@univerjs/sheets-filter-ui 0.2.2 → 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/umd/index.js CHANGED
@@ -1,9 +1,9 @@
1
- (function(P,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/sheets-filter"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render"),require("@univerjs/design"),require("@univerjs/sheets"),require("react"),require("@wendellhu/redi/react-bindings"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/sheets-filter","@univerjs/ui","rxjs","@univerjs/sheets-ui","@univerjs/engine-render","@univerjs/design","@univerjs/sheets","react","@wendellhu/redi/react-bindings","react-dom"],m):(P=typeof globalThis<"u"?globalThis:P||self,m(P.UniverSheetsFilterUi={},P.UniverCore,P["@wendellhu/redi"],P.UniverSheetsFilter,P.UniverUi,P.rxjs,P.UniverSheetsUi,P.UniverEngineRender,P.UniverDesign,P.UniverSheets,P.React,P["@wendellhu/redi/react-bindings"],P.ReactDOM))})(this,function(P,m,M,f,$,N,oe,Re,G,Y,h,Me,nt){"use strict";var Lo=Object.defineProperty;var $o=(P,m,M)=>m in P?Lo(P,m,{enumerable:!0,configurable:!0,writable:!0,value:M}):P[m]=M;var A=(P,m,M)=>$o(P,typeof m!="symbol"?m+"":m,M);function cn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const p=cn(h);var se=function(){return se=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},se.apply(this,arguments)},fn=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},ir=h.forwardRef(function(e,t){var r=e.icon,n=e.id,o=e.className,a=e.extend,i=fn(e,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),l=h.useRef("_".concat(mn()));return or(r,"".concat(n),{defIds:r.defIds,idSuffix:l.current},se({ref:t,className:s},i),a)});function or(e,t,r,n,o){return h.createElement(e.tag,se(se({key:t},hn(e,r,o)),n),(dn(e,r).children||[]).map(function(a,i){return or(a,"".concat(t,"-").concat(e.tag,"-").concat(i),r,void 0,o)}))}function hn(e,t,r){var n=se({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(a){var i=a[0],s=a[1];typeof s=="string"&&(n[i]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function dn(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?se(se({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?se(se({},o),{attrs:se(se({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function mn(){return Math.random().toString(36).substring(2,8)}ir.displayName="UniverIcon";var vn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.32182 2.60967C2.98161 2.60967 2.79671 3.0074 3.01601 3.2675L6.85819 7.8246C6.94943 7.93282 6.99947 8.06981 6.99947 8.21136V12.7338C6.99947 12.898 7.0998 13.0455 7.2525 13.1058L8.73833 13.6928C9.00085 13.7965 9.28531 13.6031 9.28531 13.3208V8.21136C9.28531 8.06981 9.33535 7.93282 9.42659 7.8246L13.2688 3.2675C13.4881 3.0074 13.3032 2.60967 12.963 2.60967H3.32182ZM2.09858 4.04101C1.22139 3.0006 1.96097 1.40967 3.32182 1.40967H12.963C14.3238 1.40967 15.0634 3.0006 14.1862 4.04101L10.4853 8.43054V13.3208C10.4853 14.4498 9.34747 15.2237 8.29742 14.8089L6.81158 14.2219C6.20078 13.9806 5.79947 13.3905 5.79947 12.7338V8.43054L2.09858 4.04101Z",fillRule:"evenodd",clipRule:"evenodd"}}]},sr=h.forwardRef(function(e,t){return h.createElement(ir,Object.assign({},e,{id:"filter-single",ref:t,icon:vn}))});sr.displayName="FilterSingle";const Fe={id:"sheet.command.smart-toggle-filter",type:m.CommandType.COMMAND,handler:async e=>{const t=e.get(m.IUniverInstanceService),r=e.get(f.SheetsFilterService),n=e.get(m.ICommandService),o=e.get(m.IUndoRedoService),a=t.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET),i=a==null?void 0:a.getActiveSheet();if(!i||!a)return!1;const s=a.getUnitId(),l=i.getSheetId(),u=r.getFilterModel(s,l);if(u){const g=u==null?void 0:u.serialize(),C=pn(s,l,g),b=n.syncExecuteCommand(f.RemoveSheetsFilterMutation.id,{unitId:s,subUnitId:l});return b&&o.pushUndoRedo({unitID:s,undoMutations:C,redoMutations:[{id:f.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}]}),b}const v=e.get(Y.SelectionManagerService).getLast();if(!v)return!1;const _=v.range,d=Y.isSingleCellSelection(v)?oe.expandToContinuousRange(_,{left:!0,right:!0,up:!0,down:!0},i):_;if(d.endRow===d.startRow){const g=e.get($.IMessageService,M.Quantity.OPTIONAL),C=e.get(m.LocaleService);return g==null||g.show({type:G.MessageType.Warning,content:C.t("sheets-filter.command.not-valid-filter-range")}),!1}const E={id:f.SetSheetsFilterRangeMutation.id,params:{unitId:s,subUnitId:l,range:d}},S=n.syncExecuteCommand(E.id,E.params);return S&&o.pushUndoRedo({unitID:s,undoMutations:[{id:f.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}],redoMutations:[E]}),S}},Pe={id:"sheet.command.set-filter-criteria",type:m.CommandType.COMMAND,handler:async(e,t)=>{const r=e.get(f.SheetsFilterService),n=e.get(m.ICommandService),o=e.get(m.IUndoRedoService),{unitId:a,subUnitId:i,col:s,criteria:l}=t,u=r.getFilterModel(a,i);if(!u)return!1;const c=u.getRange();if(!c||s<c.startColumn||s>c.endColumn)return!1;const v=u.getFilterColumn(s),_=Sn(a,i,s,v),d={id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:a,subUnitId:i,col:s,criteria:l}},E=n.syncExecuteCommand(d.id,d.params);return E&&o.pushUndoRedo({unitID:a,undoMutations:[_],redoMutations:[d]}),E}},Lt={id:"sheet.command.clear-filter-criteria",type:m.CommandType.COMMAND,handler:e=>{const t=e.get(f.SheetsFilterService),r=e.get(m.IUndoRedoService),n=e.get(m.ICommandService),o=t.activeFilterModel;if(!o)return!1;const{unitId:a,subUnitId:i}=o,s=o.serialize(),l=ar(a,i,s),u=_n(a,i,s);return m.sequenceExecute(u,n)&&r.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:u}),!0}},$t={id:"sheet.command.re-calc-filter",type:m.CommandType.COMMAND,handler:e=>{const t=e.get(f.SheetsFilterService),r=e.get(m.ICommandService),n=t.activeFilterModel;if(!n)return!1;const{unitId:o,subUnitId:a}=n;return r.executeCommand(f.ReCalcSheetsFilterMutation.id,{unitId:o,subUnitId:a})}};function pn(e,t,r){const n=[],o={id:f.SetSheetsFilterRangeMutation.id,params:{unitId:e,subUnitId:t,range:r.ref}};return n.push(o),ar(e,t,r).forEach(i=>n.push(i)),n}function ar(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:a}};n.push(i)}),n}function _n(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:null}};n.push(i)}),n}function Sn(e,t,r,n){if(!n)return{id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:null}};const o=n.serialize();return{id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:o}}}var V=(e=>(e[e.FIRST=0]="FIRST",e[e.SECOND=1]="SECOND",e))(V||{}),w=(e=>(e.NONE="none",e.STARTS_WITH="startsWith",e.DOES_NOT_START_WITH="doesNotStartWith",e.ENDS_WITH="endsWith",e.DOES_NOT_END_WITH="doesNotEndWith",e.CONTAINS="contains",e.DOES_NOT_CONTAIN="doesNotContain",e.EQUALS="equals",e.NOT_EQUALS="notEquals",e.EMPTY="empty",e.NOT_EMPTY="notEmpty",e.BETWEEN="between",e.NOT_BETWEEN="notBetween",e.CUSTOM="custom",e))(w||{}),T;(e=>{e.NONE={label:"sheets-filter.conditions.none",operator:w.NONE,order:V.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===w.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},e.EMPTY={label:"sheets-filter.conditions.empty",operator:w.EMPTY,order:V.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===w.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:""}]}}),testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===""&&s.operator===void 0?{operator1:w.EMPTY}:!1}},e.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:w.NOT_EMPTY,order:V.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===w.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:"",operator:f.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===" "&&s.operator===f.CustomFilterOperator.NOT_EQUALS?{operator1:w.NOT_EMPTY}:!1}},e.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:w.CONTAINS,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:w.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===w.CONTAINS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:`*${s}*`}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.startsWith("*")&&l.endsWith("*")?{operator1:w.CONTAINS,val1:l.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:w.DOES_NOT_CONTAIN,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:w.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:f.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=de(i);return s===w.DOES_NOT_CONTAIN},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return s.operator===f.CustomFilterOperator.NOT_EQUALS&&l.startsWith("*")&&l.endsWith("*")?{operator1:w.DOES_NOT_CONTAIN,val1:l.slice(1,-1)}:!1}},e.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:w.STARTS_WITH,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:w.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=de(i);return s===w.STARTS_WITH},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.endsWith("*")&&!l.startsWith("*")?{operator1:w.STARTS_WITH,val1:l.slice(0,-1)}:!1}},e.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:w.ENDS_WITH,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:w.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=de(i);return s===w.ENDS_WITH},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.startsWith("*")&&!l.endsWith("*")?{operator1:w.ENDS_WITH,val1:l.slice(1)}:!1}},e.EQUALS={label:"sheets-filter.conditions.equals",operator:w.EQUALS,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:w.EQUALS,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===w.EQUALS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:s}]}}},testMappingFilterColumn:i=>{var s,l,u;return((l=(s=i.filters)==null?void 0:s.filters)==null?void 0:l.length)===1?{operator1:w.EQUALS,val1:""}:((u=i.customFilters)==null?void 0:u.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:w.EQUALS,val1:i.customFilters.customFilters[0].val.toString()}:!1}},e.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:f.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.GREATER_THAN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:i=>{const[s]=de(i);return s===f.CustomFilterOperator.GREATER_THAN},testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.GREATER_THAN?!1:{operator1:f.CustomFilterOperator.GREATER_THAN,val1:s.val.toString()}}},e.GREATER_THAN_OR_EQUAL={label:"sheets-filter.conditions.greater-than-or-equal",operator:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===f.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.GREATER_THAN_OR_EQUAL?!1:{operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString()}}},e.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:f.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.LESS_THAN,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===f.CustomFilterOperator.LESS_THAN},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.LESS_THAN}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.LESS_THAN?!1:{operator1:f.CustomFilterOperator.LESS_THAN,val1:s.val.toString()}}},e.LESS_THAN_OR_EQUAL={label:"sheets-filter.conditions.less-than-or-equal",operator:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===f.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.LESS_THAN_OR_EQUAL?!1:{operator1:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:s.val.toString()}}},e.EQUAL={label:"sheets-filter.conditions.equal",operator:f.CustomFilterOperator.EQUAL,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.EQUAL,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===f.CustomFilterOperator.EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.EQUAL?!1:{operator1:f.CustomFilterOperator.EQUAL,val1:s.val.toString()}}},e.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:f.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.NOT_EQUALS,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===f.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.NOT_EQUALS?!1:{operator1:f.CustomFilterOperator.NOT_EQUALS,val1:s.val.toString()}}},e.BETWEEN={label:"sheets-filter.conditions.between",operator:w.BETWEEN,order:V.SECOND,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:"",operator2:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(!s)return!1;const c=[l,u];return c.includes(f.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&c.includes(f.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,c=u===f.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:m.BooleanNumber.TRUE,customFilters:[{val:c?s:l,operator:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:c?l:s,operator:f.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const[s,l]=i.customFilters.customFilters;return s.operator===f.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&l.operator===f.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString(),operator2:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:l.val.toString()}:l.operator===f.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&s.operator===f.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:l.val.toString(),operator2:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:s.val.toLocaleString()}:!1}},e.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:w.NOT_BETWEEN,order:V.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.LESS_THAN,val1:"",operator2:f.CustomFilterOperator.GREATER_THAN,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(s)return!1;const c=[l,u];return c.includes(f.CustomFilterOperator.GREATER_THAN)&&c.includes(f.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,c=u===f.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:c?s:l,operator:f.CustomFilterOperator.GREATER_THAN},{val:c?l:s,operator:f.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const[s,l]=i.customFilters.customFilters;return s.operator===f.CustomFilterOperator.LESS_THAN&&l.operator===f.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:f.CustomFilterOperator.LESS_THAN,val1:s.val.toString(),operator2:f.CustomFilterOperator.GREATER_THAN,val2:l.val.toString()}:l.operator===f.CustomFilterOperator.LESS_THAN&&s.operator===f.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:f.CustomFilterOperator.GREATER_THAN,val1:l.val.toString(),operator2:f.CustomFilterOperator.LESS_THAN,val2:s.val.toLocaleString()}:!1}},e.CUSTOM={label:"sheets-filter.conditions.custom",operator:w.CUSTOM,order:V.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:w.NONE,val1:"",operator2:w.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:l,val2:u,operator1:c,operator2:v}=i;function _(b,R){for(const I of e.ALL_CONDITIONS)if(I.operator===b)return I.mapToFilterColumn({val1:R,operator1:b})}const d=!c||c===e.NONE.operator,E=!v||v===e.NONE.operator;if(d&&E)return e.NONE.mapToFilterColumn({});if(d)return _(v,u);if(E)return _(c,l);const S=_(c,l),g=_(v,u),C={customFilters:[S.customFilters.customFilters[0],g.customFilters.customFilters[0]]};return s&&(C.and=m.BooleanNumber.TRUE),{customFilters:C}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const s=i.customFilters.customFilters.map(c=>a({customFilters:{customFilters:[c]}})),l={operator1:s[0][0].operator,val1:s[0][1].val1,operator2:s[1][0].operator,val2:s[1][1].val1};return i.customFilters.and&&(l.and=!0),l}},e.ALL_CONDITIONS=[e.NONE,e.EMPTY,e.NOT_EMPTY,e.TEXT_CONTAINS,e.DOES_NOT_CONTAIN,e.STARTS_WITH,e.ENDS_WITH,e.EQUALS,e.GREATER_THAN,e.GREATER_THAN_OR_EQUAL,e.LESS_THAN,e.LESS_THAN_OR_EQUAL,e.EQUAL,e.NOT_EQUAL,e.BETWEEN,e.NOT_BETWEEN,e.CUSTOM];function t(i){const s=e.ALL_CONDITIONS.find(l=>l.operator===i);if(!s)throw new Error(`[SheetsFilter]: no condition item found for operator: ${i}`);return s}e.getItemByOperator=t;function r(i,s){for(const l of e.ALL_CONDITIONS.filter(u=>u.numOfParameters===s))if(l.numOfParameters!==0&&l.testMappingParams(i))return l;for(const l of e.ALL_CONDITIONS)if(l.testMappingParams(i))return l;throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!")}e.testMappingParams=r;function n(i){const s=e.ALL_CONDITIONS.find(l=>l.operator===i);return(s==null?void 0:s.numOfParameters)===0?{operator1:s.operator}:s.getDefaultFormParams()}e.getInitialFormParams=n;function o(i,s){return i.mapToFilterColumn(s)}e.mapToFilterColumn=o;function a(i){if(!i)return[e.NONE,{}];for(const s of e.ALL_CONDITIONS){const l=s.testMappingFilterColumn(i);if(l)return[s,l]}return[e.NONE,{}]}e.testMappingFilterColumn=a})(T||(T={}));function de(e){const{operator1:t,operator2:r,val1:n,val2:o}=e;if(t&&r)throw new Error("Both operator1 and operator2 are set!");if(!t&&!r)throw new Error("Neither operator1 and operator2 and both not set!");return t?[t,n]:[r,o]}function Dt(e){const t=[],r=[];for(const n of e)n.checked?t.push(n):r.push(n);return{checkedItems:t,uncheckedItems:r,checked:t.length,unchecked:r.length}}var gn=Object.defineProperty,En=Object.getOwnPropertyDescriptor,Ut=(e,t,r,n)=>{for(var o=n>1?void 0:n?En(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&gn(t,r,o),o},Ne=(e,t)=>(r,n)=>t(r,n,e),it=(e=>(e[e.VALUES=0]="VALUES",e[e.CONDITIONS=1]="CONDITIONS",e))(it||{});M.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let be=class extends m.Disposable{constructor(t,r,n,o){super();A(this,"_filterBy$",new N.BehaviorSubject(0));A(this,"filterBy$",this._filterBy$.asObservable());A(this,"_filterByModel$",new N.ReplaySubject(1));A(this,"filterByModel$",this._filterByModel$.asObservable());A(this,"_filterByModel",null);A(this,"_hasCriteria$",new N.BehaviorSubject(!1));A(this,"hasCriteria$",this._hasCriteria$.asObservable());A(this,"_filterModel",null);A(this,"_col$",new N.BehaviorSubject(-1));A(this,"col$",this._col$.asObservable());A(this,"_filterHeaderListener",null);this._injector=t,this._sheetsFilterService=r,this._univerInstanceService=n,this._refRangeService=o}get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(t){this._filterByModel=t,this._filterByModel$.next(t)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(t,r){this.terminate(),this._filterModel=t,this._col$.next(r);const n=t.getFilterColumn(r);if(n){const o=n.getColumnData();return o.customFilters?(this._hasCriteria$.next(!0),this._setupByConditions(t,r)):o.filters?(this._hasCriteria$.next(!0),this._setupByValues(t,r)):(this._hasCriteria$.next(!1),this._setupByValues(t,r))}return this._hasCriteria$.next(!1),this._setupByValues(t,r)}changeFilterBy(t){return!this._filterModel||this.col===-1?!1:(t===0?this._setupByValues(this._filterModel,this.col):this._setupByConditions(this._filterModel,this.col),!0)}terminate(){return this._filterModel=null,this._col$.next(-1),this._disposeFilterHeaderChangeListener(),!0}_disposeFilterHeaderChangeListener(){var t;(t=this._filterHeaderListener)==null||t.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(t,r){this._disposeFilterHeaderChangeListener();const n=t.unitId,o=t.subUnitId,a=t.getRange(),i={startColumn:r,startRow:a.startRow,endRow:a.startRow,endColumn:r};this._filterHeaderListener=this._refRangeService.watchRange(n,o,i,(s,l)=>{if(!l)this.terminate();else{const u=l.startColumn-s.startColumn;u!==0&&this._filterByModel.deltaCol(u)}})}_setupByValues(t,r){this._disposePreviousModel();const n=t.getRange();if(n.startRow===n.endRow)return!1;const o=st.fromFilterColumn(this._injector,t,r);return this.filterByModel=o,this._filterBy$.next(0),this._listenToFilterHeaderChange(t,r),!0}_setupByConditions(t,r){this._disposePreviousModel();const n=t.getRange();if(n.startRow===n.endRow)return!1;const o=ot.fromFilterColumn(this._injector,t,r,t.getFilterColumn(r));return this.filterByModel=o,this._filterBy$.next(1),this._listenToFilterHeaderChange(t,r),!0}_disposePreviousModel(){var t;(t=this._filterByModel)==null||t.dispose(),this.filterByModel=null}};be=Ut([Ne(0,M.Inject(M.Injector)),Ne(1,M.Inject(f.SheetsFilterService)),Ne(2,m.IUniverInstanceService),Ne(3,M.Inject(Y.RefRangeService))],be);let ot=class extends m.Disposable{constructor(t,r,n,o,a){super();A(this,"canApply$",N.of(!0));A(this,"_conditionItem$");A(this,"conditionItem$");A(this,"_filterConditionFormParams$");A(this,"filterConditionFormParams$");this._filterModel=t,this.col=r,this._commandService=a,this._conditionItem$=new N.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new N.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(t,r,n,o){const[a,i]=T.testMappingFilterColumn(o==null?void 0:o.getColumnData());return t.createInstance(ot,r,n,a,i)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(t){this.col+=t}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(Pe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=T.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(Pe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:t})}onPrimaryConditionChange(t){const r=T.ALL_CONDITIONS.find(n=>n.operator===t);if(!r)throw new Error(`[ByConditionsModel]: condition item not found for operator: ${t}!`);this._conditionItem$.next(r),this._filterConditionFormParams$.next(T.getInitialFormParams(t))}onConditionFormChange(t){const r={...this.filterConditionFormParams,...t};if(r.and!==!0&&delete r.and,typeof t.and<"u"||typeof t.operator1<"u"||typeof t.operator2<"u"){const n=T.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(r)}};ot=Ut([Ne(4,m.ICommandService)],ot);let st=class extends m.Disposable{constructor(t,r,n,o){super();A(this,"_rawFilterItems$");A(this,"rawFilterItems$");A(this,"filterItems$");A(this,"_filterItems",[]);A(this,"canApply$");A(this,"_manuallyUpdateFilterItems$");A(this,"_searchString$");A(this,"searchString$");this._filterModel=t,this.col=r,this._commandService=o,this._searchString$=new N.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new N.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new N.Subject,this.filterItems$=N.merge(N.combineLatest([this._searchString$.pipe(N.throttleTime(500,void 0,{leading:!0,trailing:!0}),N.startWith(void 0)),this._rawFilterItems$]).pipe(N.map(([a,i])=>{if(!a)return i;const l=a.toLowerCase().split(/\s+/).filter(u=>!!u);return i.filter(u=>{const c=u.value.toLowerCase();return l.some(v=>c.includes(v))})})),this._manuallyUpdateFilterItems$).pipe(N.shareReplay(1)),this.canApply$=this.filterItems$.pipe(N.map(a=>Dt(a).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(a=>this._filterItems=a))}static fromFilterColumn(t,r,n){var U;const o=t.get(m.IUniverInstanceService),a=t.get(m.LocaleService),{unitId:i,subUnitId:s}=r,l=o.getUniverSheetInstance(i);if(!l)throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${i}!`);const u=l==null?void 0:l.getSheetBySheetId(s);if(!u)throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${i} and subUnitId: ${s}!`);const c=r.getRange(),v=n,_=(U=r.getFilterColumn(n))==null?void 0:U.getColumnData().filters,d=!!(_&&_.blank),E={...c,startRow:c.startRow+1,startColumn:v,endColumn:v},S=[],g={},C=new Set(_==null?void 0:_.filters),b=r.getFilteredOutRowsExceptCol(n);let R=0,I=0;for(const F of u.iterateByColumn(E,!1,!1)){const{row:H,rowSpan:x=1}=F;let z=0;for(;z<x;){const ee=H+z;if(b.has(ee)){z++;continue}const K=F!=null&&F.value?m.extractPureTextFromCell(F.value):"";if(!K){I+=1,z+=x;continue}if(g[K])g[K].count++;else{const ce={value:K,checked:C.size?C.has(K):!d,count:1,index:R,isEmpty:!1};g[K]=ce,S.push(ce)}z++}R++}const k=_?d:!0;if(I>0){const F={value:a.t("sheets-filter.panel.empty"),checked:k,count:I,index:R,isEmpty:!0};S.push(F)}return t.createInstance(st,r,n,S)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(t){this.col+=t}setSearchString(t){this._searchString$.next(t)}onFilterCheckToggled(t,r){const n=this._filterItems.slice(),o=n.find(a=>a.index===t.index);o.checked=r,this._manuallyUpdateFilterItems(n)}onFilterOnly(t){const r=this._filterItems.slice();r.forEach(n=>n.checked=n.index===t.index),this._manuallyUpdateFilterItems(r)}onCheckAllToggled(t){const r=this._filterItems.slice();r.forEach(n=>n.checked=t),this._manuallyUpdateFilterItems(r)}_manuallyUpdateFilterItems(t){this._manuallyUpdateFilterItems$.next(t)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(Pe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=Dt(this._filterItems),{checked:r,checkedItems:n}=t,o=this.rawFilterItems,a=r===0,i=t.checked===o.length,s={colId:this.col};if(a)throw new Error("[ByValuesModel]: no checked items!");if(i)return this._commandService.executeCommand(Pe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{s.filters={};const l=n.filter(c=>!c.isEmpty);l.length>0&&(s.filters={filters:l.map(c=>c.value)}),l.length!==n.length&&(s.filters.blank=!0)}return this._commandService.executeCommand(Pe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:s})}};st=Ut([Ne(3,m.ICommandService)],st);const we="FILTER_PANEL_OPENED",We={id:"sheet.operation.open-filter-panel",type:m.CommandType.OPERATION,handler:(e,t)=>{const r=e.get(m.IContextService),n=e.get(f.SheetsFilterService),o=e.get(be);e.get(m.ICommandService).syncExecuteCommand(oe.SetCellEditVisibleOperation.id,{visible:!1});const{unitId:i,subUnitId:s,col:l}=t,u=n.getFilterModel(i,s);return!u||!o.setupCol(u,l)?!1:(r.getContextValue(we)||r.setContextValue(we,!0),!0)}},Ae={id:"sheet.operation.close-filter-panel",type:m.CommandType.OPERATION,handler:e=>{const t=e.get(m.IContextService),r=e.get(be),n=e.get($.ILayoutService,M.Quantity.OPTIONAL);return t.getContextValue(we)?(t.setContextValue(we,!1),n==null||n.focus(),r.terminate()):!1}},Ht={id:"sheet.operation.apply-filter",type:m.CommandType.OPERATION,handler:(e,t)=>{const{filterBy:r}=t;return e.get(be).changeFilterBy(r)}},j={sheetsFilterPanel:"univer-sheets-filter-panel",sheetsFilterPanelHeader:"univer-sheets-filter-panel-header",sheetsFilterPanelContent:"univer-sheets-filter-panel-content",sheetsFilterPanelSelectAll:"univer-sheets-filter-panel-select-all",sheetsFilterPanelSelectAllCount:"univer-sheets-filter-panel-select-all-count",sheetsFilterPanelValuesContainer:"univer-sheets-filter-panel-values-container",inputAffixWrapper:"univer-input-affix-wrapper",select:"univer-select",radioGroup:"univer-radio-group",sheetsFilterPanelValuesFind:"univer-sheets-filter-panel-values-find",sheetsFilterPanelValuesList:"univer-sheets-filter-panel-values-list",sheetsFilterPanelValuesListInnerContainer:"univer-sheets-filter-panel-values-list-inner-container",sheetsFilterPanelValuesVirtual:"univer-sheets-filter-panel-values-virtual",sheetsFilterPanelValuesItem:"univer-sheets-filter-panel-values-item",sheetsFilterPanelValuesItemInner:"univer-sheets-filter-panel-values-item-inner",sheetsFilterPanelValuesItemCount:"univer-sheets-filter-panel-values-item-count",sheetsFilterPanelValuesItemExcludeButton:"univer-sheets-filter-panel-values-item-exclude-button",sheetsFilterPanelValuesItemText:"univer-sheets-filter-panel-values-item-text",sheetsFilterPanelConditionsContainer:"univer-sheets-filter-panel-conditions-container",sheetsFilterPanelConditionsContainerInner:"univer-sheets-filter-panel-conditions-container-inner",sheetsFilterPanelConditionsDesc:"univer-sheets-filter-panel-conditions-desc",sheetsFilterPanelFooter:"univer-sheets-filter-panel-footer",sheetsFilterPanelFooterPrimaryButtons:"univer-sheets-filter-panel-footer-primary-buttons",button:"univer-button",input:"univer-input",formDualColumnLayout:"univer-form-dual-column-layout"};function bn(e){const{model:t}=e,r=Me.useDependency(m.LocaleService),n=$.useObservable(t.conditionItem$,void 0,!0),o=$.useObservable(t.filterConditionFormParams$,void 0,!0),{operator:a,numOfParameters:i}=n,{operator1:s,operator2:l,val1:u,val2:c,and:v}=o,_=v?"AND":"OR",d=h.useCallback(I=>{t.onConditionFormChange({and:I==="AND"})},[t]),E=yn(r),S=h.useCallback(I=>{t.onPrimaryConditionChange(I)},[t]),g=Cn(r),C=h.useCallback(I=>{t.onConditionFormChange(I)},[t]),b=r.t("sheets-filter.panel.input-values-placeholder");function R(I,k,U){const F=T.getItemByOperator(I).numOfParameters===1;return h.createElement(h.Fragment,null,U==="operator2"&&h.createElement(G.RadioGroup,{value:_,onChange:d},h.createElement(G.Radio,{value:"AND"},r.t("sheets-filter.panel.and")),h.createElement(G.Radio,{value:"OR"},r.t("sheets-filter.panel.or"))),h.createElement(G.Select,{value:I,options:g,onChange:H=>C({[U]:H})}),F&&h.createElement(G.Input,{value:k,placeholder:b,onChange:H=>C({[U==="operator1"?"val1":"val2"]:H})}))}return h.createElement("div",{className:j.sheetsFilterPanelConditionsContainer},h.createElement(G.Select,{value:a,options:E,onChange:S}),T.getItemByOperator(a).numOfParameters!==0?h.createElement("div",{className:j.sheetsFilterPanelConditionsContainerInner},i>=1&&R(s,u!=null?u:"","operator1"),i>=2&&R(l,c!=null?c:"","operator2"),h.createElement("div",{className:j.sheetsFilterPanelConditionsDesc},r.t("sheets-filter.panel.?"),h.createElement("br",null),r.t("sheets-filter.panel.*"))):null)}function yn(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{options:[{label:e.t(T.NONE.label),value:T.NONE.operator}]},{options:[{label:e.t(T.EMPTY.label),value:T.EMPTY.operator},{label:e.t(T.NOT_EMPTY.label),value:T.NOT_EMPTY.operator}]},{options:[{label:e.t(T.TEXT_CONTAINS.label),value:T.TEXT_CONTAINS.operator},{label:e.t(T.DOES_NOT_CONTAIN.label),value:T.DOES_NOT_CONTAIN.operator},{label:e.t(T.STARTS_WITH.label),value:T.STARTS_WITH.operator},{label:e.t(T.ENDS_WITH.label),value:T.ENDS_WITH.operator},{label:e.t(T.EQUALS.label),value:T.EQUALS.operator}]},{options:[{label:e.t(T.GREATER_THAN.label),value:T.GREATER_THAN.operator},{label:e.t(T.GREATER_THAN_OR_EQUAL.label),value:T.GREATER_THAN_OR_EQUAL.operator},{label:e.t(T.LESS_THAN.label),value:T.LESS_THAN.operator},{label:e.t(T.LESS_THAN_OR_EQUAL.label),value:T.LESS_THAN_OR_EQUAL.operator},{label:e.t(T.EQUAL.label),value:T.EQUAL.operator},{label:e.t(T.NOT_EQUAL.label),value:T.NOT_EQUAL.operator},{label:e.t(T.BETWEEN.label),value:T.BETWEEN.operator},{label:e.t(T.NOT_BETWEEN.label),value:T.NOT_BETWEEN.operator}]},{options:[{label:e.t(T.CUSTOM.label),value:T.CUSTOM.operator}]}],[t,e])}function Cn(e){const t=e.getCurrentLocale();return h.useMemo(()=>T.ALL_CONDITIONS.filter(r=>r.numOfParameters!==2).map(r=>({label:e.t(r.label),value:r.operator})),[t,e])}function je(){return je=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},je.apply(null,arguments)}function ae(e){"@babel/helpers - typeof";return ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ae(e)}function On(e,t){if(ae(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ae(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lr(e){var t=On(e,"string");return ae(t)=="symbol"?t:t+""}function J(e,t,r){return(t=lr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ur(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ur(Object(r),!0).forEach(function(n){J(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ur(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tn(e){if(Array.isArray(e))return e}function Fn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(c){u=!0,o=c}finally{try{if(!l&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return s}}function cr(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Pn(e,t){if(e){if(typeof e=="string")return cr(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?cr(e,t):void 0}}function In(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X(e,t){return Tn(e)||Fn(e,t)||Pn(e,t)||In()}function Rn(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Mn(e,t){if(e==null)return{};var r,n,o=Rn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Nn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fr={exports:{}};/*!
1
+ (function(R,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@univerjs/sheets-filter"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render"),require("@univerjs/design"),require("@univerjs/sheets"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-filter","@univerjs/ui","rxjs","@univerjs/sheets-ui","@univerjs/engine-render","@univerjs/design","@univerjs/sheets","react","react-dom"],c):(R=typeof globalThis<"u"?globalThis:R||self,c(R.UniverSheetsFilterUi={},R.UniverCore,R.UniverSheetsFilter,R.UniverUi,R.rxjs,R.UniverSheetsUi,R.UniverEngineRender,R.UniverDesign,R.UniverSheets,R.React,R.ReactDOM))})(this,function(R,c,f,L,N,ie,Ie,Q,G,d,tt){"use strict";var wo=Object.defineProperty;var Ao=(R,c,f)=>c in R?wo(R,c,{enumerable:!0,configurable:!0,writable:!0,value:f}):R[c]=f;var w=(R,c,f)=>Ao(R,typeof c!="symbol"?c+"":c,f);function ln(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const p=ln(d);var oe=function(){return oe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},oe.apply(this,arguments)},un=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},rr=d.forwardRef(function(e,t){var r=e.icon,n=e.id,o=e.className,a=e.extend,i=un(e,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),l=d.useRef("_".concat(hn()));return nr(r,"".concat(n),{defIds:r.defIds,idSuffix:l.current},oe({ref:t,className:s},i),a)});function nr(e,t,r,n,o){return d.createElement(e.tag,oe(oe({key:t},cn(e,r,o)),n),(fn(e,r).children||[]).map(function(a,i){return nr(a,"".concat(t,"-").concat(e.tag,"-").concat(i),r,void 0,o)}))}function cn(e,t,r){var n=oe({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(a){var i=a[0],s=a[1];typeof s=="string"&&(n[i]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function fn(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?oe(oe({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?oe(oe({},o),{attrs:oe(oe({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function hn(){return Math.random().toString(36).substring(2,8)}rr.displayName="UniverIcon";var dn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.32182 2.60967C2.98161 2.60967 2.79671 3.0074 3.01601 3.2675L6.85819 7.8246C6.94943 7.93282 6.99947 8.06981 6.99947 8.21136V12.7338C6.99947 12.898 7.0998 13.0455 7.2525 13.1058L8.73833 13.6928C9.00085 13.7965 9.28531 13.6031 9.28531 13.3208V8.21136C9.28531 8.06981 9.33535 7.93282 9.42659 7.8246L13.2688 3.2675C13.4881 3.0074 13.3032 2.60967 12.963 2.60967H3.32182ZM2.09858 4.04101C1.22139 3.0006 1.96097 1.40967 3.32182 1.40967H12.963C14.3238 1.40967 15.0634 3.0006 14.1862 4.04101L10.4853 8.43054V13.3208C10.4853 14.4498 9.34747 15.2237 8.29742 14.8089L6.81158 14.2219C6.20078 13.9806 5.79947 13.3905 5.79947 12.7338V8.43054L2.09858 4.04101Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ir=d.forwardRef(function(e,t){return d.createElement(rr,Object.assign({},e,{id:"filter-single",ref:t,icon:dn}))});ir.displayName="FilterSingle";const Te={id:"sheet.command.smart-toggle-filter",type:c.CommandType.COMMAND,handler:async e=>{const t=e.get(c.IUniverInstanceService),r=e.get(f.SheetsFilterService),n=e.get(c.ICommandService),o=e.get(c.IUndoRedoService),a=t.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET),i=a==null?void 0:a.getActiveSheet();if(!i||!a)return!1;const s=a.getUnitId(),l=i.getSheetId(),u=r.getFilterModel(s,l);if(u){const g=u==null?void 0:u.serialize(),C=mn(s,l,g),b=n.syncExecuteCommand(f.RemoveSheetsFilterMutation.id,{unitId:s,subUnitId:l});return b&&o.pushUndoRedo({unitID:s,undoMutations:C,redoMutations:[{id:f.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}]}),b}const v=e.get(G.SheetsSelectionsService).getCurrentLastSelection();if(!v)return!1;const _=v.range,m=G.isSingleCellSelection(v)?ie.expandToContinuousRange(_,{left:!0,right:!0,up:!0,down:!0},i):_;if(m.endRow===m.startRow){const g=e.get(L.IMessageService,c.Quantity.OPTIONAL),C=e.get(c.LocaleService);return g==null||g.show({type:Q.MessageType.Warning,content:C.t("sheets-filter.command.not-valid-filter-range")}),!1}const E={id:f.SetSheetsFilterRangeMutation.id,params:{unitId:s,subUnitId:l,range:m}},S=n.syncExecuteCommand(E.id,E.params);return S&&o.pushUndoRedo({unitID:s,undoMutations:[{id:f.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}],redoMutations:[E]}),S}},Fe={id:"sheet.command.set-filter-criteria",type:c.CommandType.COMMAND,handler:async(e,t)=>{const r=e.get(f.SheetsFilterService),n=e.get(c.ICommandService),o=e.get(c.IUndoRedoService),{unitId:a,subUnitId:i,col:s,criteria:l}=t,u=r.getFilterModel(a,i);if(!u)return!1;const h=u.getRange();if(!h||s<h.startColumn||s>h.endColumn)return!1;const v=u.getFilterColumn(s),_=pn(a,i,s,v),m={id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:a,subUnitId:i,col:s,criteria:l}},E=n.syncExecuteCommand(m.id,m.params);return E&&o.pushUndoRedo({unitID:a,undoMutations:[_],redoMutations:[m]}),E}},wt={id:"sheet.command.clear-filter-criteria",type:c.CommandType.COMMAND,handler:e=>{const t=e.get(f.SheetsFilterService),r=e.get(c.IUndoRedoService),n=e.get(c.ICommandService),o=t.activeFilterModel;if(!o)return!1;const{unitId:a,subUnitId:i}=o,s=o.serialize(),l=or(a,i,s),u=vn(a,i,s);return c.sequenceExecute(u,n)&&r.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:u}),!0}},At={id:"sheet.command.re-calc-filter",type:c.CommandType.COMMAND,handler:e=>{const t=e.get(f.SheetsFilterService),r=e.get(c.ICommandService),n=t.activeFilterModel;if(!n)return!1;const{unitId:o,subUnitId:a}=n;return r.executeCommand(f.ReCalcSheetsFilterMutation.id,{unitId:o,subUnitId:a})}};function mn(e,t,r){const n=[],o={id:f.SetSheetsFilterRangeMutation.id,params:{unitId:e,subUnitId:t,range:r.ref}};return n.push(o),or(e,t,r).forEach(i=>n.push(i)),n}function or(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:a}};n.push(i)}),n}function vn(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:null}};n.push(i)}),n}function pn(e,t,r,n){if(!n)return{id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:null}};const o=n.serialize();return{id:f.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:o}}}var j=(e=>(e[e.FIRST=0]="FIRST",e[e.SECOND=1]="SECOND",e))(j||{}),M=(e=>(e.NONE="none",e.STARTS_WITH="startsWith",e.DOES_NOT_START_WITH="doesNotStartWith",e.ENDS_WITH="endsWith",e.DOES_NOT_END_WITH="doesNotEndWith",e.CONTAINS="contains",e.DOES_NOT_CONTAIN="doesNotContain",e.EQUALS="equals",e.NOT_EQUALS="notEquals",e.EMPTY="empty",e.NOT_EMPTY="notEmpty",e.BETWEEN="between",e.NOT_BETWEEN="notBetween",e.CUSTOM="custom",e))(M||{}),T;(e=>{e.NONE={label:"sheets-filter.conditions.none",operator:M.NONE,order:j.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===M.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},e.EMPTY={label:"sheets-filter.conditions.empty",operator:M.EMPTY,order:j.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===M.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:""}]}}),testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===""&&s.operator===void 0?{operator1:M.EMPTY}:!1}},e.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:M.NOT_EMPTY,order:j.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===M.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:"",operator:f.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===" "&&s.operator===f.CustomFilterOperator.NOT_EQUALS?{operator1:M.NOT_EMPTY}:!1}},e.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:M.CONTAINS,order:j.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:M.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===M.CONTAINS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:`*${s}*`}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.startsWith("*")&&l.endsWith("*")?{operator1:M.CONTAINS,val1:l.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:M.DOES_NOT_CONTAIN,order:j.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:M.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:f.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=he(i);return s===M.DOES_NOT_CONTAIN},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return s.operator===f.CustomFilterOperator.NOT_EQUALS&&l.startsWith("*")&&l.endsWith("*")?{operator1:M.DOES_NOT_CONTAIN,val1:l.slice(1,-1)}:!1}},e.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:M.STARTS_WITH,order:j.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:M.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=he(i);return s===M.STARTS_WITH},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.endsWith("*")&&!l.startsWith("*")?{operator1:M.STARTS_WITH,val1:l.slice(0,-1)}:!1}},e.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:M.ENDS_WITH,order:j.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:M.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=he(i);return s===M.ENDS_WITH},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.startsWith("*")&&!l.endsWith("*")?{operator1:M.ENDS_WITH,val1:l.slice(1)}:!1}},e.EQUALS={label:"sheets-filter.conditions.equals",operator:M.EQUALS,order:j.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:M.EQUALS,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===M.EQUALS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:s}]}}},testMappingFilterColumn:i=>{var s,l,u;return((l=(s=i.filters)==null?void 0:s.filters)==null?void 0:l.length)===1?{operator1:M.EQUALS,val1:""}:((u=i.customFilters)==null?void 0:u.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:M.EQUALS,val1:i.customFilters.customFilters[0].val.toString()}:!1}},e.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:f.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:j.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.GREATER_THAN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:i=>{const[s]=he(i);return s===f.CustomFilterOperator.GREATER_THAN},testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.GREATER_THAN?!1:{operator1:f.CustomFilterOperator.GREATER_THAN,val1:s.val.toString()}}},e.GREATER_THAN_OR_EQUAL={label:"sheets-filter.conditions.greater-than-or-equal",operator:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:j.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===f.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.GREATER_THAN_OR_EQUAL?!1:{operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString()}}},e.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:f.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:j.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.LESS_THAN,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===f.CustomFilterOperator.LESS_THAN},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.LESS_THAN}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.LESS_THAN?!1:{operator1:f.CustomFilterOperator.LESS_THAN,val1:s.val.toString()}}},e.LESS_THAN_OR_EQUAL={label:"sheets-filter.conditions.less-than-or-equal",operator:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:j.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===f.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.LESS_THAN_OR_EQUAL?!1:{operator1:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:s.val.toString()}}},e.EQUAL={label:"sheets-filter.conditions.equal",operator:f.CustomFilterOperator.EQUAL,numOfParameters:1,order:j.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.EQUAL,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===f.CustomFilterOperator.EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.EQUAL?!1:{operator1:f.CustomFilterOperator.EQUAL,val1:s.val.toString()}}},e.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:f.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:j.FIRST,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.NOT_EQUALS,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===f.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:f.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==f.CustomFilterOperator.NOT_EQUALS?!1:{operator1:f.CustomFilterOperator.NOT_EQUALS,val1:s.val.toString()}}},e.BETWEEN={label:"sheets-filter.conditions.between",operator:M.BETWEEN,order:j.SECOND,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:"",operator2:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(!s)return!1;const h=[l,u];return h.includes(f.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&h.includes(f.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,h=u===f.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:c.BooleanNumber.TRUE,customFilters:[{val:h?s:l,operator:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:h?l:s,operator:f.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const[s,l]=i.customFilters.customFilters;return s.operator===f.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&l.operator===f.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString(),operator2:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:l.val.toString()}:l.operator===f.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&s.operator===f.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:f.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:l.val.toString(),operator2:f.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:s.val.toLocaleString()}:!1}},e.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:M.NOT_BETWEEN,order:j.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:f.CustomFilterOperator.LESS_THAN,val1:"",operator2:f.CustomFilterOperator.GREATER_THAN,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(s)return!1;const h=[l,u];return h.includes(f.CustomFilterOperator.GREATER_THAN)&&h.includes(f.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,h=u===f.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:h?s:l,operator:f.CustomFilterOperator.GREATER_THAN},{val:h?l:s,operator:f.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const[s,l]=i.customFilters.customFilters;return s.operator===f.CustomFilterOperator.LESS_THAN&&l.operator===f.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:f.CustomFilterOperator.LESS_THAN,val1:s.val.toString(),operator2:f.CustomFilterOperator.GREATER_THAN,val2:l.val.toString()}:l.operator===f.CustomFilterOperator.LESS_THAN&&s.operator===f.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:f.CustomFilterOperator.GREATER_THAN,val1:l.val.toString(),operator2:f.CustomFilterOperator.LESS_THAN,val2:s.val.toLocaleString()}:!1}},e.CUSTOM={label:"sheets-filter.conditions.custom",operator:M.CUSTOM,order:j.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:M.NONE,val1:"",operator2:M.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:l,val2:u,operator1:h,operator2:v}=i;function _(b,I){for(const P of e.ALL_CONDITIONS)if(P.operator===b)return P.mapToFilterColumn({val1:I,operator1:b})}const m=!h||h===e.NONE.operator,E=!v||v===e.NONE.operator;if(m&&E)return e.NONE.mapToFilterColumn({});if(m)return _(v,u);if(E)return _(h,l);const S=_(h,l),g=_(v,u),C={customFilters:[S.customFilters.customFilters[0],g.customFilters.customFilters[0]]};return s&&(C.and=c.BooleanNumber.TRUE),{customFilters:C}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const s=i.customFilters.customFilters.map(h=>a({customFilters:{customFilters:[h]}})),l={operator1:s[0][0].operator,val1:s[0][1].val1,operator2:s[1][0].operator,val2:s[1][1].val1};return i.customFilters.and&&(l.and=!0),l}},e.ALL_CONDITIONS=[e.NONE,e.EMPTY,e.NOT_EMPTY,e.TEXT_CONTAINS,e.DOES_NOT_CONTAIN,e.STARTS_WITH,e.ENDS_WITH,e.EQUALS,e.GREATER_THAN,e.GREATER_THAN_OR_EQUAL,e.LESS_THAN,e.LESS_THAN_OR_EQUAL,e.EQUAL,e.NOT_EQUAL,e.BETWEEN,e.NOT_BETWEEN,e.CUSTOM];function t(i){const s=e.ALL_CONDITIONS.find(l=>l.operator===i);if(!s)throw new Error(`[SheetsFilter]: no condition item found for operator: ${i}`);return s}e.getItemByOperator=t;function r(i,s){for(const l of e.ALL_CONDITIONS.filter(u=>u.numOfParameters===s))if(l.numOfParameters!==0&&l.testMappingParams(i))return l;for(const l of e.ALL_CONDITIONS)if(l.testMappingParams(i))return l;throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!")}e.testMappingParams=r;function n(i){const s=e.ALL_CONDITIONS.find(l=>l.operator===i);return(s==null?void 0:s.numOfParameters)===0?{operator1:s.operator}:s.getDefaultFormParams()}e.getInitialFormParams=n;function o(i,s){return i.mapToFilterColumn(s)}e.mapToFilterColumn=o;function a(i){if(!i)return[e.NONE,{}];for(const s of e.ALL_CONDITIONS){const l=s.testMappingFilterColumn(i);if(l)return[s,l]}return[e.NONE,{}]}e.testMappingFilterColumn=a})(T||(T={}));function he(e){const{operator1:t,operator2:r,val1:n,val2:o}=e;if(t&&r)throw new Error("Both operator1 and operator2 are set!");if(!t&&!r)throw new Error("Neither operator1 and operator2 and both not set!");return t?[t,n]:[r,o]}function Lt(e){const t=[],r=[];for(const n of e)n.checked?t.push(n):r.push(n);return{checkedItems:t,uncheckedItems:r,checked:t.length,unchecked:r.length}}var _n=Object.defineProperty,Sn=Object.getOwnPropertyDescriptor,$t=(e,t,r,n)=>{for(var o=n>1?void 0:n?Sn(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&_n(t,r,o),o},Re=(e,t)=>(r,n)=>t(r,n,e),rt=(e=>(e[e.VALUES=0]="VALUES",e[e.CONDITIONS=1]="CONDITIONS",e))(rt||{});c.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let Ee=class extends c.Disposable{constructor(t,r,n,o){super();w(this,"_filterBy$",new N.BehaviorSubject(0));w(this,"filterBy$",this._filterBy$.asObservable());w(this,"_filterByModel$",new N.ReplaySubject(1));w(this,"filterByModel$",this._filterByModel$.asObservable());w(this,"_filterByModel",null);w(this,"_hasCriteria$",new N.BehaviorSubject(!1));w(this,"hasCriteria$",this._hasCriteria$.asObservable());w(this,"_filterModel",null);w(this,"_col$",new N.BehaviorSubject(-1));w(this,"col$",this._col$.asObservable());w(this,"_filterHeaderListener",null);this._injector=t,this._sheetsFilterService=r,this._univerInstanceService=n,this._refRangeService=o}get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(t){this._filterByModel=t,this._filterByModel$.next(t)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(t,r){this.terminate(),this._filterModel=t,this._col$.next(r);const n=t.getFilterColumn(r);if(n){const o=n.getColumnData();return o.customFilters?(this._hasCriteria$.next(!0),this._setupByConditions(t,r)):o.filters?(this._hasCriteria$.next(!0),this._setupByValues(t,r)):(this._hasCriteria$.next(!1),this._setupByValues(t,r))}return this._hasCriteria$.next(!1),this._setupByValues(t,r)}changeFilterBy(t){return!this._filterModel||this.col===-1?!1:(t===0?this._setupByValues(this._filterModel,this.col):this._setupByConditions(this._filterModel,this.col),!0)}terminate(){return this._filterModel=null,this._col$.next(-1),this._disposeFilterHeaderChangeListener(),!0}_disposeFilterHeaderChangeListener(){var t;(t=this._filterHeaderListener)==null||t.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(t,r){this._disposeFilterHeaderChangeListener();const n=t.unitId,o=t.subUnitId,a=t.getRange(),i={startColumn:r,startRow:a.startRow,endRow:a.startRow,endColumn:r};this._filterHeaderListener=this._refRangeService.watchRange(n,o,i,(s,l)=>{if(!l)this.terminate();else{const u=l.startColumn-s.startColumn;u!==0&&this._filterByModel.deltaCol(u)}})}_setupByValues(t,r){this._disposePreviousModel();const n=t.getRange();if(n.startRow===n.endRow)return!1;const o=it.fromFilterColumn(this._injector,t,r);return this.filterByModel=o,this._filterBy$.next(0),this._listenToFilterHeaderChange(t,r),!0}_setupByConditions(t,r){this._disposePreviousModel();const n=t.getRange();if(n.startRow===n.endRow)return!1;const o=nt.fromFilterColumn(this._injector,t,r,t.getFilterColumn(r));return this.filterByModel=o,this._filterBy$.next(1),this._listenToFilterHeaderChange(t,r),!0}_disposePreviousModel(){var t;(t=this._filterByModel)==null||t.dispose(),this.filterByModel=null}};Ee=$t([Re(0,c.Inject(c.Injector)),Re(1,c.Inject(f.SheetsFilterService)),Re(2,c.IUniverInstanceService),Re(3,c.Inject(G.RefRangeService))],Ee);let nt=class extends c.Disposable{constructor(t,r,n,o,a){super();w(this,"canApply$",N.of(!0));w(this,"_conditionItem$");w(this,"conditionItem$");w(this,"_filterConditionFormParams$");w(this,"filterConditionFormParams$");this._filterModel=t,this.col=r,this._commandService=a,this._conditionItem$=new N.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new N.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(t,r,n,o){const[a,i]=T.testMappingFilterColumn(o==null?void 0:o.getColumnData());return t.createInstance(nt,r,n,a,i)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(t){this.col+=t}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(Fe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=T.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(Fe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:t})}onPrimaryConditionChange(t){const r=T.ALL_CONDITIONS.find(n=>n.operator===t);if(!r)throw new Error(`[ByConditionsModel]: condition item not found for operator: ${t}!`);this._conditionItem$.next(r),this._filterConditionFormParams$.next(T.getInitialFormParams(t))}onConditionFormChange(t){const r={...this.filterConditionFormParams,...t};if(r.and!==!0&&delete r.and,typeof t.and<"u"||typeof t.operator1<"u"||typeof t.operator2<"u"){const n=T.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(r)}};nt=$t([Re(4,c.ICommandService)],nt);let it=class extends c.Disposable{constructor(t,r,n,o){super();w(this,"_rawFilterItems$");w(this,"rawFilterItems$");w(this,"filterItems$");w(this,"_filterItems",[]);w(this,"canApply$");w(this,"_manuallyUpdateFilterItems$");w(this,"_searchString$");w(this,"searchString$");this._filterModel=t,this.col=r,this._commandService=o,this._searchString$=new N.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new N.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new N.Subject,this.filterItems$=N.merge(N.combineLatest([this._searchString$.pipe(N.throttleTime(500,void 0,{leading:!0,trailing:!0}),N.startWith(void 0)),this._rawFilterItems$]).pipe(N.map(([a,i])=>{if(!a)return i;const l=a.toLowerCase().split(/\s+/).filter(u=>!!u);return i.filter(u=>{const h=u.value.toLowerCase();return l.some(v=>h.includes(v))})})),this._manuallyUpdateFilterItems$).pipe(N.shareReplay(1)),this.canApply$=this.filterItems$.pipe(N.map(a=>Lt(a).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(a=>this._filterItems=a))}static fromFilterColumn(t,r,n){var D;const o=t.get(c.IUniverInstanceService),a=t.get(c.LocaleService),{unitId:i,subUnitId:s}=r,l=o.getUniverSheetInstance(i);if(!l)throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${i}!`);const u=l==null?void 0:l.getSheetBySheetId(s);if(!u)throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${i} and subUnitId: ${s}!`);const h=r.getRange(),v=n,_=(D=r.getFilterColumn(n))==null?void 0:D.getColumnData().filters,m=!!(_&&_.blank),E={...h,startRow:h.startRow+1,startColumn:v,endColumn:v},S=[],g={},C=new Set(_==null?void 0:_.filters),b=r.getFilteredOutRowsExceptCol(n);let I=0,P=0;for(const F of u.iterateByColumn(E,!1,!1)){const{row:U,rowSpan:B=1}=F;let k=0;for(;k<B;){const J=U+k;if(b.has(J)){k++;continue}const X=F!=null&&F.value?c.extractPureTextFromCell(F.value):"";if(!X){P+=1,k+=B;continue}if(g[X])g[X].count++;else{const ue={value:X,checked:C.size?C.has(X):!m,count:1,index:I,isEmpty:!1};g[X]=ue,S.push(ue)}k++}I++}const V=_?m:!0;if(P>0){const F={value:a.t("sheets-filter.panel.empty"),checked:V,count:P,index:I,isEmpty:!0};S.push(F)}return t.createInstance(it,r,n,S)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(t){this.col+=t}setSearchString(t){this._searchString$.next(t)}onFilterCheckToggled(t,r){const n=this._filterItems.slice(),o=n.find(a=>a.index===t.index);o.checked=r,this._manuallyUpdateFilterItems(n)}onFilterOnly(t){const r=this._filterItems.slice();r.forEach(n=>n.checked=n.index===t.index),this._manuallyUpdateFilterItems(r)}onCheckAllToggled(t){const r=this._filterItems.slice();r.forEach(n=>n.checked=t),this._manuallyUpdateFilterItems(r)}_manuallyUpdateFilterItems(t){this._manuallyUpdateFilterItems$.next(t)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(Fe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=Lt(this._filterItems),{checked:r,checkedItems:n}=t,o=this.rawFilterItems,a=r===0,i=t.checked===o.length,s={colId:this.col};if(a)throw new Error("[ByValuesModel]: no checked items!");if(i)return this._commandService.executeCommand(Fe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{s.filters={};const l=n.filter(h=>!h.isEmpty);l.length>0&&(s.filters={filters:l.map(h=>h.value)}),l.length!==n.length&&(s.filters.blank=!0)}return this._commandService.executeCommand(Fe.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:s})}};it=$t([Re(3,c.ICommandService)],it);const Me="FILTER_PANEL_OPENED",Be={id:"sheet.operation.open-filter-panel",type:c.CommandType.OPERATION,handler:(e,t)=>{const r=e.get(c.IContextService),n=e.get(f.SheetsFilterService),o=e.get(Ee);e.get(c.ICommandService).syncExecuteCommand(ie.SetCellEditVisibleOperation.id,{visible:!1});const{unitId:i,subUnitId:s,col:l}=t,u=n.getFilterModel(i,s);return!u||!o.setupCol(u,l)?!1:(r.getContextValue(Me)||r.setContextValue(Me,!0),!0)}},Ne={id:"sheet.operation.close-filter-panel",type:c.CommandType.OPERATION,handler:e=>{const t=e.get(c.IContextService),r=e.get(Ee),n=e.get(L.ILayoutService,c.Quantity.OPTIONAL);return t.getContextValue(Me)?(t.setContextValue(Me,!1),n==null||n.focus(),r.terminate()):!1}},Dt={id:"sheet.operation.apply-filter",type:c.CommandType.OPERATION,handler:(e,t)=>{const{filterBy:r}=t;return e.get(Ee).changeFilterBy(r)}},W={sheetsFilterPanel:"univer-sheets-filter-panel",sheetsFilterPanelHeader:"univer-sheets-filter-panel-header",sheetsFilterPanelContent:"univer-sheets-filter-panel-content",sheetsFilterPanelSelectAll:"univer-sheets-filter-panel-select-all",sheetsFilterPanelSelectAllCount:"univer-sheets-filter-panel-select-all-count",sheetsFilterPanelValuesContainer:"univer-sheets-filter-panel-values-container",inputAffixWrapper:"univer-input-affix-wrapper",select:"univer-select",radioGroup:"univer-radio-group",sheetsFilterPanelValuesFind:"univer-sheets-filter-panel-values-find",sheetsFilterPanelValuesList:"univer-sheets-filter-panel-values-list",sheetsFilterPanelValuesListInnerContainer:"univer-sheets-filter-panel-values-list-inner-container",sheetsFilterPanelValuesVirtual:"univer-sheets-filter-panel-values-virtual",sheetsFilterPanelValuesItem:"univer-sheets-filter-panel-values-item",sheetsFilterPanelValuesItemInner:"univer-sheets-filter-panel-values-item-inner",sheetsFilterPanelValuesItemCount:"univer-sheets-filter-panel-values-item-count",sheetsFilterPanelValuesItemExcludeButton:"univer-sheets-filter-panel-values-item-exclude-button",sheetsFilterPanelValuesItemText:"univer-sheets-filter-panel-values-item-text",sheetsFilterPanelConditionsContainer:"univer-sheets-filter-panel-conditions-container",sheetsFilterPanelConditionsContainerInner:"univer-sheets-filter-panel-conditions-container-inner",sheetsFilterPanelConditionsDesc:"univer-sheets-filter-panel-conditions-desc",sheetsFilterPanelFooter:"univer-sheets-filter-panel-footer",sheetsFilterPanelFooterPrimaryButtons:"univer-sheets-filter-panel-footer-primary-buttons",button:"univer-button",input:"univer-input",formDualColumnLayout:"univer-form-dual-column-layout"};function gn(e){const{model:t}=e,r=c.useDependency(c.LocaleService),n=L.useObservable(t.conditionItem$,void 0,!0),o=L.useObservable(t.filterConditionFormParams$,void 0,!0),{operator:a,numOfParameters:i}=n,{operator1:s,operator2:l,val1:u,val2:h,and:v}=o,_=v?"AND":"OR",m=d.useCallback(P=>{t.onConditionFormChange({and:P==="AND"})},[t]),E=En(r),S=d.useCallback(P=>{t.onPrimaryConditionChange(P)},[t]),g=bn(r),C=d.useCallback(P=>{t.onConditionFormChange(P)},[t]),b=r.t("sheets-filter.panel.input-values-placeholder");function I(P,V,D){const F=T.getItemByOperator(P).numOfParameters===1;return d.createElement(d.Fragment,null,D==="operator2"&&d.createElement(Q.RadioGroup,{value:_,onChange:m},d.createElement(Q.Radio,{value:"AND"},r.t("sheets-filter.panel.and")),d.createElement(Q.Radio,{value:"OR"},r.t("sheets-filter.panel.or"))),d.createElement(Q.Select,{value:P,options:g,onChange:U=>C({[D]:U})}),F&&d.createElement(Q.Input,{value:V,placeholder:b,onChange:U=>C({[D==="operator1"?"val1":"val2"]:U})}))}return d.createElement("div",{className:W.sheetsFilterPanelConditionsContainer},d.createElement(Q.Select,{value:a,options:E,onChange:S}),T.getItemByOperator(a).numOfParameters!==0?d.createElement("div",{className:W.sheetsFilterPanelConditionsContainerInner},i>=1&&I(s,u!=null?u:"","operator1"),i>=2&&I(l,h!=null?h:"","operator2"),d.createElement("div",{className:W.sheetsFilterPanelConditionsDesc},r.t("sheets-filter.panel.?"),d.createElement("br",null),r.t("sheets-filter.panel.*"))):null)}function En(e){const t=e.getCurrentLocale();return d.useMemo(()=>[{options:[{label:e.t(T.NONE.label),value:T.NONE.operator}]},{options:[{label:e.t(T.EMPTY.label),value:T.EMPTY.operator},{label:e.t(T.NOT_EMPTY.label),value:T.NOT_EMPTY.operator}]},{options:[{label:e.t(T.TEXT_CONTAINS.label),value:T.TEXT_CONTAINS.operator},{label:e.t(T.DOES_NOT_CONTAIN.label),value:T.DOES_NOT_CONTAIN.operator},{label:e.t(T.STARTS_WITH.label),value:T.STARTS_WITH.operator},{label:e.t(T.ENDS_WITH.label),value:T.ENDS_WITH.operator},{label:e.t(T.EQUALS.label),value:T.EQUALS.operator}]},{options:[{label:e.t(T.GREATER_THAN.label),value:T.GREATER_THAN.operator},{label:e.t(T.GREATER_THAN_OR_EQUAL.label),value:T.GREATER_THAN_OR_EQUAL.operator},{label:e.t(T.LESS_THAN.label),value:T.LESS_THAN.operator},{label:e.t(T.LESS_THAN_OR_EQUAL.label),value:T.LESS_THAN_OR_EQUAL.operator},{label:e.t(T.EQUAL.label),value:T.EQUAL.operator},{label:e.t(T.NOT_EQUAL.label),value:T.NOT_EQUAL.operator},{label:e.t(T.BETWEEN.label),value:T.BETWEEN.operator},{label:e.t(T.NOT_BETWEEN.label),value:T.NOT_BETWEEN.operator}]},{options:[{label:e.t(T.CUSTOM.label),value:T.CUSTOM.operator}]}],[t,e])}function bn(e){const t=e.getCurrentLocale();return d.useMemo(()=>T.ALL_CONDITIONS.filter(r=>r.numOfParameters!==2).map(r=>({label:e.t(r.label),value:r.operator})),[t,e])}function xe(){return xe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xe.apply(null,arguments)}function se(e){"@babel/helpers - typeof";return se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(e)}function yn(e,t){if(se(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(se(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sr(e){var t=yn(e,"string");return se(t)=="symbol"?t:t+""}function Z(e,t,r){return(t=sr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ar(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ar(Object(r),!0).forEach(function(n){Z(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ar(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Cn(e){if(Array.isArray(e))return e}function On(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(h){u=!0,o=h}finally{try{if(!l&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return s}}function lr(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Tn(e,t){if(e){if(typeof e=="string")return lr(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lr(e,t):void 0}}function Fn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q(e,t){return Cn(e)||On(e,t)||Tn(e,t)||Fn()}function Pn(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function In(e,t){if(e==null)return{};var r,n,o=Pn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Rn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ur={exports:{}};/*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see
5
5
  http://jedwatson.github.io/classnames
6
- */(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var a="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(a=o(a,n(s)))}return a}function n(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return r.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var s in a)t.call(a,s)&&a[s]&&(i=o(i,s));return i}function o(a,i){return i?a?a+" "+i:a+i:a}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(fr);var wn=fr.exports;const at=Nn(wn);var hr={exports:{}},D={};/**
6
+ */(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var a="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(a=o(a,n(s)))}return a}function n(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return r.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var s in a)t.call(a,s)&&a[s]&&(i=o(i,s));return i}function o(a,i){return i?a?a+" "+i:a+i:a}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(ur);var Mn=ur.exports;const ot=Rn(Mn);var cr={exports:{}},$={};/**
7
7
  * @license React
8
8
  * react-is.production.min.js
9
9
  *
@@ -11,4 +11,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
11
11
  *
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
- */var Bt=Symbol.for("react.element"),xt=Symbol.for("react.portal"),lt=Symbol.for("react.fragment"),ut=Symbol.for("react.strict_mode"),ct=Symbol.for("react.profiler"),ft=Symbol.for("react.provider"),ht=Symbol.for("react.context"),An=Symbol.for("react.server_context"),dt=Symbol.for("react.forward_ref"),mt=Symbol.for("react.suspense"),vt=Symbol.for("react.suspense_list"),pt=Symbol.for("react.memo"),_t=Symbol.for("react.lazy"),Ln=Symbol.for("react.offscreen"),dr;dr=Symbol.for("react.module.reference");function le(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Bt:switch(e=e.type,e){case lt:case ct:case ut:case mt:case vt:return e;default:switch(e=e&&e.$$typeof,e){case An:case ht:case dt:case _t:case pt:case ft:return e;default:return t}}case xt:return t}}}D.ContextConsumer=ht,D.ContextProvider=ft,D.Element=Bt,D.ForwardRef=dt,D.Fragment=lt,D.Lazy=_t,D.Memo=pt,D.Portal=xt,D.Profiler=ct,D.StrictMode=ut,D.Suspense=mt,D.SuspenseList=vt,D.isAsyncMode=function(){return!1},D.isConcurrentMode=function(){return!1},D.isContextConsumer=function(e){return le(e)===ht},D.isContextProvider=function(e){return le(e)===ft},D.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Bt},D.isForwardRef=function(e){return le(e)===dt},D.isFragment=function(e){return le(e)===lt},D.isLazy=function(e){return le(e)===_t},D.isMemo=function(e){return le(e)===pt},D.isPortal=function(e){return le(e)===xt},D.isProfiler=function(e){return le(e)===ct},D.isStrictMode=function(e){return le(e)===ut},D.isSuspense=function(e){return le(e)===mt},D.isSuspenseList=function(e){return le(e)===vt},D.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===lt||e===ct||e===ut||e===mt||e===vt||e===Ln||typeof e=="object"&&e!==null&&(e.$$typeof===_t||e.$$typeof===pt||e.$$typeof===ft||e.$$typeof===ht||e.$$typeof===dt||e.$$typeof===dr||e.getModuleId!==void 0)},D.typeOf=le,hr.exports=D;var Ve=hr.exports;function Wt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=[];return h.Children.forEach(e,function(n){n==null&&!t.keepEmpty||(Array.isArray(n)?r=r.concat(Wt(n)):Ve.isFragment(n)&&n.props?r=r.concat(Wt(n.props.children,t)):r.push(n))}),r}function mr(e){return e instanceof HTMLElement||e instanceof SVGElement}function $n(e){return e&&ae(e)==="object"&&mr(e.nativeElement)?e.nativeElement:mr(e)?e:null}function St(e){var t=$n(e);if(t)return t;if(e instanceof h.Component){var r;return(r=nt.findDOMNode)===null||r===void 0?void 0:r.call(nt,e)}return null}function Dn(e,t,r){var n=p.useRef({});return(!("value"in n.current)||r(n.current.condition,t))&&(n.current.value=e(),n.current.condition=t),n.current.value}var Un=function(t,r){typeof t=="function"?t(r):ae(t)==="object"&&t&&"current"in t&&(t.current=r)},Hn=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r.filter(Boolean);return o.length<=1?o[0]:function(a){r.forEach(function(i){Un(i,a)})}},Bn=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Dn(function(){return Hn.apply(void 0,r)},r,function(o,a){return o.length!==a.length||o.every(function(i,s){return i!==a[s]})})},xn=function(t){var r,n,o=Ve.isMemo(t)?t.type.type:t.type;return!(typeof o=="function"&&!((r=o.prototype)!==null&&r!==void 0&&r.render)&&o.$$typeof!==Ve.ForwardRef||typeof t=="function"&&!((n=t.prototype)!==null&&n!==void 0&&n.render)&&t.$$typeof!==Ve.ForwardRef)};function vr(e){return h.isValidElement(e)&&!Ve.isFragment(e)}Number(h.version.split(".")[0])>=19;var jt=p.createContext(null);function Wn(e){var t=e.children,r=e.onBatchResize,n=p.useRef(0),o=p.useRef([]),a=p.useContext(jt),i=p.useCallback(function(s,l,u){n.current+=1;var c=n.current;o.current.push({size:s,element:l,data:u}),Promise.resolve().then(function(){c===n.current&&(r==null||r(o.current),o.current=[])}),a==null||a(s,l,u)},[r,a]);return p.createElement(jt.Provider,{value:i},t)}var pr=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(o,a){return o[0]===r?(n=a,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,a=this.__entries__;o<a.length;o++){var i=a[o];r.call(n,i[1],i[0])}},t}()}(),Vt=typeof window<"u"&&typeof document<"u"&&window.document===document,gt=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")()}(),jn=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(gt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Vn=2;function kn(e,t){var r=!1,n=!1,o=0;function a(){r&&(r=!1,e()),n&&s()}function i(){jn(a)}function s(){var l=Date.now();if(r){if(l-o<Vn)return;n=!0}else r=!0,n=!1,setTimeout(i,t);o=l}return s}var zn=20,Qn=["top","right","bottom","left","width","height","size","weight"],Gn=typeof MutationObserver<"u",Yn=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=kn(this.refresh.bind(this),zn)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var r=this.observers_,n=r.indexOf(t);~n&&r.splice(n,1),!r.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return t.forEach(function(r){return r.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!Vt||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Gn?(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(){!Vt||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=Qn.some(function(a){return!!~n.indexOf(a)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),_r=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},Le=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||gt},Sr=bt(0,0,0,0);function Et(e){return parseFloat(e)||0}function gr(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(n,o){var a=e["border-"+o+"-width"];return n+Et(a)},0)}function qn(e){for(var t=["top","right","bottom","left"],r={},n=0,o=t;n<o.length;n++){var a=o[n],i=e["padding-"+a];r[a]=Et(i)}return r}function Xn(e){var t=e.getBBox();return bt(0,0,t.width,t.height)}function Kn(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return Sr;var n=Le(e).getComputedStyle(e),o=qn(n),a=o.left+o.right,i=o.top+o.bottom,s=Et(n.width),l=Et(n.height);if(n.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=gr(n,"left","right")+a),Math.round(l+i)!==r&&(l-=gr(n,"top","bottom")+i)),!Jn(e)){var u=Math.round(s+a)-t,c=Math.round(l+i)-r;Math.abs(u)!==1&&(s-=u),Math.abs(c)!==1&&(l-=c)}return bt(o.left,o.top,s,l)}var Zn=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof Le(e).SVGGraphicsElement}:function(e){return e instanceof Le(e).SVGElement&&typeof e.getBBox=="function"}}();function Jn(e){return e===Le(e).document.documentElement}function ei(e){return Vt?Zn(e)?Xn(e):Kn(e):Sr}function ti(e){var t=e.x,r=e.y,n=e.width,o=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(a.prototype);return _r(i,{x:t,y:r,width:n,height:o,top:r,right:t+n,bottom:o+r,left:t}),i}function bt(e,t,r,n){return{x:e,y:t,width:r,height:n}}var ri=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=bt(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=ei(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}(),ni=function(){function e(t,r){var n=ti(r);_r(this,{target:t,contentRect:n})}return e}(),ii=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new pr,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=r,this.callbackCtx_=n}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof Le(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new ri(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 Le(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)&&(r.delete(t),r.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&t.activeObservations_.push(r)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,r=this.activeObservations_.map(function(n){return new ni(n.target,n.broadcastRect())});this.callback_.call(t,r,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),Er=typeof WeakMap<"u"?new WeakMap:new pr,br=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=Yn.getInstance(),n=new ii(t,r,this);Er.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){br.prototype[e]=function(){var t;return(t=Er.get(this))[e].apply(t,arguments)}});var oi=function(){return typeof gt.ResizeObserver<"u"?gt.ResizeObserver:br}(),ye=new Map;function si(e){e.forEach(function(t){var r,n=t.target;(r=ye.get(n))===null||r===void 0||r.forEach(function(o){return o(n)})})}var yr=new oi(si);function ai(e,t){ye.has(e)||(ye.set(e,new Set),yr.observe(e)),ye.get(e).add(t)}function li(e,t){ye.has(e)&&(ye.get(e).delete(t),ye.get(e).size||(yr.unobserve(e),ye.delete(e)))}function Cr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ui(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,lr(n.key),n)}}function Or(e,t,r){return t&&ui(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function kt(e,t){return kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},kt(e,t)}function ci(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&kt(e,t)}function yt(e){return yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yt(e)}function Tr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Tr=function(){return!!e})()}function fi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hi(e,t){if(t&&(ae(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fi(e)}function di(e){var t=Tr();return function(){var r,n=yt(e);if(t){var o=yt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return hi(this,r)}}var mi=function(e){ci(r,e);var t=di(r);function r(){return Cr(this,r),t.apply(this,arguments)}return Or(r,[{key:"render",value:function(){return this.props.children}}]),r}(p.Component);function vi(e,t){var r=e.children,n=e.disabled,o=p.useRef(null),a=p.useRef(null),i=p.useContext(jt),s=typeof r=="function",l=s?r(o):r,u=p.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),c=!s&&p.isValidElement(l)&&xn(l),v=c?l.ref:null,_=Bn(v,o),d=function(){var C;return St(o.current)||(o.current&&ae(o.current)==="object"?St((C=o.current)===null||C===void 0?void 0:C.nativeElement):null)||St(a.current)};p.useImperativeHandle(t,function(){return d()});var E=p.useRef(e);E.current=e;var S=p.useCallback(function(g){var C=E.current,b=C.onResize,R=C.data,I=g.getBoundingClientRect(),k=I.width,U=I.height,F=g.offsetWidth,H=g.offsetHeight,x=Math.floor(k),z=Math.floor(U);if(u.current.width!==x||u.current.height!==z||u.current.offsetWidth!==F||u.current.offsetHeight!==H){var ee={width:x,height:z,offsetWidth:F,offsetHeight:H};u.current=ee;var K=F===Math.round(k)?k:F,ce=H===Math.round(U)?U:H,Z=q(q({},ee),{},{offsetWidth:K,offsetHeight:ce});i==null||i(Z,g,R),b&&Promise.resolve().then(function(){b(Z,g)})}},[]);return p.useEffect(function(){var g=d();return g&&!n&&ai(g,S),function(){return li(g,S)}},[o.current,n]),p.createElement(mi,{ref:a},c?p.cloneElement(l,{ref:_}):l)}var pi=p.forwardRef(vi),_i="rc-observer-key";function Si(e,t){var r=e.children,n=typeof r=="function"?[r]:Wt(r);return n.map(function(o,a){var i=(o==null?void 0:o.key)||"".concat(_i,"-").concat(a);return p.createElement(pi,je({},e,{key:i,ref:a===0?t:void 0}),o)})}var zt=p.forwardRef(Si);zt.Collection=Wn;function Fr(e){var t=p.useRef();t.current=e;var r=p.useCallback(function(){for(var n,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return(n=t.current)===null||n===void 0?void 0:n.call.apply(n,[t].concat(a))},[]);return r}function gi(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Pr=gi()?p.useLayoutEffect:p.useEffect,ke=function(t,r){var n=p.useRef(!0);Pr(function(){return t(n.current)},r),Pr(function(){return n.current=!1,function(){n.current=!0}},[])},Ir=p.forwardRef(function(e,t){var r=e.height,n=e.offsetY,o=e.offsetX,a=e.children,i=e.prefixCls,s=e.onInnerResize,l=e.innerProps,u=e.rtl,c=e.extra,v={},_={display:"flex",flexDirection:"column"};return n!==void 0&&(v={height:r,position:"relative",overflow:"hidden"},_=q(q({},_),{},J(J(J(J(J({transform:"translateY(".concat(n,"px)")},u?"marginRight":"marginLeft",-o),"position","absolute"),"left",0),"right",0),"top",0))),p.createElement("div",{style:v},p.createElement(zt,{onResize:function(E){var S=E.offsetHeight;S&&s&&s()}},p.createElement("div",je({style:_,className:at(J({},"".concat(i,"-holder-inner"),i)),ref:t},l),a,c)))});Ir.displayName="Filler";function Ei(e){var t=e.children,r=e.setRef,n=p.useCallback(function(o){r(o)},[]);return p.cloneElement(t,{ref:n})}function bi(e,t,r,n,o,a,i,s){var l=s.getKey;return e.slice(t,r+1).map(function(u,c){var v=t+c,_=i(u,v,{style:{width:n},offsetX:o}),d=l(u);return p.createElement(Ei,{key:d,setRef:function(S){return a(u,S)}},_)})}function yi(e,t,r){var n=e.length,o=t.length,a,i;if(n===0&&o===0)return null;n<o?(a=e,i=t):(a=t,i=e);var s={__EMPTY_ITEM__:!0};function l(E){return E!==void 0?r(E):s}for(var u=null,c=Math.abs(n-o)!==1,v=0;v<i.length;v+=1){var _=l(a[v]),d=l(i[v]);if(_!==d){u=v,c=c||_!==l(i[v+1]);break}}return u===null?null:{index:u,multiple:c}}function Ci(e,t,r){var n=p.useState(e),o=X(n,2),a=o[0],i=o[1],s=p.useState(null),l=X(s,2),u=l[0],c=l[1];return p.useEffect(function(){var v=yi(a||[],e||[],t);(v==null?void 0:v.index)!==void 0&&c(e[v.index]),i(e)},[e]),[u]}var Rr=function(t){return+setTimeout(t,16)},Mr=function(t){return clearTimeout(t)};typeof window<"u"&&"requestAnimationFrame"in window&&(Rr=function(t){return window.requestAnimationFrame(t)},Mr=function(t){return window.cancelAnimationFrame(t)});var Nr=0,Qt=new Map;function wr(e){Qt.delete(e)}var me=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;Nr+=1;var n=Nr;function o(a){if(a===0)wr(n),t();else{var i=Rr(function(){o(a-1)});Qt.set(n,i)}}return o(r),n};me.cancel=function(e){var t=Qt.get(e);return wr(e),Mr(t)};var Ar=(typeof navigator>"u"?"undefined":ae(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const Lr=function(e,t,r,n){var o=h.useRef(!1),a=h.useRef(null);function i(){clearTimeout(a.current),o.current=!0,a.current=setTimeout(function(){o.current=!1},50)}var s=h.useRef({top:e,bottom:t,left:r,right:n});return s.current.top=e,s.current.bottom=t,s.current.left=r,s.current.right=n,function(l,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,v=l?u<0&&s.current.left||u>0&&s.current.right:u<0&&s.current.top||u>0&&s.current.bottom;return c&&v?(clearTimeout(a.current),o.current=!1):(!v||o.current)&&i(),!o.current&&v}};function Oi(e,t,r,n,o,a,i){var s=h.useRef(0),l=h.useRef(null),u=h.useRef(null),c=h.useRef(!1),v=Lr(t,r,n,o);function _(b,R){me.cancel(l.current),s.current+=R,u.current=R,!v(!1,R)&&(Ar||b.preventDefault(),l.current=me(function(){var I=c.current?10:1;i(s.current*I),s.current=0}))}function d(b,R){i(R,!0),Ar||b.preventDefault()}var E=h.useRef(null),S=h.useRef(null);function g(b){if(e){me.cancel(S.current),S.current=me(function(){E.current=null},2);var R=b.deltaX,I=b.deltaY,k=b.shiftKey,U=R,F=I;(E.current==="sx"||!E.current&&k&&I&&!R)&&(U=I,F=0,E.current="sx");var H=Math.abs(U),x=Math.abs(F);E.current===null&&(E.current=a&&H>x?"x":"y"),E.current==="y"?_(b,F):d(b,U)}}function C(b){e&&(c.current=b.detail===u.current)}return[g,C]}function Ti(e,t,r,n){var o=p.useMemo(function(){return[new Map,[]]},[e,r.id,n]),a=X(o,2),i=a[0],s=a[1],l=function(c){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,_=i.get(c),d=i.get(v);if(_===void 0||d===void 0)for(var E=e.length,S=s.length;S<E;S+=1){var g,C=e[S],b=t(C);i.set(b,S);var R=(g=r.get(b))!==null&&g!==void 0?g:n;if(s[S]=(s[S-1]||0)+R,b===c&&(_=S),b===v&&(d=S),_!==void 0&&d!==void 0)break}return{top:s[_-1]||0,bottom:s[d]}};return l}var Fi=function(){function e(){Cr(this,e),J(this,"maps",void 0),J(this,"id",0),this.maps=Object.create(null)}return Or(e,[{key:"set",value:function(r,n){this.maps[r]=n,this.id+=1}},{key:"get",value:function(r){return this.maps[r]}}]),e}();function Pi(e,t,r){var n=p.useState(0),o=X(n,2),a=o[0],i=o[1],s=h.useRef(new Map),l=h.useRef(new Fi),u=h.useRef();function c(){me.cancel(u.current)}function v(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;c();var E=function(){s.current.forEach(function(g,C){if(g&&g.offsetParent){var b=St(g),R=b.offsetHeight;l.current.get(C)!==R&&l.current.set(C,b.offsetHeight)}}),i(function(g){return g+1})};d?E():u.current=me(E)}function _(d,E){var S=e(d);s.current.get(S),E?(s.current.set(S,E),v()):s.current.delete(S)}return h.useEffect(function(){return c},[]),[_,v,l.current,a]}var $r=14/15;function Ii(e,t,r){var n=h.useRef(!1),o=h.useRef(0),a=h.useRef(0),i=h.useRef(null),s=h.useRef(null),l,u=function(d){if(n.current){var E=Math.ceil(d.touches[0].pageX),S=Math.ceil(d.touches[0].pageY),g=o.current-E,C=a.current-S,b=Math.abs(g)>Math.abs(C);b?o.current=E:a.current=S,r(b,b?g:C)&&d.preventDefault(),clearInterval(s.current),s.current=setInterval(function(){b?g*=$r:C*=$r;var R=Math.floor(b?g:C);(!r(b,R,!0)||Math.abs(R)<=.1)&&clearInterval(s.current)},16)}},c=function(){n.current=!1,l()},v=function(d){l(),d.touches.length===1&&!n.current&&(n.current=!0,o.current=Math.ceil(d.touches[0].pageX),a.current=Math.ceil(d.touches[0].pageY),i.current=d.target,i.current.addEventListener("touchmove",u,{passive:!1}),i.current.addEventListener("touchend",c,{passive:!0}))};l=function(){i.current&&(i.current.removeEventListener("touchmove",u),i.current.removeEventListener("touchend",c))},ke(function(){return e&&t.current.addEventListener("touchstart",v,{passive:!0}),function(){var _;(_=t.current)===null||_===void 0||_.removeEventListener("touchstart",v),l(),clearInterval(s.current)}},[e])}var Ri=10;function Mi(e,t,r,n,o,a,i,s){var l=p.useRef(),u=p.useState(null),c=X(u,2),v=c[0],_=c[1];return ke(function(){if(v&&v.times<Ri){if(!e.current){_(function(te){return q({},te)});return}a();var d=v.targetAlign,E=v.originAlign,S=v.index,g=v.offset,C=e.current.clientHeight,b=!1,R=d,I=null;if(C){for(var k=d||E,U=0,F=0,H=0,x=Math.min(t.length-1,S),z=0;z<=x;z+=1){var ee=o(t[z]);F=U;var K=r.get(ee);H=F+(K===void 0?n:K),U=H}for(var ce=k==="top"?g:C-g,Z=x;Z>=0;Z-=1){var $e=o(t[Z]),ne=r.get($e);if(ne===void 0){b=!0;break}if(ce-=ne,ce<=0)break}switch(k){case"top":I=F-g;break;case"bottom":I=H-C+g;break;default:{var Oe=e.current.scrollTop,ve=Oe+C;F<Oe?R="top":H>ve&&(R="bottom")}}I!==null&&i(I),I!==v.lastTop&&(b=!0)}b&&_(q(q({},v),{},{times:v.times+1,targetAlign:R,lastTop:I}))}},[v,e.current]),function(d){if(d==null){s();return}if(me.cancel(l.current),typeof d=="number")i(d);else if(d&&ae(d)==="object"){var E,S=d.align;"index"in d?E=d.index:E=t.findIndex(function(b){return o(b)===d.key});var g=d.offset,C=g===void 0?0:g;_({times:0,index:E,offset:C,originAlign:S})}}}function Dr(e,t){var r="touches"in e?e.touches[0]:e;return r[t?"pageX":"pageY"]}var Ur=p.forwardRef(function(e,t){var r=e.prefixCls,n=e.rtl,o=e.scrollOffset,a=e.scrollRange,i=e.onStartMove,s=e.onStopMove,l=e.onScroll,u=e.horizontal,c=e.spinSize,v=e.containerSize,_=e.style,d=e.thumbStyle,E=p.useState(!1),S=X(E,2),g=S[0],C=S[1],b=p.useState(null),R=X(b,2),I=R[0],k=R[1],U=p.useState(null),F=X(U,2),H=F[0],x=F[1],z=!n,ee=p.useRef(),K=p.useRef(),ce=p.useState(!1),Z=X(ce,2),$e=Z[0],ne=Z[1],Oe=p.useRef(),ve=function(){clearTimeout(Oe.current),ne(!0),Oe.current=setTimeout(function(){ne(!1)},3e3)},te=a-v||0,Ye=v-c||0,W=p.useMemo(function(){if(o===0||te===0)return 0;var ie=o/te;return ie*Ye},[o,te,Ye]),Ie=function(B){B.stopPropagation(),B.preventDefault()},De=p.useRef({top:W,dragging:g,pageY:I,startTop:H});De.current={top:W,dragging:g,pageY:I,startTop:H};var Ue=function(B){C(!0),k(Dr(B,u)),x(De.current.top),i(),B.stopPropagation(),B.preventDefault()};p.useEffect(function(){var ie=function(He){He.preventDefault()},B=ee.current,he=K.current;return B.addEventListener("touchstart",ie,{passive:!1}),he.addEventListener("touchstart",Ue,{passive:!1}),function(){B.removeEventListener("touchstart",ie),he.removeEventListener("touchstart",Ue)}},[]);var Tt=p.useRef();Tt.current=te;var qe=p.useRef();qe.current=Ye,p.useEffect(function(){if(g){var ie,B=function(He){var Xe=De.current,Pt=Xe.dragging,It=Xe.pageY,Rt=Xe.startTop;me.cancel(ie);var Mt=ee.current.getBoundingClientRect(),Be=v/(u?Mt.width:Mt.height);if(Pt){var Ke=(Dr(He,u)-It)*Be,Ze=Rt;!z&&u?Ze-=Ke:Ze+=Ke;var Nt=Tt.current,wt=qe.current,Xt=wt?Ze/wt:0,_e=Math.ceil(Xt*Nt);_e=Math.max(_e,0),_e=Math.min(_e,Nt),ie=me(function(){l(_e,u)})}},he=function(){C(!1),s()};return window.addEventListener("mousemove",B,{passive:!0}),window.addEventListener("touchmove",B,{passive:!0}),window.addEventListener("mouseup",he,{passive:!0}),window.addEventListener("touchend",he,{passive:!0}),function(){window.removeEventListener("mousemove",B),window.removeEventListener("touchmove",B),window.removeEventListener("mouseup",he),window.removeEventListener("touchend",he),me.cancel(ie)}}},[g]),p.useEffect(function(){return ve(),function(){clearTimeout(Oe.current)}},[o]),p.useImperativeHandle(t,function(){return{delayHidden:ve}});var re="".concat(r,"-scrollbar"),fe={position:"absolute",visibility:$e?null:"hidden"},pe={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(fe.height=8,fe.left=0,fe.right=0,fe.bottom=0,pe.height="100%",pe.width=c,z?pe.left=W:pe.right=W):(fe.width=8,fe.top=0,fe.bottom=0,z?fe.right=0:fe.left=0,pe.width="100%",pe.height=c,pe.top=W),p.createElement("div",{ref:ee,className:at(re,J(J(J({},"".concat(re,"-horizontal"),u),"".concat(re,"-vertical"),!u),"".concat(re,"-visible"),$e)),style:q(q({},fe),_),onMouseDown:Ie,onMouseMove:ve},p.createElement("div",{ref:K,className:at("".concat(re,"-thumb"),J({},"".concat(re,"-thumb-moving"),g)),style:q(q({},pe),d),onMouseDown:Ue}))}),Ni=20;function Hr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=e/t*e;return isNaN(r)&&(r=0),r=Math.max(r,Ni),Math.floor(r)}var wi=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles"],Ai=[],Li={overflowY:"auto",overflowAnchor:"none"};function $i(e,t){var r=e.prefixCls,n=r===void 0?"rc-virtual-list":r,o=e.className,a=e.height,i=e.itemHeight,s=e.fullHeight,l=s===void 0?!0:s,u=e.style,c=e.data,v=e.children,_=e.itemKey,d=e.virtual,E=e.direction,S=e.scrollWidth,g=e.component,C=g===void 0?"div":g,b=e.onScroll,R=e.onVirtualScroll,I=e.onVisibleChange,k=e.innerProps,U=e.extraRender,F=e.styles,H=Mn(e,wi),x=p.useCallback(function(O){return typeof _=="function"?_(O):O==null?void 0:O[_]},[_]),z=Pi(x),ee=X(z,4),K=ee[0],ce=ee[1],Z=ee[2],$e=ee[3],ne=!!(d!==!1&&a&&i),Oe=p.useMemo(function(){return Object.values(Z.maps).reduce(function(O,y){return O+y},0)},[Z.id,Z.maps]),ve=ne&&c&&(Math.max(i*c.length,Oe)>a||!!S),te=E==="rtl",Ye=at(n,J({},"".concat(n,"-rtl"),te),o),W=c||Ai,Ie=h.useRef(),De=h.useRef(),Ue=h.useRef(),Tt=h.useState(0),qe=X(Tt,2),re=qe[0],fe=qe[1],pe=h.useState(0),ie=X(pe,2),B=ie[0],he=ie[1],Ft=h.useState(!1),He=X(Ft,2),Xe=He[0],Pt=He[1],It=function(){Pt(!0)},Rt=function(){Pt(!1)},Mt={getKey:x};function Be(O){fe(function(y){var L;typeof O=="function"?L=O(y):L=O;var Q=Co(L);return Ie.current.scrollTop=Q,Q})}var Ke=h.useRef({start:0,end:W.length}),Ze=h.useRef(),Nt=Ci(W,x),wt=X(Nt,1),Xt=wt[0];Ze.current=Xt;var _e=p.useMemo(function(){if(!ne)return{scrollHeight:void 0,start:0,end:W.length-1,offset:void 0};if(!ve){var O;return{scrollHeight:((O=De.current)===null||O===void 0?void 0:O.offsetHeight)||0,start:0,end:W.length-1,offset:void 0}}for(var y=0,L,Q,Te,No=W.length,rt=0;rt<No;rt+=1){var wo=W[rt],Ao=x(wo),un=Z.get(Ao),nr=y+(un===void 0?i:un);nr>=re&&L===void 0&&(L=rt,Q=y),nr>re+a&&Te===void 0&&(Te=rt),y=nr}return L===void 0&&(L=0,Q=0,Te=Math.ceil(a/i)),Te===void 0&&(Te=W.length-1),Te=Math.min(Te+1,W.length-1),{scrollHeight:y,start:L,end:Te,offset:Q}},[ve,ne,re,W,$e,a]),xe=_e.scrollHeight,Je=_e.start,et=_e.end,Yr=_e.offset;Ke.current.start=Je,Ke.current.end=et;var So=p.useState({width:0,height:a}),qr=X(So,2),Ee=qr[0],go=qr[1],Eo=function(y){go({width:y.offsetWidth,height:y.offsetHeight})},Xr=h.useRef(),Kr=h.useRef(),bo=p.useMemo(function(){return Hr(Ee.width,S)},[Ee.width,S]),yo=p.useMemo(function(){return Hr(Ee.height,xe)},[Ee.height,xe]),Kt=xe-a,Zt=h.useRef(Kt);Zt.current=Kt;function Co(O){var y=O;return Number.isNaN(Zt.current)||(y=Math.min(y,Zt.current)),y=Math.max(y,0),y}var Zr=re<=0,Jr=re>=Kt,en=B<=0,tn=B>=S,Oo=Lr(Zr,Jr,en,tn),Jt=function(){return{x:te?-B:B,y:re}},er=h.useRef(Jt()),At=Fr(function(O){if(R){var y=q(q({},Jt()),O);(er.current.x!==y.x||er.current.y!==y.y)&&(R(y),er.current=y)}});function rn(O,y){var L=O;y?(nt.flushSync(function(){he(L)}),At()):Be(L)}function To(O){var y=O.currentTarget.scrollTop;y!==re&&Be(y),b==null||b(O),At()}var tr=function(y){var L=y,Q=S?S-Ee.width:0;return L=Math.max(L,0),L=Math.min(L,Q),L},Fo=Fr(function(O,y){y?(nt.flushSync(function(){he(function(L){var Q=L+(te?-O:O);return tr(Q)})}),At()):Be(function(L){var Q=L+O;return Q})}),Po=Oi(ne,Zr,Jr,en,tn,!!S,Fo),nn=X(Po,2),rr=nn[0],on=nn[1];Ii(ne,Ie,function(O,y,L){return Oo(O,y,L)?!1:(rr({preventDefault:function(){},deltaX:O?y:0,deltaY:O?0:y}),!0)}),ke(function(){function O(L){ne&&L.preventDefault()}var y=Ie.current;return y.addEventListener("wheel",rr,{passive:!1}),y.addEventListener("DOMMouseScroll",on,{passive:!0}),y.addEventListener("MozMousePixelScroll",O,{passive:!1}),function(){y.removeEventListener("wheel",rr),y.removeEventListener("DOMMouseScroll",on),y.removeEventListener("MozMousePixelScroll",O)}},[ne]),ke(function(){if(S){var O=tr(B);he(O),At({x:O})}},[Ee.width,S]);var sn=function(){var y,L;(y=Xr.current)===null||y===void 0||y.delayHidden(),(L=Kr.current)===null||L===void 0||L.delayHidden()},an=Mi(Ie,W,Z,i,x,function(){return ce(!0)},Be,sn);p.useImperativeHandle(t,function(){return{nativeElement:Ue.current,getScrollInfo:Jt,scrollTo:function(y){function L(Q){return Q&&ae(Q)==="object"&&("left"in Q||"top"in Q)}L(y)?(y.left!==void 0&&he(tr(y.left)),an(y.top)):an(y)}}}),ke(function(){if(I){var O=W.slice(Je,et+1);I(O,W)}},[Je,et,W]);var Io=Ti(W,x,Z,i),Ro=U==null?void 0:U({start:Je,end:et,virtual:ve,offsetX:B,offsetY:Yr,rtl:te,getSize:Io}),Mo=bi(W,Je,et,S,B,K,v,Mt),tt=null;a&&(tt=q(J({},l?"height":"maxHeight",a),Li),ne&&(tt.overflowY="hidden",S&&(tt.overflowX="hidden"),Xe&&(tt.pointerEvents="none")));var ln={};return te&&(ln.dir="rtl"),p.createElement("div",je({ref:Ue,style:q(q({},u),{},{position:"relative"}),className:Ye},ln,H),p.createElement(zt,{onResize:Eo},p.createElement(C,{className:"".concat(n,"-holder"),style:tt,ref:Ie,onScroll:To,onMouseEnter:sn},p.createElement(Ir,{prefixCls:n,height:xe,offsetX:B,offsetY:Yr,scrollWidth:S,onInnerResize:ce,ref:De,innerProps:k,rtl:te,extra:Ro},Mo))),ve&&xe>a&&p.createElement(Ur,{ref:Xr,prefixCls:n,scrollOffset:re,scrollRange:xe,rtl:te,onScroll:rn,onStartMove:It,onStopMove:Rt,spinSize:yo,containerSize:Ee.height,style:F==null?void 0:F.verticalScrollBar,thumbStyle:F==null?void 0:F.verticalScrollBarThumb}),ve&&S>Ee.width&&p.createElement(Ur,{ref:Kr,prefixCls:n,scrollOffset:B,scrollRange:S,rtl:te,onScroll:rn,onStartMove:It,onStopMove:Rt,spinSize:bo,containerSize:Ee.width,horizontal:!0,style:F==null?void 0:F.horizontalScrollBar,thumbStyle:F==null?void 0:F.horizontalScrollBarThumb}))}var Br=p.forwardRef($i);Br.displayName="List";function Di(e){const{model:t}=e,r=Me.useDependency(m.LocaleService),n=$.useObservable(t.searchString$,"",!0),o=$.useObservable(t.filterItems$,void 0,!0),a=r.t("sheets-filter.panel.filter-only"),i=Dt(o),s=i.checked>0&&i.unchecked===0,l=i.checked>0&&i.unchecked>0,u=h.useCallback((d,E)=>{t.onFilterCheckToggled(d,E)},[t]),c=h.useCallback(d=>{t.onFilterOnly(d)},[t]),v=h.useCallback(()=>{t.onCheckAllToggled(!s)},[t,s]),_=h.useCallback(d=>{t.setSearchString(d)},[t]);return h.createElement("div",{className:j.sheetsFilterPanelValuesContainer},h.createElement(G.Input,{value:n,placeholder:r.t("sheets-filter.panel.search-placeholder"),onChange:_}),h.createElement("div",{className:j.sheetsFilterPanelValuesList},h.createElement("div",{className:j.sheetsFilterPanelValuesItem},h.createElement("div",{className:j.sheetsFilterPanelValuesItemInner},h.createElement(G.Checkbox,{indeterminate:l,disabled:o.length===0,checked:s,onChange:v}),h.createElement("span",{className:j.sheetsFilterPanelValuesItemText},`${r.t("sheets-filter.panel.select-all")}`),h.createElement("span",{className:j.sheetsFilterPanelValuesItemCount},`(${i.checked}/${i.checked+i.unchecked})`))),h.createElement("div",{className:j.sheetsFilterPanelValuesVirtual},h.createElement(Br,{style:{paddingRight:8},data:o,height:190,itemHeight:32,itemKey:d=>`${d.value}----${d.checked}`},d=>h.createElement("div",{className:j.sheetsFilterPanelValuesItem},h.createElement("div",{className:j.sheetsFilterPanelValuesItemInner},h.createElement(G.Checkbox,{checked:d.checked,onChange:()=>u(d,!d.checked)}),h.createElement(G.Tooltip,{showIfEllipsis:!0,placement:"top",title:d.value},h.createElement("span",{className:j.sheetsFilterPanelValuesItemText},d.value)),h.createElement("span",{className:j.sheetsFilterPanelValuesItemCount},`(${d.count})`),h.createElement(G.Button,{className:j.sheetsFilterPanelValuesItemExcludeButton,size:"small",type:"link",onClick:()=>c(d)},a)))))))}function Ui(){var g;const e=Me.useDependency(be),t=Me.useDependency(m.LocaleService),r=Me.useDependency(m.ICommandService),n=$.useObservable(e.filterBy$,void 0,!0),o=$.useObservable(e.filterByModel$,void 0,!1),a=$.useObservable(()=>(o==null?void 0:o.canApply$)||N.of(!1),void 0,!1,[o]),i=Hi(t),s=!$.useObservable(e.hasCriteria$),l=h.useCallback(C=>{r.executeCommand(Ht.id,{filterBy:C})},[r]),u=h.useCallback(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(Ae.id)},[o,r]),c=h.useCallback(()=>{r.executeCommand(Ae.id)},[r]),v=h.useCallback(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(Ae.id)},[o,r]),d=(g=Me.useDependency(f.SheetsFilterService).activeFilterModel)==null?void 0:g.getRange(),E=e.col,S=$.useComponentsOfPart(oe.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return h.createElement("div",{className:j.sheetsFilterPanel},h.createElement($.ComponentContainer,{components:S,sharedProps:{range:d,colIndex:E,onClose:c}}),h.createElement("div",{className:j.sheetsFilterPanelHeader},h.createElement(G.Segmented,{value:n,options:i,onChange:C=>l(C)})),o?h.createElement("div",{className:j.sheetsFilterPanelContent},n===it.VALUES?h.createElement(Di,{model:o}):h.createElement(bn,{model:o})):null,h.createElement("div",{className:j.sheetsFilterPanelFooter},h.createElement(G.Button,{type:"link",onClick:u,disabled:s},t.t("sheets-filter.panel.clear-filter")),h.createElement("span",{className:j.sheetsFilterPanelFooterPrimaryButtons},h.createElement(G.Button,{type:"default",onClick:c},t.t("sheets-filter.panel.cancel")),h.createElement(G.Button,{disabled:!a,type:"primary",onClick:v},t.t("sheets-filter.panel.confirm")))))}function Hi(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{label:e.t("sheets-filter.panel.by-values"),value:it.VALUES},{label:e.t("sheets-filter.panel.by-conditions"),value:it.CONDITIONS}],[t,e])}const Bi={id:Fe.id,binding:$.KeyCode.L|$.MetaKeys.CTRL_COMMAND|$.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:oe.whenSheetEditorFocused,group:"4_sheet-edit"};function xi(e){const t=e.get(f.SheetsFilterService);return{id:Fe.id,group:$.MenuGroup.TOOLBAR_FORMULAS_INSERT,type:$.MenuItemType.BUTTON_SELECTOR,icon:"FilterSingle",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",positions:[$.MenuPosition.TOOLBAR_START],hidden$:$.getMenuHiddenObservable(e,m.UniverInstanceType.UNIVER_SHEET),activated$:t.activeFilterModel$.pipe(N.map(r=>!!r)),disabled$:oe.getCurrentRangeDisable$(e,{workbookTypes:[Y.WorkbookEditablePermission],worksheetTypes:[Y.WorksheetFilterPermission,Y.WorksheetEditPermission],rangeTypes:[Y.RangeProtectionPermissionEditPoint]})}}function Wi(e){const t=e.get(f.SheetsFilterService);return{id:Lt.id,group:$.MenuGroup.TOOLBAR_OTHERS,type:$.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",positions:[Fe.id],hidden$:$.getMenuHiddenObservable(e,m.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(N.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(N.map(o=>!o)))!=null?n:N.of(!0)}))}}function ji(e){const t=e.get(f.SheetsFilterService);return{id:$t.id,group:$.MenuGroup.TOOLBAR_OTHERS,type:$.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",positions:[Fe.id],hidden$:$.getMenuHiddenObservable(e,m.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(N.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(N.map(o=>!o)))!=null?n:N.of(!0)}))}}const Ce=16,Vi=new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");class xr{static drawNoCriteria(t,r,n,o){t.save(),Re.Rect.drawWith(t,{radius:2,width:Ce,height:Ce,fill:o}),t.lineCap="square",t.strokeStyle=n,t.scale(r/Ce,r/Ce),t.beginPath(),t.lineWidth=1,t.lineCap="round",t.moveTo(3,4),t.lineTo(13,4),t.moveTo(4.5,8),t.lineTo(11.5,8),t.moveTo(6,12),t.lineTo(10,12),t.stroke(),t.restore()}static drawHasCriteria(t,r,n,o){t.save(),Re.Rect.drawWith(t,{radius:2,width:Ce,height:Ce,fill:o}),t.scale(r/Ce,r/Ce),t.fillStyle=n,t.fill(Vi),t.restore()}}var ki=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,Qi=(e,t,r,n)=>{for(var o=n>1?void 0:n?zi(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&ki(t,r,o),o},Gt=(e,t)=>(r,n)=>t(r,n,e);const Se=16,Ct=1;let Yt=class extends Re.Shape{constructor(t,r,n,o,a){super(t,r);A(this,"_cellWidth",0);A(this,"_cellHeight",0);A(this,"_filterParams");A(this,"_hovered",!1);this._contextService=n,this._commandService=o,this._themeService=a,this.setShapeProps(r),this.onPointerDown$.subscribeEvent(i=>this.onPointerDown(i)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(t){typeof t.cellHeight<"u"&&(this._cellHeight=t.cellHeight),typeof t.cellWidth<"u"&&(this._cellWidth=t.cellWidth),typeof t.filterParams<"u"&&(this._filterParams=t.filterParams),this.transformByState({width:t.width,height:t.height})}_draw(t){const r=this._cellHeight,n=this._cellWidth,o=Se-n,a=Se-r;t.save();const i=new Path2D;i.rect(o,a,n,r),t.clip(i);const{hasCriteria:s}=this._filterParams,l=this._themeService.getCurrentTheme().primaryColor,u=this._hovered?this._themeService.getCurrentTheme().grey50:"rgba(255, 255, 255, 1.0)";s?xr.drawHasCriteria(t,Se,l,u):xr.drawNoCriteria(t,Se,l,u),t.restore()}onPointerDown(t){if(t.button===2)return;const{col:r,unitId:n,subUnitId:o}=this._filterParams;this._contextService.getContextValue(we)||!this._commandService.hasCommand(We.id)||setTimeout(()=>{this._commandService.executeCommand(We.id,{unitId:n,subUnitId:o,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Yt=Qi([Gt(2,m.IContextService),Gt(3,m.ICommandService),Gt(4,M.Inject(m.ThemeService))],Yt);var Gi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,qi=(e,t,r,n)=>{for(var o=n>1?void 0:n?Yi(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Gi(t,r,o),o},ge=(e,t)=>(r,n)=>t(r,n,e);const Xi=1e3,Ki=5e3;let qt=class extends m.RxDisposable{constructor(t,r,n,o,a,i,s,l,u,c){super();A(this,"_filterRangeShape",null);A(this,"_buttonRenderDisposable",null);A(this,"_filterButtonShapes",[]);this._context=t,this._injector=r,this._sheetSkeletonManagerService=n,this._sheetsFilterService=o,this._themeService=a,this._sheetInterceptorService=i,this._sheetsRenderService=s,this._commandService=l,this._renderManagerService=u,this._selectionRenderService=c,[f.SetSheetsFilterRangeMutation,f.SetSheetsFilterCriteriaMutation,f.RemoveSheetsFilterMutation,f.ReCalcSheetsFilterMutation].forEach(v=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(v.id))),this._initRenderer()}_initRenderer(){N.combineLatest([this._selectionRenderService.usable$,this._sheetSkeletonManagerService.currentSkeleton$]).pipe(N.filter(([t])=>t),N.switchMap(([t,r])=>{var l,u;if(!r)return N.of(null);const{unit:n,unitId:o}=this._context,a=((l=n.getActiveSheet())==null?void 0:l.getSheetId())||"",i=(u=this._sheetsFilterService.getFilterModel(o,a))!=null?u:void 0,s=()=>({unitId:o,worksheetId:a,filterModel:i,range:i==null?void 0:i.getRange(),skeleton:r.skeleton});return m.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(N.filter(([c])=>c.type===m.CommandType.MUTATION&&c.params.unitId===n.getUnitId()&&f.FILTER_MUTATIONS.has(c.id)),N.throttleTime(20,void 0,{leading:!1,trailing:!0}),N.map(s),N.startWith(s()))}),N.takeUntil(this.dispose$)).subscribe(t=>{this._disposeRendering(),!(!t||!t.range)&&(this._renderRange(t.unitId,t.range,t.skeleton),this._renderButtons(t))})}_renderRange(t,r,n){const o=this._renderManagerService.getRenderById(t);if(!o)return;const{scene:a}=o,{rangeWithCoord:i,style:s}=this._selectionRenderService.attachSelectionWithCoord({range:r,primary:null,style:null}),{rowHeaderWidth:l,columnHeaderHeight:u}=n,c=this._filterRangeShape=new oe.SelectionShape(a,Xi,!0,this._themeService);c.update(i,l,u,{hasAutoFill:!1,fill:"rgba(0, 0, 0, 0.0)",...s}),c.setEvent(!1),a.makeDirty(!0)}_renderButtons(t){const{range:r,filterModel:n,unitId:o,skeleton:a,worksheetId:i}=t,s=this._renderManagerService.getRenderById(o);if(!s)return;const{scene:l}=s;this._interceptCellContent(t.range);const{startColumn:u,endColumn:c,startRow:v}=r;for(let _=u;_<=c;_++){const d=`sheets-filter-button-${_}`,E=oe.getCoordByCell(v,_,l,a),{startX:S,startY:g,endX:C,endY:b}=E,R=C-S,I=b-g;if(I<=Ct||R<=Ct)continue;const k=!!n.getFilterColumn(_),U=C-Se-Ct,F=b-Se-Ct,H={left:U,top:F,height:Se,width:Se,zIndex:Ki,cellHeight:I,cellWidth:R,filterParams:{unitId:o,subUnitId:i,col:_,hasCriteria:k}},x=this._injector.createInstance(Yt,d,H);this._filterButtonShapes.push(x)}l.addObjects(this._filterButtonShapes),l.makeDirty()}_interceptCellContent(t){const{startRow:r,startColumn:n,endColumn:o}=t;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(Y.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(a,i,s)=>{const{row:l,col:u}=i;return l!==r||u<n||u>o?s(a):s({...a,fontRenderExtension:{...a==null?void 0:a.fontRenderExtension,rightOffset:Se}})},priority:10})}_disposeRendering(){var t,r;(t=this._filterRangeShape)==null||t.dispose(),this._filterButtonShapes.forEach(n=>n.dispose()),(r=this._buttonRenderDisposable)==null||r.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};qt=qi([ge(1,M.Inject(M.Injector)),ge(2,M.Inject(oe.SheetSkeletonManagerService)),ge(3,M.Inject(f.SheetsFilterService)),ge(4,M.Inject(m.ThemeService)),ge(5,M.Inject(Y.SheetInterceptorService)),ge(6,M.Inject(oe.SheetsRenderService)),ge(7,m.ICommandService),ge(8,Re.IRenderManagerService),ge(9,oe.ISelectionRenderService)],qt);var Zi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,eo=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ji(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Zi(t,r,o),o},to=(e,t)=>(r,n)=>t(r,n,e);let ze=class extends m.RxDisposable{constructor(e){super(),this._renderManagerService=e,this._initRenderControllers()}_initRenderControllers(){this.disposeWithMe(this._renderManagerService.registerRenderModule(m.UniverInstanceType.UNIVER_SHEET,qt))}};ze=eo([to(0,Re.IRenderManagerService)],ze),m.runOnLifecycle(m.LifecycleStages.Rendered,ze);var ro=Object.defineProperty,no=Object.getOwnPropertyDescriptor,io=(e,t,r,n)=>{for(var o=n>1?void 0:n?no(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&ro(t,r,o),o},ue=(e,t)=>(r,n)=>t(r,n,e);const Wr={},jr="FILTER_PANEL_POPUP";let Qe=class extends ze{constructor(t,r,n,o,a,i,s,l,u,c,v,_,d){super(d);A(this,"_popupDisposable");this._config=t,this._injector=r,this._componentManager=n,this._sheetsFilterPanelService=o,this._sheetCanvasPopupService=a,this._sheetsFilterService=i,this._localeService=s,this._shortcutService=l,this._commandService=u,this._menuService=c,this._contextService=v,this._messageService=_,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Bi].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_initCommands(){[Fe,Pe,Lt,$t,Ht,We,Ae].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initMenuItems(){const{menu:t={}}=this._config;[xi,Wi,ji].forEach(r=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r),t))})}_initUI(){this.disposeWithMe(this._componentManager.register(jr,Ui)),this.disposeWithMe(this._componentManager.register("FilterSingle",sr)),this.disposeWithMe(this._contextService.subscribeContextValue$(we).pipe(N.distinctUntilChanged()).subscribe(t=>{t?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(t=>{t&&this._messageService.show({type:G.MessageType.Error,content:this._localeService.t(t)})}))}_openFilterPopup(){const t=this._sheetsFilterPanelService.filterModel;if(!t)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const r=t.getRange(),n=this._sheetsFilterPanelService.col,{startRow:o}=r;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(o,n,{componentKey:jr,direction:"horizontal",closeOnSelfTarget:!0,onClickOutside:()=>this._commandService.syncExecuteCommand(Ae.id),offset:[5,0]})}_closeFilterPopup(){var t;(t=this._popupDisposable)==null||t.dispose(),this._popupDisposable=null}};Qe=io([m.OnLifecycle(m.LifecycleStages.Ready,Qe),ue(1,M.Inject(M.Injector)),ue(2,M.Inject($.ComponentManager)),ue(3,M.Inject(be)),ue(4,M.Inject(oe.SheetCanvasPopManagerService)),ue(5,M.Inject(f.SheetsFilterService)),ue(6,M.Inject(m.LocaleService)),ue(7,$.IShortcutService),ue(8,m.ICommandService),ue(9,$.IMenuService),ue(10,m.IContextService),ue(11,$.IMessageService),ue(12,Re.IRenderManagerService)],Qe);var oo=Object.defineProperty,so=Object.getOwnPropertyDescriptor,ao=(e,t,r,n)=>{for(var o=n>1?void 0:n?so(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&oo(t,r,o),o},Ot=(e,t)=>(r,n)=>t(r,n,e);let Ge=class extends m.Disposable{constructor(e,t,r,n){super(),this._sheetsFilterService=e,this._localeService=t,this._commandService=r,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{var t;if(e.id===Fe.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithoutRange({workbookTypes:[Y.WorkbookEditablePermission],rangeTypes:[Y.RangeProtectionPermissionViewPoint],worksheetTypes:[Y.WorksheetFilterPermission,Y.WorksheetEditPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr"))),e.id===We.id){const r=e.params,{unitId:n,subUnitId:o}=r,a=(t=this._sheetsFilterService.getFilterModel(n,o))==null?void 0:t.getRange(),i=m.Tools.deepClone(a);i&&(i.startColumn=r.col,i.endColumn=r.col,this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[Y.WorkbookEditablePermission],rangeTypes:[Y.RangeProtectionPermissionViewPoint],worksheetTypes:[Y.WorksheetFilterPermission,Y.WorksheetEditPermission]},[i])||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr")))}}))}};Ge=ao([m.OnLifecycle(m.LifecycleStages.Ready,Ge),Ot(0,M.Inject(f.SheetsFilterService)),Ot(1,M.Inject(m.LocaleService)),Ot(2,m.ICommandService),Ot(3,M.Inject(oe.SheetPermissionInterceptorBaseController))],Ge);var Vr=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,uo=(e,t,r)=>t in e?Vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,co=(e,t,r,n)=>{for(var o=n>1?void 0:n?lo(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Vr(t,r,o),o},kr=(e,t)=>(r,n)=>t(r,n,e),zr=(e,t,r)=>uo(e,typeof t!="symbol"?t+"":t,r);const fo="SHEET_FILTER_UI_PLUGIN";P.UniverSheetsFilterUIPlugin=class extends m.Plugin{constructor(t={},r,n){super(),this._config=t,this._injector=r,this._localeService=n,this._config=m.Tools.deepMerge({},Wr,this._config)}onStarting(t){[[be],[Ge],[Qe,{useFactory:()=>this._injector.createInstance(Qe,this._config)}]].forEach(r=>t.add(r))}},zr(P.UniverSheetsFilterUIPlugin,"type",m.UniverInstanceType.UNIVER_SHEET),zr(P.UniverSheetsFilterUIPlugin,"pluginName",fo),P.UniverSheetsFilterUIPlugin=co([m.DependentOn(f.UniverSheetsFilterPlugin),kr(1,M.Inject(M.Injector)),kr(2,M.Inject(m.LocaleService))],P.UniverSheetsFilterUIPlugin);var Qr=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,mo=(e,t,r)=>t in e?Qr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vo=(e,t,r,n)=>{for(var o=n>1?void 0:n?ho(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Qr(t,r,o),o},po=(e,t)=>(r,n)=>t(r,n,e),Gr=(e,t,r)=>mo(e,typeof t!="symbol"?t+"":t,r);const _o="SHEET_FILTER_UI_PLUGIN";P.UniverSheetsFilterMobileUIPlugin=class extends m.Plugin{constructor(t={},r){super(),this._config=t,this._injector=r,this._config=m.Tools.deepMerge({},Wr,this._config)}onStarting(t){[[Ge],[ze]].forEach(r=>t.add(r))}},Gr(P.UniverSheetsFilterMobileUIPlugin,"type",m.UniverInstanceType.UNIVER_SHEET),Gr(P.UniverSheetsFilterMobileUIPlugin,"pluginName",_o),P.UniverSheetsFilterMobileUIPlugin=vo([m.DependentOn(f.UniverSheetsFilterPlugin),po(1,M.Inject(M.Injector))],P.UniverSheetsFilterMobileUIPlugin),P.ChangeFilterByOperation=Ht,P.ClearSheetsFilterCriteriaCommand=Lt,P.CloseFilterPanelOperation=Ae,P.OpenFilterPanelOperation=We,P.ReCalcSheetsFilterCommand=$t,P.SetSheetsFilterCriteriaCommand=Pe,P.SmartToggleSheetsFilterCommand=Fe,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
14
+ */var Ut=Symbol.for("react.element"),Ht=Symbol.for("react.portal"),st=Symbol.for("react.fragment"),at=Symbol.for("react.strict_mode"),lt=Symbol.for("react.profiler"),ut=Symbol.for("react.provider"),ct=Symbol.for("react.context"),Nn=Symbol.for("react.server_context"),ft=Symbol.for("react.forward_ref"),ht=Symbol.for("react.suspense"),dt=Symbol.for("react.suspense_list"),mt=Symbol.for("react.memo"),vt=Symbol.for("react.lazy"),wn=Symbol.for("react.offscreen"),fr;fr=Symbol.for("react.module.reference");function ae(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Ut:switch(e=e.type,e){case st:case lt:case at:case ht:case dt:return e;default:switch(e=e&&e.$$typeof,e){case Nn:case ct:case ft:case vt:case mt:case ut:return e;default:return t}}case Ht:return t}}}$.ContextConsumer=ct,$.ContextProvider=ut,$.Element=Ut,$.ForwardRef=ft,$.Fragment=st,$.Lazy=vt,$.Memo=mt,$.Portal=Ht,$.Profiler=lt,$.StrictMode=at,$.Suspense=ht,$.SuspenseList=dt,$.isAsyncMode=function(){return!1},$.isConcurrentMode=function(){return!1},$.isContextConsumer=function(e){return ae(e)===ct},$.isContextProvider=function(e){return ae(e)===ut},$.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ut},$.isForwardRef=function(e){return ae(e)===ft},$.isFragment=function(e){return ae(e)===st},$.isLazy=function(e){return ae(e)===vt},$.isMemo=function(e){return ae(e)===mt},$.isPortal=function(e){return ae(e)===Ht},$.isProfiler=function(e){return ae(e)===lt},$.isStrictMode=function(e){return ae(e)===at},$.isSuspense=function(e){return ae(e)===ht},$.isSuspenseList=function(e){return ae(e)===dt},$.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===st||e===lt||e===at||e===ht||e===dt||e===wn||typeof e=="object"&&e!==null&&(e.$$typeof===vt||e.$$typeof===mt||e.$$typeof===ut||e.$$typeof===ct||e.$$typeof===ft||e.$$typeof===fr||e.getModuleId!==void 0)},$.typeOf=ae,cr.exports=$;var We=cr.exports;function Bt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=[];return d.Children.forEach(e,function(n){n==null&&!t.keepEmpty||(Array.isArray(n)?r=r.concat(Bt(n)):We.isFragment(n)&&n.props?r=r.concat(Bt(n.props.children,t)):r.push(n))}),r}function hr(e){return e instanceof HTMLElement||e instanceof SVGElement}function An(e){return e&&se(e)==="object"&&hr(e.nativeElement)?e.nativeElement:hr(e)?e:null}function pt(e){var t=An(e);if(t)return t;if(e instanceof d.Component){var r;return(r=tt.findDOMNode)===null||r===void 0?void 0:r.call(tt,e)}return null}function Ln(e,t,r){var n=p.useRef({});return(!("value"in n.current)||r(n.current.condition,t))&&(n.current.value=e(),n.current.condition=t),n.current.value}var $n=function(t,r){typeof t=="function"?t(r):se(t)==="object"&&t&&"current"in t&&(t.current=r)},Dn=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r.filter(Boolean);return o.length<=1?o[0]:function(a){r.forEach(function(i){$n(i,a)})}},Un=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Ln(function(){return Dn.apply(void 0,r)},r,function(o,a){return o.length!==a.length||o.every(function(i,s){return i!==a[s]})})},Hn=function(t){var r,n,o=We.isMemo(t)?t.type.type:t.type;return!(typeof o=="function"&&!((r=o.prototype)!==null&&r!==void 0&&r.render)&&o.$$typeof!==We.ForwardRef||typeof t=="function"&&!((n=t.prototype)!==null&&n!==void 0&&n.render)&&t.$$typeof!==We.ForwardRef)};function dr(e){return d.isValidElement(e)&&!We.isFragment(e)}Number(d.version.split(".")[0])>=19;var xt=p.createContext(null);function Bn(e){var t=e.children,r=e.onBatchResize,n=p.useRef(0),o=p.useRef([]),a=p.useContext(xt),i=p.useCallback(function(s,l,u){n.current+=1;var h=n.current;o.current.push({size:s,element:l,data:u}),Promise.resolve().then(function(){h===n.current&&(r==null||r(o.current),o.current=[])}),a==null||a(s,l,u)},[r,a]);return p.createElement(xt.Provider,{value:i},t)}var mr=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(o,a){return o[0]===r?(n=a,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,a=this.__entries__;o<a.length;o++){var i=a[o];r.call(n,i[1],i[0])}},t}()}(),Wt=typeof window<"u"&&typeof document<"u"&&window.document===document,_t=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),xn=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(_t):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Wn=2;function jn(e,t){var r=!1,n=!1,o=0;function a(){r&&(r=!1,e()),n&&s()}function i(){xn(a)}function s(){var l=Date.now();if(r){if(l-o<Wn)return;n=!0}else r=!0,n=!1,setTimeout(i,t);o=l}return s}var Vn=20,kn=["top","right","bottom","left","width","height","size","weight"],zn=typeof MutationObserver<"u",Qn=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=jn(this.refresh.bind(this),Vn)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var r=this.observers_,n=r.indexOf(t);~n&&r.splice(n,1),!r.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return t.forEach(function(r){return r.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!Wt||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),zn?(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(){!Wt||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=kn.some(function(a){return!!~n.indexOf(a)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),vr=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},we=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||_t},pr=gt(0,0,0,0);function St(e){return parseFloat(e)||0}function _r(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(n,o){var a=e["border-"+o+"-width"];return n+St(a)},0)}function Gn(e){for(var t=["top","right","bottom","left"],r={},n=0,o=t;n<o.length;n++){var a=o[n],i=e["padding-"+a];r[a]=St(i)}return r}function Yn(e){var t=e.getBBox();return gt(0,0,t.width,t.height)}function qn(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return pr;var n=we(e).getComputedStyle(e),o=Gn(n),a=o.left+o.right,i=o.top+o.bottom,s=St(n.width),l=St(n.height);if(n.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=_r(n,"left","right")+a),Math.round(l+i)!==r&&(l-=_r(n,"top","bottom")+i)),!Kn(e)){var u=Math.round(s+a)-t,h=Math.round(l+i)-r;Math.abs(u)!==1&&(s-=u),Math.abs(h)!==1&&(l-=h)}return gt(o.left,o.top,s,l)}var Xn=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof we(e).SVGGraphicsElement}:function(e){return e instanceof we(e).SVGElement&&typeof e.getBBox=="function"}}();function Kn(e){return e===we(e).document.documentElement}function Zn(e){return Wt?Xn(e)?Yn(e):qn(e):pr}function Jn(e){var t=e.x,r=e.y,n=e.width,o=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(a.prototype);return vr(i,{x:t,y:r,width:n,height:o,top:r,right:t+n,bottom:o+r,left:t}),i}function gt(e,t,r,n){return{x:e,y:t,width:r,height:n}}var ei=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=gt(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Zn(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}(),ti=function(){function e(t,r){var n=Jn(r);vr(this,{target:t,contentRect:n})}return e}(),ri=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new mr,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=r,this.callbackCtx_=n}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof we(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new ei(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 we(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)&&(r.delete(t),r.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&t.activeObservations_.push(r)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,r=this.activeObservations_.map(function(n){return new ti(n.target,n.broadcastRect())});this.callback_.call(t,r,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),Sr=typeof WeakMap<"u"?new WeakMap:new mr,gr=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=Qn.getInstance(),n=new ri(t,r,this);Sr.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){gr.prototype[e]=function(){var t;return(t=Sr.get(this))[e].apply(t,arguments)}});var ni=function(){return typeof _t.ResizeObserver<"u"?_t.ResizeObserver:gr}(),be=new Map;function ii(e){e.forEach(function(t){var r,n=t.target;(r=be.get(n))===null||r===void 0||r.forEach(function(o){return o(n)})})}var Er=new ni(ii);function oi(e,t){be.has(e)||(be.set(e,new Set),Er.observe(e)),be.get(e).add(t)}function si(e,t){be.has(e)&&(be.get(e).delete(t),be.get(e).size||(Er.unobserve(e),be.delete(e)))}function br(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ai(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,sr(n.key),n)}}function yr(e,t,r){return t&&ai(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function jt(e,t){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},jt(e,t)}function li(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jt(e,t)}function Et(e){return Et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Et(e)}function Cr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Cr=function(){return!!e})()}function ui(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ci(e,t){if(t&&(se(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ui(e)}function fi(e){var t=Cr();return function(){var r,n=Et(e);if(t){var o=Et(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ci(this,r)}}var hi=function(e){li(r,e);var t=fi(r);function r(){return br(this,r),t.apply(this,arguments)}return yr(r,[{key:"render",value:function(){return this.props.children}}]),r}(p.Component);function di(e,t){var r=e.children,n=e.disabled,o=p.useRef(null),a=p.useRef(null),i=p.useContext(xt),s=typeof r=="function",l=s?r(o):r,u=p.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),h=!s&&p.isValidElement(l)&&Hn(l),v=h?l.ref:null,_=Un(v,o),m=function(){var C;return pt(o.current)||(o.current&&se(o.current)==="object"?pt((C=o.current)===null||C===void 0?void 0:C.nativeElement):null)||pt(a.current)};p.useImperativeHandle(t,function(){return m()});var E=p.useRef(e);E.current=e;var S=p.useCallback(function(g){var C=E.current,b=C.onResize,I=C.data,P=g.getBoundingClientRect(),V=P.width,D=P.height,F=g.offsetWidth,U=g.offsetHeight,B=Math.floor(V),k=Math.floor(D);if(u.current.width!==B||u.current.height!==k||u.current.offsetWidth!==F||u.current.offsetHeight!==U){var J={width:B,height:k,offsetWidth:F,offsetHeight:U};u.current=J;var X=F===Math.round(V)?V:F,ue=U===Math.round(D)?D:U,K=Y(Y({},J),{},{offsetWidth:X,offsetHeight:ue});i==null||i(K,g,I),b&&Promise.resolve().then(function(){b(K,g)})}},[]);return p.useEffect(function(){var g=m();return g&&!n&&oi(g,S),function(){return si(g,S)}},[o.current,n]),p.createElement(hi,{ref:a},h?p.cloneElement(l,{ref:_}):l)}var mi=p.forwardRef(di),vi="rc-observer-key";function pi(e,t){var r=e.children,n=typeof r=="function"?[r]:Bt(r);return n.map(function(o,a){var i=(o==null?void 0:o.key)||"".concat(vi,"-").concat(a);return p.createElement(mi,xe({},e,{key:i,ref:a===0?t:void 0}),o)})}var Vt=p.forwardRef(pi);Vt.Collection=Bn;function Or(e){var t=p.useRef();t.current=e;var r=p.useCallback(function(){for(var n,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return(n=t.current)===null||n===void 0?void 0:n.call.apply(n,[t].concat(a))},[]);return r}function _i(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Tr=_i()?p.useLayoutEffect:p.useEffect,je=function(t,r){var n=p.useRef(!0);Tr(function(){return t(n.current)},r),Tr(function(){return n.current=!1,function(){n.current=!0}},[])},Fr=p.forwardRef(function(e,t){var r=e.height,n=e.offsetY,o=e.offsetX,a=e.children,i=e.prefixCls,s=e.onInnerResize,l=e.innerProps,u=e.rtl,h=e.extra,v={},_={display:"flex",flexDirection:"column"};return n!==void 0&&(v={height:r,position:"relative",overflow:"hidden"},_=Y(Y({},_),{},Z(Z(Z(Z(Z({transform:"translateY(".concat(n,"px)")},u?"marginRight":"marginLeft",-o),"position","absolute"),"left",0),"right",0),"top",0))),p.createElement("div",{style:v},p.createElement(Vt,{onResize:function(E){var S=E.offsetHeight;S&&s&&s()}},p.createElement("div",xe({style:_,className:ot(Z({},"".concat(i,"-holder-inner"),i)),ref:t},l),a,h)))});Fr.displayName="Filler";function Si(e){var t=e.children,r=e.setRef,n=p.useCallback(function(o){r(o)},[]);return p.cloneElement(t,{ref:n})}function gi(e,t,r,n,o,a,i,s){var l=s.getKey;return e.slice(t,r+1).map(function(u,h){var v=t+h,_=i(u,v,{style:{width:n},offsetX:o}),m=l(u);return p.createElement(Si,{key:m,setRef:function(S){return a(u,S)}},_)})}function Ei(e,t,r){var n=e.length,o=t.length,a,i;if(n===0&&o===0)return null;n<o?(a=e,i=t):(a=t,i=e);var s={__EMPTY_ITEM__:!0};function l(E){return E!==void 0?r(E):s}for(var u=null,h=Math.abs(n-o)!==1,v=0;v<i.length;v+=1){var _=l(a[v]),m=l(i[v]);if(_!==m){u=v,h=h||_!==l(i[v+1]);break}}return u===null?null:{index:u,multiple:h}}function bi(e,t,r){var n=p.useState(e),o=q(n,2),a=o[0],i=o[1],s=p.useState(null),l=q(s,2),u=l[0],h=l[1];return p.useEffect(function(){var v=Ei(a||[],e||[],t);(v==null?void 0:v.index)!==void 0&&h(e[v.index]),i(e)},[e]),[u]}var Pr=function(t){return+setTimeout(t,16)},Ir=function(t){return clearTimeout(t)};typeof window<"u"&&"requestAnimationFrame"in window&&(Pr=function(t){return window.requestAnimationFrame(t)},Ir=function(t){return window.cancelAnimationFrame(t)});var Rr=0,kt=new Map;function Mr(e){kt.delete(e)}var de=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;Rr+=1;var n=Rr;function o(a){if(a===0)Mr(n),t();else{var i=Pr(function(){o(a-1)});kt.set(n,i)}}return o(r),n};de.cancel=function(e){var t=kt.get(e);return Mr(e),Ir(t)};var Nr=(typeof navigator>"u"?"undefined":se(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const wr=function(e,t,r,n){var o=d.useRef(!1),a=d.useRef(null);function i(){clearTimeout(a.current),o.current=!0,a.current=setTimeout(function(){o.current=!1},50)}var s=d.useRef({top:e,bottom:t,left:r,right:n});return s.current.top=e,s.current.bottom=t,s.current.left=r,s.current.right=n,function(l,u){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,v=l?u<0&&s.current.left||u>0&&s.current.right:u<0&&s.current.top||u>0&&s.current.bottom;return h&&v?(clearTimeout(a.current),o.current=!1):(!v||o.current)&&i(),!o.current&&v}};function yi(e,t,r,n,o,a,i){var s=d.useRef(0),l=d.useRef(null),u=d.useRef(null),h=d.useRef(!1),v=wr(t,r,n,o);function _(b,I){de.cancel(l.current),s.current+=I,u.current=I,!v(!1,I)&&(Nr||b.preventDefault(),l.current=de(function(){var P=h.current?10:1;i(s.current*P),s.current=0}))}function m(b,I){i(I,!0),Nr||b.preventDefault()}var E=d.useRef(null),S=d.useRef(null);function g(b){if(e){de.cancel(S.current),S.current=de(function(){E.current=null},2);var I=b.deltaX,P=b.deltaY,V=b.shiftKey,D=I,F=P;(E.current==="sx"||!E.current&&V&&P&&!I)&&(D=P,F=0,E.current="sx");var U=Math.abs(D),B=Math.abs(F);E.current===null&&(E.current=a&&U>B?"x":"y"),E.current==="y"?_(b,F):m(b,D)}}function C(b){e&&(h.current=b.detail===u.current)}return[g,C]}function Ci(e,t,r,n){var o=p.useMemo(function(){return[new Map,[]]},[e,r.id,n]),a=q(o,2),i=a[0],s=a[1],l=function(h){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,_=i.get(h),m=i.get(v);if(_===void 0||m===void 0)for(var E=e.length,S=s.length;S<E;S+=1){var g,C=e[S],b=t(C);i.set(b,S);var I=(g=r.get(b))!==null&&g!==void 0?g:n;if(s[S]=(s[S-1]||0)+I,b===h&&(_=S),b===v&&(m=S),_!==void 0&&m!==void 0)break}return{top:s[_-1]||0,bottom:s[m]}};return l}var Oi=function(){function e(){br(this,e),Z(this,"maps",void 0),Z(this,"id",0),this.maps=Object.create(null)}return yr(e,[{key:"set",value:function(r,n){this.maps[r]=n,this.id+=1}},{key:"get",value:function(r){return this.maps[r]}}]),e}();function Ti(e,t,r){var n=p.useState(0),o=q(n,2),a=o[0],i=o[1],s=d.useRef(new Map),l=d.useRef(new Oi),u=d.useRef();function h(){de.cancel(u.current)}function v(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;h();var E=function(){s.current.forEach(function(g,C){if(g&&g.offsetParent){var b=pt(g),I=b.offsetHeight;l.current.get(C)!==I&&l.current.set(C,b.offsetHeight)}}),i(function(g){return g+1})};m?E():u.current=de(E)}function _(m,E){var S=e(m);s.current.get(S),E?(s.current.set(S,E),v()):s.current.delete(S)}return d.useEffect(function(){return h},[]),[_,v,l.current,a]}var Ar=14/15;function Fi(e,t,r){var n=d.useRef(!1),o=d.useRef(0),a=d.useRef(0),i=d.useRef(null),s=d.useRef(null),l,u=function(m){if(n.current){var E=Math.ceil(m.touches[0].pageX),S=Math.ceil(m.touches[0].pageY),g=o.current-E,C=a.current-S,b=Math.abs(g)>Math.abs(C);b?o.current=E:a.current=S,r(b,b?g:C)&&m.preventDefault(),clearInterval(s.current),s.current=setInterval(function(){b?g*=Ar:C*=Ar;var I=Math.floor(b?g:C);(!r(b,I,!0)||Math.abs(I)<=.1)&&clearInterval(s.current)},16)}},h=function(){n.current=!1,l()},v=function(m){l(),m.touches.length===1&&!n.current&&(n.current=!0,o.current=Math.ceil(m.touches[0].pageX),a.current=Math.ceil(m.touches[0].pageY),i.current=m.target,i.current.addEventListener("touchmove",u,{passive:!1}),i.current.addEventListener("touchend",h,{passive:!0}))};l=function(){i.current&&(i.current.removeEventListener("touchmove",u),i.current.removeEventListener("touchend",h))},je(function(){return e&&t.current.addEventListener("touchstart",v,{passive:!0}),function(){var _;(_=t.current)===null||_===void 0||_.removeEventListener("touchstart",v),l(),clearInterval(s.current)}},[e])}var Pi=10;function Ii(e,t,r,n,o,a,i,s){var l=p.useRef(),u=p.useState(null),h=q(u,2),v=h[0],_=h[1];return je(function(){if(v&&v.times<Pi){if(!e.current){_(function(ee){return Y({},ee)});return}a();var m=v.targetAlign,E=v.originAlign,S=v.index,g=v.offset,C=e.current.clientHeight,b=!1,I=m,P=null;if(C){for(var V=m||E,D=0,F=0,U=0,B=Math.min(t.length-1,S),k=0;k<=B;k+=1){var J=o(t[k]);F=D;var X=r.get(J);U=F+(X===void 0?n:X),D=U}for(var ue=V==="top"?g:C-g,K=B;K>=0;K-=1){var Ae=o(t[K]),re=r.get(Ae);if(re===void 0){b=!0;break}if(ue-=re,ue<=0)break}switch(V){case"top":P=F-g;break;case"bottom":P=U-C+g;break;default:{var Ce=e.current.scrollTop,me=Ce+C;F<Ce?I="top":U>me&&(I="bottom")}}P!==null&&i(P),P!==v.lastTop&&(b=!0)}b&&_(Y(Y({},v),{},{times:v.times+1,targetAlign:I,lastTop:P}))}},[v,e.current]),function(m){if(m==null){s();return}if(de.cancel(l.current),typeof m=="number")i(m);else if(m&&se(m)==="object"){var E,S=m.align;"index"in m?E=m.index:E=t.findIndex(function(b){return o(b)===m.key});var g=m.offset,C=g===void 0?0:g;_({times:0,index:E,offset:C,originAlign:S})}}}function Lr(e,t){var r="touches"in e?e.touches[0]:e;return r[t?"pageX":"pageY"]}var $r=p.forwardRef(function(e,t){var r=e.prefixCls,n=e.rtl,o=e.scrollOffset,a=e.scrollRange,i=e.onStartMove,s=e.onStopMove,l=e.onScroll,u=e.horizontal,h=e.spinSize,v=e.containerSize,_=e.style,m=e.thumbStyle,E=p.useState(!1),S=q(E,2),g=S[0],C=S[1],b=p.useState(null),I=q(b,2),P=I[0],V=I[1],D=p.useState(null),F=q(D,2),U=F[0],B=F[1],k=!n,J=p.useRef(),X=p.useRef(),ue=p.useState(!1),K=q(ue,2),Ae=K[0],re=K[1],Ce=p.useRef(),me=function(){clearTimeout(Ce.current),re(!0),Ce.current=setTimeout(function(){re(!1)},3e3)},ee=a-v||0,Qe=v-h||0,x=p.useMemo(function(){if(o===0||ee===0)return 0;var ne=o/ee;return ne*Qe},[o,ee,Qe]),Pe=function(H){H.stopPropagation(),H.preventDefault()},Le=p.useRef({top:x,dragging:g,pageY:P,startTop:U});Le.current={top:x,dragging:g,pageY:P,startTop:U};var $e=function(H){C(!0),V(Lr(H,u)),B(Le.current.top),i(),H.stopPropagation(),H.preventDefault()};p.useEffect(function(){var ne=function(De){De.preventDefault()},H=J.current,fe=X.current;return H.addEventListener("touchstart",ne,{passive:!1}),fe.addEventListener("touchstart",$e,{passive:!1}),function(){H.removeEventListener("touchstart",ne),fe.removeEventListener("touchstart",$e)}},[]);var Ct=p.useRef();Ct.current=ee;var Ge=p.useRef();Ge.current=Qe,p.useEffect(function(){if(g){var ne,H=function(De){var Ye=Le.current,Tt=Ye.dragging,Ft=Ye.pageY,Pt=Ye.startTop;de.cancel(ne);var It=J.current.getBoundingClientRect(),Ue=v/(u?It.width:It.height);if(Tt){var qe=(Lr(De,u)-Ft)*Ue,Xe=Pt;!k&&u?Xe-=qe:Xe+=qe;var Rt=Ct.current,Mt=Ge.current,Yt=Mt?Xe/Mt:0,pe=Math.ceil(Yt*Rt);pe=Math.max(pe,0),pe=Math.min(pe,Rt),ne=de(function(){l(pe,u)})}},fe=function(){C(!1),s()};return window.addEventListener("mousemove",H,{passive:!0}),window.addEventListener("touchmove",H,{passive:!0}),window.addEventListener("mouseup",fe,{passive:!0}),window.addEventListener("touchend",fe,{passive:!0}),function(){window.removeEventListener("mousemove",H),window.removeEventListener("touchmove",H),window.removeEventListener("mouseup",fe),window.removeEventListener("touchend",fe),de.cancel(ne)}}},[g]),p.useEffect(function(){return me(),function(){clearTimeout(Ce.current)}},[o]),p.useImperativeHandle(t,function(){return{delayHidden:me}});var te="".concat(r,"-scrollbar"),ce={position:"absolute",visibility:Ae?null:"hidden"},ve={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(ce.height=8,ce.left=0,ce.right=0,ce.bottom=0,ve.height="100%",ve.width=h,k?ve.left=x:ve.right=x):(ce.width=8,ce.top=0,ce.bottom=0,k?ce.right=0:ce.left=0,ve.width="100%",ve.height=h,ve.top=x),p.createElement("div",{ref:J,className:ot(te,Z(Z(Z({},"".concat(te,"-horizontal"),u),"".concat(te,"-vertical"),!u),"".concat(te,"-visible"),Ae)),style:Y(Y({},ce),_),onMouseDown:Pe,onMouseMove:me},p.createElement("div",{ref:X,className:ot("".concat(te,"-thumb"),Z({},"".concat(te,"-thumb-moving"),g)),style:Y(Y({},ve),m),onMouseDown:$e}))}),Ri=20;function Dr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=e/t*e;return isNaN(r)&&(r=0),r=Math.max(r,Ri),Math.floor(r)}var Mi=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles"],Ni=[],wi={overflowY:"auto",overflowAnchor:"none"};function Ai(e,t){var r=e.prefixCls,n=r===void 0?"rc-virtual-list":r,o=e.className,a=e.height,i=e.itemHeight,s=e.fullHeight,l=s===void 0?!0:s,u=e.style,h=e.data,v=e.children,_=e.itemKey,m=e.virtual,E=e.direction,S=e.scrollWidth,g=e.component,C=g===void 0?"div":g,b=e.onScroll,I=e.onVirtualScroll,P=e.onVisibleChange,V=e.innerProps,D=e.extraRender,F=e.styles,U=In(e,Mi),B=p.useCallback(function(O){return typeof _=="function"?_(O):O==null?void 0:O[_]},[_]),k=Ti(B),J=q(k,4),X=J[0],ue=J[1],K=J[2],Ae=J[3],re=!!(m!==!1&&a&&i),Ce=p.useMemo(function(){return Object.values(K.maps).reduce(function(O,y){return O+y},0)},[K.id,K.maps]),me=re&&h&&(Math.max(i*h.length,Ce)>a||!!S),ee=E==="rtl",Qe=ot(n,Z({},"".concat(n,"-rtl"),ee),o),x=h||Ni,Pe=d.useRef(),Le=d.useRef(),$e=d.useRef(),Ct=d.useState(0),Ge=q(Ct,2),te=Ge[0],ce=Ge[1],ve=d.useState(0),ne=q(ve,2),H=ne[0],fe=ne[1],Ot=d.useState(!1),De=q(Ot,2),Ye=De[0],Tt=De[1],Ft=function(){Tt(!0)},Pt=function(){Tt(!1)},It={getKey:B};function Ue(O){ce(function(y){var A;typeof O=="function"?A=O(y):A=O;var z=bo(A);return Pe.current.scrollTop=z,z})}var qe=d.useRef({start:0,end:x.length}),Xe=d.useRef(),Rt=bi(x,B),Mt=q(Rt,1),Yt=Mt[0];Xe.current=Yt;var pe=p.useMemo(function(){if(!re)return{scrollHeight:void 0,start:0,end:x.length-1,offset:void 0};if(!me){var O;return{scrollHeight:((O=Le.current)===null||O===void 0?void 0:O.offsetHeight)||0,start:0,end:x.length-1,offset:void 0}}for(var y=0,A,z,Oe,Ro=x.length,et=0;et<Ro;et+=1){var Mo=x[et],No=B(Mo),an=K.get(No),tr=y+(an===void 0?i:an);tr>=te&&A===void 0&&(A=et,z=y),tr>te+a&&Oe===void 0&&(Oe=et),y=tr}return A===void 0&&(A=0,z=0,Oe=Math.ceil(a/i)),Oe===void 0&&(Oe=x.length-1),Oe=Math.min(Oe+1,x.length-1),{scrollHeight:y,start:A,end:Oe,offset:z}},[me,re,te,x,Ae,a]),He=pe.scrollHeight,Ke=pe.start,Ze=pe.end,Qr=pe.offset;qe.current.start=Ke,qe.current.end=Ze;var po=p.useState({width:0,height:a}),Gr=q(po,2),ge=Gr[0],_o=Gr[1],So=function(y){_o({width:y.offsetWidth,height:y.offsetHeight})},Yr=d.useRef(),qr=d.useRef(),go=p.useMemo(function(){return Dr(ge.width,S)},[ge.width,S]),Eo=p.useMemo(function(){return Dr(ge.height,He)},[ge.height,He]),qt=He-a,Xt=d.useRef(qt);Xt.current=qt;function bo(O){var y=O;return Number.isNaN(Xt.current)||(y=Math.min(y,Xt.current)),y=Math.max(y,0),y}var Xr=te<=0,Kr=te>=qt,Zr=H<=0,Jr=H>=S,yo=wr(Xr,Kr,Zr,Jr),Kt=function(){return{x:ee?-H:H,y:te}},Zt=d.useRef(Kt()),Nt=Or(function(O){if(I){var y=Y(Y({},Kt()),O);(Zt.current.x!==y.x||Zt.current.y!==y.y)&&(I(y),Zt.current=y)}});function en(O,y){var A=O;y?(tt.flushSync(function(){fe(A)}),Nt()):Ue(A)}function Co(O){var y=O.currentTarget.scrollTop;y!==te&&Ue(y),b==null||b(O),Nt()}var Jt=function(y){var A=y,z=S?S-ge.width:0;return A=Math.max(A,0),A=Math.min(A,z),A},Oo=Or(function(O,y){y?(tt.flushSync(function(){fe(function(A){var z=A+(ee?-O:O);return Jt(z)})}),Nt()):Ue(function(A){var z=A+O;return z})}),To=yi(re,Xr,Kr,Zr,Jr,!!S,Oo),tn=q(To,2),er=tn[0],rn=tn[1];Fi(re,Pe,function(O,y,A){return yo(O,y,A)?!1:(er({preventDefault:function(){},deltaX:O?y:0,deltaY:O?0:y}),!0)}),je(function(){function O(A){re&&A.preventDefault()}var y=Pe.current;return y.addEventListener("wheel",er,{passive:!1}),y.addEventListener("DOMMouseScroll",rn,{passive:!0}),y.addEventListener("MozMousePixelScroll",O,{passive:!1}),function(){y.removeEventListener("wheel",er),y.removeEventListener("DOMMouseScroll",rn),y.removeEventListener("MozMousePixelScroll",O)}},[re]),je(function(){if(S){var O=Jt(H);fe(O),Nt({x:O})}},[ge.width,S]);var nn=function(){var y,A;(y=Yr.current)===null||y===void 0||y.delayHidden(),(A=qr.current)===null||A===void 0||A.delayHidden()},on=Ii(Pe,x,K,i,B,function(){return ue(!0)},Ue,nn);p.useImperativeHandle(t,function(){return{nativeElement:$e.current,getScrollInfo:Kt,scrollTo:function(y){function A(z){return z&&se(z)==="object"&&("left"in z||"top"in z)}A(y)?(y.left!==void 0&&fe(Jt(y.left)),on(y.top)):on(y)}}}),je(function(){if(P){var O=x.slice(Ke,Ze+1);P(O,x)}},[Ke,Ze,x]);var Fo=Ci(x,B,K,i),Po=D==null?void 0:D({start:Ke,end:Ze,virtual:me,offsetX:H,offsetY:Qr,rtl:ee,getSize:Fo}),Io=gi(x,Ke,Ze,S,H,X,v,It),Je=null;a&&(Je=Y(Z({},l?"height":"maxHeight",a),wi),re&&(Je.overflowY="hidden",S&&(Je.overflowX="hidden"),Ye&&(Je.pointerEvents="none")));var sn={};return ee&&(sn.dir="rtl"),p.createElement("div",xe({ref:$e,style:Y(Y({},u),{},{position:"relative"}),className:Qe},sn,U),p.createElement(Vt,{onResize:So},p.createElement(C,{className:"".concat(n,"-holder"),style:Je,ref:Pe,onScroll:Co,onMouseEnter:nn},p.createElement(Fr,{prefixCls:n,height:He,offsetX:H,offsetY:Qr,scrollWidth:S,onInnerResize:ue,ref:Le,innerProps:V,rtl:ee,extra:Po},Io))),me&&He>a&&p.createElement($r,{ref:Yr,prefixCls:n,scrollOffset:te,scrollRange:He,rtl:ee,onScroll:en,onStartMove:Ft,onStopMove:Pt,spinSize:Eo,containerSize:ge.height,style:F==null?void 0:F.verticalScrollBar,thumbStyle:F==null?void 0:F.verticalScrollBarThumb}),me&&S>ge.width&&p.createElement($r,{ref:qr,prefixCls:n,scrollOffset:H,scrollRange:S,rtl:ee,onScroll:en,onStartMove:Ft,onStopMove:Pt,spinSize:go,containerSize:ge.width,horizontal:!0,style:F==null?void 0:F.horizontalScrollBar,thumbStyle:F==null?void 0:F.horizontalScrollBarThumb}))}var Ur=p.forwardRef(Ai);Ur.displayName="List";function Li(e){const{model:t}=e,r=c.useDependency(c.LocaleService),n=L.useObservable(t.searchString$,"",!0),o=L.useObservable(t.filterItems$,void 0,!0),a=r.t("sheets-filter.panel.filter-only"),i=Lt(o),s=i.checked>0&&i.unchecked===0,l=i.checked>0&&i.unchecked>0,u=d.useCallback((m,E)=>{t.onFilterCheckToggled(m,E)},[t]),h=d.useCallback(m=>{t.onFilterOnly(m)},[t]),v=d.useCallback(()=>{t.onCheckAllToggled(!s)},[t,s]),_=d.useCallback(m=>{t.setSearchString(m)},[t]);return d.createElement("div",{className:W.sheetsFilterPanelValuesContainer},d.createElement(Q.Input,{value:n,placeholder:r.t("sheets-filter.panel.search-placeholder"),onChange:_}),d.createElement("div",{className:W.sheetsFilterPanelValuesList},d.createElement("div",{className:W.sheetsFilterPanelValuesItem},d.createElement("div",{className:W.sheetsFilterPanelValuesItemInner},d.createElement(Q.Checkbox,{indeterminate:l,disabled:o.length===0,checked:s,onChange:v}),d.createElement("span",{className:W.sheetsFilterPanelValuesItemText},`${r.t("sheets-filter.panel.select-all")}`),d.createElement("span",{className:W.sheetsFilterPanelValuesItemCount},`(${i.checked}/${i.checked+i.unchecked})`))),d.createElement("div",{className:W.sheetsFilterPanelValuesVirtual},d.createElement(Ur,{style:{paddingRight:8},data:o,height:190,itemHeight:32,itemKey:m=>`${m.value}----${m.checked}`},m=>d.createElement("div",{className:W.sheetsFilterPanelValuesItem},d.createElement("div",{className:W.sheetsFilterPanelValuesItemInner},d.createElement(Q.Checkbox,{checked:m.checked,onChange:()=>u(m,!m.checked)}),d.createElement(Q.Tooltip,{showIfEllipsis:!0,placement:"top",title:m.value},d.createElement("span",{className:W.sheetsFilterPanelValuesItemText},m.value)),d.createElement("span",{className:W.sheetsFilterPanelValuesItemCount},`(${m.count})`),d.createElement(Q.Button,{className:W.sheetsFilterPanelValuesItemExcludeButton,size:"small",type:"link",onClick:()=>h(m)},a)))))))}function $i(){var g;const e=c.useDependency(Ee),t=c.useDependency(c.LocaleService),r=c.useDependency(c.ICommandService),n=L.useObservable(e.filterBy$,void 0,!0),o=L.useObservable(e.filterByModel$,void 0,!1),a=L.useObservable(()=>(o==null?void 0:o.canApply$)||N.of(!1),void 0,!1,[o]),i=Di(t),s=!L.useObservable(e.hasCriteria$),l=d.useCallback(C=>{r.executeCommand(Dt.id,{filterBy:C})},[r]),u=d.useCallback(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(Ne.id)},[o,r]),h=d.useCallback(()=>{r.executeCommand(Ne.id)},[r]),v=d.useCallback(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(Ne.id)},[o,r]),m=(g=c.useDependency(f.SheetsFilterService).activeFilterModel)==null?void 0:g.getRange(),E=e.col,S=L.useComponentsOfPart(ie.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return d.createElement("div",{className:W.sheetsFilterPanel},d.createElement(L.ComponentContainer,{components:S,sharedProps:{range:m,colIndex:E,onClose:h}}),d.createElement("div",{className:W.sheetsFilterPanelHeader},d.createElement(Q.Segmented,{value:n,options:i,onChange:C=>l(C)})),o?d.createElement("div",{className:W.sheetsFilterPanelContent},n===rt.VALUES?d.createElement(Li,{model:o}):d.createElement(gn,{model:o})):null,d.createElement("div",{className:W.sheetsFilterPanelFooter},d.createElement(Q.Button,{type:"link",onClick:u,disabled:s},t.t("sheets-filter.panel.clear-filter")),d.createElement("span",{className:W.sheetsFilterPanelFooterPrimaryButtons},d.createElement(Q.Button,{type:"default",onClick:h},t.t("sheets-filter.panel.cancel")),d.createElement(Q.Button,{disabled:!a,type:"primary",onClick:v},t.t("sheets-filter.panel.confirm")))))}function Di(e){const t=e.getCurrentLocale();return d.useMemo(()=>[{label:e.t("sheets-filter.panel.by-values"),value:rt.VALUES},{label:e.t("sheets-filter.panel.by-conditions"),value:rt.CONDITIONS}],[t,e])}const Ui={id:Te.id,binding:L.KeyCode.L|L.MetaKeys.CTRL_COMMAND|L.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:ie.whenSheetEditorFocused,group:"4_sheet-edit"};function Hi(e){const t=e.get(f.SheetsFilterService);return{id:Te.id,group:L.MenuGroup.TOOLBAR_FORMULAS_INSERT,type:L.MenuItemType.BUTTON_SELECTOR,icon:"FilterSingle",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",positions:[L.MenuPosition.TOOLBAR_START],hidden$:L.getMenuHiddenObservable(e,c.UniverInstanceType.UNIVER_SHEET),activated$:t.activeFilterModel$.pipe(N.map(r=>!!r)),disabled$:ie.getCurrentRangeDisable$(e,{workbookTypes:[G.WorkbookEditablePermission],worksheetTypes:[G.WorksheetFilterPermission,G.WorksheetEditPermission],rangeTypes:[G.RangeProtectionPermissionEditPoint]})}}function Bi(e){const t=e.get(f.SheetsFilterService);return{id:wt.id,group:L.MenuGroup.TOOLBAR_OTHERS,type:L.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",positions:[Te.id],hidden$:L.getMenuHiddenObservable(e,c.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(N.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(N.map(o=>!o)))!=null?n:N.of(!0)}))}}function xi(e){const t=e.get(f.SheetsFilterService);return{id:At.id,group:L.MenuGroup.TOOLBAR_OTHERS,type:L.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",positions:[Te.id],hidden$:L.getMenuHiddenObservable(e,c.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(N.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(N.map(o=>!o)))!=null?n:N.of(!0)}))}}const ye=16,Wi=new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");class Hr{static drawNoCriteria(t,r,n,o){t.save(),Ie.Rect.drawWith(t,{radius:2,width:ye,height:ye,fill:o}),t.lineCap="square",t.strokeStyle=n,t.scale(r/ye,r/ye),t.beginPath(),t.lineWidth=1,t.lineCap="round",t.moveTo(3,4),t.lineTo(13,4),t.moveTo(4.5,8),t.lineTo(11.5,8),t.moveTo(6,12),t.lineTo(10,12),t.stroke(),t.restore()}static drawHasCriteria(t,r,n,o){t.save(),Ie.Rect.drawWith(t,{radius:2,width:ye,height:ye,fill:o}),t.scale(r/ye,r/ye),t.fillStyle=n,t.fill(Wi),t.restore()}}var ji=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,ki=(e,t,r,n)=>{for(var o=n>1?void 0:n?Vi(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&ji(t,r,o),o},zt=(e,t)=>(r,n)=>t(r,n,e);const _e=16,bt=1;let Qt=class extends Ie.Shape{constructor(t,r,n,o,a){super(t,r);w(this,"_cellWidth",0);w(this,"_cellHeight",0);w(this,"_filterParams");w(this,"_hovered",!1);this._contextService=n,this._commandService=o,this._themeService=a,this.setShapeProps(r),this.onPointerDown$.subscribeEvent(i=>this.onPointerDown(i)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(t){typeof t.cellHeight<"u"&&(this._cellHeight=t.cellHeight),typeof t.cellWidth<"u"&&(this._cellWidth=t.cellWidth),typeof t.filterParams<"u"&&(this._filterParams=t.filterParams),this.transformByState({width:t.width,height:t.height})}_draw(t){const r=this._cellHeight,n=this._cellWidth,o=_e-n,a=_e-r;t.save();const i=new Path2D;i.rect(o,a,n,r),t.clip(i);const{hasCriteria:s}=this._filterParams,l=this._themeService.getCurrentTheme().primaryColor,u=this._hovered?this._themeService.getCurrentTheme().grey50:"rgba(255, 255, 255, 1.0)";s?Hr.drawHasCriteria(t,_e,l,u):Hr.drawNoCriteria(t,_e,l,u),t.restore()}onPointerDown(t){if(t.button===2)return;const{col:r,unitId:n,subUnitId:o}=this._filterParams;this._contextService.getContextValue(Me)||!this._commandService.hasCommand(Be.id)||setTimeout(()=>{this._commandService.executeCommand(Be.id,{unitId:n,subUnitId:o,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Qt=ki([zt(2,c.IContextService),zt(3,c.ICommandService),zt(4,c.Inject(c.ThemeService))],Qt);var zi=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,Gi=(e,t,r,n)=>{for(var o=n>1?void 0:n?Qi(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&zi(t,r,o),o},Se=(e,t)=>(r,n)=>t(r,n,e);const Yi=1e3,qi=5e3;let Gt=class extends c.RxDisposable{constructor(t,r,n,o,a,i,s,l,u,h){super();w(this,"_filterRangeShape",null);w(this,"_buttonRenderDisposable",null);w(this,"_filterButtonShapes",[]);this._context=t,this._injector=r,this._sheetSkeletonManagerService=n,this._sheetsFilterService=o,this._themeService=a,this._sheetInterceptorService=i,this._sheetsRenderService=s,this._commandService=l,this._renderManagerService=u,this._selectionRenderService=h,[f.SetSheetsFilterRangeMutation,f.SetSheetsFilterCriteriaMutation,f.RemoveSheetsFilterMutation,f.ReCalcSheetsFilterMutation].forEach(v=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(v.id))),this._initRenderer()}_initRenderer(){this._sheetSkeletonManagerService.currentSkeleton$.pipe(N.switchMap(t=>{var s,l;if(!t)return N.of(null);const{unit:r,unitId:n}=this._context,o=((s=r.getActiveSheet())==null?void 0:s.getSheetId())||"",a=(l=this._sheetsFilterService.getFilterModel(n,o))!=null?l:void 0,i=()=>({unitId:n,worksheetId:o,filterModel:a,range:a==null?void 0:a.getRange(),skeleton:t.skeleton});return c.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(N.filter(([u])=>u.type===c.CommandType.MUTATION&&u.params.unitId===r.getUnitId()&&f.FILTER_MUTATIONS.has(u.id)),N.throttleTime(20,void 0,{leading:!1,trailing:!0}),N.map(i),N.startWith(i()))}),N.takeUntil(this.dispose$)).subscribe(t=>{this._disposeRendering(),!(!t||!t.range)&&(this._renderRange(t.unitId,t.range,t.skeleton),this._renderButtons(t))})}_renderRange(t,r,n){const o=this._renderManagerService.getRenderById(t);if(!o)return;const{scene:a}=o,{rangeWithCoord:i,style:s}=this._selectionRenderService.attachSelectionWithCoord({range:r,primary:null,style:null}),{rowHeaderWidth:l,columnHeaderHeight:u}=n,h=this._filterRangeShape=new ie.SelectionShape(a,Yi,!0,this._themeService);h.update(i,l,u,{hasAutoFill:!1,fill:"rgba(0, 0, 0, 0.0)",...s}),h.setEvent(!1),a.makeDirty(!0)}_renderButtons(t){const{range:r,filterModel:n,unitId:o,skeleton:a,worksheetId:i}=t,s=this._renderManagerService.getRenderById(o);if(!s)return;const{scene:l}=s;this._interceptCellContent(t.range);const{startColumn:u,endColumn:h,startRow:v}=r;for(let _=u;_<=h;_++){const m=`sheets-filter-button-${_}`,E=ie.getCoordByCell(v,_,l,a),{startX:S,startY:g,endX:C,endY:b}=E,I=C-S,P=b-g;if(P<=bt||I<=bt)continue;const V=!!n.getFilterColumn(_),D=C-_e-bt,F=b-_e-bt,U={left:D,top:F,height:_e,width:_e,zIndex:qi,cellHeight:P,cellWidth:I,filterParams:{unitId:o,subUnitId:i,col:_,hasCriteria:V}},B=this._injector.createInstance(Qt,m,U);this._filterButtonShapes.push(B)}l.addObjects(this._filterButtonShapes),l.makeDirty()}_interceptCellContent(t){const{startRow:r,startColumn:n,endColumn:o}=t;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(G.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(a,i,s)=>{const{row:l,col:u}=i;return l!==r||u<n||u>o?s(a):s({...a,fontRenderExtension:{...a==null?void 0:a.fontRenderExtension,rightOffset:_e}})},priority:10})}_disposeRendering(){var t,r;(t=this._filterRangeShape)==null||t.dispose(),this._filterButtonShapes.forEach(n=>n.dispose()),(r=this._buttonRenderDisposable)==null||r.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};Gt=Gi([Se(1,c.Inject(c.Injector)),Se(2,c.Inject(ie.SheetSkeletonManagerService)),Se(3,c.Inject(f.SheetsFilterService)),Se(4,c.Inject(c.ThemeService)),Se(5,c.Inject(G.SheetInterceptorService)),Se(6,c.Inject(ie.SheetsRenderService)),Se(7,c.ICommandService),Se(8,Ie.IRenderManagerService),Se(9,ie.ISheetSelectionRenderService)],Gt);var Xi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Zi=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ki(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Xi(t,r,o),o},Ji=(e,t)=>(r,n)=>t(r,n,e);let Ve=class extends c.RxDisposable{constructor(e){super(),this._renderManagerService=e,this._initRenderControllers()}_initRenderControllers(){this.disposeWithMe(this._renderManagerService.registerRenderModule(c.UniverInstanceType.UNIVER_SHEET,[Gt]))}};Ve=Zi([Ji(0,Ie.IRenderManagerService)],Ve),c.runOnLifecycle(c.LifecycleStages.Rendered,Ve);var eo=Object.defineProperty,to=Object.getOwnPropertyDescriptor,ro=(e,t,r,n)=>{for(var o=n>1?void 0:n?to(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&eo(t,r,o),o},le=(e,t)=>(r,n)=>t(r,n,e);const Br={},xr="FILTER_PANEL_POPUP";let ke=class extends Ve{constructor(t,r,n,o,a,i,s,l,u,h,v,_,m){super(m);w(this,"_popupDisposable");this._config=t,this._injector=r,this._componentManager=n,this._sheetsFilterPanelService=o,this._sheetCanvasPopupService=a,this._sheetsFilterService=i,this._localeService=s,this._shortcutService=l,this._commandService=u,this._menuService=h,this._contextService=v,this._messageService=_,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Ui].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_initCommands(){[Te,Fe,wt,At,Dt,Be,Ne].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initMenuItems(){const{menu:t={}}=this._config;[Hi,Bi,xi].forEach(r=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r),t))})}_initUI(){this.disposeWithMe(this._componentManager.register(xr,$i)),this.disposeWithMe(this._componentManager.register("FilterSingle",ir)),this.disposeWithMe(this._contextService.subscribeContextValue$(Me).pipe(N.distinctUntilChanged()).subscribe(t=>{t?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(t=>{t&&this._messageService.show({type:Q.MessageType.Error,content:this._localeService.t(t)})}))}_openFilterPopup(){const t=this._sheetsFilterPanelService.filterModel;if(!t)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const r=t.getRange(),n=this._sheetsFilterPanelService.col,{startRow:o}=r;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(o,n,{componentKey:xr,direction:"horizontal",closeOnSelfTarget:!0,onClickOutside:()=>this._commandService.syncExecuteCommand(Ne.id),offset:[5,0]})}_closeFilterPopup(){var t;(t=this._popupDisposable)==null||t.dispose(),this._popupDisposable=null}};ke=ro([c.OnLifecycle(c.LifecycleStages.Rendered,ke),le(1,c.Inject(c.Injector)),le(2,c.Inject(L.ComponentManager)),le(3,c.Inject(Ee)),le(4,c.Inject(ie.SheetCanvasPopManagerService)),le(5,c.Inject(f.SheetsFilterService)),le(6,c.Inject(c.LocaleService)),le(7,L.IShortcutService),le(8,c.ICommandService),le(9,L.IMenuService),le(10,c.IContextService),le(11,L.IMessageService),le(12,Ie.IRenderManagerService)],ke);var no=Object.defineProperty,io=Object.getOwnPropertyDescriptor,oo=(e,t,r,n)=>{for(var o=n>1?void 0:n?io(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&no(t,r,o),o},yt=(e,t)=>(r,n)=>t(r,n,e);let ze=class extends c.Disposable{constructor(e,t,r,n){super(),this._sheetsFilterService=e,this._localeService=t,this._commandService=r,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{var t;if(e.id===Te.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithoutRange({workbookTypes:[G.WorkbookEditablePermission],rangeTypes:[G.RangeProtectionPermissionViewPoint],worksheetTypes:[G.WorksheetFilterPermission,G.WorksheetEditPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr"))),e.id===Be.id){const r=e.params,{unitId:n,subUnitId:o}=r,a=(t=this._sheetsFilterService.getFilterModel(n,o))==null?void 0:t.getRange(),i=c.Tools.deepClone(a);i&&(i.startColumn=r.col,i.endColumn=r.col,this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[G.WorkbookEditablePermission],rangeTypes:[G.RangeProtectionPermissionViewPoint],worksheetTypes:[G.WorksheetFilterPermission,G.WorksheetEditPermission]},[i])||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr")))}}))}};ze=oo([c.OnLifecycle(c.LifecycleStages.Ready,ze),yt(0,c.Inject(f.SheetsFilterService)),yt(1,c.Inject(c.LocaleService)),yt(2,c.ICommandService),yt(3,c.Inject(ie.SheetPermissionInterceptorBaseController))],ze);var Wr=Object.defineProperty,so=Object.getOwnPropertyDescriptor,ao=(e,t,r)=>t in e?Wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lo=(e,t,r,n)=>{for(var o=n>1?void 0:n?so(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Wr(t,r,o),o},jr=(e,t)=>(r,n)=>t(r,n,e),Vr=(e,t,r)=>ao(e,typeof t!="symbol"?t+"":t,r);const uo="SHEET_FILTER_UI_PLUGIN";R.UniverSheetsFilterUIPlugin=class extends c.Plugin{constructor(t={},r,n){super(),this._config=t,this._injector=r,this._localeService=n,this._config=c.Tools.deepMerge({},Br,this._config)}onStarting(t){[[Ee],[ze],[ke,{useFactory:()=>this._injector.createInstance(ke,this._config)}]].forEach(r=>t.add(r))}},Vr(R.UniverSheetsFilterUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),Vr(R.UniverSheetsFilterUIPlugin,"pluginName",uo),R.UniverSheetsFilterUIPlugin=lo([c.DependentOn(f.UniverSheetsFilterPlugin),jr(1,c.Inject(c.Injector)),jr(2,c.Inject(c.LocaleService))],R.UniverSheetsFilterUIPlugin);var kr=Object.defineProperty,co=Object.getOwnPropertyDescriptor,fo=(e,t,r)=>t in e?kr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ho=(e,t,r,n)=>{for(var o=n>1?void 0:n?co(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&kr(t,r,o),o},mo=(e,t)=>(r,n)=>t(r,n,e),zr=(e,t,r)=>fo(e,typeof t!="symbol"?t+"":t,r);const vo="SHEET_FILTER_UI_PLUGIN";R.UniverSheetsFilterMobileUIPlugin=class extends c.Plugin{constructor(t={},r){super(),this._config=t,this._injector=r,this._config=c.Tools.deepMerge({},Br,this._config)}onStarting(t){[[ze],[Ve]].forEach(r=>t.add(r))}},zr(R.UniverSheetsFilterMobileUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),zr(R.UniverSheetsFilterMobileUIPlugin,"pluginName",vo),R.UniverSheetsFilterMobileUIPlugin=ho([c.DependentOn(f.UniverSheetsFilterPlugin),mo(1,c.Inject(c.Injector))],R.UniverSheetsFilterMobileUIPlugin),R.ChangeFilterByOperation=Dt,R.ClearSheetsFilterCriteriaCommand=wt,R.CloseFilterPanelOperation=Ne,R.OpenFilterPanelOperation=Be,R.ReCalcSheetsFilterCommand=At,R.SetSheetsFilterCriteriaCommand=Fe,R.SmartToggleSheetsFilterCommand=Te,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-filter-ui",
3
- "version": "0.2.2",
3
+ "version": "0.2.4-alpha.0",
4
4
  "private": false,
5
5
  "description": "Univer Sheets Filter UI",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -48,40 +48,38 @@
48
48
  "lib"
49
49
  ],
50
50
  "peerDependencies": {
51
- "@wendellhu/redi": "0.15.5",
52
51
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
53
52
  "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0",
54
53
  "rxjs": ">=7.0.0",
55
- "@univerjs/core": "0.2.2",
56
- "@univerjs/engine-render": "0.2.2",
57
- "@univerjs/design": "0.2.2",
58
- "@univerjs/sheets": "0.2.2",
59
- "@univerjs/sheets-filter": "0.2.2",
60
- "@univerjs/sheets-ui": "0.2.2",
61
- "@univerjs/ui": "0.2.2"
54
+ "@univerjs/core": "0.2.4-alpha.0",
55
+ "@univerjs/engine-render": "0.2.4-alpha.0",
56
+ "@univerjs/design": "0.2.4-alpha.0",
57
+ "@univerjs/sheets": "0.2.4-alpha.0",
58
+ "@univerjs/sheets-ui": "0.2.4-alpha.0",
59
+ "@univerjs/ui": "0.2.4-alpha.0",
60
+ "@univerjs/sheets-filter": "0.2.4-alpha.0"
62
61
  },
63
62
  "dependencies": {
64
- "@univerjs/icons": "^0.1.58",
63
+ "@univerjs/icons": "^0.1.64",
65
64
  "rc-virtual-list": "^3.14.5"
66
65
  },
67
66
  "devDependencies": {
68
- "@wendellhu/redi": "0.15.5",
69
67
  "clsx": "^2.1.1",
70
68
  "less": "^4.2.0",
71
69
  "react": "18.3.1",
72
70
  "rxjs": "^7.8.1",
73
71
  "typescript": "^5.5.3",
74
- "vite": "^5.3.3",
75
- "vitest": "^1.6.0",
76
- "@univerjs/design": "0.2.2",
77
- "@univerjs/drawing": "0.2.2",
78
- "@univerjs/shared": "0.2.2",
79
- "@univerjs/core": "0.2.2",
80
- "@univerjs/engine-render": "0.2.2",
81
- "@univerjs/sheets": "0.2.2",
82
- "@univerjs/sheets-ui": "0.2.2",
83
- "@univerjs/sheets-filter": "0.2.2",
84
- "@univerjs/ui": "0.2.2"
72
+ "vite": "^5.3.4",
73
+ "vitest": "^2.0.3",
74
+ "@univerjs/core": "0.2.4-alpha.0",
75
+ "@univerjs/design": "0.2.4-alpha.0",
76
+ "@univerjs/drawing": "0.2.4-alpha.0",
77
+ "@univerjs/engine-render": "0.2.4-alpha.0",
78
+ "@univerjs/shared": "0.2.4-alpha.0",
79
+ "@univerjs/sheets-filter": "0.2.4-alpha.0",
80
+ "@univerjs/sheets-ui": "0.2.4-alpha.0",
81
+ "@univerjs/ui": "0.2.4-alpha.0",
82
+ "@univerjs/sheets": "0.2.4-alpha.0"
85
83
  },
86
84
  "univerSpace": {
87
85
  ".": {