@univerjs/sheets-conditional-formatting-ui 0.2.3 → 0.2.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +3 -3
- package/lib/es/index.js +597 -599
- package/lib/types/controllers/cf.auto-fill.controller.d.ts +1 -2
- package/lib/types/controllers/cf.clear.controller.d.ts +1 -2
- package/lib/types/controllers/cf.copy-paste.controller.d.ts +1 -2
- package/lib/types/controllers/cf.menu.controller.d.ts +1 -2
- package/lib/types/controllers/cf.ref-range.controller.d.ts +1 -2
- package/lib/types/menu/manage-rule.d.ts +1 -1
- package/lib/types/mobile-plugin.d.ts +1 -2
- package/lib/types/plugin.d.ts +1 -2
- package/lib/umd/index.js +3 -3
- package/package.json +22 -24
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var $i=Object.defineProperty;var Li=(e,t,n)=>t in e?$i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Rt=(e,t,n)=>Li(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@univerjs/core"),A=require("@wendellhu/redi"),s=require("@univerjs/sheets-conditional-formatting"),L=require("@univerjs/sheets"),Ce=require("@univerjs/ui"),Me=require("rxjs"),qe=require("rxjs/operators"),ue=require("@univerjs/sheets-ui"),w=require("react"),B=require("@univerjs/design"),te=require("@wendellhu/redi/react-bindings"),bo=require("@univerjs/engine-formula"),Be=require("clsx"),Ro=require("react-dom"),Ui=require("@univerjs/engine-render"),er={type:g.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(g.ICommandService),l=e.get(g.IUniverInstanceService),u=L.getSheetCommandTarget(l);if(!u)return!1;const{unitId:d,subUnitId:h}=u,p=a.createCfId(d,h),v={ranges:n,cfId:p,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:i,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:v})}},tr={type:g.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(g.ICommandService),c=e.get(g.IUniverInstanceService),l=L.getSheetCommandTarget(c);if(!l)return!1;const{unitId:u,subUnitId:d}=l,h=i.createCfId(u,d),p={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.colorScale,config:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:u,subUnitId:d,rule:p})}},nr={type:g.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c,stopIfTrue:l,isShowValue:u}=t,d=e.get(s.ConditionalFormattingRuleModel),h=e.get(g.IUniverInstanceService),p=L.getSheetCommandTarget(h);if(!p)return!1;const{unitId:v,subUnitId:y}=p,R=e.get(g.ICommandService),E=d.createCfId(v,y),C={ranges:n,cfId:E,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,isShowValue:u,config:{min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c}}};return R.executeCommand(s.AddConditionalRuleMutation.id,{unitId:v,subUnitId:y,rule:C})}},rr={type:g.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(g.ICommandService),c=e.get(g.IUniverInstanceService),l=L.getSheetCommandTarget(c);if(!l)return!1;const{unitId:u,subUnitId:d}=l,h=i.createCfId(u,d),p={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:u,subUnitId:d,rule:p})}},or={type:g.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(g.ICommandService),u=e.get(g.IUniverInstanceService),d=L.getSheetCommandTarget(u);if(!d)return!1;const{unitId:h,subUnitId:p}=d,v=c.createCfId(h,p);let y;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(i)){const R=a;if(R.length!==2||!Array.isArray(R))return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:R}}}else{const R=a;if(typeof R!="number")return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:R}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:p,rule:y})}},ir={type:g.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,isPercent:i,isBottom:a,value:c}=t,l=e.get(s.ConditionalFormattingRuleModel),u=e.get(g.IUniverInstanceService),d=e.get(g.ICommandService),h=L.getSheetCommandTarget(u);if(!h)return!1;const{unitId:p,subUnitId:v}=h,y=l.createCfId(p,v),R={ranges:n,cfId:y,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:i,isBottom:a,style:r,value:c}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:p,subUnitId:v,rule:R})}},ar={type:g.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(g.IUniverInstanceService),u=L.getSheetCommandTarget(l);if(!u)return!1;const{unitId:d,subUnitId:h}=u,p=e.get(g.ICommandService),v=c.createCfId(d,h),y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:i,style:r,value:a}};return p.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:y})}},sr={type:g.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(g.IUniverInstanceService),l=e.get(g.ICommandService),u=L.getSheetCommandTarget(c);if(!u)return!1;const{unitId:d,subUnitId:h}=u,p=a.createCfId(d,h),v={ranges:n,cfId:p,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:i,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:v})}},lr={type:g.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(g.IUniverInstanceService),c=e.get(g.ICommandService),l=L.getSheetCommandTarget(a);if(!l)return!1;const{unitId:u,subUnitId:d}=l,h=i.createCfId(u,d),p={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:u,subUnitId:d,rule:p})}},ln={type:g.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var R;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(g.IUniverInstanceService),o=e.get(g.ICommandService),i=e.get(g.IUndoRedoService),a=e.get(L.SheetsSelectionsService),c=L.getSheetCommandTarget(r,t);if(!c)return!1;const{unitId:l,subUnitId:u}=c,d=((R=a.getCurrentSelections())==null?void 0:R.map(E=>E.range))||[],h=n.getSubunitRules(l,u);if(!(h!=null&&h.length)||!d.length)return!1;const p=[],v=[];h.forEach(E=>{const C=new g.ObjectMatrix;E.ranges.forEach(_=>{g.Range.foreach(_,(I,m)=>{C.setValue(I,m,1)})}),d.forEach(_=>{g.Range.foreach(_,(I,m)=>{C.realDeleteValue(I,m)})});const T=L.findAllRectangle(L.createTopMatrixFromMatrix(C));if(T.length){const _={...E,ranges:T},I={unitId:l,subUnitId:u,rule:_},m=s.setConditionalRuleMutationUndoFactory(e,I);p.push({id:s.SetConditionalRuleMutation.id,params:I}),v.push(...m)}else{const _={unitId:l,subUnitId:u,cfId:E.cfId},I=s.DeleteConditionalRuleMutationUndoFactory(e,_);p.push({id:s.DeleteConditionalRuleMutation.id,params:_}),v.push(...I)}});const y=g.sequenceExecute(p,o).result;return y&&i.pushUndoRedo({unitID:l,redoMutations:p,undoMutations:v}),y}},Vt={type:g.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(g.IUniverInstanceService),o=e.get(g.ICommandService),i=e.get(g.IUndoRedoService),a=L.getSheetCommandTarget(r,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,u=n.getSubunitRules(c,l);if(!(u!=null&&u.length))return!1;const d=u.map(y=>({cfId:y.cfId,unitId:c,subUnitId:l})),h=d.map(y=>({id:s.DeleteConditionalRuleMutation.id,params:y})),p=d.map(y=>s.DeleteConditionalRuleMutationUndoFactory(e,y)[0]),v=g.sequenceExecute(h,o).result;return v&&i.pushUndoRedo({unitID:c,redoMutations:h,undoMutations:p}),v}};var jt=(e=>(e[e.View=0]="View",e[e.Edit=1]="Edit",e[e.ManageCollaborator=2]="ManageCollaborator",e[e.Print=3]="Print",e[e.Duplicate=4]="Duplicate",e[e.Comment=5]="Comment",e[e.Copy=6]="Copy",e[e.Share=7]="Share",e[e.Export=8]="Export",e[e.MoveWorksheet=9]="MoveWorksheet",e[e.DeleteWorksheet=10]="DeleteWorksheet",e[e.HideWorksheet=11]="HideWorksheet",e[e.RenameWorksheet=12]="RenameWorksheet",e[e.CreateWorksheet=13]="CreateWorksheet",e[e.SetWorksheetStyle=14]="SetWorksheetStyle",e[e.EditWorksheetCell=15]="EditWorksheetCell",e[e.InsertHyperlink=16]="InsertHyperlink",e[e.Sort=17]="Sort",e[e.Filter=18]="Filter",e[e.PivotTable=19]="PivotTable",e[e.FloatImg=20]="FloatImg",e[e.History=21]="History",e[e.RwHgtClWdt=22]="RwHgtClWdt",e[e.ViemRwHgtClWdt=23]="ViemRwHgtClWdt",e[e.ViewFilter=24]="ViewFilter",e[e.MoveSheet=25]="MoveSheet",e[e.DeleteSheet=26]="DeleteSheet",e[e.HideSheet=27]="HideSheet",e[e.CopySheet=28]="CopySheet",e[e.RenameSheet=29]="RenameSheet",e[e.CreateSheet=30]="CreateSheet",e[e.SelectProtectedCells=31]="SelectProtectedCells",e[e.SelectUnProtectedCells=32]="SelectUnProtectedCells",e[e.SetCellStyle=33]="SetCellStyle",e[e.SetCellValue=34]="SetCellValue",e[e.SetRowStyle=35]="SetRowStyle",e[e.SetColumnStyle=36]="SetColumnStyle",e[e.InsertRow=37]="InsertRow",e[e.InsertColumn=38]="InsertColumn",e[e.DeleteRow=39]="DeleteRow",e[e.DeleteColumn=40]="DeleteColumn",e[e.EditExtraObject=41]="EditExtraObject",e[e.Delete=42]="Delete",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(jt||{});const Hr=[L.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],Vi=e=>{const t=[{label:"sheet.cf.ruleType.highlightCell",value:Ie.highlightCell},{label:"sheet.cf.panel.rankAndAverage",value:Ie.rank},{label:"sheet.cf.ruleType.formula",value:Ie.formula},{label:"sheet.cf.ruleType.colorScale",value:Ie.colorScale},{label:"sheet.cf.ruleType.dataBar",value:Ie.dataBar},{label:"sheet.cf.ruleType.iconSet",value:Ie.icon},{label:"sheet.cf.menu.manageConditionalFormatting",value:Ie.viewRule},{label:"sheet.cf.menu.createConditionalFormatting",value:Ie.createRule},{label:"sheet.cf.menu.clearRangeRules",value:Ie.clearRangeRules,disabled:!1},{label:"sheet.cf.menu.clearWorkSheetRules",value:Ie.clearWorkSheetRules}],n=e.get(L.SheetsSelectionsService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=new Me.Observable(u=>Me.merge(n.selectionMoveEnd$,new Me.Observable(d=>{const h=r.onCommandExecuted(p=>{var E;const{id:v,params:y}=p,R=(E=o.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getUnitId();Hr.includes(v)&&y.unitId===R&&d.next(null)});return()=>h.dispose()})).pipe(qe.debounceTime(16)).subscribe(()=>{var R;const d=((R=n.getCurrentSelections())==null?void 0:R.map(E=>E.range))||[],h=o.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!h)return;const p=h.getActiveSheet();if(!p)return;const y=(i.getSubunitRules(h.getUnitId(),p.getSheetId())||[]).filter(E=>E.ranges.some(C=>d.some(T=>g.Rectangle.intersects(T,C))));u.next(!!y.length)})),c=new Me.Observable(u=>Me.merge(n.selectionMoveEnd$,new Me.Observable(d=>{const h=r.onCommandExecuted(p=>{var E;const{id:v,params:y}=p,R=(E=o.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getUnitId();Hr.includes(v)&&y.unitId===R&&d.next(null)});return()=>h.dispose()})).pipe(qe.debounceTime(16)).subscribe(()=>{const d=o.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!d)return;const h=d.getActiveSheet();if(!h)return;const p=i.getSubunitRules(d.getUnitId(),h.getSheetId())||[];if(!p.length)return u.next(!1),!1;const v=p.some(y=>y.ranges.some(E=>{var m,x;const{startRow:C,startColumn:T,endRow:_,endColumn:I}=E;for(let O=C;O<=_;O++)for(let S=T;S<=I;S++){const M=(x=(m=h.getCell(O,S))==null?void 0:m.selectionProtection)==null?void 0:x[0];if((M==null?void 0:M[jt.Edit])===!1||(M==null?void 0:M[jt.View])===!1)return!0}return!1}));u.next(!v)})),l=new Me.Observable(u=>{a.subscribe(d=>{const h=t.find(p=>p.value===Ie.clearRangeRules);h&&(h.disabled=!d,u.next(t))}),c.subscribe(d=>{const h=t.find(p=>p.value===Ie.clearWorkSheetRules);h&&(h.disabled=!d,u.next(t))}),u.next(t)});return{id:Dn.id,type:Ce.MenuItemType.SELECTOR,group:Ce.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[Ce.MenuPosition.TOOLBAR_START],icon:"Conditions",tooltip:"sheet.cf.title",selections:l,hidden$:Ce.getMenuHiddenObservable(e,g.UniverInstanceType.UNIVER_SHEET),disabled$:ue.getCurrentRangeDisable$(e,{workbookTypes:[L.WorkbookEditablePermission],worksheetTypes:[L.WorksheetSetCellStylePermission,L.WorksheetEditPermission],rangeTypes:[L.RangeProtectionPermissionEditPoint]})}};var Ae=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function zi(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var _o={exports:{}},cn={};/**
|
|
1
|
+
"use strict";var Ni=Object.defineProperty;var ji=(e,t,n)=>t in e?Ni(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var St=(e,t,n)=>ji(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@univerjs/core"),s=require("@univerjs/sheets-conditional-formatting"),L=require("@univerjs/sheets"),fe=require("@univerjs/ui"),De=require("rxjs"),We=require("rxjs/operators"),le=require("@univerjs/sheets-ui"),w=require("react"),q=require("@univerjs/design"),Co=require("@univerjs/engine-formula"),ke=require("clsx"),So=require("react-dom"),$i=require("@univerjs/engine-render"),Jn={type:u.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(u.ICommandService),l=e.get(u.IUniverInstanceService),d=L.getSheetCommandTarget(l);if(!d)return!1;const{unitId:f,subUnitId:m}=d,h=a.createCfId(f,m),v={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:i,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:m,rule:v})}},Qn={type:u.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.ICommandService),c=e.get(u.IUniverInstanceService),l=L.getSheetCommandTarget(c);if(!l)return!1;const{unitId:d,subUnitId:f}=l,m=i.createCfId(d,f),h={ranges:n,cfId:m,stopIfTrue:!!o,rule:{type:s.CFRuleType.colorScale,config:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:h})}},er={type:u.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c,stopIfTrue:l,isShowValue:d}=t,f=e.get(s.ConditionalFormattingRuleModel),m=e.get(u.IUniverInstanceService),h=L.getSheetCommandTarget(m);if(!h)return!1;const{unitId:v,subUnitId:y}=h,R=e.get(u.ICommandService),E=f.createCfId(v,y),C={ranges:n,cfId:E,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,isShowValue:d,config:{min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c}}};return R.executeCommand(s.AddConditionalRuleMutation.id,{unitId:v,subUnitId:y,rule:C})}},tr={type:u.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.ICommandService),c=e.get(u.IUniverInstanceService),l=L.getSheetCommandTarget(c);if(!l)return!1;const{unitId:d,subUnitId:f}=l,m=i.createCfId(d,f),h={ranges:n,cfId:m,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:h})}},nr={type:u.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(u.ICommandService),d=e.get(u.IUniverInstanceService),f=L.getSheetCommandTarget(d);if(!f)return!1;const{unitId:m,subUnitId:h}=f,v=c.createCfId(m,h);let y;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(i)){const R=a;if(R.length!==2||!Array.isArray(R))return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:R}}}else{const R=a;if(typeof R!="number")return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:R}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:m,subUnitId:h,rule:y})}},rr={type:u.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,isPercent:i,isBottom:a,value:c}=t,l=e.get(s.ConditionalFormattingRuleModel),d=e.get(u.IUniverInstanceService),f=e.get(u.ICommandService),m=L.getSheetCommandTarget(d);if(!m)return!1;const{unitId:h,subUnitId:v}=m,y=l.createCfId(h,v),R={ranges:n,cfId:y,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:i,isBottom:a,style:r,value:c}};return f.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:v,rule:R})}},or={type:u.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(u.IUniverInstanceService),d=L.getSheetCommandTarget(l);if(!d)return!1;const{unitId:f,subUnitId:m}=d,h=e.get(u.ICommandService),v=c.createCfId(f,m),y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:i,style:r,value:a}};return h.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:m,rule:y})}},ir={type:u.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(u.IUniverInstanceService),l=e.get(u.ICommandService),d=L.getSheetCommandTarget(c);if(!d)return!1;const{unitId:f,subUnitId:m}=d,h=a.createCfId(f,m),v={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:i,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:m,rule:v})}},ar={type:u.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.IUniverInstanceService),c=e.get(u.ICommandService),l=L.getSheetCommandTarget(a);if(!l)return!1;const{unitId:d,subUnitId:f}=l,m=i.createCfId(d,f),h={ranges:n,cfId:m,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:h})}},an={type:u.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var R;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(u.IUniverInstanceService),o=e.get(u.ICommandService),i=e.get(u.IUndoRedoService),a=e.get(L.SheetsSelectionsService),c=L.getSheetCommandTarget(r,t);if(!c)return!1;const{unitId:l,subUnitId:d}=c,f=((R=a.getCurrentSelections())==null?void 0:R.map(E=>E.range))||[],m=n.getSubunitRules(l,d);if(!(m!=null&&m.length)||!f.length)return!1;const h=[],v=[];m.forEach(E=>{const C=new u.ObjectMatrix;E.ranges.forEach(_=>{u.Range.foreach(_,(I,g)=>{C.setValue(I,g,1)})}),f.forEach(_=>{u.Range.foreach(_,(I,g)=>{C.realDeleteValue(I,g)})});const T=L.findAllRectangle(L.createTopMatrixFromMatrix(C));if(T.length){const _={...E,ranges:T},I={unitId:l,subUnitId:d,rule:_},g=s.setConditionalRuleMutationUndoFactory(e,I);h.push({id:s.SetConditionalRuleMutation.id,params:I}),v.push(...g)}else{const _={unitId:l,subUnitId:d,cfId:E.cfId},I=s.DeleteConditionalRuleMutationUndoFactory(e,_);h.push({id:s.DeleteConditionalRuleMutation.id,params:_}),v.push(...I)}});const y=u.sequenceExecute(h,o).result;return y&&i.pushUndoRedo({unitID:l,redoMutations:h,undoMutations:v}),y}},Lt={type:u.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(u.IUniverInstanceService),o=e.get(u.ICommandService),i=e.get(u.IUndoRedoService),a=L.getSheetCommandTarget(r,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,d=n.getSubunitRules(c,l);if(!(d!=null&&d.length))return!1;const f=d.map(y=>({cfId:y.cfId,unitId:c,subUnitId:l})),m=f.map(y=>({id:s.DeleteConditionalRuleMutation.id,params:y})),h=f.map(y=>s.DeleteConditionalRuleMutationUndoFactory(e,y)[0]),v=u.sequenceExecute(m,o).result;return v&&i.pushUndoRedo({unitID:c,redoMutations:m,undoMutations:h}),v}};var Ft=(e=>(e[e.View=0]="View",e[e.Edit=1]="Edit",e[e.ManageCollaborator=2]="ManageCollaborator",e[e.Print=3]="Print",e[e.Duplicate=4]="Duplicate",e[e.Comment=5]="Comment",e[e.Copy=6]="Copy",e[e.Share=7]="Share",e[e.Export=8]="Export",e[e.MoveWorksheet=9]="MoveWorksheet",e[e.DeleteWorksheet=10]="DeleteWorksheet",e[e.HideWorksheet=11]="HideWorksheet",e[e.RenameWorksheet=12]="RenameWorksheet",e[e.CreateWorksheet=13]="CreateWorksheet",e[e.SetWorksheetStyle=14]="SetWorksheetStyle",e[e.EditWorksheetCell=15]="EditWorksheetCell",e[e.InsertHyperlink=16]="InsertHyperlink",e[e.Sort=17]="Sort",e[e.Filter=18]="Filter",e[e.PivotTable=19]="PivotTable",e[e.FloatImg=20]="FloatImg",e[e.History=21]="History",e[e.RwHgtClWdt=22]="RwHgtClWdt",e[e.ViemRwHgtClWdt=23]="ViemRwHgtClWdt",e[e.ViewFilter=24]="ViewFilter",e[e.MoveSheet=25]="MoveSheet",e[e.DeleteSheet=26]="DeleteSheet",e[e.HideSheet=27]="HideSheet",e[e.CopySheet=28]="CopySheet",e[e.RenameSheet=29]="RenameSheet",e[e.CreateSheet=30]="CreateSheet",e[e.SelectProtectedCells=31]="SelectProtectedCells",e[e.SelectUnProtectedCells=32]="SelectUnProtectedCells",e[e.SetCellStyle=33]="SetCellStyle",e[e.SetCellValue=34]="SetCellValue",e[e.SetRowStyle=35]="SetRowStyle",e[e.SetColumnStyle=36]="SetColumnStyle",e[e.InsertRow=37]="InsertRow",e[e.InsertColumn=38]="InsertColumn",e[e.DeleteRow=39]="DeleteRow",e[e.DeleteColumn=40]="DeleteColumn",e[e.EditExtraObject=41]="EditExtraObject",e[e.Delete=42]="Delete",e[e.RecoverHistory=43]="RecoverHistory",e[e.ViewHistory=44]="ViewHistory",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ft||{});const zr=[L.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],Li=e=>{const t=[{label:"sheet.cf.ruleType.highlightCell",value:_e.highlightCell},{label:"sheet.cf.panel.rankAndAverage",value:_e.rank},{label:"sheet.cf.ruleType.formula",value:_e.formula},{label:"sheet.cf.ruleType.colorScale",value:_e.colorScale},{label:"sheet.cf.ruleType.dataBar",value:_e.dataBar},{label:"sheet.cf.ruleType.iconSet",value:_e.icon},{label:"sheet.cf.menu.manageConditionalFormatting",value:_e.viewRule},{label:"sheet.cf.menu.createConditionalFormatting",value:_e.createRule},{label:"sheet.cf.menu.clearRangeRules",value:_e.clearRangeRules,disabled:!1},{label:"sheet.cf.menu.clearWorkSheetRules",value:_e.clearWorkSheetRules}],n=e.get(L.SheetsSelectionsService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=new De.Observable(d=>De.merge(n.selectionMoveEnd$,new De.Observable(f=>{const m=r.onCommandExecuted(h=>{var E;const{id:v,params:y}=h,R=(E=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getUnitId();zr.includes(v)&&y.unitId===R&&f.next(null)});return()=>m.dispose()})).pipe(We.debounceTime(16)).subscribe(()=>{var R;const f=((R=n.getCurrentSelections())==null?void 0:R.map(E=>E.range))||[],m=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!m)return;const h=m.getActiveSheet();if(!h)return;const y=(i.getSubunitRules(m.getUnitId(),h.getSheetId())||[]).filter(E=>E.ranges.some(C=>f.some(T=>u.Rectangle.intersects(T,C))));d.next(!!y.length)})),c=new De.Observable(d=>De.merge(n.selectionMoveEnd$,new De.Observable(f=>{const m=r.onCommandExecuted(h=>{var E;const{id:v,params:y}=h,R=(E=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getUnitId();zr.includes(v)&&y.unitId===R&&f.next(null)});return()=>m.dispose()})).pipe(We.debounceTime(16)).subscribe(()=>{const f=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!f)return;const m=f.getActiveSheet();if(!m)return;const h=i.getSubunitRules(f.getUnitId(),m.getSheetId())||[];if(!h.length)return d.next(!1),!1;const v=h.some(y=>y.ranges.some(E=>{var g,x;const{startRow:C,startColumn:T,endRow:_,endColumn:I}=E;for(let O=C;O<=_;O++)for(let S=T;S<=I;S++){const M=(x=(g=m.getCell(O,S))==null?void 0:g.selectionProtection)==null?void 0:x[0];if((M==null?void 0:M[Ft.Edit])===!1||(M==null?void 0:M[Ft.View])===!1)return!0}return!1}));d.next(!v)})),l=new De.Observable(d=>{a.subscribe(f=>{const m=t.find(h=>h.value===_e.clearRangeRules);m&&(m.disabled=!f,d.next(t))}),c.subscribe(f=>{const m=t.find(h=>h.value===_e.clearWorkSheetRules);m&&(m.disabled=!f,d.next(t))}),d.next(t)});return{id:On.id,type:fe.MenuItemType.SELECTOR,group:fe.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[fe.MenuPosition.TOOLBAR_START],icon:"Conditions",tooltip:"sheet.cf.title",selections:l,hidden$:fe.getMenuHiddenObservable(e,u.UniverInstanceType.UNIVER_SHEET),disabled$:le.getCurrentRangeDisable$(e,{workbookTypes:[L.WorkbookEditablePermission],worksheetTypes:[L.WorksheetSetCellStylePermission,L.WorksheetEditPermission],rangeTypes:[L.RangeProtectionPermissionEditPoint]})}};var Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ui(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var bo={exports:{}},sn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ai=w,Hi=Symbol.for("react.element"),Wi=Symbol.for("react.fragment"),ki=Object.prototype.hasOwnProperty,qi=Ai.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Bi={key:!0,ref:!0,__self:!0,__source:!0};function To(e,t,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)ki.call(t,r)&&!Bi.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:Hi,type:e,key:i,ref:a,props:o,_owner:qi.current}}cn.Fragment=Wi;cn.jsx=To;cn.jsxs=To;_o.exports=cn;var f=_o.exports;const Gi="univer-conditional-formatting-wrap",Xi="univer-cf-rule-item",Yi="univer-preview",Ki="univer-create-rule",Zi="univer-button",Ji="univer-title",Qi="univer-label",ea="univer-label-container",ta="univer-input-width",na="univer-m-t-base",ra="univer-m-t-sm",oa="univer-m-t-xl",ia="univer-m-l-sm",aa="univer-m-l-xl",sa="univer-m-l-xxs",la="univer-m-l-0",ca="univer-m-r-0",P={conditionalFormattingWrap:Gi,cfRuleItem:Xi,preview:Yi,createRule:Ki,button:Zi,title:Ji,label:Qi,labelContainer:ea,inputWidth:ta,mTBase:na,mTSm:ra,mTXl:oa,mLSm:ia,mLXl:aa,mLXxs:sa,mL0:la,mR0:ca};var Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Oe.apply(this,arguments)},ua=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},yt=w.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,i=e.extend,a=ua(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),l=w.useRef("_".concat(pa()));return Io(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},Oe({ref:t,className:c},a),i)});function Io(e,t,n,r,o){return w.createElement(e.tag,Oe(Oe({key:t},da(e,n,o)),r),(fa(e,n).children||[]).map(function(i,a){return Io(i,"".concat(t,"-").concat(e.tag,"-").concat(a),n,void 0,o)}))}function da(e,t,n){var r=Oe({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(i){var a=i[0],c=i[1];typeof c=="string"&&(r[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function fa(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?Oe(Oe({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?Oe(Oe({},o),{attrs:Oe(Oe({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function pa(){return Math.random().toString(36).substring(2,8)}yt.displayName="UniverIcon";var ha={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"}}]},Qt=w.forwardRef(function(e,t){return w.createElement(yt,Object.assign({},e,{id:"delete-single",ref:t,icon:ha}))});Qt.displayName="DeleteSingle";var ma={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"}}]},wo=w.forwardRef(function(e,t){return w.createElement(yt,Object.assign({},e,{id:"increase-single",ref:t,icon:ma}))});wo.displayName="IncreaseSingle";var ga={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"}}]},un=w.forwardRef(function(e,t){return w.createElement(yt,Object.assign({},e,{id:"more-down-single",ref:t,icon:ga}))});un.displayName="MoreDownSingle";var va={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"}}]}]},xo=w.forwardRef(function(e,t){return w.createElement(yt,Object.assign({},e,{id:"sequence-single",ref:t,icon:va}))});xo.displayName="SequenceSingle";var ya={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"}}]}]},zt=w.forwardRef(function(e,t){return w.createElement(yt,Object.assign({},e,{id:"slash-single",ref:t,icon:ya}))});zt.displayName="SlashSingle";var Oo={exports:{}},At={},Wn={exports:{}};(function(e,t){(function(n,r){r(t)})(Ae,function(n){function r(F){return function(X,Y,G,re,ae,ge,Q){return F(X,Y,Q)}}function o(F){return function(X,Y,G,re){if(!X||!Y||typeof X!="object"||typeof Y!="object")return F(X,Y,G,re);var ae=re.get(X),ge=re.get(Y);if(ae&&ge)return ae===Y&&ge===X;re.set(X,Y),re.set(Y,X);var Q=F(X,Y,G,re);return re.delete(X),re.delete(Y),Q}}function i(F,U){var X={};for(var Y in F)X[Y]=F[Y];for(var Y in U)X[Y]=U[Y];return X}function a(F){return F.constructor===Object||F.constructor==null}function c(F){return typeof F.then=="function"}function l(F,U){return F===U||F!==F&&U!==U}var u="[object Arguments]",d="[object Boolean]",h="[object Date]",p="[object RegExp]",v="[object Map]",y="[object Number]",R="[object Object]",E="[object Set]",C="[object String]",T=Object.prototype.toString;function _(F){var U=F.areArraysEqual,X=F.areDatesEqual,Y=F.areMapsEqual,G=F.areObjectsEqual,re=F.areRegExpsEqual,ae=F.areSetsEqual,ge=F.createIsNestedEqual,Q=ge(Fe);function Fe(oe,le,Ne){if(oe===le)return!0;if(!oe||!le||typeof oe!="object"||typeof le!="object")return oe!==oe&&le!==le;if(a(oe)&&a(le))return G(oe,le,Q,Ne);var zr=Array.isArray(oe),Ar=Array.isArray(le);if(zr||Ar)return zr===Ar&&U(oe,le,Q,Ne);var je=T.call(oe);return je!==T.call(le)?!1:je===h?X(oe,le,Q,Ne):je===p?re(oe,le,Q,Ne):je===v?Y(oe,le,Q,Ne):je===E?ae(oe,le,Q,Ne):je===R||je===u?c(oe)||c(le)?!1:G(oe,le,Q,Ne):je===d||je===y||je===C?l(oe.valueOf(),le.valueOf()):!1}return Fe}function I(F,U,X,Y){var G=F.length;if(U.length!==G)return!1;for(;G-- >0;)if(!X(F[G],U[G],G,G,F,U,Y))return!1;return!0}var m=o(I);function x(F,U){return l(F.valueOf(),U.valueOf())}function O(F,U,X,Y){var G=F.size===U.size;if(!G)return!1;if(!F.size)return!0;var re={},ae=0;return F.forEach(function(ge,Q){if(G){var Fe=!1,oe=0;U.forEach(function(le,Ne){!Fe&&!re[oe]&&(Fe=X(Q,Ne,ae,oe,F,U,Y)&&X(ge,le,Q,Ne,F,U,Y))&&(re[oe]=!0),oe++}),ae++,G=Fe}}),G}var S=o(O),M="_owner",j=Object.prototype.hasOwnProperty;function $(F,U,X,Y){var G=Object.keys(F),re=G.length;if(Object.keys(U).length!==re)return!1;for(var ae;re-- >0;){if(ae=G[re],ae===M){var ge=!!F.$$typeof,Q=!!U.$$typeof;if((ge||Q)&&ge!==Q)return!1}if(!j.call(U,ae)||!X(F[ae],U[ae],ae,ae,F,U,Y))return!1}return!0}var H=o($);function b(F,U){return F.source===U.source&&F.flags===U.flags}function D(F,U,X,Y){var G=F.size===U.size;if(!G)return!1;if(!F.size)return!0;var re={};return F.forEach(function(ae,ge){if(G){var Q=!1,Fe=0;U.forEach(function(oe,le){!Q&&!re[Fe]&&(Q=X(ae,oe,ge,le,F,U,Y))&&(re[Fe]=!0),Fe++}),G=Q}}),G}var J=o(D),be=Object.freeze({areArraysEqual:I,areDatesEqual:x,areMapsEqual:O,areObjectsEqual:$,areRegExpsEqual:b,areSetsEqual:D,createIsNestedEqual:r}),he=Object.freeze({areArraysEqual:m,areDatesEqual:x,areMapsEqual:S,areObjectsEqual:H,areRegExpsEqual:b,areSetsEqual:J,createIsNestedEqual:r}),me=_(be);function Ee(F,U){return me(F,U,void 0)}var V=_(i(be,{createIsNestedEqual:function(){return l}}));function K(F,U){return V(F,U,void 0)}var ne=_(he);function ie(F,U){return ne(F,U,new WeakMap)}var ce=_(i(he,{createIsNestedEqual:function(){return l}}));function fe(F,U){return ce(F,U,new WeakMap)}function xe(F){return _(i(be,F(be)))}function De(F){var U=_(i(he,F(he)));return function(X,Y,G){return G===void 0&&(G=new WeakMap),U(X,Y,G)}}n.circularDeepEqual=ie,n.circularShallowEqual=fe,n.createCustomCircularEqual=De,n.createCustomEqual=xe,n.deepEqual=Ee,n.sameValueZeroEqual=l,n.shallowEqual=K,Object.defineProperty(n,"__esModule",{value:!0})})})(Wn,Wn.exports);var ur=Wn.exports,q={},Ca=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(q,"__esModule",{value:!0});q.bottom=dr;q.childrenEqual=Ra;q.cloneLayout=Eo;q.cloneLayoutItem=Qe;q.collides=dn;q.compact=Po;q.compactItem=Mo;q.compactType=$a;q.correctBounds=Fo;q.fastPositionEqual=_a;q.fastRGLPropsEqual=void 0;q.getAllCollisions=No;q.getFirstCollision=Ze;q.getLayoutItem=fr;q.getStatics=pr;q.modifyLayout=Do;q.moveElement=Et;q.moveElementAwayFromCollision=qn;q.noop=void 0;q.perc=Ia;q.resizeItemInDirection=Pa;q.setTopLeft=Fa;q.setTransform=Ma;q.sortLayoutItems=Cr;q.sortLayoutItemsByColRow=Vo;q.sortLayoutItemsByRowCol=Uo;q.synchronizeLayoutWithChildren=Na;q.validateLayout=ja;q.withLayoutItem=ba;var Wr=ur,Ot=Sa(w);function Sa(e){return e&&e.__esModule?e:{default:e}}function dr(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function Eo(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Qe(e[n]);return t}function Do(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function ba(e,t,n){let r=fr(e,t);return r?(r=n(Qe(r)),e=Do(e,r),[e,r]):[e,null]}function Qe(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function Ra(e,t){return(0,Wr.deepEqual)(Ot.default.Children.map(e,n=>n==null?void 0:n.key),Ot.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,Wr.deepEqual)(Ot.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),Ot.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}q.fastRGLPropsEqual=Ca;function _a(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function dn(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function Po(e,t,n,r){const o=pr(e),i=Cr(e,t),a=Array(e.length);for(let c=0,l=i.length;c<l;c++){let u=Qe(i[c]);u.static||(u=Mo(o,u,t,n,i,r),o.push(u)),a[e.indexOf(i[c])]=u,u.moved=!1}return a}const Ta={x:"w",y:"h"};function kn(e,t,n,r){const o=Ta[r];t[r]+=1;const i=e.map(a=>a.i).indexOf(t.i);for(let a=i+1;a<e.length;a++){const c=e[a];if(!c.static){if(c.y>t.y+t.h)break;dn(t,c)&&kn(e,c,n+t[o],r)}}t[r]=n}function Mo(e,t,n,r,o,i){const a=n==="vertical",c=n==="horizontal";if(a)for(t.y=Math.min(dr(e),t.y);t.y>0&&!Ze(e,t);)t.y--;else if(c)for(;t.x>0&&!Ze(e,t);)t.x--;let l;for(;(l=Ze(e,t))&&!(n===null&&i);)if(c?kn(o,t,l.x+l.w,"x"):kn(o,t,l.y+l.h,"y"),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Ze(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function Fo(e,t){const n=pr(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;Ze(n,i);)i.y++}return e}function fr(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Ze(e,t){for(let n=0,r=e.length;n<r;n++)if(dn(e[n],t))return e[n]}function No(e,t){return e.filter(n=>dn(n,t))}function pr(e){return e.filter(t=>t.static)}function Et(e,t,n,r,o,i,a,c,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;const u=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let h=Cr(e,a);(a==="vertical"&&typeof r=="number"?d>=r:a==="horizontal"&&typeof n=="number"?u>=n:!1)&&(h=h.reverse());const v=No(h,t),y=v.length>0;if(y&&l)return Eo(e);if(y&&i)return`${t.i}`,t.x=u,t.y=d,t.moved=!1,e;for(let R=0,E=v.length;R<E;R++){const C=v[R];`${t.i}${t.x}${t.y}${C.i}${C.x}${C.y}`,!C.moved&&(C.static?e=qn(e,C,t,o,a):e=qn(e,t,C,o,a))}return e}function qn(e,t,n,r,o,i){const a=o==="horizontal",c=o==="vertical",l=t.static;if(r){r=!1;const h={x:a?Math.max(t.x-n.w,0):n.x,y:c?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},p=Ze(e,h),v=p&&p.y+p.h>t.y,y=p&&t.x+t.w>p.x;if(p){if(v&&c)return Et(e,n,void 0,t.y+1,r,l,o);if(v&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(y&&a)return Et(e,t,n.x,void 0,r,l,o)}else return`${n.i}${h.x}${h.y}`,Et(e,n,a?h.x:void 0,c?h.y:void 0,r,l,o)}const u=a?n.x+1:void 0,d=c?n.y+1:void 0;return u==null&&d==null?e:Et(e,n,a?n.x+1:void 0,c?n.y+1:void 0,r,l,o)}function Ia(e){return e*100+"%"}const jo=(e,t,n,r)=>e+n>r?t:n,$o=(e,t,n)=>e<0?t:n,Lo=e=>Math.max(0,e),hr=e=>Math.max(0,e),mr=(e,t,n)=>{let{left:r,height:o,width:i}=t;const a=e.top-(o-e.height);return{left:r,width:i,height:$o(a,e.height,o),top:hr(a)}},gr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{top:r,height:i,width:jo(e.left,e.width,a,n),left:Lo(o)}},vr=(e,t,n)=>{let{top:r,height:o,width:i}=t;const a=e.left-(i-e.width);return{height:o,width:a<0?e.width:jo(e.left,e.width,i,n),top:hr(r),left:Lo(a)}},yr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{width:a,left:o,height:$o(r,e.height,i),top:hr(r)}},wa=function(){return mr(arguments.length<=0?void 0:arguments[0],gr(...arguments))},xa=function(){return mr(arguments.length<=0?void 0:arguments[0],vr(...arguments))},Oa=function(){return yr(arguments.length<=0?void 0:arguments[0],gr(...arguments))},Ea=function(){return yr(arguments.length<=0?void 0:arguments[0],vr(...arguments))},Da={n:mr,ne:wa,e:gr,se:Oa,s:yr,sw:Ea,w:vr,nw:xa};function Pa(e,t,n,r){const o=Da[e];return o?o(t,{...t,...n},r):n}function Ma(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function Fa(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function Cr(e,t){return t==="horizontal"?Vo(e):t==="vertical"?Uo(e):e}function Uo(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function Vo(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function Na(e,t,n,r,o){e=e||[];const i=[];Ot.default.Children.forEach(t,c=>{if((c==null?void 0:c.key)==null)return;const l=fr(e,String(c.key)),u=c.props["data-grid"];l&&u==null?i.push(Qe(l)):u?i.push(Qe({...u,i:c.key})):i.push(Qe({w:1,h:1,x:0,y:dr(i),i:String(c.key)}))});const a=Fo(i,{cols:n});return o?a:Po(a,r,n)}function ja(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let a=0;a<n.length;a++)if(typeof i[n[a]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[a]+" must be a number!")}}function $a(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const La=()=>{};q.noop=La;var Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.calcGridColWidth=fn;Le.calcGridItemPosition=Ua;Le.calcGridItemWHPx=Bn;Le.calcWH=za;Le.calcXY=Va;Le.clamp=Je;function fn(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function Bn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function Ua(e,t,n,r,o,i){const{margin:a,containerPadding:c,rowHeight:l}=e,u=fn(e),d={};return i&&i.resizing?(d.width=Math.round(i.resizing.width),d.height=Math.round(i.resizing.height)):(d.width=Bn(r,u,a[0]),d.height=Bn(o,l,a[1])),i&&i.dragging?(d.top=Math.round(i.dragging.top),d.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(d.top=Math.round(i.resizing.top),d.left=Math.round(i.resizing.left)):(d.top=Math.round((l+a[1])*n+c[1]),d.left=Math.round((u+a[0])*t+c[0])),d}function Va(e,t,n,r,o){const{margin:i,cols:a,rowHeight:c,maxRows:l}=e,u=fn(e);let d=Math.round((n-i[0])/(u+i[0])),h=Math.round((t-i[1])/(c+i[1]));return d=Je(d,0,a-r),h=Je(h,0,l-o),{x:d,y:h}}function za(e,t,n,r,o,i){const{margin:a,maxRows:c,cols:l,rowHeight:u}=e,d=fn(e);let h=Math.round((t+a[0])/(d+a[0])),p=Math.round((n+a[1])/(u+a[1])),v=Je(h,0,l-r),y=Je(p,0,c-o);return["sw","w","nw"].indexOf(i)!==-1&&(v=Je(h,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(y=Je(p,0,c)),{w:v,h:y}}function Je(e,t,n){return Math.max(Math.min(e,n),t)}var pn={},zo={exports:{}},Aa="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Ha=Aa,Wa=Ha;function Ao(){}function Ho(){}Ho.resetWarningCache=Ao;var ka=function(){function e(r,o,i,a,c,l){if(l!==Wa){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Ho,resetWarningCache:Ao};return n.PropTypes=n,n};zo.exports=ka();var Ge=zo.exports,hn={exports:{}},Wo={},se={},Ue={};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.dontSetMe=Ya;Ue.findInArray=qa;Ue.int=Xa;Ue.isFunction=Ba;Ue.isNum=Ga;function qa(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function Ba(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Ga(e){return typeof e=="number"&&!isNaN(e)}function Xa(e){return parseInt(e,10)}function Ya(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}var rt={};Object.defineProperty(rt,"__esModule",{value:!0});rt.browserPrefixToKey=qo;rt.browserPrefixToStyle=Ka;rt.default=void 0;rt.getPrefix=ko;const Pn=["Moz","Webkit","O","ms"];function ko(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let r=0;r<Pn.length;r++)if(qo(t,Pn[r])in n)return Pn[r];return""}function qo(e,t){return t?"".concat(t).concat(Za(e)):e}function Ka(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Za(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}rt.default=ko();Object.defineProperty(se,"__esModule",{value:!0});se.addClassName=Xo;se.addEvent=es;se.addUserSelectStyles=ds;se.createCSSTransform=ss;se.createSVGTransform=ls;se.getTouch=cs;se.getTouchIdentifier=us;se.getTranslation=Sr;se.innerHeight=os;se.innerWidth=is;se.matchesSelector=Go;se.matchesSelectorAndParentsTo=Qa;se.offsetXYFromParent=as;se.outerHeight=ns;se.outerWidth=rs;se.removeClassName=Yo;se.removeEvent=ts;se.removeUserSelectStyles=fs;var we=Ue,kr=Ja(rt);function Bo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Bo=function(r){return r?n:t})(e)}function Ja(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Bo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}let qt="";function Go(e,t){return qt||(qt=(0,we.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,we.isFunction)(e[n])})),(0,we.isFunction)(e[qt])?e[qt](t):!1}function Qa(e,t,n){let r=e;do{if(Go(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function es(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function ts(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function ns(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,we.int)(n.borderTopWidth),t+=(0,we.int)(n.borderBottomWidth),t}function rs(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,we.int)(n.borderLeftWidth),t+=(0,we.int)(n.borderRightWidth),t}function os(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,we.int)(n.paddingTop),t-=(0,we.int)(n.paddingBottom),t}function is(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,we.int)(n.paddingLeft),t-=(0,we.int)(n.paddingRight),t}function as(e,t,n){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-o.left)/n,a=(e.clientY+t.scrollTop-o.top)/n;return{x:i,y:a}}function ss(e,t){const n=Sr(e,t,"px");return{[(0,kr.browserPrefixToKey)("transform",kr.default)]:n}}function ls(e,t){return Sr(e,t,"")}function Sr(e,t,n){let{x:r,y:o}=e,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){const a="".concat(typeof t.x=="string"?t.x:t.x+n),c="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(a,", ").concat(c,")")+i}return i}function cs(e,t){return e.targetTouches&&(0,we.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,we.findInArray)(e.changedTouches,n=>t===n.identifier)}function us(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function ds(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
9
|
+
*/var Vi=w,zi=Symbol.for("react.element"),Ai=Symbol.for("react.fragment"),Hi=Object.prototype.hasOwnProperty,Wi=Vi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ki={key:!0,ref:!0,__self:!0,__source:!0};function Ro(e,t,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Hi.call(t,r)&&!ki.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:zi,type:e,key:i,ref:a,props:o,_owner:Wi.current}}sn.Fragment=Ai;sn.jsx=Ro;sn.jsxs=Ro;bo.exports=sn;var p=bo.exports;const qi="univer-conditional-formatting-wrap",Bi="univer-cf-rule-item",Gi="univer-preview",Xi="univer-create-rule",Yi="univer-button",Ki="univer-title",Zi="univer-label",Ji="univer-label-container",Qi="univer-input-width",ea="univer-m-t-base",ta="univer-m-t-sm",na="univer-m-t-xl",ra="univer-m-l-sm",oa="univer-m-l-xl",ia="univer-m-l-xxs",aa="univer-m-l-0",sa="univer-m-r-0",P={conditionalFormattingWrap:qi,cfRuleItem:Bi,preview:Gi,createRule:Xi,button:Yi,title:Ki,label:Zi,labelContainer:Ji,inputWidth:Qi,mTBase:ea,mTSm:ta,mTXl:na,mLSm:ra,mLXl:oa,mLXxs:ia,mL0:aa,mR0:sa};var we=function(){return we=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},we.apply(this,arguments)},la=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},gt=w.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,i=e.extend,a=la(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),l=w.useRef("_".concat(da()));return _o(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},we({ref:t,className:c},a),i)});function _o(e,t,n,r,o){return w.createElement(e.tag,we(we({key:t},ca(e,n,o)),r),(ua(e,n).children||[]).map(function(i,a){return _o(i,"".concat(t,"-").concat(e.tag,"-").concat(a),n,void 0,o)}))}function ca(e,t,n){var r=we({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(i){var a=i[0],c=i[1];typeof c=="string"&&(r[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function ua(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?we(we({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?we(we({},o),{attrs:we(we({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function da(){return Math.random().toString(36).substring(2,8)}gt.displayName="UniverIcon";var fa={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"}}]},Zt=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"delete-single",ref:t,icon:fa}))});Zt.displayName="DeleteSingle";var pa={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=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"increase-single",ref:t,icon:pa}))});To.displayName="IncreaseSingle";var ha={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ln=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"more-down-single",ref:t,icon:ha}))});ln.displayName="MoreDownSingle";var ma={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"}}]}]},Io=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"sequence-single",ref:t,icon:ma}))});Io.displayName="SequenceSingle";var ga={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"}}]}]},Ut=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"slash-single",ref:t,icon:ga}))});Ut.displayName="SlashSingle";var wo={exports:{}},Vt={},An={exports:{}};(function(e,t){(function(n,r){r(t)})(Ve,function(n){function r(F){return function(G,X,B,te,oe,me,J){return F(G,X,J)}}function o(F){return function(G,X,B,te){if(!G||!X||typeof G!="object"||typeof X!="object")return F(G,X,B,te);var oe=te.get(G),me=te.get(X);if(oe&&me)return oe===X&&me===G;te.set(G,X),te.set(X,G);var J=F(G,X,B,te);return te.delete(G),te.delete(X),J}}function i(F,U){var G={};for(var X in F)G[X]=F[X];for(var X in U)G[X]=U[X];return G}function a(F){return F.constructor===Object||F.constructor==null}function c(F){return typeof F.then=="function"}function l(F,U){return F===U||F!==F&&U!==U}var d="[object Arguments]",f="[object Boolean]",m="[object Date]",h="[object RegExp]",v="[object Map]",y="[object Number]",R="[object Object]",E="[object Set]",C="[object String]",T=Object.prototype.toString;function _(F){var U=F.areArraysEqual,G=F.areDatesEqual,X=F.areMapsEqual,B=F.areObjectsEqual,te=F.areRegExpsEqual,oe=F.areSetsEqual,me=F.createIsNestedEqual,J=me(Pe);function Pe(ne,ae,Me){if(ne===ae)return!0;if(!ne||!ae||typeof ne!="object"||typeof ae!="object")return ne!==ne&&ae!==ae;if(a(ne)&&a(ae))return B(ne,ae,J,Me);var Ur=Array.isArray(ne),Vr=Array.isArray(ae);if(Ur||Vr)return Ur===Vr&&U(ne,ae,J,Me);var Fe=T.call(ne);return Fe!==T.call(ae)?!1:Fe===m?G(ne,ae,J,Me):Fe===h?te(ne,ae,J,Me):Fe===v?X(ne,ae,J,Me):Fe===E?oe(ne,ae,J,Me):Fe===R||Fe===d?c(ne)||c(ae)?!1:B(ne,ae,J,Me):Fe===f||Fe===y||Fe===C?l(ne.valueOf(),ae.valueOf()):!1}return Pe}function I(F,U,G,X){var B=F.length;if(U.length!==B)return!1;for(;B-- >0;)if(!G(F[B],U[B],B,B,F,U,X))return!1;return!0}var g=o(I);function x(F,U){return l(F.valueOf(),U.valueOf())}function O(F,U,G,X){var B=F.size===U.size;if(!B)return!1;if(!F.size)return!0;var te={},oe=0;return F.forEach(function(me,J){if(B){var Pe=!1,ne=0;U.forEach(function(ae,Me){!Pe&&!te[ne]&&(Pe=G(J,Me,oe,ne,F,U,X)&&G(me,ae,J,Me,F,U,X))&&(te[ne]=!0),ne++}),oe++,B=Pe}}),B}var S=o(O),M="_owner",j=Object.prototype.hasOwnProperty;function $(F,U,G,X){var B=Object.keys(F),te=B.length;if(Object.keys(U).length!==te)return!1;for(var oe;te-- >0;){if(oe=B[te],oe===M){var me=!!F.$$typeof,J=!!U.$$typeof;if((me||J)&&me!==J)return!1}if(!j.call(U,oe)||!G(F[oe],U[oe],oe,oe,F,U,X))return!1}return!0}var A=o($);function b(F,U){return F.source===U.source&&F.flags===U.flags}function D(F,U,G,X){var B=F.size===U.size;if(!B)return!1;if(!F.size)return!0;var te={};return F.forEach(function(oe,me){if(B){var J=!1,Pe=0;U.forEach(function(ne,ae){!J&&!te[Pe]&&(J=G(oe,ne,me,ae,F,U,X))&&(te[Pe]=!0),Pe++}),B=J}}),B}var Z=o(D),Ce=Object.freeze({areArraysEqual:I,areDatesEqual:x,areMapsEqual:O,areObjectsEqual:$,areRegExpsEqual:b,areSetsEqual:D,createIsNestedEqual:r}),pe=Object.freeze({areArraysEqual:g,areDatesEqual:x,areMapsEqual:S,areObjectsEqual:A,areRegExpsEqual:b,areSetsEqual:Z,createIsNestedEqual:r}),he=_(Ce);function xe(F,U){return he(F,U,void 0)}var V=_(i(Ce,{createIsNestedEqual:function(){return l}}));function Y(F,U){return V(F,U,void 0)}var ee=_(pe);function re(F,U){return ee(F,U,new WeakMap)}var se=_(i(pe,{createIsNestedEqual:function(){return l}}));function ue(F,U){return se(F,U,new WeakMap)}function Ie(F){return _(i(Ce,F(Ce)))}function Oe(F){var U=_(i(pe,F(pe)));return function(G,X,B){return B===void 0&&(B=new WeakMap),U(G,X,B)}}n.circularDeepEqual=re,n.circularShallowEqual=ue,n.createCustomCircularEqual=Oe,n.createCustomEqual=Ie,n.deepEqual=xe,n.sameValueZeroEqual=l,n.shallowEqual=Y,Object.defineProperty(n,"__esModule",{value:!0})})})(An,An.exports);var lr=An.exports,k={},va=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(k,"__esModule",{value:!0});k.bottom=cr;k.childrenEqual=Sa;k.cloneLayout=xo;k.cloneLayoutItem=Ze;k.collides=cn;k.compact=Eo;k.compactItem=Do;k.compactType=Na;k.correctBounds=Po;k.fastPositionEqual=ba;k.fastRGLPropsEqual=void 0;k.getAllCollisions=Mo;k.getFirstCollision=Ye;k.getLayoutItem=ur;k.getStatics=dr;k.modifyLayout=Oo;k.moveElement=xt;k.moveElementAwayFromCollision=Wn;k.noop=void 0;k.perc=_a;k.resizeItemInDirection=Ea;k.setTopLeft=Pa;k.setTransform=Da;k.sortLayoutItems=vr;k.sortLayoutItemsByColRow=Lo;k.sortLayoutItemsByRowCol=$o;k.synchronizeLayoutWithChildren=Ma;k.validateLayout=Fa;k.withLayoutItem=Ca;var Ar=lr,wt=ya(w);function ya(e){return e&&e.__esModule?e:{default:e}}function cr(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function xo(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Ze(e[n]);return t}function Oo(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function Ca(e,t,n){let r=ur(e,t);return r?(r=n(Ze(r)),e=Oo(e,r),[e,r]):[e,null]}function Ze(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function Sa(e,t){return(0,Ar.deepEqual)(wt.default.Children.map(e,n=>n==null?void 0:n.key),wt.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,Ar.deepEqual)(wt.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),wt.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}k.fastRGLPropsEqual=va;function ba(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function cn(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function Eo(e,t,n,r){const o=dr(e),i=vr(e,t),a=Array(e.length);for(let c=0,l=i.length;c<l;c++){let d=Ze(i[c]);d.static||(d=Do(o,d,t,n,i,r),o.push(d)),a[e.indexOf(i[c])]=d,d.moved=!1}return a}const Ra={x:"w",y:"h"};function Hn(e,t,n,r){const o=Ra[r];t[r]+=1;const i=e.map(a=>a.i).indexOf(t.i);for(let a=i+1;a<e.length;a++){const c=e[a];if(!c.static){if(c.y>t.y+t.h)break;cn(t,c)&&Hn(e,c,n+t[o],r)}}t[r]=n}function Do(e,t,n,r,o,i){const a=n==="vertical",c=n==="horizontal";if(a)for(t.y=Math.min(cr(e),t.y);t.y>0&&!Ye(e,t);)t.y--;else if(c)for(;t.x>0&&!Ye(e,t);)t.x--;let l;for(;(l=Ye(e,t))&&!(n===null&&i);)if(c?Hn(o,t,l.x+l.w,"x"):Hn(o,t,l.y+l.h,"y"),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Ye(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function Po(e,t){const n=dr(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;Ye(n,i);)i.y++}return e}function ur(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Ye(e,t){for(let n=0,r=e.length;n<r;n++)if(cn(e[n],t))return e[n]}function Mo(e,t){return e.filter(n=>cn(n,t))}function dr(e){return e.filter(t=>t.static)}function xt(e,t,n,r,o,i,a,c,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;const d=t.x,f=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let m=vr(e,a);(a==="vertical"&&typeof r=="number"?f>=r:a==="horizontal"&&typeof n=="number"?d>=n:!1)&&(m=m.reverse());const v=Mo(m,t),y=v.length>0;if(y&&l)return xo(e);if(y&&i)return`${t.i}`,t.x=d,t.y=f,t.moved=!1,e;for(let R=0,E=v.length;R<E;R++){const C=v[R];`${t.i}${t.x}${t.y}${C.i}${C.x}${C.y}`,!C.moved&&(C.static?e=Wn(e,C,t,o,a):e=Wn(e,t,C,o,a))}return e}function Wn(e,t,n,r,o,i){const a=o==="horizontal",c=o==="vertical",l=t.static;if(r){r=!1;const m={x:a?Math.max(t.x-n.w,0):n.x,y:c?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},h=Ye(e,m),v=h&&h.y+h.h>t.y,y=h&&t.x+t.w>h.x;if(h){if(v&&c)return xt(e,n,void 0,t.y+1,r,l,o);if(v&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(y&&a)return xt(e,t,n.x,void 0,r,l,o)}else return`${n.i}${m.x}${m.y}`,xt(e,n,a?m.x:void 0,c?m.y:void 0,r,l,o)}const d=a?n.x+1:void 0,f=c?n.y+1:void 0;return d==null&&f==null?e:xt(e,n,a?n.x+1:void 0,c?n.y+1:void 0,r,l,o)}function _a(e){return e*100+"%"}const Fo=(e,t,n,r)=>e+n>r?t:n,No=(e,t,n)=>e<0?t:n,jo=e=>Math.max(0,e),fr=e=>Math.max(0,e),pr=(e,t,n)=>{let{left:r,height:o,width:i}=t;const a=e.top-(o-e.height);return{left:r,width:i,height:No(a,e.height,o),top:fr(a)}},hr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{top:r,height:i,width:Fo(e.left,e.width,a,n),left:jo(o)}},mr=(e,t,n)=>{let{top:r,height:o,width:i}=t;const a=e.left-(i-e.width);return{height:o,width:a<0?e.width:Fo(e.left,e.width,i,n),top:fr(r),left:jo(a)}},gr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{width:a,left:o,height:No(r,e.height,i),top:fr(r)}},Ta=function(){return pr(arguments.length<=0?void 0:arguments[0],hr(...arguments))},Ia=function(){return pr(arguments.length<=0?void 0:arguments[0],mr(...arguments))},wa=function(){return gr(arguments.length<=0?void 0:arguments[0],hr(...arguments))},xa=function(){return gr(arguments.length<=0?void 0:arguments[0],mr(...arguments))},Oa={n:pr,ne:Ta,e:hr,se:wa,s:gr,sw:xa,w:mr,nw:Ia};function Ea(e,t,n,r){const o=Oa[e];return o?o(t,{...t,...n},r):n}function Da(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function Pa(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function vr(e,t){return t==="horizontal"?Lo(e):t==="vertical"?$o(e):e}function $o(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function Lo(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function Ma(e,t,n,r,o){e=e||[];const i=[];wt.default.Children.forEach(t,c=>{if((c==null?void 0:c.key)==null)return;const l=ur(e,String(c.key)),d=c.props["data-grid"];l&&d==null?i.push(Ze(l)):d?i.push(Ze({...d,i:c.key})):i.push(Ze({w:1,h:1,x:0,y:cr(i),i:String(c.key)}))});const a=Po(i,{cols:n});return o?a:Eo(a,r,n)}function Fa(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let a=0;a<n.length;a++)if(typeof i[n[a]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[a]+" must be a number!")}}function Na(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const ja=()=>{};k.noop=ja;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.calcGridColWidth=un;je.calcGridItemPosition=$a;je.calcGridItemWHPx=kn;je.calcWH=Ua;je.calcXY=La;je.clamp=Ke;function un(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function kn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function $a(e,t,n,r,o,i){const{margin:a,containerPadding:c,rowHeight:l}=e,d=un(e),f={};return i&&i.resizing?(f.width=Math.round(i.resizing.width),f.height=Math.round(i.resizing.height)):(f.width=kn(r,d,a[0]),f.height=kn(o,l,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((l+a[1])*n+c[1]),f.left=Math.round((d+a[0])*t+c[0])),f}function La(e,t,n,r,o){const{margin:i,cols:a,rowHeight:c,maxRows:l}=e,d=un(e);let f=Math.round((n-i[0])/(d+i[0])),m=Math.round((t-i[1])/(c+i[1]));return f=Ke(f,0,a-r),m=Ke(m,0,l-o),{x:f,y:m}}function Ua(e,t,n,r,o,i){const{margin:a,maxRows:c,cols:l,rowHeight:d}=e,f=un(e);let m=Math.round((t+a[0])/(f+a[0])),h=Math.round((n+a[1])/(d+a[1])),v=Ke(m,0,l-r),y=Ke(h,0,c-o);return["sw","w","nw"].indexOf(i)!==-1&&(v=Ke(m,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(y=Ke(h,0,c)),{w:v,h:y}}function Ke(e,t,n){return Math.max(Math.min(e,n),t)}var dn={},Uo={exports:{}},Va="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",za=Va,Aa=za;function Vo(){}function zo(){}zo.resetWarningCache=Vo;var Ha=function(){function e(r,o,i,a,c,l){if(l!==Aa){var d=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 d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:zo,resetWarningCache:Vo};return n.PropTypes=n,n};Uo.exports=Ha();var qe=Uo.exports,fn={exports:{}},Ao={},ie={},$e={};Object.defineProperty($e,"__esModule",{value:!0});$e.dontSetMe=Ga;$e.findInArray=Wa;$e.int=Ba;$e.isFunction=ka;$e.isNum=qa;function Wa(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function ka(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function qa(e){return typeof e=="number"&&!isNaN(e)}function Ba(e){return parseInt(e,10)}function Ga(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}var tt={};Object.defineProperty(tt,"__esModule",{value:!0});tt.browserPrefixToKey=Wo;tt.browserPrefixToStyle=Xa;tt.default=void 0;tt.getPrefix=Ho;const En=["Moz","Webkit","O","ms"];function Ho(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let r=0;r<En.length;r++)if(Wo(t,En[r])in n)return En[r];return""}function Wo(e,t){return t?"".concat(t).concat(Ya(e)):e}function Xa(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Ya(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}tt.default=Ho();Object.defineProperty(ie,"__esModule",{value:!0});ie.addClassName=Bo;ie.addEvent=Ja;ie.addUserSelectStyles=cs;ie.createCSSTransform=is;ie.createSVGTransform=as;ie.getTouch=ss;ie.getTouchIdentifier=ls;ie.getTranslation=yr;ie.innerHeight=ns;ie.innerWidth=rs;ie.matchesSelector=qo;ie.matchesSelectorAndParentsTo=Za;ie.offsetXYFromParent=os;ie.outerHeight=es;ie.outerWidth=ts;ie.removeClassName=Go;ie.removeEvent=Qa;ie.removeUserSelectStyles=us;var Te=$e,Hr=Ka(tt);function ko(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ko=function(r){return r?n:t})(e)}function Ka(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ko(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}let Wt="";function qo(e,t){return Wt||(Wt=(0,Te.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,Te.isFunction)(e[n])})),(0,Te.isFunction)(e[Wt])?e[Wt](t):!1}function Za(e,t,n){let r=e;do{if(qo(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Ja(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function Qa(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function es(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Te.int)(n.borderTopWidth),t+=(0,Te.int)(n.borderBottomWidth),t}function ts(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Te.int)(n.borderLeftWidth),t+=(0,Te.int)(n.borderRightWidth),t}function ns(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Te.int)(n.paddingTop),t-=(0,Te.int)(n.paddingBottom),t}function rs(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Te.int)(n.paddingLeft),t-=(0,Te.int)(n.paddingRight),t}function os(e,t,n){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-o.left)/n,a=(e.clientY+t.scrollTop-o.top)/n;return{x:i,y:a}}function is(e,t){const n=yr(e,t,"px");return{[(0,Hr.browserPrefixToKey)("transform",Hr.default)]:n}}function as(e,t){return yr(e,t,"")}function yr(e,t,n){let{x:r,y:o}=e,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){const a="".concat(typeof t.x=="string"?t.x:t.x+n),c="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(a,", ").concat(c,")")+i}return i}function ss(e,t){return e.targetTouches&&(0,Te.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,Te.findInArray)(e.changedTouches,n=>t===n.identifier)}function ls(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function cs(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
10
10
|
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
11
|
-
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Xo(e.body,"react-draggable-transparent-selection")}function fs(e){if(e)try{if(e.body&&Yo(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function Xo(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Yo(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.canDragX=ms;Ve.canDragY=gs;Ve.createCoreData=ys;Ve.createDraggableData=Cs;Ve.getBoundPosition=ps;Ve.getControlPosition=vs;Ve.snapToGrid=hs;var Te=Ue,pt=se;function ps(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:Ss(r);const o=br(e);if(typeof r=="string"){const{ownerDocument:i}=o,a=i.defaultView;let c;if(r==="parent"?c=o.parentNode:c=i.querySelector(r),!(c instanceof a.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=c,u=a.getComputedStyle(o),d=a.getComputedStyle(l);r={left:-o.offsetLeft+(0,Te.int)(d.paddingLeft)+(0,Te.int)(u.marginLeft),top:-o.offsetTop+(0,Te.int)(d.paddingTop)+(0,Te.int)(u.marginTop),right:(0,pt.innerWidth)(l)-(0,pt.outerWidth)(o)-o.offsetLeft+(0,Te.int)(d.paddingRight)-(0,Te.int)(u.marginRight),bottom:(0,pt.innerHeight)(l)-(0,pt.outerHeight)(o)-o.offsetTop+(0,Te.int)(d.paddingBottom)-(0,Te.int)(u.marginBottom)}}return(0,Te.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,Te.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Te.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,Te.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function hs(e,t,n){const r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]}function ms(e){return e.props.axis==="both"||e.props.axis==="x"}function gs(e){return e.props.axis==="both"||e.props.axis==="y"}function vs(e,t,n){const r=typeof t=="number"?(0,pt.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const o=br(n),i=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,pt.offsetXYFromParent)(r||e,i,n.props.scale)}function ys(e,t,n){const r=!(0,Te.isNum)(e.lastX),o=br(e);return r?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Cs(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function Ss(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function br(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var mn={},gn={};Object.defineProperty(gn,"__esModule",{value:!0});gn.default=bs;function bs(){}Object.defineProperty(mn,"__esModule",{value:!0});mn.default=void 0;var Mn=_s(w),Re=Rr(Ge),Rs=Rr(Ro),ve=se,We=Ve,Fn=Ue,_t=Rr(gn);function Rr(e){return e&&e.__esModule?e:{default:e}}function Ko(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Ko=function(r){return r?n:t})(e)}function _s(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Ko(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Se(e,t,n){return t=Ts(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ts(e){var t=Is(e,"string");return typeof t=="symbol"?t:String(t)}function Is(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Pe={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let ke=Pe.mouse,vn=class extends Mn.Component{constructor(){super(...arguments),Se(this,"dragging",!1),Se(this,"lastX",NaN),Se(this,"lastY",NaN),Se(this,"touchIdentifier",null),Se(this,"mounted",!1),Se(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(t.target instanceof r.defaultView.Node)||this.props.handle&&!(0,ve.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,ve.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const o=(0,ve.getTouchIdentifier)(t);this.touchIdentifier=o;const i=(0,We.getControlPosition)(t,o,this);if(i==null)return;const{x:a,y:c}=i,l=(0,We.createCoreData)(this,a,c);(0,_t.default)("DraggableCore: handleDragStart: %j",l),(0,_t.default)("calling",this.props.onStart),!(this.props.onStart(t,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,ve.addUserSelectStyles)(r),this.dragging=!0,this.lastX=a,this.lastY=c,(0,ve.addEvent)(r,ke.move,this.handleDrag),(0,ve.addEvent)(r,ke.stop,this.handleDragStop))}),Se(this,"handleDrag",t=>{const n=(0,We.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,l=o-this.lastY;if([c,l]=(0,We.snapToGrid)(this.props.grid,c,l),!c&&!l)return;r=this.lastX+c,o=this.lastY+l}const i=(0,We.createCoreData)(this,r,o);if((0,_t.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(t,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=o}),Se(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,We.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,u=o-this.lastY||0;[l,u]=(0,We.snapToGrid)(this.props.grid,l,u),r=this.lastX+l,o=this.lastY+u}const i=(0,We.createCoreData)(this,r,o);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,ve.removeUserSelectStyles)(c.ownerDocument),(0,_t.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,_t.default)("DraggableCore: Removing handlers"),(0,ve.removeEvent)(c.ownerDocument,ke.move,this.handleDrag),(0,ve.removeEvent)(c.ownerDocument,ke.stop,this.handleDragStop))}),Se(this,"onMouseDown",t=>(ke=Pe.mouse,this.handleDragStart(t))),Se(this,"onMouseUp",t=>(ke=Pe.mouse,this.handleDragStop(t))),Se(this,"onTouchStart",t=>(ke=Pe.touch,this.handleDragStart(t))),Se(this,"onTouchEnd",t=>(ke=Pe.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,ve.addEvent)(t,Pe.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,ve.removeEvent)(n,Pe.mouse.move,this.handleDrag),(0,ve.removeEvent)(n,Pe.touch.move,this.handleDrag),(0,ve.removeEvent)(n,Pe.mouse.stop,this.handleDragStop),(0,ve.removeEvent)(n,Pe.touch.stop,this.handleDragStop),(0,ve.removeEvent)(t,Pe.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,ve.removeUserSelectStyles)(n)}}findDOMNode(){var t,n;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:Rs.default.findDOMNode(this)}render(){return Mn.cloneElement(Mn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};mn.default=vn;Se(vn,"displayName","DraggableCore");Se(vn,"propTypes",{allowAnyClick:Re.default.bool,children:Re.default.node.isRequired,disabled:Re.default.bool,enableUserSelectHack:Re.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Re.default.arrayOf(Re.default.number),handle:Re.default.string,cancel:Re.default.string,nodeRef:Re.default.object,onStart:Re.default.func,onDrag:Re.default.func,onStop:Re.default.func,onMouseDown:Re.default.func,scale:Re.default.number,className:Fn.dontSetMe,style:Fn.dontSetMe,transform:Fn.dontSetMe});Se(vn,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),e.default=void 0;var t=p(w),n=d(Ge),r=d(Ro),o=d(Be),i=se,a=Ve,c=Ue,l=d(mn),u=d(gn);function d(T){return T&&T.__esModule?T:{default:T}}function h(T){if(typeof WeakMap!="function")return null;var _=new WeakMap,I=new WeakMap;return(h=function(m){return m?I:_})(T)}function p(T,_){if(T&&T.__esModule)return T;if(T===null||typeof T!="object"&&typeof T!="function")return{default:T};var I=h(_);if(I&&I.has(T))return I.get(T);var m={},x=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in T)if(O!=="default"&&Object.prototype.hasOwnProperty.call(T,O)){var S=x?Object.getOwnPropertyDescriptor(T,O):null;S&&(S.get||S.set)?Object.defineProperty(m,O,S):m[O]=T[O]}return m.default=T,I&&I.set(T,m),m}function v(){return v=Object.assign?Object.assign.bind():function(T){for(var _=1;_<arguments.length;_++){var I=arguments[_];for(var m in I)Object.prototype.hasOwnProperty.call(I,m)&&(T[m]=I[m])}return T},v.apply(this,arguments)}function y(T,_,I){return _=R(_),_ in T?Object.defineProperty(T,_,{value:I,enumerable:!0,configurable:!0,writable:!0}):T[_]=I,T}function R(T){var _=E(T,"string");return typeof _=="symbol"?_:String(_)}function E(T,_){if(typeof T!="object"||T===null)return T;var I=T[Symbol.toPrimitive];if(I!==void 0){var m=I.call(T,_||"default");if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_==="string"?String:Number)(T)}class C extends t.Component{static getDerivedStateFromProps(_,I){let{position:m}=_,{prevPropsPosition:x}=I;return m&&(!x||m.x!==x.x||m.y!==x.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:m,prevPropsPosition:x}),{x:m.x,y:m.y,prevPropsPosition:{...m}}):null}constructor(_){super(_),y(this,"onDragStart",(I,m)=>{if((0,u.default)("Draggable: onDragStart: %j",m),this.props.onStart(I,(0,a.createDraggableData)(this,m))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),y(this,"onDrag",(I,m)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",m);const x=(0,a.createDraggableData)(this,m),O={x:x.x,y:x.y,slackX:0,slackY:0};if(this.props.bounds){const{x:M,y:j}=O;O.x+=this.state.slackX,O.y+=this.state.slackY;const[$,H]=(0,a.getBoundPosition)(this,O.x,O.y);O.x=$,O.y=H,O.slackX=this.state.slackX+(M-O.x),O.slackY=this.state.slackY+(j-O.y),x.x=O.x,x.y=O.y,x.deltaX=O.x-this.state.x,x.deltaY=O.y-this.state.y}if(this.props.onDrag(I,x)===!1)return!1;this.setState(O)}),y(this,"onDragStop",(I,m)=>{if(!this.state.dragging||this.props.onStop(I,(0,a.createDraggableData)(this,m))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",m);const O={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:M,y:j}=this.props.position;O.x=M,O.y=j}this.setState(O)}),this.state={dragging:!1,dragged:!1,x:_.position?_.position.x:_.defaultPosition.x,y:_.position?_.position.y:_.defaultPosition.y,prevPropsPosition:{..._.position},slackX:0,slackY:0,isElementSVG:!1},_.position&&!(_.onDrag||_.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 _,I;return(_=(I=this.props)===null||I===void 0||(I=I.nodeRef)===null||I===void 0?void 0:I.current)!==null&&_!==void 0?_:r.default.findDOMNode(this)}render(){const{axis:_,bounds:I,children:m,defaultPosition:x,defaultClassName:O,defaultClassNameDragging:S,defaultClassNameDragged:M,position:j,positionOffset:$,scale:H,...b}=this.props;let D={},J=null;const he=!!!j||this.state.dragging,me=j||x,Ee={x:(0,a.canDragX)(this)&&he?this.state.x:me.x,y:(0,a.canDragY)(this)&&he?this.state.y:me.y};this.state.isElementSVG?J=(0,i.createSVGTransform)(Ee,$):D=(0,i.createCSSTransform)(Ee,$);const V=(0,o.default)(m.props.className||"",O,{[S]:this.state.dragging,[M]:this.state.dragged});return t.createElement(l.default,v({},b,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(m),{className:V,style:{...m.props.style,...D},transform:J}))}}e.default=C,y(C,"displayName","Draggable"),y(C,"propTypes",{...l.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),y(C,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Wo);const{default:Zo,DraggableCore:ws}=Wo;hn.exports=Zo;hn.exports.default=Zo;hn.exports.DraggableCore=ws;var Jo=hn.exports,yn={exports:{}},Ht={},_r={};_r.__esModule=!0;_r.cloneElement=Ms;var xs=Os(w);function Os(e){return e&&e.__esModule?e:{default:e}}function qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Br(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qr(Object(n),!0).forEach(function(r){Es(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Es(e,t,n){return t=Ds(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ds(e){var t=Ps(e,"string");return typeof t=="symbol"?t:String(t)}function Ps(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ms(e,t){return t.style&&e.props.style&&(t.style=Br(Br({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),xs.default.cloneElement(e,t)}var Wt={};Wt.__esModule=!0;Wt.resizableProps=void 0;var W=Fs(Ge);function Fs(e){return e&&e.__esModule?e:{default:e}}var Ns={axis:W.default.oneOf(["both","x","y","none"]),className:W.default.string,children:W.default.element.isRequired,draggableOpts:W.default.shape({allowAnyClick:W.default.bool,cancel:W.default.string,children:W.default.node,disabled:W.default.bool,enableUserSelectHack:W.default.bool,offsetParent:W.default.node,grid:W.default.arrayOf(W.default.number),handle:W.default.string,nodeRef:W.default.object,onStart:W.default.func,onDrag:W.default.func,onStop:W.default.func,onMouseDown:W.default.func,scale:W.default.number}),height:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="y"){var i;return(i=W.default.number).isRequired.apply(i,n)}return W.default.number.apply(W.default,n)},handle:W.default.oneOfType([W.default.node,W.default.func]),handleSize:W.default.arrayOf(W.default.number),lockAspectRatio:W.default.bool,maxConstraints:W.default.arrayOf(W.default.number),minConstraints:W.default.arrayOf(W.default.number),onResizeStop:W.default.func,onResizeStart:W.default.func,onResize:W.default.func,resizeHandles:W.default.arrayOf(W.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:W.default.number,width:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="x"){var i;return(i=W.default.number).isRequired.apply(i,n)}return W.default.number.apply(W.default,n)}};Wt.resizableProps=Ns;Ht.__esModule=!0;Ht.default=void 0;var Tt=Vs(w),js=Jo,$s=_r,Ls=Wt,Us=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Qo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Qo=function(o){return o?n:t})(e)}function Vs(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Qo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Gn(){return Gn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gn.apply(this,arguments)}function zs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Gr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Nn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gr(Object(n),!0).forEach(function(r){As(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function As(e,t,n){return t=Hs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hs(e){var t=Ws(e,"string");return typeof t=="symbol"?t:String(t)}function Ws(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ks(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xn(e,t)}function Xn(e,t){return Xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Xn(e,t)}var Tr=function(e){ks(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var n=t.prototype;return n.componentWillUnmount=function(){this.resetData()},n.resetData=function(){this.lastHandleRect=this.slack=null},n.runConstraints=function(o,i){var a=this.props,c=a.minConstraints,l=a.maxConstraints,u=a.lockAspectRatio;if(!c&&!l&&!u)return[o,i];if(u){var d=this.props.width/this.props.height,h=o-this.props.width,p=i-this.props.height;Math.abs(h)>Math.abs(p*d)?i=o/d:o=i*d}var v=o,y=i,R=this.slack||[0,0],E=R[0],C=R[1];return o+=E,i+=C,c&&(o=Math.max(c[0],o),i=Math.max(c[1],i)),l&&(o=Math.min(l[0],o),i=Math.min(l[1],i)),this.slack=[E+(v-o),C+(y-i)],[o,i]},n.resizeHandler=function(o,i){var a=this;return function(c,l){var u=l.node,d=l.deltaX,h=l.deltaY;o==="onResizeStart"&&a.resetData();var p=(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(!(!p&&!v)){var y=i[0],R=i[i.length-1],E=u.getBoundingClientRect();if(a.lastHandleRect!=null){if(R==="w"){var C=E.left-a.lastHandleRect.left;d+=C}if(y==="n"){var T=E.top-a.lastHandleRect.top;h+=T}}a.lastHandleRect=E,R==="w"&&(d=-d),y==="n"&&(h=-h);var _=a.props.width+(p?d/a.props.transformScale:0),I=a.props.height+(v?h/a.props.transformScale:0),m=a.runConstraints(_,I);_=m[0],I=m[1];var x=_!==a.props.width||I!==a.props.height,O=typeof a.props[o]=="function"?a.props[o]:null,S=o==="onResize"&&!x;O&&!S&&(c.persist==null||c.persist(),O(c,{node:u,size:{width:_,height:I},handle:i})),o==="onResizeStop"&&a.resetData()}}},n.renderResizeHandle=function(o,i){var a=this.props.handle;if(!a)return Tt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:i});if(typeof a=="function")return a(o,i);var c=typeof a.type=="string",l=Nn({ref:i},c?{}:{handleAxis:o});return Tt.cloneElement(a,l)},n.render=function(){var o=this,i=this.props,a=i.children,c=i.className,l=i.draggableOpts;i.width,i.height,i.handle,i.handleSize,i.lockAspectRatio,i.axis,i.minConstraints,i.maxConstraints,i.onResize,i.onResizeStop,i.onResizeStart;var u=i.resizeHandles;i.transformScale;var d=zs(i,Us);return(0,$s.cloneElement)(a,Nn(Nn({},d),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(a.props.children,u.map(function(h){var p,v=(p=o.handleRefs[h])!=null?p:o.handleRefs[h]=Tt.createRef();return Tt.createElement(js.DraggableCore,Gn({},l,{nodeRef:v,key:"resizableHandle-"+h,onStop:o.resizeHandler("onResizeStop",h),onStart:o.resizeHandler("onResizeStart",h),onDrag:o.resizeHandler("onResize",h)}),o.renderResizeHandle(h,v))}))}))},t}(Tt.Component);Ht.default=Tr;Tr.propTypes=Ls.resizableProps;Tr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var Cn={};Cn.__esModule=!0;Cn.default=void 0;var jn=Ys(w),qs=ei(Ge),Bs=ei(Ht),Gs=Wt,Xs=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function ei(e){return e&&e.__esModule?e:{default:e}}function ti(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ti=function(o){return o?n:t})(e)}function Ys(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ti(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Yn(){return Yn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yn.apply(this,arguments)}function Xr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function nn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xr(Object(n),!0).forEach(function(r){Ks(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ks(e,t,n){return t=Zs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zs(e){var t=Js(e,"string");return typeof t=="symbol"?t:String(t)}function Js(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function el(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Kn(e,t)}function Kn(e,t){return Kn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Kn(e,t)}var ni=function(e){el(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(c,l){var u=l.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(u,function(){return r.props.onResize&&r.props.onResize(c,l)})):r.setState(u)},r}t.getDerivedStateFromProps=function(o,i){return i.propsWidth!==o.width||i.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var n=t.prototype;return n.render=function(){var o=this.props,i=o.handle,a=o.handleSize;o.onResize;var c=o.onResizeStart,l=o.onResizeStop,u=o.draggableOpts,d=o.minConstraints,h=o.maxConstraints,p=o.lockAspectRatio,v=o.axis;o.width,o.height;var y=o.resizeHandles,R=o.style,E=o.transformScale,C=Qs(o,Xs);return jn.createElement(Bs.default,{axis:v,draggableOpts:u,handle:i,handleSize:a,height:this.state.height,lockAspectRatio:p,maxConstraints:h,minConstraints:d,onResizeStart:c,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:E,width:this.state.width},jn.createElement("div",Yn({},C,{style:nn(nn({},R),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(jn.Component);Cn.default=ni;ni.propTypes=nn(nn({},Gs.resizableProps),{},{children:qs.default.element});yn.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};yn.exports.Resizable=Ht.default;yn.exports.ResizableBox=Cn.default;var tl=yn.exports,He={};Object.defineProperty(He,"__esModule",{value:!0});He.resizeHandleType=He.resizeHandleAxesType=He.default=void 0;var k=ri(Ge),nl=ri(w);function ri(e){return e&&e.__esModule?e:{default:e}}const rl=He.resizeHandleAxesType=k.default.arrayOf(k.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),ol=He.resizeHandleType=k.default.oneOfType([k.default.node,k.default.func]);He.default={className:k.default.string,style:k.default.object,width:k.default.number,autoSize:k.default.bool,cols:k.default.number,draggableCancel:k.default.string,draggableHandle:k.default.string,verticalCompact:function(e){e.verticalCompact},compactType:k.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&q.validateLayout(t,"layout")},margin:k.default.arrayOf(k.default.number),containerPadding:k.default.arrayOf(k.default.number),rowHeight:k.default.number,maxRows:k.default.number,isBounded:k.default.bool,isDraggable:k.default.bool,isResizable:k.default.bool,allowOverlap:k.default.bool,preventCollision:k.default.bool,useCSSTransforms:k.default.bool,transformScale:k.default.number,isDroppable:k.default.bool,resizeHandles:rl,resizeHandle:ol,onLayoutChange:k.default.func,onDragStart:k.default.func,onDrag:k.default.func,onDragStop:k.default.func,onResizeStart:k.default.func,onResize:k.default.func,onResizeStop:k.default.func,onDrop:k.default.func,droppingItem:k.default.shape({i:k.default.string.isRequired,w:k.default.number.isRequired,h:k.default.number.isRequired}),children:function(e,t){const n=e[t],r={};nl.default.Children.forEach(n,function(o){if((o==null?void 0:o.key)!=null){if(r[o.key])throw new Error('Duplicate child key "'+o.key+'" found! This will cause problems in ReactGridLayout.');r[o.key]=!0}})},innerRef:k.default.any};Object.defineProperty(pn,"__esModule",{value:!0});pn.default=void 0;var st=Ir(w),Z=Ir(Ge),il=Jo,al=tl,lt=q,pe=Le,Yr=He,sl=Ir(Be);function Ir(e){return e&&e.__esModule?e:{default:e}}function $e(e,t,n){return t=ll(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ll(e){var t=cl(e,"string");return typeof t=="symbol"?t:String(t)}function cl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class wr extends st.default.Component{constructor(){super(...arguments),$e(this,"state",{resizing:null,dragging:null,className:""}),$e(this,"elementRef",st.default.createRef()),$e(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:o,transformScale:i}=this.props;if(!o)return;const a={top:0,left:0},{offsetParent:c}=r;if(!c)return;const l=c.getBoundingClientRect(),u=r.getBoundingClientRect(),d=u.left/i,h=l.left/i,p=u.top/i,v=l.top/i;a.left=d-h+c.scrollLeft,a.top=p-v+c.scrollTop,this.setState({dragging:a});const{x:y,y:R}=(0,pe.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return o.call(this,this.props.i,y,R,{e:t,node:r,newPosition:a})}),$e(this,"onDrag",(t,n)=>{let{node:r,deltaX:o,deltaY:i}=n;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+i,l=this.state.dragging.left+o;const{isBounded:u,i:d,w:h,h:p,containerWidth:v}=this.props,y=this.getPositionParams();if(u){const{offsetParent:_}=r;if(_){const{margin:I,rowHeight:m,containerPadding:x}=this.props,O=_.clientHeight-(0,pe.calcGridItemWHPx)(p,m,I[1]);c=(0,pe.clamp)(c-x[1],0,O);const S=(0,pe.calcGridColWidth)(y),M=v-(0,pe.calcGridItemWHPx)(h,S,I[0]);l=(0,pe.clamp)(l-x[0],0,M)}}const R={top:c,left:l};this.setState({dragging:R});const{containerPadding:E}=this.props,{x:C,y:T}=(0,pe.calcXY)(y,c-E[1],l-E[0],h,p);return a.call(this,d,C,T,{e:t,node:r,newPosition:R})}),$e(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:i,h:a,i:c,containerPadding:l}=this.props,{left:u,top:d}=this.state.dragging,h={top:d,left:u};this.setState({dragging:null});const{x:p,y:v}=(0,pe.calcXY)(this.getPositionParams(),d-l[1],u-l[0],i,a);return o.call(this,c,p,v,{e:t,node:r,newPosition:h})}),$e(this,"onResizeStop",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStop")),$e(this,"onResizeStart",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStart")),$e(this,"onResize",(t,n,r)=>this.onResizeHandler(t,n,r,"onResize"))}shouldComponentUpdate(t,n){if(this.props.children!==t.children||this.props.droppingPosition!==t.droppingPosition)return!0;const r=(0,pe.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),o=(0,pe.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,lt.fastPositionEqual)(r,o)||this.props.useCSSTransforms!==t.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(t){this.moveDroppingItem(t)}moveDroppingItem(t){const{droppingPosition:n}=this.props;if(!n)return;const r=this.elementRef.current;if(!r)return;const o=t.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&n.left!==o.left||n.top!==o.top;if(!i)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(a){const c=n.left-i.left,l=n.top-i.top;this.onDrag(n.e,{node:r,deltaX:c,deltaY:l})}}getPositionParams(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:t.cols,containerPadding:t.containerPadding,containerWidth:t.containerWidth,margin:t.margin,maxRows:t.maxRows,rowHeight:t.rowHeight}}createStyle(t){const{usePercentages:n,containerWidth:r,useCSSTransforms:o}=this.props;let i;return o?i=(0,lt.setTransform)(t):(i=(0,lt.setTopLeft)(t),n&&(i.left=(0,lt.perc)(t.left/r),i.width=(0,lt.perc)(t.width/r))),i}mixinDraggable(t,n){return st.default.createElement(il.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},t)}curryResizeHandler(t,n){return(r,o)=>n(r,o,t)}mixinResizable(t,n,r){const{cols:o,minW:i,minH:a,maxW:c,maxH:l,transformScale:u,resizeHandles:d,resizeHandle:h}=this.props,p=this.getPositionParams(),v=(0,pe.calcGridItemPosition)(p,0,0,o,0).width,y=(0,pe.calcGridItemPosition)(p,0,0,i,a),R=(0,pe.calcGridItemPosition)(p,0,0,c,l),E=[y.width,y.height],C=[Math.min(R.width,v),Math.min(R.height,1/0)];return st.default.createElement(al.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:E,maxConstraints:C,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:u,resizeHandles:d,handle:h},t)}onResizeHandler(t,n,r,o){let{node:i,size:a,handle:c}=n;const l=this.props[o];if(!l)return;const{x:u,y:d,i:h,maxH:p,minH:v,containerWidth:y}=this.props,{minW:R,maxW:E}=this.props;let C=a;i&&(C=(0,lt.resizeItemInDirection)(c,r,a,y),this.setState({resizing:o==="onResizeStop"?null:C}));let{w:T,h:_}=(0,pe.calcWH)(this.getPositionParams(),C.width,C.height,u,d,c);T=(0,pe.clamp)(T,Math.max(R,1),E),_=(0,pe.clamp)(_,v,p),l.call(this,h,T,_,{e:t,node:i,size:C,handle:c})}render(){const{x:t,y:n,w:r,h:o,isDraggable:i,isResizable:a,droppingPosition:c,useCSSTransforms:l}=this.props,u=(0,pe.calcGridItemPosition)(this.getPositionParams(),t,n,r,o,this.state),d=st.default.Children.only(this.props.children);let h=st.default.cloneElement(d,{ref:this.elementRef,className:(0,sl.default)("react-grid-item",d.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":i,"react-draggable-dragging":!!this.state.dragging,dropping:!!c,cssTransforms:l}),style:{...this.props.style,...d.props.style,...this.createStyle(u)}});return h=this.mixinResizable(h,u,a),h=this.mixinDraggable(h,i),h}}pn.default=wr;$e(wr,"propTypes",{children:Z.default.element,cols:Z.default.number.isRequired,containerWidth:Z.default.number.isRequired,rowHeight:Z.default.number.isRequired,margin:Z.default.array.isRequired,maxRows:Z.default.number.isRequired,containerPadding:Z.default.array.isRequired,x:Z.default.number.isRequired,y:Z.default.number.isRequired,w:Z.default.number.isRequired,h:Z.default.number.isRequired,minW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minWidth not Number");if(n>e.w||n>e.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxWidth not Number");if(n<e.w||n<e.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minHeight not Number");if(n>e.h||n>e.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxHeight not Number");if(n<e.h||n<e.minH)return new Error("maxHeight smaller than item height/minHeight")},i:Z.default.string.isRequired,resizeHandles:Yr.resizeHandleAxesType,resizeHandle:Yr.resizeHandleType,onDragStop:Z.default.func,onDragStart:Z.default.func,onDrag:Z.default.func,onResizeStop:Z.default.func,onResizeStart:Z.default.func,onResize:Z.default.func,isDraggable:Z.default.bool.isRequired,isResizable:Z.default.bool.isRequired,isBounded:Z.default.bool.isRequired,static:Z.default.bool,useCSSTransforms:Z.default.bool.isRequired,transformScale:Z.default.number,className:Z.default.string,handle:Z.default.string,cancel:Z.default.string,droppingPosition:Z.default.shape({e:Z.default.object.isRequired,left:Z.default.number.isRequired,top:Z.default.number.isRequired})});$e(wr,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1});Object.defineProperty(At,"__esModule",{value:!0});At.default=void 0;var Xe=pl(w),$n=ur,ul=xr(Be),z=q,dl=Le,Kr=xr(pn),fl=xr(He);function xr(e){return e&&e.__esModule?e:{default:e}}function oi(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(oi=function(r){return r?n:t})(e)}function pl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=oi(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function ye(e,t,n){return t=hl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hl(e){var t=ml(e,"string");return typeof t=="symbol"?t:String(t)}function ml(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Zr="react-grid-layout";let ii=!1;try{ii=/firefox/i.test(navigator.userAgent)}catch{}class Sn extends Xe.Component{constructor(){super(...arguments),ye(this,"state",{activeDrag:null,layout:(0,z.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,z.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),ye(this,"dragEnterCounter",0),ye(this,"onDragStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,z.getLayoutItem)(c,t);if(!l)return;const u={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:t};return this.setState({oldDragItem:(0,z.cloneLayoutItem)(l),oldLayout:c,activeDrag:u}),this.props.onDragStart(c,l,l,null,i,a)}),ye(this,"onDrag",(t,n,r,o)=>{let{e:i,node:a}=o;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,allowOverlap:d,preventCollision:h}=this.props,p=(0,z.getLayoutItem)(l,t);if(!p)return;const v={w:p.w,h:p.h,x:p.x,y:p.y,placeholder:!0,i:t};l=(0,z.moveElement)(l,p,n,r,!0,h,(0,z.compactType)(this.props),u,d),this.props.onDrag(l,c,p,v,i,a),this.setState({layout:d?l:(0,z.compact)(l,(0,z.compactType)(this.props),u),activeDrag:v})}),ye(this,"onDragStop",(t,n,r,o)=>{let{e:i,node:a}=o;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,preventCollision:d,allowOverlap:h}=this.props,p=(0,z.getLayoutItem)(l,t);if(!p)return;l=(0,z.moveElement)(l,p,n,r,!0,d,(0,z.compactType)(this.props),u,h);const y=h?l:(0,z.compact)(l,(0,z.compactType)(this.props),u);this.props.onDragStop(y,c,p,null,i,a);const{oldLayout:R}=this.state;this.setState({activeDrag:null,layout:y,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(y,R)}),ye(this,"onResizeStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,z.getLayoutItem)(c,t);l&&(this.setState({oldResizeItem:(0,z.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,l,l,null,i,a))}),ye(this,"onResize",(t,n,r,o)=>{let{e:i,node:a,size:c,handle:l}=o;const{oldResizeItem:u}=this.state,{layout:d}=this.state,{cols:h,preventCollision:p,allowOverlap:v}=this.props;let y=!1,R,E,C;const[T,_]=(0,z.withLayoutItem)(d,t,m=>{let x;return E=m.x,C=m.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(E=m.x+(m.w-n),n=m.x!==E&&E<0?m.w:n,E=E<0?0:E),["ne","n","nw"].indexOf(l)!==-1&&(C=m.y+(m.h-r),r=m.y!==C&&C<0?m.h:r,C=C<0?0:C),y=!0),p&&!v&&(x=(0,z.getAllCollisions)(d,{...m,w:n,h:r,x:E,y:C}).filter(S=>S.i!==m.i).length>0,x&&(C=m.y,r=m.h,E=m.x,n=m.w,y=!1)),m.w=n,m.h=r,m});if(!_)return;R=T,y&&(R=(0,z.moveElement)(T,_,E,C,!0,this.props.preventCollision,(0,z.compactType)(this.props),h,v));const I={w:_.w,h:_.h,x:_.x,y:_.y,static:!0,i:t};this.props.onResize(R,u,_,I,i,a),this.setState({layout:v?R:(0,z.compact)(R,(0,z.compactType)(this.props),h),activeDrag:I})}),ye(this,"onResizeStop",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c,oldResizeItem:l}=this.state,{cols:u,allowOverlap:d}=this.props,h=(0,z.getLayoutItem)(c,t),p=d?c:(0,z.compact)(c,(0,z.compactType)(this.props),u);this.props.onResizeStop(p,l,h,null,i,a);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:p,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(p,v)}),ye(this,"onDragOver",t=>{var T;if(t.preventDefault(),t.stopPropagation(),ii&&!((T=t.nativeEvent.target)!=null&&T.classList.contains(Zr)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:i,rowHeight:a,maxRows:c,width:l,containerPadding:u,transformScale:d}=this.props,h=r==null?void 0:r(t);if(h===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const p={...n,...h},{layout:v}=this.state,y=t.currentTarget.getBoundingClientRect(),R=t.clientX-y.left,E=t.clientY-y.top,C={left:R/d,top:E/d,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:_,top:I}=this.state.droppingPosition;(_!=R||I!=E)&&this.setState({droppingPosition:C})}}else{const _={cols:i,margin:o,maxRows:c,rowHeight:a,containerWidth:l,containerPadding:u||o},I=(0,dl.calcXY)(_,E,R,p.w,p.h);this.setState({droppingDOMNode:Xe.createElement("div",{key:p.i}),droppingPosition:C,layout:[...v,{...p,x:I.x,y:I.y,static:!1,isDraggable:!0}]})}}),ye(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,o=(0,z.compact)(r.filter(i=>i.i!==t.i),(0,z.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:o,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),ye(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),ye(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),ye(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,o=r.find(i=>i.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,o,t)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(t,n){let r;return n.activeDrag?null:(!(0,$n.deepEqual)(t.layout,n.propsLayout)||t.compactType!==n.compactType?r=t.layout:(0,z.childrenEqual)(t.children,n.children)||(r=n.layout),r?{layout:(0,z.synchronizeLayoutWithChildren)(r,t.children,t.cols,(0,z.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,n){return this.props.children!==t.children||!(0,z.fastRGLPropsEqual)(this.props,t,$n.deepEqual)||this.state.activeDrag!==n.activeDrag||this.state.mounted!==n.mounted||this.state.droppingPosition!==n.droppingPosition}componentDidUpdate(t,n){if(!this.state.activeDrag){const r=this.state.layout,o=n.layout;this.onLayoutMaybeChanged(r,o)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,z.bottom)(this.state.layout),n=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return t*this.props.rowHeight+(t-1)*this.props.margin[1]+n*2+"px"}onLayoutMaybeChanged(t,n){n||(n=this.state.layout),(0,$n.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:o,containerPadding:i,rowHeight:a,maxRows:c,useCSSTransforms:l,transformScale:u}=this.props;return Xe.createElement(Kr.default,{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:n,cols:r,margin:o,containerPadding:i||o,maxRows:c,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:u},Xe.createElement("div",null))}processGridItem(t,n){if(!t||!t.key)return;const r=(0,z.getLayoutItem)(this.state.layout,String(t.key));if(!r)return null;const{width:o,cols:i,margin:a,containerPadding:c,rowHeight:l,maxRows:u,isDraggable:d,isResizable:h,isBounded:p,useCSSTransforms:v,transformScale:y,draggableCancel:R,draggableHandle:E,resizeHandles:C,resizeHandle:T}=this.props,{mounted:_,droppingPosition:I}=this.state,m=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&d,x=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&h,O=r.resizeHandles||C,S=m&&p&&r.isBounded!==!1;return Xe.createElement(Kr.default,{containerWidth:o,cols:i,margin:a,containerPadding:c||a,maxRows:u,rowHeight:l,cancel:R,handle:E,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:m,isResizable:x,isBounded:S,useCSSTransforms:v&&_,usePercentages:!_,transformScale:y,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:n?I:void 0,resizeHandles:O,resizeHandle:T},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:o}=this.props,i=(0,ul.default)(Zr,t),a={height:this.containerHeight(),...n};return Xe.createElement("div",{ref:o,className:i,style:a,onDrop:r?this.onDrop:z.noop,onDragLeave:r?this.onDragLeave:z.noop,onDragEnter:r?this.onDragEnter:z.noop,onDragOver:r?this.onDragOver:z.noop},Xe.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}At.default=Sn;ye(Sn,"displayName","ReactGridLayout");ye(Sn,"propTypes",fl.default);ye(Sn,"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:z.noop,onDragStart:z.noop,onDrag:z.noop,onDragStop:z.noop,onResizeStart:z.noop,onResize:z.noop,onResizeStop:z.noop,onDrop:z.noop,onDropDragOver:z.noop});var bn={},ot={};Object.defineProperty(ot,"__esModule",{value:!0});ot.findOrGenerateResponsiveLayout=yl;ot.getBreakpointFromWidth=gl;ot.getColsFromBreakpoint=vl;ot.sortBreakpoints=Or;var Bt=q;function gl(e,t){const n=Or(e);let r=n[0];for(let o=1,i=n.length;o<i;o++){const a=n[o];t>e[a]&&(r=a)}return r}function vl(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function yl(e,t,n,r,o,i){if(e[n])return(0,Bt.cloneLayout)(e[n]);let a=e[r];const c=Or(t),l=c.slice(c.indexOf(n));for(let u=0,d=l.length;u<d;u++){const h=l[u];if(e[h]){a=e[h];break}}return a=(0,Bt.cloneLayout)(a||[]),(0,Bt.compact)((0,Bt.correctBounds)(a,{cols:o}),i,o)}function Or(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(bn,"__esModule",{value:!0});bn.default=void 0;var Jr=Sl(w),_e=ai(Ge),Ln=ur,ht=q,Ye=ot,Cl=ai(At);function ai(e){return e&&e.__esModule?e:{default:e}}function si(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(si=function(r){return r?n:t})(e)}function Sl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=si(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zn.apply(this,arguments)}function rn(e,t,n){return t=bl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bl(e){var t=Rl(e,"string");return typeof t=="symbol"?t:String(t)}function Rl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Qr=e=>Object.prototype.toString.call(e);function Gt(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class Er extends Jr.Component{constructor(){super(...arguments),rn(this,"state",this.generateInitialState()),rn(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:n,layouts:r,cols:o}=this.props,i=(0,Ye.getBreakpointFromWidth)(n,t),a=(0,Ye.getColsFromBreakpoint)(i,o),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Ye.findOrGenerateResponsiveLayout)(r,n,i,i,a,c),breakpoint:i,cols:a}}static getDerivedStateFromProps(t,n){if(!(0,Ln.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:o}=n;return{layout:(0,Ye.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,o,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,Ln.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,Ln.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:o,compactType:i}=this.props,a=this.props.breakpoint||(0,Ye.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,Ye.getColsFromBreakpoint)(a,r),u={...o};if(c!==a||t.breakpoints!==n||t.cols!==r){c in u||(u[c]=(0,ht.cloneLayout)(this.state.layout));let p=(0,Ye.findOrGenerateResponsiveLayout)(u,n,a,c,l,i);p=(0,ht.synchronizeLayoutWithChildren)(p,this.props.children,l,i,this.props.allowOverlap),u[a]=p,this.props.onLayoutChange(p,u),this.props.onBreakpointChange(a,l),this.setState({breakpoint:a,layout:p,cols:l})}const d=Gt(this.props.margin,a),h=Gt(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,d,l,h)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:o,margin:i,containerPadding:a,onBreakpointChange:c,onLayoutChange:l,onWidthChange:u,...d}=this.props;return Jr.createElement(Cl.default,Zn({},d,{margin:Gt(i,this.state.breakpoint),containerPadding:Gt(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}bn.default=Er;rn(Er,"propTypes",{breakpoint:_e.default.string,breakpoints:_e.default.object,allowOverlap:_e.default.bool,cols:_e.default.object,margin:_e.default.oneOfType([_e.default.array,_e.default.object]),containerPadding:_e.default.oneOfType([_e.default.array,_e.default.object]),layouts(e,t){if(Qr(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+Qr(e[t]));Object.keys(e[t]).forEach(n=>{if(!(n in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,ht.validateLayout)(e.layouts[n],"layouts."+n)})},width:_e.default.number.isRequired,onBreakpointChange:_e.default.func,onLayoutChange:_e.default.func,onWidthChange:_e.default.func});rn(Er,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:ht.noop,onLayoutChange:ht.noop,onWidthChange:ht.noop});var Dr={},li=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var a=i[o];n.call(r,a[1],a[0])}},t}()}(),Jn=typeof window<"u"&&typeof document<"u"&&window.document===document,on=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")()}(),_l=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(on):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Tl=2;function Il(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&c()}function a(){_l(i)}function c(){var l=Date.now();if(n){if(l-o<Tl)return;r=!0}else n=!0,r=!1,setTimeout(a,t);o=l}return c}var wl=20,xl=["top","right","bottom","left","width","height","size","weight"],Ol=typeof MutationObserver<"u",El=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Il(this.refresh.bind(this),wl)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!Jn||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Ol?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Jn||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=xl.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),ci=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},vt=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||on},ui=Rn(0,0,0,0);function an(e){return parseFloat(e)||0}function eo(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var i=e["border-"+o+"-width"];return r+an(i)},0)}function Dl(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var i=o[r],a=e["padding-"+i];n[i]=an(a)}return n}function Pl(e){var t=e.getBBox();return Rn(0,0,t.width,t.height)}function Ml(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return ui;var r=vt(e).getComputedStyle(e),o=Dl(r),i=o.left+o.right,a=o.top+o.bottom,c=an(r.width),l=an(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==t&&(c-=eo(r,"left","right")+i),Math.round(l+a)!==n&&(l-=eo(r,"top","bottom")+a)),!Nl(e)){var u=Math.round(c+i)-t,d=Math.round(l+a)-n;Math.abs(u)!==1&&(c-=u),Math.abs(d)!==1&&(l-=d)}return Rn(o.left,o.top,c,l)}var Fl=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof vt(e).SVGGraphicsElement}:function(e){return e instanceof vt(e).SVGElement&&typeof e.getBBox=="function"}}();function Nl(e){return e===vt(e).document.documentElement}function jl(e){return Jn?Fl(e)?Pl(e):Ml(e):ui}function $l(e){var t=e.x,n=e.y,r=e.width,o=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,a=Object.create(i.prototype);return ci(a,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),a}function Rn(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Ll=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Rn(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=jl(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),Ul=function(){function e(t,n){var r=$l(n);ci(this,{target:t,contentRect:r})}return e}(),Vl=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new li,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof vt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new Ll(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof vt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new Ul(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),di=typeof WeakMap<"u"?new WeakMap:new li,fi=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=El.getInstance(),r=new Vl(t,n,this);di.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){fi.prototype[e]=function(){var t;return(t=di.get(this))[e].apply(t,arguments)}});var zl=function(){return typeof on.ResizeObserver<"u"?on.ResizeObserver:fi}();const Al=Object.freeze(Object.defineProperty({__proto__:null,default:zl},Symbol.toStringTag,{value:"Module"})),Hl=zi(Al);Object.defineProperty(Dr,"__esModule",{value:!0});Dr.default=Kl;var Xt=Bl(w),Wl=Pr(Ge),kl=Pr(Hl),ql=Pr(Be);function Pr(e){return e&&e.__esModule?e:{default:e}}function pi(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(pi=function(r){return r?n:t})(e)}function Bl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=pi(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Qn(){return Qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Qn.apply(this,arguments)}function ct(e,t,n){return t=Gl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gl(e){var t=Xl(e,"string");return typeof t=="symbol"?t:String(t)}function Xl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Yl="react-grid-layout";function Kl(e){var t;return t=class extends Xt.Component{constructor(){super(...arguments),ct(this,"state",{width:1280}),ct(this,"elementRef",Xt.createRef()),ct(this,"mounted",!1),ct(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new kl.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?Xt.createElement("div",{className:(0,ql.default)(this.props.className,Yl),style:this.props.style,ref:this.elementRef}):Xt.createElement(e,Qn({innerRef:this.elementRef},o,this.state))}},ct(t,"defaultProps",{measureBeforeMount:!1}),ct(t,"propTypes",{measureBeforeMount:Wl.default.bool}),t}(function(e){e.exports=At.default,e.exports.utils=q,e.exports.calculateUtils=Le,e.exports.Responsive=bn.default,e.exports.Responsive.utils=ot,e.exports.WidthProvider=Dr.default})(Oo);var Zl=Oo.exports;const Jl=cr(Zl),$t={type:g.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(g.IUndoRedoService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),i=L.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,cfId:t.cfId},u=s.DeleteConditionalRuleMutationUndoFactory(e,l),d=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,l);return d&&n.pushUndoRedo({unitID:a,undoMutations:u,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:l}]}),d}},_n={type:g.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(g.IUndoRedoService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=L.getSheetCommandTarget(o,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,u=s.transformSupportSymmetryAnchor(t.start,t.end,i.getSubunitRules(c,l)||[],R=>R.cfId);if(!u)return!1;const[d,h]=u,p={unitId:c,subUnitId:l,start:d,end:h},v=s.MoveConditionalRuleMutationUndoFactory(p),y=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,p);return y&&n.pushUndoRedo({unitID:c,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:p}],undoMutations:v}),y}},Ql="univer-cf-preview",Yt={cfPreview:Ql},Ct=e=>{var o,i;const t=e.rule;if(!t)return null;const n=w.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const a=t.config.map((u,d)=>({color:new g.ColorKit(u.color),value:d})),c=a.length-1;return new Array(5).fill("").map((u,d,h)=>d*c/(h.length-1)).map(u=>s.getColorScaleFromValue(a,u))}return null},[t]),r=w.useMemo(()=>{if(t.type===s.CFRuleType.iconSet)return t.config.map(a=>{const c=s.iconMap[a.iconType];return c&&c[Number(a.iconId)]})},[t]);switch(t.type){case s.CFRuleType.dataBar:{const{isGradient:a}=t.config,c={width:"50%",height:"100%"},l=a?`linear-gradient(to right, ${t.config.positiveColor}, rgb(255 255 255))`:t.config.positiveColor,u=a?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor})`:t.config.nativeColor;return f.jsxs("div",{className:Yt.cfPreview,children:[f.jsx("div",{style:{...c,background:u,border:`1px solid ${t.config.nativeColor}`}}),f.jsx("div",{style:{...c,background:l,border:`1px solid ${t.config.positiveColor}`}})]})}case s.CFRuleType.colorScale:return n&&f.jsx("div",{className:Yt.cfPreview,children:n.map((a,c)=>f.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:a}},c))});case s.CFRuleType.iconSet:return r&&f.jsx("div",{className:Yt.cfPreview,children:r.map((a,c)=>a?f.jsx("img",{style:{height:"100%"},src:a},c):f.jsx(zt,{},c))});case s.CFRuleType.highlightCell:{const{ul:a,st:c,it:l,bl:u,bg:d,cl:h}=t.style,p=(a==null?void 0:a.s)===g.BooleanNumber.TRUE,v=(c==null?void 0:c.s)===g.BooleanNumber.TRUE,y=l===g.BooleanNumber.TRUE,R=u===g.BooleanNumber.TRUE,E=(o=d==null?void 0:d.rgb)!=null?o:s.DEFAULT_BG_COLOR,C=(i=h==null?void 0:h.rgb)!=null?i:s.DEFAULT_FONT_COLOR,T={fontWeight:R?"bold":void 0,fontStyle:y?"italic":void 0,textDecoration:`${p?"underline":""} ${v?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:E,color:C};return f.jsx("div",{style:T,className:Yt.cfPreview,children:"123"})}}return null};var ec=Object.defineProperty,tc=Object.getOwnPropertyDescriptor,nc=(e,t,n,r)=>{for(var o=r>1?void 0:r?tc(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&ec(t,n,o),o},rc=(e,t)=>(n,r)=>t(n,r,e);let mt=class extends g.Disposable{constructor(t){super();Rt(this,"_initLocal",()=>{});Rt(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let o=n.exec(t);for(;o;)r.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),o=t.split("."),i=r&&this._localeService.resolveKeyPath(r,o);if(typeof i=="string"){const a=[];return this._findReplaceIndex(i).forEach((c,l,u)=>{const d=u[l-1]||{startIndex:0,endIndex:-1};if(d.endIndex+1<c.startIndex){const h=i.slice(d.endIndex+1,c.startIndex);h&&a.push(h)}if(n[c.key]&&a.push(n[c.key]),l===u.length-1){const h=i.slice(c.endIndex+1);h&&a.push(h)}}),a}return[]}};mt=nc([g.OnLifecycle(g.LifecycleStages.Rendered,mt),rc(0,A.Inject(g.LocaleService))],mt);const oc="univer-cf-rule-list",ic="univer-rule-selector",ac="univer-select",sc="univer-select-selector",lc="univer-select-selection-item",cc="univer-select-selection-search-input",uc="univer-btn-list",dc="univer-gap",fc="univer-icon",pc="univer-disabled",hc="univer-rule-item",mc="univer-rule-describe",gc="univer-rule-type",vc="univer-rule-range",yc="univer-active",Cc="univer-draggableHandle",Sc="univer-delete-item",bc="univer-grid-layout-wrap",Rc="univer-react-grid-item",de={cfRuleList:oc,ruleSelector:ic,select:ac,selectSelector:sc,selectSelectionItem:lc,selectSelectionSearchInput:cc,btnList:uc,gap:dc,icon:fc,disabled:pc,ruleItem:hc,ruleDescribe:mc,ruleType:gc,ruleRange:vc,active:yc,draggableHandle:Cc,deleteItem:Sc,gridLayoutWrap:bc,reactGridItem:Rc},_c=(e,t)=>{const n=e.rule;switch(n.type){case s.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case s.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case s.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case s.CFRuleType.highlightCell:switch(n.subType){case s.CFSubRuleType.average:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,t.t("sheet.cf.subRuleType.average"))}case s.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case s.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case s.CFSubRuleType.number:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(o=>String(o)):[String(n.value||"")])}case s.CFSubRuleType.text:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case s.CFSubRuleType.timePeriod:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`)}case s.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):t.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?t.t("sheet.cf.preview.describe.bottomN",String(n.value)):t.t("sheet.cf.preview.describe.topN",String(n.value));case s.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let to=0;const Tc=e=>{const{onClick:t}=e,n=te.useDependency(s.ConditionalFormattingRuleModel),r=te.useDependency(g.IUniverInstanceService),o=te.useDependency(L.SheetsSelectionsService),i=te.useDependency(g.ICommandService),a=te.useDependency(g.LocaleService),c=te.useDependency(mt),l=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),u=l.getUnitId(),d=l.getActiveSheet();if(!d)throw new Error("No active sheet found");const h=d.getSheetId(),[p,v]=w.useState([]),[y,R]=w.useState("2"),[E,C]=w.useState(0),[T,_]=w.useState(-1),[I,m]=w.useState(to),x=w.useRef(null),O=[{label:a.t("sheet.cf.panel.workSheet"),value:"2"},{label:a.t("sheet.cf.panel.selectedRange"),value:"1"}],S=()=>{const V=n.getSubunitRules(u,h);if(!V||!V.length)return[];if(y==="1"){const K=o.getCurrentLastSelection();if(!K)return[];const ne=K.range;return V.filter(ce=>ce.ranges.some(fe=>g.Rectangle.intersects(fe,ne)))}else if(y==="2")return V;return[]},M=V=>{const ne=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet();return V.map(ce=>{const fe=ce.ranges;return(fe==null?void 0:fe.some(De=>{var G,re;const{startRow:F,startColumn:U,endRow:X,endColumn:Y}=De;for(let ae=F;ae<=X;ae++)for(let ge=U;ge<=Y;ge++){const Q=(re=(G=ne==null?void 0:ne.getCell(ae,ge))==null?void 0:G.selectionProtection)==null?void 0:re[0];if((Q==null?void 0:Q[jt.Edit])===!1||(Q==null?void 0:Q[jt.View])===!1)return!0}return!1}))?{...ce,disable:!0}:{...ce}})},[j,$]=w.useState(S);ue.useHighlightRange(p),w.useEffect(()=>{const V=i.onCommandExecuted(K=>{K.id===L.SetWorksheetActiveOperation.id&&C(Math.random())});return()=>V.dispose()}),w.useEffect(()=>{$(S)},[y,E,u,h]),w.useEffect(()=>{if(y==="2")return;const V=new Me.Observable(K=>{const ne=[L.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],ie=i.onCommandExecuted(ce=>{const{id:fe,params:xe}=ce,De=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId();ne.includes(fe)&&xe.unitId===De&&K.next(null)});return()=>ie.dispose()}).pipe(Me.debounceTime(16)).subscribe(()=>{$(S)});return()=>{V.unsubscribe()}},[r,y,u,h]),w.useEffect(()=>{const V=n.$ruleChange.subscribe(()=>{C(Math.random())});return()=>V.unsubscribe()},[n]),w.useEffect(()=>{const V=()=>{var ce;const ie=Math.max(0,(((ce=x.current)==null?void 0:ce.getBoundingClientRect().width)||0)-8);return to=ie,ie},ne=new Me.Observable(ie=>{const ce=document.querySelector(".univer-sidebar");if(ce){let fe=setTimeout(()=>{ie.next()},150);const xe=()=>{fe&&clearTimeout(fe),fe=null},De=F=>{F.propertyName==="width"&&(xe(),ie.next())};return ce.addEventListener("transitionend",De),()=>{xe(),ce.removeEventListener("transitionend",De)}}}).pipe(Me.debounceTime(16)).subscribe(()=>{m(V())});return()=>{ne.unsubscribe()}},[]);const H=V=>{var ie;const K=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),ne=(ie=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:ie.getSheetId();if(!K||!ne)throw new Error("No active sheet found");i.executeCommand($t.id,{unitId:K,subUnitId:ne,cfId:V.cfId})},b=(V,K)=>{_(K.y)},D=(V,K,ne)=>{var F;_(-1);const ie=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),ce=(F=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:F.getSheetId();if(!ie||!ce)throw new Error("No active sheet found");const fe=U=>{const X=j.length;return Math.min(X-1,Math.max(0,U))},xe=j[fe(K.y)].cfId,De=j[fe(ne.y)].cfId;xe!==De&&i.executeCommand(_n.id,{unitId:ie,subUnitId:ce,start:{id:xe,type:"self"},end:{id:De,type:ne.y>K.y?"after":"before"}})},J=()=>{e.onCreate()},be=()=>{y==="2"?i.executeCommand(Vt.id):y==="1"&&j.map(K=>({unitId:u,subUnitId:h,cfId:K.cfId})).forEach(K=>{i.executeCommand($t.id,K)})},he=j.map((V,K)=>({i:V.cfId,x:0,w:12,y:K,h:1,isResizable:!1})),me=M(j),Ee=me==null?void 0:me.some(V=>V.disable);return f.jsxs("div",{className:de.cfRuleList,children:[f.jsxs("div",{className:de.ruleSelector,children:[f.jsx("div",{children:c.tWithReactNode("sheet.cf.panel.managerRuleSelect",f.jsx(B.Select,{className:de.select,options:O,value:y,onChange:V=>{R(V)}})).map((V,K)=>f.jsx("span",{children:V},K))}),f.jsxs("div",{className:de.btnList,children:[f.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.createRule"),placement:"bottom",children:f.jsx("div",{className:`${de.icon}`,onClick:J,children:f.jsx(wo,{})})}),j.length&&!Ee?f.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.clear"),placement:"bottom",children:f.jsx("div",{className:`${de.gap} ${de.icon}`,onClick:be,children:f.jsx(Qt,{})})}):f.jsx("div",{className:`${de.gap} ${de.disabled}`,children:f.jsx(Qt,{})})]})]}),f.jsx("div",{ref:x,className:de.gridLayoutWrap,children:I?f.jsx(Jl,{onDragStop:D,onDragStart:b,layout:he,cols:12,rowHeight:60,width:I,margin:[0,10],draggableHandle:".draggableHandle",children:me==null?void 0:me.map((V,K)=>f.jsx("div",{children:f.jsxs("div",{onMouseMove:()=>{V.ranges!==p&&v(V.ranges)},onMouseLeave:()=>v([]),onClick:()=>{V.disable||t(V)},className:`${de.ruleItem} ${T===K?de.active:""}`,children:[f.jsx("div",{className:`${de.draggableHandle} draggableHandle`,onClick:ne=>ne.stopPropagation(),children:f.jsx(xo,{})}),f.jsxs("div",{className:de.ruleDescribe,children:[f.jsx("div",{className:de.ruleType,children:_c(V,a)}),f.jsx("div",{className:de.ruleRange,children:V.ranges.map(ne=>bo.serializeRange(ne)).join(",")})]}),f.jsx("div",{className:de.preview,children:f.jsx(Ct,{rule:V.rule})}),!V.disable&&f.jsx("div",{className:`${de.deleteItem} ${T===K?de.active:""}`,onClick:ne=>{ne.stopPropagation(),H(V)},children:f.jsx(Qt,{})})]})},`${V.cfId}`))}):null})]})},kt={type:g.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){if(!t)return!1;const{rule:n}=t,r=e.get(g.IUndoRedoService),o=e.get(g.ICommandService),i=e.get(s.ConditionalFormattingRuleModel),a=e.get(g.IUniverInstanceService),c=L.getSheetCommandTarget(a);if(!c)return!1;const{unitId:l,subUnitId:u}=c,d=i.createCfId(l,u),h={unitId:l,subUnitId:u,rule:{...n,cfId:n.cfId||d}},p=s.AddConditionalRuleMutationUndoFactory(e,h),v=o.syncExecuteCommand(s.AddConditionalRuleMutation.id,h);return v&&r.pushUndoRedo({unitID:l,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:h}],undoMutations:[p]}),v}},Tn={type:g.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(g.IUndoRedoService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),i=L.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,rule:t.rule},u=s.setConditionalRuleMutationUndoFactory(e,l),d=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,l);return d&&n.pushUndoRedo({unitID:a,undoMutations:u,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:l}]}),d}},Ic=g.createInterceptorKey("beforeSubmit"),wc=g.createInterceptorKey("submit"),xc="univer-cf-color-picker",Oc="univer-cf-color-picker-icon",Ec="univer-icon-dropdown",Un={cfColorPicker:xc,cfColorPickerIcon:Oc,iconDropdown:Ec},et=e=>{const{color:t,onChange:n,disable:r=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:a=!0}=e,c=te.useDependency(Ce.ComponentManager),l=w.useMemo(()=>new g.ColorKit(t),[t]),u=c.get(o);return u&&(r?f.jsx(u,{className:i,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):f.jsx(B.Dropdown,{overlay:f.jsx("div",{className:`${Un.cfColorPicker} `,children:f.jsx(B.ColorPicker,{color:t,onChange:n})}),children:f.jsxs("span",{className:`${Un.cfColorPickerIcon} ${i}`,children:[f.jsx(u,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),a&&f.jsx(un,{className:Un.iconDropdown})]})}))},Dc="univer-cf-rule-style-editor",Pc="univer-cf-preview-wrap",Mc="univer-text",Fc="univer-position-relative",Nc="univer-btn-list",jc="univer-util-item",$c="univer-icon-set",Lc="univer-render-config",Uc="univer-flex",Vc="univer-width45",zc="univer-icon-wrap",Ac="univer-icon",Hc="univer-dropdown-icon",Wc="univer-error-input",kc="univer-error-text",qc="univer-icon-group-list",Bc="univer-title",Gc="univer-group",Xc="univer-item-content",Yc="univer-item-wrap",Kc="univer-item",Zc="univer-icon-item-list-wrap",Jc="univer-none",Qc="univer-icon-item-list",eu="univer-width100",tu="univer-stress",N={cfRuleStyleEditor:Dc,cfPreviewWrap:Pc,text:Mc,positionRelative:Fc,btnList:Nc,utilItem:jc,iconSet:$c,renderConfig:Lc,flex:Uc,width45:Vc,iconWrap:zc,icon:Ac,dropdownIcon:Hc,errorInput:Wc,errorText:kc,iconGroupList:qc,title:Bc,group:Gc,itemContent:Xc,itemWrap:Yc,item:Kc,iconItemListWrap:Zc,none:Jc,iconItemList:Qc,width100:eu,stress:tu},Ke=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Vn=e=>{var h;const{type:t,className:n,onChange:r,id:o,value:i}=e,a=te.useDependency(g.IUniverInstanceService),c=a.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=(h=a.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:h.getSheetId(),u=w.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),d=w.useMemo(()=>[s.CFValueType.max,s.CFValueType.min,"none"].includes(t)?{disabled:!0}:[s.CFValueType.percent,s.CFValueType.percentile].includes(t)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[t]);return t===s.CFValueType.formula?f.jsx(Ce.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:c,id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${o}`),value:u,style:{maxWidth:"50%",marginLeft:4},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(p="")=>{r(p||"")}}):f.jsx(B.InputNumber,{className:n,value:Number(e.value)||0,onChange:p=>e.onChange(p||0),...d})},nu=e=>{var H;const{interceptorManager:t}=e,n=te.useDependency(g.LocaleService),r=((H=e.rule)==null?void 0:H.type)===s.CFRuleType.colorScale?e.rule:void 0,o=[Ke(s.CFValueType.num,n),Ke(s.CFValueType.percent,n),Ke(s.CFValueType.percentile,n),Ke(s.CFValueType.formula,n)],i=[Ke(s.CFValueType.min,n),...o],a=[Ke("none",n),...o],c=[Ke(s.CFValueType.max,n),...o],[l,u]=w.useState(()=>{var D;const b=s.CFValueType.min;return r&&((D=r.config[0])==null?void 0:D.value.type)||b}),[d,h]=w.useState(()=>{var D;const b="none";return!r||r.config.length!==3?b:((D=r.config[1])==null?void 0:D.value.type)||b}),[p,v]=w.useState(()=>{var D;const b=s.CFValueType.max;return r&&((D=r.config[r.config.length-1])==null?void 0:D.value.type)||b}),[y,R]=w.useState(()=>{if(!r)return 10;const D=r.config[0];return(D==null?void 0:D.value.value)===void 0?10:D==null?void 0:D.value.value}),[E,C]=w.useState(()=>{var J;if(!r||r.config.length!==3)return 50;const D=(J=r.config[1])==null?void 0:J.value.value;return D===void 0?50:D}),[T,_]=w.useState(()=>{var J;if(!r)return 90;const D=(J=r.config[r.config.length-1])==null?void 0:J.value.value;return D===void 0?90:D}),[I,m]=w.useState(()=>{var D;const b="#d0d9fb";return r&&((D=r.config[0])==null?void 0:D.color)||b}),[x,O]=w.useState(()=>{var D;const b="#7790f3";return!r||r.config.length!==3?b:((D=r.config[1])==null?void 0:D.color)||b}),[S,M]=w.useState(()=>{var D;const b="#2e55ef";return r&&((D=r.config[r.config.length-1])==null?void 0:D.color)||b}),j=w.useMemo(()=>b=>{const{minType:D,medianType:J,maxType:be,minValue:he,medianValue:me,maxValue:Ee,minColor:V,medianColor:K,maxColor:ne}=b,ie=[];return ie.push({color:V,value:{type:D,value:he}}),J!=="none"&&ie.push({color:K,value:{type:J,value:me}}),ie.push({color:ne,value:{type:be,value:Ee}}),{config:ie.map((fe,xe)=>({...fe,index:xe})),type:s.CFRuleType.colorScale}},[]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return j({minType:l,medianType:d,maxType:p,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),[j,l,d,p,y,E,T,I,x,S,t]);const $=b=>{e.onChange(j(b))};return f.jsxs("div",{children:[f.jsx("div",{className:P.title,children:n.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${N.cfPreviewWrap}`,children:f.jsx(Ct,{rule:j({minType:l,medianType:d,maxType:p,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})})}),f.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.min")}),f.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[f.jsx(B.Select,{options:i,value:l,onChange:b=>{u(b);const D=s.createDefaultValueByValueType(b,10);R(D),$({minType:b,medianType:d,maxType:p,minValue:D,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),f.jsx(Vn,{id:"min",className:`${P.mLXxs}`,value:y,type:l,onChange:b=>{R(b),$({minType:l,medianType:d,maxType:p,minValue:b,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),f.jsx(et,{className:P.mLXxs,color:I,onChange:b=>{m(b),$({minType:l,medianType:d,maxType:p,minValue:y,medianValue:E,maxValue:T,minColor:b,medianColor:x,maxColor:S})}})]}),f.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.medianValue")}),f.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[f.jsx(B.Select,{options:a,value:d,onChange:b=>{h(b);const D=s.createDefaultValueByValueType(b,50);C(D),$({minType:l,medianType:b,maxType:p,minValue:y,medianValue:D,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),f.jsx(Vn,{id:"median",className:` ${P.mLXxs}`,value:E,type:d,onChange:b=>{C(b),$({minType:l,medianType:d,maxType:p,minValue:y,medianValue:b,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),d!=="none"&&f.jsx(et,{className:P.mLXxs,color:x,onChange:b=>{O(b),$({minType:l,medianType:d,maxType:p,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:b,maxColor:S})}})]}),f.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.max")}),f.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[f.jsx(B.Select,{options:c,value:p,onChange:b=>{v(b);const D=s.createDefaultValueByValueType(b,90);_(D),$({minType:l,medianType:d,maxType:b,minValue:y,medianValue:E,maxValue:D,minColor:I,medianColor:x,maxColor:S})}}),f.jsx(Vn,{id:"max",className:`${P.mLXxs}`,value:T,type:p,onChange:b=>{_(b),$({minType:l,medianType:d,maxType:p,minValue:y,medianValue:E,maxValue:b,minColor:I,medianColor:x,maxColor:S})}}),f.jsx(et,{className:P.mLXxs,color:S,onChange:b=>{M(b),$({minType:l,medianType:d,maxType:p,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:b})}})]})]})},ut=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),no=e=>{var p;const{onChange:t,className:n,value:r,type:o,id:i,disabled:a=!1}=e,c=te.useDependency(g.IUniverInstanceService),l=c.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),u=(p=c.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:p.getSheetId(),d=w.useRef(r),h=w.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===s.CFValueType.formula){const v=String(d.current).startsWith("=")?String(d.current)||"":"=";return f.jsx(Ce.TextEditor,{id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${i}`),value:v,openForSheetSubUnitId:u,openForSheetUnitId:l,style:{width:"47%",marginLeft:14},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(y="")=>{t(y||"")}})}return f.jsx(B.InputNumber,{className:n,value:Number(r)||0,disabled:a,onChange:v=>{t(v||0)},...h})},ru=e=>{var H;const{interceptorManager:t}=e,n=te.useDependency(g.LocaleService),r=((H=e.rule)==null?void 0:H.type)===s.CFRuleType.dataBar?e.rule:void 0,[o,i]=w.useState(()=>{var D;const b="0";return r?(D=r.config)!=null&&D.isGradient?"1":"0":b}),[a,c]=w.useState(()=>{var D;const b="#abd91a";return r&&((D=r.config)==null?void 0:D.positiveColor)||b}),[l,u]=w.useState(()=>{var D;const b="#ffbe38";return r&&((D=r.config)==null?void 0:D.nativeColor)||b}),d=[ut(s.CFValueType.num,n),ut(s.CFValueType.percent,n),ut(s.CFValueType.percentile,n),ut(s.CFValueType.formula,n)],h=[ut(s.CFValueType.min,n),...d],p=[ut(s.CFValueType.max,n),...d],[v,y]=w.useState(()=>{var D;const b=h[0].value;return r&&((D=r.config)==null?void 0:D.min.type)||b}),[R,E]=w.useState(()=>{var D;const b=p[0].value;return r&&((D=r.config)==null?void 0:D.max.type)||b}),[C,T]=w.useState(()=>{var J;if(!r)return 0;const D=((J=r.config)==null?void 0:J.min)||{};return D.type===s.CFValueType.formula?D.value||"=":D.value||0}),[_,I]=w.useState(()=>{var J;if(!r)return 100;const D=((J=r.config)==null?void 0:J.max)||{};return D.type===s.CFValueType.formula?D.value||"=":D.value===void 0?100:D.value}),[m,x]=w.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),O=b=>({config:{min:{type:b.minValueType,value:b.minValue},max:{type:b.maxValueType,value:b.maxValue},isGradient:b.isGradient==="1",positiveColor:b.positiveColor,nativeColor:b.nativeColor},type:s.CFRuleType.dataBar,isShowValue:b.isShowValue});w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return O({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:m})}}),[o,C,v,_,R,a,l,t,m]);const S=b=>{e.onChange(O(b))},M=b=>{c(b),S({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:b,nativeColor:l,isShowValue:m})},j=b=>{u(b),S({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:b,isShowValue:m})},$=b=>d.map(D=>D.value).includes(b);return f.jsxs("div",{children:[f.jsx("div",{className:P.title,children:n.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${N.cfPreviewWrap}`,children:f.jsx(Ct,{rule:O({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:m})})}),f.jsxs("div",{children:[f.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.fillType")}),f.jsxs("div",{className:`${P.mTSm} ${P.mLXxs} ${P.labelContainer} `,children:[f.jsxs(B.RadioGroup,{value:o,onChange:b=>{i(b),S({isGradient:b,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:m})},children:[f.jsx(B.Radio,{value:"0",children:f.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.pureColor")})}),f.jsx(B.Radio,{value:"1",children:f.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.gradient")})})]}),f.jsxs("div",{className:`${N.utilItem} ${P.mLXl}`,children:[f.jsx(B.Checkbox,{checked:!m,onChange:b=>{x(!b),S({isGradient:b,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:!b})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.colorSet")}),f.jsxs("div",{className:`${P.labelContainer} ${P.mTSm} ${P.mLXxs}`,children:[f.jsxs("div",{className:`${P.labelContainer}`,children:[f.jsx("div",{className:`${N.text}`,children:n.t("sheet.cf.panel.native")}),f.jsx(et,{color:l,onChange:j})]}),f.jsxs("div",{className:`${P.labelContainer} ${P.mLSm} `,children:[f.jsx("div",{className:`${N.text} `,children:n.t("sheet.cf.panel.positive")}),f.jsx(et,{color:a,onChange:M})]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.min")}),f.jsxs("div",{className:`${P.mTSm} ${P.labelContainer}`,children:[f.jsx(B.Select,{options:h,value:v,onChange:b=>{y(b);const D=s.createDefaultValueByValueType(b,10);T(D),S({isGradient:o,minValue:D,minValueType:b,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:m})}}),f.jsx(no,{disabled:!$(v),id:"min",type:v,className:P.mLSm,value:C,onChange:b=>{T(b||0),S({isGradient:o,minValue:b||0,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:m})}})]}),f.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.max")}),f.jsxs("div",{className:`${P.mTSm} ${P.labelContainer}`,children:[f.jsx(B.Select,{options:p,value:R,onChange:b=>{E(b);const D=s.createDefaultValueByValueType(b,90);I(D),S({isGradient:o,minValue:C,minValueType:v,maxValue:D,maxValueType:b,positiveColor:a,nativeColor:l,isShowValue:m})}}),f.jsx(no,{disabled:!$(R),id:"max",type:R,className:P.mLSm,value:_,onChange:b=>{I(b||0),S({isGradient:o,minValue:C,minValueType:v,maxValue:b||0,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:m})}})]})]})]})},ou="univer-cf-style-edit",iu="univer-button-item",au="univer-isActive",ze={cfStyleEdit:ou,buttonItem:iu,isActive:au},Kt=e=>[g.BooleanNumber.FALSE,void 0].includes(e)?g.BooleanNumber.TRUE:g.BooleanNumber.FALSE,Zt=e=>e!==g.BooleanNumber.FALSE,Mr=e=>{const{style:t,onChange:n,className:r}=e,o=te.useDependency(Ce.ComponentManager),[i,a]=w.useState(()=>{if(t!=null&&t.bl)return t.bl}),[c,l]=w.useState(()=>{if(t!=null&&t.it)return t.it}),[u,d]=w.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[h,p]=w.useState(()=>{if(t!=null&&t.st)return t.st.s}),[v,y]=w.useState(()=>{var x;const m="#2f56ef";return(x=t==null?void 0:t.cl)!=null&&x.rgb?t.cl.rgb:m}),[R,E]=w.useState(()=>{var x;const m="#e8ecfc";return(x=t==null?void 0:t.bg)!=null&&x.rgb?t.bg.rgb:m}),C=o.get("BoldSingle"),T=o.get("ItalicSingle"),_=o.get("UnderlineSingle"),I=o.get("StrikethroughSingle");return w.useEffect(()=>{const m={bl:i,it:c};v!==void 0&&(m.cl={rgb:v}),R!==void 0&&(m.bg={rgb:R}),h!==void 0&&(m.st={s:h}),u!==void 0&&(m.ul={s:u}),n(s.removeUndefinedAttr(m))},[i,c,u,h,v,R]),f.jsxs("div",{className:`${ze.cfStyleEdit} ${r}`,children:[C&&f.jsx("div",{className:Be({[ze.isActive]:Zt(i||g.BooleanNumber.FALSE)},ze.buttonItem),onClick:()=>a(Kt(i)),children:f.jsx(C,{})}),T&&f.jsx("div",{className:Be({[ze.isActive]:Zt(c||g.BooleanNumber.FALSE)},ze.buttonItem),onClick:()=>l(Kt(c)),children:f.jsx(T,{})}),_&&f.jsx("div",{className:Be({[ze.isActive]:Zt(u||g.BooleanNumber.FALSE)},ze.buttonItem),onClick:()=>d(Kt(u)),children:f.jsx(_,{})}),I&&f.jsx("div",{className:Be({[ze.isActive]:Zt(h||g.BooleanNumber.FALSE)},ze.buttonItem),onClick:()=>p(Kt(h)),children:f.jsx(I,{})}),f.jsx(et,{color:v,onChange:y,iconId:"FontColor"}),f.jsx(et,{color:R,onChange:E,iconId:"PaintBucket"})]})},su=e=>{var E;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(g.LocaleService),o=((E=e.rule)==null?void 0:E.type)===s.CFRuleType.highlightCell?e.rule:void 0,i=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[a,c]=w.useState(()=>{const C=i[0].value,T=o==null?void 0:o.type;if(!o)return C;switch(T){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":C;case s.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return C}),[l,u]=w.useState(()=>{const T=o==null?void 0:o.type;if(!o)return 10;switch(T){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.value||10}}return 10}),[d,h]=w.useState(()=>{const T=o==null?void 0:o.type;if(!o)return!1;switch(T){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[p,v]=w.useState({}),y=C=>{const{type:T,isPercent:_,value:I,style:m}=C;if(T==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:_,isBottom:!1,value:I,style:m};if(T==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:_,isBottom:!0,value:I,style:m};if(T==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:m};if(T==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:m}};w.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({type:a,isPercent:d,value:l,style:p})}}),[a,d,l,p,n]);const R=C=>{t(y(C))};return f.jsxs("div",{children:[f.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx(B.Select,{className:`${N.width100} ${P.mTSm}`,value:a,options:i,onChange:C=>{c(C),R({type:C,isPercent:d,value:l,style:p})}}),["isNotBottom","isBottom"].includes(a)&&f.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[f.jsx(B.InputNumber,{min:1,max:1e3,value:l,onChange:C=>{const T=C||0;u(T),R({type:a,isPercent:d,value:T,style:p})}}),f.jsxs("div",{className:`${P.mLSm} ${P.labelContainer} ${N.text}`,children:[f.jsx(B.Checkbox,{checked:d,onChange:C=>{h(!!C),R({type:a,isPercent:!!C,value:l,style:p})}}),r.t("sheet.cf.valueType.percent")]})]}),f.jsx("div",{className:`${N.cfPreviewWrap} `,children:f.jsx(Ct,{rule:y({type:a,isPercent:d,value:l,style:p})})}),f.jsx(Mr,{style:o==null?void 0:o.style,className:`${P.mTSm} `,onChange:C=>{v(C),R({type:a,isPercent:d,value:l,style:C})}})]})},Dt=e=>f.jsxs("div",{style:{position:"relative"},children:[f.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:e.errorText}),e.children]}),ee=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),lu=e=>{const{type:t,operator:n,onChange:r,value:o,interceptorManager:i}=e,a=te.useDependency(g.LocaleService),[c,l]=w.useState(()=>typeof o=="number"?o:0),[u,d]=w.useState(""),[h,p]=w.useState(()=>typeof o=="string"?o:""),[v,y]=w.useState(""),[R,E]=w.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[C,T]=w.useState(""),[_,I]=w.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100),[m,x]=w.useState("");switch(w.useEffect(()=>{switch(t){case s.CFSubRuleType.text:{[s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)&&r(h);break}case s.CFSubRuleType.number:{[s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)&&r(c),[s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)&&r([R,_]);break}}},[t]),w.useEffect(()=>{const O=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(S,M,j)=>{switch(t){case s.CFSubRuleType.text:return s.CFTextOperator.beginsWith,s.CFTextOperator.containsText,s.CFTextOperator.endsWith,s.CFTextOperator.notEqual,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,h?j(S):(y(a.t("sheet.cf.errorMessage.notBlank")),!1)}return j(S)}});return()=>{O()}},[t,c,h,R,_]),t){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)){const O=S=>{p(S),r(S)};return f.jsx("div",{className:`${P.mTSm}`,children:f.jsx(Dt,{errorText:v,children:f.jsx(B.Input,{className:N.width100,value:h,onChange:S=>{y(""),O(S)}})})})}break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)){const O=S=>{l(S||0),r(S||0),d("")};return f.jsx("div",{className:`${P.mTSm}`,children:f.jsx(Dt,{errorText:u,children:f.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:N.width100,value:c,onChange:O})})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const O=M=>{E(M||0),r([M||0,_]),T("")},S=M=>{I(M||0),r([R,M||0]),x("")};return f.jsxs("div",{className:`${P.mTSm} ${P.labelContainer} `,children:[f.jsx(Dt,{errorText:C,children:f.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:R,onChange:O})}),f.jsx(Dt,{errorText:m,children:f.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${P.mLSm}`,value:_,onChange:S})})]})}}}return null},ro=(e,t)=>{switch(e){case s.CFSubRuleType.text:return[ee(s.CFTextOperator.containsText,t),ee(s.CFTextOperator.notContainsText,t),ee(s.CFTextOperator.beginsWith,t),ee(s.CFTextOperator.endsWith,t),ee(s.CFTextOperator.equal,t),ee(s.CFTextOperator.notEqual,t),ee(s.CFTextOperator.containsBlanks,t),ee(s.CFTextOperator.notContainsBlanks,t),ee(s.CFTextOperator.containsErrors,t),ee(s.CFTextOperator.notContainsErrors,t)];case s.CFSubRuleType.number:return[ee(s.CFNumberOperator.between,t),ee(s.CFNumberOperator.notBetween,t),ee(s.CFNumberOperator.equal,t),ee(s.CFNumberOperator.notEqual,t),ee(s.CFNumberOperator.greaterThan,t),ee(s.CFNumberOperator.greaterThanOrEqual,t),ee(s.CFNumberOperator.lessThan,t),ee(s.CFNumberOperator.lessThanOrEqual,t)];case s.CFSubRuleType.timePeriod:return[ee(s.CFTimePeriodOperator.yesterday,t),ee(s.CFTimePeriodOperator.today,t),ee(s.CFTimePeriodOperator.tomorrow,t),ee(s.CFTimePeriodOperator.last7Days,t),ee(s.CFTimePeriodOperator.lastWeek,t),ee(s.CFTimePeriodOperator.thisWeek,t),ee(s.CFTimePeriodOperator.nextWeek,t),ee(s.CFTimePeriodOperator.lastMonth,t),ee(s.CFTimePeriodOperator.thisMonth,t),ee(s.CFTimePeriodOperator.nextMonth,t)]}},oo=e=>{var I;const{interceptorManager:t,onChange:n}=e,r=te.useDependency(g.LocaleService),o=((I=e.rule)==null?void 0:I.type)===s.CFRuleType.highlightCell?e.rule:void 0,[i,a]=w.useState(()=>{const m=s.CFSubRuleType.text;return o&&o.subType||m}),c=[{value:s.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:s.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:s.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:s.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:s.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],l=w.useMemo(()=>ro(i,r),[i]),[u,d]=w.useState(()=>{const m=l?l[0].value:void 0;return o&&o.operator||m}),[h,p]=w.useState(()=>{var O;const m="";return o?(O=o.value)!=null?O:s.createDefaultValue(o.subType,o.operator):m}),[v,y]=w.useState({}),R=w.useMemo(()=>m=>{var x,O,S,M,j,$,H,b,D,J,be,he,me,Ee,V;switch(m.subType||i){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(u))return{type:s.CFRuleType.highlightCell,subType:(x=m.subType)!=null?x:i,operator:(O=m.operator)!=null?O:u,style:(S=m.style)!=null?S:v,value:(M=m.value)!=null?M:h};break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(u))return{type:s.CFRuleType.highlightCell,subType:(j=m.subType)!=null?j:i,operator:($=m.operator)!=null?$:u,style:(H=m.style)!=null?H:v,value:(b=m.value)!=null?b:h};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(u))return{type:s.CFRuleType.highlightCell,subType:(D=m.subType)!=null?D:i,operator:(J=m.operator)!=null?J:u,style:(be=m.style)!=null?be:v,value:(he=m.value)!=null?he:h};break}}return{type:s.CFRuleType.highlightCell,subType:(me=m.subType)!=null?me:i,operator:(Ee=m.operator)!=null?Ee:u,style:(V=m.style)!=null?V:v}},[i,u,h,v]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return R({})}}),[R,t]),w.useEffect(()=>{c.some(m=>m.value===i)||a(c[0].value)},[c]);const E=m=>{const x=m,O=ro(x,r),S=O&&O[0].value;a(x),d(S),S&&p(s.createDefaultValue(x,S)),n(R({subType:x,operator:S}))},C=m=>{const x=m;d(x),n(R({operator:x}))},T=m=>{p(m),n(R({value:m}))},_=w.useMemo(()=>`${i}_${u}_${Math.random()}`,[i,u]);return f.jsxs("div",{children:[f.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx(B.Select,{className:`${P.mTSm} ${N.width100}`,onChange:E,value:i,options:c}),(l==null?void 0:l.length)&&f.jsx(B.Select,{className:`${P.mTSm} ${N.width100}`,onChange:C,value:u||"",options:l}),f.jsx(lu,{value:h,interceptorManager:t,type:i,operator:u,rule:o,onChange:T},_),f.jsx("div",{className:`${N.cfPreviewWrap}`,children:f.jsx(Ct,{rule:R({})})}),f.jsx(Mr,{style:o==null?void 0:o.style,className:`${P.mLXxs}`,onChange:m=>{y(m),n(R({style:m}))}})]})},cu=e=>{var E;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(g.LocaleService),i=te.useDependency(g.IUniverInstanceService).getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),a=i.getActiveSheet(),c=((E=e.rule)==null?void 0:E.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,u]=w.useState({}),[d,h]=w.useState(()=>(c==null?void 0:c.subType)===s.CFSubRuleType.formula?c.value:"="),[p,v]=w.useState(""),y=C=>({style:C.style,value:d,type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula});w.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({style:l,formula:d})}}),[l,d,n]),w.useEffect(()=>{n.intercept(n.getInterceptPoints().beforeSubmit,{handler:(C,T,_)=>!d||d.length===1||!p.startsWith("=")?(v(r.t("sheet.cf.errorMessage.formulaError")),!1):_(C)})},[d]);const R=C=>{t(y(C))};return f.jsxs("div",{children:[f.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${P.mTSm}`,children:f.jsx(Dt,{errorText:p,children:f.jsx(Ce.TextEditor,{id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`),openForSheetSubUnitId:a==null?void 0:a.getSheetId(),openForSheetUnitId:i.getUnitId(),value:d,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(C="")=>{const T=C||"";h(T),R({style:l,formula:T}),v("")}})})}),f.jsx("div",{className:`${N.cfPreviewWrap} `,children:f.jsx(Ct,{rule:y({style:l,formula:d})})}),f.jsx(Mr,{style:c==null?void 0:c.style,className:`${P.mTSm} `,onChange:C=>{u(C),R({style:C,formula:d})}})]})};var uu="Expected a function",hi="__lodash_hash_undefined__",mi=1/0,du=9007199254740991,fu="[object Function]",pu="[object GeneratorFunction]",hu="[object Symbol]",mu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gu=/^\w*$/,vu=/^\./,yu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Cu=/[\\^$.*+?()[\]{}|]/g,Su=/\\(\\)?/g,bu=/^\[object .+?Constructor\]$/,Ru=/^(?:0|[1-9]\d*)$/,_u=typeof Ae=="object"&&Ae&&Ae.Object===Object&&Ae,Tu=typeof self=="object"&&self&&self.Object===Object&&self,Fr=_u||Tu||Function("return this")();function Iu(e,t){return e==null?void 0:e[t]}function wu(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var xu=Array.prototype,Ou=Function.prototype,gi=Object.prototype,zn=Fr["__core-js_shared__"],io=function(){var e=/[^.]+$/.exec(zn&&zn.keys&&zn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),vi=Ou.toString,In=gi.hasOwnProperty,yi=gi.toString,Eu=RegExp("^"+vi.call(In).replace(Cu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ao=Fr.Symbol,Du=xu.splice,Pu=Ci(Fr,"Map"),Lt=Ci(Object,"create"),so=ao?ao.prototype:void 0,lo=so?so.toString:void 0;function tt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Mu(){this.__data__=Lt?Lt(null):{}}function Fu(e){return this.has(e)&&delete this.__data__[e]}function Nu(e){var t=this.__data__;if(Lt){var n=t[e];return n===hi?void 0:n}return In.call(t,e)?t[e]:void 0}function ju(e){var t=this.__data__;return Lt?t[e]!==void 0:In.call(t,e)}function $u(e,t){var n=this.__data__;return n[e]=Lt&&t===void 0?hi:t,this}tt.prototype.clear=Mu;tt.prototype.delete=Fu;tt.prototype.get=Nu;tt.prototype.has=ju;tt.prototype.set=$u;function St(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Lu(){this.__data__=[]}function Uu(e){var t=this.__data__,n=wn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Du.call(t,n,1),!0}function Vu(e){var t=this.__data__,n=wn(t,e);return n<0?void 0:t[n][1]}function zu(e){return wn(this.__data__,e)>-1}function Au(e,t){var n=this.__data__,r=wn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}St.prototype.clear=Lu;St.prototype.delete=Uu;St.prototype.get=Vu;St.prototype.has=zu;St.prototype.set=Au;function it(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hu(){this.__data__={hash:new tt,map:new(Pu||St),string:new tt}}function Wu(e){return xn(this,e).delete(e)}function ku(e){return xn(this,e).get(e)}function qu(e){return xn(this,e).has(e)}function Bu(e,t){return xn(this,e).set(e,t),this}it.prototype.clear=Hu;it.prototype.delete=Wu;it.prototype.get=ku;it.prototype.has=qu;it.prototype.set=Bu;function Gu(e,t,n){var r=e[t];(!(In.call(e,t)&&Si(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function wn(e,t){for(var n=e.length;n--;)if(Si(e[n][0],t))return n;return-1}function Xu(e){if(!sn(e)||td(e))return!1;var t=id(e)||wu(e)?Eu:bu;return t.test(od(e))}function Yu(e,t,n,r){if(!sn(e))return e;t=Qu(t,e)?[t]:Zu(t);for(var o=-1,i=t.length,a=i-1,c=e;c!=null&&++o<i;){var l=rd(t[o]),u=n;if(o!=a){var d=c[l];u=void 0,u===void 0&&(u=sn(d)?d:Ju(t[o+1])?[]:{})}Gu(c,l,u),c=c[l]}return e}function Ku(e){if(typeof e=="string")return e;if(jr(e))return lo?lo.call(e):"";var t=e+"";return t=="0"&&1/e==-mi?"-0":t}function Zu(e){return bi(e)?e:nd(e)}function xn(e,t){var n=e.__data__;return ed(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ci(e,t){var n=Iu(e,t);return Xu(n)?n:void 0}function Ju(e,t){return t=t==null?du:t,!!t&&(typeof e=="number"||Ru.test(e))&&e>-1&&e%1==0&&e<t}function Qu(e,t){if(bi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||jr(e)?!0:gu.test(e)||!mu.test(e)||t!=null&&e in Object(t)}function ed(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function td(e){return!!io&&io in e}var nd=Nr(function(e){e=sd(e);var t=[];return vu.test(e)&&t.push(""),e.replace(yu,function(n,r,o,i){t.push(o?i.replace(Su,"$1"):r||n)}),t});function rd(e){if(typeof e=="string"||jr(e))return e;var t=e+"";return t=="0"&&1/e==-mi?"-0":t}function od(e){if(e!=null){try{return vi.call(e)}catch{}try{return e+""}catch{}}return""}function Nr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(uu);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(Nr.Cache||it),n}Nr.Cache=it;function Si(e,t){return e===t||e!==e&&t!==t}var bi=Array.isArray;function id(e){var t=sn(e)?yi.call(e):"";return t==fu||t==pu}function sn(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function ad(e){return!!e&&typeof e=="object"}function jr(e){return typeof e=="symbol"||ad(e)&&yi.call(e)==hu}function sd(e){return e==null?"":Ku(e)}function ld(e,t,n){return e==null?e:Yu(e,t,n)}var cd=ld;const ud=cr(cd);var dd="Expected a function",Ri="__lodash_hash_undefined__",_i=1/0,fd="[object Function]",pd="[object GeneratorFunction]",hd="[object Symbol]",md=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gd=/^\w*$/,vd=/^\./,yd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Cd=/[\\^$.*+?()[\]{}|]/g,Sd=/\\(\\)?/g,bd=/^\[object .+?Constructor\]$/,Rd=typeof Ae=="object"&&Ae&&Ae.Object===Object&&Ae,_d=typeof self=="object"&&self&&self.Object===Object&&self,$r=Rd||_d||Function("return this")();function Td(e,t){return e==null?void 0:e[t]}function Id(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var wd=Array.prototype,xd=Function.prototype,Ti=Object.prototype,An=$r["__core-js_shared__"],co=function(){var e=/[^.]+$/.exec(An&&An.keys&&An.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ii=xd.toString,Lr=Ti.hasOwnProperty,wi=Ti.toString,Od=RegExp("^"+Ii.call(Lr).replace(Cd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),uo=$r.Symbol,Ed=wd.splice,Dd=xi($r,"Map"),Ut=xi(Object,"create"),fo=uo?uo.prototype:void 0,po=fo?fo.toString:void 0;function nt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Pd(){this.__data__=Ut?Ut(null):{}}function Md(e){return this.has(e)&&delete this.__data__[e]}function Fd(e){var t=this.__data__;if(Ut){var n=t[e];return n===Ri?void 0:n}return Lr.call(t,e)?t[e]:void 0}function Nd(e){var t=this.__data__;return Ut?t[e]!==void 0:Lr.call(t,e)}function jd(e,t){var n=this.__data__;return n[e]=Ut&&t===void 0?Ri:t,this}nt.prototype.clear=Pd;nt.prototype.delete=Md;nt.prototype.get=Fd;nt.prototype.has=Nd;nt.prototype.set=jd;function bt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function $d(){this.__data__=[]}function Ld(e){var t=this.__data__,n=On(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Ed.call(t,n,1),!0}function Ud(e){var t=this.__data__,n=On(t,e);return n<0?void 0:t[n][1]}function Vd(e){return On(this.__data__,e)>-1}function zd(e,t){var n=this.__data__,r=On(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}bt.prototype.clear=$d;bt.prototype.delete=Ld;bt.prototype.get=Ud;bt.prototype.has=Vd;bt.prototype.set=zd;function at(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ad(){this.__data__={hash:new nt,map:new(Dd||bt),string:new nt}}function Hd(e){return En(this,e).delete(e)}function Wd(e){return En(this,e).get(e)}function kd(e){return En(this,e).has(e)}function qd(e,t){return En(this,e).set(e,t),this}at.prototype.clear=Ad;at.prototype.delete=Hd;at.prototype.get=Wd;at.prototype.has=kd;at.prototype.set=qd;function On(e,t){for(var n=e.length;n--;)if(nf(e[n][0],t))return n;return-1}function Bd(e,t){t=Kd(t,e)?[t]:Yd(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[ef(t[n++])];return n&&n==r?e:void 0}function Gd(e){if(!Ei(e)||Jd(e))return!1;var t=rf(e)||Id(e)?Od:bd;return t.test(tf(e))}function Xd(e){if(typeof e=="string")return e;if(Vr(e))return po?po.call(e):"";var t=e+"";return t=="0"&&1/e==-_i?"-0":t}function Yd(e){return Oi(e)?e:Qd(e)}function En(e,t){var n=e.__data__;return Zd(t)?n[typeof t=="string"?"string":"hash"]:n.map}function xi(e,t){var n=Td(e,t);return Gd(n)?n:void 0}function Kd(e,t){if(Oi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Vr(e)?!0:gd.test(e)||!md.test(e)||t!=null&&e in Object(t)}function Zd(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Jd(e){return!!co&&co in e}var Qd=Ur(function(e){e=af(e);var t=[];return vd.test(e)&&t.push(""),e.replace(yd,function(n,r,o,i){t.push(o?i.replace(Sd,"$1"):r||n)}),t});function ef(e){if(typeof e=="string"||Vr(e))return e;var t=e+"";return t=="0"&&1/e==-_i?"-0":t}function tf(e){if(e!=null){try{return Ii.call(e)}catch{}try{return e+""}catch{}}return""}function Ur(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(dd);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(Ur.Cache||at),n}Ur.Cache=at;function nf(e,t){return e===t||e!==e&&t!==t}var Oi=Array.isArray;function rf(e){var t=Ei(e)?wi.call(e):"";return t==fd||t==pd}function Ei(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function of(e){return!!e&&typeof e=="object"}function Vr(e){return typeof e=="symbol"||of(e)&&wi.call(e)==hd}function af(e){return e==null?"":Xd(e)}function sf(e,t,n){var r=e==null?void 0:Bd(e,t);return r===void 0?n:r}var lf=sf;const cf=cr(lf),Di=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",uf=e=>{var i;const t=te.useDependency(g.IUniverInstanceService),n=t.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=(i=t.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:i.getSheetId(),o=w.useMemo(()=>e.error?N.errorInput:"",[e.error]);return f.jsx("div",{className:N.positionRelative,children:e.type!==s.CFValueType.formula?f.jsxs(f.Fragment,{children:[f.jsx(B.InputNumber,{className:o,value:Number(e.value)||0,onChange:a=>e.onChange(a!=null?a:0)}),e.error&&f.jsx("div",{className:N.errorText,children:e.error})]}):f.jsx(Ce.TextEditor,{id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_icon_set_${e.id}`),value:String(e.value).startsWith("=")?String(e.value):"=",openForSheetSubUnitId:r,openForSheetUnitId:n,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(a="")=>{const c=a||"";e.onChange(c)}})})},ho=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),df=w.forwardRef((e,t)=>{const n=te.useDependency(g.LocaleService),r=o=>{e.onClick(o)};return f.jsx("div",{ref:t,className:N.iconGroupList,children:s.iconGroup.map((o,i)=>f.jsxs("div",{className:N.group,children:[f.jsx("div",{className:N.title,children:n.t(o.title)}),f.jsx("div",{className:N.itemContent,children:o.group.map(a=>f.jsx("div",{className:N.itemWrap,onClick:()=>{r(a.name)},children:f.jsx("div",{className:N.item,children:a.list.map((c,l)=>f.jsx("img",{className:N.icon,src:c},l))})},a.name))})]},i))})}),ff=e=>{const t=w.useMemo(()=>{const r=[];for(const o in s.iconMap){const i=s.iconMap[o],a=o;i.forEach((c,l)=>{r.push({iconType:a,base64:c,iconId:String(l)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return f.jsxs("div",{className:N.iconItemListWrap,children:[f.jsxs("div",{className:N.none,onClick:()=>n({iconType:s.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[f.jsx(zt,{className:N.icon}),f.jsx("span",{children:"无单元格图标"})]}),f.jsx("div",{className:N.iconItemList,children:t.map(r=>f.jsx("div",{className:N.item,children:f.jsx("img",{onClick:()=>n(r),className:`${N.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},pf=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,o=te.useDependency(g.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],a=[{label:o.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],c=(h,p)=>{t([String(p),"value","value"],h)},l=(h,p)=>{t([String(p),"operator"],h);const v=s.createDefaultValue(s.CFSubRuleType.number,h);c(v,p)},u=(h,p)=>{t([String(p),"value","type"],h)};return w.useMemo(()=>n.map((h,p)=>{const v=r[p],y=Di(h.iconType,h.iconId),R=p===n.length-1,E=p===0,C=n[p-1],T=(C==null?void 0:C.value.type)===s.CFValueType.formula?o.t("sheet.cf.valueType.formula"):C==null?void 0:C.value.value,_=(I,m)=>{const x={...h,iconId:m,iconType:I};t([String(p)],x)};return f.jsxs("div",{className:`${p?P.mTXl:P.mTSm}`,children:[f.jsxs("div",{className:`${P.label} ${N.flex}`,children:[f.jsxs("div",{className:`${N.width45}`,children:[o.t("sheet.cf.iconSet.icon"),p+1]}),f.jsx("div",{className:`${N.width45}`,children:f.jsxs(f.Fragment,{children:[!E&&!R&&o.t("sheet.cf.iconSet.rule"),!E&&!R&&f.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(C.operator)}`),T,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),f.jsxs("div",{className:`${N.flex} ${P.mTSm}`,children:[f.jsx("div",{className:`${N.iconWrap} ${N.width45}`,children:f.jsx(B.Dropdown,{overlay:f.jsx(ff,{onClick:_,iconId:h.iconId,iconType:h.iconType}),children:f.jsxs("div",{className:N.dropdownIcon,children:[y?f.jsx("img",{src:y,className:N.icon}):f.jsx(zt,{className:N.icon}),f.jsx(un,{})]})})}),R?f.jsxs("div",{className:`${N.width45} ${P.label}`,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),f.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(C.operator)}`),T,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):f.jsx(B.Select,{className:`${P.mL0} ${N.width45} ${P.mR0}`,options:i,value:h.operator,onChange:I=>{l(I,p)}})]}),R?f.jsx("div",{}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:`${P.mTSm} ${P.label} ${N.flex}`,children:[f.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.type")}),f.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.value")})]}),f.jsxs("div",{className:`${P.mTSm} ${N.flex}`,children:[f.jsx(B.Select,{className:`${N.width45} ${P.mL0}`,options:a,value:h.value.type,onChange:I=>{u(I,p)}}),f.jsx("div",{className:`${P.mL0} ${N.width45}`,children:f.jsx(uf,{id:p,type:h.value.type,error:v,value:h.value.value||"",onChange:I=>c(I,p)})})]})]})]},p)}),[n,r])},hf=e=>{var I;const{interceptorManager:t}=e,n=((I=e.rule)==null?void 0:I.type)===s.CFRuleType.iconSet?e.rule:void 0,r=te.useDependency(g.LocaleService),[o,i]=w.useState({}),[a,c]=w.useState(()=>{const m=Object.keys(s.iconMap)[0];if(n&&n.config.length){const x=n.config[0].iconType;if(!n.config.some(S=>S.iconType!==x))return x}return m}),[l,u]=w.useState(()=>{if(n&&n.config.length)return g.Tools.deepClone(n==null?void 0:n.config);const m=s.iconMap[a]||[];return new Array(m.length).fill("").map((x,O,S)=>O===S.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:a,iconId:String(O)}:ho(a,O,S))}),[d,h]=w.useState(()=>n?!!n.isShowValue:!0),p=w.useMemo(()=>{const m=l.map(x=>Di(x.iconType,x.iconId));return f.jsx("div",{className:N.iconWrap,children:m.map((x,O)=>x?f.jsx("img",{className:N.icon,src:x},O):f.jsx(zt,{className:N.icon},O))})},[l]),v=m=>{if(m.reduce((O,S,M)=>O.preType&&!O.result||m.length-1===M?O:S.value.type===s.CFValueType.formula?{preType:s.CFValueType.formula,result:!1}:O.preType?{result:O.preType===S.value.type,preType:S.value.type}:{result:!0,preType:S.value.type},{result:!0,preType:""}).result&&[s.CFValueType.num,s.CFValueType.percent,s.CFValueType.percentile].includes(m[0].value.type)){const O={};return m.forEach((S,M,j)=>{if(M-1<0||M===j.length-1)return;const H=m[M-1],b=s.getOppositeOperator(H.operator);s.compareWithNumber({operator:b,value:H.value.value},S.value.value)||(O[M]=`${r.t(`sheet.cf.form.${b}`,String(H.value.value))} `)}),O}return{}},y=(m,x)=>{cf(l,m)!==x&&(ud(l,m,x),u([...l]),i(v(l)))},R=m=>{c(m);const x=s.iconMap[m]||[],O=new Array(x.length).fill("").map((S,M,j)=>ho(m,M,j));u(O),i(v(O))};w.useEffect(()=>{const m=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:d,config:l}}});return()=>{m()}},[d,l,t]),w.useEffect(()=>{const m=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{m()}},[d,l,t,o]);const E=()=>{const m=l.map(x=>({...x}));l.forEach((x,O)=>{const S=l.length-1-O,M=m[S];x.iconId=M.iconId,x.iconType=M.iconType}),u([...l])},C=te.useDependency(Ce.ILayoutService),[T,_]=w.useState();return Ce.useScrollYOverContainer(T,C.rootContainerElement),f.jsxs("div",{className:N.iconSet,children:[f.jsx("div",{className:P.title,children:r.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${P.mTSm}`,children:f.jsx(B.Dropdown,{placement:"bottomLeft",overlay:f.jsx(df,{ref:m=>!T&&m&&_(m),iconType:a,onClick:R}),children:f.jsxs("div",{className:N.dropdownIcon,style:{width:"unset"},children:[p,f.jsx(un,{})]})})}),f.jsxs("div",{className:`${P.mTSm} ${N.renderConfig}`,children:[f.jsxs("div",{className:N.utilItem,children:[f.jsx(B.Checkbox,{onChange:E}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),f.jsxs("div",{className:`${N.utilItem} ${P.mLXl}`,children:[f.jsx(B.Checkbox,{checked:!d,onChange:m=>{h(!m)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),f.jsx(pf,{errorMap:o,onChange:y,configList:l})]})},mo=e=>e.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),go=e=>{var t;return(t=e.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId()},mf=e=>{var I,m,x,O;const t=te.useDependency(g.LocaleService),n=te.useDependency(g.ICommandService),r=te.useDependency(g.IUniverInstanceService),o=te.useDependency(s.ConditionalFormattingRuleModel),i=te.useDependency(L.SheetsSelectionsService),a=mo(r),c=go(r),l=w.useRef((m=(I=e.rule)==null?void 0:I.ranges)!=null?m:[]),u=w.useMemo(()=>{var M,j,$;let S=(M=e.rule)==null?void 0:M.ranges;return S!=null&&S.length||(S=($=(j=i.getCurrentSelections())==null?void 0:j.map(H=>H.range))!=null?$:[]),l.current=S,S!=null&&S.length?S.map(H=>{const b=bo.serializeRange(H);return b==="NaN"?"":b}).filter(H=>!!H).join(","):""},[e.rule]),d=[{label:t.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:t.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:t.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:t.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:t.t("sheet.cf.ruleType.formula"),value:"5"},{label:t.t("sheet.cf.ruleType.iconSet"),value:"6"}],[h,p]=w.useState(()=>{var j,$;const S=(j=e.rule)==null?void 0:j.rule.type,M=d[0].value;if(!S)return M;switch(S){case s.CFRuleType.highlightCell:{switch(($=e.rule)==null?void 0:$.rule.subType){case s.CFSubRuleType.number:case s.CFSubRuleType.text:case s.CFSubRuleType.duplicateValues:case s.CFSubRuleType.uniqueValues:case s.CFSubRuleType.timePeriod:return"1";case s.CFSubRuleType.average:case s.CFSubRuleType.rank:return"2";case s.CFSubRuleType.formula:return"5"}break}case s.CFRuleType.dataBar:return"3";case s.CFRuleType.colorScale:return"4";case s.CFRuleType.iconSet:return"6"}return M}),v=w.useRef(),y=w.useMemo(()=>new g.InterceptorManager({beforeSubmit:Ic,submit:wc}),[]),R=w.useMemo(()=>{switch(h){case"1":return oo;case"2":return su;case"3":return ru;case"4":return nu;case"5":return cu;case"6":return hf;default:return oo}},[h]);w.useEffect(()=>{var S;if(((S=e.rule)==null?void 0:S.cfId)!==void 0){const M=n.onCommandExecuted(j=>{if(j.id===L.RemoveSheetMutation.id){const $=j.params;$.subUnitId===c&&$.unitId===a&&e.onCancel()}j.id===L.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>M.dispose()}},[(x=e.rule)==null?void 0:x.cfId]);const E=S=>{v.current=S},C=S=>{l.current=S.map(M=>M.range)},T=()=>{const M=(()=>{const $=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!$)throw new Error("No active sheet found");return l.current.map(D=>L.setEndForRange(D,$.getRowCount(),$.getColumnCount())).filter(D=>!(Number.isNaN(D.startRow)||Number.isNaN(D.startColumn)))})();if(y.fetchThroughInterceptors(y.getInterceptPoints().beforeSubmit)(!0,null)){const $=y.fetchThroughInterceptors(y.getInterceptPoints().submit)(null,null);if($){const H=mo(r),b=go(r);if(!H||!b)throw new Error("No active sheet found");let D={};e.rule&&e.rule.cfId?(D={...e.rule,ranges:M,rule:$},n.executeCommand(Tn.id,{unitId:H,subUnitId:b,rule:D}),e.onCancel()):(D={cfId:o.createCfId(H,b),ranges:M,rule:$,stopIfTrue:!1},n.executeCommand(kt.id,{unitId:H,subUnitId:b,rule:D}),e.onCancel())}}},_=()=>{e.onCancel()};return f.jsxs("div",{className:N.cfRuleStyleEditor,children:[f.jsx("div",{className:P.title,children:t.t("sheet.cf.panel.range")}),f.jsx("div",{className:`${P.mTBase}`,children:f.jsx(Ce.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:c,openForSheetUnitId:a,value:u,id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`),onChange:C})}),f.jsx("div",{className:P.title,children:t.t("sheet.cf.panel.styleType")}),f.jsx("div",{className:P.mTBase,children:f.jsx(B.Select,{className:N.width100,value:h,options:d,onChange:S=>p(S)})}),f.jsx(R,{interceptorManager:y,rule:(O=e.rule)==null?void 0:O.rule,onChange:E}),f.jsxs("div",{className:`${P.mTBase} ${N.btnList}`,children:[f.jsx(B.Button,{size:"small",onClick:_,children:t.t("sheet.cf.panel.cancel")}),f.jsx(B.Button,{className:P.mLSm,size:"small",type:"primary",onClick:T,children:t.t("sheet.cf.panel.submit")})]})]})},gf=e=>{const[t,n]=w.useState(e.rule),[r,o]=w.useState(!!e.rule),i=()=>{o(!0)},a=()=>{o(!1),n(void 0)},c=l=>{n(l),o(!0)};return f.jsx("div",{className:P.conditionalFormattingWrap,children:r?f.jsx(mf,{onCancel:a,rule:t}):f.jsx(Tc,{onClick:c,onCreate:i})})};var vf=Object.defineProperty,yf=Object.getOwnPropertyDescriptor,Cf=(e,t,n,r)=>{for(var o=r>1?void 0:r?yf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&vf(t,n,o),o},dt=(e,t)=>(n,r)=>t(n,r,e);const Pi={},vo="sheet.conditional.formatting.panel";let gt=class extends g.Disposable{constructor(t,n,r,o,i,a,c){super();Rt(this,"_sidebarDisposable",null);this._config=t,this._univerInstanceService=n,this._injector=r,this._componentManager=o,this._menuService=i,this._sidebarService=a,this._localeService=c,this._initMenu(),this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(g.UniverInstanceType.UNIVER_SHEET).subscribe(l=>{var u;l||(u=this._sidebarDisposable)==null||u.dispose()}))}openPanel(t){const n={header:{title:this._localeService.t("sheet.cf.title")},children:{label:vo,rule:t,key:g.Tools.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initMenu(){const{menu:t={}}=this._config;this._menuService.addMenuItem(Vi(this._injector),t)}_initPanel(){this._componentManager.register(vo,gf)}};gt=Cf([g.OnLifecycle(g.LifecycleStages.Ready,gt),dt(1,g.IUniverInstanceService),dt(2,A.Inject(A.Injector)),dt(3,A.Inject(Ce.ComponentManager)),dt(4,A.Inject(Ce.IMenuService)),dt(5,A.Inject(Ce.ISidebarService)),dt(6,A.Inject(g.LocaleService))],gt);var Ie=(e=>(e[e.createRule=1]="createRule",e[e.viewRule=2]="viewRule",e[e.highlightCell=3]="highlightCell",e[e.rank=4]="rank",e[e.formula=5]="formula",e[e.colorScale=6]="colorScale",e[e.dataBar=7]="dataBar",e[e.icon=8]="icon",e[e.clearRangeRules=9]="clearRangeRules",e[e.clearWorkSheetRules=10]="clearWorkSheetRules",e))(Ie||{});const Dn={id:"sheet.operation.open.conditional.formatting.panel",type:g.CommandType.OPERATION,handler:(e,t)=>{var c;const n=e.get(gt),r=e.get(L.SheetsSelectionsService),o=e.get(g.ICommandService),i=((c=r.getCurrentSelections())==null?void 0:c.map(l=>l.range))||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 4:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(l);break}case 5:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(l);break}case 6:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(l);break}case 7:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(l);break}case 8:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(l);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(ln.id,{ranges:i});break}case 10:{o.executeCommand(Vt.id);break}}return!0}};var Sf=Object.defineProperty,bf=Object.getOwnPropertyDescriptor,Rf=(e,t,n,r)=>{for(var o=r>1?void 0:r?bf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Sf(t,n,o),o},ft=(e,t)=>(n,r)=>t(n,r,e);let Pt=class extends g.Disposable{constructor(e,t,n,r,o,i){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=i,this._initViewModelInterceptor(),this._initSkeleton()}_initSkeleton(){const e=()=>{var n,r,o;const t=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId();(n=this._renderManagerService.getRenderById(t))==null||n.with(ue.SheetSkeletonManagerService).reCalculate(),(o=(r=this._renderManagerService.getRenderById(t))==null?void 0:r.mainComponent)==null||o.makeDirty()};this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(qe.bufferTime(16),qe.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(qe.bufferTime(16),qe.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>["sort","delete"].includes(o.type)&&o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(qe.bufferTime(16),qe.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(L.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!r)return n(e);const o=t.workbook.getStyles(),a={...(typeof(e==null?void 0:e.s)=="string"?o.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},c={...e,s:a};return r.style&&Object.assign(a,r.style),c.fontRenderExtension||(c.fontRenderExtension={},r.isShowValue!==void 0&&(c.fontRenderExtension.isSkip=!r.isShowValue)),r.dataBar&&(c.dataBar=r.dataBar),r.iconSet&&(c.iconSet=r.iconSet,c.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH),n(c)},priority:10}))}};Pt=Rf([g.OnLifecycle(g.LifecycleStages.Rendered,Pt),ft(0,A.Inject(L.SheetInterceptorService)),ft(1,A.Inject(s.ConditionalFormattingService)),ft(2,A.Inject(g.IUniverInstanceService)),ft(3,A.Inject(Ui.IRenderManagerService)),ft(4,A.Inject(s.ConditionalFormattingViewModel)),ft(5,A.Inject(s.ConditionalFormattingRuleModel))],Pt);var _f=Object.defineProperty,Tf=Object.getOwnPropertyDescriptor,If=(e,t,n,r)=>{for(var o=r>1?void 0:r?Tf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&_f(t,n,o),o},It=(e,t)=>(n,r)=>t(n,r,e);let Mt=class extends g.Disposable{constructor(t,n,r,o,i){super();Rt(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=o,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,n,r)=>this._collectConditionalRule(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:i=ue.COPY_TYPE.COPY,pasteType:a}=o,{range:c}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:i,pasteType:a,copyRange:c})}}))}_collectConditionalRule(t,n,r){const o=new g.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:t,subUnitId:n,cfMap:i}};const a=this._conditionalFormattingViewModel.getMatrix(t,n);if(!a)return;const c={get:this._injector.get.bind(this._injector)},l=ue.rangeToDiscreteRange(r,c,t,n);if(!l)return;const{rows:u,cols:d}=l,h=new Set;u.forEach((p,v)=>{d.forEach((y,R)=>{const E=this._conditionalFormattingViewModel.getCellCf(t,n,p,y,a);E&&(E.cfList.forEach(C=>h.add(C.cfId)),o.setValue(v,R,E.cfList.map(C=>C.cfId)))})}),h.forEach(p=>{const v=this._conditionalFormattingRuleModel.getRule(t,n,p);v&&(i[p]=v.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),o=r.getActiveSheet(),i=r.getUnitId();if(!o)return{redos:[],undos:[]};const a=o.getSheetId();if(n.copyType===ue.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![ue.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,ue.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,ue.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[c,l],mapFunc:u}=ue.virtualizeDiscreteRanges([n.copyRange,t]),d=ue.getRepeatRange(c,l,!0),h=this._conditionalFormattingViewModel.getMatrix(i,a),p={};g.Range.foreach(l,(m,x)=>{const{row:O,col:S}=u(m,x),M=this._conditionalFormattingViewModel.getCellCf(i,a,O,S,h);M&&M.cfList.forEach(j=>{if(!p[j.cfId]){const $=new g.ObjectMatrix;p[j.cfId]=$;const H=this._conditionalFormattingRuleModel.getRule(i,a,j.cfId);H==null||H.ranges.forEach(b=>{g.Range.foreach(b,(D,J)=>{$.setValue(D,J,1)})})}p[j.cfId].realDeleteValue(O,S)})});const{matrix:v,info:y}=this._copyInfo,R=[];let E=this._conditionalFormattingRuleModel.createCfId(i,a);const C={},T=m=>{if(C[m])return C[m];const x=y==null?void 0:y.cfMap[m],O=[...this._conditionalFormattingRuleModel.getSubunitRules(i,a)||[],...R].find(S=>g.Tools.diffValue(S.rule,x));if(O)return C[m]=O,O;{const S={rule:x,cfId:E,ranges:[],stopIfTrue:!1};return C[m]=S,R.push(S),E=`${Number(E)+1}`,S}};d.forEach(m=>{v&&v.forValue((x,O,S)=>{const M=g.Rectangle.getPositionRange({startRow:x,endRow:x,startColumn:O,endColumn:O},m.startRange),{row:j,col:$}=u(M.startRow,M.startColumn);S.forEach(H=>{if(!p[H]){const b=T(H),D=new g.ObjectMatrix;p[H]=D,b.ranges.forEach(J=>{g.Range.foreach(J,(be,he)=>{D.setValue(be,he,1)})})}p[H].setValue(j,$,1)})})});const _=[],I=[];for(const m in p){const x=p[m],O=L.findAllRectangle(L.createTopMatrixFromMatrix(x));if(!O.length){const S={unitId:i,subUnitId:a,cfId:m};_.push({id:s.DeleteConditionalRuleMutation.id,params:S}),I.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,S))}if(R.some(S=>S.cfId===m)){const S=T(m),M={unitId:i,subUnitId:a,rule:{...S,ranges:O}};_.push({id:s.AddConditionalRuleMutation.id,params:M}),I.push(s.AddConditionalRuleMutationUndoFactory(this._injector,M))}else{const S=this._conditionalFormattingRuleModel.getRule(i,a,m);if(!S)continue;const M={unitId:i,subUnitId:a,rule:{...S,ranges:O}};_.push({id:s.SetConditionalRuleMutation.id,params:M}),I.push(...s.setConditionalRuleMutationUndoFactory(this._injector,M))}}return{redos:_,undos:I}}};Mt=If([g.OnLifecycle(g.LifecycleStages.Rendered,Mt),It(0,A.Inject(ue.ISheetClipboardService)),It(1,A.Inject(s.ConditionalFormattingRuleModel)),It(2,A.Inject(A.Injector)),It(3,A.Inject(s.ConditionalFormattingViewModel)),It(4,A.Inject(g.IUniverInstanceService))],Mt);var wf=Object.defineProperty,xf=Object.getOwnPropertyDescriptor,Of=(e,t,n,r)=>{for(var o=r>1?void 0:r?xf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&wf(t,n,o),o},Jt=(e,t)=>(n,r)=>t(n,r,e);let Ft=class extends g.Disposable{constructor(e,t,n,r){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._refRangeService=r,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,o,i)=>`${r}_${o}_${i}`,n=(r,o,i)=>{const a=l=>{const u=[...i.ranges],d=u.map(p=>L.handleDefaultRangeChangeWithEffectRefCommands(p,l)).filter(p=>!!p);if(s.isRangesEqual(d,u))return{redos:[],undos:[]};if(d.length){const p={unitId:r,subUnitId:o,rule:{...i,ranges:d}},v=[{id:s.SetConditionalRuleMutation.id,params:p}],y=s.setConditionalRuleMutationUndoFactory(this._injector,p);return{redos:v,undos:y}}else{const p={unitId:r,subUnitId:o,cfId:i.cfId},v=[{id:s.DeleteConditionalRuleMutation.id,params:p}],y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,p);return{redos:v,undos:y}}},c=[];i.ranges.forEach(l=>{const u=this._refRangeService.registerRefRange(l,a);c.push(()=>u.dispose())}),e.set(t(r,o,i.cfId),()=>c.forEach(l=>l()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:o,subUnitId:i,rule:a}=r,c=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),l=c.getActiveSheet();if(!(r.unitId!==c.getUnitId()||r.subUnitId!==(l==null?void 0:l.getSheetId())))switch(r.type){case"add":{n(r.unitId,r.subUnitId,r.rule);break}case"delete":{const u=e.get(t(o,i,a.cfId));u&&u();break}case"set":{const u=e.get(t(o,i,a.cfId));u&&u(),n(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(g.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};Ft=Of([g.OnLifecycle(g.LifecycleStages.Rendered,Ft),Jt(0,A.Inject(s.ConditionalFormattingRuleModel)),Jt(1,A.Inject(g.IUniverInstanceService)),Jt(2,A.Inject(A.Injector)),Jt(3,A.Inject(L.RefRangeService))],Ft);var Ef=Object.defineProperty,Df=Object.getOwnPropertyDescriptor,Pf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Df(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Ef(t,n,o),o},Hn=(e,t)=>(n,r)=>t(n,r,e);let Nt=class extends g.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===kt.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[L.WorkbookEditablePermission],rangeTypes:[L.RangeProtectionPermissionEditPoint],worksheetTypes:[L.WorksheetEditPermission,L.WorksheetSetCellStylePermission]},e.params.rule.ranges)||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")))}))}};Nt=Pf([g.OnLifecycle(g.LifecycleStages.Rendered,Nt),Hn(0,A.Inject(g.LocaleService)),Hn(1,g.ICommandService),Hn(2,A.Inject(ue.SheetPermissionInterceptorBaseController))],Nt);var Mi=Object.defineProperty,Mf=Object.getOwnPropertyDescriptor,Ff=(e,t,n)=>t in e?Mi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Mf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Mi(t,n,o),o},yo=(e,t)=>(n,r)=>t(n,r,e),Fi=(e,t,n)=>Ff(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends g.Plugin{constructor(t={},n,r){super(),this._config=t,this._injector=n,this._commandService=r,this._config=g.Tools.deepMerge({},Pi,this._config),this._initCommand(),this._injector.add([Pt]),this._injector.add([Ft]),this._injector.add([Mt]),this._injector.add([Nt]),this._injector.add([mt])}_initCommand(){[er,tr,nr,rr,or,ir,ar,sr,lr,Dn,$t,Tn,_n,kt,ln,Vt].forEach(t=>{this._commandService.registerCommand(t)})}};Fi(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Fi(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",g.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=Nf([g.DependentOn(s.UniverSheetsConditionalFormattingPlugin),yo(1,A.Inject(A.Injector)),yo(2,A.Inject(g.ICommandService))],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var jf=Object.defineProperty,$f=Object.getOwnPropertyDescriptor,Lf=(e,t,n,r)=>{for(var o=r>1?void 0:r?$f(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&jf(t,n,o),o},wt=(e,t)=>(n,r)=>t(n,r,e);let en=class extends g.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(o,i,a,c,l)=>{var v;const u=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(v=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:v.getSheetId();if(!u||!d)return;const h={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},p={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};g.Range.foreach(a,(y,R)=>{const E=g.Rectangle.getPositionRange({startRow:y,startColumn:R,endColumn:R,endRow:y},h),C=g.Rectangle.getPositionRange({startRow:y,startColumn:R,endColumn:R,endRow:y},p),{row:T,col:_}=l(E.startRow,E.startColumn),I=this._conditionalFormattingViewModel.getCellCf(u,d,T,_),{row:m,col:x}=l(C.startRow,C.startColumn),O=this._conditionalFormattingViewModel.getCellCf(u,d,m,x);O&&O.cfList.forEach(S=>{let M=c.get(S.cfId);if(!c.get(S.cfId)){const j=this._conditionalFormattingRuleModel.getRule(u,d,S.cfId);if(!j)return;M=new g.ObjectMatrix,j.ranges.forEach($=>{g.Range.foreach($,(H,b)=>{M.setValue(H,b,1)})}),c.set(S.cfId,M)}M.realDeleteValue(m,x)}),I&&I.cfList.forEach(S=>{let M=c.get(S.cfId);if(!c.get(S.cfId)){const j=this._conditionalFormattingRuleModel.getRule(u,d,S.cfId);if(!j)return;M=new g.ObjectMatrix,j.ranges.forEach($=>{g.Range.foreach($,(H,b)=>{M.setValue(H,b,1)})}),c.set(S.cfId,M)}M.setValue(m,x,1)})})},n=(o,i)=>{var C,T,_;const a=(C=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:C.getUnitId(),c=(_=(T=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:T.getActiveSheet())==null?void 0:_.getSheetId(),l=new Map,u=[],d=[];if(!a||!c)return e();const h=ue.virtualizeDiscreteRanges([o,i]),[p,v]=h.ranges,{mapFunc:y}=h,R={row:p.startRow,col:p.startColumn};return ue.getAutoFillRepeatRange(p,v).forEach(I=>{t(R,I.repeatStartCell,I.relativeRange,l,y)}),l.forEach((I,m)=>{const x=this._conditionalFormattingRuleModel.getRule(a,c,m);if(!x)return;const O=L.findAllRectangle(L.createTopMatrixFromMatrix(I));if(O.length){const S={unitId:a,subUnitId:c,rule:{...x,ranges:O}};u.push({id:s.SetConditionalRuleMutation.id,params:S}),d.push(...s.setConditionalRuleMutationUndoFactory(this._injector,S))}else{const S={unitId:a,subUnitId:c,cfId:x.cfId};u.push({id:s.DeleteConditionalRuleMutation.id,params:S}),d.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,S))}}),{undos:d,redos:u}},r={id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,a)=>{if(a===ue.APPLY_TYPE.COPY||a===ue.APPLY_TYPE.ONLY_FORMAT||a===ue.APPLY_TYPE.SERIES){const{source:c,target:l}=o;return n(c,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};en=Lf([g.OnLifecycle(g.LifecycleStages.Rendered,en),wt(0,A.Inject(A.Injector)),wt(1,A.Inject(g.IUniverInstanceService)),wt(2,A.Inject(ue.IAutoFillService)),wt(3,A.Inject(s.ConditionalFormattingRuleModel)),wt(4,A.Inject(s.ConditionalFormattingViewModel))],en);var Uf=Object.defineProperty,Vf=Object.getOwnPropertyDescriptor,zf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Vf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Uf(t,n,o),o},Co=(e,t)=>(n,r)=>t(n,r,e);let tn=class extends g.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(g.toDisposable(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(r!=null&&r.style&&(e!=null&&e.p)){const o=Object.keys(r==null?void 0:r.style);if(o.length>0){const i=s.getStringFromDataStream(e.p),a={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};o.forEach(l=>{delete a[l]});const c={...e,s:{...a},v:i};return delete c.p,n(c)}}return n(e)}})))}};tn=zf([g.OnLifecycle(g.LifecycleStages.Rendered,tn),Co(0,A.Inject(ue.IEditorBridgeService)),Co(1,A.Inject(s.ConditionalFormattingService))],tn);var Af=Object.defineProperty,Hf=Object.getOwnPropertyDescriptor,Wf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Hf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Af(t,n,o),o},xt=(e,t)=>(n,r)=>t(n,r,e);exports.ConditionalFormattingClearController=class extends g.Disposable{constructor(t,n,r,o,i){super(),this._injector=t,this._univerInstanceService=n,this._sheetInterceptorService=r,this._selectionManagerService=o,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{var i;const n=[],r=[],o={redos:n,undos:r};if([L.ClearSelectionFormatCommand.id,L.ClearSelectionAllCommand.id].includes(t.id)){const a=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(d=>d.range);if(!a)return o;const c=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),l=c.getActiveSheet();if(!l)return o;const u=this._conditionalFormattingRuleModel.getSubunitRules(c.getUnitId(),l.getSheetId());if(!u||!u.length)return o;u.filter(d=>a.some(h=>d.ranges.some(p=>g.Rectangle.getIntersects(p,h)))).forEach(d=>{const p=new L.RangeMergeUtil().add(...d.ranges).subtract(...a).merge();if(p.length){const v={id:s.SetConditionalRuleMutation.id,params:{unitId:c.getUnitId(),subUnitId:l.getSheetId(),rule:{...d,ranges:p}}},y=s.setConditionalRuleMutationUndoFactory(this._injector,v.params);n.push(v),r.push(...y)}else{const v={id:s.DeleteConditionalRuleMutation.id,params:{unitId:c.getUnitId(),subUnitId:l.getSheetId(),cfId:d.cfId}},y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,v.params);n.push(v),r.push(...y)}})}return o}}))}};exports.ConditionalFormattingClearController=Wf([g.OnLifecycle(g.LifecycleStages.Rendered,exports.ConditionalFormattingClearController),xt(0,A.Inject(A.Injector)),xt(1,A.Inject(g.IUniverInstanceService)),xt(2,A.Inject(L.SheetInterceptorService)),xt(3,A.Inject(L.SheetsSelectionsService)),xt(4,A.Inject(s.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);var Ni=Object.defineProperty,kf=Object.getOwnPropertyDescriptor,qf=(e,t,n)=>t in e?Ni(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bf=(e,t,n,r)=>{for(var o=r>1?void 0:r?kf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Ni(t,n,o),o},So=(e,t)=>(n,r)=>t(n,r,e),ji=(e,t,n)=>qf(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsConditionalFormattingUIPlugin=class extends g.Plugin{constructor(t={},n,r){super(),this._config=t,this._injector=n,this._commandService=r,this._config=g.Tools.deepMerge({},Pi,this._config),this._initCommand(),this._injector.add([Pt]),this._injector.add([Ft]),this._injector.add([Mt]),this._injector.add([en]),this._injector.add([Nt]),this._injector.add([gt,{useFactory:()=>this._injector.createInstance(gt,this._config)}]),this._injector.add([mt]),this._injector.add([tn]),this._injector.add([exports.ConditionalFormattingClearController])}_initCommand(){[er,tr,nr,rr,or,ir,ar,sr,lr,Dn,$t,Tn,_n,kt,ln,Vt].forEach(t=>{this._commandService.registerCommand(t)})}};ji(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);ji(exports.UniverSheetsConditionalFormattingUIPlugin,"type",g.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=Bf([g.DependentOn(s.UniverSheetsConditionalFormattingPlugin),So(1,A.Inject(A.Injector)),So(2,A.Inject(g.ICommandService))],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=er;exports.AddCfCommand=kt;exports.AddColorScaleConditionalRuleCommand=tr;exports.AddDataBarConditionalRuleCommand=nr;exports.AddDuplicateValuesCfCommand=rr;exports.AddNumberCfCommand=or;exports.AddRankCfCommand=ir;exports.AddTextCfCommand=ar;exports.AddTimePeriodCfCommand=sr;exports.AddUniqueValuesCfCommand=lr;exports.ClearRangeCfCommand=ln;exports.ClearWorksheetCfCommand=Vt;exports.DeleteCfCommand=$t;exports.MoveCfCommand=_n;exports.OpenConditionalFormattingOperator=Dn;exports.SetCfCommand=Tn;
|
|
11
|
+
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Bo(e.body,"react-draggable-transparent-selection")}function us(e){if(e)try{if(e.body&&Go(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function Bo(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Go(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.canDragX=ps;Le.canDragY=hs;Le.createCoreData=gs;Le.createDraggableData=vs;Le.getBoundPosition=ds;Le.getControlPosition=ms;Le.snapToGrid=fs;var Re=$e,dt=ie;function ds(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:ys(r);const o=Cr(e);if(typeof r=="string"){const{ownerDocument:i}=o,a=i.defaultView;let c;if(r==="parent"?c=o.parentNode:c=i.querySelector(r),!(c instanceof a.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=c,d=a.getComputedStyle(o),f=a.getComputedStyle(l);r={left:-o.offsetLeft+(0,Re.int)(f.paddingLeft)+(0,Re.int)(d.marginLeft),top:-o.offsetTop+(0,Re.int)(f.paddingTop)+(0,Re.int)(d.marginTop),right:(0,dt.innerWidth)(l)-(0,dt.outerWidth)(o)-o.offsetLeft+(0,Re.int)(f.paddingRight)-(0,Re.int)(d.marginRight),bottom:(0,dt.innerHeight)(l)-(0,dt.outerHeight)(o)-o.offsetTop+(0,Re.int)(f.paddingBottom)-(0,Re.int)(d.marginBottom)}}return(0,Re.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,Re.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Re.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,Re.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function fs(e,t,n){const r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]}function ps(e){return e.props.axis==="both"||e.props.axis==="x"}function hs(e){return e.props.axis==="both"||e.props.axis==="y"}function ms(e,t,n){const r=typeof t=="number"?(0,dt.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const o=Cr(n),i=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,dt.offsetXYFromParent)(r||e,i,n.props.scale)}function gs(e,t,n){const r=!(0,Re.isNum)(e.lastX),o=Cr(e);return r?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function vs(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function ys(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Cr(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var pn={},hn={};Object.defineProperty(hn,"__esModule",{value:!0});hn.default=Cs;function Cs(){}Object.defineProperty(pn,"__esModule",{value:!0});pn.default=void 0;var Dn=bs(w),Se=Sr(qe),Ss=Sr(So),ge=ie,Ae=Le,Pn=$e,bt=Sr(hn);function Sr(e){return e&&e.__esModule?e:{default:e}}function Xo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Xo=function(r){return r?n:t})(e)}function bs(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Xo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function ye(e,t,n){return t=Rs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rs(e){var t=_s(e,"string");return typeof t=="symbol"?t:String(t)}function _s(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Ee={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let He=Ee.mouse,mn=class extends Dn.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",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(t.target instanceof r.defaultView.Node)||this.props.handle&&!(0,ge.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,ge.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const o=(0,ge.getTouchIdentifier)(t);this.touchIdentifier=o;const i=(0,Ae.getControlPosition)(t,o,this);if(i==null)return;const{x:a,y:c}=i,l=(0,Ae.createCoreData)(this,a,c);(0,bt.default)("DraggableCore: handleDragStart: %j",l),(0,bt.default)("calling",this.props.onStart),!(this.props.onStart(t,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,ge.addUserSelectStyles)(r),this.dragging=!0,this.lastX=a,this.lastY=c,(0,ge.addEvent)(r,He.move,this.handleDrag),(0,ge.addEvent)(r,He.stop,this.handleDragStop))}),ye(this,"handleDrag",t=>{const n=(0,Ae.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,l=o-this.lastY;if([c,l]=(0,Ae.snapToGrid)(this.props.grid,c,l),!c&&!l)return;r=this.lastX+c,o=this.lastY+l}const i=(0,Ae.createCoreData)(this,r,o);if((0,bt.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(t,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=o}),ye(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,Ae.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,d=o-this.lastY||0;[l,d]=(0,Ae.snapToGrid)(this.props.grid,l,d),r=this.lastX+l,o=this.lastY+d}const i=(0,Ae.createCoreData)(this,r,o);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,ge.removeUserSelectStyles)(c.ownerDocument),(0,bt.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,bt.default)("DraggableCore: Removing handlers"),(0,ge.removeEvent)(c.ownerDocument,He.move,this.handleDrag),(0,ge.removeEvent)(c.ownerDocument,He.stop,this.handleDragStop))}),ye(this,"onMouseDown",t=>(He=Ee.mouse,this.handleDragStart(t))),ye(this,"onMouseUp",t=>(He=Ee.mouse,this.handleDragStop(t))),ye(this,"onTouchStart",t=>(He=Ee.touch,this.handleDragStart(t))),ye(this,"onTouchEnd",t=>(He=Ee.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,ge.addEvent)(t,Ee.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,ge.removeEvent)(n,Ee.mouse.move,this.handleDrag),(0,ge.removeEvent)(n,Ee.touch.move,this.handleDrag),(0,ge.removeEvent)(n,Ee.mouse.stop,this.handleDragStop),(0,ge.removeEvent)(n,Ee.touch.stop,this.handleDragStop),(0,ge.removeEvent)(t,Ee.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,ge.removeUserSelectStyles)(n)}}findDOMNode(){var t,n;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:Ss.default.findDOMNode(this)}render(){return Dn.cloneElement(Dn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};pn.default=mn;ye(mn,"displayName","DraggableCore");ye(mn,"propTypes",{allowAnyClick:Se.default.bool,children:Se.default.node.isRequired,disabled:Se.default.bool,enableUserSelectHack:Se.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid: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:Pn.dontSetMe,style:Pn.dontSetMe,transform:Pn.dontSetMe});ye(mn,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),e.default=void 0;var t=h(w),n=f(qe),r=f(So),o=f(ke),i=ie,a=Le,c=$e,l=f(pn),d=f(hn);function f(T){return T&&T.__esModule?T:{default:T}}function m(T){if(typeof WeakMap!="function")return null;var _=new WeakMap,I=new WeakMap;return(m=function(g){return g?I:_})(T)}function h(T,_){if(T&&T.__esModule)return T;if(T===null||typeof T!="object"&&typeof T!="function")return{default:T};var I=m(_);if(I&&I.has(T))return I.get(T);var g={},x=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in T)if(O!=="default"&&Object.prototype.hasOwnProperty.call(T,O)){var S=x?Object.getOwnPropertyDescriptor(T,O):null;S&&(S.get||S.set)?Object.defineProperty(g,O,S):g[O]=T[O]}return g.default=T,I&&I.set(T,g),g}function v(){return v=Object.assign?Object.assign.bind():function(T){for(var _=1;_<arguments.length;_++){var I=arguments[_];for(var g in I)Object.prototype.hasOwnProperty.call(I,g)&&(T[g]=I[g])}return T},v.apply(this,arguments)}function y(T,_,I){return _=R(_),_ in T?Object.defineProperty(T,_,{value:I,enumerable:!0,configurable:!0,writable:!0}):T[_]=I,T}function R(T){var _=E(T,"string");return typeof _=="symbol"?_:String(_)}function E(T,_){if(typeof T!="object"||T===null)return T;var I=T[Symbol.toPrimitive];if(I!==void 0){var g=I.call(T,_||"default");if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_==="string"?String:Number)(T)}class C extends t.Component{static getDerivedStateFromProps(_,I){let{position:g}=_,{prevPropsPosition:x}=I;return g&&(!x||g.x!==x.x||g.y!==x.y)?((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:g,prevPropsPosition:x}),{x:g.x,y:g.y,prevPropsPosition:{...g}}):null}constructor(_){super(_),y(this,"onDragStart",(I,g)=>{if((0,d.default)("Draggable: onDragStart: %j",g),this.props.onStart(I,(0,a.createDraggableData)(this,g))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),y(this,"onDrag",(I,g)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",g);const x=(0,a.createDraggableData)(this,g),O={x:x.x,y:x.y,slackX:0,slackY:0};if(this.props.bounds){const{x:M,y:j}=O;O.x+=this.state.slackX,O.y+=this.state.slackY;const[$,A]=(0,a.getBoundPosition)(this,O.x,O.y);O.x=$,O.y=A,O.slackX=this.state.slackX+(M-O.x),O.slackY=this.state.slackY+(j-O.y),x.x=O.x,x.y=O.y,x.deltaX=O.x-this.state.x,x.deltaY=O.y-this.state.y}if(this.props.onDrag(I,x)===!1)return!1;this.setState(O)}),y(this,"onDragStop",(I,g)=>{if(!this.state.dragging||this.props.onStop(I,(0,a.createDraggableData)(this,g))===!1)return!1;(0,d.default)("Draggable: onDragStop: %j",g);const O={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:M,y:j}=this.props.position;O.x=M,O.y=j}this.setState(O)}),this.state={dragging:!1,dragged:!1,x:_.position?_.position.x:_.defaultPosition.x,y:_.position?_.position.y:_.defaultPosition.y,prevPropsPosition:{..._.position},slackX:0,slackY:0,isElementSVG:!1},_.position&&!(_.onDrag||_.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 _,I;return(_=(I=this.props)===null||I===void 0||(I=I.nodeRef)===null||I===void 0?void 0:I.current)!==null&&_!==void 0?_:r.default.findDOMNode(this)}render(){const{axis:_,bounds:I,children:g,defaultPosition:x,defaultClassName:O,defaultClassNameDragging:S,defaultClassNameDragged:M,position:j,positionOffset:$,scale:A,...b}=this.props;let D={},Z=null;const pe=!!!j||this.state.dragging,he=j||x,xe={x:(0,a.canDragX)(this)&&pe?this.state.x:he.x,y:(0,a.canDragY)(this)&&pe?this.state.y:he.y};this.state.isElementSVG?Z=(0,i.createSVGTransform)(xe,$):D=(0,i.createCSSTransform)(xe,$);const V=(0,o.default)(g.props.className||"",O,{[S]:this.state.dragging,[M]:this.state.dragged});return t.createElement(l.default,v({},b,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(g),{className:V,style:{...g.props.style,...D},transform:Z}))}}e.default=C,y(C,"displayName","Draggable"),y(C,"propTypes",{...l.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),y(C,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Ao);const{default:Yo,DraggableCore:Ts}=Ao;fn.exports=Yo;fn.exports.default=Yo;fn.exports.DraggableCore=Ts;var Ko=fn.exports,gn={exports:{}},zt={},br={};br.__esModule=!0;br.cloneElement=Ds;var Is=ws(w);function ws(e){return e&&e.__esModule?e:{default:e}}function Wr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function kr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wr(Object(n),!0).forEach(function(r){xs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xs(e,t,n){return t=Os(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Os(e){var t=Es(e,"string");return typeof t=="symbol"?t:String(t)}function Es(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ds(e,t){return t.style&&e.props.style&&(t.style=kr(kr({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),Is.default.cloneElement(e,t)}var At={};At.__esModule=!0;At.resizableProps=void 0;var H=Ps(qe);function Ps(e){return e&&e.__esModule?e:{default:e}}var Ms={axis:H.default.oneOf(["both","x","y","none"]),className:H.default.string,children:H.default.element.isRequired,draggableOpts:H.default.shape({allowAnyClick:H.default.bool,cancel:H.default.string,children:H.default.node,disabled:H.default.bool,enableUserSelectHack:H.default.bool,offsetParent:H.default.node,grid:H.default.arrayOf(H.default.number),handle:H.default.string,nodeRef:H.default.object,onStart:H.default.func,onDrag:H.default.func,onStop:H.default.func,onMouseDown:H.default.func,scale:H.default.number}),height:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="y"){var i;return(i=H.default.number).isRequired.apply(i,n)}return H.default.number.apply(H.default,n)},handle:H.default.oneOfType([H.default.node,H.default.func]),handleSize:H.default.arrayOf(H.default.number),lockAspectRatio:H.default.bool,maxConstraints:H.default.arrayOf(H.default.number),minConstraints:H.default.arrayOf(H.default.number),onResizeStop:H.default.func,onResizeStart:H.default.func,onResize:H.default.func,resizeHandles:H.default.arrayOf(H.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:H.default.number,width:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="x"){var i;return(i=H.default.number).isRequired.apply(i,n)}return H.default.number.apply(H.default,n)}};At.resizableProps=Ms;zt.__esModule=!0;zt.default=void 0;var Rt=Ls(w),Fs=Ko,Ns=br,js=At,$s=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Zo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Zo=function(o){return o?n:t})(e)}function Ls(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Zo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function qn(){return qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qn.apply(this,arguments)}function Us(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Mn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qr(Object(n),!0).forEach(function(r){Vs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Vs(e,t,n){return t=zs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zs(e){var t=As(e,"string");return typeof t=="symbol"?t:String(t)}function As(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Bn(e,t)}function Bn(e,t){return Bn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Bn(e,t)}var Rr=function(e){Hs(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var n=t.prototype;return n.componentWillUnmount=function(){this.resetData()},n.resetData=function(){this.lastHandleRect=this.slack=null},n.runConstraints=function(o,i){var a=this.props,c=a.minConstraints,l=a.maxConstraints,d=a.lockAspectRatio;if(!c&&!l&&!d)return[o,i];if(d){var f=this.props.width/this.props.height,m=o-this.props.width,h=i-this.props.height;Math.abs(m)>Math.abs(h*f)?i=o/f:o=i*f}var v=o,y=i,R=this.slack||[0,0],E=R[0],C=R[1];return o+=E,i+=C,c&&(o=Math.max(c[0],o),i=Math.max(c[1],i)),l&&(o=Math.min(l[0],o),i=Math.min(l[1],i)),this.slack=[E+(v-o),C+(y-i)],[o,i]},n.resizeHandler=function(o,i){var a=this;return function(c,l){var d=l.node,f=l.deltaX,m=l.deltaY;o==="onResizeStart"&&a.resetData();var h=(a.props.axis==="both"||a.props.axis==="x")&&i!=="n"&&i!=="s",v=(a.props.axis==="both"||a.props.axis==="y")&&i!=="e"&&i!=="w";if(!(!h&&!v)){var y=i[0],R=i[i.length-1],E=d.getBoundingClientRect();if(a.lastHandleRect!=null){if(R==="w"){var C=E.left-a.lastHandleRect.left;f+=C}if(y==="n"){var T=E.top-a.lastHandleRect.top;m+=T}}a.lastHandleRect=E,R==="w"&&(f=-f),y==="n"&&(m=-m);var _=a.props.width+(h?f/a.props.transformScale:0),I=a.props.height+(v?m/a.props.transformScale:0),g=a.runConstraints(_,I);_=g[0],I=g[1];var x=_!==a.props.width||I!==a.props.height,O=typeof a.props[o]=="function"?a.props[o]:null,S=o==="onResize"&&!x;O&&!S&&(c.persist==null||c.persist(),O(c,{node:d,size:{width:_,height:I},handle:i})),o==="onResizeStop"&&a.resetData()}}},n.renderResizeHandle=function(o,i){var a=this.props.handle;if(!a)return Rt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:i});if(typeof a=="function")return a(o,i);var c=typeof a.type=="string",l=Mn({ref:i},c?{}:{handleAxis:o});return Rt.cloneElement(a,l)},n.render=function(){var o=this,i=this.props,a=i.children,c=i.className,l=i.draggableOpts;i.width,i.height,i.handle,i.handleSize,i.lockAspectRatio,i.axis,i.minConstraints,i.maxConstraints,i.onResize,i.onResizeStop,i.onResizeStart;var d=i.resizeHandles;i.transformScale;var f=Us(i,$s);return(0,Ns.cloneElement)(a,Mn(Mn({},f),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(a.props.children,d.map(function(m){var h,v=(h=o.handleRefs[m])!=null?h:o.handleRefs[m]=Rt.createRef();return Rt.createElement(Fs.DraggableCore,qn({},l,{nodeRef:v,key:"resizableHandle-"+m,onStop:o.resizeHandler("onResizeStop",m),onStart:o.resizeHandler("onResizeStart",m),onDrag:o.resizeHandler("onResize",m)}),o.renderResizeHandle(m,v))}))}))},t}(Rt.Component);zt.default=Rr;Rr.propTypes=js.resizableProps;Rr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var vn={};vn.__esModule=!0;vn.default=void 0;var Fn=Gs(w),Ws=Jo(qe),ks=Jo(zt),qs=At,Bs=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Jo(e){return e&&e.__esModule?e:{default:e}}function Qo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Qo=function(o){return o?n:t})(e)}function Gs(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Qo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Gn(){return Gn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gn.apply(this,arguments)}function Br(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function en(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Br(Object(n),!0).forEach(function(r){Xs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Br(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Xs(e,t,n){return t=Ys(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ys(e){var t=Ks(e,"string");return typeof t=="symbol"?t:String(t)}function Ks(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Js(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xn(e,t)}function Xn(e,t){return Xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Xn(e,t)}var ei=function(e){Js(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(c,l){var d=l.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(d,function(){return r.props.onResize&&r.props.onResize(c,l)})):r.setState(d)},r}t.getDerivedStateFromProps=function(o,i){return i.propsWidth!==o.width||i.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var n=t.prototype;return n.render=function(){var o=this.props,i=o.handle,a=o.handleSize;o.onResize;var c=o.onResizeStart,l=o.onResizeStop,d=o.draggableOpts,f=o.minConstraints,m=o.maxConstraints,h=o.lockAspectRatio,v=o.axis;o.width,o.height;var y=o.resizeHandles,R=o.style,E=o.transformScale,C=Zs(o,Bs);return Fn.createElement(ks.default,{axis:v,draggableOpts:d,handle:i,handleSize:a,height:this.state.height,lockAspectRatio:h,maxConstraints:m,minConstraints:f,onResizeStart:c,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:E,width:this.state.width},Fn.createElement("div",Gn({},C,{style:en(en({},R),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Fn.Component);vn.default=ei;ei.propTypes=en(en({},qs.resizableProps),{},{children:Ws.default.element});gn.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};gn.exports.Resizable=zt.default;gn.exports.ResizableBox=vn.default;var Qs=gn.exports,ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.resizeHandleType=ze.resizeHandleAxesType=ze.default=void 0;var W=ti(qe),el=ti(w);function ti(e){return e&&e.__esModule?e:{default:e}}const tl=ze.resizeHandleAxesType=W.default.arrayOf(W.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),nl=ze.resizeHandleType=W.default.oneOfType([W.default.node,W.default.func]);ze.default={className:W.default.string,style:W.default.object,width:W.default.number,autoSize:W.default.bool,cols:W.default.number,draggableCancel:W.default.string,draggableHandle:W.default.string,verticalCompact:function(e){e.verticalCompact},compactType:W.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&k.validateLayout(t,"layout")},margin:W.default.arrayOf(W.default.number),containerPadding:W.default.arrayOf(W.default.number),rowHeight:W.default.number,maxRows:W.default.number,isBounded:W.default.bool,isDraggable:W.default.bool,isResizable:W.default.bool,allowOverlap:W.default.bool,preventCollision:W.default.bool,useCSSTransforms:W.default.bool,transformScale:W.default.number,isDroppable:W.default.bool,resizeHandles:tl,resizeHandle:nl,onLayoutChange:W.default.func,onDragStart:W.default.func,onDrag:W.default.func,onDragStop:W.default.func,onResizeStart:W.default.func,onResize:W.default.func,onResizeStop:W.default.func,onDrop:W.default.func,droppingItem:W.default.shape({i:W.default.string.isRequired,w:W.default.number.isRequired,h:W.default.number.isRequired}),children:function(e,t){const n=e[t],r={};el.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:W.default.any};Object.defineProperty(dn,"__esModule",{value:!0});dn.default=void 0;var it=_r(w),K=_r(qe),rl=Ko,ol=Qs,at=k,de=je,Gr=ze,il=_r(ke);function _r(e){return e&&e.__esModule?e:{default:e}}function Ne(e,t,n){return t=al(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function al(e){var t=sl(e,"string");return typeof t=="symbol"?t:String(t)}function sl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class Tr extends it.default.Component{constructor(){super(...arguments),Ne(this,"state",{resizing:null,dragging:null,className:""}),Ne(this,"elementRef",it.default.createRef()),Ne(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:o,transformScale:i}=this.props;if(!o)return;const a={top:0,left:0},{offsetParent:c}=r;if(!c)return;const l=c.getBoundingClientRect(),d=r.getBoundingClientRect(),f=d.left/i,m=l.left/i,h=d.top/i,v=l.top/i;a.left=f-m+c.scrollLeft,a.top=h-v+c.scrollTop,this.setState({dragging:a});const{x:y,y:R}=(0,de.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return o.call(this,this.props.i,y,R,{e:t,node:r,newPosition:a})}),Ne(this,"onDrag",(t,n)=>{let{node:r,deltaX:o,deltaY:i}=n;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+i,l=this.state.dragging.left+o;const{isBounded:d,i:f,w:m,h,containerWidth:v}=this.props,y=this.getPositionParams();if(d){const{offsetParent:_}=r;if(_){const{margin:I,rowHeight:g,containerPadding:x}=this.props,O=_.clientHeight-(0,de.calcGridItemWHPx)(h,g,I[1]);c=(0,de.clamp)(c-x[1],0,O);const S=(0,de.calcGridColWidth)(y),M=v-(0,de.calcGridItemWHPx)(m,S,I[0]);l=(0,de.clamp)(l-x[0],0,M)}}const R={top:c,left:l};this.setState({dragging:R});const{containerPadding:E}=this.props,{x:C,y:T}=(0,de.calcXY)(y,c-E[1],l-E[0],m,h);return a.call(this,f,C,T,{e:t,node:r,newPosition:R})}),Ne(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:i,h:a,i:c,containerPadding:l}=this.props,{left:d,top:f}=this.state.dragging,m={top:f,left:d};this.setState({dragging:null});const{x:h,y:v}=(0,de.calcXY)(this.getPositionParams(),f-l[1],d-l[0],i,a);return o.call(this,c,h,v,{e:t,node:r,newPosition:m})}),Ne(this,"onResizeStop",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStop")),Ne(this,"onResizeStart",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStart")),Ne(this,"onResize",(t,n,r)=>this.onResizeHandler(t,n,r,"onResize"))}shouldComponentUpdate(t,n){if(this.props.children!==t.children||this.props.droppingPosition!==t.droppingPosition)return!0;const r=(0,de.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),o=(0,de.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,at.fastPositionEqual)(r,o)||this.props.useCSSTransforms!==t.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(t){this.moveDroppingItem(t)}moveDroppingItem(t){const{droppingPosition:n}=this.props;if(!n)return;const r=this.elementRef.current;if(!r)return;const o=t.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&n.left!==o.left||n.top!==o.top;if(!i)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(a){const c=n.left-i.left,l=n.top-i.top;this.onDrag(n.e,{node:r,deltaX:c,deltaY:l})}}getPositionParams(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:t.cols,containerPadding:t.containerPadding,containerWidth:t.containerWidth,margin:t.margin,maxRows:t.maxRows,rowHeight:t.rowHeight}}createStyle(t){const{usePercentages:n,containerWidth:r,useCSSTransforms:o}=this.props;let i;return o?i=(0,at.setTransform)(t):(i=(0,at.setTopLeft)(t),n&&(i.left=(0,at.perc)(t.left/r),i.width=(0,at.perc)(t.width/r))),i}mixinDraggable(t,n){return it.default.createElement(rl.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},t)}curryResizeHandler(t,n){return(r,o)=>n(r,o,t)}mixinResizable(t,n,r){const{cols:o,minW:i,minH:a,maxW:c,maxH:l,transformScale:d,resizeHandles:f,resizeHandle:m}=this.props,h=this.getPositionParams(),v=(0,de.calcGridItemPosition)(h,0,0,o,0).width,y=(0,de.calcGridItemPosition)(h,0,0,i,a),R=(0,de.calcGridItemPosition)(h,0,0,c,l),E=[y.width,y.height],C=[Math.min(R.width,v),Math.min(R.height,1/0)];return it.default.createElement(ol.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:E,maxConstraints:C,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:d,resizeHandles:f,handle:m},t)}onResizeHandler(t,n,r,o){let{node:i,size:a,handle:c}=n;const l=this.props[o];if(!l)return;const{x:d,y:f,i:m,maxH:h,minH:v,containerWidth:y}=this.props,{minW:R,maxW:E}=this.props;let C=a;i&&(C=(0,at.resizeItemInDirection)(c,r,a,y),this.setState({resizing:o==="onResizeStop"?null:C}));let{w:T,h:_}=(0,de.calcWH)(this.getPositionParams(),C.width,C.height,d,f,c);T=(0,de.clamp)(T,Math.max(R,1),E),_=(0,de.clamp)(_,v,h),l.call(this,m,T,_,{e:t,node:i,size:C,handle:c})}render(){const{x:t,y:n,w:r,h:o,isDraggable:i,isResizable:a,droppingPosition:c,useCSSTransforms:l}=this.props,d=(0,de.calcGridItemPosition)(this.getPositionParams(),t,n,r,o,this.state),f=it.default.Children.only(this.props.children);let m=it.default.cloneElement(f,{ref:this.elementRef,className:(0,il.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:l}),style:{...this.props.style,...f.props.style,...this.createStyle(d)}});return m=this.mixinResizable(m,d,a),m=this.mixinDraggable(m,i),m}}dn.default=Tr;Ne(Tr,"propTypes",{children:K.default.element,cols:K.default.number.isRequired,containerWidth:K.default.number.isRequired,rowHeight:K.default.number.isRequired,margin:K.default.array.isRequired,maxRows:K.default.number.isRequired,containerPadding:K.default.array.isRequired,x:K.default.number.isRequired,y:K.default.number.isRequired,w:K.default.number.isRequired,h:K.default.number.isRequired,minW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minWidth not Number");if(n>e.w||n>e.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxWidth not Number");if(n<e.w||n<e.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minHeight not Number");if(n>e.h||n>e.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxHeight not Number");if(n<e.h||n<e.minH)return new Error("maxHeight smaller than item height/minHeight")},i:K.default.string.isRequired,resizeHandles:Gr.resizeHandleAxesType,resizeHandle:Gr.resizeHandleType,onDragStop:K.default.func,onDragStart:K.default.func,onDrag:K.default.func,onResizeStop:K.default.func,onResizeStart:K.default.func,onResize:K.default.func,isDraggable:K.default.bool.isRequired,isResizable:K.default.bool.isRequired,isBounded:K.default.bool.isRequired,static:K.default.bool,useCSSTransforms:K.default.bool.isRequired,transformScale:K.default.number,className:K.default.string,handle:K.default.string,cancel:K.default.string,droppingPosition:K.default.shape({e:K.default.object.isRequired,left:K.default.number.isRequired,top:K.default.number.isRequired})});Ne(Tr,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1});Object.defineProperty(Vt,"__esModule",{value:!0});Vt.default=void 0;var Be=dl(w),Nn=lr,ll=Ir(ke),z=k,cl=je,Xr=Ir(dn),ul=Ir(ze);function Ir(e){return e&&e.__esModule?e:{default:e}}function ni(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ni=function(r){return r?n:t})(e)}function dl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ni(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function ve(e,t,n){return t=fl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fl(e){var t=pl(e,"string");return typeof t=="symbol"?t:String(t)}function pl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Yr="react-grid-layout";let ri=!1;try{ri=/firefox/i.test(navigator.userAgent)}catch{}class yn extends Be.Component{constructor(){super(...arguments),ve(this,"state",{activeDrag:null,layout:(0,z.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,z.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),ve(this,"dragEnterCounter",0),ve(this,"onDragStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,z.getLayoutItem)(c,t);if(!l)return;const d={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:t};return this.setState({oldDragItem:(0,z.cloneLayoutItem)(l),oldLayout:c,activeDrag:d}),this.props.onDragStart(c,l,l,null,i,a)}),ve(this,"onDrag",(t,n,r,o)=>{let{e:i,node:a}=o;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:d,allowOverlap:f,preventCollision:m}=this.props,h=(0,z.getLayoutItem)(l,t);if(!h)return;const v={w:h.w,h:h.h,x:h.x,y:h.y,placeholder:!0,i:t};l=(0,z.moveElement)(l,h,n,r,!0,m,(0,z.compactType)(this.props),d,f),this.props.onDrag(l,c,h,v,i,a),this.setState({layout:f?l:(0,z.compact)(l,(0,z.compactType)(this.props),d),activeDrag:v})}),ve(this,"onDragStop",(t,n,r,o)=>{let{e:i,node:a}=o;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:d,preventCollision:f,allowOverlap:m}=this.props,h=(0,z.getLayoutItem)(l,t);if(!h)return;l=(0,z.moveElement)(l,h,n,r,!0,f,(0,z.compactType)(this.props),d,m);const y=m?l:(0,z.compact)(l,(0,z.compactType)(this.props),d);this.props.onDragStop(y,c,h,null,i,a);const{oldLayout:R}=this.state;this.setState({activeDrag:null,layout:y,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(y,R)}),ve(this,"onResizeStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,z.getLayoutItem)(c,t);l&&(this.setState({oldResizeItem:(0,z.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,l,l,null,i,a))}),ve(this,"onResize",(t,n,r,o)=>{let{e:i,node:a,size:c,handle:l}=o;const{oldResizeItem:d}=this.state,{layout:f}=this.state,{cols:m,preventCollision:h,allowOverlap:v}=this.props;let y=!1,R,E,C;const[T,_]=(0,z.withLayoutItem)(f,t,g=>{let x;return E=g.x,C=g.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(E=g.x+(g.w-n),n=g.x!==E&&E<0?g.w:n,E=E<0?0:E),["ne","n","nw"].indexOf(l)!==-1&&(C=g.y+(g.h-r),r=g.y!==C&&C<0?g.h:r,C=C<0?0:C),y=!0),h&&!v&&(x=(0,z.getAllCollisions)(f,{...g,w:n,h:r,x:E,y:C}).filter(S=>S.i!==g.i).length>0,x&&(C=g.y,r=g.h,E=g.x,n=g.w,y=!1)),g.w=n,g.h=r,g});if(!_)return;R=T,y&&(R=(0,z.moveElement)(T,_,E,C,!0,this.props.preventCollision,(0,z.compactType)(this.props),m,v));const I={w:_.w,h:_.h,x:_.x,y:_.y,static:!0,i:t};this.props.onResize(R,d,_,I,i,a),this.setState({layout:v?R:(0,z.compact)(R,(0,z.compactType)(this.props),m),activeDrag:I})}),ve(this,"onResizeStop",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c,oldResizeItem:l}=this.state,{cols:d,allowOverlap:f}=this.props,m=(0,z.getLayoutItem)(c,t),h=f?c:(0,z.compact)(c,(0,z.compactType)(this.props),d);this.props.onResizeStop(h,l,m,null,i,a);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:h,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(h,v)}),ve(this,"onDragOver",t=>{var T;if(t.preventDefault(),t.stopPropagation(),ri&&!((T=t.nativeEvent.target)!=null&&T.classList.contains(Yr)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:i,rowHeight:a,maxRows:c,width:l,containerPadding:d,transformScale:f}=this.props,m=r==null?void 0:r(t);if(m===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const h={...n,...m},{layout:v}=this.state,y=t.currentTarget.getBoundingClientRect(),R=t.clientX-y.left,E=t.clientY-y.top,C={left:R/f,top:E/f,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:_,top:I}=this.state.droppingPosition;(_!=R||I!=E)&&this.setState({droppingPosition:C})}}else{const _={cols:i,margin:o,maxRows:c,rowHeight:a,containerWidth:l,containerPadding:d||o},I=(0,cl.calcXY)(_,E,R,h.w,h.h);this.setState({droppingDOMNode:Be.createElement("div",{key:h.i}),droppingPosition:C,layout:[...v,{...h,x:I.x,y:I.y,static:!1,isDraggable:!0}]})}}),ve(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,o=(0,z.compact)(r.filter(i=>i.i!==t.i),(0,z.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:o,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),ve(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),ve(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),ve(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,o=r.find(i=>i.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,o,t)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(t,n){let r;return n.activeDrag?null:(!(0,Nn.deepEqual)(t.layout,n.propsLayout)||t.compactType!==n.compactType?r=t.layout:(0,z.childrenEqual)(t.children,n.children)||(r=n.layout),r?{layout:(0,z.synchronizeLayoutWithChildren)(r,t.children,t.cols,(0,z.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,n){return this.props.children!==t.children||!(0,z.fastRGLPropsEqual)(this.props,t,Nn.deepEqual)||this.state.activeDrag!==n.activeDrag||this.state.mounted!==n.mounted||this.state.droppingPosition!==n.droppingPosition}componentDidUpdate(t,n){if(!this.state.activeDrag){const r=this.state.layout,o=n.layout;this.onLayoutMaybeChanged(r,o)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,z.bottom)(this.state.layout),n=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return t*this.props.rowHeight+(t-1)*this.props.margin[1]+n*2+"px"}onLayoutMaybeChanged(t,n){n||(n=this.state.layout),(0,Nn.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:o,containerPadding:i,rowHeight:a,maxRows:c,useCSSTransforms:l,transformScale:d}=this.props;return Be.createElement(Xr.default,{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:n,cols:r,margin:o,containerPadding:i||o,maxRows:c,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:d},Be.createElement("div",null))}processGridItem(t,n){if(!t||!t.key)return;const r=(0,z.getLayoutItem)(this.state.layout,String(t.key));if(!r)return null;const{width:o,cols:i,margin:a,containerPadding:c,rowHeight:l,maxRows:d,isDraggable:f,isResizable:m,isBounded:h,useCSSTransforms:v,transformScale:y,draggableCancel:R,draggableHandle:E,resizeHandles:C,resizeHandle:T}=this.props,{mounted:_,droppingPosition:I}=this.state,g=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&f,x=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&m,O=r.resizeHandles||C,S=g&&h&&r.isBounded!==!1;return Be.createElement(Xr.default,{containerWidth:o,cols:i,margin:a,containerPadding:c||a,maxRows:d,rowHeight:l,cancel:R,handle:E,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:g,isResizable:x,isBounded:S,useCSSTransforms:v&&_,usePercentages:!_,transformScale:y,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:n?I:void 0,resizeHandles:O,resizeHandle:T},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:o}=this.props,i=(0,ll.default)(Yr,t),a={height:this.containerHeight(),...n};return Be.createElement("div",{ref:o,className:i,style:a,onDrop:r?this.onDrop:z.noop,onDragLeave:r?this.onDragLeave:z.noop,onDragEnter:r?this.onDragEnter:z.noop,onDragOver:r?this.onDragOver:z.noop},Be.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}Vt.default=yn;ve(yn,"displayName","ReactGridLayout");ve(yn,"propTypes",ul.default);ve(yn,"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:z.noop,onDragStart:z.noop,onDrag:z.noop,onDragStop:z.noop,onResizeStart:z.noop,onResize:z.noop,onResizeStop:z.noop,onDrop:z.noop,onDropDragOver:z.noop});var Cn={},nt={};Object.defineProperty(nt,"__esModule",{value:!0});nt.findOrGenerateResponsiveLayout=gl;nt.getBreakpointFromWidth=hl;nt.getColsFromBreakpoint=ml;nt.sortBreakpoints=wr;var kt=k;function hl(e,t){const n=wr(e);let r=n[0];for(let o=1,i=n.length;o<i;o++){const a=n[o];t>e[a]&&(r=a)}return r}function ml(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function gl(e,t,n,r,o,i){if(e[n])return(0,kt.cloneLayout)(e[n]);let a=e[r];const c=wr(t),l=c.slice(c.indexOf(n));for(let d=0,f=l.length;d<f;d++){const m=l[d];if(e[m]){a=e[m];break}}return a=(0,kt.cloneLayout)(a||[]),(0,kt.compact)((0,kt.correctBounds)(a,{cols:o}),i,o)}function wr(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(Cn,"__esModule",{value:!0});Cn.default=void 0;var Kr=yl(w),be=oi(qe),jn=lr,ft=k,Ge=nt,vl=oi(Vt);function oi(e){return e&&e.__esModule?e:{default:e}}function ii(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ii=function(r){return r?n:t})(e)}function yl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ii(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Yn(){return Yn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yn.apply(this,arguments)}function tn(e,t,n){return t=Cl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cl(e){var t=Sl(e,"string");return typeof t=="symbol"?t:String(t)}function Sl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Zr=e=>Object.prototype.toString.call(e);function qt(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class xr extends Kr.Component{constructor(){super(...arguments),tn(this,"state",this.generateInitialState()),tn(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:n,layouts:r,cols:o}=this.props,i=(0,Ge.getBreakpointFromWidth)(n,t),a=(0,Ge.getColsFromBreakpoint)(i,o),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Ge.findOrGenerateResponsiveLayout)(r,n,i,i,a,c),breakpoint:i,cols:a}}static getDerivedStateFromProps(t,n){if(!(0,jn.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:o}=n;return{layout:(0,Ge.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,o,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,jn.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,jn.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:o,compactType:i}=this.props,a=this.props.breakpoint||(0,Ge.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,Ge.getColsFromBreakpoint)(a,r),d={...o};if(c!==a||t.breakpoints!==n||t.cols!==r){c in d||(d[c]=(0,ft.cloneLayout)(this.state.layout));let h=(0,Ge.findOrGenerateResponsiveLayout)(d,n,a,c,l,i);h=(0,ft.synchronizeLayoutWithChildren)(h,this.props.children,l,i,this.props.allowOverlap),d[a]=h,this.props.onLayoutChange(h,d),this.props.onBreakpointChange(a,l),this.setState({breakpoint:a,layout:h,cols:l})}const f=qt(this.props.margin,a),m=qt(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,f,l,m)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:o,margin:i,containerPadding:a,onBreakpointChange:c,onLayoutChange:l,onWidthChange:d,...f}=this.props;return Kr.createElement(vl.default,Yn({},f,{margin:qt(i,this.state.breakpoint),containerPadding:qt(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}Cn.default=xr;tn(xr,"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(e,t){if(Zr(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+Zr(e[t]));Object.keys(e[t]).forEach(n=>{if(!(n in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,ft.validateLayout)(e.layouts[n],"layouts."+n)})},width:be.default.number.isRequired,onBreakpointChange:be.default.func,onLayoutChange:be.default.func,onWidthChange:be.default.func});tn(xr,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:ft.noop,onLayoutChange:ft.noop,onWidthChange:ft.noop});var Or={},ai=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var a=i[o];n.call(r,a[1],a[0])}},t}()}(),Kn=typeof window<"u"&&typeof document<"u"&&window.document===document,nn=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")()}(),bl=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(nn):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Rl=2;function _l(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&c()}function a(){bl(i)}function c(){var l=Date.now();if(n){if(l-o<Rl)return;r=!0}else n=!0,r=!1,setTimeout(a,t);o=l}return c}var Tl=20,Il=["top","right","bottom","left","width","height","size","weight"],wl=typeof MutationObserver<"u",xl=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=_l(this.refresh.bind(this),Tl)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!Kn||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),wl?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!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)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=Il.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),si=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},mt=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||nn},li=Sn(0,0,0,0);function rn(e){return parseFloat(e)||0}function Jr(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var i=e["border-"+o+"-width"];return r+rn(i)},0)}function Ol(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var i=o[r],a=e["padding-"+i];n[i]=rn(a)}return n}function El(e){var t=e.getBBox();return Sn(0,0,t.width,t.height)}function Dl(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return li;var r=mt(e).getComputedStyle(e),o=Ol(r),i=o.left+o.right,a=o.top+o.bottom,c=rn(r.width),l=rn(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==t&&(c-=Jr(r,"left","right")+i),Math.round(l+a)!==n&&(l-=Jr(r,"top","bottom")+a)),!Ml(e)){var d=Math.round(c+i)-t,f=Math.round(l+a)-n;Math.abs(d)!==1&&(c-=d),Math.abs(f)!==1&&(l-=f)}return Sn(o.left,o.top,c,l)}var Pl=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof mt(e).SVGGraphicsElement}:function(e){return e instanceof mt(e).SVGElement&&typeof e.getBBox=="function"}}();function Ml(e){return e===mt(e).document.documentElement}function Fl(e){return Kn?Pl(e)?El(e):Dl(e):li}function Nl(e){var t=e.x,n=e.y,r=e.width,o=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,a=Object.create(i.prototype);return si(a,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),a}function Sn(e,t,n,r){return{x:e,y:t,width:n,height:r}}var jl=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Sn(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Fl(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),$l=function(){function e(t,n){var r=Nl(n);si(this,{target:t,contentRect:r})}return e}(),Ll=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new ai,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof mt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new jl(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof mt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new $l(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),ci=typeof WeakMap<"u"?new WeakMap:new ai,ui=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=xl.getInstance(),r=new Ll(t,n,this);ci.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){ui.prototype[e]=function(){var t;return(t=ci.get(this))[e].apply(t,arguments)}});var Ul=function(){return typeof nn.ResizeObserver<"u"?nn.ResizeObserver:ui}();const Vl=Object.freeze(Object.defineProperty({__proto__:null,default:Ul},Symbol.toStringTag,{value:"Module"})),zl=Ui(Vl);Object.defineProperty(Or,"__esModule",{value:!0});Or.default=Xl;var Bt=kl(w),Al=Er(qe),Hl=Er(zl),Wl=Er(ke);function Er(e){return e&&e.__esModule?e:{default:e}}function di(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(di=function(r){return r?n:t})(e)}function kl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=di(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zn.apply(this,arguments)}function st(e,t,n){return t=ql(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ql(e){var t=Bl(e,"string");return typeof t=="symbol"?t:String(t)}function Bl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Gl="react-grid-layout";function Xl(e){var t;return t=class extends Bt.Component{constructor(){super(...arguments),st(this,"state",{width:1280}),st(this,"elementRef",Bt.createRef()),st(this,"mounted",!1),st(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new Hl.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?Bt.createElement("div",{className:(0,Wl.default)(this.props.className,Gl),style:this.props.style,ref:this.elementRef}):Bt.createElement(e,Zn({innerRef:this.elementRef},o,this.state))}},st(t,"defaultProps",{measureBeforeMount:!1}),st(t,"propTypes",{measureBeforeMount:Al.default.bool}),t}(function(e){e.exports=Vt.default,e.exports.utils=k,e.exports.calculateUtils=je,e.exports.Responsive=Cn.default,e.exports.Responsive.utils=nt,e.exports.WidthProvider=Or.default})(wo);var Yl=wo.exports;const Kl=sr(Yl),Nt={type:u.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(u.IUndoRedoService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=L.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,cfId:t.cfId},d=s.DeleteConditionalRuleMutationUndoFactory(e,l),f=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,l);return f&&n.pushUndoRedo({unitID:a,undoMutations:d,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:l}]}),f}},bn={type:u.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(u.IUndoRedoService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=L.getSheetCommandTarget(o,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,d=s.transformSupportSymmetryAnchor(t.start,t.end,i.getSubunitRules(c,l)||[],R=>R.cfId);if(!d)return!1;const[f,m]=d,h={unitId:c,subUnitId:l,start:f,end:m},v=s.MoveConditionalRuleMutationUndoFactory(h),y=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,h);return y&&n.pushUndoRedo({unitID:c,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:h}],undoMutations:v}),y}},Zl="univer-cf-preview",Gt={cfPreview:Zl},vt=e=>{var o,i;const t=e.rule;if(!t)return null;const n=w.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const a=t.config.map((d,f)=>({color:new u.ColorKit(d.color),value:f})),c=a.length-1;return new Array(5).fill("").map((d,f,m)=>f*c/(m.length-1)).map(d=>s.getColorScaleFromValue(a,d))}return null},[t]),r=w.useMemo(()=>{if(t.type===s.CFRuleType.iconSet)return t.config.map(a=>{const c=s.iconMap[a.iconType];return c&&c[Number(a.iconId)]})},[t]);switch(t.type){case s.CFRuleType.dataBar:{const{isGradient:a}=t.config,c={width:"50%",height:"100%"},l=a?`linear-gradient(to right, ${t.config.positiveColor}, rgb(255 255 255))`:t.config.positiveColor,d=a?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor})`:t.config.nativeColor;return p.jsxs("div",{className:Gt.cfPreview,children:[p.jsx("div",{style:{...c,background:d,border:`1px solid ${t.config.nativeColor}`}}),p.jsx("div",{style:{...c,background:l,border:`1px solid ${t.config.positiveColor}`}})]})}case s.CFRuleType.colorScale:return n&&p.jsx("div",{className:Gt.cfPreview,children:n.map((a,c)=>p.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:a}},c))});case s.CFRuleType.iconSet:return r&&p.jsx("div",{className:Gt.cfPreview,children:r.map((a,c)=>a?p.jsx("img",{style:{height:"100%"},src:a},c):p.jsx(Ut,{},c))});case s.CFRuleType.highlightCell:{const{ul:a,st:c,it:l,bl:d,bg:f,cl:m}=t.style,h=(a==null?void 0:a.s)===u.BooleanNumber.TRUE,v=(c==null?void 0:c.s)===u.BooleanNumber.TRUE,y=l===u.BooleanNumber.TRUE,R=d===u.BooleanNumber.TRUE,E=(o=f==null?void 0:f.rgb)!=null?o:s.DEFAULT_BG_COLOR,C=(i=m==null?void 0:m.rgb)!=null?i:s.DEFAULT_FONT_COLOR,T={fontWeight:R?"bold":void 0,fontStyle:y?"italic":void 0,textDecoration:`${h?"underline":""} ${v?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:E,color:C};return p.jsx("div",{style:T,className:Gt.cfPreview,children:"123"})}}return null};var Jl=Object.defineProperty,Ql=Object.getOwnPropertyDescriptor,ec=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ql(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Jl(t,n,o),o},tc=(e,t)=>(n,r)=>t(n,r,e);let pt=class extends u.Disposable{constructor(t){super();St(this,"_initLocal",()=>{});St(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let o=n.exec(t);for(;o;)r.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),o=t.split("."),i=r&&this._localeService.resolveKeyPath(r,o);if(typeof i=="string"){const a=[];return this._findReplaceIndex(i).forEach((c,l,d)=>{const f=d[l-1]||{startIndex:0,endIndex:-1};if(f.endIndex+1<c.startIndex){const m=i.slice(f.endIndex+1,c.startIndex);m&&a.push(m)}if(n[c.key]&&a.push(n[c.key]),l===d.length-1){const m=i.slice(c.endIndex+1);m&&a.push(m)}}),a}return[]}};pt=ec([u.OnLifecycle(u.LifecycleStages.Rendered,pt),tc(0,u.Inject(u.LocaleService))],pt);const nc="univer-cf-rule-list",rc="univer-rule-selector",oc="univer-select",ic="univer-select-selector",ac="univer-select-selection-item",sc="univer-select-selection-search-input",lc="univer-btn-list",cc="univer-gap",uc="univer-icon",dc="univer-disabled",fc="univer-rule-item",pc="univer-rule-describe",hc="univer-rule-type",mc="univer-rule-range",gc="univer-active",vc="univer-draggableHandle",yc="univer-delete-item",Cc="univer-grid-layout-wrap",Sc="univer-react-grid-item",ce={cfRuleList:nc,ruleSelector:rc,select:oc,selectSelector:ic,selectSelectionItem:ac,selectSelectionSearchInput:sc,btnList:lc,gap:cc,icon:uc,disabled:dc,ruleItem:fc,ruleDescribe:pc,ruleType:hc,ruleRange:mc,active:gc,draggableHandle:vc,deleteItem:yc,gridLayoutWrap:Cc,reactGridItem:Sc},bc=(e,t)=>{const n=e.rule;switch(n.type){case s.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case s.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case s.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case s.CFRuleType.highlightCell:switch(n.subType){case s.CFSubRuleType.average:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,t.t("sheet.cf.subRuleType.average"))}case s.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case s.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case s.CFSubRuleType.number:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(o=>String(o)):[String(n.value||"")])}case s.CFSubRuleType.text:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case s.CFSubRuleType.timePeriod:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`)}case s.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):t.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?t.t("sheet.cf.preview.describe.bottomN",String(n.value)):t.t("sheet.cf.preview.describe.topN",String(n.value));case s.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let Qr=0;const Rc=e=>{const{onClick:t}=e,n=u.useDependency(s.ConditionalFormattingRuleModel),r=u.useDependency(u.IUniverInstanceService),o=u.useDependency(L.SheetsSelectionsService),i=u.useDependency(u.ICommandService),a=u.useDependency(u.LocaleService),c=u.useDependency(pt),l=fe.useObservable(r.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET)),d=l.getUnitId(),f=l.getActiveSheet();if(!f)throw new Error("No active sheet found");const m=f.getSheetId(),[h,v]=w.useState([]),[y,R]=w.useState("2"),[E,C]=w.useState(0),[T,_]=w.useState(-1),[I,g]=w.useState(Qr),x=w.useRef(null),O=[{label:a.t("sheet.cf.panel.workSheet"),value:"2"},{label:a.t("sheet.cf.panel.selectedRange"),value:"1"}],S=()=>{const V=n.getSubunitRules(d,m);if(!V||!V.length)return[];if(y==="1"){const Y=o.getCurrentLastSelection();if(!Y)return[];const ee=Y.range;return V.filter(se=>se.ranges.some(ue=>u.Rectangle.intersects(ue,ee)))}else if(y==="2")return V;return[]},M=V=>{const ee=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet();return V.map(se=>{const ue=se.ranges;return(ue==null?void 0:ue.some(Oe=>{var B,te;const{startRow:F,startColumn:U,endRow:G,endColumn:X}=Oe;for(let oe=F;oe<=G;oe++)for(let me=U;me<=X;me++){const J=(te=(B=ee==null?void 0:ee.getCell(oe,me))==null?void 0:B.selectionProtection)==null?void 0:te[0];if((J==null?void 0:J[Ft.Edit])===!1||(J==null?void 0:J[Ft.View])===!1)return!0}return!1}))?{...se,disable:!0}:{...se}})},[j,$]=w.useState(S);le.useHighlightRange(h),w.useEffect(()=>{const V=i.onCommandExecuted(Y=>{Y.id===L.SetWorksheetActiveOperation.id&&C(Math.random())});return()=>V.dispose()}),w.useEffect(()=>{$(S)},[y,E,d,m]),w.useEffect(()=>{if(y==="2")return;const V=new De.Observable(Y=>{const ee=[L.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],re=i.onCommandExecuted(se=>{const{id:ue,params:Ie}=se,Oe=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId();ee.includes(ue)&&Ie.unitId===Oe&&Y.next(null)});return()=>re.dispose()}).pipe(De.debounceTime(16)).subscribe(()=>{$(S)});return()=>{V.unsubscribe()}},[r,y,d,m]),w.useEffect(()=>{const V=n.$ruleChange.subscribe(()=>{C(Math.random())});return()=>V.unsubscribe()},[n]),w.useEffect(()=>{const V=()=>{var se;const re=Math.max(0,(((se=x.current)==null?void 0:se.getBoundingClientRect().width)||0)-8);return Qr=re,re},ee=new De.Observable(re=>{const se=document.querySelector(".univer-sidebar");if(se){let ue=setTimeout(()=>{re.next()},150);const Ie=()=>{ue&&clearTimeout(ue),ue=null},Oe=F=>{F.propertyName==="width"&&(Ie(),re.next())};return se.addEventListener("transitionend",Oe),()=>{Ie(),se.removeEventListener("transitionend",Oe)}}}).pipe(De.debounceTime(16)).subscribe(()=>{g(V())});return()=>{ee.unsubscribe()}},[]);const A=V=>{var re;const Y=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),ee=(re=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:re.getSheetId();if(!Y||!ee)throw new Error("No active sheet found");i.executeCommand(Nt.id,{unitId:Y,subUnitId:ee,cfId:V.cfId})},b=(V,Y)=>{_(Y.y)},D=(V,Y,ee)=>{var F;_(-1);const re=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),se=(F=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:F.getSheetId();if(!re||!se)throw new Error("No active sheet found");const ue=U=>{const G=j.length;return Math.min(G-1,Math.max(0,U))},Ie=j[ue(Y.y)].cfId,Oe=j[ue(ee.y)].cfId;Ie!==Oe&&i.executeCommand(bn.id,{unitId:re,subUnitId:se,start:{id:Ie,type:"self"},end:{id:Oe,type:ee.y>Y.y?"after":"before"}})},Z=()=>{e.onCreate()},Ce=()=>{y==="2"?i.executeCommand(Lt.id):y==="1"&&j.map(Y=>({unitId:d,subUnitId:m,cfId:Y.cfId})).forEach(Y=>{i.executeCommand(Nt.id,Y)})},pe=j.map((V,Y)=>({i:V.cfId,x:0,w:12,y:Y,h:1,isResizable:!1})),he=M(j),xe=he==null?void 0:he.some(V=>V.disable);return p.jsxs("div",{className:ce.cfRuleList,children:[p.jsxs("div",{className:ce.ruleSelector,children:[p.jsx("div",{children:c.tWithReactNode("sheet.cf.panel.managerRuleSelect",p.jsx(q.Select,{className:ce.select,options:O,value:y,onChange:V=>{R(V)}})).map((V,Y)=>p.jsx("span",{children:V},Y))}),p.jsxs("div",{className:ce.btnList,children:[p.jsx(q.Tooltip,{title:a.t("sheet.cf.panel.createRule"),placement:"bottom",children:p.jsx("div",{className:`${ce.icon}`,onClick:Z,children:p.jsx(To,{})})}),j.length&&!xe?p.jsx(q.Tooltip,{title:a.t("sheet.cf.panel.clear"),placement:"bottom",children:p.jsx("div",{className:`${ce.gap} ${ce.icon}`,onClick:Ce,children:p.jsx(Zt,{})})}):p.jsx("div",{className:`${ce.gap} ${ce.disabled}`,children:p.jsx(Zt,{})})]})]}),p.jsx("div",{ref:x,className:ce.gridLayoutWrap,children:I?p.jsx(Kl,{onDragStop:D,onDragStart:b,layout:pe,cols:12,rowHeight:60,width:I,margin:[0,10],draggableHandle:".draggableHandle",children:he==null?void 0:he.map((V,Y)=>p.jsx("div",{children:p.jsxs("div",{onMouseMove:()=>{V.ranges!==h&&v(V.ranges)},onMouseLeave:()=>v([]),onClick:()=>{V.disable||t(V)},className:`${ce.ruleItem} ${T===Y?ce.active:""}`,children:[p.jsx("div",{className:`${ce.draggableHandle} draggableHandle`,onClick:ee=>ee.stopPropagation(),children:p.jsx(Io,{})}),p.jsxs("div",{className:ce.ruleDescribe,children:[p.jsx("div",{className:ce.ruleType,children:bc(V,a)}),p.jsx("div",{className:ce.ruleRange,children:V.ranges.map(ee=>Co.serializeRange(ee)).join(",")})]}),p.jsx("div",{className:ce.preview,children:p.jsx(vt,{rule:V.rule})}),!V.disable&&p.jsx("div",{className:`${ce.deleteItem} ${T===Y?ce.active:""}`,onClick:ee=>{ee.stopPropagation(),A(V)},children:p.jsx(Zt,{})})]})},`${V.cfId}`))}):null})]})},Ht={type:u.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){if(!t)return!1;const{rule:n}=t,r=e.get(u.IUndoRedoService),o=e.get(u.ICommandService),i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.IUniverInstanceService),c=L.getSheetCommandTarget(a);if(!c)return!1;const{unitId:l,subUnitId:d}=c,f=i.createCfId(l,d),m={unitId:l,subUnitId:d,rule:{...n,cfId:n.cfId||f}},h=s.AddConditionalRuleMutationUndoFactory(e,m),v=o.syncExecuteCommand(s.AddConditionalRuleMutation.id,m);return v&&r.pushUndoRedo({unitID:l,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:m}],undoMutations:[h]}),v}},Rn={type:u.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(u.IUndoRedoService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=L.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,rule:t.rule},d=s.setConditionalRuleMutationUndoFactory(e,l),f=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,l);return f&&n.pushUndoRedo({unitID:a,undoMutations:d,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:l}]}),f}},_c=u.createInterceptorKey("beforeSubmit"),Tc=u.createInterceptorKey("submit"),Ic="univer-cf-color-picker",wc="univer-cf-color-picker-icon",xc="univer-icon-dropdown",$n={cfColorPicker:Ic,cfColorPickerIcon:wc,iconDropdown:xc},Je=e=>{const{color:t,onChange:n,disable:r=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:a=!0}=e,c=u.useDependency(fe.ComponentManager),l=w.useMemo(()=>new u.ColorKit(t),[t]),d=c.get(o);return d&&(r?p.jsx(d,{className:i,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):p.jsx(q.Dropdown,{overlay:p.jsx("div",{className:`${$n.cfColorPicker} `,children:p.jsx(q.ColorPicker,{color:t,onChange:n})}),children:p.jsxs("span",{className:`${$n.cfColorPickerIcon} ${i}`,children:[p.jsx(d,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),a&&p.jsx(ln,{className:$n.iconDropdown})]})}))},Oc="univer-cf-rule-style-editor",Ec="univer-cf-preview-wrap",Dc="univer-text",Pc="univer-position-relative",Mc="univer-btn-list",Fc="univer-util-item",Nc="univer-icon-set",jc="univer-render-config",$c="univer-flex",Lc="univer-width45",Uc="univer-icon-wrap",Vc="univer-icon",zc="univer-dropdown-icon",Ac="univer-error-input",Hc="univer-error-text",Wc="univer-icon-group-list",kc="univer-title",qc="univer-group",Bc="univer-item-content",Gc="univer-item-wrap",Xc="univer-item",Yc="univer-icon-item-list-wrap",Kc="univer-none",Zc="univer-icon-item-list",Jc="univer-width100",Qc="univer-stress",N={cfRuleStyleEditor:Oc,cfPreviewWrap:Ec,text:Dc,positionRelative:Pc,btnList:Mc,utilItem:Fc,iconSet:Nc,renderConfig:jc,flex:$c,width45:Lc,iconWrap:Uc,icon:Vc,dropdownIcon:zc,errorInput:Ac,errorText:Hc,iconGroupList:Wc,title:kc,group:qc,itemContent:Bc,itemWrap:Gc,item:Xc,iconItemListWrap:Yc,none:Kc,iconItemList:Zc,width100:Jc,stress:Qc},Xe=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Ln=e=>{var m;const{type:t,className:n,onChange:r,id:o,value:i}=e,a=u.useDependency(u.IUniverInstanceService),c=a.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=(m=a.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:m.getSheetId(),d=w.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),f=w.useMemo(()=>[s.CFValueType.max,s.CFValueType.min,"none"].includes(t)?{disabled:!0}:[s.CFValueType.percent,s.CFValueType.percentile].includes(t)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[t]);return t===s.CFValueType.formula?p.jsx(fe.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:c,id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${o}`),value:d,style:{maxWidth:"50%",marginLeft:4},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(h="")=>{r(h||"")}}):p.jsx(q.InputNumber,{className:n,value:Number(e.value)||0,onChange:h=>e.onChange(h||0),...f})},eu=e=>{var A;const{interceptorManager:t}=e,n=u.useDependency(u.LocaleService),r=((A=e.rule)==null?void 0:A.type)===s.CFRuleType.colorScale?e.rule:void 0,o=[Xe(s.CFValueType.num,n),Xe(s.CFValueType.percent,n),Xe(s.CFValueType.percentile,n),Xe(s.CFValueType.formula,n)],i=[Xe(s.CFValueType.min,n),...o],a=[Xe("none",n),...o],c=[Xe(s.CFValueType.max,n),...o],[l,d]=w.useState(()=>{var D;const b=s.CFValueType.min;return r&&((D=r.config[0])==null?void 0:D.value.type)||b}),[f,m]=w.useState(()=>{var D;const b="none";return!r||r.config.length!==3?b:((D=r.config[1])==null?void 0:D.value.type)||b}),[h,v]=w.useState(()=>{var D;const b=s.CFValueType.max;return r&&((D=r.config[r.config.length-1])==null?void 0:D.value.type)||b}),[y,R]=w.useState(()=>{if(!r)return 10;const D=r.config[0];return(D==null?void 0:D.value.value)===void 0?10:D==null?void 0:D.value.value}),[E,C]=w.useState(()=>{var Z;if(!r||r.config.length!==3)return 50;const D=(Z=r.config[1])==null?void 0:Z.value.value;return D===void 0?50:D}),[T,_]=w.useState(()=>{var Z;if(!r)return 90;const D=(Z=r.config[r.config.length-1])==null?void 0:Z.value.value;return D===void 0?90:D}),[I,g]=w.useState(()=>{var D;const b="#d0d9fb";return r&&((D=r.config[0])==null?void 0:D.color)||b}),[x,O]=w.useState(()=>{var D;const b="#7790f3";return!r||r.config.length!==3?b:((D=r.config[1])==null?void 0:D.color)||b}),[S,M]=w.useState(()=>{var D;const b="#2e55ef";return r&&((D=r.config[r.config.length-1])==null?void 0:D.color)||b}),j=w.useMemo(()=>b=>{const{minType:D,medianType:Z,maxType:Ce,minValue:pe,medianValue:he,maxValue:xe,minColor:V,medianColor:Y,maxColor:ee}=b,re=[];return re.push({color:V,value:{type:D,value:pe}}),Z!=="none"&&re.push({color:Y,value:{type:Z,value:he}}),re.push({color:ee,value:{type:Ce,value:xe}}),{config:re.map((ue,Ie)=>({...ue,index:Ie})),type:s.CFRuleType.colorScale}},[]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return j({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),[j,l,f,h,y,E,T,I,x,S,t]);const $=b=>{e.onChange(j(b))};return p.jsxs("div",{children:[p.jsx("div",{className:P.title,children:n.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${N.cfPreviewWrap}`,children:p.jsx(vt,{rule:j({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})})}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.min")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.Select,{options:i,value:l,onChange:b=>{d(b);const D=s.createDefaultValueByValueType(b,10);R(D),$({minType:b,medianType:f,maxType:h,minValue:D,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Ln,{id:"min",className:`${P.mLXxs}`,value:y,type:l,onChange:b=>{R(b),$({minType:l,medianType:f,maxType:h,minValue:b,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Je,{className:P.mLXxs,color:I,onChange:b=>{g(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:b,medianColor:x,maxColor:S})}})]}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.medianValue")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.Select,{options:a,value:f,onChange:b=>{m(b);const D=s.createDefaultValueByValueType(b,50);C(D),$({minType:l,medianType:b,maxType:h,minValue:y,medianValue:D,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Ln,{id:"median",className:` ${P.mLXxs}`,value:E,type:f,onChange:b=>{C(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:b,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),f!=="none"&&p.jsx(Je,{className:P.mLXxs,color:x,onChange:b=>{O(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:b,maxColor:S})}})]}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.max")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.Select,{options:c,value:h,onChange:b=>{v(b);const D=s.createDefaultValueByValueType(b,90);_(D),$({minType:l,medianType:f,maxType:b,minValue:y,medianValue:E,maxValue:D,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Ln,{id:"max",className:`${P.mLXxs}`,value:T,type:h,onChange:b=>{_(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:b,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Je,{className:P.mLXxs,color:S,onChange:b=>{M(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:b})}})]})]})},lt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),eo=e=>{var h;const{onChange:t,className:n,value:r,type:o,id:i,disabled:a=!1}=e,c=u.useDependency(u.IUniverInstanceService),l=c.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(h=c.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:h.getSheetId(),f=w.useRef(r),m=w.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===s.CFValueType.formula){const v=String(f.current).startsWith("=")?String(f.current)||"":"=";return p.jsx(fe.TextEditor,{id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${i}`),value:v,openForSheetSubUnitId:d,openForSheetUnitId:l,style:{width:"47%",marginLeft:14},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(y="")=>{t(y||"")}})}return p.jsx(q.InputNumber,{className:n,value:Number(r)||0,disabled:a,onChange:v=>{t(v||0)},...m})},tu=e=>{var A;const{interceptorManager:t}=e,n=u.useDependency(u.LocaleService),r=((A=e.rule)==null?void 0:A.type)===s.CFRuleType.dataBar?e.rule:void 0,[o,i]=w.useState(()=>{var D;const b="0";return r?(D=r.config)!=null&&D.isGradient?"1":"0":b}),[a,c]=w.useState(()=>{var D;const b="#abd91a";return r&&((D=r.config)==null?void 0:D.positiveColor)||b}),[l,d]=w.useState(()=>{var D;const b="#ffbe38";return r&&((D=r.config)==null?void 0:D.nativeColor)||b}),f=[lt(s.CFValueType.num,n),lt(s.CFValueType.percent,n),lt(s.CFValueType.percentile,n),lt(s.CFValueType.formula,n)],m=[lt(s.CFValueType.min,n),...f],h=[lt(s.CFValueType.max,n),...f],[v,y]=w.useState(()=>{var D;const b=m[0].value;return r&&((D=r.config)==null?void 0:D.min.type)||b}),[R,E]=w.useState(()=>{var D;const b=h[0].value;return r&&((D=r.config)==null?void 0:D.max.type)||b}),[C,T]=w.useState(()=>{var Z;if(!r)return 0;const D=((Z=r.config)==null?void 0:Z.min)||{};return D.type===s.CFValueType.formula?D.value||"=":D.value||0}),[_,I]=w.useState(()=>{var Z;if(!r)return 100;const D=((Z=r.config)==null?void 0:Z.max)||{};return D.type===s.CFValueType.formula?D.value||"=":D.value===void 0?100:D.value}),[g,x]=w.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),O=b=>({config:{min:{type:b.minValueType,value:b.minValue},max:{type:b.maxValueType,value:b.maxValue},isGradient:b.isGradient==="1",positiveColor:b.positiveColor,nativeColor:b.nativeColor},type:s.CFRuleType.dataBar,isShowValue:b.isShowValue});w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return O({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}}),[o,C,v,_,R,a,l,t,g]);const S=b=>{e.onChange(O(b))},M=b=>{c(b),S({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:b,nativeColor:l,isShowValue:g})},j=b=>{d(b),S({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:b,isShowValue:g})},$=b=>f.map(D=>D.value).includes(b);return p.jsxs("div",{children:[p.jsx("div",{className:P.title,children:n.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${N.cfPreviewWrap}`,children:p.jsx(vt,{rule:O({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})})}),p.jsxs("div",{children:[p.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.fillType")}),p.jsxs("div",{className:`${P.mTSm} ${P.mLXxs} ${P.labelContainer} `,children:[p.jsxs(q.RadioGroup,{value:o,onChange:b=>{i(b),S({isGradient:b,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})},children:[p.jsx(q.Radio,{value:"0",children:p.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.pureColor")})}),p.jsx(q.Radio,{value:"1",children:p.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.gradient")})})]}),p.jsxs("div",{className:`${N.utilItem} ${P.mLXl}`,children:[p.jsx(q.Checkbox,{checked:!g,onChange:b=>{x(!b),S({isGradient:b,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:!b})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),p.jsxs("div",{children:[p.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.colorSet")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm} ${P.mLXxs}`,children:[p.jsxs("div",{className:`${P.labelContainer}`,children:[p.jsx("div",{className:`${N.text}`,children:n.t("sheet.cf.panel.native")}),p.jsx(Je,{color:l,onChange:j})]}),p.jsxs("div",{className:`${P.labelContainer} ${P.mLSm} `,children:[p.jsx("div",{className:`${N.text} `,children:n.t("sheet.cf.panel.positive")}),p.jsx(Je,{color:a,onChange:M})]})]})]}),p.jsxs("div",{children:[p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.min")}),p.jsxs("div",{className:`${P.mTSm} ${P.labelContainer}`,children:[p.jsx(q.Select,{options:m,value:v,onChange:b=>{y(b);const D=s.createDefaultValueByValueType(b,10);T(D),S({isGradient:o,minValue:D,minValueType:b,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}}),p.jsx(eo,{disabled:!$(v),id:"min",type:v,className:P.mLSm,value:C,onChange:b=>{T(b||0),S({isGradient:o,minValue:b||0,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}})]}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.max")}),p.jsxs("div",{className:`${P.mTSm} ${P.labelContainer}`,children:[p.jsx(q.Select,{options:h,value:R,onChange:b=>{E(b);const D=s.createDefaultValueByValueType(b,90);I(D),S({isGradient:o,minValue:C,minValueType:v,maxValue:D,maxValueType:b,positiveColor:a,nativeColor:l,isShowValue:g})}}),p.jsx(eo,{disabled:!$(R),id:"max",type:R,className:P.mLSm,value:_,onChange:b=>{I(b||0),S({isGradient:o,minValue:C,minValueType:v,maxValue:b||0,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}})]})]})]})},nu="univer-cf-style-edit",ru="univer-button-item",ou="univer-isActive",Ue={cfStyleEdit:nu,buttonItem:ru,isActive:ou},Xt=e=>[u.BooleanNumber.FALSE,void 0].includes(e)?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE,Yt=e=>e!==u.BooleanNumber.FALSE,Dr=e=>{const{style:t,onChange:n,className:r}=e,o=u.useDependency(fe.ComponentManager),[i,a]=w.useState(()=>{if(t!=null&&t.bl)return t.bl}),[c,l]=w.useState(()=>{if(t!=null&&t.it)return t.it}),[d,f]=w.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[m,h]=w.useState(()=>{if(t!=null&&t.st)return t.st.s}),[v,y]=w.useState(()=>{var x;const g="#2f56ef";return(x=t==null?void 0:t.cl)!=null&&x.rgb?t.cl.rgb:g}),[R,E]=w.useState(()=>{var x;const g="#e8ecfc";return(x=t==null?void 0:t.bg)!=null&&x.rgb?t.bg.rgb:g}),C=o.get("BoldSingle"),T=o.get("ItalicSingle"),_=o.get("UnderlineSingle"),I=o.get("StrikethroughSingle");return w.useEffect(()=>{const g={bl:i,it:c};v!==void 0&&(g.cl={rgb:v}),R!==void 0&&(g.bg={rgb:R}),m!==void 0&&(g.st={s:m}),d!==void 0&&(g.ul={s:d}),n(s.removeUndefinedAttr(g))},[i,c,d,m,v,R]),p.jsxs("div",{className:`${Ue.cfStyleEdit} ${r}`,children:[C&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(i||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>a(Xt(i)),children:p.jsx(C,{})}),T&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(c||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>l(Xt(c)),children:p.jsx(T,{})}),_&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(d||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>f(Xt(d)),children:p.jsx(_,{})}),I&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(m||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>h(Xt(m)),children:p.jsx(I,{})}),p.jsx(Je,{color:v,onChange:y,iconId:"FontColor"}),p.jsx(Je,{color:R,onChange:E,iconId:"PaintBucket"})]})},iu=e=>{var E;const{onChange:t,interceptorManager:n}=e,r=u.useDependency(u.LocaleService),o=((E=e.rule)==null?void 0:E.type)===s.CFRuleType.highlightCell?e.rule:void 0,i=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[a,c]=w.useState(()=>{const C=i[0].value,T=o==null?void 0:o.type;if(!o)return C;switch(T){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":C;case s.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return C}),[l,d]=w.useState(()=>{const T=o==null?void 0:o.type;if(!o)return 10;switch(T){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.value||10}}return 10}),[f,m]=w.useState(()=>{const T=o==null?void 0:o.type;if(!o)return!1;switch(T){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[h,v]=w.useState({}),y=C=>{const{type:T,isPercent:_,value:I,style:g}=C;if(T==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:_,isBottom:!1,value:I,style:g};if(T==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:_,isBottom:!0,value:I,style:g};if(T==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:g};if(T==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:g}};w.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({type:a,isPercent:f,value:l,style:h})}}),[a,f,l,h,n]);const R=C=>{t(y(C))};return p.jsxs("div",{children:[p.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx(q.Select,{className:`${N.width100} ${P.mTSm}`,value:a,options:i,onChange:C=>{c(C),R({type:C,isPercent:f,value:l,style:h})}}),["isNotBottom","isBottom"].includes(a)&&p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.InputNumber,{min:1,max:1e3,value:l,onChange:C=>{const T=C||0;d(T),R({type:a,isPercent:f,value:T,style:h})}}),p.jsxs("div",{className:`${P.mLSm} ${P.labelContainer} ${N.text}`,children:[p.jsx(q.Checkbox,{checked:f,onChange:C=>{m(!!C),R({type:a,isPercent:!!C,value:l,style:h})}}),r.t("sheet.cf.valueType.percent")]})]}),p.jsx("div",{className:`${N.cfPreviewWrap} `,children:p.jsx(vt,{rule:y({type:a,isPercent:f,value:l,style:h})})}),p.jsx(Dr,{style:o==null?void 0:o.style,className:`${P.mTSm} `,onChange:C=>{v(C),R({type:a,isPercent:f,value:l,style:C})}})]})},Ot=e=>p.jsxs("div",{style:{position:"relative"},children:[p.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:e.errorText}),e.children]}),Q=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),au=e=>{const{type:t,operator:n,onChange:r,value:o,interceptorManager:i}=e,a=u.useDependency(u.LocaleService),[c,l]=w.useState(()=>typeof o=="number"?o:0),[d,f]=w.useState(""),[m,h]=w.useState(()=>typeof o=="string"?o:""),[v,y]=w.useState(""),[R,E]=w.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[C,T]=w.useState(""),[_,I]=w.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100),[g,x]=w.useState("");switch(w.useEffect(()=>{switch(t){case s.CFSubRuleType.text:{[s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)&&r(m);break}case s.CFSubRuleType.number:{[s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)&&r(c),[s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)&&r([R,_]);break}}},[t]),w.useEffect(()=>{const O=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(S,M,j)=>{switch(t){case s.CFSubRuleType.text:return s.CFTextOperator.beginsWith,s.CFTextOperator.containsText,s.CFTextOperator.endsWith,s.CFTextOperator.notEqual,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,m?j(S):(y(a.t("sheet.cf.errorMessage.notBlank")),!1)}return j(S)}});return()=>{O()}},[t,c,m,R,_]),t){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)){const O=S=>{h(S),r(S)};return p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(Ot,{errorText:v,children:p.jsx(q.Input,{className:N.width100,value:m,onChange:S=>{y(""),O(S)}})})})}break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)){const O=S=>{l(S||0),r(S||0),f("")};return p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(Ot,{errorText:d,children:p.jsx(q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:N.width100,value:c,onChange:O})})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const O=M=>{E(M||0),r([M||0,_]),T("")},S=M=>{I(M||0),r([R,M||0]),x("")};return p.jsxs("div",{className:`${P.mTSm} ${P.labelContainer} `,children:[p.jsx(Ot,{errorText:C,children:p.jsx(q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:R,onChange:O})}),p.jsx(Ot,{errorText:g,children:p.jsx(q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${P.mLSm}`,value:_,onChange:S})})]})}}}return null},to=(e,t)=>{switch(e){case s.CFSubRuleType.text:return[Q(s.CFTextOperator.containsText,t),Q(s.CFTextOperator.notContainsText,t),Q(s.CFTextOperator.beginsWith,t),Q(s.CFTextOperator.endsWith,t),Q(s.CFTextOperator.equal,t),Q(s.CFTextOperator.notEqual,t),Q(s.CFTextOperator.containsBlanks,t),Q(s.CFTextOperator.notContainsBlanks,t),Q(s.CFTextOperator.containsErrors,t),Q(s.CFTextOperator.notContainsErrors,t)];case s.CFSubRuleType.number:return[Q(s.CFNumberOperator.between,t),Q(s.CFNumberOperator.notBetween,t),Q(s.CFNumberOperator.equal,t),Q(s.CFNumberOperator.notEqual,t),Q(s.CFNumberOperator.greaterThan,t),Q(s.CFNumberOperator.greaterThanOrEqual,t),Q(s.CFNumberOperator.lessThan,t),Q(s.CFNumberOperator.lessThanOrEqual,t)];case s.CFSubRuleType.timePeriod:return[Q(s.CFTimePeriodOperator.yesterday,t),Q(s.CFTimePeriodOperator.today,t),Q(s.CFTimePeriodOperator.tomorrow,t),Q(s.CFTimePeriodOperator.last7Days,t),Q(s.CFTimePeriodOperator.lastWeek,t),Q(s.CFTimePeriodOperator.thisWeek,t),Q(s.CFTimePeriodOperator.nextWeek,t),Q(s.CFTimePeriodOperator.lastMonth,t),Q(s.CFTimePeriodOperator.thisMonth,t),Q(s.CFTimePeriodOperator.nextMonth,t)]}},no=e=>{var I;const{interceptorManager:t,onChange:n}=e,r=u.useDependency(u.LocaleService),o=((I=e.rule)==null?void 0:I.type)===s.CFRuleType.highlightCell?e.rule:void 0,[i,a]=w.useState(()=>{const g=s.CFSubRuleType.text;return o&&o.subType||g}),c=[{value:s.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:s.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:s.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:s.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:s.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],l=w.useMemo(()=>to(i,r),[i]),[d,f]=w.useState(()=>{const g=l?l[0].value:void 0;return o&&o.operator||g}),[m,h]=w.useState(()=>{var O;const g="";return o?(O=o.value)!=null?O:s.createDefaultValue(o.subType,o.operator):g}),[v,y]=w.useState({}),R=w.useMemo(()=>g=>{var x,O,S,M,j,$,A,b,D,Z,Ce,pe,he,xe,V;switch(g.subType||i){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(d))return{type:s.CFRuleType.highlightCell,subType:(x=g.subType)!=null?x:i,operator:(O=g.operator)!=null?O:d,style:(S=g.style)!=null?S:v,value:(M=g.value)!=null?M:m};break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(d))return{type:s.CFRuleType.highlightCell,subType:(j=g.subType)!=null?j:i,operator:($=g.operator)!=null?$:d,style:(A=g.style)!=null?A:v,value:(b=g.value)!=null?b:m};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(d))return{type:s.CFRuleType.highlightCell,subType:(D=g.subType)!=null?D:i,operator:(Z=g.operator)!=null?Z:d,style:(Ce=g.style)!=null?Ce:v,value:(pe=g.value)!=null?pe:m};break}}return{type:s.CFRuleType.highlightCell,subType:(he=g.subType)!=null?he:i,operator:(xe=g.operator)!=null?xe:d,style:(V=g.style)!=null?V:v}},[i,d,m,v]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return R({})}}),[R,t]),w.useEffect(()=>{c.some(g=>g.value===i)||a(c[0].value)},[c]);const E=g=>{const x=g,O=to(x,r),S=O&&O[0].value;a(x),f(S),S&&h(s.createDefaultValue(x,S)),n(R({subType:x,operator:S}))},C=g=>{const x=g;f(x),n(R({operator:x}))},T=g=>{h(g),n(R({value:g}))},_=w.useMemo(()=>`${i}_${d}_${Math.random()}`,[i,d]);return p.jsxs("div",{children:[p.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx(q.Select,{className:`${P.mTSm} ${N.width100}`,onChange:E,value:i,options:c}),(l==null?void 0:l.length)&&p.jsx(q.Select,{className:`${P.mTSm} ${N.width100}`,onChange:C,value:d||"",options:l}),p.jsx(au,{value:m,interceptorManager:t,type:i,operator:d,rule:o,onChange:T},_),p.jsx("div",{className:`${N.cfPreviewWrap}`,children:p.jsx(vt,{rule:R({})})}),p.jsx(Dr,{style:o==null?void 0:o.style,className:`${P.mLXxs}`,onChange:g=>{y(g),n(R({style:g}))}})]})},su=e=>{var E;const{onChange:t,interceptorManager:n}=e,r=u.useDependency(u.LocaleService),i=u.useDependency(u.IUniverInstanceService).getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),a=i.getActiveSheet(),c=((E=e.rule)==null?void 0:E.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,d]=w.useState({}),[f,m]=w.useState(()=>(c==null?void 0:c.subType)===s.CFSubRuleType.formula?c.value:"="),[h,v]=w.useState(""),y=C=>({style:C.style,value:f,type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula});w.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({style:l,formula:f})}}),[l,f,n]),w.useEffect(()=>{n.intercept(n.getInterceptPoints().beforeSubmit,{handler:(C,T,_)=>!f||f.length===1||!h.startsWith("=")?(v(r.t("sheet.cf.errorMessage.formulaError")),!1):_(C)})},[f]);const R=C=>{t(y(C))};return p.jsxs("div",{children:[p.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(Ot,{errorText:h,children:p.jsx(fe.TextEditor,{id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`),openForSheetSubUnitId:a==null?void 0:a.getSheetId(),openForSheetUnitId:i.getUnitId(),value:f,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(C="")=>{const T=C||"";m(T),R({style:l,formula:T}),v("")}})})}),p.jsx("div",{className:`${N.cfPreviewWrap} `,children:p.jsx(vt,{rule:y({style:l,formula:f})})}),p.jsx(Dr,{style:c==null?void 0:c.style,className:`${P.mTSm} `,onChange:C=>{d(C),R({style:C,formula:f})}})]})};var lu="Expected a function",fi="__lodash_hash_undefined__",pi=1/0,cu=9007199254740991,uu="[object Function]",du="[object GeneratorFunction]",fu="[object Symbol]",pu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hu=/^\w*$/,mu=/^\./,gu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vu=/[\\^$.*+?()[\]{}|]/g,yu=/\\(\\)?/g,Cu=/^\[object .+?Constructor\]$/,Su=/^(?:0|[1-9]\d*)$/,bu=typeof Ve=="object"&&Ve&&Ve.Object===Object&&Ve,Ru=typeof self=="object"&&self&&self.Object===Object&&self,Pr=bu||Ru||Function("return this")();function _u(e,t){return e==null?void 0:e[t]}function Tu(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Iu=Array.prototype,wu=Function.prototype,hi=Object.prototype,Un=Pr["__core-js_shared__"],ro=function(){var e=/[^.]+$/.exec(Un&&Un.keys&&Un.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),mi=wu.toString,_n=hi.hasOwnProperty,gi=hi.toString,xu=RegExp("^"+mi.call(_n).replace(vu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oo=Pr.Symbol,Ou=Iu.splice,Eu=vi(Pr,"Map"),jt=vi(Object,"create"),io=oo?oo.prototype:void 0,ao=io?io.toString:void 0;function Qe(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Du(){this.__data__=jt?jt(null):{}}function Pu(e){return this.has(e)&&delete this.__data__[e]}function Mu(e){var t=this.__data__;if(jt){var n=t[e];return n===fi?void 0:n}return _n.call(t,e)?t[e]:void 0}function Fu(e){var t=this.__data__;return jt?t[e]!==void 0:_n.call(t,e)}function Nu(e,t){var n=this.__data__;return n[e]=jt&&t===void 0?fi:t,this}Qe.prototype.clear=Du;Qe.prototype.delete=Pu;Qe.prototype.get=Mu;Qe.prototype.has=Fu;Qe.prototype.set=Nu;function yt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ju(){this.__data__=[]}function $u(e){var t=this.__data__,n=Tn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Ou.call(t,n,1),!0}function Lu(e){var t=this.__data__,n=Tn(t,e);return n<0?void 0:t[n][1]}function Uu(e){return Tn(this.__data__,e)>-1}function Vu(e,t){var n=this.__data__,r=Tn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}yt.prototype.clear=ju;yt.prototype.delete=$u;yt.prototype.get=Lu;yt.prototype.has=Uu;yt.prototype.set=Vu;function rt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function zu(){this.__data__={hash:new Qe,map:new(Eu||yt),string:new Qe}}function Au(e){return In(this,e).delete(e)}function Hu(e){return In(this,e).get(e)}function Wu(e){return In(this,e).has(e)}function ku(e,t){return In(this,e).set(e,t),this}rt.prototype.clear=zu;rt.prototype.delete=Au;rt.prototype.get=Hu;rt.prototype.has=Wu;rt.prototype.set=ku;function qu(e,t,n){var r=e[t];(!(_n.call(e,t)&&yi(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function Tn(e,t){for(var n=e.length;n--;)if(yi(e[n][0],t))return n;return-1}function Bu(e){if(!on(e)||Qu(e))return!1;var t=rd(e)||Tu(e)?xu:Cu;return t.test(nd(e))}function Gu(e,t,n,r){if(!on(e))return e;t=Zu(t,e)?[t]:Yu(t);for(var o=-1,i=t.length,a=i-1,c=e;c!=null&&++o<i;){var l=td(t[o]),d=n;if(o!=a){var f=c[l];d=void 0,d===void 0&&(d=on(f)?f:Ku(t[o+1])?[]:{})}qu(c,l,d),c=c[l]}return e}function Xu(e){if(typeof e=="string")return e;if(Fr(e))return ao?ao.call(e):"";var t=e+"";return t=="0"&&1/e==-pi?"-0":t}function Yu(e){return Ci(e)?e:ed(e)}function In(e,t){var n=e.__data__;return Ju(t)?n[typeof t=="string"?"string":"hash"]:n.map}function vi(e,t){var n=_u(e,t);return Bu(n)?n:void 0}function Ku(e,t){return t=t==null?cu:t,!!t&&(typeof e=="number"||Su.test(e))&&e>-1&&e%1==0&&e<t}function Zu(e,t){if(Ci(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Fr(e)?!0:hu.test(e)||!pu.test(e)||t!=null&&e in Object(t)}function Ju(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Qu(e){return!!ro&&ro in e}var ed=Mr(function(e){e=id(e);var t=[];return mu.test(e)&&t.push(""),e.replace(gu,function(n,r,o,i){t.push(o?i.replace(yu,"$1"):r||n)}),t});function td(e){if(typeof e=="string"||Fr(e))return e;var t=e+"";return t=="0"&&1/e==-pi?"-0":t}function nd(e){if(e!=null){try{return mi.call(e)}catch{}try{return e+""}catch{}}return""}function Mr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(lu);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(Mr.Cache||rt),n}Mr.Cache=rt;function yi(e,t){return e===t||e!==e&&t!==t}var Ci=Array.isArray;function rd(e){var t=on(e)?gi.call(e):"";return t==uu||t==du}function on(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function od(e){return!!e&&typeof e=="object"}function Fr(e){return typeof e=="symbol"||od(e)&&gi.call(e)==fu}function id(e){return e==null?"":Xu(e)}function ad(e,t,n){return e==null?e:Gu(e,t,n)}var sd=ad;const ld=sr(sd);var cd="Expected a function",Si="__lodash_hash_undefined__",bi=1/0,ud="[object Function]",dd="[object GeneratorFunction]",fd="[object Symbol]",pd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hd=/^\w*$/,md=/^\./,gd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vd=/[\\^$.*+?()[\]{}|]/g,yd=/\\(\\)?/g,Cd=/^\[object .+?Constructor\]$/,Sd=typeof Ve=="object"&&Ve&&Ve.Object===Object&&Ve,bd=typeof self=="object"&&self&&self.Object===Object&&self,Nr=Sd||bd||Function("return this")();function Rd(e,t){return e==null?void 0:e[t]}function _d(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Td=Array.prototype,Id=Function.prototype,Ri=Object.prototype,Vn=Nr["__core-js_shared__"],so=function(){var e=/[^.]+$/.exec(Vn&&Vn.keys&&Vn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),_i=Id.toString,jr=Ri.hasOwnProperty,Ti=Ri.toString,wd=RegExp("^"+_i.call(jr).replace(vd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lo=Nr.Symbol,xd=Td.splice,Od=Ii(Nr,"Map"),$t=Ii(Object,"create"),co=lo?lo.prototype:void 0,uo=co?co.toString:void 0;function et(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ed(){this.__data__=$t?$t(null):{}}function Dd(e){return this.has(e)&&delete this.__data__[e]}function Pd(e){var t=this.__data__;if($t){var n=t[e];return n===Si?void 0:n}return jr.call(t,e)?t[e]:void 0}function Md(e){var t=this.__data__;return $t?t[e]!==void 0:jr.call(t,e)}function Fd(e,t){var n=this.__data__;return n[e]=$t&&t===void 0?Si:t,this}et.prototype.clear=Ed;et.prototype.delete=Dd;et.prototype.get=Pd;et.prototype.has=Md;et.prototype.set=Fd;function Ct(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Nd(){this.__data__=[]}function jd(e){var t=this.__data__,n=wn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():xd.call(t,n,1),!0}function $d(e){var t=this.__data__,n=wn(t,e);return n<0?void 0:t[n][1]}function Ld(e){return wn(this.__data__,e)>-1}function Ud(e,t){var n=this.__data__,r=wn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Ct.prototype.clear=Nd;Ct.prototype.delete=jd;Ct.prototype.get=$d;Ct.prototype.has=Ld;Ct.prototype.set=Ud;function ot(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vd(){this.__data__={hash:new et,map:new(Od||Ct),string:new et}}function zd(e){return xn(this,e).delete(e)}function Ad(e){return xn(this,e).get(e)}function Hd(e){return xn(this,e).has(e)}function Wd(e,t){return xn(this,e).set(e,t),this}ot.prototype.clear=Vd;ot.prototype.delete=zd;ot.prototype.get=Ad;ot.prototype.has=Hd;ot.prototype.set=Wd;function wn(e,t){for(var n=e.length;n--;)if(ef(e[n][0],t))return n;return-1}function kd(e,t){t=Xd(t,e)?[t]:Gd(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Jd(t[n++])];return n&&n==r?e:void 0}function qd(e){if(!xi(e)||Kd(e))return!1;var t=tf(e)||_d(e)?wd:Cd;return t.test(Qd(e))}function Bd(e){if(typeof e=="string")return e;if(Lr(e))return uo?uo.call(e):"";var t=e+"";return t=="0"&&1/e==-bi?"-0":t}function Gd(e){return wi(e)?e:Zd(e)}function xn(e,t){var n=e.__data__;return Yd(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ii(e,t){var n=Rd(e,t);return qd(n)?n:void 0}function Xd(e,t){if(wi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Lr(e)?!0:hd.test(e)||!pd.test(e)||t!=null&&e in Object(t)}function Yd(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Kd(e){return!!so&&so in e}var Zd=$r(function(e){e=rf(e);var t=[];return md.test(e)&&t.push(""),e.replace(gd,function(n,r,o,i){t.push(o?i.replace(yd,"$1"):r||n)}),t});function Jd(e){if(typeof e=="string"||Lr(e))return e;var t=e+"";return t=="0"&&1/e==-bi?"-0":t}function Qd(e){if(e!=null){try{return _i.call(e)}catch{}try{return e+""}catch{}}return""}function $r(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(cd);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new($r.Cache||ot),n}$r.Cache=ot;function ef(e,t){return e===t||e!==e&&t!==t}var wi=Array.isArray;function tf(e){var t=xi(e)?Ti.call(e):"";return t==ud||t==dd}function xi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function nf(e){return!!e&&typeof e=="object"}function Lr(e){return typeof e=="symbol"||nf(e)&&Ti.call(e)==fd}function rf(e){return e==null?"":Bd(e)}function of(e,t,n){var r=e==null?void 0:kd(e,t);return r===void 0?n:r}var af=of;const sf=sr(af),Oi=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",lf=e=>{var i;const t=u.useDependency(u.IUniverInstanceService),n=t.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=(i=t.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:i.getSheetId(),o=w.useMemo(()=>e.error?N.errorInput:"",[e.error]);return p.jsx("div",{className:N.positionRelative,children:e.type!==s.CFValueType.formula?p.jsxs(p.Fragment,{children:[p.jsx(q.InputNumber,{className:o,value:Number(e.value)||0,onChange:a=>e.onChange(a!=null?a:0)}),e.error&&p.jsx("div",{className:N.errorText,children:e.error})]}):p.jsx(fe.TextEditor,{id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_icon_set_${e.id}`),value:String(e.value).startsWith("=")?String(e.value):"=",openForSheetSubUnitId:r,openForSheetUnitId:n,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(a="")=>{const c=a||"";e.onChange(c)}})})},fo=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),cf=w.forwardRef((e,t)=>{const n=u.useDependency(u.LocaleService),r=o=>{e.onClick(o)};return p.jsx("div",{ref:t,className:N.iconGroupList,children:s.iconGroup.map((o,i)=>p.jsxs("div",{className:N.group,children:[p.jsx("div",{className:N.title,children:n.t(o.title)}),p.jsx("div",{className:N.itemContent,children:o.group.map(a=>p.jsx("div",{className:N.itemWrap,onClick:()=>{r(a.name)},children:p.jsx("div",{className:N.item,children:a.list.map((c,l)=>p.jsx("img",{className:N.icon,src:c},l))})},a.name))})]},i))})}),uf=e=>{const t=w.useMemo(()=>{const r=[];for(const o in s.iconMap){const i=s.iconMap[o],a=o;i.forEach((c,l)=>{r.push({iconType:a,base64:c,iconId:String(l)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return p.jsxs("div",{className:N.iconItemListWrap,children:[p.jsxs("div",{className:N.none,onClick:()=>n({iconType:s.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[p.jsx(Ut,{className:N.icon}),p.jsx("span",{children:"无单元格图标"})]}),p.jsx("div",{className:N.iconItemList,children:t.map(r=>p.jsx("div",{className:N.item,children:p.jsx("img",{onClick:()=>n(r),className:`${N.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},df=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,o=u.useDependency(u.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],a=[{label:o.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],c=(m,h)=>{t([String(h),"value","value"],m)},l=(m,h)=>{t([String(h),"operator"],m);const v=s.createDefaultValue(s.CFSubRuleType.number,m);c(v,h)},d=(m,h)=>{t([String(h),"value","type"],m)};return w.useMemo(()=>n.map((m,h)=>{const v=r[h],y=Oi(m.iconType,m.iconId),R=h===n.length-1,E=h===0,C=n[h-1],T=(C==null?void 0:C.value.type)===s.CFValueType.formula?o.t("sheet.cf.valueType.formula"):C==null?void 0:C.value.value,_=(I,g)=>{const x={...m,iconId:g,iconType:I};t([String(h)],x)};return p.jsxs("div",{className:`${h?P.mTXl:P.mTSm}`,children:[p.jsxs("div",{className:`${P.label} ${N.flex}`,children:[p.jsxs("div",{className:`${N.width45}`,children:[o.t("sheet.cf.iconSet.icon"),h+1]}),p.jsx("div",{className:`${N.width45}`,children:p.jsxs(p.Fragment,{children:[!E&&!R&&o.t("sheet.cf.iconSet.rule"),!E&&!R&&p.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(C.operator)}`),T,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),p.jsxs("div",{className:`${N.flex} ${P.mTSm}`,children:[p.jsx("div",{className:`${N.iconWrap} ${N.width45}`,children:p.jsx(q.Dropdown,{overlay:p.jsx(uf,{onClick:_,iconId:m.iconId,iconType:m.iconType}),children:p.jsxs("div",{className:N.dropdownIcon,children:[y?p.jsx("img",{src:y,className:N.icon}):p.jsx(Ut,{className:N.icon}),p.jsx(ln,{})]})})}),R?p.jsxs("div",{className:`${N.width45} ${P.label}`,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),p.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(C.operator)}`),T,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):p.jsx(q.Select,{className:`${P.mL0} ${N.width45} ${P.mR0}`,options:i,value:m.operator,onChange:I=>{l(I,h)}})]}),R?p.jsx("div",{}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:`${P.mTSm} ${P.label} ${N.flex}`,children:[p.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.type")}),p.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.value")})]}),p.jsxs("div",{className:`${P.mTSm} ${N.flex}`,children:[p.jsx(q.Select,{className:`${N.width45} ${P.mL0}`,options:a,value:m.value.type,onChange:I=>{d(I,h)}}),p.jsx("div",{className:`${P.mL0} ${N.width45}`,children:p.jsx(lf,{id:h,type:m.value.type,error:v,value:m.value.value||"",onChange:I=>c(I,h)})})]})]})]},h)}),[n,r])},ff=e=>{var I;const{interceptorManager:t}=e,n=((I=e.rule)==null?void 0:I.type)===s.CFRuleType.iconSet?e.rule:void 0,r=u.useDependency(u.LocaleService),[o,i]=w.useState({}),[a,c]=w.useState(()=>{const g=Object.keys(s.iconMap)[0];if(n&&n.config.length){const x=n.config[0].iconType;if(!n.config.some(S=>S.iconType!==x))return x}return g}),[l,d]=w.useState(()=>{if(n&&n.config.length)return u.Tools.deepClone(n==null?void 0:n.config);const g=s.iconMap[a]||[];return new Array(g.length).fill("").map((x,O,S)=>O===S.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:a,iconId:String(O)}:fo(a,O,S))}),[f,m]=w.useState(()=>n?!!n.isShowValue:!0),h=w.useMemo(()=>{const g=l.map(x=>Oi(x.iconType,x.iconId));return p.jsx("div",{className:N.iconWrap,children:g.map((x,O)=>x?p.jsx("img",{className:N.icon,src:x},O):p.jsx(Ut,{className:N.icon},O))})},[l]),v=g=>{if(g.reduce((O,S,M)=>O.preType&&!O.result||g.length-1===M?O:S.value.type===s.CFValueType.formula?{preType:s.CFValueType.formula,result:!1}:O.preType?{result:O.preType===S.value.type,preType:S.value.type}:{result:!0,preType:S.value.type},{result:!0,preType:""}).result&&[s.CFValueType.num,s.CFValueType.percent,s.CFValueType.percentile].includes(g[0].value.type)){const O={};return g.forEach((S,M,j)=>{if(M-1<0||M===j.length-1)return;const A=g[M-1],b=s.getOppositeOperator(A.operator);s.compareWithNumber({operator:b,value:A.value.value},S.value.value)||(O[M]=`${r.t(`sheet.cf.form.${b}`,String(A.value.value))} `)}),O}return{}},y=(g,x)=>{sf(l,g)!==x&&(ld(l,g,x),d([...l]),i(v(l)))},R=g=>{c(g);const x=s.iconMap[g]||[],O=new Array(x.length).fill("").map((S,M,j)=>fo(g,M,j));d(O),i(v(O))};w.useEffect(()=>{const g=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:f,config:l}}});return()=>{g()}},[f,l,t]),w.useEffect(()=>{const g=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{g()}},[f,l,t,o]);const E=()=>{const g=l.map(x=>({...x}));l.forEach((x,O)=>{const S=l.length-1-O,M=g[S];x.iconId=M.iconId,x.iconType=M.iconType}),d([...l])},C=u.useDependency(fe.ILayoutService),[T,_]=w.useState();return fe.useScrollYOverContainer(T,C.rootContainerElement),p.jsxs("div",{className:N.iconSet,children:[p.jsx("div",{className:P.title,children:r.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(q.Dropdown,{placement:"bottomLeft",overlay:p.jsx(cf,{ref:g=>!T&&g&&_(g),iconType:a,onClick:R}),children:p.jsxs("div",{className:N.dropdownIcon,style:{width:"unset"},children:[h,p.jsx(ln,{})]})})}),p.jsxs("div",{className:`${P.mTSm} ${N.renderConfig}`,children:[p.jsxs("div",{className:N.utilItem,children:[p.jsx(q.Checkbox,{onChange:E}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),p.jsxs("div",{className:`${N.utilItem} ${P.mLXl}`,children:[p.jsx(q.Checkbox,{checked:!f,onChange:g=>{m(!g)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),p.jsx(df,{errorMap:o,onChange:y,configList:l})]})},po=e=>e.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),ho=e=>{var t;return(t=e.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId()},pf=e=>{var I,g,x,O;const t=u.useDependency(u.LocaleService),n=u.useDependency(u.ICommandService),r=u.useDependency(u.IUniverInstanceService),o=u.useDependency(s.ConditionalFormattingRuleModel),i=u.useDependency(L.SheetsSelectionsService),a=po(r),c=ho(r),l=w.useRef((g=(I=e.rule)==null?void 0:I.ranges)!=null?g:[]),d=w.useMemo(()=>{var M,j,$;let S=(M=e.rule)==null?void 0:M.ranges;return S!=null&&S.length||(S=($=(j=i.getCurrentSelections())==null?void 0:j.map(A=>A.range))!=null?$:[]),l.current=S,S!=null&&S.length?S.map(A=>{const b=Co.serializeRange(A);return b==="NaN"?"":b}).filter(A=>!!A).join(","):""},[e.rule]),f=[{label:t.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:t.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:t.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:t.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:t.t("sheet.cf.ruleType.formula"),value:"5"},{label:t.t("sheet.cf.ruleType.iconSet"),value:"6"}],[m,h]=w.useState(()=>{var j,$;const S=(j=e.rule)==null?void 0:j.rule.type,M=f[0].value;if(!S)return M;switch(S){case s.CFRuleType.highlightCell:{switch(($=e.rule)==null?void 0:$.rule.subType){case s.CFSubRuleType.number:case s.CFSubRuleType.text:case s.CFSubRuleType.duplicateValues:case s.CFSubRuleType.uniqueValues:case s.CFSubRuleType.timePeriod:return"1";case s.CFSubRuleType.average:case s.CFSubRuleType.rank:return"2";case s.CFSubRuleType.formula:return"5"}break}case s.CFRuleType.dataBar:return"3";case s.CFRuleType.colorScale:return"4";case s.CFRuleType.iconSet:return"6"}return M}),v=w.useRef(),y=w.useMemo(()=>new u.InterceptorManager({beforeSubmit:_c,submit:Tc}),[]),R=w.useMemo(()=>{switch(m){case"1":return no;case"2":return iu;case"3":return tu;case"4":return eu;case"5":return su;case"6":return ff;default:return no}},[m]);w.useEffect(()=>{var S;if(((S=e.rule)==null?void 0:S.cfId)!==void 0){const M=n.onCommandExecuted(j=>{if(j.id===L.RemoveSheetMutation.id){const $=j.params;$.subUnitId===c&&$.unitId===a&&e.onCancel()}j.id===L.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>M.dispose()}},[(x=e.rule)==null?void 0:x.cfId]);const E=S=>{v.current=S},C=S=>{l.current=S.map(M=>M.range)},T=()=>{const M=(()=>{const $=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!$)throw new Error("No active sheet found");return l.current.map(D=>L.setEndForRange(D,$.getRowCount(),$.getColumnCount())).filter(D=>!(Number.isNaN(D.startRow)||Number.isNaN(D.startColumn)))})();if(y.fetchThroughInterceptors(y.getInterceptPoints().beforeSubmit)(!0,null)){const $=y.fetchThroughInterceptors(y.getInterceptPoints().submit)(null,null);if($){const A=po(r),b=ho(r);if(!A||!b)throw new Error("No active sheet found");let D={};e.rule&&e.rule.cfId?(D={...e.rule,ranges:M,rule:$},n.executeCommand(Rn.id,{unitId:A,subUnitId:b,rule:D}),e.onCancel()):(D={cfId:o.createCfId(A,b),ranges:M,rule:$,stopIfTrue:!1},n.executeCommand(Ht.id,{unitId:A,subUnitId:b,rule:D}),e.onCancel())}}},_=()=>{e.onCancel()};return p.jsxs("div",{className:N.cfRuleStyleEditor,children:[p.jsx("div",{className:P.title,children:t.t("sheet.cf.panel.range")}),p.jsx("div",{className:`${P.mTBase}`,children:p.jsx(fe.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:c,openForSheetUnitId:a,value:d,id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`),onChange:C})}),p.jsx("div",{className:P.title,children:t.t("sheet.cf.panel.styleType")}),p.jsx("div",{className:P.mTBase,children:p.jsx(q.Select,{className:N.width100,value:m,options:f,onChange:S=>h(S)})}),p.jsx(R,{interceptorManager:y,rule:(O=e.rule)==null?void 0:O.rule,onChange:E}),p.jsxs("div",{className:`${P.mTBase} ${N.btnList}`,children:[p.jsx(q.Button,{size:"small",onClick:_,children:t.t("sheet.cf.panel.cancel")}),p.jsx(q.Button,{className:P.mLSm,size:"small",type:"primary",onClick:T,children:t.t("sheet.cf.panel.submit")})]})]})},hf=e=>{const[t,n]=w.useState(e.rule),[r,o]=w.useState(!!e.rule),i=()=>{o(!0)},a=()=>{o(!1),n(void 0)},c=l=>{n(l),o(!0)};return p.jsx("div",{className:P.conditionalFormattingWrap,children:r?p.jsx(pf,{onCancel:a,rule:t}):p.jsx(Rc,{onClick:c,onCreate:i})})};var mf=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,vf=(e,t,n,r)=>{for(var o=r>1?void 0:r?gf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&mf(t,n,o),o},ct=(e,t)=>(n,r)=>t(n,r,e);const Ei={},mo="sheet.conditional.formatting.panel";let ht=class extends u.Disposable{constructor(t,n,r,o,i,a,c){super();St(this,"_sidebarDisposable",null);this._config=t,this._univerInstanceService=n,this._injector=r,this._componentManager=o,this._menuService=i,this._sidebarService=a,this._localeService=c,this._initMenu(),this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET).subscribe(l=>{var d;l||(d=this._sidebarDisposable)==null||d.dispose()}))}openPanel(t){const n={header:{title:this._localeService.t("sheet.cf.title")},children:{label:mo,rule:t,key:u.Tools.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initMenu(){const{menu:t={}}=this._config;this._menuService.addMenuItem(Li(this._injector),t)}_initPanel(){this._componentManager.register(mo,hf)}};ht=vf([u.OnLifecycle(u.LifecycleStages.Ready,ht),ct(1,u.IUniverInstanceService),ct(2,u.Inject(u.Injector)),ct(3,u.Inject(fe.ComponentManager)),ct(4,u.Inject(fe.IMenuService)),ct(5,u.Inject(fe.ISidebarService)),ct(6,u.Inject(u.LocaleService))],ht);var _e=(e=>(e[e.createRule=1]="createRule",e[e.viewRule=2]="viewRule",e[e.highlightCell=3]="highlightCell",e[e.rank=4]="rank",e[e.formula=5]="formula",e[e.colorScale=6]="colorScale",e[e.dataBar=7]="dataBar",e[e.icon=8]="icon",e[e.clearRangeRules=9]="clearRangeRules",e[e.clearWorkSheetRules=10]="clearWorkSheetRules",e))(_e||{});const On={id:"sheet.operation.open.conditional.formatting.panel",type:u.CommandType.OPERATION,handler:(e,t)=>{var c;const n=e.get(ht),r=e.get(L.SheetsSelectionsService),o=e.get(u.ICommandService),i=((c=r.getCurrentSelections())==null?void 0:c.map(l=>l.range))||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 4:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(l);break}case 5:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(l);break}case 6:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(l);break}case 7:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(l);break}case 8:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(l);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(an.id,{ranges:i});break}case 10:{o.executeCommand(Lt.id);break}}return!0}};var yf=Object.defineProperty,Cf=Object.getOwnPropertyDescriptor,Sf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Cf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&yf(t,n,o),o},ut=(e,t)=>(n,r)=>t(n,r,e);let Et=class extends u.Disposable{constructor(e,t,n,r,o,i){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=i,this._initViewModelInterceptor(),this._initSkeleton()}_initSkeleton(){const e=()=>{var n,r,o;const t=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId();(n=this._renderManagerService.getRenderById(t))==null||n.with(le.SheetSkeletonManagerService).reCalculate(),(o=(r=this._renderManagerService.getRenderById(t))==null?void 0:r.mainComponent)==null||o.makeDirty()};this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(We.bufferTime(16),We.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(We.bufferTime(16),We.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>["sort","delete"].includes(o.type)&&o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(We.bufferTime(16),We.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(L.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!r)return n(e);const o=t.workbook.getStyles(),a={...(typeof(e==null?void 0:e.s)=="string"?o.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},c={...e,s:a};return r.style&&Object.assign(a,r.style),c.fontRenderExtension||(c.fontRenderExtension={},r.isShowValue!==void 0&&(c.fontRenderExtension.isSkip=!r.isShowValue)),r.dataBar&&(c.dataBar=r.dataBar),r.iconSet&&(c.iconSet=r.iconSet,c.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH),n(c)},priority:10}))}};Et=Sf([u.OnLifecycle(u.LifecycleStages.Rendered,Et),ut(0,u.Inject(L.SheetInterceptorService)),ut(1,u.Inject(s.ConditionalFormattingService)),ut(2,u.Inject(u.IUniverInstanceService)),ut(3,u.Inject($i.IRenderManagerService)),ut(4,u.Inject(s.ConditionalFormattingViewModel)),ut(5,u.Inject(s.ConditionalFormattingRuleModel))],Et);var bf=Object.defineProperty,Rf=Object.getOwnPropertyDescriptor,_f=(e,t,n,r)=>{for(var o=r>1?void 0:r?Rf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&bf(t,n,o),o},_t=(e,t)=>(n,r)=>t(n,r,e);let Dt=class extends u.Disposable{constructor(t,n,r,o,i){super();St(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=o,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,n,r)=>this._collectConditionalRule(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:i=le.COPY_TYPE.COPY,pasteType:a}=o,{range:c}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:i,pasteType:a,copyRange:c})}}))}_collectConditionalRule(t,n,r){const o=new u.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:t,subUnitId:n,cfMap:i}};const a=this._conditionalFormattingViewModel.getMatrix(t,n);if(!a)return;const c={get:this._injector.get.bind(this._injector)},l=le.rangeToDiscreteRange(r,c,t,n);if(!l)return;const{rows:d,cols:f}=l,m=new Set;d.forEach((h,v)=>{f.forEach((y,R)=>{const E=this._conditionalFormattingViewModel.getCellCf(t,n,h,y,a);E&&(E.cfList.forEach(C=>m.add(C.cfId)),o.setValue(v,R,E.cfList.map(C=>C.cfId)))})}),m.forEach(h=>{const v=this._conditionalFormattingRuleModel.getRule(t,n,h);v&&(i[h]=v.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),o=r.getActiveSheet(),i=r.getUnitId();if(!o)return{redos:[],undos:[]};const a=o.getSheetId();if(n.copyType===le.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![le.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,le.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,le.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[c,l],mapFunc:d}=le.virtualizeDiscreteRanges([n.copyRange,t]),f=le.getRepeatRange(c,l,!0),m=this._conditionalFormattingViewModel.getMatrix(i,a),h={};u.Range.foreach(l,(g,x)=>{const{row:O,col:S}=d(g,x),M=this._conditionalFormattingViewModel.getCellCf(i,a,O,S,m);M&&M.cfList.forEach(j=>{if(!h[j.cfId]){const $=new u.ObjectMatrix;h[j.cfId]=$;const A=this._conditionalFormattingRuleModel.getRule(i,a,j.cfId);A==null||A.ranges.forEach(b=>{u.Range.foreach(b,(D,Z)=>{$.setValue(D,Z,1)})})}h[j.cfId].realDeleteValue(O,S)})});const{matrix:v,info:y}=this._copyInfo,R=[];let E=this._conditionalFormattingRuleModel.createCfId(i,a);const C={},T=g=>{if(C[g])return C[g];const x=y==null?void 0:y.cfMap[g],O=[...this._conditionalFormattingRuleModel.getSubunitRules(i,a)||[],...R].find(S=>u.Tools.diffValue(S.rule,x));if(O)return C[g]=O,O;{const S={rule:x,cfId:E,ranges:[],stopIfTrue:!1};return C[g]=S,R.push(S),E=`${Number(E)+1}`,S}};f.forEach(g=>{v&&v.forValue((x,O,S)=>{const M=u.Rectangle.getPositionRange({startRow:x,endRow:x,startColumn:O,endColumn:O},g.startRange),{row:j,col:$}=d(M.startRow,M.startColumn);S.forEach(A=>{if(!h[A]){const b=T(A),D=new u.ObjectMatrix;h[A]=D,b.ranges.forEach(Z=>{u.Range.foreach(Z,(Ce,pe)=>{D.setValue(Ce,pe,1)})})}h[A].setValue(j,$,1)})})});const _=[],I=[];for(const g in h){const x=h[g],O=L.findAllRectangle(L.createTopMatrixFromMatrix(x));if(!O.length){const S={unitId:i,subUnitId:a,cfId:g};_.push({id:s.DeleteConditionalRuleMutation.id,params:S}),I.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,S))}if(R.some(S=>S.cfId===g)){const S=T(g),M={unitId:i,subUnitId:a,rule:{...S,ranges:O}};_.push({id:s.AddConditionalRuleMutation.id,params:M}),I.push(s.AddConditionalRuleMutationUndoFactory(this._injector,M))}else{const S=this._conditionalFormattingRuleModel.getRule(i,a,g);if(!S)continue;const M={unitId:i,subUnitId:a,rule:{...S,ranges:O}};_.push({id:s.SetConditionalRuleMutation.id,params:M}),I.push(...s.setConditionalRuleMutationUndoFactory(this._injector,M))}}return{redos:_,undos:I}}};Dt=_f([u.OnLifecycle(u.LifecycleStages.Rendered,Dt),_t(0,u.Inject(le.ISheetClipboardService)),_t(1,u.Inject(s.ConditionalFormattingRuleModel)),_t(2,u.Inject(u.Injector)),_t(3,u.Inject(s.ConditionalFormattingViewModel)),_t(4,u.Inject(u.IUniverInstanceService))],Dt);var Tf=Object.defineProperty,If=Object.getOwnPropertyDescriptor,wf=(e,t,n,r)=>{for(var o=r>1?void 0:r?If(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Tf(t,n,o),o},Kt=(e,t)=>(n,r)=>t(n,r,e);let Pt=class extends u.Disposable{constructor(e,t,n,r){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._refRangeService=r,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,o,i)=>`${r}_${o}_${i}`,n=(r,o,i)=>{const a=l=>{const d=[...i.ranges],f=d.map(h=>L.handleDefaultRangeChangeWithEffectRefCommands(h,l)).filter(h=>!!h);if(s.isRangesEqual(f,d))return{redos:[],undos:[]};if(f.length){const h={unitId:r,subUnitId:o,rule:{...i,ranges:f}},v=[{id:s.SetConditionalRuleMutation.id,params:h}],y=s.setConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:y}}else{const h={unitId:r,subUnitId:o,cfId:i.cfId},v=[{id:s.DeleteConditionalRuleMutation.id,params:h}],y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:y}}},c=[];i.ranges.forEach(l=>{const d=this._refRangeService.registerRefRange(l,a);c.push(()=>d.dispose())}),e.set(t(r,o,i.cfId),()=>c.forEach(l=>l()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:o,subUnitId:i,rule:a}=r,c=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),l=c.getActiveSheet();if(!(r.unitId!==c.getUnitId()||r.subUnitId!==(l==null?void 0:l.getSheetId())))switch(r.type){case"add":{n(r.unitId,r.subUnitId,r.rule);break}case"delete":{const d=e.get(t(o,i,a.cfId));d&&d();break}case"set":{const d=e.get(t(o,i,a.cfId));d&&d(),n(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(u.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};Pt=wf([u.OnLifecycle(u.LifecycleStages.Rendered,Pt),Kt(0,u.Inject(s.ConditionalFormattingRuleModel)),Kt(1,u.Inject(u.IUniverInstanceService)),Kt(2,u.Inject(u.Injector)),Kt(3,u.Inject(L.RefRangeService))],Pt);var xf=Object.defineProperty,Of=Object.getOwnPropertyDescriptor,Ef=(e,t,n,r)=>{for(var o=r>1?void 0:r?Of(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&xf(t,n,o),o},zn=(e,t)=>(n,r)=>t(n,r,e);let Mt=class extends u.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===Ht.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[L.WorkbookEditablePermission],rangeTypes:[L.RangeProtectionPermissionEditPoint],worksheetTypes:[L.WorksheetEditPermission,L.WorksheetSetCellStylePermission]},e.params.rule.ranges)||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")))}))}};Mt=Ef([u.OnLifecycle(u.LifecycleStages.Rendered,Mt),zn(0,u.Inject(u.LocaleService)),zn(1,u.ICommandService),zn(2,u.Inject(le.SheetPermissionInterceptorBaseController))],Mt);var Di=Object.defineProperty,Df=Object.getOwnPropertyDescriptor,Pf=(e,t,n)=>t in e?Di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Df(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Di(t,n,o),o},go=(e,t)=>(n,r)=>t(n,r,e),Pi=(e,t,n)=>Pf(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends u.Plugin{constructor(t={},n,r){super(),this._config=t,this._injector=n,this._commandService=r,this._config=u.Tools.deepMerge({},Ei,this._config),this._initCommand(),this._injector.add([Et]),this._injector.add([Pt]),this._injector.add([Dt]),this._injector.add([Mt]),this._injector.add([pt])}_initCommand(){[Jn,Qn,er,tr,nr,rr,or,ir,ar,On,Nt,Rn,bn,Ht,an,Lt].forEach(t=>{this._commandService.registerCommand(t)})}};Pi(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Pi(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",u.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=Mf([u.DependentOn(s.UniverSheetsConditionalFormattingPlugin),go(1,u.Inject(u.Injector)),go(2,u.Inject(u.ICommandService))],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var Ff=Object.defineProperty,Nf=Object.getOwnPropertyDescriptor,jf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Nf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Ff(t,n,o),o},Tt=(e,t)=>(n,r)=>t(n,r,e);let Jt=class extends u.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(o,i,a,c,l)=>{var v;const d=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),f=(v=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:v.getSheetId();if(!d||!f)return;const m={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};u.Range.foreach(a,(y,R)=>{const E=u.Rectangle.getPositionRange({startRow:y,startColumn:R,endColumn:R,endRow:y},m),C=u.Rectangle.getPositionRange({startRow:y,startColumn:R,endColumn:R,endRow:y},h),{row:T,col:_}=l(E.startRow,E.startColumn),I=this._conditionalFormattingViewModel.getCellCf(d,f,T,_),{row:g,col:x}=l(C.startRow,C.startColumn),O=this._conditionalFormattingViewModel.getCellCf(d,f,g,x);O&&O.cfList.forEach(S=>{let M=c.get(S.cfId);if(!c.get(S.cfId)){const j=this._conditionalFormattingRuleModel.getRule(d,f,S.cfId);if(!j)return;M=new u.ObjectMatrix,j.ranges.forEach($=>{u.Range.foreach($,(A,b)=>{M.setValue(A,b,1)})}),c.set(S.cfId,M)}M.realDeleteValue(g,x)}),I&&I.cfList.forEach(S=>{let M=c.get(S.cfId);if(!c.get(S.cfId)){const j=this._conditionalFormattingRuleModel.getRule(d,f,S.cfId);if(!j)return;M=new u.ObjectMatrix,j.ranges.forEach($=>{u.Range.foreach($,(A,b)=>{M.setValue(A,b,1)})}),c.set(S.cfId,M)}M.setValue(g,x,1)})})},n=(o,i)=>{var C,T,_;const a=(C=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:C.getUnitId(),c=(_=(T=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:T.getActiveSheet())==null?void 0:_.getSheetId(),l=new Map,d=[],f=[];if(!a||!c)return e();const m=le.virtualizeDiscreteRanges([o,i]),[h,v]=m.ranges,{mapFunc:y}=m,R={row:h.startRow,col:h.startColumn};return le.getAutoFillRepeatRange(h,v).forEach(I=>{t(R,I.repeatStartCell,I.relativeRange,l,y)}),l.forEach((I,g)=>{const x=this._conditionalFormattingRuleModel.getRule(a,c,g);if(!x)return;const O=L.findAllRectangle(L.createTopMatrixFromMatrix(I));if(O.length){const S={unitId:a,subUnitId:c,rule:{...x,ranges:O}};d.push({id:s.SetConditionalRuleMutation.id,params:S}),f.push(...s.setConditionalRuleMutationUndoFactory(this._injector,S))}else{const S={unitId:a,subUnitId:c,cfId:x.cfId};d.push({id:s.DeleteConditionalRuleMutation.id,params:S}),f.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,S))}}),{undos:f,redos:d}},r={id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,a)=>{if(a===le.APPLY_TYPE.COPY||a===le.APPLY_TYPE.ONLY_FORMAT||a===le.APPLY_TYPE.SERIES){const{source:c,target:l}=o;return n(c,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Jt=jf([u.OnLifecycle(u.LifecycleStages.Rendered,Jt),Tt(0,u.Inject(u.Injector)),Tt(1,u.Inject(u.IUniverInstanceService)),Tt(2,u.Inject(le.IAutoFillService)),Tt(3,u.Inject(s.ConditionalFormattingRuleModel)),Tt(4,u.Inject(s.ConditionalFormattingViewModel))],Jt);var $f=Object.defineProperty,Lf=Object.getOwnPropertyDescriptor,Uf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Lf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&$f(t,n,o),o},vo=(e,t)=>(n,r)=>t(n,r,e);let Qt=class extends u.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(u.toDisposable(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(r!=null&&r.style&&(e!=null&&e.p)){const o=Object.keys(r==null?void 0:r.style);if(o.length>0){const i=s.getStringFromDataStream(e.p),a={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};o.forEach(l=>{delete a[l]});const c={...e,s:{...a},v:i};return delete c.p,n(c)}}return n(e)}})))}};Qt=Uf([u.OnLifecycle(u.LifecycleStages.Rendered,Qt),vo(0,u.Inject(le.IEditorBridgeService)),vo(1,u.Inject(s.ConditionalFormattingService))],Qt);var Vf=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,Af=(e,t,n,r)=>{for(var o=r>1?void 0:r?zf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Vf(t,n,o),o},It=(e,t)=>(n,r)=>t(n,r,e);exports.ConditionalFormattingClearController=class extends u.Disposable{constructor(t,n,r,o,i){super(),this._injector=t,this._univerInstanceService=n,this._sheetInterceptorService=r,this._selectionManagerService=o,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{var i;const n=[],r=[],o={redos:n,undos:r};if([L.ClearSelectionFormatCommand.id,L.ClearSelectionAllCommand.id].includes(t.id)){const a=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(f=>f.range);if(!a)return o;const c=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),l=c.getActiveSheet();if(!l)return o;const d=this._conditionalFormattingRuleModel.getSubunitRules(c.getUnitId(),l.getSheetId());if(!d||!d.length)return o;d.filter(f=>a.some(m=>f.ranges.some(h=>u.Rectangle.getIntersects(h,m)))).forEach(f=>{const h=new L.RangeMergeUtil().add(...f.ranges).subtract(...a).merge();if(h.length){const v={id:s.SetConditionalRuleMutation.id,params:{unitId:c.getUnitId(),subUnitId:l.getSheetId(),rule:{...f,ranges:h}}},y=s.setConditionalRuleMutationUndoFactory(this._injector,v.params);n.push(v),r.push(...y)}else{const v={id:s.DeleteConditionalRuleMutation.id,params:{unitId:c.getUnitId(),subUnitId:l.getSheetId(),cfId:f.cfId}},y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,v.params);n.push(v),r.push(...y)}})}return o}}))}};exports.ConditionalFormattingClearController=Af([u.OnLifecycle(u.LifecycleStages.Rendered,exports.ConditionalFormattingClearController),It(0,u.Inject(u.Injector)),It(1,u.Inject(u.IUniverInstanceService)),It(2,u.Inject(L.SheetInterceptorService)),It(3,u.Inject(L.SheetsSelectionsService)),It(4,u.Inject(s.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);var Mi=Object.defineProperty,Hf=Object.getOwnPropertyDescriptor,Wf=(e,t,n)=>t in e?Mi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Hf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Mi(t,n,o),o},yo=(e,t)=>(n,r)=>t(n,r,e),Fi=(e,t,n)=>Wf(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsConditionalFormattingUIPlugin=class extends u.Plugin{constructor(t={},n,r){super(),this._config=t,this._injector=n,this._commandService=r,this._config=u.Tools.deepMerge({},Ei,this._config),this._initCommand(),this._injector.add([Et]),this._injector.add([Pt]),this._injector.add([Dt]),this._injector.add([Jt]),this._injector.add([Mt]),this._injector.add([ht,{useFactory:()=>this._injector.createInstance(ht,this._config)}]),this._injector.add([pt]),this._injector.add([Qt]),this._injector.add([exports.ConditionalFormattingClearController])}_initCommand(){[Jn,Qn,er,tr,nr,rr,or,ir,ar,On,Nt,Rn,bn,Ht,an,Lt].forEach(t=>{this._commandService.registerCommand(t)})}};Fi(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);Fi(exports.UniverSheetsConditionalFormattingUIPlugin,"type",u.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=kf([u.DependentOn(s.UniverSheetsConditionalFormattingPlugin),yo(1,u.Inject(u.Injector)),yo(2,u.Inject(u.ICommandService))],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=Jn;exports.AddCfCommand=Ht;exports.AddColorScaleConditionalRuleCommand=Qn;exports.AddDataBarConditionalRuleCommand=er;exports.AddDuplicateValuesCfCommand=tr;exports.AddNumberCfCommand=nr;exports.AddRankCfCommand=rr;exports.AddTextCfCommand=or;exports.AddTimePeriodCfCommand=ir;exports.AddUniqueValuesCfCommand=ar;exports.ClearRangeCfCommand=an;exports.ClearWorksheetCfCommand=Lt;exports.DeleteCfCommand=Nt;exports.MoveCfCommand=bn;exports.OpenConditionalFormattingOperator=On;exports.SetCfCommand=Rn;
|