@univerjs/sheets-conditional-formatting-ui 0.1.6

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.
Files changed (50) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +30 -0
  3. package/lib/cjs/index.js +11 -0
  4. package/lib/es/index.js +7516 -0
  5. package/lib/index.css +1 -0
  6. package/lib/types/commands/commands/add-average-cf.command.d.ts +11 -0
  7. package/lib/types/commands/commands/add-cf.command.d.ts +9 -0
  8. package/lib/types/commands/commands/add-color-scale-cf.command.d.ts +10 -0
  9. package/lib/types/commands/commands/add-data-bar-cf.command.d.ts +14 -0
  10. package/lib/types/commands/commands/add-duplicate-values-cf.command.d.ts +10 -0
  11. package/lib/types/commands/commands/add-number-cf.command.d.ts +12 -0
  12. package/lib/types/commands/commands/add-rank-cf.command.d.ts +13 -0
  13. package/lib/types/commands/commands/add-text-cf.command.d.ts +12 -0
  14. package/lib/types/commands/commands/add-time-period-cf.command.d.ts +11 -0
  15. package/lib/types/commands/commands/add-unique-values-cf.command.d.ts +10 -0
  16. package/lib/types/commands/commands/clear-range-cf.command.d.ts +8 -0
  17. package/lib/types/commands/commands/clear-worksheet-cf.command.d.ts +7 -0
  18. package/lib/types/commands/commands/delete-cf.command.d.ts +8 -0
  19. package/lib/types/commands/commands/move-cf.command.d.ts +10 -0
  20. package/lib/types/commands/commands/set-cf.command.d.ts +9 -0
  21. package/lib/types/commands/operations/open-conditional-formatting-panel.d.ts +15 -0
  22. package/lib/types/components/color-picker/index.d.ts +12 -0
  23. package/lib/types/components/conditional-style-editor/index.d.ts +10 -0
  24. package/lib/types/components/panel/index.d.ts +8 -0
  25. package/lib/types/components/panel/rule-edit/colorScale.d.ts +4 -0
  26. package/lib/types/components/panel/rule-edit/dataBar.d.ts +4 -0
  27. package/lib/types/components/panel/rule-edit/formula.d.ts +4 -0
  28. package/lib/types/components/panel/rule-edit/highlightCell.d.ts +5 -0
  29. package/lib/types/components/panel/rule-edit/iconSet.d.ts +5 -0
  30. package/lib/types/components/panel/rule-edit/index.d.ts +9 -0
  31. package/lib/types/components/panel/rule-edit/rank.d.ts +4 -0
  32. package/lib/types/components/panel/rule-edit/type.d.ts +13 -0
  33. package/lib/types/components/panel/rule-list/index.d.ts +9 -0
  34. package/lib/types/components/preview/index.d.ts +6 -0
  35. package/lib/types/controllers/cf.auto-fill.controller.d.ts +14 -0
  36. package/lib/types/controllers/cf.clear.controller.d.ts +14 -0
  37. package/lib/types/controllers/cf.copy-paste.controller.d.ts +17 -0
  38. package/lib/types/controllers/cf.editor.controller.d.ts +15 -0
  39. package/lib/types/controllers/cf.i18n.controller.d.ts +10 -0
  40. package/lib/types/controllers/cf.menu.controller.d.ts +16 -0
  41. package/lib/types/controllers/cf.ref-range.controller.d.ts +15 -0
  42. package/lib/types/controllers/cf.render.controller.d.ts +19 -0
  43. package/lib/types/index.d.ts +17 -0
  44. package/lib/types/locale/en-US.d.ts +4 -0
  45. package/lib/types/locale/index.d.ts +17 -0
  46. package/lib/types/locale/zh-CN.d.ts +169 -0
  47. package/lib/types/menu/manage-rule.d.ts +4 -0
  48. package/lib/types/plugin.d.ts +11 -0
  49. package/lib/umd/index.js +11 -0
  50. package/package.json +107 -0
@@ -0,0 +1,11 @@
1
+ "use strict";var Ii=Object.defineProperty;var wi=(e,t,n)=>t in e?Ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var it=(e,t,n)=>(wi(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@univerjs/core"),V=require("@wendellhu/redi"),s=require("@univerjs/sheets-conditional-formatting"),ee=require("@univerjs/sheets"),Ce=require("@univerjs/ui"),ye=require("rxjs"),Oe=require("rxjs/operators"),_=require("react"),B=require("@univerjs/design"),Q=require("@wendellhu/redi/react-bindings"),to=require("@univerjs/engine-formula"),Ue=require("clsx"),no=require("react-dom"),ge=require("@univerjs/sheets-ui"),Ti=require("@univerjs/engine-render"),_i={type:S.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(S.ICommandService),u=e.get(S.IUniverInstanceService).getCurrentUniverSheetInstance(),d=u.getActiveSheet(),p=u.getUnitId(),h=d.getSheetId(),v=a.createCfId(p,h),b={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:i,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:p,subUnitId:h,rule:b})}},xi={type:S.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(S.ICommandService),l=e.get(S.IUniverInstanceService).getCurrentUniverSheetInstance(),u=l.getActiveSheet(),d=l.getUnitId(),p=u.getSheetId(),h=i.createCfId(d,p),v={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.colorScale,config:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:p,rule:v})}},Oi={type:S.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c,stopIfTrue:l}=t,u=e.get(s.ConditionalFormattingRuleModel),d=e.get(S.IUniverInstanceService),p=e.get(S.ICommandService),h=d.getCurrentUniverSheetInstance(),v=h.getActiveSheet(),b=h.getUnitId(),C=v.getSheetId(),T=u.createCfId(b,C),I={ranges:n,cfId:T,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,config:{min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c}}};return p.executeCommand(s.AddConditionalRuleMutation.id,{unitId:b,subUnitId:C,rule:I})}},Mi={type:S.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(S.ICommandService),l=e.get(S.IUniverInstanceService).getCurrentUniverSheetInstance(),u=l.getActiveSheet(),d=l.getUnitId(),p=u.getSheetId(),h=i.createCfId(d,p),v={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:p,rule:v})}},Di={type:S.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(S.ICommandService),d=e.get(S.IUniverInstanceService).getCurrentUniverSheetInstance(),p=d.getActiveSheet(),h=d.getUnitId(),v=p.getSheetId(),b=c.createCfId(h,v);let C;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(i)){const T=a;if(T.length!==2||!Array.isArray(T))return!1;C={ranges:n,cfId:b,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:T}}}else{const T=a;if(typeof T!="number")return!1;C={ranges:n,cfId:b,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:T}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:v,rule:C})}},Ei={type:S.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,isPercent:i,isBottom:a,value:c}=t,l=e.get(s.ConditionalFormattingRuleModel),u=e.get(S.IUniverInstanceService),d=e.get(S.ICommandService),p=u.getCurrentUniverSheetInstance(),h=p.getActiveSheet(),v=p.getUnitId(),b=h.getSheetId(),C=l.createCfId(v,b),T={ranges:n,cfId:C,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:i,isBottom:a,style:r,value:c}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:v,subUnitId:b,rule:T})}},Pi={type:S.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),u=e.get(S.IUniverInstanceService).getCurrentUniverSheetInstance(),d=e.get(S.ICommandService),p=u.getActiveSheet(),h=u.getUnitId(),v=p.getSheetId(),b=c.createCfId(h,v),C={ranges:n,cfId:b,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:i,style:r,value:a}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:v,rule:C})}},Ni={type:S.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(S.IUniverInstanceService),l=e.get(S.ICommandService),u=c.getCurrentUniverSheetInstance(),d=u.getActiveSheet(),p=u.getUnitId(),h=d.getSheetId(),v=a.createCfId(p,h),b={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:i,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:p,subUnitId:h,rule:b})}},Fi={type:S.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(S.IUniverInstanceService),c=e.get(S.ICommandService),l=a.getCurrentUniverSheetInstance(),u=l.getActiveSheet(),d=l.getUnitId(),p=u.getSheetId(),h=i.createCfId(d,p),v={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:p,rule:v})}},ro={type:S.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var T,I,m;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(S.IUniverInstanceService),o=e.get(S.ICommandService),i=r.getCurrentUniverSheetInstance(),a=e.get(S.IUndoRedoService),c=e.get(ee.SelectionManagerService),l=i.getActiveSheet(),u=(T=t.unitId)!=null?T:i.getUnitId(),d=(I=t.subUnitId)!=null?I:l.getSheetId(),p=((m=c.getSelections())==null?void 0:m.map(y=>y.range))||[],h=n.getSubunitRules(u,d);if(!(h!=null&&h.length)||!p.length)return!1;const v=[],b=[];h.forEach(y=>{const R=new S.ObjectMatrix;y.ranges.forEach(w=>{S.Range.foreach(w,(x,E)=>{R.setValue(x,E,1)})}),p.forEach(w=>{S.Range.foreach(w,(x,E)=>{R.realDeleteValue(x,E)})});const g=ee.findAllRectangle(ee.createTopMatrixFromMatrix(R));if(g.length){const w={...y,ranges:g},x={unitId:u,subUnitId:d,rule:w},E=s.setConditionalRuleMutationUndoFactory(e,x);v.push({id:s.SetConditionalRuleMutation.id,params:x}),b.push(...E)}else{const w={unitId:u,subUnitId:d,cfId:y.cfId},x=s.DeleteConditionalRuleMutationUndoFactory(e,w);v.push({id:s.DeleteConditionalRuleMutation.id,params:w}),b.push(...x)}});const C=S.sequenceExecute(v,o).result;return C&&a.pushUndoRedo({unitID:u,redoMutations:v,undoMutations:b}),C}},qn={type:S.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){var C,T;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(S.IUniverInstanceService),o=e.get(S.ICommandService),i=r.getCurrentUniverSheetInstance(),a=e.get(S.IUndoRedoService),c=i.getActiveSheet(),l=(C=t==null?void 0:t.unitId)!=null?C:i.getUnitId(),u=(T=t==null?void 0:t.subUnitId)!=null?T:c.getSheetId(),d=n.getSubunitRules(l,u);if(!(d!=null&&d.length))return!1;const p=d.map(I=>({cfId:I.cfId,unitId:l,subUnitId:u})),h=p.map(I=>({id:s.DeleteConditionalRuleMutation.id,params:I})),v=p.map(I=>s.DeleteConditionalRuleMutationUndoFactory(e,I)[0]),b=S.sequenceExecute(h,o).result;return b&&a.pushUndoRedo({unitID:l,redoMutations:h,undoMutations:v}),b}};var we=function(){return we=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},we.apply(this,arguments)},$i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},et=_.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,i=e.extend,a=$i(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),l=_.useRef("_".concat(ki()));return oo(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},we({ref:t,className:c},a),i)});function oo(e,t,n,r,o){return _.createElement(e.tag,we(we({key:t},ji(e,n,o)),r),(Li(e,n).children||[]).map(function(i,a){return oo(i,"".concat(t,"-").concat(e.tag,"-").concat(a),n,void 0,o)}))}function ji(e,t,n){var r=we({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(i){var a=i[0],c=i[1];typeof c=="string"&&(r[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Li(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)?we(we({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?we(we({},o),{attrs:we(we({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function ki(){return Math.random().toString(36).substring(2,8)}et.displayName="UniverIcon";var Ai={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M5.59 1.51H10.46V14.459999999999999H5.59z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.34863 2.53325C1.34863 1.87051 1.88589 1.33325 2.54863 1.33325H13.482C14.1447 1.33325 14.682 1.87051 14.682 2.53325V13.4666C14.682 14.1294 14.1447 14.6666 13.482 14.6666H2.54863C1.88589 14.6666 1.34863 14.1294 1.34863 13.4666V2.53325ZM13.082 2.63325C13.2477 2.63325 13.382 2.76757 13.382 2.93325V5.09946C13.382 5.26515 13.2477 5.39946 13.082 5.39946H10.9708C10.8052 5.39946 10.6708 5.26515 10.6708 5.09946V2.93325C10.6708 2.76757 10.8052 2.63325 10.9708 2.63325H13.082ZM9.37085 2.93325C9.37085 2.76757 9.23653 2.63325 9.07085 2.63325H6.95974C6.79406 2.63325 6.65974 2.76757 6.65974 2.93325V5.09946C6.65974 5.26515 6.79406 5.39946 6.95974 5.39946L9.07085 5.39946C9.23654 5.39946 9.37085 5.26515 9.37085 5.09946V2.93325ZM5.35974 2.93325C5.35974 2.76757 5.22543 2.63325 5.05974 2.63325H2.94863C2.78295 2.63325 2.64863 2.76757 2.64863 2.93325V5.09946C2.64863 5.26515 2.78295 5.39946 2.94863 5.39946H5.05974C5.22543 5.39946 5.35974 5.26515 5.35974 5.09946V2.93325ZM2.94863 6.69946C2.78295 6.69946 2.64863 6.83378 2.64863 6.99946V9.11045C2.64863 9.27613 2.78295 9.41045 2.94863 9.41045H5.05974C5.22543 9.41045 5.35974 9.27613 5.35974 9.11045V6.99946C5.35974 6.83378 5.22543 6.69946 5.05974 6.69946H2.94863ZM2.94863 10.7104C2.78295 10.7104 2.64863 10.8448 2.64863 11.0104V13.0666C2.64863 13.2323 2.78295 13.3666 2.94863 13.3666H5.05974C5.22543 13.3666 5.35974 13.2323 5.35974 13.0666V11.0104C5.35974 10.8448 5.22543 10.7104 5.05974 10.7104H2.94863ZM6.65974 13.0666C6.65974 13.2323 6.79406 13.3666 6.95974 13.3666H9.07085C9.23653 13.3666 9.37085 13.2323 9.37085 13.0666V11.0104C9.37085 10.8448 9.23653 10.7104 9.07085 10.7104L6.95974 10.7104C6.79406 10.7104 6.65974 10.8448 6.65974 11.0104V13.0666ZM10.6708 13.0666C10.6708 13.2323 10.8052 13.3666 10.9708 13.3666H13.082C13.2477 13.3666 13.382 13.2323 13.382 13.0666V11.0104C13.382 10.8448 13.2477 10.7104 13.082 10.7104H10.9708C10.8052 10.7104 10.6708 10.8448 10.6708 11.0104V13.0666ZM13.082 9.41045C13.2477 9.41045 13.382 9.27613 13.382 9.11045V6.99946C13.382 6.83378 13.2477 6.69946 13.082 6.69946H10.9708C10.8052 6.69946 10.6708 6.83378 10.6708 6.99946V9.11045C10.6708 9.27613 10.8052 9.41045 10.9708 9.41045H13.082ZM6.95974 9.41045C6.79406 9.41045 6.65974 9.27613 6.65974 9.11045V6.99946C6.65974 6.83378 6.79406 6.69946 6.95974 6.69946L9.07085 6.69946C9.23653 6.69946 9.37085 6.83378 9.37085 6.99946V9.11045C9.37085 9.27613 9.23653 9.41045 9.07085 9.41045H6.95974Z",fillRule:"evenodd",clipRule:"evenodd"}}]},io=_.forwardRef(function(e,t){return _.createElement(et,Object.assign({},e,{id:"conditions",ref:t,icon:Ai}))});io.displayName="Conditions";const Vi=io;var zi={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"}}]},ao=_.forwardRef(function(e,t){return _.createElement(et,Object.assign({},e,{id:"delete-single",ref:t,icon:zi}))});ao.displayName="DeleteSingle";const Sn=ao;var Ui={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"}}]}]},so=_.forwardRef(function(e,t){return _.createElement(et,Object.assign({},e,{id:"increase-single",ref:t,icon:Ui}))});so.displayName="IncreaseSingle";const Wi=so;var qi={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"}}]}]},lo=_.forwardRef(function(e,t){return _.createElement(et,Object.assign({},e,{id:"more-down-single",ref:t,icon:qi}))});lo.displayName="MoreDownSingle";const Hn=lo;var Hi={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"}}]}]},co=_.forwardRef(function(e,t){return _.createElement(et,Object.assign({},e,{id:"sequence-single",ref:t,icon:Hi}))});co.displayName="SequenceSingle";const Bi=co;var Gi={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"}}]}]},uo=_.forwardRef(function(e,t){return _.createElement(et,Object.assign({},e,{id:"slash-single",ref:t,icon:Gi}))});uo.displayName="SlashSingle";const Jt=uo,Xi=e=>{const t="conditional-formatting-menu-icon";return e.register(t,Vi),n=>{const r=n.get(S.LocaleService),o=n.get(ee.SelectionManagerService),i=n.get(S.ICommandService),a=n.get(S.IUniverInstanceService),c=n.get(s.ConditionalFormattingRuleModel),l=n.get(Ce.IZenZoneService),u=[ee.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],d=new ye.Observable(b=>ye.merge(o.selectionMoveEnd$,new ye.Observable(C=>{const T=i.onCommandExecuted(I=>{const{id:m,params:y}=I,R=a.getCurrentUniverSheetInstance().getUnitId();u.includes(m)&&y.unitId===R&&C.next(null)});return()=>T.dispose()})).pipe(Oe.debounceTime(16)).subscribe(()=>{var R;const C=((R=o.getSelections())==null?void 0:R.map(g=>g.range))||[],T=a.getCurrentUniverSheetInstance().getUnitId(),I=a.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),y=(c.getSubunitRules(T,I)||[]).filter(g=>g.ranges.some(w=>C.some(x=>S.Rectangle.intersects(x,w))));b.next(!!y.length)})),p=new ye.Observable(b=>ye.merge(o.selectionMoveEnd$,new ye.Observable(C=>{const T=i.onCommandExecuted(I=>{const{id:m,params:y}=I,R=a.getCurrentUniverSheetInstance().getUnitId();u.includes(m)&&y.unitId===R&&C.next(null)});return()=>T.dispose()})).pipe(Oe.debounceTime(16)).subscribe(()=>{const C=a.getCurrentUniverSheetInstance().getUnitId(),T=a.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),I=c.getSubunitRules(C,T)||[];b.next(!!I.length)})),h=new ye.Observable(b=>{const C=[{label:r.t("sheet.cf.ruleType.highlightCell"),value:be.highlightCell},{label:r.t("sheet.cf.panel.rankAndAverage"),value:be.rank},{label:r.t("sheet.cf.ruleType.formula"),value:be.formula},{label:r.t("sheet.cf.ruleType.colorScale"),value:be.colorScale},{label:r.t("sheet.cf.ruleType.dataBar"),value:be.dataBar},{label:r.t("sheet.cf.ruleType.iconSet"),value:be.icon},{label:r.t("sheet.cf.menu.manageConditionalFormatting"),value:be.viewRule},{label:r.t("sheet.cf.menu.createConditionalFormatting"),value:be.createRule},{label:r.t("sheet.cf.menu.clearRangeRules"),value:be.clearRangeRules,disabled:!d},{label:r.t("sheet.cf.menu.clearWorkSheetRules"),value:be.clearWorkSheetRules}];d.subscribe(T=>{const I=C.find(m=>m.value===be.clearRangeRules);I&&(I.disabled=!T,b.next(C))}),p.subscribe(T=>{const I=C.find(m=>m.value===be.clearWorkSheetRules);I&&(I.disabled=!T,b.next(C))}),b.next(C)}),v=new ye.Observable(b=>{const C=l.visible$.subscribe(T=>{b.next(T)});return()=>{C.unsubscribe()}});return{id:bi.id,type:Ce.MenuItemType.SELECTOR,group:Ce.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[Ce.MenuPosition.TOOLBAR_START],icon:t,tooltip:r.t("sheet.cf.title"),selections:h,hidden$:v}}};var ke=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Yi(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var fo={exports:{}},Qt={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Ki=_,Zi=Symbol.for("react.element"),Ji=Symbol.for("react.fragment"),Qi=Object.prototype.hasOwnProperty,ea=Ki.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ta={key:!0,ref:!0,__self:!0,__source:!0};function ho(e,t,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Qi.call(t,r)&&!ta.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:Zi,type:e,key:i,ref:a,props:o,_owner:ea.current}}Qt.Fragment=Ji;Qt.jsx=ho;Qt.jsxs=ho;fo.exports=Qt;var f=fo.exports;const na="univer-conditional-formatting-wrap",ra="univer-cf-rule-item",oa="univer-preview",ia="univer-create-rule",aa="univer-button",sa="univer-title",la="univer-label",ca="univer-label-container",ua="univer-input-width",da="univer-m-t-base",fa="univer-m-t-sm",ha="univer-m-t-xl",pa="univer-m-l-sm",ga="univer-m-l-xl",ma="univer-m-l-xxs",va="univer-m-l-0",ya="univer-m-r-0",M={conditionalFormattingWrap:na,cfRuleItem:ra,preview:oa,createRule:ia,button:aa,title:sa,label:la,labelContainer:ca,inputWidth:ua,mTBase:da,mTSm:fa,mTXl:ha,mLSm:pa,mLXl:ga,mLXxs:ma,mL0:va,mR0:ya};var po={exports:{}},Mt={},Pn={exports:{}};(function(e,t){(function(n,r){r(t)})(ke,function(n){function r(P){return function(Z,X,Y,oe,ue,Ie,ie){return P(Z,X,ie)}}function o(P){return function(Z,X,Y,oe){if(!Z||!X||typeof Z!="object"||typeof X!="object")return P(Z,X,Y,oe);var ue=oe.get(Z),Ie=oe.get(X);if(ue&&Ie)return ue===X&&Ie===Z;oe.set(Z,X),oe.set(X,Z);var ie=P(Z,X,Y,oe);return oe.delete(Z),oe.delete(X),ie}}function i(P,A){var Z={};for(var X in P)Z[X]=P[X];for(var X in A)Z[X]=A[X];return Z}function a(P){return P.constructor===Object||P.constructor==null}function c(P){return typeof P.then=="function"}function l(P,A){return P===A||P!==P&&A!==A}var u="[object Arguments]",d="[object Boolean]",p="[object Date]",h="[object RegExp]",v="[object Map]",b="[object Number]",C="[object Object]",T="[object Set]",I="[object String]",m=Object.prototype.toString;function y(P){var A=P.areArraysEqual,Z=P.areDatesEqual,X=P.areMapsEqual,Y=P.areObjectsEqual,oe=P.areRegExpsEqual,ue=P.areSetsEqual,Ie=P.createIsNestedEqual,ie=Ie(De);function De(te,ae,Ee){if(te===ae)return!0;if(!te||!ae||typeof te!="object"||typeof ae!="object")return te!==te&&ae!==ae;if(a(te)&&a(ae))return Y(te,ae,ie,Ee);var Ir=Array.isArray(te),wr=Array.isArray(ae);if(Ir||wr)return Ir===wr&&A(te,ae,ie,Ee);var Pe=m.call(te);return Pe!==m.call(ae)?!1:Pe===p?Z(te,ae,ie,Ee):Pe===h?oe(te,ae,ie,Ee):Pe===v?X(te,ae,ie,Ee):Pe===T?ue(te,ae,ie,Ee):Pe===C||Pe===u?c(te)||c(ae)?!1:Y(te,ae,ie,Ee):Pe===d||Pe===b||Pe===I?l(te.valueOf(),ae.valueOf()):!1}return De}function R(P,A,Z,X){var Y=P.length;if(A.length!==Y)return!1;for(;Y-- >0;)if(!Z(P[Y],A[Y],Y,Y,P,A,X))return!1;return!0}var g=o(R);function w(P,A){return l(P.valueOf(),A.valueOf())}function x(P,A,Z,X){var Y=P.size===A.size;if(!Y)return!1;if(!P.size)return!0;var oe={},ue=0;return P.forEach(function(Ie,ie){if(Y){var De=!1,te=0;A.forEach(function(ae,Ee){!De&&!oe[te]&&(De=Z(ie,Ee,ue,te,P,A,X)&&Z(Ie,ae,ie,Ee,P,A,X))&&(oe[te]=!0),te++}),ue++,Y=De}}),Y}var E=o(x),k="_owner",W=Object.prototype.hasOwnProperty;function O(P,A,Z,X){var Y=Object.keys(P),oe=Y.length;if(Object.keys(A).length!==oe)return!1;for(var ue;oe-- >0;){if(ue=Y[oe],ue===k){var Ie=!!P.$$typeof,ie=!!A.$$typeof;if((Ie||ie)&&Ie!==ie)return!1}if(!W.call(A,ue)||!Z(P[ue],A[ue],ue,ue,P,A,X))return!1}return!0}var $=o(O);function D(P,A){return P.source===A.source&&P.flags===A.flags}function F(P,A,Z,X){var Y=P.size===A.size;if(!Y)return!1;if(!P.size)return!0;var oe={};return P.forEach(function(ue,Ie){if(Y){var ie=!1,De=0;A.forEach(function(te,ae){!ie&&!oe[De]&&(ie=Z(ue,te,Ie,ae,P,A,X))&&(oe[De]=!0),De++}),Y=ie}}),Y}var j=o(F),H=Object.freeze({areArraysEqual:R,areDatesEqual:w,areMapsEqual:x,areObjectsEqual:O,areRegExpsEqual:D,areSetsEqual:F,createIsNestedEqual:r}),K=Object.freeze({areArraysEqual:g,areDatesEqual:w,areMapsEqual:E,areObjectsEqual:$,areRegExpsEqual:D,areSetsEqual:j,createIsNestedEqual:r}),se=y(H);function ne(P,A){return se(P,A,void 0)}var le=y(i(H,{createIsNestedEqual:function(){return l}}));function Te(P,A){return le(P,A,void 0)}var _e=y(K);function Me(P,A){return _e(P,A,new WeakMap)}var Pt=y(i(K,{createIsNestedEqual:function(){return l}}));function yn(P,A){return Pt(P,A,new WeakMap)}function Cn(P){return y(i(H,P(H)))}function Ri(P){var A=y(i(K,P(K)));return function(Z,X,Y){return Y===void 0&&(Y=new WeakMap),A(Z,X,Y)}}n.circularDeepEqual=Me,n.circularShallowEqual=yn,n.createCustomCircularEqual=Ri,n.createCustomEqual=Cn,n.deepEqual=ne,n.sameValueZeroEqual=l,n.shallowEqual=Te,Object.defineProperty(n,"__esModule",{value:!0})})})(Pn,Pn.exports);var Gn=Pn.exports,q={},Ca=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(q,"__esModule",{value:!0});q.bottom=Xn;q.childrenEqual=Ra;q.cloneLayout=go;q.cloneLayoutItem=Ke;q.collides=en;q.compact=vo;q.compactItem=yo;q.compactType=ja;q.correctBounds=Co;q.fastPositionEqual=Ia;q.fastRGLPropsEqual=void 0;q.getAllCollisions=So;q.getFirstCollision=Xe;q.getLayoutItem=Yn;q.getStatics=Kn;q.modifyLayout=mo;q.moveElement=wt;q.moveElementAwayFromCollision=Fn;q.noop=void 0;q.perc=Ta;q.resizeItemInDirection=Ea;q.setTopLeft=Na;q.setTransform=Pa;q.sortLayoutItems=nr;q.sortLayoutItemsByColRow=To;q.sortLayoutItemsByRowCol=wo;q.synchronizeLayoutWithChildren=Fa;q.validateLayout=$a;q.withLayoutItem=ba;var Tr=Gn,It=Sa(_);function Sa(e){return e&&e.__esModule?e:{default:e}}function Xn(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function go(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Ke(e[n]);return t}function mo(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function ba(e,t,n){let r=Yn(e,t);return r?(r=n(Ke(r)),e=mo(e,r),[e,r]):[e,null]}function Ke(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 Ra(e,t){return(0,Tr.deepEqual)(It.default.Children.map(e,n=>n==null?void 0:n.key),It.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,Tr.deepEqual)(It.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),It.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}q.fastRGLPropsEqual=Ca;function Ia(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function en(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 vo(e,t,n,r){const o=Kn(e),i=nr(e,t),a=Array(e.length);for(let c=0,l=i.length;c<l;c++){let u=Ke(i[c]);u.static||(u=yo(o,u,t,n,i,r),o.push(u)),a[e.indexOf(i[c])]=u,u.moved=!1}return a}const wa={x:"w",y:"h"};function Nn(e,t,n,r){const o=wa[r];t[r]+=1;const i=e.map(a=>a.i).indexOf(t.i);for(let a=i+1;a<e.length;a++){const c=e[a];if(!c.static){if(c.y>t.y+t.h)break;en(t,c)&&Nn(e,c,n+t[o],r)}}t[r]=n}function yo(e,t,n,r,o,i){const a=n==="vertical",c=n==="horizontal";if(a)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&&i);)if(c?Nn(o,t,l.x+l.w,"x"):Nn(o,t,l.y+l.h,"y"),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Xe(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function Co(e,t){const n=Kn(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;Xe(n,i);)i.y++}return e}function Yn(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Xe(e,t){for(let n=0,r=e.length;n<r;n++)if(en(e[n],t))return e[n]}function So(e,t){return e.filter(n=>en(n,t))}function Kn(e){return e.filter(t=>t.static)}function wt(e,t,n,r,o,i,a,c,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;const u=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let p=nr(e,a);(a==="vertical"&&typeof r=="number"?d>=r:a==="horizontal"&&typeof n=="number"?u>=n:!1)&&(p=p.reverse());const v=So(p,t),b=v.length>0;if(b&&l)return go(e);if(b&&i)return`${t.i}`,t.x=u,t.y=d,t.moved=!1,e;for(let C=0,T=v.length;C<T;C++){const I=v[C];`${t.i}${t.x}${t.y}${I.i}${I.x}${I.y}`,!I.moved&&(I.static?e=Fn(e,I,t,o,a):e=Fn(e,t,I,o,a))}return e}function Fn(e,t,n,r,o,i){const a=o==="horizontal",c=o==="vertical",l=t.static;if(r){r=!1;const p={x:a?Math.max(t.x-n.w,0):n.x,y:c?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},h=Xe(e,p),v=h&&h.y+h.h>t.y,b=h&&t.x+t.w>h.x;if(h){if(v&&c)return wt(e,n,void 0,t.y+1,r,l,o);if(v&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(b&&a)return wt(e,t,n.x,void 0,r,l,o)}else return`${n.i}${p.x}${p.y}`,wt(e,n,a?p.x:void 0,c?p.y:void 0,r,l,o)}const u=a?n.x+1:void 0,d=c?n.y+1:void 0;return u==null&&d==null?e:wt(e,n,a?n.x+1:void 0,c?n.y+1:void 0,r,l,o)}function Ta(e){return e*100+"%"}const bo=(e,t,n,r)=>e+n>r?t:n,Ro=(e,t,n)=>e<0?t:n,Io=e=>Math.max(0,e),Zn=e=>Math.max(0,e),Jn=(e,t,n)=>{let{left:r,height:o,width:i}=t;const a=e.top-(o-e.height);return{left:r,width:i,height:Ro(a,e.height,o),top:Zn(a)}},Qn=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{top:r,height:i,width:bo(e.left,e.width,a,n),left:Io(o)}},er=(e,t,n)=>{let{top:r,height:o,width:i}=t;const a=e.left-(i-e.width);return{height:o,width:a<0?e.width:bo(e.left,e.width,i,n),top:Zn(r),left:Io(a)}},tr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{width:a,left:o,height:Ro(r,e.height,i),top:Zn(r)}},_a=function(){return Jn(arguments.length<=0?void 0:arguments[0],Qn(...arguments))},xa=function(){return Jn(arguments.length<=0?void 0:arguments[0],er(...arguments))},Oa=function(){return tr(arguments.length<=0?void 0:arguments[0],Qn(...arguments))},Ma=function(){return tr(arguments.length<=0?void 0:arguments[0],er(...arguments))},Da={n:Jn,ne:_a,e:Qn,se:Oa,s:tr,sw:Ma,w:er,nw:xa};function Ea(e,t,n,r){const o=Da[e];return o?o(t,{...t,...n},r):n}function Pa(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function Na(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function nr(e,t){return t==="horizontal"?To(e):t==="vertical"?wo(e):e}function wo(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function To(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 Fa(e,t,n,r,o){e=e||[];const i=[];It.default.Children.forEach(t,c=>{if((c==null?void 0:c.key)==null)return;const l=Yn(e,String(c.key)),u=c.props["data-grid"];l&&u==null?i.push(Ke(l)):u?i.push(Ke({...u,i:c.key})):i.push(Ke({w:1,h:1,x:0,y:Xn(i),i:String(c.key)}))});const a=Co(i,{cols:n});return o?a:vo(a,r,n)}function $a(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let a=0;a<n.length;a++)if(typeof i[n[a]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[a]+" must be a number!")}}function ja(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const La=()=>{};q.noop=La;var Fe={};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.calcGridColWidth=tn;Fe.calcGridItemPosition=ka;Fe.calcGridItemWHPx=$n;Fe.calcWH=Va;Fe.calcXY=Aa;Fe.clamp=Ye;function tn(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function $n(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function ka(e,t,n,r,o,i){const{margin:a,containerPadding:c,rowHeight:l}=e,u=tn(e),d={};return i&&i.resizing?(d.width=Math.round(i.resizing.width),d.height=Math.round(i.resizing.height)):(d.width=$n(r,u,a[0]),d.height=$n(o,l,a[1])),i&&i.dragging?(d.top=Math.round(i.dragging.top),d.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(d.top=Math.round(i.resizing.top),d.left=Math.round(i.resizing.left)):(d.top=Math.round((l+a[1])*n+c[1]),d.left=Math.round((u+a[0])*t+c[0])),d}function Aa(e,t,n,r,o){const{margin:i,cols:a,rowHeight:c,maxRows:l}=e,u=tn(e);let d=Math.round((n-i[0])/(u+i[0])),p=Math.round((t-i[1])/(c+i[1]));return d=Ye(d,0,a-r),p=Ye(p,0,l-o),{x:d,y:p}}function Va(e,t,n,r,o,i){const{margin:a,maxRows:c,cols:l,rowHeight:u}=e,d=tn(e);let p=Math.round((t+a[0])/(d+a[0])),h=Math.round((n+a[1])/(u+a[1])),v=Ye(p,0,l-r),b=Ye(h,0,c-o);return["sw","w","nw"].indexOf(i)!==-1&&(v=Ye(p,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(b=Ye(h,0,c)),{w:v,h:b}}function Ye(e,t,n){return Math.max(Math.min(e,n),t)}var nn={},_o={exports:{}},za="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Ua=za,Wa=Ua;function xo(){}function Oo(){}Oo.resetWarningCache=xo;var qa=function(){function e(r,o,i,a,c,l){if(l!==Wa){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:Oo,resetWarningCache:xo};return n.PropTypes=n,n};_o.exports=qa();var We=_o.exports,rn={exports:{}},Mo={},re={},$e={};Object.defineProperty($e,"__esModule",{value:!0});$e.dontSetMe=Ya;$e.findInArray=Ha;$e.int=Xa;$e.isFunction=Ba;$e.isNum=Ga;function Ha(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function Ba(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Ga(e){return typeof e=="number"&&!isNaN(e)}function Xa(e){return parseInt(e,10)}function Ya(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 tt={};Object.defineProperty(tt,"__esModule",{value:!0});tt.browserPrefixToKey=Eo;tt.browserPrefixToStyle=Ka;tt.default=void 0;tt.getPrefix=Do;const bn=["Moz","Webkit","O","ms"];function Do(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let r=0;r<bn.length;r++)if(Eo(t,bn[r])in n)return bn[r];return""}function Eo(e,t){return t?"".concat(t).concat(Za(e)):e}function Ka(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Za(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}tt.default=Do();Object.defineProperty(re,"__esModule",{value:!0});re.addClassName=Fo;re.addEvent=es;re.addUserSelectStyles=ds;re.createCSSTransform=ss;re.createSVGTransform=ls;re.getTouch=cs;re.getTouchIdentifier=us;re.getTranslation=rr;re.innerHeight=os;re.innerWidth=is;re.matchesSelector=No;re.matchesSelectorAndParentsTo=Qa;re.offsetXYFromParent=as;re.outerHeight=ns;re.outerWidth=rs;re.removeClassName=$o;re.removeEvent=ts;re.removeUserSelectStyles=fs;var Re=$e,_r=Ja(tt);function Po(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Po=function(r){return r?n:t})(e)}function Ja(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Po(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}let Nt="";function No(e,t){return Nt||(Nt=(0,Re.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,Re.isFunction)(e[n])})),(0,Re.isFunction)(e[Nt])?e[Nt](t):!1}function Qa(e,t,n){let r=e;do{if(No(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function es(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function ts(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function ns(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Re.int)(n.borderTopWidth),t+=(0,Re.int)(n.borderBottomWidth),t}function rs(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Re.int)(n.borderLeftWidth),t+=(0,Re.int)(n.borderRightWidth),t}function os(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Re.int)(n.paddingTop),t-=(0,Re.int)(n.paddingBottom),t}function is(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Re.int)(n.paddingLeft),t-=(0,Re.int)(n.paddingRight),t}function as(e,t,n){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-o.left)/n,a=(e.clientY+t.scrollTop-o.top)/n;return{x:i,y:a}}function ss(e,t){const n=rr(e,t,"px");return{[(0,_r.browserPrefixToKey)("transform",_r.default)]:n}}function ls(e,t){return rr(e,t,"")}function rr(e,t,n){let{x:r,y:o}=e,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){const a="".concat(typeof t.x=="string"?t.x:t.x+n),c="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(a,", ").concat(c,")")+i}return i}function cs(e,t){return e.targetTouches&&(0,Re.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,Re.findInArray)(e.changedTouches,n=>t===n.identifier)}function us(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function ds(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
+ `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
11
+ `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Fo(e.body,"react-draggable-transparent-selection")}function fs(e){if(e)try{if(e.body&&$o(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 Fo(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function $o(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var je={};Object.defineProperty(je,"__esModule",{value:!0});je.canDragX=gs;je.canDragY=ms;je.createCoreData=ys;je.createDraggableData=Cs;je.getBoundPosition=hs;je.getControlPosition=vs;je.snapToGrid=ps;var Se=$e,ut=re;function hs(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:Ss(r);const o=or(e);if(typeof r=="string"){const{ownerDocument:i}=o,a=i.defaultView;let c;if(r==="parent"?c=o.parentNode:c=i.querySelector(r),!(c instanceof a.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=c,u=a.getComputedStyle(o),d=a.getComputedStyle(l);r={left:-o.offsetLeft+(0,Se.int)(d.paddingLeft)+(0,Se.int)(u.marginLeft),top:-o.offsetTop+(0,Se.int)(d.paddingTop)+(0,Se.int)(u.marginTop),right:(0,ut.innerWidth)(l)-(0,ut.outerWidth)(o)-o.offsetLeft+(0,Se.int)(d.paddingRight)-(0,Se.int)(u.marginRight),bottom:(0,ut.innerHeight)(l)-(0,ut.outerHeight)(o)-o.offsetTop+(0,Se.int)(d.paddingBottom)-(0,Se.int)(u.marginBottom)}}return(0,Se.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,Se.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Se.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,Se.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function ps(e,t,n){const r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]}function gs(e){return e.props.axis==="both"||e.props.axis==="x"}function ms(e){return e.props.axis==="both"||e.props.axis==="y"}function vs(e,t,n){const r=typeof t=="number"?(0,ut.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const o=or(n),i=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,ut.offsetXYFromParent)(r||e,i,n.props.scale)}function ys(e,t,n){const r=!(0,Se.isNum)(e.lastX),o=or(e);return r?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Cs(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 Ss(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function or(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var on={},an={};Object.defineProperty(an,"__esModule",{value:!0});an.default=bs;function bs(){}Object.defineProperty(on,"__esModule",{value:!0});on.default=void 0;var Rn=Is(_),me=ir(We),Rs=ir(no),fe=re,Ve=je,In=$e,mt=ir(an);function ir(e){return e&&e.__esModule?e:{default:e}}function jo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(jo=function(r){return r?n:t})(e)}function Is(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=jo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function pe(e,t,n){return t=ws(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ws(e){var t=Ts(e,"string");return typeof t=="symbol"?t:String(t)}function Ts(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 xe={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let ze=xe.mouse,sn=class extends Rn.Component{constructor(){super(...arguments),pe(this,"dragging",!1),pe(this,"lastX",NaN),pe(this,"lastY",NaN),pe(this,"touchIdentifier",null),pe(this,"mounted",!1),pe(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,fe.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,fe.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const o=(0,fe.getTouchIdentifier)(t);this.touchIdentifier=o;const i=(0,Ve.getControlPosition)(t,o,this);if(i==null)return;const{x:a,y:c}=i,l=(0,Ve.createCoreData)(this,a,c);(0,mt.default)("DraggableCore: handleDragStart: %j",l),(0,mt.default)("calling",this.props.onStart),!(this.props.onStart(t,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,fe.addUserSelectStyles)(r),this.dragging=!0,this.lastX=a,this.lastY=c,(0,fe.addEvent)(r,ze.move,this.handleDrag),(0,fe.addEvent)(r,ze.stop,this.handleDragStop))}),pe(this,"handleDrag",t=>{const n=(0,Ve.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,l=o-this.lastY;if([c,l]=(0,Ve.snapToGrid)(this.props.grid,c,l),!c&&!l)return;r=this.lastX+c,o=this.lastY+l}const i=(0,Ve.createCoreData)(this,r,o);if((0,mt.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(t,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=o}),pe(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,Ve.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,u=o-this.lastY||0;[l,u]=(0,Ve.snapToGrid)(this.props.grid,l,u),r=this.lastX+l,o=this.lastY+u}const i=(0,Ve.createCoreData)(this,r,o);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,fe.removeUserSelectStyles)(c.ownerDocument),(0,mt.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,mt.default)("DraggableCore: Removing handlers"),(0,fe.removeEvent)(c.ownerDocument,ze.move,this.handleDrag),(0,fe.removeEvent)(c.ownerDocument,ze.stop,this.handleDragStop))}),pe(this,"onMouseDown",t=>(ze=xe.mouse,this.handleDragStart(t))),pe(this,"onMouseUp",t=>(ze=xe.mouse,this.handleDragStop(t))),pe(this,"onTouchStart",t=>(ze=xe.touch,this.handleDragStart(t))),pe(this,"onTouchEnd",t=>(ze=xe.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,fe.addEvent)(t,xe.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,fe.removeEvent)(n,xe.mouse.move,this.handleDrag),(0,fe.removeEvent)(n,xe.touch.move,this.handleDrag),(0,fe.removeEvent)(n,xe.mouse.stop,this.handleDragStop),(0,fe.removeEvent)(n,xe.touch.stop,this.handleDragStop),(0,fe.removeEvent)(t,xe.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,fe.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:Rs.default.findDOMNode(this)}render(){return Rn.cloneElement(Rn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};on.default=sn;pe(sn,"displayName","DraggableCore");pe(sn,"propTypes",{allowAnyClick:me.default.bool,children:me.default.node.isRequired,disabled:me.default.bool,enableUserSelectHack:me.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:me.default.arrayOf(me.default.number),handle:me.default.string,cancel:me.default.string,nodeRef:me.default.object,onStart:me.default.func,onDrag:me.default.func,onStop:me.default.func,onMouseDown:me.default.func,scale:me.default.number,className:In.dontSetMe,style:In.dontSetMe,transform:In.dontSetMe});pe(sn,"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=h(_),n=d(We),r=d(no),o=d(Ue),i=re,a=je,c=$e,l=d(on),u=d(an);function d(m){return m&&m.__esModule?m:{default:m}}function p(m){if(typeof WeakMap!="function")return null;var y=new WeakMap,R=new WeakMap;return(p=function(g){return g?R:y})(m)}function h(m,y){if(!y&&m&&m.__esModule)return m;if(m===null||typeof m!="object"&&typeof m!="function")return{default:m};var R=p(y);if(R&&R.has(m))return R.get(m);var g={},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in m)if(x!=="default"&&Object.prototype.hasOwnProperty.call(m,x)){var E=w?Object.getOwnPropertyDescriptor(m,x):null;E&&(E.get||E.set)?Object.defineProperty(g,x,E):g[x]=m[x]}return g.default=m,R&&R.set(m,g),g}function v(){return v=Object.assign?Object.assign.bind():function(m){for(var y=1;y<arguments.length;y++){var R=arguments[y];for(var g in R)Object.prototype.hasOwnProperty.call(R,g)&&(m[g]=R[g])}return m},v.apply(this,arguments)}function b(m,y,R){return y=C(y),y in m?Object.defineProperty(m,y,{value:R,enumerable:!0,configurable:!0,writable:!0}):m[y]=R,m}function C(m){var y=T(m,"string");return typeof y=="symbol"?y:String(y)}function T(m,y){if(typeof m!="object"||m===null)return m;var R=m[Symbol.toPrimitive];if(R!==void 0){var g=R.call(m,y||"default");if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return(y==="string"?String:Number)(m)}class I extends t.Component{static getDerivedStateFromProps(y,R){let{position:g}=y,{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(y){super(y),b(this,"onDragStart",(R,g)=>{if((0,u.default)("Draggable: onDragStart: %j",g),this.props.onStart(R,(0,a.createDraggableData)(this,g))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),b(this,"onDrag",(R,g)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",g);const w=(0,a.createDraggableData)(this,g),x={x:w.x,y:w.y,slackX:0,slackY:0};if(this.props.bounds){const{x:k,y:W}=x;x.x+=this.state.slackX,x.y+=this.state.slackY;const[O,$]=(0,a.getBoundPosition)(this,x.x,x.y);x.x=O,x.y=$,x.slackX=this.state.slackX+(k-x.x),x.slackY=this.state.slackY+(W-x.y),w.x=x.x,w.y=x.y,w.deltaX=x.x-this.state.x,w.deltaY=x.y-this.state.y}if(this.props.onDrag(R,w)===!1)return!1;this.setState(x)}),b(this,"onDragStop",(R,g)=>{if(!this.state.dragging||this.props.onStop(R,(0,a.createDraggableData)(this,g))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",g);const x={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:k,y:W}=this.props.position;x.x=k,x.y=W}this.setState(x)}),this.state={dragging:!1,dragged:!1,x:y.position?y.position.x:y.defaultPosition.x,y:y.position?y.position.y:y.defaultPosition.y,prevPropsPosition:{...y.position},slackX:0,slackY:0,isElementSVG:!1},y.position&&!(y.onDrag||y.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 y,R;return(y=(R=this.props)===null||R===void 0||(R=R.nodeRef)===null||R===void 0?void 0:R.current)!==null&&y!==void 0?y:r.default.findDOMNode(this)}render(){const{axis:y,bounds:R,children:g,defaultPosition:w,defaultClassName:x,defaultClassNameDragging:E,defaultClassNameDragged:k,position:W,positionOffset:O,scale:$,...D}=this.props;let F={},j=null;const K=!!!W||this.state.dragging,se=W||w,ne={x:(0,a.canDragX)(this)&&K?this.state.x:se.x,y:(0,a.canDragY)(this)&&K?this.state.y:se.y};this.state.isElementSVG?j=(0,i.createSVGTransform)(ne,O):F=(0,i.createCSSTransform)(ne,O);const le=(0,o.default)(g.props.className||"",x,{[E]:this.state.dragging,[k]:this.state.dragged});return t.createElement(l.default,v({},D,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(g),{className:le,style:{...g.props.style,...F},transform:j}))}}e.default=I,b(I,"displayName","Draggable"),b(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}),b(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})})(Mo);const{default:Lo,DraggableCore:_s}=Mo;rn.exports=Lo;rn.exports.default=Lo;rn.exports.DraggableCore=_s;var ko=rn.exports,ln={exports:{}},Dt={},ar={};ar.__esModule=!0;ar.cloneElement=Ps;var xs=Os(_);function Os(e){return e&&e.__esModule?e:{default:e}}function xr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Or(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xr(Object(n),!0).forEach(function(r){Ms(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ms(e,t,n){return t=Ds(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ds(e){var t=Es(e,"string");return typeof t=="symbol"?t:String(t)}function Es(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){return t.style&&e.props.style&&(t.style=Or(Or({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),xs.default.cloneElement(e,t)}var Et={};Et.__esModule=!0;Et.resizableProps=void 0;var z=Ns(We);function Ns(e){return e&&e.__esModule?e:{default:e}}var Fs={axis:z.default.oneOf(["both","x","y","none"]),className:z.default.string,children:z.default.element.isRequired,draggableOpts:z.default.shape({allowAnyClick:z.default.bool,cancel:z.default.string,children:z.default.node,disabled:z.default.bool,enableUserSelectHack:z.default.bool,offsetParent:z.default.node,grid:z.default.arrayOf(z.default.number),handle:z.default.string,nodeRef:z.default.object,onStart:z.default.func,onDrag:z.default.func,onStop:z.default.func,onMouseDown:z.default.func,scale:z.default.number}),height:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="y"){var i;return(i=z.default.number).isRequired.apply(i,n)}return z.default.number.apply(z.default,n)},handle:z.default.oneOfType([z.default.node,z.default.func]),handleSize:z.default.arrayOf(z.default.number),lockAspectRatio:z.default.bool,maxConstraints:z.default.arrayOf(z.default.number),minConstraints:z.default.arrayOf(z.default.number),onResizeStop:z.default.func,onResizeStart:z.default.func,onResize:z.default.func,resizeHandles:z.default.arrayOf(z.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:z.default.number,width:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="x"){var i;return(i=z.default.number).isRequired.apply(i,n)}return z.default.number.apply(z.default,n)}};Et.resizableProps=Fs;Dt.__esModule=!0;Dt.default=void 0;var vt=As(_),$s=ko,js=ar,Ls=Et,ks=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Ao(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Ao=function(o){return o?n:t})(e)}function As(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Ao(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jn.apply(this,arguments)}function Vs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Mr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function wn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mr(Object(n),!0).forEach(function(r){zs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zs(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=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)}function qs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ln(e,t)}function Ln(e,t){return Ln=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Ln(e,t)}var sr=function(e){qs(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var n=t.prototype;return n.componentWillUnmount=function(){this.resetData()},n.resetData=function(){this.lastHandleRect=this.slack=null},n.runConstraints=function(o,i){var a=this.props,c=a.minConstraints,l=a.maxConstraints,u=a.lockAspectRatio;if(!c&&!l&&!u)return[o,i];if(u){var d=this.props.width/this.props.height,p=o-this.props.width,h=i-this.props.height;Math.abs(p)>Math.abs(h*d)?i=o/d:o=i*d}var v=o,b=i,C=this.slack||[0,0],T=C[0],I=C[1];return o+=T,i+=I,c&&(o=Math.max(c[0],o),i=Math.max(c[1],i)),l&&(o=Math.min(l[0],o),i=Math.min(l[1],i)),this.slack=[T+(v-o),I+(b-i)],[o,i]},n.resizeHandler=function(o,i){var a=this;return function(c,l){var u=l.node,d=l.deltaX,p=l.deltaY;o==="onResizeStart"&&a.resetData();var h=(a.props.axis==="both"||a.props.axis==="x")&&i!=="n"&&i!=="s",v=(a.props.axis==="both"||a.props.axis==="y")&&i!=="e"&&i!=="w";if(!(!h&&!v)){var b=i[0],C=i[i.length-1],T=u.getBoundingClientRect();if(a.lastHandleRect!=null){if(C==="w"){var I=T.left-a.lastHandleRect.left;d+=I}if(b==="n"){var m=T.top-a.lastHandleRect.top;p+=m}}a.lastHandleRect=T,C==="w"&&(d=-d),b==="n"&&(p=-p);var y=a.props.width+(h?d/a.props.transformScale:0),R=a.props.height+(v?p/a.props.transformScale:0),g=a.runConstraints(y,R);y=g[0],R=g[1];var w=y!==a.props.width||R!==a.props.height,x=typeof a.props[o]=="function"?a.props[o]:null,E=o==="onResize"&&!w;x&&!E&&(c.persist==null||c.persist(),x(c,{node:u,size:{width:y,height:R},handle:i})),o==="onResizeStop"&&a.resetData()}}},n.renderResizeHandle=function(o,i){var a=this.props.handle;if(!a)return vt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:i});if(typeof a=="function")return a(o,i);var c=typeof a.type=="string",l=wn({ref:i},c?{}:{handleAxis:o});return vt.cloneElement(a,l)},n.render=function(){var o=this,i=this.props,a=i.children,c=i.className,l=i.draggableOpts;i.width,i.height,i.handle,i.handleSize,i.lockAspectRatio,i.axis,i.minConstraints,i.maxConstraints,i.onResize,i.onResizeStop,i.onResizeStart;var u=i.resizeHandles;i.transformScale;var d=Vs(i,ks);return(0,js.cloneElement)(a,wn(wn({},d),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(a.props.children,u.map(function(p){var h,v=(h=o.handleRefs[p])!=null?h:o.handleRefs[p]=vt.createRef();return vt.createElement($s.DraggableCore,jn({},l,{nodeRef:v,key:"resizableHandle-"+p,onStop:o.resizeHandler("onResizeStop",p),onStart:o.resizeHandler("onResizeStart",p),onDrag:o.resizeHandler("onResize",p)}),o.renderResizeHandle(p,v))}))}))},t}(vt.Component);Dt.default=sr;sr.propTypes=Ls.resizableProps;sr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var cn={};cn.__esModule=!0;cn.default=void 0;var Tn=Ys(_),Hs=Vo(We),Bs=Vo(Dt),Gs=Et,Xs=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Vo(e){return e&&e.__esModule?e:{default:e}}function zo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(zo=function(o){return o?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=zo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function kn(){return kn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kn.apply(this,arguments)}function Dr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Gt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dr(Object(n),!0).forEach(function(r){Ks(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ks(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=Js(e,"string");return typeof t=="symbol"?t:String(t)}function Js(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 Qs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function el(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,An(e,t)}function An(e,t){return An=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},An(e,t)}var Uo=function(e){el(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(c,l){var u=l.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(u,function(){return r.props.onResize&&r.props.onResize(c,l)})):r.setState(u)},r}t.getDerivedStateFromProps=function(o,i){return i.propsWidth!==o.width||i.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var n=t.prototype;return n.render=function(){var o=this.props,i=o.handle,a=o.handleSize;o.onResize;var c=o.onResizeStart,l=o.onResizeStop,u=o.draggableOpts,d=o.minConstraints,p=o.maxConstraints,h=o.lockAspectRatio,v=o.axis;o.width,o.height;var b=o.resizeHandles,C=o.style,T=o.transformScale,I=Qs(o,Xs);return Tn.createElement(Bs.default,{axis:v,draggableOpts:u,handle:i,handleSize:a,height:this.state.height,lockAspectRatio:h,maxConstraints:p,minConstraints:d,onResizeStart:c,onResize:this.onResize,onResizeStop:l,resizeHandles:b,transformScale:T,width:this.state.width},Tn.createElement("div",kn({},I,{style:Gt(Gt({},C),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Tn.Component);cn.default=Uo;Uo.propTypes=Gt(Gt({},Gs.resizableProps),{},{children:Hs.default.element});ln.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};ln.exports.Resizable=Dt.default;ln.exports.ResizableBox=cn.default;var tl=ln.exports,Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.resizeHandleType=Ae.resizeHandleAxesType=Ae.default=void 0;var U=Wo(We),nl=Wo(_);function Wo(e){return e&&e.__esModule?e:{default:e}}const rl=Ae.resizeHandleAxesType=U.default.arrayOf(U.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),ol=Ae.resizeHandleType=U.default.oneOfType([U.default.node,U.default.func]);Ae.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&&q.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:rl,resizeHandle:ol,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={};nl.default.Children.forEach(n,function(o){if((o==null?void 0:o.key)!=null){if(r[o.key])throw new Error('Duplicate child key "'+o.key+'" found! This will cause problems in ReactGridLayout.');r[o.key]=!0}})},innerRef:U.default.any};Object.defineProperty(nn,"__esModule",{value:!0});nn.default=void 0;var at=lr(_),G=lr(We),il=ko,al=tl,st=q,de=Fe,Er=Ae,sl=lr(Ue);function lr(e){return e&&e.__esModule?e:{default:e}}function Ne(e,t,n){return t=ll(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ll(e){var t=cl(e,"string");return typeof t=="symbol"?t:String(t)}function cl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class cr extends at.default.Component{constructor(){super(...arguments),Ne(this,"state",{resizing:null,dragging:null,className:""}),Ne(this,"elementRef",at.default.createRef()),Ne(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:o,transformScale:i}=this.props;if(!o)return;const a={top:0,left:0},{offsetParent:c}=r;if(!c)return;const l=c.getBoundingClientRect(),u=r.getBoundingClientRect(),d=u.left/i,p=l.left/i,h=u.top/i,v=l.top/i;a.left=d-p+c.scrollLeft,a.top=h-v+c.scrollTop,this.setState({dragging:a});const{x:b,y:C}=(0,de.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return o.call(this,this.props.i,b,C,{e:t,node:r,newPosition:a})}),Ne(this,"onDrag",(t,n)=>{let{node:r,deltaX:o,deltaY:i}=n;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+i,l=this.state.dragging.left+o;const{isBounded:u,i:d,w:p,h,containerWidth:v}=this.props,b=this.getPositionParams();if(u){const{offsetParent:y}=r;if(y){const{margin:R,rowHeight:g,containerPadding:w}=this.props,x=y.clientHeight-(0,de.calcGridItemWHPx)(h,g,R[1]);c=(0,de.clamp)(c-w[1],0,x);const E=(0,de.calcGridColWidth)(b),k=v-(0,de.calcGridItemWHPx)(p,E,R[0]);l=(0,de.clamp)(l-w[0],0,k)}}const C={top:c,left:l};this.setState({dragging:C});const{containerPadding:T}=this.props,{x:I,y:m}=(0,de.calcXY)(b,c-T[1],l-T[0],p,h);return a.call(this,d,I,m,{e:t,node:r,newPosition:C})}),Ne(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:i,h:a,i:c,containerPadding:l}=this.props,{left:u,top:d}=this.state.dragging,p={top:d,left:u};this.setState({dragging:null});const{x:h,y:v}=(0,de.calcXY)(this.getPositionParams(),d-l[1],u-l[0],i,a);return o.call(this,c,h,v,{e:t,node:r,newPosition:p})}),Ne(this,"onResizeStop",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStop")),Ne(this,"onResizeStart",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStart")),Ne(this,"onResize",(t,n,r)=>this.onResizeHandler(t,n,r,"onResize"))}shouldComponentUpdate(t,n){if(this.props.children!==t.children||this.props.droppingPosition!==t.droppingPosition)return!0;const r=(0,de.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),o=(0,de.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,st.fastPositionEqual)(r,o)||this.props.useCSSTransforms!==t.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(t){this.moveDroppingItem(t)}moveDroppingItem(t){const{droppingPosition:n}=this.props;if(!n)return;const r=this.elementRef.current;if(!r)return;const o=t.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&n.left!==o.left||n.top!==o.top;if(!i)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(a){const c=n.left-i.left,l=n.top-i.top;this.onDrag(n.e,{node:r,deltaX:c,deltaY:l})}}getPositionParams(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:t.cols,containerPadding:t.containerPadding,containerWidth:t.containerWidth,margin:t.margin,maxRows:t.maxRows,rowHeight:t.rowHeight}}createStyle(t){const{usePercentages:n,containerWidth:r,useCSSTransforms:o}=this.props;let i;return o?i=(0,st.setTransform)(t):(i=(0,st.setTopLeft)(t),n&&(i.left=(0,st.perc)(t.left/r),i.width=(0,st.perc)(t.width/r))),i}mixinDraggable(t,n){return at.default.createElement(il.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},t)}curryResizeHandler(t,n){return(r,o)=>n(r,o,t)}mixinResizable(t,n,r){const{cols:o,minW:i,minH:a,maxW:c,maxH:l,transformScale:u,resizeHandles:d,resizeHandle:p}=this.props,h=this.getPositionParams(),v=(0,de.calcGridItemPosition)(h,0,0,o,0).width,b=(0,de.calcGridItemPosition)(h,0,0,i,a),C=(0,de.calcGridItemPosition)(h,0,0,c,l),T=[b.width,b.height],I=[Math.min(C.width,v),Math.min(C.height,1/0)];return at.default.createElement(al.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:T,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:p},t)}onResizeHandler(t,n,r,o){let{node:i,size:a,handle:c}=n;const l=this.props[o];if(!l)return;const{x:u,y:d,i:p,maxH:h,minH:v,containerWidth:b}=this.props,{minW:C,maxW:T}=this.props;let I=a;i&&(I=(0,st.resizeItemInDirection)(c,r,a,b),this.setState({resizing:o==="onResizeStop"?null:I}));let{w:m,h:y}=(0,de.calcWH)(this.getPositionParams(),I.width,I.height,u,d,c);m=(0,de.clamp)(m,Math.max(C,1),T),y=(0,de.clamp)(y,v,h),l.call(this,p,m,y,{e:t,node:i,size:I,handle:c})}render(){const{x:t,y:n,w:r,h:o,isDraggable:i,isResizable:a,droppingPosition:c,useCSSTransforms:l}=this.props,u=(0,de.calcGridItemPosition)(this.getPositionParams(),t,n,r,o,this.state),d=at.default.Children.only(this.props.children);let p=at.default.cloneElement(d,{ref:this.elementRef,className:(0,sl.default)("react-grid-item",d.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":i,"react-draggable-dragging":!!this.state.dragging,dropping:!!c,cssTransforms:l}),style:{...this.props.style,...d.props.style,...this.createStyle(u)}});return p=this.mixinResizable(p,u,a),p=this.mixinDraggable(p,i),p}}nn.default=cr;Ne(cr,"propTypes",{children:G.default.element,cols:G.default.number.isRequired,containerWidth:G.default.number.isRequired,rowHeight:G.default.number.isRequired,margin:G.default.array.isRequired,maxRows:G.default.number.isRequired,containerPadding:G.default.array.isRequired,x:G.default.number.isRequired,y:G.default.number.isRequired,w:G.default.number.isRequired,h:G.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:G.default.string.isRequired,resizeHandles:Er.resizeHandleAxesType,resizeHandle:Er.resizeHandleType,onDragStop:G.default.func,onDragStart:G.default.func,onDrag:G.default.func,onResizeStop:G.default.func,onResizeStart:G.default.func,onResize:G.default.func,isDraggable:G.default.bool.isRequired,isResizable:G.default.bool.isRequired,isBounded:G.default.bool.isRequired,static:G.default.bool,useCSSTransforms:G.default.bool.isRequired,transformScale:G.default.number,className:G.default.string,handle:G.default.string,cancel:G.default.string,droppingPosition:G.default.shape({e:G.default.object.isRequired,left:G.default.number.isRequired,top:G.default.number.isRequired})});Ne(cr,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1});Object.defineProperty(Mt,"__esModule",{value:!0});Mt.default=void 0;var qe=hl(_),_n=Gn,ul=ur(Ue),L=q,dl=Fe,Pr=ur(nn),fl=ur(Ae);function ur(e){return e&&e.__esModule?e:{default:e}}function qo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(qo=function(r){return r?n:t})(e)}function hl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=qo(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function he(e,t,n){return t=pl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pl(e){var t=gl(e,"string");return typeof t=="symbol"?t:String(t)}function gl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Nr="react-grid-layout";let Ho=!1;try{Ho=/firefox/i.test(navigator.userAgent)}catch{}class un extends qe.Component{constructor(){super(...arguments),he(this,"state",{activeDrag:null,layout:(0,L.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,L.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),he(this,"dragEnterCounter",0),he(this,"onDragStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,L.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,L.cloneLayoutItem)(l),oldLayout:c,activeDrag:u}),this.props.onDragStart(c,l,l,null,i,a)}),he(this,"onDrag",(t,n,r,o)=>{let{e:i,node:a}=o;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,allowOverlap:d,preventCollision:p}=this.props,h=(0,L.getLayoutItem)(l,t);if(!h)return;const v={w:h.w,h:h.h,x:h.x,y:h.y,placeholder:!0,i:t};l=(0,L.moveElement)(l,h,n,r,!0,p,(0,L.compactType)(this.props),u,d),this.props.onDrag(l,c,h,v,i,a),this.setState({layout:d?l:(0,L.compact)(l,(0,L.compactType)(this.props),u),activeDrag:v})}),he(this,"onDragStop",(t,n,r,o)=>{let{e:i,node:a}=o;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,preventCollision:d,allowOverlap:p}=this.props,h=(0,L.getLayoutItem)(l,t);if(!h)return;l=(0,L.moveElement)(l,h,n,r,!0,d,(0,L.compactType)(this.props),u,p);const b=p?l:(0,L.compact)(l,(0,L.compactType)(this.props),u);this.props.onDragStop(b,c,h,null,i,a);const{oldLayout:C}=this.state;this.setState({activeDrag:null,layout:b,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(b,C)}),he(this,"onResizeStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,L.getLayoutItem)(c,t);l&&(this.setState({oldResizeItem:(0,L.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,l,l,null,i,a))}),he(this,"onResize",(t,n,r,o)=>{let{e:i,node:a,size:c,handle:l}=o;const{oldResizeItem:u}=this.state,{layout:d}=this.state,{cols:p,preventCollision:h,allowOverlap:v}=this.props;let b=!1,C,T,I;const[m,y]=(0,L.withLayoutItem)(d,t,g=>{let w;return T=g.x,I=g.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(T=g.x+(g.w-n),n=g.x!==T&&T<0?g.w:n,T=T<0?0:T),["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),b=!0),h&&!v&&(w=(0,L.getAllCollisions)(d,{...g,w:n,h:r,x:T,y:I}).filter(E=>E.i!==g.i).length>0,w&&(I=g.y,r=g.h,T=g.x,n=g.w,b=!1)),g.w=n,g.h=r,g});if(!y)return;C=m,b&&(C=(0,L.moveElement)(m,y,T,I,!0,this.props.preventCollision,(0,L.compactType)(this.props),p,v));const R={w:y.w,h:y.h,x:y.x,y:y.y,static:!0,i:t};this.props.onResize(C,u,y,R,i,a),this.setState({layout:v?C:(0,L.compact)(C,(0,L.compactType)(this.props),p),activeDrag:R})}),he(this,"onResizeStop",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c,oldResizeItem:l}=this.state,{cols:u,allowOverlap:d}=this.props,p=(0,L.getLayoutItem)(c,t),h=d?c:(0,L.compact)(c,(0,L.compactType)(this.props),u);this.props.onResizeStop(h,l,p,null,i,a);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:h,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(h,v)}),he(this,"onDragOver",t=>{var m;if(t.preventDefault(),t.stopPropagation(),Ho&&!((m=t.nativeEvent.target)!=null&&m.classList.contains(Nr)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:i,rowHeight:a,maxRows:c,width:l,containerPadding:u,transformScale:d}=this.props,p=r==null?void 0:r(t);if(p===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const h={...n,...p},{layout:v}=this.state,b=t.currentTarget.getBoundingClientRect(),C=t.clientX-b.left,T=t.clientY-b.top,I={left:C/d,top:T/d,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:y,top:R}=this.state.droppingPosition;(y!=C||R!=T)&&this.setState({droppingPosition:I})}}else{const y={cols:i,margin:o,maxRows:c,rowHeight:a,containerWidth:l,containerPadding:u||o},R=(0,dl.calcXY)(y,T,C,h.w,h.h);this.setState({droppingDOMNode:qe.createElement("div",{key:h.i}),droppingPosition:I,layout:[...v,{...h,x:R.x,y:R.y,static:!1,isDraggable:!0}]})}}),he(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,o=(0,L.compact)(r.filter(i=>i.i!==t.i),(0,L.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:o,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),he(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),he(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),he(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,o=r.find(i=>i.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,o,t)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(t,n){let r;return n.activeDrag?null:(!(0,_n.deepEqual)(t.layout,n.propsLayout)||t.compactType!==n.compactType?r=t.layout:(0,L.childrenEqual)(t.children,n.children)||(r=n.layout),r?{layout:(0,L.synchronizeLayoutWithChildren)(r,t.children,t.cols,(0,L.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,n){return this.props.children!==t.children||!(0,L.fastRGLPropsEqual)(this.props,t,_n.deepEqual)||this.state.activeDrag!==n.activeDrag||this.state.mounted!==n.mounted||this.state.droppingPosition!==n.droppingPosition}componentDidUpdate(t,n){if(!this.state.activeDrag){const r=this.state.layout,o=n.layout;this.onLayoutMaybeChanged(r,o)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,L.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,_n.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:o,containerPadding:i,rowHeight:a,maxRows:c,useCSSTransforms:l,transformScale:u}=this.props;return qe.createElement(Pr.default,{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:n,cols:r,margin:o,containerPadding:i||o,maxRows:c,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:u},qe.createElement("div",null))}processGridItem(t,n){if(!t||!t.key)return;const r=(0,L.getLayoutItem)(this.state.layout,String(t.key));if(!r)return null;const{width:o,cols:i,margin:a,containerPadding:c,rowHeight:l,maxRows:u,isDraggable:d,isResizable:p,isBounded:h,useCSSTransforms:v,transformScale:b,draggableCancel:C,draggableHandle:T,resizeHandles:I,resizeHandle:m}=this.props,{mounted:y,droppingPosition:R}=this.state,g=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&d,w=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&p,x=r.resizeHandles||I,E=g&&h&&r.isBounded!==!1;return qe.createElement(Pr.default,{containerWidth:o,cols:i,margin:a,containerPadding:c||a,maxRows:u,rowHeight:l,cancel:C,handle:T,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:v&&y,usePercentages:!y,transformScale:b,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:x,resizeHandle:m},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:o}=this.props,i=(0,ul.default)(Nr,t),a={height:this.containerHeight(),...n};return qe.createElement("div",{ref:o,className:i,style:a,onDrop:r?this.onDrop:L.noop,onDragLeave:r?this.onDragLeave:L.noop,onDragEnter:r?this.onDragEnter:L.noop,onDragOver:r?this.onDragOver:L.noop},qe.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}Mt.default=un;he(un,"displayName","ReactGridLayout");he(un,"propTypes",fl.default);he(un,"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:L.noop,onDragStart:L.noop,onDrag:L.noop,onDragStop:L.noop,onResizeStart:L.noop,onResize:L.noop,onResizeStop:L.noop,onDrop:L.noop,onDropDragOver:L.noop});var dn={},nt={};Object.defineProperty(nt,"__esModule",{value:!0});nt.findOrGenerateResponsiveLayout=yl;nt.getBreakpointFromWidth=ml;nt.getColsFromBreakpoint=vl;nt.sortBreakpoints=dr;var Ft=q;function ml(e,t){const n=dr(e);let r=n[0];for(let o=1,i=n.length;o<i;o++){const a=n[o];t>e[a]&&(r=a)}return r}function vl(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function yl(e,t,n,r,o,i){if(e[n])return(0,Ft.cloneLayout)(e[n]);let a=e[r];const c=dr(t),l=c.slice(c.indexOf(n));for(let u=0,d=l.length;u<d;u++){const p=l[u];if(e[p]){a=e[p];break}}return a=(0,Ft.cloneLayout)(a||[]),(0,Ft.compact)((0,Ft.correctBounds)(a,{cols:o}),i,o)}function dr(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(dn,"__esModule",{value:!0});dn.default=void 0;var Fr=Sl(_),ve=Bo(We),xn=Gn,dt=q,He=nt,Cl=Bo(Mt);function Bo(e){return e&&e.__esModule?e:{default:e}}function Go(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Go=function(r){return r?n:t})(e)}function Sl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Go(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Vn(){return Vn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vn.apply(this,arguments)}function Xt(e,t,n){return t=bl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bl(e){var t=Rl(e,"string");return typeof t=="symbol"?t:String(t)}function Rl(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 $r=e=>Object.prototype.toString.call(e);function $t(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class fr extends Fr.Component{constructor(){super(...arguments),Xt(this,"state",this.generateInitialState()),Xt(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:n,layouts:r,cols:o}=this.props,i=(0,He.getBreakpointFromWidth)(n,t),a=(0,He.getColsFromBreakpoint)(i,o),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,He.findOrGenerateResponsiveLayout)(r,n,i,i,a,c),breakpoint:i,cols:a}}static getDerivedStateFromProps(t,n){if(!(0,xn.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:o}=n;return{layout:(0,He.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,o,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,xn.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,xn.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:o,compactType:i}=this.props,a=this.props.breakpoint||(0,He.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,He.getColsFromBreakpoint)(a,r),u={...o};if(c!==a||t.breakpoints!==n||t.cols!==r){c in u||(u[c]=(0,dt.cloneLayout)(this.state.layout));let h=(0,He.findOrGenerateResponsiveLayout)(u,n,a,c,l,i);h=(0,dt.synchronizeLayoutWithChildren)(h,this.props.children,l,i,this.props.allowOverlap),u[a]=h,this.props.onLayoutChange(h,u),this.props.onBreakpointChange(a,l),this.setState({breakpoint:a,layout:h,cols:l})}const d=$t(this.props.margin,a),p=$t(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,d,l,p)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:o,margin:i,containerPadding:a,onBreakpointChange:c,onLayoutChange:l,onWidthChange:u,...d}=this.props;return Fr.createElement(Cl.default,Vn({},d,{margin:$t(i,this.state.breakpoint),containerPadding:$t(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}dn.default=fr;Xt(fr,"propTypes",{breakpoint:ve.default.string,breakpoints:ve.default.object,allowOverlap:ve.default.bool,cols:ve.default.object,margin:ve.default.oneOfType([ve.default.array,ve.default.object]),containerPadding:ve.default.oneOfType([ve.default.array,ve.default.object]),layouts(e,t){if($r(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+$r(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:ve.default.number.isRequired,onBreakpointChange:ve.default.func,onLayoutChange:ve.default.func,onWidthChange:ve.default.func});Xt(fr,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:dt.noop,onLayoutChange:dt.noop,onWidthChange:dt.noop});var hr={},Xo=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var a=i[o];n.call(r,a[1],a[0])}},t}()}(),zn=typeof window<"u"&&typeof document<"u"&&window.document===document,Yt=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")()}(),Il=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Yt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),wl=2;function Tl(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&c()}function a(){Il(i)}function c(){var l=Date.now();if(n){if(l-o<wl)return;r=!0}else n=!0,r=!1,setTimeout(a,t);o=l}return c}var _l=20,xl=["top","right","bottom","left","width","height","size","weight"],Ol=typeof MutationObserver<"u",Ml=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Tl(this.refresh.bind(this),_l)}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(){!zn||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(){!zn||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=xl.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Yo=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},ft=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Yt},Ko=fn(0,0,0,0);function Kt(e){return parseFloat(e)||0}function jr(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var i=e["border-"+o+"-width"];return r+Kt(i)},0)}function Dl(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var i=o[r],a=e["padding-"+i];n[i]=Kt(a)}return n}function El(e){var t=e.getBBox();return fn(0,0,t.width,t.height)}function Pl(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Ko;var r=ft(e).getComputedStyle(e),o=Dl(r),i=o.left+o.right,a=o.top+o.bottom,c=Kt(r.width),l=Kt(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==t&&(c-=jr(r,"left","right")+i),Math.round(l+a)!==n&&(l-=jr(r,"top","bottom")+a)),!Fl(e)){var u=Math.round(c+i)-t,d=Math.round(l+a)-n;Math.abs(u)!==1&&(c-=u),Math.abs(d)!==1&&(l-=d)}return fn(o.left,o.top,c,l)}var Nl=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 Fl(e){return e===ft(e).document.documentElement}function $l(e){return zn?Nl(e)?El(e):Pl(e):Ko}function jl(e){var t=e.x,n=e.y,r=e.width,o=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,a=Object.create(i.prototype);return Yo(a,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),a}function fn(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Ll=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=fn(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=$l(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}(),kl=function(){function e(t,n){var r=jl(n);Yo(this,{target:t,contentRect:r})}return e}(),Al=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new Xo,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 Ll(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 kl(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}(),Zo=typeof WeakMap<"u"?new WeakMap:new Xo,Jo=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=Ml.getInstance(),r=new Al(t,n,this);Zo.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Jo.prototype[e]=function(){var t;return(t=Zo.get(this))[e].apply(t,arguments)}});var Vl=function(){return typeof Yt.ResizeObserver<"u"?Yt.ResizeObserver:Jo}();const zl=Object.freeze(Object.defineProperty({__proto__:null,default:Vl},Symbol.toStringTag,{value:"Module"})),Ul=Yi(zl);Object.defineProperty(hr,"__esModule",{value:!0});hr.default=Kl;var jt=Bl(_),Wl=pr(We),ql=pr(Ul),Hl=pr(Ue);function pr(e){return e&&e.__esModule?e:{default:e}}function Qo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Qo=function(r){return r?n:t})(e)}function Bl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Qo(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Un(){return Un=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},Un.apply(this,arguments)}function lt(e,t,n){return t=Gl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gl(e){var t=Xl(e,"string");return typeof t=="symbol"?t:String(t)}function Xl(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 Yl="react-grid-layout";function Kl(e){var t;return t=class extends jt.Component{constructor(){super(...arguments),lt(this,"state",{width:1280}),lt(this,"elementRef",jt.createRef()),lt(this,"mounted",!1),lt(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new ql.default(o=>{if(this.elementRef.current instanceof HTMLElement){const a=o[0].contentRect.width;this.setState({width:a})}});const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.observe(r)}componentWillUnmount(){this.mounted=!1;const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.unobserve(r),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:r,...o}=this.props;return r&&!this.mounted?jt.createElement("div",{className:(0,Hl.default)(this.props.className,Yl),style:this.props.style,ref:this.elementRef}):jt.createElement(e,Un({innerRef:this.elementRef},o,this.state))}},lt(t,"defaultProps",{measureBeforeMount:!1}),lt(t,"propTypes",{measureBeforeMount:Wl.default.bool}),t}(function(e){e.exports=Mt.default,e.exports.utils=q,e.exports.calculateUtils=Fe,e.exports.Responsive=dn.default,e.exports.Responsive.utils=nt,e.exports.WidthProvider=hr.default})(po);var Zl=po.exports;const Jl=Bn(Zl),Wn={type:S.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){var h,v;if(!t)return!1;const n=e.get(S.IUndoRedoService),r=e.get(S.ICommandService),i=e.get(S.IUniverInstanceService).getCurrentUniverSheetInstance(),a=i.getActiveSheet(),c=(h=t.unitId)!=null?h:i.getUnitId(),l=(v=t.subUnitId)!=null?v:a.getSheetId(),u={unitId:c,subUnitId:l,cfId:t.cfId},d=s.DeleteConditionalRuleMutationUndoFactory(e,u),p=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,u);return p&&n.pushUndoRedo({unitID:c,undoMutations:d,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:u}]}),p}},ei={type:S.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){var T,I;if(!t)return!1;const n=e.get(S.IUndoRedoService),r=e.get(S.ICommandService),o=e.get(S.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=o.getCurrentUniverSheetInstance(),c=a.getActiveSheet(),l=(T=t.unitId)!=null?T:a.getUnitId(),u=(I=t.subUnitId)!=null?I:c.getSheetId(),d=s.transformSupportSymmetryAnchor(t.start,t.end,i.getSubunitRules(l,u)||[],m=>m.cfId);if(!d)return!1;const[p,h]=d,v={unitId:l,subUnitId:u,start:p,end:h},b=s.MoveConditionalRuleMutationUndoFactory(v),C=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,v);return C&&n.pushUndoRedo({unitID:l,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:v}],undoMutations:b}),C}},Ql="univer-cf-preview",Lt={cfPreview:Ql},ht=e=>{var o,i;const t=e.rule;if(!t)return null;const n=_.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const a=t.config.map((u,d)=>({color:new S.ColorKit(u.color),value:d})),c=a.length-1;return new Array(5).fill("").map((u,d,p)=>d*c/(p.length-1)).map(u=>s.getColorScaleFromValue(a,u))}return null},[t]),r=_.useMemo(()=>{if(t.type===s.CFRuleType.iconSet)return t.config.map(a=>{const c=s.iconMap[a.iconType];return c&&c[Number(a.iconId)]})},[t]);switch(t.type){case s.CFRuleType.dataBar:{const{isGradient:a}=t.config,c={width:"50%",height:"100%"},l=a?`linear-gradient(to right, ${t.config.positiveColor}, rgb(255 255 255))`:t.config.positiveColor,u=a?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor})`:t.config.nativeColor;return f.jsxs("div",{className:Lt.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:Lt.cfPreview,children:n.map((a,c)=>f.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:a}},c))});case s.CFRuleType.iconSet:return r&&f.jsx("div",{className:Lt.cfPreview,children:r.map((a,c)=>a?f.jsx("img",{style:{height:"100%"},src:a},c):f.jsx(Jt,{},c))});case s.CFRuleType.highlightCell:{const{ul:a,st:c,it:l,bl:u,bg:d,cl:p}=t.style,h=(a==null?void 0:a.s)===S.BooleanNumber.TRUE,v=(c==null?void 0:c.s)===S.BooleanNumber.TRUE,b=l===S.BooleanNumber.TRUE,C=u===S.BooleanNumber.TRUE,T=(o=d==null?void 0:d.rgb)!=null?o:s.DEFAULT_BG_COLOR,I=(i=p==null?void 0:p.rgb)!=null?i:s.DEFAULT_FONT_COLOR,m={fontWeight:C?"bold":void 0,fontStyle:b?"italic":void 0,textDecoration:`${h?"underline":""} ${v?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:T,color:I};return f.jsx("div",{style:m,className:Lt.cfPreview,children:"123"})}}return null},ec={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"},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"}}}},tc=ec,nc={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} 的规则"},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:"无"}}}},ti=nc;var rc=Object.defineProperty,oc=Object.getOwnPropertyDescriptor,ic=(e,t,n,r)=>{for(var o=r>1?void 0:r?oc(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&rc(t,n,o),o},ac=(e,t)=>(n,r)=>t(n,r,e);let Tt=class extends S.Disposable{constructor(t){super();it(this,"_initLocal",()=>{this._localeService.load({zhCN:ti})});it(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let o=n.exec(t);for(;o;)r.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),o=t.split("."),i=r&&this._localeService.resolveKeyPath(r,o);if(typeof i=="string"){const a=[];return this._findReplaceIndex(i).forEach((c,l,u)=>{const d=u[l-1]||{startIndex:0,endIndex:-1};if(d.endIndex+1<c.startIndex){const p=i.slice(d.endIndex+1,c.startIndex);p&&a.push(p)}if(n[c.key]&&a.push(n[c.key]),l===u.length-1){const p=i.slice(c.endIndex+1);p&&a.push(p)}}),a}return[]}};Tt=ic([S.OnLifecycle(S.LifecycleStages.Rendered,Tt),ac(0,V.Inject(S.LocaleService))],Tt);const sc="univer-cf-rule-list",lc="univer-rule-selector",cc="univer-select",uc="univer-select-selector",dc="univer-select-selection-item",fc="univer-select-selection-search-input",hc="univer-btn-list",pc="univer-gap",gc="univer-icon",mc="univer-disabled",vc="univer-rule-item",yc="univer-rule-describe",Cc="univer-rule-type",Sc="univer-rule-range",bc="univer-active",Rc="univer-draggableHandle",Ic="univer-delete-item",wc="univer-grid-layout-wrap",Tc="univer-react-grid-item",ce={cfRuleList:sc,ruleSelector:lc,select:cc,selectSelector:uc,selectSelectionItem:dc,selectSelectionSearchInput:fc,btnList:hc,gap:pc,icon:gc,disabled:mc,ruleItem:vc,ruleDescribe:yc,ruleType:Cc,ruleRange:Sc,active:bc,draggableHandle:Rc,deleteItem:Ic,gridLayoutWrap:wc,reactGridItem:Tc},_c=(e,t)=>{const n=e.rule;switch(n.type){case s.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case s.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case s.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case s.CFRuleType.highlightCell:switch(n.subType){case s.CFSubRuleType.average:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,t.t("sheet.cf.subRuleType.average"))}case s.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case s.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case s.CFSubRuleType.number:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(o=>String(o)):[String(n.value||"")])}case s.CFSubRuleType.text:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case s.CFSubRuleType.timePeriod:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`)}case s.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):t.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?t.t("sheet.cf.preview.describe.bottomN",String(n.value)):t.t("sheet.cf.preview.describe.topN",String(n.value));case s.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let Lr=0;const xc=e=>{const{onClick:t}=e,n=Q.useDependency(s.ConditionalFormattingRuleModel),r=Q.useDependency(S.IUniverInstanceService),o=Q.useDependency(ee.SelectionManagerService),i=Q.useDependency(S.ICommandService),a=Q.useDependency(S.LocaleService),c=Q.useDependency(Tt),l=r.getCurrentUniverSheetInstance(),u=l.getUnitId(),p=l.getActiveSheet().getSheetId(),[h,v]=_.useState("2"),[b,C]=_.useState(0),[T,I]=_.useState(-1),[m,y]=_.useState(Lr),R=_.useRef(null),g=[{label:a.t("sheet.cf.panel.workSheet"),value:"2"},{label:a.t("sheet.cf.panel.selectedRange"),value:"1"}],w=()=>{const j=n.getSubunitRules(u,p);if(!j||!j.length)return[];if(h==="1"){const H=o.getLast();if(!H)return[];const K=H.range;return j.filter(ne=>ne.ranges.some(le=>S.Rectangle.intersects(le,K)))}else if(h==="2")return j;return[]},[x,E]=_.useState(w);_.useEffect(()=>{const j=i.onCommandExecuted(H=>{H.id===ee.SetWorksheetActiveOperation.id&&C(Math.random())});return()=>j.dispose()}),_.useEffect(()=>{E(w)},[h,b,u,p]),_.useEffect(()=>{if(h==="2")return;const j=new ye.Observable(H=>{const K=[ee.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],se=i.onCommandExecuted(ne=>{const{id:le,params:Te}=ne,_e=r.getCurrentUniverSheetInstance().getUnitId();K.includes(le)&&Te.unitId===_e&&H.next(null)});return()=>se.dispose()}).pipe(ye.debounceTime(16)).subscribe(()=>{E(w)});return()=>{j.unsubscribe()}},[r,h,u,p]),_.useEffect(()=>{const j=n.$ruleChange.subscribe(()=>{C(Math.random())});return()=>j.unsubscribe()},[n]),_.useEffect(()=>{const j=()=>{var ne;const se=Math.max(0,(((ne=R.current)==null?void 0:ne.getBoundingClientRect().width)||0)-8);return Lr=se,se},K=new ye.Observable(se=>{const ne=document.querySelector(".univer-sidebar");if(ne){let le=setTimeout(()=>{se.next()},150);const Te=()=>{le&&clearTimeout(le),le=null},_e=Me=>{Me.propertyName==="width"&&(Te(),se.next())};return ne.addEventListener("transitionend",_e),()=>{Te(),ne.removeEventListener("transitionend",_e)}}}).pipe(ye.debounceTime(16)).subscribe(()=>{y(j())});return()=>{K.unsubscribe()}},[]);const k=j=>{const H=r.getCurrentUniverSheetInstance().getUnitId(),K=r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();i.executeCommand(Wn.id,{unitId:H,subUnitId:K,cfId:j.cfId})},W=(j,H)=>{I(H.y)},O=(j,H,K)=>{I(-1);const se=r.getCurrentUniverSheetInstance().getUnitId(),ne=r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),le=Me=>{const Pt=x.length;return Math.min(Pt-1,Math.max(0,Me))},Te=x[le(H.y)].cfId,_e=x[le(K.y)].cfId;Te!==_e&&i.executeCommand(ei.id,{unitId:se,subUnitId:ne,start:{id:Te,type:"self"},end:{id:_e,type:K.y>H.y?"after":"before"}})},$=()=>{e.onCreate()},D=()=>{h==="2"?i.executeCommand(qn.id):h==="1"&&x.map(H=>({unitId:u,subUnitId:p,cfId:H.cfId})).forEach(H=>{i.executeCommand(Wn.id,H)})},F=x.map((j,H)=>({i:j.cfId,x:0,w:12,y:H,h:1,isResizable:!1}));return f.jsxs("div",{className:ce.cfRuleList,children:[f.jsxs("div",{className:ce.ruleSelector,children:[f.jsx("div",{children:c.tWithReactNode("sheet.cf.panel.managerRuleSelect",f.jsx(B.Select,{className:ce.select,options:g,value:h,onChange:j=>{v(j)}})).map((j,H)=>f.jsx("span",{children:j},H))}),f.jsxs("div",{className:ce.btnList,children:[f.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.createRule"),placement:"bottom",children:f.jsx("div",{className:`${ce.icon}`,onClick:$,children:f.jsx(Wi,{})})}),x.length?f.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.clear"),placement:"bottom",children:f.jsx("div",{className:`${ce.gap} ${ce.icon}`,onClick:D,children:f.jsx(Sn,{})})}):f.jsx("div",{className:`${ce.gap} ${ce.disabled}`,children:f.jsx(Sn,{})})]})]}),f.jsx("div",{ref:R,className:ce.gridLayoutWrap,children:m?f.jsx(Jl,{onDragStop:O,onDragStart:W,layout:F,cols:12,rowHeight:60,width:m,margin:[0,10],draggableHandle:".draggableHandle",children:x.map((j,H)=>f.jsx("div",{children:f.jsxs("div",{className:`${ce.ruleItem} ${T===H?ce.active:""}`,onClick:()=>t(j),children:[f.jsx("div",{className:`${ce.draggableHandle} draggableHandle`,onClick:K=>K.stopPropagation(),children:f.jsx(Bi,{})}),f.jsxs("div",{className:ce.ruleDescribe,children:[f.jsx("div",{className:ce.ruleType,children:_c(j,a)}),f.jsx("div",{className:ce.ruleRange,children:j.ranges.map(K=>to.serializeRange(K)).join(",")})]}),f.jsx("div",{className:ce.preview,children:f.jsx(ht,{rule:j.rule})}),f.jsx("div",{className:`${ce.deleteItem} ${T===H?ce.active:""}`,onClick:K=>{K.stopPropagation(),k(j)},children:f.jsx(Sn,{})})]})},`${j.cfId}`))}):null})]})},ni={type:S.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){var C,T;if(!t)return!1;const{rule:n}=t,r=e.get(S.IUndoRedoService),o=e.get(S.ICommandService),i=e.get(s.ConditionalFormattingRuleModel),c=e.get(S.IUniverInstanceService).getCurrentUniverSheetInstance(),l=c.getActiveSheet(),u=(C=t.unitId)!=null?C:c.getUnitId(),d=(T=t.subUnitId)!=null?T:l.getSheetId(),p=i.createCfId(u,d),h={unitId:u,subUnitId:d,rule:{...n,cfId:n.cfId||p}},v=s.AddConditionalRuleMutationUndoFactory(e,h),b=o.syncExecuteCommand(s.AddConditionalRuleMutation.id,h);return b&&r.pushUndoRedo({unitID:u,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:h}],undoMutations:[v]}),b}},ri={type:S.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){var h,v;if(!t)return!1;const n=e.get(S.IUndoRedoService),r=e.get(S.ICommandService),i=e.get(S.IUniverInstanceService).getCurrentUniverSheetInstance(),a=i.getActiveSheet(),c=(h=t.unitId)!=null?h:i.getUnitId(),l=(v=t.subUnitId)!=null?v:a.getSheetId(),u={unitId:c,subUnitId:l,rule:t.rule},d=s.setConditionalRuleMutationUndoFactory(e,u),p=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,u);return p&&n.pushUndoRedo({unitID:c,undoMutations:d,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:u}]}),p}},Oc=S.createInterceptorKey("beforeSubmit"),Mc=S.createInterceptorKey("submit"),Dc="univer-cf-color-picker",Ec="univer-cf-color-picker-icon",Pc="univer-icon-dropdown",On={cfColorPicker:Dc,cfColorPickerIcon:Ec,iconDropdown:Pc},Ze=e=>{const{color:t,onChange:n,disable:r=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:a=!0}=e,c=Q.useDependency(Ce.ComponentManager),l=_.useMemo(()=>new S.ColorKit(t),[t]),u=c.get(o);return u&&(r?f.jsx(u,{className:i,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):f.jsx(B.Dropdown,{overlay:f.jsx("div",{className:`${On.cfColorPicker} `,children:f.jsx(B.ColorPicker,{color:t,onChange:n})}),children:f.jsxs("span",{className:`${On.cfColorPickerIcon} ${i}`,children:[f.jsx(u,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),a&&f.jsx(Hn,{className:On.iconDropdown})]})}))},Nc="univer-cf-rule-style-editor",Fc="univer-cf-preview-wrap",$c="univer-text",jc="univer-position-relative",Lc="univer-btn-list",kc="univer-icon-set",Ac="univer-render-config",Vc="univer-util-item",zc="univer-flex",Uc="univer-width45",Wc="univer-icon-wrap",qc="univer-icon",Hc="univer-dropdown-icon",Bc="univer-error-input",Gc="univer-error-text",Xc="univer-icon-group-list",Yc="univer-title",Kc="univer-group",Zc="univer-item-content",Jc="univer-item-wrap",Qc="univer-item",eu="univer-icon-item-list-wrap",tu="univer-none",nu="univer-icon-item-list",ru="univer-width100",ou="univer-stress",N={cfRuleStyleEditor:Nc,cfPreviewWrap:Fc,text:$c,positionRelative:jc,btnList:Lc,iconSet:kc,renderConfig:Ac,utilItem:Vc,flex:zc,width45:Uc,iconWrap:Wc,icon:qc,dropdownIcon:Hc,errorInput:Bc,errorText:Gc,iconGroupList:Xc,title:Yc,group:Kc,itemContent:Zc,itemWrap:Jc,item:Qc,iconItemListWrap:eu,none:tu,iconItemList:nu,width100:ru,stress:ou},Be=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Mn=e=>{const{type:t,className:n,onChange:r,id:o,value:i}=e,a=Q.useDependency(S.IUniverInstanceService),c=a.getCurrentUniverSheetInstance().getUnitId(),l=a.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),u=_.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),d=_.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(Ce.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:c,id:`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${o}`,value:u,style:{maxWidth:"50%",marginLeft:4},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(p="")=>{r(p||"")}}):f.jsx(B.InputNumber,{className:n,value:Number(e.value)||0,onChange:p=>e.onChange(p||0),...d})},iu=e=>{var $;const{interceptorManager:t}=e,n=Q.useDependency(S.LocaleService),r=(($=e.rule)==null?void 0:$.type)===s.CFRuleType.colorScale?e.rule:void 0,o=[Be(s.CFValueType.num,n),Be(s.CFValueType.percent,n),Be(s.CFValueType.percentile,n),Be(s.CFValueType.formula,n)],i=[Be(s.CFValueType.min,n),...o],a=[Be("none",n),...o],c=[Be(s.CFValueType.max,n),...o],[l,u]=_.useState(()=>{var F;const D=s.CFValueType.min;return r&&((F=r.config[0])==null?void 0:F.value.type)||D}),[d,p]=_.useState(()=>{var F;const D="none";return!r||r.config.length!==3?D:((F=r.config[1])==null?void 0:F.value.type)||D}),[h,v]=_.useState(()=>{var F;const D=s.CFValueType.max;return r&&((F=r.config[r.config.length-1])==null?void 0:F.value.type)||D}),[b,C]=_.useState(()=>{if(!r)return 10;const F=r.config[0];return(F==null?void 0:F.value.value)===void 0?10:F==null?void 0:F.value.value}),[T,I]=_.useState(()=>{var j;if(!r||r.config.length!==3)return 50;const F=(j=r.config[1])==null?void 0:j.value.value;return F===void 0?50:F}),[m,y]=_.useState(()=>{var j;if(!r)return 90;const F=(j=r.config[r.config.length-1])==null?void 0:j.value.value;return F===void 0?90:F}),[R,g]=_.useState(()=>{var F;const D="#d0d9fb";return r&&((F=r.config[0])==null?void 0:F.color)||D}),[w,x]=_.useState(()=>{var F;const D="#7790f3";return!r||r.config.length!==3?D:((F=r.config[1])==null?void 0:F.color)||D}),[E,k]=_.useState(()=>{var F;const D="#2e55ef";return r&&((F=r.config[r.config.length-1])==null?void 0:F.color)||D}),W=_.useMemo(()=>D=>{const{minType:F,medianType:j,maxType:H,minValue:K,medianValue:se,maxValue:ne,minColor:le,medianColor:Te,maxColor:_e}=D,Me=[];return Me.push({color:le,value:{type:F,value:K}}),j!=="none"&&Me.push({color:Te,value:{type:j,value:se}}),Me.push({color:_e,value:{type:H,value:ne}}),{config:Me.map((yn,Cn)=>({...yn,index:Cn})),type:s.CFRuleType.colorScale}},[]);_.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return W({minType:l,medianType:d,maxType:h,minValue:b,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),[W,l,d,h,b,T,m,R,w,E,t]);const O=D=>{e.onChange(W(D))};return f.jsxs("div",{children:[f.jsx("div",{className:M.title,children:n.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${N.cfPreviewWrap}`,children:f.jsx(ht,{rule:W({minType:l,medianType:d,maxType:h,minValue:b,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:E})})}),f.jsx("div",{className:M.label,children:n.t("sheet.cf.valueType.min")}),f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm}`,children:[f.jsx(B.Select,{options:i,value:l,onChange:D=>{u(D);const F=s.createDefaultValueByValueType(D,10);C(F),O({minType:D,medianType:d,maxType:h,minValue:F,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(Mn,{id:"min",className:`${M.mLXxs}`,value:b,type:l,onChange:D=>{C(D),O({minType:l,medianType:d,maxType:h,minValue:D,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(Ze,{className:M.mLXxs,color:R,onChange:D=>{g(D),O({minType:l,medianType:d,maxType:h,minValue:b,medianValue:T,maxValue:m,minColor:D,medianColor:w,maxColor:E})}})]}),f.jsx("div",{className:M.label,children:n.t("sheet.cf.panel.medianValue")}),f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm}`,children:[f.jsx(B.Select,{options:a,value:d,onChange:D=>{p(D);const F=s.createDefaultValueByValueType(D,50);I(F),O({minType:l,medianType:D,maxType:h,minValue:b,medianValue:F,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(Mn,{id:"median",className:` ${M.mLXxs}`,value:T,type:d,onChange:D=>{I(D),O({minType:l,medianType:d,maxType:h,minValue:b,medianValue:D,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),d!=="none"&&f.jsx(Ze,{className:M.mLXxs,color:w,onChange:D=>{x(D),O({minType:l,medianType:d,maxType:h,minValue:b,medianValue:T,maxValue:m,minColor:R,medianColor:D,maxColor:E})}})]}),f.jsx("div",{className:M.label,children:n.t("sheet.cf.valueType.max")}),f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm}`,children:[f.jsx(B.Select,{options:c,value:h,onChange:D=>{v(D);const F=s.createDefaultValueByValueType(D,90);y(F),O({minType:l,medianType:d,maxType:D,minValue:b,medianValue:T,maxValue:F,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(Mn,{id:"max",className:`${M.mLXxs}`,value:m,type:h,onChange:D=>{y(D),O({minType:l,medianType:d,maxType:h,minValue:b,medianValue:T,maxValue:D,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(Ze,{className:M.mLXxs,color:E,onChange:D=>{k(D),O({minType:l,medianType:d,maxType:h,minValue:b,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:D})}})]})]})},ct=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),kr=e=>{const{onChange:t,className:n,value:r,type:o,id:i,disabled:a=!1}=e,c=Q.useDependency(S.IUniverInstanceService),l=c.getCurrentUniverSheetInstance().getUnitId(),u=c.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),d=_.useRef(r),p=_.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===s.CFValueType.formula){const h=String(d.current).startsWith("=")?String(d.current)||"":"=";return f.jsx(Ce.TextEditor,{id:`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${i}`,value:h,openForSheetSubUnitId:u,openForSheetUnitId:l,style:{width:"47%",marginLeft:14},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(v="")=>{t(v||"")}})}return f.jsx(B.InputNumber,{className:n,value:Number(r)||0,disabled:a,onChange:h=>{t(h||0)},...p})},au=e=>{var W;const{interceptorManager:t}=e,n=Q.useDependency(S.LocaleService),r=((W=e.rule)==null?void 0:W.type)===s.CFRuleType.dataBar?e.rule:void 0,[o,i]=_.useState(()=>{var $;const O="0";return r?($=r.config)!=null&&$.isGradient?"1":"0":O}),[a,c]=_.useState(()=>{var $;const O="#abd91a";return r&&(($=r.config)==null?void 0:$.positiveColor)||O}),[l,u]=_.useState(()=>{var $;const O="#ffbe38";return r&&(($=r.config)==null?void 0:$.nativeColor)||O}),d=[ct(s.CFValueType.num,n),ct(s.CFValueType.percent,n),ct(s.CFValueType.percentile,n),ct(s.CFValueType.formula,n)],p=[ct(s.CFValueType.min,n),...d],h=[ct(s.CFValueType.max,n),...d],[v,b]=_.useState(()=>{var $;const O=p[0].value;return r&&(($=r.config)==null?void 0:$.min.type)||O}),[C,T]=_.useState(()=>{var $;const O=h[0].value;return r&&(($=r.config)==null?void 0:$.max.type)||O}),[I,m]=_.useState(()=>{var D;if(!r)return 0;const $=((D=r.config)==null?void 0:D.min)||{};return $.type===s.CFValueType.formula?$.value||"=":$.value||0}),[y,R]=_.useState(()=>{var D;if(!r)return 100;const $=((D=r.config)==null?void 0:D.max)||{};return $.type===s.CFValueType.formula?$.value||"=":$.value===void 0?100:$.value}),g=O=>({config:{min:{type:O.minValueType,value:O.minValue},max:{type:O.maxValueType,value:O.maxValue},isGradient:O.isGradient==="1",positiveColor:O.positiveColor,nativeColor:O.nativeColor},type:s.CFRuleType.dataBar});_.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return g({isGradient:o,minValue:I,minValueType:v,maxValue:y,maxValueType:C,positiveColor:a,nativeColor:l})}}),[o,I,v,y,C,a,l,t]);const w=O=>{e.onChange(g(O))},x=O=>{c(O),w({isGradient:o,minValue:I,minValueType:v,maxValue:y,maxValueType:C,positiveColor:O,nativeColor:l})},E=O=>{u(O),w({isGradient:o,minValue:I,minValueType:v,maxValue:y,maxValueType:C,positiveColor:a,nativeColor:O})},k=O=>d.map($=>$.value).includes(O);return f.jsxs("div",{children:[f.jsx("div",{className:M.title,children:n.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${N.cfPreviewWrap}`,children:f.jsx(ht,{rule:g({isGradient:o,minValue:I,minValueType:v,maxValue:y,maxValueType:C,positiveColor:a,nativeColor:l})})}),f.jsxs("div",{children:[f.jsx("div",{className:M.label,children:n.t("sheet.cf.panel.fillType")}),f.jsx("div",{className:`${M.mTSm} ${M.mLXxs} `,children:f.jsxs(B.RadioGroup,{value:o,onChange:O=>{i(O),w({isGradient:O,minValue:I,minValueType:v,maxValue:y,maxValueType:C,positiveColor:a,nativeColor:l})},children:[f.jsx(B.Radio,{value:"0",children:f.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.pureColor")})}),f.jsx(B.Radio,{value:"1",children:f.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.gradient")})})]})})]}),f.jsxs("div",{children:[f.jsx("div",{className:M.label,children:n.t("sheet.cf.panel.colorSet")}),f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm} ${M.mLXxs}`,children:[f.jsxs("div",{className:`${M.labelContainer}`,children:[f.jsx("div",{className:`${N.text}`,children:n.t("sheet.cf.panel.native")}),f.jsx(Ze,{color:l,onChange:E})]}),f.jsxs("div",{className:`${M.labelContainer} ${M.mLSm} `,children:[f.jsx("div",{className:`${N.text} `,children:n.t("sheet.cf.panel.positive")}),f.jsx(Ze,{color:a,onChange:x})]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:M.label,children:n.t("sheet.cf.valueType.min")}),f.jsxs("div",{className:`${M.mTSm} ${M.labelContainer}`,children:[f.jsx(B.Select,{options:p,value:v,onChange:O=>{b(O);const $=s.createDefaultValueByValueType(O,10);m($),w({isGradient:o,minValue:$,minValueType:O,maxValue:y,maxValueType:C,positiveColor:a,nativeColor:l})}}),f.jsx(kr,{disabled:!k(v),id:"min",type:v,className:M.mLSm,value:I,onChange:O=>{m(O||0),w({isGradient:o,minValue:O||0,minValueType:v,maxValue:y,maxValueType:C,positiveColor:a,nativeColor:l})}})]}),f.jsx("div",{className:M.label,children:n.t("sheet.cf.valueType.max")}),f.jsxs("div",{className:`${M.mTSm} ${M.labelContainer}`,children:[f.jsx(B.Select,{options:h,value:C,onChange:O=>{T(O);const $=s.createDefaultValueByValueType(O,90);R($),w({isGradient:o,minValue:I,minValueType:v,maxValue:$,maxValueType:O,positiveColor:a,nativeColor:l})}}),f.jsx(kr,{disabled:!k(C),id:"max",type:C,className:M.mLSm,value:y,onChange:O=>{R(O||0),w({isGradient:o,minValue:I,minValueType:v,maxValue:O||0,maxValueType:C,positiveColor:a,nativeColor:l})}})]})]})]})},su="univer-cf-style-edit",lu="univer-button-item",cu="univer-isActive",Le={cfStyleEdit:su,buttonItem:lu,isActive:cu},kt=e=>[S.BooleanNumber.FALSE,void 0].includes(e)?S.BooleanNumber.TRUE:S.BooleanNumber.FALSE,At=e=>e!==S.BooleanNumber.FALSE,gr=e=>{const{style:t,onChange:n,className:r}=e,o=Q.useDependency(Ce.ComponentManager),[i,a]=_.useState(()=>{if(t!=null&&t.bl)return t.bl}),[c,l]=_.useState(()=>{if(t!=null&&t.it)return t.it}),[u,d]=_.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[p,h]=_.useState(()=>{if(t!=null&&t.st)return t.st.s}),[v,b]=_.useState(()=>{var w;const g="#2f56ef";return(w=t==null?void 0:t.cl)!=null&&w.rgb?t.cl.rgb:g}),[C,T]=_.useState(()=>{var w;const g="#e8ecfc";return(w=t==null?void 0:t.bg)!=null&&w.rgb?t.bg.rgb:g}),I=o.get("BoldSingle"),m=o.get("ItalicSingle"),y=o.get("UnderlineSingle"),R=o.get("StrikethroughSingle");return _.useEffect(()=>{const g={bl:i,it:c};v!==void 0&&(g.cl={rgb:v}),C!==void 0&&(g.bg={rgb:C}),p!==void 0&&(g.st={s:p}),u!==void 0&&(g.ul={s:u}),n(s.removeUndefinedAttr(g))},[i,c,u,p,v,C]),f.jsxs("div",{className:`${Le.cfStyleEdit} ${r}`,children:[I&&f.jsx("div",{className:Ue({[Le.isActive]:At(i||S.BooleanNumber.FALSE)},Le.buttonItem),onClick:()=>a(kt(i)),children:f.jsx(I,{})}),m&&f.jsx("div",{className:Ue({[Le.isActive]:At(c||S.BooleanNumber.FALSE)},Le.buttonItem),onClick:()=>l(kt(c)),children:f.jsx(m,{})}),y&&f.jsx("div",{className:Ue({[Le.isActive]:At(u||S.BooleanNumber.FALSE)},Le.buttonItem),onClick:()=>d(kt(u)),children:f.jsx(y,{})}),R&&f.jsx("div",{className:Ue({[Le.isActive]:At(p||S.BooleanNumber.FALSE)},Le.buttonItem),onClick:()=>h(kt(p)),children:f.jsx(R,{})}),f.jsx(Ze,{color:v,onChange:b,iconId:"FontColor"}),f.jsx(Ze,{color:C,onChange:T,iconId:"PaintBucket"})]})},uu=e=>{var T;const{onChange:t,interceptorManager:n}=e,r=Q.useDependency(S.LocaleService),o=((T=e.rule)==null?void 0:T.type)===s.CFRuleType.highlightCell?e.rule:void 0,i=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[a,c]=_.useState(()=>{const I=i[0].value,m=o==null?void 0:o.type;if(!o)return I;switch(m){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":I;case s.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return I}),[l,u]=_.useState(()=>{const m=o==null?void 0:o.type;if(!o)return 10;switch(m){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.value||10}}return 10}),[d,p]=_.useState(()=>{const m=o==null?void 0:o.type;if(!o)return!1;switch(m){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[h,v]=_.useState({}),b=I=>{const{type:m,isPercent:y,value:R,style:g}=I;if(m==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:y,isBottom:!1,value:R,style:g};if(m==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:y,isBottom:!0,value:R,style:g};if(m==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:g};if(m==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:g}};_.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return b({type:a,isPercent:d,value:l,style:h})}}),[a,d,l,h,n]);const C=I=>{t(b(I))};return f.jsxs("div",{children:[f.jsx("div",{className:`${M.title} ${M.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx(B.Select,{className:`${N.width100} ${M.mTSm}`,value:a,options:i,onChange:I=>{c(I),C({type:I,isPercent:d,value:l,style:h})}}),["isNotBottom","isBottom"].includes(a)&&f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm}`,children:[f.jsx(B.InputNumber,{min:1,max:1e3,value:l,onChange:I=>{const m=I||0;u(m),C({type:a,isPercent:d,value:m,style:h})}}),f.jsxs("div",{className:`${M.mLSm} ${M.labelContainer} ${N.text}`,children:[f.jsx(B.Checkbox,{checked:d,onChange:I=>{p(!!I),C({type:a,isPercent:!!I,value:l,style:h})}}),r.t("sheet.cf.valueType.percent")]})]}),f.jsx("div",{className:`${N.cfPreviewWrap} `,children:f.jsx(ht,{rule:b({type:a,isPercent:d,value:l,style:h})})}),f.jsx(gr,{style:o==null?void 0:o.style,className:`${M.mTSm} `,onChange:I=>{v(I),C({type:a,isPercent:d,value:l,style:I})}})]})},J=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),du=e=>{const{type:t,operator:n,onChange:r,value:o}=e,[i,a]=_.useState(()=>typeof o=="number"?o:0),[c,l]=_.useState(()=>typeof o=="string"?o:""),[u,d]=_.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[p,h]=_.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100);switch(_.useEffect(()=>{switch(t){case s.CFSubRuleType.text:{[s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)&&r(c);break}case s.CFSubRuleType.number:{[s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)&&r(i),[s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)&&r([u,p]);break}}},[t]),t){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)){const v=b=>{l(b),r(b)};return f.jsx("div",{className:`${M.mTSm}`,children:f.jsx(B.Input,{className:N.width100,value:c,onChange:v})})}break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)){const v=b=>{a(b||0),r(b||0)};return f.jsx("div",{className:`${M.mTSm}`,children:f.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:N.width100,value:i,onChange:v})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const v=C=>{d(C||0),r([C||0,p])},b=C=>{h(C||0),r([u,C||0])};return f.jsxs("div",{className:`${M.mTSm} ${M.labelContainer} `,children:[f.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:u,onChange:v}),f.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${M.mLSm}`,value:p,onChange:b})]})}}}return null},Ar=(e,t)=>{switch(e){case s.CFSubRuleType.text:return[J(s.CFTextOperator.containsText,t),J(s.CFTextOperator.notContainsText,t),J(s.CFTextOperator.beginsWith,t),J(s.CFTextOperator.endsWith,t),J(s.CFTextOperator.equal,t),J(s.CFTextOperator.notEqual,t),J(s.CFTextOperator.containsBlanks,t),J(s.CFTextOperator.notContainsBlanks,t)];case s.CFSubRuleType.number:return[J(s.CFNumberOperator.between,t),J(s.CFNumberOperator.notBetween,t),J(s.CFNumberOperator.equal,t),J(s.CFNumberOperator.notEqual,t),J(s.CFNumberOperator.greaterThan,t),J(s.CFNumberOperator.greaterThanOrEqual,t),J(s.CFNumberOperator.lessThan,t),J(s.CFNumberOperator.lessThanOrEqual,t)];case s.CFSubRuleType.timePeriod:return[J(s.CFTimePeriodOperator.yesterday,t),J(s.CFTimePeriodOperator.today,t),J(s.CFTimePeriodOperator.tomorrow,t),J(s.CFTimePeriodOperator.last7Days,t),J(s.CFTimePeriodOperator.lastWeek,t),J(s.CFTimePeriodOperator.thisWeek,t),J(s.CFTimePeriodOperator.nextWeek,t),J(s.CFTimePeriodOperator.lastMonth,t),J(s.CFTimePeriodOperator.thisMonth,t),J(s.CFTimePeriodOperator.nextMonth,t)]}},Vr=e=>{var R;const{interceptorManager:t,onChange:n}=e,r=Q.useDependency(S.LocaleService),o=((R=e.rule)==null?void 0:R.type)===s.CFRuleType.highlightCell?e.rule:void 0,[i,a]=_.useState(()=>{const g=s.CFSubRuleType.text;return o&&o.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=_.useMemo(()=>Ar(i,r),[i]),[u,d]=_.useState(()=>{const g=l?l[0].value:void 0;return o&&o.operator||g}),[p,h]=_.useState(()=>{var x;const g="";return o?(x=o.value)!=null?x:s.createDefaultValue(o.subType,o.operator):g}),[v,b]=_.useState({}),C=_.useMemo(()=>g=>{var w,x,E,k,W,O,$,D,F,j,H,K,se,ne,le;switch(g.subType||i){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(u))return{type:s.CFRuleType.highlightCell,subType:(w=g.subType)!=null?w:i,operator:(x=g.operator)!=null?x:u,style:(E=g.style)!=null?E:v,value:(k=g.value)!=null?k:p};break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(u))return{type:s.CFRuleType.highlightCell,subType:(W=g.subType)!=null?W:i,operator:(O=g.operator)!=null?O:u,style:($=g.style)!=null?$:v,value:(D=g.value)!=null?D:p};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(u))return{type:s.CFRuleType.highlightCell,subType:(F=g.subType)!=null?F:i,operator:(j=g.operator)!=null?j:u,style:(H=g.style)!=null?H:v,value:(K=g.value)!=null?K:p};break}}return{type:s.CFRuleType.highlightCell,subType:(se=g.subType)!=null?se:i,operator:(ne=g.operator)!=null?ne:u,style:(le=g.style)!=null?le:v}},[i,u,p,v]);_.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return C({})}}),[C,t]),_.useEffect(()=>{c.some(g=>g.value===i)||a(c[0].value)},[c]);const T=g=>{const w=g,x=Ar(w,r),E=x&&x[0].value;a(w),d(E),E&&h(s.createDefaultValue(w,E)),n(C({subType:w,operator:E}))},I=g=>{const w=g;d(w),n(C({operator:w}))},m=g=>{h(g),n(C({value:g}))},y=_.useMemo(()=>`${i}_${u}_${Math.random()}`,[i,u]);return f.jsxs("div",{children:[f.jsx("div",{className:`${M.title} ${M.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx(B.Select,{className:`${M.mTSm} ${N.width100}`,onChange:T,value:i,options:c}),(l==null?void 0:l.length)&&f.jsx(B.Select,{className:`${M.mTSm} ${N.width100}`,onChange:I,value:u||"",options:l}),f.jsx(du,{value:p,interceptorManager:t,type:i,operator:u,rule:o,onChange:m},y),f.jsx("div",{className:`${N.cfPreviewWrap}`,children:f.jsx(ht,{rule:C({})})}),f.jsx(gr,{style:o==null?void 0:o.style,className:`${M.mLXxs}`,onChange:g=>{b(g),n(C({style:g}))}})]})},fu=e=>{var b;const{onChange:t,interceptorManager:n}=e,r=Q.useDependency(S.LocaleService),i=Q.useDependency(S.IUniverInstanceService).getCurrentUniverSheetInstance(),a=i.getActiveSheet(),c=((b=e.rule)==null?void 0:b.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,u]=_.useState({}),[d,p]=_.useState(()=>(c==null?void 0:c.subType)===s.CFSubRuleType.formula?c.value:"="),h=C=>({style:C.style,value:d,type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula});_.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return h({style:l,formula:d})}}),[l,d,n]);const v=C=>{t(h(C))};return f.jsxs("div",{children:[f.jsx("div",{className:`${M.title} ${M.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${M.mTSm}`,children:f.jsx(Ce.TextEditor,{id:`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`,openForSheetSubUnitId:a.getSheetId(),openForSheetUnitId:i.getUnitId(),value:d,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(C="")=>{const T=C||"";p(T),v({style:l,formula:T})}})}),f.jsx("div",{className:`${N.cfPreviewWrap} `,children:f.jsx(ht,{rule:h({style:l,formula:d})})}),f.jsx(gr,{style:c==null?void 0:c.style,className:`${M.mTSm} `,onChange:C=>{u(C),v({style:C,formula:d})}})]})};var hu="Expected a function",oi="__lodash_hash_undefined__",ii=1/0,pu=9007199254740991,gu="[object Function]",mu="[object GeneratorFunction]",vu="[object Symbol]",yu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cu=/^\w*$/,Su=/^\./,bu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ru=/[\\^$.*+?()[\]{}|]/g,Iu=/\\(\\)?/g,wu=/^\[object .+?Constructor\]$/,Tu=/^(?:0|[1-9]\d*)$/,_u=typeof ke=="object"&&ke&&ke.Object===Object&&ke,xu=typeof self=="object"&&self&&self.Object===Object&&self,mr=_u||xu||Function("return this")();function Ou(e,t){return e==null?void 0:e[t]}function Mu(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Du=Array.prototype,Eu=Function.prototype,ai=Object.prototype,Dn=mr["__core-js_shared__"],zr=function(){var e=/[^.]+$/.exec(Dn&&Dn.keys&&Dn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),si=Eu.toString,hn=ai.hasOwnProperty,li=ai.toString,Pu=RegExp("^"+si.call(hn).replace(Ru,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ur=mr.Symbol,Nu=Du.splice,Fu=ci(mr,"Map"),xt=ci(Object,"create"),Wr=Ur?Ur.prototype:void 0,qr=Wr?Wr.toString:void 0;function Je(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__=xt?xt(null):{}}function ju(e){return this.has(e)&&delete this.__data__[e]}function Lu(e){var t=this.__data__;if(xt){var n=t[e];return n===oi?void 0:n}return hn.call(t,e)?t[e]:void 0}function ku(e){var t=this.__data__;return xt?t[e]!==void 0:hn.call(t,e)}function Au(e,t){var n=this.__data__;return n[e]=xt&&t===void 0?oi:t,this}Je.prototype.clear=$u;Je.prototype.delete=ju;Je.prototype.get=Lu;Je.prototype.has=ku;Je.prototype.set=Au;function pt(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 Vu(){this.__data__=[]}function zu(e){var t=this.__data__,n=pn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Nu.call(t,n,1),!0}function Uu(e){var t=this.__data__,n=pn(t,e);return n<0?void 0:t[n][1]}function Wu(e){return pn(this.__data__,e)>-1}function qu(e,t){var n=this.__data__,r=pn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}pt.prototype.clear=Vu;pt.prototype.delete=zu;pt.prototype.get=Uu;pt.prototype.has=Wu;pt.prototype.set=qu;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 Hu(){this.__data__={hash:new Je,map:new(Fu||pt),string:new Je}}function Bu(e){return gn(this,e).delete(e)}function Gu(e){return gn(this,e).get(e)}function Xu(e){return gn(this,e).has(e)}function Yu(e,t){return gn(this,e).set(e,t),this}rt.prototype.clear=Hu;rt.prototype.delete=Bu;rt.prototype.get=Gu;rt.prototype.has=Xu;rt.prototype.set=Yu;function Ku(e,t,n){var r=e[t];(!(hn.call(e,t)&&ui(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function pn(e,t){for(var n=e.length;n--;)if(ui(e[n][0],t))return n;return-1}function Zu(e){if(!Zt(e)||od(e))return!1;var t=ld(e)||Mu(e)?Pu:wu;return t.test(sd(e))}function Ju(e,t,n,r){if(!Zt(e))return e;t=nd(t,e)?[t]:ed(t);for(var o=-1,i=t.length,a=i-1,c=e;c!=null&&++o<i;){var l=ad(t[o]),u=n;if(o!=a){var d=c[l];u=r?r(d,l,c):void 0,u===void 0&&(u=Zt(d)?d:td(t[o+1])?[]:{})}Ku(c,l,u),c=c[l]}return e}function Qu(e){if(typeof e=="string")return e;if(yr(e))return qr?qr.call(e):"";var t=e+"";return t=="0"&&1/e==-ii?"-0":t}function ed(e){return di(e)?e:id(e)}function gn(e,t){var n=e.__data__;return rd(t)?n[typeof t=="string"?"string":"hash"]:n.map}function ci(e,t){var n=Ou(e,t);return Zu(n)?n:void 0}function td(e,t){return t=t==null?pu:t,!!t&&(typeof e=="number"||Tu.test(e))&&e>-1&&e%1==0&&e<t}function nd(e,t){if(di(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||yr(e)?!0:Cu.test(e)||!yu.test(e)||t!=null&&e in Object(t)}function rd(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function od(e){return!!zr&&zr in e}var id=vr(function(e){e=ud(e);var t=[];return Su.test(e)&&t.push(""),e.replace(bu,function(n,r,o,i){t.push(o?i.replace(Iu,"$1"):r||n)}),t});function ad(e){if(typeof e=="string"||yr(e))return e;var t=e+"";return t=="0"&&1/e==-ii?"-0":t}function sd(e){if(e!=null){try{return si.call(e)}catch{}try{return e+""}catch{}}return""}function vr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(hu);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(vr.Cache||rt),n}vr.Cache=rt;function ui(e,t){return e===t||e!==e&&t!==t}var di=Array.isArray;function ld(e){var t=Zt(e)?li.call(e):"";return t==gu||t==mu}function Zt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function cd(e){return!!e&&typeof e=="object"}function yr(e){return typeof e=="symbol"||cd(e)&&li.call(e)==vu}function ud(e){return e==null?"":Qu(e)}function dd(e,t,n){return e==null?e:Ju(e,t,n)}var fd=dd;const hd=Bn(fd);var pd="Expected a function",fi="__lodash_hash_undefined__",hi=1/0,gd="[object Function]",md="[object GeneratorFunction]",vd="[object Symbol]",yd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cd=/^\w*$/,Sd=/^\./,bd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rd=/[\\^$.*+?()[\]{}|]/g,Id=/\\(\\)?/g,wd=/^\[object .+?Constructor\]$/,Td=typeof ke=="object"&&ke&&ke.Object===Object&&ke,_d=typeof self=="object"&&self&&self.Object===Object&&self,Cr=Td||_d||Function("return this")();function xd(e,t){return e==null?void 0:e[t]}function Od(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Md=Array.prototype,Dd=Function.prototype,pi=Object.prototype,En=Cr["__core-js_shared__"],Hr=function(){var e=/[^.]+$/.exec(En&&En.keys&&En.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),gi=Dd.toString,Sr=pi.hasOwnProperty,mi=pi.toString,Ed=RegExp("^"+gi.call(Sr).replace(Rd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Br=Cr.Symbol,Pd=Md.splice,Nd=vi(Cr,"Map"),Ot=vi(Object,"create"),Gr=Br?Br.prototype:void 0,Xr=Gr?Gr.toString:void 0;function Qe(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 Fd(){this.__data__=Ot?Ot(null):{}}function $d(e){return this.has(e)&&delete this.__data__[e]}function jd(e){var t=this.__data__;if(Ot){var n=t[e];return n===fi?void 0:n}return Sr.call(t,e)?t[e]:void 0}function Ld(e){var t=this.__data__;return Ot?t[e]!==void 0:Sr.call(t,e)}function kd(e,t){var n=this.__data__;return n[e]=Ot&&t===void 0?fi:t,this}Qe.prototype.clear=Fd;Qe.prototype.delete=$d;Qe.prototype.get=jd;Qe.prototype.has=Ld;Qe.prototype.set=kd;function gt(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 Ad(){this.__data__=[]}function Vd(e){var t=this.__data__,n=mn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Pd.call(t,n,1),!0}function zd(e){var t=this.__data__,n=mn(t,e);return n<0?void 0:t[n][1]}function Ud(e){return mn(this.__data__,e)>-1}function Wd(e,t){var n=this.__data__,r=mn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}gt.prototype.clear=Ad;gt.prototype.delete=Vd;gt.prototype.get=zd;gt.prototype.has=Ud;gt.prototype.set=Wd;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 qd(){this.__data__={hash:new Qe,map:new(Nd||gt),string:new Qe}}function Hd(e){return vn(this,e).delete(e)}function Bd(e){return vn(this,e).get(e)}function Gd(e){return vn(this,e).has(e)}function Xd(e,t){return vn(this,e).set(e,t),this}ot.prototype.clear=qd;ot.prototype.delete=Hd;ot.prototype.get=Bd;ot.prototype.has=Gd;ot.prototype.set=Xd;function mn(e,t){for(var n=e.length;n--;)if(af(e[n][0],t))return n;return-1}function Yd(e,t){t=Qd(t,e)?[t]:Jd(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[rf(t[n++])];return n&&n==r?e:void 0}function Kd(e){if(!Ci(e)||tf(e))return!1;var t=sf(e)||Od(e)?Ed:wd;return t.test(of(e))}function Zd(e){if(typeof e=="string")return e;if(Rr(e))return Xr?Xr.call(e):"";var t=e+"";return t=="0"&&1/e==-hi?"-0":t}function Jd(e){return yi(e)?e:nf(e)}function vn(e,t){var n=e.__data__;return ef(t)?n[typeof t=="string"?"string":"hash"]:n.map}function vi(e,t){var n=xd(e,t);return Kd(n)?n:void 0}function Qd(e,t){if(yi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Rr(e)?!0:Cd.test(e)||!yd.test(e)||t!=null&&e in Object(t)}function ef(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function tf(e){return!!Hr&&Hr in e}var nf=br(function(e){e=cf(e);var t=[];return Sd.test(e)&&t.push(""),e.replace(bd,function(n,r,o,i){t.push(o?i.replace(Id,"$1"):r||n)}),t});function rf(e){if(typeof e=="string"||Rr(e))return e;var t=e+"";return t=="0"&&1/e==-hi?"-0":t}function of(e){if(e!=null){try{return gi.call(e)}catch{}try{return e+""}catch{}}return""}function br(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(pd);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(br.Cache||ot),n}br.Cache=ot;function af(e,t){return e===t||e!==e&&t!==t}var yi=Array.isArray;function sf(e){var t=Ci(e)?mi.call(e):"";return t==gd||t==md}function Ci(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function lf(e){return!!e&&typeof e=="object"}function Rr(e){return typeof e=="symbol"||lf(e)&&mi.call(e)==vd}function cf(e){return e==null?"":Zd(e)}function uf(e,t,n){var r=e==null?void 0:Yd(e,t);return r===void 0?n:r}var df=uf;const ff=Bn(df),Si=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",hf=e=>{const t=Q.useDependency(S.IUniverInstanceService),n=t.getCurrentUniverSheetInstance().getUnitId(),r=t.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),o=_.useMemo(()=>e.error?N.errorInput:"",[e.error]);return f.jsx("div",{className:N.positionRelative,children:e.type!==s.CFValueType.formula?f.jsxs(f.Fragment,{children:[f.jsx(B.InputNumber,{className:o,value:Number(e.value)||0,onChange:i=>e.onChange(i!=null?i:0)}),e.error&&f.jsx("div",{className:N.errorText,children:e.error})]}):f.jsx(Ce.TextEditor,{id:`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_icon_set_${e.id}`,value:String(e.value).startsWith("=")?String(e.value):"=",openForSheetSubUnitId:r,openForSheetUnitId:n,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(i="")=>{const a=i||"";e.onChange(a)}})})},Yr=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),pf=e=>{const t=Q.useDependency(S.LocaleService),n=r=>{e.onClick(r)};return f.jsx("div",{className:N.iconGroupList,children:s.iconGroup.map((r,o)=>f.jsxs("div",{className:N.group,children:[f.jsx("div",{className:N.title,children:t.t(r.title)}),f.jsx("div",{className:N.itemContent,children:r.group.map(i=>f.jsx("div",{className:N.itemWrap,onClick:()=>{n(i.name)},children:f.jsx("div",{className:N.item,children:i.list.map((a,c)=>f.jsx("img",{className:N.icon,src:a},c))})},i.name))})]},o))})},gf=e=>{const t=_.useMemo(()=>{const r=[];for(const o in s.iconMap){const i=s.iconMap[o],a=o;i.forEach((c,l)=>{r.push({iconType:a,base64:c,iconId:String(l)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return f.jsxs("div",{className:N.iconItemListWrap,children:[f.jsxs("div",{className:N.none,onClick:()=>n({iconType:s.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[f.jsx(Jt,{className:N.icon}),f.jsx("span",{children:"无单元格图标"})]}),f.jsx("div",{className:N.iconItemList,children:t.map(r=>f.jsx("div",{className:N.item,children:f.jsx("img",{onClick:()=>n(r),className:`${N.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},mf=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,o=Q.useDependency(S.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],a=[{label:o.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],c=(p,h)=>{t([String(h),"value","value"],p)},l=(p,h)=>{t([String(h),"operator"],p);const v=s.createDefaultValue(s.CFSubRuleType.number,p);c(v,h)},u=(p,h)=>{t([String(h),"value","type"],p)};return _.useMemo(()=>n.map((p,h)=>{const v=r[h],b=Si(p.iconType,p.iconId),C=h===n.length-1,T=h===0,I=n[h-1],m=(I==null?void 0:I.value.type)===s.CFValueType.formula?o.t("sheet.cf.valueType.formula"):I==null?void 0:I.value.value,y=(R,g)=>{const w={...p,iconId:g,iconType:R};t([String(h)],w)};return f.jsxs("div",{className:`${h?M.mTXl:M.mTSm}`,children:[f.jsxs("div",{className:`${M.label} ${N.flex}`,children:[f.jsxs("div",{className:`${N.width45}`,children:[o.t("sheet.cf.iconSet.icon"),h+1]}),f.jsx("div",{className:`${N.width45}`,children:f.jsxs(f.Fragment,{children:[!T&&!C&&o.t("sheet.cf.iconSet.rule"),!T&&!C&&f.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(I.operator)}`),m,C?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),f.jsxs("div",{className:`${N.flex} ${M.mTSm}`,children:[f.jsx("div",{className:`${N.iconWrap} ${N.width45}`,children:f.jsx(B.Dropdown,{overlay:f.jsx(gf,{onClick:y,iconId:p.iconId,iconType:p.iconType}),children:f.jsxs("div",{className:N.dropdownIcon,children:[b?f.jsx("img",{src:b,className:N.icon}):f.jsx(Jt,{className:N.icon}),f.jsx(Hn,{})]})})}),C?f.jsxs("div",{className:`${N.width45} ${M.label}`,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),f.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(I.operator)}`),m,C?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):f.jsx(B.Select,{className:`${M.mL0} ${N.width45} ${M.mR0}`,options:i,value:p.operator,onChange:R=>{l(R,h)}})]}),C?f.jsx("div",{}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:`${M.mTSm} ${M.label} ${N.flex}`,children:[f.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.type")}),f.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.value")})]}),f.jsxs("div",{className:`${M.mTSm} ${N.flex}`,children:[f.jsx(B.Select,{className:`${N.width45} ${M.mL0}`,options:a,value:p.value.type,onChange:R=>{u(R,h)}}),f.jsx("div",{className:`${M.mL0} ${N.width45}`,children:f.jsx(hf,{id:h,type:p.value.type,error:v,value:p.value.value||"",onChange:R=>c(R,h)})})]})]})]},h)}),[n,r])},vf=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(S.LocaleService),[o,i]=_.useState({}),[a,c]=_.useState(()=>{const m=Object.keys(s.iconMap)[0];if(n&&n.config.length){const y=n.config[0].iconType;if(!n.config.some(g=>g.iconType!==y))return y}return m}),[l,u]=_.useState(()=>{if(n&&n.config.length)return S.Tools.deepClone(n==null?void 0:n.config);const m=s.iconMap[a]||[];return new Array(m.length).fill("").map((y,R,g)=>R===g.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:a,iconId:String(R)}:Yr(a,R,g))}),[d,p]=_.useState(()=>n?!!n.isShowValue:!0),h=_.useMemo(()=>{const m=l.map(y=>Si(y.iconType,y.iconId));return f.jsx("div",{className:N.iconWrap,children:m.map((y,R)=>y?f.jsx("img",{className:N.icon,src:y},R):f.jsx(Jt,{className:N.icon},R))})},[l]),v=m=>{if(m.reduce((R,g,w)=>R.preType&&!R.result||m.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(m[0].value.type)){const R={};return m.forEach((g,w,x)=>{if(w-1<0||w===x.length-1)return;const k=m[w-1],W=s.getOppositeOperator(k.operator);s.compareWithNumber({operator:W,value:k.value.value},g.value.value)||(R[w]=`${r.t(`sheet.cf.form.${W}`,String(k.value.value))} `)}),R}return{}},b=(m,y)=>{ff(l,m)!==y&&(hd(l,m,y),u([...l]),i(v(l)))},C=m=>{c(m);const y=s.iconMap[m]||[],R=new Array(y.length).fill("").map((g,w,x)=>Yr(m,w,x));u(R),i(v(R))};_.useEffect(()=>{const m=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:d,config:l}}});return()=>{m()}},[d,l,t]),_.useEffect(()=>{const m=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{m()}},[d,l,t,o]);const T=()=>{const m=l.map(y=>({...y}));l.forEach((y,R)=>{const g=l.length-1-R,w=m[g];y.iconId=w.iconId,y.iconType=w.iconType}),u([...l])};return f.jsxs("div",{className:N.iconSet,children:[f.jsx("div",{className:M.title,children:r.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${M.mTSm}`,children:f.jsx(B.Dropdown,{overlay:f.jsx(pf,{iconType:a,onClick:C}),children:f.jsxs("div",{className:N.dropdownIcon,style:{width:"unset"},children:[h,f.jsx(Hn,{})]})})}),f.jsxs("div",{className:`${M.mTSm} ${N.renderConfig}`,children:[f.jsxs("div",{className:N.utilItem,children:[f.jsx(B.Checkbox,{onChange:T}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),f.jsxs("div",{className:`${N.utilItem} ${M.mLXl}`,children:[f.jsx(B.Checkbox,{checked:!d,onChange:m=>{p(!m)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),f.jsx(mf,{errorMap:o,onChange:b,configList:l})]})},Kr=e=>e.getCurrentUniverSheetInstance().getUnitId(),Zr=e=>e.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),yf=e=>{var R,g;const t=Q.useDependency(S.LocaleService),n=Q.useDependency(S.ICommandService),r=Q.useDependency(S.IUniverInstanceService),o=Q.useDependency(s.ConditionalFormattingRuleModel),i=Q.useDependency(ee.SelectionManagerService),a=Kr(r),c=Zr(r),l=_.useRef([]),u=_.useMemo(()=>{var x,E;let w=(x=e.rule)==null?void 0:x.ranges;return w!=null&&w.length||(w=(E=i.getSelectionRanges())!=null?E:[]),w!=null&&w.length?w.map(k=>{const W=to.serializeRange(k);return W==="NaN"?"":W}).filter(k=>!!k).join(","):""},[e.rule]),d=[{label:t.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:t.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:t.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:t.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:t.t("sheet.cf.ruleType.formula"),value:"5"},{label:t.t("sheet.cf.ruleType.iconSet"),value:"6"}],[p,h]=_.useState(()=>{var E,k;const w=(E=e.rule)==null?void 0:E.rule.type,x=d[0].value;if(!w)return x;switch(w){case s.CFRuleType.highlightCell:{switch((k=e.rule)==null?void 0:k.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 x}),v=_.useRef(),b=_.useMemo(()=>new S.InterceptorManager({beforeSubmit:Oc,submit:Mc}),[]),C=_.useMemo(()=>{switch(p){case"1":return Vr;case"2":return uu;case"3":return au;case"4":return iu;case"5":return fu;case"6":return vf;default:return Vr}},[p]);_.useEffect(()=>{var w;if(((w=e.rule)==null?void 0:w.cfId)!==void 0){const x=n.onCommandExecuted(E=>{if(E.id===ee.RemoveSheetMutation.id){const k=E.params;k.subUnitId===c&&k.unitId===a&&e.onCancel()}E.id===ee.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>x.dispose()}},[(R=e.rule)==null?void 0:R.cfId]);const T=w=>{v.current=w},I=w=>{l.current=w.map(x=>x.range)},m=()=>{const w=b.fetchThroughInterceptors(b.getInterceptPoints().beforeSubmit)(!0,null),x=()=>{const E=l.current;return E.some(W=>Number.isNaN(W.startRow)||Number.isNaN(W.startColumn))?[]:E};if(w){const E=b.fetchThroughInterceptors(b.getInterceptPoints().submit)(null,null),k=x();if(E&&k.length){const W=Kr(r),O=Zr(r);let $={};e.rule&&e.rule.cfId?($={...e.rule,ranges:k,rule:E},n.executeCommand(ri.id,{unitId:W,subUnitId:O,rule:$}),e.onCancel()):($={cfId:o.createCfId(W,O),ranges:k,rule:E,stopIfTrue:!1},n.executeCommand(ni.id,{unitId:W,subUnitId:O,rule:$}),e.onCancel())}}},y=()=>{e.onCancel()};return f.jsxs("div",{className:N.cfRuleStyleEditor,children:[f.jsx("div",{className:M.title,children:t.t("sheet.cf.panel.range")}),f.jsx("div",{className:`${M.mTBase}`,children:f.jsx(Ce.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:c,openForSheetUnitId:a,value:u,id:`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`,onChange:I})}),f.jsx("div",{className:M.title,children:t.t("sheet.cf.panel.styleType")}),f.jsx("div",{className:M.mTBase,children:f.jsx(B.Select,{className:N.width100,value:p,options:d,onChange:w=>h(w)})}),f.jsx(C,{interceptorManager:b,rule:(g=e.rule)==null?void 0:g.rule,onChange:T}),f.jsxs("div",{className:`${M.mTBase} ${N.btnList}`,children:[f.jsx(B.Button,{size:"small",onClick:y,children:t.t("sheet.cf.panel.cancel")}),f.jsx(B.Button,{className:M.mLSm,size:"small",type:"primary",onClick:m,children:t.t("sheet.cf.panel.submit")})]})]})},Cf=e=>{const[t,n]=_.useState(e.rule),[r,o]=_.useState(!!e.rule),i=()=>{o(!0)},a=()=>{o(!1),n(void 0)},c=l=>{n(l),o(!0)};return f.jsx("div",{className:M.conditionalFormattingWrap,children:r?f.jsx(yf,{onCancel:a,rule:t}):f.jsx(xc,{onClick:c,onCreate:i})})};var Sf=Object.defineProperty,bf=Object.getOwnPropertyDescriptor,Rf=(e,t,n,r)=>{for(var o=r>1?void 0:r?bf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Sf(t,n,o),o},yt=(e,t)=>(n,r)=>t(n,r,e);const Jr="sheet.conditional.formatting.panel";let _t=class extends S.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._componentManager=t,this._menuService=n,this._sidebarService=r,this._localeService=o,this._initMenu(),this._initPanel()}openPanel(e){const t={header:{title:this._localeService.t("sheet.cf.title")},children:{label:Jr,rule:e}};this._sidebarService.open(t)}_initMenu(){this._menuService.addMenuItem(Xi(this._componentManager)(this._injector))}_initPanel(){this._componentManager.register(Jr,Cf)}};_t=Rf([S.OnLifecycle(S.LifecycleStages.Ready,_t),yt(0,V.Inject(V.Injector)),yt(1,V.Inject(Ce.ComponentManager)),yt(2,V.Inject(Ce.IMenuService)),yt(3,V.Inject(Ce.ISidebarService)),yt(4,V.Inject(S.LocaleService))],_t);var be=(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))(be||{});const bi={id:"sheet.operation.open.conditional.formatting.panel",type:S.CommandType.OPERATION,handler:(e,t)=>{const n=e.get(_t),r=e.get(ee.SelectionManagerService),o=e.get(S.ICommandService),i=r.getSelectionRanges()||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 4:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(c);break}case 5:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(c);break}case 6:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(c);break}case 7:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.dataBar}};n.openPanel(c);break}case 8:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(c);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(ro.id,{ranges:i});break}case 10:{o.executeCommand(qn.id);break}}return!0}};var If=Object.defineProperty,wf=Object.getOwnPropertyDescriptor,Tf=(e,t,n,r)=>{for(var o=r>1?void 0:r?wf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&If(t,n,o),o},Ge=(e,t)=>(n,r)=>t(n,r,e);let zt=class extends S.Disposable{constructor(e,t,n,r,o,i,a){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=i,this._sheetSkeletonManagerService=a,this._initViewModelInterceptor(),this._initSkeleton(),this._initRender()}_initRender(){const e=[[s.dataBarUKey,s.DataBar],[s.IconUKey,s.ConditionalFormattingIcon]],t=r=>{const o=r&&this._renderManagerService.getRenderById(r),i=o&&o.mainComponent;i&&e.forEach(([a,c])=>{i.getExtensionByKey(a)||i.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(Oe.bufferTime(16),Oe.filter(t=>{const n=this._univerInstanceService.getCurrentUniverSheetInstance(),r=n.getActiveSheet();return t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(Oe.bufferTime(16),Oe.filter(t=>{const n=this._univerInstanceService.getCurrentUniverSheetInstance(),r=n.getActiveSheet();return t.filter(o=>["sort","delete"].includes(o.type)&&o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(Oe.bufferTime(16),Oe.filter(t=>{const n=this._univerInstanceService.getCurrentUniverSheetInstance(),r=n.getActiveSheet();return t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0})).subscribe(e))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(ee.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!r)return n(e);const o=t.workbook.getStyles(),a={...(typeof(e==null?void 0:e.s)=="string"?o.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},c={...e,s:a};return r.style&&Object.assign(a,r.style),r.dataBar&&(c.dataBar=r.dataBar),r.iconSet&&(c.iconSet=r.iconSet,c.fontRenderExtension||(c.fontRenderExtension={}),c.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH,r.iconSet.isShowValue||(c.fontRenderExtension.isSkip=!0)),n(c)}}))}};zt=Tf([S.OnLifecycle(S.LifecycleStages.Rendered,zt),Ge(0,V.Inject(ee.SheetInterceptorService)),Ge(1,V.Inject(s.ConditionalFormattingService)),Ge(2,V.Inject(S.IUniverInstanceService)),Ge(3,V.Inject(Ti.IRenderManagerService)),Ge(4,V.Inject(s.ConditionalFormattingViewModel)),Ge(5,V.Inject(s.ConditionalFormattingRuleModel)),Ge(6,V.Inject(ge.SheetSkeletonManagerService))],zt);var _f=Object.defineProperty,xf=Object.getOwnPropertyDescriptor,Of=(e,t,n,r)=>{for(var o=r>1?void 0:r?xf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&_f(t,n,o),o},Ct=(e,t)=>(n,r)=>t(n,r,e);let Ut=class extends S.Disposable{constructor(t,n,r,o,i){super();it(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=o,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,n,r)=>this._collectConditionalRule(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:i=ge.COPY_TYPE.COPY,pasteType:a}=o,{range:c}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:i,pasteType:a,copyRange:c})}}))}_collectConditionalRule(t,n,r){const o=new S.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:t,subUnitId:n,cfMap:i}};const a=this._conditionalFormattingViewModel.getMatrix(t,n);if(!a)return;const c=new Set;S.Range.foreach(r,(l,u)=>{const d=this._conditionalFormattingViewModel.getCellCf(t,n,l,u,a);if(!d)return;const p=S.Rectangle.getRelativeRange({startRow:l,endRow:l,startColumn:u,endColumn:u},r);d.cfList.forEach(h=>c.add(h.cfId)),o.setValue(p.startRow,p.startColumn,d.cfList.map(h=>h.cfId))}),c.forEach(l=>{const u=this._conditionalFormattingRuleModel.getRule(t,n,l);u&&(i[l]=u.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUniverSheetInstance(),o=r.getActiveSheet(),i=r.getUnitId(),a=o.getSheetId();if(n.copyType===ge.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![ge.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,ge.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,ge.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const c=ge.getRepeatRange(n.copyRange,t,!0),l=this._conditionalFormattingViewModel.getMatrix(i,a),u={};S.Range.foreach(t,(m,y)=>{const R=this._conditionalFormattingViewModel.getCellCf(i,a,m,y,l);R&&R.cfList.forEach(g=>{if(!u[g.cfId]){const w=new S.ObjectMatrix;u[g.cfId]=w;const x=this._conditionalFormattingRuleModel.getRule(i,a,g.cfId);x==null||x.ranges.forEach(E=>{S.Range.foreach(E,(k,W)=>{w.setValue(k,W,1)})})}u[g.cfId].realDeleteValue(m,y)})});const{matrix:d,info:p}=this._copyInfo,h=[];let v=this._conditionalFormattingRuleModel.createCfId(i,a);const b={},C=m=>{if(b[m])return b[m];const y=p==null?void 0:p.cfMap[m],R=[...this._conditionalFormattingRuleModel.getSubunitRules(i,a)||[],...h].find(g=>S.Tools.diffValue(g.rule,y));if(R)return b[m]=R,R;{const g={rule:y,cfId:v,ranges:[],stopIfTrue:!1};return b[m]=g,h.push(g),v=`${Number(v)+1}`,g}};c.forEach(m=>{d&&d.forValue((y,R,g)=>{const w=S.Rectangle.getPositionRange({startRow:y,endRow:y,startColumn:R,endColumn:R},m.startRange),x=w.startRow,E=w.startColumn;g.forEach(k=>{if(!u[k]){const W=C(k),O=new S.ObjectMatrix;u[k]=O,W.ranges.forEach($=>{S.Range.foreach($,(D,F)=>{O.setValue(D,F,1)})})}u[k].setValue(x,E,1)})})});const T=[],I=[];for(const m in u){const y=u[m],R=ee.findAllRectangle(ee.createTopMatrixFromMatrix(y));if(!R.length){const g={unitId:i,subUnitId:a,cfId:m};T.push({id:s.DeleteConditionalRuleMutation.id,params:g}),I.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}if(h.some(g=>g.cfId===m)){const g=C(m),w={unitId:i,subUnitId:a,rule:{...g,ranges:R}};T.push({id:s.AddConditionalRuleMutation.id,params:w}),I.push(s.AddConditionalRuleMutationUndoFactory(this._injector,w))}else{const g=this._conditionalFormattingRuleModel.getRule(i,a,m);if(!g)continue;const w={unitId:i,subUnitId:a,rule:{...g,ranges:R}};T.push({id:s.SetConditionalRuleMutation.id,params:w}),I.push(...s.setConditionalRuleMutationUndoFactory(this._injector,w))}}return{redos:T,undos:I}}};Ut=Of([S.OnLifecycle(S.LifecycleStages.Rendered,Ut),Ct(0,V.Inject(ge.ISheetClipboardService)),Ct(1,V.Inject(s.ConditionalFormattingRuleModel)),Ct(2,V.Inject(V.Injector)),Ct(3,V.Inject(s.ConditionalFormattingViewModel)),Ct(4,V.Inject(S.IUniverInstanceService))],Ut);var Mf=Object.defineProperty,Df=Object.getOwnPropertyDescriptor,Ef=(e,t,n,r)=>{for(var o=r>1?void 0:r?Df(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Mf(t,n,o),o},St=(e,t)=>(n,r)=>t(n,r,e);let Wt=class extends S.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(o,i,a,c)=>{const l=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(),u=this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),d={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},p={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};S.Range.foreach(a,(h,v)=>{const b=S.Rectangle.getPositionRange({startRow:h,startColumn:v,endColumn:v,endRow:h},d),C=S.Rectangle.getPositionRange({startRow:h,startColumn:v,endColumn:v,endRow:h},p),T=this._conditionalFormattingViewModel.getCellCf(l,u,b.startRow,b.startColumn),I=this._conditionalFormattingViewModel.getCellCf(l,u,C.startRow,C.startColumn);I&&I.cfList.forEach(m=>{let y=c.get(m.cfId);if(!c.get(m.cfId)){const R=this._conditionalFormattingRuleModel.getRule(l,u,m.cfId);if(!R)return;y=new S.ObjectMatrix,R.ranges.forEach(g=>{S.Range.foreach(g,(w,x)=>{y.setValue(w,x,1)})}),c.set(m.cfId,y)}y.realDeleteValue(C.startRow,C.startColumn)}),T&&T.cfList.forEach(m=>{let y=c.get(m.cfId);if(!c.get(m.cfId)){const R=this._conditionalFormattingRuleModel.getRule(l,u,m.cfId);if(!R)return;y=new S.ObjectMatrix,R.ranges.forEach(g=>{S.Range.foreach(g,(w,x)=>{y.setValue(w,x,1)})}),c.set(m.cfId,y)}y.setValue(C.startRow,C.startColumn,1)})})},n=(o,i)=>{const a=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(),c=this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),l=new Map,u=[],d=[],p={row:o.startRow,col:o.startColumn};return ge.getAutoFillRepeatRange(o,i).forEach(v=>{t(p,v.repeatStartCell,v.relativeRange,l)}),l.forEach((v,b)=>{const C=this._conditionalFormattingRuleModel.getRule(a,c,b);if(!C)return;const T=ee.findAllRectangle(ee.createTopMatrixFromMatrix(v)),I={unitId:a,subUnitId:c,rule:{...C,ranges:T}};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:(o,i,a)=>{if(a===ge.APPLY_TYPE.COPY||a===ge.APPLY_TYPE.ONLY_FORMAT||a===ge.APPLY_TYPE.SERIES){const{source:c,target:l}=o;return n(c,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Wt=Ef([S.OnLifecycle(S.LifecycleStages.Rendered,Wt),St(0,V.Inject(V.Injector)),St(1,V.Inject(S.IUniverInstanceService)),St(2,V.Inject(ge.IAutoFillService)),St(3,V.Inject(s.ConditionalFormattingRuleModel)),St(4,V.Inject(s.ConditionalFormattingViewModel))],Wt);var Pf=Object.defineProperty,Nf=Object.getOwnPropertyDescriptor,Ff=(e,t,n,r)=>{for(var o=r>1?void 0:r?Nf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Pf(t,n,o),o},bt=(e,t)=>(n,r)=>t(n,r,e);let qt=class extends S.Disposable{constructor(e,t,n,r,o){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._sheetSkeletonManagerService=r,this._refRangeService=o,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,o,i)=>`${r}_${o}_${i}`,n=(r,o,i)=>{const a=l=>{const u=[...i.ranges],d=u.map(h=>ee.handleDefaultRangeChangeWithEffectRefCommands(h,l)).filter(h=>!!h);if(s.isRangesEqual(d,u))return{redos:[],undos:[]};if(d.length){const h={unitId:r,subUnitId:o,rule:{...i,ranges:d}},v=[{id:s.SetConditionalRuleMutation.id,params:h}],b=s.setConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:b}}else{const h={unitId:r,subUnitId:o,cfId:i.cfId},v=[{id:s.DeleteConditionalRuleMutation.id,params:h}],b=s.DeleteConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:b}}},c=[];i.ranges.forEach(l=>{const u=this._refRangeService.registerRefRange(l,a);c.push(()=>u.dispose())}),e.set(t(r,o,i.cfId),()=>c.forEach(l=>l()))};this.disposeWithMe(ye.merge(this._sheetSkeletonManagerService.currentSkeleton$.pipe(Oe.map(r=>r==null?void 0:r.sheetId),Oe.distinctUntilChanged())).pipe(Oe.switchMap(()=>new ye.Observable(r=>{const o=new S.DisposableCollection;return r.next(o),()=>{o.dispose()}}))).subscribe(r=>{r.add(S.toDisposable(this._conditionalFormattingRuleModel.$ruleChange.subscribe(o=>{const{unitId:i,subUnitId:a,rule:c}=o,l=this._univerInstanceService.getCurrentUniverSheetInstance(),u=l.getActiveSheet();if(!(o.unitId!==l.getUnitId()||o.subUnitId!==u.getSheetId()))switch(o.type){case"add":{n(o.unitId,o.subUnitId,o.rule);break}case"delete":{const d=e.get(t(i,a,c.cfId));d&&d();break}case"set":{const d=e.get(t(i,a,c.cfId));d&&d(),n(o.unitId,o.subUnitId,o.rule)}}})))})),this.disposeWithMe(S.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};qt=Ff([S.OnLifecycle(S.LifecycleStages.Rendered,qt),bt(0,V.Inject(s.ConditionalFormattingRuleModel)),bt(1,V.Inject(S.IUniverInstanceService)),bt(2,V.Inject(V.Injector)),bt(3,V.Inject(ge.SheetSkeletonManagerService)),bt(4,V.Inject(ee.RefRangeService))],qt);var $f=Object.defineProperty,jf=Object.getOwnPropertyDescriptor,Lf=(e,t,n,r)=>{for(var o=r>1?void 0:r?jf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&$f(t,n,o),o},Qr=(e,t)=>(n,r)=>t(n,r,e);let Ht=class extends S.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(S.toDisposable(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(r!=null&&r.style&&(e!=null&&e.p)){const o=Object.keys(r==null?void 0:r.style);if(o.length>0){const i=s.getStringFromDataStream(e.p),a={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};o.forEach(l=>{delete a[l]});const c={...e,s:{...a},v:i};return delete c.p,n(c)}}return n(e)}})))}};Ht=Lf([S.OnLifecycle(S.LifecycleStages.Rendered,Ht),Qr(0,V.Inject(ge.IEditorBridgeService)),Qr(1,V.Inject(s.ConditionalFormattingService))],Ht);var kf=Object.defineProperty,Af=Object.getOwnPropertyDescriptor,Vf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Af(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&kf(t,n,o),o},Rt=(e,t)=>(n,r)=>t(n,r,e);let Bt=class extends S.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=r,this._conditionalFormattingRuleModel=o,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{const t=[],n=[],r={redos:t,undos:n};if([ee.ClearSelectionFormatCommand.id,ee.ClearSelectionAllCommand.id].includes(e.id)){const o=this._selectionManagerService.getSelectionRanges();if(!o)return r;const i=this._univerInstanceService.getCurrentUniverSheetInstance(),a=i.getActiveSheet(),c=this._conditionalFormattingRuleModel.getSubunitRules(i.getUnitId(),a.getSheetId());if(!c||!c.length)return r;c.filter(l=>o.some(u=>l.ranges.some(d=>S.Rectangle.getIntersects(d,u)))).forEach(l=>{const d=new ee.RangeMergeUtil().add(...l.ranges).subtract(...o).merge();if(d.length){const p={id:s.SetConditionalRuleMutation.id,params:{unitId:i.getUnitId(),subUnitId:a.getSheetId(),rule:{...l,ranges:d}}},h=s.setConditionalRuleMutationUndoFactory(this._injector,p.params);t.push(p),n.push(...h)}else{const p={id:s.DeleteConditionalRuleMutation.id,params:{unitId:i.getUnitId(),subUnitId:a.getSheetId(),cfId:l.cfId}},h=s.DeleteConditionalRuleMutationUndoFactory(this._injector,p.params);t.push(p),n.push(...h)}})}return r}}))}};Bt=Vf([S.OnLifecycle(S.LifecycleStages.Rendered,Bt),Rt(0,V.Inject(V.Injector)),Rt(1,V.Inject(S.IUniverInstanceService)),Rt(2,V.Inject(ee.SheetInterceptorService)),Rt(3,V.Inject(ee.SelectionManagerService)),Rt(4,V.Inject(s.ConditionalFormattingRuleModel))],Bt);var zf=Object.defineProperty,Uf=Object.getOwnPropertyDescriptor,Wf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Uf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&zf(t,n,o),o},eo=(e,t)=>(n,r)=>t(n,r,e),Vt;exports.SheetsConditionalFormattingUiPlugin=(Vt=class extends S.Plugin{constructor(t,n,r){super(s.SHEET_CONDITIONAL_FORMATTING_PLUGIN),this._injector=n,this._commandService=r,this._initCommand(),s.SheetsConditionalFormattingPlugin.dependencyList.forEach(o=>{this._injector.add(o)}),this._injector.add([zt]),this._injector.add([qt]),this._injector.add([Ut]),this._injector.add([Wt]),this._injector.add([_t]),this._injector.add([Tt]),this._injector.add([Ht]),this._injector.add([Bt])}_initCommand(){[...s.SheetsConditionalFormattingPlugin.mutationList,...exports.SheetsConditionalFormattingUiPlugin.commandList].forEach(t=>{this._commandService.registerCommand(t)})}},it(Vt,"type",S.PluginType.Sheet),it(Vt,"commandList",[_i,xi,Oi,Mi,Di,Ei,Pi,Ni,Fi,bi,Wn,ri,ei,ni,ro,qn]),Vt);exports.SheetsConditionalFormattingUiPlugin=Wf([eo(1,V.Inject(V.Injector)),eo(2,V.Inject(S.ICommandService))],exports.SheetsConditionalFormattingUiPlugin);exports.enUS=tc;exports.zhCN=ti;