@univerjs/sheets-conditional-formatting-ui 0.5.0-alpha.0 → 0.5.0-nightly.202411091605
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +310 -308
- package/lib/umd/index.js +3 -3
- package/package.json +11 -11
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ii=_,ai=Symbol.for("react.element"),si=Symbol.for("react.fragment"),li=Object.prototype.hasOwnProperty,ci=ii.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ui={key:!0,ref:!0,__self:!0,__source:!0};function Qr(t,e,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(a=e.ref);for(r in e)li.call(e,r)&&!ui.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:ai,type:t,key:i,ref:a,props:o,_owner:ci.current}}nn.Fragment=si;nn.jsx=Qr;nn.jsxs=Qr;Jr.exports=nn;var g=Jr.exports;const di="univer-conditional-formatting-wrap",fi="univer-cf-rule-item",pi="univer-preview",hi="univer-create-rule",mi="univer-button",gi="univer-title",vi="univer-label",yi="univer-label-container",Ci="univer-input-width",Si="univer-m-t-base",bi="univer-m-t-sm",Ri="univer-m-t-xl",Ti="univer-m-l-sm",wi="univer-m-l-xl",Ii="univer-m-l-xxs",_i="univer-m-l-0",xi="univer-m-r-0",F={conditionalFormattingWrap:di,cfRuleItem:fi,preview:pi,createRule:hi,button:mi,title:gi,label:vi,labelContainer:yi,inputWidth:Ci,mTBase:Si,mTSm:bi,mTXl:Ri,mLSm:Ti,mLXl:wi,mLXxs:Ii,mL0:_i,mR0:xi};var _e=function(){return _e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},_e.apply(this,arguments)},Ei=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n},ut=_.forwardRef(function(t,e){var n=t.icon,r=t.id,o=t.className,i=t.extend,a=Ei(t,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),s=_.useRef("_".concat(Fi()));return eo(n,"".concat(r),{defIds:n.defIds,idSuffix:s.current},_e({ref:e,className:c},a),i)});function eo(t,e,n,r,o){return _.createElement(t.tag,_e(_e({key:e},Oi(t,n,o)),r),(Mi(t,n).children||[]).map(function(i,a){return eo(i,"".concat(e,"-").concat(t.tag,"-").concat(a),n,void 0,o)}))}function Oi(t,e,n){var r=_e({},t.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=e.defIds;return!o||o.length===0||(t.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(i){var a=i[0],c=i[1];typeof c=="string"&&(r[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Mi(t,e){var n,r=e.defIds;return!r||r.length===0?t:t.tag==="defs"&&(!((n=t.children)===null||n===void 0)&&n.length)?_e(_e({},t),{children:t.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?_e(_e({},o),{attrs:_e(_e({},o.attrs),{id:o.attrs.id+e.idSuffix})}):o})}):t}function Fi(){return Math.random().toString(36).substring(2,8)}ut.displayName="UniverIcon";var Pi={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"}}]},Bt=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"delete-single",ref:e,icon:Pi}))});Bt.displayName="DeleteSingle";var Di={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"}}]},to=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"increase-single",ref:e,icon:Di}))});to.displayName="IncreaseSingle";var Ni={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"}}]},rn=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"more-down-single",ref:e,icon:Ni}))});rn.displayName="MoreDownSingle";var ji={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"}}]}]},no=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"sequence-single",ref:e,icon:ji}))});no.displayName="SequenceSingle";var $i={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"}}]}]},Ot=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"slash-single",ref:e,icon:$i}))});Ot.displayName="SlashSingle";var ro={exports:{}},Mt={},Pn={exports:{}};(function(t,e){(function(n,r){r(e)})(ri,function(n){function r(D){return function(K,Z,J,se,pe,Ie,le){return D(K,Z,le)}}function o(D){return function(K,Z,J,se){if(!K||!Z||typeof K!="object"||typeof Z!="object")return D(K,Z,J,se);var pe=se.get(K),Ie=se.get(Z);if(pe&&Ie)return pe===Z&&Ie===K;se.set(K,Z),se.set(Z,K);var le=D(K,Z,J,se);return se.delete(K),se.delete(Z),le}}function i(D,U){var K={};for(var Z in D)K[Z]=D[Z];for(var Z in U)K[Z]=U[Z];return K}function a(D){return D.constructor===Object||D.constructor==null}function c(D){return typeof D.then=="function"}function s(D,U){return D===U||D!==D&&U!==U}var u="[object Arguments]",f="[object Boolean]",p="[object Date]",h="[object RegExp]",v="[object Map]",S="[object Number]",y="[object Object]",O="[object Set]",R="[object String]",I=Object.prototype.toString;function b(D){var U=D.areArraysEqual,K=D.areDatesEqual,Z=D.areMapsEqual,J=D.areObjectsEqual,se=D.areRegExpsEqual,pe=D.areSetsEqual,Ie=D.createIsNestedEqual,le=Ie(Oe);function Oe(re,ce,Me){if(re===ce)return!0;if(!re||!ce||typeof re!="object"||typeof ce!="object")return re!==re&&ce!==ce;if(a(re)&&a(ce))return J(re,ce,le,Me);var Tr=Array.isArray(re),wr=Array.isArray(ce);if(Tr||wr)return Tr===wr&&U(re,ce,le,Me);var Fe=I.call(re);return Fe!==I.call(ce)?!1:Fe===p?K(re,ce,le,Me):Fe===h?se(re,ce,le,Me):Fe===v?Z(re,ce,le,Me):Fe===O?pe(re,ce,le,Me):Fe===y||Fe===u?c(re)||c(ce)?!1:J(re,ce,le,Me):Fe===f||Fe===S||Fe===R?s(re.valueOf(),ce.valueOf()):!1}return Oe}function x(D,U,K,Z){var J=D.length;if(U.length!==J)return!1;for(;J-- >0;)if(!K(D[J],U[J],J,J,D,U,Z))return!1;return!0}var m=o(x);function T(D,U){return s(D.valueOf(),U.valueOf())}function w(D,U,K,Z){var J=D.size===U.size;if(!J)return!1;if(!D.size)return!0;var se={},pe=0;return D.forEach(function(Ie,le){if(J){var Oe=!1,re=0;U.forEach(function(ce,Me){!Oe&&!se[re]&&(Oe=K(le,Me,pe,re,D,U,Z)&&K(Ie,ce,le,Me,D,U,Z))&&(se[re]=!0),re++}),pe++,J=Oe}}),J}var E=o(w),P="_owner",$=Object.prototype.hasOwnProperty;function z(D,U,K,Z){var J=Object.keys(D),se=J.length;if(Object.keys(U).length!==se)return!1;for(var pe;se-- >0;){if(pe=J[se],pe===P){var Ie=!!D.$$typeof,le=!!U.$$typeof;if((Ie||le)&&Ie!==le)return!1}if(!$.call(U,pe)||!K(D[pe],U[pe],pe,pe,D,U,Z))return!1}return!0}var q=o(z);function C(D,U){return D.source===U.source&&D.flags===U.flags}function M(D,U,K,Z){var J=D.size===U.size;if(!J)return!1;if(!D.size)return!0;var se={};return D.forEach(function(pe,Ie){if(J){var le=!1,Oe=0;U.forEach(function(re,ce){!le&&!se[Oe]&&(le=K(pe,re,Ie,ce,D,U,Z))&&(se[Oe]=!0),Oe++}),J=le}}),J}var A=o(M),Q=Object.freeze({areArraysEqual:x,areDatesEqual:T,areMapsEqual:w,areObjectsEqual:z,areRegExpsEqual:C,areSetsEqual:M,createIsNestedEqual:r}),X=Object.freeze({areArraysEqual:m,areDatesEqual:T,areMapsEqual:E,areObjectsEqual:q,areRegExpsEqual:C,areSetsEqual:A,createIsNestedEqual:r}),ue=b(Q);function ae(D,U){return ue(D,U,void 0)}var L=b(i(Q,{createIsNestedEqual:function(){return s}}));function G(D,U){return L(D,U,void 0)}var te=b(X);function ne(D,U){return te(D,U,new WeakMap)}var fe=b(i(X,{createIsNestedEqual:function(){return s}}));function Ce(D,U){return fe(D,U,new WeakMap)}function xe(D){return b(i(Q,D(Q)))}function Le(D){var U=b(i(X,D(X)));return function(K,Z,J){return J===void 0&&(J=new WeakMap),U(K,Z,J)}}n.circularDeepEqual=ne,n.circularShallowEqual=Ce,n.createCustomCircularEqual=Le,n.createCustomEqual=xe,n.deepEqual=ae,n.sameValueZeroEqual=s,n.shallowEqual=G,Object.defineProperty(n,"__esModule",{value:!0})})})(Pn,Pn.exports);var Qn=Pn.exports,Dn={exports:{}};function oo(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=oo(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Ir(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=oo(t))&&(r&&(r+=" "),r+=e);return r}Dn.exports=Ir,Dn.exports.clsx=Ir;var er=Dn.exports,W={},Li=function(e,n,r){return e===n?!0:e.className===n.className&&r(e.style,n.style)&&e.width===n.width&&e.autoSize===n.autoSize&&e.cols===n.cols&&e.draggableCancel===n.draggableCancel&&e.draggableHandle===n.draggableHandle&&r(e.verticalCompact,n.verticalCompact)&&r(e.compactType,n.compactType)&&r(e.layout,n.layout)&&r(e.margin,n.margin)&&r(e.containerPadding,n.containerPadding)&&e.rowHeight===n.rowHeight&&e.maxRows===n.maxRows&&e.isBounded===n.isBounded&&e.isDraggable===n.isDraggable&&e.isResizable===n.isResizable&&e.allowOverlap===n.allowOverlap&&e.preventCollision===n.preventCollision&&e.useCSSTransforms===n.useCSSTransforms&&e.transformScale===n.transformScale&&e.isDroppable===n.isDroppable&&r(e.resizeHandles,n.resizeHandles)&&r(e.resizeHandle,n.resizeHandle)&&e.onLayoutChange===n.onLayoutChange&&e.onDragStart===n.onDragStart&&e.onDrag===n.onDrag&&e.onDragStop===n.onDragStop&&e.onResizeStart===n.onResizeStart&&e.onResize===n.onResize&&e.onResizeStop===n.onResizeStop&&e.onDrop===n.onDrop&&r(e.droppingItem,n.droppingItem)&&r(e.innerRef,n.innerRef)};Object.defineProperty(W,"__esModule",{value:!0});W.bottom=tr;W.childrenEqual=Ai;W.cloneLayout=io;W.cloneLayoutItem=Ke;W.collides=on;W.compact=so;W.compactItem=lo;W.compactType=ea;W.correctBounds=co;W.fastPositionEqual=zi;W.fastRGLPropsEqual=void 0;W.getAllCollisions=uo;W.getFirstCollision=Xe;W.getLayoutItem=nr;W.getStatics=rr;W.modifyLayout=ao;W.moveElement=St;W.moveElementAwayFromCollision=jn;W.noop=void 0;W.perc=Hi;W.resizeItemInDirection=Yi;W.setTopLeft=Zi;W.setTransform=Ki;W.sortLayoutItems=cr;W.sortLayoutItemsByColRow=go;W.sortLayoutItemsByRowCol=mo;W.synchronizeLayoutWithChildren=Ji;W.validateLayout=Qi;W.withLayoutItem=Vi;var _r=Qn,Ct=Ui(_);function Ui(t){return t&&t.__esModule?t:{default:t}}function tr(t){let e=0,n;for(let r=0,o=t.length;r<o;r++)n=t[r].y+t[r].h,n>e&&(e=n);return e}function io(t){const e=Array(t.length);for(let n=0,r=t.length;n<r;n++)e[n]=Ke(t[n]);return e}function ao(t,e){const n=Array(t.length);for(let r=0,o=t.length;r<o;r++)e.i===t[r].i?n[r]=e:n[r]=t[r];return n}function Vi(t,e,n){let r=nr(t,e);return r?(r=n(Ke(r)),t=ao(t,r),[t,r]):[t,null]}function Ke(t){return{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,minW:t.minW,maxW:t.maxW,minH:t.minH,maxH:t.maxH,moved:!!t.moved,static:!!t.static,isDraggable:t.isDraggable,isResizable:t.isResizable,resizeHandles:t.resizeHandles,isBounded:t.isBounded}}function Ai(t,e){return(0,_r.deepEqual)(Ct.default.Children.map(t,n=>n==null?void 0:n.key),Ct.default.Children.map(e,n=>n==null?void 0:n.key))&&(0,_r.deepEqual)(Ct.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]),Ct.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]))}W.fastRGLPropsEqual=Li;function zi(t,e){return t.left===e.left&&t.top===e.top&&t.width===e.width&&t.height===e.height}function on(t,e){return!(t.i===e.i||t.x+t.w<=e.x||t.x>=e.x+e.w||t.y+t.h<=e.y||t.y>=e.y+e.h)}function so(t,e,n,r){const o=rr(t),i=cr(t,e),a=Array(t.length);for(let c=0,s=i.length;c<s;c++){let u=Ke(i[c]);u.static||(u=lo(o,u,e,n,i,r),o.push(u)),a[t.indexOf(i[c])]=u,u.moved=!1}return a}const ki={x:"w",y:"h"};function Nn(t,e,n,r){const o=ki[r];e[r]+=1;const i=t.map(a=>a.i).indexOf(e.i);for(let a=i+1;a<t.length;a++){const c=t[a];if(!c.static){if(c.y>e.y+e.h)break;on(e,c)&&Nn(t,c,n+e[o],r)}}e[r]=n}function lo(t,e,n,r,o,i){const a=n==="vertical",c=n==="horizontal";if(a)for(e.y=Math.min(tr(t),e.y);e.y>0&&!Xe(t,e);)e.y--;else if(c)for(;e.x>0&&!Xe(t,e);)e.x--;let s;for(;(s=Xe(t,e))&&!(n===null&&i);)if(c?Nn(o,e,s.x+s.w,"x"):Nn(o,e,s.y+s.h,"y"),c&&e.x+e.w>r)for(e.x=r-e.w,e.y++;e.x>0&&!Xe(t,e);)e.x--;return e.y=Math.max(e.y,0),e.x=Math.max(e.x,0),e}function co(t,e){const n=rr(t);for(let r=0,o=t.length;r<o;r++){const i=t[r];if(i.x+i.w>e.cols&&(i.x=e.cols-i.w),i.x<0&&(i.x=0,i.w=e.cols),!i.static)n.push(i);else for(;Xe(n,i);)i.y++}return t}function nr(t,e){for(let n=0,r=t.length;n<r;n++)if(t[n].i===e)return t[n]}function Xe(t,e){for(let n=0,r=t.length;n<r;n++)if(on(t[n],e))return t[n]}function uo(t,e){return t.filter(n=>on(n,e))}function rr(t){return t.filter(e=>e.static)}function St(t,e,n,r,o,i,a,c,s){if(e.static&&e.isDraggable!==!0||e.y===r&&e.x===n)return t;`${e.i}${String(n)}${String(r)}${e.x}${e.y}`;const u=e.x,f=e.y;typeof n=="number"&&(e.x=n),typeof r=="number"&&(e.y=r),e.moved=!0;let p=cr(t,a);(a==="vertical"&&typeof r=="number"?f>=r:a==="horizontal"&&typeof n=="number"?u>=n:!1)&&(p=p.reverse());const v=uo(p,e),S=v.length>0;if(S&&s)return io(t);if(S&&i)return`${e.i}`,e.x=u,e.y=f,e.moved=!1,t;for(let y=0,O=v.length;y<O;y++){const R=v[y];`${e.i}${e.x}${e.y}${R.i}${R.x}${R.y}`,!R.moved&&(R.static?t=jn(t,R,e,o,a):t=jn(t,e,R,o,a))}return t}function jn(t,e,n,r,o,i){const a=o==="horizontal",c=o==="vertical",s=e.static;if(r){r=!1;const p={x:a?Math.max(e.x-n.w,0):n.x,y:c?Math.max(e.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},h=Xe(t,p),v=h&&h.y+h.h>e.y,S=h&&e.x+e.w>h.x;if(h){if(v&&c)return St(t,n,void 0,e.y+1,r,s,o);if(v&&o==null)return e.y=n.y,n.y=n.y+n.h,t;if(S&&a)return St(t,e,n.x,void 0,r,s,o)}else return`${n.i}${p.x}${p.y}`,St(t,n,a?p.x:void 0,c?p.y:void 0,r,s,o)}const u=a?n.x+1:void 0,f=c?n.y+1:void 0;return u==null&&f==null?t:St(t,n,a?n.x+1:void 0,c?n.y+1:void 0,r,s,o)}function Hi(t){return t*100+"%"}const fo=(t,e,n,r)=>t+n>r?e:n,po=(t,e,n)=>t<0?e:n,ho=t=>Math.max(0,t),or=t=>Math.max(0,t),ir=(t,e,n)=>{let{left:r,height:o,width:i}=e;const a=t.top-(o-t.height);return{left:r,width:i,height:po(a,t.height,o),top:or(a)}},ar=(t,e,n)=>{let{top:r,left:o,height:i,width:a}=e;return{top:r,height:i,width:fo(t.left,t.width,a,n),left:ho(o)}},sr=(t,e,n)=>{let{top:r,height:o,width:i}=e;const a=t.left-(i-t.width);return{height:o,width:a<0?t.width:fo(t.left,t.width,i,n),top:or(r),left:ho(a)}},lr=(t,e,n)=>{let{top:r,left:o,height:i,width:a}=e;return{width:a,left:o,height:po(r,t.height,i),top:or(r)}},Wi=function(){return ir(arguments.length<=0?void 0:arguments[0],ar(...arguments))},qi=function(){return ir(arguments.length<=0?void 0:arguments[0],sr(...arguments))},Bi=function(){return lr(arguments.length<=0?void 0:arguments[0],ar(...arguments))},Gi=function(){return lr(arguments.length<=0?void 0:arguments[0],sr(...arguments))},Xi={n:ir,ne:Wi,e:ar,se:Bi,s:lr,sw:Gi,w:sr,nw:qi};function Yi(t,e,n,r){const o=Xi[t];return o?o(e,{...e,...n},r):n}function Ki(t){let{top:e,left:n,width:r,height:o}=t;const i=`translate(${n}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function Zi(t){let{top:e,left:n,width:r,height:o}=t;return{top:`${e}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function cr(t,e){return e==="horizontal"?go(t):e==="vertical"?mo(t):t}function mo(t){return t.slice(0).sort(function(e,n){return e.y>n.y||e.y===n.y&&e.x>n.x?1:e.y===n.y&&e.x===n.x?0:-1})}function go(t){return t.slice(0).sort(function(e,n){return e.x>n.x||e.x===n.x&&e.y>n.y?1:-1})}function Ji(t,e,n,r,o){t=t||[];const i=[];Ct.default.Children.forEach(e,c=>{if((c==null?void 0:c.key)==null)return;const s=nr(t,String(c.key)),u=c.props["data-grid"];s&&u==null?i.push(Ke(s)):u?i.push(Ke({...u,i:c.key})):i.push(Ke({w:1,h:1,x:0,y:tr(i),i:String(c.key)}))});const a=co(i,{cols:n});return o?a:so(a,r,n)}function Qi(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(t))throw new Error(e+" must be an array!");for(let r=0,o=t.length;r<o;r++){const i=t[r];for(let a=0;a<n.length;a++)if(typeof i[n[a]]!="number")throw new Error("ReactGridLayout: "+e+"["+r+"]."+n[a]+" must be a number!")}}function ea(t){const{verticalCompact:e,compactType:n}=t||{};return e===!1?null:n}const ta=()=>{};W.noop=ta;var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.calcGridColWidth=an;Ne.calcGridItemPosition=na;Ne.calcGridItemWHPx=$n;Ne.calcWH=oa;Ne.calcXY=ra;Ne.clamp=Ye;function an(t){const{margin:e,containerPadding:n,containerWidth:r,cols:o}=t;return(r-e[0]*(o-1)-n[0]*2)/o}function $n(t,e,n){return Number.isFinite(t)?Math.round(e*t+Math.max(0,t-1)*n):t}function na(t,e,n,r,o,i){const{margin:a,containerPadding:c,rowHeight:s}=t,u=an(t),f={};return i&&i.resizing?(f.width=Math.round(i.resizing.width),f.height=Math.round(i.resizing.height)):(f.width=$n(r,u,a[0]),f.height=$n(o,s,a[1])),i&&i.dragging?(f.top=Math.round(i.dragging.top),f.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(f.top=Math.round(i.resizing.top),f.left=Math.round(i.resizing.left)):(f.top=Math.round((s+a[1])*n+c[1]),f.left=Math.round((u+a[0])*e+c[0])),f}function ra(t,e,n,r,o){const{margin:i,cols:a,rowHeight:c,maxRows:s}=t,u=an(t);let f=Math.round((n-i[0])/(u+i[0])),p=Math.round((e-i[1])/(c+i[1]));return f=Ye(f,0,a-r),p=Ye(p,0,s-o),{x:f,y:p}}function oa(t,e,n,r,o,i){const{margin:a,maxRows:c,cols:s,rowHeight:u}=t,f=an(t);let p=Math.round((e+a[0])/(f+a[0])),h=Math.round((n+a[1])/(u+a[1])),v=Ye(p,0,s-r),S=Ye(h,0,c-o);return["sw","w","nw"].indexOf(i)!==-1&&(v=Ye(p,0,s)),["nw","n","ne"].indexOf(i)!==-1&&(S=Ye(h,0,c)),{w:v,h:S}}function Ye(t,e,n){return Math.max(Math.min(t,n),e)}var sn={},vo={exports:{}},ia="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",aa=ia,sa=aa;function yo(){}function Co(){}Co.resetWarningCache=yo;var la=function(){function t(r,o,i,a,c,s){if(s!==sa){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Co,resetWarningCache:yo};return n.PropTypes=n,n};vo.exports=la();var We=vo.exports,ln={exports:{}},So={};function bo(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=bo(t[e]))&&(r&&(r+=" "),r+=n);else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function xr(){for(var t,e,n=0,r="";n<arguments.length;)(t=arguments[n++])&&(e=bo(t))&&(r&&(r+=" "),r+=e);return r}const ca=Object.freeze(Object.defineProperty({__proto__:null,clsx:xr,default:xr},Symbol.toStringTag,{value:"Module"})),ua=Zr(ca);var ie={},je={};Object.defineProperty(je,"__esModule",{value:!0});je.dontSetMe=ma;je.findInArray=da;je.int=ha;je.isFunction=fa;je.isNum=pa;function da(t,e){for(let n=0,r=t.length;n<r;n++)if(e.apply(e,[t[n],n,t]))return t[n]}function fa(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Function]"}function pa(t){return typeof t=="number"&&!isNaN(t)}function ha(t){return parseInt(t,10)}function ma(t,e,n){if(t[e])return new Error("Invalid prop ".concat(e," passed to ").concat(n," - do not set this, set it on the child."))}var Je={};Object.defineProperty(Je,"__esModule",{value:!0});Je.browserPrefixToKey=To;Je.browserPrefixToStyle=ga;Je.default=void 0;Je.getPrefix=Ro;const Cn=["Moz","Webkit","O","ms"];function Ro(){var t;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(t=window.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.style;if(!n||e in n)return"";for(let r=0;r<Cn.length;r++)if(To(e,Cn[r])in n)return Cn[r];return""}function To(t,e){return e?"".concat(e).concat(va(t)):t}function ga(t,e){return e?"-".concat(e.toLowerCase(),"-").concat(t):t}function va(t){let e="",n=!0;for(let r=0;r<t.length;r++)n?(e+=t[r].toUpperCase(),n=!1):t[r]==="-"?n=!0:e+=t[r];return e}Je.default=Ro();Object.defineProperty(ie,"__esModule",{value:!0});ie.addClassName=_o;ie.addEvent=Sa;ie.addUserSelectStyles=Fa;ie.createCSSTransform=xa;ie.createSVGTransform=Ea;ie.getTouch=Oa;ie.getTouchIdentifier=Ma;ie.getTranslation=ur;ie.innerHeight=wa;ie.innerWidth=Ia;ie.matchesSelector=Io;ie.matchesSelectorAndParentsTo=Ca;ie.offsetXYFromParent=_a;ie.outerHeight=Ra;ie.outerWidth=Ta;ie.removeClassName=xo;ie.removeEvent=ba;ie.removeUserSelectStyles=Pa;var we=je,Er=ya(Je);function wo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(wo=function(r){return r?n:e})(t)}function ya(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=wo(e);if(n&&n.has(t))return n.get(t);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}let jt="";function Io(t,e){return jt||(jt=(0,we.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,we.isFunction)(t[n])})),(0,we.isFunction)(t[jt])?t[jt](e):!1}function Ca(t,e,n){let r=t;do{if(Io(r,e))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Sa(t,e,n,r){if(!t)return;const o={capture:!0,...r};t.addEventListener?t.addEventListener(e,n,o):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}function ba(t,e,n,r){if(!t)return;const o={capture:!0,...r};t.removeEventListener?t.removeEventListener(e,n,o):t.detachEvent?t.detachEvent("on"+e,n):t["on"+e]=null}function Ra(t){let e=t.clientHeight;const n=t.ownerDocument.defaultView.getComputedStyle(t);return e+=(0,we.int)(n.borderTopWidth),e+=(0,we.int)(n.borderBottomWidth),e}function Ta(t){let e=t.clientWidth;const n=t.ownerDocument.defaultView.getComputedStyle(t);return e+=(0,we.int)(n.borderLeftWidth),e+=(0,we.int)(n.borderRightWidth),e}function wa(t){let e=t.clientHeight;const n=t.ownerDocument.defaultView.getComputedStyle(t);return e-=(0,we.int)(n.paddingTop),e-=(0,we.int)(n.paddingBottom),e}function Ia(t){let e=t.clientWidth;const n=t.ownerDocument.defaultView.getComputedStyle(t);return e-=(0,we.int)(n.paddingLeft),e-=(0,we.int)(n.paddingRight),e}function _a(t,e,n){const o=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),i=(t.clientX+e.scrollLeft-o.left)/n,a=(t.clientY+e.scrollTop-o.top)/n;return{x:i,y:a}}function xa(t,e){const n=ur(t,e,"px");return{[(0,Er.browserPrefixToKey)("transform",Er.default)]:n}}function Ea(t,e){return ur(t,e,"")}function ur(t,e,n){let{x:r,y:o}=t,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(e){const a="".concat(typeof e.x=="string"?e.x:e.x+n),c="".concat(typeof e.y=="string"?e.y:e.y+n);i="translate(".concat(a,", ").concat(c,")")+i}return i}function Oa(t,e){return t.targetTouches&&(0,we.findInArray)(t.targetTouches,n=>e===n.identifier)||t.changedTouches&&(0,we.findInArray)(t.changedTouches,n=>e===n.identifier)}function Ma(t){if(t.targetTouches&&t.targetTouches[0])return t.targetTouches[0].identifier;if(t.changedTouches&&t.changedTouches[0])return t.changedTouches[0].identifier}function Fa(t){if(!t)return;let e=t.getElementById("react-draggable-style-el");e||(e=t.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
9
|
+
*/var ii=_,ai=Symbol.for("react.element"),si=Symbol.for("react.fragment"),li=Object.prototype.hasOwnProperty,ci=ii.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ui={key:!0,ref:!0,__self:!0,__source:!0};function Qr(t,e,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(a=e.ref);for(r in e)li.call(e,r)&&!ui.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:ai,type:t,key:i,ref:a,props:o,_owner:ci.current}}nn.Fragment=si;nn.jsx=Qr;nn.jsxs=Qr;Jr.exports=nn;var g=Jr.exports;const di="univer-conditional-formatting-wrap",fi="univer-cf-rule-item",pi="univer-preview",hi="univer-create-rule",mi="univer-button",gi="univer-title",vi="univer-label",yi="univer-label-container",Ci="univer-input-width",Si="univer-m-t-base",bi="univer-m-t-sm",Ri="univer-m-t-xl",Ti="univer-m-l-sm",wi="univer-m-l-xl",Ii="univer-m-l-xxs",_i="univer-m-l-0",xi="univer-m-r-0",F={conditionalFormattingWrap:di,cfRuleItem:fi,preview:pi,createRule:hi,button:mi,title:gi,label:vi,labelContainer:yi,inputWidth:Ci,mTBase:Si,mTSm:bi,mTXl:Ri,mLSm:Ti,mLXl:wi,mLXxs:Ii,mL0:_i,mR0:xi};var _e=function(){return _e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},_e.apply(this,arguments)},Ei=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n},ut=_.forwardRef(function(t,e){var n=t.icon,r=t.id,o=t.className,i=t.extend,a=Ei(t,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),s=_.useRef("_".concat(Fi()));return eo(n,"".concat(r),{defIds:n.defIds,idSuffix:s.current},_e({ref:e,className:c},a),i)});function eo(t,e,n,r,o){return _.createElement(t.tag,_e(_e({key:e},Oi(t,n,o)),r),(Mi(t,n).children||[]).map(function(i,a){return eo(i,"".concat(e,"-").concat(t.tag,"-").concat(a),n,void 0,o)}))}function Oi(t,e,n){var r=_e({},t.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=e.defIds;return!o||o.length===0||(t.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(i){var a=i[0],c=i[1];typeof c=="string"&&(r[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Mi(t,e){var n,r=e.defIds;return!r||r.length===0?t:t.tag==="defs"&&(!((n=t.children)===null||n===void 0)&&n.length)?_e(_e({},t),{children:t.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?_e(_e({},o),{attrs:_e(_e({},o.attrs),{id:o.attrs.id+e.idSuffix})}):o})}):t}function Fi(){return Math.random().toString(36).substring(2,8)}ut.displayName="UniverIcon";var Pi={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"}}]},Bt=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"delete-single",ref:e,icon:Pi}))});Bt.displayName="DeleteSingle";var Di={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"}}]},to=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"increase-single",ref:e,icon:Di}))});to.displayName="IncreaseSingle";var Ni={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"}}]},rn=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"more-down-single",ref:e,icon:Ni}))});rn.displayName="MoreDownSingle";var ji={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"}}]}]},no=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"sequence-single",ref:e,icon:ji}))});no.displayName="SequenceSingle";var $i={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"}}]}]},Ot=_.forwardRef(function(t,e){return _.createElement(ut,Object.assign({},t,{id:"slash-single",ref:e,icon:$i}))});Ot.displayName="SlashSingle";var ro={exports:{}},Mt={},Pn={exports:{}};(function(t,e){(function(n,r){r(e)})(ri,function(n){function r(P){return function(K,Z,J,se,pe,Ie,le){return P(K,Z,le)}}function o(P){return function(K,Z,J,se){if(!K||!Z||typeof K!="object"||typeof Z!="object")return P(K,Z,J,se);var pe=se.get(K),Ie=se.get(Z);if(pe&&Ie)return pe===Z&&Ie===K;se.set(K,Z),se.set(Z,K);var le=P(K,Z,J,se);return se.delete(K),se.delete(Z),le}}function i(P,U){var K={};for(var Z in P)K[Z]=P[Z];for(var Z in U)K[Z]=U[Z];return K}function a(P){return P.constructor===Object||P.constructor==null}function c(P){return typeof P.then=="function"}function s(P,U){return P===U||P!==P&&U!==U}var u="[object Arguments]",f="[object Boolean]",p="[object Date]",h="[object RegExp]",v="[object Map]",S="[object Number]",y="[object Object]",O="[object Set]",R="[object String]",I=Object.prototype.toString;function b(P){var U=P.areArraysEqual,K=P.areDatesEqual,Z=P.areMapsEqual,J=P.areObjectsEqual,se=P.areRegExpsEqual,pe=P.areSetsEqual,Ie=P.createIsNestedEqual,le=Ie(Oe);function Oe(re,ce,Me){if(re===ce)return!0;if(!re||!ce||typeof re!="object"||typeof ce!="object")return re!==re&&ce!==ce;if(a(re)&&a(ce))return J(re,ce,le,Me);var Tr=Array.isArray(re),wr=Array.isArray(ce);if(Tr||wr)return Tr===wr&&U(re,ce,le,Me);var Fe=I.call(re);return Fe!==I.call(ce)?!1:Fe===p?K(re,ce,le,Me):Fe===h?se(re,ce,le,Me):Fe===v?Z(re,ce,le,Me):Fe===O?pe(re,ce,le,Me):Fe===y||Fe===u?c(re)||c(ce)?!1:J(re,ce,le,Me):Fe===f||Fe===S||Fe===R?s(re.valueOf(),ce.valueOf()):!1}return Oe}function x(P,U,K,Z){var J=P.length;if(U.length!==J)return!1;for(;J-- >0;)if(!K(P[J],U[J],J,J,P,U,Z))return!1;return!0}var m=o(x);function w(P,U){return s(P.valueOf(),U.valueOf())}function T(P,U,K,Z){var J=P.size===U.size;if(!J)return!1;if(!P.size)return!0;var se={},pe=0;return P.forEach(function(Ie,le){if(J){var Oe=!1,re=0;U.forEach(function(ce,Me){!Oe&&!se[re]&&(Oe=K(le,Me,pe,re,P,U,Z)&&K(Ie,ce,le,Me,P,U,Z))&&(se[re]=!0),re++}),pe++,J=Oe}}),J}var E=o(T),D="_owner",$=Object.prototype.hasOwnProperty;function z(P,U,K,Z){var J=Object.keys(P),se=J.length;if(Object.keys(U).length!==se)return!1;for(var pe;se-- >0;){if(pe=J[se],pe===D){var Ie=!!P.$$typeof,le=!!U.$$typeof;if((Ie||le)&&Ie!==le)return!1}if(!$.call(U,pe)||!K(P[pe],U[pe],pe,pe,P,U,Z))return!1}return!0}var q=o(z);function C(P,U){return P.source===U.source&&P.flags===U.flags}function M(P,U,K,Z){var J=P.size===U.size;if(!J)return!1;if(!P.size)return!0;var se={};return P.forEach(function(pe,Ie){if(J){var le=!1,Oe=0;U.forEach(function(re,ce){!le&&!se[Oe]&&(le=K(pe,re,Ie,ce,P,U,Z))&&(se[Oe]=!0),Oe++}),J=le}}),J}var A=o(M),Q=Object.freeze({areArraysEqual:x,areDatesEqual:w,areMapsEqual:T,areObjectsEqual:z,areRegExpsEqual:C,areSetsEqual:M,createIsNestedEqual:r}),X=Object.freeze({areArraysEqual:m,areDatesEqual:w,areMapsEqual:E,areObjectsEqual:q,areRegExpsEqual:C,areSetsEqual:A,createIsNestedEqual:r}),ue=b(Q);function ae(P,U){return ue(P,U,void 0)}var L=b(i(Q,{createIsNestedEqual:function(){return s}}));function G(P,U){return L(P,U,void 0)}var te=b(X);function ne(P,U){return te(P,U,new WeakMap)}var fe=b(i(X,{createIsNestedEqual:function(){return s}}));function Ce(P,U){return fe(P,U,new WeakMap)}function xe(P){return b(i(Q,P(Q)))}function Le(P){var U=b(i(X,P(X)));return function(K,Z,J){return J===void 0&&(J=new WeakMap),U(K,Z,J)}}n.circularDeepEqual=ne,n.circularShallowEqual=Ce,n.createCustomCircularEqual=Le,n.createCustomEqual=xe,n.deepEqual=ae,n.sameValueZeroEqual=s,n.shallowEqual=G,Object.defineProperty(n,"__esModule",{value:!0})})})(Pn,Pn.exports);var Qn=Pn.exports,Dn={exports:{}};function oo(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=oo(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Ir(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=oo(t))&&(r&&(r+=" "),r+=e);return r}Dn.exports=Ir,Dn.exports.clsx=Ir;var er=Dn.exports,W={},Li=function(e,n,r){return e===n?!0:e.className===n.className&&r(e.style,n.style)&&e.width===n.width&&e.autoSize===n.autoSize&&e.cols===n.cols&&e.draggableCancel===n.draggableCancel&&e.draggableHandle===n.draggableHandle&&r(e.verticalCompact,n.verticalCompact)&&r(e.compactType,n.compactType)&&r(e.layout,n.layout)&&r(e.margin,n.margin)&&r(e.containerPadding,n.containerPadding)&&e.rowHeight===n.rowHeight&&e.maxRows===n.maxRows&&e.isBounded===n.isBounded&&e.isDraggable===n.isDraggable&&e.isResizable===n.isResizable&&e.allowOverlap===n.allowOverlap&&e.preventCollision===n.preventCollision&&e.useCSSTransforms===n.useCSSTransforms&&e.transformScale===n.transformScale&&e.isDroppable===n.isDroppable&&r(e.resizeHandles,n.resizeHandles)&&r(e.resizeHandle,n.resizeHandle)&&e.onLayoutChange===n.onLayoutChange&&e.onDragStart===n.onDragStart&&e.onDrag===n.onDrag&&e.onDragStop===n.onDragStop&&e.onResizeStart===n.onResizeStart&&e.onResize===n.onResize&&e.onResizeStop===n.onResizeStop&&e.onDrop===n.onDrop&&r(e.droppingItem,n.droppingItem)&&r(e.innerRef,n.innerRef)};Object.defineProperty(W,"__esModule",{value:!0});W.bottom=tr;W.childrenEqual=Ai;W.cloneLayout=io;W.cloneLayoutItem=Ke;W.collides=on;W.compact=so;W.compactItem=lo;W.compactType=ea;W.correctBounds=co;W.fastPositionEqual=zi;W.fastRGLPropsEqual=void 0;W.getAllCollisions=uo;W.getFirstCollision=Xe;W.getLayoutItem=nr;W.getStatics=rr;W.modifyLayout=ao;W.moveElement=St;W.moveElementAwayFromCollision=jn;W.noop=void 0;W.perc=Hi;W.resizeItemInDirection=Yi;W.setTopLeft=Zi;W.setTransform=Ki;W.sortLayoutItems=cr;W.sortLayoutItemsByColRow=go;W.sortLayoutItemsByRowCol=mo;W.synchronizeLayoutWithChildren=Ji;W.validateLayout=Qi;W.withLayoutItem=Vi;var _r=Qn,Ct=Ui(_);function Ui(t){return t&&t.__esModule?t:{default:t}}function tr(t){let e=0,n;for(let r=0,o=t.length;r<o;r++)n=t[r].y+t[r].h,n>e&&(e=n);return e}function io(t){const e=Array(t.length);for(let n=0,r=t.length;n<r;n++)e[n]=Ke(t[n]);return e}function ao(t,e){const n=Array(t.length);for(let r=0,o=t.length;r<o;r++)e.i===t[r].i?n[r]=e:n[r]=t[r];return n}function Vi(t,e,n){let r=nr(t,e);return r?(r=n(Ke(r)),t=ao(t,r),[t,r]):[t,null]}function Ke(t){return{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,minW:t.minW,maxW:t.maxW,minH:t.minH,maxH:t.maxH,moved:!!t.moved,static:!!t.static,isDraggable:t.isDraggable,isResizable:t.isResizable,resizeHandles:t.resizeHandles,isBounded:t.isBounded}}function Ai(t,e){return(0,_r.deepEqual)(Ct.default.Children.map(t,n=>n==null?void 0:n.key),Ct.default.Children.map(e,n=>n==null?void 0:n.key))&&(0,_r.deepEqual)(Ct.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]),Ct.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]))}W.fastRGLPropsEqual=Li;function zi(t,e){return t.left===e.left&&t.top===e.top&&t.width===e.width&&t.height===e.height}function on(t,e){return!(t.i===e.i||t.x+t.w<=e.x||t.x>=e.x+e.w||t.y+t.h<=e.y||t.y>=e.y+e.h)}function so(t,e,n,r){const o=rr(t),i=cr(t,e),a=Array(t.length);for(let c=0,s=i.length;c<s;c++){let u=Ke(i[c]);u.static||(u=lo(o,u,e,n,i,r),o.push(u)),a[t.indexOf(i[c])]=u,u.moved=!1}return a}const ki={x:"w",y:"h"};function Nn(t,e,n,r){const o=ki[r];e[r]+=1;const i=t.map(a=>a.i).indexOf(e.i);for(let a=i+1;a<t.length;a++){const c=t[a];if(!c.static){if(c.y>e.y+e.h)break;on(e,c)&&Nn(t,c,n+e[o],r)}}e[r]=n}function lo(t,e,n,r,o,i){const a=n==="vertical",c=n==="horizontal";if(a)for(e.y=Math.min(tr(t),e.y);e.y>0&&!Xe(t,e);)e.y--;else if(c)for(;e.x>0&&!Xe(t,e);)e.x--;let s;for(;(s=Xe(t,e))&&!(n===null&&i);)if(c?Nn(o,e,s.x+s.w,"x"):Nn(o,e,s.y+s.h,"y"),c&&e.x+e.w>r)for(e.x=r-e.w,e.y++;e.x>0&&!Xe(t,e);)e.x--;return e.y=Math.max(e.y,0),e.x=Math.max(e.x,0),e}function co(t,e){const n=rr(t);for(let r=0,o=t.length;r<o;r++){const i=t[r];if(i.x+i.w>e.cols&&(i.x=e.cols-i.w),i.x<0&&(i.x=0,i.w=e.cols),!i.static)n.push(i);else for(;Xe(n,i);)i.y++}return t}function nr(t,e){for(let n=0,r=t.length;n<r;n++)if(t[n].i===e)return t[n]}function Xe(t,e){for(let n=0,r=t.length;n<r;n++)if(on(t[n],e))return t[n]}function uo(t,e){return t.filter(n=>on(n,e))}function rr(t){return t.filter(e=>e.static)}function St(t,e,n,r,o,i,a,c,s){if(e.static&&e.isDraggable!==!0||e.y===r&&e.x===n)return t;`${e.i}${String(n)}${String(r)}${e.x}${e.y}`;const u=e.x,f=e.y;typeof n=="number"&&(e.x=n),typeof r=="number"&&(e.y=r),e.moved=!0;let p=cr(t,a);(a==="vertical"&&typeof r=="number"?f>=r:a==="horizontal"&&typeof n=="number"?u>=n:!1)&&(p=p.reverse());const v=uo(p,e),S=v.length>0;if(S&&s)return io(t);if(S&&i)return`${e.i}`,e.x=u,e.y=f,e.moved=!1,t;for(let y=0,O=v.length;y<O;y++){const R=v[y];`${e.i}${e.x}${e.y}${R.i}${R.x}${R.y}`,!R.moved&&(R.static?t=jn(t,R,e,o,a):t=jn(t,e,R,o,a))}return t}function jn(t,e,n,r,o,i){const a=o==="horizontal",c=o==="vertical",s=e.static;if(r){r=!1;const p={x:a?Math.max(e.x-n.w,0):n.x,y:c?Math.max(e.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},h=Xe(t,p),v=h&&h.y+h.h>e.y,S=h&&e.x+e.w>h.x;if(h){if(v&&c)return St(t,n,void 0,e.y+1,r,s,o);if(v&&o==null)return e.y=n.y,n.y=n.y+n.h,t;if(S&&a)return St(t,e,n.x,void 0,r,s,o)}else return`${n.i}${p.x}${p.y}`,St(t,n,a?p.x:void 0,c?p.y:void 0,r,s,o)}const u=a?n.x+1:void 0,f=c?n.y+1:void 0;return u==null&&f==null?t:St(t,n,a?n.x+1:void 0,c?n.y+1:void 0,r,s,o)}function Hi(t){return t*100+"%"}const fo=(t,e,n,r)=>t+n>r?e:n,po=(t,e,n)=>t<0?e:n,ho=t=>Math.max(0,t),or=t=>Math.max(0,t),ir=(t,e,n)=>{let{left:r,height:o,width:i}=e;const a=t.top-(o-t.height);return{left:r,width:i,height:po(a,t.height,o),top:or(a)}},ar=(t,e,n)=>{let{top:r,left:o,height:i,width:a}=e;return{top:r,height:i,width:fo(t.left,t.width,a,n),left:ho(o)}},sr=(t,e,n)=>{let{top:r,height:o,width:i}=e;const a=t.left-(i-t.width);return{height:o,width:a<0?t.width:fo(t.left,t.width,i,n),top:or(r),left:ho(a)}},lr=(t,e,n)=>{let{top:r,left:o,height:i,width:a}=e;return{width:a,left:o,height:po(r,t.height,i),top:or(r)}},Wi=function(){return ir(arguments.length<=0?void 0:arguments[0],ar(...arguments))},qi=function(){return ir(arguments.length<=0?void 0:arguments[0],sr(...arguments))},Bi=function(){return lr(arguments.length<=0?void 0:arguments[0],ar(...arguments))},Gi=function(){return lr(arguments.length<=0?void 0:arguments[0],sr(...arguments))},Xi={n:ir,ne:Wi,e:ar,se:Bi,s:lr,sw:Gi,w:sr,nw:qi};function Yi(t,e,n,r){const o=Xi[t];return o?o(e,{...e,...n},r):n}function Ki(t){let{top:e,left:n,width:r,height:o}=t;const i=`translate(${n}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function Zi(t){let{top:e,left:n,width:r,height:o}=t;return{top:`${e}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function cr(t,e){return e==="horizontal"?go(t):e==="vertical"?mo(t):t}function mo(t){return t.slice(0).sort(function(e,n){return e.y>n.y||e.y===n.y&&e.x>n.x?1:e.y===n.y&&e.x===n.x?0:-1})}function go(t){return t.slice(0).sort(function(e,n){return e.x>n.x||e.x===n.x&&e.y>n.y?1:-1})}function Ji(t,e,n,r,o){t=t||[];const i=[];Ct.default.Children.forEach(e,c=>{if((c==null?void 0:c.key)==null)return;const s=nr(t,String(c.key)),u=c.props["data-grid"];s&&u==null?i.push(Ke(s)):u?i.push(Ke({...u,i:c.key})):i.push(Ke({w:1,h:1,x:0,y:tr(i),i:String(c.key)}))});const a=co(i,{cols:n});return o?a:so(a,r,n)}function Qi(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(t))throw new Error(e+" must be an array!");for(let r=0,o=t.length;r<o;r++){const i=t[r];for(let a=0;a<n.length;a++){const c=n[a],s=i[c];if(typeof s!="number"||Number.isNaN(s))throw new Error(`ReactGridLayout: ${e}[${r}].${c} must be a number! Received: ${s} (${typeof s})`)}if(typeof i.i<"u"&&typeof i.i!="string")throw new Error(`ReactGridLayout: ${e}[${r}].i must be a string! Received: ${i.i} (${typeof i.i})`)}}function ea(t){const{verticalCompact:e,compactType:n}=t||{};return e===!1?null:n}const ta=()=>{};W.noop=ta;var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.calcGridColWidth=an;Ne.calcGridItemPosition=na;Ne.calcGridItemWHPx=$n;Ne.calcWH=oa;Ne.calcXY=ra;Ne.clamp=Ye;function an(t){const{margin:e,containerPadding:n,containerWidth:r,cols:o}=t;return(r-e[0]*(o-1)-n[0]*2)/o}function $n(t,e,n){return Number.isFinite(t)?Math.round(e*t+Math.max(0,t-1)*n):t}function na(t,e,n,r,o,i){const{margin:a,containerPadding:c,rowHeight:s}=t,u=an(t),f={};return i&&i.resizing?(f.width=Math.round(i.resizing.width),f.height=Math.round(i.resizing.height)):(f.width=$n(r,u,a[0]),f.height=$n(o,s,a[1])),i&&i.dragging?(f.top=Math.round(i.dragging.top),f.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(f.top=Math.round(i.resizing.top),f.left=Math.round(i.resizing.left)):(f.top=Math.round((s+a[1])*n+c[1]),f.left=Math.round((u+a[0])*e+c[0])),f}function ra(t,e,n,r,o){const{margin:i,containerPadding:a,cols:c,rowHeight:s,maxRows:u}=t,f=an(t);let p=Math.round((n-a[0])/(f+i[0])),h=Math.round((e-a[1])/(s+i[1]));return p=Ye(p,0,c-r),h=Ye(h,0,u-o),{x:p,y:h}}function oa(t,e,n,r,o,i){const{margin:a,maxRows:c,cols:s,rowHeight:u}=t,f=an(t);let p=Math.round((e+a[0])/(f+a[0])),h=Math.round((n+a[1])/(u+a[1])),v=Ye(p,0,s-r),S=Ye(h,0,c-o);return["sw","w","nw"].indexOf(i)!==-1&&(v=Ye(p,0,s)),["nw","n","ne"].indexOf(i)!==-1&&(S=Ye(h,0,c)),{w:v,h:S}}function Ye(t,e,n){return Math.max(Math.min(t,n),e)}var sn={},vo={exports:{}},ia="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",aa=ia,sa=aa;function yo(){}function Co(){}Co.resetWarningCache=yo;var la=function(){function t(r,o,i,a,c,s){if(s!==sa){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Co,resetWarningCache:yo};return n.PropTypes=n,n};vo.exports=la();var We=vo.exports,ln={exports:{}},So={};function bo(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=bo(t[e]))&&(r&&(r+=" "),r+=n);else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function xr(){for(var t,e,n=0,r="";n<arguments.length;)(t=arguments[n++])&&(e=bo(t))&&(r&&(r+=" "),r+=e);return r}const ca=Object.freeze(Object.defineProperty({__proto__:null,clsx:xr,default:xr},Symbol.toStringTag,{value:"Module"})),ua=Zr(ca);var ie={},je={};Object.defineProperty(je,"__esModule",{value:!0});je.dontSetMe=ma;je.findInArray=da;je.int=ha;je.isFunction=fa;je.isNum=pa;function da(t,e){for(let n=0,r=t.length;n<r;n++)if(e.apply(e,[t[n],n,t]))return t[n]}function fa(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Function]"}function pa(t){return typeof t=="number"&&!isNaN(t)}function ha(t){return parseInt(t,10)}function ma(t,e,n){if(t[e])return new Error("Invalid prop ".concat(e," passed to ").concat(n," - do not set this, set it on the child."))}var Je={};Object.defineProperty(Je,"__esModule",{value:!0});Je.browserPrefixToKey=To;Je.browserPrefixToStyle=ga;Je.default=void 0;Je.getPrefix=Ro;const Cn=["Moz","Webkit","O","ms"];function Ro(){var t;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(t=window.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.style;if(!n||e in n)return"";for(let r=0;r<Cn.length;r++)if(To(e,Cn[r])in n)return Cn[r];return""}function To(t,e){return e?"".concat(e).concat(va(t)):t}function ga(t,e){return e?"-".concat(e.toLowerCase(),"-").concat(t):t}function va(t){let e="",n=!0;for(let r=0;r<t.length;r++)n?(e+=t[r].toUpperCase(),n=!1):t[r]==="-"?n=!0:e+=t[r];return e}Je.default=Ro();Object.defineProperty(ie,"__esModule",{value:!0});ie.addClassName=_o;ie.addEvent=Sa;ie.addUserSelectStyles=Fa;ie.createCSSTransform=xa;ie.createSVGTransform=Ea;ie.getTouch=Oa;ie.getTouchIdentifier=Ma;ie.getTranslation=ur;ie.innerHeight=wa;ie.innerWidth=Ia;ie.matchesSelector=Io;ie.matchesSelectorAndParentsTo=Ca;ie.offsetXYFromParent=_a;ie.outerHeight=Ra;ie.outerWidth=Ta;ie.removeClassName=xo;ie.removeEvent=ba;ie.removeUserSelectStyles=Pa;var we=je,Er=ya(Je);function wo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(wo=function(r){return r?n:e})(t)}function ya(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=wo(e);if(n&&n.has(t))return n.get(t);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}let jt="";function Io(t,e){return jt||(jt=(0,we.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,we.isFunction)(t[n])})),(0,we.isFunction)(t[jt])?t[jt](e):!1}function Ca(t,e,n){let r=t;do{if(Io(r,e))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Sa(t,e,n,r){if(!t)return;const o={capture:!0,...r};t.addEventListener?t.addEventListener(e,n,o):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}function ba(t,e,n,r){if(!t)return;const o={capture:!0,...r};t.removeEventListener?t.removeEventListener(e,n,o):t.detachEvent?t.detachEvent("on"+e,n):t["on"+e]=null}function Ra(t){let e=t.clientHeight;const n=t.ownerDocument.defaultView.getComputedStyle(t);return e+=(0,we.int)(n.borderTopWidth),e+=(0,we.int)(n.borderBottomWidth),e}function Ta(t){let e=t.clientWidth;const n=t.ownerDocument.defaultView.getComputedStyle(t);return e+=(0,we.int)(n.borderLeftWidth),e+=(0,we.int)(n.borderRightWidth),e}function wa(t){let e=t.clientHeight;const n=t.ownerDocument.defaultView.getComputedStyle(t);return e-=(0,we.int)(n.paddingTop),e-=(0,we.int)(n.paddingBottom),e}function Ia(t){let e=t.clientWidth;const n=t.ownerDocument.defaultView.getComputedStyle(t);return e-=(0,we.int)(n.paddingLeft),e-=(0,we.int)(n.paddingRight),e}function _a(t,e,n){const o=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),i=(t.clientX+e.scrollLeft-o.left)/n,a=(t.clientY+e.scrollTop-o.top)/n;return{x:i,y:a}}function xa(t,e){const n=ur(t,e,"px");return{[(0,Er.browserPrefixToKey)("transform",Er.default)]:n}}function Ea(t,e){return ur(t,e,"")}function ur(t,e,n){let{x:r,y:o}=t,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(e){const a="".concat(typeof e.x=="string"?e.x:e.x+n),c="".concat(typeof e.y=="string"?e.y:e.y+n);i="translate(".concat(a,", ").concat(c,")")+i}return i}function Oa(t,e){return t.targetTouches&&(0,we.findInArray)(t.targetTouches,n=>e===n.identifier)||t.changedTouches&&(0,we.findInArray)(t.changedTouches,n=>e===n.identifier)}function Ma(t){if(t.targetTouches&&t.targetTouches[0])return t.targetTouches[0].identifier;if(t.changedTouches&&t.changedTouches[0])return t.changedTouches[0].identifier}function Fa(t){if(!t)return;let e=t.getElementById("react-draggable-style-el");e||(e=t.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
10
10
|
`,e.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
11
|
-
`,t.getElementsByTagName("head")[0].appendChild(e)),t.body&&_o(t.body,"react-draggable-transparent-selection")}function Pa(t){if(t)try{if(t.body&&xo(t.body,"react-draggable-transparent-selection"),t.selection)t.selection.empty();else{const e=(t.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function _o(t,e){t.classList?t.classList.add(e):t.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(t.className+=" ".concat(e))}function xo(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var $e={};Object.defineProperty($e,"__esModule",{value:!0});$e.canDragX=ja;$e.canDragY=$a;$e.createCoreData=Ua;$e.createDraggableData=Va;$e.getBoundPosition=Da;$e.getControlPosition=La;$e.snapToGrid=Na;var Re=je,at=ie;function Da(t,e,n){if(!t.props.bounds)return[e,n];let{bounds:r}=t.props;r=typeof r=="string"?r:Aa(r);const o=dr(t);if(typeof r=="string"){const{ownerDocument:i}=o,a=i.defaultView;let c;if(r==="parent"?c=o.parentNode:c=i.querySelector(r),!(c instanceof a.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const s=c,u=a.getComputedStyle(o),f=a.getComputedStyle(s);r={left:-o.offsetLeft+(0,Re.int)(f.paddingLeft)+(0,Re.int)(u.marginLeft),top:-o.offsetTop+(0,Re.int)(f.paddingTop)+(0,Re.int)(u.marginTop),right:(0,at.innerWidth)(s)-(0,at.outerWidth)(o)-o.offsetLeft+(0,Re.int)(f.paddingRight)-(0,Re.int)(u.marginRight),bottom:(0,at.innerHeight)(s)-(0,at.outerHeight)(o)-o.offsetTop+(0,Re.int)(f.paddingBottom)-(0,Re.int)(u.marginBottom)}}return(0,Re.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,Re.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Re.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,Re.isNum)(r.top)&&(n=Math.max(n,r.top)),[e,n]}function Na(t,e,n){const r=Math.round(e/t[0])*t[0],o=Math.round(n/t[1])*t[1];return[r,o]}function ja(t){return t.props.axis==="both"||t.props.axis==="x"}function $a(t){return t.props.axis==="both"||t.props.axis==="y"}function La(t,e,n){const r=typeof e=="number"?(0,at.getTouch)(t,e):null;if(typeof e=="number"&&!r)return null;const o=dr(n),i=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,at.offsetXYFromParent)(r||t,i,n.props.scale)}function Ua(t,e,n){const r=!(0,Re.isNum)(t.lastX),o=dr(t);return r?{node:o,deltaX:0,deltaY:0,lastX:e,lastY:n,x:e,y:n}:{node:o,deltaX:e-t.lastX,deltaY:n-t.lastY,lastX:t.lastX,lastY:t.lastY,x:e,y:n}}function Va(t,e){const n=t.props.scale;return{node:e.node,x:t.state.x+e.deltaX/n,y:t.state.y+e.deltaY/n,deltaX:e.deltaX/n,deltaY:e.deltaY/n,lastX:t.state.x,lastY:t.state.y}}function Aa(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}function dr(t){const e=t.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var cn={},un={};Object.defineProperty(un,"__esModule",{value:!0});un.default=za;function za(){}Object.defineProperty(cn,"__esModule",{value:!0});cn.default=void 0;var Sn=Ha(_),Se=fr(We),ka=fr(Kr),me=ie,ze=$e,bn=je,ft=fr(un);function fr(t){return t&&t.__esModule?t:{default:t}}function Eo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(Eo=function(r){return r?n:e})(t)}function Ha(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=Eo(e);if(n&&n.has(t))return n.get(t);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function ye(t,e,n){return e=Wa(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wa(t){var e=qa(t,"string");return typeof e=="symbol"?e:String(e)}function qa(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const Ee={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let ke=Ee.mouse,dn=class extends Sn.Component{constructor(){super(...arguments),ye(this,"dragging",!1),ye(this,"lastX",NaN),ye(this,"lastY",NaN),ye(this,"touchIdentifier",null),ye(this,"mounted",!1),ye(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,me.matchesSelectorAndParentsTo)(e.target,this.props.handle,n)||this.props.cancel&&(0,me.matchesSelectorAndParentsTo)(e.target,this.props.cancel,n))return;e.type==="touchstart"&&e.preventDefault();const o=(0,me.getTouchIdentifier)(e);this.touchIdentifier=o;const i=(0,ze.getControlPosition)(e,o,this);if(i==null)return;const{x:a,y:c}=i,s=(0,ze.createCoreData)(this,a,c);(0,ft.default)("DraggableCore: handleDragStart: %j",s),(0,ft.default)("calling",this.props.onStart),!(this.props.onStart(e,s)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,me.addUserSelectStyles)(r),this.dragging=!0,this.lastX=a,this.lastY=c,(0,me.addEvent)(r,ke.move,this.handleDrag),(0,me.addEvent)(r,ke.stop,this.handleDragStop))}),ye(this,"handleDrag",e=>{const n=(0,ze.getControlPosition)(e,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,s=o-this.lastY;if([c,s]=(0,ze.snapToGrid)(this.props.grid,c,s),!c&&!s)return;r=this.lastX+c,o=this.lastY+s}const i=(0,ze.createCoreData)(this,r,o);if((0,ft.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const s=document.createEvent("MouseEvents");s.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(s)}return}this.lastX=r,this.lastY=o}),ye(this,"handleDragStop",e=>{if(!this.dragging)return;const n=(0,ze.getControlPosition)(e,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let s=r-this.lastX||0,u=o-this.lastY||0;[s,u]=(0,ze.snapToGrid)(this.props.grid,s,u),r=this.lastX+s,o=this.lastY+u}const i=(0,ze.createCoreData)(this,r,o);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,me.removeUserSelectStyles)(c.ownerDocument),(0,ft.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,ft.default)("DraggableCore: Removing handlers"),(0,me.removeEvent)(c.ownerDocument,ke.move,this.handleDrag),(0,me.removeEvent)(c.ownerDocument,ke.stop,this.handleDragStop))}),ye(this,"onMouseDown",e=>(ke=Ee.mouse,this.handleDragStart(e))),ye(this,"onMouseUp",e=>(ke=Ee.mouse,this.handleDragStop(e))),ye(this,"onTouchStart",e=>(ke=Ee.touch,this.handleDragStart(e))),ye(this,"onTouchEnd",e=>(ke=Ee.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,me.addEvent)(e,Ee.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:n}=e;(0,me.removeEvent)(n,Ee.mouse.move,this.handleDrag),(0,me.removeEvent)(n,Ee.touch.move,this.handleDrag),(0,me.removeEvent)(n,Ee.mouse.stop,this.handleDragStop),(0,me.removeEvent)(n,Ee.touch.stop,this.handleDragStop),(0,me.removeEvent)(e,Ee.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,me.removeUserSelectStyles)(n)}}findDOMNode(){var e,n;return(e=this.props)!==null&&e!==void 0&&e.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:ka.default.findDOMNode(this)}render(){return Sn.cloneElement(Sn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};cn.default=dn;ye(dn,"displayName","DraggableCore");ye(dn,"propTypes",{allowAnyClick:Se.default.bool,children:Se.default.node.isRequired,disabled:Se.default.bool,enableUserSelectHack:Se.default.bool,offsetParent:function(t,e){if(t[e]&&t[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Se.default.arrayOf(Se.default.number),handle:Se.default.string,cancel:Se.default.string,nodeRef:Se.default.object,onStart:Se.default.func,onDrag:Se.default.func,onStop:Se.default.func,onMouseDown:Se.default.func,scale:Se.default.number,className:bn.dontSetMe,style:bn.dontSetMe,transform:bn.dontSetMe});ye(dn,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return s.default}}),t.default=void 0;var e=h(_),n=f(We),r=f(Kr),o=f(ua),i=ie,a=$e,c=je,s=f(cn),u=f(un);function f(I){return I&&I.__esModule?I:{default:I}}function p(I){if(typeof WeakMap!="function")return null;var b=new WeakMap,x=new WeakMap;return(p=function(m){return m?x:b})(I)}function h(I,b){if(I&&I.__esModule)return I;if(I===null||typeof I!="object"&&typeof I!="function")return{default:I};var x=p(b);if(x&&x.has(I))return x.get(I);var m={},T=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var w in I)if(w!=="default"&&Object.prototype.hasOwnProperty.call(I,w)){var E=T?Object.getOwnPropertyDescriptor(I,w):null;E&&(E.get||E.set)?Object.defineProperty(m,w,E):m[w]=I[w]}return m.default=I,x&&x.set(I,m),m}function v(){return v=Object.assign?Object.assign.bind():function(I){for(var b=1;b<arguments.length;b++){var x=arguments[b];for(var m in x)Object.prototype.hasOwnProperty.call(x,m)&&(I[m]=x[m])}return I},v.apply(this,arguments)}function S(I,b,x){return b=y(b),b in I?Object.defineProperty(I,b,{value:x,enumerable:!0,configurable:!0,writable:!0}):I[b]=x,I}function y(I){var b=O(I,"string");return typeof b=="symbol"?b:String(b)}function O(I,b){if(typeof I!="object"||I===null)return I;var x=I[Symbol.toPrimitive];if(x!==void 0){var m=x.call(I,b||"default");if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(I)}class R extends e.Component{static getDerivedStateFromProps(b,x){let{position:m}=b,{prevPropsPosition:T}=x;return m&&(!T||m.x!==T.x||m.y!==T.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:m,prevPropsPosition:T}),{x:m.x,y:m.y,prevPropsPosition:{...m}}):null}constructor(b){super(b),S(this,"onDragStart",(x,m)=>{if((0,u.default)("Draggable: onDragStart: %j",m),this.props.onStart(x,(0,a.createDraggableData)(this,m))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),S(this,"onDrag",(x,m)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",m);const T=(0,a.createDraggableData)(this,m),w={x:T.x,y:T.y,slackX:0,slackY:0};if(this.props.bounds){const{x:P,y:$}=w;w.x+=this.state.slackX,w.y+=this.state.slackY;const[z,q]=(0,a.getBoundPosition)(this,w.x,w.y);w.x=z,w.y=q,w.slackX=this.state.slackX+(P-w.x),w.slackY=this.state.slackY+($-w.y),T.x=w.x,T.y=w.y,T.deltaX=w.x-this.state.x,T.deltaY=w.y-this.state.y}if(this.props.onDrag(x,T)===!1)return!1;this.setState(w)}),S(this,"onDragStop",(x,m)=>{if(!this.state.dragging||this.props.onStop(x,(0,a.createDraggableData)(this,m))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",m);const w={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:P,y:$}=this.props.position;w.x=P,w.y=$}this.setState(w)}),this.state={dragging:!1,dragged:!1,x:b.position?b.position.x:b.defaultPosition.x,y:b.position?b.position.y:b.defaultPosition.y,prevPropsPosition:{...b.position},slackX:0,slackY:0,isElementSVG:!1},b.position&&!(b.onDrag||b.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 b,x;return(b=(x=this.props)===null||x===void 0||(x=x.nodeRef)===null||x===void 0?void 0:x.current)!==null&&b!==void 0?b:r.default.findDOMNode(this)}render(){const{axis:b,bounds:x,children:m,defaultPosition:T,defaultClassName:w,defaultClassNameDragging:E,defaultClassNameDragged:P,position:$,positionOffset:z,scale:q,...C}=this.props;let M={},A=null;const X=!!!$||this.state.dragging,ue=$||T,ae={x:(0,a.canDragX)(this)&&X?this.state.x:ue.x,y:(0,a.canDragY)(this)&&X?this.state.y:ue.y};this.state.isElementSVG?A=(0,i.createSVGTransform)(ae,z):M=(0,i.createCSSTransform)(ae,z);const L=(0,o.default)(m.props.className||"",w,{[E]:this.state.dragging,[P]:this.state.dragged});return e.createElement(s.default,v({},C,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(m),{className:L,style:{...m.props.style,...M},transform:A}))}}t.default=R,S(R,"displayName","Draggable"),S(R,"propTypes",{...s.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),S(R,"defaultProps",{...s.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(So);const{default:Oo,DraggableCore:Ba}=So;ln.exports=Oo;ln.exports.default=Oo;ln.exports.DraggableCore=Ba;var Mo=ln.exports,fn={exports:{}},Ft={},pr={};pr.__esModule=!0;pr.cloneElement=Ja;var Ga=Xa(_);function Xa(t){return t&&t.__esModule?t:{default:t}}function Or(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Mr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Or(Object(n),!0).forEach(function(r){Ya(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Or(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ya(t,e,n){return e=Ka(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ka(t){var e=Za(t,"string");return typeof e=="symbol"?e:String(e)}function Za(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ja(t,e){return e.style&&t.props.style&&(e.style=Mr(Mr({},t.props.style),e.style)),e.className&&t.props.className&&(e.className=t.props.className+" "+e.className),Ga.default.cloneElement(t,e)}var Pt={};Pt.__esModule=!0;Pt.resizableProps=void 0;var k=Qa(We);function Qa(t){return t&&t.__esModule?t:{default:t}}var es={axis:k.default.oneOf(["both","x","y","none"]),className:k.default.string,children:k.default.element.isRequired,draggableOpts:k.default.shape({allowAnyClick:k.default.bool,cancel:k.default.string,children:k.default.node,disabled:k.default.bool,enableUserSelectHack:k.default.bool,offsetParent:k.default.node,grid:k.default.arrayOf(k.default.number),handle:k.default.string,nodeRef:k.default.object,onStart:k.default.func,onDrag:k.default.func,onStop:k.default.func,onMouseDown:k.default.func,scale:k.default.number}),height:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="y"){var i;return(i=k.default.number).isRequired.apply(i,n)}return k.default.number.apply(k.default,n)},handle:k.default.oneOfType([k.default.node,k.default.func]),handleSize:k.default.arrayOf(k.default.number),lockAspectRatio:k.default.bool,maxConstraints:k.default.arrayOf(k.default.number),minConstraints:k.default.arrayOf(k.default.number),onResizeStop:k.default.func,onResizeStart:k.default.func,onResize:k.default.func,resizeHandles:k.default.arrayOf(k.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:k.default.number,width:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="x"){var i;return(i=k.default.number).isRequired.apply(i,n)}return k.default.number.apply(k.default,n)}};Pt.resizableProps=es;Ft.__esModule=!0;Ft.default=void 0;var pt=is(_),ts=Mo,ns=pr,rs=Pt,os=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Fo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(Fo=function(o){return o?n:e})(t)}function is(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=Fo(e);if(n&&n.has(t))return n.get(t);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function Ln(){return Ln=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ln.apply(this,arguments)}function as(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function Fr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Rn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fr(Object(n),!0).forEach(function(r){ss(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ss(t,e,n){return e=ls(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ls(t){var e=cs(t,"string");return typeof e=="symbol"?e:String(e)}function cs(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function us(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Un(t,e)}function Un(t,e){return Un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Un(t,e)}var hr=function(t){us(e,t);function e(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var n=e.prototype;return n.componentWillUnmount=function(){this.resetData()},n.resetData=function(){this.lastHandleRect=this.slack=null},n.runConstraints=function(o,i){var a=this.props,c=a.minConstraints,s=a.maxConstraints,u=a.lockAspectRatio;if(!c&&!s&&!u)return[o,i];if(u){var f=this.props.width/this.props.height,p=o-this.props.width,h=i-this.props.height;Math.abs(p)>Math.abs(h*f)?i=o/f:o=i*f}var v=o,S=i,y=this.slack||[0,0],O=y[0],R=y[1];return o+=O,i+=R,c&&(o=Math.max(c[0],o),i=Math.max(c[1],i)),s&&(o=Math.min(s[0],o),i=Math.min(s[1],i)),this.slack=[O+(v-o),R+(S-i)],[o,i]},n.resizeHandler=function(o,i){var a=this;return function(c,s){var u=s.node,f=s.deltaX,p=s.deltaY;o==="onResizeStart"&&a.resetData();var h=(a.props.axis==="both"||a.props.axis==="x")&&i!=="n"&&i!=="s",v=(a.props.axis==="both"||a.props.axis==="y")&&i!=="e"&&i!=="w";if(!(!h&&!v)){var S=i[0],y=i[i.length-1],O=u.getBoundingClientRect();if(a.lastHandleRect!=null){if(y==="w"){var R=O.left-a.lastHandleRect.left;f+=R}if(S==="n"){var I=O.top-a.lastHandleRect.top;p+=I}}a.lastHandleRect=O,y==="w"&&(f=-f),S==="n"&&(p=-p);var b=a.props.width+(h?f/a.props.transformScale:0),x=a.props.height+(v?p/a.props.transformScale:0),m=a.runConstraints(b,x);b=m[0],x=m[1];var T=b!==a.props.width||x!==a.props.height,w=typeof a.props[o]=="function"?a.props[o]:null,E=o==="onResize"&&!T;w&&!E&&(c.persist==null||c.persist(),w(c,{node:u,size:{width:b,height:x},handle:i})),o==="onResizeStop"&&a.resetData()}}},n.renderResizeHandle=function(o,i){var a=this.props.handle;if(!a)return pt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:i});if(typeof a=="function")return a(o,i);var c=typeof a.type=="string",s=Rn({ref:i},c?{}:{handleAxis:o});return pt.cloneElement(a,s)},n.render=function(){var o=this,i=this.props,a=i.children,c=i.className,s=i.draggableOpts;i.width,i.height,i.handle,i.handleSize,i.lockAspectRatio,i.axis,i.minConstraints,i.maxConstraints,i.onResize,i.onResizeStop,i.onResizeStart;var u=i.resizeHandles;i.transformScale;var f=as(i,os);return(0,ns.cloneElement)(a,Rn(Rn({},f),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(a.props.children,u.map(function(p){var h,v=(h=o.handleRefs[p])!=null?h:o.handleRefs[p]=pt.createRef();return pt.createElement(ts.DraggableCore,Ln({},s,{nodeRef:v,key:"resizableHandle-"+p,onStop:o.resizeHandler("onResizeStop",p),onStart:o.resizeHandler("onResizeStart",p),onDrag:o.resizeHandler("onResize",p)}),o.renderResizeHandle(p,v))}))}))},e}(pt.Component);Ft.default=hr;hr.propTypes=rs.resizableProps;hr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var pn={};pn.__esModule=!0;pn.default=void 0;var Tn=ms(_),ds=Po(We),fs=Po(Ft),ps=Pt,hs=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Po(t){return t&&t.__esModule?t:{default:t}}function Do(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(Do=function(o){return o?n:e})(t)}function ms(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=Do(e);if(n&&n.has(t))return n.get(t);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function Vn(){return Vn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Vn.apply(this,arguments)}function Pr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Gt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Pr(Object(n),!0).forEach(function(r){gs(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gs(t,e,n){return e=vs(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vs(t){var e=ys(t,"string");return typeof e=="symbol"?e:String(e)}function ys(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cs(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function Ss(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,An(t,e)}function An(t,e){return An=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},An(t,e)}var No=function(t){Ss(e,t);function e(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(c,s){var u=s.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(u,function(){return r.props.onResize&&r.props.onResize(c,s)})):r.setState(u)},r}e.getDerivedStateFromProps=function(o,i){return i.propsWidth!==o.width||i.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var n=e.prototype;return n.render=function(){var o=this.props,i=o.handle,a=o.handleSize;o.onResize;var c=o.onResizeStart,s=o.onResizeStop,u=o.draggableOpts,f=o.minConstraints,p=o.maxConstraints,h=o.lockAspectRatio,v=o.axis;o.width,o.height;var S=o.resizeHandles,y=o.style,O=o.transformScale,R=Cs(o,hs);return Tn.createElement(fs.default,{axis:v,draggableOpts:u,handle:i,handleSize:a,height:this.state.height,lockAspectRatio:h,maxConstraints:p,minConstraints:f,onResizeStart:c,onResize:this.onResize,onResizeStop:s,resizeHandles:S,transformScale:O,width:this.state.width},Tn.createElement("div",Vn({},R,{style:Gt(Gt({},y),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},e}(Tn.Component);pn.default=No;No.propTypes=Gt(Gt({},ps.resizableProps),{},{children:ds.default.element});fn.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};fn.exports.Resizable=Ft.default;fn.exports.ResizableBox=pn.default;var bs=fn.exports,Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.resizeHandleType=Ve.resizeHandleAxesType=Ve.default=void 0;var H=jo(We),Rs=jo(_);function jo(t){return t&&t.__esModule?t:{default:t}}const Ts=Ve.resizeHandleAxesType=H.default.arrayOf(H.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),ws=Ve.resizeHandleType=H.default.oneOfType([H.default.node,H.default.func]);Ve.default={className:H.default.string,style:H.default.object,width:H.default.number,autoSize:H.default.bool,cols:H.default.number,draggableCancel:H.default.string,draggableHandle:H.default.string,verticalCompact:function(t){t.verticalCompact},compactType:H.default.oneOf(["vertical","horizontal"]),layout:function(t){var e=t.layout;e!==void 0&&W.validateLayout(e,"layout")},margin:H.default.arrayOf(H.default.number),containerPadding:H.default.arrayOf(H.default.number),rowHeight:H.default.number,maxRows:H.default.number,isBounded:H.default.bool,isDraggable:H.default.bool,isResizable:H.default.bool,allowOverlap:H.default.bool,preventCollision:H.default.bool,useCSSTransforms:H.default.bool,transformScale:H.default.number,isDroppable:H.default.bool,resizeHandles:Ts,resizeHandle:ws,onLayoutChange:H.default.func,onDragStart:H.default.func,onDrag:H.default.func,onDragStop:H.default.func,onResizeStart:H.default.func,onResize:H.default.func,onResizeStop:H.default.func,onDrop:H.default.func,droppingItem:H.default.shape({i:H.default.string.isRequired,w:H.default.number.isRequired,h:H.default.number.isRequired}),children:function(t,e){const n=t[e],r={};Rs.default.Children.forEach(n,function(o){if((o==null?void 0:o.key)!=null){if(r[o.key])throw new Error('Duplicate child key "'+o.key+'" found! This will cause problems in ReactGridLayout.');r[o.key]=!0}})},innerRef:H.default.any};Object.defineProperty(sn,"__esModule",{value:!0});sn.default=void 0;var et=mr(_),Y=mr(We),Is=Mo,_s=bs,tt=W,he=Ne,Dr=Ve,xs=mr(er);function mr(t){return t&&t.__esModule?t:{default:t}}function Pe(t,e,n){return e=Es(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Es(t){var e=Os(t,"string");return typeof e=="symbol"?e:String(e)}function Os(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class gr extends et.default.Component{constructor(){super(...arguments),Pe(this,"state",{resizing:null,dragging:null,className:""}),Pe(this,"elementRef",et.default.createRef()),Pe(this,"onDragStart",(e,n)=>{let{node:r}=n;const{onDragStart:o,transformScale:i}=this.props;if(!o)return;const a={top:0,left:0},{offsetParent:c}=r;if(!c)return;const s=c.getBoundingClientRect(),u=r.getBoundingClientRect(),f=u.left/i,p=s.left/i,h=u.top/i,v=s.top/i;a.left=f-p+c.scrollLeft,a.top=h-v+c.scrollTop,this.setState({dragging:a});const{x:S,y}=(0,he.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return o.call(this,this.props.i,S,y,{e,node:r,newPosition:a})}),Pe(this,"onDrag",(e,n)=>{let{node:r,deltaX:o,deltaY:i}=n;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+i,s=this.state.dragging.left+o;const{isBounded:u,i:f,w:p,h,containerWidth:v}=this.props,S=this.getPositionParams();if(u){const{offsetParent:b}=r;if(b){const{margin:x,rowHeight:m,containerPadding:T}=this.props,w=b.clientHeight-(0,he.calcGridItemWHPx)(h,m,x[1]);c=(0,he.clamp)(c-T[1],0,w);const E=(0,he.calcGridColWidth)(S),P=v-(0,he.calcGridItemWHPx)(p,E,x[0]);s=(0,he.clamp)(s-T[0],0,P)}}const y={top:c,left:s};this.setState({dragging:y});const{containerPadding:O}=this.props,{x:R,y:I}=(0,he.calcXY)(S,c-O[1],s-O[0],p,h);return a.call(this,f,R,I,{e,node:r,newPosition:y})}),Pe(this,"onDragStop",(e,n)=>{let{node:r}=n;const{onDragStop:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:i,h:a,i:c,containerPadding:s}=this.props,{left:u,top:f}=this.state.dragging,p={top:f,left:u};this.setState({dragging:null});const{x:h,y:v}=(0,he.calcXY)(this.getPositionParams(),f-s[1],u-s[0],i,a);return o.call(this,c,h,v,{e,node:r,newPosition:p})}),Pe(this,"onResizeStop",(e,n,r)=>this.onResizeHandler(e,n,r,"onResizeStop")),Pe(this,"onResizeStart",(e,n,r)=>this.onResizeHandler(e,n,r,"onResizeStart")),Pe(this,"onResize",(e,n,r)=>this.onResizeHandler(e,n,r,"onResize"))}shouldComponentUpdate(e,n){if(this.props.children!==e.children||this.props.droppingPosition!==e.droppingPosition)return!0;const r=(0,he.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),o=(0,he.calcGridItemPosition)(this.getPositionParams(e),e.x,e.y,e.w,e.h,n);return!(0,tt.fastPositionEqual)(r,o)||this.props.useCSSTransforms!==e.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(e){this.moveDroppingItem(e)}moveDroppingItem(e){const{droppingPosition:n}=this.props;if(!n)return;const r=this.elementRef.current;if(!r)return;const o=e.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&n.left!==o.left||n.top!==o.top;if(!i)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(a){const c=n.left-i.left,s=n.top-i.top;this.onDrag(n.e,{node:r,deltaX:c,deltaY:s})}}getPositionParams(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:e.cols,containerPadding:e.containerPadding,containerWidth:e.containerWidth,margin:e.margin,maxRows:e.maxRows,rowHeight:e.rowHeight}}createStyle(e){const{usePercentages:n,containerWidth:r,useCSSTransforms:o}=this.props;let i;return o?i=(0,tt.setTransform)(e):(i=(0,tt.setTopLeft)(e),n&&(i.left=(0,tt.perc)(e.left/r),i.width=(0,tt.perc)(e.width/r))),i}mixinDraggable(e,n){return et.default.createElement(Is.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},e)}curryResizeHandler(e,n){return(r,o)=>n(r,o,e)}mixinResizable(e,n,r){const{cols:o,minW:i,minH:a,maxW:c,maxH:s,transformScale:u,resizeHandles:f,resizeHandle:p}=this.props,h=this.getPositionParams(),v=(0,he.calcGridItemPosition)(h,0,0,o,0).width,S=(0,he.calcGridItemPosition)(h,0,0,i,a),y=(0,he.calcGridItemPosition)(h,0,0,c,s),O=[S.width,S.height],R=[Math.min(y.width,v),Math.min(y.height,1/0)];return et.default.createElement(_s.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:O,maxConstraints:R,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:u,resizeHandles:f,handle:p},e)}onResizeHandler(e,n,r,o){let{node:i,size:a,handle:c}=n;const s=this.props[o];if(!s)return;const{x:u,y:f,i:p,maxH:h,minH:v,containerWidth:S}=this.props,{minW:y,maxW:O}=this.props;let R=a;i&&(R=(0,tt.resizeItemInDirection)(c,r,a,S),this.setState({resizing:o==="onResizeStop"?null:R}));let{w:I,h:b}=(0,he.calcWH)(this.getPositionParams(),R.width,R.height,u,f,c);I=(0,he.clamp)(I,Math.max(y,1),O),b=(0,he.clamp)(b,v,h),s.call(this,p,I,b,{e,node:i,size:R,handle:c})}render(){const{x:e,y:n,w:r,h:o,isDraggable:i,isResizable:a,droppingPosition:c,useCSSTransforms:s}=this.props,u=(0,he.calcGridItemPosition)(this.getPositionParams(),e,n,r,o,this.state),f=et.default.Children.only(this.props.children);let p=et.default.cloneElement(f,{ref:this.elementRef,className:(0,xs.default)("react-grid-item",f.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":i,"react-draggable-dragging":!!this.state.dragging,dropping:!!c,cssTransforms:s}),style:{...this.props.style,...f.props.style,...this.createStyle(u)}});return p=this.mixinResizable(p,u,a),p=this.mixinDraggable(p,i),p}}sn.default=gr;Pe(gr,"propTypes",{children:Y.default.element,cols:Y.default.number.isRequired,containerWidth:Y.default.number.isRequired,rowHeight:Y.default.number.isRequired,margin:Y.default.array.isRequired,maxRows:Y.default.number.isRequired,containerPadding:Y.default.array.isRequired,x:Y.default.number.isRequired,y:Y.default.number.isRequired,w:Y.default.number.isRequired,h:Y.default.number.isRequired,minW:function(t,e){const n=t[e];if(typeof n!="number")return new Error("minWidth not Number");if(n>t.w||n>t.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(t,e){const n=t[e];if(typeof n!="number")return new Error("maxWidth not Number");if(n<t.w||n<t.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(t,e){const n=t[e];if(typeof n!="number")return new Error("minHeight not Number");if(n>t.h||n>t.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(t,e){const n=t[e];if(typeof n!="number")return new Error("maxHeight not Number");if(n<t.h||n<t.minH)return new Error("maxHeight smaller than item height/minHeight")},i:Y.default.string.isRequired,resizeHandles:Dr.resizeHandleAxesType,resizeHandle:Dr.resizeHandleType,onDragStop:Y.default.func,onDragStart:Y.default.func,onDrag:Y.default.func,onResizeStop:Y.default.func,onResizeStart:Y.default.func,onResize:Y.default.func,isDraggable:Y.default.bool.isRequired,isResizable:Y.default.bool.isRequired,isBounded:Y.default.bool.isRequired,static:Y.default.bool,useCSSTransforms:Y.default.bool.isRequired,transformScale:Y.default.number,className:Y.default.string,handle:Y.default.string,cancel:Y.default.string,droppingPosition:Y.default.shape({e:Y.default.object.isRequired,left:Y.default.number.isRequired,top:Y.default.number.isRequired})});Pe(gr,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1});Object.defineProperty(Mt,"__esModule",{value:!0});Mt.default=void 0;var qe=Ds(_),wn=Qn,Ms=vr(er),V=W,Fs=Ne,Nr=vr(sn),Ps=vr(Ve);function vr(t){return t&&t.__esModule?t:{default:t}}function $o(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return($o=function(r){return r?n:e})(t)}function Ds(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=$o(e);if(n&&n.has(t))return n.get(t);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function ge(t,e,n){return e=Ns(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ns(t){var e=js(t,"string");return typeof e=="symbol"?e:String(e)}function js(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const jr="react-grid-layout";let Lo=!1;try{Lo=/firefox/i.test(navigator.userAgent)}catch{}class hn extends qe.Component{constructor(){super(...arguments),ge(this,"state",{activeDrag:null,layout:(0,V.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,V.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),ge(this,"dragEnterCounter",0),ge(this,"onDragStart",(e,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,s=(0,V.getLayoutItem)(c,e);if(!s)return;const u={w:s.w,h:s.h,x:s.x,y:s.y,placeholder:!0,i:e};return this.setState({oldDragItem:(0,V.cloneLayoutItem)(s),oldLayout:c,activeDrag:u}),this.props.onDragStart(c,s,s,null,i,a)}),ge(this,"onDrag",(e,n,r,o)=>{let{e:i,node:a}=o;const{oldDragItem:c}=this.state;let{layout:s}=this.state;const{cols:u,allowOverlap:f,preventCollision:p}=this.props,h=(0,V.getLayoutItem)(s,e);if(!h)return;const v={w:h.w,h:h.h,x:h.x,y:h.y,placeholder:!0,i:e};s=(0,V.moveElement)(s,h,n,r,!0,p,(0,V.compactType)(this.props),u,f),this.props.onDrag(s,c,h,v,i,a),this.setState({layout:f?s:(0,V.compact)(s,(0,V.compactType)(this.props),u),activeDrag:v})}),ge(this,"onDragStop",(e,n,r,o)=>{let{e:i,node:a}=o;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:s}=this.state;const{cols:u,preventCollision:f,allowOverlap:p}=this.props,h=(0,V.getLayoutItem)(s,e);if(!h)return;s=(0,V.moveElement)(s,h,n,r,!0,f,(0,V.compactType)(this.props),u,p);const S=p?s:(0,V.compact)(s,(0,V.compactType)(this.props),u);this.props.onDragStop(S,c,h,null,i,a);const{oldLayout:y}=this.state;this.setState({activeDrag:null,layout:S,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(S,y)}),ge(this,"onResizeStart",(e,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,s=(0,V.getLayoutItem)(c,e);s&&(this.setState({oldResizeItem:(0,V.cloneLayoutItem)(s),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,s,s,null,i,a))}),ge(this,"onResize",(e,n,r,o)=>{let{e:i,node:a,size:c,handle:s}=o;const{oldResizeItem:u}=this.state,{layout:f}=this.state,{cols:p,preventCollision:h,allowOverlap:v}=this.props;let S=!1,y,O,R;const[I,b]=(0,V.withLayoutItem)(f,e,m=>{let T;return O=m.x,R=m.y,["sw","w","nw","n","ne"].indexOf(s)!==-1&&(["sw","nw","w"].indexOf(s)!==-1&&(O=m.x+(m.w-n),n=m.x!==O&&O<0?m.w:n,O=O<0?0:O),["ne","n","nw"].indexOf(s)!==-1&&(R=m.y+(m.h-r),r=m.y!==R&&R<0?m.h:r,R=R<0?0:R),S=!0),h&&!v&&(T=(0,V.getAllCollisions)(f,{...m,w:n,h:r,x:O,y:R}).filter(E=>E.i!==m.i).length>0,T&&(R=m.y,r=m.h,O=m.x,n=m.w,S=!1)),m.w=n,m.h=r,m});if(!b)return;y=I,S&&(y=(0,V.moveElement)(I,b,O,R,!0,this.props.preventCollision,(0,V.compactType)(this.props),p,v));const x={w:b.w,h:b.h,x:b.x,y:b.y,static:!0,i:e};this.props.onResize(y,u,b,x,i,a),this.setState({layout:v?y:(0,V.compact)(y,(0,V.compactType)(this.props),p),activeDrag:x})}),ge(this,"onResizeStop",(e,n,r,o)=>{let{e:i,node:a}=o;const{layout:c,oldResizeItem:s}=this.state,{cols:u,allowOverlap:f}=this.props,p=(0,V.getLayoutItem)(c,e),h=f?c:(0,V.compact)(c,(0,V.compactType)(this.props),u);this.props.onResizeStop(h,s,p,null,i,a);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:h,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(h,v)}),ge(this,"onDragOver",e=>{var I;if(e.preventDefault(),e.stopPropagation(),Lo&&!((I=e.nativeEvent.target)!=null&&I.classList.contains(jr)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:i,rowHeight:a,maxRows:c,width:s,containerPadding:u,transformScale:f}=this.props,p=r==null?void 0:r(e);if(p===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const h={...n,...p},{layout:v}=this.state,S=e.currentTarget.getBoundingClientRect(),y=e.clientX-S.left,O=e.clientY-S.top,R={left:y/f,top:O/f,e};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:b,top:x}=this.state.droppingPosition;(b!=y||x!=O)&&this.setState({droppingPosition:R})}}else{const b={cols:i,margin:o,maxRows:c,rowHeight:a,containerWidth:s,containerPadding:u||o},x=(0,Fs.calcXY)(b,O,y,h.w,h.h);this.setState({droppingDOMNode:qe.createElement("div",{key:h.i}),droppingPosition:R,layout:[...v,{...h,x:x.x,y:x.y,static:!1,isDraggable:!0}]})}}),ge(this,"removeDroppingPlaceholder",()=>{const{droppingItem:e,cols:n}=this.props,{layout:r}=this.state,o=(0,V.compact)(r.filter(i=>i.i!==e.i),(0,V.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:o,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),ge(this,"onDragLeave",e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),ge(this,"onDragEnter",e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter++}),ge(this,"onDrop",e=>{e.preventDefault(),e.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,o=r.find(i=>i.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,o,e)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(e,n){let r;return n.activeDrag?null:(!(0,wn.deepEqual)(e.layout,n.propsLayout)||e.compactType!==n.compactType?r=e.layout:(0,V.childrenEqual)(e.children,n.children)||(r=n.layout),r?{layout:(0,V.synchronizeLayoutWithChildren)(r,e.children,e.cols,(0,V.compactType)(e),e.allowOverlap),compactType:e.compactType,children:e.children,propsLayout:e.layout}:null)}shouldComponentUpdate(e,n){return this.props.children!==e.children||!(0,V.fastRGLPropsEqual)(this.props,e,wn.deepEqual)||this.state.activeDrag!==n.activeDrag||this.state.mounted!==n.mounted||this.state.droppingPosition!==n.droppingPosition}componentDidUpdate(e,n){if(!this.state.activeDrag){const r=this.state.layout,o=n.layout;this.onLayoutMaybeChanged(r,o)}}containerHeight(){if(!this.props.autoSize)return;const e=(0,V.bottom)(this.state.layout),n=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return e*this.props.rowHeight+(e-1)*this.props.margin[1]+n*2+"px"}onLayoutMaybeChanged(e,n){n||(n=this.state.layout),(0,wn.deepEqual)(n,e)||this.props.onLayoutChange(e)}placeholder(){const{activeDrag:e}=this.state;if(!e)return null;const{width:n,cols:r,margin:o,containerPadding:i,rowHeight:a,maxRows:c,useCSSTransforms:s,transformScale:u}=this.props;return qe.createElement(Nr.default,{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:n,cols:r,margin:o,containerPadding:i||o,maxRows:c,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:s,transformScale:u},qe.createElement("div",null))}processGridItem(e,n){if(!e||!e.key)return;const r=(0,V.getLayoutItem)(this.state.layout,String(e.key));if(!r)return null;const{width:o,cols:i,margin:a,containerPadding:c,rowHeight:s,maxRows:u,isDraggable:f,isResizable:p,isBounded:h,useCSSTransforms:v,transformScale:S,draggableCancel:y,draggableHandle:O,resizeHandles:R,resizeHandle:I}=this.props,{mounted:b,droppingPosition:x}=this.state,m=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&f,T=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&p,w=r.resizeHandles||R,E=m&&h&&r.isBounded!==!1;return qe.createElement(Nr.default,{containerWidth:o,cols:i,margin:a,containerPadding:c||a,maxRows:u,rowHeight:s,cancel:y,handle:O,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:m,isResizable:T,isBounded:E,useCSSTransforms:v&&b,usePercentages:!b,transformScale:S,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:n?x:void 0,resizeHandles:w,resizeHandle:I},e)}render(){const{className:e,style:n,isDroppable:r,innerRef:o}=this.props,i=(0,Ms.default)(jr,e),a={height:this.containerHeight(),...n};return qe.createElement("div",{ref:o,className:i,style:a,onDrop:r?this.onDrop:V.noop,onDragLeave:r?this.onDragLeave:V.noop,onDragEnter:r?this.onDragEnter:V.noop,onDragOver:r?this.onDragOver:V.noop},qe.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}Mt.default=hn;ge(hn,"displayName","ReactGridLayout");ge(hn,"propTypes",Ps.default);ge(hn,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:V.noop,onDragStart:V.noop,onDrag:V.noop,onDragStop:V.noop,onResizeStart:V.noop,onResize:V.noop,onResizeStop:V.noop,onDrop:V.noop,onDropDragOver:V.noop});var mn={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.findOrGenerateResponsiveLayout=Us;Qe.getBreakpointFromWidth=$s;Qe.getColsFromBreakpoint=Ls;Qe.sortBreakpoints=yr;var $t=W;function $s(t,e){const n=yr(t);let r=n[0];for(let o=1,i=n.length;o<i;o++){const a=n[o];e>t[a]&&(r=a)}return r}function Ls(t,e){if(!e[t])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+t+" is missing!");return e[t]}function Us(t,e,n,r,o,i){if(t[n])return(0,$t.cloneLayout)(t[n]);let a=t[r];const c=yr(e),s=c.slice(c.indexOf(n));for(let u=0,f=s.length;u<f;u++){const p=s[u];if(t[p]){a=t[p];break}}return a=(0,$t.cloneLayout)(a||[]),(0,$t.compact)((0,$t.correctBounds)(a,{cols:o}),i,o)}function yr(t){return Object.keys(t).sort(function(n,r){return t[n]-t[r]})}Object.defineProperty(mn,"__esModule",{value:!0});mn.default=void 0;var $r=As(_),be=Uo(We),In=Qn,st=W,Be=Qe,Vs=Uo(Mt);function Uo(t){return t&&t.__esModule?t:{default:t}}function Vo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(Vo=function(r){return r?n:e})(t)}function As(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=Vo(e);if(n&&n.has(t))return n.get(t);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function zn(){return zn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zn.apply(this,arguments)}function Xt(t,e,n){return e=zs(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zs(t){var e=ks(t,"string");return typeof e=="symbol"?e:String(e)}function ks(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const Lr=t=>Object.prototype.toString.call(t);function Lt(t,e){return t==null?null:Array.isArray(t)?t:t[e]}class Cr extends $r.Component{constructor(){super(...arguments),Xt(this,"state",this.generateInitialState()),Xt(this,"onLayoutChange",e=>{this.props.onLayoutChange(e,{...this.props.layouts,[this.state.breakpoint]:e})})}generateInitialState(){const{width:e,breakpoints:n,layouts:r,cols:o}=this.props,i=(0,Be.getBreakpointFromWidth)(n,e),a=(0,Be.getColsFromBreakpoint)(i,o),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Be.findOrGenerateResponsiveLayout)(r,n,i,i,a,c),breakpoint:i,cols:a}}static getDerivedStateFromProps(e,n){if(!(0,In.deepEqual)(e.layouts,n.layouts)){const{breakpoint:r,cols:o}=n;return{layout:(0,Be.findOrGenerateResponsiveLayout)(e.layouts,e.breakpoints,r,r,o,e.compactType),layouts:e.layouts}}return null}componentDidUpdate(e){(this.props.width!=e.width||this.props.breakpoint!==e.breakpoint||!(0,In.deepEqual)(this.props.breakpoints,e.breakpoints)||!(0,In.deepEqual)(this.props.cols,e.cols))&&this.onWidthChange(e)}onWidthChange(e){const{breakpoints:n,cols:r,layouts:o,compactType:i}=this.props,a=this.props.breakpoint||(0,Be.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,s=(0,Be.getColsFromBreakpoint)(a,r),u={...o};if(c!==a||e.breakpoints!==n||e.cols!==r){c in u||(u[c]=(0,st.cloneLayout)(this.state.layout));let h=(0,Be.findOrGenerateResponsiveLayout)(u,n,a,c,s,i);h=(0,st.synchronizeLayoutWithChildren)(h,this.props.children,s,i,this.props.allowOverlap),u[a]=h,this.props.onLayoutChange(h,u),this.props.onBreakpointChange(a,s),this.setState({breakpoint:a,layout:h,cols:s})}const f=Lt(this.props.margin,a),p=Lt(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,f,s,p)}render(){const{breakpoint:e,breakpoints:n,cols:r,layouts:o,margin:i,containerPadding:a,onBreakpointChange:c,onLayoutChange:s,onWidthChange:u,...f}=this.props;return $r.createElement(Vs.default,zn({},f,{margin:Lt(i,this.state.breakpoint),containerPadding:Lt(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}mn.default=Cr;Xt(Cr,"propTypes",{breakpoint:be.default.string,breakpoints:be.default.object,allowOverlap:be.default.bool,cols:be.default.object,margin:be.default.oneOfType([be.default.array,be.default.object]),containerPadding:be.default.oneOfType([be.default.array,be.default.object]),layouts(t,e){if(Lr(t[e])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+Lr(t[e]));Object.keys(t[e]).forEach(n=>{if(!(n in t.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,st.validateLayout)(t.layouts[n],"layouts."+n)})},width:be.default.number.isRequired,onBreakpointChange:be.default.func,onLayoutChange:be.default.func,onWidthChange:be.default.func});Xt(Cr,"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:st.noop,onLayoutChange:st.noop,onWidthChange:st.noop});var Sr={},Ao=function(){if(typeof Map<"u")return Map;function t(e,n){var r=-1;return e.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(n){var r=t(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},e.prototype.set=function(n,r){var o=t(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},e.prototype.delete=function(n){var r=this.__entries__,o=t(r,n);~o&&r.splice(o,1)},e.prototype.has=function(n){return!!~t(this.__entries__,n)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var a=i[o];n.call(r,a[1],a[0])}},e}()}(),kn=typeof window<"u"&&typeof document<"u"&&window.document===document,Yt=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),Hs=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Yt):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)}}(),Ws=2;function qs(t,e){var n=!1,r=!1,o=0;function i(){n&&(n=!1,t()),r&&c()}function a(){Hs(i)}function c(){var s=Date.now();if(n){if(s-o<Ws)return;r=!0}else n=!0,r=!1,setTimeout(a,e);o=s}return c}var Bs=20,Gs=["top","right","bottom","left","width","height","size","weight"],Xs=typeof MutationObserver<"u",Ys=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=qs(this.refresh.bind(this),Bs)}return t.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},t.prototype.removeObserver=function(e){var n=this.observers_,r=n.indexOf(e);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){var e=this.updateObservers_();e&&this.refresh()},t.prototype.updateObservers_=function(){var e=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return e.forEach(function(n){return n.broadcastActive()}),e.length>0},t.prototype.connect_=function(){!kn||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Xs?(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)},t.prototype.disconnect_=function(){!kn||!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)},t.prototype.onTransitionEnd_=function(e){var n=e.propertyName,r=n===void 0?"":n,o=Gs.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),zo=function(t,e){for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];Object.defineProperty(t,o,{value:e[o],enumerable:!1,writable:!1,configurable:!0})}return t},lt=function(t){var e=t&&t.ownerDocument&&t.ownerDocument.defaultView;return e||Yt},ko=gn(0,0,0,0);function Kt(t){return parseFloat(t)||0}function Ur(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce(function(r,o){var i=t["border-"+o+"-width"];return r+Kt(i)},0)}function Ks(t){for(var e=["top","right","bottom","left"],n={},r=0,o=e;r<o.length;r++){var i=o[r],a=t["padding-"+i];n[i]=Kt(a)}return n}function Zs(t){var e=t.getBBox();return gn(0,0,e.width,e.height)}function Js(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return ko;var r=lt(t).getComputedStyle(t),o=Ks(r),i=o.left+o.right,a=o.top+o.bottom,c=Kt(r.width),s=Kt(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==e&&(c-=Ur(r,"left","right")+i),Math.round(s+a)!==n&&(s-=Ur(r,"top","bottom")+a)),!el(t)){var u=Math.round(c+i)-e,f=Math.round(s+a)-n;Math.abs(u)!==1&&(c-=u),Math.abs(f)!==1&&(s-=f)}return gn(o.left,o.top,c,s)}var Qs=function(){return typeof SVGGraphicsElement<"u"?function(t){return t instanceof lt(t).SVGGraphicsElement}:function(t){return t instanceof lt(t).SVGElement&&typeof t.getBBox=="function"}}();function el(t){return t===lt(t).document.documentElement}function tl(t){return kn?Qs(t)?Zs(t):Js(t):ko}function nl(t){var e=t.x,n=t.y,r=t.width,o=t.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,a=Object.create(i.prototype);return zo(a,{x:e,y:n,width:r,height:o,top:n,right:e+r,bottom:o+n,left:e}),a}function gn(t,e,n,r){return{x:t,y:e,width:n,height:r}}var rl=function(){function t(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=gn(0,0,0,0),this.target=e}return t.prototype.isActive=function(){var e=tl(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},t}(),ol=function(){function t(e,n){var r=nl(n);zo(this,{target:e,contentRect:r})}return t}(),il=function(){function t(e,n,r){if(this.activeObservations_=[],this.observations_=new Ao,typeof e!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=n,this.callbackCtx_=r}return t.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof lt(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)||(n.set(e,new rl(e)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof lt(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)&&(n.delete(e),n.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&e.activeObservations_.push(n)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new ol(r.target,r.broadcastRect())});this.callback_.call(e,n,e),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),Ho=typeof WeakMap<"u"?new WeakMap:new Ao,Wo=function(){function t(e){if(!(this instanceof t))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=Ys.getInstance(),r=new il(e,n,this);Ho.set(this,r)}return t}();["observe","unobserve","disconnect"].forEach(function(t){Wo.prototype[t]=function(){var e;return(e=Ho.get(this))[t].apply(e,arguments)}});var al=function(){return typeof Yt.ResizeObserver<"u"?Yt.ResizeObserver:Wo}();const sl=Object.freeze(Object.defineProperty({__proto__:null,default:al},Symbol.toStringTag,{value:"Module"})),ll=Zr(sl);Object.defineProperty(Sr,"__esModule",{value:!0});Sr.default=gl;var Ut=fl(_),cl=br(We),ul=br(ll),dl=br(er);function br(t){return t&&t.__esModule?t:{default:t}}function qo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(qo=function(r){return r?n:e})(t)}function fl(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=qo(e);if(n&&n.has(t))return n.get(t);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function Hn(){return Hn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Hn.apply(this,arguments)}function nt(t,e,n){return e=pl(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pl(t){var e=hl(t,"string");return typeof e=="symbol"?e:String(e)}function hl(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const ml="react-grid-layout";function gl(t){var e;return e=class extends Ut.Component{constructor(){super(...arguments),nt(this,"state",{width:1280}),nt(this,"elementRef",Ut.createRef()),nt(this,"mounted",!1),nt(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new ul.default(o=>{if(this.elementRef.current instanceof HTMLElement){const a=o[0].contentRect.width;this.setState({width:a})}});const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.observe(r)}componentWillUnmount(){this.mounted=!1;const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.unobserve(r),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:r,...o}=this.props;return r&&!this.mounted?Ut.createElement("div",{className:(0,dl.default)(this.props.className,ml),style:this.props.style,ref:this.elementRef}):Ut.createElement(t,Hn({innerRef:this.elementRef},o,this.state))}},nt(e,"defaultProps",{measureBeforeMount:!1}),nt(e,"propTypes",{measureBeforeMount:cl.default.bool}),e}(function(t){t.exports=Mt.default,t.exports.utils=W,t.exports.calculateUtils=Ne,t.exports.Responsive=mn.default,t.exports.Responsive.utils=Qe,t.exports.WidthProvider=Sr.default})(ro);var vl=ro.exports;const yl=oi(vl),bt={type:d.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(t,e){if(!e)return!1;const n=t.get(d.IUndoRedoService),r=t.get(d.ICommandService),o=t.get(d.IUniverInstanceService),i=j.getSheetCommandTarget(o,e);if(!i)return!1;const{unitId:a,subUnitId:c}=i,s={unitId:a,subUnitId:c,cfId:e.cfId},u=l.DeleteConditionalRuleMutationUndoFactory(t,s),f=r.syncExecuteCommand(l.DeleteConditionalRuleMutation.id,s);return f&&n.pushUndoRedo({unitID:a,undoMutations:u,redoMutations:[{id:l.DeleteConditionalRuleMutation.id,params:s}]}),f}},vn={type:d.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(t,e){if(!e)return!1;const n=t.get(d.IUndoRedoService),r=t.get(d.ICommandService),o=t.get(d.IUniverInstanceService),i=t.get(l.ConditionalFormattingRuleModel),a=j.getSheetCommandTarget(o,e);if(!a)return!1;const{unitId:c,subUnitId:s}=a,u=l.transformSupportSymmetryAnchor(e.start,e.end,i.getSubunitRules(c,s)||[],y=>y.cfId);if(!u)return!1;const[f,p]=u,h={unitId:c,subUnitId:s,start:f,end:p},v=l.MoveConditionalRuleMutationUndoFactory(h),S=r.syncExecuteCommand(l.MoveConditionalRuleMutation.id,h);return S&&n.pushUndoRedo({unitID:c,redoMutations:[{id:l.MoveConditionalRuleMutation.id,params:h}],undoMutations:v}),S}},Cl="univer-cf-preview",Vt={cfPreview:Cl},dt=t=>{var o,i;const e=t.rule;if(!e)return null;const n=_.useMemo(()=>{if(e.type===l.CFRuleType.colorScale){const a=e.config.map((u,f)=>({color:new d.ColorKit(u.color),value:f})),c=a.length-1;return new Array(5).fill("").map((u,f,p)=>f*c/(p.length-1)).map(u=>l.getColorScaleFromValue(a,u))}return null},[e]),r=_.useMemo(()=>{if(e.type===l.CFRuleType.iconSet)return e.config.map(a=>{const c=l.iconMap[a.iconType];return c&&c[Number(a.iconId)]})},[e]);switch(e.type){case l.CFRuleType.dataBar:{const{isGradient:a}=e.config,c={width:"50%",height:"100%"},s=a?`linear-gradient(to right, ${e.config.positiveColor||l.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,u=a?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||l.defaultDataBarNativeColor})`:e.config.nativeColor;return g.jsxs("div",{className:Vt.cfPreview,children:[g.jsx("div",{style:{...c,background:u,border:`1px solid ${e.config.nativeColor||l.defaultDataBarNativeColor}`}}),g.jsx("div",{style:{...c,background:s,border:`1px solid ${e.config.positiveColor||l.defaultDataBarPositiveColor}`}})]})}case l.CFRuleType.colorScale:return n&&g.jsx("div",{className:Vt.cfPreview,children:n.map((a,c)=>g.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:a}},c))});case l.CFRuleType.iconSet:return r&&g.jsx("div",{className:Vt.cfPreview,children:r.map((a,c)=>a?g.jsx("img",{style:{height:"100%"},src:a},c):g.jsx(Ot,{},c))});case l.CFRuleType.highlightCell:{const{ul:a,st:c,it:s,bl:u,bg:f,cl:p}=e.style,h=(a==null?void 0:a.s)===d.BooleanNumber.TRUE,v=(c==null?void 0:c.s)===d.BooleanNumber.TRUE,S=s===d.BooleanNumber.TRUE,y=u===d.BooleanNumber.TRUE,O=(o=f==null?void 0:f.rgb)!=null?o:l.DEFAULT_BG_COLOR,R=(i=p==null?void 0:p.rgb)!=null?i:l.DEFAULT_FONT_COLOR,I={fontWeight:y?"bold":void 0,fontStyle:S?"italic":void 0,textDecoration:`${h?"underline":""} ${v?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:O,color:R};return g.jsx("div",{style:I,className:Vt.cfPreview,children:"123"})}}return null};var Sl=Object.defineProperty,bl=Object.getOwnPropertyDescriptor,Rl=(t,e,n,r)=>{for(var o=r>1?void 0:r?bl(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Sl(e,n,o),o},Tl=(t,e)=>(n,r)=>e(n,r,t);let ct=class extends d.Disposable{constructor(e){super();Ae(this,"_initLocal",()=>{});Ae(this,"_findReplaceIndex",e=>{const n=/\{([^}]+)?\}/g,r=[];let o=n.exec(e);for(;o;)r.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=n.exec(e);return r});this._localeService=e,this._initLocal()}tWithReactNode(e,...n){const r=this._localeService.getLocales(),o=e.split("."),i=r&&this._localeService.resolveKeyPath(r,o);if(typeof i=="string"){const a=[];return this._findReplaceIndex(i).forEach((c,s,u)=>{const f=u[s-1]||{startIndex:0,endIndex:-1};if(f.endIndex+1<c.startIndex){const p=i.slice(f.endIndex+1,c.startIndex);p&&a.push(p)}if(n[c.key]&&a.push(n[c.key]),s===u.length-1){const p=i.slice(c.endIndex+1);p&&a.push(p)}}),a}return[]}};ct=Rl([Tl(0,d.Inject(d.LocaleService))],ct);const wl="univer-cf-rule-list",Il="univer-rule-selector",_l="univer-select",xl="univer-select-selector",El="univer-select-selection-item",Ol="univer-select-selection-search-input",Ml="univer-btn-list",Fl="univer-gap",Pl="univer-icon",Dl="univer-disabled",Nl="univer-rule-item",jl="univer-rule-describe",$l="univer-rule-type",Ll="univer-rule-range",Ul="univer-active",Vl="univer-draggableHandle",Al="univer-delete-item",zl="univer-grid-layout-wrap",kl="univer-react-grid-item",de={cfRuleList:wl,ruleSelector:Il,select:_l,selectSelector:xl,selectSelectionItem:El,selectSelectionSearchInput:Ol,btnList:Ml,gap:Fl,icon:Pl,disabled:Dl,ruleItem:Nl,ruleDescribe:jl,ruleType:$l,ruleRange:Ll,active:Ul,draggableHandle:Vl,deleteItem:Al,gridLayoutWrap:zl,reactGridItem:kl},Hl=(t,e)=>{const n=t.rule;switch(n.type){case l.CFRuleType.colorScale:return e.t("sheet.cf.ruleType.colorScale");case l.CFRuleType.dataBar:return e.t("sheet.cf.ruleType.dataBar");case l.CFRuleType.iconSet:return e.t("sheet.cf.ruleType.iconSet");case l.CFRuleType.highlightCell:switch(n.subType){case l.CFSubRuleType.average:{const r=n.operator;return e.t(`sheet.cf.preview.describe.${r}`,e.t("sheet.cf.subRuleType.average"))}case l.CFSubRuleType.duplicateValues:return e.t("sheet.cf.subRuleType.duplicateValues");case l.CFSubRuleType.uniqueValues:return e.t("sheet.cf.subRuleType.uniqueValues");case l.CFSubRuleType.number:{const r=n.operator;return e.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(o=>String(o)):[String(n.value||"")])}case l.CFSubRuleType.text:{const r=n.operator;return e.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case l.CFSubRuleType.timePeriod:{const r=n.operator;return e.t(`sheet.cf.preview.describe.${r}`)}case l.CFSubRuleType.rank:return n.isPercent?n.isBottom?e.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):e.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?e.t("sheet.cf.preview.describe.bottomN",String(n.value)):e.t("sheet.cf.preview.describe.topN",String(n.value));case l.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let Vr=0;const Wl=t=>{const{onClick:e}=t,n=d.useDependency(l.ConditionalFormattingRuleModel),r=d.useDependency(d.IUniverInstanceService),o=d.useDependency(j.SheetsSelectionsService),i=d.useDependency(d.ICommandService),a=d.useDependency(d.LocaleService),c=d.useDependency(d.Injector),s=d.useDependency(ct),u=ve.useObservable(()=>r.getCurrentTypeOfUnit$(d.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),f=u.getUnitId(),p=u.getActiveSheet();if(!p)throw new Error("No active sheet found");const h=p.getSheetId(),[v,S]=_.useState([]),[y,O]=_.useState("2"),[R,I]=_.useState(0),[b,x]=_.useState(-1),[m,T]=_.useState(Vr),w=_.useRef(null),E=[{label:a.t("sheet.cf.panel.workSheet"),value:"2"},{label:a.t("sheet.cf.panel.selectedRange"),value:"1"}],P=()=>{const L=n.getSubunitRules(f,h);if(!L||!L.length)return[];if(y==="1"){const G=o.getCurrentLastSelection();if(!G)return[];const te=G.range;return L.filter(fe=>fe.ranges.some(Ce=>d.Rectangle.intersects(Ce,te)))}else if(y==="2")return[...L];return[]},[$,z]=_.useState(P);oe.useHighlightRange(v),_.useEffect(()=>{const L=i.onCommandExecuted(G=>{G.id===j.SetWorksheetActiveOperation.id&&I(Math.random())});return()=>L.dispose()}),_.useEffect(()=>{z(P)},[y,R,f,h]),_.useEffect(()=>{if(y==="2")return;const L=new De.Observable(G=>{const te=[j.SetSelectionsOperation.id,l.AddConditionalRuleMutation.id,l.SetConditionalRuleMutation.id,l.DeleteConditionalRuleMutation.id,l.MoveConditionalRuleMutation.id],ne=i.onCommandExecuted(fe=>{const{id:Ce,params:xe}=fe,Le=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId();te.includes(Ce)&&xe.unitId===Le&&G.next(null)});return()=>ne.dispose()}).pipe(De.debounceTime(16)).subscribe(()=>{z(P)});return()=>{L.unsubscribe()}},[r,y,f,h]),_.useEffect(()=>{const L=n.$ruleChange.subscribe(()=>{I(Math.random())});return()=>L.unsubscribe()},[n]),_.useEffect(()=>{const L=()=>{var fe;const ne=Math.max(0,(((fe=w.current)==null?void 0:fe.getBoundingClientRect().width)||0)-8);return Vr=ne,ne},te=new De.Observable(ne=>{const fe=document.querySelector(".univer-sidebar");if(fe){let Ce=setTimeout(()=>{ne.next()},150);const xe=()=>{Ce&&clearTimeout(Ce),Ce=null},Le=D=>{D.propertyName==="width"&&(xe(),ne.next())};return fe.addEventListener("transitionend",Le),()=>{xe(),fe.removeEventListener("transitionend",Le)}}}).pipe(De.debounceTime(16)).subscribe(()=>{T(L())});return()=>{te.unsubscribe()}},[]);const q=L=>{var ne;const G=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),te=(ne=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:ne.getSheetId();if(!G||!te)throw new Error("No active sheet found");i.executeCommand(bt.id,{unitId:G,subUnitId:te,cfId:L.cfId})},C=(L,G)=>{x(G.y)},M=(L,G,te)=>{var D;x(-1);const ne=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),fe=(D=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:D.getSheetId();if(!ne||!fe)throw new Error("No active sheet found");const Ce=U=>{const K=$.length;return Math.min(K-1,Math.max(0,U))},xe=$[Ce(G.y)].cfId,Le=$[Ce(te.y)].cfId;xe!==Le&&i.executeCommand(vn.id,{unitId:ne,subUnitId:fe,start:{id:xe,type:"self"},end:{id:Le,type:te.y>G.y?"after":"before"}})},A=()=>{t.onCreate()},Q=()=>{y==="2"?i.executeCommand(Et.id):y==="1"&&$.map(G=>({unitId:f,subUnitId:h,cfId:G.cfId})).forEach(G=>{i.executeCommand(bt.id,G)})},X=_.useMemo(()=>{const L=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),G=L.getActiveSheet();return $.filter(te=>{const ne=te.ranges;return j.checkRangesEditablePermission(c,L.getUnitId(),G.getSheetId(),ne)})},[$]),ue=X.map((L,G)=>({i:L.cfId,x:0,w:12,y:G,h:1,isResizable:!1})),ae=_.useMemo(()=>{const L=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),G=L.getActiveSheet();return $.every(te=>{const ne=te.ranges;return j.checkRangesEditablePermission(c,L.getUnitId(),G.getSheetId(),ne)})},[$]);return g.jsxs("div",{className:de.cfRuleList,children:[g.jsxs("div",{className:de.ruleSelector,children:[g.jsx("div",{children:s.tWithReactNode("sheet.cf.panel.managerRuleSelect",g.jsx(B.Select,{className:de.select,options:E,value:y,onChange:L=>{O(L)}})).map((L,G)=>g.jsx("span",{children:L},G))}),g.jsxs("div",{className:de.btnList,children:[g.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.createRule"),placement:"bottom",children:g.jsx("div",{className:`${de.icon}`,onClick:A,children:g.jsx(to,{})})}),$.length&&ae?g.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.clear"),placement:"bottom",children:g.jsx("div",{className:`${de.gap} ${de.icon}`,onClick:Q,children:g.jsx(Bt,{})})}):g.jsx("div",{className:`${de.gap} ${de.disabled}`,children:g.jsx(Bt,{})})]})]}),g.jsx("div",{ref:w,className:de.gridLayoutWrap,children:m?g.jsx(yl,{onDragStop:M,onDragStart:C,layout:ue,cols:12,rowHeight:60,width:m,margin:[0,10],draggableHandle:".draggableHandle",children:X==null?void 0:X.map((L,G)=>g.jsx("div",{children:g.jsxs("div",{onMouseMove:()=>{L.ranges!==v&&S(L.ranges)},onMouseLeave:()=>S([]),onClick:()=>{e(L)},className:`${de.ruleItem} ${b===G?de.active:""}`,children:[g.jsx("div",{className:`${de.draggableHandle} draggableHandle`,onClick:te=>te.stopPropagation(),children:g.jsx(no,{})}),g.jsxs("div",{className:de.ruleDescribe,children:[g.jsx("div",{className:de.ruleType,children:Hl(L,a)}),g.jsx("div",{className:de.ruleRange,children:L.ranges.map(te=>Fn.serializeRange(te)).join(",")})]}),g.jsx("div",{className:de.preview,children:g.jsx(dt,{rule:L.rule})}),g.jsx("div",{className:`${de.deleteItem} ${b===G?de.active:""}`,onClick:te=>{te.stopPropagation(),q(L),S([])},children:g.jsx(Bt,{})})]})},`${L.cfId}`))}):null})]})},Dt={type:d.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(t,e){if(!e)return!1;const{rule:n}=e,r=t.get(d.IUndoRedoService),o=t.get(d.ICommandService),i=t.get(l.ConditionalFormattingRuleModel),a=t.get(d.IUniverInstanceService),c=j.getSheetCommandTarget(a);if(!c)return!1;const{unitId:s,subUnitId:u}=c,f=i.createCfId(s,u),p={unitId:s,subUnitId:u,rule:{...n,cfId:n.cfId||f}},h=l.AddConditionalRuleMutationUndoFactory(t,p),v=o.syncExecuteCommand(l.AddConditionalRuleMutation.id,p);return v&&r.pushUndoRedo({unitID:s,redoMutations:[{id:l.AddConditionalRuleMutation.id,params:p}],undoMutations:[h]}),v}},yn={type:d.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(t,e){if(!e)return!1;const n=t.get(d.IUndoRedoService),r=t.get(d.ICommandService),o=t.get(d.IUniverInstanceService),i=j.getSheetCommandTarget(o,e);if(!i)return!1;const{unitId:a,subUnitId:c}=i,s={unitId:a,subUnitId:c,rule:e.rule},u=l.setConditionalRuleMutationUndoFactory(t,s),f=r.syncExecuteCommand(l.SetConditionalRuleMutation.id,s);return f&&n.pushUndoRedo({unitID:a,undoMutations:u,redoMutations:[{id:l.SetConditionalRuleMutation.id,params:s}]}),f}},ql="univer-cf-color-picker",Bl="univer-cf-color-picker-icon",Gl="univer-icon-dropdown",_n={cfColorPicker:ql,cfColorPickerIcon:Bl,iconDropdown:Gl},Ze=t=>{const{color:e,onChange:n,disable:r=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:a=!0}=t,c=d.useDependency(ve.ComponentManager),s=_.useMemo(()=>new d.ColorKit(e),[e]),u=c.get(o);return u&&(r?g.jsx(u,{className:i,extend:{colorChannel1:s.isValid?e:"rgb(var(--primary-color))"}}):g.jsx(B.Dropdown,{overlay:g.jsx("div",{className:`${_n.cfColorPicker} `,children:g.jsx(B.ColorPicker,{color:e,onChange:n})}),children:g.jsxs("span",{className:`${_n.cfColorPickerIcon} ${i}`,children:[g.jsx(u,{extend:{colorChannel1:s.isValid?e:"rgb(var(--primary-color))"}}),a&&g.jsx(rn,{className:_n.iconDropdown})]})}))},Xl="univer-cf-rule-style-editor",Yl="univer-cf-preview-wrap",Kl="univer-text",Zl="univer-position-relative",Jl="univer-btn-list",Ql="univer-util-item",ec="univer-icon-set",tc="univer-render-config",nc="univer-flex",rc="univer-width45",oc="univer-icon-wrap",ic="univer-icon",ac="univer-dropdown-icon",sc="univer-error-input",lc="univer-error-text",cc="univer-icon-group-list",uc="univer-title",dc="univer-group",fc="univer-item-content",pc="univer-item-wrap",hc="univer-item",mc="univer-icon-item-list-wrap",gc="univer-none",vc="univer-icon-item-list",yc="univer-width100",Cc="univer-stress",N={cfRuleStyleEditor:Xl,cfPreviewWrap:Yl,text:Kl,positionRelative:Zl,btnList:Jl,utilItem:Ql,iconSet:ec,renderConfig:tc,flex:nc,width45:rc,iconWrap:oc,icon:ic,dropdownIcon:ac,errorInput:sc,errorText:lc,iconGroupList:cc,title:uc,group:dc,itemContent:fc,itemWrap:pc,item:hc,iconItemListWrap:mc,none:gc,iconItemList:vc,width100:yc,stress:Cc},Ge=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),xn=t=>{var S;const{type:e,className:n,onChange:r,id:o,value:i}=t,a=d.useDependency(d.IUniverInstanceService),c=a.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),s=(S=a.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:S.getSheetId(),u=_.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),f=_.useMemo(()=>[l.CFValueType.max,l.CFValueType.min,"none"].includes(e)?{disabled:!0}:[l.CFValueType.percent,l.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),p=_.useRef({}),[h,v]=_.useState(!1);return ve.useSidebarClick(y=>{var R;const O=(R=p.current)==null?void 0:R.handleOutClick;O&&O(y,()=>v(!1))}),e===l.CFValueType.formula?g.jsx("div",{style:{width:"100%",marginLeft:4},children:g.jsx(xt.FormulaEditor,{initValue:u,unitId:c,subUnitId:s,isFocus:h,onChange:(y="")=>{r(y||"")},onFocus:()=>v(!0),actions:p.current})}):g.jsx(B.InputNumber,{className:n,value:Number(t.value)||0,onChange:y=>t.onChange(y||0),...f})},Sc=t=>{var q;const{interceptorManager:e}=t,n=d.useDependency(d.LocaleService),r=((q=t.rule)==null?void 0:q.type)===l.CFRuleType.colorScale?t.rule:void 0,o=[Ge(l.CFValueType.num,n),Ge(l.CFValueType.percent,n),Ge(l.CFValueType.percentile,n),Ge(l.CFValueType.formula,n)],i=[Ge(l.CFValueType.min,n),...o],a=[Ge("none",n),...o],c=[Ge(l.CFValueType.max,n),...o],[s,u]=_.useState(()=>{var M;const C=l.CFValueType.min;return r&&((M=r.config[0])==null?void 0:M.value.type)||C}),[f,p]=_.useState(()=>{var M;const C="none";return!r||r.config.length!==3?C:((M=r.config[1])==null?void 0:M.value.type)||C}),[h,v]=_.useState(()=>{var M;const C=l.CFValueType.max;return r&&((M=r.config[r.config.length-1])==null?void 0:M.value.type)||C}),[S,y]=_.useState(()=>{if(!r)return 10;const M=r.config[0];return(M==null?void 0:M.value.value)===void 0?10:M==null?void 0:M.value.value}),[O,R]=_.useState(()=>{var A;if(!r||r.config.length!==3)return 50;const M=(A=r.config[1])==null?void 0:A.value.value;return M===void 0?50:M}),[I,b]=_.useState(()=>{var A;if(!r)return 90;const M=(A=r.config[r.config.length-1])==null?void 0:A.value.value;return M===void 0?90:M}),[x,m]=_.useState(()=>{var M;const C="#d0d9fb";return r&&((M=r.config[0])==null?void 0:M.color)||C}),[T,w]=_.useState(()=>{var M;const C="#7790f3";return!r||r.config.length!==3?C:((M=r.config[1])==null?void 0:M.color)||C}),[E,P]=_.useState(()=>{var M;const C="#2e55ef";return r&&((M=r.config[r.config.length-1])==null?void 0:M.color)||C}),$=_.useMemo(()=>C=>{const{minType:M,medianType:A,maxType:Q,minValue:X,medianValue:ue,maxValue:ae,minColor:L,medianColor:G,maxColor:te}=C,ne=[];return ne.push({color:L,value:{type:M,value:X}}),A!=="none"&&ne.push({color:G,value:{type:A,value:ue}}),ne.push({color:te,value:{type:Q,value:ae}}),{config:ne.map((Ce,xe)=>({...Ce,index:xe})),type:l.CFRuleType.colorScale}},[]);_.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return $({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:x,medianColor:T,maxColor:E})}}),[$,s,f,h,S,O,I,x,T,E,e]);const z=C=>{t.onChange($(C))};return g.jsxs("div",{children:[g.jsx("div",{className:F.title,children:n.t("sheet.cf.panel.styleRule")}),g.jsx("div",{className:`${N.cfPreviewWrap}`,children:g.jsx(dt,{rule:$({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:x,medianColor:T,maxColor:E})})}),g.jsx("div",{className:F.label,children:n.t("sheet.cf.valueType.min")}),g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm}`,children:[g.jsx(B.Select,{style:{flexShrink:0},options:i,value:s,onChange:C=>{u(C);const M=l.createDefaultValueByValueType(C,10);y(M),z({minType:C,medianType:f,maxType:h,minValue:M,medianValue:O,maxValue:I,minColor:x,medianColor:T,maxColor:E})}}),g.jsx(xn,{id:"min",className:`${F.mLXxs}`,value:S,type:s,onChange:C=>{y(C),z({minType:s,medianType:f,maxType:h,minValue:C,medianValue:O,maxValue:I,minColor:x,medianColor:T,maxColor:E})}}),g.jsx(Ze,{className:F.mLXxs,color:x,onChange:C=>{m(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:C,medianColor:T,maxColor:E})}})]}),g.jsx("div",{className:F.label,children:n.t("sheet.cf.panel.medianValue")}),g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm}`,children:[g.jsx(B.Select,{style:{flexShrink:0},options:a,value:f,onChange:C=>{p(C);const M=l.createDefaultValueByValueType(C,50);R(M),z({minType:s,medianType:C,maxType:h,minValue:S,medianValue:M,maxValue:I,minColor:x,medianColor:T,maxColor:E})}}),g.jsx(xn,{id:"median",className:` ${F.mLXxs}`,value:O,type:f,onChange:C=>{R(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:C,maxValue:I,minColor:x,medianColor:T,maxColor:E})}}),f!=="none"&&g.jsx(Ze,{className:F.mLXxs,color:T,onChange:C=>{w(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:x,medianColor:C,maxColor:E})}})]}),g.jsx("div",{className:F.label,children:n.t("sheet.cf.valueType.max")}),g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm}`,children:[g.jsx(B.Select,{style:{flexShrink:0},options:c,value:h,onChange:C=>{v(C);const M=l.createDefaultValueByValueType(C,90);b(M),z({minType:s,medianType:f,maxType:C,minValue:S,medianValue:O,maxValue:M,minColor:x,medianColor:T,maxColor:E})}}),g.jsx(xn,{id:"max",className:`${F.mLXxs}`,value:I,type:h,onChange:C=>{b(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:C,minColor:x,medianColor:T,maxColor:E})}}),g.jsx(Ze,{className:F.mLXxs,color:E,onChange:C=>{P(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:x,medianColor:T,maxColor:C})}})]})]})},rt=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),Ar=t=>{var y;const{onChange:e,className:n,value:r,type:o,id:i,disabled:a=!1}=t,c=d.useDependency(d.IUniverInstanceService),s=c.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),u=(y=c.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:y.getSheetId(),f=_.useRef({}),[p,h]=_.useState(!1);ve.useSidebarClick(O=>{var I;const R=(I=f.current)==null?void 0:I.handleOutClick;R&&R(O,()=>h(!1))});const v=_.useRef(r),S=_.useMemo(()=>[l.CFValueType.percentile,l.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===l.CFValueType.formula){const O=String(v.current).startsWith("=")?String(v.current)||"":"=";return g.jsx("div",{style:{width:"100%",marginLeft:12},children:g.jsx(xt.FormulaEditor,{initValue:O,unitId:s,subUnitId:u,isFocus:p,onChange:(R="")=>{e(R||"")},onFocus:()=>h(!0),actions:f.current})})}return g.jsx(B.InputNumber,{className:n,value:Number(r)||0,disabled:a,onChange:O=>{e(O||0)},...S})},bc=t=>{var q;const{interceptorManager:e}=t,n=d.useDependency(d.LocaleService),r=((q=t.rule)==null?void 0:q.type)===l.CFRuleType.dataBar?t.rule:void 0,[o,i]=_.useState(()=>{var M;const C="0";return r?(M=r.config)!=null&&M.isGradient?"1":"0":C}),[a,c]=_.useState(()=>{var C;return r&&((C=r.config)==null?void 0:C.positiveColor)||l.defaultDataBarPositiveColor}),[s,u]=_.useState(()=>{var C;return r&&((C=r.config)==null?void 0:C.nativeColor)||l.defaultDataBarNativeColor}),f=[rt(l.CFValueType.num,n),rt(l.CFValueType.percent,n),rt(l.CFValueType.percentile,n),rt(l.CFValueType.formula,n)],p=[rt(l.CFValueType.min,n),...f],h=[rt(l.CFValueType.max,n),...f],[v,S]=_.useState(()=>{var M;const C=p[0].value;return r&&((M=r.config)==null?void 0:M.min.type)||C}),[y,O]=_.useState(()=>{var M;const C=h[0].value;return r&&((M=r.config)==null?void 0:M.max.type)||C}),[R,I]=_.useState(()=>{var A;if(!r)return 0;const M=((A=r.config)==null?void 0:A.min)||{};return M.type===l.CFValueType.formula?M.value||"=":M.value||0}),[b,x]=_.useState(()=>{var A;if(!r)return 100;const M=((A=r.config)==null?void 0:A.max)||{};return M.type===l.CFValueType.formula?M.value||"=":M.value===void 0?100:M.value}),[m,T]=_.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),w=C=>({config:{min:{type:C.minValueType,value:C.minValue},max:{type:C.maxValueType,value:C.maxValue},isGradient:C.isGradient==="1",positiveColor:C.positiveColor||l.defaultDataBarPositiveColor,nativeColor:C.nativeColor||l.defaultDataBarNativeColor},type:l.CFRuleType.dataBar,isShowValue:C.isShowValue});_.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return w({isGradient:o,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})}}),[o,R,v,b,y,a,s,e,m]);const E=C=>{t.onChange(w(C))},P=C=>{c(C),E({isGradient:o,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:C,nativeColor:s,isShowValue:m})},$=C=>{u(C),E({isGradient:o,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:C,isShowValue:m})},z=C=>f.map(M=>M.value).includes(C);return g.jsxs("div",{children:[g.jsx("div",{className:F.title,children:n.t("sheet.cf.panel.styleRule")}),g.jsx("div",{className:`${N.cfPreviewWrap}`,children:g.jsx(dt,{rule:w({isGradient:o,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})})}),g.jsxs("div",{children:[g.jsx("div",{className:F.label,children:n.t("sheet.cf.panel.fillType")}),g.jsxs("div",{className:`${F.mTSm} ${F.mLXxs} ${F.labelContainer} `,children:[g.jsxs(B.RadioGroup,{value:o,onChange:C=>{i(C),E({isGradient:C,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})},children:[g.jsx(B.Radio,{value:"0",children:g.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.pureColor")})}),g.jsx(B.Radio,{value:"1",children:g.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.gradient")})})]}),g.jsxs("div",{className:`${N.utilItem} ${F.mLXl}`,children:[g.jsx(B.Checkbox,{checked:!m,onChange:C=>{T(!C),E({isGradient:C,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:!C})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),g.jsxs("div",{children:[g.jsx("div",{className:F.label,children:n.t("sheet.cf.panel.colorSet")}),g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm} ${F.mLXxs}`,children:[g.jsxs("div",{className:`${F.labelContainer}`,children:[g.jsx("div",{className:`${N.text}`,children:n.t("sheet.cf.panel.native")}),g.jsx(Ze,{color:s,onChange:$})]}),g.jsxs("div",{className:`${F.labelContainer} ${F.mLSm} `,children:[g.jsx("div",{className:`${N.text} `,children:n.t("sheet.cf.panel.positive")}),g.jsx(Ze,{color:a,onChange:P})]})]})]}),g.jsxs("div",{children:[g.jsx("div",{className:F.label,children:n.t("sheet.cf.valueType.min")}),g.jsxs("div",{className:`${F.mTSm} ${F.labelContainer}`,children:[g.jsx(B.Select,{style:{width:"50%",flexShrink:0},options:p,value:v,onChange:C=>{S(C);const M=l.createDefaultValueByValueType(C,10);I(M),E({isGradient:o,minValue:M,minValueType:C,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})}}),g.jsx(Ar,{disabled:!z(v),id:"min",type:v,className:F.mLSm,value:R,onChange:C=>{I(C||0),E({isGradient:o,minValue:C||0,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})}})]}),g.jsx("div",{className:F.label,children:n.t("sheet.cf.valueType.max")}),g.jsxs("div",{className:`${F.mTSm} ${F.labelContainer}`,children:[g.jsx(B.Select,{style:{width:"50%",flexShrink:0},options:h,value:y,onChange:C=>{O(C);const M=l.createDefaultValueByValueType(C,90);x(M),E({isGradient:o,minValue:R,minValueType:v,maxValue:M,maxValueType:C,positiveColor:a,nativeColor:s,isShowValue:m})}}),g.jsx(Ar,{disabled:!z(y),id:"max",type:y,className:F.mLSm,value:b,onChange:C=>{x(C||0),E({isGradient:o,minValue:R,minValueType:v,maxValue:C||0,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})}})]})]})]})};function Bo(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=Bo(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function At(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=Bo(t))&&(r&&(r+=" "),r+=e);return r}const Rc="univer-cf-style-edit",Tc="univer-button-item",wc="univer-isActive",Ue={cfStyleEdit:Rc,buttonItem:Tc,isActive:wc},zt=t=>[d.BooleanNumber.FALSE,void 0].includes(t)?d.BooleanNumber.TRUE:d.BooleanNumber.FALSE,kt=t=>t!==d.BooleanNumber.FALSE,Rr=t=>{const{style:e,onChange:n,className:r}=t,o=d.useDependency(ve.ComponentManager),[i,a]=_.useState(()=>{if(e!=null&&e.bl)return e.bl}),[c,s]=_.useState(()=>{if(e!=null&&e.it)return e.it}),[u,f]=_.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[p,h]=_.useState(()=>{if(e!=null&&e.st)return e.st.s}),[v,S]=_.useState(()=>{var T;const m="#2f56ef";return(T=e==null?void 0:e.cl)!=null&&T.rgb?e.cl.rgb:m}),[y,O]=_.useState(()=>{var T;const m="#e8ecfc";return(T=e==null?void 0:e.bg)!=null&&T.rgb?e.bg.rgb:m}),R=o.get("BoldSingle"),I=o.get("ItalicSingle"),b=o.get("UnderlineSingle"),x=o.get("StrikethroughSingle");return _.useEffect(()=>{const m={bl:i,it:c};v!==void 0&&(m.cl={rgb:v}),y!==void 0&&(m.bg={rgb:y}),p!==void 0&&(m.st={s:p}),u!==void 0&&(m.ul={s:u}),n(l.removeUndefinedAttr(m))},[i,c,u,p,v,y]),g.jsxs("div",{className:`${Ue.cfStyleEdit} ${r}`,children:[R&&g.jsx("div",{className:At({[Ue.isActive]:kt(i||d.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>a(zt(i)),children:g.jsx(R,{})}),I&&g.jsx("div",{className:At({[Ue.isActive]:kt(c||d.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>s(zt(c)),children:g.jsx(I,{})}),b&&g.jsx("div",{className:At({[Ue.isActive]:kt(u||d.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>f(zt(u)),children:g.jsx(b,{})}),x&&g.jsx("div",{className:At({[Ue.isActive]:kt(p||d.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>h(zt(p)),children:g.jsx(x,{})}),g.jsx(Ze,{color:v,onChange:S,iconId:"FontColor"}),g.jsx(Ze,{color:y,onChange:O,iconId:"PaintBucket"})]})},Ic=t=>{var x;const{onChange:e,interceptorManager:n}=t,r=d.useDependency(d.LocaleService),i=d.useDependency(d.IUniverInstanceService).getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),a=i.getActiveSheet(),c=((x=t.rule)==null?void 0:x.type)===l.CFRuleType.highlightCell?t.rule:void 0,s=_.useRef(null),[u,f]=_.useState(!1),p=_.useRef({}),[h,v]=_.useState({}),[S,y]=_.useState(()=>(c==null?void 0:c.subType)===l.CFSubRuleType.formula?c.value:"="),[O,R]=_.useState(void 0),I=m=>({style:m.style,value:S,type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.formula});_.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return I({style:h,formula:S})}}),[h,S,n]),_.useEffect(()=>n.intercept(n.getInterceptPoints().beforeSubmit,{handler:(T,w,E)=>O||S.length===1||!S.startsWith("=")?(R(r.t("sheet.cf.errorMessage.formulaError")),!1):E(T)}),[O,S]);const b=m=>{e(I(m))};return ve.useSidebarClick(m=>{var w;const T=(w=p.current)==null?void 0:w.handleOutClick;T&&T(m,()=>f(!1))}),g.jsxs("div",{ref:s,children:[g.jsx("div",{className:`${F.title} ${F.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),g.jsx("div",{className:`${F.mTSm}`,children:g.jsx(xt.FormulaEditor,{onChange:m=>{y(m),b({style:h,formula:m})},onVerify:(m,T)=>{!m||T.length===1?R(r.t("sheet.cf.errorMessage.formulaError")):R(void 0)},errorText:O,onFocus:()=>{f(!0)},actions:p.current,isFocus:u,initValue:S,unitId:i.getUnitId(),subUnitId:a==null?void 0:a.getSheetId()})}),g.jsx("div",{className:`${N.cfPreviewWrap} `,children:g.jsx(dt,{rule:I({style:h,formula:S})})}),g.jsx(Rr,{style:c==null?void 0:c.style,className:`${F.mTSm} `,onChange:m=>{v(m),b({style:m,formula:S})}})]})},Ht=t=>g.jsxs("div",{style:{position:"relative"},children:[g.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:t.errorText}),t.children]}),ee=(t,e)=>({label:e.t(`sheet.cf.operator.${t}`),value:t}),_c=t=>{const{type:e,operator:n,onChange:r,value:o,interceptorManager:i}=t,a=d.useDependency(d.LocaleService),[c,s]=_.useState(()=>typeof o=="number"?o:0),[u,f]=_.useState(""),[p,h]=_.useState(()=>typeof o=="string"?o:""),[v,S]=_.useState(""),[y,O]=_.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[R,I]=_.useState(""),[b,x]=_.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100),[m,T]=_.useState("");switch(_.useEffect(()=>{switch(e){case l.CFSubRuleType.text:{[l.CFTextOperator.beginsWith,l.CFTextOperator.endsWith,l.CFTextOperator.containsText,l.CFTextOperator.notContainsText,l.CFTextOperator.equal,l.CFTextOperator.notEqual].includes(n)&&r(p);break}case l.CFSubRuleType.number:{[l.CFNumberOperator.equal,l.CFNumberOperator.notEqual,l.CFNumberOperator.greaterThan,l.CFNumberOperator.greaterThanOrEqual,l.CFNumberOperator.lessThan,l.CFNumberOperator.lessThanOrEqual].includes(n)&&r(c),[l.CFNumberOperator.between,l.CFNumberOperator.notBetween].includes(n)&&r([y,b]);break}}},[e]),_.useEffect(()=>{const w=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(E,P,$)=>{switch(e){case l.CFSubRuleType.text:if([l.CFTextOperator.beginsWith,l.CFTextOperator.containsText,l.CFTextOperator.endsWith,l.CFTextOperator.notEqual,l.CFTextOperator.notContainsText,l.CFTextOperator.equal].includes(n))return p?$(E):(S(a.t("sheet.cf.errorMessage.notBlank")),!1)}return $(E)}});return()=>{w()}},[e,c,p,n]),e){case l.CFSubRuleType.text:{if([l.CFTextOperator.beginsWith,l.CFTextOperator.endsWith,l.CFTextOperator.containsText,l.CFTextOperator.notContainsText,l.CFTextOperator.equal,l.CFTextOperator.notEqual].includes(n)){const w=E=>{h(E),r(E)};return g.jsx("div",{className:`${F.mTSm}`,children:g.jsx(Ht,{errorText:v,children:g.jsx(B.Input,{className:N.width100,value:p,onChange:E=>{S(""),w(E)}})})})}break}case l.CFSubRuleType.number:{if([l.CFNumberOperator.equal,l.CFNumberOperator.notEqual,l.CFNumberOperator.greaterThan,l.CFNumberOperator.greaterThanOrEqual,l.CFNumberOperator.lessThan,l.CFNumberOperator.lessThanOrEqual].includes(n)){const w=E=>{s(E||0),r(E||0),f("")};return g.jsx("div",{className:`${F.mTSm}`,children:g.jsx(Ht,{errorText:u,children:g.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:N.width100,value:c,onChange:w})})})}if([l.CFNumberOperator.between,l.CFNumberOperator.notBetween].includes(n)){const w=P=>{O(P||0),r([P||0,b]),I("")},E=P=>{x(P||0),r([y,P||0]),T("")};return g.jsxs("div",{className:`${F.mTSm} ${F.labelContainer} `,children:[g.jsx(Ht,{errorText:R,children:g.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:y,onChange:w})}),g.jsx(Ht,{errorText:m,children:g.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${F.mLSm}`,value:b,onChange:E})})]})}}}return null},zr=(t,e)=>{switch(t){case l.CFSubRuleType.text:return[ee(l.CFTextOperator.containsText,e),ee(l.CFTextOperator.notContainsText,e),ee(l.CFTextOperator.beginsWith,e),ee(l.CFTextOperator.endsWith,e),ee(l.CFTextOperator.equal,e),ee(l.CFTextOperator.notEqual,e),ee(l.CFTextOperator.containsBlanks,e),ee(l.CFTextOperator.notContainsBlanks,e),ee(l.CFTextOperator.containsErrors,e),ee(l.CFTextOperator.notContainsErrors,e)];case l.CFSubRuleType.number:return[ee(l.CFNumberOperator.between,e),ee(l.CFNumberOperator.notBetween,e),ee(l.CFNumberOperator.equal,e),ee(l.CFNumberOperator.notEqual,e),ee(l.CFNumberOperator.greaterThan,e),ee(l.CFNumberOperator.greaterThanOrEqual,e),ee(l.CFNumberOperator.lessThan,e),ee(l.CFNumberOperator.lessThanOrEqual,e)];case l.CFSubRuleType.timePeriod:return[ee(l.CFTimePeriodOperator.yesterday,e),ee(l.CFTimePeriodOperator.today,e),ee(l.CFTimePeriodOperator.tomorrow,e),ee(l.CFTimePeriodOperator.last7Days,e),ee(l.CFTimePeriodOperator.lastWeek,e),ee(l.CFTimePeriodOperator.thisWeek,e),ee(l.CFTimePeriodOperator.nextWeek,e),ee(l.CFTimePeriodOperator.lastMonth,e),ee(l.CFTimePeriodOperator.thisMonth,e),ee(l.CFTimePeriodOperator.nextMonth,e)]}},kr=t=>{var x;const{interceptorManager:e,onChange:n}=t,r=d.useDependency(d.LocaleService),o=((x=t.rule)==null?void 0:x.type)===l.CFRuleType.highlightCell?t.rule:void 0,[i,a]=_.useState(()=>{const m=l.CFSubRuleType.text;return o&&o.subType||m}),c=[{value:l.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:l.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:l.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:l.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:l.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],s=_.useMemo(()=>zr(i,r),[i]),[u,f]=_.useState(()=>{const m=s?s[0].value:void 0;return o&&o.operator||m}),[p,h]=_.useState(()=>{var w;const m="";return o?(w=o.value)!=null?w:l.createDefaultValue(o.subType,o.operator):m}),[v,S]=_.useState({}),y=_.useMemo(()=>m=>{var T,w,E,P,$,z,q,C,M,A,Q,X,ue,ae,L;switch(m.subType||i){case l.CFSubRuleType.text:{if([l.CFTextOperator.beginsWith,l.CFTextOperator.endsWith,l.CFTextOperator.containsText,l.CFTextOperator.notContainsText,l.CFTextOperator.equal,l.CFTextOperator.notEqual].includes(u))return{type:l.CFRuleType.highlightCell,subType:(T=m.subType)!=null?T:i,operator:(w=m.operator)!=null?w:u,style:(E=m.style)!=null?E:v,value:(P=m.value)!=null?P:p};break}case l.CFSubRuleType.number:{if([l.CFNumberOperator.equal,l.CFNumberOperator.notEqual,l.CFNumberOperator.greaterThan,l.CFNumberOperator.greaterThanOrEqual,l.CFNumberOperator.lessThan,l.CFNumberOperator.lessThanOrEqual].includes(u))return{type:l.CFRuleType.highlightCell,subType:($=m.subType)!=null?$:i,operator:(z=m.operator)!=null?z:u,style:(q=m.style)!=null?q:v,value:(C=m.value)!=null?C:p};if([l.CFNumberOperator.between,l.CFNumberOperator.notBetween].includes(u))return{type:l.CFRuleType.highlightCell,subType:(M=m.subType)!=null?M:i,operator:(A=m.operator)!=null?A:u,style:(Q=m.style)!=null?Q:v,value:(X=m.value)!=null?X:p};break}}return{type:l.CFRuleType.highlightCell,subType:(ue=m.subType)!=null?ue:i,operator:(ae=m.operator)!=null?ae:u,style:(L=m.style)!=null?L:v}},[i,u,p,v]);_.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return y({})}}),[y,e]),_.useEffect(()=>{c.some(m=>m.value===i)||a(c[0].value)},[c]);const O=m=>{const T=m,w=zr(T,r),E=w&&w[0].value;a(T),f(E),E&&h(l.createDefaultValue(T,E)),n(y({subType:T,operator:E}))},R=m=>{const T=m;f(T),n(y({operator:T}))},I=m=>{h(m),n(y({value:m}))},b=_.useMemo(()=>`${i}_${u}_${Math.random()}`,[i,u]);return g.jsxs("div",{children:[g.jsx("div",{className:`${F.title} ${F.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),g.jsx(B.Select,{className:`${F.mTSm} ${N.width100}`,onChange:O,value:i,options:c}),(s==null?void 0:s.length)&&g.jsx(B.Select,{className:`${F.mTSm} ${N.width100}`,onChange:R,value:u||"",options:s}),g.jsx(_c,{value:p,interceptorManager:e,type:i,operator:u,rule:o,onChange:I},b),g.jsx("div",{className:`${N.cfPreviewWrap}`,children:g.jsx(dt,{rule:y({})})}),g.jsx(Rr,{style:o==null?void 0:o.style,className:`${F.mLXxs}`,onChange:m=>{S(m),n(y({style:m}))}})]})},Go=(t,e)=>(l.iconMap[t]||[])[Number(e)]||"",xc=t=>{var s;const e=d.useDependency(d.IUniverInstanceService),n=e.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=(s=e.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:s.getSheetId(),o=_.useMemo(()=>t.error?N.errorInput:"",[t.error]),i=_.useRef({}),[a,c]=_.useState(!1);return ve.useSidebarClick(u=>{var p;const f=(p=i.current)==null?void 0:p.handleOutClick;f&&f(u,()=>c(!1))}),g.jsx("div",{className:N.positionRelative,children:t.type!==l.CFValueType.formula?g.jsxs(g.Fragment,{children:[g.jsx(B.InputNumber,{className:o,value:Number(t.value)||0,onChange:u=>t.onChange(u!=null?u:0)}),t.error&&g.jsx("div",{className:N.errorText,children:t.error})]}):g.jsx("div",{style:{width:"100%"},children:g.jsx(xt.FormulaEditor,{initValue:String(t.value),unitId:n,subUnitId:r,isFocus:a,onChange:(u="")=>{const f=u||"";t.onChange(f)},onFocus:()=>c(!0),actions:i.current})})})},Hr=(t,e,n)=>({operator:l.CFNumberOperator.greaterThan,value:{type:l.CFValueType.num,value:(n.length-1-e)*10},iconType:t,iconId:String(e)}),Ec=_.forwardRef((t,e)=>{const n=d.useDependency(d.LocaleService),r=o=>{t.onClick(o)};return g.jsx("div",{ref:e,className:N.iconGroupList,children:l.iconGroup.map((o,i)=>g.jsxs("div",{className:N.group,children:[g.jsx("div",{className:N.title,children:n.t(o.title)}),g.jsx("div",{className:N.itemContent,children:o.group.map(a=>g.jsx("div",{className:N.itemWrap,onClick:()=>{r(a.name)},children:g.jsx("div",{className:N.item,children:a.list.map((c,s)=>g.jsx("img",{className:N.icon,src:c},s))})},a.name))})]},i))})}),Oc=t=>{const e=_.useMemo(()=>{const r=[];for(const o in l.iconMap){const i=l.iconMap[o],a=o;i.forEach((c,s)=>{r.push({iconType:a,base64:c,iconId:String(s)})})}return r},[]),n=r=>{t.onClick(r.iconType,r.iconId)};return g.jsxs("div",{className:N.iconItemListWrap,children:[g.jsxs("div",{className:N.none,onClick:()=>n({iconType:l.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[g.jsx(Ot,{className:N.icon}),g.jsx("span",{children:"无单元格图标"})]}),g.jsx("div",{className:N.iconItemList,children:e.map(r=>g.jsx("div",{className:N.item,children:g.jsx("img",{onClick:()=>n(r),className:`${N.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},Mc=t=>{const{onChange:e,configList:n,errorMap:r={}}=t,o=d.useDependency(d.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${l.CFNumberOperator.greaterThan}`),value:l.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${l.CFNumberOperator.greaterThanOrEqual}`),value:l.CFNumberOperator.greaterThanOrEqual}],a=[{label:o.t(`sheet.cf.valueType.${l.CFValueType.num}`),value:l.CFValueType.num},{label:o.t(`sheet.cf.valueType.${l.CFValueType.percent}`),value:l.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${l.CFValueType.percentile}`),value:l.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${l.CFValueType.formula}`),value:l.CFValueType.formula}],c=(p,h)=>{e([String(h),"value","value"],p)},s=(p,h)=>{e([String(h),"operator"],p);const v=l.createDefaultValue(l.CFSubRuleType.number,p);c(v,h)},u=(p,h)=>{e([String(h),"value","type"],p);const v=n[h],S=l.createDefaultValue(l.CFSubRuleType.number,v.operator);c(S,h)};return _.useMemo(()=>n.map((p,h)=>{const v=r[h],S=Go(p.iconType,p.iconId),y=h===n.length-1,O=h===0,R=n[h-1],I=(R==null?void 0:R.value.type)===l.CFValueType.formula?o.t("sheet.cf.valueType.formula"):R==null?void 0:R.value.value,b=(x,m)=>{const T={...p,iconId:m,iconType:x};e([String(h)],T)};return g.jsxs("div",{className:`${h?F.mTXl:F.mTSm}`,children:[g.jsxs("div",{className:`${F.label} ${N.flex}`,children:[g.jsxs("div",{className:`${N.width45}`,children:[o.t("sheet.cf.iconSet.icon"),h+1]}),g.jsx("div",{className:`${N.width45}`,children:g.jsxs(g.Fragment,{children:[!O&&!y&&o.t("sheet.cf.iconSet.rule"),!O&&!y&&g.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${l.getOppositeOperator(R.operator)}`),I,y?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),g.jsxs("div",{className:`${N.flex} ${F.mTSm}`,children:[g.jsx("div",{className:`${N.iconWrap} ${N.width45}`,children:g.jsx(B.Dropdown,{overlay:g.jsx(Oc,{onClick:b,iconId:p.iconId,iconType:p.iconType}),children:g.jsxs("div",{className:N.dropdownIcon,children:[S?g.jsx("img",{src:S,className:N.icon}):g.jsx(Ot,{className:N.icon}),g.jsx(rn,{})]})})}),y?g.jsxs("div",{className:`${N.width45} ${F.label}`,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),g.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${l.getOppositeOperator(R.operator)}`),I,y?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):g.jsx(B.Select,{className:`${F.mL0} ${N.width45} ${F.mR0}`,options:i,value:p.operator,onChange:x=>{s(x,h)}})]}),y?g.jsx("div",{}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:`${F.mTSm} ${F.label} ${N.flex}`,children:[g.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.type")}),g.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.value")})]}),g.jsxs("div",{className:`${F.mTSm} ${N.flex}`,children:[g.jsx(B.Select,{style:{flexShrink:0},className:`${N.width45} ${F.mL0}`,options:a,value:p.value.type,onChange:x=>{u(x,h)}}),g.jsx("div",{className:`${F.mL0} ${N.width45}`,children:g.jsx(xc,{id:h,type:p.value.type,error:v,value:p.value.value||"",onChange:x=>c(x,h)})})]})]})]},h)}),[n,r])},Fc=t=>{var x;const{interceptorManager:e}=t,n=((x=t.rule)==null?void 0:x.type)===l.CFRuleType.iconSet?t.rule:void 0,r=d.useDependency(d.LocaleService),[o,i]=_.useState({}),[a,c]=_.useState(()=>{const m=Object.keys(l.iconMap)[0];if(n&&n.config.length){const T=n.config[0].iconType;if(!n.config.some(E=>E.iconType!==T))return T}return m}),[s,u]=_.useState(()=>{if(n&&n.config.length)return d.Tools.deepClone(n==null?void 0:n.config);const m=l.iconMap[a]||[];return new Array(m.length).fill("").map((T,w,E)=>w===E.length-1?{operator:l.CFNumberOperator.lessThanOrEqual,value:{type:l.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:a,iconId:String(w)}:Hr(a,w,E))}),[f,p]=_.useState(()=>n?!!n.isShowValue:!0),h=_.useMemo(()=>{const m=s.map(T=>Go(T.iconType,T.iconId));return g.jsx("div",{className:N.iconWrap,children:m.map((T,w)=>T?g.jsx("img",{className:N.icon,src:T},w):g.jsx(Ot,{className:N.icon},w))})},[s]),v=m=>{if(m.reduce((w,E,P)=>w.preType&&!w.result||m.length-1===P?w:E.value.type===l.CFValueType.formula?{preType:l.CFValueType.formula,result:!1}:w.preType?{result:w.preType===E.value.type,preType:E.value.type}:{result:!0,preType:E.value.type},{result:!0,preType:""}).result&&[l.CFValueType.num,l.CFValueType.percent,l.CFValueType.percentile].includes(m[0].value.type)){const w={};return m.forEach((E,P,$)=>{if(P-1<0||P===$.length-1)return;const q=m[P-1],C=l.getOppositeOperator(q.operator);l.compareWithNumber({operator:C,value:q.value.value},E.value.value)||(w[P]=`${r.t(`sheet.cf.form.${C}`,String(q.value.value))} `)}),w}return{}},S=(m,T)=>{d.get(s,m)!==T&&(d.set(s,m,T),u([...s]),i(v(s)))},y=m=>{c(m);const T=l.iconMap[m]||[],w=new Array(T.length).fill("").map((E,P,$)=>Hr(m,P,$));u(w),i(v(w))};_.useEffect(()=>{const m=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:l.CFRuleType.iconSet,isShowValue:f,config:s}}});return()=>{m()}},[f,s,e]),_.useEffect(()=>{const m=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{m()}},[f,s,e,o]);const O=()=>{const m=s.map(T=>({...T}));s.forEach((T,w)=>{const E=s.length-1-w,P=m[E];T.iconId=P.iconId,T.iconType=P.iconType}),u([...s])},R=d.useDependency(ve.ILayoutService),[I,b]=_.useState();return ve.useScrollYOverContainer(I,R.rootContainerElement),g.jsxs("div",{className:N.iconSet,children:[g.jsx("div",{className:F.title,children:r.t("sheet.cf.panel.styleRule")}),g.jsx("div",{className:`${F.mTSm}`,children:g.jsx(B.Dropdown,{placement:"bottomLeft",overlay:g.jsx(Ec,{ref:m=>!I&&m&&b(m),iconType:a,onClick:y}),children:g.jsxs("div",{className:N.dropdownIcon,style:{width:"unset"},children:[h,g.jsx(rn,{})]})})}),g.jsxs("div",{className:`${F.mTSm} ${N.renderConfig}`,children:[g.jsxs("div",{className:N.utilItem,children:[g.jsx(B.Checkbox,{onChange:O}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),g.jsxs("div",{className:`${N.utilItem} ${F.mLXl}`,children:[g.jsx(B.Checkbox,{checked:!f,onChange:m=>{p(!m)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),g.jsx(Mc,{errorMap:o,onChange:S,configList:s})]})},Pc=t=>{var O;const{onChange:e,interceptorManager:n}=t,r=d.useDependency(d.LocaleService),o=((O=t.rule)==null?void 0:O.type)===l.CFRuleType.highlightCell?t.rule:void 0,i=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[a,c]=_.useState(()=>{const R=i[0].value,I=o==null?void 0:o.type;if(!o)return R;switch(I){case l.CFRuleType.highlightCell:switch(o.subType){case l.CFSubRuleType.average:return[l.CFNumberOperator.greaterThan,l.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[l.CFNumberOperator.lessThan,l.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":R;case l.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return R}),[s,u]=_.useState(()=>{const I=o==null?void 0:o.type;if(!o)return 10;switch(I){case l.CFRuleType.highlightCell:switch(o.subType){case l.CFSubRuleType.rank:return o.value||10}}return 10}),[f,p]=_.useState(()=>{const I=o==null?void 0:o.type;if(!o)return!1;switch(I){case l.CFRuleType.highlightCell:switch(o.subType){case l.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[h,v]=_.useState({}),S=R=>{const{type:I,isPercent:b,value:x,style:m}=R;if(I==="isNotBottom")return{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.rank,isPercent:b,isBottom:!1,value:x,style:m};if(I==="isBottom")return{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.rank,isPercent:b,isBottom:!0,value:x,style:m};if(I==="greaterThanAverage")return{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.average,operator:l.CFNumberOperator.greaterThan,style:m};if(I==="lessThanAverage")return{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.average,operator:l.CFNumberOperator.lessThan,style:m}};_.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return S({type:a,isPercent:f,value:s,style:h})}}),[a,f,s,h,n]);const y=R=>{e(S(R))};return g.jsxs("div",{children:[g.jsx("div",{className:`${F.title} ${F.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),g.jsx(B.Select,{className:`${N.width100} ${F.mTSm}`,value:a,options:i,onChange:R=>{c(R),y({type:R,isPercent:f,value:s,style:h})}}),["isNotBottom","isBottom"].includes(a)&&g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm}`,children:[g.jsx(B.InputNumber,{min:1,max:1e3,value:s,onChange:R=>{const I=R||0;u(I),y({type:a,isPercent:f,value:I,style:h})}}),g.jsxs("div",{className:`${F.mLSm} ${F.labelContainer} ${N.text}`,children:[g.jsx(B.Checkbox,{checked:f,onChange:R=>{p(!!R),y({type:a,isPercent:!!R,value:s,style:h})}}),r.t("sheet.cf.valueType.percent")]})]}),g.jsx("div",{className:`${N.cfPreviewWrap} `,children:g.jsx(dt,{rule:S({type:a,isPercent:f,value:s,style:h})})}),g.jsx(Rr,{style:o==null?void 0:o.style,className:`${F.mTSm} `,onChange:R=>{v(R),y({type:a,isPercent:f,value:s,style:R})}})]})},Dc=d.createInterceptorKey("beforeSubmit"),Nc=d.createInterceptorKey("submit"),Wr=t=>t.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),qr=t=>{var e;return(e=t.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},jc=t=>{var $,z,q;const e=d.useDependency(d.LocaleService),n=d.useDependency(d.ICommandService),r=d.useDependency(d.IUniverInstanceService),o=d.useDependency(l.ConditionalFormattingRuleModel),i=d.useDependency(j.SheetsSelectionsService),a=Wr(r),c=qr(r),[s,u]=_.useState(!0),f=_.useRef({}),[p,h]=_.useState(void 0),v=_.useRef((z=($=t.rule)==null?void 0:$.ranges)!=null?z:[]),S=_.useMemo(()=>{var M,A,Q;let C=(M=t.rule)==null?void 0:M.ranges;return C!=null&&C.length||(C=(Q=(A=i.getCurrentSelections())==null?void 0:A.map(X=>X.range))!=null?Q:[]),v.current=C,C!=null&&C.length?C.map(X=>{const ue=Fn.serializeRange(X);return ue==="NaN"?"":ue}).filter(X=>!!X).join(","):""},[t.rule]),y=[{label:e.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:e.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:e.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:e.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:e.t("sheet.cf.ruleType.formula"),value:"5"},{label:e.t("sheet.cf.ruleType.iconSet"),value:"6"}],[O,R]=_.useState(()=>{var A,Q;const C=(A=t.rule)==null?void 0:A.rule.type,M=y[0].value;if(!C)return M;switch(C){case l.CFRuleType.highlightCell:{switch((Q=t.rule)==null?void 0:Q.rule.subType){case l.CFSubRuleType.number:case l.CFSubRuleType.text:case l.CFSubRuleType.duplicateValues:case l.CFSubRuleType.uniqueValues:case l.CFSubRuleType.timePeriod:return"1";case l.CFSubRuleType.average:case l.CFSubRuleType.rank:return"2";case l.CFSubRuleType.formula:return"5"}break}case l.CFRuleType.dataBar:return"3";case l.CFRuleType.colorScale:return"4";case l.CFRuleType.iconSet:return"6"}return M}),I=_.useRef(),b=_.useMemo(()=>new d.InterceptorManager({beforeSubmit:Dc,submit:Nc}),[]),x=_.useMemo(()=>{switch(O){case"1":return kr;case"2":return Pc;case"3":return bc;case"4":return Sc;case"5":return Ic;case"6":return Fc;default:return kr}},[O]);_.useEffect(()=>{const C=n.onCommandExecuted(M=>{if(M.id===j.RemoveSheetMutation.id){const A=M.params;A.subUnitId===c&&A.unitId===a&&t.onCancel()}M.id===j.SetWorksheetActiveOperation.id&&t.onCancel()});return()=>C.dispose()},[]);const m=C=>{I.current=C},T=C=>{const M=C.split(",").filter(A=>!!A).map(Fn.deserializeRangeWithSheet).map(A=>A.range);v.current=M},w=()=>{if(p)return;const M=(()=>{const Q=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!Q)throw new Error("No active sheet found");return v.current.map(ae=>j.setEndForRange(ae,Q.getRowCount(),Q.getColumnCount())).filter(ae=>!(Number.isNaN(ae.startRow)||Number.isNaN(ae.startColumn)))})();if(b.fetchThroughInterceptors(b.getInterceptPoints().beforeSubmit)(!0,null)){const Q=b.fetchThroughInterceptors(b.getInterceptPoints().submit)(null,null);if(Q){const X=Wr(r),ue=qr(r);if(!X||!ue)throw new Error("No active sheet found");let ae={};t.rule&&t.rule.cfId?(ae={...t.rule,ranges:M,rule:Q},n.executeCommand(yn.id,{unitId:X,subUnitId:ue,rule:ae}),t.onCancel()):(ae={cfId:o.createCfId(X,ue),ranges:M,rule:Q,stopIfTrue:!1},n.executeCommand(Dt.id,{unitId:X,subUnitId:ue,rule:ae}),t.onCancel())}}},E=()=>{t.onCancel()},P=(C,M)=>{C?M.length<1?h(e.t("sheet.cf.errorMessage.rangeError")):h(void 0):h(e.t("sheet.cf.errorMessage.rangeError"))};return ve.useSidebarClick(C=>{var A;const M=(A=f.current)==null?void 0:A.handleOutClick;M&&M(C,()=>u(!1))}),g.jsxs("div",{className:N.cfRuleStyleEditor,children:[g.jsx("div",{className:F.title,children:e.t("sheet.cf.panel.range")}),g.jsx("div",{className:`${F.mTBase}`,children:g.jsx(xt.RangeSelector,{unitId:a,errorText:p,subUnitId:c,initValue:S,onChange:T,onVerify:P,onFocus:()=>u(!0),isFocus:s,actions:f.current})}),g.jsx("div",{className:F.title,children:e.t("sheet.cf.panel.styleType")}),g.jsx("div",{className:F.mTBase,children:g.jsx(B.Select,{className:N.width100,value:O,options:y,onChange:C=>R(C)})}),g.jsx(x,{interceptorManager:b,rule:(q=t.rule)==null?void 0:q.rule,onChange:m}),g.jsxs("div",{className:`${F.mTBase} ${N.btnList}`,children:[g.jsx(B.Button,{size:"small",onClick:E,children:e.t("sheet.cf.panel.cancel")}),g.jsx(B.Button,{className:F.mLSm,size:"small",type:"primary",onClick:w,children:e.t("sheet.cf.panel.submit")})]})]})},$c=t=>{const[e,n]=_.useState(t.rule),[r,o]=_.useState(!!t.rule),i=()=>{o(!0)},a=()=>{o(!1),n(void 0)},c=s=>{n(s),o(!0)};return g.jsx("div",{className:F.conditionalFormattingWrap,children:r?g.jsx(jc,{onCancel:a,rule:e}):g.jsx(Wl,{onClick:c,onCreate:i})})};var Lc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,Vc=(t,e,n,r)=>{for(var o=r>1?void 0:r?Uc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Lc(e,n,o),o},ht=(t,e)=>(n,r)=>e(n,r,t);const Wt="sheet.conditional.formatting.panel";let Rt=class extends d.Disposable{constructor(e,n,r,o,i){super();Ae(this,"_sidebarDisposable",null);this._univerInstanceService=e,this._injector=n,this._componentManager=r,this._sidebarService=o,this._localeService=i,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(d.UniverInstanceType.UNIVER_SHEET).subscribe(a=>{var c;a||(c=this._sidebarDisposable)==null||c.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(a=>{a.id===Wt&&(a.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const n={id:Wt,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Wt,rule:e,key:d.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initPanel(){this._componentManager.register(Wt,$c)}};Rt=Vc([ht(0,d.IUniverInstanceService),ht(1,d.Inject(d.Injector)),ht(2,d.Inject(ve.ComponentManager)),ht(3,d.Inject(ve.ISidebarService)),ht(4,d.Inject(d.LocaleService))],Rt);var Te=(t=>(t[t.createRule=1]="createRule",t[t.viewRule=2]="viewRule",t[t.highlightCell=3]="highlightCell",t[t.rank=4]="rank",t[t.formula=5]="formula",t[t.colorScale=6]="colorScale",t[t.dataBar=7]="dataBar",t[t.icon=8]="icon",t[t.clearRangeRules=9]="clearRangeRules",t[t.clearWorkSheetRules=10]="clearWorkSheetRules",t))(Te||{});const Nt={id:"sheet.operation.open.conditional.formatting.panel",type:d.CommandType.OPERATION,handler:(t,e)=>{var c;const n=t.get(Rt),r=t.get(j.SheetsSelectionsService),o=t.get(d.ICommandService),i=((c=r.getCurrentSelections())==null?void 0:c.map(s=>s.range))||[];switch(e.value){case 3:{n.openPanel({...l.createDefaultRule(),ranges:i});break}case 4:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.rank}};n.openPanel(s);break}case 5:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.formula,value:"="}};n.openPanel(s);break}case 6:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.colorScale,config:[]}};n.openPanel(s);break}case 7:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(s);break}case 8:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(s);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...l.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(tn.id,{ranges:i});break}case 10:{o.executeCommand(Et.id);break}}return!0}};var Ac=Object.defineProperty,zc=Object.getOwnPropertyDescriptor,kc=(t,e,n,r)=>{for(var o=r>1?void 0:r?zc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Ac(e,n,o),o},ot=(t,e)=>(n,r)=>e(n,r,t);let Tt=class extends d.Disposable{constructor(e,n,r,o,i,a){super();Ae(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=n,this._univerInstanceService=r,this._renderManagerService=o,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=a,this._initViewModelInterceptor(),this._initViewModel(),this._initSkeleton(),this._initVmEffectByRule(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}markDirtySkeleton(){var n,r,o;const e=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId();(n=this._renderManagerService.getRenderById(e))==null||n.with(oe.SheetSkeletonManagerService).reCalculate(),(o=(r=this._renderManagerService.getRenderById(e))==null?void 0:r.mainComponent)==null||o.makeDirty()}_initSkeleton(){this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(He.bufferTime(16),He.filter(e=>{const n=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?e.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this.markDirtySkeleton())),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(He.bufferTime(16),He.filter(e=>{const n=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?e.filter(o=>["sort","delete"].includes(o.type)&&o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this.markDirtySkeleton())),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(He.bufferTime(16),He.filter(e=>{const n=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?e.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this.markDirtySkeleton()))}_initVmEffectByRule(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{const{rule:n,unitId:r,subUnitId:o}=e;switch(e.type){case"add":{this._handleRuleAdd(r,o,n);return}case"delete":{n.ranges.forEach(i=>{d.Range.foreach(i,(a,c)=>{this._conditionalFormattingViewModel.deleteCellCf(r,o,a,c,n.cfId)})}),this._conditionalFormattingViewModel.markRuleDirty(r,o,n);return}case"set":{this._handleRuleChange(r,o,n,e.oldRule);return}case"sort":{const a=this._conditionalFormattingRuleModel.getSubunitRules(r,o).map(c=>c.cfId).reduce((c,s,u)=>(c.set(s,u),c),new Map);n.ranges.forEach(c=>{d.Range.foreach(c,(s,u)=>{this._conditionalFormattingViewModel.sortCellCf(r,o,s,u,a)})})}}}))}_initViewModel(){let e=!1;this._univerInstanceService.getAllUnitsForType(d.UniverInstanceType.UNIVER_SHEET).forEach(r=>{const o=r.getUnitId(),i=this._conditionalFormattingRuleModel.getUnitRules(o);i&&[...i.keys()].forEach(a=>{i.get(a).forEach(s=>{this._handleRuleAdd(o,a,s),e=!0})})}),e&&this.markDirtySkeleton()}_handleRuleAdd(e,n,r){const i=this._conditionalFormattingRuleModel.getSubunitRules(e,n).map(a=>a.cfId).reduce((a,c,s)=>(a.set(c,s),a),new Map);r.ranges.forEach(a=>{d.Range.foreach(a,(c,s)=>{this._conditionalFormattingViewModel.pushCellCf(e,n,c,s,r.cfId),this._conditionalFormattingViewModel.sortCellCf(e,n,c,s,i)})}),this._conditionalFormattingViewModel.markRuleDirty(e,n,r)}_handleRuleChange(e,n,r,o){const a=this._conditionalFormattingRuleModel.getSubunitRules(e,n).map(u=>u.cfId).reduce((u,f,p)=>(u.set(f,p),u),new Map),c=(u,f)=>{u.ranges.forEach(p=>{d.Range.foreach(p,(h,v)=>{this._conditionalFormattingViewModel.deleteCellCf(e,n,h,v,u.cfId)})}),f.ranges.forEach(p=>{d.Range.foreach(p,(h,v)=>{this._conditionalFormattingViewModel.pushCellCf(e,n,h,v,u.cfId),this._conditionalFormattingViewModel.sortCellCf(e,n,h,v,a)})})},s=this._conditionalFormattingService.interceptorManager.intercept(this._conditionalFormattingService.interceptorManager.getInterceptPoints().beforeUpdateRuleResult,{handler:(u,f,p)=>{if(e===(u==null?void 0:u.unitId)&&n===u.subUnitId&&o.cfId===u.cfId){(this._ruleChangeCacheMap.get(u.cfId)||[]).forEach(v=>{c(v.oldRule,v.rule),v.dispose()}),this._ruleChangeCacheMap.delete(u.cfId);return}p(u)}});if(o.cfId===r.cfId){let u=this._ruleChangeCacheMap.get(o.cfId);u||(u=[],this._ruleChangeCacheMap.set(o.cfId,u)),u.push({oldRule:o,rule:r,dispose:s})}r.ranges.forEach(u=>{d.Range.foreach(u,(f,p)=>{this._conditionalFormattingViewModel.pushCellCf(e,n,f,p,o.cfId)})}),this._conditionalFormattingViewModel.markRuleDirty(e,n,r)}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(j.INTERCEPTOR_POINT.CELL_CONTENT,{effect:d.InterceptorEffectEnum.Style,handler:(e,n,r)=>{const o=this._conditionalFormattingService.composeStyle(n.unitId,n.subUnitId,n.row,n.col);if(!o)return r(e);const i=n.workbook.getStyles(),c={...(typeof(e==null?void 0:e.s)=="string"?i.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},s={...e,s:c};return o.style&&Object.assign(c,o.style),s.fontRenderExtension||(s.fontRenderExtension={},o.isShowValue!==void 0&&(s.fontRenderExtension.isSkip=!o.isShowValue)),o.dataBar&&(s.dataBar=o.dataBar),o.iconSet&&(s.iconSet=o.iconSet,s.fontRenderExtension.leftOffset=l.DEFAULT_PADDING+l.DEFAULT_WIDTH),r(s)},priority:10}))}};Tt=kc([ot(0,d.Inject(j.SheetInterceptorService)),ot(1,d.Inject(l.ConditionalFormattingService)),ot(2,d.Inject(d.IUniverInstanceService)),ot(3,d.Inject(ni.IRenderManagerService)),ot(4,d.Inject(l.ConditionalFormattingViewModel)),ot(5,d.Inject(l.ConditionalFormattingRuleModel))],Tt);var Hc=Object.defineProperty,Wc=Object.getOwnPropertyDescriptor,qc=(t,e,n,r)=>{for(var o=r>1?void 0:r?Wc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Hc(e,n,o),o},mt=(t,e)=>(n,r)=>e(n,r,t);let wt=class extends d.Disposable{constructor(e,n,r,o,i){super();Ae(this,"_copyInfo");this._sheetClipboardService=e,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=o,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:l.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,n,r)=>this._collectConditionalRule(e,n,r),onPasteCells:(e,n,r,o)=>{const{copyType:i=oe.COPY_TYPE.COPY,pasteType:a}=o,{range:c}=e||{},{range:s}=n;return this._generateConditionalFormattingMutations(s,{copyType:i,pasteType:a,copyRange:c})}}))}_collectConditionalRule(e,n,r){const o=new d.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:e,subUnitId:n,cfMap:i}};const a=this._conditionalFormattingViewModel.getMatrix(e,n);if(!a)return;const c=this._injector.invoke(p=>oe.rangeToDiscreteRange(r,p,e,n));if(!c)return;const{rows:s,cols:u}=c,f=new Set;s.forEach((p,h)=>{u.forEach((v,S)=>{const y=this._conditionalFormattingViewModel.getCellCf(e,n,p,v,a);y&&(y.cfList.forEach(O=>f.add(O.cfId)),o.setValue(h,S,y.cfList.map(O=>O.cfId)))})}),f.forEach(p=>{const h=this._conditionalFormattingRuleModel.getRule(e,n,p);h&&(i[p]=h.rule)})}_generateConditionalFormattingMutations(e,n){const r=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),o=r.getActiveSheet(),i=r.getUnitId();if(!o)return{redos:[],undos:[]};const a=o.getSheetId();if(n.copyType===oe.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![oe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,oe.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,oe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[c,s],mapFunc:u}=oe.virtualizeDiscreteRanges([n.copyRange,e]),f=oe.getRepeatRange(c,s,!0),p=this._conditionalFormattingViewModel.getMatrix(i,a),h={};d.Range.foreach(s,(m,T)=>{const{row:w,col:E}=u(m,T),P=this._conditionalFormattingViewModel.getCellCf(i,a,w,E,p);P&&P.cfList.forEach($=>{if(!h[$.cfId]){const z=new d.ObjectMatrix;h[$.cfId]=z;const q=this._conditionalFormattingRuleModel.getRule(i,a,$.cfId);q==null||q.ranges.forEach(C=>{d.Range.foreach(C,(M,A)=>{z.setValue(M,A,1)})})}h[$.cfId].realDeleteValue(w,E)})});const{matrix:v,info:S}=this._copyInfo,y=[];let O=this._conditionalFormattingRuleModel.createCfId(i,a);const R={},I=m=>{if(R[m])return R[m];const T=S==null?void 0:S.cfMap[m],w=[...this._conditionalFormattingRuleModel.getSubunitRules(i,a)||[],...y].find(E=>d.Tools.diffValue(E.rule,T));if(w)return R[m]=w,w;{const E={rule:T,cfId:O,ranges:[],stopIfTrue:!1};return R[m]=E,y.push(E),O=`${Number(O)+1}`,E}};f.forEach(m=>{v&&v.forValue((T,w,E)=>{const P=d.Rectangle.getPositionRange({startRow:T,endRow:T,startColumn:w,endColumn:w},m.startRange),{row:$,col:z}=u(P.startRow,P.startColumn);E.forEach(q=>{if(!h[q]){const C=I(q),M=new d.ObjectMatrix;h[q]=M,C.ranges.forEach(A=>{d.Range.foreach(A,(Q,X)=>{M.setValue(Q,X,1)})})}h[q].setValue($,z,1)})})});const b=[],x=[];for(const m in h){const T=h[m],w=j.findAllRectangle(j.createTopMatrixFromMatrix(T));if(!w.length){const E={unitId:i,subUnitId:a,cfId:m};b.push({id:l.DeleteConditionalRuleMutation.id,params:E}),x.push(...l.DeleteConditionalRuleMutationUndoFactory(this._injector,E))}if(y.some(E=>E.cfId===m)){const E=I(m),P={unitId:i,subUnitId:a,rule:{...E,ranges:w}};b.push({id:l.AddConditionalRuleMutation.id,params:P}),x.push(l.AddConditionalRuleMutationUndoFactory(this._injector,P))}else{const E=this._conditionalFormattingRuleModel.getRule(i,a,m);if(!E)continue;const P={unitId:i,subUnitId:a,rule:{...E,ranges:w}};b.push({id:l.SetConditionalRuleMutation.id,params:P}),x.push(...l.setConditionalRuleMutationUndoFactory(this._injector,P))}}return{redos:b,undos:x}}};wt=qc([mt(0,d.Inject(oe.ISheetClipboardService)),mt(1,d.Inject(l.ConditionalFormattingRuleModel)),mt(2,d.Inject(d.Injector)),mt(3,d.Inject(l.ConditionalFormattingViewModel)),mt(4,d.Inject(d.IUniverInstanceService))],wt);var Bc=Object.defineProperty,Gc=Object.getOwnPropertyDescriptor,Xc=(t,e,n,r)=>{for(var o=r>1?void 0:r?Gc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Bc(e,n,o),o},qt=(t,e)=>(n,r)=>e(n,r,t);let It=class extends d.Disposable{constructor(t,e,n,r){super(),this._conditionalFormattingRuleModel=t,this._univerInstanceService=e,this._injector=n,this._refRangeService=r,this._initRefRange()}_initRefRange(){const t=new Map,e=(r,o,i)=>`${r}_${o}_${i}`,n=(r,o,i)=>{const a=s=>{const u=[...i.ranges],f=u.map(h=>j.handleDefaultRangeChangeWithEffectRefCommands(h,s)).filter(h=>!!h);if(l.isRangesEqual(f,u))return{redos:[],undos:[]};if(f.length){const h={unitId:r,subUnitId:o,rule:{...i,ranges:f}},v=[{id:l.SetConditionalRuleMutation.id,params:h}],S=l.setConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:S}}else{const h={unitId:r,subUnitId:o,cfId:i.cfId},v=[{id:l.DeleteConditionalRuleMutation.id,params:h}],S=l.DeleteConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:S}}},c=[];i.ranges.forEach(s=>{const u=this._refRangeService.registerRefRange(s,a);c.push(()=>u.dispose())}),t.set(e(r,o,i.cfId),()=>c.forEach(s=>s()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:o,subUnitId:i,rule:a}=r,c=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),s=c.getActiveSheet();if(!(r.unitId!==c.getUnitId()||r.subUnitId!==(s==null?void 0:s.getSheetId())))switch(r.type){case"add":{n(r.unitId,r.subUnitId,r.rule);break}case"delete":{const u=t.get(e(o,i,a.cfId));u&&u();break}case"set":{const u=t.get(e(o,i,a.cfId));u&&u(),n(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(d.toDisposable(()=>{t.forEach(r=>{r()}),t.clear()}))}};It=Xc([qt(0,d.Inject(l.ConditionalFormattingRuleModel)),qt(1,d.Inject(d.IUniverInstanceService)),qt(2,d.Inject(d.Injector)),qt(3,d.Inject(j.RefRangeService))],It);var Yc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,Zc=(t,e,n,r)=>{for(var o=r>1?void 0:r?Kc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Yc(e,n,o),o},En=(t,e)=>(n,r)=>e(n,r,t);let _t=class extends d.Disposable{constructor(t,e,n){super(),this._localeService=t,this._commandService=e,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===Dt.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[j.WorkbookEditablePermission],rangeTypes:[j.RangeProtectionPermissionEditPoint],worksheetTypes:[j.WorksheetEditPermission,j.WorksheetSetCellStylePermission]},t.params.rule.ranges)||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")))}))}};_t=Zc([En(0,d.Inject(d.LocaleService)),En(1,d.ICommandService),En(2,d.Inject(oe.SheetPermissionInterceptorBaseController))],_t);const Xo="sheets-conditional-formatting-ui.config",Yo={};var Ko=Object.defineProperty,Jc=Object.getOwnPropertyDescriptor,Qc=(t,e,n)=>e in t?Ko(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,eu=(t,e,n,r)=>{for(var o=r>1?void 0:r?Jc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Ko(e,n,o),o},On=(t,e)=>(n,r)=>e(n,r,t),Zo=(t,e,n)=>Qc(t,typeof e!="symbol"?e+"":e,n);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends d.Plugin{constructor(e=Yo,n,r,o){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=o;const{menu:i,...a}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Xo,a),this._initCommand(),this._injector.add([Tt]),this._injector.add([It]),this._injector.add([wt]),this._injector.add([_t]),this._injector.add([ct])}_initCommand(){[Wn,qn,Bn,Gn,Xn,Yn,Kn,Zn,Jn,Nt,bt,yn,vn,Dt,tn,Et].forEach(e=>{this._commandService.registerCommand(e)})}};Zo(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${l.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Zo(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",d.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=eu([d.DependentOn(l.UniverSheetsConditionalFormattingPlugin),On(1,d.Inject(d.Injector)),On(2,d.Inject(d.ICommandService)),On(3,d.IConfigService)],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var tu=Object.defineProperty,nu=Object.getOwnPropertyDescriptor,ru=(t,e,n,r)=>{for(var o=r>1?void 0:r?nu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&tu(e,n,o),o},gt=(t,e)=>(n,r)=>e(n,r,t);let Zt=class extends d.Disposable{constructor(t,e,n,r,o){super(),this._injector=t,this._univerInstanceService=e,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),e=(o,i,a,c,s)=>{var v;const u=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),f=(v=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:v.getSheetId();if(!u||!f)return;const p={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},h={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};d.Range.foreach(a,(S,y)=>{const O=d.Rectangle.getPositionRange({startRow:S,startColumn:y,endColumn:y,endRow:S},p),R=d.Rectangle.getPositionRange({startRow:S,startColumn:y,endColumn:y,endRow:S},h),{row:I,col:b}=s(O.startRow,O.startColumn),x=this._conditionalFormattingViewModel.getCellCf(u,f,I,b),{row:m,col:T}=s(R.startRow,R.startColumn),w=this._conditionalFormattingViewModel.getCellCf(u,f,m,T);w&&w.cfList.forEach(E=>{let P=c.get(E.cfId);if(!c.get(E.cfId)){const $=this._conditionalFormattingRuleModel.getRule(u,f,E.cfId);if(!$)return;P=new d.ObjectMatrix,$.ranges.forEach(z=>{d.Range.foreach(z,(q,C)=>{P.setValue(q,C,1)})}),c.set(E.cfId,P)}P.realDeleteValue(m,T)}),x&&x.cfList.forEach(E=>{let P=c.get(E.cfId);if(!c.get(E.cfId)){const $=this._conditionalFormattingRuleModel.getRule(u,f,E.cfId);if(!$)return;P=new d.ObjectMatrix,$.ranges.forEach(z=>{d.Range.foreach(z,(q,C)=>{P.setValue(q,C,1)})}),c.set(E.cfId,P)}P.setValue(m,T,1)})})},n=(o,i)=>{var R,I,b;const a=(R=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:R.getUnitId(),c=(b=(I=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getActiveSheet())==null?void 0:b.getSheetId(),s=new Map,u=[],f=[];if(!a||!c)return t();const p=oe.virtualizeDiscreteRanges([o,i]),[h,v]=p.ranges,{mapFunc:S}=p,y={row:h.startRow,col:h.startColumn};return oe.getAutoFillRepeatRange(h,v).forEach(x=>{e(y,x.repeatStartCell,x.relativeRange,s,S)}),s.forEach((x,m)=>{const T=this._conditionalFormattingRuleModel.getRule(a,c,m);if(!T)return;const w=j.findAllRectangle(j.createTopMatrixFromMatrix(x));if(w.length){const E={unitId:a,subUnitId:c,rule:{...T,ranges:w}};u.push({id:l.SetConditionalRuleMutation.id,params:E}),f.push(...l.setConditionalRuleMutationUndoFactory(this._injector,E))}else{const E={unitId:a,subUnitId:c,cfId:T.cfId};u.push({id:l.DeleteConditionalRuleMutation.id,params:E}),f.push(...l.DeleteConditionalRuleMutationUndoFactory(this._injector,E))}}),{undos:f,redos:u}},r={id:l.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,a)=>{if(a===oe.APPLY_TYPE.COPY||a===oe.APPLY_TYPE.ONLY_FORMAT||a===oe.APPLY_TYPE.SERIES){const{source:c,target:s}=o;return n(c,s)}return t()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Zt=ru([gt(0,d.Inject(d.Injector)),gt(1,d.Inject(d.IUniverInstanceService)),gt(2,d.Inject(oe.IAutoFillService)),gt(3,d.Inject(l.ConditionalFormattingRuleModel)),gt(4,d.Inject(l.ConditionalFormattingViewModel))],Zt);var ou=Object.defineProperty,iu=Object.getOwnPropertyDescriptor,au=(t,e,n,r)=>{for(var o=r>1?void 0:r?iu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&ou(e,n,o),o},vt=(t,e)=>(n,r)=>e(n,r,t);exports.ConditionalFormattingClearController=class extends d.Disposable{constructor(e,n,r,o,i){super(),this._injector=e,this._univerInstanceService=n,this._sheetInterceptorService=r,this._selectionManagerService=o,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var i;const n=[],r=[],o={redos:n,undos:r};if([j.ClearSelectionFormatCommand.id,j.ClearSelectionAllCommand.id].includes(e.id)){const a=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(S=>S.range);if(!a)return o;const c=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),s=c.getActiveSheet();if(!s)return o;const u=c.getUnitId(),f=s.getSheetId(),p=this._conditionalFormattingRuleModel.getSubunitRules(u,f);if(!p||!p.length)return o;const{redos:h,undos:v}=Br(this._injector,p,a,u,f);n.push(...h),r.push(...v)}return o}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:n,ranges:r})=>{const o=[],i=[],a={redos:o,undos:i};if(!r||!r.length)return a;const c=this._conditionalFormattingRuleModel.getSubunitRules(e,n);if(!c||!c.length)return a;const{redos:s,undos:u}=Br(this._injector,c,r,e,n);return o.push(...s),i.push(...u),a}}))}};exports.ConditionalFormattingClearController=au([vt(0,d.Inject(d.Injector)),vt(1,d.Inject(d.IUniverInstanceService)),vt(2,d.Inject(j.SheetInterceptorService)),vt(3,d.Inject(j.SheetsSelectionsService)),vt(4,d.Inject(l.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);function Br(t,e,n,r,o){const i=[],a=[];return e.filter(c=>n.some(s=>c.ranges.some(u=>d.Rectangle.getIntersects(u,s)))).forEach(c=>{const u=new j.RangeMergeUtil().add(...c.ranges).subtract(...n).merge();if(u.length){const f={id:l.SetConditionalRuleMutation.id,params:{unitId:r,subUnitId:o,rule:{...c,ranges:u}}},p=l.setConditionalRuleMutationUndoFactory(t,f.params);i.push(f),a.push(...p)}else{const f={id:l.DeleteConditionalRuleMutation.id,params:{unitId:r,subUnitId:o,cfId:c.cfId}},p=l.DeleteConditionalRuleMutationUndoFactory(t,f.params);i.push(f),a.push(...p)}}),{redos:i,undos:a}}var su=Object.defineProperty,lu=Object.getOwnPropertyDescriptor,cu=(t,e,n,r)=>{for(var o=r>1?void 0:r?lu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&su(e,n,o),o},Gr=(t,e)=>(n,r)=>e(n,r,t);let Jt=class extends d.Disposable{constructor(t,e){super(),this._sheetInterceptorService=t,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(d.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(j.AFTER_CELL_EDIT,{handler:(t,e,n)=>{var o,i;const r=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col);if(r!=null&&r.style&&(t!=null&&t.p)){const a=Object.keys(r==null?void 0:r.style);if(a.length>0){const c=d.BuildTextUtils.transform.getPlainText((i=(o=t.p.body)==null?void 0:o.dataStream)!=null?i:""),s={...(typeof t.s=="string"?e.workbook.getStyles().get(t.s):t.s)||{}};a.forEach(f=>{delete s[f]});const u={...t,s:{...s},v:c};return delete u.p,n(u)}}return n(t)}})))}};Jt=cu([Gr(0,d.Inject(j.SheetInterceptorService)),Gr(1,d.Inject(l.ConditionalFormattingService))],Jt);const Xr=[j.SetWorksheetActiveOperation.id,l.AddConditionalRuleMutation.id,l.SetConditionalRuleMutation.id,l.DeleteConditionalRuleMutation.id,l.MoveConditionalRuleMutation.id],yt=[{label:"sheet.cf.ruleType.highlightCell",value:Te.highlightCell},{label:"sheet.cf.panel.rankAndAverage",value:Te.rank},{label:"sheet.cf.ruleType.formula",value:Te.formula},{label:"sheet.cf.ruleType.colorScale",value:Te.colorScale},{label:"sheet.cf.ruleType.dataBar",value:Te.dataBar},{label:"sheet.cf.ruleType.iconSet",value:Te.icon},{label:"sheet.cf.menu.manageConditionalFormatting",value:Te.viewRule},{label:"sheet.cf.menu.createConditionalFormatting",value:Te.createRule},{label:"sheet.cf.menu.clearRangeRules",value:Te.clearRangeRules,disabled:!1},{label:"sheet.cf.menu.clearWorkSheetRules",value:Te.clearWorkSheetRules}],uu=t=>{const e=t.get(j.SheetsSelectionsService),n=t.get(d.ICommandService),r=t.get(d.IUniverInstanceService),o=t.get(l.ConditionalFormattingRuleModel),i=new De.Observable(s=>De.merge(e.selectionMoveEnd$,new De.Observable(u=>{const f=n.onCommandExecuted(p=>{var y;const{id:h,params:v}=p,S=(y=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getUnitId();Xr.includes(h)&&v.unitId===S&&u.next(null)});return()=>f.dispose()})).pipe(He.debounceTime(16)).subscribe(()=>{var y;const u=((y=e.getCurrentSelections())==null?void 0:y.map(O=>O.range))||[],f=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!f)return;const p=f.getActiveSheet();if(!p)return;const S=(o.getSubunitRules(f.getUnitId(),p.getSheetId())||[]).filter(O=>O.ranges.some(R=>u.some(I=>d.Rectangle.intersects(I,R)))).map(O=>O.ranges).every(O=>j.checkRangesEditablePermission(t,f.getUnitId(),p.getSheetId(),O));s.next(S)})),a=new De.Observable(s=>new De.Observable(u=>{const f=n.onCommandExecuted(p=>{var y;const{id:h,params:v}=p,S=(y=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getUnitId();Xr.includes(h)&&v.unitId===S&&u.next(null)});return()=>f.dispose()}).pipe(He.debounceTime(16)).subscribe(()=>{const u=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!u)return;const f=u.getActiveSheet();if(!f)return;const p=o.getSubunitRules(u.getUnitId(),f.getSheetId())||[];if(!p.length)return s.next(!1),!1;const h=p.map(v=>v.ranges).every(v=>j.checkRangesEditablePermission(t,u.getUnitId(),f.getSheetId(),v));s.next(h)})),c=new De.Observable(s=>{i.subscribe(u=>{const f=yt.find(p=>p.value===Te.clearRangeRules);f&&(f.disabled=!u,s.next(yt))}),a.subscribe(u=>{const f=yt.find(p=>p.value===Te.clearWorkSheetRules);f&&(f.disabled=!u,s.next(yt))}),s.next(yt)});return{id:Nt.id,type:ve.MenuItemType.SELECTOR,icon:"Conditions",tooltip:"sheet.cf.title",selections:c,hidden$:ve.getMenuHiddenObservable(t,d.UniverInstanceType.UNIVER_SHEET),disabled$:oe.getCurrentRangeDisable$(t,{workbookTypes:[j.WorkbookEditablePermission],worksheetTypes:[j.WorksheetSetCellStylePermission,j.WorksheetEditPermission],rangeTypes:[j.RangeProtectionPermissionEditPoint]})}},du={[ve.RibbonStartGroup.FORMULAS_INSERT]:{[Nt.id]:{order:0,menuItemFactory:uu}}};var fu=Object.defineProperty,pu=Object.getOwnPropertyDescriptor,hu=(t,e,n,r)=>{for(var o=r>1?void 0:r?pu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&fu(e,n,o),o},Yr=(t,e)=>(n,r)=>e(n,r,t);let Qt=class extends d.Disposable{constructor(e,n){super();Ae(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=n,this._menuManagerService.mergeMenu(du)}};Qt=hu([Yr(0,d.Inject(d.Injector)),Yr(1,ve.IMenuManagerService)],Qt);var mu=Object.defineProperty,gu=Object.getOwnPropertyDescriptor,vu=(t,e,n,r)=>{for(var o=r>1?void 0:r?gu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&mu(e,n,o),o},it=(t,e)=>(n,r)=>e(n,r,t);const yu=(t,e)=>{const n=f=>f.endRow-f.startRow+1,r=f=>f.endColumn-f.startColumn+1,o=n(e)%n(t),i=r(e)%r(t),a=Math.floor(n(e)/n(t)),c=Math.floor(r(e)/r(t)),s=[],u={startRow:0,endRow:n(t)-1,startColumn:0,endColumn:r(t)-1};if(n(e)===1&&r(e)===1){const f={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return s.push({repeatRelativeRange:u,startRange:f}),s}for(let f=0;f<a+(o?.1:0);f++)for(let p=0;p<c+(i?.1:0);p++){const h=n(t)*f,v=r(t)*p,S={startRow:h+e.startRow,endRow:h+e.startRow,startColumn:v+e.startColumn,endColumn:v+e.startColumn};let y=u;f===a&&o&&(y={...y},y.endRow=y.endRow-(n(t)-o)),p===c&&i&&(y={...y},y.endColumn=y.endColumn-(r(t)-i)),s.push({repeatRelativeRange:y,startRange:S})}return s};let en=class extends d.Disposable{constructor(e,n,r,o,i,a){super();Ae(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=n,this._formatPainterService=r,this._sheetsSelectionsService=o,this._conditionalFormattingRuleModel=i,this._conditionalFormattingViewModel=a,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),n=(i,a,c,s,u)=>{const{unitId:f,subUnitId:p}=this._painterConfig,{targetUnitId:h,targetSubUnitId:v}=u,S={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row},y={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row};d.Range.foreach(c,(O,R)=>{const I=d.Rectangle.getPositionRange({startRow:O,startColumn:R,endColumn:R,endRow:O},S),b=d.Rectangle.getPositionRange({startRow:O,startColumn:R,endColumn:R,endRow:O},y),x=this._conditionalFormattingViewModel.getCellCf(f,p,I.startRow,I.startColumn),m=this._conditionalFormattingViewModel.getCellCf(h,v,b.startRow,b.startColumn);m&&m.cfList.forEach(T=>{let w=s.get(T.cfId);if(!s.get(T.cfId)){const E=this._conditionalFormattingRuleModel.getRule(h,v,T.cfId);if(!E)return;w=new d.ObjectMatrix,E.ranges.forEach(P=>{d.Range.foreach(P,($,z)=>{w.setValue($,z,1)})}),s.set(T.cfId,w)}w.realDeleteValue(b.startRow,b.startColumn)}),x&&x.cfList.forEach(T=>{const w=s.get(T.cfId);w&&w.setValue(b.startRow,b.startColumn,1)})})},r=(i,a,c)=>{var I;const{range:s,unitId:u,subUnitId:f}=this._painterConfig,p=i!==u||f!==a,h=new Map,v=[],S=[];if(!i||!a||!u||!f)return e();const y=(I=this._conditionalFormattingRuleModel.getSubunitRules(u,f))!=null?I:[];y==null||y.forEach(b=>{const{ranges:x,cfId:m}=b;if(x.some(T=>d.Rectangle.intersects(s,T))){const T=new d.ObjectMatrix;p||x.forEach(w=>{d.Range.foreach(w,(E,P)=>{T.setValue(E,P,1)})}),h.set(m,T)}});const O={row:s.startRow,col:s.startColumn};return yu(s,c).forEach(b=>{n(O,{row:b.startRange.startRow,col:b.startRange.startColumn},b.repeatRelativeRange,h,{targetUnitId:i,targetSubUnitId:a})}),h.forEach((b,x)=>{if(p){const m=this._conditionalFormattingRuleModel.getRule(i,a,x),T=j.findAllRectangle(j.createTopMatrixFromMatrix(b));if(m)if(T.length){const w={unitId:i,subUnitId:a,rule:{...m,ranges:T}};v.push({id:l.SetConditionalRuleMutation.id,params:w}),S.push(...l.setConditionalRuleMutationUndoFactory(this._injector,w))}else{const w={unitId:i,subUnitId:a,cfId:m.cfId};v.push({id:l.DeleteConditionalRuleMutation.id,params:w}),S.push(...l.DeleteConditionalRuleMutationUndoFactory(this._injector,w))}else if(T.length){const w=this._conditionalFormattingRuleModel.getRule(u,f,x);if(w){const E={unitId:i,subUnitId:a,rule:{...d.Tools.deepClone(w),cfId:this._conditionalFormattingRuleModel.createCfId(i,a),ranges:T}};v.push({id:l.AddConditionalRuleMutation.id,params:E}),S.push(l.AddConditionalRuleMutationUndoFactory(this._injector,E))}}}else{const m=this._conditionalFormattingRuleModel.getRule(u,f,x);if(!m)return;const T=j.findAllRectangle(j.createTopMatrixFromMatrix(b));if(T.length){const w={unitId:u,subUnitId:f,rule:{...m,ranges:T}};v.push({id:l.SetConditionalRuleMutation.id,params:w}),S.push(...l.setConditionalRuleMutationUndoFactory(this._injector,w))}else{const w={unitId:u,subUnitId:f,cfId:m.cfId};v.push({id:l.DeleteConditionalRuleMutation.id,params:w}),S.push(...l.DeleteConditionalRuleMutationUndoFactory(this._injector,w))}}}),{undos:S,redos:v}},o={id:l.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:i=>{var a,c,s;switch(i){case oe.FormatPainterStatus.INFINITE:case oe.FormatPainterStatus.ONCE:{const u=(a=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:a.getUnitId(),f=(s=(c=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:c.getActiveSheet())==null?void 0:s.getSheetId(),p=this._sheetsSelectionsService.getCurrentLastSelection(),h=p==null?void 0:p.range;u&&f&&h&&(this._painterConfig={unitId:u,subUnitId:f,range:h});break}case oe.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(i,a,c)=>this._painterConfig?r(i,a,c):{redos:[],undos:[]}};this._formatPainterService.addHook(o)}};en=vu([it(0,d.Inject(d.Injector)),it(1,d.Inject(d.IUniverInstanceService)),it(2,d.Inject(oe.IFormatPainterService)),it(3,d.Inject(j.SheetsSelectionsService)),it(4,d.Inject(l.ConditionalFormattingRuleModel)),it(5,d.Inject(l.ConditionalFormattingViewModel))],en);var Jo=Object.defineProperty,Cu=Object.getOwnPropertyDescriptor,Su=(t,e,n)=>e in t?Jo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bu=(t,e,n,r)=>{for(var o=r>1?void 0:r?Cu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Jo(e,n,o),o},Mn=(t,e)=>(n,r)=>e(n,r,t),Qo=(t,e,n)=>Su(t,typeof e!="symbol"?e+"":e,n);exports.UniverSheetsConditionalFormattingUIPlugin=class extends d.Plugin{constructor(e=Yo,n,r,o){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=o;const{menu:i,...a}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Xo,a),this._initCommand()}onStarting(){d.registerDependencies(this._injector,[[Tt],[It],[wt],[Zt],[_t],[Rt],[Qt],[ct],[Jt],[exports.ConditionalFormattingClearController],[en]]),d.touchDependencies(this._injector,[[Tt]])}onReady(){d.touchDependencies(this._injector,[[Qt],[Rt]])}onRendered(){d.touchDependencies(this._injector,[[Zt],[exports.ConditionalFormattingClearController],[wt],[Jt],[ct],[en],[_t],[It]])}_initCommand(){[Wn,qn,Bn,Gn,Xn,Yn,Kn,Zn,Jn,Nt,bt,yn,vn,Dt,tn,Et].forEach(e=>{this._commandService.registerCommand(e)})}};Qo(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${l.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);Qo(exports.UniverSheetsConditionalFormattingUIPlugin,"type",d.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=bu([d.DependentOn(l.UniverSheetsConditionalFormattingPlugin),Mn(1,d.Inject(d.Injector)),Mn(2,d.Inject(d.ICommandService)),Mn(3,d.IConfigService)],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=Wn;exports.AddCfCommand=Dt;exports.AddColorScaleConditionalRuleCommand=qn;exports.AddDataBarConditionalRuleCommand=Bn;exports.AddDuplicateValuesCfCommand=Gn;exports.AddNumberCfCommand=Xn;exports.AddRankCfCommand=Yn;exports.AddTextCfCommand=Kn;exports.AddTimePeriodCfCommand=Zn;exports.AddUniqueValuesCfCommand=Jn;exports.ClearRangeCfCommand=tn;exports.ClearWorksheetCfCommand=Et;exports.DeleteCfCommand=bt;exports.MoveCfCommand=vn;exports.OpenConditionalFormattingOperator=Nt;exports.SetCfCommand=yn;
|
|
11
|
+
`,t.getElementsByTagName("head")[0].appendChild(e)),t.body&&_o(t.body,"react-draggable-transparent-selection")}function Pa(t){if(t)try{if(t.body&&xo(t.body,"react-draggable-transparent-selection"),t.selection)t.selection.empty();else{const e=(t.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function _o(t,e){t.classList?t.classList.add(e):t.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(t.className+=" ".concat(e))}function xo(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var $e={};Object.defineProperty($e,"__esModule",{value:!0});$e.canDragX=ja;$e.canDragY=$a;$e.createCoreData=Ua;$e.createDraggableData=Va;$e.getBoundPosition=Da;$e.getControlPosition=La;$e.snapToGrid=Na;var Re=je,at=ie;function Da(t,e,n){if(!t.props.bounds)return[e,n];let{bounds:r}=t.props;r=typeof r=="string"?r:Aa(r);const o=dr(t);if(typeof r=="string"){const{ownerDocument:i}=o,a=i.defaultView;let c;if(r==="parent"?c=o.parentNode:c=i.querySelector(r),!(c instanceof a.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const s=c,u=a.getComputedStyle(o),f=a.getComputedStyle(s);r={left:-o.offsetLeft+(0,Re.int)(f.paddingLeft)+(0,Re.int)(u.marginLeft),top:-o.offsetTop+(0,Re.int)(f.paddingTop)+(0,Re.int)(u.marginTop),right:(0,at.innerWidth)(s)-(0,at.outerWidth)(o)-o.offsetLeft+(0,Re.int)(f.paddingRight)-(0,Re.int)(u.marginRight),bottom:(0,at.innerHeight)(s)-(0,at.outerHeight)(o)-o.offsetTop+(0,Re.int)(f.paddingBottom)-(0,Re.int)(u.marginBottom)}}return(0,Re.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,Re.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Re.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,Re.isNum)(r.top)&&(n=Math.max(n,r.top)),[e,n]}function Na(t,e,n){const r=Math.round(e/t[0])*t[0],o=Math.round(n/t[1])*t[1];return[r,o]}function ja(t){return t.props.axis==="both"||t.props.axis==="x"}function $a(t){return t.props.axis==="both"||t.props.axis==="y"}function La(t,e,n){const r=typeof e=="number"?(0,at.getTouch)(t,e):null;if(typeof e=="number"&&!r)return null;const o=dr(n),i=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,at.offsetXYFromParent)(r||t,i,n.props.scale)}function Ua(t,e,n){const r=!(0,Re.isNum)(t.lastX),o=dr(t);return r?{node:o,deltaX:0,deltaY:0,lastX:e,lastY:n,x:e,y:n}:{node:o,deltaX:e-t.lastX,deltaY:n-t.lastY,lastX:t.lastX,lastY:t.lastY,x:e,y:n}}function Va(t,e){const n=t.props.scale;return{node:e.node,x:t.state.x+e.deltaX/n,y:t.state.y+e.deltaY/n,deltaX:e.deltaX/n,deltaY:e.deltaY/n,lastX:t.state.x,lastY:t.state.y}}function Aa(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}function dr(t){const e=t.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var cn={},un={};Object.defineProperty(un,"__esModule",{value:!0});un.default=za;function za(){}Object.defineProperty(cn,"__esModule",{value:!0});cn.default=void 0;var Sn=Ha(_),Se=fr(We),ka=fr(Kr),me=ie,ze=$e,bn=je,ft=fr(un);function fr(t){return t&&t.__esModule?t:{default:t}}function Eo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(Eo=function(r){return r?n:e})(t)}function Ha(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=Eo(e);if(n&&n.has(t))return n.get(t);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function ye(t,e,n){return e=Wa(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wa(t){var e=qa(t,"string");return typeof e=="symbol"?e:String(e)}function qa(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const Ee={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let ke=Ee.mouse,dn=class extends Sn.Component{constructor(){super(...arguments),ye(this,"dragging",!1),ye(this,"lastX",NaN),ye(this,"lastY",NaN),ye(this,"touchIdentifier",null),ye(this,"mounted",!1),ye(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,me.matchesSelectorAndParentsTo)(e.target,this.props.handle,n)||this.props.cancel&&(0,me.matchesSelectorAndParentsTo)(e.target,this.props.cancel,n))return;e.type==="touchstart"&&e.preventDefault();const o=(0,me.getTouchIdentifier)(e);this.touchIdentifier=o;const i=(0,ze.getControlPosition)(e,o,this);if(i==null)return;const{x:a,y:c}=i,s=(0,ze.createCoreData)(this,a,c);(0,ft.default)("DraggableCore: handleDragStart: %j",s),(0,ft.default)("calling",this.props.onStart),!(this.props.onStart(e,s)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,me.addUserSelectStyles)(r),this.dragging=!0,this.lastX=a,this.lastY=c,(0,me.addEvent)(r,ke.move,this.handleDrag),(0,me.addEvent)(r,ke.stop,this.handleDragStop))}),ye(this,"handleDrag",e=>{const n=(0,ze.getControlPosition)(e,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,s=o-this.lastY;if([c,s]=(0,ze.snapToGrid)(this.props.grid,c,s),!c&&!s)return;r=this.lastX+c,o=this.lastY+s}const i=(0,ze.createCoreData)(this,r,o);if((0,ft.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const s=document.createEvent("MouseEvents");s.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(s)}return}this.lastX=r,this.lastY=o}),ye(this,"handleDragStop",e=>{if(!this.dragging)return;const n=(0,ze.getControlPosition)(e,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let s=r-this.lastX||0,u=o-this.lastY||0;[s,u]=(0,ze.snapToGrid)(this.props.grid,s,u),r=this.lastX+s,o=this.lastY+u}const i=(0,ze.createCoreData)(this,r,o);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,me.removeUserSelectStyles)(c.ownerDocument),(0,ft.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,ft.default)("DraggableCore: Removing handlers"),(0,me.removeEvent)(c.ownerDocument,ke.move,this.handleDrag),(0,me.removeEvent)(c.ownerDocument,ke.stop,this.handleDragStop))}),ye(this,"onMouseDown",e=>(ke=Ee.mouse,this.handleDragStart(e))),ye(this,"onMouseUp",e=>(ke=Ee.mouse,this.handleDragStop(e))),ye(this,"onTouchStart",e=>(ke=Ee.touch,this.handleDragStart(e))),ye(this,"onTouchEnd",e=>(ke=Ee.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,me.addEvent)(e,Ee.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:n}=e;(0,me.removeEvent)(n,Ee.mouse.move,this.handleDrag),(0,me.removeEvent)(n,Ee.touch.move,this.handleDrag),(0,me.removeEvent)(n,Ee.mouse.stop,this.handleDragStop),(0,me.removeEvent)(n,Ee.touch.stop,this.handleDragStop),(0,me.removeEvent)(e,Ee.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,me.removeUserSelectStyles)(n)}}findDOMNode(){var e,n;return(e=this.props)!==null&&e!==void 0&&e.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:ka.default.findDOMNode(this)}render(){return Sn.cloneElement(Sn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};cn.default=dn;ye(dn,"displayName","DraggableCore");ye(dn,"propTypes",{allowAnyClick:Se.default.bool,children:Se.default.node.isRequired,disabled:Se.default.bool,enableUserSelectHack:Se.default.bool,offsetParent:function(t,e){if(t[e]&&t[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Se.default.arrayOf(Se.default.number),handle:Se.default.string,cancel:Se.default.string,nodeRef:Se.default.object,onStart:Se.default.func,onDrag:Se.default.func,onStop:Se.default.func,onMouseDown:Se.default.func,scale:Se.default.number,className:bn.dontSetMe,style:bn.dontSetMe,transform:bn.dontSetMe});ye(dn,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return s.default}}),t.default=void 0;var e=h(_),n=f(We),r=f(Kr),o=f(ua),i=ie,a=$e,c=je,s=f(cn),u=f(un);function f(I){return I&&I.__esModule?I:{default:I}}function p(I){if(typeof WeakMap!="function")return null;var b=new WeakMap,x=new WeakMap;return(p=function(m){return m?x:b})(I)}function h(I,b){if(I&&I.__esModule)return I;if(I===null||typeof I!="object"&&typeof I!="function")return{default:I};var x=p(b);if(x&&x.has(I))return x.get(I);var m={},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var T in I)if(T!=="default"&&Object.prototype.hasOwnProperty.call(I,T)){var E=w?Object.getOwnPropertyDescriptor(I,T):null;E&&(E.get||E.set)?Object.defineProperty(m,T,E):m[T]=I[T]}return m.default=I,x&&x.set(I,m),m}function v(){return v=Object.assign?Object.assign.bind():function(I){for(var b=1;b<arguments.length;b++){var x=arguments[b];for(var m in x)Object.prototype.hasOwnProperty.call(x,m)&&(I[m]=x[m])}return I},v.apply(this,arguments)}function S(I,b,x){return b=y(b),b in I?Object.defineProperty(I,b,{value:x,enumerable:!0,configurable:!0,writable:!0}):I[b]=x,I}function y(I){var b=O(I,"string");return typeof b=="symbol"?b:String(b)}function O(I,b){if(typeof I!="object"||I===null)return I;var x=I[Symbol.toPrimitive];if(x!==void 0){var m=x.call(I,b||"default");if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(I)}class R extends e.Component{static getDerivedStateFromProps(b,x){let{position:m}=b,{prevPropsPosition:w}=x;return m&&(!w||m.x!==w.x||m.y!==w.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:m,prevPropsPosition:w}),{x:m.x,y:m.y,prevPropsPosition:{...m}}):null}constructor(b){super(b),S(this,"onDragStart",(x,m)=>{if((0,u.default)("Draggable: onDragStart: %j",m),this.props.onStart(x,(0,a.createDraggableData)(this,m))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),S(this,"onDrag",(x,m)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",m);const w=(0,a.createDraggableData)(this,m),T={x:w.x,y:w.y,slackX:0,slackY:0};if(this.props.bounds){const{x:D,y:$}=T;T.x+=this.state.slackX,T.y+=this.state.slackY;const[z,q]=(0,a.getBoundPosition)(this,T.x,T.y);T.x=z,T.y=q,T.slackX=this.state.slackX+(D-T.x),T.slackY=this.state.slackY+($-T.y),w.x=T.x,w.y=T.y,w.deltaX=T.x-this.state.x,w.deltaY=T.y-this.state.y}if(this.props.onDrag(x,w)===!1)return!1;this.setState(T)}),S(this,"onDragStop",(x,m)=>{if(!this.state.dragging||this.props.onStop(x,(0,a.createDraggableData)(this,m))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",m);const T={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:D,y:$}=this.props.position;T.x=D,T.y=$}this.setState(T)}),this.state={dragging:!1,dragged:!1,x:b.position?b.position.x:b.defaultPosition.x,y:b.position?b.position.y:b.defaultPosition.y,prevPropsPosition:{...b.position},slackX:0,slackY:0,isElementSVG:!1},b.position&&!(b.onDrag||b.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 b,x;return(b=(x=this.props)===null||x===void 0||(x=x.nodeRef)===null||x===void 0?void 0:x.current)!==null&&b!==void 0?b:r.default.findDOMNode(this)}render(){const{axis:b,bounds:x,children:m,defaultPosition:w,defaultClassName:T,defaultClassNameDragging:E,defaultClassNameDragged:D,position:$,positionOffset:z,scale:q,...C}=this.props;let M={},A=null;const X=!!!$||this.state.dragging,ue=$||w,ae={x:(0,a.canDragX)(this)&&X?this.state.x:ue.x,y:(0,a.canDragY)(this)&&X?this.state.y:ue.y};this.state.isElementSVG?A=(0,i.createSVGTransform)(ae,z):M=(0,i.createCSSTransform)(ae,z);const L=(0,o.default)(m.props.className||"",T,{[E]:this.state.dragging,[D]:this.state.dragged});return e.createElement(s.default,v({},C,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(m),{className:L,style:{...m.props.style,...M},transform:A}))}}t.default=R,S(R,"displayName","Draggable"),S(R,"propTypes",{...s.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),S(R,"defaultProps",{...s.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(So);const{default:Oo,DraggableCore:Ba}=So;ln.exports=Oo;ln.exports.default=Oo;ln.exports.DraggableCore=Ba;var Mo=ln.exports,fn={exports:{}},Ft={},pr={};pr.__esModule=!0;pr.cloneElement=Ja;var Ga=Xa(_);function Xa(t){return t&&t.__esModule?t:{default:t}}function Or(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Mr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Or(Object(n),!0).forEach(function(r){Ya(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Or(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ya(t,e,n){return e=Ka(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ka(t){var e=Za(t,"string");return typeof e=="symbol"?e:String(e)}function Za(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ja(t,e){return e.style&&t.props.style&&(e.style=Mr(Mr({},t.props.style),e.style)),e.className&&t.props.className&&(e.className=t.props.className+" "+e.className),Ga.default.cloneElement(t,e)}var Pt={};Pt.__esModule=!0;Pt.resizableProps=void 0;var k=Qa(We);function Qa(t){return t&&t.__esModule?t:{default:t}}var es={axis:k.default.oneOf(["both","x","y","none"]),className:k.default.string,children:k.default.element.isRequired,draggableOpts:k.default.shape({allowAnyClick:k.default.bool,cancel:k.default.string,children:k.default.node,disabled:k.default.bool,enableUserSelectHack:k.default.bool,offsetParent:k.default.node,grid:k.default.arrayOf(k.default.number),handle:k.default.string,nodeRef:k.default.object,onStart:k.default.func,onDrag:k.default.func,onStop:k.default.func,onMouseDown:k.default.func,scale:k.default.number}),height:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="y"){var i;return(i=k.default.number).isRequired.apply(i,n)}return k.default.number.apply(k.default,n)},handle:k.default.oneOfType([k.default.node,k.default.func]),handleSize:k.default.arrayOf(k.default.number),lockAspectRatio:k.default.bool,maxConstraints:k.default.arrayOf(k.default.number),minConstraints:k.default.arrayOf(k.default.number),onResizeStop:k.default.func,onResizeStart:k.default.func,onResize:k.default.func,resizeHandles:k.default.arrayOf(k.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:k.default.number,width:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="x"){var i;return(i=k.default.number).isRequired.apply(i,n)}return k.default.number.apply(k.default,n)}};Pt.resizableProps=es;Ft.__esModule=!0;Ft.default=void 0;var pt=is(_),ts=Mo,ns=pr,rs=Pt,os=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Fo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(Fo=function(o){return o?n:e})(t)}function is(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=Fo(e);if(n&&n.has(t))return n.get(t);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function Ln(){return Ln=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ln.apply(this,arguments)}function as(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function Fr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Rn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fr(Object(n),!0).forEach(function(r){ss(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ss(t,e,n){return e=ls(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ls(t){var e=cs(t,"string");return typeof e=="symbol"?e:String(e)}function cs(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function us(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Un(t,e)}function Un(t,e){return Un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Un(t,e)}var hr=function(t){us(e,t);function e(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var n=e.prototype;return n.componentWillUnmount=function(){this.resetData()},n.resetData=function(){this.lastHandleRect=this.slack=null},n.runConstraints=function(o,i){var a=this.props,c=a.minConstraints,s=a.maxConstraints,u=a.lockAspectRatio;if(!c&&!s&&!u)return[o,i];if(u){var f=this.props.width/this.props.height,p=o-this.props.width,h=i-this.props.height;Math.abs(p)>Math.abs(h*f)?i=o/f:o=i*f}var v=o,S=i,y=this.slack||[0,0],O=y[0],R=y[1];return o+=O,i+=R,c&&(o=Math.max(c[0],o),i=Math.max(c[1],i)),s&&(o=Math.min(s[0],o),i=Math.min(s[1],i)),this.slack=[O+(v-o),R+(S-i)],[o,i]},n.resizeHandler=function(o,i){var a=this;return function(c,s){var u=s.node,f=s.deltaX,p=s.deltaY;o==="onResizeStart"&&a.resetData();var h=(a.props.axis==="both"||a.props.axis==="x")&&i!=="n"&&i!=="s",v=(a.props.axis==="both"||a.props.axis==="y")&&i!=="e"&&i!=="w";if(!(!h&&!v)){var S=i[0],y=i[i.length-1],O=u.getBoundingClientRect();if(a.lastHandleRect!=null){if(y==="w"){var R=O.left-a.lastHandleRect.left;f+=R}if(S==="n"){var I=O.top-a.lastHandleRect.top;p+=I}}a.lastHandleRect=O,y==="w"&&(f=-f),S==="n"&&(p=-p);var b=a.props.width+(h?f/a.props.transformScale:0),x=a.props.height+(v?p/a.props.transformScale:0),m=a.runConstraints(b,x);b=m[0],x=m[1];var w=b!==a.props.width||x!==a.props.height,T=typeof a.props[o]=="function"?a.props[o]:null,E=o==="onResize"&&!w;T&&!E&&(c.persist==null||c.persist(),T(c,{node:u,size:{width:b,height:x},handle:i})),o==="onResizeStop"&&a.resetData()}}},n.renderResizeHandle=function(o,i){var a=this.props.handle;if(!a)return pt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:i});if(typeof a=="function")return a(o,i);var c=typeof a.type=="string",s=Rn({ref:i},c?{}:{handleAxis:o});return pt.cloneElement(a,s)},n.render=function(){var o=this,i=this.props,a=i.children,c=i.className,s=i.draggableOpts;i.width,i.height,i.handle,i.handleSize,i.lockAspectRatio,i.axis,i.minConstraints,i.maxConstraints,i.onResize,i.onResizeStop,i.onResizeStart;var u=i.resizeHandles;i.transformScale;var f=as(i,os);return(0,ns.cloneElement)(a,Rn(Rn({},f),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(a.props.children,u.map(function(p){var h,v=(h=o.handleRefs[p])!=null?h:o.handleRefs[p]=pt.createRef();return pt.createElement(ts.DraggableCore,Ln({},s,{nodeRef:v,key:"resizableHandle-"+p,onStop:o.resizeHandler("onResizeStop",p),onStart:o.resizeHandler("onResizeStart",p),onDrag:o.resizeHandler("onResize",p)}),o.renderResizeHandle(p,v))}))}))},e}(pt.Component);Ft.default=hr;hr.propTypes=rs.resizableProps;hr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var pn={};pn.__esModule=!0;pn.default=void 0;var Tn=ms(_),ds=Po(We),fs=Po(Ft),ps=Pt,hs=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Po(t){return t&&t.__esModule?t:{default:t}}function Do(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(Do=function(o){return o?n:e})(t)}function ms(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=Do(e);if(n&&n.has(t))return n.get(t);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function Vn(){return Vn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Vn.apply(this,arguments)}function Pr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Gt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Pr(Object(n),!0).forEach(function(r){gs(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gs(t,e,n){return e=vs(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vs(t){var e=ys(t,"string");return typeof e=="symbol"?e:String(e)}function ys(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cs(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function Ss(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,An(t,e)}function An(t,e){return An=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},An(t,e)}var No=function(t){Ss(e,t);function e(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(c,s){var u=s.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(u,function(){return r.props.onResize&&r.props.onResize(c,s)})):r.setState(u)},r}e.getDerivedStateFromProps=function(o,i){return i.propsWidth!==o.width||i.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var n=e.prototype;return n.render=function(){var o=this.props,i=o.handle,a=o.handleSize;o.onResize;var c=o.onResizeStart,s=o.onResizeStop,u=o.draggableOpts,f=o.minConstraints,p=o.maxConstraints,h=o.lockAspectRatio,v=o.axis;o.width,o.height;var S=o.resizeHandles,y=o.style,O=o.transformScale,R=Cs(o,hs);return Tn.createElement(fs.default,{axis:v,draggableOpts:u,handle:i,handleSize:a,height:this.state.height,lockAspectRatio:h,maxConstraints:p,minConstraints:f,onResizeStart:c,onResize:this.onResize,onResizeStop:s,resizeHandles:S,transformScale:O,width:this.state.width},Tn.createElement("div",Vn({},R,{style:Gt(Gt({},y),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},e}(Tn.Component);pn.default=No;No.propTypes=Gt(Gt({},ps.resizableProps),{},{children:ds.default.element});fn.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};fn.exports.Resizable=Ft.default;fn.exports.ResizableBox=pn.default;var bs=fn.exports,Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.resizeHandleType=Ve.resizeHandleAxesType=Ve.default=void 0;var H=jo(We),Rs=jo(_);function jo(t){return t&&t.__esModule?t:{default:t}}const Ts=Ve.resizeHandleAxesType=H.default.arrayOf(H.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),ws=Ve.resizeHandleType=H.default.oneOfType([H.default.node,H.default.func]);Ve.default={className:H.default.string,style:H.default.object,width:H.default.number,autoSize:H.default.bool,cols:H.default.number,draggableCancel:H.default.string,draggableHandle:H.default.string,verticalCompact:function(t){t.verticalCompact},compactType:H.default.oneOf(["vertical","horizontal"]),layout:function(t){var e=t.layout;e!==void 0&&W.validateLayout(e,"layout")},margin:H.default.arrayOf(H.default.number),containerPadding:H.default.arrayOf(H.default.number),rowHeight:H.default.number,maxRows:H.default.number,isBounded:H.default.bool,isDraggable:H.default.bool,isResizable:H.default.bool,allowOverlap:H.default.bool,preventCollision:H.default.bool,useCSSTransforms:H.default.bool,transformScale:H.default.number,isDroppable:H.default.bool,resizeHandles:Ts,resizeHandle:ws,onLayoutChange:H.default.func,onDragStart:H.default.func,onDrag:H.default.func,onDragStop:H.default.func,onResizeStart:H.default.func,onResize:H.default.func,onResizeStop:H.default.func,onDrop:H.default.func,droppingItem:H.default.shape({i:H.default.string.isRequired,w:H.default.number.isRequired,h:H.default.number.isRequired}),children:function(t,e){const n=t[e],r={};Rs.default.Children.forEach(n,function(o){if((o==null?void 0:o.key)!=null){if(r[o.key])throw new Error('Duplicate child key "'+o.key+'" found! This will cause problems in ReactGridLayout.');r[o.key]=!0}})},innerRef:H.default.any};Object.defineProperty(sn,"__esModule",{value:!0});sn.default=void 0;var et=mr(_),Y=mr(We),Is=Mo,_s=bs,tt=W,he=Ne,Dr=Ve,xs=mr(er);function mr(t){return t&&t.__esModule?t:{default:t}}function Pe(t,e,n){return e=Es(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Es(t){var e=Os(t,"string");return typeof e=="symbol"?e:String(e)}function Os(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class gr extends et.default.Component{constructor(){super(...arguments),Pe(this,"state",{resizing:null,dragging:null,className:""}),Pe(this,"elementRef",et.default.createRef()),Pe(this,"onDragStart",(e,n)=>{let{node:r}=n;const{onDragStart:o,transformScale:i}=this.props;if(!o)return;const a={top:0,left:0},{offsetParent:c}=r;if(!c)return;const s=c.getBoundingClientRect(),u=r.getBoundingClientRect(),f=u.left/i,p=s.left/i,h=u.top/i,v=s.top/i;a.left=f-p+c.scrollLeft,a.top=h-v+c.scrollTop,this.setState({dragging:a});const{x:S,y}=(0,he.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return o.call(this,this.props.i,S,y,{e,node:r,newPosition:a})}),Pe(this,"onDrag",(e,n)=>{let{node:r,deltaX:o,deltaY:i}=n;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+i,s=this.state.dragging.left+o;const{isBounded:u,i:f,w:p,h,containerWidth:v}=this.props,S=this.getPositionParams();if(u){const{offsetParent:I}=r;if(I){const{margin:b,rowHeight:x,containerPadding:m}=this.props,w=I.clientHeight-(0,he.calcGridItemWHPx)(h,x,b[1]);c=(0,he.clamp)(c-m[1],0,w);const T=(0,he.calcGridColWidth)(S),E=v-(0,he.calcGridItemWHPx)(p,T,b[0]);s=(0,he.clamp)(s-m[0],0,E)}}const y={top:c,left:s};this.setState({dragging:y});const{x:O,y:R}=(0,he.calcXY)(S,c,s,p,h);return a.call(this,f,O,R,{e,node:r,newPosition:y})}),Pe(this,"onDragStop",(e,n)=>{let{node:r}=n;const{onDragStop:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:i,h:a,i:c}=this.props,{left:s,top:u}=this.state.dragging,f={top:u,left:s};this.setState({dragging:null});const{x:p,y:h}=(0,he.calcXY)(this.getPositionParams(),u,s,i,a);return o.call(this,c,p,h,{e,node:r,newPosition:f})}),Pe(this,"onResizeStop",(e,n,r)=>this.onResizeHandler(e,n,r,"onResizeStop")),Pe(this,"onResizeStart",(e,n,r)=>this.onResizeHandler(e,n,r,"onResizeStart")),Pe(this,"onResize",(e,n,r)=>this.onResizeHandler(e,n,r,"onResize"))}shouldComponentUpdate(e,n){if(this.props.children!==e.children||this.props.droppingPosition!==e.droppingPosition)return!0;const r=(0,he.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),o=(0,he.calcGridItemPosition)(this.getPositionParams(e),e.x,e.y,e.w,e.h,n);return!(0,tt.fastPositionEqual)(r,o)||this.props.useCSSTransforms!==e.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(e){this.moveDroppingItem(e)}moveDroppingItem(e){const{droppingPosition:n}=this.props;if(!n)return;const r=this.elementRef.current;if(!r)return;const o=e.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&n.left!==o.left||n.top!==o.top;if(!i)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(a){const c=n.left-i.left,s=n.top-i.top;this.onDrag(n.e,{node:r,deltaX:c,deltaY:s})}}getPositionParams(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:e.cols,containerPadding:e.containerPadding,containerWidth:e.containerWidth,margin:e.margin,maxRows:e.maxRows,rowHeight:e.rowHeight}}createStyle(e){const{usePercentages:n,containerWidth:r,useCSSTransforms:o}=this.props;let i;return o?i=(0,tt.setTransform)(e):(i=(0,tt.setTopLeft)(e),n&&(i.left=(0,tt.perc)(e.left/r),i.width=(0,tt.perc)(e.width/r))),i}mixinDraggable(e,n){return et.default.createElement(Is.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},e)}curryResizeHandler(e,n){return(r,o)=>n(r,o,e)}mixinResizable(e,n,r){const{cols:o,minW:i,minH:a,maxW:c,maxH:s,transformScale:u,resizeHandles:f,resizeHandle:p}=this.props,h=this.getPositionParams(),v=(0,he.calcGridItemPosition)(h,0,0,o,0).width,S=(0,he.calcGridItemPosition)(h,0,0,i,a),y=(0,he.calcGridItemPosition)(h,0,0,c,s),O=[S.width,S.height],R=[Math.min(y.width,v),Math.min(y.height,1/0)];return et.default.createElement(_s.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:O,maxConstraints:R,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:u,resizeHandles:f,handle:p},e)}onResizeHandler(e,n,r,o){let{node:i,size:a,handle:c}=n;const s=this.props[o];if(!s)return;const{x:u,y:f,i:p,maxH:h,minH:v,containerWidth:S}=this.props,{minW:y,maxW:O}=this.props;let R=a;i&&(R=(0,tt.resizeItemInDirection)(c,r,a,S),this.setState({resizing:o==="onResizeStop"?null:R}));let{w:I,h:b}=(0,he.calcWH)(this.getPositionParams(),R.width,R.height,u,f,c);I=(0,he.clamp)(I,Math.max(y,1),O),b=(0,he.clamp)(b,v,h),s.call(this,p,I,b,{e,node:i,size:R,handle:c})}render(){const{x:e,y:n,w:r,h:o,isDraggable:i,isResizable:a,droppingPosition:c,useCSSTransforms:s}=this.props,u=(0,he.calcGridItemPosition)(this.getPositionParams(),e,n,r,o,this.state),f=et.default.Children.only(this.props.children);let p=et.default.cloneElement(f,{ref:this.elementRef,className:(0,xs.default)("react-grid-item",f.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":i,"react-draggable-dragging":!!this.state.dragging,dropping:!!c,cssTransforms:s}),style:{...this.props.style,...f.props.style,...this.createStyle(u)}});return p=this.mixinResizable(p,u,a),p=this.mixinDraggable(p,i),p}}sn.default=gr;Pe(gr,"propTypes",{children:Y.default.element,cols:Y.default.number.isRequired,containerWidth:Y.default.number.isRequired,rowHeight:Y.default.number.isRequired,margin:Y.default.array.isRequired,maxRows:Y.default.number.isRequired,containerPadding:Y.default.array.isRequired,x:Y.default.number.isRequired,y:Y.default.number.isRequired,w:Y.default.number.isRequired,h:Y.default.number.isRequired,minW:function(t,e){const n=t[e];if(typeof n!="number")return new Error("minWidth not Number");if(n>t.w||n>t.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(t,e){const n=t[e];if(typeof n!="number")return new Error("maxWidth not Number");if(n<t.w||n<t.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(t,e){const n=t[e];if(typeof n!="number")return new Error("minHeight not Number");if(n>t.h||n>t.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(t,e){const n=t[e];if(typeof n!="number")return new Error("maxHeight not Number");if(n<t.h||n<t.minH)return new Error("maxHeight smaller than item height/minHeight")},i:Y.default.string.isRequired,resizeHandles:Dr.resizeHandleAxesType,resizeHandle:Dr.resizeHandleType,onDragStop:Y.default.func,onDragStart:Y.default.func,onDrag:Y.default.func,onResizeStop:Y.default.func,onResizeStart:Y.default.func,onResize:Y.default.func,isDraggable:Y.default.bool.isRequired,isResizable:Y.default.bool.isRequired,isBounded:Y.default.bool.isRequired,static:Y.default.bool,useCSSTransforms:Y.default.bool.isRequired,transformScale:Y.default.number,className:Y.default.string,handle:Y.default.string,cancel:Y.default.string,droppingPosition:Y.default.shape({e:Y.default.object.isRequired,left:Y.default.number.isRequired,top:Y.default.number.isRequired})});Pe(gr,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1});Object.defineProperty(Mt,"__esModule",{value:!0});Mt.default=void 0;var qe=Ds(_),wn=Qn,Ms=vr(er),V=W,Fs=Ne,Nr=vr(sn),Ps=vr(Ve);function vr(t){return t&&t.__esModule?t:{default:t}}function $o(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return($o=function(r){return r?n:e})(t)}function Ds(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=$o(e);if(n&&n.has(t))return n.get(t);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function ge(t,e,n){return e=Ns(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ns(t){var e=js(t,"string");return typeof e=="symbol"?e:String(e)}function js(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const jr="react-grid-layout";let Lo=!1;try{Lo=/firefox/i.test(navigator.userAgent)}catch{}class hn extends qe.Component{constructor(){super(...arguments),ge(this,"state",{activeDrag:null,layout:(0,V.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,V.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),ge(this,"dragEnterCounter",0),ge(this,"onDragStart",(e,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,s=(0,V.getLayoutItem)(c,e);if(!s)return;const u={w:s.w,h:s.h,x:s.x,y:s.y,placeholder:!0,i:e};return this.setState({oldDragItem:(0,V.cloneLayoutItem)(s),oldLayout:c,activeDrag:u}),this.props.onDragStart(c,s,s,null,i,a)}),ge(this,"onDrag",(e,n,r,o)=>{let{e:i,node:a}=o;const{oldDragItem:c}=this.state;let{layout:s}=this.state;const{cols:u,allowOverlap:f,preventCollision:p}=this.props,h=(0,V.getLayoutItem)(s,e);if(!h)return;const v={w:h.w,h:h.h,x:h.x,y:h.y,placeholder:!0,i:e};s=(0,V.moveElement)(s,h,n,r,!0,p,(0,V.compactType)(this.props),u,f),this.props.onDrag(s,c,h,v,i,a),this.setState({layout:f?s:(0,V.compact)(s,(0,V.compactType)(this.props),u),activeDrag:v})}),ge(this,"onDragStop",(e,n,r,o)=>{let{e:i,node:a}=o;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:s}=this.state;const{cols:u,preventCollision:f,allowOverlap:p}=this.props,h=(0,V.getLayoutItem)(s,e);if(!h)return;s=(0,V.moveElement)(s,h,n,r,!0,f,(0,V.compactType)(this.props),u,p);const S=p?s:(0,V.compact)(s,(0,V.compactType)(this.props),u);this.props.onDragStop(S,c,h,null,i,a);const{oldLayout:y}=this.state;this.setState({activeDrag:null,layout:S,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(S,y)}),ge(this,"onResizeStart",(e,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,s=(0,V.getLayoutItem)(c,e);s&&(this.setState({oldResizeItem:(0,V.cloneLayoutItem)(s),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,s,s,null,i,a))}),ge(this,"onResize",(e,n,r,o)=>{let{e:i,node:a,size:c,handle:s}=o;const{oldResizeItem:u}=this.state,{layout:f}=this.state,{cols:p,preventCollision:h,allowOverlap:v}=this.props;let S=!1,y,O,R;const[I,b]=(0,V.withLayoutItem)(f,e,m=>{let w;return O=m.x,R=m.y,["sw","w","nw","n","ne"].indexOf(s)!==-1&&(["sw","nw","w"].indexOf(s)!==-1&&(O=m.x+(m.w-n),n=m.x!==O&&O<0?m.w:n,O=O<0?0:O),["ne","n","nw"].indexOf(s)!==-1&&(R=m.y+(m.h-r),r=m.y!==R&&R<0?m.h:r,R=R<0?0:R),S=!0),h&&!v&&(w=(0,V.getAllCollisions)(f,{...m,w:n,h:r,x:O,y:R}).filter(E=>E.i!==m.i).length>0,w&&(R=m.y,r=m.h,O=m.x,n=m.w,S=!1)),m.w=n,m.h=r,m});if(!b)return;y=I,S&&(y=(0,V.moveElement)(I,b,O,R,!0,this.props.preventCollision,(0,V.compactType)(this.props),p,v));const x={w:b.w,h:b.h,x:b.x,y:b.y,static:!0,i:e};this.props.onResize(y,u,b,x,i,a),this.setState({layout:v?y:(0,V.compact)(y,(0,V.compactType)(this.props),p),activeDrag:x})}),ge(this,"onResizeStop",(e,n,r,o)=>{let{e:i,node:a}=o;const{layout:c,oldResizeItem:s}=this.state,{cols:u,allowOverlap:f}=this.props,p=(0,V.getLayoutItem)(c,e),h=f?c:(0,V.compact)(c,(0,V.compactType)(this.props),u);this.props.onResizeStop(h,s,p,null,i,a);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:h,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(h,v)}),ge(this,"onDragOver",e=>{var I;if(e.preventDefault(),e.stopPropagation(),Lo&&!((I=e.nativeEvent.target)!=null&&I.classList.contains(jr)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:i,rowHeight:a,maxRows:c,width:s,containerPadding:u,transformScale:f}=this.props,p=r==null?void 0:r(e);if(p===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const h={...n,...p},{layout:v}=this.state,S=e.currentTarget.getBoundingClientRect(),y=e.clientX-S.left,O=e.clientY-S.top,R={left:y/f,top:O/f,e};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:b,top:x}=this.state.droppingPosition;(b!=y||x!=O)&&this.setState({droppingPosition:R})}}else{const b={cols:i,margin:o,maxRows:c,rowHeight:a,containerWidth:s,containerPadding:u||o},x=(0,Fs.calcXY)(b,O,y,h.w,h.h);this.setState({droppingDOMNode:qe.createElement("div",{key:h.i}),droppingPosition:R,layout:[...v,{...h,x:x.x,y:x.y,static:!1,isDraggable:!0}]})}}),ge(this,"removeDroppingPlaceholder",()=>{const{droppingItem:e,cols:n}=this.props,{layout:r}=this.state,o=(0,V.compact)(r.filter(i=>i.i!==e.i),(0,V.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:o,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),ge(this,"onDragLeave",e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),ge(this,"onDragEnter",e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter++}),ge(this,"onDrop",e=>{e.preventDefault(),e.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,o=r.find(i=>i.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,o,e)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(e,n){let r;return n.activeDrag?null:(!(0,wn.deepEqual)(e.layout,n.propsLayout)||e.compactType!==n.compactType?r=e.layout:(0,V.childrenEqual)(e.children,n.children)||(r=n.layout),r?{layout:(0,V.synchronizeLayoutWithChildren)(r,e.children,e.cols,(0,V.compactType)(e),e.allowOverlap),compactType:e.compactType,children:e.children,propsLayout:e.layout}:null)}shouldComponentUpdate(e,n){return this.props.children!==e.children||!(0,V.fastRGLPropsEqual)(this.props,e,wn.deepEqual)||this.state.activeDrag!==n.activeDrag||this.state.mounted!==n.mounted||this.state.droppingPosition!==n.droppingPosition}componentDidUpdate(e,n){if(!this.state.activeDrag){const r=this.state.layout,o=n.layout;this.onLayoutMaybeChanged(r,o)}}containerHeight(){if(!this.props.autoSize)return;const e=(0,V.bottom)(this.state.layout),n=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return e*this.props.rowHeight+(e-1)*this.props.margin[1]+n*2+"px"}onLayoutMaybeChanged(e,n){n||(n=this.state.layout),(0,wn.deepEqual)(n,e)||this.props.onLayoutChange(e)}placeholder(){const{activeDrag:e}=this.state;if(!e)return null;const{width:n,cols:r,margin:o,containerPadding:i,rowHeight:a,maxRows:c,useCSSTransforms:s,transformScale:u}=this.props;return qe.createElement(Nr.default,{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:n,cols:r,margin:o,containerPadding:i||o,maxRows:c,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:s,transformScale:u},qe.createElement("div",null))}processGridItem(e,n){if(!e||!e.key)return;const r=(0,V.getLayoutItem)(this.state.layout,String(e.key));if(!r)return null;const{width:o,cols:i,margin:a,containerPadding:c,rowHeight:s,maxRows:u,isDraggable:f,isResizable:p,isBounded:h,useCSSTransforms:v,transformScale:S,draggableCancel:y,draggableHandle:O,resizeHandles:R,resizeHandle:I}=this.props,{mounted:b,droppingPosition:x}=this.state,m=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&f,w=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&p,T=r.resizeHandles||R,E=m&&h&&r.isBounded!==!1;return qe.createElement(Nr.default,{containerWidth:o,cols:i,margin:a,containerPadding:c||a,maxRows:u,rowHeight:s,cancel:y,handle:O,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:m,isResizable:w,isBounded:E,useCSSTransforms:v&&b,usePercentages:!b,transformScale:S,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:n?x:void 0,resizeHandles:T,resizeHandle:I},e)}render(){const{className:e,style:n,isDroppable:r,innerRef:o}=this.props,i=(0,Ms.default)(jr,e),a={height:this.containerHeight(),...n};return qe.createElement("div",{ref:o,className:i,style:a,onDrop:r?this.onDrop:V.noop,onDragLeave:r?this.onDragLeave:V.noop,onDragEnter:r?this.onDragEnter:V.noop,onDragOver:r?this.onDragOver:V.noop},qe.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}Mt.default=hn;ge(hn,"displayName","ReactGridLayout");ge(hn,"propTypes",Ps.default);ge(hn,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:V.noop,onDragStart:V.noop,onDrag:V.noop,onDragStop:V.noop,onResizeStart:V.noop,onResize:V.noop,onResizeStop:V.noop,onDrop:V.noop,onDropDragOver:V.noop});var mn={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.findOrGenerateResponsiveLayout=Us;Qe.getBreakpointFromWidth=$s;Qe.getColsFromBreakpoint=Ls;Qe.sortBreakpoints=yr;var $t=W;function $s(t,e){const n=yr(t);let r=n[0];for(let o=1,i=n.length;o<i;o++){const a=n[o];e>t[a]&&(r=a)}return r}function Ls(t,e){if(!e[t])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+t+" is missing!");return e[t]}function Us(t,e,n,r,o,i){if(t[n])return(0,$t.cloneLayout)(t[n]);let a=t[r];const c=yr(e),s=c.slice(c.indexOf(n));for(let u=0,f=s.length;u<f;u++){const p=s[u];if(t[p]){a=t[p];break}}return a=(0,$t.cloneLayout)(a||[]),(0,$t.compact)((0,$t.correctBounds)(a,{cols:o}),i,o)}function yr(t){return Object.keys(t).sort(function(n,r){return t[n]-t[r]})}Object.defineProperty(mn,"__esModule",{value:!0});mn.default=void 0;var $r=As(_),be=Uo(We),In=Qn,st=W,Be=Qe,Vs=Uo(Mt);function Uo(t){return t&&t.__esModule?t:{default:t}}function Vo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(Vo=function(r){return r?n:e})(t)}function As(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=Vo(e);if(n&&n.has(t))return n.get(t);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function zn(){return zn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zn.apply(this,arguments)}function Xt(t,e,n){return e=zs(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zs(t){var e=ks(t,"string");return typeof e=="symbol"?e:String(e)}function ks(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const Lr=t=>Object.prototype.toString.call(t);function Lt(t,e){return t==null?null:Array.isArray(t)?t:t[e]}class Cr extends $r.Component{constructor(){super(...arguments),Xt(this,"state",this.generateInitialState()),Xt(this,"onLayoutChange",e=>{this.props.onLayoutChange(e,{...this.props.layouts,[this.state.breakpoint]:e})})}generateInitialState(){const{width:e,breakpoints:n,layouts:r,cols:o}=this.props,i=(0,Be.getBreakpointFromWidth)(n,e),a=(0,Be.getColsFromBreakpoint)(i,o),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Be.findOrGenerateResponsiveLayout)(r,n,i,i,a,c),breakpoint:i,cols:a}}static getDerivedStateFromProps(e,n){if(!(0,In.deepEqual)(e.layouts,n.layouts)){const{breakpoint:r,cols:o}=n;return{layout:(0,Be.findOrGenerateResponsiveLayout)(e.layouts,e.breakpoints,r,r,o,e.compactType),layouts:e.layouts}}return null}componentDidUpdate(e){(this.props.width!=e.width||this.props.breakpoint!==e.breakpoint||!(0,In.deepEqual)(this.props.breakpoints,e.breakpoints)||!(0,In.deepEqual)(this.props.cols,e.cols))&&this.onWidthChange(e)}onWidthChange(e){const{breakpoints:n,cols:r,layouts:o,compactType:i}=this.props,a=this.props.breakpoint||(0,Be.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,s=(0,Be.getColsFromBreakpoint)(a,r),u={...o};if(c!==a||e.breakpoints!==n||e.cols!==r){c in u||(u[c]=(0,st.cloneLayout)(this.state.layout));let h=(0,Be.findOrGenerateResponsiveLayout)(u,n,a,c,s,i);h=(0,st.synchronizeLayoutWithChildren)(h,this.props.children,s,i,this.props.allowOverlap),u[a]=h,this.props.onBreakpointChange(a,s),this.props.onLayoutChange(h,u),this.setState({breakpoint:a,layout:h,cols:s})}const f=Lt(this.props.margin,a),p=Lt(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,f,s,p)}render(){const{breakpoint:e,breakpoints:n,cols:r,layouts:o,margin:i,containerPadding:a,onBreakpointChange:c,onLayoutChange:s,onWidthChange:u,...f}=this.props;return $r.createElement(Vs.default,zn({},f,{margin:Lt(i,this.state.breakpoint),containerPadding:Lt(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}mn.default=Cr;Xt(Cr,"propTypes",{breakpoint:be.default.string,breakpoints:be.default.object,allowOverlap:be.default.bool,cols:be.default.object,margin:be.default.oneOfType([be.default.array,be.default.object]),containerPadding:be.default.oneOfType([be.default.array,be.default.object]),layouts(t,e){if(Lr(t[e])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+Lr(t[e]));Object.keys(t[e]).forEach(n=>{if(!(n in t.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,st.validateLayout)(t.layouts[n],"layouts."+n)})},width:be.default.number.isRequired,onBreakpointChange:be.default.func,onLayoutChange:be.default.func,onWidthChange:be.default.func});Xt(Cr,"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:st.noop,onLayoutChange:st.noop,onWidthChange:st.noop});var Sr={},Ao=function(){if(typeof Map<"u")return Map;function t(e,n){var r=-1;return e.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(n){var r=t(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},e.prototype.set=function(n,r){var o=t(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},e.prototype.delete=function(n){var r=this.__entries__,o=t(r,n);~o&&r.splice(o,1)},e.prototype.has=function(n){return!!~t(this.__entries__,n)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var a=i[o];n.call(r,a[1],a[0])}},e}()}(),kn=typeof window<"u"&&typeof document<"u"&&window.document===document,Yt=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),Hs=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Yt):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)}}(),Ws=2;function qs(t,e){var n=!1,r=!1,o=0;function i(){n&&(n=!1,t()),r&&c()}function a(){Hs(i)}function c(){var s=Date.now();if(n){if(s-o<Ws)return;r=!0}else n=!0,r=!1,setTimeout(a,e);o=s}return c}var Bs=20,Gs=["top","right","bottom","left","width","height","size","weight"],Xs=typeof MutationObserver<"u",Ys=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=qs(this.refresh.bind(this),Bs)}return t.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},t.prototype.removeObserver=function(e){var n=this.observers_,r=n.indexOf(e);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){var e=this.updateObservers_();e&&this.refresh()},t.prototype.updateObservers_=function(){var e=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return e.forEach(function(n){return n.broadcastActive()}),e.length>0},t.prototype.connect_=function(){!kn||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Xs?(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)},t.prototype.disconnect_=function(){!kn||!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)},t.prototype.onTransitionEnd_=function(e){var n=e.propertyName,r=n===void 0?"":n,o=Gs.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),zo=function(t,e){for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];Object.defineProperty(t,o,{value:e[o],enumerable:!1,writable:!1,configurable:!0})}return t},lt=function(t){var e=t&&t.ownerDocument&&t.ownerDocument.defaultView;return e||Yt},ko=gn(0,0,0,0);function Kt(t){return parseFloat(t)||0}function Ur(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce(function(r,o){var i=t["border-"+o+"-width"];return r+Kt(i)},0)}function Ks(t){for(var e=["top","right","bottom","left"],n={},r=0,o=e;r<o.length;r++){var i=o[r],a=t["padding-"+i];n[i]=Kt(a)}return n}function Zs(t){var e=t.getBBox();return gn(0,0,e.width,e.height)}function Js(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return ko;var r=lt(t).getComputedStyle(t),o=Ks(r),i=o.left+o.right,a=o.top+o.bottom,c=Kt(r.width),s=Kt(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==e&&(c-=Ur(r,"left","right")+i),Math.round(s+a)!==n&&(s-=Ur(r,"top","bottom")+a)),!el(t)){var u=Math.round(c+i)-e,f=Math.round(s+a)-n;Math.abs(u)!==1&&(c-=u),Math.abs(f)!==1&&(s-=f)}return gn(o.left,o.top,c,s)}var Qs=function(){return typeof SVGGraphicsElement<"u"?function(t){return t instanceof lt(t).SVGGraphicsElement}:function(t){return t instanceof lt(t).SVGElement&&typeof t.getBBox=="function"}}();function el(t){return t===lt(t).document.documentElement}function tl(t){return kn?Qs(t)?Zs(t):Js(t):ko}function nl(t){var e=t.x,n=t.y,r=t.width,o=t.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,a=Object.create(i.prototype);return zo(a,{x:e,y:n,width:r,height:o,top:n,right:e+r,bottom:o+n,left:e}),a}function gn(t,e,n,r){return{x:t,y:e,width:n,height:r}}var rl=function(){function t(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=gn(0,0,0,0),this.target=e}return t.prototype.isActive=function(){var e=tl(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},t}(),ol=function(){function t(e,n){var r=nl(n);zo(this,{target:e,contentRect:r})}return t}(),il=function(){function t(e,n,r){if(this.activeObservations_=[],this.observations_=new Ao,typeof e!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=n,this.callbackCtx_=r}return t.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof lt(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)||(n.set(e,new rl(e)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof lt(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)&&(n.delete(e),n.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&e.activeObservations_.push(n)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new ol(r.target,r.broadcastRect())});this.callback_.call(e,n,e),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),Ho=typeof WeakMap<"u"?new WeakMap:new Ao,Wo=function(){function t(e){if(!(this instanceof t))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=Ys.getInstance(),r=new il(e,n,this);Ho.set(this,r)}return t}();["observe","unobserve","disconnect"].forEach(function(t){Wo.prototype[t]=function(){var e;return(e=Ho.get(this))[t].apply(e,arguments)}});var al=function(){return typeof Yt.ResizeObserver<"u"?Yt.ResizeObserver:Wo}();const sl=Object.freeze(Object.defineProperty({__proto__:null,default:al},Symbol.toStringTag,{value:"Module"})),ll=Zr(sl);Object.defineProperty(Sr,"__esModule",{value:!0});Sr.default=gl;var Ut=fl(_),cl=br(We),ul=br(ll),dl=br(er);function br(t){return t&&t.__esModule?t:{default:t}}function qo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(qo=function(r){return r?n:e})(t)}function fl(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=qo(e);if(n&&n.has(t))return n.get(t);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,n&&n.set(t,r),r}function Hn(){return Hn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Hn.apply(this,arguments)}function nt(t,e,n){return e=pl(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pl(t){var e=hl(t,"string");return typeof e=="symbol"?e:String(e)}function hl(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const ml="react-grid-layout";function gl(t){var e;return e=class extends Ut.Component{constructor(){super(...arguments),nt(this,"state",{width:1280}),nt(this,"elementRef",Ut.createRef()),nt(this,"mounted",!1),nt(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new ul.default(o=>{if(this.elementRef.current instanceof HTMLElement){const a=o[0].contentRect.width;this.setState({width:a})}});const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.observe(r)}componentWillUnmount(){this.mounted=!1;const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.unobserve(r),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:r,...o}=this.props;return r&&!this.mounted?Ut.createElement("div",{className:(0,dl.default)(this.props.className,ml),style:this.props.style,ref:this.elementRef}):Ut.createElement(t,Hn({innerRef:this.elementRef},o,this.state))}},nt(e,"defaultProps",{measureBeforeMount:!1}),nt(e,"propTypes",{measureBeforeMount:cl.default.bool}),e}(function(t){t.exports=Mt.default,t.exports.utils=W,t.exports.calculateUtils=Ne,t.exports.Responsive=mn.default,t.exports.Responsive.utils=Qe,t.exports.WidthProvider=Sr.default})(ro);var vl=ro.exports;const yl=oi(vl),bt={type:d.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(t,e){if(!e)return!1;const n=t.get(d.IUndoRedoService),r=t.get(d.ICommandService),o=t.get(d.IUniverInstanceService),i=j.getSheetCommandTarget(o,e);if(!i)return!1;const{unitId:a,subUnitId:c}=i,s={unitId:a,subUnitId:c,cfId:e.cfId},u=l.DeleteConditionalRuleMutationUndoFactory(t,s),f=r.syncExecuteCommand(l.DeleteConditionalRuleMutation.id,s);return f&&n.pushUndoRedo({unitID:a,undoMutations:u,redoMutations:[{id:l.DeleteConditionalRuleMutation.id,params:s}]}),f}},vn={type:d.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(t,e){if(!e)return!1;const n=t.get(d.IUndoRedoService),r=t.get(d.ICommandService),o=t.get(d.IUniverInstanceService),i=t.get(l.ConditionalFormattingRuleModel),a=j.getSheetCommandTarget(o,e);if(!a)return!1;const{unitId:c,subUnitId:s}=a,u=l.transformSupportSymmetryAnchor(e.start,e.end,i.getSubunitRules(c,s)||[],y=>y.cfId);if(!u)return!1;const[f,p]=u,h={unitId:c,subUnitId:s,start:f,end:p},v=l.MoveConditionalRuleMutationUndoFactory(h),S=r.syncExecuteCommand(l.MoveConditionalRuleMutation.id,h);return S&&n.pushUndoRedo({unitID:c,redoMutations:[{id:l.MoveConditionalRuleMutation.id,params:h}],undoMutations:v}),S}},Cl="univer-cf-preview",Vt={cfPreview:Cl},dt=t=>{var o,i;const e=t.rule;if(!e)return null;const n=_.useMemo(()=>{if(e.type===l.CFRuleType.colorScale){const a=e.config.map((u,f)=>({color:new d.ColorKit(u.color),value:f})),c=a.length-1;return new Array(5).fill("").map((u,f,p)=>f*c/(p.length-1)).map(u=>l.getColorScaleFromValue(a,u))}return null},[e]),r=_.useMemo(()=>{if(e.type===l.CFRuleType.iconSet)return e.config.map(a=>{const c=l.iconMap[a.iconType];return c&&c[Number(a.iconId)]})},[e]);switch(e.type){case l.CFRuleType.dataBar:{const{isGradient:a}=e.config,c={width:"50%",height:"100%"},s=a?`linear-gradient(to right, ${e.config.positiveColor||l.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,u=a?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||l.defaultDataBarNativeColor})`:e.config.nativeColor;return g.jsxs("div",{className:Vt.cfPreview,children:[g.jsx("div",{style:{...c,background:u,border:`1px solid ${e.config.nativeColor||l.defaultDataBarNativeColor}`}}),g.jsx("div",{style:{...c,background:s,border:`1px solid ${e.config.positiveColor||l.defaultDataBarPositiveColor}`}})]})}case l.CFRuleType.colorScale:return n&&g.jsx("div",{className:Vt.cfPreview,children:n.map((a,c)=>g.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:a}},c))});case l.CFRuleType.iconSet:return r&&g.jsx("div",{className:Vt.cfPreview,children:r.map((a,c)=>a?g.jsx("img",{style:{height:"100%"},src:a},c):g.jsx(Ot,{},c))});case l.CFRuleType.highlightCell:{const{ul:a,st:c,it:s,bl:u,bg:f,cl:p}=e.style,h=(a==null?void 0:a.s)===d.BooleanNumber.TRUE,v=(c==null?void 0:c.s)===d.BooleanNumber.TRUE,S=s===d.BooleanNumber.TRUE,y=u===d.BooleanNumber.TRUE,O=(o=f==null?void 0:f.rgb)!=null?o:l.DEFAULT_BG_COLOR,R=(i=p==null?void 0:p.rgb)!=null?i:l.DEFAULT_FONT_COLOR,I={fontWeight:y?"bold":void 0,fontStyle:S?"italic":void 0,textDecoration:`${h?"underline":""} ${v?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:O,color:R};return g.jsx("div",{style:I,className:Vt.cfPreview,children:"123"})}}return null};var Sl=Object.defineProperty,bl=Object.getOwnPropertyDescriptor,Rl=(t,e,n,r)=>{for(var o=r>1?void 0:r?bl(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Sl(e,n,o),o},Tl=(t,e)=>(n,r)=>e(n,r,t);let ct=class extends d.Disposable{constructor(e){super();Ae(this,"_initLocal",()=>{});Ae(this,"_findReplaceIndex",e=>{const n=/\{([^}]+)?\}/g,r=[];let o=n.exec(e);for(;o;)r.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=n.exec(e);return r});this._localeService=e,this._initLocal()}tWithReactNode(e,...n){const r=this._localeService.getLocales(),o=e.split("."),i=r&&this._localeService.resolveKeyPath(r,o);if(typeof i=="string"){const a=[];return this._findReplaceIndex(i).forEach((c,s,u)=>{const f=u[s-1]||{startIndex:0,endIndex:-1};if(f.endIndex+1<c.startIndex){const p=i.slice(f.endIndex+1,c.startIndex);p&&a.push(p)}if(n[c.key]&&a.push(n[c.key]),s===u.length-1){const p=i.slice(c.endIndex+1);p&&a.push(p)}}),a}return[]}};ct=Rl([Tl(0,d.Inject(d.LocaleService))],ct);const wl="univer-cf-rule-list",Il="univer-rule-selector",_l="univer-select",xl="univer-select-selector",El="univer-select-selection-item",Ol="univer-select-selection-search-input",Ml="univer-btn-list",Fl="univer-gap",Pl="univer-icon",Dl="univer-disabled",Nl="univer-rule-item",jl="univer-rule-describe",$l="univer-rule-type",Ll="univer-rule-range",Ul="univer-active",Vl="univer-draggableHandle",Al="univer-delete-item",zl="univer-grid-layout-wrap",kl="univer-react-grid-item",de={cfRuleList:wl,ruleSelector:Il,select:_l,selectSelector:xl,selectSelectionItem:El,selectSelectionSearchInput:Ol,btnList:Ml,gap:Fl,icon:Pl,disabled:Dl,ruleItem:Nl,ruleDescribe:jl,ruleType:$l,ruleRange:Ll,active:Ul,draggableHandle:Vl,deleteItem:Al,gridLayoutWrap:zl,reactGridItem:kl},Hl=(t,e)=>{const n=t.rule;switch(n.type){case l.CFRuleType.colorScale:return e.t("sheet.cf.ruleType.colorScale");case l.CFRuleType.dataBar:return e.t("sheet.cf.ruleType.dataBar");case l.CFRuleType.iconSet:return e.t("sheet.cf.ruleType.iconSet");case l.CFRuleType.highlightCell:switch(n.subType){case l.CFSubRuleType.average:{const r=n.operator;return e.t(`sheet.cf.preview.describe.${r}`,e.t("sheet.cf.subRuleType.average"))}case l.CFSubRuleType.duplicateValues:return e.t("sheet.cf.subRuleType.duplicateValues");case l.CFSubRuleType.uniqueValues:return e.t("sheet.cf.subRuleType.uniqueValues");case l.CFSubRuleType.number:{const r=n.operator;return e.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(o=>String(o)):[String(n.value||"")])}case l.CFSubRuleType.text:{const r=n.operator;return e.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case l.CFSubRuleType.timePeriod:{const r=n.operator;return e.t(`sheet.cf.preview.describe.${r}`)}case l.CFSubRuleType.rank:return n.isPercent?n.isBottom?e.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):e.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?e.t("sheet.cf.preview.describe.bottomN",String(n.value)):e.t("sheet.cf.preview.describe.topN",String(n.value));case l.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let Vr=0;const Wl=t=>{const{onClick:e}=t,n=d.useDependency(l.ConditionalFormattingRuleModel),r=d.useDependency(d.IUniverInstanceService),o=d.useDependency(j.SheetsSelectionsService),i=d.useDependency(d.ICommandService),a=d.useDependency(d.LocaleService),c=d.useDependency(d.Injector),s=d.useDependency(ct),u=ve.useObservable(()=>r.getCurrentTypeOfUnit$(d.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),f=u.getUnitId(),p=u.getActiveSheet();if(!p)throw new Error("No active sheet found");const h=p.getSheetId(),[v,S]=_.useState([]),[y,O]=_.useState("2"),[R,I]=_.useState(0),[b,x]=_.useState(-1),[m,w]=_.useState(Vr),T=_.useRef(null),E=[{label:a.t("sheet.cf.panel.workSheet"),value:"2"},{label:a.t("sheet.cf.panel.selectedRange"),value:"1"}],D=()=>{const L=n.getSubunitRules(f,h);if(!L||!L.length)return[];if(y==="1"){const G=o.getCurrentLastSelection();if(!G)return[];const te=G.range;return L.filter(fe=>fe.ranges.some(Ce=>d.Rectangle.intersects(Ce,te)))}else if(y==="2")return[...L];return[]},[$,z]=_.useState(D);oe.useHighlightRange(v),_.useEffect(()=>{const L=i.onCommandExecuted(G=>{G.id===j.SetWorksheetActiveOperation.id&&I(Math.random())});return()=>L.dispose()}),_.useEffect(()=>{z(D)},[y,R,f,h]),_.useEffect(()=>{if(y==="2")return;const L=new De.Observable(G=>{const te=[j.SetSelectionsOperation.id,l.AddConditionalRuleMutation.id,l.SetConditionalRuleMutation.id,l.DeleteConditionalRuleMutation.id,l.MoveConditionalRuleMutation.id],ne=i.onCommandExecuted(fe=>{const{id:Ce,params:xe}=fe,Le=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId();te.includes(Ce)&&xe.unitId===Le&&G.next(null)});return()=>ne.dispose()}).pipe(De.debounceTime(16)).subscribe(()=>{z(D)});return()=>{L.unsubscribe()}},[r,y,f,h]),_.useEffect(()=>{const L=n.$ruleChange.subscribe(()=>{I(Math.random())});return()=>L.unsubscribe()},[n]),_.useEffect(()=>{const L=()=>{var fe;const ne=Math.max(0,(((fe=T.current)==null?void 0:fe.getBoundingClientRect().width)||0)-8);return Vr=ne,ne},te=new De.Observable(ne=>{const fe=document.querySelector(".univer-sidebar");if(fe){let Ce=setTimeout(()=>{ne.next()},150);const xe=()=>{Ce&&clearTimeout(Ce),Ce=null},Le=P=>{P.propertyName==="width"&&(xe(),ne.next())};return fe.addEventListener("transitionend",Le),()=>{xe(),fe.removeEventListener("transitionend",Le)}}}).pipe(De.debounceTime(16)).subscribe(()=>{w(L())});return()=>{te.unsubscribe()}},[]);const q=L=>{var ne;const G=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),te=(ne=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:ne.getSheetId();if(!G||!te)throw new Error("No active sheet found");i.executeCommand(bt.id,{unitId:G,subUnitId:te,cfId:L.cfId})},C=(L,G)=>{x(G.y)},M=(L,G,te)=>{var P;x(-1);const ne=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),fe=(P=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:P.getSheetId();if(!ne||!fe)throw new Error("No active sheet found");const Ce=U=>{const K=$.length;return Math.min(K-1,Math.max(0,U))},xe=$[Ce(G.y)].cfId,Le=$[Ce(te.y)].cfId;xe!==Le&&i.executeCommand(vn.id,{unitId:ne,subUnitId:fe,start:{id:xe,type:"self"},end:{id:Le,type:te.y>G.y?"after":"before"}})},A=()=>{t.onCreate()},Q=()=>{y==="2"?i.executeCommand(Et.id):y==="1"&&$.map(G=>({unitId:f,subUnitId:h,cfId:G.cfId})).forEach(G=>{i.executeCommand(bt.id,G)})},X=_.useMemo(()=>{const L=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),G=L.getActiveSheet();return $.filter(te=>{const ne=te.ranges;return j.checkRangesEditablePermission(c,L.getUnitId(),G.getSheetId(),ne)})},[$]),ue=X.map((L,G)=>({i:L.cfId,x:0,w:12,y:G,h:1,isResizable:!1})),ae=_.useMemo(()=>{const L=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),G=L.getActiveSheet();return $.every(te=>{const ne=te.ranges;return j.checkRangesEditablePermission(c,L.getUnitId(),G.getSheetId(),ne)})},[$]);return g.jsxs("div",{className:de.cfRuleList,children:[g.jsxs("div",{className:de.ruleSelector,children:[g.jsx("div",{children:s.tWithReactNode("sheet.cf.panel.managerRuleSelect",g.jsx(B.Select,{className:de.select,options:E,value:y,onChange:L=>{O(L)}})).map((L,G)=>g.jsx("span",{children:L},G))}),g.jsxs("div",{className:de.btnList,children:[g.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.createRule"),placement:"bottom",children:g.jsx("div",{className:`${de.icon}`,onClick:A,children:g.jsx(to,{})})}),$.length&&ae?g.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.clear"),placement:"bottom",children:g.jsx("div",{className:`${de.gap} ${de.icon}`,onClick:Q,children:g.jsx(Bt,{})})}):g.jsx("div",{className:`${de.gap} ${de.disabled}`,children:g.jsx(Bt,{})})]})]}),g.jsx("div",{ref:T,className:de.gridLayoutWrap,children:m?g.jsx(yl,{onDragStop:M,onDragStart:C,layout:ue,cols:12,rowHeight:60,width:m,margin:[0,10],draggableHandle:".draggableHandle",children:X==null?void 0:X.map((L,G)=>g.jsx("div",{children:g.jsxs("div",{onMouseMove:()=>{L.ranges!==v&&S(L.ranges)},onMouseLeave:()=>S([]),onClick:()=>{e(L)},className:`${de.ruleItem} ${b===G?de.active:""}`,children:[g.jsx("div",{className:`${de.draggableHandle} draggableHandle`,onClick:te=>te.stopPropagation(),children:g.jsx(no,{})}),g.jsxs("div",{className:de.ruleDescribe,children:[g.jsx("div",{className:de.ruleType,children:Hl(L,a)}),g.jsx("div",{className:de.ruleRange,children:L.ranges.map(te=>Fn.serializeRange(te)).join(",")})]}),g.jsx("div",{className:de.preview,children:g.jsx(dt,{rule:L.rule})}),g.jsx("div",{className:`${de.deleteItem} ${b===G?de.active:""}`,onClick:te=>{te.stopPropagation(),q(L),S([])},children:g.jsx(Bt,{})})]})},`${L.cfId}`))}):null})]})},Dt={type:d.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(t,e){if(!e)return!1;const{rule:n}=e,r=t.get(d.IUndoRedoService),o=t.get(d.ICommandService),i=t.get(l.ConditionalFormattingRuleModel),a=t.get(d.IUniverInstanceService),c=j.getSheetCommandTarget(a);if(!c)return!1;const{unitId:s,subUnitId:u}=c,f=i.createCfId(s,u),p={unitId:s,subUnitId:u,rule:{...n,cfId:n.cfId||f}},h=l.AddConditionalRuleMutationUndoFactory(t,p),v=o.syncExecuteCommand(l.AddConditionalRuleMutation.id,p);return v&&r.pushUndoRedo({unitID:s,redoMutations:[{id:l.AddConditionalRuleMutation.id,params:p}],undoMutations:[h]}),v}},yn={type:d.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(t,e){if(!e)return!1;const n=t.get(d.IUndoRedoService),r=t.get(d.ICommandService),o=t.get(d.IUniverInstanceService),i=j.getSheetCommandTarget(o,e);if(!i)return!1;const{unitId:a,subUnitId:c}=i,s={unitId:a,subUnitId:c,rule:e.rule},u=l.setConditionalRuleMutationUndoFactory(t,s),f=r.syncExecuteCommand(l.SetConditionalRuleMutation.id,s);return f&&n.pushUndoRedo({unitID:a,undoMutations:u,redoMutations:[{id:l.SetConditionalRuleMutation.id,params:s}]}),f}},ql="univer-cf-color-picker",Bl="univer-cf-color-picker-icon",Gl="univer-icon-dropdown",_n={cfColorPicker:ql,cfColorPickerIcon:Bl,iconDropdown:Gl},Ze=t=>{const{color:e,onChange:n,disable:r=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:a=!0}=t,c=d.useDependency(ve.ComponentManager),s=_.useMemo(()=>new d.ColorKit(e),[e]),u=c.get(o);return u&&(r?g.jsx(u,{className:i,extend:{colorChannel1:s.isValid?e:"rgb(var(--primary-color))"}}):g.jsx(B.Dropdown,{overlay:g.jsx("div",{className:`${_n.cfColorPicker} `,children:g.jsx(B.ColorPicker,{color:e,onChange:n})}),children:g.jsxs("span",{className:`${_n.cfColorPickerIcon} ${i}`,children:[g.jsx(u,{extend:{colorChannel1:s.isValid?e:"rgb(var(--primary-color))"}}),a&&g.jsx(rn,{className:_n.iconDropdown})]})}))},Xl="univer-cf-rule-style-editor",Yl="univer-cf-preview-wrap",Kl="univer-text",Zl="univer-position-relative",Jl="univer-btn-list",Ql="univer-util-item",ec="univer-icon-set",tc="univer-render-config",nc="univer-flex",rc="univer-width45",oc="univer-icon-wrap",ic="univer-icon",ac="univer-dropdown-icon",sc="univer-error-input",lc="univer-error-text",cc="univer-icon-group-list",uc="univer-title",dc="univer-group",fc="univer-item-content",pc="univer-item-wrap",hc="univer-item",mc="univer-icon-item-list-wrap",gc="univer-none",vc="univer-icon-item-list",yc="univer-width100",Cc="univer-stress",N={cfRuleStyleEditor:Xl,cfPreviewWrap:Yl,text:Kl,positionRelative:Zl,btnList:Jl,utilItem:Ql,iconSet:ec,renderConfig:tc,flex:nc,width45:rc,iconWrap:oc,icon:ic,dropdownIcon:ac,errorInput:sc,errorText:lc,iconGroupList:cc,title:uc,group:dc,itemContent:fc,itemWrap:pc,item:hc,iconItemListWrap:mc,none:gc,iconItemList:vc,width100:yc,stress:Cc},Ge=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),xn=t=>{var S;const{type:e,className:n,onChange:r,id:o,value:i}=t,a=d.useDependency(d.IUniverInstanceService),c=a.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),s=(S=a.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:S.getSheetId(),u=_.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),f=_.useMemo(()=>[l.CFValueType.max,l.CFValueType.min,"none"].includes(e)?{disabled:!0}:[l.CFValueType.percent,l.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),p=_.useRef({}),[h,v]=_.useState(!1);return ve.useSidebarClick(y=>{var R;const O=(R=p.current)==null?void 0:R.handleOutClick;O&&O(y,()=>v(!1))}),e===l.CFValueType.formula?g.jsx("div",{style:{width:"100%",marginLeft:4},children:g.jsx(xt.FormulaEditor,{initValue:u,unitId:c,subUnitId:s,isFocus:h,onChange:(y="")=>{r(y||"")},onFocus:()=>v(!0),actions:p.current})}):g.jsx(B.InputNumber,{className:n,value:Number(t.value)||0,onChange:y=>t.onChange(y||0),...f})},Sc=t=>{var q;const{interceptorManager:e}=t,n=d.useDependency(d.LocaleService),r=((q=t.rule)==null?void 0:q.type)===l.CFRuleType.colorScale?t.rule:void 0,o=[Ge(l.CFValueType.num,n),Ge(l.CFValueType.percent,n),Ge(l.CFValueType.percentile,n),Ge(l.CFValueType.formula,n)],i=[Ge(l.CFValueType.min,n),...o],a=[Ge("none",n),...o],c=[Ge(l.CFValueType.max,n),...o],[s,u]=_.useState(()=>{var M;const C=l.CFValueType.min;return r&&((M=r.config[0])==null?void 0:M.value.type)||C}),[f,p]=_.useState(()=>{var M;const C="none";return!r||r.config.length!==3?C:((M=r.config[1])==null?void 0:M.value.type)||C}),[h,v]=_.useState(()=>{var M;const C=l.CFValueType.max;return r&&((M=r.config[r.config.length-1])==null?void 0:M.value.type)||C}),[S,y]=_.useState(()=>{if(!r)return 10;const M=r.config[0];return(M==null?void 0:M.value.value)===void 0?10:M==null?void 0:M.value.value}),[O,R]=_.useState(()=>{var A;if(!r||r.config.length!==3)return 50;const M=(A=r.config[1])==null?void 0:A.value.value;return M===void 0?50:M}),[I,b]=_.useState(()=>{var A;if(!r)return 90;const M=(A=r.config[r.config.length-1])==null?void 0:A.value.value;return M===void 0?90:M}),[x,m]=_.useState(()=>{var M;const C="#d0d9fb";return r&&((M=r.config[0])==null?void 0:M.color)||C}),[w,T]=_.useState(()=>{var M;const C="#7790f3";return!r||r.config.length!==3?C:((M=r.config[1])==null?void 0:M.color)||C}),[E,D]=_.useState(()=>{var M;const C="#2e55ef";return r&&((M=r.config[r.config.length-1])==null?void 0:M.color)||C}),$=_.useMemo(()=>C=>{const{minType:M,medianType:A,maxType:Q,minValue:X,medianValue:ue,maxValue:ae,minColor:L,medianColor:G,maxColor:te}=C,ne=[];return ne.push({color:L,value:{type:M,value:X}}),A!=="none"&&ne.push({color:G,value:{type:A,value:ue}}),ne.push({color:te,value:{type:Q,value:ae}}),{config:ne.map((Ce,xe)=>({...Ce,index:xe})),type:l.CFRuleType.colorScale}},[]);_.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return $({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:x,medianColor:w,maxColor:E})}}),[$,s,f,h,S,O,I,x,w,E,e]);const z=C=>{t.onChange($(C))};return g.jsxs("div",{children:[g.jsx("div",{className:F.title,children:n.t("sheet.cf.panel.styleRule")}),g.jsx("div",{className:`${N.cfPreviewWrap}`,children:g.jsx(dt,{rule:$({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:x,medianColor:w,maxColor:E})})}),g.jsx("div",{className:F.label,children:n.t("sheet.cf.valueType.min")}),g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm}`,children:[g.jsx(B.Select,{style:{flexShrink:0},options:i,value:s,onChange:C=>{u(C);const M=l.createDefaultValueByValueType(C,10);y(M),z({minType:C,medianType:f,maxType:h,minValue:M,medianValue:O,maxValue:I,minColor:x,medianColor:w,maxColor:E})}}),g.jsx(xn,{id:"min",className:`${F.mLXxs}`,value:S,type:s,onChange:C=>{y(C),z({minType:s,medianType:f,maxType:h,minValue:C,medianValue:O,maxValue:I,minColor:x,medianColor:w,maxColor:E})}}),g.jsx(Ze,{className:F.mLXxs,color:x,onChange:C=>{m(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:C,medianColor:w,maxColor:E})}})]}),g.jsx("div",{className:F.label,children:n.t("sheet.cf.panel.medianValue")}),g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm}`,children:[g.jsx(B.Select,{style:{flexShrink:0},options:a,value:f,onChange:C=>{p(C);const M=l.createDefaultValueByValueType(C,50);R(M),z({minType:s,medianType:C,maxType:h,minValue:S,medianValue:M,maxValue:I,minColor:x,medianColor:w,maxColor:E})}}),g.jsx(xn,{id:"median",className:` ${F.mLXxs}`,value:O,type:f,onChange:C=>{R(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:C,maxValue:I,minColor:x,medianColor:w,maxColor:E})}}),f!=="none"&&g.jsx(Ze,{className:F.mLXxs,color:w,onChange:C=>{T(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:x,medianColor:C,maxColor:E})}})]}),g.jsx("div",{className:F.label,children:n.t("sheet.cf.valueType.max")}),g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm}`,children:[g.jsx(B.Select,{style:{flexShrink:0},options:c,value:h,onChange:C=>{v(C);const M=l.createDefaultValueByValueType(C,90);b(M),z({minType:s,medianType:f,maxType:C,minValue:S,medianValue:O,maxValue:M,minColor:x,medianColor:w,maxColor:E})}}),g.jsx(xn,{id:"max",className:`${F.mLXxs}`,value:I,type:h,onChange:C=>{b(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:C,minColor:x,medianColor:w,maxColor:E})}}),g.jsx(Ze,{className:F.mLXxs,color:E,onChange:C=>{D(C),z({minType:s,medianType:f,maxType:h,minValue:S,medianValue:O,maxValue:I,minColor:x,medianColor:w,maxColor:C})}})]})]})},rt=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),Ar=t=>{var y;const{onChange:e,className:n,value:r,type:o,id:i,disabled:a=!1}=t,c=d.useDependency(d.IUniverInstanceService),s=c.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),u=(y=c.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:y.getSheetId(),f=_.useRef({}),[p,h]=_.useState(!1);ve.useSidebarClick(O=>{var I;const R=(I=f.current)==null?void 0:I.handleOutClick;R&&R(O,()=>h(!1))});const v=_.useRef(r),S=_.useMemo(()=>[l.CFValueType.percentile,l.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===l.CFValueType.formula){const O=String(v.current).startsWith("=")?String(v.current)||"":"=";return g.jsx("div",{style:{width:"100%",marginLeft:12},children:g.jsx(xt.FormulaEditor,{initValue:O,unitId:s,subUnitId:u,isFocus:p,onChange:(R="")=>{e(R||"")},onFocus:()=>h(!0),actions:f.current})})}return g.jsx(B.InputNumber,{className:n,value:Number(r)||0,disabled:a,onChange:O=>{e(O||0)},...S})},bc=t=>{var q;const{interceptorManager:e}=t,n=d.useDependency(d.LocaleService),r=((q=t.rule)==null?void 0:q.type)===l.CFRuleType.dataBar?t.rule:void 0,[o,i]=_.useState(()=>{var M;const C="0";return r?(M=r.config)!=null&&M.isGradient?"1":"0":C}),[a,c]=_.useState(()=>{var C;return r&&((C=r.config)==null?void 0:C.positiveColor)||l.defaultDataBarPositiveColor}),[s,u]=_.useState(()=>{var C;return r&&((C=r.config)==null?void 0:C.nativeColor)||l.defaultDataBarNativeColor}),f=[rt(l.CFValueType.num,n),rt(l.CFValueType.percent,n),rt(l.CFValueType.percentile,n),rt(l.CFValueType.formula,n)],p=[rt(l.CFValueType.min,n),...f],h=[rt(l.CFValueType.max,n),...f],[v,S]=_.useState(()=>{var M;const C=p[0].value;return r&&((M=r.config)==null?void 0:M.min.type)||C}),[y,O]=_.useState(()=>{var M;const C=h[0].value;return r&&((M=r.config)==null?void 0:M.max.type)||C}),[R,I]=_.useState(()=>{var A;if(!r)return 0;const M=((A=r.config)==null?void 0:A.min)||{};return M.type===l.CFValueType.formula?M.value||"=":M.value||0}),[b,x]=_.useState(()=>{var A;if(!r)return 100;const M=((A=r.config)==null?void 0:A.max)||{};return M.type===l.CFValueType.formula?M.value||"=":M.value===void 0?100:M.value}),[m,w]=_.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),T=C=>({config:{min:{type:C.minValueType,value:C.minValue},max:{type:C.maxValueType,value:C.maxValue},isGradient:C.isGradient==="1",positiveColor:C.positiveColor||l.defaultDataBarPositiveColor,nativeColor:C.nativeColor||l.defaultDataBarNativeColor},type:l.CFRuleType.dataBar,isShowValue:C.isShowValue});_.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return T({isGradient:o,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})}}),[o,R,v,b,y,a,s,e,m]);const E=C=>{t.onChange(T(C))},D=C=>{c(C),E({isGradient:o,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:C,nativeColor:s,isShowValue:m})},$=C=>{u(C),E({isGradient:o,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:C,isShowValue:m})},z=C=>f.map(M=>M.value).includes(C);return g.jsxs("div",{children:[g.jsx("div",{className:F.title,children:n.t("sheet.cf.panel.styleRule")}),g.jsx("div",{className:`${N.cfPreviewWrap}`,children:g.jsx(dt,{rule:T({isGradient:o,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})})}),g.jsxs("div",{children:[g.jsx("div",{className:F.label,children:n.t("sheet.cf.panel.fillType")}),g.jsxs("div",{className:`${F.mTSm} ${F.mLXxs} ${F.labelContainer} `,children:[g.jsxs(B.RadioGroup,{value:o,onChange:C=>{i(C),E({isGradient:C,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})},children:[g.jsx(B.Radio,{value:"0",children:g.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.pureColor")})}),g.jsx(B.Radio,{value:"1",children:g.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.gradient")})})]}),g.jsxs("div",{className:`${N.utilItem} ${F.mLXl}`,children:[g.jsx(B.Checkbox,{checked:!m,onChange:C=>{w(!C),E({isGradient:C,minValue:R,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:!C})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),g.jsxs("div",{children:[g.jsx("div",{className:F.label,children:n.t("sheet.cf.panel.colorSet")}),g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm} ${F.mLXxs}`,children:[g.jsxs("div",{className:`${F.labelContainer}`,children:[g.jsx("div",{className:`${N.text}`,children:n.t("sheet.cf.panel.native")}),g.jsx(Ze,{color:s,onChange:$})]}),g.jsxs("div",{className:`${F.labelContainer} ${F.mLSm} `,children:[g.jsx("div",{className:`${N.text} `,children:n.t("sheet.cf.panel.positive")}),g.jsx(Ze,{color:a,onChange:D})]})]})]}),g.jsxs("div",{children:[g.jsx("div",{className:F.label,children:n.t("sheet.cf.valueType.min")}),g.jsxs("div",{className:`${F.mTSm} ${F.labelContainer}`,children:[g.jsx(B.Select,{style:{width:"50%",flexShrink:0},options:p,value:v,onChange:C=>{S(C);const M=l.createDefaultValueByValueType(C,10);I(M),E({isGradient:o,minValue:M,minValueType:C,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})}}),g.jsx(Ar,{disabled:!z(v),id:"min",type:v,className:F.mLSm,value:R,onChange:C=>{I(C||0),E({isGradient:o,minValue:C||0,minValueType:v,maxValue:b,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})}})]}),g.jsx("div",{className:F.label,children:n.t("sheet.cf.valueType.max")}),g.jsxs("div",{className:`${F.mTSm} ${F.labelContainer}`,children:[g.jsx(B.Select,{style:{width:"50%",flexShrink:0},options:h,value:y,onChange:C=>{O(C);const M=l.createDefaultValueByValueType(C,90);x(M),E({isGradient:o,minValue:R,minValueType:v,maxValue:M,maxValueType:C,positiveColor:a,nativeColor:s,isShowValue:m})}}),g.jsx(Ar,{disabled:!z(y),id:"max",type:y,className:F.mLSm,value:b,onChange:C=>{x(C||0),E({isGradient:o,minValue:R,minValueType:v,maxValue:C||0,maxValueType:y,positiveColor:a,nativeColor:s,isShowValue:m})}})]})]})]})};function Bo(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=Bo(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function At(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=Bo(t))&&(r&&(r+=" "),r+=e);return r}const Rc="univer-cf-style-edit",Tc="univer-button-item",wc="univer-isActive",Ue={cfStyleEdit:Rc,buttonItem:Tc,isActive:wc},zt=t=>[d.BooleanNumber.FALSE,void 0].includes(t)?d.BooleanNumber.TRUE:d.BooleanNumber.FALSE,kt=t=>t!==d.BooleanNumber.FALSE,Rr=t=>{const{style:e,onChange:n,className:r}=t,o=d.useDependency(ve.ComponentManager),[i,a]=_.useState(()=>{if(e!=null&&e.bl)return e.bl}),[c,s]=_.useState(()=>{if(e!=null&&e.it)return e.it}),[u,f]=_.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[p,h]=_.useState(()=>{if(e!=null&&e.st)return e.st.s}),[v,S]=_.useState(()=>{var w;const m="#2f56ef";return(w=e==null?void 0:e.cl)!=null&&w.rgb?e.cl.rgb:m}),[y,O]=_.useState(()=>{var w;const m="#e8ecfc";return(w=e==null?void 0:e.bg)!=null&&w.rgb?e.bg.rgb:m}),R=o.get("BoldSingle"),I=o.get("ItalicSingle"),b=o.get("UnderlineSingle"),x=o.get("StrikethroughSingle");return _.useEffect(()=>{const m={bl:i,it:c};v!==void 0&&(m.cl={rgb:v}),y!==void 0&&(m.bg={rgb:y}),p!==void 0&&(m.st={s:p}),u!==void 0&&(m.ul={s:u}),n(l.removeUndefinedAttr(m))},[i,c,u,p,v,y]),g.jsxs("div",{className:`${Ue.cfStyleEdit} ${r}`,children:[R&&g.jsx("div",{className:At({[Ue.isActive]:kt(i||d.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>a(zt(i)),children:g.jsx(R,{})}),I&&g.jsx("div",{className:At({[Ue.isActive]:kt(c||d.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>s(zt(c)),children:g.jsx(I,{})}),b&&g.jsx("div",{className:At({[Ue.isActive]:kt(u||d.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>f(zt(u)),children:g.jsx(b,{})}),x&&g.jsx("div",{className:At({[Ue.isActive]:kt(p||d.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>h(zt(p)),children:g.jsx(x,{})}),g.jsx(Ze,{color:v,onChange:S,iconId:"FontColor"}),g.jsx(Ze,{color:y,onChange:O,iconId:"PaintBucket"})]})},Ic=t=>{var x;const{onChange:e,interceptorManager:n}=t,r=d.useDependency(d.LocaleService),i=d.useDependency(d.IUniverInstanceService).getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),a=i.getActiveSheet(),c=((x=t.rule)==null?void 0:x.type)===l.CFRuleType.highlightCell?t.rule:void 0,s=_.useRef(null),[u,f]=_.useState(!1),p=_.useRef({}),[h,v]=_.useState({}),[S,y]=_.useState(()=>(c==null?void 0:c.subType)===l.CFSubRuleType.formula?c.value:"="),[O,R]=_.useState(void 0),I=m=>({style:m.style,value:S,type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.formula});_.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return I({style:h,formula:S})}}),[h,S,n]),_.useEffect(()=>n.intercept(n.getInterceptPoints().beforeSubmit,{handler:(w,T,E)=>O||S.length===1||!S.startsWith("=")?(R(r.t("sheet.cf.errorMessage.formulaError")),!1):E(w)}),[O,S]);const b=m=>{e(I(m))};return ve.useSidebarClick(m=>{var T;const w=(T=p.current)==null?void 0:T.handleOutClick;w&&w(m,()=>f(!1))}),g.jsxs("div",{ref:s,children:[g.jsx("div",{className:`${F.title} ${F.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),g.jsx("div",{className:`${F.mTSm}`,children:g.jsx(xt.FormulaEditor,{onChange:m=>{y(m),b({style:h,formula:m})},onVerify:(m,w)=>{!m||w.length===1?R(r.t("sheet.cf.errorMessage.formulaError")):R(void 0)},errorText:O,onFocus:()=>{f(!0)},actions:p.current,isFocus:u,initValue:S,unitId:i.getUnitId(),subUnitId:a==null?void 0:a.getSheetId()})}),g.jsx("div",{className:`${N.cfPreviewWrap} `,children:g.jsx(dt,{rule:I({style:h,formula:S})})}),g.jsx(Rr,{style:c==null?void 0:c.style,className:`${F.mTSm} `,onChange:m=>{v(m),b({style:m,formula:S})}})]})},Ht=t=>g.jsxs("div",{style:{position:"relative"},children:[g.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:t.errorText}),t.children]}),ee=(t,e)=>({label:e.t(`sheet.cf.operator.${t}`),value:t}),_c=t=>{const{type:e,operator:n,onChange:r,value:o,interceptorManager:i}=t,a=d.useDependency(d.LocaleService),[c,s]=_.useState(()=>typeof o=="number"?o:0),[u,f]=_.useState(""),[p,h]=_.useState(()=>typeof o=="string"?o:""),[v,S]=_.useState(""),[y,O]=_.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[R,I]=_.useState(""),[b,x]=_.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100),[m,w]=_.useState("");switch(_.useEffect(()=>{switch(e){case l.CFSubRuleType.text:{[l.CFTextOperator.beginsWith,l.CFTextOperator.endsWith,l.CFTextOperator.containsText,l.CFTextOperator.notContainsText,l.CFTextOperator.equal,l.CFTextOperator.notEqual].includes(n)&&r(p);break}case l.CFSubRuleType.number:{[l.CFNumberOperator.equal,l.CFNumberOperator.notEqual,l.CFNumberOperator.greaterThan,l.CFNumberOperator.greaterThanOrEqual,l.CFNumberOperator.lessThan,l.CFNumberOperator.lessThanOrEqual].includes(n)&&r(c),[l.CFNumberOperator.between,l.CFNumberOperator.notBetween].includes(n)&&r([y,b]);break}}},[e]),_.useEffect(()=>{const T=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(E,D,$)=>{switch(e){case l.CFSubRuleType.text:if([l.CFTextOperator.beginsWith,l.CFTextOperator.containsText,l.CFTextOperator.endsWith,l.CFTextOperator.notEqual,l.CFTextOperator.notContainsText,l.CFTextOperator.equal].includes(n))return p?$(E):(S(a.t("sheet.cf.errorMessage.notBlank")),!1)}return $(E)}});return()=>{T()}},[e,c,p,n]),e){case l.CFSubRuleType.text:{if([l.CFTextOperator.beginsWith,l.CFTextOperator.endsWith,l.CFTextOperator.containsText,l.CFTextOperator.notContainsText,l.CFTextOperator.equal,l.CFTextOperator.notEqual].includes(n)){const T=E=>{h(E),r(E)};return g.jsx("div",{className:`${F.mTSm}`,children:g.jsx(Ht,{errorText:v,children:g.jsx(B.Input,{className:N.width100,value:p,onChange:E=>{S(""),T(E)}})})})}break}case l.CFSubRuleType.number:{if([l.CFNumberOperator.equal,l.CFNumberOperator.notEqual,l.CFNumberOperator.greaterThan,l.CFNumberOperator.greaterThanOrEqual,l.CFNumberOperator.lessThan,l.CFNumberOperator.lessThanOrEqual].includes(n)){const T=E=>{s(E||0),r(E||0),f("")};return g.jsx("div",{className:`${F.mTSm}`,children:g.jsx(Ht,{errorText:u,children:g.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:N.width100,value:c,onChange:T})})})}if([l.CFNumberOperator.between,l.CFNumberOperator.notBetween].includes(n)){const T=D=>{O(D||0),r([D||0,b]),I("")},E=D=>{x(D||0),r([y,D||0]),w("")};return g.jsxs("div",{className:`${F.mTSm} ${F.labelContainer} `,children:[g.jsx(Ht,{errorText:R,children:g.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:y,onChange:T})}),g.jsx(Ht,{errorText:m,children:g.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${F.mLSm}`,value:b,onChange:E})})]})}}}return null},zr=(t,e)=>{switch(t){case l.CFSubRuleType.text:return[ee(l.CFTextOperator.containsText,e),ee(l.CFTextOperator.notContainsText,e),ee(l.CFTextOperator.beginsWith,e),ee(l.CFTextOperator.endsWith,e),ee(l.CFTextOperator.equal,e),ee(l.CFTextOperator.notEqual,e),ee(l.CFTextOperator.containsBlanks,e),ee(l.CFTextOperator.notContainsBlanks,e),ee(l.CFTextOperator.containsErrors,e),ee(l.CFTextOperator.notContainsErrors,e)];case l.CFSubRuleType.number:return[ee(l.CFNumberOperator.between,e),ee(l.CFNumberOperator.notBetween,e),ee(l.CFNumberOperator.equal,e),ee(l.CFNumberOperator.notEqual,e),ee(l.CFNumberOperator.greaterThan,e),ee(l.CFNumberOperator.greaterThanOrEqual,e),ee(l.CFNumberOperator.lessThan,e),ee(l.CFNumberOperator.lessThanOrEqual,e)];case l.CFSubRuleType.timePeriod:return[ee(l.CFTimePeriodOperator.yesterday,e),ee(l.CFTimePeriodOperator.today,e),ee(l.CFTimePeriodOperator.tomorrow,e),ee(l.CFTimePeriodOperator.last7Days,e),ee(l.CFTimePeriodOperator.lastWeek,e),ee(l.CFTimePeriodOperator.thisWeek,e),ee(l.CFTimePeriodOperator.nextWeek,e),ee(l.CFTimePeriodOperator.lastMonth,e),ee(l.CFTimePeriodOperator.thisMonth,e),ee(l.CFTimePeriodOperator.nextMonth,e)]}},kr=t=>{var x;const{interceptorManager:e,onChange:n}=t,r=d.useDependency(d.LocaleService),o=((x=t.rule)==null?void 0:x.type)===l.CFRuleType.highlightCell?t.rule:void 0,[i,a]=_.useState(()=>{const m=l.CFSubRuleType.text;return o&&o.subType||m}),c=[{value:l.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:l.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:l.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:l.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:l.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],s=_.useMemo(()=>zr(i,r),[i]),[u,f]=_.useState(()=>{const m=s?s[0].value:void 0;return o&&o.operator||m}),[p,h]=_.useState(()=>{var T;const m="";return o?(T=o.value)!=null?T:l.createDefaultValue(o.subType,o.operator):m}),[v,S]=_.useState({}),y=_.useMemo(()=>m=>{var w,T,E,D,$,z,q,C,M,A,Q,X,ue,ae,L;switch(m.subType||i){case l.CFSubRuleType.text:{if([l.CFTextOperator.beginsWith,l.CFTextOperator.endsWith,l.CFTextOperator.containsText,l.CFTextOperator.notContainsText,l.CFTextOperator.equal,l.CFTextOperator.notEqual].includes(u))return{type:l.CFRuleType.highlightCell,subType:(w=m.subType)!=null?w:i,operator:(T=m.operator)!=null?T:u,style:(E=m.style)!=null?E:v,value:(D=m.value)!=null?D:p};break}case l.CFSubRuleType.number:{if([l.CFNumberOperator.equal,l.CFNumberOperator.notEqual,l.CFNumberOperator.greaterThan,l.CFNumberOperator.greaterThanOrEqual,l.CFNumberOperator.lessThan,l.CFNumberOperator.lessThanOrEqual].includes(u))return{type:l.CFRuleType.highlightCell,subType:($=m.subType)!=null?$:i,operator:(z=m.operator)!=null?z:u,style:(q=m.style)!=null?q:v,value:(C=m.value)!=null?C:p};if([l.CFNumberOperator.between,l.CFNumberOperator.notBetween].includes(u))return{type:l.CFRuleType.highlightCell,subType:(M=m.subType)!=null?M:i,operator:(A=m.operator)!=null?A:u,style:(Q=m.style)!=null?Q:v,value:(X=m.value)!=null?X:p};break}}return{type:l.CFRuleType.highlightCell,subType:(ue=m.subType)!=null?ue:i,operator:(ae=m.operator)!=null?ae:u,style:(L=m.style)!=null?L:v}},[i,u,p,v]);_.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return y({})}}),[y,e]),_.useEffect(()=>{c.some(m=>m.value===i)||a(c[0].value)},[c]);const O=m=>{const w=m,T=zr(w,r),E=T&&T[0].value;a(w),f(E),E&&h(l.createDefaultValue(w,E)),n(y({subType:w,operator:E}))},R=m=>{const w=m;f(w),n(y({operator:w}))},I=m=>{h(m),n(y({value:m}))},b=_.useMemo(()=>`${i}_${u}_${Math.random()}`,[i,u]);return g.jsxs("div",{children:[g.jsx("div",{className:`${F.title} ${F.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),g.jsx(B.Select,{className:`${F.mTSm} ${N.width100}`,onChange:O,value:i,options:c}),(s==null?void 0:s.length)&&g.jsx(B.Select,{className:`${F.mTSm} ${N.width100}`,onChange:R,value:u||"",options:s}),g.jsx(_c,{value:p,interceptorManager:e,type:i,operator:u,rule:o,onChange:I},b),g.jsx("div",{className:`${N.cfPreviewWrap}`,children:g.jsx(dt,{rule:y({})})}),g.jsx(Rr,{style:o==null?void 0:o.style,className:`${F.mLXxs}`,onChange:m=>{S(m),n(y({style:m}))}})]})},Go=(t,e)=>(l.iconMap[t]||[])[Number(e)]||"",xc=t=>{var s;const e=d.useDependency(d.IUniverInstanceService),n=e.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=(s=e.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:s.getSheetId(),o=_.useMemo(()=>t.error?N.errorInput:"",[t.error]),i=_.useRef({}),[a,c]=_.useState(!1);return ve.useSidebarClick(u=>{var p;const f=(p=i.current)==null?void 0:p.handleOutClick;f&&f(u,()=>c(!1))}),g.jsx("div",{className:N.positionRelative,children:t.type!==l.CFValueType.formula?g.jsxs(g.Fragment,{children:[g.jsx(B.InputNumber,{className:o,value:Number(t.value)||0,onChange:u=>t.onChange(u!=null?u:0)}),t.error&&g.jsx("div",{className:N.errorText,children:t.error})]}):g.jsx("div",{style:{width:"100%"},children:g.jsx(xt.FormulaEditor,{initValue:String(t.value),unitId:n,subUnitId:r,isFocus:a,onChange:(u="")=>{const f=u||"";t.onChange(f)},onFocus:()=>c(!0),actions:i.current})})})},Hr=(t,e,n)=>({operator:l.CFNumberOperator.greaterThan,value:{type:l.CFValueType.num,value:(n.length-1-e)*10},iconType:t,iconId:String(e)}),Ec=_.forwardRef((t,e)=>{const n=d.useDependency(d.LocaleService),r=o=>{t.onClick(o)};return g.jsx("div",{ref:e,className:N.iconGroupList,children:l.iconGroup.map((o,i)=>g.jsxs("div",{className:N.group,children:[g.jsx("div",{className:N.title,children:n.t(o.title)}),g.jsx("div",{className:N.itemContent,children:o.group.map(a=>g.jsx("div",{className:N.itemWrap,onClick:()=>{r(a.name)},children:g.jsx("div",{className:N.item,children:a.list.map((c,s)=>g.jsx("img",{className:N.icon,src:c},s))})},a.name))})]},i))})}),Oc=t=>{const e=_.useMemo(()=>{const r=[];for(const o in l.iconMap){const i=l.iconMap[o],a=o;i.forEach((c,s)=>{r.push({iconType:a,base64:c,iconId:String(s)})})}return r},[]),n=r=>{t.onClick(r.iconType,r.iconId)};return g.jsxs("div",{className:N.iconItemListWrap,children:[g.jsxs("div",{className:N.none,onClick:()=>n({iconType:l.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[g.jsx(Ot,{className:N.icon}),g.jsx("span",{children:"无单元格图标"})]}),g.jsx("div",{className:N.iconItemList,children:e.map(r=>g.jsx("div",{className:N.item,children:g.jsx("img",{onClick:()=>n(r),className:`${N.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},Mc=t=>{const{onChange:e,configList:n,errorMap:r={}}=t,o=d.useDependency(d.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${l.CFNumberOperator.greaterThan}`),value:l.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${l.CFNumberOperator.greaterThanOrEqual}`),value:l.CFNumberOperator.greaterThanOrEqual}],a=[{label:o.t(`sheet.cf.valueType.${l.CFValueType.num}`),value:l.CFValueType.num},{label:o.t(`sheet.cf.valueType.${l.CFValueType.percent}`),value:l.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${l.CFValueType.percentile}`),value:l.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${l.CFValueType.formula}`),value:l.CFValueType.formula}],c=(p,h)=>{e([String(h),"value","value"],p)},s=(p,h)=>{e([String(h),"operator"],p);const v=l.createDefaultValue(l.CFSubRuleType.number,p);c(v,h)},u=(p,h)=>{e([String(h),"value","type"],p);const v=n[h],S=l.createDefaultValue(l.CFSubRuleType.number,v.operator);c(S,h)};return _.useMemo(()=>n.map((p,h)=>{const v=r[h],S=Go(p.iconType,p.iconId),y=h===n.length-1,O=h===0,R=n[h-1],I=(R==null?void 0:R.value.type)===l.CFValueType.formula?o.t("sheet.cf.valueType.formula"):R==null?void 0:R.value.value,b=(x,m)=>{const w={...p,iconId:m,iconType:x};e([String(h)],w)};return g.jsxs("div",{className:`${h?F.mTXl:F.mTSm}`,children:[g.jsxs("div",{className:`${F.label} ${N.flex}`,children:[g.jsxs("div",{className:`${N.width45}`,children:[o.t("sheet.cf.iconSet.icon"),h+1]}),g.jsx("div",{className:`${N.width45}`,children:g.jsxs(g.Fragment,{children:[!O&&!y&&o.t("sheet.cf.iconSet.rule"),!O&&!y&&g.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${l.getOppositeOperator(R.operator)}`),I,y?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),g.jsxs("div",{className:`${N.flex} ${F.mTSm}`,children:[g.jsx("div",{className:`${N.iconWrap} ${N.width45}`,children:g.jsx(B.Dropdown,{overlay:g.jsx(Oc,{onClick:b,iconId:p.iconId,iconType:p.iconType}),children:g.jsxs("div",{className:N.dropdownIcon,children:[S?g.jsx("img",{src:S,className:N.icon}):g.jsx(Ot,{className:N.icon}),g.jsx(rn,{})]})})}),y?g.jsxs("div",{className:`${N.width45} ${F.label}`,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),g.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${l.getOppositeOperator(R.operator)}`),I,y?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):g.jsx(B.Select,{className:`${F.mL0} ${N.width45} ${F.mR0}`,options:i,value:p.operator,onChange:x=>{s(x,h)}})]}),y?g.jsx("div",{}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:`${F.mTSm} ${F.label} ${N.flex}`,children:[g.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.type")}),g.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.value")})]}),g.jsxs("div",{className:`${F.mTSm} ${N.flex}`,children:[g.jsx(B.Select,{style:{flexShrink:0},className:`${N.width45} ${F.mL0}`,options:a,value:p.value.type,onChange:x=>{u(x,h)}}),g.jsx("div",{className:`${F.mL0} ${N.width45}`,children:g.jsx(xc,{id:h,type:p.value.type,error:v,value:p.value.value||"",onChange:x=>c(x,h)})})]})]})]},h)}),[n,r])},Fc=t=>{var x;const{interceptorManager:e}=t,n=((x=t.rule)==null?void 0:x.type)===l.CFRuleType.iconSet?t.rule:void 0,r=d.useDependency(d.LocaleService),[o,i]=_.useState({}),[a,c]=_.useState(()=>{const m=Object.keys(l.iconMap)[0];if(n&&n.config.length){const w=n.config[0].iconType;if(!n.config.some(E=>E.iconType!==w))return w}return m}),[s,u]=_.useState(()=>{if(n&&n.config.length)return d.Tools.deepClone(n==null?void 0:n.config);const m=l.iconMap[a]||[];return new Array(m.length).fill("").map((w,T,E)=>T===E.length-1?{operator:l.CFNumberOperator.lessThanOrEqual,value:{type:l.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:a,iconId:String(T)}:Hr(a,T,E))}),[f,p]=_.useState(()=>n?!!n.isShowValue:!0),h=_.useMemo(()=>{const m=s.map(w=>Go(w.iconType,w.iconId));return g.jsx("div",{className:N.iconWrap,children:m.map((w,T)=>w?g.jsx("img",{className:N.icon,src:w},T):g.jsx(Ot,{className:N.icon},T))})},[s]),v=m=>{if(m.reduce((T,E,D)=>T.preType&&!T.result||m.length-1===D?T:E.value.type===l.CFValueType.formula?{preType:l.CFValueType.formula,result:!1}:T.preType?{result:T.preType===E.value.type,preType:E.value.type}:{result:!0,preType:E.value.type},{result:!0,preType:""}).result&&[l.CFValueType.num,l.CFValueType.percent,l.CFValueType.percentile].includes(m[0].value.type)){const T={};return m.forEach((E,D,$)=>{if(D-1<0||D===$.length-1)return;const q=m[D-1],C=l.getOppositeOperator(q.operator);l.compareWithNumber({operator:C,value:q.value.value},E.value.value)||(T[D]=`${r.t(`sheet.cf.form.${C}`,String(q.value.value))} `)}),T}return{}},S=(m,w)=>{d.get(s,m)!==w&&(d.set(s,m,w),u([...s]),i(v(s)))},y=m=>{c(m);const w=l.iconMap[m]||[],T=new Array(w.length).fill("").map((E,D,$)=>Hr(m,D,$));u(T),i(v(T))};_.useEffect(()=>{const m=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:l.CFRuleType.iconSet,isShowValue:f,config:s}}});return()=>{m()}},[f,s,e]),_.useEffect(()=>{const m=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{m()}},[f,s,e,o]);const O=()=>{const m=s.map(w=>({...w}));s.forEach((w,T)=>{const E=s.length-1-T,D=m[E];w.iconId=D.iconId,w.iconType=D.iconType}),u([...s])},R=d.useDependency(ve.ILayoutService),[I,b]=_.useState();return ve.useScrollYOverContainer(I,R.rootContainerElement),g.jsxs("div",{className:N.iconSet,children:[g.jsx("div",{className:F.title,children:r.t("sheet.cf.panel.styleRule")}),g.jsx("div",{className:`${F.mTSm}`,children:g.jsx(B.Dropdown,{placement:"bottomLeft",overlay:g.jsx(Ec,{ref:m=>!I&&m&&b(m),iconType:a,onClick:y}),children:g.jsxs("div",{className:N.dropdownIcon,style:{width:"unset"},children:[h,g.jsx(rn,{})]})})}),g.jsxs("div",{className:`${F.mTSm} ${N.renderConfig}`,children:[g.jsxs("div",{className:N.utilItem,children:[g.jsx(B.Checkbox,{onChange:O}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),g.jsxs("div",{className:`${N.utilItem} ${F.mLXl}`,children:[g.jsx(B.Checkbox,{checked:!f,onChange:m=>{p(!m)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),g.jsx(Mc,{errorMap:o,onChange:S,configList:s})]})},Pc=t=>{var O;const{onChange:e,interceptorManager:n}=t,r=d.useDependency(d.LocaleService),o=((O=t.rule)==null?void 0:O.type)===l.CFRuleType.highlightCell?t.rule:void 0,i=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[a,c]=_.useState(()=>{const R=i[0].value,I=o==null?void 0:o.type;if(!o)return R;switch(I){case l.CFRuleType.highlightCell:switch(o.subType){case l.CFSubRuleType.average:return[l.CFNumberOperator.greaterThan,l.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[l.CFNumberOperator.lessThan,l.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":R;case l.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return R}),[s,u]=_.useState(()=>{const I=o==null?void 0:o.type;if(!o)return 10;switch(I){case l.CFRuleType.highlightCell:switch(o.subType){case l.CFSubRuleType.rank:return o.value||10}}return 10}),[f,p]=_.useState(()=>{const I=o==null?void 0:o.type;if(!o)return!1;switch(I){case l.CFRuleType.highlightCell:switch(o.subType){case l.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[h,v]=_.useState({}),S=R=>{const{type:I,isPercent:b,value:x,style:m}=R;if(I==="isNotBottom")return{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.rank,isPercent:b,isBottom:!1,value:x,style:m};if(I==="isBottom")return{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.rank,isPercent:b,isBottom:!0,value:x,style:m};if(I==="greaterThanAverage")return{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.average,operator:l.CFNumberOperator.greaterThan,style:m};if(I==="lessThanAverage")return{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.average,operator:l.CFNumberOperator.lessThan,style:m}};_.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return S({type:a,isPercent:f,value:s,style:h})}}),[a,f,s,h,n]);const y=R=>{e(S(R))};return g.jsxs("div",{children:[g.jsx("div",{className:`${F.title} ${F.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),g.jsx(B.Select,{className:`${N.width100} ${F.mTSm}`,value:a,options:i,onChange:R=>{c(R),y({type:R,isPercent:f,value:s,style:h})}}),["isNotBottom","isBottom"].includes(a)&&g.jsxs("div",{className:`${F.labelContainer} ${F.mTSm}`,children:[g.jsx(B.InputNumber,{min:1,max:1e3,value:s,onChange:R=>{const I=R||0;u(I),y({type:a,isPercent:f,value:I,style:h})}}),g.jsxs("div",{className:`${F.mLSm} ${F.labelContainer} ${N.text}`,children:[g.jsx(B.Checkbox,{checked:f,onChange:R=>{p(!!R),y({type:a,isPercent:!!R,value:s,style:h})}}),r.t("sheet.cf.valueType.percent")]})]}),g.jsx("div",{className:`${N.cfPreviewWrap} `,children:g.jsx(dt,{rule:S({type:a,isPercent:f,value:s,style:h})})}),g.jsx(Rr,{style:o==null?void 0:o.style,className:`${F.mTSm} `,onChange:R=>{v(R),y({type:a,isPercent:f,value:s,style:R})}})]})},Dc=d.createInterceptorKey("beforeSubmit"),Nc=d.createInterceptorKey("submit"),Wr=t=>t.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),qr=t=>{var e;return(e=t.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},jc=t=>{var $,z,q;const e=d.useDependency(d.LocaleService),n=d.useDependency(d.ICommandService),r=d.useDependency(d.IUniverInstanceService),o=d.useDependency(l.ConditionalFormattingRuleModel),i=d.useDependency(j.SheetsSelectionsService),a=Wr(r),c=qr(r),[s,u]=_.useState(!0),f=_.useRef({}),[p,h]=_.useState(void 0),v=_.useRef((z=($=t.rule)==null?void 0:$.ranges)!=null?z:[]),S=_.useMemo(()=>{var M,A,Q;let C=(M=t.rule)==null?void 0:M.ranges;return C!=null&&C.length||(C=(Q=(A=i.getCurrentSelections())==null?void 0:A.map(X=>X.range))!=null?Q:[]),v.current=C,C!=null&&C.length?C.map(X=>{const ue=Fn.serializeRange(X);return ue==="NaN"?"":ue}).filter(X=>!!X).join(","):""},[t.rule]),y=[{label:e.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:e.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:e.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:e.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:e.t("sheet.cf.ruleType.formula"),value:"5"},{label:e.t("sheet.cf.ruleType.iconSet"),value:"6"}],[O,R]=_.useState(()=>{var A,Q;const C=(A=t.rule)==null?void 0:A.rule.type,M=y[0].value;if(!C)return M;switch(C){case l.CFRuleType.highlightCell:{switch((Q=t.rule)==null?void 0:Q.rule.subType){case l.CFSubRuleType.number:case l.CFSubRuleType.text:case l.CFSubRuleType.duplicateValues:case l.CFSubRuleType.uniqueValues:case l.CFSubRuleType.timePeriod:return"1";case l.CFSubRuleType.average:case l.CFSubRuleType.rank:return"2";case l.CFSubRuleType.formula:return"5"}break}case l.CFRuleType.dataBar:return"3";case l.CFRuleType.colorScale:return"4";case l.CFRuleType.iconSet:return"6"}return M}),I=_.useRef(),b=_.useMemo(()=>new d.InterceptorManager({beforeSubmit:Dc,submit:Nc}),[]),x=_.useMemo(()=>{switch(O){case"1":return kr;case"2":return Pc;case"3":return bc;case"4":return Sc;case"5":return Ic;case"6":return Fc;default:return kr}},[O]);_.useEffect(()=>{const C=n.onCommandExecuted(M=>{if(M.id===j.RemoveSheetMutation.id){const A=M.params;A.subUnitId===c&&A.unitId===a&&t.onCancel()}M.id===j.SetWorksheetActiveOperation.id&&t.onCancel()});return()=>C.dispose()},[]);const m=C=>{I.current=C},w=C=>{const M=C.split(",").filter(A=>!!A).map(Fn.deserializeRangeWithSheet).map(A=>A.range);v.current=M},T=()=>{if(p)return;const M=(()=>{const Q=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!Q)throw new Error("No active sheet found");return v.current.map(ae=>j.setEndForRange(ae,Q.getRowCount(),Q.getColumnCount())).filter(ae=>!(Number.isNaN(ae.startRow)||Number.isNaN(ae.startColumn)))})();if(b.fetchThroughInterceptors(b.getInterceptPoints().beforeSubmit)(!0,null)){const Q=b.fetchThroughInterceptors(b.getInterceptPoints().submit)(null,null);if(Q){const X=Wr(r),ue=qr(r);if(!X||!ue)throw new Error("No active sheet found");let ae={};t.rule&&t.rule.cfId?(ae={...t.rule,ranges:M,rule:Q},n.executeCommand(yn.id,{unitId:X,subUnitId:ue,rule:ae}),t.onCancel()):(ae={cfId:o.createCfId(X,ue),ranges:M,rule:Q,stopIfTrue:!1},n.executeCommand(Dt.id,{unitId:X,subUnitId:ue,rule:ae}),t.onCancel())}}},E=()=>{t.onCancel()},D=(C,M)=>{C?M.length<1?h(e.t("sheet.cf.errorMessage.rangeError")):h(void 0):h(e.t("sheet.cf.errorMessage.rangeError"))};return ve.useSidebarClick(C=>{var A;const M=(A=f.current)==null?void 0:A.handleOutClick;M&&M(C,()=>u(!1))}),g.jsxs("div",{className:N.cfRuleStyleEditor,children:[g.jsx("div",{className:F.title,children:e.t("sheet.cf.panel.range")}),g.jsx("div",{className:`${F.mTBase}`,children:g.jsx(xt.RangeSelector,{unitId:a,errorText:p,subUnitId:c,initValue:S,onChange:w,onVerify:D,onFocus:()=>u(!0),isFocus:s,actions:f.current})}),g.jsx("div",{className:F.title,children:e.t("sheet.cf.panel.styleType")}),g.jsx("div",{className:F.mTBase,children:g.jsx(B.Select,{className:N.width100,value:O,options:y,onChange:C=>R(C)})}),g.jsx(x,{interceptorManager:b,rule:(q=t.rule)==null?void 0:q.rule,onChange:m}),g.jsxs("div",{className:`${F.mTBase} ${N.btnList}`,children:[g.jsx(B.Button,{size:"small",onClick:E,children:e.t("sheet.cf.panel.cancel")}),g.jsx(B.Button,{className:F.mLSm,size:"small",type:"primary",onClick:T,children:e.t("sheet.cf.panel.submit")})]})]})},$c=t=>{const[e,n]=_.useState(t.rule),[r,o]=_.useState(!!t.rule),i=()=>{o(!0)},a=()=>{o(!1),n(void 0)},c=s=>{n(s),o(!0)};return g.jsx("div",{className:F.conditionalFormattingWrap,children:r?g.jsx(jc,{onCancel:a,rule:e}):g.jsx(Wl,{onClick:c,onCreate:i})})};var Lc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,Vc=(t,e,n,r)=>{for(var o=r>1?void 0:r?Uc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Lc(e,n,o),o},ht=(t,e)=>(n,r)=>e(n,r,t);const Wt="sheet.conditional.formatting.panel";let Rt=class extends d.Disposable{constructor(e,n,r,o,i){super();Ae(this,"_sidebarDisposable",null);this._univerInstanceService=e,this._injector=n,this._componentManager=r,this._sidebarService=o,this._localeService=i,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(d.UniverInstanceType.UNIVER_SHEET).subscribe(a=>{var c;a||(c=this._sidebarDisposable)==null||c.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(a=>{a.id===Wt&&(a.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const n={id:Wt,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Wt,rule:e,key:d.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initPanel(){this._componentManager.register(Wt,$c)}};Rt=Vc([ht(0,d.IUniverInstanceService),ht(1,d.Inject(d.Injector)),ht(2,d.Inject(ve.ComponentManager)),ht(3,d.Inject(ve.ISidebarService)),ht(4,d.Inject(d.LocaleService))],Rt);var Te=(t=>(t[t.createRule=1]="createRule",t[t.viewRule=2]="viewRule",t[t.highlightCell=3]="highlightCell",t[t.rank=4]="rank",t[t.formula=5]="formula",t[t.colorScale=6]="colorScale",t[t.dataBar=7]="dataBar",t[t.icon=8]="icon",t[t.clearRangeRules=9]="clearRangeRules",t[t.clearWorkSheetRules=10]="clearWorkSheetRules",t))(Te||{});const Nt={id:"sheet.operation.open.conditional.formatting.panel",type:d.CommandType.OPERATION,handler:(t,e)=>{var c;const n=t.get(Rt),r=t.get(j.SheetsSelectionsService),o=t.get(d.ICommandService),i=((c=r.getCurrentSelections())==null?void 0:c.map(s=>s.range))||[];switch(e.value){case 3:{n.openPanel({...l.createDefaultRule(),ranges:i});break}case 4:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.rank}};n.openPanel(s);break}case 5:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.highlightCell,subType:l.CFSubRuleType.formula,value:"="}};n.openPanel(s);break}case 6:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.colorScale,config:[]}};n.openPanel(s);break}case 7:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(s);break}case 8:{const s={...l.createDefaultRule,ranges:i,rule:{type:l.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(s);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...l.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(tn.id,{ranges:i});break}case 10:{o.executeCommand(Et.id);break}}return!0}};var Ac=Object.defineProperty,zc=Object.getOwnPropertyDescriptor,kc=(t,e,n,r)=>{for(var o=r>1?void 0:r?zc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Ac(e,n,o),o},ot=(t,e)=>(n,r)=>e(n,r,t);let Tt=class extends d.Disposable{constructor(e,n,r,o,i,a){super();Ae(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=n,this._univerInstanceService=r,this._renderManagerService=o,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=a,this._initViewModelInterceptor(),this._initViewModel(),this._initSkeleton(),this._initVmEffectByRule(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}markDirtySkeleton(){var n,r,o;const e=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId();(n=this._renderManagerService.getRenderById(e))==null||n.with(oe.SheetSkeletonManagerService).reCalculate(),(o=(r=this._renderManagerService.getRenderById(e))==null?void 0:r.mainComponent)==null||o.makeDirty()}_initSkeleton(){this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(He.bufferTime(16),He.filter(e=>{const n=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?e.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this.markDirtySkeleton())),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(He.bufferTime(16),He.filter(e=>{const n=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?e.filter(o=>["sort","delete"].includes(o.type)&&o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this.markDirtySkeleton())),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(He.bufferTime(16),He.filter(e=>{const n=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?e.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this.markDirtySkeleton()))}_initVmEffectByRule(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{const{rule:n,unitId:r,subUnitId:o}=e;switch(e.type){case"add":{this._handleRuleAdd(r,o,n);return}case"delete":{n.ranges.forEach(i=>{d.Range.foreach(i,(a,c)=>{this._conditionalFormattingViewModel.deleteCellCf(r,o,a,c,n.cfId)})}),this._conditionalFormattingViewModel.markRuleDirty(r,o,n);return}case"set":{this._handleRuleChange(r,o,n,e.oldRule);return}case"sort":{const a=this._conditionalFormattingRuleModel.getSubunitRules(r,o).map(c=>c.cfId).reduce((c,s,u)=>(c.set(s,u),c),new Map);n.ranges.forEach(c=>{d.Range.foreach(c,(s,u)=>{this._conditionalFormattingViewModel.sortCellCf(r,o,s,u,a)})})}}}))}_initViewModel(){let e=!1;this._univerInstanceService.getAllUnitsForType(d.UniverInstanceType.UNIVER_SHEET).forEach(r=>{const o=r.getUnitId(),i=this._conditionalFormattingRuleModel.getUnitRules(o);i&&[...i.keys()].forEach(a=>{i.get(a).forEach(s=>{this._handleRuleAdd(o,a,s),e=!0})})}),e&&this.markDirtySkeleton()}_handleRuleAdd(e,n,r){const i=this._conditionalFormattingRuleModel.getSubunitRules(e,n).map(a=>a.cfId).reduce((a,c,s)=>(a.set(c,s),a),new Map);r.ranges.forEach(a=>{d.Range.foreach(a,(c,s)=>{this._conditionalFormattingViewModel.pushCellCf(e,n,c,s,r.cfId),this._conditionalFormattingViewModel.sortCellCf(e,n,c,s,i)})}),this._conditionalFormattingViewModel.markRuleDirty(e,n,r)}_handleRuleChange(e,n,r,o){const a=this._conditionalFormattingRuleModel.getSubunitRules(e,n).map(u=>u.cfId).reduce((u,f,p)=>(u.set(f,p),u),new Map),c=(u,f)=>{u.ranges.forEach(p=>{d.Range.foreach(p,(h,v)=>{this._conditionalFormattingViewModel.deleteCellCf(e,n,h,v,u.cfId)})}),f.ranges.forEach(p=>{d.Range.foreach(p,(h,v)=>{this._conditionalFormattingViewModel.pushCellCf(e,n,h,v,u.cfId),this._conditionalFormattingViewModel.sortCellCf(e,n,h,v,a)})})},s=this._conditionalFormattingService.interceptorManager.intercept(this._conditionalFormattingService.interceptorManager.getInterceptPoints().beforeUpdateRuleResult,{handler:(u,f,p)=>{if(e===(u==null?void 0:u.unitId)&&n===u.subUnitId&&o.cfId===u.cfId){(this._ruleChangeCacheMap.get(u.cfId)||[]).forEach(v=>{c(v.oldRule,v.rule),v.dispose()}),this._ruleChangeCacheMap.delete(u.cfId);return}p(u)}});if(o.cfId===r.cfId){let u=this._ruleChangeCacheMap.get(o.cfId);u||(u=[],this._ruleChangeCacheMap.set(o.cfId,u)),u.push({oldRule:o,rule:r,dispose:s})}r.ranges.forEach(u=>{d.Range.foreach(u,(f,p)=>{this._conditionalFormattingViewModel.pushCellCf(e,n,f,p,o.cfId)})}),this._conditionalFormattingViewModel.markRuleDirty(e,n,r)}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(j.INTERCEPTOR_POINT.CELL_CONTENT,{effect:d.InterceptorEffectEnum.Style,handler:(e,n,r)=>{const o=this._conditionalFormattingService.composeStyle(n.unitId,n.subUnitId,n.row,n.col);if(!o)return r(e);const i=n.workbook.getStyles(),c={...(typeof(e==null?void 0:e.s)=="string"?i.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},s={...e,s:c};return o.style&&Object.assign(c,o.style),s.fontRenderExtension||(s.fontRenderExtension={},o.isShowValue!==void 0&&(s.fontRenderExtension.isSkip=!o.isShowValue)),o.dataBar&&(s.dataBar=o.dataBar),o.iconSet&&(s.iconSet=o.iconSet,s.fontRenderExtension.leftOffset=l.DEFAULT_PADDING+l.DEFAULT_WIDTH),r(s)},priority:10}))}};Tt=kc([ot(0,d.Inject(j.SheetInterceptorService)),ot(1,d.Inject(l.ConditionalFormattingService)),ot(2,d.Inject(d.IUniverInstanceService)),ot(3,d.Inject(ni.IRenderManagerService)),ot(4,d.Inject(l.ConditionalFormattingViewModel)),ot(5,d.Inject(l.ConditionalFormattingRuleModel))],Tt);var Hc=Object.defineProperty,Wc=Object.getOwnPropertyDescriptor,qc=(t,e,n,r)=>{for(var o=r>1?void 0:r?Wc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Hc(e,n,o),o},mt=(t,e)=>(n,r)=>e(n,r,t);let wt=class extends d.Disposable{constructor(e,n,r,o,i){super();Ae(this,"_copyInfo");this._sheetClipboardService=e,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=o,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:l.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,n,r)=>this._collectConditionalRule(e,n,r),onPasteCells:(e,n,r,o)=>{const{copyType:i=oe.COPY_TYPE.COPY,pasteType:a}=o,{range:c}=e||{},{range:s}=n;return this._generateConditionalFormattingMutations(s,{copyType:i,pasteType:a,copyRange:c})}}))}_collectConditionalRule(e,n,r){const o=new d.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:e,subUnitId:n,cfMap:i}};const a=this._conditionalFormattingViewModel.getMatrix(e,n);if(!a)return;const c=this._injector.invoke(p=>oe.rangeToDiscreteRange(r,p,e,n));if(!c)return;const{rows:s,cols:u}=c,f=new Set;s.forEach((p,h)=>{u.forEach((v,S)=>{const y=this._conditionalFormattingViewModel.getCellCf(e,n,p,v,a);y&&(y.cfList.forEach(O=>f.add(O.cfId)),o.setValue(h,S,y.cfList.map(O=>O.cfId)))})}),f.forEach(p=>{const h=this._conditionalFormattingRuleModel.getRule(e,n,p);h&&(i[p]=h.rule)})}_generateConditionalFormattingMutations(e,n){const r=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),o=r.getActiveSheet(),i=r.getUnitId();if(!o)return{redos:[],undos:[]};const a=o.getSheetId();if(n.copyType===oe.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![oe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,oe.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,oe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[c,s],mapFunc:u}=oe.virtualizeDiscreteRanges([n.copyRange,e]),f=oe.getRepeatRange(c,s,!0),p=this._conditionalFormattingViewModel.getMatrix(i,a),h={};d.Range.foreach(s,(m,w)=>{const{row:T,col:E}=u(m,w),D=this._conditionalFormattingViewModel.getCellCf(i,a,T,E,p);D&&D.cfList.forEach($=>{if(!h[$.cfId]){const z=new d.ObjectMatrix;h[$.cfId]=z;const q=this._conditionalFormattingRuleModel.getRule(i,a,$.cfId);q==null||q.ranges.forEach(C=>{d.Range.foreach(C,(M,A)=>{z.setValue(M,A,1)})})}h[$.cfId].realDeleteValue(T,E)})});const{matrix:v,info:S}=this._copyInfo,y=[];let O=this._conditionalFormattingRuleModel.createCfId(i,a);const R={},I=m=>{if(R[m])return R[m];const w=S==null?void 0:S.cfMap[m],T=[...this._conditionalFormattingRuleModel.getSubunitRules(i,a)||[],...y].find(E=>d.Tools.diffValue(E.rule,w));if(T)return R[m]=T,T;{const E={rule:w,cfId:O,ranges:[],stopIfTrue:!1};return R[m]=E,y.push(E),O=`${Number(O)+1}`,E}};f.forEach(m=>{v&&v.forValue((w,T,E)=>{const D=d.Rectangle.getPositionRange({startRow:w,endRow:w,startColumn:T,endColumn:T},m.startRange),{row:$,col:z}=u(D.startRow,D.startColumn);E.forEach(q=>{if(!h[q]){const C=I(q),M=new d.ObjectMatrix;h[q]=M,C.ranges.forEach(A=>{d.Range.foreach(A,(Q,X)=>{M.setValue(Q,X,1)})})}h[q].setValue($,z,1)})})});const b=[],x=[];for(const m in h){const w=h[m],T=j.findAllRectangle(j.createTopMatrixFromMatrix(w));if(!T.length){const E={unitId:i,subUnitId:a,cfId:m};b.push({id:l.DeleteConditionalRuleMutation.id,params:E}),x.push(...l.DeleteConditionalRuleMutationUndoFactory(this._injector,E))}if(y.some(E=>E.cfId===m)){const E=I(m),D={unitId:i,subUnitId:a,rule:{...E,ranges:T}};b.push({id:l.AddConditionalRuleMutation.id,params:D}),x.push(l.AddConditionalRuleMutationUndoFactory(this._injector,D))}else{const E=this._conditionalFormattingRuleModel.getRule(i,a,m);if(!E)continue;const D={unitId:i,subUnitId:a,rule:{...E,ranges:T}};b.push({id:l.SetConditionalRuleMutation.id,params:D}),x.push(...l.setConditionalRuleMutationUndoFactory(this._injector,D))}}return{redos:b,undos:x}}};wt=qc([mt(0,d.Inject(oe.ISheetClipboardService)),mt(1,d.Inject(l.ConditionalFormattingRuleModel)),mt(2,d.Inject(d.Injector)),mt(3,d.Inject(l.ConditionalFormattingViewModel)),mt(4,d.Inject(d.IUniverInstanceService))],wt);var Bc=Object.defineProperty,Gc=Object.getOwnPropertyDescriptor,Xc=(t,e,n,r)=>{for(var o=r>1?void 0:r?Gc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Bc(e,n,o),o},qt=(t,e)=>(n,r)=>e(n,r,t);let It=class extends d.Disposable{constructor(t,e,n,r){super(),this._conditionalFormattingRuleModel=t,this._univerInstanceService=e,this._injector=n,this._refRangeService=r,this._initRefRange()}_initRefRange(){const t=new Map,e=(r,o,i)=>`${r}_${o}_${i}`,n=(r,o,i)=>{const a=s=>{const u=[...i.ranges],f=u.map(h=>j.handleDefaultRangeChangeWithEffectRefCommands(h,s)).filter(h=>!!h);if(l.isRangesEqual(f,u))return{redos:[],undos:[]};if(f.length){const h={unitId:r,subUnitId:o,rule:{...i,ranges:f}},v=[{id:l.SetConditionalRuleMutation.id,params:h}],S=l.setConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:S}}else{const h={unitId:r,subUnitId:o,cfId:i.cfId},v=[{id:l.DeleteConditionalRuleMutation.id,params:h}],S=l.DeleteConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:S}}},c=[];i.ranges.forEach(s=>{const u=this._refRangeService.registerRefRange(s,a);c.push(()=>u.dispose())}),t.set(e(r,o,i.cfId),()=>c.forEach(s=>s()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:o,subUnitId:i,rule:a}=r,c=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),s=c.getActiveSheet();if(!(r.unitId!==c.getUnitId()||r.subUnitId!==(s==null?void 0:s.getSheetId())))switch(r.type){case"add":{n(r.unitId,r.subUnitId,r.rule);break}case"delete":{const u=t.get(e(o,i,a.cfId));u&&u();break}case"set":{const u=t.get(e(o,i,a.cfId));u&&u(),n(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(d.toDisposable(()=>{t.forEach(r=>{r()}),t.clear()}))}};It=Xc([qt(0,d.Inject(l.ConditionalFormattingRuleModel)),qt(1,d.Inject(d.IUniverInstanceService)),qt(2,d.Inject(d.Injector)),qt(3,d.Inject(j.RefRangeService))],It);var Yc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,Zc=(t,e,n,r)=>{for(var o=r>1?void 0:r?Kc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Yc(e,n,o),o},En=(t,e)=>(n,r)=>e(n,r,t);let _t=class extends d.Disposable{constructor(t,e,n){super(),this._localeService=t,this._commandService=e,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===Dt.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[j.WorkbookEditablePermission],rangeTypes:[j.RangeProtectionPermissionEditPoint],worksheetTypes:[j.WorksheetEditPermission,j.WorksheetSetCellStylePermission]},t.params.rule.ranges)||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")))}))}};_t=Zc([En(0,d.Inject(d.LocaleService)),En(1,d.ICommandService),En(2,d.Inject(oe.SheetPermissionInterceptorBaseController))],_t);const Xo="sheets-conditional-formatting-ui.config",Yo={};var Ko=Object.defineProperty,Jc=Object.getOwnPropertyDescriptor,Qc=(t,e,n)=>e in t?Ko(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,eu=(t,e,n,r)=>{for(var o=r>1?void 0:r?Jc(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Ko(e,n,o),o},On=(t,e)=>(n,r)=>e(n,r,t),Zo=(t,e,n)=>Qc(t,typeof e!="symbol"?e+"":e,n);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends d.Plugin{constructor(e=Yo,n,r,o){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=o;const{menu:i,...a}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Xo,a),this._initCommand(),this._injector.add([Tt]),this._injector.add([It]),this._injector.add([wt]),this._injector.add([_t]),this._injector.add([ct])}_initCommand(){[Wn,qn,Bn,Gn,Xn,Yn,Kn,Zn,Jn,Nt,bt,yn,vn,Dt,tn,Et].forEach(e=>{this._commandService.registerCommand(e)})}};Zo(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${l.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Zo(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",d.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=eu([d.DependentOn(l.UniverSheetsConditionalFormattingPlugin),On(1,d.Inject(d.Injector)),On(2,d.Inject(d.ICommandService)),On(3,d.IConfigService)],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var tu=Object.defineProperty,nu=Object.getOwnPropertyDescriptor,ru=(t,e,n,r)=>{for(var o=r>1?void 0:r?nu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&tu(e,n,o),o},gt=(t,e)=>(n,r)=>e(n,r,t);let Zt=class extends d.Disposable{constructor(t,e,n,r,o){super(),this._injector=t,this._univerInstanceService=e,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),e=(o,i,a,c,s)=>{var v;const u=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getUnitId(),f=(v=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:v.getSheetId();if(!u||!f)return;const p={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},h={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};d.Range.foreach(a,(S,y)=>{const O=d.Rectangle.getPositionRange({startRow:S,startColumn:y,endColumn:y,endRow:S},p),R=d.Rectangle.getPositionRange({startRow:S,startColumn:y,endColumn:y,endRow:S},h),{row:I,col:b}=s(O.startRow,O.startColumn),x=this._conditionalFormattingViewModel.getCellCf(u,f,I,b),{row:m,col:w}=s(R.startRow,R.startColumn),T=this._conditionalFormattingViewModel.getCellCf(u,f,m,w);T&&T.cfList.forEach(E=>{let D=c.get(E.cfId);if(!c.get(E.cfId)){const $=this._conditionalFormattingRuleModel.getRule(u,f,E.cfId);if(!$)return;D=new d.ObjectMatrix,$.ranges.forEach(z=>{d.Range.foreach(z,(q,C)=>{D.setValue(q,C,1)})}),c.set(E.cfId,D)}D.realDeleteValue(m,w)}),x&&x.cfList.forEach(E=>{let D=c.get(E.cfId);if(!c.get(E.cfId)){const $=this._conditionalFormattingRuleModel.getRule(u,f,E.cfId);if(!$)return;D=new d.ObjectMatrix,$.ranges.forEach(z=>{d.Range.foreach(z,(q,C)=>{D.setValue(q,C,1)})}),c.set(E.cfId,D)}D.setValue(m,w,1)})})},n=(o,i)=>{var R,I,b;const a=(R=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:R.getUnitId(),c=(b=(I=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getActiveSheet())==null?void 0:b.getSheetId(),s=new Map,u=[],f=[];if(!a||!c)return t();const p=oe.virtualizeDiscreteRanges([o,i]),[h,v]=p.ranges,{mapFunc:S}=p,y={row:h.startRow,col:h.startColumn};return oe.getAutoFillRepeatRange(h,v).forEach(x=>{e(y,x.repeatStartCell,x.relativeRange,s,S)}),s.forEach((x,m)=>{const w=this._conditionalFormattingRuleModel.getRule(a,c,m);if(!w)return;const T=j.findAllRectangle(j.createTopMatrixFromMatrix(x));if(T.length){const E={unitId:a,subUnitId:c,rule:{...w,ranges:T}};u.push({id:l.SetConditionalRuleMutation.id,params:E}),f.push(...l.setConditionalRuleMutationUndoFactory(this._injector,E))}else{const E={unitId:a,subUnitId:c,cfId:w.cfId};u.push({id:l.DeleteConditionalRuleMutation.id,params:E}),f.push(...l.DeleteConditionalRuleMutationUndoFactory(this._injector,E))}}),{undos:f,redos:u}},r={id:l.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,a)=>{if(a===oe.APPLY_TYPE.COPY||a===oe.APPLY_TYPE.ONLY_FORMAT||a===oe.APPLY_TYPE.SERIES){const{source:c,target:s}=o;return n(c,s)}return t()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Zt=ru([gt(0,d.Inject(d.Injector)),gt(1,d.Inject(d.IUniverInstanceService)),gt(2,d.Inject(oe.IAutoFillService)),gt(3,d.Inject(l.ConditionalFormattingRuleModel)),gt(4,d.Inject(l.ConditionalFormattingViewModel))],Zt);var ou=Object.defineProperty,iu=Object.getOwnPropertyDescriptor,au=(t,e,n,r)=>{for(var o=r>1?void 0:r?iu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&ou(e,n,o),o},vt=(t,e)=>(n,r)=>e(n,r,t);exports.ConditionalFormattingClearController=class extends d.Disposable{constructor(e,n,r,o,i){super(),this._injector=e,this._univerInstanceService=n,this._sheetInterceptorService=r,this._selectionManagerService=o,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var i;const n=[],r=[],o={redos:n,undos:r};if([j.ClearSelectionFormatCommand.id,j.ClearSelectionAllCommand.id].includes(e.id)){const a=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(S=>S.range);if(!a)return o;const c=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET),s=c.getActiveSheet();if(!s)return o;const u=c.getUnitId(),f=s.getSheetId(),p=this._conditionalFormattingRuleModel.getSubunitRules(u,f);if(!p||!p.length)return o;const{redos:h,undos:v}=Br(this._injector,p,a,u,f);n.push(...h),r.push(...v)}return o}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:n,ranges:r})=>{const o=[],i=[],a={redos:o,undos:i};if(!r||!r.length)return a;const c=this._conditionalFormattingRuleModel.getSubunitRules(e,n);if(!c||!c.length)return a;const{redos:s,undos:u}=Br(this._injector,c,r,e,n);return o.push(...s),i.push(...u),a}}))}};exports.ConditionalFormattingClearController=au([vt(0,d.Inject(d.Injector)),vt(1,d.Inject(d.IUniverInstanceService)),vt(2,d.Inject(j.SheetInterceptorService)),vt(3,d.Inject(j.SheetsSelectionsService)),vt(4,d.Inject(l.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);function Br(t,e,n,r,o){const i=[],a=[];return e.filter(c=>n.some(s=>c.ranges.some(u=>d.Rectangle.getIntersects(u,s)))).forEach(c=>{const u=new j.RangeMergeUtil().add(...c.ranges).subtract(...n).merge();if(u.length){const f={id:l.SetConditionalRuleMutation.id,params:{unitId:r,subUnitId:o,rule:{...c,ranges:u}}},p=l.setConditionalRuleMutationUndoFactory(t,f.params);i.push(f),a.push(...p)}else{const f={id:l.DeleteConditionalRuleMutation.id,params:{unitId:r,subUnitId:o,cfId:c.cfId}},p=l.DeleteConditionalRuleMutationUndoFactory(t,f.params);i.push(f),a.push(...p)}}),{redos:i,undos:a}}var su=Object.defineProperty,lu=Object.getOwnPropertyDescriptor,cu=(t,e,n,r)=>{for(var o=r>1?void 0:r?lu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&su(e,n,o),o},Gr=(t,e)=>(n,r)=>e(n,r,t);let Jt=class extends d.Disposable{constructor(t,e){super(),this._sheetInterceptorService=t,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(d.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(j.AFTER_CELL_EDIT,{handler:(t,e,n)=>{var o,i;const r=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col);if(r!=null&&r.style&&(t!=null&&t.p)){const a=Object.keys(r==null?void 0:r.style);if(a.length>0){const c=d.BuildTextUtils.transform.getPlainText((i=(o=t.p.body)==null?void 0:o.dataStream)!=null?i:""),s={...(typeof t.s=="string"?e.workbook.getStyles().get(t.s):t.s)||{}};a.forEach(f=>{delete s[f]});const u={...t,s:{...s},v:c};return delete u.p,n(u)}}return n(t)}})))}};Jt=cu([Gr(0,d.Inject(j.SheetInterceptorService)),Gr(1,d.Inject(l.ConditionalFormattingService))],Jt);const Xr=[j.SetWorksheetActiveOperation.id,l.AddConditionalRuleMutation.id,l.SetConditionalRuleMutation.id,l.DeleteConditionalRuleMutation.id,l.MoveConditionalRuleMutation.id],yt=[{label:"sheet.cf.ruleType.highlightCell",value:Te.highlightCell},{label:"sheet.cf.panel.rankAndAverage",value:Te.rank},{label:"sheet.cf.ruleType.formula",value:Te.formula},{label:"sheet.cf.ruleType.colorScale",value:Te.colorScale},{label:"sheet.cf.ruleType.dataBar",value:Te.dataBar},{label:"sheet.cf.ruleType.iconSet",value:Te.icon},{label:"sheet.cf.menu.manageConditionalFormatting",value:Te.viewRule},{label:"sheet.cf.menu.createConditionalFormatting",value:Te.createRule},{label:"sheet.cf.menu.clearRangeRules",value:Te.clearRangeRules,disabled:!1},{label:"sheet.cf.menu.clearWorkSheetRules",value:Te.clearWorkSheetRules}],uu=t=>{const e=t.get(j.SheetsSelectionsService),n=t.get(d.ICommandService),r=t.get(d.IUniverInstanceService),o=t.get(l.ConditionalFormattingRuleModel),i=new De.Observable(s=>De.merge(e.selectionMoveEnd$,new De.Observable(u=>{const f=n.onCommandExecuted(p=>{var y;const{id:h,params:v}=p,S=(y=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getUnitId();Xr.includes(h)&&v.unitId===S&&u.next(null)});return()=>f.dispose()})).pipe(He.debounceTime(16)).subscribe(()=>{var y;const u=((y=e.getCurrentSelections())==null?void 0:y.map(O=>O.range))||[],f=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!f)return;const p=f.getActiveSheet();if(!p)return;const S=(o.getSubunitRules(f.getUnitId(),p.getSheetId())||[]).filter(O=>O.ranges.some(R=>u.some(I=>d.Rectangle.intersects(I,R)))).map(O=>O.ranges).every(O=>j.checkRangesEditablePermission(t,f.getUnitId(),p.getSheetId(),O));s.next(S)})),a=new De.Observable(s=>new De.Observable(u=>{const f=n.onCommandExecuted(p=>{var y;const{id:h,params:v}=p,S=(y=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getUnitId();Xr.includes(h)&&v.unitId===S&&u.next(null)});return()=>f.dispose()}).pipe(He.debounceTime(16)).subscribe(()=>{const u=r.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET);if(!u)return;const f=u.getActiveSheet();if(!f)return;const p=o.getSubunitRules(u.getUnitId(),f.getSheetId())||[];if(!p.length)return s.next(!1),!1;const h=p.map(v=>v.ranges).every(v=>j.checkRangesEditablePermission(t,u.getUnitId(),f.getSheetId(),v));s.next(h)})),c=new De.Observable(s=>{i.subscribe(u=>{const f=yt.find(p=>p.value===Te.clearRangeRules);f&&(f.disabled=!u,s.next(yt))}),a.subscribe(u=>{const f=yt.find(p=>p.value===Te.clearWorkSheetRules);f&&(f.disabled=!u,s.next(yt))}),s.next(yt)});return{id:Nt.id,type:ve.MenuItemType.SELECTOR,icon:"Conditions",tooltip:"sheet.cf.title",selections:c,hidden$:ve.getMenuHiddenObservable(t,d.UniverInstanceType.UNIVER_SHEET),disabled$:oe.getCurrentRangeDisable$(t,{workbookTypes:[j.WorkbookEditablePermission],worksheetTypes:[j.WorksheetSetCellStylePermission,j.WorksheetEditPermission],rangeTypes:[j.RangeProtectionPermissionEditPoint]})}},du={[ve.RibbonStartGroup.FORMULAS_INSERT]:{[Nt.id]:{order:0,menuItemFactory:uu}}};var fu=Object.defineProperty,pu=Object.getOwnPropertyDescriptor,hu=(t,e,n,r)=>{for(var o=r>1?void 0:r?pu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&fu(e,n,o),o},Yr=(t,e)=>(n,r)=>e(n,r,t);let Qt=class extends d.Disposable{constructor(e,n){super();Ae(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=n,this._menuManagerService.mergeMenu(du)}};Qt=hu([Yr(0,d.Inject(d.Injector)),Yr(1,ve.IMenuManagerService)],Qt);var mu=Object.defineProperty,gu=Object.getOwnPropertyDescriptor,vu=(t,e,n,r)=>{for(var o=r>1?void 0:r?gu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&mu(e,n,o),o},it=(t,e)=>(n,r)=>e(n,r,t);const yu=(t,e)=>{const n=f=>f.endRow-f.startRow+1,r=f=>f.endColumn-f.startColumn+1,o=n(e)%n(t),i=r(e)%r(t),a=Math.floor(n(e)/n(t)),c=Math.floor(r(e)/r(t)),s=[],u={startRow:0,endRow:n(t)-1,startColumn:0,endColumn:r(t)-1};if(n(e)===1&&r(e)===1){const f={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return s.push({repeatRelativeRange:u,startRange:f}),s}for(let f=0;f<a+(o?.1:0);f++)for(let p=0;p<c+(i?.1:0);p++){const h=n(t)*f,v=r(t)*p,S={startRow:h+e.startRow,endRow:h+e.startRow,startColumn:v+e.startColumn,endColumn:v+e.startColumn};let y=u;f===a&&o&&(y={...y},y.endRow=y.endRow-(n(t)-o)),p===c&&i&&(y={...y},y.endColumn=y.endColumn-(r(t)-i)),s.push({repeatRelativeRange:y,startRange:S})}return s};let en=class extends d.Disposable{constructor(e,n,r,o,i,a){super();Ae(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=n,this._formatPainterService=r,this._sheetsSelectionsService=o,this._conditionalFormattingRuleModel=i,this._conditionalFormattingViewModel=a,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),n=(i,a,c,s,u)=>{const{unitId:f,subUnitId:p}=this._painterConfig,{targetUnitId:h,targetSubUnitId:v}=u,S={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row},y={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row};d.Range.foreach(c,(O,R)=>{const I=d.Rectangle.getPositionRange({startRow:O,startColumn:R,endColumn:R,endRow:O},S),b=d.Rectangle.getPositionRange({startRow:O,startColumn:R,endColumn:R,endRow:O},y),x=this._conditionalFormattingViewModel.getCellCf(f,p,I.startRow,I.startColumn),m=this._conditionalFormattingViewModel.getCellCf(h,v,b.startRow,b.startColumn);m&&m.cfList.forEach(w=>{let T=s.get(w.cfId);if(!s.get(w.cfId)){const E=this._conditionalFormattingRuleModel.getRule(h,v,w.cfId);if(!E)return;T=new d.ObjectMatrix,E.ranges.forEach(D=>{d.Range.foreach(D,($,z)=>{T.setValue($,z,1)})}),s.set(w.cfId,T)}T.realDeleteValue(b.startRow,b.startColumn)}),x&&x.cfList.forEach(w=>{const T=s.get(w.cfId);T&&T.setValue(b.startRow,b.startColumn,1)})})},r=(i,a,c)=>{var I;const{range:s,unitId:u,subUnitId:f}=this._painterConfig,p=i!==u||f!==a,h=new Map,v=[],S=[];if(!i||!a||!u||!f)return e();const y=(I=this._conditionalFormattingRuleModel.getSubunitRules(u,f))!=null?I:[];y==null||y.forEach(b=>{const{ranges:x,cfId:m}=b;if(x.some(w=>d.Rectangle.intersects(s,w))){const w=new d.ObjectMatrix;p||x.forEach(T=>{d.Range.foreach(T,(E,D)=>{w.setValue(E,D,1)})}),h.set(m,w)}});const O={row:s.startRow,col:s.startColumn};return yu(s,c).forEach(b=>{n(O,{row:b.startRange.startRow,col:b.startRange.startColumn},b.repeatRelativeRange,h,{targetUnitId:i,targetSubUnitId:a})}),h.forEach((b,x)=>{if(p){const m=this._conditionalFormattingRuleModel.getRule(i,a,x),w=j.findAllRectangle(j.createTopMatrixFromMatrix(b));if(m)if(w.length){const T={unitId:i,subUnitId:a,rule:{...m,ranges:w}};v.push({id:l.SetConditionalRuleMutation.id,params:T}),S.push(...l.setConditionalRuleMutationUndoFactory(this._injector,T))}else{const T={unitId:i,subUnitId:a,cfId:m.cfId};v.push({id:l.DeleteConditionalRuleMutation.id,params:T}),S.push(...l.DeleteConditionalRuleMutationUndoFactory(this._injector,T))}else if(w.length){const T=this._conditionalFormattingRuleModel.getRule(u,f,x);if(T){const E={unitId:i,subUnitId:a,rule:{...d.Tools.deepClone(T),cfId:this._conditionalFormattingRuleModel.createCfId(i,a),ranges:w}};v.push({id:l.AddConditionalRuleMutation.id,params:E}),S.push(l.AddConditionalRuleMutationUndoFactory(this._injector,E))}}}else{const m=this._conditionalFormattingRuleModel.getRule(u,f,x);if(!m)return;const w=j.findAllRectangle(j.createTopMatrixFromMatrix(b));if(w.length){const T={unitId:u,subUnitId:f,rule:{...m,ranges:w}};v.push({id:l.SetConditionalRuleMutation.id,params:T}),S.push(...l.setConditionalRuleMutationUndoFactory(this._injector,T))}else{const T={unitId:u,subUnitId:f,cfId:m.cfId};v.push({id:l.DeleteConditionalRuleMutation.id,params:T}),S.push(...l.DeleteConditionalRuleMutationUndoFactory(this._injector,T))}}}),{undos:S,redos:v}},o={id:l.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:i=>{var a,c,s;switch(i){case oe.FormatPainterStatus.INFINITE:case oe.FormatPainterStatus.ONCE:{const u=(a=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:a.getUnitId(),f=(s=(c=this._univerInstanceService.getCurrentUnitForType(d.UniverInstanceType.UNIVER_SHEET))==null?void 0:c.getActiveSheet())==null?void 0:s.getSheetId(),p=this._sheetsSelectionsService.getCurrentLastSelection(),h=p==null?void 0:p.range;u&&f&&h&&(this._painterConfig={unitId:u,subUnitId:f,range:h});break}case oe.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(i,a,c)=>this._painterConfig?r(i,a,c):{redos:[],undos:[]}};this._formatPainterService.addHook(o)}};en=vu([it(0,d.Inject(d.Injector)),it(1,d.Inject(d.IUniverInstanceService)),it(2,d.Inject(oe.IFormatPainterService)),it(3,d.Inject(j.SheetsSelectionsService)),it(4,d.Inject(l.ConditionalFormattingRuleModel)),it(5,d.Inject(l.ConditionalFormattingViewModel))],en);var Jo=Object.defineProperty,Cu=Object.getOwnPropertyDescriptor,Su=(t,e,n)=>e in t?Jo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bu=(t,e,n,r)=>{for(var o=r>1?void 0:r?Cu(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(r?a(e,n,o):a(o))||o);return r&&o&&Jo(e,n,o),o},Mn=(t,e)=>(n,r)=>e(n,r,t),Qo=(t,e,n)=>Su(t,typeof e!="symbol"?e+"":e,n);exports.UniverSheetsConditionalFormattingUIPlugin=class extends d.Plugin{constructor(e=Yo,n,r,o){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=o;const{menu:i,...a}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Xo,a),this._initCommand()}onStarting(){d.registerDependencies(this._injector,[[Tt],[It],[wt],[Zt],[_t],[Rt],[Qt],[ct],[Jt],[exports.ConditionalFormattingClearController],[en]]),d.touchDependencies(this._injector,[[Tt]])}onReady(){d.touchDependencies(this._injector,[[Qt],[Rt]])}onRendered(){d.touchDependencies(this._injector,[[Zt],[exports.ConditionalFormattingClearController],[wt],[Jt],[ct],[en],[_t],[It]])}_initCommand(){[Wn,qn,Bn,Gn,Xn,Yn,Kn,Zn,Jn,Nt,bt,yn,vn,Dt,tn,Et].forEach(e=>{this._commandService.registerCommand(e)})}};Qo(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${l.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);Qo(exports.UniverSheetsConditionalFormattingUIPlugin,"type",d.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=bu([d.DependentOn(l.UniverSheetsConditionalFormattingPlugin),Mn(1,d.Inject(d.Injector)),Mn(2,d.Inject(d.ICommandService)),Mn(3,d.IConfigService)],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=Wn;exports.AddCfCommand=Dt;exports.AddColorScaleConditionalRuleCommand=qn;exports.AddDataBarConditionalRuleCommand=Bn;exports.AddDuplicateValuesCfCommand=Gn;exports.AddNumberCfCommand=Xn;exports.AddRankCfCommand=Yn;exports.AddTextCfCommand=Kn;exports.AddTimePeriodCfCommand=Zn;exports.AddUniqueValuesCfCommand=Jn;exports.ClearRangeCfCommand=tn;exports.ClearWorksheetCfCommand=Et;exports.DeleteCfCommand=bt;exports.MoveCfCommand=vn;exports.OpenConditionalFormattingOperator=Nt;exports.SetCfCommand=yn;
|