@univerjs/sheets-conditional-formatting-ui 0.7.0-beta.0 → 0.7.0-nightly.202504301607

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/umd/index.js CHANGED
@@ -1,80 +1,54 @@
1
- (function(Y,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@univerjs/core"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets"),require("@univerjs/ui"),require("react/jsx-runtime"),require("react"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("@univerjs/sheets-ui"),require("react-dom"),require("rxjs"),require("@univerjs/sheets-formula-ui"),require("@univerjs/engine-render"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-conditional-formatting","@univerjs/sheets","@univerjs/ui","react/jsx-runtime","react","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets-ui","react-dom","rxjs","@univerjs/sheets-formula-ui","@univerjs/engine-render","rxjs/operators"],w):(Y=typeof globalThis<"u"?globalThis:Y||self,w(Y.UniverSheetsConditionalFormattingUi={},Y.UniverCore,Y.UniverSheetsConditionalFormatting,Y.UniverSheets,Y.UniverUi,Y.React,Y.React,Y.UniverDesign,Y.UniverEngineFormula,Y.UniverSheetsUi,Y.ReactDOM,Y.rxjs,Y.UniverSheetsFormulaUi,Y.UniverEngineRender,Y.rxjs.operators))})(this,function(Y,w,c,q,$,_,V,X,kt,pe,At,Ce,Ge,hr,qe){"use strict";var mo=Object.defineProperty;var yo=(Y,w,c)=>w in Y?mo(Y,w,{enumerable:!0,configurable:!0,writable:!0,value:c}):Y[w]=c;var De=(Y,w,c)=>yo(Y,typeof w!="symbol"?w+"":w,c);const jt={type:w.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,u=e.get(c.ConditionalFormattingRuleModel),y=e.get(w.ICommandService),h=e.get(w.IUniverInstanceService),T=q.getSheetCommandTarget(h);if(!T)return!1;const{unitId:m,subUnitId:C}=T,E=u.createCfId(m,C),R={ranges:n,cfId:E,stopIfTrue:!!a,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.average,operator:o,style:r}};return y.executeCommand(c.AddConditionalRuleMutation.id,{unitId:m,subUnitId:C,rule:R})}},Wt={type:w.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:a}=t,o=e.get(c.ConditionalFormattingRuleModel),u=e.get(w.ICommandService),y=e.get(w.IUniverInstanceService),h=q.getSheetCommandTarget(y);if(!h)return!1;const{unitId:T,subUnitId:m}=h,C=o.createCfId(T,m),E={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:c.CFRuleType.colorScale,config:r}};return u.executeCommand(c.AddConditionalRuleMutation.id,{unitId:T,subUnitId:m,rule:E})}},Ht={type:w.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:a,nativeColor:o,positiveColor:u,isGradient:y,stopIfTrue:h,isShowValue:T}=t,m=e.get(c.ConditionalFormattingRuleModel),C=e.get(w.IUniverInstanceService),E=q.getSheetCommandTarget(C);if(!E)return!1;const{unitId:R,subUnitId:I}=E,S=e.get(w.ICommandService),p=m.createCfId(R,I),i={ranges:n,cfId:p,stopIfTrue:!!h,rule:{type:c.CFRuleType.dataBar,isShowValue:T,config:{min:r,max:a,nativeColor:o,positiveColor:u,isGradient:y}}};return S.executeCommand(c.AddConditionalRuleMutation.id,{unitId:R,subUnitId:I,rule:i})}},Bt={type:w.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(c.ConditionalFormattingRuleModel),u=e.get(w.ICommandService),y=e.get(w.IUniverInstanceService),h=q.getSheetCommandTarget(y);if(!h)return!1;const{unitId:T,subUnitId:m}=h,C=o.createCfId(T,m),E={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.duplicateValues,style:r}};return u.executeCommand(c.AddConditionalRuleMutation.id,{unitId:T,subUnitId:m,rule:E})}},Ft={type:w.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:u}=t,y=e.get(c.ConditionalFormattingRuleModel),h=e.get(w.ICommandService),T=e.get(w.IUniverInstanceService),m=q.getSheetCommandTarget(T);if(!m)return!1;const{unitId:C,subUnitId:E}=m,R=y.createCfId(C,E);let I;if([c.CFNumberOperator.between,c.CFNumberOperator.notBetween].includes(o)){const S=u;if(S.length!==2||!Array.isArray(S))return!1;I={ranges:n,cfId:R,stopIfTrue:!!a,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.number,operator:o,style:r,value:S}}}else{const S=u;if(typeof S!="number")return!1;I={ranges:n,cfId:R,stopIfTrue:!!a,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.number,operator:o,style:r,value:S}}}return h.executeCommand(c.AddConditionalRuleMutation.id,{unitId:C,subUnitId:E,rule:I})}},Gt={type:w.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,isPercent:o,isBottom:u,value:y}=t,h=e.get(c.ConditionalFormattingRuleModel),T=e.get(w.IUniverInstanceService),m=e.get(w.ICommandService),C=q.getSheetCommandTarget(T);if(!C)return!1;const{unitId:E,subUnitId:R}=C,I=h.createCfId(E,R),S={ranges:n,cfId:I,stopIfTrue:!!a,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.rank,isPercent:o,isBottom:u,style:r,value:y}};return m.executeCommand(c.AddConditionalRuleMutation.id,{unitId:E,subUnitId:R,rule:S})}},qt={type:w.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:u}=t,y=e.get(c.ConditionalFormattingRuleModel),h=e.get(w.IUniverInstanceService),T=q.getSheetCommandTarget(h);if(!T)return!1;const{unitId:m,subUnitId:C}=T,E=e.get(w.ICommandService),R=y.createCfId(m,C),I={ranges:n,cfId:R,stopIfTrue:!!a,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.text,operator:o,style:r,value:u}};return E.executeCommand(c.AddConditionalRuleMutation.id,{unitId:m,subUnitId:C,rule:I})}},Yt={type:w.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,u=e.get(c.ConditionalFormattingRuleModel),y=e.get(w.IUniverInstanceService),h=e.get(w.ICommandService),T=q.getSheetCommandTarget(y);if(!T)return!1;const{unitId:m,subUnitId:C}=T,E=u.createCfId(m,C),R={ranges:n,cfId:E,stopIfTrue:!!a,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.timePeriod,operator:o,style:r}};return h.executeCommand(c.AddConditionalRuleMutation.id,{unitId:m,subUnitId:C,rule:R})}},Xt={type:w.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(c.ConditionalFormattingRuleModel),u=e.get(w.IUniverInstanceService),y=e.get(w.ICommandService),h=q.getSheetCommandTarget(u);if(!h)return!1;const{unitId:T,subUnitId:m}=h,C=o.createCfId(T,m),E={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.uniqueValues,style:r}};return y.executeCommand(c.AddConditionalRuleMutation.id,{unitId:T,subUnitId:m,rule:E})}},ue={conditionalFormattingWrap:"univer-conditional-formatting-wrap",title:"univer-title",label:"univer-label",labelContainer:"univer-label-container"};var be=function(){return be=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},be.apply(this,arguments)},_n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},Ue=V.forwardRef(function(e,t){var n=e.icon,r=e.id,a=e.className,o=e.extend,u=_n(e,["icon","id","className","extend"]),y="univerjs-icon univerjs-icon-".concat(r," ").concat(a||"").trim(),h=V.useRef("_".concat(On()));return vr(n,"".concat(r),{defIds:n.defIds,idSuffix:h.current},be({ref:t,className:y},u),o)});function vr(e,t,n,r,a){return V.createElement(e.tag,be(be({key:t},Rn(e,n,a)),r),(En(e,n).children||[]).map(function(o,u){return vr(o,"".concat(t,"-").concat(e.tag,"-").concat(u),n,void 0,a)}))}function Rn(e,t,n){var r=be({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1),e.tag==="mask"&&r.id&&(r.id=r.id+t.idSuffix),Object.entries(r).forEach(function(o){var u=o[0],y=o[1];u==="mask"&&typeof y=="string"&&(r[u]=y.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var a=t.defIds;return!a||a.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(o){var u=o[0],y=o[1];typeof y=="string"&&(r[u]=y.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function En(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)?be(be({},e),{children:e.children.map(function(a){return typeof a.attrs.id=="string"&&r&&r.indexOf(a.attrs.id)>-1?be(be({},a),{attrs:be(be({},a.attrs),{id:a.attrs.id+t.idSuffix})}):a})}):e}function On(){return Math.random().toString(36).substring(2,8)}Ue.displayName="UniverIcon";var Pn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},vt=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"delete-single",ref:t,icon:Pn}))});vt.displayName="DeleteSingle";var Dn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},gr=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"increase-single",ref:t,icon:Dn}))});gr.displayName="IncreaseSingle";var xn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},gt=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"more-down-single",ref:t,icon:xn}))});gt.displayName="MoreDownSingle";var Mn={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"}}]}]},mr=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"sequence-single",ref:t,icon:Mn}))});mr.displayName="SequenceSingle";var Nn={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"}}]}]},Ye=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"slash-single",ref:t,icon:Nn}))});Ye.displayName="SlashSingle";function Ln(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function yr(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Kt={exports:{}},Xe={},Ke={exports:{}},Vn=Ke.exports,br;function Zt(){return br||(br=1,function(e,t){(function(n,r){r(t)})(Vn,function(n){function r(W){return function(ie,P,D,N,k,B,j){return W(ie,P,j)}}function a(W){return function(ie,P,D,N){if(!ie||!P||typeof ie!="object"||typeof P!="object")return W(ie,P,D,N);var k=N.get(ie),B=N.get(P);if(k&&B)return k===P&&B===ie;N.set(ie,P),N.set(P,ie);var j=W(ie,P,D,N);return N.delete(ie),N.delete(P),j}}function o(W,Z){var ie={};for(var P in W)ie[P]=W[P];for(var P in Z)ie[P]=Z[P];return ie}function u(W){return W.constructor===Object||W.constructor==null}function y(W){return typeof W.then=="function"}function h(W,Z){return W===Z||W!==W&&Z!==Z}var T="[object Arguments]",m="[object Boolean]",C="[object Date]",E="[object RegExp]",R="[object Map]",I="[object Number]",S="[object Object]",p="[object Set]",i="[object String]",s=Object.prototype.toString;function f(W){var Z=W.areArraysEqual,ie=W.areDatesEqual,P=W.areMapsEqual,D=W.areObjectsEqual,N=W.areRegExpsEqual,k=W.areSetsEqual,B=W.createIsNestedEqual,j=B(J);function J(G,ee,de){if(G===ee)return!0;if(!G||!ee||typeof G!="object"||typeof ee!="object")return G!==G&&ee!==ee;if(u(G)&&u(ee))return D(G,ee,j,de);var Le=Array.isArray(G),Se=Array.isArray(ee);if(Le||Se)return Le===Se&&Z(G,ee,j,de);var ge=s.call(G);return ge!==s.call(ee)?!1:ge===C?ie(G,ee,j,de):ge===E?N(G,ee,j,de):ge===R?P(G,ee,j,de):ge===p?k(G,ee,j,de):ge===S||ge===T?y(G)||y(ee)?!1:D(G,ee,j,de):ge===m||ge===I||ge===i?h(G.valueOf(),ee.valueOf()):!1}return J}function b(W,Z,ie,P){var D=W.length;if(Z.length!==D)return!1;for(;D-- >0;)if(!ie(W[D],Z[D],D,D,W,Z,P))return!1;return!0}var l=a(b);function v(W,Z){return h(W.valueOf(),Z.valueOf())}function d(W,Z,ie,P){var D=W.size===Z.size;if(!D)return!1;if(!W.size)return!0;var N={},k=0;return W.forEach(function(B,j){if(D){var J=!1,G=0;Z.forEach(function(ee,de){!J&&!N[G]&&(J=ie(j,de,k,G,W,Z,P)&&ie(B,ee,j,de,W,Z,P))&&(N[G]=!0),G++}),k++,D=J}}),D}var g=a(d),x="_owner",M=Object.prototype.hasOwnProperty;function U(W,Z,ie,P){var D=Object.keys(W),N=D.length;if(Object.keys(Z).length!==N)return!1;for(var k;N-- >0;){if(k=D[N],k===x){var B=!!W.$$typeof,j=!!Z.$$typeof;if((B||j)&&B!==j)return!1}if(!M.call(Z,k)||!ie(W[k],Z[k],k,k,W,Z,P))return!1}return!0}var z=a(U);function O(W,Z){return W.source===Z.source&&W.flags===Z.flags}function L(W,Z,ie,P){var D=W.size===Z.size;if(!D)return!1;if(!W.size)return!0;var N={};return W.forEach(function(k,B){if(D){var j=!1,J=0;Z.forEach(function(G,ee){!j&&!N[J]&&(j=ie(k,G,B,ee,W,Z,P))&&(N[J]=!0),J++}),D=j}}),D}var H=a(L),F=Object.freeze({areArraysEqual:b,areDatesEqual:v,areMapsEqual:d,areObjectsEqual:U,areRegExpsEqual:O,areSetsEqual:L,createIsNestedEqual:r}),K=Object.freeze({areArraysEqual:l,areDatesEqual:v,areMapsEqual:g,areObjectsEqual:z,areRegExpsEqual:O,areSetsEqual:H,createIsNestedEqual:r}),oe=f(F);function ae(W,Z){return oe(W,Z,void 0)}var le=f(o(F,{createIsNestedEqual:function(){return h}}));function A(W,Z){return le(W,Z,void 0)}var Q=f(K);function te(W,Z){return Q(W,Z,new WeakMap)}var se=f(o(K,{createIsNestedEqual:function(){return h}}));function fe(W,Z){return se(W,Z,new WeakMap)}function ve(W){return f(o(F,W(F)))}function Te(W){var Z=f(o(K,W(K)));return function(ie,P,D){return D===void 0&&(D=new WeakMap),Z(ie,P,D)}}n.circularDeepEqual=te,n.circularShallowEqual=fe,n.createCustomCircularEqual=Te,n.createCustomEqual=ve,n.deepEqual=ae,n.sameValueZeroEqual=h,n.shallowEqual=A,Object.defineProperty(n,"__esModule",{value:!0})})}(Ke,Ke.exports)),Ke.exports}var mt={exports:{}},Sr;function Jt(){if(Sr)return mt.exports;Sr=1;function e(n){var r,a,o="";if(typeof n=="string"||typeof n=="number")o+=n;else if(typeof n=="object")if(Array.isArray(n)){var u=n.length;for(r=0;r<u;r++)n[r]&&(a=e(n[r]))&&(o&&(o+=" "),o+=a)}else for(a in n)n[a]&&(o&&(o+=" "),o+=a);return o}function t(){for(var n,r,a=0,o="",u=arguments.length;a<u;a++)(n=arguments[a])&&(r=e(n))&&(o&&(o+=" "),o+=r);return o}return mt.exports=t,mt.exports.clsx=t,mt.exports}var ne={},Qt,Cr;function Un(){return Cr||(Cr=1,Qt=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)}),Qt}var Tr;function ze(){if(Tr)return ne;Tr=1,Object.defineProperty(ne,"__esModule",{value:!0}),ne.bottom=r,ne.childrenEqual=h,ne.cloneLayout=a,ne.cloneLayoutItem=y,ne.collides=m,ne.compact=C,ne.compactItem=I,ne.compactType=W,ne.correctBounds=S,ne.fastPositionEqual=T,ne.fastRGLPropsEqual=void 0,ne.getAllCollisions=s,ne.getFirstCollision=i,ne.getLayoutItem=p,ne.getStatics=f,ne.modifyLayout=o,ne.moveElement=b,ne.moveElementAwayFromCollision=l,ne.noop=void 0,ne.perc=v,ne.resizeItemInDirection=le,ne.setTopLeft=Q,ne.setTransform=A,ne.sortLayoutItems=te,ne.sortLayoutItemsByColRow=fe,ne.sortLayoutItemsByRowCol=se,ne.synchronizeLayoutWithChildren=ve,ne.validateLayout=Te,ne.withLayoutItem=u;var e=Zt(),t=n(V);function n(P){return P&&P.__esModule?P:{default:P}}function r(P){let D=0,N;for(let k=0,B=P.length;k<B;k++)N=P[k].y+P[k].h,N>D&&(D=N);return D}function a(P){const D=Array(P.length);for(let N=0,k=P.length;N<k;N++)D[N]=y(P[N]);return D}function o(P,D){const N=Array(P.length);for(let k=0,B=P.length;k<B;k++)D.i===P[k].i?N[k]=D:N[k]=P[k];return N}function u(P,D,N){let k=p(P,D);return k?(k=N(y(k)),P=o(P,k),[P,k]):[P,null]}function y(P){return{w:P.w,h:P.h,x:P.x,y:P.y,i:P.i,minW:P.minW,maxW:P.maxW,minH:P.minH,maxH:P.maxH,moved:!!P.moved,static:!!P.static,isDraggable:P.isDraggable,isResizable:P.isResizable,resizeHandles:P.resizeHandles,isBounded:P.isBounded}}function h(P,D){return(0,e.deepEqual)(t.default.Children.map(P,N=>N==null?void 0:N.key),t.default.Children.map(D,N=>N==null?void 0:N.key))&&(0,e.deepEqual)(t.default.Children.map(P,N=>N==null?void 0:N.props["data-grid"]),t.default.Children.map(D,N=>N==null?void 0:N.props["data-grid"]))}ne.fastRGLPropsEqual=Un();function T(P,D){return P.left===D.left&&P.top===D.top&&P.width===D.width&&P.height===D.height}function m(P,D){return!(P.i===D.i||P.x+P.w<=D.x||P.x>=D.x+D.w||P.y+P.h<=D.y||P.y>=D.y+D.h)}function C(P,D,N,k){const B=f(P),j=te(P,D),J=Array(P.length);for(let G=0,ee=j.length;G<ee;G++){let de=y(j[G]);de.static||(de=I(B,de,D,N,j,k),B.push(de)),J[P.indexOf(j[G])]=de,de.moved=!1}return J}const E={x:"w",y:"h"};function R(P,D,N,k){const B=E[k];D[k]+=1;const j=P.map(J=>J.i).indexOf(D.i);for(let J=j+1;J<P.length;J++){const G=P[J];if(!G.static){if(G.y>D.y+D.h)break;m(D,G)&&R(P,G,N+D[B],k)}}D[k]=N}function I(P,D,N,k,B,j){const J=N==="vertical",G=N==="horizontal";if(J)for(D.y=Math.min(r(P),D.y);D.y>0&&!i(P,D);)D.y--;else if(G)for(;D.x>0&&!i(P,D);)D.x--;let ee;for(;(ee=i(P,D))&&!(N===null&&j);)if(G?R(B,D,ee.x+ee.w,"x"):R(B,D,ee.y+ee.h,"y"),G&&D.x+D.w>k)for(D.x=k-D.w,D.y++;D.x>0&&!i(P,D);)D.x--;return D.y=Math.max(D.y,0),D.x=Math.max(D.x,0),D}function S(P,D){const N=f(P);for(let k=0,B=P.length;k<B;k++){const j=P[k];if(j.x+j.w>D.cols&&(j.x=D.cols-j.w),j.x<0&&(j.x=0,j.w=D.cols),!j.static)N.push(j);else for(;i(N,j);)j.y++}return P}function p(P,D){for(let N=0,k=P.length;N<k;N++)if(P[N].i===D)return P[N]}function i(P,D){for(let N=0,k=P.length;N<k;N++)if(m(P[N],D))return P[N]}function s(P,D){return P.filter(N=>m(N,D))}function f(P){return P.filter(D=>D.static)}function b(P,D,N,k,B,j,J,G,ee){if(D.static&&D.isDraggable!==!0||D.y===k&&D.x===N)return P;`${D.i}${String(N)}${String(k)}${D.x}${D.y}`;const de=D.x,Le=D.y;typeof N=="number"&&(D.x=N),typeof k=="number"&&(D.y=k),D.moved=!0;let Se=te(P,J);(J==="vertical"&&typeof k=="number"?Le>=k:J==="horizontal"&&typeof N=="number"?de>=N:!1)&&(Se=Se.reverse());const Fe=s(Se,D),zt=Fe.length>0;if(zt&&ee)return a(P);if(zt&&j)return`${D.i}`,D.x=de,D.y=Le,D.moved=!1,P;for(let pr=0,go=Fe.length;pr<go;pr++){const Ve=Fe[pr];`${D.i}${D.x}${D.y}${Ve.i}${Ve.x}${Ve.y}`,!Ve.moved&&(Ve.static?P=l(P,Ve,D,B,J):P=l(P,D,Ve,B,J))}return P}function l(P,D,N,k,B,j){const J=B==="horizontal",G=B==="vertical",ee=D.static;if(k){k=!1;const Se={x:J?Math.max(D.x-N.w,0):N.x,y:G?Math.max(D.y-N.h,0):N.y,w:N.w,h:N.h,i:"-1"},ge=i(P,Se),Fe=ge&&ge.y+ge.h>D.y,zt=ge&&D.x+D.w>ge.x;if(ge){if(Fe&&G)return b(P,N,void 0,D.y+1,k,ee,B);if(Fe&&B==null)return D.y=N.y,N.y=N.y+N.h,P;if(zt&&J)return b(P,D,N.x,void 0,k,ee,B)}else return`${N.i}${Se.x}${Se.y}`,b(P,N,J?Se.x:void 0,G?Se.y:void 0,k,ee,B)}const de=J?N.x+1:void 0,Le=G?N.y+1:void 0;return de==null&&Le==null?P:b(P,N,J?N.x+1:void 0,G?N.y+1:void 0,k,ee,B)}function v(P){return P*100+"%"}const d=(P,D,N,k)=>P+N>k?D:N,g=(P,D,N)=>P<0?D:N,x=P=>Math.max(0,P),M=P=>Math.max(0,P),U=(P,D,N)=>{let{left:k,height:B,width:j}=D;const J=P.top-(B-P.height);return{left:k,width:j,height:g(J,P.height,B),top:M(J)}},z=(P,D,N)=>{let{top:k,left:B,height:j,width:J}=D;return{top:k,height:j,width:d(P.left,P.width,J,N),left:x(B)}},O=(P,D,N)=>{let{top:k,height:B,width:j}=D;const J=P.left-(j-P.width);return{height:B,width:J<0?P.width:d(P.left,P.width,j,N),top:M(k),left:x(J)}},L=(P,D,N)=>{let{top:k,left:B,height:j,width:J}=D;return{width:J,left:B,height:g(k,P.height,j),top:M(k)}},ae={n:U,ne:function(){return U(arguments.length<=0?void 0:arguments[0],z(...arguments))},e:z,se:function(){return L(arguments.length<=0?void 0:arguments[0],z(...arguments))},s:L,sw:function(){return L(arguments.length<=0?void 0:arguments[0],O(...arguments))},w:O,nw:function(){return U(arguments.length<=0?void 0:arguments[0],O(...arguments))}};function le(P,D,N,k){const B=ae[P];return B?B(D,{...D,...N},k):N}function A(P){let{top:D,left:N,width:k,height:B}=P;const j=`translate(${N}px,${D}px)`;return{transform:j,WebkitTransform:j,MozTransform:j,msTransform:j,OTransform:j,width:`${k}px`,height:`${B}px`,position:"absolute"}}function Q(P){let{top:D,left:N,width:k,height:B}=P;return{top:`${D}px`,left:`${N}px`,width:`${k}px`,height:`${B}px`,position:"absolute"}}function te(P,D){return D==="horizontal"?fe(P):D==="vertical"?se(P):P}function se(P){return P.slice(0).sort(function(D,N){return D.y>N.y||D.y===N.y&&D.x>N.x?1:D.y===N.y&&D.x===N.x?0:-1})}function fe(P){return P.slice(0).sort(function(D,N){return D.x>N.x||D.x===N.x&&D.y>N.y?1:-1})}function ve(P,D,N,k,B){P=P||[];const j=[];t.default.Children.forEach(D,G=>{if((G==null?void 0:G.key)==null)return;const ee=p(P,String(G.key)),de=G.props["data-grid"];ee&&de==null?j.push(y(ee)):de?j.push(y({...de,i:G.key})):j.push(y({w:1,h:1,x:0,y:r(j),i:String(G.key)}))});const J=S(j,{cols:N});return B?J:C(J,k,N)}function Te(P){let D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const N=["x","y","w","h"];if(!Array.isArray(P))throw new Error(D+" must be an array!");for(let k=0,B=P.length;k<B;k++){const j=P[k];for(let J=0;J<N.length;J++){const G=N[J],ee=j[G];if(typeof ee!="number"||Number.isNaN(ee))throw new Error(`ReactGridLayout: ${D}[${k}].${G} must be a number! Received: ${ee} (${typeof ee})`)}if(typeof j.i<"u"&&typeof j.i!="string")throw new Error(`ReactGridLayout: ${D}[${k}].i must be a string! Received: ${j.i} (${typeof j.i})`)}}function W(P){const{verticalCompact:D,compactType:N}=P||{};return D===!1?null:N}function Z(){}const ie=()=>{};return ne.noop=ie,ne}var Ie={},wr;function $t(){if(wr)return Ie;wr=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.calcGridColWidth=e,Ie.calcGridItemPosition=n,Ie.calcGridItemWHPx=t,Ie.calcWH=a,Ie.calcXY=r,Ie.clamp=o;function e(u){const{margin:y,containerPadding:h,containerWidth:T,cols:m}=u;return(T-y[0]*(m-1)-h[0]*2)/m}function t(u,y,h){return Number.isFinite(u)?Math.round(y*u+Math.max(0,u-1)*h):u}function n(u,y,h,T,m,C){const{margin:E,containerPadding:R,rowHeight:I}=u,S=e(u),p={};return C&&C.resizing?(p.width=Math.round(C.resizing.width),p.height=Math.round(C.resizing.height)):(p.width=t(T,S,E[0]),p.height=t(m,I,E[1])),C&&C.dragging?(p.top=Math.round(C.dragging.top),p.left=Math.round(C.dragging.left)):C&&C.resizing&&typeof C.resizing.top=="number"&&typeof C.resizing.left=="number"?(p.top=Math.round(C.resizing.top),p.left=Math.round(C.resizing.left)):(p.top=Math.round((I+E[1])*h+R[1]),p.left=Math.round((S+E[0])*y+R[0])),p}function r(u,y,h,T,m){const{margin:C,containerPadding:E,cols:R,rowHeight:I,maxRows:S}=u,p=e(u);let i=Math.round((h-E[0])/(p+C[0])),s=Math.round((y-E[1])/(I+C[1]));return i=o(i,0,R-T),s=o(s,0,S-m),{x:i,y:s}}function a(u,y,h,T,m,C){const{margin:E,maxRows:R,cols:I,rowHeight:S}=u,p=e(u);let i=Math.round((y+E[0])/(p+E[0])),s=Math.round((h+E[1])/(S+E[1])),f=o(i,0,I-T),b=o(s,0,R-m);return["sw","w","nw"].indexOf(C)!==-1&&(f=o(i,0,I)),["nw","n","ne"].indexOf(C)!==-1&&(b=o(s,0,R)),{w:f,h:b}}function o(u,y,h){return Math.max(Math.min(u,h),y)}return Ie}var Ze={},er={exports:{}},tr,Ir;function zn(){if(Ir)return tr;Ir=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return tr=e,tr}var rr,_r;function kn(){if(_r)return rr;_r=1;var e=zn();function t(){}function n(){}return n.resetWarningCache=t,rr=function(){function r(u,y,h,T,m,C){if(C!==e){var E=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 E.name="Invariant Violation",E}}r.isRequired=r;function a(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},rr}var Rr;function Ee(){return Rr||(Rr=1,er.exports=kn()()),er.exports}var Je={exports:{}},nr={};function Er(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Er(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Or(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Er(e))&&(r&&(r+=" "),r+=t);return r}const An=yr(Object.freeze(Object.defineProperty({__proto__:null,clsx:Or,default:Or},Symbol.toStringTag,{value:"Module"})));var he={},Oe={},Pr;function yt(){if(Pr)return Oe;Pr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.dontSetMe=a,Oe.findInArray=e,Oe.int=r,Oe.isFunction=t,Oe.isNum=n;function e(o,u){for(let y=0,h=o.length;y<h;y++)if(u.apply(u,[o[y],y,o]))return o[y]}function t(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Function]"}function n(o){return typeof o=="number"&&!isNaN(o)}function r(o){return parseInt(o,10)}function a(o,u,y){if(o[u])return new Error("Invalid prop ".concat(u," passed to ").concat(y," - do not set this, set it on the child."))}return Oe}var Pe={},Dr;function jn(){if(Dr)return Pe;Dr=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.browserPrefixToKey=n,Pe.browserPrefixToStyle=r,Pe.default=void 0,Pe.getPrefix=t;const e=["Moz","Webkit","O","ms"];function t(){var o;let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const y=(o=window.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.style;if(!y||u in y)return"";for(let h=0;h<e.length;h++)if(n(u,e[h])in y)return e[h];return""}function n(o,u){return u?"".concat(u).concat(a(o)):o}function r(o,u){return u?"-".concat(u.toLowerCase(),"-").concat(o):o}function a(o){let u="",y=!0;for(let h=0;h<o.length;h++)y?(u+=o[h].toUpperCase(),y=!1):o[h]==="-"?y=!0:u+=o[h];return u}return Pe.default=t(),Pe}var xr;function ar(){if(xr)return he;xr=1,Object.defineProperty(he,"__esModule",{value:!0}),he.addClassName=l,he.addEvent=y,he.addUserSelectStyles=f,he.createCSSTransform=I,he.createSVGTransform=S,he.getTouch=i,he.getTouchIdentifier=s,he.getTranslation=p,he.innerHeight=C,he.innerWidth=E,he.matchesSelector=o,he.matchesSelectorAndParentsTo=u,he.offsetXYFromParent=R,he.outerHeight=T,he.outerWidth=m,he.removeClassName=v,he.removeEvent=h,he.removeUserSelectStyles=b;var e=yt(),t=r(jn());function n(d){if(typeof WeakMap!="function")return null;var g=new WeakMap,x=new WeakMap;return(n=function(M){return M?x:g})(d)}function r(d,g){if(d&&d.__esModule)return d;if(d===null||typeof d!="object"&&typeof d!="function")return{default:d};var x=n(g);if(x&&x.has(d))return x.get(d);var M={},U=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var z in d)if(z!=="default"&&Object.prototype.hasOwnProperty.call(d,z)){var O=U?Object.getOwnPropertyDescriptor(d,z):null;O&&(O.get||O.set)?Object.defineProperty(M,z,O):M[z]=d[z]}return M.default=d,x&&x.set(d,M),M}let a="";function o(d,g){return a||(a=(0,e.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(x){return(0,e.isFunction)(d[x])})),(0,e.isFunction)(d[a])?d[a](g):!1}function u(d,g,x){let M=d;do{if(o(M,g))return!0;if(M===x)return!1;M=M.parentNode}while(M);return!1}function y(d,g,x,M){if(!d)return;const U={capture:!0,...M};d.addEventListener?d.addEventListener(g,x,U):d.attachEvent?d.attachEvent("on"+g,x):d["on"+g]=x}function h(d,g,x,M){if(!d)return;const U={capture:!0,...M};d.removeEventListener?d.removeEventListener(g,x,U):d.detachEvent?d.detachEvent("on"+g,x):d["on"+g]=null}function T(d){let g=d.clientHeight;const x=d.ownerDocument.defaultView.getComputedStyle(d);return g+=(0,e.int)(x.borderTopWidth),g+=(0,e.int)(x.borderBottomWidth),g}function m(d){let g=d.clientWidth;const x=d.ownerDocument.defaultView.getComputedStyle(d);return g+=(0,e.int)(x.borderLeftWidth),g+=(0,e.int)(x.borderRightWidth),g}function C(d){let g=d.clientHeight;const x=d.ownerDocument.defaultView.getComputedStyle(d);return g-=(0,e.int)(x.paddingTop),g-=(0,e.int)(x.paddingBottom),g}function E(d){let g=d.clientWidth;const x=d.ownerDocument.defaultView.getComputedStyle(d);return g-=(0,e.int)(x.paddingLeft),g-=(0,e.int)(x.paddingRight),g}function R(d,g,x){const U=g===g.ownerDocument.body?{left:0,top:0}:g.getBoundingClientRect(),z=(d.clientX+g.scrollLeft-U.left)/x,O=(d.clientY+g.scrollTop-U.top)/x;return{x:z,y:O}}function I(d,g){const x=p(d,g,"px");return{[(0,t.browserPrefixToKey)("transform",t.default)]:x}}function S(d,g){return p(d,g,"")}function p(d,g,x){let{x:M,y:U}=d,z="translate(".concat(M).concat(x,",").concat(U).concat(x,")");if(g){const O="".concat(typeof g.x=="string"?g.x:g.x+x),L="".concat(typeof g.y=="string"?g.y:g.y+x);z="translate(".concat(O,", ").concat(L,")")+z}return z}function i(d,g){return d.targetTouches&&(0,e.findInArray)(d.targetTouches,x=>g===x.identifier)||d.changedTouches&&(0,e.findInArray)(d.changedTouches,x=>g===x.identifier)}function s(d){if(d.targetTouches&&d.targetTouches[0])return d.targetTouches[0].identifier;if(d.changedTouches&&d.changedTouches[0])return d.changedTouches[0].identifier}function f(d){if(!d)return;let g=d.getElementById("react-draggable-style-el");g||(g=d.createElement("style"),g.type="text/css",g.id="react-draggable-style-el",g.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
2
- `,g.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
3
- `,d.getElementsByTagName("head")[0].appendChild(g)),d.body&&l(d.body,"react-draggable-transparent-selection")}function b(d){if(d)try{if(d.body&&v(d.body,"react-draggable-transparent-selection"),d.selection)d.selection.empty();else{const g=(d.defaultView||window).getSelection();g&&g.type!=="Caret"&&g.removeAllRanges()}}catch{}}function l(d,g){d.classList?d.classList.add(g):d.className.match(new RegExp("(?:^|\\s)".concat(g,"(?!\\S)")))||(d.className+=" ".concat(g))}function v(d,g){d.classList?d.classList.remove(g):d.className=d.className.replace(new RegExp("(?:^|\\s)".concat(g,"(?!\\S)"),"g"),"")}return he}var we={},Mr;function Nr(){if(Mr)return we;Mr=1,Object.defineProperty(we,"__esModule",{value:!0}),we.canDragX=a,we.canDragY=o,we.createCoreData=y,we.createDraggableData=h,we.getBoundPosition=n,we.getControlPosition=u,we.snapToGrid=r;var e=yt(),t=ar();function n(C,E,R){if(!C.props.bounds)return[E,R];let{bounds:I}=C.props;I=typeof I=="string"?I:T(I);const S=m(C);if(typeof I=="string"){const{ownerDocument:p}=S,i=p.defaultView;let s;if(I==="parent"?s=S.parentNode:s=p.querySelector(I),!(s instanceof i.HTMLElement))throw new Error('Bounds selector "'+I+'" could not find an element.');const f=s,b=i.getComputedStyle(S),l=i.getComputedStyle(f);I={left:-S.offsetLeft+(0,e.int)(l.paddingLeft)+(0,e.int)(b.marginLeft),top:-S.offsetTop+(0,e.int)(l.paddingTop)+(0,e.int)(b.marginTop),right:(0,t.innerWidth)(f)-(0,t.outerWidth)(S)-S.offsetLeft+(0,e.int)(l.paddingRight)-(0,e.int)(b.marginRight),bottom:(0,t.innerHeight)(f)-(0,t.outerHeight)(S)-S.offsetTop+(0,e.int)(l.paddingBottom)-(0,e.int)(b.marginBottom)}}return(0,e.isNum)(I.right)&&(E=Math.min(E,I.right)),(0,e.isNum)(I.bottom)&&(R=Math.min(R,I.bottom)),(0,e.isNum)(I.left)&&(E=Math.max(E,I.left)),(0,e.isNum)(I.top)&&(R=Math.max(R,I.top)),[E,R]}function r(C,E,R){const I=Math.round(E/C[0])*C[0],S=Math.round(R/C[1])*C[1];return[I,S]}function a(C){return C.props.axis==="both"||C.props.axis==="x"}function o(C){return C.props.axis==="both"||C.props.axis==="y"}function u(C,E,R){const I=typeof E=="number"?(0,t.getTouch)(C,E):null;if(typeof E=="number"&&!I)return null;const S=m(R),p=R.props.offsetParent||S.offsetParent||S.ownerDocument.body;return(0,t.offsetXYFromParent)(I||C,p,R.props.scale)}function y(C,E,R){const I=!(0,e.isNum)(C.lastX),S=m(C);return I?{node:S,deltaX:0,deltaY:0,lastX:E,lastY:R,x:E,y:R}:{node:S,deltaX:E-C.lastX,deltaY:R-C.lastY,lastX:C.lastX,lastY:C.lastY,x:E,y:R}}function h(C,E){const R=C.props.scale;return{node:E.node,x:C.state.x+E.deltaX/R,y:C.state.y+E.deltaY/R,deltaX:E.deltaX/R,deltaY:E.deltaY/R,lastX:C.state.x,lastY:C.state.y}}function T(C){return{left:C.left,top:C.top,right:C.right,bottom:C.bottom}}function m(C){const E=C.findDOMNode();if(!E)throw new Error("<DraggableCore>: Unmounted during event!");return E}return we}var Qe={},bt={},Lr;function Vr(){if(Lr)return bt;Lr=1,Object.defineProperty(bt,"__esModule",{value:!0}),bt.default=e;function e(){}return bt}var Ur;function Wn(){if(Ur)return Qe;Ur=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=void 0;var e=T(V),t=y(Ee()),n=y(At),r=ar(),a=Nr(),o=yt(),u=y(Vr());function y(p){return p&&p.__esModule?p:{default:p}}function h(p){if(typeof WeakMap!="function")return null;var i=new WeakMap,s=new WeakMap;return(h=function(f){return f?s:i})(p)}function T(p,i){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var s=h(i);if(s&&s.has(p))return s.get(p);var f={},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in p)if(l!=="default"&&Object.prototype.hasOwnProperty.call(p,l)){var v=b?Object.getOwnPropertyDescriptor(p,l):null;v&&(v.get||v.set)?Object.defineProperty(f,l,v):f[l]=p[l]}return f.default=p,s&&s.set(p,f),f}function m(p,i,s){return i=C(i),i in p?Object.defineProperty(p,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):p[i]=s,p}function C(p){var i=E(p,"string");return typeof i=="symbol"?i:String(i)}function E(p,i){if(typeof p!="object"||p===null)return p;var s=p[Symbol.toPrimitive];if(s!==void 0){var f=s.call(p,i);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(p)}const R={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let I=R.mouse,S=class extends e.Component{constructor(){super(...arguments),m(this,"dragging",!1),m(this,"lastX",NaN),m(this,"lastY",NaN),m(this,"touchIdentifier",null),m(this,"mounted",!1),m(this,"handleDragStart",i=>{if(this.props.onMouseDown(i),!this.props.allowAnyClick&&typeof i.button=="number"&&i.button!==0)return!1;const s=this.findDOMNode();if(!s||!s.ownerDocument||!s.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:f}=s;if(this.props.disabled||!(i.target instanceof f.defaultView.Node)||this.props.handle&&!(0,r.matchesSelectorAndParentsTo)(i.target,this.props.handle,s)||this.props.cancel&&(0,r.matchesSelectorAndParentsTo)(i.target,this.props.cancel,s))return;i.type==="touchstart"&&i.preventDefault();const b=(0,r.getTouchIdentifier)(i);this.touchIdentifier=b;const l=(0,a.getControlPosition)(i,b,this);if(l==null)return;const{x:v,y:d}=l,g=(0,a.createCoreData)(this,v,d);(0,u.default)("DraggableCore: handleDragStart: %j",g),(0,u.default)("calling",this.props.onStart),!(this.props.onStart(i,g)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,r.addUserSelectStyles)(f),this.dragging=!0,this.lastX=v,this.lastY=d,(0,r.addEvent)(f,I.move,this.handleDrag),(0,r.addEvent)(f,I.stop,this.handleDragStop))}),m(this,"handleDrag",i=>{const s=(0,a.getControlPosition)(i,this.touchIdentifier,this);if(s==null)return;let{x:f,y:b}=s;if(Array.isArray(this.props.grid)){let d=f-this.lastX,g=b-this.lastY;if([d,g]=(0,a.snapToGrid)(this.props.grid,d,g),!d&&!g)return;f=this.lastX+d,b=this.lastY+g}const l=(0,a.createCoreData)(this,f,b);if((0,u.default)("DraggableCore: handleDrag: %j",l),this.props.onDrag(i,l)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const g=document.createEvent("MouseEvents");g.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(g)}return}this.lastX=f,this.lastY=b}),m(this,"handleDragStop",i=>{if(!this.dragging)return;const s=(0,a.getControlPosition)(i,this.touchIdentifier,this);if(s==null)return;let{x:f,y:b}=s;if(Array.isArray(this.props.grid)){let g=f-this.lastX||0,x=b-this.lastY||0;[g,x]=(0,a.snapToGrid)(this.props.grid,g,x),f=this.lastX+g,b=this.lastY+x}const l=(0,a.createCoreData)(this,f,b);if(this.props.onStop(i,l)===!1||this.mounted===!1)return!1;const d=this.findDOMNode();d&&this.props.enableUserSelectHack&&(0,r.removeUserSelectStyles)(d.ownerDocument),(0,u.default)("DraggableCore: handleDragStop: %j",l),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,d&&((0,u.default)("DraggableCore: Removing handlers"),(0,r.removeEvent)(d.ownerDocument,I.move,this.handleDrag),(0,r.removeEvent)(d.ownerDocument,I.stop,this.handleDragStop))}),m(this,"onMouseDown",i=>(I=R.mouse,this.handleDragStart(i))),m(this,"onMouseUp",i=>(I=R.mouse,this.handleDragStop(i))),m(this,"onTouchStart",i=>(I=R.touch,this.handleDragStart(i))),m(this,"onTouchEnd",i=>(I=R.touch,this.handleDragStop(i)))}componentDidMount(){this.mounted=!0;const i=this.findDOMNode();i&&(0,r.addEvent)(i,R.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const i=this.findDOMNode();if(i){const{ownerDocument:s}=i;(0,r.removeEvent)(s,R.mouse.move,this.handleDrag),(0,r.removeEvent)(s,R.touch.move,this.handleDrag),(0,r.removeEvent)(s,R.mouse.stop,this.handleDragStop),(0,r.removeEvent)(s,R.touch.stop,this.handleDragStop),(0,r.removeEvent)(i,R.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,r.removeUserSelectStyles)(s)}}findDOMNode(){var i,s;return(i=this.props)!==null&&i!==void 0&&i.nodeRef?(s=this.props)===null||s===void 0||(s=s.nodeRef)===null||s===void 0?void 0:s.current:n.default.findDOMNode(this)}render(){return e.cloneElement(e.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return Qe.default=S,m(S,"displayName","DraggableCore"),m(S,"propTypes",{allowAnyClick:t.default.bool,children:t.default.node.isRequired,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:function(p,i){if(p[i]&&p[i].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:t.default.arrayOf(t.default.number),handle:t.default.string,cancel:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number,className:o.dontSetMe,style:o.dontSetMe,transform:o.dontSetMe}),m(S,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Qe}var zr;function Hn(){return zr||(zr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return h.default}}),e.default=void 0;var t=E(V),n=m(Ee()),r=m(At),a=m(An),o=ar(),u=Nr(),y=yt(),h=m(Wn()),T=m(Vr());function m(s){return s&&s.__esModule?s:{default:s}}function C(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,b=new WeakMap;return(C=function(l){return l?b:f})(s)}function E(s,f){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var b=C(f);if(b&&b.has(s))return b.get(s);var l={},v=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var g=v?Object.getOwnPropertyDescriptor(s,d):null;g&&(g.get||g.set)?Object.defineProperty(l,d,g):l[d]=s[d]}return l.default=s,b&&b.set(s,l),l}function R(){return R=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var b=arguments[f];for(var l in b)Object.prototype.hasOwnProperty.call(b,l)&&(s[l]=b[l])}return s},R.apply(this,arguments)}function I(s,f,b){return f=S(f),f in s?Object.defineProperty(s,f,{value:b,enumerable:!0,configurable:!0,writable:!0}):s[f]=b,s}function S(s){var f=p(s,"string");return typeof f=="symbol"?f:String(f)}function p(s,f){if(typeof s!="object"||s===null)return s;var b=s[Symbol.toPrimitive];if(b!==void 0){var l=b.call(s,f);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(s)}class i extends t.Component{static getDerivedStateFromProps(f,b){let{position:l}=f,{prevPropsPosition:v}=b;return l&&(!v||l.x!==v.x||l.y!==v.y)?((0,T.default)("Draggable: getDerivedStateFromProps %j",{position:l,prevPropsPosition:v}),{x:l.x,y:l.y,prevPropsPosition:{...l}}):null}constructor(f){super(f),I(this,"onDragStart",(b,l)=>{if((0,T.default)("Draggable: onDragStart: %j",l),this.props.onStart(b,(0,u.createDraggableData)(this,l))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),I(this,"onDrag",(b,l)=>{if(!this.state.dragging)return!1;(0,T.default)("Draggable: onDrag: %j",l);const v=(0,u.createDraggableData)(this,l),d={x:v.x,y:v.y,slackX:0,slackY:0};if(this.props.bounds){const{x,y:M}=d;d.x+=this.state.slackX,d.y+=this.state.slackY;const[U,z]=(0,u.getBoundPosition)(this,d.x,d.y);d.x=U,d.y=z,d.slackX=this.state.slackX+(x-d.x),d.slackY=this.state.slackY+(M-d.y),v.x=d.x,v.y=d.y,v.deltaX=d.x-this.state.x,v.deltaY=d.y-this.state.y}if(this.props.onDrag(b,v)===!1)return!1;this.setState(d)}),I(this,"onDragStop",(b,l)=>{if(!this.state.dragging||this.props.onStop(b,(0,u.createDraggableData)(this,l))===!1)return!1;(0,T.default)("Draggable: onDragStop: %j",l);const d={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x,y:M}=this.props.position;d.x=x,d.y=M}this.setState(d)}),this.state={dragging:!1,dragged:!1,x:f.position?f.position.x:f.defaultPosition.x,y:f.position?f.position.y:f.defaultPosition.y,prevPropsPosition:{...f.position},slackX:0,slackY:0,isElementSVG:!1},f.position&&!(f.onDrag||f.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 f,b;return(f=(b=this.props)===null||b===void 0||(b=b.nodeRef)===null||b===void 0?void 0:b.current)!==null&&f!==void 0?f:r.default.findDOMNode(this)}render(){const{axis:f,bounds:b,children:l,defaultPosition:v,defaultClassName:d,defaultClassNameDragging:g,defaultClassNameDragged:x,position:M,positionOffset:U,scale:z,...O}=this.props;let L={},H=null;const K=!!!M||this.state.dragging,oe=M||v,ae={x:(0,u.canDragX)(this)&&K?this.state.x:oe.x,y:(0,u.canDragY)(this)&&K?this.state.y:oe.y};this.state.isElementSVG?H=(0,o.createSVGTransform)(ae,U):L=(0,o.createCSSTransform)(ae,U);const le=(0,a.default)(l.props.className||"",d,{[g]:this.state.dragging,[x]:this.state.dragged});return t.createElement(h.default,R({},O,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(l),{className:le,style:{...l.props.style,...L},transform:H}))}}e.default=i,I(i,"displayName","Draggable"),I(i,"propTypes",{...h.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:y.dontSetMe,style:y.dontSetMe,transform:y.dontSetMe}),I(i,"defaultProps",{...h.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(nr)),nr}var kr;function or(){if(kr)return Je.exports;kr=1;const{default:e,DraggableCore:t}=Hn();return Je.exports=e,Je.exports.default=e,Je.exports.DraggableCore=t,Je.exports}var $e={exports:{}},et={},St={},Ar;function Bn(){if(Ar)return St;Ar=1,St.__esModule=!0,St.cloneElement=y;var e=t(V);function t(h){return h&&h.__esModule?h:{default:h}}function n(h,T){var m=Object.keys(h);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(h);T&&(C=C.filter(function(E){return Object.getOwnPropertyDescriptor(h,E).enumerable})),m.push.apply(m,C)}return m}function r(h){for(var T=1;T<arguments.length;T++){var m=arguments[T]!=null?arguments[T]:{};T%2?n(Object(m),!0).forEach(function(C){a(h,C,m[C])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(m)):n(Object(m)).forEach(function(C){Object.defineProperty(h,C,Object.getOwnPropertyDescriptor(m,C))})}return h}function a(h,T,m){return T=o(T),T in h?Object.defineProperty(h,T,{value:m,enumerable:!0,configurable:!0,writable:!0}):h[T]=m,h}function o(h){var T=u(h,"string");return typeof T=="symbol"?T:String(T)}function u(h,T){if(typeof h!="object"||h===null)return h;var m=h[Symbol.toPrimitive];if(m!==void 0){var C=m.call(h,T);if(typeof C!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return(T==="string"?String:Number)(h)}function y(h,T){return T.style&&h.props.style&&(T.style=r(r({},h.props.style),T.style)),T.className&&h.props.className&&(T.className=h.props.className+" "+T.className),e.default.cloneElement(h,T)}return St}var tt={},jr;function Wr(){if(jr)return tt;jr=1,tt.__esModule=!0,tt.resizableProps=void 0;var e=t(Ee());or();function t(r){return r&&r.__esModule?r:{default:r}}var n={axis:e.default.oneOf(["both","x","y","none"]),className:e.default.string,children:e.default.element.isRequired,draggableOpts:e.default.shape({allowAnyClick:e.default.bool,cancel:e.default.string,children:e.default.node,disabled:e.default.bool,enableUserSelectHack:e.default.bool,offsetParent:e.default.node,grid:e.default.arrayOf(e.default.number),handle:e.default.string,nodeRef:e.default.object,onStart:e.default.func,onDrag:e.default.func,onStop:e.default.func,onMouseDown:e.default.func,scale:e.default.number}),height:function(){for(var a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];var y=o[0];if(y.axis==="both"||y.axis==="y"){var h;return(h=e.default.number).isRequired.apply(h,o)}return e.default.number.apply(e.default,o)},handle:e.default.oneOfType([e.default.node,e.default.func]),handleSize:e.default.arrayOf(e.default.number),lockAspectRatio:e.default.bool,maxConstraints:e.default.arrayOf(e.default.number),minConstraints:e.default.arrayOf(e.default.number),onResizeStop:e.default.func,onResizeStart:e.default.func,onResize:e.default.func,resizeHandles:e.default.arrayOf(e.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:e.default.number,width:function(){for(var a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];var y=o[0];if(y.axis==="both"||y.axis==="x"){var h;return(h=e.default.number).isRequired.apply(h,o)}return e.default.number.apply(e.default,o)}};return tt.resizableProps=n,tt}var Hr;function Br(){if(Hr)return et;Hr=1,et.__esModule=!0,et.default=void 0;var e=u(V),t=or(),n=Bn(),r=Wr(),a=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function o(i){if(typeof WeakMap!="function")return null;var s=new WeakMap,f=new WeakMap;return(o=function(l){return l?f:s})(i)}function u(i,s){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var f=o(s);if(f&&f.has(i))return f.get(i);var b={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var v in i)if(v!=="default"&&Object.prototype.hasOwnProperty.call(i,v)){var d=l?Object.getOwnPropertyDescriptor(i,v):null;d&&(d.get||d.set)?Object.defineProperty(b,v,d):b[v]=i[v]}return b.default=i,f&&f.set(i,b),b}function y(){return y=Object.assign?Object.assign.bind():function(i){for(var s=1;s<arguments.length;s++){var f=arguments[s];for(var b in f)Object.prototype.hasOwnProperty.call(f,b)&&(i[b]=f[b])}return i},y.apply(this,arguments)}function h(i,s){if(i==null)return{};var f={},b=Object.keys(i),l,v;for(v=0;v<b.length;v++)l=b[v],!(s.indexOf(l)>=0)&&(f[l]=i[l]);return f}function T(i,s){var f=Object.keys(i);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(i);s&&(b=b.filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable})),f.push.apply(f,b)}return f}function m(i){for(var s=1;s<arguments.length;s++){var f=arguments[s]!=null?arguments[s]:{};s%2?T(Object(f),!0).forEach(function(b){C(i,b,f[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(f)):T(Object(f)).forEach(function(b){Object.defineProperty(i,b,Object.getOwnPropertyDescriptor(f,b))})}return i}function C(i,s,f){return s=E(s),s in i?Object.defineProperty(i,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):i[s]=f,i}function E(i){var s=R(i,"string");return typeof s=="symbol"?s:String(s)}function R(i,s){if(typeof i!="object"||i===null)return i;var f=i[Symbol.toPrimitive];if(f!==void 0){var b=f.call(i,s);if(typeof b!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}function I(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,S(i,s)}function S(i,s){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(b,l){return b.__proto__=l,b},S(i,s)}var p=function(i){I(s,i);function s(){for(var b,l=arguments.length,v=new Array(l),d=0;d<l;d++)v[d]=arguments[d];return b=i.call.apply(i,[this].concat(v))||this,b.handleRefs={},b.lastHandleRect=null,b.slack=null,b}var f=s.prototype;return f.componentWillUnmount=function(){this.resetData()},f.resetData=function(){this.lastHandleRect=this.slack=null},f.runConstraints=function(l,v){var d=this.props,g=d.minConstraints,x=d.maxConstraints,M=d.lockAspectRatio;if(!g&&!x&&!M)return[l,v];if(M){var U=this.props.width/this.props.height,z=l-this.props.width,O=v-this.props.height;Math.abs(z)>Math.abs(O*U)?v=l/U:l=v*U}var L=l,H=v,F=this.slack||[0,0],K=F[0],oe=F[1];return l+=K,v+=oe,g&&(l=Math.max(g[0],l),v=Math.max(g[1],v)),x&&(l=Math.min(x[0],l),v=Math.min(x[1],v)),this.slack=[K+(L-l),oe+(H-v)],[l,v]},f.resizeHandler=function(l,v){var d=this;return function(g,x){var M=x.node,U=x.deltaX,z=x.deltaY;l==="onResizeStart"&&d.resetData();var O=(d.props.axis==="both"||d.props.axis==="x")&&v!=="n"&&v!=="s",L=(d.props.axis==="both"||d.props.axis==="y")&&v!=="e"&&v!=="w";if(!(!O&&!L)){var H=v[0],F=v[v.length-1],K=M.getBoundingClientRect();if(d.lastHandleRect!=null){if(F==="w"){var oe=K.left-d.lastHandleRect.left;U+=oe}if(H==="n"){var ae=K.top-d.lastHandleRect.top;z+=ae}}d.lastHandleRect=K,F==="w"&&(U=-U),H==="n"&&(z=-z);var le=d.props.width+(O?U/d.props.transformScale:0),A=d.props.height+(L?z/d.props.transformScale:0),Q=d.runConstraints(le,A);le=Q[0],A=Q[1];var te=le!==d.props.width||A!==d.props.height,se=typeof d.props[l]=="function"?d.props[l]:null,fe=l==="onResize"&&!te;se&&!fe&&(g.persist==null||g.persist(),se(g,{node:M,size:{width:le,height:A},handle:v})),l==="onResizeStop"&&d.resetData()}}},f.renderResizeHandle=function(l,v){var d=this.props.handle;if(!d)return e.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+l,ref:v});if(typeof d=="function")return d(l,v);var g=typeof d.type=="string",x=m({ref:v},g?{}:{handleAxis:l});return e.cloneElement(d,x)},f.render=function(){var l=this,v=this.props,d=v.children,g=v.className,x=v.draggableOpts;v.width,v.height,v.handle,v.handleSize,v.lockAspectRatio,v.axis,v.minConstraints,v.maxConstraints,v.onResize,v.onResizeStop,v.onResizeStart;var M=v.resizeHandles;v.transformScale;var U=h(v,a);return(0,n.cloneElement)(d,m(m({},U),{},{className:(g?g+" ":"")+"react-resizable",children:[].concat(d.props.children,M.map(function(z){var O,L=(O=l.handleRefs[z])!=null?O:l.handleRefs[z]=e.createRef();return e.createElement(t.DraggableCore,y({},x,{nodeRef:L,key:"resizableHandle-"+z,onStop:l.resizeHandler("onResizeStop",z),onStart:l.resizeHandler("onResizeStart",z),onDrag:l.resizeHandler("onResize",z)}),l.renderResizeHandle(z,L))}))}))},s}(e.Component);return et.default=p,p.propTypes=r.resizableProps,p.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},et}var rt={},Fr;function Fn(){if(Fr)return rt;Fr=1,rt.__esModule=!0,rt.default=void 0;var e=y(V),t=o(Ee()),n=o(Br()),r=Wr(),a=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function o(s){return s&&s.__esModule?s:{default:s}}function u(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,b=new WeakMap;return(u=function(v){return v?b:f})(s)}function y(s,f){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var b=u(f);if(b&&b.has(s))return b.get(s);var l={},v=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var g=v?Object.getOwnPropertyDescriptor(s,d):null;g&&(g.get||g.set)?Object.defineProperty(l,d,g):l[d]=s[d]}return l.default=s,b&&b.set(s,l),l}function h(){return h=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var b=arguments[f];for(var l in b)Object.prototype.hasOwnProperty.call(b,l)&&(s[l]=b[l])}return s},h.apply(this,arguments)}function T(s,f){var b=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);f&&(l=l.filter(function(v){return Object.getOwnPropertyDescriptor(s,v).enumerable})),b.push.apply(b,l)}return b}function m(s){for(var f=1;f<arguments.length;f++){var b=arguments[f]!=null?arguments[f]:{};f%2?T(Object(b),!0).forEach(function(l){C(s,l,b[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(b)):T(Object(b)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(b,l))})}return s}function C(s,f,b){return f=E(f),f in s?Object.defineProperty(s,f,{value:b,enumerable:!0,configurable:!0,writable:!0}):s[f]=b,s}function E(s){var f=R(s,"string");return typeof f=="symbol"?f:String(f)}function R(s,f){if(typeof s!="object"||s===null)return s;var b=s[Symbol.toPrimitive];if(b!==void 0){var l=b.call(s,f);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(s)}function I(s,f){if(s==null)return{};var b={},l=Object.keys(s),v,d;for(d=0;d<l.length;d++)v=l[d],!(f.indexOf(v)>=0)&&(b[v]=s[v]);return b}function S(s,f){s.prototype=Object.create(f.prototype),s.prototype.constructor=s,p(s,f)}function p(s,f){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,v){return l.__proto__=v,l},p(s,f)}var i=function(s){S(f,s);function f(){for(var l,v=arguments.length,d=new Array(v),g=0;g<v;g++)d[g]=arguments[g];return l=s.call.apply(s,[this].concat(d))||this,l.state={width:l.props.width,height:l.props.height,propsWidth:l.props.width,propsHeight:l.props.height},l.onResize=function(x,M){var U=M.size;l.props.onResize?(x.persist==null||x.persist(),l.setState(U,function(){return l.props.onResize&&l.props.onResize(x,M)})):l.setState(U)},l}f.getDerivedStateFromProps=function(v,d){return d.propsWidth!==v.width||d.propsHeight!==v.height?{width:v.width,height:v.height,propsWidth:v.width,propsHeight:v.height}:null};var b=f.prototype;return b.render=function(){var v=this.props,d=v.handle,g=v.handleSize;v.onResize;var x=v.onResizeStart,M=v.onResizeStop,U=v.draggableOpts,z=v.minConstraints,O=v.maxConstraints,L=v.lockAspectRatio,H=v.axis;v.width,v.height;var F=v.resizeHandles,K=v.style,oe=v.transformScale,ae=I(v,a);return e.createElement(n.default,{axis:H,draggableOpts:U,handle:d,handleSize:g,height:this.state.height,lockAspectRatio:L,maxConstraints:O,minConstraints:z,onResizeStart:x,onResize:this.onResize,onResizeStop:M,resizeHandles:F,transformScale:oe,width:this.state.width},e.createElement("div",h({},ae,{style:m(m({},K),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},f}(e.Component);return rt.default=i,i.propTypes=m(m({},r.resizableProps),{},{children:t.default.element}),rt}var Gr;function Gn(){return Gr||(Gr=1,$e.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},$e.exports.Resizable=Br().default,$e.exports.ResizableBox=Fn().default),$e.exports}var _e={},qr;function Yr(){if(qr)return _e;qr=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.resizeHandleType=_e.resizeHandleAxesType=_e.default=void 0;var e=n(Ee()),t=n(V);function n(o){return o&&o.__esModule?o:{default:o}}const r=_e.resizeHandleAxesType=e.default.arrayOf(e.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),a=_e.resizeHandleType=e.default.oneOfType([e.default.node,e.default.func]);return _e.default={className:e.default.string,style:e.default.object,width:e.default.number,autoSize:e.default.bool,cols:e.default.number,draggableCancel:e.default.string,draggableHandle:e.default.string,verticalCompact:function(o){o.verticalCompact},compactType:e.default.oneOf(["vertical","horizontal"]),layout:function(o){var u=o.layout;u!==void 0&&ze().validateLayout(u,"layout")},margin:e.default.arrayOf(e.default.number),containerPadding:e.default.arrayOf(e.default.number),rowHeight:e.default.number,maxRows:e.default.number,isBounded:e.default.bool,isDraggable:e.default.bool,isResizable:e.default.bool,allowOverlap:e.default.bool,preventCollision:e.default.bool,useCSSTransforms:e.default.bool,transformScale:e.default.number,isDroppable:e.default.bool,resizeHandles:r,resizeHandle:a,onLayoutChange:e.default.func,onDragStart:e.default.func,onDrag:e.default.func,onDragStop:e.default.func,onResizeStart:e.default.func,onResize:e.default.func,onResizeStop:e.default.func,onDrop:e.default.func,droppingItem:e.default.shape({i:e.default.string.isRequired,w:e.default.number.isRequired,h:e.default.number.isRequired}),children:function(o,u){const y=o[u],h={};t.default.Children.forEach(y,function(T){if((T==null?void 0:T.key)!=null){if(h[T.key])throw new Error('Duplicate child key "'+T.key+'" found! This will cause problems in ReactGridLayout.');h[T.key]=!0}})},innerRef:e.default.any},_e}var Xr;function qn(){if(Xr)return Ze;Xr=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.default=void 0;var e=T(V),t=At,n=T(Ee()),r=or(),a=Gn(),o=ze(),u=$t(),y=Yr(),h=T(Jt());function T(I){return I&&I.__esModule?I:{default:I}}function m(I,S,p){return S=C(S),S in I?Object.defineProperty(I,S,{value:p,enumerable:!0,configurable:!0,writable:!0}):I[S]=p,I}function C(I){var S=E(I,"string");return typeof S=="symbol"?S:String(S)}function E(I,S){if(typeof I!="object"||I===null)return I;var p=I[Symbol.toPrimitive];if(p!==void 0){var i=p.call(I,S);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(I)}let R=class extends e.default.Component{constructor(){super(...arguments),m(this,"state",{resizing:null,dragging:null,className:""}),m(this,"elementRef",e.default.createRef()),m(this,"onDragStart",(S,p)=>{let{node:i}=p;const{onDragStart:s,transformScale:f}=this.props;if(!s)return;const b={top:0,left:0},{offsetParent:l}=i;if(!l)return;const v=l.getBoundingClientRect(),d=i.getBoundingClientRect(),g=d.left/f,x=v.left/f,M=d.top/f,U=v.top/f;b.left=g-x+l.scrollLeft,b.top=M-U+l.scrollTop,this.setState({dragging:b});const{x:z,y:O}=(0,u.calcXY)(this.getPositionParams(),b.top,b.left,this.props.w,this.props.h);return s.call(this,this.props.i,z,O,{e:S,node:i,newPosition:b})}),m(this,"onDrag",(S,p,i)=>{let{node:s,deltaX:f,deltaY:b}=p;const{onDrag:l}=this.props;if(!l)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let v=this.state.dragging.top+b,d=this.state.dragging.left+f;const{isBounded:g,i:x,w:M,h:U,containerWidth:z}=this.props,O=this.getPositionParams();if(g){const{offsetParent:K}=s;if(K){const{margin:oe,rowHeight:ae,containerPadding:le}=this.props,A=K.clientHeight-(0,u.calcGridItemWHPx)(U,ae,oe[1]);v=(0,u.clamp)(v-le[1],0,A);const Q=(0,u.calcGridColWidth)(O),te=z-(0,u.calcGridItemWHPx)(M,Q,oe[0]);d=(0,u.clamp)(d-le[0],0,te)}}const L={top:v,left:d};i?this.setState({dragging:L}):(0,t.flushSync)(()=>{this.setState({dragging:L})});const{x:H,y:F}=(0,u.calcXY)(O,v,d,M,U);return l.call(this,x,H,F,{e:S,node:s,newPosition:L})}),m(this,"onDragStop",(S,p)=>{let{node:i}=p;const{onDragStop:s}=this.props;if(!s)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:f,h:b,i:l}=this.props,{left:v,top:d}=this.state.dragging,g={top:d,left:v};this.setState({dragging:null});const{x,y:M}=(0,u.calcXY)(this.getPositionParams(),d,v,f,b);return s.call(this,l,x,M,{e:S,node:i,newPosition:g})}),m(this,"onResizeStop",(S,p,i)=>this.onResizeHandler(S,p,i,"onResizeStop")),m(this,"onResizeStart",(S,p,i)=>this.onResizeHandler(S,p,i,"onResizeStart")),m(this,"onResize",(S,p,i)=>this.onResizeHandler(S,p,i,"onResize"))}shouldComponentUpdate(S,p){if(this.props.children!==S.children||this.props.droppingPosition!==S.droppingPosition)return!0;const i=(0,u.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),s=(0,u.calcGridItemPosition)(this.getPositionParams(S),S.x,S.y,S.w,S.h,p);return!(0,o.fastPositionEqual)(i,s)||this.props.useCSSTransforms!==S.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(S){this.moveDroppingItem(S)}moveDroppingItem(S){const{droppingPosition:p}=this.props;if(!p)return;const i=this.elementRef.current;if(!i)return;const s=S.droppingPosition||{left:0,top:0},{dragging:f}=this.state,b=f&&p.left!==s.left||p.top!==s.top;if(!f)this.onDragStart(p.e,{node:i,deltaX:p.left,deltaY:p.top});else if(b){const l=p.left-f.left,v=p.top-f.top;this.onDrag(p.e,{node:i,deltaX:l,deltaY:v},!0)}}getPositionParams(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:S.cols,containerPadding:S.containerPadding,containerWidth:S.containerWidth,margin:S.margin,maxRows:S.maxRows,rowHeight:S.rowHeight}}createStyle(S){const{usePercentages:p,containerWidth:i,useCSSTransforms:s}=this.props;let f;return s?f=(0,o.setTransform)(S):(f=(0,o.setTopLeft)(S),p&&(f.left=(0,o.perc)(S.left/i),f.width=(0,o.perc)(S.width/i))),f}mixinDraggable(S,p){return e.default.createElement(r.DraggableCore,{disabled:!p,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},S)}curryResizeHandler(S,p){return(i,s)=>p(i,s,S)}mixinResizable(S,p,i){const{cols:s,minW:f,minH:b,maxW:l,maxH:v,transformScale:d,resizeHandles:g,resizeHandle:x}=this.props,M=this.getPositionParams(),U=(0,u.calcGridItemPosition)(M,0,0,s,0).width,z=(0,u.calcGridItemPosition)(M,0,0,f,b),O=(0,u.calcGridItemPosition)(M,0,0,l,v),L=[z.width,z.height],H=[Math.min(O.width,U),Math.min(O.height,1/0)];return e.default.createElement(a.Resizable,{draggableOpts:{disabled:!i},className:i?void 0:"react-resizable-hide",width:p.width,height:p.height,minConstraints:L,maxConstraints:H,onResizeStop:this.curryResizeHandler(p,this.onResizeStop),onResizeStart:this.curryResizeHandler(p,this.onResizeStart),onResize:this.curryResizeHandler(p,this.onResize),transformScale:d,resizeHandles:g,handle:x},S)}onResizeHandler(S,p,i,s){let{node:f,size:b,handle:l}=p;const v=this.props[s];if(!v)return;const{x:d,y:g,i:x,maxH:M,minH:U,containerWidth:z}=this.props,{minW:O,maxW:L}=this.props;let H=b;f&&(H=(0,o.resizeItemInDirection)(l,i,b,z),(0,t.flushSync)(()=>{this.setState({resizing:s==="onResizeStop"?null:H})}));let{w:F,h:K}=(0,u.calcWH)(this.getPositionParams(),H.width,H.height,d,g,l);F=(0,u.clamp)(F,Math.max(O,1),L),K=(0,u.clamp)(K,U,M),v.call(this,x,F,K,{e:S,node:f,size:H,handle:l})}render(){const{x:S,y:p,w:i,h:s,isDraggable:f,isResizable:b,droppingPosition:l,useCSSTransforms:v}=this.props,d=(0,u.calcGridItemPosition)(this.getPositionParams(),S,p,i,s,this.state),g=e.default.Children.only(this.props.children);let x=e.default.cloneElement(g,{ref:this.elementRef,className:(0,h.default)("react-grid-item",g.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":f,"react-draggable-dragging":!!this.state.dragging,dropping:!!l,cssTransforms:v}),style:{...this.props.style,...g.props.style,...this.createStyle(d)}});return x=this.mixinResizable(x,d,b),x=this.mixinDraggable(x,f),x}};return Ze.default=R,m(R,"propTypes",{children:n.default.element,cols:n.default.number.isRequired,containerWidth:n.default.number.isRequired,rowHeight:n.default.number.isRequired,margin:n.default.array.isRequired,maxRows:n.default.number.isRequired,containerPadding:n.default.array.isRequired,x:n.default.number.isRequired,y:n.default.number.isRequired,w:n.default.number.isRequired,h:n.default.number.isRequired,minW:function(I,S){const p=I[S];if(typeof p!="number")return new Error("minWidth not Number");if(p>I.w||p>I.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(I,S){const p=I[S];if(typeof p!="number")return new Error("maxWidth not Number");if(p<I.w||p<I.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(I,S){const p=I[S];if(typeof p!="number")return new Error("minHeight not Number");if(p>I.h||p>I.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(I,S){const p=I[S];if(typeof p!="number")return new Error("maxHeight not Number");if(p<I.h||p<I.minH)return new Error("maxHeight smaller than item height/minHeight")},i:n.default.string.isRequired,resizeHandles:y.resizeHandleAxesType,resizeHandle:y.resizeHandleType,onDragStop:n.default.func,onDragStart:n.default.func,onDrag:n.default.func,onResizeStop:n.default.func,onResizeStart:n.default.func,onResize:n.default.func,isDraggable:n.default.bool.isRequired,isResizable:n.default.bool.isRequired,isBounded:n.default.bool.isRequired,static:n.default.bool,useCSSTransforms:n.default.bool.isRequired,transformScale:n.default.number,className:n.default.string,handle:n.default.string,cancel:n.default.string,droppingPosition:n.default.shape({e:n.default.object.isRequired,left:n.default.number.isRequired,top:n.default.number.isRequired})}),m(R,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Ze}var Kr;function Zr(){if(Kr)return Xe;Kr=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.default=void 0;var e=T(V),t=Zt(),n=y(Jt()),r=ze(),a=$t(),o=y(qn()),u=y(Yr());function y(p){return p&&p.__esModule?p:{default:p}}function h(p){if(typeof WeakMap!="function")return null;var i=new WeakMap,s=new WeakMap;return(h=function(f){return f?s:i})(p)}function T(p,i){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var s=h(i);if(s&&s.has(p))return s.get(p);var f={__proto__:null},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in p)if(l!=="default"&&Object.prototype.hasOwnProperty.call(p,l)){var v=b?Object.getOwnPropertyDescriptor(p,l):null;v&&(v.get||v.set)?Object.defineProperty(f,l,v):f[l]=p[l]}return f.default=p,s&&s.set(p,f),f}function m(p,i,s){return i=C(i),i in p?Object.defineProperty(p,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):p[i]=s,p}function C(p){var i=E(p,"string");return typeof i=="symbol"?i:String(i)}function E(p,i){if(typeof p!="object"||p===null)return p;var s=p[Symbol.toPrimitive];if(s!==void 0){var f=s.call(p,i);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(p)}const R="react-grid-layout";let I=!1;try{I=/firefox/i.test(navigator.userAgent)}catch{}let S=class extends e.Component{constructor(){super(...arguments),m(this,"state",{activeDrag:null,layout:(0,r.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,r.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),m(this,"dragEnterCounter",0),m(this,"onDragStart",(i,s,f,b)=>{let{e:l,node:v}=b;const{layout:d}=this.state,g=(0,r.getLayoutItem)(d,i);if(!g)return;const x={w:g.w,h:g.h,x:g.x,y:g.y,placeholder:!0,i};return this.setState({oldDragItem:(0,r.cloneLayoutItem)(g),oldLayout:d,activeDrag:x}),this.props.onDragStart(d,g,g,null,l,v)}),m(this,"onDrag",(i,s,f,b)=>{let{e:l,node:v}=b;const{oldDragItem:d}=this.state;let{layout:g}=this.state;const{cols:x,allowOverlap:M,preventCollision:U}=this.props,z=(0,r.getLayoutItem)(g,i);if(!z)return;const O={w:z.w,h:z.h,x:z.x,y:z.y,placeholder:!0,i};g=(0,r.moveElement)(g,z,s,f,!0,U,(0,r.compactType)(this.props),x,M),this.props.onDrag(g,d,z,O,l,v),this.setState({layout:M?g:(0,r.compact)(g,(0,r.compactType)(this.props),x),activeDrag:O})}),m(this,"onDragStop",(i,s,f,b)=>{let{e:l,node:v}=b;if(!this.state.activeDrag)return;const{oldDragItem:d}=this.state;let{layout:g}=this.state;const{cols:x,preventCollision:M,allowOverlap:U}=this.props,z=(0,r.getLayoutItem)(g,i);if(!z)return;g=(0,r.moveElement)(g,z,s,f,!0,M,(0,r.compactType)(this.props),x,U);const L=U?g:(0,r.compact)(g,(0,r.compactType)(this.props),x);this.props.onDragStop(L,d,z,null,l,v);const{oldLayout:H}=this.state;this.setState({activeDrag:null,layout:L,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(L,H)}),m(this,"onResizeStart",(i,s,f,b)=>{let{e:l,node:v}=b;const{layout:d}=this.state,g=(0,r.getLayoutItem)(d,i);g&&(this.setState({oldResizeItem:(0,r.cloneLayoutItem)(g),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(d,g,g,null,l,v))}),m(this,"onResize",(i,s,f,b)=>{let{e:l,node:v,size:d,handle:g}=b;const{oldResizeItem:x}=this.state,{layout:M}=this.state,{cols:U,preventCollision:z,allowOverlap:O}=this.props;let L=!1,H,F,K;const[oe,ae]=(0,r.withLayoutItem)(M,i,A=>{let Q;return F=A.x,K=A.y,["sw","w","nw","n","ne"].indexOf(g)!==-1&&(["sw","nw","w"].indexOf(g)!==-1&&(F=A.x+(A.w-s),s=A.x!==F&&F<0?A.w:s,F=F<0?0:F),["ne","n","nw"].indexOf(g)!==-1&&(K=A.y+(A.h-f),f=A.y!==K&&K<0?A.h:f,K=K<0?0:K),L=!0),z&&!O&&(Q=(0,r.getAllCollisions)(M,{...A,w:s,h:f,x:F,y:K}).filter(se=>se.i!==A.i).length>0,Q&&(K=A.y,f=A.h,F=A.x,s=A.w,L=!1)),A.w=s,A.h=f,A});if(!ae)return;H=oe,L&&(H=(0,r.moveElement)(oe,ae,F,K,!0,this.props.preventCollision,(0,r.compactType)(this.props),U,O));const le={w:ae.w,h:ae.h,x:ae.x,y:ae.y,static:!0,i};this.props.onResize(H,x,ae,le,l,v),this.setState({layout:O?H:(0,r.compact)(H,(0,r.compactType)(this.props),U),activeDrag:le})}),m(this,"onResizeStop",(i,s,f,b)=>{let{e:l,node:v}=b;const{layout:d,oldResizeItem:g}=this.state,{cols:x,allowOverlap:M}=this.props,U=(0,r.getLayoutItem)(d,i),z=M?d:(0,r.compact)(d,(0,r.compactType)(this.props),x);this.props.onResizeStop(z,g,U,null,l,v);const{oldLayout:O}=this.state;this.setState({activeDrag:null,layout:z,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(z,O)}),m(this,"onDragOver",i=>{var oe;if(i.preventDefault(),i.stopPropagation(),I&&!((oe=i.nativeEvent.target)!=null&&oe.classList.contains(R)))return!1;const{droppingItem:s,onDropDragOver:f,margin:b,cols:l,rowHeight:v,maxRows:d,width:g,containerPadding:x,transformScale:M}=this.props,U=f==null?void 0:f(i);if(U===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const z={...s,...U},{layout:O}=this.state,L=i.currentTarget.getBoundingClientRect(),H=i.clientX-L.left,F=i.clientY-L.top,K={left:H/M,top:F/M,e:i};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:ae,top:le}=this.state.droppingPosition;(ae!=H||le!=F)&&this.setState({droppingPosition:K})}}else{const ae={cols:l,margin:b,maxRows:d,rowHeight:v,containerWidth:g,containerPadding:x||b},le=(0,a.calcXY)(ae,F,H,z.w,z.h);this.setState({droppingDOMNode:e.createElement("div",{key:z.i}),droppingPosition:K,layout:[...O,{...z,x:le.x,y:le.y,static:!1,isDraggable:!0}]})}}),m(this,"removeDroppingPlaceholder",()=>{const{droppingItem:i,cols:s}=this.props,{layout:f}=this.state,b=(0,r.compact)(f.filter(l=>l.i!==i.i),(0,r.compactType)(this.props),s,this.props.allowOverlap);this.setState({layout:b,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),m(this,"onDragLeave",i=>{i.preventDefault(),i.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),m(this,"onDragEnter",i=>{i.preventDefault(),i.stopPropagation(),this.dragEnterCounter++}),m(this,"onDrop",i=>{i.preventDefault(),i.stopPropagation();const{droppingItem:s}=this.props,{layout:f}=this.state,b=f.find(l=>l.i===s.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(f,b,i)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(i,s){let f;return s.activeDrag?null:(!(0,t.deepEqual)(i.layout,s.propsLayout)||i.compactType!==s.compactType?f=i.layout:(0,r.childrenEqual)(i.children,s.children)||(f=s.layout),f?{layout:(0,r.synchronizeLayoutWithChildren)(f,i.children,i.cols,(0,r.compactType)(i),i.allowOverlap),compactType:i.compactType,children:i.children,propsLayout:i.layout}:null)}shouldComponentUpdate(i,s){return this.props.children!==i.children||!(0,r.fastRGLPropsEqual)(this.props,i,t.deepEqual)||this.state.activeDrag!==s.activeDrag||this.state.mounted!==s.mounted||this.state.droppingPosition!==s.droppingPosition}componentDidUpdate(i,s){if(!this.state.activeDrag){const f=this.state.layout,b=s.layout;this.onLayoutMaybeChanged(f,b)}}containerHeight(){if(!this.props.autoSize)return;const i=(0,r.bottom)(this.state.layout),s=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return i*this.props.rowHeight+(i-1)*this.props.margin[1]+s*2+"px"}onLayoutMaybeChanged(i,s){s||(s=this.state.layout),(0,t.deepEqual)(s,i)||this.props.onLayoutChange(i)}placeholder(){const{activeDrag:i}=this.state;if(!i)return null;const{width:s,cols:f,margin:b,containerPadding:l,rowHeight:v,maxRows:d,useCSSTransforms:g,transformScale:x}=this.props;return e.createElement(o.default,{w:i.w,h:i.h,x:i.x,y:i.y,i:i.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:s,cols:f,margin:b,containerPadding:l||b,maxRows:d,rowHeight:v,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:g,transformScale:x},e.createElement("div",null))}processGridItem(i,s){if(!i||!i.key)return;const f=(0,r.getLayoutItem)(this.state.layout,String(i.key));if(!f)return null;const{width:b,cols:l,margin:v,containerPadding:d,rowHeight:g,maxRows:x,isDraggable:M,isResizable:U,isBounded:z,useCSSTransforms:O,transformScale:L,draggableCancel:H,draggableHandle:F,resizeHandles:K,resizeHandle:oe}=this.props,{mounted:ae,droppingPosition:le}=this.state,A=typeof f.isDraggable=="boolean"?f.isDraggable:!f.static&&M,Q=typeof f.isResizable=="boolean"?f.isResizable:!f.static&&U,te=f.resizeHandles||K,se=A&&z&&f.isBounded!==!1;return e.createElement(o.default,{containerWidth:b,cols:l,margin:v,containerPadding:d||v,maxRows:x,rowHeight:g,cancel:H,handle:F,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:A,isResizable:Q,isBounded:se,useCSSTransforms:O&&ae,usePercentages:!ae,transformScale:L,w:f.w,h:f.h,x:f.x,y:f.y,i:f.i,minH:f.minH,minW:f.minW,maxH:f.maxH,maxW:f.maxW,static:f.static,droppingPosition:s?le:void 0,resizeHandles:te,resizeHandle:oe},i)}render(){const{className:i,style:s,isDroppable:f,innerRef:b}=this.props,l=(0,n.default)(R,i),v={height:this.containerHeight(),...s};return e.createElement("div",{ref:b,className:l,style:v,onDrop:f?this.onDrop:r.noop,onDragLeave:f?this.onDragLeave:r.noop,onDragEnter:f?this.onDragEnter:r.noop,onDragOver:f?this.onDragOver:r.noop},e.Children.map(this.props.children,d=>this.processGridItem(d)),f&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};return Xe.default=S,m(S,"displayName","ReactGridLayout"),m(S,"propTypes",u.default),m(S,"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:r.noop,onDragStart:r.noop,onDrag:r.noop,onDragStop:r.noop,onResizeStart:r.noop,onResize:r.noop,onResizeStop:r.noop,onDrop:r.noop,onDropDragOver:r.noop}),Xe}var nt={},xe={},Jr;function Qr(){if(Jr)return xe;Jr=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.findOrGenerateResponsiveLayout=r,xe.getBreakpointFromWidth=t,xe.getColsFromBreakpoint=n,xe.sortBreakpoints=a;var e=ze();function t(o,u){const y=a(o);let h=y[0];for(let T=1,m=y.length;T<m;T++){const C=y[T];u>o[C]&&(h=C)}return h}function n(o,u){if(!u[o])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+o+" is missing!");return u[o]}function r(o,u,y,h,T,m){if(o[y])return(0,e.cloneLayout)(o[y]);let C=o[h];const E=a(u),R=E.slice(E.indexOf(y));for(let I=0,S=R.length;I<S;I++){const p=R[I];if(o[p]){C=o[p];break}}return C=(0,e.cloneLayout)(C||[]),(0,e.compact)((0,e.correctBounds)(C,{cols:T}),m,T)}function a(o){return Object.keys(o).sort(function(y,h){return o[y]-o[h]})}return xe}var $r;function Yn(){if($r)return nt;$r=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.default=void 0;var e=h(V),t=u(Ee()),n=Zt(),r=ze(),a=Qr(),o=u(Zr());function u(p){return p&&p.__esModule?p:{default:p}}function y(p){if(typeof WeakMap!="function")return null;var i=new WeakMap,s=new WeakMap;return(y=function(f){return f?s:i})(p)}function h(p,i){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var s=y(i);if(s&&s.has(p))return s.get(p);var f={__proto__:null},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in p)if(l!=="default"&&Object.prototype.hasOwnProperty.call(p,l)){var v=b?Object.getOwnPropertyDescriptor(p,l):null;v&&(v.get||v.set)?Object.defineProperty(f,l,v):f[l]=p[l]}return f.default=p,s&&s.set(p,f),f}function T(){return T=Object.assign?Object.assign.bind():function(p){for(var i=1;i<arguments.length;i++){var s=arguments[i];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(p[f]=s[f])}return p},T.apply(this,arguments)}function m(p,i,s){return i=C(i),i in p?Object.defineProperty(p,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):p[i]=s,p}function C(p){var i=E(p,"string");return typeof i=="symbol"?i:String(i)}function E(p,i){if(typeof p!="object"||p===null)return p;var s=p[Symbol.toPrimitive];if(s!==void 0){var f=s.call(p,i);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(p)}const R=p=>Object.prototype.toString.call(p);function I(p,i){return p==null?null:Array.isArray(p)?p:p[i]}let S=class extends e.Component{constructor(){super(...arguments),m(this,"state",this.generateInitialState()),m(this,"onLayoutChange",i=>{this.props.onLayoutChange(i,{...this.props.layouts,[this.state.breakpoint]:i})})}generateInitialState(){const{width:i,breakpoints:s,layouts:f,cols:b}=this.props,l=(0,a.getBreakpointFromWidth)(s,i),v=(0,a.getColsFromBreakpoint)(l,b),d=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,a.findOrGenerateResponsiveLayout)(f,s,l,l,v,d),breakpoint:l,cols:v}}static getDerivedStateFromProps(i,s){if(!(0,n.deepEqual)(i.layouts,s.layouts)){const{breakpoint:f,cols:b}=s;return{layout:(0,a.findOrGenerateResponsiveLayout)(i.layouts,i.breakpoints,f,f,b,i.compactType),layouts:i.layouts}}return null}componentDidUpdate(i){(this.props.width!=i.width||this.props.breakpoint!==i.breakpoint||!(0,n.deepEqual)(this.props.breakpoints,i.breakpoints)||!(0,n.deepEqual)(this.props.cols,i.cols))&&this.onWidthChange(i)}onWidthChange(i){const{breakpoints:s,cols:f,layouts:b,compactType:l}=this.props,v=this.props.breakpoint||(0,a.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),d=this.state.breakpoint,g=(0,a.getColsFromBreakpoint)(v,f),x={...b};if(d!==v||i.breakpoints!==s||i.cols!==f){d in x||(x[d]=(0,r.cloneLayout)(this.state.layout));let z=(0,a.findOrGenerateResponsiveLayout)(x,s,v,d,g,l);z=(0,r.synchronizeLayoutWithChildren)(z,this.props.children,g,l,this.props.allowOverlap),x[v]=z,this.props.onBreakpointChange(v,g),this.props.onLayoutChange(z,x),this.setState({breakpoint:v,layout:z,cols:g})}const M=I(this.props.margin,v),U=I(this.props.containerPadding,v);this.props.onWidthChange(this.props.width,M,g,U)}render(){const{breakpoint:i,breakpoints:s,cols:f,layouts:b,margin:l,containerPadding:v,onBreakpointChange:d,onLayoutChange:g,onWidthChange:x,...M}=this.props;return e.createElement(o.default,T({},M,{margin:I(l,this.state.breakpoint),containerPadding:I(v,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}};return nt.default=S,m(S,"propTypes",{breakpoint:t.default.string,breakpoints:t.default.object,allowOverlap:t.default.bool,cols:t.default.object,margin:t.default.oneOfType([t.default.array,t.default.object]),containerPadding:t.default.oneOfType([t.default.array,t.default.object]),layouts(p,i){if(R(p[i])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+R(p[i]));Object.keys(p[i]).forEach(s=>{if(!(s in p.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,r.validateLayout)(p.layouts[s],"layouts."+s)})},width:t.default.number.isRequired,onBreakpointChange:t.default.func,onLayoutChange:t.default.func,onWidthChange:t.default.func}),m(S,"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:r.noop,onLayoutChange:r.noop,onWidthChange:r.noop}),nt}var Ct={},en=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(a,o){return a[0]===n?(r=o,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),a=this.__entries__[r];return a&&a[1]},t.prototype.set=function(n,r){var a=e(this.__entries__,n);~a?this.__entries__[a][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,a=e(r,n);~a&&r.splice(a,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var a=0,o=this.__entries__;a<o.length;a++){var u=o[a];n.call(r,u[1],u[0])}},t}()}(),ir=typeof window<"u"&&typeof document<"u"&&window.document===document,Tt=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")()}(),Xn=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Tt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Kn=2;function Zn(e,t){var n=!1,r=!1,a=0;function o(){n&&(n=!1,e()),r&&y()}function u(){Xn(o)}function y(){var h=Date.now();if(n){if(h-a<Kn)return;r=!0}else n=!0,r=!1,setTimeout(u,t);a=h}return y}var Jn=20,Qn=["top","right","bottom","left","width","height","size","weight"],$n=typeof MutationObserver<"u",ea=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Zn(this.refresh.bind(this),Jn)}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(){!ir||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),$n?(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(){!ir||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,a=Qn.some(function(o){return!!~r.indexOf(o)});a&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),tn=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var a=r[n];Object.defineProperty(e,a,{value:t[a],enumerable:!1,writable:!1,configurable:!0})}return e},ke=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Tt},rn=It(0,0,0,0);function wt(e){return parseFloat(e)||0}function nn(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,a){var o=e["border-"+a+"-width"];return r+wt(o)},0)}function ta(e){for(var t=["top","right","bottom","left"],n={},r=0,a=t;r<a.length;r++){var o=a[r],u=e["padding-"+o];n[o]=wt(u)}return n}function ra(e){var t=e.getBBox();return It(0,0,t.width,t.height)}function na(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return rn;var r=ke(e).getComputedStyle(e),a=ta(r),o=a.left+a.right,u=a.top+a.bottom,y=wt(r.width),h=wt(r.height);if(r.boxSizing==="border-box"&&(Math.round(y+o)!==t&&(y-=nn(r,"left","right")+o),Math.round(h+u)!==n&&(h-=nn(r,"top","bottom")+u)),!oa(e)){var T=Math.round(y+o)-t,m=Math.round(h+u)-n;Math.abs(T)!==1&&(y-=T),Math.abs(m)!==1&&(h-=m)}return It(a.left,a.top,y,h)}var aa=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof ke(e).SVGGraphicsElement}:function(e){return e instanceof ke(e).SVGElement&&typeof e.getBBox=="function"}}();function oa(e){return e===ke(e).document.documentElement}function ia(e){return ir?aa(e)?ra(e):na(e):rn}function sa(e){var t=e.x,n=e.y,r=e.width,a=e.height,o=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,u=Object.create(o.prototype);return tn(u,{x:t,y:n,width:r,height:a,top:n,right:t+r,bottom:a+n,left:t}),u}function It(e,t,n,r){return{x:e,y:t,width:n,height:r}}var la=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=It(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=ia(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}(),ua=function(){function e(t,n){var r=sa(n);tn(this,{target:t,contentRect:r})}return e}(),ca=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new en,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 ke(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new la(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 ke(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 ua(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}(),an=typeof WeakMap<"u"?new WeakMap:new en,on=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=ea.getInstance(),r=new ca(t,n,this);an.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){on.prototype[e]=function(){var t;return(t=an.get(this))[e].apply(t,arguments)}});var da=function(){return typeof Tt.ResizeObserver<"u"?Tt.ResizeObserver:on}();const fa=yr(Object.freeze(Object.defineProperty({__proto__:null,default:da},Symbol.toStringTag,{value:"Module"})));var sn;function pa(){if(sn)return Ct;sn=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.default=E;var e=u(V),t=a(Ee()),n=a(fa),r=a(Jt());function a(R){return R&&R.__esModule?R:{default:R}}function o(R){if(typeof WeakMap!="function")return null;var I=new WeakMap,S=new WeakMap;return(o=function(p){return p?S:I})(R)}function u(R,I){if(R&&R.__esModule)return R;if(R===null||typeof R!="object"&&typeof R!="function")return{default:R};var S=o(I);if(S&&S.has(R))return S.get(R);var p={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in R)if(s!=="default"&&Object.prototype.hasOwnProperty.call(R,s)){var f=i?Object.getOwnPropertyDescriptor(R,s):null;f&&(f.get||f.set)?Object.defineProperty(p,s,f):p[s]=R[s]}return p.default=R,S&&S.set(R,p),p}function y(){return y=Object.assign?Object.assign.bind():function(R){for(var I=1;I<arguments.length;I++){var S=arguments[I];for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&(R[p]=S[p])}return R},y.apply(this,arguments)}function h(R,I,S){return I=T(I),I in R?Object.defineProperty(R,I,{value:S,enumerable:!0,configurable:!0,writable:!0}):R[I]=S,R}function T(R){var I=m(R,"string");return typeof I=="symbol"?I:String(I)}function m(R,I){if(typeof R!="object"||R===null)return R;var S=R[Symbol.toPrimitive];if(S!==void 0){var p=S.call(R,I);if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(I==="string"?String:Number)(R)}const C="react-grid-layout";function E(R){var I;return I=class extends e.Component{constructor(){super(...arguments),h(this,"state",{width:1280}),h(this,"elementRef",e.createRef()),h(this,"mounted",!1),h(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new n.default(i=>{if(this.elementRef.current instanceof HTMLElement){const f=i[0].contentRect.width;this.setState({width:f})}});const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.observe(p)}componentWillUnmount(){this.mounted=!1;const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.unobserve(p),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:p,...i}=this.props;return p&&!this.mounted?e.createElement("div",{className:(0,r.default)(this.props.className,C),style:this.props.style,ref:this.elementRef}):e.createElement(R,y({innerRef:this.elementRef},i,this.state))}},h(I,"defaultProps",{measureBeforeMount:!1}),h(I,"propTypes",{measureBeforeMount:t.default.bool}),I}return Ct}var ln;function ha(){return ln||(ln=1,function(e){e.exports=Zr().default,e.exports.utils=ze(),e.exports.calculateUtils=$t(),e.exports.Responsive=Yn().default,e.exports.Responsive.utils=Qr(),e.exports.WidthProvider=pa().default}(Kt)),Kt.exports}var va=ha();const ga=Ln(va);var ma=Object.getOwnPropertyDescriptor,ya=(e,t,n,r)=>{for(var a=r>1?void 0:r?ma(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},ba=(e,t)=>(n,r)=>t(n,r,e);let Ae=class extends w.Disposable{constructor(t){super();De(this,"_initLocal",()=>{});De(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let a=n.exec(t);for(;a;)r.push({startIndex:a.index,key:Number(a[1]),endIndex:a.index+a[0].length-1}),a=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),a=t.split("."),o=r&&this._localeService.resolveKeyPath(r,a);if(typeof o=="string"){const u=[];return this._findReplaceIndex(o).forEach((y,h,T)=>{const m=T[h-1]||{endIndex:-1};if(m.endIndex+1<y.startIndex){const C=o.slice(m.endIndex+1,y.startIndex);C&&u.push(C)}if(n[y.key]&&u.push(n[y.key]),h===T.length-1){const C=o.slice(y.endIndex+1);C&&u.push(C)}}),u}return[]}};Ae=ya([ba(0,w.Inject(w.LocaleService))],Ae);const _t={cfPreview:"univer-cf-preview"},je=e=>{var a,o;const t=e.rule;if(!t)return null;const n=V.useMemo(()=>{if(t.type===c.CFRuleType.colorScale){const u=t.config.map((T,m)=>({color:new w.ColorKit(T.color),value:m})),y=u.length-1;return new Array(5).fill("").map((T,m,C)=>m*y/(C.length-1)).map(T=>c.getColorScaleFromValue(u,T))}return null},[t]),r=V.useMemo(()=>{if(t.type===c.CFRuleType.iconSet)return t.config.map(u=>{const y=c.iconMap[u.iconType];return y&&y[Number(u.iconId)]})},[t]);switch(t.type){case c.CFRuleType.dataBar:{const{isGradient:u}=t.config,y={width:"50%",height:"100%"},h=u?`linear-gradient(to right, ${t.config.positiveColor||c.defaultDataBarPositiveColor}, rgb(255 255 255))`:t.config.positiveColor,T=u?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor||c.defaultDataBarNativeColor})`:t.config.nativeColor;return _.jsxs("div",{className:_t.cfPreview,children:[_.jsx("div",{style:{...y,background:T,border:`1px solid ${t.config.nativeColor||c.defaultDataBarNativeColor}`}}),_.jsx("div",{style:{...y,background:h,border:`1px solid ${t.config.positiveColor||c.defaultDataBarPositiveColor}`}})]})}case c.CFRuleType.colorScale:return n&&_.jsx("div",{className:_t.cfPreview,children:n.map((u,y)=>_.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:u}},y))});case c.CFRuleType.iconSet:return r&&_.jsx("div",{className:_t.cfPreview,children:r.map((u,y)=>u?_.jsx("img",{style:{height:"100%"},src:u},y):_.jsx(Ye,{},y))});case c.CFRuleType.highlightCell:{const{ul:u,st:y,it:h,bl:T,bg:m,cl:C}=t.style,E=(u==null?void 0:u.s)===w.BooleanNumber.TRUE,R=(y==null?void 0:y.s)===w.BooleanNumber.TRUE,I=h===w.BooleanNumber.TRUE,S=T===w.BooleanNumber.TRUE,p=(a=m==null?void 0:m.rgb)!=null?a:c.DEFAULT_BG_COLOR,i=(o=C==null?void 0:C.rgb)!=null?o:c.DEFAULT_FONT_COLOR,s={fontWeight:S?"bold":void 0,fontStyle:I?"italic":void 0,textDecoration:`${E?"underline":""} ${R?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:p,color:i};return _.jsx("div",{style:s,className:_t.cfPreview,children:"123"})}}return null},me={cfRuleList:"univer-cf-rule-list",ruleSelector:"univer-rule-selector",select:"univer-select",gap:"univer-gap",disabled:"univer-disabled",ruleItem:"univer-rule-item",ruleDescribe:"univer-rule-describe",ruleType:"univer-rule-type",ruleRange:"univer-rule-range",active:"univer-active",draggableHandle:"univer-draggableHandle",deleteItem:"univer-delete-item",gridLayoutWrap:"univer-grid-layout-wrap"},Sa=(e,t)=>{const n=e.rule;switch(n.type){case c.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case c.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case c.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case c.CFRuleType.highlightCell:switch(n.subType){case c.CFSubRuleType.average:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,t.t("sheet.cf.subRuleType.average"))}case c.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case c.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case c.CFSubRuleType.number:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(a=>String(a)):[String(n.value||"")])}case c.CFSubRuleType.text:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case c.CFSubRuleType.timePeriod:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`)}case c.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 c.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let un=0;const Ca=e=>{const{onClick:t}=e,n=$.useDependency(c.ConditionalFormattingRuleModel),r=$.useDependency(w.IUniverInstanceService),a=$.useDependency(q.SheetsSelectionsService),o=$.useDependency(w.ICommandService),u=$.useDependency(w.LocaleService),y=$.useDependency(w.Injector),h=$.useDependency($.ISidebarService),T=$.useDependency(Ae),m=$.useObservable(()=>r.getCurrentTypeOfUnit$(w.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),C=m.getUnitId(),E=m.getActiveSheet();if(!E)throw new Error("No active sheet found");const R=E.getSheetId(),[I,S]=V.useState([]),[p,i]=V.useState("2"),[s,f]=V.useState(0),[b,l]=V.useState(-1),[v,d]=V.useState(un),g=V.useRef(null),x=[{label:u.t("sheet.cf.panel.workSheet"),value:"2"},{label:u.t("sheet.cf.panel.selectedRange"),value:"1"}],M=()=>{const A=n.getSubunitRules(C,R);if(!A||!A.length)return[];if(p==="1"){const Q=a.getCurrentLastSelection();if(!Q)return[];const te=Q.range;return A.filter(fe=>fe.ranges.some(ve=>w.Rectangle.intersects(ve,te)))}else if(p==="2")return[...A];return[]},[U,z]=V.useState(M);pe.useHighlightRange(I),V.useEffect(()=>{const A=o.onCommandExecuted(Q=>{Q.id===q.SetWorksheetActiveOperation.id&&f(Math.random())});return()=>A.dispose()}),V.useEffect(()=>{z(M)},[p,s,C,R]),V.useEffect(()=>{if(p==="2")return;const A=new Ce.Observable(Q=>{const te=[q.SetSelectionsOperation.id,c.AddConditionalRuleMutation.id,c.SetConditionalRuleMutation.id,c.DeleteConditionalRuleMutation.id,c.MoveConditionalRuleMutation.id],se=o.onCommandExecuted(fe=>{const{id:ve,params:Te}=fe,W=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getUnitId();te.includes(ve)&&Te.unitId===W&&Q.next(null)});return()=>se.dispose()}).pipe(Ce.debounceTime(16)).subscribe(()=>{z(M)});return()=>{A.unsubscribe()}},[r,p,C,R]),V.useEffect(()=>{const A=n.$ruleChange.subscribe(()=>{f(Math.random())});return()=>A.unsubscribe()},[n]),V.useEffect(()=>{const A=()=>{var fe,ve;const se=Math.max(0,((ve=(fe=g.current)==null?void 0:fe.getBoundingClientRect().width)!=null?ve:0)-8);return un=se,se},te=new Ce.Observable(se=>{const fe=h.getContainer();if(fe){let ve=setTimeout(()=>{se.next()},150);const Te=()=>{ve&&clearTimeout(ve),ve=null},W=Z=>{Z.propertyName==="width"&&(Te(),se.next())};return fe.addEventListener("transitionend",W),()=>{Te(),fe.removeEventListener("transitionend",W)}}}).pipe(Ce.debounceTime(16)).subscribe(()=>{d(A())});return()=>{te.unsubscribe()}},[]);const O=A=>{var se;const Q=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),te=(se=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:se.getSheetId();if(!Q||!te)throw new Error("No active sheet found");o.executeCommand(c.DeleteCfCommand.id,{unitId:Q,subUnitId:te,cfId:A.cfId})},L=(A,Q)=>{l(Q.y)},H=(A,Q,te)=>{var Z;l(-1);const se=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),fe=(Z=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:Z.getSheetId();if(!se||!fe)throw new Error("No active sheet found");const ve=ie=>{const P=U.length;return Math.min(P-1,Math.max(0,ie))},Te=U[ve(Q.y)].cfId,W=U[ve(te.y)].cfId;Te!==W&&o.executeCommand(c.MoveCfCommand.id,{unitId:se,subUnitId:fe,start:{id:Te,type:"self"},end:{id:W,type:te.y>Q.y?"after":"before"}})},F=()=>{e.onCreate()},K=()=>{p==="2"?o.executeCommand(c.ClearWorksheetCfCommand.id):p==="1"&&U.map(Q=>({unitId:C,subUnitId:R,cfId:Q.cfId})).forEach(Q=>{o.executeCommand(c.DeleteCfCommand.id,Q)})},oe=V.useMemo(()=>{const A=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET),Q=A.getActiveSheet();return U.filter(te=>{const se=te.ranges;return q.checkRangesEditablePermission(y,A.getUnitId(),Q.getSheetId(),se)})},[U]),ae=oe.map((A,Q)=>({i:A.cfId,x:0,w:12,y:Q,h:1,isResizable:!1})),le=V.useMemo(()=>{const A=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET),Q=A.getActiveSheet();return U.every(te=>{const se=te.ranges;return q.checkRangesEditablePermission(y,A.getUnitId(),Q.getSheetId(),se)})},[U]);return _.jsxs("div",{className:me.cfRuleList,children:[_.jsxs("div",{className:me.ruleSelector,children:[_.jsx("div",{children:T.tWithReactNode("sheet.cf.panel.managerRuleSelect",_.jsx(X.Select,{className:me.select,options:x,value:p,onChange:A=>{i(A)}})).map((A,Q)=>_.jsx("span",{children:A},Q))}),_.jsxs("div",{className:"univer-flex univer-justify-end",children:[_.jsx(X.Tooltip,{title:u.t("sheet.cf.panel.createRule"),placement:"bottom",children:_.jsx("div",{className:"univer-size-5",onClick:F,children:_.jsx(gr,{})})}),U.length&&le?_.jsx(X.Tooltip,{title:u.t("sheet.cf.panel.clear"),placement:"bottom",children:_.jsx("div",{className:X.clsx(me.gap,"univer-size-5"),onClick:K,children:_.jsx(vt,{})})}):_.jsx("div",{className:X.clsx(me.gap,me.disabled),children:_.jsx(vt,{})})]})]}),_.jsx("div",{ref:g,className:me.gridLayoutWrap,children:v?_.jsx(ga,{draggableHandle:".draggableHandle",layout:ae,cols:12,rowHeight:60,width:v,margin:[0,10],onDragStop:H,onDragStart:L,children:oe==null?void 0:oe.map((A,Q)=>_.jsx("div",{children:_.jsxs("div",{className:X.clsx(me.ruleItem,{[me.active]:b===Q}),onMouseMove:()=>{A.ranges!==I&&S(A.ranges)},onMouseLeave:()=>S([]),onClick:()=>{t(A)},children:[_.jsx("div",{className:X.clsx(me.draggableHandle,"draggableHandle"),onClick:te=>te.stopPropagation(),children:_.jsx(mr,{})}),_.jsxs("div",{className:me.ruleDescribe,children:[_.jsx("div",{className:me.ruleType,children:Sa(A,u)}),_.jsx("div",{className:me.ruleRange,children:A.ranges.map(te=>kt.serializeRange(te)).join(",")})]}),_.jsx("div",{children:_.jsx(je,{rule:A.rule})}),_.jsx("div",{className:X.clsx(me.deleteItem,{[me.active]:b===Q}),onClick:te=>{te.stopPropagation(),O(A),S([])},children:_.jsx(vt,{})})]})},`${A.cfId}`))}):null})]})},cn={cfColorPickerIcon:"univer-cf-color-picker-icon",iconDropdown:"univer-icon-dropdown"},Me=e=>{const{color:t,onChange:n,disable:r=!1,iconId:a="PaintBucket",className:o,isNeedDropdownIcon:u=!0}=e,y=$.useDependency($.ComponentManager),h=V.useMemo(()=>new w.ColorKit(t),[t]),T=y.get(a);return T&&(r?_.jsx(T,{className:o,extend:{colorChannel1:h.isValid?t:"rgb(var(--primary-color))"}}):_.jsx(X.Dropdown,{overlay:_.jsx("div",{className:"univer-rounded-lg univer-p-4",children:_.jsx(X.ColorPicker,{value:t,onChange:n})}),children:_.jsxs("span",{className:`
4
- ${cn.cfColorPickerIcon}
5
- ${o}
6
- `,children:[_.jsx(T,{extend:{colorChannel1:h.isValid?t:"rgb(var(--primary-color))"}}),u&&_.jsx(gt,{className:cn.iconDropdown})]})}))},re={cfRuleStyleEditor:"univer-cf-rule-style-editor",cfErrorText:"univer-cf-error-text",cfPreviewWrap:"univer-cf-preview-wrap",text:"univer-text",positionRelative:"univer-position-relative",utilItem:"univer-util-item",iconSet:"univer-icon-set",renderConfig:"univer-render-config",dropdownIcon:"univer-dropdown-icon",icon:"univer-icon",errorInput:"univer-error-input",errorText:"univer-error-text",iconGroupList:"univer-icon-group-list",title:"univer-title",group:"univer-group",itemContent:"univer-item-content",itemWrap:"univer-item-wrap",item:"univer-item",iconItemListWrap:"univer-icon-item-list-wrap",none:"univer-none",iconItemList:"univer-icon-item-list",stress:"univer-stress"},Ne=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),sr=e=>{var I;const{type:t,className:n,onChange:r,id:a,value:o}=e,u=$.useDependency(w.IUniverInstanceService),y=u.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),h=(I=u.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:I.getSheetId(),T=V.useMemo(()=>String(o).startsWith("=")?String(o):"=",[o]),m=V.useMemo(()=>[c.CFValueType.max,c.CFValueType.min,"none"].includes(t)?{disabled:!0}:[c.CFValueType.percent,c.CFValueType.percentile].includes(t)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[t]),C=V.useRef(null),[E,R]=V.useState(!1);return $.useSidebarClick(S=>{var i;((i=C.current)==null?void 0:i.isClickOutSide(S))&&R(!1)}),t===c.CFValueType.formula?_.jsx("div",{style:{width:"100%",marginLeft:4},children:_.jsx(Ge.FormulaEditor,{initValue:T,unitId:y,subUnitId:h,isFocus:E,onChange:(S="")=>{r(S||"")},onFocus:()=>R(!0),ref:C})}):_.jsx(X.InputNumber,{className:n,value:Number(e.value)||0,onChange:S=>e.onChange(S||0),...m})},Ta=e=>{var z;const{interceptorManager:t}=e,n=$.useDependency(w.LocaleService),r=((z=e.rule)==null?void 0:z.type)===c.CFRuleType.colorScale?e.rule:void 0,a=[Ne(c.CFValueType.num,n),Ne(c.CFValueType.percent,n),Ne(c.CFValueType.percentile,n),Ne(c.CFValueType.formula,n)],o=[Ne(c.CFValueType.min,n),...a],u=[Ne("none",n),...a],y=[Ne(c.CFValueType.max,n),...a],[h,T]=V.useState(()=>{var L;const O=c.CFValueType.min;return r&&((L=r.config[0])==null?void 0:L.value.type)||O}),[m,C]=V.useState(()=>{var L;const O="none";return!r||r.config.length!==3?O:((L=r.config[1])==null?void 0:L.value.type)||O}),[E,R]=V.useState(()=>{var L;const O=c.CFValueType.max;return r&&((L=r.config[r.config.length-1])==null?void 0:L.value.type)||O}),[I,S]=V.useState(()=>{if(!r)return 10;const L=r.config[0];return(L==null?void 0:L.value.value)===void 0?10:L==null?void 0:L.value.value}),[p,i]=V.useState(()=>{var H;if(!r||r.config.length!==3)return 50;const L=(H=r.config[1])==null?void 0:H.value.value;return L===void 0?50:L}),[s,f]=V.useState(()=>{var H;if(!r)return 90;const L=(H=r.config[r.config.length-1])==null?void 0:H.value.value;return L===void 0?90:L}),[b,l]=V.useState(()=>{var L;const O="#d0d9fb";return r&&((L=r.config[0])==null?void 0:L.color)||O}),[v,d]=V.useState(()=>{var L;const O="#7790f3";return!r||r.config.length!==3?O:((L=r.config[1])==null?void 0:L.color)||O}),[g,x]=V.useState(()=>{var L;const O="#2e55ef";return r&&((L=r.config[r.config.length-1])==null?void 0:L.color)||O}),M=V.useMemo(()=>O=>{const{minType:L,medianType:H,maxType:F,minValue:K,medianValue:oe,maxValue:ae,minColor:le,medianColor:A,maxColor:Q}=O,te=[];return te.push({color:le,value:{type:L,value:K}}),H!=="none"&&te.push({color:A,value:{type:H,value:oe}}),te.push({color:Q,value:{type:F,value:ae}}),{config:te.map((fe,ve)=>({...fe,index:ve})),type:c.CFRuleType.colorScale}},[]);V.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return M({minType:h,medianType:m,maxType:E,minValue:I,medianValue:p,maxValue:s,minColor:b,medianColor:v,maxColor:g})}}),[M,h,m,E,I,p,s,b,v,g,t]);const U=O=>{e.onChange(M(O))};return _.jsxs("div",{children:[_.jsx("div",{className:ue.title,children:n.t("sheet.cf.panel.styleRule")}),_.jsx("div",{className:`
7
- ${re.cfPreviewWrap}
8
- `,children:_.jsx(je,{rule:M({minType:h,medianType:m,maxType:E,minValue:I,medianValue:p,maxValue:s,minColor:b,medianColor:v,maxColor:g})})}),_.jsx("div",{className:ue.label,children:n.t("sheet.cf.valueType.min")}),_.jsxs("div",{className:X.clsx(`
9
- ${ue.labelContainer}
10
- univer-mt-3
11
- `,"univer-box-border univer-h-8"),children:[_.jsx(X.Select,{className:"univer-flex-shrink-0",options:o,value:h,onChange:O=>{T(O);const L=c.createDefaultValueByValueType(O,10);S(L),U({minType:O,medianType:m,maxType:E,minValue:L,medianValue:p,maxValue:s,minColor:b,medianColor:v,maxColor:g})}}),_.jsx(sr,{id:"min",className:"univer-ml-1",value:I,type:h,onChange:O=>{S(O),U({minType:h,medianType:m,maxType:E,minValue:O,medianValue:p,maxValue:s,minColor:b,medianColor:v,maxColor:g})}}),_.jsx(Me,{className:"univer-ml-1",color:b,onChange:O=>{l(O),U({minType:h,medianType:m,maxType:E,minValue:I,medianValue:p,maxValue:s,minColor:O,medianColor:v,maxColor:g})}})]}),_.jsx("div",{className:ue.label,children:n.t("sheet.cf.panel.medianValue")}),_.jsxs("div",{className:X.clsx(`
12
- ${ue.labelContainer}
13
- univer-mt-3
14
- `,"univer-box-border univer-h-8"),children:[_.jsx(X.Select,{className:"univer-flex-shrink-0",options:u,value:m,onChange:O=>{C(O);const L=c.createDefaultValueByValueType(O,50);i(L),U({minType:h,medianType:O,maxType:E,minValue:I,medianValue:L,maxValue:s,minColor:b,medianColor:v,maxColor:g})}}),_.jsx(sr,{id:"median",className:"univer-ml-1",value:p,type:m,onChange:O=>{i(O),U({minType:h,medianType:m,maxType:E,minValue:I,medianValue:O,maxValue:s,minColor:b,medianColor:v,maxColor:g})}}),m!=="none"&&_.jsx(Me,{className:"univer-ml-1",color:v,onChange:O=>{d(O),U({minType:h,medianType:m,maxType:E,minValue:I,medianValue:p,maxValue:s,minColor:b,medianColor:O,maxColor:g})}})]}),_.jsx("div",{className:ue.label,children:n.t("sheet.cf.valueType.max")}),_.jsxs("div",{className:X.clsx(`
15
- ${ue.labelContainer}
16
- univer-mt-3 univer-box-border univer-h-8
17
- `),children:[_.jsx(X.Select,{className:"univer-flex-shrink-0",options:y,value:E,onChange:O=>{R(O);const L=c.createDefaultValueByValueType(O,90);f(L),U({minType:h,medianType:m,maxType:O,minValue:I,medianValue:p,maxValue:L,minColor:b,medianColor:v,maxColor:g})}}),_.jsx(sr,{id:"max",className:"univer-ml-1",value:s,type:E,onChange:O=>{f(O),U({minType:h,medianType:m,maxType:E,minValue:I,medianValue:p,maxValue:O,minColor:b,medianColor:v,maxColor:g})}}),_.jsx(Me,{className:"univer-ml-1",color:g,onChange:O=>{x(O),U({minType:h,medianType:m,maxType:E,minValue:I,medianValue:p,maxValue:s,minColor:b,medianColor:v,maxColor:O})}})]})]})},We=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),dn=e=>{var S;const{onChange:t,className:n,value:r,type:a,id:o,disabled:u=!1}=e,y=$.useDependency(w.IUniverInstanceService),h=y.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),T=(S=y.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:S.getSheetId(),m=V.useRef(null),[C,E]=V.useState(!1);$.useSidebarClick(p=>{var s;((s=m.current)==null?void 0:s.isClickOutSide(p))&&E(!1)});const R=V.useRef(r),I=V.useMemo(()=>[c.CFValueType.percentile,c.CFValueType.percent].includes(a)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[a]);if(a===c.CFValueType.formula){const p=String(R.current).startsWith("=")?String(R.current)||"":"=";return _.jsx("div",{style:{width:"100%",marginLeft:12},children:_.jsx(Ge.FormulaEditor,{initValue:p,unitId:h,subUnitId:T,isFocus:C,onChange:(i="")=>{t(i||"")},onFocus:()=>E(!0),ref:m})})}return _.jsx(X.InputNumber,{className:n,value:Number(r)||0,disabled:u,onChange:p=>{t(p||0)},...I})},wa=e=>{var z;const{interceptorManager:t}=e,n=$.useDependency(w.LocaleService),r=((z=e.rule)==null?void 0:z.type)===c.CFRuleType.dataBar?e.rule:void 0,[a,o]=V.useState(()=>{var L;const O="0";return r?(L=r.config)!=null&&L.isGradient?"1":"0":O}),[u,y]=V.useState(()=>{var O;return r&&((O=r.config)==null?void 0:O.positiveColor)||c.defaultDataBarPositiveColor}),[h,T]=V.useState(()=>{var O;return r&&((O=r.config)==null?void 0:O.nativeColor)||c.defaultDataBarNativeColor}),m=[We(c.CFValueType.num,n),We(c.CFValueType.percent,n),We(c.CFValueType.percentile,n),We(c.CFValueType.formula,n)],C=[We(c.CFValueType.min,n),...m],E=[We(c.CFValueType.max,n),...m],[R,I]=V.useState(()=>{var L;const O=C[0].value;return r&&((L=r.config)==null?void 0:L.min.type)||O}),[S,p]=V.useState(()=>{var L;const O=E[0].value;return r&&((L=r.config)==null?void 0:L.max.type)||O}),[i,s]=V.useState(()=>{var H;if(!r)return 0;const L=((H=r.config)==null?void 0:H.min)||{};return L.type===c.CFValueType.formula?L.value||"=":L.value||0}),[f,b]=V.useState(()=>{var H;if(!r)return 100;const L=((H=r.config)==null?void 0:H.max)||{};return L.type===c.CFValueType.formula?L.value||"=":L.value===void 0?100:L.value}),[l,v]=V.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),d=O=>({config:{min:{type:O.minValueType,value:O.minValue},max:{type:O.maxValueType,value:O.maxValue},isGradient:O.isGradient==="1",positiveColor:O.positiveColor||c.defaultDataBarPositiveColor,nativeColor:O.nativeColor||c.defaultDataBarNativeColor},type:c.CFRuleType.dataBar,isShowValue:O.isShowValue});V.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return d({isGradient:a,minValue:i,minValueType:R,maxValue:f,maxValueType:S,positiveColor:u,nativeColor:h,isShowValue:l})}}),[a,i,R,f,S,u,h,t,l]);const g=O=>{e.onChange(d(O))},x=O=>{y(O),g({isGradient:a,minValue:i,minValueType:R,maxValue:f,maxValueType:S,positiveColor:O,nativeColor:h,isShowValue:l})},M=O=>{T(O),g({isGradient:a,minValue:i,minValueType:R,maxValue:f,maxValueType:S,positiveColor:u,nativeColor:O,isShowValue:l})},U=O=>m.map(L=>L.value).includes(O);return _.jsxs("div",{children:[_.jsx("div",{className:ue.title,children:n.t("sheet.cf.panel.styleRule")}),_.jsx("div",{className:`
18
- ${re.cfPreviewWrap}
19
- `,children:_.jsx(je,{rule:d({isGradient:a,minValue:i,minValueType:R,maxValue:f,maxValueType:S,positiveColor:u,nativeColor:h,isShowValue:l})})}),_.jsxs("div",{children:[_.jsx("div",{className:ue.label,children:n.t("sheet.cf.panel.fillType")}),_.jsxs("div",{className:`
20
- univer-ml-1 univer-mt-3
21
- ${ue.labelContainer}
22
- `,children:[_.jsxs(X.RadioGroup,{value:a,onChange:O=>{o(O),g({isGradient:O,minValue:i,minValueType:R,maxValue:f,maxValueType:S,positiveColor:u,nativeColor:h,isShowValue:l})},children:[_.jsx(X.Radio,{value:"0",children:_.jsx("span",{className:re.text,children:n.t("sheet.cf.panel.pureColor")})}),_.jsx(X.Radio,{value:"1",children:_.jsx("span",{className:re.text,children:n.t("sheet.cf.panel.gradient")})})]}),_.jsxs("div",{className:`
23
- ${re.utilItem}
24
- univer-ml-6
25
- `,children:[_.jsx(X.Checkbox,{checked:!l,onChange:O=>{v(!O),g({isGradient:O,minValue:i,minValueType:R,maxValue:f,maxValueType:S,positiveColor:u,nativeColor:h,isShowValue:!O})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),_.jsxs("div",{children:[_.jsx("div",{className:ue.label,children:n.t("sheet.cf.panel.colorSet")}),_.jsxs("div",{className:`
26
- ${ue.labelContainer}
27
- univer-ml-1 univer-mt-3
28
- `,children:[_.jsxs("div",{className:`
29
- ${ue.labelContainer}
30
- `,children:[_.jsx("div",{className:`
31
- ${re.text}
32
- `,children:n.t("sheet.cf.panel.native")}),_.jsx(Me,{color:h,onChange:M})]}),_.jsxs("div",{className:`
33
- ${ue.labelContainer}
34
- univer-ml-3
35
- `,children:[_.jsx("div",{className:`
36
- ${re.text}
37
- `,children:n.t("sheet.cf.panel.positive")}),_.jsx(Me,{color:u,onChange:x})]})]})]}),_.jsxs("div",{children:[_.jsx("div",{className:ue.label,children:n.t("sheet.cf.valueType.min")}),_.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[_.jsx(X.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:C,value:R,onChange:O=>{I(O);const L=c.createDefaultValueByValueType(O,10);s(L),g({isGradient:a,minValue:L,minValueType:O,maxValue:f,maxValueType:S,positiveColor:u,nativeColor:h,isShowValue:l})}}),_.jsx(dn,{disabled:!U(R),id:"min",type:R,className:"univer-ml-3",value:i,onChange:O=>{s(O||0),g({isGradient:a,minValue:O||0,minValueType:R,maxValue:f,maxValueType:S,positiveColor:u,nativeColor:h,isShowValue:l})}})]}),_.jsx("div",{className:ue.label,children:n.t("sheet.cf.valueType.max")}),_.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[_.jsx(X.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:E,value:S,onChange:O=>{p(O);const L=c.createDefaultValueByValueType(O,90);b(L),g({isGradient:a,minValue:i,minValueType:R,maxValue:L,maxValueType:O,positiveColor:u,nativeColor:h,isShowValue:l})}}),_.jsx(dn,{className:"univer-ml-3",disabled:!U(S),id:"max",type:S,value:f,onChange:O=>{b(O||0),g({isGradient:a,minValue:i,minValueType:R,maxValue:O||0,maxValueType:S,positiveColor:u,nativeColor:h,isShowValue:l})}})]})]})]})},Re={cfStyleEdit:"univer-cf-style-edit",buttonItem:"univer-button-item",isActive:"univer-isActive"},Rt=e=>[w.BooleanNumber.FALSE,void 0].includes(e)?w.BooleanNumber.TRUE:w.BooleanNumber.FALSE,Et=e=>e!==w.BooleanNumber.FALSE,lr=e=>{const{style:t,onChange:n,className:r}=e,a=$.useDependency($.ComponentManager),[o,u]=V.useState(()=>{if(t!=null&&t.bl)return t.bl}),[y,h]=V.useState(()=>{if(t!=null&&t.it)return t.it}),[T,m]=V.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[C,E]=V.useState(()=>{if(t!=null&&t.st)return t.st.s}),[R,I]=V.useState(()=>{var v;const l="#2f56ef";return(v=t==null?void 0:t.cl)!=null&&v.rgb?t.cl.rgb:l}),[S,p]=V.useState(()=>{var v;const l="#e8ecfc";return(v=t==null?void 0:t.bg)!=null&&v.rgb?t.bg.rgb:l}),i=a.get("BoldSingle"),s=a.get("ItalicSingle"),f=a.get("UnderlineSingle"),b=a.get("StrikethroughSingle");return V.useEffect(()=>{const l={bl:o,it:y};R!==void 0&&(l.cl={rgb:R}),S!==void 0&&(l.bg={rgb:S}),C!==void 0&&(l.st={s:C}),T!==void 0&&(l.ul={s:T}),n(c.removeUndefinedAttr(l))},[o,y,T,C,R,S]),_.jsxs("div",{className:X.clsx(Re.cfStyleEdit,r),children:[i&&_.jsx("div",{className:X.clsx({[Re.isActive]:Et(o||w.BooleanNumber.FALSE)},Re.buttonItem),onClick:()=>u(Rt(o)),children:_.jsx(i,{})}),s&&_.jsx("div",{className:X.clsx({[Re.isActive]:Et(y||w.BooleanNumber.FALSE)},Re.buttonItem),onClick:()=>h(Rt(y)),children:_.jsx(s,{})}),f&&_.jsx("div",{className:X.clsx({[Re.isActive]:Et(T||w.BooleanNumber.FALSE)},Re.buttonItem),onClick:()=>m(Rt(T)),children:_.jsx(f,{})}),b&&_.jsx("div",{className:X.clsx({[Re.isActive]:Et(C||w.BooleanNumber.FALSE)},Re.buttonItem),onClick:()=>E(Rt(C)),children:_.jsx(b,{})}),_.jsx(Me,{color:R,onChange:I,iconId:"FontColor"}),_.jsx(Me,{color:S,onChange:p,iconId:"PaintBucket"})]})},Ia=e=>{var b;const{onChange:t,interceptorManager:n}=e,r=$.useDependency(w.LocaleService),o=$.useDependency(w.IUniverInstanceService).getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),u=o.getActiveSheet(),y=((b=e.rule)==null?void 0:b.type)===c.CFRuleType.highlightCell?e.rule:void 0,h=V.useRef(null),[T,m]=V.useState(!1),C=V.useRef(null),[E,R]=V.useState({}),[I,S]=V.useState(()=>(y==null?void 0:y.subType)===c.CFSubRuleType.formula?y.value:"="),[p,i]=V.useState(void 0),s=l=>({style:l.style,value:I,type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.formula});V.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return s({style:E})}}),[E,I,n]),V.useEffect(()=>n.intercept(n.getInterceptPoints().beforeSubmit,{handler:(v,d,g)=>p||I.length===1||!I.startsWith("=")?(i(r.t("sheet.cf.errorMessage.formulaError")),!1):g(v)}),[p,I]);const f=l=>{t(s(l))};return $.useSidebarClick(l=>{var d;((d=C.current)==null?void 0:d.isClickOutSide(l))&&m(!1)}),_.jsxs("div",{ref:h,children:[_.jsx("div",{className:`
38
- ${ue.title}
39
- univer-mt-4
40
- `,children:r.t("sheet.cf.panel.styleRule")}),_.jsx("div",{className:"univer-mt-3",children:_.jsx(Ge.FormulaEditor,{onChange:l=>{S(l),f({style:E})},onVerify:(l,v)=>{!l||v.length===1?i(r.t("sheet.cf.errorMessage.formulaError")):i(void 0)},errorText:p,onFocus:()=>{m(!0)},isFocus:T,initValue:I,unitId:o.getUnitId(),subUnitId:u==null?void 0:u.getSheetId(),ref:C})}),_.jsx("div",{className:`
41
- ${re.cfPreviewWrap}
42
- `,children:_.jsx(je,{rule:s({style:E})})}),_.jsx(lr,{style:y==null?void 0:y.style,className:"univer-mt-3",onChange:l=>{R(l),f({style:l})}})]})},Ot=e=>_.jsxs("div",{style:{position:"relative"},children:[_.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:e.errorText}),e.children]}),ce=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),_a=e=>{const{type:t,operator:n,onChange:r,value:a,interceptorManager:o}=e,u=$.useDependency(w.LocaleService),[y,h]=V.useState(()=>typeof a=="number"?a:0),[T,m]=V.useState(""),[C,E]=V.useState(()=>typeof a=="string"?a:""),[R,I]=V.useState(""),[S,p]=V.useState(()=>Array.isArray(a)?a[0]===void 0?0:a[0]:0),[i,s]=V.useState(""),[f,b]=V.useState(()=>Array.isArray(a)?a[1]===void 0?100:a[1]:100),[l,v]=V.useState("");switch(V.useEffect(()=>{switch(t){case c.CFSubRuleType.text:{[c.CFTextOperator.beginsWith,c.CFTextOperator.endsWith,c.CFTextOperator.containsText,c.CFTextOperator.notContainsText,c.CFTextOperator.equal,c.CFTextOperator.notEqual].includes(n)&&r(C);break}case c.CFSubRuleType.number:{[c.CFNumberOperator.equal,c.CFNumberOperator.notEqual,c.CFNumberOperator.greaterThan,c.CFNumberOperator.greaterThanOrEqual,c.CFNumberOperator.lessThan,c.CFNumberOperator.lessThanOrEqual].includes(n)&&r(y),[c.CFNumberOperator.between,c.CFNumberOperator.notBetween].includes(n)&&r([S,f]);break}}},[t]),V.useEffect(()=>{const d=o.intercept(o.getInterceptPoints().beforeSubmit,{handler:(g,x,M)=>{switch(t){case c.CFSubRuleType.text:if([c.CFTextOperator.beginsWith,c.CFTextOperator.containsText,c.CFTextOperator.endsWith,c.CFTextOperator.notEqual,c.CFTextOperator.notContainsText,c.CFTextOperator.equal].includes(n))return C?M(g):(I(u.t("sheet.cf.errorMessage.notBlank")),!1)}return M(g)}});return()=>{d()}},[t,y,C,n]),t){case c.CFSubRuleType.text:{if([c.CFTextOperator.beginsWith,c.CFTextOperator.endsWith,c.CFTextOperator.containsText,c.CFTextOperator.notContainsText,c.CFTextOperator.equal,c.CFTextOperator.notEqual].includes(n)){const d=g=>{E(g),r(g)};return _.jsx("div",{className:"univer-mt-3",children:_.jsx(Ot,{errorText:R,children:_.jsx(X.Input,{value:C,onChange:g=>{I(""),d(g)}})})})}break}case c.CFSubRuleType.number:{if([c.CFNumberOperator.equal,c.CFNumberOperator.notEqual,c.CFNumberOperator.greaterThan,c.CFNumberOperator.greaterThanOrEqual,c.CFNumberOperator.lessThan,c.CFNumberOperator.lessThanOrEqual].includes(n)){const d=g=>{h(g||0),r(g||0),m("")};return _.jsx("div",{className:"univer-mt-3",children:_.jsx(Ot,{errorText:T,children:_.jsx(X.InputNumber,{className:"univer-w-full",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:y,onChange:d})})})}if([c.CFNumberOperator.between,c.CFNumberOperator.notBetween].includes(n)){const d=x=>{p(x||0),r([x||0,f]),s("")},g=x=>{b(x||0),r([S,x||0]),v("")};return _.jsxs("div",{className:`
43
- univer-mt-3
44
- ${ue.labelContainer}
45
- `,children:[_.jsx(Ot,{errorText:i,children:_.jsx(X.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:S,onChange:d})}),_.jsx(Ot,{errorText:l,children:_.jsx(X.InputNumber,{className:"univer-ml-3",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:f,onChange:g})})]})}}}return null},fn=(e,t)=>{switch(e){case c.CFSubRuleType.text:return[ce(c.CFTextOperator.containsText,t),ce(c.CFTextOperator.notContainsText,t),ce(c.CFTextOperator.beginsWith,t),ce(c.CFTextOperator.endsWith,t),ce(c.CFTextOperator.equal,t),ce(c.CFTextOperator.notEqual,t),ce(c.CFTextOperator.containsBlanks,t),ce(c.CFTextOperator.notContainsBlanks,t),ce(c.CFTextOperator.containsErrors,t),ce(c.CFTextOperator.notContainsErrors,t)];case c.CFSubRuleType.number:return[ce(c.CFNumberOperator.between,t),ce(c.CFNumberOperator.notBetween,t),ce(c.CFNumberOperator.equal,t),ce(c.CFNumberOperator.notEqual,t),ce(c.CFNumberOperator.greaterThan,t),ce(c.CFNumberOperator.greaterThanOrEqual,t),ce(c.CFNumberOperator.lessThan,t),ce(c.CFNumberOperator.lessThanOrEqual,t)];case c.CFSubRuleType.timePeriod:return[ce(c.CFTimePeriodOperator.yesterday,t),ce(c.CFTimePeriodOperator.today,t),ce(c.CFTimePeriodOperator.tomorrow,t),ce(c.CFTimePeriodOperator.last7Days,t),ce(c.CFTimePeriodOperator.lastWeek,t),ce(c.CFTimePeriodOperator.thisWeek,t),ce(c.CFTimePeriodOperator.nextWeek,t),ce(c.CFTimePeriodOperator.lastMonth,t),ce(c.CFTimePeriodOperator.thisMonth,t),ce(c.CFTimePeriodOperator.nextMonth,t)]}},pn=e=>{var b;const{interceptorManager:t,onChange:n}=e,r=$.useDependency(w.LocaleService),a=((b=e.rule)==null?void 0:b.type)===c.CFRuleType.highlightCell?e.rule:void 0,[o,u]=V.useState(()=>{const l=c.CFSubRuleType.text;return a&&a.subType||l}),y=[{value:c.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:c.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:c.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:c.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:c.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],h=V.useMemo(()=>fn(o,r),[o]),[T,m]=V.useState(()=>{const l=h?h[0].value:void 0;return a&&a.operator||l}),[C,E]=V.useState(()=>{var d;const l="";return a?(d=a.value)!=null?d:c.createDefaultValue(a.subType,a.operator):l}),[R,I]=V.useState({}),S=V.useMemo(()=>l=>{var v,d,g,x,M,U,z,O,L,H,F,K,oe,ae,le;switch(l.subType||o){case c.CFSubRuleType.text:{if([c.CFTextOperator.beginsWith,c.CFTextOperator.endsWith,c.CFTextOperator.containsText,c.CFTextOperator.notContainsText,c.CFTextOperator.equal,c.CFTextOperator.notEqual].includes(T))return{type:c.CFRuleType.highlightCell,subType:(v=l.subType)!=null?v:o,operator:(d=l.operator)!=null?d:T,style:(g=l.style)!=null?g:R,value:(x=l.value)!=null?x:C};break}case c.CFSubRuleType.number:{if([c.CFNumberOperator.equal,c.CFNumberOperator.notEqual,c.CFNumberOperator.greaterThan,c.CFNumberOperator.greaterThanOrEqual,c.CFNumberOperator.lessThan,c.CFNumberOperator.lessThanOrEqual].includes(T))return{type:c.CFRuleType.highlightCell,subType:(M=l.subType)!=null?M:o,operator:(U=l.operator)!=null?U:T,style:(z=l.style)!=null?z:R,value:(O=l.value)!=null?O:C};if([c.CFNumberOperator.between,c.CFNumberOperator.notBetween].includes(T))return{type:c.CFRuleType.highlightCell,subType:(L=l.subType)!=null?L:o,operator:(H=l.operator)!=null?H:T,style:(F=l.style)!=null?F:R,value:(K=l.value)!=null?K:C};break}}return{type:c.CFRuleType.highlightCell,subType:(oe=l.subType)!=null?oe:o,operator:(ae=l.operator)!=null?ae:T,style:(le=l.style)!=null?le:R}},[o,T,C,R]);V.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return S({})}}),[S,t]),V.useEffect(()=>{y.some(l=>l.value===o)||u(y[0].value)},[y]);const p=l=>{const v=l,d=fn(v,r),g=d&&d[0].value;u(v),m(g),g&&E(c.createDefaultValue(v,g)),n(S({subType:v,operator:g}))},i=l=>{const v=l;m(v),n(S({operator:v}))},s=l=>{E(l),n(S({value:l}))},f=V.useMemo(()=>`${o}_${T}_${Math.random()}`,[o,T]);return _.jsxs("div",{children:[_.jsx("div",{className:`
46
- ${ue.title}
47
- univer-mt-4
48
- `,children:r.t("sheet.cf.panel.styleRule")}),_.jsxs("div",{className:"univer-flex univer-justify-between univer-gap-4",children:[_.jsx(X.Select,{className:"univer-mt-3 univer-w-full",onChange:p,value:o,options:y}),(h==null?void 0:h.length)&&_.jsx(X.Select,{className:"univer-mt-3 univer-w-full",onChange:i,value:T||"",options:h})]}),_.jsx(_a,{value:C,interceptorManager:t,type:o,operator:T,rule:a,onChange:s},f),_.jsx("div",{className:`
49
- ${re.cfPreviewWrap}
50
- `,children:_.jsx(je,{rule:S({})})}),_.jsx(lr,{style:a==null?void 0:a.style,className:"univer-ml-1",onChange:l=>{I(l),n(S({style:l}))}})]})},hn=(e,t)=>(c.iconMap[e]||[])[Number(t)]||"",Ra=e=>{var h;const t=$.useDependency(w.IUniverInstanceService),n=t.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=(h=t.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:h.getSheetId(),a=V.useMemo(()=>e.error?re.errorInput:"",[e.error]),o=V.useRef(null),[u,y]=V.useState(!1);return $.useSidebarClick(T=>{var C;((C=o.current)==null?void 0:C.isClickOutSide(T))&&y(!1)}),_.jsx("div",{className:re.positionRelative,children:e.type!==c.CFValueType.formula?_.jsxs(_.Fragment,{children:[_.jsx(X.InputNumber,{className:a,value:Number(e.value)||0,onChange:T=>e.onChange(T!=null?T:0)}),e.error&&_.jsx("div",{className:re.errorText,children:e.error})]}):_.jsx("div",{className:"univer-w-full",children:_.jsx(Ge.FormulaEditor,{initValue:String(e.value),unitId:n,subUnitId:r,isFocus:u,onChange:(T="")=>{const m=T||"";e.onChange(m)},onFocus:()=>y(!0),ref:o})})})},vn=(e,t,n)=>({operator:c.CFNumberOperator.greaterThan,value:{type:c.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),Ea=V.forwardRef((e,t)=>{const n=$.useDependency(w.LocaleService),r=a=>{e.onClick(a)};return _.jsx("div",{ref:t,className:re.iconGroupList,children:c.iconGroup.map((a,o)=>_.jsxs("div",{className:re.group,children:[_.jsx("div",{className:re.title,children:n.t(a.title)}),_.jsx("div",{className:re.itemContent,children:a.group.map(u=>_.jsx("div",{className:re.itemWrap,onClick:()=>{r(u.name)},children:_.jsx("div",{className:re.item,children:u.list.map((y,h)=>_.jsx("img",{className:"univer-size-5",src:y},h))})},u.name))})]},o))})}),Oa=e=>{const t=V.useMemo(()=>{const r=[];for(const a in c.iconMap){const o=c.iconMap[a],u=a;o.forEach((y,h)=>{r.push({iconType:u,base64:y,iconId:String(h)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return _.jsxs("div",{className:re.iconItemListWrap,children:[_.jsxs("div",{className:re.none,onClick:()=>n({iconType:c.EMPTY_ICON_TYPE,iconId:""}),children:[_.jsx(Ye,{className:"univer-size-5"}),_.jsx("span",{children:"无单元格图标"})]}),_.jsx("div",{className:re.iconItemList,children:t.map(r=>_.jsx("div",{className:re.item,children:_.jsx("img",{className:"univer-size-5",onClick:()=>n(r),src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},Pa=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,a=$.useDependency(w.LocaleService),o=[{label:a.t(`sheet.cf.symbol.${c.CFNumberOperator.greaterThan}`),value:c.CFNumberOperator.greaterThan},{label:a.t(`sheet.cf.symbol.${c.CFNumberOperator.greaterThanOrEqual}`),value:c.CFNumberOperator.greaterThanOrEqual}],u=[{label:a.t(`sheet.cf.valueType.${c.CFValueType.num}`),value:c.CFValueType.num},{label:a.t(`sheet.cf.valueType.${c.CFValueType.percent}`),value:c.CFValueType.percent},{label:a.t(`sheet.cf.valueType.${c.CFValueType.percentile}`),value:c.CFValueType.percentile},{label:a.t(`sheet.cf.valueType.${c.CFValueType.formula}`),value:c.CFValueType.formula}],y=(C,E)=>{t([String(E),"value","value"],C)},h=(C,E)=>{t([String(E),"operator"],C);const R=c.createDefaultValue(c.CFSubRuleType.number,C);y(R,E)},T=(C,E)=>{t([String(E),"value","type"],C);const R=n[E],I=c.createDefaultValue(c.CFSubRuleType.number,R.operator);y(I,E)};return V.useMemo(()=>n.map((C,E)=>{const R=r[E],I=hn(C.iconType,C.iconId),S=E===n.length-1,p=E===0,i=n[E-1],s=(i==null?void 0:i.value.type)===c.CFValueType.formula?a.t("sheet.cf.valueType.formula"):i==null?void 0:i.value.value,f=(b,l)=>{const v={...C,iconId:l,iconType:b};t([String(E)],v)};return _.jsxs("div",{className:E?"univer-mt-6":"univer-mt-3",children:[_.jsxs("div",{className:`
51
- ${ue.label}
52
- univer-flex univer-items-center univer-justify-between
53
- `,children:[_.jsxs("div",{className:"univer-w-[45%]",children:[a.t("sheet.cf.iconSet.icon"),E+1]}),_.jsx("div",{className:"univer-w-[45%]",children:_.jsxs(_.Fragment,{children:[!p&&!S&&a.t("sheet.cf.iconSet.rule"),!p&&!S&&_.jsxs("span",{className:re.stress,children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${c.getOppositeOperator(i.operator)}`),s,S?"":` ${a.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),_.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-justify-between univer-gap-4",children:[_.jsx("div",{className:"univer-flex univer-items-center",children:_.jsx(X.Dropdown,{overlay:_.jsx("div",{className:"univer-rounded-lg univer-p-4",children:_.jsx(Oa,{onClick:f,iconId:C.iconId,iconType:C.iconType})}),children:_.jsxs("div",{className:X.clsx(re.dropdownIcon,"univer-box-border univer-h-7"),children:[I?_.jsx("img",{src:I,className:re.icon}):_.jsx(Ye,{className:re.icon}),_.jsx(gt,{})]})})}),S?_.jsxs("div",{className:`
54
- univer-w-[45%]
55
- ${ue.label}
56
- `,style:{marginTop:0},children:[a.t("sheet.cf.iconSet.rule"),_.jsxs("span",{className:re.stress,children:[a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${c.getOppositeOperator(i.operator)}`),s,S?"":` ${a.t("sheet.cf.iconSet.and")} `]})]}):_.jsx(X.Select,{options:o,value:C.operator,onChange:b=>{h(b,E)}})]}),S?_.jsx("div",{}):_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:`
57
- univer-mt-3
58
- ${ue.label}
59
- univer-flex univer-items-center univer-justify-between univer-gap-4
60
- `,children:[_.jsx("div",{children:a.t("sheet.cf.iconSet.type")}),_.jsx("div",{children:a.t("sheet.cf.iconSet.value")})]}),_.jsxs("div",{className:`
1
+ (function(Y,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@univerjs/core"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets"),require("@univerjs/ui"),require("react/jsx-runtime"),require("react"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula-ui"),require("@univerjs/sheets-ui"),require("react-dom"),require("rxjs"),require("@univerjs/engine-render"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-conditional-formatting","@univerjs/sheets","@univerjs/ui","react/jsx-runtime","react","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets-formula-ui","@univerjs/sheets-ui","react-dom","rxjs","@univerjs/engine-render","rxjs/operators"],w):(Y=typeof globalThis<"u"?globalThis:Y||self,w(Y.UniverSheetsConditionalFormattingUi={},Y.UniverCore,Y.UniverSheetsConditionalFormatting,Y.UniverSheets,Y.UniverUi,Y.React,Y.React,Y.UniverDesign,Y.UniverEngineFormula,Y.UniverSheetsFormulaUi,Y.UniverSheetsUi,Y.ReactDOM,Y.rxjs,Y.UniverEngineRender,Y.rxjs.operators))})(this,function(Y,w,u,q,$,R,V,J,Lt,He,de,Vt,ye,cr,We){"use strict";var di=Object.defineProperty;var fi=(Y,w,u)=>w in Y?di(Y,w,{enumerable:!0,configurable:!0,writable:!0,value:u}):Y[w]=u;var Re=(Y,w,u)=>fi(Y,typeof w!="symbol"?w+"":w,u);const Ut={type:w.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:r,style:n,stopIfTrue:a,operator:i}=t,d=e.get(u.ConditionalFormattingRuleModel),S=e.get(w.ICommandService),h=e.get(w.IUniverInstanceService),C=q.getSheetCommandTarget(h);if(!C)return!1;const{unitId:m,subUnitId:b}=C,E=d.createCfId(m,b),I={ranges:r,cfId:E,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:i,style:n}};return S.executeCommand(u.AddConditionalRuleMutation.id,{unitId:m,subUnitId:b,rule:I})}},zt={type:w.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:r,config:n,stopIfTrue:a}=t,i=e.get(u.ConditionalFormattingRuleModel),d=e.get(w.ICommandService),S=e.get(w.IUniverInstanceService),h=q.getSheetCommandTarget(S);if(!h)return!1;const{unitId:C,subUnitId:m}=h,b=i.createCfId(C,m),E={ranges:r,cfId:b,stopIfTrue:!!a,rule:{type:u.CFRuleType.colorScale,config:n}};return d.executeCommand(u.AddConditionalRuleMutation.id,{unitId:C,subUnitId:m,rule:E})}},kt={type:w.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:r,min:n,max:a,nativeColor:i,positiveColor:d,isGradient:S,stopIfTrue:h,isShowValue:C}=t,m=e.get(u.ConditionalFormattingRuleModel),b=e.get(w.IUniverInstanceService),E=q.getSheetCommandTarget(b);if(!E)return!1;const{unitId:I,subUnitId:_}=E,T=e.get(w.ICommandService),p=m.createCfId(I,_),o={ranges:r,cfId:p,stopIfTrue:!!h,rule:{type:u.CFRuleType.dataBar,isShowValue:C,config:{min:n,max:a,nativeColor:i,positiveColor:d,isGradient:S}}};return T.executeCommand(u.AddConditionalRuleMutation.id,{unitId:I,subUnitId:_,rule:o})}},jt={type:w.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:r,style:n,stopIfTrue:a}=t,i=e.get(u.ConditionalFormattingRuleModel),d=e.get(w.ICommandService),S=e.get(w.IUniverInstanceService),h=q.getSheetCommandTarget(S);if(!h)return!1;const{unitId:C,subUnitId:m}=h,b=i.createCfId(C,m),E={ranges:r,cfId:b,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.duplicateValues,style:n}};return d.executeCommand(u.AddConditionalRuleMutation.id,{unitId:C,subUnitId:m,rule:E})}},At={type:w.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:r,style:n,stopIfTrue:a,operator:i,value:d}=t,S=e.get(u.ConditionalFormattingRuleModel),h=e.get(w.ICommandService),C=e.get(w.IUniverInstanceService),m=q.getSheetCommandTarget(C);if(!m)return!1;const{unitId:b,subUnitId:E}=m,I=S.createCfId(b,E);let _;if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(i)){const T=d;if(T.length!==2||!Array.isArray(T))return!1;_={ranges:r,cfId:I,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.number,operator:i,style:n,value:T}}}else{const T=d;if(typeof T!="number")return!1;_={ranges:r,cfId:I,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.number,operator:i,style:n,value:T}}}return h.executeCommand(u.AddConditionalRuleMutation.id,{unitId:b,subUnitId:E,rule:_})}},Ht={type:w.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:r,style:n,stopIfTrue:a,isPercent:i,isBottom:d,value:S}=t,h=e.get(u.ConditionalFormattingRuleModel),C=e.get(w.IUniverInstanceService),m=e.get(w.ICommandService),b=q.getSheetCommandTarget(C);if(!b)return!1;const{unitId:E,subUnitId:I}=b,_=h.createCfId(E,I),T={ranges:r,cfId:_,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:i,isBottom:d,style:n,value:S}};return m.executeCommand(u.AddConditionalRuleMutation.id,{unitId:E,subUnitId:I,rule:T})}},Wt={type:w.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:r,style:n,stopIfTrue:a,operator:i,value:d}=t,S=e.get(u.ConditionalFormattingRuleModel),h=e.get(w.IUniverInstanceService),C=q.getSheetCommandTarget(h);if(!C)return!1;const{unitId:m,subUnitId:b}=C,E=e.get(w.ICommandService),I=S.createCfId(m,b),_={ranges:r,cfId:I,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.text,operator:i,style:n,value:d}};return E.executeCommand(u.AddConditionalRuleMutation.id,{unitId:m,subUnitId:b,rule:_})}},Bt={type:w.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:r,style:n,stopIfTrue:a,operator:i}=t,d=e.get(u.ConditionalFormattingRuleModel),S=e.get(w.IUniverInstanceService),h=e.get(w.ICommandService),C=q.getSheetCommandTarget(S);if(!C)return!1;const{unitId:m,subUnitId:b}=C,E=d.createCfId(m,b),I={ranges:r,cfId:E,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.timePeriod,operator:i,style:n}};return h.executeCommand(u.AddConditionalRuleMutation.id,{unitId:m,subUnitId:b,rule:I})}},Ft={type:w.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:r,style:n,stopIfTrue:a}=t,i=e.get(u.ConditionalFormattingRuleModel),d=e.get(w.IUniverInstanceService),S=e.get(w.ICommandService),h=q.getSheetCommandTarget(d);if(!h)return!1;const{unitId:C,subUnitId:m}=h,b=i.createCfId(C,m),E={ranges:r,cfId:b,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.uniqueValues,style:n}};return S.executeCommand(u.AddConditionalRuleMutation.id,{unitId:C,subUnitId:m,rule:E})}};var ge=function(){return ge=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ge.apply(this,arguments)},Sn=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r},Me=V.forwardRef(function(e,t){var r=e.icon,n=e.id,a=e.className,i=e.extend,d=Sn(e,["icon","id","className","extend"]),S="univerjs-icon univerjs-icon-".concat(n," ").concat(a||"").trim(),h=V.useRef("_".concat(wn()));return dr(r,"".concat(n),{defIds:r.defIds,idSuffix:h.current},ge({ref:t,className:S},d),i)});function dr(e,t,r,n,a){return V.createElement(e.tag,ge(ge({key:t},Cn(e,r,a)),n),(Tn(e,r).children||[]).map(function(i,d){return dr(i,"".concat(t,"-").concat(e.tag,"-").concat(d),r,void 0,a)}))}function Cn(e,t,r){var n=ge({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1),e.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(i){var d=i[0],S=i[1];d==="mask"&&typeof S=="string"&&(n[d]=S.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var a=t.defIds;return!a||a.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(i){var d=i[0],S=i[1];typeof S=="string"&&(n[d]=S.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Tn(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?ge(ge({},e),{children:e.children.map(function(a){return typeof a.attrs.id=="string"&&n&&n.indexOf(a.attrs.id)>-1?ge(ge({},a),{attrs:ge(ge({},a.attrs),{id:a.attrs.id+t.idSuffix})}):a})}):e}function wn(){return Math.random().toString(36).substring(2,8)}Me.displayName="UniverIcon";var _n={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ft=V.forwardRef(function(e,t){return V.createElement(Me,Object.assign({},e,{id:"delete-single",ref:t,icon:_n}))});ft.displayName="DeleteSingle";var In={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},fr=V.forwardRef(function(e,t){return V.createElement(Me,Object.assign({},e,{id:"increase-single",ref:t,icon:In}))});fr.displayName="IncreaseSingle";var Rn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},pt=V.forwardRef(function(e,t){return V.createElement(Me,Object.assign({},e,{id:"more-down-single",ref:t,icon:Rn}))});pt.displayName="MoreDownSingle";var En={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{fill:"currentColor",mask:"url(#mask0_622_8)"},children:[{tag:"path",attrs:{d:"M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z"}}]}]},pr=V.forwardRef(function(e,t){return V.createElement(Me,Object.assign({},e,{id:"sequence-single",ref:t,icon:En}))});pr.displayName="SequenceSingle";var On={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"}}]}]},Be=V.forwardRef(function(e,t){return V.createElement(Me,Object.assign({},e,{id:"slash-single",ref:t,icon:On}))});Be.displayName="SlashSingle";const Ee=e=>{const{color:t,onChange:r,disable:n=!1,iconId:a="PaintBucket",className:i,isNeedDropdownIcon:d=!0}=e,S=$.useDependency($.ComponentManager),h=V.useMemo(()=>new w.ColorKit(t),[t]),C=S.get(a);return C?n?R.jsx(C,{className:J.clsx("univer-fill-primary-600",i),extend:{colorChannel1:h.isValid?t:""}}):R.jsx(J.Dropdown,{overlay:R.jsx("div",{className:"univer-rounded-lg univer-p-4",children:R.jsx(J.ColorPicker,{value:t,onChange:r})}),children:R.jsxs("span",{className:J.clsx(`
2
+ univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1
3
+ hover:univer-bg-gray-100
4
+ `,i),children:[R.jsx(C,{className:"univer-fill-primary-600",extend:{colorChannel1:h.isValid?t:""}}),d&&R.jsx(pt,{className:"univer-ml-1.5 univer-text-[10px] univer-text-gray-400"})]})}):null},Ne=e=>{var i,d,S;const t=e.rule;if(!t)return null;const r=V.useMemo(()=>{if(t.type===u.CFRuleType.colorScale){const h=t.config.map((b,E)=>({color:new w.ColorKit(b.color),value:E})),C=h.length-1;return new Array(5).fill("").map((b,E,I)=>E*C/(I.length-1)).map(b=>u.getColorScaleFromValue(h,b))}return null},[t]),n=V.useMemo(()=>{if(t.type===u.CFRuleType.iconSet)return t.config.map(h=>{const C=u.iconMap[h.iconType];return C&&C[Number(h.iconId)]})},[t]),a=`univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center
5
+ univer-justify-center univer-text-xs`;switch(t.type){case u.CFRuleType.dataBar:{const{isGradient:h}=t.config,C=h?`linear-gradient(to right, ${t.config.positiveColor||u.defaultDataBarPositiveColor}, rgb(255 255 255))`:t.config.positiveColor,m=h?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor||u.defaultDataBarNativeColor})`:t.config.nativeColor;return R.jsxs("div",{className:a,children:[R.jsx("div",{className:"univer-h-full univer-w-1/2",style:{background:m,border:`1px solid ${t.config.nativeColor||u.defaultDataBarNativeColor}`}}),R.jsx("div",{className:"univer-h-full univer-w-1/2",style:{background:C,border:`1px solid ${t.config.positiveColor||u.defaultDataBarPositiveColor}`}})]})}case u.CFRuleType.colorScale:return r&&R.jsx("div",{className:a,children:r.map((h,C)=>R.jsx("div",{className:"univer-h-full",style:{width:`${100/r.length}%`,background:h}},C))});case u.CFRuleType.iconSet:return n&&R.jsx("div",{className:a,children:n.map((h,C)=>h?R.jsx("img",{className:"univer-h-full",src:h,draggable:!1},C):R.jsx(Be,{},C))});case u.CFRuleType.highlightCell:{const{ul:h,st:C,it:m,bl:b,bg:E,cl:I}=t.style,_=(h==null?void 0:h.s)===w.BooleanNumber.TRUE,T=(C==null?void 0:C.s)===w.BooleanNumber.TRUE,p=m===w.BooleanNumber.TRUE,o=b===w.BooleanNumber.TRUE,s=(i=E==null?void 0:E.rgb)!=null?i:u.DEFAULT_BG_COLOR,f=(d=I==null?void 0:I.rgb)!=null?d:u.DEFAULT_FONT_COLOR,y={textDecoration:(S=`${_?"underline":""} ${T?"line-through":""}`.replace(/^ /,""))!=null?S:void 0,backgroundColor:s,color:f};return R.jsx("div",{className:J.clsx(a,{"univer-font-bold":o,"univer-italic":p}),style:y,children:"123"})}}},Fe="univer-mt-5 univer-px-1 univer-py-2 univer-border univer-border-solid univer-border-gray-200 univer-rounded",Oe=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Gt=e=>{var _;const{type:t,className:r,onChange:n,id:a,value:i}=e,d=$.useDependency(w.IUniverInstanceService),S=d.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),h=(_=d.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:_.getSheetId(),C=V.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),m=V.useMemo(()=>[u.CFValueType.max,u.CFValueType.min,"none"].includes(t)?{disabled:!0}:[u.CFValueType.percent,u.CFValueType.percentile].includes(t)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[t]),b=V.useRef(null),[E,I]=V.useState(!1);return $.useSidebarClick(T=>{var o;((o=b.current)==null?void 0:o.isClickOutSide(T))&&I(!1)}),t===u.CFValueType.formula?R.jsx("div",{className:"univer-ml-1 univer-w-full",children:R.jsx(He.FormulaEditor,{initValue:C,unitId:S,subUnitId:h,isFocus:E,onChange:(T="")=>{n(T||"")},onFocus:()=>I(!0),ref:b})}):R.jsx(J.InputNumber,{className:r,value:Number(e.value)||0,onChange:T=>e.onChange(T||0),...m})},xn=e=>{var z;const{interceptorManager:t}=e,r=$.useDependency(w.LocaleService),n=((z=e.rule)==null?void 0:z.type)===u.CFRuleType.colorScale?e.rule:void 0,a=[Oe(u.CFValueType.num,r),Oe(u.CFValueType.percent,r),Oe(u.CFValueType.percentile,r),Oe(u.CFValueType.formula,r)],i=[Oe(u.CFValueType.min,r),...a],d=[Oe("none",r),...a],S=[Oe(u.CFValueType.max,r),...a],[h,C]=V.useState(()=>{var L;const O=u.CFValueType.min;return n&&((L=n.config[0])==null?void 0:L.value.type)||O}),[m,b]=V.useState(()=>{var L;const O="none";return!n||n.config.length!==3?O:((L=n.config[1])==null?void 0:L.value.type)||O}),[E,I]=V.useState(()=>{var L;const O=u.CFValueType.max;return n&&((L=n.config[n.config.length-1])==null?void 0:L.value.type)||O}),[_,T]=V.useState(()=>{if(!n)return 10;const L=n.config[0];return(L==null?void 0:L.value.value)===void 0?10:L==null?void 0:L.value.value}),[p,o]=V.useState(()=>{var W;if(!n||n.config.length!==3)return 50;const L=(W=n.config[1])==null?void 0:W.value.value;return L===void 0?50:L}),[s,f]=V.useState(()=>{var W;if(!n)return 90;const L=(W=n.config[n.config.length-1])==null?void 0:W.value.value;return L===void 0?90:L}),[y,l]=V.useState(()=>{var L;const O="#d0d9fb";return n&&((L=n.config[0])==null?void 0:L.color)||O}),[v,c]=V.useState(()=>{var L;const O="#7790f3";return!n||n.config.length!==3?O:((L=n.config[1])==null?void 0:L.color)||O}),[g,P]=V.useState(()=>{var L;const O="#2e55ef";return n&&((L=n.config[n.config.length-1])==null?void 0:L.color)||O}),M=V.useMemo(()=>O=>{const{minType:L,medianType:W,maxType:F,minValue:X,medianValue:ae,maxValue:ne,minColor:se,medianColor:j,maxColor:Q}=O,te=[];return te.push({color:se,value:{type:L,value:X}}),W!=="none"&&te.push({color:j,value:{type:W,value:ae}}),te.push({color:Q,value:{type:F,value:ne}}),{config:te.map((ce,pe)=>({...ce,index:pe})),type:u.CFRuleType.colorScale}},[]);V.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return M({minType:h,medianType:m,maxType:E,minValue:_,medianValue:p,maxValue:s,minColor:y,medianColor:v,maxColor:g})}}),[M,h,m,E,_,p,s,y,v,g,t]);const U=O=>{e.onChange(M(O))};return R.jsxs("div",{children:[R.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:r.t("sheet.cf.panel.styleRule")}),R.jsx("div",{className:Fe,children:R.jsx(Ne,{rule:M({minType:h,medianType:m,maxType:E,minValue:_,medianValue:p,maxValue:s,minColor:y,medianColor:v,maxColor:g})})}),R.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600",children:r.t("sheet.cf.valueType.min")}),R.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[R.jsx(J.Select,{className:"univer-flex-shrink-0",options:i,value:h,onChange:O=>{C(O);const L=u.createDefaultValueByValueType(O,10);T(L),U({minType:O,medianType:m,maxType:E,minValue:L,medianValue:p,maxValue:s,minColor:y,medianColor:v,maxColor:g})}}),R.jsx(Gt,{id:"min",className:"univer-ml-1",value:_,type:h,onChange:O=>{T(O),U({minType:h,medianType:m,maxType:E,minValue:O,medianValue:p,maxValue:s,minColor:y,medianColor:v,maxColor:g})}}),R.jsx(Ee,{className:"univer-ml-1",color:y,onChange:O=>{l(O),U({minType:h,medianType:m,maxType:E,minValue:_,medianValue:p,maxValue:s,minColor:O,medianColor:v,maxColor:g})}})]}),R.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600",children:r.t("sheet.cf.panel.medianValue")}),R.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[R.jsx(J.Select,{className:"univer-flex-shrink-0",options:d,value:m,onChange:O=>{b(O);const L=u.createDefaultValueByValueType(O,50);o(L),U({minType:h,medianType:O,maxType:E,minValue:_,medianValue:L,maxValue:s,minColor:y,medianColor:v,maxColor:g})}}),R.jsx(Gt,{id:"median",className:"univer-ml-1",value:p,type:m,onChange:O=>{o(O),U({minType:h,medianType:m,maxType:E,minValue:_,medianValue:O,maxValue:s,minColor:y,medianColor:v,maxColor:g})}}),m!=="none"&&R.jsx(Ee,{className:"univer-ml-1",color:v,onChange:O=>{c(O),U({minType:h,medianType:m,maxType:E,minValue:_,medianValue:p,maxValue:s,minColor:y,medianColor:O,maxColor:g})}})]}),R.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600",children:r.t("sheet.cf.valueType.max")}),R.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[R.jsx(J.Select,{className:"univer-flex-shrink-0",options:S,value:E,onChange:O=>{I(O);const L=u.createDefaultValueByValueType(O,90);f(L),U({minType:h,medianType:m,maxType:O,minValue:_,medianValue:p,maxValue:L,minColor:y,medianColor:v,maxColor:g})}}),R.jsx(Gt,{id:"max",className:"univer-ml-1",value:s,type:E,onChange:O=>{f(O),U({minType:h,medianType:m,maxType:E,minValue:_,medianValue:p,maxValue:O,minColor:y,medianColor:v,maxColor:g})}}),R.jsx(Ee,{className:"univer-ml-1",color:g,onChange:O=>{P(O),U({minType:h,medianType:m,maxType:E,minValue:_,medianValue:p,maxValue:s,minColor:y,medianColor:v,maxColor:O})}})]})]})},Le=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),hr=e=>{var T;const{onChange:t,className:r,value:n,type:a,id:i,disabled:d=!1}=e,S=$.useDependency(w.IUniverInstanceService),h=S.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),C=(T=S.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:T.getSheetId(),m=V.useRef(null),[b,E]=V.useState(!1);$.useSidebarClick(p=>{var s;((s=m.current)==null?void 0:s.isClickOutSide(p))&&E(!1)});const I=V.useRef(n),_=V.useMemo(()=>[u.CFValueType.percentile,u.CFValueType.percent].includes(a)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[a]);if(a===u.CFValueType.formula){const p=String(I.current).startsWith("=")?String(I.current)||"":"=";return R.jsx("div",{className:"univer-ml-3 univer-w-full",children:R.jsx(He.FormulaEditor,{initValue:p,unitId:h,subUnitId:C,isFocus:b,onChange:(o="")=>{t(o||"")},onFocus:()=>E(!0),ref:m})})}return R.jsx(J.InputNumber,{className:r,value:Number(n)||0,disabled:d,onChange:p=>{t(p||0)},..._})},Dn=e=>{var z;const{interceptorManager:t}=e,r=$.useDependency(w.LocaleService),n=((z=e.rule)==null?void 0:z.type)===u.CFRuleType.dataBar?e.rule:void 0,[a,i]=V.useState(()=>{var L;const O="0";return n?(L=n.config)!=null&&L.isGradient?"1":"0":O}),[d,S]=V.useState(()=>{var O;return n&&((O=n.config)==null?void 0:O.positiveColor)||u.defaultDataBarPositiveColor}),[h,C]=V.useState(()=>{var O;return n&&((O=n.config)==null?void 0:O.nativeColor)||u.defaultDataBarNativeColor}),m=[Le(u.CFValueType.num,r),Le(u.CFValueType.percent,r),Le(u.CFValueType.percentile,r),Le(u.CFValueType.formula,r)],b=[Le(u.CFValueType.min,r),...m],E=[Le(u.CFValueType.max,r),...m],[I,_]=V.useState(()=>{var L;const O=b[0].value;return n&&((L=n.config)==null?void 0:L.min.type)||O}),[T,p]=V.useState(()=>{var L;const O=E[0].value;return n&&((L=n.config)==null?void 0:L.max.type)||O}),[o,s]=V.useState(()=>{var W;if(!n)return 0;const L=((W=n.config)==null?void 0:W.min)||{};return L.type===u.CFValueType.formula?L.value||"=":L.value||0}),[f,y]=V.useState(()=>{var W;if(!n)return 100;const L=((W=n.config)==null?void 0:W.max)||{};return L.type===u.CFValueType.formula?L.value||"=":L.value===void 0?100:L.value}),[l,v]=V.useState(()=>n?n.isShowValue===void 0?!0:!!n.isShowValue:!0),c=O=>({config:{min:{type:O.minValueType,value:O.minValue},max:{type:O.maxValueType,value:O.maxValue},isGradient:O.isGradient==="1",positiveColor:O.positiveColor||u.defaultDataBarPositiveColor,nativeColor:O.nativeColor||u.defaultDataBarNativeColor},type:u.CFRuleType.dataBar,isShowValue:O.isShowValue});V.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return c({isGradient:a,minValue:o,minValueType:I,maxValue:f,maxValueType:T,positiveColor:d,nativeColor:h,isShowValue:l})}}),[a,o,I,f,T,d,h,t,l]);const g=O=>{e.onChange(c(O))},P=O=>{S(O),g({isGradient:a,minValue:o,minValueType:I,maxValue:f,maxValueType:T,positiveColor:O,nativeColor:h,isShowValue:l})},M=O=>{C(O),g({isGradient:a,minValue:o,minValueType:I,maxValue:f,maxValueType:T,positiveColor:d,nativeColor:O,isShowValue:l})},U=O=>m.map(L=>L.value).includes(O);return R.jsxs("div",{children:[R.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:r.t("sheet.cf.panel.styleRule")}),R.jsx("div",{className:Fe,children:R.jsx(Ne,{rule:c({isGradient:a,minValue:o,minValueType:I,maxValue:f,maxValueType:T,positiveColor:d,nativeColor:h,isShowValue:l})})}),R.jsxs("div",{children:[R.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600",children:r.t("sheet.cf.panel.fillType")}),R.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[R.jsxs(J.RadioGroup,{value:a,onChange:O=>{i(O),g({isGradient:O,minValue:o,minValueType:I,maxValue:f,maxValueType:T,positiveColor:d,nativeColor:h,isShowValue:l})},children:[R.jsx(J.Radio,{value:"0",children:R.jsx("span",{className:"univer-text-xs",children:r.t("sheet.cf.panel.pureColor")})}),R.jsx(J.Radio,{value:"1",children:R.jsx("span",{className:"univer-text-xs",children:r.t("sheet.cf.panel.gradient")})})]}),R.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[R.jsx(J.Checkbox,{checked:!l,onChange:O=>{v(!O),g({isGradient:O,minValue:o,minValueType:I,maxValue:f,maxValueType:T,positiveColor:d,nativeColor:h,isShowValue:!O})}}),r.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),R.jsxs("div",{children:[R.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600",children:r.t("sheet.cf.panel.colorSet")}),R.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[R.jsxs("div",{className:"univer-flex univer-items-center",children:[R.jsx("div",{className:"univer-text-xs",children:r.t("sheet.cf.panel.native")}),R.jsx(Ee,{color:h,onChange:M})]}),R.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center",children:[R.jsx("div",{className:"univer-text-xs",children:r.t("sheet.cf.panel.positive")}),R.jsx(Ee,{color:d,onChange:P})]})]})]}),R.jsxs("div",{children:[R.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600",children:r.t("sheet.cf.valueType.min")}),R.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[R.jsx(J.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:b,value:I,onChange:O=>{_(O);const L=u.createDefaultValueByValueType(O,10);s(L),g({isGradient:a,minValue:L,minValueType:O,maxValue:f,maxValueType:T,positiveColor:d,nativeColor:h,isShowValue:l})}}),R.jsx(hr,{id:"min",className:"univer-ml-3",disabled:!U(I),type:I,value:o,onChange:O=>{s(O||0),g({isGradient:a,minValue:O||0,minValueType:I,maxValue:f,maxValueType:T,positiveColor:d,nativeColor:h,isShowValue:l})}})]}),R.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600",children:r.t("sheet.cf.valueType.max")}),R.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[R.jsx(J.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:E,value:T,onChange:O=>{p(O);const L=u.createDefaultValueByValueType(O,90);y(L),g({isGradient:a,minValue:o,minValueType:I,maxValue:L,maxValueType:O,positiveColor:d,nativeColor:h,isShowValue:l})}}),R.jsx(hr,{className:"univer-ml-3",disabled:!U(T),id:"max",type:T,value:f,onChange:O=>{y(O||0),g({isGradient:a,minValue:o,minValueType:I,maxValue:O||0,maxValueType:T,positiveColor:d,nativeColor:h,isShowValue:l})}})]})]})]})},ht=e=>[w.BooleanNumber.FALSE,void 0].includes(e)?w.BooleanNumber.TRUE:w.BooleanNumber.FALSE,vt=e=>e!==w.BooleanNumber.FALSE,qt=e=>{const{style:t,onChange:r,className:n}=e,a=$.useDependency($.ComponentManager),[i,d]=V.useState(()=>{if(t!=null&&t.bl)return t.bl}),[S,h]=V.useState(()=>{if(t!=null&&t.it)return t.it}),[C,m]=V.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[b,E]=V.useState(()=>{if(t!=null&&t.st)return t.st.s}),[I,_]=V.useState(()=>{var c;const v="#2f56ef";return(c=t==null?void 0:t.cl)!=null&&c.rgb?t.cl.rgb:v}),[T,p]=V.useState(()=>{var c;const v="#e8ecfc";return(c=t==null?void 0:t.bg)!=null&&c.rgb?t.bg.rgb:v}),o=a.get("BoldSingle"),s=a.get("ItalicSingle"),f=a.get("UnderlineSingle"),y=a.get("StrikethroughSingle");V.useEffect(()=>{const v={bl:i,it:S};I!==void 0&&(v.cl={rgb:I}),T!==void 0&&(v.bg={rgb:T}),b!==void 0&&(v.st={s:b}),C!==void 0&&(v.ul={s:C}),r(u.removeUndefinedAttr(v))},[i,S,C,b,I,T]);const l="univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1";return R.jsxs("div",{className:J.clsx("univer-my-2.5 univer-flex univer-justify-between",n),children:[o&&R.jsx("div",{className:J.clsx(l,{"univer-bg-gray-100":vt(i||w.BooleanNumber.FALSE)}),onClick:()=>d(ht(i)),children:R.jsx(o,{})}),s&&R.jsx("div",{className:J.clsx(l,{"univer-bg-gray-100":vt(S||w.BooleanNumber.FALSE)}),onClick:()=>h(ht(S)),children:R.jsx(s,{})}),f&&R.jsx("div",{className:J.clsx(l,{"univer-bg-gray-100":vt(C||w.BooleanNumber.FALSE)}),onClick:()=>m(ht(C)),children:R.jsx(f,{})}),y&&R.jsx("div",{className:J.clsx(l,{"univer-bg-gray-100":vt(b||w.BooleanNumber.FALSE)}),onClick:()=>E(ht(b)),children:R.jsx(y,{})}),R.jsx(Ee,{color:I,onChange:_,iconId:"FontColor"}),R.jsx(Ee,{color:T,onChange:p,iconId:"PaintBucket"})]})},Pn=e=>{var y;const{onChange:t,interceptorManager:r}=e,n=$.useDependency(w.LocaleService),i=$.useDependency(w.IUniverInstanceService).getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),d=i.getActiveSheet(),S=((y=e.rule)==null?void 0:y.type)===u.CFRuleType.highlightCell?e.rule:void 0,h=V.useRef(null),[C,m]=V.useState(!1),b=V.useRef(null),[E,I]=V.useState({}),[_,T]=V.useState(()=>(S==null?void 0:S.subType)===u.CFSubRuleType.formula?S.value:"="),[p,o]=V.useState(void 0),s=l=>({style:l.style,value:_,type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.formula});V.useEffect(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return s({style:E})}}),[E,_,r]),V.useEffect(()=>r.intercept(r.getInterceptPoints().beforeSubmit,{handler:(v,c,g)=>p||_.length===1||!_.startsWith("=")?(o(n.t("sheet.cf.errorMessage.formulaError")),!1):g(v)}),[p,_]);const f=l=>{t(s(l))};return $.useSidebarClick(l=>{var c;((c=b.current)==null?void 0:c.isClickOutSide(l))&&m(!1)}),R.jsxs("div",{ref:h,children:[R.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),R.jsx("div",{className:"univer-mt-3",children:R.jsx(He.FormulaEditor,{onChange:l=>{T(l),f({style:E})},onVerify:(l,v)=>{!l||v.length===1?o(n.t("sheet.cf.errorMessage.formulaError")):o(void 0)},errorText:p,onFocus:()=>{m(!0)},isFocus:C,initValue:_,unitId:i.getUnitId(),subUnitId:d==null?void 0:d.getSheetId(),ref:b})}),R.jsx("div",{className:Fe,children:R.jsx(Ne,{rule:s({style:E})})}),R.jsx(qt,{style:S==null?void 0:S.style,className:"univer-mt-3",onChange:l=>{I(l),f({style:l})}})]})},gt=e=>R.jsxs("div",{style:{position:"relative"},children:[R.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:e.errorText}),e.children]}),le=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),Mn=e=>{const{type:t,operator:r,onChange:n,value:a,interceptorManager:i}=e,d=$.useDependency(w.LocaleService),[S,h]=V.useState(()=>typeof a=="number"?a:0),[C,m]=V.useState(""),[b,E]=V.useState(()=>typeof a=="string"?a:""),[I,_]=V.useState(""),[T,p]=V.useState(()=>Array.isArray(a)?a[0]===void 0?0:a[0]:0),[o,s]=V.useState(""),[f,y]=V.useState(()=>Array.isArray(a)?a[1]===void 0?100:a[1]:100),[l,v]=V.useState("");switch(V.useEffect(()=>{switch(t){case u.CFSubRuleType.text:{[u.CFTextOperator.beginsWith,u.CFTextOperator.endsWith,u.CFTextOperator.containsText,u.CFTextOperator.notContainsText,u.CFTextOperator.equal,u.CFTextOperator.notEqual].includes(r)&&n(b);break}case u.CFSubRuleType.number:{[u.CFNumberOperator.equal,u.CFNumberOperator.notEqual,u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual,u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(r)&&n(S),[u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(r)&&n([T,f]);break}}},[t]),V.useEffect(()=>{const c=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(g,P,M)=>{switch(t){case u.CFSubRuleType.text:if([u.CFTextOperator.beginsWith,u.CFTextOperator.containsText,u.CFTextOperator.endsWith,u.CFTextOperator.notEqual,u.CFTextOperator.notContainsText,u.CFTextOperator.equal].includes(r))return b?M(g):(_(d.t("sheet.cf.errorMessage.notBlank")),!1)}return M(g)}});return()=>{c()}},[t,S,b,r]),t){case u.CFSubRuleType.text:{if([u.CFTextOperator.beginsWith,u.CFTextOperator.endsWith,u.CFTextOperator.containsText,u.CFTextOperator.notContainsText,u.CFTextOperator.equal,u.CFTextOperator.notEqual].includes(r)){const c=g=>{E(g),n(g)};return R.jsx("div",{className:"univer-mt-3",children:R.jsx(gt,{errorText:I,children:R.jsx(J.Input,{value:b,onChange:g=>{_(""),c(g)}})})})}break}case u.CFSubRuleType.number:{if([u.CFNumberOperator.equal,u.CFNumberOperator.notEqual,u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual,u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(r)){const c=g=>{h(g||0),n(g||0),m("")};return R.jsx("div",{className:"univer-mt-3",children:R.jsx(gt,{errorText:C,children:R.jsx(J.InputNumber,{className:"univer-w-full",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:S,onChange:c})})})}if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(r)){const c=P=>{p(P||0),n([P||0,f]),s("")},g=P=>{y(P||0),n([T,P||0]),v("")};return R.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[R.jsx(gt,{errorText:o,children:R.jsx(J.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:T,onChange:c})}),R.jsx(gt,{errorText:l,children:R.jsx(J.InputNumber,{className:"univer-ml-3",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:f,onChange:g})})]})}}}return null},vr=(e,t)=>{switch(e){case u.CFSubRuleType.text:return[le(u.CFTextOperator.containsText,t),le(u.CFTextOperator.notContainsText,t),le(u.CFTextOperator.beginsWith,t),le(u.CFTextOperator.endsWith,t),le(u.CFTextOperator.equal,t),le(u.CFTextOperator.notEqual,t),le(u.CFTextOperator.containsBlanks,t),le(u.CFTextOperator.notContainsBlanks,t),le(u.CFTextOperator.containsErrors,t),le(u.CFTextOperator.notContainsErrors,t)];case u.CFSubRuleType.number:return[le(u.CFNumberOperator.between,t),le(u.CFNumberOperator.notBetween,t),le(u.CFNumberOperator.equal,t),le(u.CFNumberOperator.notEqual,t),le(u.CFNumberOperator.greaterThan,t),le(u.CFNumberOperator.greaterThanOrEqual,t),le(u.CFNumberOperator.lessThan,t),le(u.CFNumberOperator.lessThanOrEqual,t)];case u.CFSubRuleType.timePeriod:return[le(u.CFTimePeriodOperator.yesterday,t),le(u.CFTimePeriodOperator.today,t),le(u.CFTimePeriodOperator.tomorrow,t),le(u.CFTimePeriodOperator.last7Days,t),le(u.CFTimePeriodOperator.lastWeek,t),le(u.CFTimePeriodOperator.thisWeek,t),le(u.CFTimePeriodOperator.nextWeek,t),le(u.CFTimePeriodOperator.lastMonth,t),le(u.CFTimePeriodOperator.thisMonth,t),le(u.CFTimePeriodOperator.nextMonth,t)]}},gr=e=>{var y;const{interceptorManager:t,onChange:r}=e,n=$.useDependency(w.LocaleService),a=((y=e.rule)==null?void 0:y.type)===u.CFRuleType.highlightCell?e.rule:void 0,[i,d]=V.useState(()=>{const l=u.CFSubRuleType.text;return a&&a.subType||l}),S=[{value:u.CFSubRuleType.text,label:n.t("sheet.cf.subRuleType.text")},{value:u.CFSubRuleType.number,label:n.t("sheet.cf.subRuleType.number")},{value:u.CFSubRuleType.timePeriod,label:n.t("sheet.cf.subRuleType.timePeriod")},{value:u.CFSubRuleType.duplicateValues,label:n.t("sheet.cf.subRuleType.duplicateValues")},{value:u.CFSubRuleType.uniqueValues,label:n.t("sheet.cf.subRuleType.uniqueValues")}],h=V.useMemo(()=>vr(i,n),[i]),[C,m]=V.useState(()=>{const l=h?h[0].value:void 0;return a&&a.operator||l}),[b,E]=V.useState(()=>{var c;const l="";return a?(c=a.value)!=null?c:u.createDefaultValue(a.subType,a.operator):l}),[I,_]=V.useState({}),T=V.useMemo(()=>l=>{var v,c,g,P,M,U,z,O,L,W,F,X,ae,ne,se;switch(l.subType||i){case u.CFSubRuleType.text:{if([u.CFTextOperator.beginsWith,u.CFTextOperator.endsWith,u.CFTextOperator.containsText,u.CFTextOperator.notContainsText,u.CFTextOperator.equal,u.CFTextOperator.notEqual].includes(C))return{type:u.CFRuleType.highlightCell,subType:(v=l.subType)!=null?v:i,operator:(c=l.operator)!=null?c:C,style:(g=l.style)!=null?g:I,value:(P=l.value)!=null?P:b};break}case u.CFSubRuleType.number:{if([u.CFNumberOperator.equal,u.CFNumberOperator.notEqual,u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual,u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(C))return{type:u.CFRuleType.highlightCell,subType:(M=l.subType)!=null?M:i,operator:(U=l.operator)!=null?U:C,style:(z=l.style)!=null?z:I,value:(O=l.value)!=null?O:b};if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(C))return{type:u.CFRuleType.highlightCell,subType:(L=l.subType)!=null?L:i,operator:(W=l.operator)!=null?W:C,style:(F=l.style)!=null?F:I,value:(X=l.value)!=null?X:b};break}}return{type:u.CFRuleType.highlightCell,subType:(ae=l.subType)!=null?ae:i,operator:(ne=l.operator)!=null?ne:C,style:(se=l.style)!=null?se:I}},[i,C,b,I]);V.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return T({})}}),[T,t]),V.useEffect(()=>{S.some(l=>l.value===i)||d(S[0].value)},[S]);const p=l=>{const v=l,c=vr(v,n),g=c&&c[0].value;d(v),m(g),g&&E(u.createDefaultValue(v,g)),r(T({subType:v,operator:g}))},o=l=>{const v=l;m(v),r(T({operator:v}))},s=l=>{E(l),r(T({value:l}))},f=V.useMemo(()=>`${i}_${C}_${Math.random()}`,[i,C]);return R.jsxs("div",{children:[R.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),R.jsxs("div",{className:"univer-flex univer-justify-between univer-gap-4",children:[R.jsx(J.Select,{className:"univer-mt-3 univer-w-full",onChange:p,value:i,options:S}),(h==null?void 0:h.length)&&R.jsx(J.Select,{className:"univer-mt-3 univer-w-full",onChange:o,value:C||"",options:h})]}),R.jsx(Mn,{value:b,interceptorManager:t,type:i,operator:C,rule:a,onChange:s},f),R.jsx("div",{className:Fe,children:R.jsx(Ne,{rule:T({})})}),R.jsx(qt,{style:a==null?void 0:a.style,className:"univer-ml-1",onChange:l=>{_(l),r(T({style:l}))}})]})},mr=(e,t)=>(u.iconMap[e]||[])[Number(t)]||"",Nn=e=>{var m;const{error:t,type:r,onChange:n}=e,a=$.useDependency(w.IUniverInstanceService),i=a.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(m=a.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:m.getSheetId(),S=V.useRef(null),[h,C]=V.useState(!1);return $.useSidebarClick(b=>{var I;((I=S.current)==null?void 0:I.isClickOutSide(b))&&C(!1)}),R.jsx("div",{className:"univer-relative",children:r!==u.CFValueType.formula?R.jsxs(R.Fragment,{children:[R.jsx(J.InputNumber,{className:J.clsx({"univer-border-red-500":t}),value:Number(e.value)||0,onChange:b=>n(b!=null?b:0)}),t&&R.jsx("div",{className:"univer-absolute univer-text-xs univer-text-red-500",children:t})]}):R.jsx("div",{className:"univer-w-full",children:R.jsx(He.FormulaEditor,{ref:S,initValue:String(e.value),unitId:i,subUnitId:d,isFocus:h,onChange:(b="")=>{n(b||"")},onFocus:()=>C(!0)})})})},yr=(e,t,r)=>({operator:u.CFNumberOperator.greaterThan,value:{type:u.CFValueType.num,value:(r.length-1-t)*10},iconType:e,iconId:String(t)}),Ln=V.forwardRef((e,t)=>{const{onClick:r}=e,n=$.useDependency(w.LocaleService),a=i=>{r(i)};return R.jsx("div",{ref:t,className:"univer-w-80",children:u.iconGroup.map((i,d)=>R.jsxs("div",{className:"univer-mb-3",children:[R.jsx("div",{className:"univer-mb-1 univer-text-sm",children:n.t(i.title)}),R.jsx("div",{className:"univer-flex univer-flex-wrap",children:i.group.map(S=>R.jsx("div",{className:"univer-mb-1 univer-flex univer-w-1/2 univer-items-center",onClick:()=>{a(S.name)},children:R.jsx("a",{className:`
6
+ univer-cursor-pointer univer-rounded
7
+ hover:univer-bg-gray-100
8
+ `,children:S.list.map((h,C)=>R.jsx("img",{className:"univer-size-5",src:h,draggable:!1},C))})},S.name))})]},d))})}),Vn=e=>{const{onClick:t}=e,r=V.useMemo(()=>{const a=[];for(const i in u.iconMap){const d=u.iconMap[i],S=i;d.forEach((h,C)=>{a.push({iconType:S,base64:h,iconId:String(C)})})}return a},[]),n=a=>{t(a.iconType,a.iconId)};return R.jsxs("div",{children:[R.jsxs("div",{className:"univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-pl-1",onClick:()=>n({iconType:u.EMPTY_ICON_TYPE,iconId:""}),children:[R.jsx(Be,{className:"univer-size-5"}),R.jsx("span",{className:"univer-ml-2",children:"无单元格图标"})]}),R.jsx("div",{className:"univer-flex univer-w-64 univer-flex-wrap",children:r.map(a=>R.jsx("div",{className:`
9
+ univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center
10
+ univer-justify-center univer-rounded
11
+ hover:univer-bg-gray-100
12
+ `,children:R.jsx("img",{className:"univer-size-5",src:a.base64,draggable:!1,onClick:()=>n(a)})},`${a.iconType}_${a.iconId}`))})]})},Un=e=>{const{onChange:t,configList:r,errorMap:n={}}=e,a=$.useDependency(w.LocaleService),i=[{label:a.t(`sheet.cf.symbol.${u.CFNumberOperator.greaterThan}`),value:u.CFNumberOperator.greaterThan},{label:a.t(`sheet.cf.symbol.${u.CFNumberOperator.greaterThanOrEqual}`),value:u.CFNumberOperator.greaterThanOrEqual}],d=[{label:a.t(`sheet.cf.valueType.${u.CFValueType.num}`),value:u.CFValueType.num},{label:a.t(`sheet.cf.valueType.${u.CFValueType.percent}`),value:u.CFValueType.percent},{label:a.t(`sheet.cf.valueType.${u.CFValueType.percentile}`),value:u.CFValueType.percentile},{label:a.t(`sheet.cf.valueType.${u.CFValueType.formula}`),value:u.CFValueType.formula}],S=(b,E)=>{t([String(E),"value","value"],b)},h=(b,E)=>{t([String(E),"operator"],b);const I=u.createDefaultValue(u.CFSubRuleType.number,b);S(I,E)},C=(b,E)=>{t([String(E),"value","type"],b);const I=r[E],_=u.createDefaultValue(u.CFSubRuleType.number,I.operator);S(_,E)};return V.useMemo(()=>r.map((b,E)=>{const I=n[E],_=mr(b.iconType,b.iconId),T=E===r.length-1,p=E===0,o=r[E-1],s=(o==null?void 0:o.value.type)===u.CFValueType.formula?a.t("sheet.cf.valueType.formula"):o==null?void 0:o.value.value,f=(y,l)=>{const v={...b,iconId:l,iconType:y};t([String(E)],v)};return R.jsxs("div",{className:E?"univer-mt-6":"univer-mt-3",children:[R.jsxs("div",{className:`
13
+ univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm
14
+ univer-text-gray-600
15
+ `,children:[R.jsxs("div",{className:"univer-w-[45%]",children:[a.t("sheet.cf.iconSet.icon"),E+1]}),R.jsx("div",{className:"univer-w-[45%]",children:R.jsxs(R.Fragment,{children:[!p&&!T&&a.t("sheet.cf.iconSet.rule"),!p&&!T&&R.jsxs("span",{className:"univer-font-medium univer-text-gray-600",children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${u.getOppositeOperator(o.operator)}`),s,T?"":` ${a.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),R.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-justify-between univer-gap-4",children:[R.jsx("div",{className:"univer-flex univer-items-center",children:R.jsx(J.Dropdown,{overlay:R.jsx("div",{className:"univer-rounded-lg univer-p-4",children:R.jsx(Vn,{onClick:f,iconId:b.iconId,iconType:b.iconType})}),children:R.jsxs("div",{className:`
16
+ univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center
17
+ univer-justify-between univer-rounded-md univer-border univer-border-solid
18
+ univer-border-gray-200 univer-bg-white univer-px-4 univer-py-2 univer-text-xs
19
+ univer-text-gray-600 univer-transition-all
20
+ hover:univer-border-primary-600
21
+ `,children:[_?R.jsx("img",{src:_,className:"univer-size-4",draggable:!1}):R.jsx(Be,{className:"univer-size-4"}),R.jsx(pt,{})]})})}),T?R.jsxs("div",{className:"univer-mt-0 univer-w-[45%] univer-text-sm univer-text-gray-600",children:[a.t("sheet.cf.iconSet.rule"),R.jsxs("span",{className:"univer-font-medium univer-text-gray-600",children:[a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${u.getOppositeOperator(o.operator)}`),s,T?"":` ${a.t("sheet.cf.iconSet.and")} `]})]}):R.jsx(J.Select,{options:i,value:b.operator,onChange:y=>{h(y,E)}})]}),T?R.jsx("div",{}):R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:`
22
+ univer-mt-3 univer-flex univer-items-center univer-justify-between univer-gap-4
23
+ univer-text-sm univer-text-gray-600
24
+ `,children:[R.jsx("div",{children:a.t("sheet.cf.iconSet.type")}),R.jsx("div",{children:a.t("sheet.cf.iconSet.value")})]}),R.jsxs("div",{className:`
61
25
  univer-mt-3 univer-flex univer-items-center univer-justify-between univer-gap-4
62
- `,children:[_.jsx(X.Select,{className:"univer-flex-shrink-0",options:u,value:C.value.type,onChange:b=>{T(b,E)}}),_.jsx("div",{children:_.jsx(Ra,{id:E,type:C.value.type,error:R,value:C.value.value||"",onChange:b=>{y(b,E)}})})]})]})]},E)}),[n,r])},Da=e=>{var b;const{interceptorManager:t}=e,n=((b=e.rule)==null?void 0:b.type)===c.CFRuleType.iconSet?e.rule:void 0,r=$.useDependency(w.LocaleService),[a,o]=V.useState({}),[u,y]=V.useState(()=>{const l=Object.keys(c.iconMap)[0];if(n&&n.config.length){const v=n.config[0].iconType;if(!n.config.some(g=>g.iconType!==v))return v}return l}),[h,T]=V.useState(()=>{if(n&&n.config.length)return w.Tools.deepClone(n==null?void 0:n.config);const l=c.iconMap[u]||[];return new Array(l.length).fill("").map((v,d,g)=>d===g.length-1?{operator:c.CFNumberOperator.lessThanOrEqual,value:{type:c.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:u,iconId:String(d)}:vn(u,d,g))}),[m,C]=V.useState(()=>n?!!n.isShowValue:!0),E=V.useMemo(()=>{const l=h.map(v=>hn(v.iconType,v.iconId));return _.jsx("div",{className:"univer-flex univer-items-center",children:l.map((v,d)=>v?_.jsx("img",{className:"univer-size-5",src:v},d):_.jsx(Ye,{className:"univer-size-5"},d))})},[h]),R=l=>{if(l.reduce((d,g,x)=>d.preType&&!d.result||l.length-1===x?d:g.value.type===c.CFValueType.formula?{preType:c.CFValueType.formula,result:!1}:d.preType?{result:d.preType===g.value.type,preType:g.value.type}:{result:!0,preType:g.value.type},{result:!0,preType:""}).result&&[c.CFValueType.num,c.CFValueType.percent,c.CFValueType.percentile].includes(l[0].value.type)){const d={};return l.forEach((g,x,M)=>{if(x-1<0||x===M.length-1)return;const z=l[x-1],O=c.getOppositeOperator(z.operator);c.compareWithNumber({operator:O,value:z.value.value},g.value.value)||(d[x]=`${r.t(`sheet.cf.form.${O}`,String(z.value.value))} `)}),d}return{}},I=(l,v)=>{w.get(h,l)!==v&&(w.set(h,l,v),T([...h]),o(R(h)))},S=l=>{y(l);const v=c.iconMap[l]||[],d=new Array(v.length).fill("").map((g,x,M)=>vn(l,x,M));T(d),o(R(d))};V.useEffect(()=>{const l=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:c.CFRuleType.iconSet,isShowValue:m,config:h}}});return()=>{l()}},[m,h,t]),V.useEffect(()=>{const l=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(a).length===0}});return()=>{l()}},[m,h,t,a]);const p=()=>{const l=h.map(v=>({...v}));h.forEach((v,d)=>{const g=h.length-1-d,x=l[g];v.iconId=x.iconId,v.iconType=x.iconType}),T([...h])},i=$.useDependency($.ILayoutService),[s,f]=V.useState();return $.useScrollYOverContainer(s,i.rootContainerElement),_.jsxs("div",{className:re.iconSet,children:[_.jsx("div",{className:ue.title,children:r.t("sheet.cf.panel.styleRule")}),_.jsx("div",{className:"univer-mt-3",children:_.jsx(X.Dropdown,{overlay:_.jsx("div",{className:"univer-rounded-lg univer-p-4",children:_.jsx(Ea,{ref:l=>{!s&&l&&f(l)},iconType:u,onClick:S})}),children:_.jsxs("div",{className:X.clsx(re.dropdownIcon,"univer-box-border univer-h-7 univer-w-auto"),children:[E,_.jsx(gt,{})]})})}),_.jsxs("div",{className:`
63
- univer-mt-3
64
- ${re.renderConfig}
65
- `,children:[_.jsxs("div",{className:re.utilItem,children:[_.jsx(X.Checkbox,{onChange:p}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),_.jsxs("div",{className:`
66
- ${re.utilItem}
67
- univer-ml-6
68
- `,children:[_.jsx(X.Checkbox,{checked:!m,onChange:l=>{C(!l)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),_.jsx(Pa,{errorMap:a,onChange:I,configList:h})]})},xa=e=>{var p;const{onChange:t,interceptorManager:n}=e,r=$.useDependency(w.LocaleService),a=((p=e.rule)==null?void 0:p.type)===c.CFRuleType.highlightCell?e.rule:void 0,o=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[u,y]=V.useState(()=>{const i=o[0].value,s=a==null?void 0:a.type;if(!a)return i;switch(s){case c.CFRuleType.highlightCell:switch(a.subType){case c.CFSubRuleType.average:return[c.CFNumberOperator.greaterThan,c.CFNumberOperator.greaterThanOrEqual].includes(a.operator)?"greaterThanAverage":[c.CFNumberOperator.lessThan,c.CFNumberOperator.lessThanOrEqual].includes(a.operator)?"lessThanAverage":i;case c.CFSubRuleType.rank:return a.isBottom?"isBottom":"isNotBottom"}}return i}),[h,T]=V.useState(()=>{const s=a==null?void 0:a.type;if(!a)return 10;switch(s){case c.CFRuleType.highlightCell:switch(a.subType){case c.CFSubRuleType.rank:return a.value||10}}return 10}),[m,C]=V.useState(()=>{const s=a==null?void 0:a.type;if(!a)return!1;switch(s){case c.CFRuleType.highlightCell:switch(a.subType){case c.CFSubRuleType.rank:return a.isPercent||!1}}return!1}),[E,R]=V.useState({}),I=i=>{const{type:s,isPercent:f,value:b,style:l}=i;if(s==="isNotBottom")return{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.rank,isPercent:f,isBottom:!1,value:b,style:l};if(s==="isBottom")return{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.rank,isPercent:f,isBottom:!0,value:b,style:l};if(s==="greaterThanAverage")return{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.average,operator:c.CFNumberOperator.greaterThan,style:l};if(s==="lessThanAverage")return{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.average,operator:c.CFNumberOperator.lessThan,style:l}};V.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return I({type:u,isPercent:m,value:h,style:E})}}),[u,m,h,E,n]);const S=i=>{t(I(i))};return _.jsxs("div",{children:[_.jsx("div",{className:`
69
- ${ue.title}
70
- univer-mt-4
71
- `,children:r.t("sheet.cf.panel.styleRule")}),_.jsx(X.Select,{className:"univer-mt-3 univer-w-full",value:u,options:o,onChange:i=>{y(i),S({type:i,isPercent:m,value:h,style:E})}}),["isNotBottom","isBottom"].includes(u)&&_.jsxs("div",{className:`
72
- ${ue.labelContainer}
73
- univer-mt-3
74
- `,children:[_.jsx(X.InputNumber,{min:1,max:1e3,value:h,onChange:i=>{const s=i||0;T(s),S({type:u,isPercent:m,value:s,style:E})}}),_.jsxs("div",{className:`
75
- univer-ml-3
76
- ${ue.labelContainer}
77
- ${re.text}
78
- `,children:[_.jsx(X.Checkbox,{checked:m,onChange:i=>{C(!!i),S({type:u,isPercent:!!i,value:h,style:E})}}),r.t("sheet.cf.valueType.percent")]})]}),_.jsx("div",{className:`
79
- ${re.cfPreviewWrap}
80
- `,children:_.jsx(je,{rule:I({type:u,isPercent:m,value:h,style:E})})}),_.jsx(lr,{style:a==null?void 0:a.style,className:"univer-mt-3",onChange:i=>{R(i),S({type:u,isPercent:m,value:h,style:i})}})]})},Ma=w.createInterceptorKey("beforeSubmit"),Na=w.createInterceptorKey("submit"),gn=e=>e.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),mn=e=>{var t;return(t=e.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId()},La=e=>{var d,g,x;const t=$.useDependency(w.LocaleService),n=$.useDependency(w.ICommandService),r=$.useDependency(w.IUniverInstanceService),a=$.useDependency(c.ConditionalFormattingRuleModel),o=$.useDependency(q.SheetsSelectionsService),u=gn(r),y=mn(r),[h,T]=V.useState(void 0),m=V.useRef((g=(d=e.rule)==null?void 0:d.ranges)!=null?g:[]),C=V.useMemo(()=>{var U,z,O;let M=(U=e.rule)==null?void 0:U.ranges;return M!=null&&M.length||(M=(O=(z=o.getCurrentSelections())==null?void 0:z.map(L=>L.range))!=null?O:[]),m.current=M,M!=null&&M.length?M.map(L=>{const H=kt.serializeRange(L);return H==="NaN"?"":H}).filter(L=>!!L).join(","):""},[e.rule]),E=[{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"}],[R,I]=V.useState(()=>{var z,O;const M=(z=e.rule)==null?void 0:z.rule.type,U=E[0].value;if(!M)return U;switch(M){case c.CFRuleType.highlightCell:{switch((O=e.rule)==null?void 0:O.rule.subType){case c.CFSubRuleType.number:case c.CFSubRuleType.text:case c.CFSubRuleType.duplicateValues:case c.CFSubRuleType.uniqueValues:case c.CFSubRuleType.timePeriod:return"1";case c.CFSubRuleType.average:case c.CFSubRuleType.rank:return"2";case c.CFSubRuleType.formula:return"5"}break}case c.CFRuleType.dataBar:return"3";case c.CFRuleType.colorScale:return"4";case c.CFRuleType.iconSet:return"6"}return U}),S=V.useRef(void 0),p=V.useMemo(()=>new w.InterceptorManager({beforeSubmit:Ma,submit:Na}),[]),i=V.useMemo(()=>{switch(R){case"1":return pn;case"2":return xa;case"3":return wa;case"4":return Ta;case"5":return Ia;case"6":return Da;default:return pn}},[R]);V.useEffect(()=>{const M=n.onCommandExecuted(U=>{if(U.id===q.RemoveSheetMutation.id){const z=U.params;z.subUnitId===y&&z.unitId===u&&e.onCancel()}U.id===q.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>M.dispose()},[]);const s=M=>{S.current=M},f=M=>{const U=M.split(",").filter(z=>!!z).map(kt.deserializeRangeWithSheet).map(z=>z.range);m.current=U},b=()=>{if(h)return;const U=(()=>{const O=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!O)throw new Error("No active sheet found");return m.current.map(F=>q.setEndForRange(F,O.getRowCount(),O.getColumnCount())).filter(F=>!(Number.isNaN(F.startRow)||Number.isNaN(F.startColumn)))})();if(p.fetchThroughInterceptors(p.getInterceptPoints().beforeSubmit)(!0,null)){const O=p.fetchThroughInterceptors(p.getInterceptPoints().submit)(null,null);if(O){const L=gn(r),H=mn(r);if(!L||!H)throw new Error("No active sheet found");let F={};e.rule&&e.rule.cfId?(F={...e.rule,ranges:U,rule:O},n.executeCommand(c.SetCfCommand.id,{unitId:L,subUnitId:H,rule:F}),e.onCancel()):(F={cfId:a.createCfId(L,H),ranges:U,rule:O,stopIfTrue:!1},n.executeCommand(c.AddCfCommand.id,{unitId:L,subUnitId:H,rule:F}),e.onCancel())}}},l=()=>{e.onCancel()},v=(M,U)=>{M?U.length<1?T(t.t("sheet.cf.errorMessage.rangeError")):T(void 0):T(t.t("sheet.cf.errorMessage.rangeError"))};return _.jsxs("div",{className:re.cfRuleStyleEditor,children:[_.jsx("div",{className:ue.title,children:t.t("sheet.cf.panel.range")}),_.jsxs("div",{className:"univer-mt-4",children:[_.jsx(Ge.RangeSelector,{unitId:u,subUnitId:y,initialValue:C,onChange:(M,U)=>f(U),onVerify:v}),h&&_.jsx("div",{className:re.cfErrorText,children:h})]}),_.jsx("div",{className:ue.title,children:t.t("sheet.cf.panel.styleType")}),_.jsx(X.Select,{className:"univer-mt-4 univer-w-full",value:R,options:E,onChange:M=>I(M)}),_.jsx(i,{interceptorManager:p,rule:(x=e.rule)==null?void 0:x.rule,onChange:s}),_.jsxs("div",{className:"univer-mt-4 univer-flex univer-justify-end",children:[_.jsx(X.Button,{onClick:l,children:t.t("sheet.cf.panel.cancel")}),_.jsx(X.Button,{className:"univer-ml-3",variant:"primary",onClick:b,children:t.t("sheet.cf.panel.submit")})]})]})},Va=e=>{const[t,n]=V.useState(e.rule),[r,a]=V.useState(!!e.rule),o=()=>{a(!0)},u=()=>{a(!1),n(void 0)},y=h=>{n(h),a(!0)};return _.jsx("div",{className:ue.conditionalFormattingWrap,children:r?_.jsx(La,{onCancel:u,rule:t}):_.jsx(Ca,{onClick:y,onCreate:o})})};var Ua=Object.getOwnPropertyDescriptor,za=(e,t,n,r)=>{for(var a=r>1?void 0:r?Ua(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},at=(e,t)=>(n,r)=>t(n,r,e);const Pt="sheet.conditional.formatting.panel";let ot=class extends w.Disposable{constructor(t,n,r,a,o){super();De(this,"_sidebarDisposable",null);this._univerInstanceService=t,this._injector=n,this._componentManager=r,this._sidebarService=a,this._localeService=o,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(w.UniverInstanceType.UNIVER_SHEET).subscribe(u=>{var y;u||(y=this._sidebarDisposable)==null||y.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(u=>{u.id===Pt&&(u.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(t){const n={id:Pt,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Pt,rule:t,key:w.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initPanel(){this._componentManager.register(Pt,Va)}};ot=za([at(0,w.IUniverInstanceService),at(1,w.Inject(w.Injector)),at(2,w.Inject($.ComponentManager)),at(3,w.Inject($.ISidebarService)),at(4,w.Inject(w.LocaleService))],ot);var ye=(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))(ye||{});const it={id:"sheet.operation.open.conditional.formatting.panel",type:w.CommandType.OPERATION,handler:(e,t)=>{var y;const n=e.get(ot),r=e.get(q.SheetsSelectionsService),a=e.get(w.ICommandService),o=((y=r.getCurrentSelections())==null?void 0:y.map(h=>h.range))||[];switch(t.value){case 3:{n.openPanel({...c.createDefaultRule(),ranges:o});break}case 4:{const h={...c.createDefaultRule,ranges:o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.rank}};n.openPanel(h);break}case 5:{const h={...c.createDefaultRule,ranges:o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.formula,value:"="}};n.openPanel(h);break}case 6:{const h={...c.createDefaultRule,ranges:o,rule:{type:c.CFRuleType.colorScale,config:[]}};n.openPanel(h);break}case 7:{const h={...c.createDefaultRule,ranges:o,rule:{type:c.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(h);break}case 8:{const h={...c.createDefaultRule,ranges:o,rule:{type:c.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(h);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...c.createDefaultRule(),ranges:o});break}case 9:{a.executeCommand(c.ClearRangeCfCommand.id,{ranges:o});break}case 10:{a.executeCommand(c.ClearWorksheetCfCommand.id);break}}return!0}};var ka=Object.getOwnPropertyDescriptor,Aa=(e,t,n,r)=>{for(var a=r>1?void 0:r?ka(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},st=(e,t)=>(n,r)=>t(n,r,e);let lt=class extends w.Disposable{constructor(t,n,r,a,o){super();De(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=a,this._univerInstanceService=o,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:c.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,n,r)=>this._collectConditionalRule(t,n,r),onPasteCells:(t,n,r,a)=>{const{copyType:o=pe.COPY_TYPE.COPY,pasteType:u}=a,{range:y}=t||{},{range:h}=n;return this._generateConditionalFormattingMutations(h,{copyType:o,pasteType:u,copyRange:y})}}))}_collectConditionalRule(t,n,r){const a=new w.ObjectMatrix,o={};this._copyInfo={matrix:a,info:{unitId:t,subUnitId:n,cfMap:o}};const u=this._injector.invoke(m=>q.rangeToDiscreteRange(r,m,t,n));if(!u)return;const{rows:y,cols:h}=u,T=new Set;y.forEach((m,C)=>{h.forEach((E,R)=>{const I=this._conditionalFormattingViewModel.getCellCfs(t,n,m,E);I&&(I.forEach(S=>T.add(S.cfId)),a.setValue(C,R,I.map(S=>S.cfId)))})}),T.forEach(m=>{const C=this._conditionalFormattingRuleModel.getRule(t,n,m);C&&(o[m]=C.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),a=r.getActiveSheet(),o=r.getUnitId();if(!a)return{redos:[],undos:[]};const u=a.getSheetId();if(n.copyType===pe.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![pe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,pe.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,pe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[h,T],mapFunc:m}=pe.virtualizeDiscreteRanges([n.copyRange,t]),C=pe.getRepeatRange(h,T,!0),E={};w.Range.foreach(T,(l,v)=>{const{row:d,col:g}=m(l,v),x=this._conditionalFormattingViewModel.getCellCfs(o,u,d,g);x&&x.forEach(M=>{if(!E[M.cfId]){const U=new w.ObjectMatrix;E[M.cfId]=U;const z=this._conditionalFormattingRuleModel.getRule(o,u,M.cfId);z==null||z.ranges.forEach(O=>{w.Range.foreach(O,(L,H)=>{U.setValue(L,H,1)})})}E[M.cfId].realDeleteValue(d,g)})});const{matrix:R,info:I}=this._copyInfo,S=[];let p=this._conditionalFormattingRuleModel.createCfId(o,u);const i={},s=l=>{if(i[l])return i[l];const v=I==null?void 0:I.cfMap[l],d=[...this._conditionalFormattingRuleModel.getSubunitRules(o,u)||[],...S].find(g=>w.Tools.diffValue(g.rule,v));if(d)return i[l]=d,d;{const g={rule:v,cfId:p,ranges:[],stopIfTrue:!1};return i[l]=g,S.push(g),p=`${Number(p)+1}`,g}};C.forEach(l=>{R&&R.forValue((v,d,g)=>{const x=w.Rectangle.getPositionRange({startRow:v,endRow:v,startColumn:d,endColumn:d},l.startRange),{row:M,col:U}=m(x.startRow,x.startColumn);g.forEach(z=>{if(!E[z]){const O=s(z),L=new w.ObjectMatrix;E[z]=L,O.ranges.forEach(H=>{w.Range.foreach(H,(F,K)=>{L.setValue(F,K,1)})})}E[z].setValue(M,U,1)})})});const f=[],b=[];for(const l in E){const v=E[l],d=q.findAllRectangle(q.createTopMatrixFromMatrix(v));if(!d.length){const g={unitId:o,subUnitId:u,cfId:l};f.push({id:c.DeleteConditionalRuleMutation.id,params:g}),b.push(...c.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}if(S.some(g=>g.cfId===l)){const g=s(l),x={unitId:o,subUnitId:u,rule:{...g,ranges:d}};f.push({id:c.AddConditionalRuleMutation.id,params:x}),b.push(c.AddConditionalRuleMutationUndoFactory(this._injector,x))}else{const g=this._conditionalFormattingRuleModel.getRule(o,u,l);if(!g)continue;const x={unitId:o,subUnitId:u,rule:{...g,ranges:d}};f.push({id:c.SetConditionalRuleMutation.id,params:x}),b.push(...c.setConditionalRuleMutationUndoFactory(this._injector,x))}}return{redos:f,undos:b}}};lt=Aa([st(0,w.Inject(pe.ISheetClipboardService)),st(1,w.Inject(c.ConditionalFormattingRuleModel)),st(2,w.Inject(w.Injector)),st(3,w.Inject(c.ConditionalFormattingViewModel)),st(4,w.Inject(w.IUniverInstanceService))],lt);var ja=Object.getOwnPropertyDescriptor,Wa=(e,t,n,r)=>{for(var a=r>1?void 0:r?ja(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},ur=(e,t)=>(n,r)=>t(n,r,e);let ut=class extends w.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===c.AddCfCommand.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[q.WorkbookEditablePermission],rangeTypes:[q.RangeProtectionPermissionEditPoint],worksheetTypes:[q.WorksheetEditPermission,q.WorksheetSetCellStylePermission]},e.params.rule.ranges)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")))}))}};ut=Wa([ur(0,w.Inject(w.LocaleService)),ur(1,w.ICommandService),ur(2,w.Inject(q.SheetPermissionCheckController))],ut);var Ha=Object.getOwnPropertyDescriptor,Ba=(e,t,n,r)=>{for(var a=r>1?void 0:r?Ha(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},Dt=(e,t)=>(n,r)=>t(n,r,e);let ct=class extends w.Disposable{constructor(e,t,n,r){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._refRangeService=r,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,a,o)=>`${r}_${a}_${o}`,n=(r,a,o)=>{const u=h=>{const T=[...o.ranges],m=T.map(E=>q.handleDefaultRangeChangeWithEffectRefCommands(E,h)).filter(E=>!!E);if(c.isRangesEqual(m,T))return{redos:[],undos:[]};if(m.length){const E={unitId:r,subUnitId:a,rule:{...o,ranges:m}},R=[{id:c.SetConditionalRuleMutation.id,params:E}],I=c.setConditionalRuleMutationUndoFactory(this._injector,E);return{redos:R,undos:I}}else{const E={unitId:r,subUnitId:a,cfId:o.cfId},R=[{id:c.DeleteConditionalRuleMutation.id,params:E}],I=c.DeleteConditionalRuleMutationUndoFactory(this._injector,E);return{redos:R,undos:I}}},y=[];o.ranges.forEach(h=>{const T=this._refRangeService.registerRefRange(h,u);y.push(()=>T.dispose())}),e.set(t(r,a,o.cfId),()=>y.forEach(h=>h()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:a,subUnitId:o,rule:u}=r,y=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),h=y.getActiveSheet();if(!(r.unitId!==y.getUnitId()||r.subUnitId!==(h==null?void 0:h.getSheetId())))switch(r.type){case"add":{n(r.unitId,r.subUnitId,r.rule);break}case"delete":{const T=e.get(t(a,o,u.cfId));T&&T();break}case"set":{const T=e.get(t(a,o,u.cfId));T&&T(),n(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(w.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};ct=Ba([Dt(0,w.Inject(c.ConditionalFormattingRuleModel)),Dt(1,w.Inject(w.IUniverInstanceService)),Dt(2,w.Inject(w.Injector)),Dt(3,w.Inject(q.RefRangeService))],ct);var Fa=Object.getOwnPropertyDescriptor,Ga=(e,t,n,r)=>{for(var a=r>1?void 0:r?Fa(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},He=(e,t)=>(n,r)=>t(n,r,e);let dt=class extends w.Disposable{constructor(t,n,r,a,o,u){super();De(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=t,this._conditionalFormattingService=n,this._univerInstanceService=r,this._renderManagerService=a,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=u,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var n,r,a;const t=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId();(n=this._renderManagerService.getRenderById(t))==null||n.with(pe.SheetSkeletonManagerService).reCalculate(),(a=(r=this._renderManagerService.getRenderById(t))==null?void 0:r.mainComponent)==null||a.makeDirty()}_initSkeleton(){this.disposeWithMe(Ce.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(qe.bufferTime(16),qe.filter(t=>!!t.length),qe.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(a=>a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(q.INTERCEPTOR_POINT.CELL_CONTENT,{effect:w.InterceptorEffectEnum.Style,handler:(t,n,r)=>{const a=this._conditionalFormattingService.composeStyle(n.unitId,n.subUnitId,n.row,n.col);if(!a)return r(t);const o=n.workbook.getStyles(),y={...(typeof(t==null?void 0:t.s)=="string"?o.get(t==null?void 0:t.s):t==null?void 0:t.s)||{}},h={...t,s:y};return a.style&&Object.assign(y,a.style),h.fontRenderExtension||(h.fontRenderExtension={},a.isShowValue!==void 0&&(h.fontRenderExtension.isSkip=!a.isShowValue)),a.dataBar&&(h.dataBar=a.dataBar),a.iconSet&&(h.iconSet=a.iconSet,h.fontRenderExtension.leftOffset=c.DEFAULT_PADDING+c.DEFAULT_WIDTH),r(h)},priority:10}))}};dt=Ga([He(0,w.Inject(q.SheetInterceptorService)),He(1,w.Inject(c.ConditionalFormattingService)),He(2,w.Inject(w.IUniverInstanceService)),He(3,w.Inject(hr.IRenderManagerService)),He(4,w.Inject(c.ConditionalFormattingViewModel)),He(5,w.Inject(c.ConditionalFormattingRuleModel))],dt);const yn="sheets-conditional-formatting-ui.config",xt={};var qa=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,Xa=(e,t,n)=>t in e?qa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ka=(e,t,n,r)=>{for(var a=r>1?void 0:r?Ya(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},cr=(e,t)=>(n,r)=>t(n,r,e),bn=(e,t,n)=>Xa(e,typeof t!="symbol"?t+"":t,n);Y.UniverSheetsConditionalFormattingMobileUIPlugin=class extends w.Plugin{constructor(t=xt,n,r,a){super(),this._config=t,this._injector=n,this._commandService=r,this._configService=a;const{menu:o,...u}=w.merge({},xt,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(yn,u),this._initCommand(),this._injector.add([dt]),this._injector.add([ct]),this._injector.add([lt]),this._injector.add([ut]),this._injector.add([Ae])}_initCommand(){[jt,Wt,Ht,Bt,Ft,Gt,qt,Yt,Xt,it].forEach(t=>{this._commandService.registerCommand(t)})}},bn(Y.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${c.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`),bn(Y.UniverSheetsConditionalFormattingMobileUIPlugin,"type",w.UniverInstanceType.UNIVER_SHEET),Y.UniverSheetsConditionalFormattingMobileUIPlugin=Ka([w.DependentOn(c.UniverSheetsConditionalFormattingPlugin),cr(1,w.Inject(w.Injector)),cr(2,w.Inject(w.ICommandService)),cr(3,w.IConfigService)],Y.UniverSheetsConditionalFormattingMobileUIPlugin);var Za=Object.getOwnPropertyDescriptor,Ja=(e,t,n,r)=>{for(var a=r>1?void 0:r?Za(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},ft=(e,t)=>(n,r)=>t(n,r,e);let Mt=class extends w.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=a,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(a,o,u,y,h)=>{var R;const T=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),m=(R=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:R.getSheetId();if(!T||!m)return;const C={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row},E={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row};w.Range.foreach(u,(I,S)=>{const p=w.Rectangle.getPositionRange({startRow:I,startColumn:S,endColumn:S,endRow:I},C),i=w.Rectangle.getPositionRange({startRow:I,startColumn:S,endColumn:S,endRow:I},E),{row:s,col:f}=h(p.startRow,p.startColumn),b=this._conditionalFormattingViewModel.getCellCfs(T,m,s,f),{row:l,col:v}=h(i.startRow,i.startColumn),d=this._conditionalFormattingViewModel.getCellCfs(T,m,l,v);d&&d.forEach(g=>{let x=y.get(g.cfId);if(!y.get(g.cfId)){const M=this._conditionalFormattingRuleModel.getRule(T,m,g.cfId);if(!M)return;x=new w.ObjectMatrix,M.ranges.forEach(U=>{w.Range.foreach(U,(z,O)=>{x.setValue(z,O,1)})}),y.set(g.cfId,x)}x.realDeleteValue(l,v)}),b&&b.forEach(g=>{let x=y.get(g.cfId);if(!y.get(g.cfId)){const M=this._conditionalFormattingRuleModel.getRule(T,m,g.cfId);if(!M)return;x=new w.ObjectMatrix,M.ranges.forEach(U=>{w.Range.foreach(U,(z,O)=>{x.setValue(z,O,1)})}),y.set(g.cfId,x)}x.setValue(l,v,1)})})},n=(a,o)=>{var i,s,f;const u=(i=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:i.getUnitId(),y=(f=(s=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getActiveSheet())==null?void 0:f.getSheetId(),h=new Map,T=[],m=[];if(!u||!y)return e();const C=pe.virtualizeDiscreteRanges([a,o]),[E,R]=C.ranges,{mapFunc:I}=C,S={row:E.startRow,col:E.startColumn};return pe.getAutoFillRepeatRange(E,R).forEach(b=>{t(S,b.repeatStartCell,b.relativeRange,h,I)}),h.forEach((b,l)=>{const v=this._conditionalFormattingRuleModel.getRule(u,y,l);if(!v)return;const d=q.findAllRectangle(q.createTopMatrixFromMatrix(b));if(d.length){const g={unitId:u,subUnitId:y,rule:{...v,ranges:d}};T.push({id:c.SetConditionalRuleMutation.id,params:g}),m.push(...c.setConditionalRuleMutationUndoFactory(this._injector,g))}else{const g={unitId:u,subUnitId:y,cfId:v.cfId};T.push({id:c.DeleteConditionalRuleMutation.id,params:g}),m.push(...c.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}}),{undos:m,redos:T}},r={id:c.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(a,o,u)=>{if(u===pe.APPLY_TYPE.COPY||u===pe.APPLY_TYPE.ONLY_FORMAT||u===pe.APPLY_TYPE.SERIES){const{source:y,target:h}=a;return n(y,h)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Mt=Ja([ft(0,w.Inject(w.Injector)),ft(1,w.Inject(w.IUniverInstanceService)),ft(2,w.Inject(pe.IAutoFillService)),ft(3,w.Inject(c.ConditionalFormattingRuleModel)),ft(4,w.Inject(c.ConditionalFormattingViewModel))],Mt);var Qa=Object.getOwnPropertyDescriptor,$a=(e,t,n,r)=>{for(var a=r>1?void 0:r?Qa(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},pt=(e,t)=>(n,r)=>t(n,r,e);Y.ConditionalFormattingClearController=class extends w.Disposable{constructor(t,n,r,a,o){super(),this._injector=t,this._univerInstanceService=n,this._sheetInterceptorService=r,this._selectionManagerService=a,this._conditionalFormattingRuleModel=o,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{var o;const n=[],r=[],a={redos:n,undos:r};if([q.ClearSelectionFormatCommand.id,q.ClearSelectionAllCommand.id].includes(t.id)){const u=(o=this._selectionManagerService.getCurrentSelections())==null?void 0:o.map(I=>I.range);if(!u)return a;const y=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),h=y.getActiveSheet();if(!h)return a;const T=y.getUnitId(),m=h.getSheetId(),C=this._conditionalFormattingRuleModel.getSubunitRules(T,m);if(!C||!C.length)return a;const{redos:E,undos:R}=Sn(this._injector,C,u,T,m);n.push(...E),r.push(...R)}return a}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:t,subUnitId:n,ranges:r})=>{const a=[],o=[],u={redos:a,undos:o};if(!r||!r.length)return u;const y=this._conditionalFormattingRuleModel.getSubunitRules(t,n);if(!y||!y.length)return u;const{redos:h,undos:T}=Sn(this._injector,y,r,t,n);return a.push(...h),o.push(...T),u}}))}},Y.ConditionalFormattingClearController=$a([pt(0,w.Inject(w.Injector)),pt(1,w.Inject(w.IUniverInstanceService)),pt(2,w.Inject(q.SheetInterceptorService)),pt(3,w.Inject(q.SheetsSelectionsService)),pt(4,w.Inject(c.ConditionalFormattingRuleModel))],Y.ConditionalFormattingClearController);function Sn(e,t,n,r,a){const o=[],u=[];return t.filter(y=>n.some(h=>y.ranges.some(T=>w.Rectangle.getIntersects(T,h)))).forEach(y=>{const T=new q.RangeMergeUtil().add(...y.ranges).subtract(...n).merge();if(T.length){const m={id:c.SetConditionalRuleMutation.id,params:{unitId:r,subUnitId:a,rule:{...y,ranges:T}}},C=c.setConditionalRuleMutationUndoFactory(e,m.params);o.push(m),u.push(...C)}else{const m={id:c.DeleteConditionalRuleMutation.id,params:{unitId:r,subUnitId:a,cfId:y.cfId}},C=c.DeleteConditionalRuleMutationUndoFactory(e,m.params);o.push(m),u.push(...C)}}),{redos:o,undos:u}}var eo=Object.getOwnPropertyDescriptor,to=(e,t,n,r)=>{for(var a=r>1?void 0:r?eo(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},Cn=(e,t)=>(n,r)=>t(n,r,e);let Nt=class extends w.Disposable{constructor(e,t){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(w.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(q.AFTER_CELL_EDIT,{handler:(e,t,n)=>{var u,y,h;e||n(e);const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col),a=(u=r==null?void 0:r.style)!=null?u:{},o=Object.keys(a);if(e!=null&&e.p)return(h=(y=e.p.body)==null?void 0:y.textRuns)==null||h.forEach(T=>{T.ts&&o.forEach(m=>{var C;(C=T.ts)==null||delete C[m]})}),n(e);{const T={...(typeof(e==null?void 0:e.s)=="string"?t.workbook.getStyles().get(e.s):e==null?void 0:e.s)||{}};o.forEach(C=>{delete T[C]});const m={...e,s:{...T}};return n(m)}}})))}};Nt=to([Cn(0,w.Inject(q.SheetInterceptorService)),Cn(1,w.Inject(c.ConditionalFormattingService))],Nt);const Tn=[q.SetWorksheetActiveOperation.id,c.AddConditionalRuleMutation.id,c.SetConditionalRuleMutation.id,c.DeleteConditionalRuleMutation.id,c.MoveConditionalRuleMutation.id],ht=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:ye.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:ye.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:ye.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:ye.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:ye.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:ye.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:ye.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:ye.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:ye.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:ye.clearWorkSheetRules}],ro=e=>{const t=e.get(q.SheetsSelectionsService),n=e.get(w.ICommandService),r=e.get(w.IUniverInstanceService),a=e.get(c.ConditionalFormattingRuleModel),o=new Ce.Observable(h=>Ce.merge(t.selectionMoveEnd$,t.selectionSet$,new Ce.Observable(T=>{const m=n.onCommandExecuted(C=>{var S;const{id:E,params:R}=C,I=(S=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getUnitId();Tn.includes(E)&&R.unitId===I&&T.next(null)});return()=>m.dispose()})).pipe(qe.debounceTime(16)).subscribe(()=>{var S;const T=((S=t.getCurrentSelections())==null?void 0:S.map(p=>p.range))||[],m=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET);if(!m)return;const C=m.getActiveSheet();if(!C)return;const I=(a.getSubunitRules(m.getUnitId(),C.getSheetId())||[]).filter(p=>p.ranges.some(i=>T.some(s=>w.Rectangle.intersects(s,i)))).map(p=>p.ranges).every(p=>q.checkRangesEditablePermission(e,m.getUnitId(),C.getSheetId(),p));h.next(I)})),u=new Ce.Observable(h=>new Ce.Observable(T=>{const m=n.onCommandExecuted(C=>{var S;const{id:E,params:R}=C,I=(S=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getUnitId();Tn.includes(E)&&R.unitId===I&&T.next(null)});return()=>m.dispose()}).pipe(qe.debounceTime(16)).subscribe(()=>{const T=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET);if(!T)return;const m=T.getActiveSheet();if(!m)return;const C=a.getSubunitRules(T.getUnitId(),m.getSheetId())||[];if(!C.length)return h.next(!1),!1;const E=C.map(R=>R.ranges).every(R=>q.checkRangesEditablePermission(e,T.getUnitId(),m.getSheetId(),R));h.next(E)})),y=new Ce.Observable(h=>{o.subscribe(T=>{const m=ht.find(C=>C.value===ye.clearRangeRules);m&&(m.disabled=!T,h.next(ht))}),u.subscribe(T=>{const m=ht.find(C=>C.value===ye.clearWorkSheetRules);m&&(m.disabled=!T,h.next(ht))}),h.next(ht)});return{id:it.id,type:$.MenuItemType.SELECTOR,icon:"Conditions",tooltip:"sheet.cf.title",selections:y,hidden$:$.getMenuHiddenObservable(e,w.UniverInstanceType.UNIVER_SHEET),disabled$:pe.getCurrentRangeDisable$(e,{workbookTypes:[q.WorkbookEditablePermission],worksheetTypes:[q.WorksheetSetCellStylePermission,q.WorksheetEditPermission],rangeTypes:[q.RangeProtectionPermissionEditPoint]})}},no={[$.RibbonStartGroup.FORMULAS_INSERT]:{[it.id]:{order:0,menuItemFactory:ro}}};var ao=Object.getOwnPropertyDescriptor,oo=(e,t,n,r)=>{for(var a=r>1?void 0:r?ao(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},wn=(e,t)=>(n,r)=>t(n,r,e);let Lt=class extends w.Disposable{constructor(t,n){super();De(this,"_sidebarDisposable",null);this._injector=t,this._menuManagerService=n,this._menuManagerService.mergeMenu(no)}};Lt=oo([wn(0,w.Inject(w.Injector)),wn(1,$.IMenuManagerService)],Lt);var io=Object.getOwnPropertyDescriptor,so=(e,t,n,r)=>{for(var a=r>1?void 0:r?io(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},Be=(e,t)=>(n,r)=>t(n,r,e);const lo=(e,t)=>{const n=m=>m.endRow-m.startRow+1,r=m=>m.endColumn-m.startColumn+1,a=n(t)%n(e),o=r(t)%r(e),u=Math.floor(n(t)/n(e)),y=Math.floor(r(t)/r(e)),h=[],T={startRow:0,endRow:n(e)-1,startColumn:0,endColumn:r(e)-1};if(n(t)===1&&r(t)===1){const m={startRow:t.startRow,endRow:t.startRow,startColumn:t.startColumn,endColumn:t.startColumn};return h.push({repeatRelativeRange:T,startRange:m}),h}for(let m=0;m<u+(a?.1:0);m++)for(let C=0;C<y+(o?.1:0);C++){const E=n(e)*m,R=r(e)*C,I={startRow:E+t.startRow,endRow:E+t.startRow,startColumn:R+t.startColumn,endColumn:R+t.startColumn};let S=T;m===u&&a&&(S={...S},S.endRow=S.endRow-(n(e)-a)),C===y&&o&&(S={...S},S.endColumn=S.endColumn-(r(e)-o)),h.push({repeatRelativeRange:S,startRange:I})}return h};let Vt=class extends w.Disposable{constructor(t,n,r,a,o,u){super();De(this,"_painterConfig",null);this._injector=t,this._univerInstanceService=n,this._formatPainterService=r,this._sheetsSelectionsService=a,this._conditionalFormattingRuleModel=o,this._conditionalFormattingViewModel=u,this._initFormattingPainter()}_initFormattingPainter(){const t=()=>({redos:[],undos:[]}),n=(o,u,y,h,T)=>{const{unitId:m,subUnitId:C}=this._painterConfig,{targetUnitId:E,targetSubUnitId:R}=T,I={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},S={startRow:u.row,startColumn:u.col,endColumn:u.col,endRow:u.row};w.Range.foreach(y,(p,i)=>{const s=w.Rectangle.getPositionRange({startRow:p,startColumn:i,endColumn:i,endRow:p},I),f=w.Rectangle.getPositionRange({startRow:p,startColumn:i,endColumn:i,endRow:p},S),b=this._conditionalFormattingViewModel.getCellCfs(m,C,s.startRow,s.startColumn),l=this._conditionalFormattingViewModel.getCellCfs(E,R,f.startRow,f.startColumn);l&&l.forEach(v=>{let d=h.get(v.cfId);if(!h.get(v.cfId)){const g=this._conditionalFormattingRuleModel.getRule(E,R,v.cfId);if(!g)return;d=new w.ObjectMatrix,g.ranges.forEach(x=>{w.Range.foreach(x,(M,U)=>{d.setValue(M,U,1)})}),h.set(v.cfId,d)}d.realDeleteValue(f.startRow,f.startColumn)}),b&&b.forEach(v=>{const d=h.get(v.cfId);d&&d.setValue(f.startRow,f.startColumn,1)})})},r=(o,u,y)=>{var s;const{range:h,unitId:T,subUnitId:m}=this._painterConfig,C=o!==T||m!==u,E=new Map,R=[],I=[];if(!o||!u||!T||!m)return t();const S=(s=this._conditionalFormattingRuleModel.getSubunitRules(T,m))!=null?s:[];S==null||S.forEach(f=>{const{ranges:b,cfId:l}=f;if(b.some(v=>w.Rectangle.intersects(h,v))){const v=new w.ObjectMatrix;C||b.forEach(d=>{w.Range.foreach(d,(g,x)=>{v.setValue(g,x,1)})}),E.set(l,v)}});const p={row:h.startRow,col:h.startColumn};return lo(h,y).forEach(f=>{n(p,{row:f.startRange.startRow,col:f.startRange.startColumn},f.repeatRelativeRange,E,{targetUnitId:o,targetSubUnitId:u})}),E.forEach((f,b)=>{if(C){const l=this._conditionalFormattingRuleModel.getRule(o,u,b),v=q.findAllRectangle(q.createTopMatrixFromMatrix(f));if(l)if(v.length){const d={unitId:o,subUnitId:u,rule:{...l,ranges:v}};R.push({id:c.SetConditionalRuleMutation.id,params:d}),I.push(...c.setConditionalRuleMutationUndoFactory(this._injector,d))}else{const d={unitId:o,subUnitId:u,cfId:l.cfId};R.push({id:c.DeleteConditionalRuleMutation.id,params:d}),I.push(...c.DeleteConditionalRuleMutationUndoFactory(this._injector,d))}else if(v.length){const d=this._conditionalFormattingRuleModel.getRule(T,m,b);if(d){const g={unitId:o,subUnitId:u,rule:{...w.Tools.deepClone(d),cfId:this._conditionalFormattingRuleModel.createCfId(o,u),ranges:v}};R.push({id:c.AddConditionalRuleMutation.id,params:g}),I.push(c.AddConditionalRuleMutationUndoFactory(this._injector,g))}}}else{const l=this._conditionalFormattingRuleModel.getRule(T,m,b);if(!l)return;const v=q.findAllRectangle(q.createTopMatrixFromMatrix(f));if(v.length){const d={unitId:T,subUnitId:m,rule:{...l,ranges:v}};R.push({id:c.SetConditionalRuleMutation.id,params:d}),I.push(...c.setConditionalRuleMutationUndoFactory(this._injector,d))}else{const d={unitId:T,subUnitId:m,cfId:l.cfId};R.push({id:c.DeleteConditionalRuleMutation.id,params:d}),I.push(...c.DeleteConditionalRuleMutationUndoFactory(this._injector,d))}}}),{undos:I,redos:R}},a={id:c.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:o=>{var u,y,h;switch(o){case pe.FormatPainterStatus.INFINITE:case pe.FormatPainterStatus.ONCE:{const T=(u=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:u.getUnitId(),m=(h=(y=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getActiveSheet())==null?void 0:h.getSheetId(),C=this._sheetsSelectionsService.getCurrentLastSelection(),E=C==null?void 0:C.range;T&&m&&E&&(this._painterConfig={unitId:T,subUnitId:m,range:E});break}case pe.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(o,u,y)=>this._painterConfig?r(o,u,y):{redos:[],undos:[]}};this._formatPainterService.addHook(a)}};Vt=so([Be(0,w.Inject(w.Injector)),Be(1,w.Inject(w.IUniverInstanceService)),Be(2,w.Inject(pe.IFormatPainterService)),Be(3,w.Inject(q.SheetsSelectionsService)),Be(4,w.Inject(c.ConditionalFormattingRuleModel)),Be(5,w.Inject(c.ConditionalFormattingViewModel))],Vt);var uo=Object.getOwnPropertyDescriptor,co=(e,t,n,r)=>{for(var a=r>1?void 0:r?uo(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},dr=(e,t)=>(n,r)=>t(n,r,e);let Ut=class extends w.Disposable{constructor(e,t,n){super(),this._conditionalFormattingViewModel=e,this._univerInstanceService=t,this._renderManagerService=n,this._init()}_init(){const e=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),t=n=>{const r=n.getUnitId(),a=this._renderManagerService.getRenderById(r);if(!a)return;const o=a.with(pe.SheetSkeletonManagerService);this.disposeWithMe(o.currentSkeleton$.subscribe(u=>{if(u){const y=u.skeleton.rowColumnSegment,h=y.endColumn-y.startColumn+1,m=(y.endRow-y.startRow+1)*h*9,C=Math.max(c.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,m);this._conditionalFormattingViewModel.setCacheLength(C)}}))};e&&t(e),this._univerInstanceService.getCurrentTypeOfUnit$(w.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{n&&t(n)})}};Ut=co([dr(0,w.Inject(c.ConditionalFormattingViewModel)),dr(1,w.IUniverInstanceService),dr(2,hr.IRenderManagerService)],Ut);var fo=Object.defineProperty,po=Object.getOwnPropertyDescriptor,ho=(e,t,n)=>t in e?fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vo=(e,t,n,r)=>{for(var a=r>1?void 0:r?po(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(a=u(a)||a);return a},fr=(e,t)=>(n,r)=>t(n,r,e),In=(e,t,n)=>ho(e,typeof t!="symbol"?t+"":t,n);Y.UniverSheetsConditionalFormattingUIPlugin=class extends w.Plugin{constructor(t=xt,n,r,a){super(),this._config=t,this._injector=n,this._commandService=r,this._configService=a;const{menu:o,...u}=w.merge({},xt,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(yn,u),this._initCommand()}onStarting(){w.registerDependencies(this._injector,[[dt],[ct],[lt],[Mt],[ut],[ot],[Lt],[Ae],[Nt],[Y.ConditionalFormattingClearController],[Vt],[Ut]]),w.touchDependencies(this._injector,[[dt]])}onReady(){w.touchDependencies(this._injector,[[Lt],[ot]])}onRendered(){w.touchDependencies(this._injector,[[Mt],[Y.ConditionalFormattingClearController],[lt],[Nt],[Ae],[Vt],[ut],[ct],[Ut]])}_initCommand(){[jt,Wt,Ht,Bt,Ft,Gt,qt,Yt,Xt,it].forEach(t=>{this._commandService.registerCommand(t)})}},In(Y.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${c.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),In(Y.UniverSheetsConditionalFormattingUIPlugin,"type",w.UniverInstanceType.UNIVER_SHEET),Y.UniverSheetsConditionalFormattingUIPlugin=vo([w.DependentOn(c.UniverSheetsConditionalFormattingPlugin),fr(1,w.Inject(w.Injector)),fr(2,w.Inject(w.ICommandService)),fr(3,w.IConfigService)],Y.UniverSheetsConditionalFormattingUIPlugin),Y.AddAverageCfCommand=jt,Y.AddColorScaleConditionalRuleCommand=Wt,Y.AddDataBarConditionalRuleCommand=Ht,Y.AddDuplicateValuesCfCommand=Bt,Y.AddNumberCfCommand=Ft,Y.AddRankCfCommand=Gt,Y.AddTextCfCommand=qt,Y.AddTimePeriodCfCommand=Yt,Y.AddUniqueValuesCfCommand=Xt,Y.OpenConditionalFormattingOperator=it,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
26
+ `,children:[R.jsx(J.Select,{className:"univer-flex-shrink-0",options:d,value:b.value.type,onChange:y=>{C(y,E)}}),R.jsx("div",{children:R.jsx(Nn,{id:E,type:b.value.type,error:I,value:b.value.value||"",onChange:y=>{S(y,E)}})})]})]})]},E)}),[r,n])},zn=e=>{var y;const{interceptorManager:t}=e,r=((y=e.rule)==null?void 0:y.type)===u.CFRuleType.iconSet?e.rule:void 0,n=$.useDependency(w.LocaleService),[a,i]=V.useState({}),[d,S]=V.useState(()=>{const l=Object.keys(u.iconMap)[0];if(r&&r.config.length){const v=r.config[0].iconType;if(!r.config.some(g=>g.iconType!==v))return v}return l}),[h,C]=V.useState(()=>{if(r&&r.config.length)return w.Tools.deepClone(r==null?void 0:r.config);const l=u.iconMap[d]||[];return new Array(l.length).fill("").map((v,c,g)=>c===g.length-1?{operator:u.CFNumberOperator.lessThanOrEqual,value:{type:u.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:d,iconId:String(c)}:yr(d,c,g))}),[m,b]=V.useState(()=>r?!!r.isShowValue:!0),E=V.useMemo(()=>{const l=h.map(v=>mr(v.iconType,v.iconId));return R.jsx("div",{className:"univer-flex univer-items-center",children:l.map((v,c)=>v?R.jsx("img",{className:"univer-size-5",src:v},c):R.jsx(Be,{className:"univer-size-5"},c))})},[h]),I=l=>{if(l.reduce((c,g,P)=>c.preType&&!c.result||l.length-1===P?c:g.value.type===u.CFValueType.formula?{preType:u.CFValueType.formula,result:!1}:c.preType?{result:c.preType===g.value.type,preType:g.value.type}:{result:!0,preType:g.value.type},{result:!0,preType:""}).result&&[u.CFValueType.num,u.CFValueType.percent,u.CFValueType.percentile].includes(l[0].value.type)){const c={};return l.forEach((g,P,M)=>{if(P-1<0||P===M.length-1)return;const z=l[P-1],O=u.getOppositeOperator(z.operator);u.compareWithNumber({operator:O,value:z.value.value},g.value.value)||(c[P]=`${n.t(`sheet.cf.form.${O}`,String(z.value.value))} `)}),c}return{}},_=(l,v)=>{w.get(h,l)!==v&&(w.set(h,l,v),C([...h]),i(I(h)))},T=l=>{S(l);const v=u.iconMap[l]||[],c=new Array(v.length).fill("").map((g,P,M)=>yr(l,P,M));C(c),i(I(c))};V.useEffect(()=>{const l=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:u.CFRuleType.iconSet,isShowValue:m,config:h}}});return()=>{l()}},[m,h,t]),V.useEffect(()=>{const l=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(a).length===0}});return()=>{l()}},[m,h,t,a]);const p=()=>{const l=h.map(v=>({...v}));h.forEach((v,c)=>{const g=h.length-1-c,P=l[g];v.iconId=P.iconId,v.iconType=P.iconType}),C([...h])},o=$.useDependency($.ILayoutService),[s,f]=V.useState();return $.useScrollYOverContainer(s,o.rootContainerElement),R.jsxs("div",{children:[R.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),R.jsx("div",{className:"univer-mt-3",children:R.jsx(J.Dropdown,{overlay:R.jsx("div",{className:"univer-rounded-lg univer-p-4",children:R.jsx(Ln,{ref:l=>{!s&&l&&f(l)},iconType:d,onClick:T})}),children:R.jsxs("div",{className:J.clsx(`
27
+ univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center
28
+ univer-justify-between univer-rounded-md univer-border univer-border-solid
29
+ univer-border-gray-200 univer-bg-white univer-px-4 univer-py-2 univer-text-xs
30
+ univer-text-gray-600 univer-transition-all
31
+ hover:univer-border-primary-600
32
+ `),children:[E,R.jsx(pt,{})]})})}),R.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-text-xs",children:[R.jsxs("div",{className:"univer-flex univer-items-center univer-text-xs",children:[R.jsx(J.Checkbox,{onChange:p}),n.t("sheet.cf.iconSet.reverseIconOrder")]}),R.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[R.jsx(J.Checkbox,{checked:!m,onChange:l=>{b(!l)}}),n.t("sheet.cf.iconSet.onlyShowIcon")]})]}),R.jsx(Un,{errorMap:a,onChange:_,configList:h})]})},kn=e=>{var p;const{onChange:t,interceptorManager:r}=e,n=$.useDependency(w.LocaleService),a=((p=e.rule)==null?void 0:p.type)===u.CFRuleType.highlightCell?e.rule:void 0,i=[{label:n.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:n.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:n.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:n.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[d,S]=V.useState(()=>{const o=i[0].value,s=a==null?void 0:a.type;if(!a)return o;switch(s){case u.CFRuleType.highlightCell:switch(a.subType){case u.CFSubRuleType.average:return[u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual].includes(a.operator)?"greaterThanAverage":[u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(a.operator)?"lessThanAverage":o;case u.CFSubRuleType.rank:return a.isBottom?"isBottom":"isNotBottom"}}return o}),[h,C]=V.useState(()=>{const s=a==null?void 0:a.type;if(!a)return 10;switch(s){case u.CFRuleType.highlightCell:switch(a.subType){case u.CFSubRuleType.rank:return a.value||10}}return 10}),[m,b]=V.useState(()=>{const s=a==null?void 0:a.type;if(!a)return!1;switch(s){case u.CFRuleType.highlightCell:switch(a.subType){case u.CFSubRuleType.rank:return a.isPercent||!1}}return!1}),[E,I]=V.useState({}),_=o=>{const{type:s,isPercent:f,value:y,style:l}=o;if(s==="isNotBottom")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:f,isBottom:!1,value:y,style:l};if(s==="isBottom")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:f,isBottom:!0,value:y,style:l};if(s==="greaterThanAverage")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:u.CFNumberOperator.greaterThan,style:l};if(s==="lessThanAverage")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:u.CFNumberOperator.lessThan,style:l}};V.useEffect(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return _({type:d,isPercent:m,value:h,style:E})}}),[d,m,h,E,r]);const T=o=>{t(_(o))};return R.jsxs("div",{children:[R.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),R.jsx(J.Select,{className:"univer-mt-3 univer-w-full",value:d,options:i,onChange:o=>{S(o),T({type:o,isPercent:m,value:h,style:E})}}),["isNotBottom","isBottom"].includes(d)&&R.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[R.jsx(J.InputNumber,{min:1,max:1e3,value:h,onChange:o=>{const s=o||0;C(s),T({type:d,isPercent:m,value:s,style:E})}}),R.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center univer-text-xs",children:[R.jsx(J.Checkbox,{checked:m,onChange:o=>{b(!!o),T({type:d,isPercent:!!o,value:h,style:E})}}),n.t("sheet.cf.valueType.percent")]})]}),R.jsx("div",{className:Fe,children:R.jsx(Ne,{rule:_({type:d,isPercent:m,value:h,style:E})})}),R.jsx(qt,{style:a==null?void 0:a.style,className:"univer-mt-3",onChange:o=>{I(o),T({type:d,isPercent:m,value:h,style:o})}})]})},jn=w.createInterceptorKey("beforeSubmit"),An=w.createInterceptorKey("submit"),br=e=>e.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),Sr=e=>{var t;return(t=e.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId()},Hn=e=>{var c,g,P;const t=$.useDependency(w.LocaleService),r=$.useDependency(w.ICommandService),n=$.useDependency(w.IUniverInstanceService),a=$.useDependency(u.ConditionalFormattingRuleModel),i=$.useDependency(q.SheetsSelectionsService),d=br(n),S=Sr(n),[h,C]=V.useState(void 0),m=V.useRef((g=(c=e.rule)==null?void 0:c.ranges)!=null?g:[]),b=V.useMemo(()=>{var U,z,O;let M=(U=e.rule)==null?void 0:U.ranges;return M!=null&&M.length||(M=(O=(z=i.getCurrentSelections())==null?void 0:z.map(L=>L.range))!=null?O:[]),m.current=M,M!=null&&M.length?M.map(L=>{const W=Lt.serializeRange(L);return W==="NaN"?"":W}).filter(L=>!!L).join(","):""},[e.rule]),E=[{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"}],[I,_]=V.useState(()=>{var z,O;const M=(z=e.rule)==null?void 0:z.rule.type,U=E[0].value;if(!M)return U;switch(M){case u.CFRuleType.highlightCell:{switch((O=e.rule)==null?void 0:O.rule.subType){case u.CFSubRuleType.number:case u.CFSubRuleType.text:case u.CFSubRuleType.duplicateValues:case u.CFSubRuleType.uniqueValues:case u.CFSubRuleType.timePeriod:return"1";case u.CFSubRuleType.average:case u.CFSubRuleType.rank:return"2";case u.CFSubRuleType.formula:return"5"}break}case u.CFRuleType.dataBar:return"3";case u.CFRuleType.colorScale:return"4";case u.CFRuleType.iconSet:return"6"}return U}),T=V.useRef(void 0),p=V.useMemo(()=>new w.InterceptorManager({beforeSubmit:jn,submit:An}),[]),o=V.useMemo(()=>{switch(I){case"1":return gr;case"2":return kn;case"3":return Dn;case"4":return xn;case"5":return Pn;case"6":return zn;default:return gr}},[I]);V.useEffect(()=>{const M=r.onCommandExecuted(U=>{if(U.id===q.RemoveSheetMutation.id){const z=U.params;z.subUnitId===S&&z.unitId===d&&e.onCancel()}U.id===q.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>M.dispose()},[]);const s=M=>{T.current=M},f=M=>{const U=M.split(",").filter(z=>!!z).map(Lt.deserializeRangeWithSheet).map(z=>z.range);m.current=U},y=()=>{if(h)return;const U=(()=>{const O=n.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!O)throw new Error("No active sheet found");return m.current.map(F=>q.setEndForRange(F,O.getRowCount(),O.getColumnCount())).filter(F=>!(Number.isNaN(F.startRow)||Number.isNaN(F.startColumn)))})();if(p.fetchThroughInterceptors(p.getInterceptPoints().beforeSubmit)(!0,null)){const O=p.fetchThroughInterceptors(p.getInterceptPoints().submit)(null,null);if(O){const L=br(n),W=Sr(n);if(!L||!W)throw new Error("No active sheet found");let F={};e.rule&&e.rule.cfId?(F={...e.rule,ranges:U,rule:O},r.executeCommand(u.SetCfCommand.id,{unitId:L,subUnitId:W,rule:F}),e.onCancel()):(F={cfId:a.createCfId(L,W),ranges:U,rule:O,stopIfTrue:!1},r.executeCommand(u.AddCfCommand.id,{unitId:L,subUnitId:W,rule:F}),e.onCancel())}}},l=()=>{e.onCancel()},v=(M,U)=>{M?U.length<1?C(t.t("sheet.cf.errorMessage.rangeError")):C(void 0):C(t.t("sheet.cf.errorMessage.rangeError"))};return R.jsxs("div",{children:[R.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:t.t("sheet.cf.panel.range")}),R.jsxs("div",{className:"univer-mt-4",children:[R.jsx(He.RangeSelector,{unitId:d,subUnitId:S,initialValue:b,onChange:(M,U)=>f(U),onVerify:v}),h&&R.jsx("div",{className:"univer-mt-1 univer-text-xs univer-text-red-500",children:h})]}),R.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:t.t("sheet.cf.panel.styleType")}),R.jsx(J.Select,{className:"univer-mt-4 univer-w-full",value:I,options:E,onChange:M=>_(M)}),R.jsx(o,{interceptorManager:p,rule:(P=e.rule)==null?void 0:P.rule,onChange:s}),R.jsxs("div",{className:"univer-mt-4 univer-flex univer-justify-end",children:[R.jsx(J.Button,{onClick:l,children:t.t("sheet.cf.panel.cancel")}),R.jsx(J.Button,{className:"univer-ml-3",variant:"primary",onClick:y,children:t.t("sheet.cf.panel.submit")})]})]})};function Wn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Cr(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}),r}var Yt={exports:{}},Ge={},qe={exports:{}},Bn=qe.exports,Tr;function Xt(){return Tr||(Tr=1,function(e,t){(function(r,n){n(t)})(Bn,function(r){function n(H){return function(ie,x,D,N,k,B,A){return H(ie,x,A)}}function a(H){return function(ie,x,D,N){if(!ie||!x||typeof ie!="object"||typeof x!="object")return H(ie,x,D,N);var k=N.get(ie),B=N.get(x);if(k&&B)return k===x&&B===ie;N.set(ie,x),N.set(x,ie);var A=H(ie,x,D,N);return N.delete(ie),N.delete(x),A}}function i(H,K){var ie={};for(var x in H)ie[x]=H[x];for(var x in K)ie[x]=K[x];return ie}function d(H){return H.constructor===Object||H.constructor==null}function S(H){return typeof H.then=="function"}function h(H,K){return H===K||H!==H&&K!==K}var C="[object Arguments]",m="[object Boolean]",b="[object Date]",E="[object RegExp]",I="[object Map]",_="[object Number]",T="[object Object]",p="[object Set]",o="[object String]",s=Object.prototype.toString;function f(H){var K=H.areArraysEqual,ie=H.areDatesEqual,x=H.areMapsEqual,D=H.areObjectsEqual,N=H.areRegExpsEqual,k=H.areSetsEqual,B=H.createIsNestedEqual,A=B(Z);function Z(G,ee,ue){if(G===ee)return!0;if(!G||!ee||typeof G!="object"||typeof ee!="object")return G!==G&&ee!==ee;if(d(G)&&d(ee))return D(G,ee,A,ue);var De=Array.isArray(G),me=Array.isArray(ee);if(De||me)return De===me&&K(G,ee,A,ue);var he=s.call(G);return he!==s.call(ee)?!1:he===b?ie(G,ee,A,ue):he===E?N(G,ee,A,ue):he===I?x(G,ee,A,ue):he===p?k(G,ee,A,ue):he===T||he===C?S(G)||S(ee)?!1:D(G,ee,A,ue):he===m||he===_||he===o?h(G.valueOf(),ee.valueOf()):!1}return Z}function y(H,K,ie,x){var D=H.length;if(K.length!==D)return!1;for(;D-- >0;)if(!ie(H[D],K[D],D,D,H,K,x))return!1;return!0}var l=a(y);function v(H,K){return h(H.valueOf(),K.valueOf())}function c(H,K,ie,x){var D=H.size===K.size;if(!D)return!1;if(!H.size)return!0;var N={},k=0;return H.forEach(function(B,A){if(D){var Z=!1,G=0;K.forEach(function(ee,ue){!Z&&!N[G]&&(Z=ie(A,ue,k,G,H,K,x)&&ie(B,ee,A,ue,H,K,x))&&(N[G]=!0),G++}),k++,D=Z}}),D}var g=a(c),P="_owner",M=Object.prototype.hasOwnProperty;function U(H,K,ie,x){var D=Object.keys(H),N=D.length;if(Object.keys(K).length!==N)return!1;for(var k;N-- >0;){if(k=D[N],k===P){var B=!!H.$$typeof,A=!!K.$$typeof;if((B||A)&&B!==A)return!1}if(!M.call(K,k)||!ie(H[k],K[k],k,k,H,K,x))return!1}return!0}var z=a(U);function O(H,K){return H.source===K.source&&H.flags===K.flags}function L(H,K,ie,x){var D=H.size===K.size;if(!D)return!1;if(!H.size)return!0;var N={};return H.forEach(function(k,B){if(D){var A=!1,Z=0;K.forEach(function(G,ee){!A&&!N[Z]&&(A=ie(k,G,B,ee,H,K,x))&&(N[Z]=!0),Z++}),D=A}}),D}var W=a(L),F=Object.freeze({areArraysEqual:y,areDatesEqual:v,areMapsEqual:c,areObjectsEqual:U,areRegExpsEqual:O,areSetsEqual:L,createIsNestedEqual:n}),X=Object.freeze({areArraysEqual:l,areDatesEqual:v,areMapsEqual:g,areObjectsEqual:z,areRegExpsEqual:O,areSetsEqual:W,createIsNestedEqual:n}),ae=f(F);function ne(H,K){return ae(H,K,void 0)}var se=f(i(F,{createIsNestedEqual:function(){return h}}));function j(H,K){return se(H,K,void 0)}var Q=f(X);function te(H,K){return Q(H,K,new WeakMap)}var oe=f(i(X,{createIsNestedEqual:function(){return h}}));function ce(H,K){return oe(H,K,new WeakMap)}function pe(H){return f(i(F,H(F)))}function be(H){var K=f(i(X,H(X)));return function(ie,x,D){return D===void 0&&(D=new WeakMap),K(ie,x,D)}}r.circularDeepEqual=te,r.circularShallowEqual=ce,r.createCustomCircularEqual=be,r.createCustomEqual=pe,r.deepEqual=ne,r.sameValueZeroEqual=h,r.shallowEqual=j,Object.defineProperty(r,"__esModule",{value:!0})})}(qe,qe.exports)),qe.exports}var mt={exports:{}},wr;function Kt(){if(wr)return mt.exports;wr=1;function e(r){var n,a,i="";if(typeof r=="string"||typeof r=="number")i+=r;else if(typeof r=="object")if(Array.isArray(r)){var d=r.length;for(n=0;n<d;n++)r[n]&&(a=e(r[n]))&&(i&&(i+=" "),i+=a)}else for(a in r)r[a]&&(i&&(i+=" "),i+=a);return i}function t(){for(var r,n,a=0,i="",d=arguments.length;a<d;a++)(r=arguments[a])&&(n=e(r))&&(i&&(i+=" "),i+=n);return i}return mt.exports=t,mt.exports.clsx=t,mt.exports}var re={},Zt,_r;function Fn(){return _r||(_r=1,Zt=function(t,r,n){return t===r?!0:t.className===r.className&&n(t.style,r.style)&&t.width===r.width&&t.autoSize===r.autoSize&&t.cols===r.cols&&t.draggableCancel===r.draggableCancel&&t.draggableHandle===r.draggableHandle&&n(t.verticalCompact,r.verticalCompact)&&n(t.compactType,r.compactType)&&n(t.layout,r.layout)&&n(t.margin,r.margin)&&n(t.containerPadding,r.containerPadding)&&t.rowHeight===r.rowHeight&&t.maxRows===r.maxRows&&t.isBounded===r.isBounded&&t.isDraggable===r.isDraggable&&t.isResizable===r.isResizable&&t.allowOverlap===r.allowOverlap&&t.preventCollision===r.preventCollision&&t.useCSSTransforms===r.useCSSTransforms&&t.transformScale===r.transformScale&&t.isDroppable===r.isDroppable&&n(t.resizeHandles,r.resizeHandles)&&n(t.resizeHandle,r.resizeHandle)&&t.onLayoutChange===r.onLayoutChange&&t.onDragStart===r.onDragStart&&t.onDrag===r.onDrag&&t.onDragStop===r.onDragStop&&t.onResizeStart===r.onResizeStart&&t.onResize===r.onResize&&t.onResizeStop===r.onResizeStop&&t.onDrop===r.onDrop&&n(t.droppingItem,r.droppingItem)&&n(t.innerRef,r.innerRef)}),Zt}var Ir;function Ve(){if(Ir)return re;Ir=1,Object.defineProperty(re,"__esModule",{value:!0}),re.bottom=n,re.childrenEqual=h,re.cloneLayout=a,re.cloneLayoutItem=S,re.collides=m,re.compact=b,re.compactItem=_,re.compactType=H,re.correctBounds=T,re.fastPositionEqual=C,re.fastRGLPropsEqual=void 0,re.getAllCollisions=s,re.getFirstCollision=o,re.getLayoutItem=p,re.getStatics=f,re.modifyLayout=i,re.moveElement=y,re.moveElementAwayFromCollision=l,re.noop=void 0,re.perc=v,re.resizeItemInDirection=se,re.setTopLeft=Q,re.setTransform=j,re.sortLayoutItems=te,re.sortLayoutItemsByColRow=ce,re.sortLayoutItemsByRowCol=oe,re.synchronizeLayoutWithChildren=pe,re.validateLayout=be,re.withLayoutItem=d;var e=Xt(),t=r(V);function r(x){return x&&x.__esModule?x:{default:x}}function n(x){let D=0,N;for(let k=0,B=x.length;k<B;k++)N=x[k].y+x[k].h,N>D&&(D=N);return D}function a(x){const D=Array(x.length);for(let N=0,k=x.length;N<k;N++)D[N]=S(x[N]);return D}function i(x,D){const N=Array(x.length);for(let k=0,B=x.length;k<B;k++)D.i===x[k].i?N[k]=D:N[k]=x[k];return N}function d(x,D,N){let k=p(x,D);return k?(k=N(S(k)),x=i(x,k),[x,k]):[x,null]}function S(x){return{w:x.w,h:x.h,x:x.x,y:x.y,i:x.i,minW:x.minW,maxW:x.maxW,minH:x.minH,maxH:x.maxH,moved:!!x.moved,static:!!x.static,isDraggable:x.isDraggable,isResizable:x.isResizable,resizeHandles:x.resizeHandles,isBounded:x.isBounded}}function h(x,D){return(0,e.deepEqual)(t.default.Children.map(x,N=>N==null?void 0:N.key),t.default.Children.map(D,N=>N==null?void 0:N.key))&&(0,e.deepEqual)(t.default.Children.map(x,N=>N==null?void 0:N.props["data-grid"]),t.default.Children.map(D,N=>N==null?void 0:N.props["data-grid"]))}re.fastRGLPropsEqual=Fn();function C(x,D){return x.left===D.left&&x.top===D.top&&x.width===D.width&&x.height===D.height}function m(x,D){return!(x.i===D.i||x.x+x.w<=D.x||x.x>=D.x+D.w||x.y+x.h<=D.y||x.y>=D.y+D.h)}function b(x,D,N,k){const B=f(x),A=te(x,D),Z=Array(x.length);for(let G=0,ee=A.length;G<ee;G++){let ue=S(A[G]);ue.static||(ue=_(B,ue,D,N,A,k),B.push(ue)),Z[x.indexOf(A[G])]=ue,ue.moved=!1}return Z}const E={x:"w",y:"h"};function I(x,D,N,k){const B=E[k];D[k]+=1;const A=x.map(Z=>Z.i).indexOf(D.i);for(let Z=A+1;Z<x.length;Z++){const G=x[Z];if(!G.static){if(G.y>D.y+D.h)break;m(D,G)&&I(x,G,N+D[B],k)}}D[k]=N}function _(x,D,N,k,B,A){const Z=N==="vertical",G=N==="horizontal";if(Z)for(D.y=Math.min(n(x),D.y);D.y>0&&!o(x,D);)D.y--;else if(G)for(;D.x>0&&!o(x,D);)D.x--;let ee;for(;(ee=o(x,D))&&!(N===null&&A);)if(G?I(B,D,ee.x+ee.w,"x"):I(B,D,ee.y+ee.h,"y"),G&&D.x+D.w>k)for(D.x=k-D.w,D.y++;D.x>0&&!o(x,D);)D.x--;return D.y=Math.max(D.y,0),D.x=Math.max(D.x,0),D}function T(x,D){const N=f(x);for(let k=0,B=x.length;k<B;k++){const A=x[k];if(A.x+A.w>D.cols&&(A.x=D.cols-A.w),A.x<0&&(A.x=0,A.w=D.cols),!A.static)N.push(A);else for(;o(N,A);)A.y++}return x}function p(x,D){for(let N=0,k=x.length;N<k;N++)if(x[N].i===D)return x[N]}function o(x,D){for(let N=0,k=x.length;N<k;N++)if(m(x[N],D))return x[N]}function s(x,D){return x.filter(N=>m(N,D))}function f(x){return x.filter(D=>D.static)}function y(x,D,N,k,B,A,Z,G,ee){if(D.static&&D.isDraggable!==!0||D.y===k&&D.x===N)return x;`${D.i}${String(N)}${String(k)}${D.x}${D.y}`;const ue=D.x,De=D.y;typeof N=="number"&&(D.x=N),typeof k=="number"&&(D.y=k),D.moved=!0;let me=te(x,Z);(Z==="vertical"&&typeof k=="number"?De>=k:Z==="horizontal"&&typeof N=="number"?ue>=N:!1)&&(me=me.reverse());const Ae=s(me,D),Nt=Ae.length>0;if(Nt&&ee)return a(x);if(Nt&&A)return`${D.i}`,D.x=ue,D.y=De,D.moved=!1,x;for(let ur=0,ci=Ae.length;ur<ci;ur++){const Pe=Ae[ur];`${D.i}${D.x}${D.y}${Pe.i}${Pe.x}${Pe.y}`,!Pe.moved&&(Pe.static?x=l(x,Pe,D,B,Z):x=l(x,D,Pe,B,Z))}return x}function l(x,D,N,k,B,A){const Z=B==="horizontal",G=B==="vertical",ee=D.static;if(k){k=!1;const me={x:Z?Math.max(D.x-N.w,0):N.x,y:G?Math.max(D.y-N.h,0):N.y,w:N.w,h:N.h,i:"-1"},he=o(x,me),Ae=he&&he.y+he.h>D.y,Nt=he&&D.x+D.w>he.x;if(he){if(Ae&&G)return y(x,N,void 0,D.y+1,k,ee,B);if(Ae&&B==null)return D.y=N.y,N.y=N.y+N.h,x;if(Nt&&Z)return y(x,D,N.x,void 0,k,ee,B)}else return`${N.i}${me.x}${me.y}`,y(x,N,Z?me.x:void 0,G?me.y:void 0,k,ee,B)}const ue=Z?N.x+1:void 0,De=G?N.y+1:void 0;return ue==null&&De==null?x:y(x,N,Z?N.x+1:void 0,G?N.y+1:void 0,k,ee,B)}function v(x){return x*100+"%"}const c=(x,D,N,k)=>x+N>k?D:N,g=(x,D,N)=>x<0?D:N,P=x=>Math.max(0,x),M=x=>Math.max(0,x),U=(x,D,N)=>{let{left:k,height:B,width:A}=D;const Z=x.top-(B-x.height);return{left:k,width:A,height:g(Z,x.height,B),top:M(Z)}},z=(x,D,N)=>{let{top:k,left:B,height:A,width:Z}=D;return{top:k,height:A,width:c(x.left,x.width,Z,N),left:P(B)}},O=(x,D,N)=>{let{top:k,height:B,width:A}=D;const Z=x.left-(A-x.width);return{height:B,width:Z<0?x.width:c(x.left,x.width,A,N),top:M(k),left:P(Z)}},L=(x,D,N)=>{let{top:k,left:B,height:A,width:Z}=D;return{width:Z,left:B,height:g(k,x.height,A),top:M(k)}},ne={n:U,ne:function(){return U(arguments.length<=0?void 0:arguments[0],z(...arguments))},e:z,se:function(){return L(arguments.length<=0?void 0:arguments[0],z(...arguments))},s:L,sw:function(){return L(arguments.length<=0?void 0:arguments[0],O(...arguments))},w:O,nw:function(){return U(arguments.length<=0?void 0:arguments[0],O(...arguments))}};function se(x,D,N,k){const B=ne[x];return B?B(D,{...D,...N},k):N}function j(x){let{top:D,left:N,width:k,height:B}=x;const A=`translate(${N}px,${D}px)`;return{transform:A,WebkitTransform:A,MozTransform:A,msTransform:A,OTransform:A,width:`${k}px`,height:`${B}px`,position:"absolute"}}function Q(x){let{top:D,left:N,width:k,height:B}=x;return{top:`${D}px`,left:`${N}px`,width:`${k}px`,height:`${B}px`,position:"absolute"}}function te(x,D){return D==="horizontal"?ce(x):D==="vertical"?oe(x):x}function oe(x){return x.slice(0).sort(function(D,N){return D.y>N.y||D.y===N.y&&D.x>N.x?1:D.y===N.y&&D.x===N.x?0:-1})}function ce(x){return x.slice(0).sort(function(D,N){return D.x>N.x||D.x===N.x&&D.y>N.y?1:-1})}function pe(x,D,N,k,B){x=x||[];const A=[];t.default.Children.forEach(D,G=>{if((G==null?void 0:G.key)==null)return;const ee=p(x,String(G.key)),ue=G.props["data-grid"];ee&&ue==null?A.push(S(ee)):ue?A.push(S({...ue,i:G.key})):A.push(S({w:1,h:1,x:0,y:n(A),i:String(G.key)}))});const Z=T(A,{cols:N});return B?Z:b(Z,k,N)}function be(x){let D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const N=["x","y","w","h"];if(!Array.isArray(x))throw new Error(D+" must be an array!");for(let k=0,B=x.length;k<B;k++){const A=x[k];for(let Z=0;Z<N.length;Z++){const G=N[Z],ee=A[G];if(typeof ee!="number"||Number.isNaN(ee))throw new Error(`ReactGridLayout: ${D}[${k}].${G} must be a number! Received: ${ee} (${typeof ee})`)}if(typeof A.i<"u"&&typeof A.i!="string")throw new Error(`ReactGridLayout: ${D}[${k}].i must be a string! Received: ${A.i} (${typeof A.i})`)}}function H(x){const{verticalCompact:D,compactType:N}=x||{};return D===!1?null:N}function K(){}const ie=()=>{};return re.noop=ie,re}var Ce={},Rr;function Jt(){if(Rr)return Ce;Rr=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.calcGridColWidth=e,Ce.calcGridItemPosition=r,Ce.calcGridItemWHPx=t,Ce.calcWH=a,Ce.calcXY=n,Ce.clamp=i;function e(d){const{margin:S,containerPadding:h,containerWidth:C,cols:m}=d;return(C-S[0]*(m-1)-h[0]*2)/m}function t(d,S,h){return Number.isFinite(d)?Math.round(S*d+Math.max(0,d-1)*h):d}function r(d,S,h,C,m,b){const{margin:E,containerPadding:I,rowHeight:_}=d,T=e(d),p={};return b&&b.resizing?(p.width=Math.round(b.resizing.width),p.height=Math.round(b.resizing.height)):(p.width=t(C,T,E[0]),p.height=t(m,_,E[1])),b&&b.dragging?(p.top=Math.round(b.dragging.top),p.left=Math.round(b.dragging.left)):b&&b.resizing&&typeof b.resizing.top=="number"&&typeof b.resizing.left=="number"?(p.top=Math.round(b.resizing.top),p.left=Math.round(b.resizing.left)):(p.top=Math.round((_+E[1])*h+I[1]),p.left=Math.round((T+E[0])*S+I[0])),p}function n(d,S,h,C,m){const{margin:b,containerPadding:E,cols:I,rowHeight:_,maxRows:T}=d,p=e(d);let o=Math.round((h-E[0])/(p+b[0])),s=Math.round((S-E[1])/(_+b[1]));return o=i(o,0,I-C),s=i(s,0,T-m),{x:o,y:s}}function a(d,S,h,C,m,b){const{margin:E,maxRows:I,cols:_,rowHeight:T}=d,p=e(d);let o=Math.round((S+E[0])/(p+E[0])),s=Math.round((h+E[1])/(T+E[1])),f=i(o,0,_-C),y=i(s,0,I-m);return["sw","w","nw"].indexOf(b)!==-1&&(f=i(o,0,_)),["nw","n","ne"].indexOf(b)!==-1&&(y=i(s,0,I)),{w:f,h:y}}function i(d,S,h){return Math.max(Math.min(d,h),S)}return Ce}var Ye={},Qt={exports:{}},$t,Er;function Gn(){if(Er)return $t;Er=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return $t=e,$t}var er,Or;function qn(){if(Or)return er;Or=1;var e=Gn();function t(){}function r(){}return r.resetWarningCache=t,er=function(){function n(d,S,h,C,m,b){if(b!==e){var E=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 E.name="Invariant Violation",E}}n.isRequired=n;function a(){return n}var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:a,element:n,elementType:n,instanceOf:a,node:n,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i},er}var xr;function we(){return xr||(xr=1,Qt.exports=qn()()),Qt.exports}var Xe={exports:{}},tr={};function Dr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Dr(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Pr(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Dr(e))&&(n&&(n+=" "),n+=t);return n}const Yn=Cr(Object.freeze(Object.defineProperty({__proto__:null,clsx:Pr,default:Pr},Symbol.toStringTag,{value:"Module"})));var fe={},_e={},Mr;function yt(){if(Mr)return _e;Mr=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.dontSetMe=a,_e.findInArray=e,_e.int=n,_e.isFunction=t,_e.isNum=r;function e(i,d){for(let S=0,h=i.length;S<h;S++)if(d.apply(d,[i[S],S,i]))return i[S]}function t(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Function]"}function r(i){return typeof i=="number"&&!isNaN(i)}function n(i){return parseInt(i,10)}function a(i,d,S){if(i[d])return new Error("Invalid prop ".concat(d," passed to ").concat(S," - do not set this, set it on the child."))}return _e}var Ie={},Nr;function Xn(){if(Nr)return Ie;Nr=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.browserPrefixToKey=r,Ie.browserPrefixToStyle=n,Ie.default=void 0,Ie.getPrefix=t;const e=["Moz","Webkit","O","ms"];function t(){var i;let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const S=(i=window.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.style;if(!S||d in S)return"";for(let h=0;h<e.length;h++)if(r(d,e[h])in S)return e[h];return""}function r(i,d){return d?"".concat(d).concat(a(i)):i}function n(i,d){return d?"-".concat(d.toLowerCase(),"-").concat(i):i}function a(i){let d="",S=!0;for(let h=0;h<i.length;h++)S?(d+=i[h].toUpperCase(),S=!1):i[h]==="-"?S=!0:d+=i[h];return d}return Ie.default=t(),Ie}var Lr;function rr(){if(Lr)return fe;Lr=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.addClassName=l,fe.addEvent=S,fe.addUserSelectStyles=f,fe.createCSSTransform=_,fe.createSVGTransform=T,fe.getTouch=o,fe.getTouchIdentifier=s,fe.getTranslation=p,fe.innerHeight=b,fe.innerWidth=E,fe.matchesSelector=i,fe.matchesSelectorAndParentsTo=d,fe.offsetXYFromParent=I,fe.outerHeight=C,fe.outerWidth=m,fe.removeClassName=v,fe.removeEvent=h,fe.removeUserSelectStyles=y;var e=yt(),t=n(Xn());function r(c){if(typeof WeakMap!="function")return null;var g=new WeakMap,P=new WeakMap;return(r=function(M){return M?P:g})(c)}function n(c,g){if(c&&c.__esModule)return c;if(c===null||typeof c!="object"&&typeof c!="function")return{default:c};var P=r(g);if(P&&P.has(c))return P.get(c);var M={},U=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var z in c)if(z!=="default"&&Object.prototype.hasOwnProperty.call(c,z)){var O=U?Object.getOwnPropertyDescriptor(c,z):null;O&&(O.get||O.set)?Object.defineProperty(M,z,O):M[z]=c[z]}return M.default=c,P&&P.set(c,M),M}let a="";function i(c,g){return a||(a=(0,e.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(P){return(0,e.isFunction)(c[P])})),(0,e.isFunction)(c[a])?c[a](g):!1}function d(c,g,P){let M=c;do{if(i(M,g))return!0;if(M===P)return!1;M=M.parentNode}while(M);return!1}function S(c,g,P,M){if(!c)return;const U={capture:!0,...M};c.addEventListener?c.addEventListener(g,P,U):c.attachEvent?c.attachEvent("on"+g,P):c["on"+g]=P}function h(c,g,P,M){if(!c)return;const U={capture:!0,...M};c.removeEventListener?c.removeEventListener(g,P,U):c.detachEvent?c.detachEvent("on"+g,P):c["on"+g]=null}function C(c){let g=c.clientHeight;const P=c.ownerDocument.defaultView.getComputedStyle(c);return g+=(0,e.int)(P.borderTopWidth),g+=(0,e.int)(P.borderBottomWidth),g}function m(c){let g=c.clientWidth;const P=c.ownerDocument.defaultView.getComputedStyle(c);return g+=(0,e.int)(P.borderLeftWidth),g+=(0,e.int)(P.borderRightWidth),g}function b(c){let g=c.clientHeight;const P=c.ownerDocument.defaultView.getComputedStyle(c);return g-=(0,e.int)(P.paddingTop),g-=(0,e.int)(P.paddingBottom),g}function E(c){let g=c.clientWidth;const P=c.ownerDocument.defaultView.getComputedStyle(c);return g-=(0,e.int)(P.paddingLeft),g-=(0,e.int)(P.paddingRight),g}function I(c,g,P){const U=g===g.ownerDocument.body?{left:0,top:0}:g.getBoundingClientRect(),z=(c.clientX+g.scrollLeft-U.left)/P,O=(c.clientY+g.scrollTop-U.top)/P;return{x:z,y:O}}function _(c,g){const P=p(c,g,"px");return{[(0,t.browserPrefixToKey)("transform",t.default)]:P}}function T(c,g){return p(c,g,"")}function p(c,g,P){let{x:M,y:U}=c,z="translate(".concat(M).concat(P,",").concat(U).concat(P,")");if(g){const O="".concat(typeof g.x=="string"?g.x:g.x+P),L="".concat(typeof g.y=="string"?g.y:g.y+P);z="translate(".concat(O,", ").concat(L,")")+z}return z}function o(c,g){return c.targetTouches&&(0,e.findInArray)(c.targetTouches,P=>g===P.identifier)||c.changedTouches&&(0,e.findInArray)(c.changedTouches,P=>g===P.identifier)}function s(c){if(c.targetTouches&&c.targetTouches[0])return c.targetTouches[0].identifier;if(c.changedTouches&&c.changedTouches[0])return c.changedTouches[0].identifier}function f(c){if(!c)return;let g=c.getElementById("react-draggable-style-el");g||(g=c.createElement("style"),g.type="text/css",g.id="react-draggable-style-el",g.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
33
+ `,g.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
34
+ `,c.getElementsByTagName("head")[0].appendChild(g)),c.body&&l(c.body,"react-draggable-transparent-selection")}function y(c){if(c)try{if(c.body&&v(c.body,"react-draggable-transparent-selection"),c.selection)c.selection.empty();else{const g=(c.defaultView||window).getSelection();g&&g.type!=="Caret"&&g.removeAllRanges()}}catch{}}function l(c,g){c.classList?c.classList.add(g):c.className.match(new RegExp("(?:^|\\s)".concat(g,"(?!\\S)")))||(c.className+=" ".concat(g))}function v(c,g){c.classList?c.classList.remove(g):c.className=c.className.replace(new RegExp("(?:^|\\s)".concat(g,"(?!\\S)"),"g"),"")}return fe}var Se={},Vr;function Ur(){if(Vr)return Se;Vr=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.canDragX=a,Se.canDragY=i,Se.createCoreData=S,Se.createDraggableData=h,Se.getBoundPosition=r,Se.getControlPosition=d,Se.snapToGrid=n;var e=yt(),t=rr();function r(b,E,I){if(!b.props.bounds)return[E,I];let{bounds:_}=b.props;_=typeof _=="string"?_:C(_);const T=m(b);if(typeof _=="string"){const{ownerDocument:p}=T,o=p.defaultView;let s;if(_==="parent"?s=T.parentNode:s=p.querySelector(_),!(s instanceof o.HTMLElement))throw new Error('Bounds selector "'+_+'" could not find an element.');const f=s,y=o.getComputedStyle(T),l=o.getComputedStyle(f);_={left:-T.offsetLeft+(0,e.int)(l.paddingLeft)+(0,e.int)(y.marginLeft),top:-T.offsetTop+(0,e.int)(l.paddingTop)+(0,e.int)(y.marginTop),right:(0,t.innerWidth)(f)-(0,t.outerWidth)(T)-T.offsetLeft+(0,e.int)(l.paddingRight)-(0,e.int)(y.marginRight),bottom:(0,t.innerHeight)(f)-(0,t.outerHeight)(T)-T.offsetTop+(0,e.int)(l.paddingBottom)-(0,e.int)(y.marginBottom)}}return(0,e.isNum)(_.right)&&(E=Math.min(E,_.right)),(0,e.isNum)(_.bottom)&&(I=Math.min(I,_.bottom)),(0,e.isNum)(_.left)&&(E=Math.max(E,_.left)),(0,e.isNum)(_.top)&&(I=Math.max(I,_.top)),[E,I]}function n(b,E,I){const _=Math.round(E/b[0])*b[0],T=Math.round(I/b[1])*b[1];return[_,T]}function a(b){return b.props.axis==="both"||b.props.axis==="x"}function i(b){return b.props.axis==="both"||b.props.axis==="y"}function d(b,E,I){const _=typeof E=="number"?(0,t.getTouch)(b,E):null;if(typeof E=="number"&&!_)return null;const T=m(I),p=I.props.offsetParent||T.offsetParent||T.ownerDocument.body;return(0,t.offsetXYFromParent)(_||b,p,I.props.scale)}function S(b,E,I){const _=!(0,e.isNum)(b.lastX),T=m(b);return _?{node:T,deltaX:0,deltaY:0,lastX:E,lastY:I,x:E,y:I}:{node:T,deltaX:E-b.lastX,deltaY:I-b.lastY,lastX:b.lastX,lastY:b.lastY,x:E,y:I}}function h(b,E){const I=b.props.scale;return{node:E.node,x:b.state.x+E.deltaX/I,y:b.state.y+E.deltaY/I,deltaX:E.deltaX/I,deltaY:E.deltaY/I,lastX:b.state.x,lastY:b.state.y}}function C(b){return{left:b.left,top:b.top,right:b.right,bottom:b.bottom}}function m(b){const E=b.findDOMNode();if(!E)throw new Error("<DraggableCore>: Unmounted during event!");return E}return Se}var Ke={},bt={},zr;function kr(){if(zr)return bt;zr=1,Object.defineProperty(bt,"__esModule",{value:!0}),bt.default=e;function e(){}return bt}var jr;function Kn(){if(jr)return Ke;jr=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.default=void 0;var e=C(V),t=S(we()),r=S(Vt),n=rr(),a=Ur(),i=yt(),d=S(kr());function S(p){return p&&p.__esModule?p:{default:p}}function h(p){if(typeof WeakMap!="function")return null;var o=new WeakMap,s=new WeakMap;return(h=function(f){return f?s:o})(p)}function C(p,o){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var s=h(o);if(s&&s.has(p))return s.get(p);var f={},y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in p)if(l!=="default"&&Object.prototype.hasOwnProperty.call(p,l)){var v=y?Object.getOwnPropertyDescriptor(p,l):null;v&&(v.get||v.set)?Object.defineProperty(f,l,v):f[l]=p[l]}return f.default=p,s&&s.set(p,f),f}function m(p,o,s){return o=b(o),o in p?Object.defineProperty(p,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):p[o]=s,p}function b(p){var o=E(p,"string");return typeof o=="symbol"?o:String(o)}function E(p,o){if(typeof p!="object"||p===null)return p;var s=p[Symbol.toPrimitive];if(s!==void 0){var f=s.call(p,o);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(p)}const I={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let _=I.mouse,T=class extends e.Component{constructor(){super(...arguments),m(this,"dragging",!1),m(this,"lastX",NaN),m(this,"lastY",NaN),m(this,"touchIdentifier",null),m(this,"mounted",!1),m(this,"handleDragStart",o=>{if(this.props.onMouseDown(o),!this.props.allowAnyClick&&typeof o.button=="number"&&o.button!==0)return!1;const s=this.findDOMNode();if(!s||!s.ownerDocument||!s.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:f}=s;if(this.props.disabled||!(o.target instanceof f.defaultView.Node)||this.props.handle&&!(0,n.matchesSelectorAndParentsTo)(o.target,this.props.handle,s)||this.props.cancel&&(0,n.matchesSelectorAndParentsTo)(o.target,this.props.cancel,s))return;o.type==="touchstart"&&o.preventDefault();const y=(0,n.getTouchIdentifier)(o);this.touchIdentifier=y;const l=(0,a.getControlPosition)(o,y,this);if(l==null)return;const{x:v,y:c}=l,g=(0,a.createCoreData)(this,v,c);(0,d.default)("DraggableCore: handleDragStart: %j",g),(0,d.default)("calling",this.props.onStart),!(this.props.onStart(o,g)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,n.addUserSelectStyles)(f),this.dragging=!0,this.lastX=v,this.lastY=c,(0,n.addEvent)(f,_.move,this.handleDrag),(0,n.addEvent)(f,_.stop,this.handleDragStop))}),m(this,"handleDrag",o=>{const s=(0,a.getControlPosition)(o,this.touchIdentifier,this);if(s==null)return;let{x:f,y}=s;if(Array.isArray(this.props.grid)){let c=f-this.lastX,g=y-this.lastY;if([c,g]=(0,a.snapToGrid)(this.props.grid,c,g),!c&&!g)return;f=this.lastX+c,y=this.lastY+g}const l=(0,a.createCoreData)(this,f,y);if((0,d.default)("DraggableCore: handleDrag: %j",l),this.props.onDrag(o,l)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const g=document.createEvent("MouseEvents");g.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(g)}return}this.lastX=f,this.lastY=y}),m(this,"handleDragStop",o=>{if(!this.dragging)return;const s=(0,a.getControlPosition)(o,this.touchIdentifier,this);if(s==null)return;let{x:f,y}=s;if(Array.isArray(this.props.grid)){let g=f-this.lastX||0,P=y-this.lastY||0;[g,P]=(0,a.snapToGrid)(this.props.grid,g,P),f=this.lastX+g,y=this.lastY+P}const l=(0,a.createCoreData)(this,f,y);if(this.props.onStop(o,l)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(c.ownerDocument),(0,d.default)("DraggableCore: handleDragStop: %j",l),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,d.default)("DraggableCore: Removing handlers"),(0,n.removeEvent)(c.ownerDocument,_.move,this.handleDrag),(0,n.removeEvent)(c.ownerDocument,_.stop,this.handleDragStop))}),m(this,"onMouseDown",o=>(_=I.mouse,this.handleDragStart(o))),m(this,"onMouseUp",o=>(_=I.mouse,this.handleDragStop(o))),m(this,"onTouchStart",o=>(_=I.touch,this.handleDragStart(o))),m(this,"onTouchEnd",o=>(_=I.touch,this.handleDragStop(o)))}componentDidMount(){this.mounted=!0;const o=this.findDOMNode();o&&(0,n.addEvent)(o,I.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const o=this.findDOMNode();if(o){const{ownerDocument:s}=o;(0,n.removeEvent)(s,I.mouse.move,this.handleDrag),(0,n.removeEvent)(s,I.touch.move,this.handleDrag),(0,n.removeEvent)(s,I.mouse.stop,this.handleDragStop),(0,n.removeEvent)(s,I.touch.stop,this.handleDragStop),(0,n.removeEvent)(o,I.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(s)}}findDOMNode(){var o,s;return(o=this.props)!==null&&o!==void 0&&o.nodeRef?(s=this.props)===null||s===void 0||(s=s.nodeRef)===null||s===void 0?void 0:s.current:r.default.findDOMNode(this)}render(){return e.cloneElement(e.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return Ke.default=T,m(T,"displayName","DraggableCore"),m(T,"propTypes",{allowAnyClick:t.default.bool,children:t.default.node.isRequired,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:function(p,o){if(p[o]&&p[o].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:t.default.arrayOf(t.default.number),handle:t.default.string,cancel:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number,className:i.dontSetMe,style:i.dontSetMe,transform:i.dontSetMe}),m(T,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Ke}var Ar;function Zn(){return Ar||(Ar=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return h.default}}),e.default=void 0;var t=E(V),r=m(we()),n=m(Vt),a=m(Yn),i=rr(),d=Ur(),S=yt(),h=m(Kn()),C=m(kr());function m(s){return s&&s.__esModule?s:{default:s}}function b(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,y=new WeakMap;return(b=function(l){return l?y:f})(s)}function E(s,f){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var y=b(f);if(y&&y.has(s))return y.get(s);var l={},v=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in s)if(c!=="default"&&Object.prototype.hasOwnProperty.call(s,c)){var g=v?Object.getOwnPropertyDescriptor(s,c):null;g&&(g.get||g.set)?Object.defineProperty(l,c,g):l[c]=s[c]}return l.default=s,y&&y.set(s,l),l}function I(){return I=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var y=arguments[f];for(var l in y)Object.prototype.hasOwnProperty.call(y,l)&&(s[l]=y[l])}return s},I.apply(this,arguments)}function _(s,f,y){return f=T(f),f in s?Object.defineProperty(s,f,{value:y,enumerable:!0,configurable:!0,writable:!0}):s[f]=y,s}function T(s){var f=p(s,"string");return typeof f=="symbol"?f:String(f)}function p(s,f){if(typeof s!="object"||s===null)return s;var y=s[Symbol.toPrimitive];if(y!==void 0){var l=y.call(s,f);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(s)}class o extends t.Component{static getDerivedStateFromProps(f,y){let{position:l}=f,{prevPropsPosition:v}=y;return l&&(!v||l.x!==v.x||l.y!==v.y)?((0,C.default)("Draggable: getDerivedStateFromProps %j",{position:l,prevPropsPosition:v}),{x:l.x,y:l.y,prevPropsPosition:{...l}}):null}constructor(f){super(f),_(this,"onDragStart",(y,l)=>{if((0,C.default)("Draggable: onDragStart: %j",l),this.props.onStart(y,(0,d.createDraggableData)(this,l))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),_(this,"onDrag",(y,l)=>{if(!this.state.dragging)return!1;(0,C.default)("Draggable: onDrag: %j",l);const v=(0,d.createDraggableData)(this,l),c={x:v.x,y:v.y,slackX:0,slackY:0};if(this.props.bounds){const{x:P,y:M}=c;c.x+=this.state.slackX,c.y+=this.state.slackY;const[U,z]=(0,d.getBoundPosition)(this,c.x,c.y);c.x=U,c.y=z,c.slackX=this.state.slackX+(P-c.x),c.slackY=this.state.slackY+(M-c.y),v.x=c.x,v.y=c.y,v.deltaX=c.x-this.state.x,v.deltaY=c.y-this.state.y}if(this.props.onDrag(y,v)===!1)return!1;this.setState(c)}),_(this,"onDragStop",(y,l)=>{if(!this.state.dragging||this.props.onStop(y,(0,d.createDraggableData)(this,l))===!1)return!1;(0,C.default)("Draggable: onDragStop: %j",l);const c={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:P,y:M}=this.props.position;c.x=P,c.y=M}this.setState(c)}),this.state={dragging:!1,dragged:!1,x:f.position?f.position.x:f.defaultPosition.x,y:f.position?f.position.y:f.defaultPosition.y,prevPropsPosition:{...f.position},slackX:0,slackY:0,isElementSVG:!1},f.position&&!(f.onDrag||f.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 f,y;return(f=(y=this.props)===null||y===void 0||(y=y.nodeRef)===null||y===void 0?void 0:y.current)!==null&&f!==void 0?f:n.default.findDOMNode(this)}render(){const{axis:f,bounds:y,children:l,defaultPosition:v,defaultClassName:c,defaultClassNameDragging:g,defaultClassNameDragged:P,position:M,positionOffset:U,scale:z,...O}=this.props;let L={},W=null;const X=!!!M||this.state.dragging,ae=M||v,ne={x:(0,d.canDragX)(this)&&X?this.state.x:ae.x,y:(0,d.canDragY)(this)&&X?this.state.y:ae.y};this.state.isElementSVG?W=(0,i.createSVGTransform)(ne,U):L=(0,i.createCSSTransform)(ne,U);const se=(0,a.default)(l.props.className||"",c,{[g]:this.state.dragging,[P]:this.state.dragged});return t.createElement(h.default,I({},O,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(l),{className:se,style:{...l.props.style,...L},transform:W}))}}e.default=o,_(o,"displayName","Draggable"),_(o,"propTypes",{...h.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:S.dontSetMe,style:S.dontSetMe,transform:S.dontSetMe}),_(o,"defaultProps",{...h.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(tr)),tr}var Hr;function nr(){if(Hr)return Xe.exports;Hr=1;const{default:e,DraggableCore:t}=Zn();return Xe.exports=e,Xe.exports.default=e,Xe.exports.DraggableCore=t,Xe.exports}var Ze={exports:{}},Je={},St={},Wr;function Jn(){if(Wr)return St;Wr=1,St.__esModule=!0,St.cloneElement=S;var e=t(V);function t(h){return h&&h.__esModule?h:{default:h}}function r(h,C){var m=Object.keys(h);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(h);C&&(b=b.filter(function(E){return Object.getOwnPropertyDescriptor(h,E).enumerable})),m.push.apply(m,b)}return m}function n(h){for(var C=1;C<arguments.length;C++){var m=arguments[C]!=null?arguments[C]:{};C%2?r(Object(m),!0).forEach(function(b){a(h,b,m[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(m)):r(Object(m)).forEach(function(b){Object.defineProperty(h,b,Object.getOwnPropertyDescriptor(m,b))})}return h}function a(h,C,m){return C=i(C),C in h?Object.defineProperty(h,C,{value:m,enumerable:!0,configurable:!0,writable:!0}):h[C]=m,h}function i(h){var C=d(h,"string");return typeof C=="symbol"?C:String(C)}function d(h,C){if(typeof h!="object"||h===null)return h;var m=h[Symbol.toPrimitive];if(m!==void 0){var b=m.call(h,C);if(typeof b!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(h)}function S(h,C){return C.style&&h.props.style&&(C.style=n(n({},h.props.style),C.style)),C.className&&h.props.className&&(C.className=h.props.className+" "+C.className),e.default.cloneElement(h,C)}return St}var Qe={},Br;function Fr(){if(Br)return Qe;Br=1,Qe.__esModule=!0,Qe.resizableProps=void 0;var e=t(we());nr();function t(n){return n&&n.__esModule?n:{default:n}}var r={axis:e.default.oneOf(["both","x","y","none"]),className:e.default.string,children:e.default.element.isRequired,draggableOpts:e.default.shape({allowAnyClick:e.default.bool,cancel:e.default.string,children:e.default.node,disabled:e.default.bool,enableUserSelectHack:e.default.bool,offsetParent:e.default.node,grid:e.default.arrayOf(e.default.number),handle:e.default.string,nodeRef:e.default.object,onStart:e.default.func,onDrag:e.default.func,onStop:e.default.func,onMouseDown:e.default.func,scale:e.default.number}),height:function(){for(var a=arguments.length,i=new Array(a),d=0;d<a;d++)i[d]=arguments[d];var S=i[0];if(S.axis==="both"||S.axis==="y"){var h;return(h=e.default.number).isRequired.apply(h,i)}return e.default.number.apply(e.default,i)},handle:e.default.oneOfType([e.default.node,e.default.func]),handleSize:e.default.arrayOf(e.default.number),lockAspectRatio:e.default.bool,maxConstraints:e.default.arrayOf(e.default.number),minConstraints:e.default.arrayOf(e.default.number),onResizeStop:e.default.func,onResizeStart:e.default.func,onResize:e.default.func,resizeHandles:e.default.arrayOf(e.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:e.default.number,width:function(){for(var a=arguments.length,i=new Array(a),d=0;d<a;d++)i[d]=arguments[d];var S=i[0];if(S.axis==="both"||S.axis==="x"){var h;return(h=e.default.number).isRequired.apply(h,i)}return e.default.number.apply(e.default,i)}};return Qe.resizableProps=r,Qe}var Gr;function qr(){if(Gr)return Je;Gr=1,Je.__esModule=!0,Je.default=void 0;var e=d(V),t=nr(),r=Jn(),n=Fr(),a=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function i(o){if(typeof WeakMap!="function")return null;var s=new WeakMap,f=new WeakMap;return(i=function(l){return l?f:s})(o)}function d(o,s){if(o&&o.__esModule)return o;if(o===null||typeof o!="object"&&typeof o!="function")return{default:o};var f=i(s);if(f&&f.has(o))return f.get(o);var y={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var v in o)if(v!=="default"&&Object.prototype.hasOwnProperty.call(o,v)){var c=l?Object.getOwnPropertyDescriptor(o,v):null;c&&(c.get||c.set)?Object.defineProperty(y,v,c):y[v]=o[v]}return y.default=o,f&&f.set(o,y),y}function S(){return S=Object.assign?Object.assign.bind():function(o){for(var s=1;s<arguments.length;s++){var f=arguments[s];for(var y in f)Object.prototype.hasOwnProperty.call(f,y)&&(o[y]=f[y])}return o},S.apply(this,arguments)}function h(o,s){if(o==null)return{};var f={},y=Object.keys(o),l,v;for(v=0;v<y.length;v++)l=y[v],!(s.indexOf(l)>=0)&&(f[l]=o[l]);return f}function C(o,s){var f=Object.keys(o);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(o);s&&(y=y.filter(function(l){return Object.getOwnPropertyDescriptor(o,l).enumerable})),f.push.apply(f,y)}return f}function m(o){for(var s=1;s<arguments.length;s++){var f=arguments[s]!=null?arguments[s]:{};s%2?C(Object(f),!0).forEach(function(y){b(o,y,f[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(f)):C(Object(f)).forEach(function(y){Object.defineProperty(o,y,Object.getOwnPropertyDescriptor(f,y))})}return o}function b(o,s,f){return s=E(s),s in o?Object.defineProperty(o,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):o[s]=f,o}function E(o){var s=I(o,"string");return typeof s=="symbol"?s:String(s)}function I(o,s){if(typeof o!="object"||o===null)return o;var f=o[Symbol.toPrimitive];if(f!==void 0){var y=f.call(o,s);if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(o)}function _(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,T(o,s)}function T(o,s){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(y,l){return y.__proto__=l,y},T(o,s)}var p=function(o){_(s,o);function s(){for(var y,l=arguments.length,v=new Array(l),c=0;c<l;c++)v[c]=arguments[c];return y=o.call.apply(o,[this].concat(v))||this,y.handleRefs={},y.lastHandleRect=null,y.slack=null,y}var f=s.prototype;return f.componentWillUnmount=function(){this.resetData()},f.resetData=function(){this.lastHandleRect=this.slack=null},f.runConstraints=function(l,v){var c=this.props,g=c.minConstraints,P=c.maxConstraints,M=c.lockAspectRatio;if(!g&&!P&&!M)return[l,v];if(M){var U=this.props.width/this.props.height,z=l-this.props.width,O=v-this.props.height;Math.abs(z)>Math.abs(O*U)?v=l/U:l=v*U}var L=l,W=v,F=this.slack||[0,0],X=F[0],ae=F[1];return l+=X,v+=ae,g&&(l=Math.max(g[0],l),v=Math.max(g[1],v)),P&&(l=Math.min(P[0],l),v=Math.min(P[1],v)),this.slack=[X+(L-l),ae+(W-v)],[l,v]},f.resizeHandler=function(l,v){var c=this;return function(g,P){var M=P.node,U=P.deltaX,z=P.deltaY;l==="onResizeStart"&&c.resetData();var O=(c.props.axis==="both"||c.props.axis==="x")&&v!=="n"&&v!=="s",L=(c.props.axis==="both"||c.props.axis==="y")&&v!=="e"&&v!=="w";if(!(!O&&!L)){var W=v[0],F=v[v.length-1],X=M.getBoundingClientRect();if(c.lastHandleRect!=null){if(F==="w"){var ae=X.left-c.lastHandleRect.left;U+=ae}if(W==="n"){var ne=X.top-c.lastHandleRect.top;z+=ne}}c.lastHandleRect=X,F==="w"&&(U=-U),W==="n"&&(z=-z);var se=c.props.width+(O?U/c.props.transformScale:0),j=c.props.height+(L?z/c.props.transformScale:0),Q=c.runConstraints(se,j);se=Q[0],j=Q[1];var te=se!==c.props.width||j!==c.props.height,oe=typeof c.props[l]=="function"?c.props[l]:null,ce=l==="onResize"&&!te;oe&&!ce&&(g.persist==null||g.persist(),oe(g,{node:M,size:{width:se,height:j},handle:v})),l==="onResizeStop"&&c.resetData()}}},f.renderResizeHandle=function(l,v){var c=this.props.handle;if(!c)return e.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+l,ref:v});if(typeof c=="function")return c(l,v);var g=typeof c.type=="string",P=m({ref:v},g?{}:{handleAxis:l});return e.cloneElement(c,P)},f.render=function(){var l=this,v=this.props,c=v.children,g=v.className,P=v.draggableOpts;v.width,v.height,v.handle,v.handleSize,v.lockAspectRatio,v.axis,v.minConstraints,v.maxConstraints,v.onResize,v.onResizeStop,v.onResizeStart;var M=v.resizeHandles;v.transformScale;var U=h(v,a);return(0,r.cloneElement)(c,m(m({},U),{},{className:(g?g+" ":"")+"react-resizable",children:[].concat(c.props.children,M.map(function(z){var O,L=(O=l.handleRefs[z])!=null?O:l.handleRefs[z]=e.createRef();return e.createElement(t.DraggableCore,S({},P,{nodeRef:L,key:"resizableHandle-"+z,onStop:l.resizeHandler("onResizeStop",z),onStart:l.resizeHandler("onResizeStart",z),onDrag:l.resizeHandler("onResize",z)}),l.renderResizeHandle(z,L))}))}))},s}(e.Component);return Je.default=p,p.propTypes=n.resizableProps,p.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},Je}var $e={},Yr;function Qn(){if(Yr)return $e;Yr=1,$e.__esModule=!0,$e.default=void 0;var e=S(V),t=i(we()),r=i(qr()),n=Fr(),a=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function i(s){return s&&s.__esModule?s:{default:s}}function d(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,y=new WeakMap;return(d=function(v){return v?y:f})(s)}function S(s,f){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var y=d(f);if(y&&y.has(s))return y.get(s);var l={},v=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in s)if(c!=="default"&&Object.prototype.hasOwnProperty.call(s,c)){var g=v?Object.getOwnPropertyDescriptor(s,c):null;g&&(g.get||g.set)?Object.defineProperty(l,c,g):l[c]=s[c]}return l.default=s,y&&y.set(s,l),l}function h(){return h=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var y=arguments[f];for(var l in y)Object.prototype.hasOwnProperty.call(y,l)&&(s[l]=y[l])}return s},h.apply(this,arguments)}function C(s,f){var y=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);f&&(l=l.filter(function(v){return Object.getOwnPropertyDescriptor(s,v).enumerable})),y.push.apply(y,l)}return y}function m(s){for(var f=1;f<arguments.length;f++){var y=arguments[f]!=null?arguments[f]:{};f%2?C(Object(y),!0).forEach(function(l){b(s,l,y[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(y)):C(Object(y)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(y,l))})}return s}function b(s,f,y){return f=E(f),f in s?Object.defineProperty(s,f,{value:y,enumerable:!0,configurable:!0,writable:!0}):s[f]=y,s}function E(s){var f=I(s,"string");return typeof f=="symbol"?f:String(f)}function I(s,f){if(typeof s!="object"||s===null)return s;var y=s[Symbol.toPrimitive];if(y!==void 0){var l=y.call(s,f);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(s)}function _(s,f){if(s==null)return{};var y={},l=Object.keys(s),v,c;for(c=0;c<l.length;c++)v=l[c],!(f.indexOf(v)>=0)&&(y[v]=s[v]);return y}function T(s,f){s.prototype=Object.create(f.prototype),s.prototype.constructor=s,p(s,f)}function p(s,f){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,v){return l.__proto__=v,l},p(s,f)}var o=function(s){T(f,s);function f(){for(var l,v=arguments.length,c=new Array(v),g=0;g<v;g++)c[g]=arguments[g];return l=s.call.apply(s,[this].concat(c))||this,l.state={width:l.props.width,height:l.props.height,propsWidth:l.props.width,propsHeight:l.props.height},l.onResize=function(P,M){var U=M.size;l.props.onResize?(P.persist==null||P.persist(),l.setState(U,function(){return l.props.onResize&&l.props.onResize(P,M)})):l.setState(U)},l}f.getDerivedStateFromProps=function(v,c){return c.propsWidth!==v.width||c.propsHeight!==v.height?{width:v.width,height:v.height,propsWidth:v.width,propsHeight:v.height}:null};var y=f.prototype;return y.render=function(){var v=this.props,c=v.handle,g=v.handleSize;v.onResize;var P=v.onResizeStart,M=v.onResizeStop,U=v.draggableOpts,z=v.minConstraints,O=v.maxConstraints,L=v.lockAspectRatio,W=v.axis;v.width,v.height;var F=v.resizeHandles,X=v.style,ae=v.transformScale,ne=_(v,a);return e.createElement(r.default,{axis:W,draggableOpts:U,handle:c,handleSize:g,height:this.state.height,lockAspectRatio:L,maxConstraints:O,minConstraints:z,onResizeStart:P,onResize:this.onResize,onResizeStop:M,resizeHandles:F,transformScale:ae,width:this.state.width},e.createElement("div",h({},ne,{style:m(m({},X),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},f}(e.Component);return $e.default=o,o.propTypes=m(m({},n.resizableProps),{},{children:t.default.element}),$e}var Xr;function $n(){return Xr||(Xr=1,Ze.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Ze.exports.Resizable=qr().default,Ze.exports.ResizableBox=Qn().default),Ze.exports}var Te={},Kr;function Zr(){if(Kr)return Te;Kr=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.resizeHandleType=Te.resizeHandleAxesType=Te.default=void 0;var e=r(we()),t=r(V);function r(i){return i&&i.__esModule?i:{default:i}}const n=Te.resizeHandleAxesType=e.default.arrayOf(e.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),a=Te.resizeHandleType=e.default.oneOfType([e.default.node,e.default.func]);return Te.default={className:e.default.string,style:e.default.object,width:e.default.number,autoSize:e.default.bool,cols:e.default.number,draggableCancel:e.default.string,draggableHandle:e.default.string,verticalCompact:function(i){i.verticalCompact},compactType:e.default.oneOf(["vertical","horizontal"]),layout:function(i){var d=i.layout;d!==void 0&&Ve().validateLayout(d,"layout")},margin:e.default.arrayOf(e.default.number),containerPadding:e.default.arrayOf(e.default.number),rowHeight:e.default.number,maxRows:e.default.number,isBounded:e.default.bool,isDraggable:e.default.bool,isResizable:e.default.bool,allowOverlap:e.default.bool,preventCollision:e.default.bool,useCSSTransforms:e.default.bool,transformScale:e.default.number,isDroppable:e.default.bool,resizeHandles:n,resizeHandle:a,onLayoutChange:e.default.func,onDragStart:e.default.func,onDrag:e.default.func,onDragStop:e.default.func,onResizeStart:e.default.func,onResize:e.default.func,onResizeStop:e.default.func,onDrop:e.default.func,droppingItem:e.default.shape({i:e.default.string.isRequired,w:e.default.number.isRequired,h:e.default.number.isRequired}),children:function(i,d){const S=i[d],h={};t.default.Children.forEach(S,function(C){if((C==null?void 0:C.key)!=null){if(h[C.key])throw new Error('Duplicate child key "'+C.key+'" found! This will cause problems in ReactGridLayout.');h[C.key]=!0}})},innerRef:e.default.any},Te}var Jr;function ea(){if(Jr)return Ye;Jr=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.default=void 0;var e=C(V),t=Vt,r=C(we()),n=nr(),a=$n(),i=Ve(),d=Jt(),S=Zr(),h=C(Kt());function C(_){return _&&_.__esModule?_:{default:_}}function m(_,T,p){return T=b(T),T in _?Object.defineProperty(_,T,{value:p,enumerable:!0,configurable:!0,writable:!0}):_[T]=p,_}function b(_){var T=E(_,"string");return typeof T=="symbol"?T:String(T)}function E(_,T){if(typeof _!="object"||_===null)return _;var p=_[Symbol.toPrimitive];if(p!==void 0){var o=p.call(_,T);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(T==="string"?String:Number)(_)}let I=class extends e.default.Component{constructor(){super(...arguments),m(this,"state",{resizing:null,dragging:null,className:""}),m(this,"elementRef",e.default.createRef()),m(this,"onDragStart",(T,p)=>{let{node:o}=p;const{onDragStart:s,transformScale:f}=this.props;if(!s)return;const y={top:0,left:0},{offsetParent:l}=o;if(!l)return;const v=l.getBoundingClientRect(),c=o.getBoundingClientRect(),g=c.left/f,P=v.left/f,M=c.top/f,U=v.top/f;y.left=g-P+l.scrollLeft,y.top=M-U+l.scrollTop,this.setState({dragging:y});const{x:z,y:O}=(0,d.calcXY)(this.getPositionParams(),y.top,y.left,this.props.w,this.props.h);return s.call(this,this.props.i,z,O,{e:T,node:o,newPosition:y})}),m(this,"onDrag",(T,p,o)=>{let{node:s,deltaX:f,deltaY:y}=p;const{onDrag:l}=this.props;if(!l)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let v=this.state.dragging.top+y,c=this.state.dragging.left+f;const{isBounded:g,i:P,w:M,h:U,containerWidth:z}=this.props,O=this.getPositionParams();if(g){const{offsetParent:X}=s;if(X){const{margin:ae,rowHeight:ne,containerPadding:se}=this.props,j=X.clientHeight-(0,d.calcGridItemWHPx)(U,ne,ae[1]);v=(0,d.clamp)(v-se[1],0,j);const Q=(0,d.calcGridColWidth)(O),te=z-(0,d.calcGridItemWHPx)(M,Q,ae[0]);c=(0,d.clamp)(c-se[0],0,te)}}const L={top:v,left:c};o?this.setState({dragging:L}):(0,t.flushSync)(()=>{this.setState({dragging:L})});const{x:W,y:F}=(0,d.calcXY)(O,v,c,M,U);return l.call(this,P,W,F,{e:T,node:s,newPosition:L})}),m(this,"onDragStop",(T,p)=>{let{node:o}=p;const{onDragStop:s}=this.props;if(!s)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:f,h:y,i:l}=this.props,{left:v,top:c}=this.state.dragging,g={top:c,left:v};this.setState({dragging:null});const{x:P,y:M}=(0,d.calcXY)(this.getPositionParams(),c,v,f,y);return s.call(this,l,P,M,{e:T,node:o,newPosition:g})}),m(this,"onResizeStop",(T,p,o)=>this.onResizeHandler(T,p,o,"onResizeStop")),m(this,"onResizeStart",(T,p,o)=>this.onResizeHandler(T,p,o,"onResizeStart")),m(this,"onResize",(T,p,o)=>this.onResizeHandler(T,p,o,"onResize"))}shouldComponentUpdate(T,p){if(this.props.children!==T.children||this.props.droppingPosition!==T.droppingPosition)return!0;const o=(0,d.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),s=(0,d.calcGridItemPosition)(this.getPositionParams(T),T.x,T.y,T.w,T.h,p);return!(0,i.fastPositionEqual)(o,s)||this.props.useCSSTransforms!==T.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(T){this.moveDroppingItem(T)}moveDroppingItem(T){const{droppingPosition:p}=this.props;if(!p)return;const o=this.elementRef.current;if(!o)return;const s=T.droppingPosition||{left:0,top:0},{dragging:f}=this.state,y=f&&p.left!==s.left||p.top!==s.top;if(!f)this.onDragStart(p.e,{node:o,deltaX:p.left,deltaY:p.top});else if(y){const l=p.left-f.left,v=p.top-f.top;this.onDrag(p.e,{node:o,deltaX:l,deltaY:v},!0)}}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:p,containerWidth:o,useCSSTransforms:s}=this.props;let f;return s?f=(0,i.setTransform)(T):(f=(0,i.setTopLeft)(T),p&&(f.left=(0,i.perc)(T.left/o),f.width=(0,i.perc)(T.width/o))),f}mixinDraggable(T,p){return e.default.createElement(n.DraggableCore,{disabled:!p,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,p){return(o,s)=>p(o,s,T)}mixinResizable(T,p,o){const{cols:s,minW:f,minH:y,maxW:l,maxH:v,transformScale:c,resizeHandles:g,resizeHandle:P}=this.props,M=this.getPositionParams(),U=(0,d.calcGridItemPosition)(M,0,0,s,0).width,z=(0,d.calcGridItemPosition)(M,0,0,f,y),O=(0,d.calcGridItemPosition)(M,0,0,l,v),L=[z.width,z.height],W=[Math.min(O.width,U),Math.min(O.height,1/0)];return e.default.createElement(a.Resizable,{draggableOpts:{disabled:!o},className:o?void 0:"react-resizable-hide",width:p.width,height:p.height,minConstraints:L,maxConstraints:W,onResizeStop:this.curryResizeHandler(p,this.onResizeStop),onResizeStart:this.curryResizeHandler(p,this.onResizeStart),onResize:this.curryResizeHandler(p,this.onResize),transformScale:c,resizeHandles:g,handle:P},T)}onResizeHandler(T,p,o,s){let{node:f,size:y,handle:l}=p;const v=this.props[s];if(!v)return;const{x:c,y:g,i:P,maxH:M,minH:U,containerWidth:z}=this.props,{minW:O,maxW:L}=this.props;let W=y;f&&(W=(0,i.resizeItemInDirection)(l,o,y,z),(0,t.flushSync)(()=>{this.setState({resizing:s==="onResizeStop"?null:W})}));let{w:F,h:X}=(0,d.calcWH)(this.getPositionParams(),W.width,W.height,c,g,l);F=(0,d.clamp)(F,Math.max(O,1),L),X=(0,d.clamp)(X,U,M),v.call(this,P,F,X,{e:T,node:f,size:W,handle:l})}render(){const{x:T,y:p,w:o,h:s,isDraggable:f,isResizable:y,droppingPosition:l,useCSSTransforms:v}=this.props,c=(0,d.calcGridItemPosition)(this.getPositionParams(),T,p,o,s,this.state),g=e.default.Children.only(this.props.children);let P=e.default.cloneElement(g,{ref:this.elementRef,className:(0,h.default)("react-grid-item",g.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":f,"react-draggable-dragging":!!this.state.dragging,dropping:!!l,cssTransforms:v}),style:{...this.props.style,...g.props.style,...this.createStyle(c)}});return P=this.mixinResizable(P,c,y),P=this.mixinDraggable(P,f),P}};return Ye.default=I,m(I,"propTypes",{children:r.default.element,cols:r.default.number.isRequired,containerWidth:r.default.number.isRequired,rowHeight:r.default.number.isRequired,margin:r.default.array.isRequired,maxRows:r.default.number.isRequired,containerPadding:r.default.array.isRequired,x:r.default.number.isRequired,y:r.default.number.isRequired,w:r.default.number.isRequired,h:r.default.number.isRequired,minW:function(_,T){const p=_[T];if(typeof p!="number")return new Error("minWidth not Number");if(p>_.w||p>_.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(_,T){const p=_[T];if(typeof p!="number")return new Error("maxWidth not Number");if(p<_.w||p<_.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(_,T){const p=_[T];if(typeof p!="number")return new Error("minHeight not Number");if(p>_.h||p>_.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(_,T){const p=_[T];if(typeof p!="number")return new Error("maxHeight not Number");if(p<_.h||p<_.minH)return new Error("maxHeight smaller than item height/minHeight")},i:r.default.string.isRequired,resizeHandles:S.resizeHandleAxesType,resizeHandle:S.resizeHandleType,onDragStop:r.default.func,onDragStart:r.default.func,onDrag:r.default.func,onResizeStop:r.default.func,onResizeStart:r.default.func,onResize:r.default.func,isDraggable:r.default.bool.isRequired,isResizable:r.default.bool.isRequired,isBounded:r.default.bool.isRequired,static:r.default.bool,useCSSTransforms:r.default.bool.isRequired,transformScale:r.default.number,className:r.default.string,handle:r.default.string,cancel:r.default.string,droppingPosition:r.default.shape({e:r.default.object.isRequired,left:r.default.number.isRequired,top:r.default.number.isRequired})}),m(I,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Ye}var Qr;function $r(){if(Qr)return Ge;Qr=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.default=void 0;var e=C(V),t=Xt(),r=S(Kt()),n=Ve(),a=Jt(),i=S(ea()),d=S(Zr());function S(p){return p&&p.__esModule?p:{default:p}}function h(p){if(typeof WeakMap!="function")return null;var o=new WeakMap,s=new WeakMap;return(h=function(f){return f?s:o})(p)}function C(p,o){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var s=h(o);if(s&&s.has(p))return s.get(p);var f={__proto__:null},y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in p)if(l!=="default"&&Object.prototype.hasOwnProperty.call(p,l)){var v=y?Object.getOwnPropertyDescriptor(p,l):null;v&&(v.get||v.set)?Object.defineProperty(f,l,v):f[l]=p[l]}return f.default=p,s&&s.set(p,f),f}function m(p,o,s){return o=b(o),o in p?Object.defineProperty(p,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):p[o]=s,p}function b(p){var o=E(p,"string");return typeof o=="symbol"?o:String(o)}function E(p,o){if(typeof p!="object"||p===null)return p;var s=p[Symbol.toPrimitive];if(s!==void 0){var f=s.call(p,o);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(p)}const I="react-grid-layout";let _=!1;try{_=/firefox/i.test(navigator.userAgent)}catch{}let T=class extends e.Component{constructor(){super(...arguments),m(this,"state",{activeDrag:null,layout:(0,n.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,n.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),m(this,"dragEnterCounter",0),m(this,"onDragStart",(o,s,f,y)=>{let{e:l,node:v}=y;const{layout:c}=this.state,g=(0,n.getLayoutItem)(c,o);if(!g)return;const P={w:g.w,h:g.h,x:g.x,y:g.y,placeholder:!0,i:o};return this.setState({oldDragItem:(0,n.cloneLayoutItem)(g),oldLayout:c,activeDrag:P}),this.props.onDragStart(c,g,g,null,l,v)}),m(this,"onDrag",(o,s,f,y)=>{let{e:l,node:v}=y;const{oldDragItem:c}=this.state;let{layout:g}=this.state;const{cols:P,allowOverlap:M,preventCollision:U}=this.props,z=(0,n.getLayoutItem)(g,o);if(!z)return;const O={w:z.w,h:z.h,x:z.x,y:z.y,placeholder:!0,i:o};g=(0,n.moveElement)(g,z,s,f,!0,U,(0,n.compactType)(this.props),P,M),this.props.onDrag(g,c,z,O,l,v),this.setState({layout:M?g:(0,n.compact)(g,(0,n.compactType)(this.props),P),activeDrag:O})}),m(this,"onDragStop",(o,s,f,y)=>{let{e:l,node:v}=y;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:g}=this.state;const{cols:P,preventCollision:M,allowOverlap:U}=this.props,z=(0,n.getLayoutItem)(g,o);if(!z)return;g=(0,n.moveElement)(g,z,s,f,!0,M,(0,n.compactType)(this.props),P,U);const L=U?g:(0,n.compact)(g,(0,n.compactType)(this.props),P);this.props.onDragStop(L,c,z,null,l,v);const{oldLayout:W}=this.state;this.setState({activeDrag:null,layout:L,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(L,W)}),m(this,"onResizeStart",(o,s,f,y)=>{let{e:l,node:v}=y;const{layout:c}=this.state,g=(0,n.getLayoutItem)(c,o);g&&(this.setState({oldResizeItem:(0,n.cloneLayoutItem)(g),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,g,g,null,l,v))}),m(this,"onResize",(o,s,f,y)=>{let{e:l,node:v,size:c,handle:g}=y;const{oldResizeItem:P}=this.state,{layout:M}=this.state,{cols:U,preventCollision:z,allowOverlap:O}=this.props;let L=!1,W,F,X;const[ae,ne]=(0,n.withLayoutItem)(M,o,j=>{let Q;return F=j.x,X=j.y,["sw","w","nw","n","ne"].indexOf(g)!==-1&&(["sw","nw","w"].indexOf(g)!==-1&&(F=j.x+(j.w-s),s=j.x!==F&&F<0?j.w:s,F=F<0?0:F),["ne","n","nw"].indexOf(g)!==-1&&(X=j.y+(j.h-f),f=j.y!==X&&X<0?j.h:f,X=X<0?0:X),L=!0),z&&!O&&(Q=(0,n.getAllCollisions)(M,{...j,w:s,h:f,x:F,y:X}).filter(oe=>oe.i!==j.i).length>0,Q&&(X=j.y,f=j.h,F=j.x,s=j.w,L=!1)),j.w=s,j.h=f,j});if(!ne)return;W=ae,L&&(W=(0,n.moveElement)(ae,ne,F,X,!0,this.props.preventCollision,(0,n.compactType)(this.props),U,O));const se={w:ne.w,h:ne.h,x:ne.x,y:ne.y,static:!0,i:o};this.props.onResize(W,P,ne,se,l,v),this.setState({layout:O?W:(0,n.compact)(W,(0,n.compactType)(this.props),U),activeDrag:se})}),m(this,"onResizeStop",(o,s,f,y)=>{let{e:l,node:v}=y;const{layout:c,oldResizeItem:g}=this.state,{cols:P,allowOverlap:M}=this.props,U=(0,n.getLayoutItem)(c,o),z=M?c:(0,n.compact)(c,(0,n.compactType)(this.props),P);this.props.onResizeStop(z,g,U,null,l,v);const{oldLayout:O}=this.state;this.setState({activeDrag:null,layout:z,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(z,O)}),m(this,"onDragOver",o=>{var ae;if(o.preventDefault(),o.stopPropagation(),_&&!((ae=o.nativeEvent.target)!=null&&ae.classList.contains(I)))return!1;const{droppingItem:s,onDropDragOver:f,margin:y,cols:l,rowHeight:v,maxRows:c,width:g,containerPadding:P,transformScale:M}=this.props,U=f==null?void 0:f(o);if(U===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const z={...s,...U},{layout:O}=this.state,L=o.currentTarget.getBoundingClientRect(),W=o.clientX-L.left,F=o.clientY-L.top,X={left:W/M,top:F/M,e:o};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:ne,top:se}=this.state.droppingPosition;(ne!=W||se!=F)&&this.setState({droppingPosition:X})}}else{const ne={cols:l,margin:y,maxRows:c,rowHeight:v,containerWidth:g,containerPadding:P||y},se=(0,a.calcXY)(ne,F,W,z.w,z.h);this.setState({droppingDOMNode:e.createElement("div",{key:z.i}),droppingPosition:X,layout:[...O,{...z,x:se.x,y:se.y,static:!1,isDraggable:!0}]})}}),m(this,"removeDroppingPlaceholder",()=>{const{droppingItem:o,cols:s}=this.props,{layout:f}=this.state,y=(0,n.compact)(f.filter(l=>l.i!==o.i),(0,n.compactType)(this.props),s,this.props.allowOverlap);this.setState({layout:y,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),m(this,"onDragLeave",o=>{o.preventDefault(),o.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),m(this,"onDragEnter",o=>{o.preventDefault(),o.stopPropagation(),this.dragEnterCounter++}),m(this,"onDrop",o=>{o.preventDefault(),o.stopPropagation();const{droppingItem:s}=this.props,{layout:f}=this.state,y=f.find(l=>l.i===s.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(f,y,o)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(o,s){let f;return s.activeDrag?null:(!(0,t.deepEqual)(o.layout,s.propsLayout)||o.compactType!==s.compactType?f=o.layout:(0,n.childrenEqual)(o.children,s.children)||(f=s.layout),f?{layout:(0,n.synchronizeLayoutWithChildren)(f,o.children,o.cols,(0,n.compactType)(o),o.allowOverlap),compactType:o.compactType,children:o.children,propsLayout:o.layout}:null)}shouldComponentUpdate(o,s){return this.props.children!==o.children||!(0,n.fastRGLPropsEqual)(this.props,o,t.deepEqual)||this.state.activeDrag!==s.activeDrag||this.state.mounted!==s.mounted||this.state.droppingPosition!==s.droppingPosition}componentDidUpdate(o,s){if(!this.state.activeDrag){const f=this.state.layout,y=s.layout;this.onLayoutMaybeChanged(f,y)}}containerHeight(){if(!this.props.autoSize)return;const o=(0,n.bottom)(this.state.layout),s=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return o*this.props.rowHeight+(o-1)*this.props.margin[1]+s*2+"px"}onLayoutMaybeChanged(o,s){s||(s=this.state.layout),(0,t.deepEqual)(s,o)||this.props.onLayoutChange(o)}placeholder(){const{activeDrag:o}=this.state;if(!o)return null;const{width:s,cols:f,margin:y,containerPadding:l,rowHeight:v,maxRows:c,useCSSTransforms:g,transformScale:P}=this.props;return e.createElement(i.default,{w:o.w,h:o.h,x:o.x,y:o.y,i:o.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:s,cols:f,margin:y,containerPadding:l||y,maxRows:c,rowHeight:v,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:g,transformScale:P},e.createElement("div",null))}processGridItem(o,s){if(!o||!o.key)return;const f=(0,n.getLayoutItem)(this.state.layout,String(o.key));if(!f)return null;const{width:y,cols:l,margin:v,containerPadding:c,rowHeight:g,maxRows:P,isDraggable:M,isResizable:U,isBounded:z,useCSSTransforms:O,transformScale:L,draggableCancel:W,draggableHandle:F,resizeHandles:X,resizeHandle:ae}=this.props,{mounted:ne,droppingPosition:se}=this.state,j=typeof f.isDraggable=="boolean"?f.isDraggable:!f.static&&M,Q=typeof f.isResizable=="boolean"?f.isResizable:!f.static&&U,te=f.resizeHandles||X,oe=j&&z&&f.isBounded!==!1;return e.createElement(i.default,{containerWidth:y,cols:l,margin:v,containerPadding:c||v,maxRows:P,rowHeight:g,cancel:W,handle:F,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:j,isResizable:Q,isBounded:oe,useCSSTransforms:O&&ne,usePercentages:!ne,transformScale:L,w:f.w,h:f.h,x:f.x,y:f.y,i:f.i,minH:f.minH,minW:f.minW,maxH:f.maxH,maxW:f.maxW,static:f.static,droppingPosition:s?se:void 0,resizeHandles:te,resizeHandle:ae},o)}render(){const{className:o,style:s,isDroppable:f,innerRef:y}=this.props,l=(0,r.default)(I,o),v={height:this.containerHeight(),...s};return e.createElement("div",{ref:y,className:l,style:v,onDrop:f?this.onDrop:n.noop,onDragLeave:f?this.onDragLeave:n.noop,onDragEnter:f?this.onDragEnter:n.noop,onDragOver:f?this.onDragOver:n.noop},e.Children.map(this.props.children,c=>this.processGridItem(c)),f&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};return Ge.default=T,m(T,"displayName","ReactGridLayout"),m(T,"propTypes",d.default),m(T,"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:n.noop,onDragStart:n.noop,onDrag:n.noop,onDragStop:n.noop,onResizeStart:n.noop,onResize:n.noop,onResizeStop:n.noop,onDrop:n.noop,onDropDragOver:n.noop}),Ge}var et={},xe={},en;function tn(){if(en)return xe;en=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.findOrGenerateResponsiveLayout=n,xe.getBreakpointFromWidth=t,xe.getColsFromBreakpoint=r,xe.sortBreakpoints=a;var e=Ve();function t(i,d){const S=a(i);let h=S[0];for(let C=1,m=S.length;C<m;C++){const b=S[C];d>i[b]&&(h=b)}return h}function r(i,d){if(!d[i])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+i+" is missing!");return d[i]}function n(i,d,S,h,C,m){if(i[S])return(0,e.cloneLayout)(i[S]);let b=i[h];const E=a(d),I=E.slice(E.indexOf(S));for(let _=0,T=I.length;_<T;_++){const p=I[_];if(i[p]){b=i[p];break}}return b=(0,e.cloneLayout)(b||[]),(0,e.compact)((0,e.correctBounds)(b,{cols:C}),m,C)}function a(i){return Object.keys(i).sort(function(S,h){return i[S]-i[h]})}return xe}var rn;function ta(){if(rn)return et;rn=1,Object.defineProperty(et,"__esModule",{value:!0}),et.default=void 0;var e=h(V),t=d(we()),r=Xt(),n=Ve(),a=tn(),i=d($r());function d(p){return p&&p.__esModule?p:{default:p}}function S(p){if(typeof WeakMap!="function")return null;var o=new WeakMap,s=new WeakMap;return(S=function(f){return f?s:o})(p)}function h(p,o){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var s=S(o);if(s&&s.has(p))return s.get(p);var f={__proto__:null},y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in p)if(l!=="default"&&Object.prototype.hasOwnProperty.call(p,l)){var v=y?Object.getOwnPropertyDescriptor(p,l):null;v&&(v.get||v.set)?Object.defineProperty(f,l,v):f[l]=p[l]}return f.default=p,s&&s.set(p,f),f}function C(){return C=Object.assign?Object.assign.bind():function(p){for(var o=1;o<arguments.length;o++){var s=arguments[o];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(p[f]=s[f])}return p},C.apply(this,arguments)}function m(p,o,s){return o=b(o),o in p?Object.defineProperty(p,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):p[o]=s,p}function b(p){var o=E(p,"string");return typeof o=="symbol"?o:String(o)}function E(p,o){if(typeof p!="object"||p===null)return p;var s=p[Symbol.toPrimitive];if(s!==void 0){var f=s.call(p,o);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(p)}const I=p=>Object.prototype.toString.call(p);function _(p,o){return p==null?null:Array.isArray(p)?p:p[o]}let T=class extends e.Component{constructor(){super(...arguments),m(this,"state",this.generateInitialState()),m(this,"onLayoutChange",o=>{this.props.onLayoutChange(o,{...this.props.layouts,[this.state.breakpoint]:o})})}generateInitialState(){const{width:o,breakpoints:s,layouts:f,cols:y}=this.props,l=(0,a.getBreakpointFromWidth)(s,o),v=(0,a.getColsFromBreakpoint)(l,y),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,a.findOrGenerateResponsiveLayout)(f,s,l,l,v,c),breakpoint:l,cols:v}}static getDerivedStateFromProps(o,s){if(!(0,r.deepEqual)(o.layouts,s.layouts)){const{breakpoint:f,cols:y}=s;return{layout:(0,a.findOrGenerateResponsiveLayout)(o.layouts,o.breakpoints,f,f,y,o.compactType),layouts:o.layouts}}return null}componentDidUpdate(o){(this.props.width!=o.width||this.props.breakpoint!==o.breakpoint||!(0,r.deepEqual)(this.props.breakpoints,o.breakpoints)||!(0,r.deepEqual)(this.props.cols,o.cols))&&this.onWidthChange(o)}onWidthChange(o){const{breakpoints:s,cols:f,layouts:y,compactType:l}=this.props,v=this.props.breakpoint||(0,a.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,g=(0,a.getColsFromBreakpoint)(v,f),P={...y};if(c!==v||o.breakpoints!==s||o.cols!==f){c in P||(P[c]=(0,n.cloneLayout)(this.state.layout));let z=(0,a.findOrGenerateResponsiveLayout)(P,s,v,c,g,l);z=(0,n.synchronizeLayoutWithChildren)(z,this.props.children,g,l,this.props.allowOverlap),P[v]=z,this.props.onBreakpointChange(v,g),this.props.onLayoutChange(z,P),this.setState({breakpoint:v,layout:z,cols:g})}const M=_(this.props.margin,v),U=_(this.props.containerPadding,v);this.props.onWidthChange(this.props.width,M,g,U)}render(){const{breakpoint:o,breakpoints:s,cols:f,layouts:y,margin:l,containerPadding:v,onBreakpointChange:c,onLayoutChange:g,onWidthChange:P,...M}=this.props;return e.createElement(i.default,C({},M,{margin:_(l,this.state.breakpoint),containerPadding:_(v,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}};return et.default=T,m(T,"propTypes",{breakpoint:t.default.string,breakpoints:t.default.object,allowOverlap:t.default.bool,cols:t.default.object,margin:t.default.oneOfType([t.default.array,t.default.object]),containerPadding:t.default.oneOfType([t.default.array,t.default.object]),layouts(p,o){if(I(p[o])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+I(p[o]));Object.keys(p[o]).forEach(s=>{if(!(s in p.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,n.validateLayout)(p.layouts[s],"layouts."+s)})},width:t.default.number.isRequired,onBreakpointChange:t.default.func,onLayoutChange:t.default.func,onWidthChange:t.default.func}),m(T,"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:n.noop,onLayoutChange:n.noop,onWidthChange:n.noop}),et}var Ct={},nn=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(a,i){return a[0]===r?(n=i,!0):!1}),n}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(r){var n=e(this.__entries__,r),a=this.__entries__[n];return a&&a[1]},t.prototype.set=function(r,n){var a=e(this.__entries__,r);~a?this.__entries__[a][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,a=e(n,r);~a&&n.splice(a,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var a=0,i=this.__entries__;a<i.length;a++){var d=i[a];r.call(n,d[1],d[0])}},t}()}(),ar=typeof window<"u"&&typeof document<"u"&&window.document===document,Tt=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")()}(),ra=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Tt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),na=2;function aa(e,t){var r=!1,n=!1,a=0;function i(){r&&(r=!1,e()),n&&S()}function d(){ra(i)}function S(){var h=Date.now();if(r){if(h-a<na)return;n=!0}else r=!0,n=!1,setTimeout(d,t);a=h}return S}var ia=20,oa=["top","right","bottom","left","width","height","size","weight"],sa=typeof MutationObserver<"u",la=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=aa(this.refresh.bind(this),ia)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var r=this.observers_,n=r.indexOf(t);~n&&r.splice(n,1),!r.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(r){return r.gatherActive(),r.hasActive()});return t.forEach(function(r){return r.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!ar||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),sa?(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(){!ar||!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 r=t.propertyName,n=r===void 0?"":r,a=oa.some(function(i){return!!~n.indexOf(i)});a&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),an=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var a=n[r];Object.defineProperty(e,a,{value:t[a],enumerable:!1,writable:!1,configurable:!0})}return e},Ue=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Tt},on=_t(0,0,0,0);function wt(e){return parseFloat(e)||0}function sn(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(n,a){var i=e["border-"+a+"-width"];return n+wt(i)},0)}function ua(e){for(var t=["top","right","bottom","left"],r={},n=0,a=t;n<a.length;n++){var i=a[n],d=e["padding-"+i];r[i]=wt(d)}return r}function ca(e){var t=e.getBBox();return _t(0,0,t.width,t.height)}function da(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return on;var n=Ue(e).getComputedStyle(e),a=ua(n),i=a.left+a.right,d=a.top+a.bottom,S=wt(n.width),h=wt(n.height);if(n.boxSizing==="border-box"&&(Math.round(S+i)!==t&&(S-=sn(n,"left","right")+i),Math.round(h+d)!==r&&(h-=sn(n,"top","bottom")+d)),!pa(e)){var C=Math.round(S+i)-t,m=Math.round(h+d)-r;Math.abs(C)!==1&&(S-=C),Math.abs(m)!==1&&(h-=m)}return _t(a.left,a.top,S,h)}var fa=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof Ue(e).SVGGraphicsElement}:function(e){return e instanceof Ue(e).SVGElement&&typeof e.getBBox=="function"}}();function pa(e){return e===Ue(e).document.documentElement}function ha(e){return ar?fa(e)?ca(e):da(e):on}function va(e){var t=e.x,r=e.y,n=e.width,a=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,d=Object.create(i.prototype);return an(d,{x:t,y:r,width:n,height:a,top:r,right:t+n,bottom:a+r,left:t}),d}function _t(e,t,r,n){return{x:e,y:t,width:r,height:n}}var ga=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=_t(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=ha(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}(),ma=function(){function e(t,r){var n=va(r);an(this,{target:t,contentRect:n})}return e}(),ya=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new nn,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=r,this.callbackCtx_=n}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 Ue(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new ga(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 Ue(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)&&(r.delete(t),r.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(r){r.isActive()&&t.activeObservations_.push(r)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,r=this.activeObservations_.map(function(n){return new ma(n.target,n.broadcastRect())});this.callback_.call(t,r,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),ln=typeof WeakMap<"u"?new WeakMap:new nn,un=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 r=la.getInstance(),n=new ya(t,r,this);ln.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){un.prototype[e]=function(){var t;return(t=ln.get(this))[e].apply(t,arguments)}});var ba=function(){return typeof Tt.ResizeObserver<"u"?Tt.ResizeObserver:un}();const Sa=Cr(Object.freeze(Object.defineProperty({__proto__:null,default:ba},Symbol.toStringTag,{value:"Module"})));var cn;function Ca(){if(cn)return Ct;cn=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.default=E;var e=d(V),t=a(we()),r=a(Sa),n=a(Kt());function a(I){return I&&I.__esModule?I:{default:I}}function i(I){if(typeof WeakMap!="function")return null;var _=new WeakMap,T=new WeakMap;return(i=function(p){return p?T:_})(I)}function d(I,_){if(I&&I.__esModule)return I;if(I===null||typeof I!="object"&&typeof I!="function")return{default:I};var T=i(_);if(T&&T.has(I))return T.get(I);var p={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in I)if(s!=="default"&&Object.prototype.hasOwnProperty.call(I,s)){var f=o?Object.getOwnPropertyDescriptor(I,s):null;f&&(f.get||f.set)?Object.defineProperty(p,s,f):p[s]=I[s]}return p.default=I,T&&T.set(I,p),p}function S(){return S=Object.assign?Object.assign.bind():function(I){for(var _=1;_<arguments.length;_++){var T=arguments[_];for(var p in T)Object.prototype.hasOwnProperty.call(T,p)&&(I[p]=T[p])}return I},S.apply(this,arguments)}function h(I,_,T){return _=C(_),_ in I?Object.defineProperty(I,_,{value:T,enumerable:!0,configurable:!0,writable:!0}):I[_]=T,I}function C(I){var _=m(I,"string");return typeof _=="symbol"?_:String(_)}function m(I,_){if(typeof I!="object"||I===null)return I;var T=I[Symbol.toPrimitive];if(T!==void 0){var p=T.call(I,_);if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_==="string"?String:Number)(I)}const b="react-grid-layout";function E(I){var _;return _=class extends e.Component{constructor(){super(...arguments),h(this,"state",{width:1280}),h(this,"elementRef",e.createRef()),h(this,"mounted",!1),h(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new r.default(o=>{if(this.elementRef.current instanceof HTMLElement){const f=o[0].contentRect.width;this.setState({width:f})}});const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.observe(p)}componentWillUnmount(){this.mounted=!1;const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.unobserve(p),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:p,...o}=this.props;return p&&!this.mounted?e.createElement("div",{className:(0,n.default)(this.props.className,b),style:this.props.style,ref:this.elementRef}):e.createElement(I,S({innerRef:this.elementRef},o,this.state))}},h(_,"defaultProps",{measureBeforeMount:!1}),h(_,"propTypes",{measureBeforeMount:t.default.bool}),_}return Ct}var dn;function Ta(){return dn||(dn=1,function(e){e.exports=$r().default,e.exports.utils=Ve(),e.exports.calculateUtils=Jt(),e.exports.Responsive=ta().default,e.exports.Responsive.utils=tn(),e.exports.WidthProvider=Ca().default}(Yt)),Yt.exports}var wa=Ta();const _a=Wn(wa);var Ia=Object.getOwnPropertyDescriptor,Ra=(e,t,r,n)=>{for(var a=n>1?void 0:n?Ia(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},Ea=(e,t)=>(r,n)=>t(r,n,e);let ze=class extends w.Disposable{constructor(t){super();Re(this,"_initLocal",()=>{});Re(this,"_findReplaceIndex",t=>{const r=/\{([^}]+)?\}/g,n=[];let a=r.exec(t);for(;a;)n.push({startIndex:a.index,key:Number(a[1]),endIndex:a.index+a[0].length-1}),a=r.exec(t);return n});this._localeService=t,this._initLocal()}tWithReactNode(t,...r){const n=this._localeService.getLocales(),a=t.split("."),i=n&&this._localeService.resolveKeyPath(n,a);if(typeof i=="string"){const d=[];return this._findReplaceIndex(i).forEach((S,h,C)=>{const m=C[h-1]||{endIndex:-1};if(m.endIndex+1<S.startIndex){const b=i.slice(m.endIndex+1,S.startIndex);b&&d.push(b)}if(r[S.key]&&d.push(r[S.key]),h===C.length-1){const b=i.slice(S.endIndex+1);b&&d.push(b)}}),d}return[]}};ze=Ra([Ea(0,w.Inject(w.LocaleService))],ze);const Oa=(e,t)=>{const r=e.rule;switch(r.type){case u.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case u.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case u.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case u.CFRuleType.highlightCell:switch(r.subType){case u.CFSubRuleType.average:{const n=r.operator;return t.t(`sheet.cf.preview.describe.${n}`,t.t("sheet.cf.subRuleType.average"))}case u.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case u.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case u.CFSubRuleType.number:{const n=r.operator;return t.t(`sheet.cf.preview.describe.${n}`,...Array.isArray(r.value)?r.value.map(a=>String(a)):[String(r.value||"")])}case u.CFSubRuleType.text:{const n=r.operator;return t.t(`sheet.cf.preview.describe.${n}`,r.value||"")}case u.CFSubRuleType.timePeriod:{const n=r.operator;return t.t(`sheet.cf.preview.describe.${n}`)}case u.CFSubRuleType.rank:return r.isPercent?r.isBottom?t.t("sheet.cf.preview.describe.bottomNPercent",String(r.value)):t.t("sheet.cf.preview.describe.topNPercent",String(r.value)):r.isBottom?t.t("sheet.cf.preview.describe.bottomN",String(r.value)):t.t("sheet.cf.preview.describe.topN",String(r.value));case u.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let fn=0;const xa=e=>{const{onClick:t}=e,r=$.useDependency(u.ConditionalFormattingRuleModel),n=$.useDependency(w.IUniverInstanceService),a=$.useDependency(q.SheetsSelectionsService),i=$.useDependency(w.ICommandService),d=$.useDependency(w.LocaleService),S=$.useDependency(w.Injector),h=$.useDependency($.ISidebarService),C=$.useDependency(ze),m=$.useObservable(()=>n.getCurrentTypeOfUnit$(w.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),b=m.getUnitId(),E=m.getActiveSheet();if(!E)throw new Error("No active sheet found");const I=E.getSheetId(),[_,T]=V.useState([]),[p,o]=V.useState("2"),[s,f]=V.useState(0),[y,l]=V.useState(-1),[v,c]=V.useState(fn),g=V.useRef(null),P=[{label:d.t("sheet.cf.panel.workSheet"),value:"2"},{label:d.t("sheet.cf.panel.selectedRange"),value:"1"}],M=()=>{const j=r.getSubunitRules(b,I);if(!j||!j.length)return[];if(p==="1"){const Q=a.getCurrentLastSelection();if(!Q)return[];const te=Q.range;return j.filter(ce=>ce.ranges.some(pe=>w.Rectangle.intersects(pe,te)))}else if(p==="2")return[...j];return[]},[U,z]=V.useState(M);de.useHighlightRange(_),V.useEffect(()=>{const j=i.onCommandExecuted(Q=>{Q.id===q.SetWorksheetActiveOperation.id&&f(Math.random())});return()=>j.dispose()}),V.useEffect(()=>{z(M)},[p,s,b,I]),V.useEffect(()=>{if(p==="2")return;const j=new ye.Observable(Q=>{const te=[q.SetSelectionsOperation.id,u.AddConditionalRuleMutation.id,u.SetConditionalRuleMutation.id,u.DeleteConditionalRuleMutation.id,u.MoveConditionalRuleMutation.id],oe=i.onCommandExecuted(ce=>{const{id:pe,params:be}=ce,H=n.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getUnitId();te.includes(pe)&&be.unitId===H&&Q.next(null)});return()=>oe.dispose()}).pipe(ye.debounceTime(16)).subscribe(()=>{z(M)});return()=>{j.unsubscribe()}},[n,p,b,I]),V.useEffect(()=>{const j=r.$ruleChange.subscribe(()=>{f(Math.random())});return()=>j.unsubscribe()},[r]),V.useEffect(()=>{const j=()=>{var ce,pe;const oe=Math.max(0,((pe=(ce=g.current)==null?void 0:ce.getBoundingClientRect().width)!=null?pe:0)-8);return fn=oe,oe},te=new ye.Observable(oe=>{const ce=h.getContainer();if(ce){let pe=setTimeout(()=>{oe.next()},150);const be=()=>{pe&&clearTimeout(pe),pe=null},H=K=>{K.propertyName==="width"&&(be(),oe.next())};return ce.addEventListener("transitionend",H),()=>{be(),ce.removeEventListener("transitionend",H)}}}).pipe(ye.debounceTime(16)).subscribe(()=>{c(j())});return()=>{te.unsubscribe()}},[]);const O=j=>{var oe;const Q=n.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),te=(oe=n.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:oe.getSheetId();if(!Q||!te)throw new Error("No active sheet found");i.executeCommand(u.DeleteCfCommand.id,{unitId:Q,subUnitId:te,cfId:j.cfId})},L=(j,Q)=>{l(Q.y)},W=(j,Q,te)=>{var K;l(-1);const oe=n.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),ce=(K=n.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:K.getSheetId();if(!oe||!ce)throw new Error("No active sheet found");const pe=ie=>{const x=U.length;return Math.min(x-1,Math.max(0,ie))},be=U[pe(Q.y)].cfId,H=U[pe(te.y)].cfId;be!==H&&i.executeCommand(u.MoveCfCommand.id,{unitId:oe,subUnitId:ce,start:{id:be,type:"self"},end:{id:H,type:te.y>Q.y?"after":"before"}})},F=()=>{e.onCreate()},X=()=>{p==="2"?i.executeCommand(u.ClearWorksheetCfCommand.id):p==="1"&&U.map(Q=>({unitId:b,subUnitId:I,cfId:Q.cfId})).forEach(Q=>{i.executeCommand(u.DeleteCfCommand.id,Q)})},ae=V.useMemo(()=>{const j=n.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET),Q=j.getActiveSheet();return U.filter(te=>{const oe=te.ranges;return q.checkRangesEditablePermission(S,j.getUnitId(),Q.getSheetId(),oe)})},[U]),ne=ae.map((j,Q)=>({i:j.cfId,x:0,w:12,y:Q,h:1,isResizable:!1})),se=V.useMemo(()=>{const j=n.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET),Q=j.getActiveSheet();return U.every(te=>{const oe=te.ranges;return q.checkRangesEditablePermission(S,j.getUnitId(),Q.getSheetId(),oe)})},[U]);return R.jsxs("div",{children:[R.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm",children:[R.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:C.tWithReactNode("sheet.cf.panel.managerRuleSelect",R.jsx(J.Select,{className:"univer-w-36",options:P,value:p,onChange:j=>{o(j)}})).map((j,Q)=>R.jsx("span",{children:j},Q))}),R.jsxs("div",{className:"univer-flex univer-justify-end",children:[R.jsx(J.Tooltip,{title:d.t("sheet.cf.panel.createRule"),placement:"bottom",children:R.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:F,children:R.jsx(fr,{})})}),U.length&&se?R.jsx(J.Tooltip,{title:d.t("sheet.cf.panel.clear"),placement:"bottom",children:R.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:X,children:R.jsx(ft,{className:"univer-text-red-500"})})}):R.jsx("div",{children:R.jsx(ft,{className:"univer-text-gray-300"})})]})]}),R.jsx("div",{ref:g,children:v>0&&R.jsx(_a,{className:`
35
+ [&_.react-grid-item]:univer-transition-none
36
+ [&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200
37
+ `,draggableHandle:".draggableHandle",layout:ne,cols:12,rowHeight:60,width:v,margin:[0,10],onDragStop:W,onDragStart:L,children:ae==null?void 0:ae.map((j,Q)=>R.jsx("div",{children:R.jsxs("div",{className:J.clsx(`
38
+ univer-group univer-relative univer-flex univer-items-center
39
+ univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8
40
+ hover:univer-bg-gray-100
41
+ `,{"univer-bg-gray-100":y===Q}),onMouseMove:()=>{j.ranges!==_&&T(j.ranges)},onMouseLeave:()=>T([]),onClick:()=>{t(j)},children:[R.jsx("div",{className:J.clsx(`
42
+ univer-absolute univer-left-0 univer-hidden univer-size-5
43
+ univer-cursor-grab univer-items-center univer-justify-center
44
+ univer-rounded
45
+ group-hover:univer-flex
46
+ `,"draggableHandle"),onClick:te=>te.stopPropagation(),children:R.jsx(pr,{})}),R.jsxs("div",{className:`
47
+ univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden
48
+ `,children:[R.jsx("div",{className:"univer-text-sm univer-text-gray-900",children:Oa(j,d)}),R.jsx("div",{className:"univer-text-xs univer-text-gray-400",children:j.ranges.map(te=>Lt.serializeRange(te)).join(",")})]}),R.jsx("div",{children:R.jsx(Ne,{rule:j.rule})}),R.jsx("div",{className:J.clsx(`
49
+ univer-absolute univer-right-1 univer-hidden univer-size-6
50
+ univer-cursor-pointer univer-items-center univer-justify-center
51
+ univer-rounded
52
+ group-hover:univer-flex
53
+ hover:univer-bg-gray-200
54
+ `,{"univer-flex univer-items-center univer-justify-center":y===Q}),onClick:te=>{te.stopPropagation(),O(j),T([])},children:R.jsx(ft,{})})]})},`${j.cfId}`))})})]})},Da=e=>{const[t,r]=V.useState(e.rule),[n,a]=V.useState(!!e.rule),i=()=>{a(!0)},d=()=>{a(!1),r(void 0)},S=h=>{r(h),a(!0)};return R.jsx("div",{className:"univer-flex univer-h-full univer-flex-col univer-justify-between",children:n?R.jsx(Hn,{onCancel:d,rule:t}):R.jsx(xa,{onClick:S,onCreate:i})})};var Pa=Object.getOwnPropertyDescriptor,Ma=(e,t,r,n)=>{for(var a=n>1?void 0:n?Pa(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},tt=(e,t)=>(r,n)=>t(r,n,e);const It="sheet.conditional.formatting.panel";let rt=class extends w.Disposable{constructor(t,r,n,a,i){super();Re(this,"_sidebarDisposable",null);this._univerInstanceService=t,this._injector=r,this._componentManager=n,this._sidebarService=a,this._localeService=i,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(w.UniverInstanceType.UNIVER_SHEET).subscribe(d=>{var S;d||(S=this._sidebarDisposable)==null||S.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(d=>{d.id===It&&(d.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(t){const r={id:It,header:{title:this._localeService.t("sheet.cf.title")},children:{label:It,rule:t,key:w.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(r)}_initPanel(){this._componentManager.register(It,Da)}};rt=Ma([tt(0,w.IUniverInstanceService),tt(1,w.Inject(w.Injector)),tt(2,w.Inject($.ComponentManager)),tt(3,w.Inject($.ISidebarService)),tt(4,w.Inject(w.LocaleService))],rt);var ve=(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))(ve||{});const nt={id:"sheet.operation.open.conditional.formatting.panel",type:w.CommandType.OPERATION,handler:(e,t)=>{var S;const r=e.get(rt),n=e.get(q.SheetsSelectionsService),a=e.get(w.ICommandService),i=((S=n.getCurrentSelections())==null?void 0:S.map(h=>h.range))||[];switch(t.value){case 3:{r.openPanel({...u.createDefaultRule(),ranges:i});break}case 4:{const h={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank}};r.openPanel(h);break}case 5:{const h={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.formula,value:"="}};r.openPanel(h);break}case 6:{const h={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.colorScale,config:[]}};r.openPanel(h);break}case 7:{const h={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.dataBar,isShowValue:!0}};r.openPanel(h);break}case 8:{const h={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.iconSet,config:[],isShowValue:!0}};r.openPanel(h);break}case 2:{r.openPanel();break}case 1:{r.openPanel({...u.createDefaultRule(),ranges:i});break}case 9:{a.executeCommand(u.ClearRangeCfCommand.id,{ranges:i});break}case 10:{a.executeCommand(u.ClearWorksheetCfCommand.id);break}}return!0}};var Na=Object.getOwnPropertyDescriptor,La=(e,t,r,n)=>{for(var a=n>1?void 0:n?Na(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},at=(e,t)=>(r,n)=>t(r,n,e);let it=class extends w.Disposable{constructor(t,r,n,a,i){super();Re(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=r,this._injector=n,this._conditionalFormattingViewModel=a,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,r,n)=>this._collectConditionalRule(t,r,n),onPasteCells:(t,r,n,a)=>{const{copyType:i=de.COPY_TYPE.COPY,pasteType:d}=a,{range:S}=t||{},{range:h}=r;return this._generateConditionalFormattingMutations(h,{copyType:i,pasteType:d,copyRange:S})}}))}_collectConditionalRule(t,r,n){const a=new w.ObjectMatrix,i={};this._copyInfo={matrix:a,info:{unitId:t,subUnitId:r,cfMap:i}};const d=this._injector.invoke(m=>q.rangeToDiscreteRange(n,m,t,r));if(!d)return;const{rows:S,cols:h}=d,C=new Set;S.forEach((m,b)=>{h.forEach((E,I)=>{const _=this._conditionalFormattingViewModel.getCellCfs(t,r,m,E);_&&(_.forEach(T=>C.add(T.cfId)),a.setValue(b,I,_.map(T=>T.cfId)))})}),C.forEach(m=>{const b=this._conditionalFormattingRuleModel.getRule(t,r,m);b&&(i[m]=b.rule)})}_generateConditionalFormattingMutations(t,r){const n=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),a=n.getActiveSheet(),i=n.getUnitId();if(!a)return{redos:[],undos:[]};const d=a.getSheetId();if(r.copyType===de.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!r.copyRange)return{redos:[],undos:[]};if(![de.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,de.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,de.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(r.pasteType))return{redos:[],undos:[]};const{ranges:[h,C],mapFunc:m}=de.virtualizeDiscreteRanges([r.copyRange,t]),b=de.getRepeatRange(h,C,!0),E={};w.Range.foreach(C,(l,v)=>{const{row:c,col:g}=m(l,v),P=this._conditionalFormattingViewModel.getCellCfs(i,d,c,g);P&&P.forEach(M=>{if(!E[M.cfId]){const U=new w.ObjectMatrix;E[M.cfId]=U;const z=this._conditionalFormattingRuleModel.getRule(i,d,M.cfId);z==null||z.ranges.forEach(O=>{w.Range.foreach(O,(L,W)=>{U.setValue(L,W,1)})})}E[M.cfId].realDeleteValue(c,g)})});const{matrix:I,info:_}=this._copyInfo,T=[];let p=this._conditionalFormattingRuleModel.createCfId(i,d);const o={},s=l=>{if(o[l])return o[l];const v=_==null?void 0:_.cfMap[l],c=[...this._conditionalFormattingRuleModel.getSubunitRules(i,d)||[],...T].find(g=>w.Tools.diffValue(g.rule,v));if(c)return o[l]=c,c;{const g={rule:v,cfId:p,ranges:[],stopIfTrue:!1};return o[l]=g,T.push(g),p=`${Number(p)+1}`,g}};b.forEach(l=>{I&&I.forValue((v,c,g)=>{const P=w.Rectangle.getPositionRange({startRow:v,endRow:v,startColumn:c,endColumn:c},l.startRange),{row:M,col:U}=m(P.startRow,P.startColumn);g.forEach(z=>{if(!E[z]){const O=s(z),L=new w.ObjectMatrix;E[z]=L,O.ranges.forEach(W=>{w.Range.foreach(W,(F,X)=>{L.setValue(F,X,1)})})}E[z].setValue(M,U,1)})})});const f=[],y=[];for(const l in E){const v=E[l],c=q.findAllRectangle(q.createTopMatrixFromMatrix(v));if(!c.length){const g={unitId:i,subUnitId:d,cfId:l};f.push({id:u.DeleteConditionalRuleMutation.id,params:g}),y.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}if(T.some(g=>g.cfId===l)){const g=s(l),P={unitId:i,subUnitId:d,rule:{...g,ranges:c}};f.push({id:u.AddConditionalRuleMutation.id,params:P}),y.push(u.AddConditionalRuleMutationUndoFactory(this._injector,P))}else{const g=this._conditionalFormattingRuleModel.getRule(i,d,l);if(!g)continue;const P={unitId:i,subUnitId:d,rule:{...g,ranges:c}};f.push({id:u.SetConditionalRuleMutation.id,params:P}),y.push(...u.setConditionalRuleMutationUndoFactory(this._injector,P))}}return{redos:f,undos:y}}};it=La([at(0,w.Inject(de.ISheetClipboardService)),at(1,w.Inject(u.ConditionalFormattingRuleModel)),at(2,w.Inject(w.Injector)),at(3,w.Inject(u.ConditionalFormattingViewModel)),at(4,w.Inject(w.IUniverInstanceService))],it);var Va=Object.getOwnPropertyDescriptor,Ua=(e,t,r,n)=>{for(var a=n>1?void 0:n?Va(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},ir=(e,t)=>(r,n)=>t(r,n,e);let ot=class extends w.Disposable{constructor(e,t,r){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=r,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===u.AddCfCommand.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[q.WorkbookEditablePermission],rangeTypes:[q.RangeProtectionPermissionEditPoint],worksheetTypes:[q.WorksheetEditPermission,q.WorksheetSetCellStylePermission]},e.params.rule.ranges)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")))}))}};ot=Ua([ir(0,w.Inject(w.LocaleService)),ir(1,w.ICommandService),ir(2,w.Inject(q.SheetPermissionCheckController))],ot);var za=Object.getOwnPropertyDescriptor,ka=(e,t,r,n)=>{for(var a=n>1?void 0:n?za(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},Rt=(e,t)=>(r,n)=>t(r,n,e);let st=class extends w.Disposable{constructor(e,t,r,n){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=r,this._refRangeService=n,this._initRefRange()}_initRefRange(){const e=new Map,t=(n,a,i)=>`${n}_${a}_${i}`,r=(n,a,i)=>{const d=h=>{const C=[...i.ranges],m=C.map(E=>q.handleDefaultRangeChangeWithEffectRefCommands(E,h)).filter(E=>!!E);if(u.isRangesEqual(m,C))return{redos:[],undos:[]};if(m.length){const E={unitId:n,subUnitId:a,rule:{...i,ranges:m}},I=[{id:u.SetConditionalRuleMutation.id,params:E}],_=u.setConditionalRuleMutationUndoFactory(this._injector,E);return{redos:I,undos:_}}else{const E={unitId:n,subUnitId:a,cfId:i.cfId},I=[{id:u.DeleteConditionalRuleMutation.id,params:E}],_=u.DeleteConditionalRuleMutationUndoFactory(this._injector,E);return{redos:I,undos:_}}},S=[];i.ranges.forEach(h=>{const C=this._refRangeService.registerRefRange(h,d);S.push(()=>C.dispose())}),e.set(t(n,a,i.cfId),()=>S.forEach(h=>h()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{const{unitId:a,subUnitId:i,rule:d}=n,S=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),h=S.getActiveSheet();if(!(n.unitId!==S.getUnitId()||n.subUnitId!==(h==null?void 0:h.getSheetId())))switch(n.type){case"add":{r(n.unitId,n.subUnitId,n.rule);break}case"delete":{const C=e.get(t(a,i,d.cfId));C&&C();break}case"set":{const C=e.get(t(a,i,d.cfId));C&&C(),r(n.unitId,n.subUnitId,n.rule)}}})),this.disposeWithMe(w.toDisposable(()=>{e.forEach(n=>{n()}),e.clear()}))}};st=ka([Rt(0,w.Inject(u.ConditionalFormattingRuleModel)),Rt(1,w.Inject(w.IUniverInstanceService)),Rt(2,w.Inject(w.Injector)),Rt(3,w.Inject(q.RefRangeService))],st);var ja=Object.getOwnPropertyDescriptor,Aa=(e,t,r,n)=>{for(var a=n>1?void 0:n?ja(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},ke=(e,t)=>(r,n)=>t(r,n,e);let lt=class extends w.Disposable{constructor(t,r,n,a,i,d){super();Re(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=t,this._conditionalFormattingService=r,this._univerInstanceService=n,this._renderManagerService=a,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=d,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var r,n,a;const t=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId();(r=this._renderManagerService.getRenderById(t))==null||r.with(de.SheetSkeletonManagerService).reCalculate(),(a=(n=this._renderManagerService.getRenderById(t))==null?void 0:n.mainComponent)==null||a.makeDirty()}_initSkeleton(){this.disposeWithMe(ye.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(We.bufferTime(16),We.filter(t=>!!t.length),We.filter(t=>{const r=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const n=r.getActiveSheet();return n?t.filter(a=>a.unitId===r.getUnitId()&&a.subUnitId===n.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(q.INTERCEPTOR_POINT.CELL_CONTENT,{effect:w.InterceptorEffectEnum.Style,handler:(t,r,n)=>{const a=this._conditionalFormattingService.composeStyle(r.unitId,r.subUnitId,r.row,r.col);if(!a)return n(t);const i=r.workbook.getStyles(),S={...(typeof(t==null?void 0:t.s)=="string"?i.get(t==null?void 0:t.s):t==null?void 0:t.s)||{}},h={...t,s:S};return a.style&&Object.assign(S,a.style),h.fontRenderExtension||(h.fontRenderExtension={},a.isShowValue!==void 0&&(h.fontRenderExtension.isSkip=!a.isShowValue)),a.dataBar&&(h.dataBar=a.dataBar),a.iconSet&&(h.iconSet=a.iconSet,h.fontRenderExtension.leftOffset=u.DEFAULT_PADDING+u.DEFAULT_WIDTH),n(h)},priority:10}))}};lt=Aa([ke(0,w.Inject(q.SheetInterceptorService)),ke(1,w.Inject(u.ConditionalFormattingService)),ke(2,w.Inject(w.IUniverInstanceService)),ke(3,w.Inject(cr.IRenderManagerService)),ke(4,w.Inject(u.ConditionalFormattingViewModel)),ke(5,w.Inject(u.ConditionalFormattingRuleModel))],lt);const pn="sheets-conditional-formatting-ui.config",Et={};var Ha=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,Ba=(e,t,r)=>t in e?Ha(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fa=(e,t,r,n)=>{for(var a=n>1?void 0:n?Wa(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},or=(e,t)=>(r,n)=>t(r,n,e),hn=(e,t,r)=>Ba(e,typeof t!="symbol"?t+"":t,r);Y.UniverSheetsConditionalFormattingMobileUIPlugin=class extends w.Plugin{constructor(t=Et,r,n,a){super(),this._config=t,this._injector=r,this._commandService=n,this._configService=a;const{menu:i,...d}=w.merge({},Et,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(pn,d),this._initCommand(),this._injector.add([lt]),this._injector.add([st]),this._injector.add([it]),this._injector.add([ot]),this._injector.add([ze])}_initCommand(){[Ut,zt,kt,jt,At,Ht,Wt,Bt,Ft,nt].forEach(t=>{this._commandService.registerCommand(t)})}},hn(Y.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${u.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`),hn(Y.UniverSheetsConditionalFormattingMobileUIPlugin,"type",w.UniverInstanceType.UNIVER_SHEET),Y.UniverSheetsConditionalFormattingMobileUIPlugin=Fa([w.DependentOn(u.UniverSheetsConditionalFormattingPlugin),or(1,w.Inject(w.Injector)),or(2,w.Inject(w.ICommandService)),or(3,w.IConfigService)],Y.UniverSheetsConditionalFormattingMobileUIPlugin);var Ga=Object.getOwnPropertyDescriptor,qa=(e,t,r,n)=>{for(var a=n>1?void 0:n?Ga(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},ut=(e,t)=>(r,n)=>t(r,n,e);let Ot=class extends w.Disposable{constructor(e,t,r,n,a){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=r,this._conditionalFormattingRuleModel=n,this._conditionalFormattingViewModel=a,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(a,i,d,S,h)=>{var I;const C=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),m=(I=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:I.getSheetId();if(!C||!m)return;const b={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row},E={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};w.Range.foreach(d,(_,T)=>{const p=w.Rectangle.getPositionRange({startRow:_,startColumn:T,endColumn:T,endRow:_},b),o=w.Rectangle.getPositionRange({startRow:_,startColumn:T,endColumn:T,endRow:_},E),{row:s,col:f}=h(p.startRow,p.startColumn),y=this._conditionalFormattingViewModel.getCellCfs(C,m,s,f),{row:l,col:v}=h(o.startRow,o.startColumn),c=this._conditionalFormattingViewModel.getCellCfs(C,m,l,v);c&&c.forEach(g=>{let P=S.get(g.cfId);if(!S.get(g.cfId)){const M=this._conditionalFormattingRuleModel.getRule(C,m,g.cfId);if(!M)return;P=new w.ObjectMatrix,M.ranges.forEach(U=>{w.Range.foreach(U,(z,O)=>{P.setValue(z,O,1)})}),S.set(g.cfId,P)}P.realDeleteValue(l,v)}),y&&y.forEach(g=>{let P=S.get(g.cfId);if(!S.get(g.cfId)){const M=this._conditionalFormattingRuleModel.getRule(C,m,g.cfId);if(!M)return;P=new w.ObjectMatrix,M.ranges.forEach(U=>{w.Range.foreach(U,(z,O)=>{P.setValue(z,O,1)})}),S.set(g.cfId,P)}P.setValue(l,v,1)})})},r=(a,i)=>{var o,s,f;const d=(o=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:o.getUnitId(),S=(f=(s=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getActiveSheet())==null?void 0:f.getSheetId(),h=new Map,C=[],m=[];if(!d||!S)return e();const b=de.virtualizeDiscreteRanges([a,i]),[E,I]=b.ranges,{mapFunc:_}=b,T={row:E.startRow,col:E.startColumn};return de.getAutoFillRepeatRange(E,I).forEach(y=>{t(T,y.repeatStartCell,y.relativeRange,h,_)}),h.forEach((y,l)=>{const v=this._conditionalFormattingRuleModel.getRule(d,S,l);if(!v)return;const c=q.findAllRectangle(q.createTopMatrixFromMatrix(y));if(c.length){const g={unitId:d,subUnitId:S,rule:{...v,ranges:c}};C.push({id:u.SetConditionalRuleMutation.id,params:g}),m.push(...u.setConditionalRuleMutationUndoFactory(this._injector,g))}else{const g={unitId:d,subUnitId:S,cfId:v.cfId};C.push({id:u.DeleteConditionalRuleMutation.id,params:g}),m.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}}),{undos:m,redos:C}},n={id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(a,i,d)=>{if(d===de.APPLY_TYPE.COPY||d===de.APPLY_TYPE.ONLY_FORMAT||d===de.APPLY_TYPE.SERIES){const{source:S,target:h}=a;return r(S,h)}return e()}};this.disposeWithMe(this._autoFillService.addHook(n))}};Ot=qa([ut(0,w.Inject(w.Injector)),ut(1,w.Inject(w.IUniverInstanceService)),ut(2,w.Inject(de.IAutoFillService)),ut(3,w.Inject(u.ConditionalFormattingRuleModel)),ut(4,w.Inject(u.ConditionalFormattingViewModel))],Ot);var Ya=Object.getOwnPropertyDescriptor,Xa=(e,t,r,n)=>{for(var a=n>1?void 0:n?Ya(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},ct=(e,t)=>(r,n)=>t(r,n,e);Y.ConditionalFormattingClearController=class extends w.Disposable{constructor(t,r,n,a,i){super(),this._injector=t,this._univerInstanceService=r,this._sheetInterceptorService=n,this._selectionManagerService=a,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{var i;const r=[],n=[],a={redos:r,undos:n};if([q.ClearSelectionFormatCommand.id,q.ClearSelectionAllCommand.id].includes(t.id)){const d=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(_=>_.range);if(!d)return a;const S=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),h=S.getActiveSheet();if(!h)return a;const C=S.getUnitId(),m=h.getSheetId(),b=this._conditionalFormattingRuleModel.getSubunitRules(C,m);if(!b||!b.length)return a;const{redos:E,undos:I}=vn(this._injector,b,d,C,m);r.push(...E),n.push(...I)}return a}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:t,subUnitId:r,ranges:n})=>{const a=[],i=[],d={redos:a,undos:i};if(!n||!n.length)return d;const S=this._conditionalFormattingRuleModel.getSubunitRules(t,r);if(!S||!S.length)return d;const{redos:h,undos:C}=vn(this._injector,S,n,t,r);return a.push(...h),i.push(...C),d}}))}},Y.ConditionalFormattingClearController=Xa([ct(0,w.Inject(w.Injector)),ct(1,w.Inject(w.IUniverInstanceService)),ct(2,w.Inject(q.SheetInterceptorService)),ct(3,w.Inject(q.SheetsSelectionsService)),ct(4,w.Inject(u.ConditionalFormattingRuleModel))],Y.ConditionalFormattingClearController);function vn(e,t,r,n,a){const i=[],d=[];return t.filter(S=>r.some(h=>S.ranges.some(C=>w.Rectangle.getIntersects(C,h)))).forEach(S=>{const C=new q.RangeMergeUtil().add(...S.ranges).subtract(...r).merge();if(C.length){const m={id:u.SetConditionalRuleMutation.id,params:{unitId:n,subUnitId:a,rule:{...S,ranges:C}}},b=u.setConditionalRuleMutationUndoFactory(e,m.params);i.push(m),d.push(...b)}else{const m={id:u.DeleteConditionalRuleMutation.id,params:{unitId:n,subUnitId:a,cfId:S.cfId}},b=u.DeleteConditionalRuleMutationUndoFactory(e,m.params);i.push(m),d.push(...b)}}),{redos:i,undos:d}}var Ka=Object.getOwnPropertyDescriptor,Za=(e,t,r,n)=>{for(var a=n>1?void 0:n?Ka(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},gn=(e,t)=>(r,n)=>t(r,n,e);let xt=class extends w.Disposable{constructor(e,t){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(w.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(q.AFTER_CELL_EDIT,{handler:(e,t,r)=>{var d,S,h;e||r(e);const n=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col),a=(d=n==null?void 0:n.style)!=null?d:{},i=Object.keys(a);if(e!=null&&e.p)return(h=(S=e.p.body)==null?void 0:S.textRuns)==null||h.forEach(C=>{C.ts&&i.forEach(m=>{var b;(b=C.ts)==null||delete b[m]})}),r(e);{const C={...(typeof(e==null?void 0:e.s)=="string"?t.workbook.getStyles().get(e.s):e==null?void 0:e.s)||{}};i.forEach(b=>{delete C[b]});const m={...e,s:{...C}};return r(m)}}})))}};xt=Za([gn(0,w.Inject(q.SheetInterceptorService)),gn(1,w.Inject(u.ConditionalFormattingService))],xt);const mn=[q.SetWorksheetActiveOperation.id,u.AddConditionalRuleMutation.id,u.SetConditionalRuleMutation.id,u.DeleteConditionalRuleMutation.id,u.MoveConditionalRuleMutation.id],dt=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:ve.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:ve.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:ve.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:ve.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:ve.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:ve.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:ve.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:ve.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:ve.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:ve.clearWorkSheetRules}],Ja=e=>{const t=e.get(q.SheetsSelectionsService),r=e.get(w.ICommandService),n=e.get(w.IUniverInstanceService),a=e.get(u.ConditionalFormattingRuleModel),i=new ye.Observable(h=>ye.merge(t.selectionMoveEnd$,t.selectionSet$,new ye.Observable(C=>{const m=r.onCommandExecuted(b=>{var T;const{id:E,params:I}=b,_=(T=n.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:T.getUnitId();mn.includes(E)&&I.unitId===_&&C.next(null)});return()=>m.dispose()})).pipe(We.debounceTime(16)).subscribe(()=>{var T;const C=((T=t.getCurrentSelections())==null?void 0:T.map(p=>p.range))||[],m=n.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET);if(!m)return;const b=m.getActiveSheet();if(!b)return;const _=(a.getSubunitRules(m.getUnitId(),b.getSheetId())||[]).filter(p=>p.ranges.some(o=>C.some(s=>w.Rectangle.intersects(s,o)))).map(p=>p.ranges).every(p=>q.checkRangesEditablePermission(e,m.getUnitId(),b.getSheetId(),p));h.next(_)})),d=new ye.Observable(h=>new ye.Observable(C=>{const m=r.onCommandExecuted(b=>{var T;const{id:E,params:I}=b,_=(T=n.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:T.getUnitId();mn.includes(E)&&I.unitId===_&&C.next(null)});return()=>m.dispose()}).pipe(We.debounceTime(16)).subscribe(()=>{const C=n.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET);if(!C)return;const m=C.getActiveSheet();if(!m)return;const b=a.getSubunitRules(C.getUnitId(),m.getSheetId())||[];if(!b.length)return h.next(!1),!1;const E=b.map(I=>I.ranges).every(I=>q.checkRangesEditablePermission(e,C.getUnitId(),m.getSheetId(),I));h.next(E)})),S=new ye.Observable(h=>{i.subscribe(C=>{const m=dt.find(b=>b.value===ve.clearRangeRules);m&&(m.disabled=!C,h.next(dt))}),d.subscribe(C=>{const m=dt.find(b=>b.value===ve.clearWorkSheetRules);m&&(m.disabled=!C,h.next(dt))}),h.next(dt)});return{id:nt.id,type:$.MenuItemType.SELECTOR,icon:"Conditions",tooltip:"sheet.cf.title",selections:S,hidden$:$.getMenuHiddenObservable(e,w.UniverInstanceType.UNIVER_SHEET),disabled$:de.getCurrentRangeDisable$(e,{workbookTypes:[q.WorkbookEditablePermission],worksheetTypes:[q.WorksheetSetCellStylePermission,q.WorksheetEditPermission],rangeTypes:[q.RangeProtectionPermissionEditPoint]})}},Qa={[$.RibbonStartGroup.FORMULAS_INSERT]:{[nt.id]:{order:0,menuItemFactory:Ja}}};var $a=Object.getOwnPropertyDescriptor,ei=(e,t,r,n)=>{for(var a=n>1?void 0:n?$a(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},yn=(e,t)=>(r,n)=>t(r,n,e);let Dt=class extends w.Disposable{constructor(t,r){super();Re(this,"_sidebarDisposable",null);this._injector=t,this._menuManagerService=r,this._menuManagerService.mergeMenu(Qa)}};Dt=ei([yn(0,w.Inject(w.Injector)),yn(1,$.IMenuManagerService)],Dt);var ti=Object.getOwnPropertyDescriptor,ri=(e,t,r,n)=>{for(var a=n>1?void 0:n?ti(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},je=(e,t)=>(r,n)=>t(r,n,e);const ni=(e,t)=>{const r=m=>m.endRow-m.startRow+1,n=m=>m.endColumn-m.startColumn+1,a=r(t)%r(e),i=n(t)%n(e),d=Math.floor(r(t)/r(e)),S=Math.floor(n(t)/n(e)),h=[],C={startRow:0,endRow:r(e)-1,startColumn:0,endColumn:n(e)-1};if(r(t)===1&&n(t)===1){const m={startRow:t.startRow,endRow:t.startRow,startColumn:t.startColumn,endColumn:t.startColumn};return h.push({repeatRelativeRange:C,startRange:m}),h}for(let m=0;m<d+(a?.1:0);m++)for(let b=0;b<S+(i?.1:0);b++){const E=r(e)*m,I=n(e)*b,_={startRow:E+t.startRow,endRow:E+t.startRow,startColumn:I+t.startColumn,endColumn:I+t.startColumn};let T=C;m===d&&a&&(T={...T},T.endRow=T.endRow-(r(e)-a)),b===S&&i&&(T={...T},T.endColumn=T.endColumn-(n(e)-i)),h.push({repeatRelativeRange:T,startRange:_})}return h};let Pt=class extends w.Disposable{constructor(t,r,n,a,i,d){super();Re(this,"_painterConfig",null);this._injector=t,this._univerInstanceService=r,this._formatPainterService=n,this._sheetsSelectionsService=a,this._conditionalFormattingRuleModel=i,this._conditionalFormattingViewModel=d,this._initFormattingPainter()}_initFormattingPainter(){const t=()=>({redos:[],undos:[]}),r=(i,d,S,h,C)=>{const{unitId:m,subUnitId:b}=this._painterConfig,{targetUnitId:E,targetSubUnitId:I}=C,_={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row},T={startRow:d.row,startColumn:d.col,endColumn:d.col,endRow:d.row};w.Range.foreach(S,(p,o)=>{const s=w.Rectangle.getPositionRange({startRow:p,startColumn:o,endColumn:o,endRow:p},_),f=w.Rectangle.getPositionRange({startRow:p,startColumn:o,endColumn:o,endRow:p},T),y=this._conditionalFormattingViewModel.getCellCfs(m,b,s.startRow,s.startColumn),l=this._conditionalFormattingViewModel.getCellCfs(E,I,f.startRow,f.startColumn);l&&l.forEach(v=>{let c=h.get(v.cfId);if(!h.get(v.cfId)){const g=this._conditionalFormattingRuleModel.getRule(E,I,v.cfId);if(!g)return;c=new w.ObjectMatrix,g.ranges.forEach(P=>{w.Range.foreach(P,(M,U)=>{c.setValue(M,U,1)})}),h.set(v.cfId,c)}c.realDeleteValue(f.startRow,f.startColumn)}),y&&y.forEach(v=>{const c=h.get(v.cfId);c&&c.setValue(f.startRow,f.startColumn,1)})})},n=(i,d,S)=>{var s;const{range:h,unitId:C,subUnitId:m}=this._painterConfig,b=i!==C||m!==d,E=new Map,I=[],_=[];if(!i||!d||!C||!m)return t();const T=(s=this._conditionalFormattingRuleModel.getSubunitRules(C,m))!=null?s:[];T==null||T.forEach(f=>{const{ranges:y,cfId:l}=f;if(y.some(v=>w.Rectangle.intersects(h,v))){const v=new w.ObjectMatrix;b||y.forEach(c=>{w.Range.foreach(c,(g,P)=>{v.setValue(g,P,1)})}),E.set(l,v)}});const p={row:h.startRow,col:h.startColumn};return ni(h,S).forEach(f=>{r(p,{row:f.startRange.startRow,col:f.startRange.startColumn},f.repeatRelativeRange,E,{targetUnitId:i,targetSubUnitId:d})}),E.forEach((f,y)=>{if(b){const l=this._conditionalFormattingRuleModel.getRule(i,d,y),v=q.findAllRectangle(q.createTopMatrixFromMatrix(f));if(l)if(v.length){const c={unitId:i,subUnitId:d,rule:{...l,ranges:v}};I.push({id:u.SetConditionalRuleMutation.id,params:c}),_.push(...u.setConditionalRuleMutationUndoFactory(this._injector,c))}else{const c={unitId:i,subUnitId:d,cfId:l.cfId};I.push({id:u.DeleteConditionalRuleMutation.id,params:c}),_.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,c))}else if(v.length){const c=this._conditionalFormattingRuleModel.getRule(C,m,y);if(c){const g={unitId:i,subUnitId:d,rule:{...w.Tools.deepClone(c),cfId:this._conditionalFormattingRuleModel.createCfId(i,d),ranges:v}};I.push({id:u.AddConditionalRuleMutation.id,params:g}),_.push(u.AddConditionalRuleMutationUndoFactory(this._injector,g))}}}else{const l=this._conditionalFormattingRuleModel.getRule(C,m,y);if(!l)return;const v=q.findAllRectangle(q.createTopMatrixFromMatrix(f));if(v.length){const c={unitId:C,subUnitId:m,rule:{...l,ranges:v}};I.push({id:u.SetConditionalRuleMutation.id,params:c}),_.push(...u.setConditionalRuleMutationUndoFactory(this._injector,c))}else{const c={unitId:C,subUnitId:m,cfId:l.cfId};I.push({id:u.DeleteConditionalRuleMutation.id,params:c}),_.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,c))}}}),{undos:_,redos:I}},a={id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:i=>{var d,S,h;switch(i){case de.FormatPainterStatus.INFINITE:case de.FormatPainterStatus.ONCE:{const C=(d=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:d.getUnitId(),m=(h=(S=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getActiveSheet())==null?void 0:h.getSheetId(),b=this._sheetsSelectionsService.getCurrentLastSelection(),E=b==null?void 0:b.range;C&&m&&E&&(this._painterConfig={unitId:C,subUnitId:m,range:E});break}case de.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(i,d,S)=>this._painterConfig?n(i,d,S):{redos:[],undos:[]}};this._formatPainterService.addHook(a)}};Pt=ri([je(0,w.Inject(w.Injector)),je(1,w.Inject(w.IUniverInstanceService)),je(2,w.Inject(de.IFormatPainterService)),je(3,w.Inject(q.SheetsSelectionsService)),je(4,w.Inject(u.ConditionalFormattingRuleModel)),je(5,w.Inject(u.ConditionalFormattingViewModel))],Pt);var ai=Object.getOwnPropertyDescriptor,ii=(e,t,r,n)=>{for(var a=n>1?void 0:n?ai(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},sr=(e,t)=>(r,n)=>t(r,n,e);let Mt=class extends w.Disposable{constructor(e,t,r){super(),this._conditionalFormattingViewModel=e,this._univerInstanceService=t,this._renderManagerService=r,this._init()}_init(){const e=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),t=r=>{const n=r.getUnitId(),a=this._renderManagerService.getRenderById(n);if(!a)return;const i=a.with(de.SheetSkeletonManagerService);this.disposeWithMe(i.currentSkeleton$.subscribe(d=>{if(d){const S=d.skeleton.rowColumnSegment,h=S.endColumn-S.startColumn+1,m=(S.endRow-S.startRow+1)*h*9,b=Math.max(u.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,m);this._conditionalFormattingViewModel.setCacheLength(b)}}))};e&&t(e),this._univerInstanceService.getCurrentTypeOfUnit$(w.UniverInstanceType.UNIVER_SHEET).subscribe(r=>{r&&t(r)})}};Mt=ii([sr(0,w.Inject(u.ConditionalFormattingViewModel)),sr(1,w.IUniverInstanceService),sr(2,cr.IRenderManagerService)],Mt);var oi=Object.defineProperty,si=Object.getOwnPropertyDescriptor,li=(e,t,r)=>t in e?oi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ui=(e,t,r,n)=>{for(var a=n>1?void 0:n?si(t,r):t,i=e.length-1,d;i>=0;i--)(d=e[i])&&(a=d(a)||a);return a},lr=(e,t)=>(r,n)=>t(r,n,e),bn=(e,t,r)=>li(e,typeof t!="symbol"?t+"":t,r);Y.UniverSheetsConditionalFormattingUIPlugin=class extends w.Plugin{constructor(t=Et,r,n,a){super(),this._config=t,this._injector=r,this._commandService=n,this._configService=a;const{menu:i,...d}=w.merge({},Et,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(pn,d),this._initCommand()}onStarting(){w.registerDependencies(this._injector,[[lt],[st],[it],[Ot],[ot],[rt],[Dt],[ze],[xt],[Y.ConditionalFormattingClearController],[Pt],[Mt]]),w.touchDependencies(this._injector,[[lt]])}onReady(){w.touchDependencies(this._injector,[[Dt],[rt]])}onRendered(){w.touchDependencies(this._injector,[[Ot],[Y.ConditionalFormattingClearController],[it],[xt],[ze],[Pt],[ot],[st],[Mt]])}_initCommand(){[Ut,zt,kt,jt,At,Ht,Wt,Bt,Ft,nt].forEach(t=>{this._commandService.registerCommand(t)})}},bn(Y.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${u.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),bn(Y.UniverSheetsConditionalFormattingUIPlugin,"type",w.UniverInstanceType.UNIVER_SHEET),Y.UniverSheetsConditionalFormattingUIPlugin=ui([w.DependentOn(u.UniverSheetsConditionalFormattingPlugin),lr(1,w.Inject(w.Injector)),lr(2,w.Inject(w.ICommandService)),lr(3,w.IConfigService)],Y.UniverSheetsConditionalFormattingUIPlugin),Y.AddAverageCfCommand=Ut,Y.AddColorScaleConditionalRuleCommand=zt,Y.AddDataBarConditionalRuleCommand=kt,Y.AddDuplicateValuesCfCommand=jt,Y.AddNumberCfCommand=At,Y.AddRankCfCommand=Ht,Y.AddTextCfCommand=Wt,Y.AddTimePeriodCfCommand=Bt,Y.AddUniqueValuesCfCommand=Ft,Y.OpenConditionalFormattingOperator=nt,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});