@univerjs/sheets-filter-ui 0.1.17 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +4 -4
- package/lib/es/index.js +705 -672
- package/lib/index.css +1 -1
- package/lib/types/commands/{sheets-filter.operation.d.ts → operations/sheets-filter.operation.d.ts} +1 -1
- package/lib/types/index.d.ts +2 -3
- package/lib/umd/index.js +4 -4
- package/package.json +23 -23
- /package/lib/types/commands/{__tests__ → commands/__tests__}/sheets-filter.command.spec.d.ts +0 -0
- /package/lib/types/commands/{sheets-filter.command.d.ts → commands/sheets-filter.command.d.ts} +0 -0
- /package/lib/types/commands/{__tests__ → operations/__tests__}/sheets-filter.operation.spec.d.ts +0 -0
package/lib/cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var On=Object.defineProperty;var Cn=(e,t,r)=>t in e?On(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var N=(e,t,r)=>Cn(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("@univerjs/core"),A=require("@wendellhu/redi"),f=require("@univerjs/sheets-filter"),L=require("@univerjs/ui"),M=require("rxjs"),ue=require("@univerjs/sheets-ui"),Ue=require("@univerjs/engine-render"),G=require("@univerjs/design"),Q=require("@univerjs/sheets"),h=require("react"),Ae=require("@wendellhu/redi/react-bindings"),dt=require("react-dom");function Tn(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=Tn(h);var le=function(){return le=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},le.apply(this,arguments)},In=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},Mr=h.forwardRef(function(e,t){var r=e.icon,n=e.id,o=e.className,a=e.extend,i=In(e,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),l=h.useRef("_".concat(Nn()));return Nr(r,"".concat(n),{defIds:r.defIds,idSuffix:l.current},le({ref:t,className:s},i),a)});function Nr(e,t,r,n,o){return h.createElement(e.tag,le(le({key:t},Pn(e,r,o)),n),(Mn(e,r).children||[]).map(function(a,i){return Nr(a,"".concat(t,"-").concat(e.tag,"-").concat(i),r,void 0,o)}))}function Pn(e,t,r){var n=le({},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 Mn(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)?le(le({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?le(le({},o),{attrs:le(le({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function Nn(){return Math.random().toString(36).substring(2,8)}Mr.displayName="UniverIcon";var wn={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"}}]},wr=h.forwardRef(function(e,t){return h.createElement(Mr,Object.assign({},e,{id:"filter-single",ref:t,icon:wn}))});wr.displayName="FilterSingle";const Te={id:"sheet.command.smart-toggle-filter",type:v.CommandType.COMMAND,handler:async e=>{const t=e.get(v.IUniverInstanceService),r=e.get(f.SheetsFilterService),n=e.get(v.ICommandService),o=e.get(v.IUndoRedoService),a=t.getCurrentUnitForType(v.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 S=u==null?void 0:u.serialize(),y=An(s,l,S),b=n.syncExecuteCommand(f.RemoveSheetsFilterMutation.id,{unitId:s,subUnitId:l});return b&&o.pushUndoRedo({unitID:s,undoMutations:y,redoMutations:[{id:f.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}]}),b}const m=e.get(Q.SelectionManagerService).getLast();if(!m)return!1;const _=m.range,d=Q.isSingleCellSelection(m)?ue.expandToContinuousRange(_,{left:!0,right:!0,up:!0,down:!0},i):_;if(d.endRow===d.startRow){const S=e.get(L.IMessageService,A.Quantity.OPTIONAL),y=e.get(v.LocaleService);return S==null||S.show({type:G.MessageType.Warning,content:y.t("sheets-filter.command.not-valid-filter-range")}),!1}const E={id:f.SetSheetsFilterRangeMutation.id,params:{unitId:s,subUnitId:l,range:d}},g=n.syncExecuteCommand(E.id,E.params);return g&&o.pushUndoRedo({unitID:s,undoMutations:[{id:f.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}],redoMutations:[E]}),g}},$e={id:"sheet.command.set-filter-criteria",type:v.CommandType.COMMAND,handler:async(e,t)=>{const r=e.get(f.SheetsFilterService),n=e.get(v.ICommandService),o=e.get(v.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 m=u.getFilterColumn(s),_=$n(a,i,s,m),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}},Ar={id:"sheet.command.clear-filter-criteria",type:v.CommandType.COMMAND,handler:e=>{const t=e.get(f.SheetsFilterService),r=e.get(v.IUndoRedoService),n=e.get(v.ICommandService),o=t.activeFilterModel;if(!o)return!1;const{unitId:a,subUnitId:i}=o,s=o.serialize(),l=$r(a,i,s),u=Ln(a,i,s);return v.sequenceExecute(u,n)&&r.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:u}),!0}},Lr={id:"sheet.command.re-calc-filter",type:v.CommandType.COMMAND,handler:e=>{const t=e.get(f.SheetsFilterService),r=e.get(v.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 An(e,t,r){const n=[],o={id:f.SetSheetsFilterRangeMutation.id,params:{unitId:e,subUnitId:t,range:r.ref}};return n.push(o),$r(e,t,r).forEach(i=>n.push(i)),n}function $r(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 Ln(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 $n(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 z=(e=>(e[e.FIRST=0]="FIRST",e[e.SECOND=1]="SECOND",e))(z||{}),P=(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))(P||{}),O;(e=>{e.NONE={label:"sheets-filter.conditions.none",operator:P.NONE,order:z.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===P.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},e.EMPTY={label:"sheets-filter.conditions.empty",operator:P.EMPTY,order:z.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===P.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:P.EMPTY}:!1}},e.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:P.NOT_EMPTY,order:z.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===P.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:P.NOT_EMPTY}:!1}},e.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:P.CONTAINS,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.CONTAINS,val1:l.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:P.DOES_NOT_CONTAIN,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:f.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.DOES_NOT_CONTAIN,val1:l.slice(1,-1)}:!1}},e.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:P.STARTS_WITH,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.STARTS_WITH,val1:l.slice(0,-1)}:!1}},e.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:P.ENDS_WITH,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.ENDS_WITH,val1:l.slice(1)}:!1}},e.EQUALS={label:"sheets-filter.conditions.equals",operator:P.EQUALS,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.EQUALS,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.EQUALS,val1:""}:((u=i.customFilters)==null?void 0:u.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:P.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:z.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:z.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:z.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:z.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:z.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:z.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:P.BETWEEN,order:z.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:v.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:P.NOT_BETWEEN,order:z.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:P.CUSTOM,order:z.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:P.NONE,val1:"",operator2:P.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:l,val2:u,operator1:c,operator2:m}=i;function _(b,I){for(const T of e.ALL_CONDITIONS)if(T.operator===b)return T.mapToFilterColumn({val1:I,operator1:b})}const d=!c||c===e.NONE.operator,E=!m||m===e.NONE.operator;if(d&&E)return e.NONE.mapToFilterColumn({});if(d)return _(m,u);if(E)return _(c,l);const g=_(c,l),S=_(m,u),y={customFilters:[g.customFilters.customFilters[0],S.customFilters.customFilters[0]]};return s&&(y.and=v.BooleanNumber.TRUE),{customFilters:y}},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})(O||(O={}));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 jt(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 Un=Object.defineProperty,Dn=Object.getOwnPropertyDescriptor,Yt=(e,t,r,n)=>{for(var o=n>1?void 0:n?Dn(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&&Un(t,r,o),o},Le=(e,t)=>(r,n)=>t(r,n,e),mt=(e=>(e[e.VALUES=0]="VALUES",e[e.CONDITIONS=1]="CONDITIONS",e))(mt||{});A.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let ye=class extends v.Disposable{constructor(t,r,n,o){super();N(this,"_filterBy$",new M.BehaviorSubject(0));N(this,"filterBy$",this._filterBy$.asObservable());N(this,"_filterByModel$",new M.ReplaySubject(1));N(this,"filterByModel$",this._filterByModel$.asObservable());N(this,"_filterByModel",null);N(this,"_hasCriteria$",new M.BehaviorSubject(!1));N(this,"hasCriteria$",this._hasCriteria$.asObservable());N(this,"_filterModel",null);N(this,"_col$",new M.BehaviorSubject(-1));N(this,"col$",this._col$.asObservable());N(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=vt.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=pt.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}};ye=Yt([Le(0,A.Inject(A.Injector)),Le(1,A.Inject(f.SheetsFilterService)),Le(2,v.IUniverInstanceService),Le(3,A.Inject(Q.RefRangeService))],ye);let pt=class extends v.Disposable{constructor(t,r,n,o,a){super();N(this,"canApply$",M.of(!0));N(this,"_conditionItem$");N(this,"conditionItem$");N(this,"_filterConditionFormParams$");N(this,"filterConditionFormParams$");this._filterModel=t,this.col=r,this._commandService=a,this._conditionItem$=new M.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new M.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(t,r,n,o){const[a,i]=O.testMappingFilterColumn(o==null?void 0:o.getColumnData());return t.createInstance(pt,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($e.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=O.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand($e.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:t})}onPrimaryConditionChange(t){const r=O.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(O.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=O.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(r)}};pt=Yt([Le(4,v.ICommandService)],pt);let vt=class extends v.Disposable{constructor(t,r,n,o){super();N(this,"_rawFilterItems$");N(this,"rawFilterItems$");N(this,"filterItems$");N(this,"_filterItems",[]);N(this,"canApply$");N(this,"_manuallyUpdateFilterItems$");N(this,"_searchString$");N(this,"searchString$");this._filterModel=t,this.col=r,this._commandService=o,this._searchString$=new M.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new M.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new M.Subject,this.filterItems$=M.merge(M.combineLatest([this._searchString$.pipe(M.throttleTime(500,void 0,{leading:!0,trailing:!0}),M.startWith(void 0)),this._rawFilterItems$]).pipe(M.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(m=>c.includes(m))})})),this._manuallyUpdateFilterItems$).pipe(M.shareReplay(1)),this.canApply$=this.filterItems$.pipe(M.map(a=>jt(a).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(a=>this._filterItems=a))}static fromFilterColumn(t,r,n){var U;const o=t.get(v.IUniverInstanceService),a=t.get(v.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(),m=n,_=(U=r.getFilterColumn(n))==null?void 0:U.getColumnData().filters,d=!!(_&&_.blank),E={...c,startRow:c.startRow+1,startColumn:m,endColumn:m},g=[],S={},y=new Set(_==null?void 0:_.filters),b=r.getFilteredOutRowsExceptCol(n);let I=0,T=0;for(const C of u.iterateByColumn(E,!1,!1)){const{row:D,rowSpan:x=1}=C;let V=0;for(;V<x;){const te=D+V;if(b.has(te)){V++;continue}const Y=C!=null&&C.value?v.extractPureTextFromCell(C.value):"";if(!Y){T+=1,V+=x;continue}if(S[Y])S[Y].count++;else{const ie={value:Y,checked:y.size?y.has(Y):!d,count:1,index:I,isEmpty:!1};S[Y]=ie,g.push(ie)}V++}I++}const W=_?d:!0;if(T>0){const C={value:a.t("sheets-filter.panel.empty"),checked:W,count:T,index:I,isEmpty:!0};g.push(C)}return t.createInstance(vt,r,n,g)}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($e.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=jt(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($e.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($e.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:s})}};vt=Yt([Le(3,v.ICommandService)],vt);const De="FILTER_PANEL_OPENED",Ze={id:"sheet.operation.open-filter-panel",type:v.CommandType.OPERATION,handler:(e,t)=>{const r=e.get(v.IContextService),n=e.get(f.SheetsFilterService),o=e.get(ye);e.get(v.ICommandService).syncExecuteCommand(ue.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(De)||r.setContextValue(De,!0),!0)}},Ge={id:"sheet.operation.close-filter-panel",type:v.CommandType.OPERATION,handler:e=>{const t=e.get(v.IContextService),r=e.get(ye),n=e.get(L.ILayoutService,A.Quantity.OPTIONAL);return t.getContextValue(De)?(t.setContextValue(De,!1),n==null||n.focus(),r.terminate()):!1}},Ur={id:"sheet.operation.apply-filter",type:v.CommandType.OPERATION,handler:(e,t)=>{const{filterBy:r}=t;return e.get(ye).changeFilterBy(r)}},Hn="univer-sheets-filter-panel",xn="univer-sheets-filter-panel-header",Bn="univer-sheets-filter-panel-content",jn="univer-sheets-filter-panel-select-all",Wn="univer-sheets-filter-panel-select-all-count",Vn="univer-sheets-filter-panel-values-container",kn="univer-input-affix-wrapper",zn="univer-select",Qn="univer-radio-group",Gn="univer-sheets-filter-panel-values-find",Yn="univer-sheets-filter-panel-values-list",qn="univer-sheets-filter-panel-values-list-inner-container",Xn="univer-sheets-filter-panel-values-virtual",Kn="univer-sheets-filter-panel-values-item",Zn="univer-sheets-filter-panel-values-item-inner",Jn="univer-sheets-filter-panel-values-item-count",ei="univer-sheets-filter-panel-values-item-exclude-button",ti="univer-sheets-filter-panel-values-item-text",ri="univer-sheets-filter-panel-conditions-container",ni="univer-sheets-filter-panel-conditions-container-inner",ii="univer-sheets-filter-panel-conditions-desc",oi="univer-sheets-filter-panel-footer",si="univer-sheets-filter-panel-footer-primary-buttons",ai="univer-button",li="univer-input",ui="univer-form-dual-column-layout",j={sheetsFilterPanel:Hn,sheetsFilterPanelHeader:xn,sheetsFilterPanelContent:Bn,sheetsFilterPanelSelectAll:jn,sheetsFilterPanelSelectAllCount:Wn,sheetsFilterPanelValuesContainer:Vn,inputAffixWrapper:kn,select:zn,radioGroup:Qn,sheetsFilterPanelValuesFind:Gn,sheetsFilterPanelValuesList:Yn,sheetsFilterPanelValuesListInnerContainer:qn,sheetsFilterPanelValuesVirtual:Xn,sheetsFilterPanelValuesItem:Kn,sheetsFilterPanelValuesItemInner:Zn,sheetsFilterPanelValuesItemCount:Jn,sheetsFilterPanelValuesItemExcludeButton:ei,sheetsFilterPanelValuesItemText:ti,sheetsFilterPanelConditionsContainer:ri,sheetsFilterPanelConditionsContainerInner:ni,sheetsFilterPanelConditionsDesc:ii,sheetsFilterPanelFooter:oi,sheetsFilterPanelFooterPrimaryButtons:si,button:ai,input:li,formDualColumnLayout:ui};function ci(e){const{model:t}=e,r=Ae.useDependency(v.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:c,and:m}=o,_=m?"AND":"OR",d=h.useCallback(T=>{t.onConditionFormChange({and:T==="AND"})},[t]),E=fi(r),g=h.useCallback(T=>{t.onPrimaryConditionChange(T)},[t]),S=hi(r),y=h.useCallback(T=>{t.onConditionFormChange(T)},[t]),b=r.t("sheets-filter.panel.input-values-placeholder");function I(T,W,U){const C=O.getItemByOperator(T).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:T,options:S,onChange:D=>y({[U]:D})}),C&&h.createElement(G.Input,{value:W,placeholder:b,onChange:D=>y({[U==="operator1"?"val1":"val2"]:D})}))}return h.createElement("div",{className:j.sheetsFilterPanelConditionsContainer},h.createElement(G.Select,{value:a,options:E,onChange:g}),O.getItemByOperator(a).numOfParameters!==0?h.createElement("div",{className:j.sheetsFilterPanelConditionsContainerInner},i>=1&&I(s,u!=null?u:"","operator1"),i>=2&&I(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 fi(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{options:[{label:e.t(O.NONE.label),value:O.NONE.operator}]},{options:[{label:e.t(O.EMPTY.label),value:O.EMPTY.operator},{label:e.t(O.NOT_EMPTY.label),value:O.NOT_EMPTY.operator}]},{options:[{label:e.t(O.TEXT_CONTAINS.label),value:O.TEXT_CONTAINS.operator},{label:e.t(O.DOES_NOT_CONTAIN.label),value:O.DOES_NOT_CONTAIN.operator},{label:e.t(O.STARTS_WITH.label),value:O.STARTS_WITH.operator},{label:e.t(O.ENDS_WITH.label),value:O.ENDS_WITH.operator},{label:e.t(O.EQUALS.label),value:O.EQUALS.operator}]},{options:[{label:e.t(O.GREATER_THAN.label),value:O.GREATER_THAN.operator},{label:e.t(O.GREATER_THAN_OR_EQUAL.label),value:O.GREATER_THAN_OR_EQUAL.operator},{label:e.t(O.LESS_THAN.label),value:O.LESS_THAN.operator},{label:e.t(O.LESS_THAN_OR_EQUAL.label),value:O.LESS_THAN_OR_EQUAL.operator},{label:e.t(O.EQUAL.label),value:O.EQUAL.operator},{label:e.t(O.NOT_EQUAL.label),value:O.NOT_EQUAL.operator},{label:e.t(O.BETWEEN.label),value:O.BETWEEN.operator},{label:e.t(O.NOT_BETWEEN.label),value:O.NOT_BETWEEN.operator}]},{options:[{label:e.t(O.CUSTOM.label),value:O.CUSTOM.operator}]}],[t,e])}function hi(e){const t=e.getCurrentLocale();return h.useMemo(()=>O.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 ce(e){"@babel/helpers - typeof";return ce=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},ce(e)}function di(e,t){if(ce(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ce(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dr(e){var t=di(e,"string");return ce(t)=="symbol"?t:t+""}function ee(e,t,r){return(t=Dr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mr(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 K(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mr(Object(r),!0).forEach(function(n){ee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mi(e){if(Array.isArray(e))return e}function pi(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 pr(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 vi(e,t){if(e){if(typeof e=="string")return pr(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)?pr(e,t):void 0}}function _i(){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 mi(e)||pi(e,t)||vi(e,t)||
|
|
1
|
+
"use strict";var On=Object.defineProperty;var Cn=(e,t,r)=>t in e?On(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var N=(e,t,r)=>Cn(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("@univerjs/core"),A=require("@wendellhu/redi"),f=require("@univerjs/sheets-filter"),L=require("@univerjs/ui"),M=require("rxjs"),ue=require("@univerjs/sheets-ui"),De=require("@univerjs/engine-render"),G=require("@univerjs/design"),Q=require("@univerjs/sheets"),h=require("react"),Le=require("@wendellhu/redi/react-bindings"),mt=require("react-dom");function Tn(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=Tn(h);var le=function(){return le=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},le.apply(this,arguments)},In=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},Lr=h.forwardRef(function(e,t){var r=e.icon,n=e.id,o=e.className,a=e.extend,i=In(e,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),l=h.useRef("_".concat(Nn()));return $r(r,"".concat(n),{defIds:r.defIds,idSuffix:l.current},le({ref:t,className:s},i),a)});function $r(e,t,r,n,o){return h.createElement(e.tag,le(le({key:t},Pn(e,r,o)),n),(Mn(e,r).children||[]).map(function(a,i){return $r(a,"".concat(t,"-").concat(e.tag,"-").concat(i),r,void 0,o)}))}function Pn(e,t,r){var n=le({},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 Mn(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)?le(le({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?le(le({},o),{attrs:le(le({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function Nn(){return Math.random().toString(36).substring(2,8)}Lr.displayName="UniverIcon";var wn={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"}}]},Ur=h.forwardRef(function(e,t){return h.createElement(Lr,Object.assign({},e,{id:"filter-single",ref:t,icon:wn}))});Ur.displayName="FilterSingle";const Te={id:"sheet.command.smart-toggle-filter",type:v.CommandType.COMMAND,handler:async e=>{const t=e.get(v.IUniverInstanceService),r=e.get(f.SheetsFilterService),n=e.get(v.ICommandService),o=e.get(v.IUndoRedoService),a=t.getCurrentUnitForType(v.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 S=u==null?void 0:u.serialize(),y=An(s,l,S),b=n.syncExecuteCommand(f.RemoveSheetsFilterMutation.id,{unitId:s,subUnitId:l});return b&&o.pushUndoRedo({unitID:s,undoMutations:y,redoMutations:[{id:f.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}]}),b}const m=e.get(Q.SelectionManagerService).getLast();if(!m)return!1;const g=m.range,d=Q.isSingleCellSelection(m)?ue.expandToContinuousRange(g,{left:!0,right:!0,up:!0,down:!0},i):g;if(d.endRow===d.startRow){const S=e.get(L.IMessageService,A.Quantity.OPTIONAL),y=e.get(v.LocaleService);return S==null||S.show({type:G.MessageType.Warning,content:y.t("sheets-filter.command.not-valid-filter-range")}),!1}const E={id:f.SetSheetsFilterRangeMutation.id,params:{unitId:s,subUnitId:l,range:d}},_=n.syncExecuteCommand(E.id,E.params);return _&&o.pushUndoRedo({unitID:s,undoMutations:[{id:f.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}],redoMutations:[E]}),_}},Ce={id:"sheet.command.set-filter-criteria",type:v.CommandType.COMMAND,handler:async(e,t)=>{const r=e.get(f.SheetsFilterService),n=e.get(v.ICommandService),o=e.get(v.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 m=u.getFilterColumn(s),g=$n(a,i,s,m),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:[g],redoMutations:[d]}),E}},qt={id:"sheet.command.clear-filter-criteria",type:v.CommandType.COMMAND,handler:e=>{const t=e.get(f.SheetsFilterService),r=e.get(v.IUndoRedoService),n=e.get(v.ICommandService),o=t.activeFilterModel;if(!o)return!1;const{unitId:a,subUnitId:i}=o,s=o.serialize(),l=Dr(a,i,s),u=Ln(a,i,s);return v.sequenceExecute(u,n)&&r.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:u}),!0}},Xt={id:"sheet.command.re-calc-filter",type:v.CommandType.COMMAND,handler:e=>{const t=e.get(f.SheetsFilterService),r=e.get(v.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 An(e,t,r){const n=[],o={id:f.SetSheetsFilterRangeMutation.id,params:{unitId:e,subUnitId:t,range:r.ref}};return n.push(o),Dr(e,t,r).forEach(i=>n.push(i)),n}function Dr(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 Ln(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 $n(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 z=(e=>(e[e.FIRST=0]="FIRST",e[e.SECOND=1]="SECOND",e))(z||{}),P=(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))(P||{}),O;(e=>{e.NONE={label:"sheets-filter.conditions.none",operator:P.NONE,order:z.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===P.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},e.EMPTY={label:"sheets-filter.conditions.empty",operator:P.EMPTY,order:z.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===P.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:P.EMPTY}:!1}},e.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:P.NOT_EMPTY,order:z.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===P.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:P.NOT_EMPTY}:!1}},e.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:P.CONTAINS,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.CONTAINS,val1:l.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:P.DOES_NOT_CONTAIN,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:f.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.DOES_NOT_CONTAIN,val1:l.slice(1,-1)}:!1}},e.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:P.STARTS_WITH,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.STARTS_WITH,val1:l.slice(0,-1)}:!1}},e.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:P.ENDS_WITH,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.ENDS_WITH,val1:l.slice(1)}:!1}},e.EQUALS={label:"sheets-filter.conditions.equals",operator:P.EQUALS,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.EQUALS,val1:""}),testMappingParams:i=>{const[s]=de(i);return s===P.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:P.EQUALS,val1:""}:((u=i.customFilters)==null?void 0:u.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:P.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:z.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:z.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:z.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:z.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:z.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:z.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:P.BETWEEN,order:z.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:v.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:P.NOT_BETWEEN,order:z.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:P.CUSTOM,order:z.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:P.NONE,val1:"",operator2:P.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:l,val2:u,operator1:c,operator2:m}=i;function g(b,I){for(const T of e.ALL_CONDITIONS)if(T.operator===b)return T.mapToFilterColumn({val1:I,operator1:b})}const d=!c||c===e.NONE.operator,E=!m||m===e.NONE.operator;if(d&&E)return e.NONE.mapToFilterColumn({});if(d)return g(m,u);if(E)return g(c,l);const _=g(c,l),S=g(m,u),y={customFilters:[_.customFilters.customFilters[0],S.customFilters.customFilters[0]]};return s&&(y.and=v.BooleanNumber.TRUE),{customFilters:y}},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})(O||(O={}));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 Wt(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 Un=Object.defineProperty,Dn=Object.getOwnPropertyDescriptor,Kt=(e,t,r,n)=>{for(var o=n>1?void 0:n?Dn(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&&Un(t,r,o),o},$e=(e,t)=>(r,n)=>t(r,n,e),pt=(e=>(e[e.VALUES=0]="VALUES",e[e.CONDITIONS=1]="CONDITIONS",e))(pt||{});A.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let Re=class extends v.Disposable{constructor(t,r,n,o){super();N(this,"_filterBy$",new M.BehaviorSubject(0));N(this,"filterBy$",this._filterBy$.asObservable());N(this,"_filterByModel$",new M.ReplaySubject(1));N(this,"filterByModel$",this._filterByModel$.asObservable());N(this,"_filterByModel",null);N(this,"_hasCriteria$",new M.BehaviorSubject(!1));N(this,"hasCriteria$",this._hasCriteria$.asObservable());N(this,"_filterModel",null);N(this,"_col$",new M.BehaviorSubject(-1));N(this,"col$",this._col$.asObservable());N(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=gt.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=vt.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}};Re=Kt([$e(0,A.Inject(A.Injector)),$e(1,A.Inject(f.SheetsFilterService)),$e(2,v.IUniverInstanceService),$e(3,A.Inject(Q.RefRangeService))],Re);let vt=class extends v.Disposable{constructor(t,r,n,o,a){super();N(this,"canApply$",M.of(!0));N(this,"_conditionItem$");N(this,"conditionItem$");N(this,"_filterConditionFormParams$");N(this,"filterConditionFormParams$");this._filterModel=t,this.col=r,this._commandService=a,this._conditionItem$=new M.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new M.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(t,r,n,o){const[a,i]=O.testMappingFilterColumn(o==null?void 0:o.getColumnData());return t.createInstance(vt,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(Ce.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=O.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(Ce.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:t})}onPrimaryConditionChange(t){const r=O.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(O.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=O.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(r)}};vt=Kt([$e(4,v.ICommandService)],vt);let gt=class extends v.Disposable{constructor(t,r,n,o){super();N(this,"_rawFilterItems$");N(this,"rawFilterItems$");N(this,"filterItems$");N(this,"_filterItems",[]);N(this,"canApply$");N(this,"_manuallyUpdateFilterItems$");N(this,"_searchString$");N(this,"searchString$");this._filterModel=t,this.col=r,this._commandService=o,this._searchString$=new M.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new M.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new M.Subject,this.filterItems$=M.merge(M.combineLatest([this._searchString$.pipe(M.throttleTime(500,void 0,{leading:!0,trailing:!0}),M.startWith(void 0)),this._rawFilterItems$]).pipe(M.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(m=>c.includes(m))})})),this._manuallyUpdateFilterItems$).pipe(M.shareReplay(1)),this.canApply$=this.filterItems$.pipe(M.map(a=>Wt(a).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(a=>this._filterItems=a))}static fromFilterColumn(t,r,n){var U;const o=t.get(v.IUniverInstanceService),a=t.get(v.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(),m=n,g=(U=r.getFilterColumn(n))==null?void 0:U.getColumnData().filters,d=!!(g&&g.blank),E={...c,startRow:c.startRow+1,startColumn:m,endColumn:m},_=[],S={},y=new Set(g==null?void 0:g.filters),b=r.getFilteredOutRowsExceptCol(n);let I=0,T=0;for(const C of u.iterateByColumn(E,!1,!1)){const{row:D,rowSpan:x=1}=C;let V=0;for(;V<x;){const Z=D+V;if(b.has(Z)){V++;continue}const Y=C!=null&&C.value?v.extractPureTextFromCell(C.value):"";if(!Y){T+=1,V+=x;continue}if(S[Y])S[Y].count++;else{const ie={value:Y,checked:y.size?y.has(Y):!d,count:1,index:I,isEmpty:!1};S[Y]=ie,_.push(ie)}V++}I++}const W=g?d:!0;if(T>0){const C={value:a.t("sheets-filter.panel.empty"),checked:W,count:T,index:I,isEmpty:!0};_.push(C)}return t.createInstance(gt,r,n,_)}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(Ce.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=Wt(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(Ce.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(Ce.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:s})}};gt=Kt([$e(3,v.ICommandService)],gt);const He="FILTER_PANEL_OPENED",Je={id:"sheet.operation.open-filter-panel",type:v.CommandType.OPERATION,handler:(e,t)=>{const r=e.get(v.IContextService),n=e.get(f.SheetsFilterService),o=e.get(Re);e.get(v.ICommandService).syncExecuteCommand(ue.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(He)||r.setContextValue(He,!0),!0)}},Ue={id:"sheet.operation.close-filter-panel",type:v.CommandType.OPERATION,handler:e=>{const t=e.get(v.IContextService),r=e.get(Re),n=e.get(L.ILayoutService,A.Quantity.OPTIONAL);return t.getContextValue(He)?(t.setContextValue(He,!1),n==null||n.focus(),r.terminate()):!1}},Zt={id:"sheet.operation.apply-filter",type:v.CommandType.OPERATION,handler:(e,t)=>{const{filterBy:r}=t;return e.get(Re).changeFilterBy(r)}},Hn="univer-sheets-filter-panel",xn="univer-sheets-filter-panel-header",Bn="univer-sheets-filter-panel-content",jn="univer-sheets-filter-panel-select-all",Wn="univer-sheets-filter-panel-select-all-count",Vn="univer-sheets-filter-panel-values-container",kn="univer-input-affix-wrapper",zn="univer-select",Qn="univer-radio-group",Gn="univer-sheets-filter-panel-values-find",Yn="univer-sheets-filter-panel-values-list",qn="univer-sheets-filter-panel-values-list-inner-container",Xn="univer-sheets-filter-panel-values-virtual",Kn="univer-sheets-filter-panel-values-item",Zn="univer-sheets-filter-panel-values-item-inner",Jn="univer-sheets-filter-panel-values-item-count",ei="univer-sheets-filter-panel-values-item-exclude-button",ti="univer-sheets-filter-panel-values-item-text",ri="univer-sheets-filter-panel-conditions-container",ni="univer-sheets-filter-panel-conditions-container-inner",ii="univer-sheets-filter-panel-conditions-desc",oi="univer-sheets-filter-panel-footer",si="univer-sheets-filter-panel-footer-primary-buttons",ai="univer-button",li="univer-input",ui="univer-form-dual-column-layout",j={sheetsFilterPanel:Hn,sheetsFilterPanelHeader:xn,sheetsFilterPanelContent:Bn,sheetsFilterPanelSelectAll:jn,sheetsFilterPanelSelectAllCount:Wn,sheetsFilterPanelValuesContainer:Vn,inputAffixWrapper:kn,select:zn,radioGroup:Qn,sheetsFilterPanelValuesFind:Gn,sheetsFilterPanelValuesList:Yn,sheetsFilterPanelValuesListInnerContainer:qn,sheetsFilterPanelValuesVirtual:Xn,sheetsFilterPanelValuesItem:Kn,sheetsFilterPanelValuesItemInner:Zn,sheetsFilterPanelValuesItemCount:Jn,sheetsFilterPanelValuesItemExcludeButton:ei,sheetsFilterPanelValuesItemText:ti,sheetsFilterPanelConditionsContainer:ri,sheetsFilterPanelConditionsContainerInner:ni,sheetsFilterPanelConditionsDesc:ii,sheetsFilterPanelFooter:oi,sheetsFilterPanelFooterPrimaryButtons:si,button:ai,input:li,formDualColumnLayout:ui};function ci(e){const{model:t}=e,r=Le.useDependency(v.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:c,and:m}=o,g=m?"AND":"OR",d=h.useCallback(T=>{t.onConditionFormChange({and:T==="AND"})},[t]),E=fi(r),_=h.useCallback(T=>{t.onPrimaryConditionChange(T)},[t]),S=hi(r),y=h.useCallback(T=>{t.onConditionFormChange(T)},[t]),b=r.t("sheets-filter.panel.input-values-placeholder");function I(T,W,U){const C=O.getItemByOperator(T).numOfParameters===1;return h.createElement(h.Fragment,null,U==="operator2"&&h.createElement(G.RadioGroup,{value:g,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:T,options:S,onChange:D=>y({[U]:D})}),C&&h.createElement(G.Input,{value:W,placeholder:b,onChange:D=>y({[U==="operator1"?"val1":"val2"]:D})}))}return h.createElement("div",{className:j.sheetsFilterPanelConditionsContainer},h.createElement(G.Select,{value:a,options:E,onChange:_}),O.getItemByOperator(a).numOfParameters!==0?h.createElement("div",{className:j.sheetsFilterPanelConditionsContainerInner},i>=1&&I(s,u!=null?u:"","operator1"),i>=2&&I(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 fi(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{options:[{label:e.t(O.NONE.label),value:O.NONE.operator}]},{options:[{label:e.t(O.EMPTY.label),value:O.EMPTY.operator},{label:e.t(O.NOT_EMPTY.label),value:O.NOT_EMPTY.operator}]},{options:[{label:e.t(O.TEXT_CONTAINS.label),value:O.TEXT_CONTAINS.operator},{label:e.t(O.DOES_NOT_CONTAIN.label),value:O.DOES_NOT_CONTAIN.operator},{label:e.t(O.STARTS_WITH.label),value:O.STARTS_WITH.operator},{label:e.t(O.ENDS_WITH.label),value:O.ENDS_WITH.operator},{label:e.t(O.EQUALS.label),value:O.EQUALS.operator}]},{options:[{label:e.t(O.GREATER_THAN.label),value:O.GREATER_THAN.operator},{label:e.t(O.GREATER_THAN_OR_EQUAL.label),value:O.GREATER_THAN_OR_EQUAL.operator},{label:e.t(O.LESS_THAN.label),value:O.LESS_THAN.operator},{label:e.t(O.LESS_THAN_OR_EQUAL.label),value:O.LESS_THAN_OR_EQUAL.operator},{label:e.t(O.EQUAL.label),value:O.EQUAL.operator},{label:e.t(O.NOT_EQUAL.label),value:O.NOT_EQUAL.operator},{label:e.t(O.BETWEEN.label),value:O.BETWEEN.operator},{label:e.t(O.NOT_BETWEEN.label),value:O.NOT_BETWEEN.operator}]},{options:[{label:e.t(O.CUSTOM.label),value:O.CUSTOM.operator}]}],[t,e])}function hi(e){const t=e.getCurrentLocale();return h.useMemo(()=>O.ALL_CONDITIONS.filter(r=>r.numOfParameters!==2).map(r=>({label:e.t(r.label),value:r.operator})),[t,e])}function et(){return et=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},et.apply(null,arguments)}function ce(e){"@babel/helpers - typeof";return ce=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},ce(e)}function di(e,t){if(ce(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ce(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hr(e){var t=di(e,"string");return ce(t)=="symbol"?t:t+""}function te(e,t,r){return(t=Hr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _r(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 K(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_r(Object(r),!0).forEach(function(n){te(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_r(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mi(e){if(Array.isArray(e))return e}function pi(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 Sr(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 vi(e,t){if(e){if(typeof e=="string")return Sr(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)?Sr(e,t):void 0}}function gi(){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 mi(e)||pi(e,t)||vi(e,t)||gi()}function _i(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 Si(e,t){if(e==null)return{};var r,n,o=_i(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 Ei(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xr={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})()})(
|
|
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})()})(xr);var bi=xr.exports;const _t=Ei(bi);var Br={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 qt=Symbol.for("react.element"),Xt=Symbol.for("react.portal"),bt=Symbol.for("react.fragment"),Ft=Symbol.for("react.strict_mode"),yt=Symbol.for("react.profiler"),Rt=Symbol.for("react.provider"),Ot=Symbol.for("react.context"),Fi=Symbol.for("react.server_context"),Ct=Symbol.for("react.forward_ref"),Tt=Symbol.for("react.suspense"),It=Symbol.for("react.suspense_list"),Pt=Symbol.for("react.memo"),Mt=Symbol.for("react.lazy"),yi=Symbol.for("react.offscreen"),Br;Br=Symbol.for("react.module.reference");function fe(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case qt:switch(e=e.type,e){case bt:case yt:case Ft:case Tt:case It:return e;default:switch(e=e&&e.$$typeof,e){case Fi:case Ot:case Ct:case Mt:case Pt:case Rt:return e;default:return t}}case Xt:return t}}}$.ContextConsumer=Ot;$.ContextProvider=Rt;$.Element=qt;$.ForwardRef=Ct;$.Fragment=bt;$.Lazy=Mt;$.Memo=Pt;$.Portal=Xt;$.Profiler=yt;$.StrictMode=Ft;$.Suspense=Tt;$.SuspenseList=It;$.isAsyncMode=function(){return!1};$.isConcurrentMode=function(){return!1};$.isContextConsumer=function(e){return fe(e)===Ot};$.isContextProvider=function(e){return fe(e)===Rt};$.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===qt};$.isForwardRef=function(e){return fe(e)===Ct};$.isFragment=function(e){return fe(e)===bt};$.isLazy=function(e){return fe(e)===Mt};$.isMemo=function(e){return fe(e)===Pt};$.isPortal=function(e){return fe(e)===Xt};$.isProfiler=function(e){return fe(e)===yt};$.isStrictMode=function(e){return fe(e)===Ft};$.isSuspense=function(e){return fe(e)===Tt};$.isSuspenseList=function(e){return fe(e)===It};$.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===bt||e===yt||e===Ft||e===Tt||e===It||e===yi||typeof e=="object"&&e!==null&&(e.$$typeof===Mt||e.$$typeof===Pt||e.$$typeof===Rt||e.$$typeof===Ot||e.$$typeof===Ct||e.$$typeof===Br||e.getModuleId!==void 0)};$.typeOf=fe;xr.exports=$;var Ye=xr.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)):Ye.isFragment(n)&&n.props?r=r.concat(Wt(n.props.children,t)):r.push(n))}),r}function vr(e){return e instanceof HTMLElement||e instanceof SVGElement}function Ri(e){return e&&ce(e)==="object"&&vr(e.nativeElement)?e.nativeElement:vr(e)?e:null}function ht(e){var t=Ri(e);if(t)return t;if(e instanceof h.Component){var r;return(r=dt.findDOMNode)===null||r===void 0?void 0:r.call(dt,e)}return null}function Oi(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 Ci=function(t,r){typeof t=="function"?t(r):ce(t)==="object"&&t&&"current"in t&&(t.current=r)},Ti=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){Ci(i,a)})}},Ii=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Oi(function(){return Ti.apply(void 0,r)},r,function(o,a){return o.length!==a.length||o.every(function(i,s){return i!==a[s]})})},Pi=function(t){var r,n,o=Ye.isMemo(t)?t.type.type:t.type;return!(typeof o=="function"&&!((r=o.prototype)!==null&&r!==void 0&&r.render)&&o.$$typeof!==Ye.ForwardRef||typeof t=="function"&&!((n=t.prototype)!==null&&n!==void 0&&n.render)&&t.$$typeof!==Ye.ForwardRef)};function _r(e){return h.isValidElement(e)&&!Ye.isFragment(e)}Number(h.version.split(".")[0])>=19;var Vt=p.createContext(null);function Mi(e){var t=e.children,r=e.onBatchResize,n=p.useRef(0),o=p.useRef([]),a=p.useContext(Vt),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(Vt.Provider,{value:i},t)}var jr=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}()}(),kt=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")()}(),Ni=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(gt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),wi=2;function Ai(e,t){var r=!1,n=!1,o=0;function a(){r&&(r=!1,e()),n&&s()}function i(){Ni(a)}function s(){var l=Date.now();if(r){if(l-o<wi)return;n=!0}else r=!0,n=!1,setTimeout(i,t);o=l}return s}var Li=20,$i=["top","right","bottom","left","width","height","size","weight"],Ui=typeof MutationObserver<"u",Di=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Ai(this.refresh.bind(this),Li)}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(){!kt||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Ui?(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(){!kt||!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=$i.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}(),Wr=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},He=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||gt},Vr=Nt(0,0,0,0);function St(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+St(a)},0)}function Hi(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 xi(e){var t=e.getBBox();return Nt(0,0,t.width,t.height)}function Bi(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return Vr;var n=He(e).getComputedStyle(e),o=Hi(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-=gr(n,"left","right")+a),Math.round(l+i)!==r&&(l-=gr(n,"top","bottom")+i)),!Wi(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 Nt(o.left,o.top,s,l)}var ji=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof He(e).SVGGraphicsElement}:function(e){return e instanceof He(e).SVGElement&&typeof e.getBBox=="function"}}();function Wi(e){return e===He(e).document.documentElement}function Vi(e){return kt?ji(e)?xi(e):Bi(e):Vr}function ki(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 Wr(i,{x:t,y:r,width:n,height:o,top:r,right:t+n,bottom:o+r,left:t}),i}function Nt(e,t,r,n){return{x:e,y:t,width:r,height:n}}var zi=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Nt(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Vi(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}(),Qi=function(){function e(t,r){var n=ki(r);Wr(this,{target:t,contentRect:n})}return e}(),Gi=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new jr,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 He(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new zi(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 He(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 Qi(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}(),kr=typeof WeakMap<"u"?new WeakMap:new jr,zr=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=Di.getInstance(),n=new Gi(t,r,this);kr.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){zr.prototype[e]=function(){var t;return(t=kr.get(this))[e].apply(t,arguments)}});var Yi=function(){return typeof gt.ResizeObserver<"u"?gt.ResizeObserver:zr}(),Fe=new Map;function qi(e){e.forEach(function(t){var r,n=t.target;(r=Fe.get(n))===null||r===void 0||r.forEach(function(o){return o(n)})})}var Qr=new Yi(qi);function Xi(e,t){Fe.has(e)||(Fe.set(e,new Set),Qr.observe(e)),Fe.get(e).add(t)}function Ki(e,t){Fe.has(e)&&(Fe.get(e).delete(t),Fe.get(e).size||(Qr.unobserve(e),Fe.delete(e)))}function Gr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zi(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,Dr(n.key),n)}}function Yr(e,t,r){return t&&Zi(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function zt(e,t){return zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},zt(e,t)}function Ji(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&&zt(e,t)}function Et(e){return Et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Et(e)}function qr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qr=function(){return!!e})()}function eo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function to(e,t){if(t&&(ce(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eo(e)}function ro(e){var t=qr();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 to(this,r)}}var no=function(e){Ji(r,e);var t=ro(r);function r(){return Gr(this,r),t.apply(this,arguments)}return Yr(r,[{key:"render",value:function(){return this.props.children}}]),r}(p.Component);function io(e,t){var r=e.children,n=e.disabled,o=p.useRef(null),a=p.useRef(null),i=p.useContext(Vt),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)&&Pi(l),m=c?l.ref:null,_=Ii(m,o),d=function(){var y;return ht(o.current)||(o.current&&ce(o.current)==="object"?ht((y=o.current)===null||y===void 0?void 0:y.nativeElement):null)||ht(a.current)};p.useImperativeHandle(t,function(){return d()});var E=p.useRef(e);E.current=e;var g=p.useCallback(function(S){var y=E.current,b=y.onResize,I=y.data,T=S.getBoundingClientRect(),W=T.width,U=T.height,C=S.offsetWidth,D=S.offsetHeight,x=Math.floor(W),V=Math.floor(U);if(u.current.width!==x||u.current.height!==V||u.current.offsetWidth!==C||u.current.offsetHeight!==D){var te={width:x,height:V,offsetWidth:C,offsetHeight:D};u.current=te;var Y=C===Math.round(W)?W:C,ie=D===Math.round(U)?U:D,q=K(K({},te),{},{offsetWidth:Y,offsetHeight:ie});i==null||i(q,S,I),b&&Promise.resolve().then(function(){b(q,S)})}},[]);return p.useEffect(function(){var S=d();return S&&!n&&Xi(S,g),function(){return Ki(S,g)}},[o.current,n]),p.createElement(no,{ref:a},c?p.cloneElement(l,{ref:_}):l)}var oo=p.forwardRef(io),so="rc-observer-key";function ao(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(so,"-").concat(a);return p.createElement(oo,Je({},e,{key:i,ref:a===0?t:void 0}),o)})}var Kt=p.forwardRef(ao);Kt.Collection=Mi;function Sr(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 lo(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Er=lo()?p.useLayoutEffect:p.useEffect,qe=function(t,r){var n=p.useRef(!0);Er(function(){return t(n.current)},r),Er(function(){return n.current=!1,function(){n.current=!0}},[])},Xr=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,m={},_={display:"flex",flexDirection:"column"};return n!==void 0&&(m={height:r,position:"relative",overflow:"hidden"},_=K(K({},_),{},ee(ee(ee(ee(ee({transform:"translateY(".concat(n,"px)")},u?"marginRight":"marginLeft",-o),"position","absolute"),"left",0),"right",0),"top",0))),p.createElement("div",{style:m},p.createElement(Kt,{onResize:function(E){var g=E.offsetHeight;g&&s&&s()}},p.createElement("div",Je({style:_,className:_t(ee({},"".concat(i,"-holder-inner"),i)),ref:t},l),a,c)))});Xr.displayName="Filler";function uo(e){var t=e.children,r=e.setRef,n=p.useCallback(function(o){r(o)},[]);return p.cloneElement(t,{ref:n})}function co(e,t,r,n,o,a,i,s){var l=s.getKey;return e.slice(t,r+1).map(function(u,c){var m=t+c,_=i(u,m,{style:{width:n},offsetX:o}),d=l(u);return p.createElement(uo,{key:d,setRef:function(g){return a(u,g)}},_)})}function fo(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,m=0;m<i.length;m+=1){var _=l(a[m]),d=l(i[m]);if(_!==d){u=m,c=c||_!==l(i[m+1]);break}}return u===null?null:{index:u,multiple:c}}function ho(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 m=fo(a||[],e||[],t);(m==null?void 0:m.index)!==void 0&&c(e[m.index]),i(e)},[e]),[u]}var Kr=function(t){return+setTimeout(t,16)},Zr=function(t){return clearTimeout(t)};typeof window<"u"&&"requestAnimationFrame"in window&&(Kr=function(t){return window.requestAnimationFrame(t)},Zr=function(t){return window.cancelAnimationFrame(t)});var br=0,Zt=new Map;function Jr(e){Zt.delete(e)}var me=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;br+=1;var n=br;function o(a){if(a===0)Jr(n),t();else{var i=Kr(function(){o(a-1)});Zt.set(n,i)}}return o(r),n};me.cancel=function(e){var t=Zt.get(e);return Jr(e),Zr(t)};var Fr=(typeof navigator>"u"?"undefined":ce(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const en=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,m=l?u<0&&s.current.left||u>0&&s.current.right:u<0&&s.current.top||u>0&&s.current.bottom;return c&&m?(clearTimeout(a.current),o.current=!1):(!m||o.current)&&i(),!o.current&&m}};function mo(e,t,r,n,o,a,i){var s=h.useRef(0),l=h.useRef(null),u=h.useRef(null),c=h.useRef(!1),m=en(t,r,n,o);function _(b,I){me.cancel(l.current),s.current+=I,u.current=I,!m(!1,I)&&(Fr||b.preventDefault(),l.current=me(function(){var T=c.current?10:1;i(s.current*T),s.current=0}))}function d(b,I){i(I,!0),Fr||b.preventDefault()}var E=h.useRef(null),g=h.useRef(null);function S(b){if(e){me.cancel(g.current),g.current=me(function(){E.current=null},2);var I=b.deltaX,T=b.deltaY,W=b.shiftKey,U=I,C=T;(E.current==="sx"||!E.current&&W&&T&&!I)&&(U=T,C=0,E.current="sx");var D=Math.abs(U),x=Math.abs(C);E.current===null&&(E.current=a&&D>x?"x":"y"),E.current==="y"?_(b,C):d(b,U)}}function y(b){e&&(c.current=b.detail===u.current)}return[S,y]}function po(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 m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,_=i.get(c),d=i.get(m);if(_===void 0||d===void 0)for(var E=e.length,g=s.length;g<E;g+=1){var S,y=e[g],b=t(y);i.set(b,g);var I=(S=r.get(b))!==null&&S!==void 0?S:n;if(s[g]=(s[g-1]||0)+I,b===c&&(_=g),b===m&&(d=g),_!==void 0&&d!==void 0)break}return{top:s[_-1]||0,bottom:s[d]}};return l}var vo=function(){function e(){Gr(this,e),ee(this,"maps",void 0),ee(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 _o(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 vo),u=h.useRef();function c(){me.cancel(u.current)}function m(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;c();var E=function(){s.current.forEach(function(S,y){if(S&&S.offsetParent){var b=ht(S),I=b.offsetHeight;l.current.get(y)!==I&&l.current.set(y,b.offsetHeight)}}),i(function(S){return S+1})};d?E():u.current=me(E)}function _(d,E){var g=e(d);s.current.get(g),E?(s.current.set(g,E),m()):s.current.delete(g)}return h.useEffect(function(){return c},[]),[_,m,l.current,a]}var yr=14/15;function go(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),g=Math.ceil(d.touches[0].pageY),S=o.current-E,y=a.current-g,b=Math.abs(S)>Math.abs(y);b?o.current=E:a.current=g,r(b,b?S:y)&&d.preventDefault(),clearInterval(s.current),s.current=setInterval(function(){b?S*=yr:y*=yr;var I=Math.floor(b?S:y);(!r(b,I,!0)||Math.abs(I)<=.1)&&clearInterval(s.current)},16)}},c=function(){n.current=!1,l()},m=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),i.current.addEventListener("touchend",c))};l=function(){i.current&&(i.current.removeEventListener("touchmove",u),i.current.removeEventListener("touchend",c))},qe(function(){return e&&t.current.addEventListener("touchstart",m),function(){var _;(_=t.current)===null||_===void 0||_.removeEventListener("touchstart",m),l(),clearInterval(s.current)}},[e])}var So=10;function Eo(e,t,r,n,o,a,i,s){var l=p.useRef(),u=p.useState(null),c=X(u,2),m=c[0],_=c[1];return qe(function(){if(m&&m.times<So){if(!e.current){_(function(Z){return K({},Z)});return}a();var d=m.targetAlign,E=m.originAlign,g=m.index,S=m.offset,y=e.current.clientHeight,b=!1,I=d,T=null;if(y){for(var W=d||E,U=0,C=0,D=0,x=Math.min(t.length-1,g),V=0;V<=x;V+=1){var te=o(t[V]);C=U;var Y=r.get(te);D=C+(Y===void 0?n:Y),U=D}for(var ie=W==="top"?S:y-S,q=x;q>=0;q-=1){var Ie=o(t[q]),re=r.get(Ie);if(re===void 0){b=!0;break}if(ie-=re,ie<=0)break}switch(W){case"top":T=C-S;break;case"bottom":T=D-y+S;break;default:{var Re=e.current.scrollTop,he=Re+y;C<Re?I="top":D>he&&(I="bottom")}}T!==null&&i(T),T!==m.lastTop&&(b=!0)}b&&_(K(K({},m),{},{times:m.times+1,targetAlign:I,lastTop:T}))}},[m,e.current]),function(d){if(d==null){s();return}if(me.cancel(l.current),typeof d=="number")i(d);else if(d&&ce(d)==="object"){var E,g=d.align;"index"in d?E=d.index:E=t.findIndex(function(b){return o(b)===d.key});var S=d.offset,y=S===void 0?0:S;_({times:0,index:E,offset:y,originAlign:g})}}}function Rr(e,t){var r="touches"in e?e.touches[0]:e;return r[t?"pageX":"pageY"]}var Or=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,m=e.containerSize,_=e.style,d=e.thumbStyle,E=p.useState(!1),g=X(E,2),S=g[0],y=g[1],b=p.useState(null),I=X(b,2),T=I[0],W=I[1],U=p.useState(null),C=X(U,2),D=C[0],x=C[1],V=!n,te=p.useRef(),Y=p.useRef(),ie=p.useState(!1),q=X(ie,2),Ie=q[0],re=q[1],Re=p.useRef(),he=function(){clearTimeout(Re.current),re(!0),Re.current=setTimeout(function(){re(!1)},3e3)},Z=a-m||0,xe=m-c||0,B=p.useMemo(function(){if(o===0||Z===0)return 0;var ne=o/Z;return ne*xe},[o,Z,xe]),Oe=function(H){H.stopPropagation(),H.preventDefault()},Pe=p.useRef({top:B,dragging:S,pageY:T,startTop:D});Pe.current={top:B,dragging:S,pageY:T,startTop:D};var Me=function(H){y(!0),W(Rr(H,u)),x(Pe.current.top),i(),H.stopPropagation(),H.preventDefault()};p.useEffect(function(){var ne=function(Ne){Ne.preventDefault()},H=te.current,se=Y.current;return H.addEventListener("touchstart",ne),se.addEventListener("touchstart",Me),function(){H.removeEventListener("touchstart",ne),se.removeEventListener("touchstart",Me)}},[]);var tt=p.useRef();tt.current=Z;var Be=p.useRef();Be.current=xe,p.useEffect(function(){if(S){var ne,H=function(Ne){var je=Pe.current,nt=je.dragging,it=je.pageY,ot=je.startTop;if(me.cancel(ne),nt){var st=Rr(Ne,u)-it,Se=ot;!V&&u?Se-=st:Se+=st;var We=tt.current,at=Be.current,wt=at?Se/at:0,Ce=Math.ceil(wt*We);Ce=Math.max(Ce,0),Ce=Math.min(Ce,We),ne=me(function(){l(Ce,u)})}},se=function(){y(!1),s()};return window.addEventListener("mousemove",H),window.addEventListener("touchmove",H),window.addEventListener("mouseup",se),window.addEventListener("touchend",se),function(){window.removeEventListener("mousemove",H),window.removeEventListener("touchmove",H),window.removeEventListener("mouseup",se),window.removeEventListener("touchend",se),me.cancel(ne)}}},[S]),p.useEffect(function(){he()},[o]),p.useImperativeHandle(t,function(){return{delayHidden:he}});var J="".concat(r,"-scrollbar"),oe={position:"absolute",visibility:Ie?null:"hidden"},pe={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(oe.height=8,oe.left=0,oe.right=0,oe.bottom=0,pe.height="100%",pe.width=c,V?pe.left=B:pe.right=B):(oe.width=8,oe.top=0,oe.bottom=0,V?oe.right=0:oe.left=0,pe.width="100%",pe.height=c,pe.top=B),p.createElement("div",{ref:te,className:_t(J,ee(ee(ee({},"".concat(J,"-horizontal"),u),"".concat(J,"-vertical"),!u),"".concat(J,"-visible"),Ie)),style:K(K({},oe),_),onMouseDown:Oe,onMouseMove:he},p.createElement("div",{ref:Y,className:_t("".concat(J,"-thumb"),ee({},"".concat(J,"-thumb-moving"),S)),style:K(K({},pe),d),onMouseDown:Me}))}),bo=20;function Cr(){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,bo),Math.floor(r)}var Fo=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles"],yo=[],Ro={overflowY:"auto",overflowAnchor:"none"};function Oo(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,m=e.children,_=e.itemKey,d=e.virtual,E=e.direction,g=e.scrollWidth,S=e.component,y=S===void 0?"div":S,b=e.onScroll,I=e.onVirtualScroll,T=e.onVisibleChange,W=e.innerProps,U=e.extraRender,C=e.styles,D=Si(e,Fo),x=p.useCallback(function(R){return typeof _=="function"?_(R):R==null?void 0:R[_]},[_]),V=_o(x),te=X(V,4),Y=te[0],ie=te[1],q=te[2],Ie=te[3],re=!!(d!==!1&&a&&i),Re=p.useMemo(function(){return Object.values(q.maps).reduce(function(R,F){return R+F},0)},[q.id,q.maps]),he=re&&c&&(Math.max(i*c.length,Re)>a||!!g),Z=E==="rtl",xe=_t(n,ee({},"".concat(n,"-rtl"),Z),o),B=c||yo,Oe=h.useRef(),Pe=h.useRef(),Me=h.useRef(),tt=h.useState(0),Be=X(tt,2),J=Be[0],oe=Be[1],pe=h.useState(0),ne=X(pe,2),H=ne[0],se=ne[1],rt=h.useState(!1),Ne=X(rt,2),je=Ne[0],nt=Ne[1],it=function(){nt(!0)},ot=function(){nt(!1)},st={getKey:x};function Se(R){oe(function(F){var w;typeof R=="function"?w=R(F):w=R;var k=mn(w);return Oe.current.scrollTop=k,k})}var We=h.useRef({start:0,end:B.length}),at=h.useRef(),wt=ho(B,x),Ce=X(wt,1),ln=Ce[0];at.current=ln;var lt=p.useMemo(function(){if(!re)return{scrollHeight:void 0,start:0,end:B.length-1,offset:void 0};if(!he){var R;return{scrollHeight:((R=Pe.current)===null||R===void 0?void 0:R.offsetHeight)||0,start:0,end:B.length-1,offset:void 0}}for(var F=0,w,k,Ee,Fn=B.length,Qe=0;Qe<Fn;Qe+=1){var yn=B[Qe],Rn=x(yn),dr=q.get(Rn),xt=F+(dr===void 0?i:dr);xt>=J&&w===void 0&&(w=Qe,k=F),xt>J+a&&Ee===void 0&&(Ee=Qe),F=xt}return w===void 0&&(w=0,k=0,Ee=Math.ceil(a/i)),Ee===void 0&&(Ee=B.length-1),Ee=Math.min(Ee+1,B.length-1),{scrollHeight:F,start:w,end:Ee,offset:k}},[he,re,J,B,Ie,a]),we=lt.scrollHeight,Ve=lt.start,ke=lt.end,Jt=lt.offset;We.current.start=Ve,We.current.end=ke;var un=p.useState({width:0,height:a}),er=X(un,2),ve=er[0],cn=er[1],fn=function(F){cn({width:F.width||F.offsetWidth,height:F.height||F.offsetHeight})},tr=h.useRef(),rr=h.useRef(),hn=p.useMemo(function(){return Cr(ve.width,g)},[ve.width,g]),dn=p.useMemo(function(){return Cr(ve.height,we)},[ve.height,we]),At=we-a,Lt=h.useRef(At);Lt.current=At;function mn(R){var F=R;return Number.isNaN(Lt.current)||(F=Math.min(F,Lt.current)),F=Math.max(F,0),F}var nr=J<=0,ir=J>=At,or=H<=0,sr=H>=g,pn=en(nr,ir,or,sr),$t=function(){return{x:Z?-H:H,y:J}},Ut=h.useRef($t()),ut=Sr(function(R){if(I){var F=K(K({},$t()),R);(Ut.current.x!==F.x||Ut.current.y!==F.y)&&(I(F),Ut.current=F)}});function ar(R,F){var w=R;F?(dt.flushSync(function(){se(w)}),ut()):Se(w)}function vn(R){var F=R.currentTarget.scrollTop;F!==J&&Se(F),b==null||b(R),ut()}var Dt=function(F){var w=F,k=g?g-ve.width:0;return w=Math.max(w,0),w=Math.min(w,k),w},_n=Sr(function(R,F){F?(dt.flushSync(function(){se(function(w){var k=w+(Z?-R:R);return Dt(k)})}),ut()):Se(function(w){var k=w+R;return k})}),gn=mo(re,nr,ir,or,sr,!!g,_n),lr=X(gn,2),Ht=lr[0],ur=lr[1];go(re,Oe,function(R,F,w){return pn(R,F,w)?!1:(Ht({preventDefault:function(){},deltaX:R?F:0,deltaY:R?0:F}),!0)}),qe(function(){function R(w){re&&w.preventDefault()}var F=Oe.current;return F.addEventListener("wheel",Ht),F.addEventListener("DOMMouseScroll",ur),F.addEventListener("MozMousePixelScroll",R),function(){F.removeEventListener("wheel",Ht),F.removeEventListener("DOMMouseScroll",ur),F.removeEventListener("MozMousePixelScroll",R)}},[re]),qe(function(){if(g){var R=Dt(H);se(R),ut({x:R})}},[ve.width,g]);var cr=function(){var F,w;(F=tr.current)===null||F===void 0||F.delayHidden(),(w=rr.current)===null||w===void 0||w.delayHidden()},fr=Eo(Oe,B,q,i,x,function(){return ie(!0)},Se,cr);p.useImperativeHandle(t,function(){return{nativeElement:Me.current,getScrollInfo:$t,scrollTo:function(F){function w(k){return k&&ce(k)==="object"&&("left"in k||"top"in k)}w(F)?(F.left!==void 0&&se(Dt(F.left)),fr(F.top)):fr(F)}}}),qe(function(){if(T){var R=B.slice(Ve,ke+1);T(R,B)}},[Ve,ke,B]);var Sn=po(B,x,q,i),En=U==null?void 0:U({start:Ve,end:ke,virtual:he,offsetX:H,offsetY:Jt,rtl:Z,getSize:Sn}),bn=co(B,Ve,ke,g,H,Y,m,st),ze=null;a&&(ze=K(ee({},l?"height":"maxHeight",a),Ro),re&&(ze.overflowY="hidden",g&&(ze.overflowX="hidden"),je&&(ze.pointerEvents="none")));var hr={};return Z&&(hr.dir="rtl"),p.createElement("div",Je({ref:Me,style:K(K({},u),{},{position:"relative"}),className:xe},hr,D),p.createElement(Kt,{onResize:fn},p.createElement(y,{className:"".concat(n,"-holder"),style:ze,ref:Oe,onScroll:vn,onMouseEnter:cr},p.createElement(Xr,{prefixCls:n,height:we,offsetX:H,offsetY:Jt,scrollWidth:g,onInnerResize:ie,ref:Pe,innerProps:W,rtl:Z,extra:En},bn))),he&&we>a&&p.createElement(Or,{ref:tr,prefixCls:n,scrollOffset:J,scrollRange:we,rtl:Z,onScroll:ar,onStartMove:it,onStopMove:ot,spinSize:dn,containerSize:ve.height,style:C==null?void 0:C.verticalScrollBar,thumbStyle:C==null?void 0:C.verticalScrollBarThumb}),he&&g>ve.width&&p.createElement(Or,{ref:rr,prefixCls:n,scrollOffset:H,scrollRange:g,rtl:Z,onScroll:ar,onStartMove:it,onStopMove:ot,spinSize:hn,containerSize:ve.width,horizontal:!0,style:C==null?void 0:C.horizontalScrollBar,thumbStyle:C==null?void 0:C.horizontalScrollBarThumb}))}var tn=p.forwardRef(Oo);tn.displayName="List";function Co(e){const{model:t}=e,r=Ae.useDependency(v.LocaleService),n=L.useObservable(t.searchString$,"",!0),o=L.useObservable(t.filterItems$,void 0,!0),a=r.t("sheets-filter.panel.filter-only"),i=jt(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]),m=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:m}),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(tn,{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 To(){var S;const e=Ae.useDependency(ye),t=Ae.useDependency(v.LocaleService),r=Ae.useDependency(v.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$)||M.of(!1),void 0,!1,[o]),i=Io(t),s=!L.useObservable(e.hasCriteria$),l=h.useCallback(y=>{r.executeCommand(Ur.id,{filterBy:y})},[r]),u=h.useCallback(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(Ge.id)},[o,r]),c=h.useCallback(()=>{r.executeCommand(Ge.id)},[r]),m=h.useCallback(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(Ge.id)},[o,r]),d=(S=Ae.useDependency(f.SheetsFilterService).activeFilterModel)==null?void 0:S.getRange(),E=e.col,g=L.useComponentsOfPart(ue.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return h.createElement("div",{className:j.sheetsFilterPanel},h.createElement(L.ComponentContainer,{components:g,sharedProps:{range:d,colIndex:E,onClose:c}}),h.createElement("div",{className:j.sheetsFilterPanelHeader},h.createElement(G.Segmented,{value:n,options:i,onChange:y=>l(y)})),o?h.createElement("div",{className:j.sheetsFilterPanelContent},n===mt.VALUES?h.createElement(Co,{model:o}):h.createElement(ci,{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:m},t.t("sheets-filter.panel.confirm")))))}function Io(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{label:e.t("sheets-filter.panel.by-values"),value:mt.VALUES},{label:e.t("sheets-filter.panel.by-conditions"),value:mt.CONDITIONS}],[t,e])}const Po={id:Te.id,binding:L.KeyCode.L|L.MetaKeys.CTRL_COMMAND|L.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:ue.whenSheetEditorFocused,group:"4_sheet-edit"};function Mo(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,v.UniverInstanceType.UNIVER_SHEET),activated$:t.activeFilterModel$.pipe(M.map(r=>!!r)),disabled$:ue.getCurrentRangeDisable$(e,{workbookTypes:[Q.WorkbookEditablePermission],worksheetTypes:[Q.WorksheetFilterPermission,Q.WorksheetEditPermission],rangeTypes:[Q.RangeProtectionPermissionEditPoint]})}}function No(e){const t=e.get(f.SheetsFilterService);return{id:Ar.id,group:L.MenuGroup.TOOLBAR_OTHERS,type:L.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",positions:[Te.id],hidden$:L.getMenuHiddenObservable(e,v.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(M.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(M.map(o=>!o)))!=null?n:M.of(!0)}))}}function wo(e){const t=e.get(f.SheetsFilterService);return{id:Lr.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,v.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(M.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(M.map(o=>!o)))!=null?n:M.of(!0)}))}}const be=16,Ao=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 Tr{static drawNoCriteria(t,r,n,o){t.save(),Ue.Rect.drawWith(t,{radius:2,width:be,height:be,fill:o}),t.lineCap="square",t.strokeStyle=n,t.scale(r/be,r/be),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(),Ue.Rect.drawWith(t,{radius:2,width:be,height:be,fill:o}),t.scale(r/be,r/be),t.fillStyle=n,t.fill(Ao),t.restore()}}var Lo=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,Uo=(e,t,r,n)=>{for(var o=n>1?void 0:n?$o(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&&Lo(t,r,o),o},Bt=(e,t)=>(r,n)=>t(r,n,e);const ge=16,ct=1;let Qt=class extends Ue.Shape{constructor(t,r,n,o,a){super(t,r);N(this,"_cellWidth",0);N(this,"_cellHeight",0);N(this,"_filterParams");N(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=ge-n,a=ge-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?Tr.drawHasCriteria(t,ge,l,u):Tr.drawNoCriteria(t,ge,l,u),t.restore()}onPointerDown(t){if(t.button===2)return;const{col:r,unitId:n,subUnitId:o}=this._filterParams;this._contextService.getContextValue(De)||!this._commandService.hasCommand(Ze.id)||setTimeout(()=>{this._commandService.executeCommand(Ze.id,{unitId:n,subUnitId:o,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Qt=Uo([Bt(2,v.IContextService),Bt(3,v.ICommandService),Bt(4,A.Inject(v.ThemeService))],Qt);var Do=Object.defineProperty,Ho=Object.getOwnPropertyDescriptor,xo=(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&&Do(t,r,o),o},_e=(e,t)=>(r,n)=>t(r,n,e);const Bo=1e3,jo=5e3;let Gt=class extends v.RxDisposable{constructor(t,r,n,o,a,i,s,l,u,c){super();N(this,"_filterRangeShape",null);N(this,"_buttonRenderDisposable",null);N(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(m=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(m.id))),this._initRenderer()}_initRenderer(){M.combineLatest([this._selectionRenderService.usable$,this._sheetSkeletonManagerService.currentSkeleton$]).pipe(M.filter(([t])=>t),M.switchMap(([t,r])=>{var l,u;if(!r)return M.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 v.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(M.filter(([c])=>c.type===v.CommandType.MUTATION&&c.params.unitId===n.getUnitId()&&f.FILTER_MUTATIONS.has(c.id)),M.throttleTime(20,void 0,{leading:!1,trailing:!0}),M.map(s),M.startWith(s()))}),M.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 ue.SelectionShape(a,Bo,!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:m}=r;for(let _=u;_<=c;_++){const d=`sheets-filter-button-${_}`,E=ue.getCoordByCell(m,_,l,a),{startX:g,startY:S,endX:y,endY:b}=E,I=y-g,T=b-S;if(T<=ct||I<=ct)continue;const W=!!n.getFilterColumn(_),U=y-ge-ct,C=b-ge-ct,D={left:U,top:C,height:ge,width:ge,zIndex:jo,cellHeight:T,cellWidth:I,filterParams:{unitId:o,subUnitId:i,col:_,hasCriteria:W}},x=this._injector.createInstance(Qt,d,D);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(Q.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:ge}})},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=xo([_e(1,A.Inject(A.Injector)),_e(2,A.Inject(ue.SheetSkeletonManagerService)),_e(3,A.Inject(f.SheetsFilterService)),_e(4,A.Inject(v.ThemeService)),_e(5,A.Inject(Q.SheetInterceptorService)),_e(6,A.Inject(ue.SheetsRenderService)),_e(7,v.ICommandService),_e(8,Ue.IRenderManagerService),_e(9,ue.ISelectionRenderService)],Gt);var Wo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,ko=(e,t,r,n)=>{for(var o=n>1?void 0:n?Vo(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&&Wo(t,r,o),o},zo=(e,t)=>(r,n)=>t(r,n,e);let et=class extends v.RxDisposable{constructor(e){super(),this._renderManagerService=e,this._initRenderControllers()}_initRenderControllers(){this.disposeWithMe(this._renderManagerService.registerRenderModule(v.UniverInstanceType.UNIVER_SHEET,Gt))}};et=ko([zo(0,Ue.IRenderManagerService)],et);v.runOnLifecycle(v.LifecycleStages.Rendered,et);var Qo=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,Yo=(e,t,r,n)=>{for(var o=n>1?void 0:n?Go(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&&Qo(t,r,o),o},ae=(e,t)=>(r,n)=>t(r,n,e);const rn={},Ir="FILTER_PANEL_POPUP";let Xe=class extends et{constructor(t,r,n,o,a,i,s,l,u,c,m,_,d){super(d);N(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=m,this._messageService=_,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Po].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_initCommands(){[Te,$e,Ar,Lr,Ur,Ze,Ge].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initMenuItems(){const{menu:t={}}=this._config;[Mo,No,wo].forEach(r=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r),t))})}_initUI(){this.disposeWithMe(this._componentManager.register(Ir,To)),this.disposeWithMe(this._componentManager.register("FilterSingle",wr)),this.disposeWithMe(this._contextService.subscribeContextValue$(De).pipe(M.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:Ir,direction:"horizontal",closeOnSelfTarget:!0,onClickOutside:()=>this._commandService.syncExecuteCommand(Ge.id),offset:[5,0]})}_closeFilterPopup(){var t;(t=this._popupDisposable)==null||t.dispose(),this._popupDisposable=null}};Xe=Yo([v.OnLifecycle(v.LifecycleStages.Ready,Xe),ae(1,A.Inject(A.Injector)),ae(2,A.Inject(L.ComponentManager)),ae(3,A.Inject(ye)),ae(4,A.Inject(ue.SheetCanvasPopManagerService)),ae(5,A.Inject(f.SheetsFilterService)),ae(6,A.Inject(v.LocaleService)),ae(7,L.IShortcutService),ae(8,v.ICommandService),ae(9,L.IMenuService),ae(10,v.IContextService),ae(11,L.IMessageService),ae(12,Ue.IRenderManagerService)],Xe);var qo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Ko=(e,t,r,n)=>{for(var o=n>1?void 0:n?Xo(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&&qo(t,r,o),o},ft=(e,t)=>(r,n)=>t(r,n,e);let Ke=class extends v.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:[Q.WorkbookEditablePermission],rangeTypes:[Q.RangeProtectionPermissionViewPoint],worksheetTypes:[Q.WorksheetFilterPermission,Q.WorksheetEditPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr"))),e.id===Ze.id){const r=e.params,{unitId:n,subUnitId:o}=r,a=(t=this._sheetsFilterService.getFilterModel(n,o))==null?void 0:t.getRange(),i=v.Tools.deepClone(a);i&&(i.startColumn=r.col,i.endColumn=r.col,this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[Q.WorkbookEditablePermission],rangeTypes:[Q.RangeProtectionPermissionViewPoint],worksheetTypes:[Q.WorksheetFilterPermission,Q.WorksheetEditPermission]},[i])||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr")))}}))}};Ke=Ko([v.OnLifecycle(v.LifecycleStages.Ready,Ke),ft(0,A.Inject(f.SheetsFilterService)),ft(1,A.Inject(v.LocaleService)),ft(2,v.ICommandService),ft(3,A.Inject(ue.SheetPermissionInterceptorBaseController))],Ke);var nn=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,Jo=(e,t,r)=>t in e?nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,es=(e,t,r,n)=>{for(var o=n>1?void 0:n?Zo(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&&nn(t,r,o),o},Pr=(e,t)=>(r,n)=>t(r,n,e),on=(e,t,r)=>Jo(e,typeof t!="symbol"?t+"":t,r);const ts="SHEET_FILTER_UI_PLUGIN";exports.UniverSheetsFilterUIPlugin=class extends v.Plugin{constructor(t={},r,n){super(),this._config=t,this._injector=r,this._localeService=n,this._config=v.Tools.deepMerge({},rn,this._config)}onStarting(t){[[ye],[Ke],[Xe,{useFactory:()=>this._injector.createInstance(Xe,this._config)}]].forEach(r=>t.add(r))}};on(exports.UniverSheetsFilterUIPlugin,"type",v.UniverInstanceType.UNIVER_SHEET);on(exports.UniverSheetsFilterUIPlugin,"pluginName",ts);exports.UniverSheetsFilterUIPlugin=es([v.DependentOn(f.UniverSheetsFilterPlugin),Pr(1,A.Inject(A.Injector)),Pr(2,A.Inject(v.LocaleService))],exports.UniverSheetsFilterUIPlugin);var sn=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,ns=(e,t,r)=>t in e?sn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,is=(e,t,r,n)=>{for(var o=n>1?void 0:n?rs(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&&sn(t,r,o),o},os=(e,t)=>(r,n)=>t(r,n,e),an=(e,t,r)=>ns(e,typeof t!="symbol"?t+"":t,r);const ss="SHEET_FILTER_UI_PLUGIN";exports.UniverSheetsFilterMobileUIPlugin=class extends v.Plugin{constructor(t={},r){super(),this._config=t,this._injector=r,this._config=v.Tools.deepMerge({},rn,this._config)}onStarting(t){[[Ke],[et]].forEach(r=>t.add(r))}};an(exports.UniverSheetsFilterMobileUIPlugin,"type",v.UniverInstanceType.UNIVER_SHEET);an(exports.UniverSheetsFilterMobileUIPlugin,"pluginName",ss);exports.UniverSheetsFilterMobileUIPlugin=is([v.DependentOn(f.UniverSheetsFilterPlugin),os(1,A.Inject(A.Injector))],exports.UniverSheetsFilterMobileUIPlugin);exports.OpenFilterPanelOperation=Ze;exports.SmartToggleSheetsFilterCommand=Te;
|
|
14
|
+
*/var Jt=Symbol.for("react.element"),er=Symbol.for("react.portal"),Ft=Symbol.for("react.fragment"),yt=Symbol.for("react.strict_mode"),Rt=Symbol.for("react.profiler"),Ot=Symbol.for("react.provider"),Ct=Symbol.for("react.context"),Fi=Symbol.for("react.server_context"),Tt=Symbol.for("react.forward_ref"),It=Symbol.for("react.suspense"),Pt=Symbol.for("react.suspense_list"),Mt=Symbol.for("react.memo"),Nt=Symbol.for("react.lazy"),yi=Symbol.for("react.offscreen"),jr;jr=Symbol.for("react.module.reference");function fe(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Jt:switch(e=e.type,e){case Ft:case Rt:case yt:case It:case Pt:return e;default:switch(e=e&&e.$$typeof,e){case Fi:case Ct:case Tt:case Nt:case Mt:case Ot:return e;default:return t}}case er:return t}}}$.ContextConsumer=Ct;$.ContextProvider=Ot;$.Element=Jt;$.ForwardRef=Tt;$.Fragment=Ft;$.Lazy=Nt;$.Memo=Mt;$.Portal=er;$.Profiler=Rt;$.StrictMode=yt;$.Suspense=It;$.SuspenseList=Pt;$.isAsyncMode=function(){return!1};$.isConcurrentMode=function(){return!1};$.isContextConsumer=function(e){return fe(e)===Ct};$.isContextProvider=function(e){return fe(e)===Ot};$.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Jt};$.isForwardRef=function(e){return fe(e)===Tt};$.isFragment=function(e){return fe(e)===Ft};$.isLazy=function(e){return fe(e)===Nt};$.isMemo=function(e){return fe(e)===Mt};$.isPortal=function(e){return fe(e)===er};$.isProfiler=function(e){return fe(e)===Rt};$.isStrictMode=function(e){return fe(e)===yt};$.isSuspense=function(e){return fe(e)===It};$.isSuspenseList=function(e){return fe(e)===Pt};$.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Ft||e===Rt||e===yt||e===It||e===Pt||e===yi||typeof e=="object"&&e!==null&&(e.$$typeof===Nt||e.$$typeof===Mt||e.$$typeof===Ot||e.$$typeof===Ct||e.$$typeof===Tt||e.$$typeof===jr||e.getModuleId!==void 0)};$.typeOf=fe;Br.exports=$;var qe=Br.exports;function Vt(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(Vt(n)):qe.isFragment(n)&&n.props?r=r.concat(Vt(n.props.children,t)):r.push(n))}),r}function Er(e){return e instanceof HTMLElement||e instanceof SVGElement}function Ri(e){return e&&ce(e)==="object"&&Er(e.nativeElement)?e.nativeElement:Er(e)?e:null}function dt(e){var t=Ri(e);if(t)return t;if(e instanceof h.Component){var r;return(r=mt.findDOMNode)===null||r===void 0?void 0:r.call(mt,e)}return null}function Oi(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 Ci=function(t,r){typeof t=="function"?t(r):ce(t)==="object"&&t&&"current"in t&&(t.current=r)},Ti=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){Ci(i,a)})}},Ii=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Oi(function(){return Ti.apply(void 0,r)},r,function(o,a){return o.length!==a.length||o.every(function(i,s){return i!==a[s]})})},Pi=function(t){var r,n,o=qe.isMemo(t)?t.type.type:t.type;return!(typeof o=="function"&&!((r=o.prototype)!==null&&r!==void 0&&r.render)&&o.$$typeof!==qe.ForwardRef||typeof t=="function"&&!((n=t.prototype)!==null&&n!==void 0&&n.render)&&t.$$typeof!==qe.ForwardRef)};function br(e){return h.isValidElement(e)&&!qe.isFragment(e)}Number(h.version.split(".")[0])>=19;var kt=p.createContext(null);function Mi(e){var t=e.children,r=e.onBatchResize,n=p.useRef(0),o=p.useRef([]),a=p.useContext(kt),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(kt.Provider,{value:i},t)}var Wr=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}()}(),zt=typeof window<"u"&&typeof document<"u"&&window.document===document,St=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")()}(),Ni=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(St):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),wi=2;function Ai(e,t){var r=!1,n=!1,o=0;function a(){r&&(r=!1,e()),n&&s()}function i(){Ni(a)}function s(){var l=Date.now();if(r){if(l-o<wi)return;n=!0}else r=!0,n=!1,setTimeout(i,t);o=l}return s}var Li=20,$i=["top","right","bottom","left","width","height","size","weight"],Ui=typeof MutationObserver<"u",Di=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Ai(this.refresh.bind(this),Li)}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(){!zt||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Ui?(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(){!zt||!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=$i.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},xe=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||St},kr=wt(0,0,0,0);function Et(e){return parseFloat(e)||0}function Fr(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 Hi(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 xi(e){var t=e.getBBox();return wt(0,0,t.width,t.height)}function Bi(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return kr;var n=xe(e).getComputedStyle(e),o=Hi(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-=Fr(n,"left","right")+a),Math.round(l+i)!==r&&(l-=Fr(n,"top","bottom")+i)),!Wi(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 wt(o.left,o.top,s,l)}var ji=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof xe(e).SVGGraphicsElement}:function(e){return e instanceof xe(e).SVGElement&&typeof e.getBBox=="function"}}();function Wi(e){return e===xe(e).document.documentElement}function Vi(e){return zt?ji(e)?xi(e):Bi(e):kr}function ki(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 wt(e,t,r,n){return{x:e,y:t,width:r,height:n}}var zi=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=wt(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Vi(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}(),Qi=function(){function e(t,r){var n=ki(r);Vr(this,{target:t,contentRect:n})}return e}(),Gi=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new Wr,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 xe(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new zi(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 xe(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 Qi(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}(),zr=typeof WeakMap<"u"?new WeakMap:new Wr,Qr=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=Di.getInstance(),n=new Gi(t,r,this);zr.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Qr.prototype[e]=function(){var t;return(t=zr.get(this))[e].apply(t,arguments)}});var Yi=function(){return typeof St.ResizeObserver<"u"?St.ResizeObserver:Qr}(),ye=new Map;function qi(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 Gr=new Yi(qi);function Xi(e,t){ye.has(e)||(ye.set(e,new Set),Gr.observe(e)),ye.get(e).add(t)}function Ki(e,t){ye.has(e)&&(ye.get(e).delete(t),ye.get(e).size||(Gr.unobserve(e),ye.delete(e)))}function Yr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zi(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,Hr(n.key),n)}}function qr(e,t,r){return t&&Zi(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qt(e,t){return Qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Qt(e,t)}function Ji(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&&Qt(e,t)}function bt(e){return bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bt(e)}function Xr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xr=function(){return!!e})()}function eo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function to(e,t){if(t&&(ce(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eo(e)}function ro(e){var t=Xr();return function(){var r,n=bt(e);if(t){var o=bt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return to(this,r)}}var no=function(e){Ji(r,e);var t=ro(r);function r(){return Yr(this,r),t.apply(this,arguments)}return qr(r,[{key:"render",value:function(){return this.props.children}}]),r}(p.Component);function io(e,t){var r=e.children,n=e.disabled,o=p.useRef(null),a=p.useRef(null),i=p.useContext(kt),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)&&Pi(l),m=c?l.ref:null,g=Ii(m,o),d=function(){var y;return dt(o.current)||(o.current&&ce(o.current)==="object"?dt((y=o.current)===null||y===void 0?void 0:y.nativeElement):null)||dt(a.current)};p.useImperativeHandle(t,function(){return d()});var E=p.useRef(e);E.current=e;var _=p.useCallback(function(S){var y=E.current,b=y.onResize,I=y.data,T=S.getBoundingClientRect(),W=T.width,U=T.height,C=S.offsetWidth,D=S.offsetHeight,x=Math.floor(W),V=Math.floor(U);if(u.current.width!==x||u.current.height!==V||u.current.offsetWidth!==C||u.current.offsetHeight!==D){var Z={width:x,height:V,offsetWidth:C,offsetHeight:D};u.current=Z;var Y=C===Math.round(W)?W:C,ie=D===Math.round(U)?U:D,q=K(K({},Z),{},{offsetWidth:Y,offsetHeight:ie});i==null||i(q,S,I),b&&Promise.resolve().then(function(){b(q,S)})}},[]);return p.useEffect(function(){var S=d();return S&&!n&&Xi(S,_),function(){return Ki(S,_)}},[o.current,n]),p.createElement(no,{ref:a},c?p.cloneElement(l,{ref:g}):l)}var oo=p.forwardRef(io),so="rc-observer-key";function ao(e,t){var r=e.children,n=typeof r=="function"?[r]:Vt(r);return n.map(function(o,a){var i=(o==null?void 0:o.key)||"".concat(so,"-").concat(a);return p.createElement(oo,et({},e,{key:i,ref:a===0?t:void 0}),o)})}var tr=p.forwardRef(ao);tr.Collection=Mi;function yr(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 lo(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Rr=lo()?p.useLayoutEffect:p.useEffect,Xe=function(t,r){var n=p.useRef(!0);Rr(function(){return t(n.current)},r),Rr(function(){return n.current=!1,function(){n.current=!0}},[])},Kr=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,m={},g={display:"flex",flexDirection:"column"};return n!==void 0&&(m={height:r,position:"relative",overflow:"hidden"},g=K(K({},g),{},te(te(te(te(te({transform:"translateY(".concat(n,"px)")},u?"marginRight":"marginLeft",-o),"position","absolute"),"left",0),"right",0),"top",0))),p.createElement("div",{style:m},p.createElement(tr,{onResize:function(E){var _=E.offsetHeight;_&&s&&s()}},p.createElement("div",et({style:g,className:_t(te({},"".concat(i,"-holder-inner"),i)),ref:t},l),a,c)))});Kr.displayName="Filler";function uo(e){var t=e.children,r=e.setRef,n=p.useCallback(function(o){r(o)},[]);return p.cloneElement(t,{ref:n})}function co(e,t,r,n,o,a,i,s){var l=s.getKey;return e.slice(t,r+1).map(function(u,c){var m=t+c,g=i(u,m,{style:{width:n},offsetX:o}),d=l(u);return p.createElement(uo,{key:d,setRef:function(_){return a(u,_)}},g)})}function fo(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,m=0;m<i.length;m+=1){var g=l(a[m]),d=l(i[m]);if(g!==d){u=m,c=c||g!==l(i[m+1]);break}}return u===null?null:{index:u,multiple:c}}function ho(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 m=fo(a||[],e||[],t);(m==null?void 0:m.index)!==void 0&&c(e[m.index]),i(e)},[e]),[u]}var Zr=function(t){return+setTimeout(t,16)},Jr=function(t){return clearTimeout(t)};typeof window<"u"&&"requestAnimationFrame"in window&&(Zr=function(t){return window.requestAnimationFrame(t)},Jr=function(t){return window.cancelAnimationFrame(t)});var Or=0,rr=new Map;function en(e){rr.delete(e)}var me=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;Or+=1;var n=Or;function o(a){if(a===0)en(n),t();else{var i=Zr(function(){o(a-1)});rr.set(n,i)}}return o(r),n};me.cancel=function(e){var t=rr.get(e);return en(e),Jr(t)};var Cr=(typeof navigator>"u"?"undefined":ce(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const tn=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,m=l?u<0&&s.current.left||u>0&&s.current.right:u<0&&s.current.top||u>0&&s.current.bottom;return c&&m?(clearTimeout(a.current),o.current=!1):(!m||o.current)&&i(),!o.current&&m}};function mo(e,t,r,n,o,a,i){var s=h.useRef(0),l=h.useRef(null),u=h.useRef(null),c=h.useRef(!1),m=tn(t,r,n,o);function g(b,I){me.cancel(l.current),s.current+=I,u.current=I,!m(!1,I)&&(Cr||b.preventDefault(),l.current=me(function(){var T=c.current?10:1;i(s.current*T),s.current=0}))}function d(b,I){i(I,!0),Cr||b.preventDefault()}var E=h.useRef(null),_=h.useRef(null);function S(b){if(e){me.cancel(_.current),_.current=me(function(){E.current=null},2);var I=b.deltaX,T=b.deltaY,W=b.shiftKey,U=I,C=T;(E.current==="sx"||!E.current&&W&&T&&!I)&&(U=T,C=0,E.current="sx");var D=Math.abs(U),x=Math.abs(C);E.current===null&&(E.current=a&&D>x?"x":"y"),E.current==="y"?g(b,C):d(b,U)}}function y(b){e&&(c.current=b.detail===u.current)}return[S,y]}function po(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 m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,g=i.get(c),d=i.get(m);if(g===void 0||d===void 0)for(var E=e.length,_=s.length;_<E;_+=1){var S,y=e[_],b=t(y);i.set(b,_);var I=(S=r.get(b))!==null&&S!==void 0?S:n;if(s[_]=(s[_-1]||0)+I,b===c&&(g=_),b===m&&(d=_),g!==void 0&&d!==void 0)break}return{top:s[g-1]||0,bottom:s[d]}};return l}var vo=function(){function e(){Yr(this,e),te(this,"maps",void 0),te(this,"id",0),this.maps=Object.create(null)}return qr(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 go(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 vo),u=h.useRef();function c(){me.cancel(u.current)}function m(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;c();var E=function(){s.current.forEach(function(S,y){if(S&&S.offsetParent){var b=dt(S),I=b.offsetHeight;l.current.get(y)!==I&&l.current.set(y,b.offsetHeight)}}),i(function(S){return S+1})};d?E():u.current=me(E)}function g(d,E){var _=e(d);s.current.get(_),E?(s.current.set(_,E),m()):s.current.delete(_)}return h.useEffect(function(){return c},[]),[g,m,l.current,a]}var Tr=14/15;function _o(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),_=Math.ceil(d.touches[0].pageY),S=o.current-E,y=a.current-_,b=Math.abs(S)>Math.abs(y);b?o.current=E:a.current=_,r(b,b?S:y)&&d.preventDefault(),clearInterval(s.current),s.current=setInterval(function(){b?S*=Tr:y*=Tr;var I=Math.floor(b?S:y);(!r(b,I,!0)||Math.abs(I)<=.1)&&clearInterval(s.current)},16)}},c=function(){n.current=!1,l()},m=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))},Xe(function(){return e&&t.current.addEventListener("touchstart",m,{passive:!0}),function(){var g;(g=t.current)===null||g===void 0||g.removeEventListener("touchstart",m),l(),clearInterval(s.current)}},[e])}var So=10;function Eo(e,t,r,n,o,a,i,s){var l=p.useRef(),u=p.useState(null),c=X(u,2),m=c[0],g=c[1];return Xe(function(){if(m&&m.times<So){if(!e.current){g(function(J){return K({},J)});return}a();var d=m.targetAlign,E=m.originAlign,_=m.index,S=m.offset,y=e.current.clientHeight,b=!1,I=d,T=null;if(y){for(var W=d||E,U=0,C=0,D=0,x=Math.min(t.length-1,_),V=0;V<=x;V+=1){var Z=o(t[V]);C=U;var Y=r.get(Z);D=C+(Y===void 0?n:Y),U=D}for(var ie=W==="top"?S:y-S,q=x;q>=0;q-=1){var Ie=o(t[q]),re=r.get(Ie);if(re===void 0){b=!0;break}if(ie-=re,ie<=0)break}switch(W){case"top":T=C-S;break;case"bottom":T=D-y+S;break;default:{var Ee=e.current.scrollTop,he=Ee+y;C<Ee?I="top":D>he&&(I="bottom")}}T!==null&&i(T),T!==m.lastTop&&(b=!0)}b&&g(K(K({},m),{},{times:m.times+1,targetAlign:I,lastTop:T}))}},[m,e.current]),function(d){if(d==null){s();return}if(me.cancel(l.current),typeof d=="number")i(d);else if(d&&ce(d)==="object"){var E,_=d.align;"index"in d?E=d.index:E=t.findIndex(function(b){return o(b)===d.key});var S=d.offset,y=S===void 0?0:S;g({times:0,index:E,offset:y,originAlign:_})}}}function Ir(e,t){var r="touches"in e?e.touches[0]:e;return r[t?"pageX":"pageY"]}var Pr=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,m=e.containerSize,g=e.style,d=e.thumbStyle,E=p.useState(!1),_=X(E,2),S=_[0],y=_[1],b=p.useState(null),I=X(b,2),T=I[0],W=I[1],U=p.useState(null),C=X(U,2),D=C[0],x=C[1],V=!n,Z=p.useRef(),Y=p.useRef(),ie=p.useState(!1),q=X(ie,2),Ie=q[0],re=q[1],Ee=p.useRef(),he=function(){clearTimeout(Ee.current),re(!0),Ee.current=setTimeout(function(){re(!1)},3e3)},J=a-m||0,Be=m-c||0,B=p.useMemo(function(){if(o===0||J===0)return 0;var ne=o/J;return ne*Be},[o,J,Be]),Oe=function(H){H.stopPropagation(),H.preventDefault()},Pe=p.useRef({top:B,dragging:S,pageY:T,startTop:D});Pe.current={top:B,dragging:S,pageY:T,startTop:D};var Me=function(H){y(!0),W(Ir(H,u)),x(Pe.current.top),i(),H.stopPropagation(),H.preventDefault()};p.useEffect(function(){var ne=function(Ne){Ne.preventDefault()},H=Z.current,se=Y.current;return H.addEventListener("touchstart",ne,{passive:!1}),se.addEventListener("touchstart",Me,{passive:!1}),function(){H.removeEventListener("touchstart",ne),se.removeEventListener("touchstart",Me)}},[]);var rt=p.useRef();rt.current=J;var je=p.useRef();je.current=Be,p.useEffect(function(){if(S){var ne,H=function(Ne){var We=Pe.current,it=We.dragging,ot=We.pageY,st=We.startTop;me.cancel(ne);var at=Z.current.getBoundingClientRect(),we=m/(u?at.width:at.height);if(it){var Ve=(Ir(Ne,u)-ot)*we,ke=st;!V&&u?ke-=Ve:ke+=Ve;var lt=rt.current,ut=je.current,At=ut?ke/ut:0,ve=Math.ceil(At*lt);ve=Math.max(ve,0),ve=Math.min(ve,lt),ne=me(function(){l(ve,u)})}},se=function(){y(!1),s()};return window.addEventListener("mousemove",H,{passive:!0}),window.addEventListener("touchmove",H,{passive:!0}),window.addEventListener("mouseup",se,{passive:!0}),window.addEventListener("touchend",se,{passive:!0}),function(){window.removeEventListener("mousemove",H),window.removeEventListener("touchmove",H),window.removeEventListener("mouseup",se),window.removeEventListener("touchend",se),me.cancel(ne)}}},[S]),p.useEffect(function(){return he(),function(){clearTimeout(Ee.current)}},[o]),p.useImperativeHandle(t,function(){return{delayHidden:he}});var ee="".concat(r,"-scrollbar"),oe={position:"absolute",visibility:Ie?null:"hidden"},pe={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(oe.height=8,oe.left=0,oe.right=0,oe.bottom=0,pe.height="100%",pe.width=c,V?pe.left=B:pe.right=B):(oe.width=8,oe.top=0,oe.bottom=0,V?oe.right=0:oe.left=0,pe.width="100%",pe.height=c,pe.top=B),p.createElement("div",{ref:Z,className:_t(ee,te(te(te({},"".concat(ee,"-horizontal"),u),"".concat(ee,"-vertical"),!u),"".concat(ee,"-visible"),Ie)),style:K(K({},oe),g),onMouseDown:Oe,onMouseMove:he},p.createElement("div",{ref:Y,className:_t("".concat(ee,"-thumb"),te({},"".concat(ee,"-thumb-moving"),S)),style:K(K({},pe),d),onMouseDown:Me}))}),bo=20;function Mr(){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,bo),Math.floor(r)}var Fo=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles"],yo=[],Ro={overflowY:"auto",overflowAnchor:"none"};function Oo(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,m=e.children,g=e.itemKey,d=e.virtual,E=e.direction,_=e.scrollWidth,S=e.component,y=S===void 0?"div":S,b=e.onScroll,I=e.onVirtualScroll,T=e.onVisibleChange,W=e.innerProps,U=e.extraRender,C=e.styles,D=Si(e,Fo),x=p.useCallback(function(R){return typeof g=="function"?g(R):R==null?void 0:R[g]},[g]),V=go(x),Z=X(V,4),Y=Z[0],ie=Z[1],q=Z[2],Ie=Z[3],re=!!(d!==!1&&a&&i),Ee=p.useMemo(function(){return Object.values(q.maps).reduce(function(R,F){return R+F},0)},[q.id,q.maps]),he=re&&c&&(Math.max(i*c.length,Ee)>a||!!_),J=E==="rtl",Be=_t(n,te({},"".concat(n,"-rtl"),J),o),B=c||yo,Oe=h.useRef(),Pe=h.useRef(),Me=h.useRef(),rt=h.useState(0),je=X(rt,2),ee=je[0],oe=je[1],pe=h.useState(0),ne=X(pe,2),H=ne[0],se=ne[1],nt=h.useState(!1),Ne=X(nt,2),We=Ne[0],it=Ne[1],ot=function(){it(!0)},st=function(){it(!1)},at={getKey:x};function we(R){oe(function(F){var w;typeof R=="function"?w=R(F):w=R;var k=mn(w);return Oe.current.scrollTop=k,k})}var Ve=h.useRef({start:0,end:B.length}),ke=h.useRef(),lt=ho(B,x),ut=X(lt,1),At=ut[0];ke.current=At;var ve=p.useMemo(function(){if(!re)return{scrollHeight:void 0,start:0,end:B.length-1,offset:void 0};if(!he){var R;return{scrollHeight:((R=Pe.current)===null||R===void 0?void 0:R.offsetHeight)||0,start:0,end:B.length-1,offset:void 0}}for(var F=0,w,k,be,Fn=B.length,Ye=0;Ye<Fn;Ye+=1){var yn=B[Ye],Rn=x(yn),gr=q.get(Rn),Bt=F+(gr===void 0?i:gr);Bt>=ee&&w===void 0&&(w=Ye,k=F),Bt>ee+a&&be===void 0&&(be=Ye),F=Bt}return w===void 0&&(w=0,k=0,be=Math.ceil(a/i)),be===void 0&&(be=B.length-1),be=Math.min(be+1,B.length-1),{scrollHeight:F,start:w,end:be,offset:k}},[he,re,ee,B,Ie,a]),Ae=ve.scrollHeight,ze=ve.start,Qe=ve.end,nr=ve.offset;Ve.current.start=ze,Ve.current.end=Qe;var un=p.useState({width:0,height:a}),ir=X(un,2),ge=ir[0],cn=ir[1],fn=function(F){cn({width:F.offsetWidth,height:F.offsetHeight})},or=h.useRef(),sr=h.useRef(),hn=p.useMemo(function(){return Mr(ge.width,_)},[ge.width,_]),dn=p.useMemo(function(){return Mr(ge.height,Ae)},[ge.height,Ae]),Lt=Ae-a,$t=h.useRef(Lt);$t.current=Lt;function mn(R){var F=R;return Number.isNaN($t.current)||(F=Math.min(F,$t.current)),F=Math.max(F,0),F}var ar=ee<=0,lr=ee>=Lt,ur=H<=0,cr=H>=_,pn=tn(ar,lr,ur,cr),Ut=function(){return{x:J?-H:H,y:ee}},Dt=h.useRef(Ut()),ct=yr(function(R){if(I){var F=K(K({},Ut()),R);(Dt.current.x!==F.x||Dt.current.y!==F.y)&&(I(F),Dt.current=F)}});function fr(R,F){var w=R;F?(mt.flushSync(function(){se(w)}),ct()):we(w)}function vn(R){var F=R.currentTarget.scrollTop;F!==ee&&we(F),b==null||b(R),ct()}var Ht=function(F){var w=F,k=_?_-ge.width:0;return w=Math.max(w,0),w=Math.min(w,k),w},gn=yr(function(R,F){F?(mt.flushSync(function(){se(function(w){var k=w+(J?-R:R);return Ht(k)})}),ct()):we(function(w){var k=w+R;return k})}),_n=mo(re,ar,lr,ur,cr,!!_,gn),hr=X(_n,2),xt=hr[0],dr=hr[1];_o(re,Oe,function(R,F,w){return pn(R,F,w)?!1:(xt({preventDefault:function(){},deltaX:R?F:0,deltaY:R?0:F}),!0)}),Xe(function(){function R(w){re&&w.preventDefault()}var F=Oe.current;return F.addEventListener("wheel",xt,{passive:!1}),F.addEventListener("DOMMouseScroll",dr,{passive:!0}),F.addEventListener("MozMousePixelScroll",R,{passive:!1}),function(){F.removeEventListener("wheel",xt),F.removeEventListener("DOMMouseScroll",dr),F.removeEventListener("MozMousePixelScroll",R)}},[re]),Xe(function(){if(_){var R=Ht(H);se(R),ct({x:R})}},[ge.width,_]);var mr=function(){var F,w;(F=or.current)===null||F===void 0||F.delayHidden(),(w=sr.current)===null||w===void 0||w.delayHidden()},pr=Eo(Oe,B,q,i,x,function(){return ie(!0)},we,mr);p.useImperativeHandle(t,function(){return{nativeElement:Me.current,getScrollInfo:Ut,scrollTo:function(F){function w(k){return k&&ce(k)==="object"&&("left"in k||"top"in k)}w(F)?(F.left!==void 0&&se(Ht(F.left)),pr(F.top)):pr(F)}}}),Xe(function(){if(T){var R=B.slice(ze,Qe+1);T(R,B)}},[ze,Qe,B]);var Sn=po(B,x,q,i),En=U==null?void 0:U({start:ze,end:Qe,virtual:he,offsetX:H,offsetY:nr,rtl:J,getSize:Sn}),bn=co(B,ze,Qe,_,H,Y,m,at),Ge=null;a&&(Ge=K(te({},l?"height":"maxHeight",a),Ro),re&&(Ge.overflowY="hidden",_&&(Ge.overflowX="hidden"),We&&(Ge.pointerEvents="none")));var vr={};return J&&(vr.dir="rtl"),p.createElement("div",et({ref:Me,style:K(K({},u),{},{position:"relative"}),className:Be},vr,D),p.createElement(tr,{onResize:fn},p.createElement(y,{className:"".concat(n,"-holder"),style:Ge,ref:Oe,onScroll:vn,onMouseEnter:mr},p.createElement(Kr,{prefixCls:n,height:Ae,offsetX:H,offsetY:nr,scrollWidth:_,onInnerResize:ie,ref:Pe,innerProps:W,rtl:J,extra:En},bn))),he&&Ae>a&&p.createElement(Pr,{ref:or,prefixCls:n,scrollOffset:ee,scrollRange:Ae,rtl:J,onScroll:fr,onStartMove:ot,onStopMove:st,spinSize:dn,containerSize:ge.height,style:C==null?void 0:C.verticalScrollBar,thumbStyle:C==null?void 0:C.verticalScrollBarThumb}),he&&_>ge.width&&p.createElement(Pr,{ref:sr,prefixCls:n,scrollOffset:H,scrollRange:_,rtl:J,onScroll:fr,onStartMove:ot,onStopMove:st,spinSize:hn,containerSize:ge.width,horizontal:!0,style:C==null?void 0:C.horizontalScrollBar,thumbStyle:C==null?void 0:C.horizontalScrollBarThumb}))}var rn=p.forwardRef(Oo);rn.displayName="List";function Co(e){const{model:t}=e,r=Le.useDependency(v.LocaleService),n=L.useObservable(t.searchString$,"",!0),o=L.useObservable(t.filterItems$,void 0,!0),a=r.t("sheets-filter.panel.filter-only"),i=Wt(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]),m=h.useCallback(()=>{t.onCheckAllToggled(!s)},[t,s]),g=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:g}),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:m}),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(rn,{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 To(){var S;const e=Le.useDependency(Re),t=Le.useDependency(v.LocaleService),r=Le.useDependency(v.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$)||M.of(!1),void 0,!1,[o]),i=Io(t),s=!L.useObservable(e.hasCriteria$),l=h.useCallback(y=>{r.executeCommand(Zt.id,{filterBy:y})},[r]),u=h.useCallback(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(Ue.id)},[o,r]),c=h.useCallback(()=>{r.executeCommand(Ue.id)},[r]),m=h.useCallback(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(Ue.id)},[o,r]),d=(S=Le.useDependency(f.SheetsFilterService).activeFilterModel)==null?void 0:S.getRange(),E=e.col,_=L.useComponentsOfPart(ue.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return h.createElement("div",{className:j.sheetsFilterPanel},h.createElement(L.ComponentContainer,{components:_,sharedProps:{range:d,colIndex:E,onClose:c}}),h.createElement("div",{className:j.sheetsFilterPanelHeader},h.createElement(G.Segmented,{value:n,options:i,onChange:y=>l(y)})),o?h.createElement("div",{className:j.sheetsFilterPanelContent},n===pt.VALUES?h.createElement(Co,{model:o}):h.createElement(ci,{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:m},t.t("sheets-filter.panel.confirm")))))}function Io(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{label:e.t("sheets-filter.panel.by-values"),value:pt.VALUES},{label:e.t("sheets-filter.panel.by-conditions"),value:pt.CONDITIONS}],[t,e])}const Po={id:Te.id,binding:L.KeyCode.L|L.MetaKeys.CTRL_COMMAND|L.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:ue.whenSheetEditorFocused,group:"4_sheet-edit"};function Mo(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,v.UniverInstanceType.UNIVER_SHEET),activated$:t.activeFilterModel$.pipe(M.map(r=>!!r)),disabled$:ue.getCurrentRangeDisable$(e,{workbookTypes:[Q.WorkbookEditablePermission],worksheetTypes:[Q.WorksheetFilterPermission,Q.WorksheetEditPermission],rangeTypes:[Q.RangeProtectionPermissionEditPoint]})}}function No(e){const t=e.get(f.SheetsFilterService);return{id:qt.id,group:L.MenuGroup.TOOLBAR_OTHERS,type:L.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",positions:[Te.id],hidden$:L.getMenuHiddenObservable(e,v.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(M.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(M.map(o=>!o)))!=null?n:M.of(!0)}))}}function wo(e){const t=e.get(f.SheetsFilterService);return{id:Xt.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,v.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(M.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(M.map(o=>!o)))!=null?n:M.of(!0)}))}}const Fe=16,Ao=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 Nr{static drawNoCriteria(t,r,n,o){t.save(),De.Rect.drawWith(t,{radius:2,width:Fe,height:Fe,fill:o}),t.lineCap="square",t.strokeStyle=n,t.scale(r/Fe,r/Fe),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(),De.Rect.drawWith(t,{radius:2,width:Fe,height:Fe,fill:o}),t.scale(r/Fe,r/Fe),t.fillStyle=n,t.fill(Ao),t.restore()}}var Lo=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,Uo=(e,t,r,n)=>{for(var o=n>1?void 0:n?$o(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&&Lo(t,r,o),o},jt=(e,t)=>(r,n)=>t(r,n,e);const Se=16,ft=1;let Gt=class extends De.Shape{constructor(t,r,n,o,a){super(t,r);N(this,"_cellWidth",0);N(this,"_cellHeight",0);N(this,"_filterParams");N(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?Nr.drawHasCriteria(t,Se,l,u):Nr.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(He)||!this._commandService.hasCommand(Je.id)||setTimeout(()=>{this._commandService.executeCommand(Je.id,{unitId:n,subUnitId:o,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Gt=Uo([jt(2,v.IContextService),jt(3,v.ICommandService),jt(4,A.Inject(v.ThemeService))],Gt);var Do=Object.defineProperty,Ho=Object.getOwnPropertyDescriptor,xo=(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&&Do(t,r,o),o},_e=(e,t)=>(r,n)=>t(r,n,e);const Bo=1e3,jo=5e3;let Yt=class extends v.RxDisposable{constructor(t,r,n,o,a,i,s,l,u,c){super();N(this,"_filterRangeShape",null);N(this,"_buttonRenderDisposable",null);N(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(m=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(m.id))),this._initRenderer()}_initRenderer(){M.combineLatest([this._selectionRenderService.usable$,this._sheetSkeletonManagerService.currentSkeleton$]).pipe(M.filter(([t])=>t),M.switchMap(([t,r])=>{var l,u;if(!r)return M.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 v.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(M.filter(([c])=>c.type===v.CommandType.MUTATION&&c.params.unitId===n.getUnitId()&&f.FILTER_MUTATIONS.has(c.id)),M.throttleTime(20,void 0,{leading:!1,trailing:!0}),M.map(s),M.startWith(s()))}),M.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 ue.SelectionShape(a,Bo,!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:m}=r;for(let g=u;g<=c;g++){const d=`sheets-filter-button-${g}`,E=ue.getCoordByCell(m,g,l,a),{startX:_,startY:S,endX:y,endY:b}=E,I=y-_,T=b-S;if(T<=ft||I<=ft)continue;const W=!!n.getFilterColumn(g),U=y-Se-ft,C=b-Se-ft,D={left:U,top:C,height:Se,width:Se,zIndex:jo,cellHeight:T,cellWidth:I,filterParams:{unitId:o,subUnitId:i,col:g,hasCriteria:W}},x=this._injector.createInstance(Gt,d,D);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(Q.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=[]}};Yt=xo([_e(1,A.Inject(A.Injector)),_e(2,A.Inject(ue.SheetSkeletonManagerService)),_e(3,A.Inject(f.SheetsFilterService)),_e(4,A.Inject(v.ThemeService)),_e(5,A.Inject(Q.SheetInterceptorService)),_e(6,A.Inject(ue.SheetsRenderService)),_e(7,v.ICommandService),_e(8,De.IRenderManagerService),_e(9,ue.ISelectionRenderService)],Yt);var Wo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,ko=(e,t,r,n)=>{for(var o=n>1?void 0:n?Vo(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&&Wo(t,r,o),o},zo=(e,t)=>(r,n)=>t(r,n,e);let tt=class extends v.RxDisposable{constructor(e){super(),this._renderManagerService=e,this._initRenderControllers()}_initRenderControllers(){this.disposeWithMe(this._renderManagerService.registerRenderModule(v.UniverInstanceType.UNIVER_SHEET,Yt))}};tt=ko([zo(0,De.IRenderManagerService)],tt);v.runOnLifecycle(v.LifecycleStages.Rendered,tt);var Qo=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,Yo=(e,t,r,n)=>{for(var o=n>1?void 0:n?Go(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&&Qo(t,r,o),o},ae=(e,t)=>(r,n)=>t(r,n,e);const nn={},wr="FILTER_PANEL_POPUP";let Ke=class extends tt{constructor(t,r,n,o,a,i,s,l,u,c,m,g,d){super(d);N(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=m,this._messageService=g,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Po].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_initCommands(){[Te,Ce,qt,Xt,Zt,Je,Ue].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initMenuItems(){const{menu:t={}}=this._config;[Mo,No,wo].forEach(r=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r),t))})}_initUI(){this.disposeWithMe(this._componentManager.register(wr,To)),this.disposeWithMe(this._componentManager.register("FilterSingle",Ur)),this.disposeWithMe(this._contextService.subscribeContextValue$(He).pipe(M.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:wr,direction:"horizontal",closeOnSelfTarget:!0,onClickOutside:()=>this._commandService.syncExecuteCommand(Ue.id),offset:[5,0]})}_closeFilterPopup(){var t;(t=this._popupDisposable)==null||t.dispose(),this._popupDisposable=null}};Ke=Yo([v.OnLifecycle(v.LifecycleStages.Ready,Ke),ae(1,A.Inject(A.Injector)),ae(2,A.Inject(L.ComponentManager)),ae(3,A.Inject(Re)),ae(4,A.Inject(ue.SheetCanvasPopManagerService)),ae(5,A.Inject(f.SheetsFilterService)),ae(6,A.Inject(v.LocaleService)),ae(7,L.IShortcutService),ae(8,v.ICommandService),ae(9,L.IMenuService),ae(10,v.IContextService),ae(11,L.IMessageService),ae(12,De.IRenderManagerService)],Ke);var qo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Ko=(e,t,r,n)=>{for(var o=n>1?void 0:n?Xo(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&&qo(t,r,o),o},ht=(e,t)=>(r,n)=>t(r,n,e);let Ze=class extends v.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:[Q.WorkbookEditablePermission],rangeTypes:[Q.RangeProtectionPermissionViewPoint],worksheetTypes:[Q.WorksheetFilterPermission,Q.WorksheetEditPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr"))),e.id===Je.id){const r=e.params,{unitId:n,subUnitId:o}=r,a=(t=this._sheetsFilterService.getFilterModel(n,o))==null?void 0:t.getRange(),i=v.Tools.deepClone(a);i&&(i.startColumn=r.col,i.endColumn=r.col,this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[Q.WorkbookEditablePermission],rangeTypes:[Q.RangeProtectionPermissionViewPoint],worksheetTypes:[Q.WorksheetFilterPermission,Q.WorksheetEditPermission]},[i])||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr")))}}))}};Ze=Ko([v.OnLifecycle(v.LifecycleStages.Ready,Ze),ht(0,A.Inject(f.SheetsFilterService)),ht(1,A.Inject(v.LocaleService)),ht(2,v.ICommandService),ht(3,A.Inject(ue.SheetPermissionInterceptorBaseController))],Ze);var on=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,Jo=(e,t,r)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,es=(e,t,r,n)=>{for(var o=n>1?void 0:n?Zo(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&&on(t,r,o),o},Ar=(e,t)=>(r,n)=>t(r,n,e),sn=(e,t,r)=>Jo(e,typeof t!="symbol"?t+"":t,r);const ts="SHEET_FILTER_UI_PLUGIN";exports.UniverSheetsFilterUIPlugin=class extends v.Plugin{constructor(t={},r,n){super(),this._config=t,this._injector=r,this._localeService=n,this._config=v.Tools.deepMerge({},nn,this._config)}onStarting(t){[[Re],[Ze],[Ke,{useFactory:()=>this._injector.createInstance(Ke,this._config)}]].forEach(r=>t.add(r))}};sn(exports.UniverSheetsFilterUIPlugin,"type",v.UniverInstanceType.UNIVER_SHEET);sn(exports.UniverSheetsFilterUIPlugin,"pluginName",ts);exports.UniverSheetsFilterUIPlugin=es([v.DependentOn(f.UniverSheetsFilterPlugin),Ar(1,A.Inject(A.Injector)),Ar(2,A.Inject(v.LocaleService))],exports.UniverSheetsFilterUIPlugin);var an=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,ns=(e,t,r)=>t in e?an(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,is=(e,t,r,n)=>{for(var o=n>1?void 0:n?rs(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&&an(t,r,o),o},os=(e,t)=>(r,n)=>t(r,n,e),ln=(e,t,r)=>ns(e,typeof t!="symbol"?t+"":t,r);const ss="SHEET_FILTER_UI_PLUGIN";exports.UniverSheetsFilterMobileUIPlugin=class extends v.Plugin{constructor(t={},r){super(),this._config=t,this._injector=r,this._config=v.Tools.deepMerge({},nn,this._config)}onStarting(t){[[Ze],[tt]].forEach(r=>t.add(r))}};ln(exports.UniverSheetsFilterMobileUIPlugin,"type",v.UniverInstanceType.UNIVER_SHEET);ln(exports.UniverSheetsFilterMobileUIPlugin,"pluginName",ss);exports.UniverSheetsFilterMobileUIPlugin=is([v.DependentOn(f.UniverSheetsFilterPlugin),os(1,A.Inject(A.Injector))],exports.UniverSheetsFilterMobileUIPlugin);exports.ChangeFilterByOperation=Zt;exports.ClearSheetsFilterCriteriaCommand=qt;exports.CloseFilterPanelOperation=Ue;exports.OpenFilterPanelOperation=Je;exports.ReCalcSheetsFilterCommand=Xt;exports.SetSheetsFilterCriteriaCommand=Ce;exports.SmartToggleSheetsFilterCommand=Te;
|