@univerjs/sheets-filter-ui 0.1.8

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.
Files changed (34) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +34 -0
  3. package/lib/cjs/index.js +14 -0
  4. package/lib/es/index.js +3158 -0
  5. package/lib/index.css +1 -0
  6. package/lib/types/__testing__/data.d.ts +22 -0
  7. package/lib/types/commands/__tests__/sheets-filter.command.spec.d.ts +16 -0
  8. package/lib/types/commands/__tests__/sheets-filter.operation.spec.d.ts +16 -0
  9. package/lib/types/commands/sheets-filter.command.d.ts +25 -0
  10. package/lib/types/commands/sheets-filter.operation.d.ts +18 -0
  11. package/lib/types/controllers/__tests__/sheets-filter.menu.spec.d.ts +16 -0
  12. package/lib/types/controllers/sheets-filter-render.controller.d.ts +28 -0
  13. package/lib/types/controllers/sheets-filter-ui.controller.d.ts +29 -0
  14. package/lib/types/controllers/sheets-filter.menu.d.ts +6 -0
  15. package/lib/types/controllers/sheets-filter.shortcut.d.ts +3 -0
  16. package/lib/types/index.d.ts +18 -0
  17. package/lib/types/locale/en-US.d.ts +66 -0
  18. package/lib/types/locale/index.d.ts +17 -0
  19. package/lib/types/locale/zh-CN.d.ts +4 -0
  20. package/lib/types/models/__tests__/conditions.spec.d.ts +16 -0
  21. package/lib/types/models/conditions.d.ts +75 -0
  22. package/lib/types/models/extended-operators.d.ts +89 -0
  23. package/lib/types/models/utils.d.ts +8 -0
  24. package/lib/types/plugin.d.ts +11 -0
  25. package/lib/types/services/__tests__/sheets-filter-panel.service.spec.d.ts +16 -0
  26. package/lib/types/services/sheets-filter-panel.service.d.ts +186 -0
  27. package/lib/types/views/components/SheetsFilterByConditionsPanel.d.ts +9 -0
  28. package/lib/types/views/components/SheetsFilterByValuesPanel.d.ts +9 -0
  29. package/lib/types/views/components/SheetsFilterPanel.d.ts +8 -0
  30. package/lib/types/views/components/SheetsFilterPanel.stories.d.ts +15 -0
  31. package/lib/types/views/widgets/drawings.d.ts +7 -0
  32. package/lib/types/views/widgets/filter-button.shape.d.ts +33 -0
  33. package/lib/umd/index.js +14 -0
  34. package/package.json +91 -0
package/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @univerjs/sheets-filter-ui
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@univerjs/sheets-filter-ui)](https://npmjs.org/packages/@univerjs/sheets-filter-ui)
4
+ [![license](https://img.shields.io/npm/l/@univerjs/sheets-filter-ui)](https://img.shields.io/npm/l/@univerjs/sheets-filter-ui)
5
+ ![CSS Included](https://img.shields.io/badge/CSS_Included-blue?logo=CSS3)
6
+ ![i18n](https://img.shields.io/badge/zh--CN%20%7C%20en--US-cornflowerblue?label=i18n)
7
+
8
+ ## Introduction
9
+
10
+ `@univerjs/sheets-filter-ui` provides a user interface for filtering in sheets.
11
+
12
+ ## Usage
13
+
14
+ You should use this plugin with the `@univerjs/sheets-filter` package.
15
+
16
+ ```ts
17
+ import '@univerjs/sheets-filter-ui/lib/index.css';
18
+
19
+ import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
20
+ import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
21
+
22
+ univer.registerPlugin(UniverSheetsFilterPlugin);
23
+ univer.registerPlugin(UniverSheetsFilterUIPlugin);
24
+ ```
25
+
26
+ ### Installation
27
+
28
+ ```shell
29
+ # Using npm
30
+ npm install @univerjs/sheets-filter-ui
31
+
32
+ # Using pnpm
33
+ pnpm add @univerjs/sheets-filter-ui
34
+ ```
@@ -0,0 +1,14 @@
1
+ "use strict";var mn=Object.defineProperty;var pn=(e,t,r)=>t in e?mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var I=(e,t,r)=>(pn(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@univerjs/core"),H=require("@wendellhu/redi"),L=require("@univerjs/ui"),P=require("rxjs"),ve=require("@univerjs/sheets-ui"),K=require("@univerjs/design"),qe=require("@univerjs/sheets"),c=require("@univerjs/sheets-filter"),h=require("react"),ze=require("@wendellhu/redi/react-bindings"),Ut=require("react-dom"),lt=require("@univerjs/engine-render");function vn(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 v=vn(h),gn={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"Toggle Filter","clear-filter-criteria":"Clear Filter Conditions","re-calc-filter-conditions":"Re-calc Filter Conditions"},command:{"not-valid-filter-range":"The selected range only has one row and not valid for filter."},shortcut:{"smart-toggle-filter":"Toggle Filter"},panel:{"clear-filter":"Clear Filter",cancel:"Cancel",confirm:"Confirm","by-values":"By Values","by-conditions":"By Conditions","filter-only":"Filter Only","search-placeholder":"Use space to separate keywords","select-all":"Select All","input-values-placeholder":"Input Values",and:"AND",or:"OR",empty:"(empty)","?":"Use “?” to represent a single character.","*":"Use “*” to represent multiple characters."},conditions:{none:"None",empty:"Is Empty","not-empty":"Is Not Empty","text-contains":"Text Contains","does-not-contain":"Text Does Not Contain","starts-with":"Text Starts With","ends-with":"Text Ends With",equals:"Text Equals","greater-than":"Greater Than","greater-than-or-equal":"Greater Than Or Equal To","less-than":"Less Than","less-than-or-equal":"Less Than Or Equal To",equal:"Equal","not-equal":"Not Equal",between:"Between","not-between":"Not Between",custom:"Custom"}}},_n={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"筛选","clear-filter-criteria":"清除筛选条件","re-calc-filter-conditions":"重新计算"},command:{"not-valid-filter-range":"选中的区域只有一行,无法进行筛选"},shortcut:{"smart-toggle-filter":"切换筛选"},panel:{"clear-filter":"清除筛选",cancel:"取消",confirm:"确认","by-values":"按值","by-conditions":"按条件","filter-only":"仅筛选","search-placeholder":"使用空格分隔关键字","select-all":"全选","input-values-placeholder":"请输入",or:"或",and:"和",empty:"(空白)","?":"可用 ? 代表单个字符","*":"可用 * 代表任意多个字符"},conditions:{none:"无",empty:"为空","not-empty":"不为空","text-contains":"文本包含","does-not-contain":"文本不包含","starts-with":"文本开头","ends-with":"文本结尾",equals:"文本相符","greater-than":"大于","greater-than-or-equal":"大于等于","less-than":"小于","less-than-or-equal":"小于等于",equal:"等于","not-equal":"不等于",between:"介于","not-between":"不介于",custom:"自定义"}}},Or=_n;var ie=function(){return ie=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},ie.apply(this,arguments)},Sn=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var 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},Fr=h.forwardRef(function(e,t){var r=e.icon,n=e.id,o=e.className,a=e.extend,i=Sn(e,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),l=h.useRef("_".concat(bn()));return Rr(r,"".concat(n),{defIds:r.defIds,idSuffix:l.current},ie({ref:t,className:s},i),a)});function Rr(e,t,r,n,o){return h.createElement(e.tag,ie(ie({key:t},En(e,r,o)),n),(yn(e,r).children||[]).map(function(a,i){return Rr(a,"".concat(t,"-").concat(e.tag,"-").concat(i),r,void 0,o)}))}function En(e,t,r){var n=ie({},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 yn(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)?ie(ie({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?ie(ie({},o),{attrs:ie(ie({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function bn(){return Math.random().toString(36).substring(2,8)}Fr.displayName="UniverIcon";var On={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M2 3L6.8 8.60593V12.8148L9.2 14V8.60593L14 3H2Z",strokeLinejoin:"round",strokeWidth:1.33}}]},Tr=h.forwardRef(function(e,t){return h.createElement(Fr,Object.assign({},e,{id:"filter-single",ref:t,icon:On}))});Tr.displayName="FilterSingle";const Xe={id:"sheet.command.smart-toggle-filter",type:_.CommandType.COMMAND,handler:async e=>{const t=e.get(_.IUniverInstanceService),r=e.get(c.SheetsFilterService),n=e.get(_.ICommandService),o=e.get(_.IUndoRedoService),a=t.getCurrentUnitForType(_.UniverInstanceType.UNIVER_SHEET),i=a==null?void 0:a.getActiveSheet();if(!i||!a)return!1;const s=a.getUnitId(),l=i.getSheetId(),u=r.getFilterModel(s,l);if(u){const g=u==null?void 0:u.serialize(),y=Fn(s,l,g),R=n.syncExecuteCommand(c.RemoveSheetsFilterMutation.id,{unitId:s,subUnitId:l});return R&&o.pushUndoRedo({unitID:s,undoMutations:y,redoMutations:[{id:c.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}]}),R}const d=e.get(qe.SelectionManagerService).getLast();if(!d)return!1;const p=d.range,m=qe.isSingleCellSelection(d)?ve.expandToContinuousRange(p,{left:!0,right:!0,up:!0,down:!0},i):p;if(m.endRow===m.startRow){const g=e.get(L.IMessageService,H.Quantity.OPTIONAL),y=e.get(_.LocaleService);return g==null||g.show({type:K.MessageType.Warning,content:y.t("sheets-filter.command.not-valid-filter-range")}),!1}const S={id:c.SetSheetsFilterRangeMutation.id,params:{unitId:s,subUnitId:l,range:m}},E=n.syncExecuteCommand(S.id,S.params);return E&&o.pushUndoRedo({unitID:s,undoMutations:[{id:c.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}],redoMutations:[S]}),E}},Ae={id:"sheet.command.set-filter-criteria",type:_.CommandType.COMMAND,handler:async(e,t)=>{const r=e.get(c.SheetsFilterService),n=e.get(_.ICommandService),o=e.get(_.IUndoRedoService),{unitId:a,subUnitId:i,col:s,criteria:l}=t,u=r.getFilterModel(a,i);if(!u)return!1;const f=u.getRange();if(!f||s<f.startColumn||s>f.endColumn)return!1;const d=u.getFilterColumn(s),p=Tn(a,i,s,d),m={id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:a,subUnitId:i,col:s,criteria:l}},S=n.syncExecuteCommand(m.id,m.params);return S&&o.pushUndoRedo({unitID:a,undoMutations:[p],redoMutations:[m]}),S}},Cr={id:"sheet.command.clear-filter-criteria",type:_.CommandType.COMMAND,handler:e=>{const t=e.get(c.SheetsFilterService),r=e.get(_.IUndoRedoService),n=e.get(_.ICommandService),o=t.activeFilterModel;if(!o)return!1;const{unitId:a,subUnitId:i}=o,s=o.serialize(),l=Nr(a,i,s),u=Rn(a,i,s);return _.sequenceExecute(u,n)&&r.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:u}),!0}},Ir={id:"sheet.command.re-calc-filter",type:_.CommandType.COMMAND,handler:e=>{const t=e.get(c.SheetsFilterService),r=e.get(_.ICommandService),n=t.activeFilterModel;if(!n)return!1;const{unitId:o,subUnitId:a}=n;return r.executeCommand(c.ReCalcSheetsFilterMutation.id,{unitId:o,subUnitId:a})}};function Fn(e,t,r){const n=[],o={id:c.SetSheetsFilterRangeMutation.id,params:{unitId:e,subUnitId:t,range:r.ref}};return n.push(o),Nr(e,t,r).forEach(i=>n.push(i)),n}function Nr(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:a}};n.push(i)}),n}function Rn(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:null}};n.push(i)}),n}function Tn(e,t,r,n){if(!n)return{id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:null}};const o=n.serialize();return{id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:o}}}var k=(e=>(e[e.FIRST=0]="FIRST",e[e.SECOND=1]="SECOND",e))(k||{}),N=(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))(N||{}),F;(e=>{e.NONE={label:"sheets-filter.conditions.none",operator:N.NONE,order:k.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===N.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},e.EMPTY={label:"sheets-filter.conditions.empty",operator:N.EMPTY,order:k.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===N.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:N.EMPTY}:!1}},e.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:N.NOT_EMPTY,order:k.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===N.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:" ",operator:c.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===c.CustomFilterOperator.NOT_EQUALS?{operator1:N.NOT_EMPTY}:!1}},e.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:N.CONTAINS,order:k.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:N.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=ue(i);return s===N.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:N.CONTAINS,val1:l.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:N.DOES_NOT_CONTAIN,order:k.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:N.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:c.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=ue(i);return s===N.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===c.CustomFilterOperator.NOT_EQUALS&&l.startsWith("*")&&l.endsWith("*")?{operator1:N.DOES_NOT_CONTAIN,val1:l.slice(1,-1)}:!1}},e.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:N.STARTS_WITH,order:k.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:N.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=ue(i);return s===N.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:N.STARTS_WITH,val1:l.slice(0,-1)}:!1}},e.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:N.ENDS_WITH,order:k.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:N.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=ue(i);return s===N.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:N.ENDS_WITH,val1:l.slice(1)}:!1}},e.EQUALS={label:"sheets-filter.conditions.equals",operator:N.EQUALS,order:k.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:N.EQUALS,val1:""}),testMappingParams:i=>{const[s]=ue(i);return s===N.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:N.EQUALS,val1:""}:((u=i.customFilters)==null?void 0:u.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:N.EQUALS,val1:i.customFilters.customFilters[0].val.toString()}:!1}},e.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:c.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:k.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.GREATER_THAN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:i=>{const[s]=ue(i);return s===c.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!==c.CustomFilterOperator.GREATER_THAN?!1:{operator1:c.CustomFilterOperator.GREATER_THAN,val1:s.val.toString()}}},e.GREATER_THAN_OR_EQUAL={label:"sheets-filter.conditions.greater-than-or-equal",operator:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:k.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=ue(i);return s===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.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!==c.CustomFilterOperator.GREATER_THAN_OR_EQUAL?!1:{operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString()}}},e.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:c.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:k.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.LESS_THAN,val1:""}),testMappingParams:i=>{const[s]=ue(i);return s===c.CustomFilterOperator.LESS_THAN},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.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!==c.CustomFilterOperator.LESS_THAN?!1:{operator1:c.CustomFilterOperator.LESS_THAN,val1:s.val.toString()}}},e.LESS_THAN_OR_EQUAL={label:"sheets-filter.conditions.less-than-or-equal",operator:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:k.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=ue(i);return s===c.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.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!==c.CustomFilterOperator.LESS_THAN_OR_EQUAL?!1:{operator1:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:s.val.toString()}}},e.EQUAL={label:"sheets-filter.conditions.equal",operator:c.CustomFilterOperator.EQUAL,numOfParameters:1,order:k.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.EQUAL,val1:""}),testMappingParams:i=>{const[s]=ue(i);return s===c.CustomFilterOperator.EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.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!==c.CustomFilterOperator.EQUAL?!1:{operator1:c.CustomFilterOperator.EQUAL,val1:s.val.toString()}}},e.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:c.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:k.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.NOT_EQUALS,val1:""}),testMappingParams:i=>{const[s]=ue(i);return s===c.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.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!==c.CustomFilterOperator.NOT_EQUALS?!1:{operator1:c.CustomFilterOperator.NOT_EQUALS,val1:s.val.toString()}}},e.BETWEEN={label:"sheets-filter.conditions.between",operator:N.BETWEEN,order:k.SECOND,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:"",operator2:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(!s)return!1;const f=[l,u];return f.includes(c.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&f.includes(c.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,f=u===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:_.BooleanNumber.TRUE,customFilters:[{val:f?s:l,operator:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:f?l:s,operator:c.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===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&l.operator===c.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString(),operator2:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:l.val.toString()}:l.operator===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&s.operator===c.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:l.val.toString(),operator2:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:s.val.toLocaleString()}:!1}},e.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:N.NOT_BETWEEN,order:k.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.LESS_THAN,val1:"",operator2:c.CustomFilterOperator.GREATER_THAN,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(s)return!1;const f=[l,u];return f.includes(c.CustomFilterOperator.GREATER_THAN)&&f.includes(c.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,f=u===c.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:f?s:l,operator:c.CustomFilterOperator.GREATER_THAN},{val:f?l:s,operator:c.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===c.CustomFilterOperator.LESS_THAN&&l.operator===c.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:c.CustomFilterOperator.LESS_THAN,val1:s.val.toString(),operator2:c.CustomFilterOperator.GREATER_THAN,val2:l.val.toString()}:l.operator===c.CustomFilterOperator.LESS_THAN&&s.operator===c.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:c.CustomFilterOperator.GREATER_THAN,val1:l.val.toString(),operator2:c.CustomFilterOperator.LESS_THAN,val2:s.val.toLocaleString()}:!1}},e.CUSTOM={label:"sheets-filter.conditions.custom",operator:N.CUSTOM,order:k.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:N.NONE,val1:"",operator2:N.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:l,val2:u,operator1:f,operator2:d}=i;function p(R,w){for(const C of e.ALL_CONDITIONS)if(C.operator===R)return C.mapToFilterColumn({val1:w,operator1:R})}const m=!f||f===e.NONE.operator,S=!d||d===e.NONE.operator;if(m&&S)return e.NONE.mapToFilterColumn({});if(m)return p(d,u);if(S)return p(f,l);const E=p(f,l),g=p(d,u),y={customFilters:[E.customFilters.customFilters[0],g.customFilters.customFilters[0]]};return s&&(y.and=_.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(f=>a({customFilters:{customFilters:[f]}})),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})(F||(F={}));function ue(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 xt(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 Cn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,zt=(e,t,r,n)=>{for(var o=n>1?void 0:n?In(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&&Cn(t,r,o),o},we=(e,t)=>(r,n)=>t(r,n,e),ut=(e=>(e[e.VALUES=0]="VALUES",e[e.CONDITIONS=1]="CONDITIONS",e))(ut||{});H.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let be=class extends _.Disposable{constructor(t,r,n,o){super();I(this,"_filterBy$",new P.BehaviorSubject(0));I(this,"filterBy$",this._filterBy$.asObservable());I(this,"_filterByModel$",new P.ReplaySubject(1));I(this,"filterByModel$",this._filterByModel$.asObservable());I(this,"_filterByModel",null);I(this,"_hasCriteria$",new P.BehaviorSubject(!1));I(this,"hasCriteria$",this._hasCriteria$.asObservable());I(this,"_filterModel",null);I(this,"_col$",new P.BehaviorSubject(-1));I(this,"col$",this._col$.asObservable());I(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=ft.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=ct.fromFilterColumn(this._injector,t,r,t.getFilterColumn(r));return this.filterByModel=o,this._filterBy$.next(1),this._listenToFilterHeaderChange(t,r),!0}_disposePreviousModel(){var t;(t=this._filterByModel)==null||t.dispose(),this.filterByModel=null}};be=zt([we(0,H.Inject(H.Injector)),we(1,H.Inject(c.SheetsFilterService)),we(2,_.IUniverInstanceService),we(3,H.Inject(qe.RefRangeService))],be);let ct=class extends _.Disposable{constructor(t,r,n,o,a){super();I(this,"canApply$",P.of(!0));I(this,"_conditionItem$");I(this,"conditionItem$");I(this,"_filterConditionFormParams$");I(this,"filterConditionFormParams$");this._filterModel=t,this.col=r,this._commandService=a,this._conditionItem$=new P.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new P.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(t,r,n,o){const[a,i]=F.testMappingFilterColumn(o==null?void 0:o.getColumnData());return t.createInstance(ct,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(Ae.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=F.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(Ae.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:t})}onPrimaryConditionChange(t){const r=F.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(F.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=F.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(r)}};ct=zt([we(4,_.ICommandService)],ct);let ft=class extends _.Disposable{constructor(t,r,n,o){super();I(this,"_rawFilterItems$");I(this,"rawFilterItems$");I(this,"filterItems$");I(this,"_filterItems",[]);I(this,"canApply$");I(this,"_manuallyUpdateFilterItems$");I(this,"_searchString$");I(this,"searchString$");this._filterModel=t,this.col=r,this._commandService=o,this._searchString$=new P.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new P.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new P.Subject,this.filterItems$=P.merge(P.combineLatest([this._searchString$.pipe(P.throttleTime(500,void 0,{leading:!0,trailing:!0}),P.startWith(void 0)),this._rawFilterItems$]).pipe(P.map(([a,i])=>{if(!a)return i;const l=a.toLowerCase().split(/\s+/).filter(u=>!!u);return i.filter(u=>{const f=u.value.toLowerCase();return l.some(d=>f.includes(d))})})),this._manuallyUpdateFilterItems$).pipe(P.shareReplay(1)),this.canApply$=this.filterItems$.pipe(P.map(a=>xt(a).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(a=>this._filterItems=a))}static fromFilterColumn(t,r,n){var D;const o=t.get(_.IUniverInstanceService),a=t.get(_.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 f=r.getRange(),d=n,p=(D=r.getFilterColumn(n))==null?void 0:D.getColumnData().filters,m=!!(p&&p.blank),S={...f,startRow:f.startRow+1,startColumn:d,endColumn:d},E=[],g={},y=new Set(p==null?void 0:p.filters),R=r.getFilteredOutRowsExceptCol(n);let w=0,C=0;for(const T of u.iterateByColumn(S,!1,!1)){const{row:$,rowSpan:j=1}=T;let V=0;for(;V<j;){const J=$+V;if(R.has(J)){V++;continue}const G=T!=null&&T.value?_.extractPureTextFromCell(T.value):"";if(!G){C+=1,V+=j;continue}if(g[G])g[G].count++;else{const re={value:G,checked:y.size?y.has(G):!m,count:1,index:w,isEmpty:!1};g[G]=re,E.push(re)}V++}w++}const x=p?m:!0;if(C>0){const T={value:a.t("sheets-filter.panel.empty"),checked:x,count:C,index:w,isEmpty:!0};E.push(T)}return t.createInstance(ft,r,n,E)}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(Ae.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=xt(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(Ae.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{s.filters={};const l=n.filter(f=>!f.isEmpty);l.length>0&&(s.filters={filters:l.map(f=>f.value)}),l.length!==n.length&&(s.filters.blank=!0)}return this._commandService.executeCommand(Ae.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:s})}};ft=zt([we(3,_.ICommandService)],ft);const Le="FILTER_PANEL_OPENED",Pr={id:"sheet.operation.open-filter-panel",type:_.CommandType.OPERATION,handler:(e,t)=>{const r=e.get(_.IContextService),n=e.get(c.SheetsFilterService),o=e.get(be);e.get(_.ICommandService).syncExecuteCommand(ve.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(Le)||r.setContextValue(Le,!0),!0)}},Qe={id:"sheet.operation.close-filter-panel",type:_.CommandType.OPERATION,handler:e=>{const t=e.get(_.IContextService),r=e.get(be),n=e.get(L.ILayoutService,H.Quantity.OPTIONAL);return t.getContextValue(Le)?(t.setContextValue(Le,!1),n==null||n.focus(),r.terminate()):!1}},Mr={id:"sheet.operation.apply-filter",type:_.CommandType.OPERATION,handler:(e,t)=>{const{filterBy:r}=t;return e.get(be).changeFilterBy(r)}},Nn="univer-sheets-filter-panel",Pn="univer-sheets-filter-panel-header",Mn="univer-sheets-filter-panel-content",wn="univer-sheets-filter-panel-select-all",An="univer-sheets-filter-panel-select-all-count",Ln="univer-sheets-filter-panel-values-container",Dn="univer-input-affix-wrapper",Hn="univer-select",$n="univer-radio-group",Un="univer-sheets-filter-panel-values-find",xn="univer-sheets-filter-panel-values-list",Bn="univer-sheets-filter-panel-values-list-inner-container",jn="univer-sheets-filter-panel-values-virtual",Wn="univer-sheets-filter-panel-values-item",Vn="univer-sheets-filter-panel-values-item-inner",kn="univer-sheets-filter-panel-values-item-count",zn="univer-sheets-filter-panel-values-item-exclude-button",Qn="univer-sheets-filter-panel-values-item-text",Gn="univer-sheets-filter-panel-conditions-container",qn="univer-sheets-filter-panel-conditions-container-inner",Yn="univer-sheets-filter-panel-conditions-desc",Xn="univer-sheets-filter-panel-footer",Kn="univer-sheets-filter-panel-footer-primary-buttons",Zn="univer-button",Jn="univer-input",ei="univer-form-dual-column-layout",B={sheetsFilterPanel:Nn,sheetsFilterPanelHeader:Pn,sheetsFilterPanelContent:Mn,sheetsFilterPanelSelectAll:wn,sheetsFilterPanelSelectAllCount:An,sheetsFilterPanelValuesContainer:Ln,inputAffixWrapper:Dn,select:Hn,radioGroup:$n,sheetsFilterPanelValuesFind:Un,sheetsFilterPanelValuesList:xn,sheetsFilterPanelValuesListInnerContainer:Bn,sheetsFilterPanelValuesVirtual:jn,sheetsFilterPanelValuesItem:Wn,sheetsFilterPanelValuesItemInner:Vn,sheetsFilterPanelValuesItemCount:kn,sheetsFilterPanelValuesItemExcludeButton:zn,sheetsFilterPanelValuesItemText:Qn,sheetsFilterPanelConditionsContainer:Gn,sheetsFilterPanelConditionsContainerInner:qn,sheetsFilterPanelConditionsDesc:Yn,sheetsFilterPanelFooter:Xn,sheetsFilterPanelFooterPrimaryButtons:Kn,button:Zn,input:Jn,formDualColumnLayout:ei};function ti(e){const{model:t}=e,r=ze.useDependency(_.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:f,and:d}=o,p=d?"AND":"OR",m=h.useCallback(C=>{t.onConditionFormChange({and:C==="AND"})},[t]),S=ri(r),E=h.useCallback(C=>{t.onPrimaryConditionChange(C)},[t]),g=ni(r),y=h.useCallback(C=>{t.onConditionFormChange(C)},[t]),R=r.t("sheets-filter.panel.input-values-placeholder");function w(C,x,D){const T=F.getItemByOperator(C).numOfParameters===1;return h.createElement(h.Fragment,null,D==="operator2"&&h.createElement(K.RadioGroup,{value:p,onChange:m},h.createElement(K.Radio,{value:"AND"},r.t("sheets-filter.panel.and")),h.createElement(K.Radio,{value:"OR"},r.t("sheets-filter.panel.or"))),h.createElement(K.Select,{value:C,options:g,onChange:$=>y({[D]:$})}),T&&h.createElement(K.Input,{value:x,placeholder:R,onChange:$=>y({[D==="operator1"?"val1":"val2"]:$})}))}return h.createElement("div",{className:B.sheetsFilterPanelConditionsContainer},h.createElement(K.Select,{value:a,options:S,onChange:E}),F.getItemByOperator(a).numOfParameters!==0?h.createElement("div",{className:B.sheetsFilterPanelConditionsContainerInner},i>=1&&w(s,u!=null?u:"","operator1"),i>=2&&w(l,f!=null?f:"","operator2"),h.createElement("div",{className:B.sheetsFilterPanelConditionsDesc},r.t("sheets-filter.panel.?"),h.createElement("br",null),r.t("sheets-filter.panel.*"))):null)}function ri(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{options:[{label:e.t(F.NONE.label),value:F.NONE.operator}]},{options:[{label:e.t(F.EMPTY.label),value:F.EMPTY.operator},{label:e.t(F.NOT_EMPTY.label),value:F.NOT_EMPTY.operator}]},{options:[{label:e.t(F.TEXT_CONTAINS.label),value:F.TEXT_CONTAINS.operator},{label:e.t(F.DOES_NOT_CONTAIN.label),value:F.DOES_NOT_CONTAIN.operator},{label:e.t(F.STARTS_WITH.label),value:F.STARTS_WITH.operator},{label:e.t(F.ENDS_WITH.label),value:F.ENDS_WITH.operator},{label:e.t(F.EQUALS.label),value:F.EQUALS.operator}]},{options:[{label:e.t(F.GREATER_THAN.label),value:F.GREATER_THAN.operator},{label:e.t(F.GREATER_THAN_OR_EQUAL.label),value:F.GREATER_THAN_OR_EQUAL.operator},{label:e.t(F.LESS_THAN.label),value:F.LESS_THAN.operator},{label:e.t(F.LESS_THAN_OR_EQUAL.label),value:F.LESS_THAN_OR_EQUAL.operator},{label:e.t(F.EQUAL.label),value:F.EQUAL.operator},{label:e.t(F.NOT_EQUAL.label),value:F.NOT_EQUAL.operator},{label:e.t(F.BETWEEN.label),value:F.BETWEEN.operator},{label:e.t(F.NOT_BETWEEN.label),value:F.NOT_BETWEEN.operator}]},{options:[{label:e.t(F.CUSTOM.label),value:F.CUSTOM.operator}]}],[t,e])}function ni(e){const t=e.getCurrentLocale();return h.useMemo(()=>F.ALL_CONDITIONS.filter(r=>r.numOfParameters!==2).map(r=>({label:e.t(r.label),value:r.operator})),[t,e])}function Ye(){return Ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ye.apply(this,arguments)}function fe(e){"@babel/helpers - typeof";return fe=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},fe(e)}function ii(e,t){if(fe(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(fe(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wr(e){var t=ii(e,"string");return fe(t)=="symbol"?t:t+""}function Z(e,t,r){return t=wr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ur(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function te(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ur(Object(r),!0).forEach(function(n){Z(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ur(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function oi(e){if(Array.isArray(e))return e}function si(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(f){u=!0,o=f}finally{try{if(!l&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return s}}function cr(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ai(e,t){if(e){if(typeof e=="string")return cr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cr(e,t)}}function li(){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 Y(e,t){return oi(e)||si(e,t)||ai(e,t)||li()}function ui(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function ci(e,t){if(e==null)return{};var r=ui(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function fi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ar={exports:{}};/*!
3
+ Copyright (c) 2018 Jed Watson.
4
+ Licensed under the MIT License (MIT), see
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})()})(Ar);var hi=Ar.exports;const ht=fi(hi);var Lr={exports:{}},A={};/**
7
+ * @license React
8
+ * react-is.production.min.js
9
+ *
10
+ * Copyright (c) Facebook, Inc. and its affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */var Qt=Symbol.for("react.element"),Gt=Symbol.for("react.portal"),vt=Symbol.for("react.fragment"),gt=Symbol.for("react.strict_mode"),_t=Symbol.for("react.profiler"),St=Symbol.for("react.provider"),Et=Symbol.for("react.context"),di=Symbol.for("react.server_context"),yt=Symbol.for("react.forward_ref"),bt=Symbol.for("react.suspense"),Ot=Symbol.for("react.suspense_list"),Ft=Symbol.for("react.memo"),Rt=Symbol.for("react.lazy"),mi=Symbol.for("react.offscreen"),Dr;Dr=Symbol.for("react.module.reference");function oe(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Qt:switch(e=e.type,e){case vt:case _t:case gt:case bt:case Ot:return e;default:switch(e=e&&e.$$typeof,e){case di:case Et:case yt:case Rt:case Ft:case St:return e;default:return t}}case Gt:return t}}}A.ContextConsumer=Et;A.ContextProvider=St;A.Element=Qt;A.ForwardRef=yt;A.Fragment=vt;A.Lazy=Rt;A.Memo=Ft;A.Portal=Gt;A.Profiler=_t;A.StrictMode=gt;A.Suspense=bt;A.SuspenseList=Ot;A.isAsyncMode=function(){return!1};A.isConcurrentMode=function(){return!1};A.isContextConsumer=function(e){return oe(e)===Et};A.isContextProvider=function(e){return oe(e)===St};A.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Qt};A.isForwardRef=function(e){return oe(e)===yt};A.isFragment=function(e){return oe(e)===vt};A.isLazy=function(e){return oe(e)===Rt};A.isMemo=function(e){return oe(e)===Ft};A.isPortal=function(e){return oe(e)===Gt};A.isProfiler=function(e){return oe(e)===_t};A.isStrictMode=function(e){return oe(e)===gt};A.isSuspense=function(e){return oe(e)===bt};A.isSuspenseList=function(e){return oe(e)===Ot};A.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===vt||e===_t||e===gt||e===bt||e===Ot||e===mi||typeof e=="object"&&e!==null&&(e.$$typeof===Rt||e.$$typeof===Ft||e.$$typeof===St||e.$$typeof===Et||e.$$typeof===yt||e.$$typeof===Dr||e.getModuleId!==void 0)};A.typeOf=oe;Lr.exports=A;var it=Lr.exports;function Bt(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(Bt(n)):it.isFragment(n)&&n.props?r=r.concat(Bt(n.props.children,t)):r.push(n))}),r}function pi(e){return e instanceof HTMLElement||e instanceof SVGElement}function ot(e){return pi(e)?e:e instanceof h.Component?Ut.findDOMNode(e):null}function vi(e,t,r){var n=v.useRef({});return(!("value"in n.current)||r(n.current.condition,t))&&(n.current.value=e(),n.current.condition=t),n.current.value}function gi(e,t){typeof e=="function"?e(t):fe(e)==="object"&&e&&"current"in e&&(e.current=t)}function _i(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.filter(function(o){return o});return n.length<=1?n[0]:function(o){t.forEach(function(a){gi(a,o)})}}function Si(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return vi(function(){return _i.apply(void 0,t)},t,function(n,o){return n.length!==o.length||n.every(function(a,i){return a!==o[i]})})}function Ei(e){var t,r,n=it.isMemo(e)?e.type.type:e.type;return!(typeof n=="function"&&!((t=n.prototype)!==null&&t!==void 0&&t.render)&&n.$$typeof!==it.ForwardRef||typeof e=="function"&&!((r=e.prototype)!==null&&r!==void 0&&r.render)&&e.$$typeof!==it.ForwardRef)}var jt=v.createContext(null);function yi(e){var t=e.children,r=e.onBatchResize,n=v.useRef(0),o=v.useRef([]),a=v.useContext(jt),i=v.useCallback(function(s,l,u){n.current+=1;var f=n.current;o.current.push({size:s,element:l,data:u}),Promise.resolve().then(function(){f===n.current&&(r==null||r(o.current),o.current=[])}),a==null||a(s,l,u)},[r,a]);return v.createElement(jt.Provider,{value:i},t)}var Hr=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(o,a){return o[0]===r?(n=a,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,a=this.__entries__;o<a.length;o++){var i=a[o];r.call(n,i[1],i[0])}},t}()}(),Wt=typeof window<"u"&&typeof document<"u"&&window.document===document,dt=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")()}(),bi=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(dt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Oi=2;function Fi(e,t){var r=!1,n=!1,o=0;function a(){r&&(r=!1,e()),n&&s()}function i(){bi(a)}function s(){var l=Date.now();if(r){if(l-o<Oi)return;n=!0}else r=!0,n=!1,setTimeout(i,t);o=l}return s}var Ri=20,Ti=["top","right","bottom","left","width","height","size","weight"],Ci=typeof MutationObserver<"u",Ii=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Fi(this.refresh.bind(this),Ri)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var r=this.observers_,n=r.indexOf(t);~n&&r.splice(n,1),!r.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return t.forEach(function(r){return r.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!Wt||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Ci?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Wt||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=Ti.some(function(a){return!!~n.indexOf(a)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),$r=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},De=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||dt},Ur=Tt(0,0,0,0);function mt(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+mt(a)},0)}function Ni(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]=mt(i)}return r}function Pi(e){var t=e.getBBox();return Tt(0,0,t.width,t.height)}function Mi(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return Ur;var n=De(e).getComputedStyle(e),o=Ni(n),a=o.left+o.right,i=o.top+o.bottom,s=mt(n.width),l=mt(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)),!Ai(e)){var u=Math.round(s+a)-t,f=Math.round(l+i)-r;Math.abs(u)!==1&&(s-=u),Math.abs(f)!==1&&(l-=f)}return Tt(o.left,o.top,s,l)}var wi=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof De(e).SVGGraphicsElement}:function(e){return e instanceof De(e).SVGElement&&typeof e.getBBox=="function"}}();function Ai(e){return e===De(e).document.documentElement}function Li(e){return Wt?wi(e)?Pi(e):Mi(e):Ur}function Di(e){var t=e.x,r=e.y,n=e.width,o=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(a.prototype);return $r(i,{x:t,y:r,width:n,height:o,top:r,right:t+n,bottom:o+r,left:t}),i}function Tt(e,t,r,n){return{x:e,y:t,width:r,height:n}}var Hi=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Tt(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Li(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}(),$i=function(){function e(t,r){var n=Di(r);$r(this,{target:t,contentRect:n})}return e}(),Ui=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new Hr,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 De(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new Hi(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 De(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 $i(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}(),xr=typeof WeakMap<"u"?new WeakMap:new Hr,Br=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=Ii.getInstance(),n=new Ui(t,r,this);xr.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Br.prototype[e]=function(){var t;return(t=xr.get(this))[e].apply(t,arguments)}});var xi=function(){return typeof dt.ResizeObserver<"u"?dt.ResizeObserver:Br}(),ye=new Map;function Bi(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 jr=new xi(Bi);function ji(e,t){ye.has(e)||(ye.set(e,new Set),jr.observe(e)),ye.get(e).add(t)}function Wi(e,t){ye.has(e)&&(ye.get(e).delete(t),ye.get(e).size||(jr.unobserve(e),ye.delete(e)))}function Wr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hr(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,wr(n.key),n)}}function Vr(e,t,r){return t&&hr(e.prototype,t),r&&hr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vt(e,t){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Vt(e,t)}function Vi(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&&Vt(e,t)}function pt(e){return pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},pt(e)}function kr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kr=function(){return!!e})()}function ki(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zi(e,t){if(t&&(fe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ki(e)}function Qi(e){var t=kr();return function(){var n=pt(e),o;if(t){var a=pt(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return zi(this,o)}}var Gi=function(e){Vi(r,e);var t=Qi(r);function r(){return Wr(this,r),t.apply(this,arguments)}return Vr(r,[{key:"render",value:function(){return this.props.children}}]),r}(v.Component);function qi(e,t){var r=e.children,n=e.disabled,o=v.useRef(null),a=v.useRef(null),i=v.useContext(jt),s=typeof r=="function",l=s?r(o):r,u=v.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),f=!s&&v.isValidElement(l)&&Ei(l),d=f?l.ref:null,p=Si(d,o),m=function(){var y;return ot(o.current)||(o.current&&fe(o.current)==="object"?ot((y=o.current)===null||y===void 0?void 0:y.nativeElement):null)||ot(a.current)};v.useImperativeHandle(t,function(){return m()});var S=v.useRef(e);S.current=e;var E=v.useCallback(function(g){var y=S.current,R=y.onResize,w=y.data,C=g.getBoundingClientRect(),x=C.width,D=C.height,T=g.offsetWidth,$=g.offsetHeight,j=Math.floor(x),V=Math.floor(D);if(u.current.width!==j||u.current.height!==V||u.current.offsetWidth!==T||u.current.offsetHeight!==$){var J={width:j,height:V,offsetWidth:T,offsetHeight:$};u.current=J;var G=T===Math.round(x)?x:T,re=$===Math.round(D)?D:$,q=te(te({},J),{},{offsetWidth:G,offsetHeight:re});i==null||i(q,g,w),R&&Promise.resolve().then(function(){R(q,g)})}},[]);return v.useEffect(function(){var g=m();return g&&!n&&ji(g,E),function(){return Wi(g,E)}},[o.current,n]),v.createElement(Gi,{ref:a},f?v.cloneElement(l,{ref:p}):l)}var Yi=v.forwardRef(qi),Xi="rc-observer-key";function Ki(e,t){var r=e.children,n=typeof r=="function"?[r]:Bt(r);return n.map(function(o,a){var i=(o==null?void 0:o.key)||"".concat(Xi,"-").concat(a);return v.createElement(Yi,Ye({},e,{key:i,ref:a===0?t:void 0}),o)})}var qt=v.forwardRef(Ki);qt.Collection=yi;var zr=v.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,f=e.extra,d={},p={display:"flex",flexDirection:"column"};return n!==void 0&&(d={height:r,position:"relative",overflow:"hidden"},p=te(te({},p),{},Z(Z(Z(Z(Z({transform:"translateY(".concat(n,"px)")},u?"marginRight":"marginLeft",-o),"position","absolute"),"left",0),"right",0),"top",0))),v.createElement("div",{style:d},v.createElement(qt,{onResize:function(S){var E=S.offsetHeight;E&&s&&s()}},v.createElement("div",Ye({style:p,className:ht(Z({},"".concat(i,"-holder-inner"),i)),ref:t},l),a,f)))});zr.displayName="Filler";var Qr=function(t){return+setTimeout(t,16)},Gr=function(t){return clearTimeout(t)};typeof window<"u"&&"requestAnimationFrame"in window&&(Qr=function(t){return window.requestAnimationFrame(t)},Gr=function(t){return window.cancelAnimationFrame(t)});var dr=0,Yt=new Map;function qr(e){Yt.delete(e)}var ce=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;dr+=1;var n=dr;function o(a){if(a===0)qr(n),t();else{var i=Qr(function(){o(a-1)});Yt.set(n,i)}}return o(r),n};ce.cancel=function(e){var t=Yt.get(e);return qr(e),Gr(t)};function mr(e,t){var r="touches"in e?e.touches[0]:e;return r[t?"pageX":"pageY"]}var pr=v.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,f=e.spinSize,d=e.containerSize,p=e.style,m=e.thumbStyle,S=v.useState(!1),E=Y(S,2),g=E[0],y=E[1],R=v.useState(null),w=Y(R,2),C=w[0],x=w[1],D=v.useState(null),T=Y(D,2),$=T[0],j=T[1],V=!n,J=v.useRef(),G=v.useRef(),re=v.useState(!1),q=Y(re,2),Ce=q[0],ee=q[1],Oe=v.useRef(),se=function(){clearTimeout(Oe.current),ee(!0),Oe.current=setTimeout(function(){ee(!1)},3e3)},X=a-d||0,He=d-f||0,U=v.useMemo(function(){if(o===0||X===0)return 0;var z=o/X;return z*He},[o,X,He]),Fe=function(W){W.stopPropagation(),W.preventDefault()},Ie=v.useRef({top:U,dragging:g,pageY:C,startTop:$});Ie.current={top:U,dragging:g,pageY:C,startTop:$};var $e=function(W){y(!0),x(mr(W,u)),j(Ie.current.top),i(),W.stopPropagation(),W.preventDefault()};v.useEffect(function(){var z=function(Be){Be.preventDefault()},W=J.current,de=G.current;return W.addEventListener("touchstart",z),de.addEventListener("touchstart",$e),function(){W.removeEventListener("touchstart",z),de.removeEventListener("touchstart",$e)}},[]);var Ue=v.useRef();Ue.current=X;var ae=v.useRef();ae.current=He,v.useEffect(function(){if(g){var z,W=function(Be){var Ne=Ie.current,Ke=Ne.dragging,Ze=Ne.pageY,Ct=Ne.startTop;if(ce.cancel(z),Ke){var Re=mr(Be,u)-Ze,Pe=Ct;!V&&u?Pe-=Re:Pe+=Re;var Je=Ue.current,et=ae.current,It=et?Pe/et:0,Te=Math.ceil(It*Je);Te=Math.max(Te,0),Te=Math.min(Te,Je),z=ce(function(){l(Te,u)})}},de=function(){y(!1),s()};return window.addEventListener("mousemove",W),window.addEventListener("touchmove",W),window.addEventListener("mouseup",de),window.addEventListener("touchend",de),function(){window.removeEventListener("mousemove",W),window.removeEventListener("touchmove",W),window.removeEventListener("mouseup",de),window.removeEventListener("touchend",de),ce.cancel(z)}}},[g]),v.useEffect(function(){se()},[o]),v.useImperativeHandle(t,function(){return{delayHidden:se}});var ge="".concat(r,"-scrollbar"),ne={position:"absolute",visibility:Ce?null:"hidden"},le={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(ne.height=8,ne.left=0,ne.right=0,ne.bottom=0,le.height="100%",le.width=f,V?le.left=U:le.right=U):(ne.width=8,ne.top=0,ne.bottom=0,V?ne.right=0:ne.left=0,le.width="100%",le.height=f,le.top=U),v.createElement("div",{ref:J,className:ht(ge,Z(Z(Z({},"".concat(ge,"-horizontal"),u),"".concat(ge,"-vertical"),!u),"".concat(ge,"-visible"),Ce)),style:te(te({},ne),p),onMouseDown:Fe,onMouseMove:se},v.createElement("div",{ref:G,className:ht("".concat(ge,"-thumb"),Z({},"".concat(ge,"-thumb-moving"),g)),style:te(te({},le),m),onMouseDown:$e}))});function Zi(e){var t=e.children,r=e.setRef,n=v.useCallback(function(o){r(o)},[]);return v.cloneElement(t,{ref:n})}function Ji(e,t,r,n,o,a,i){var s=i.getKey;return e.slice(t,r+1).map(function(l,u){var f=t+u,d=a(l,f,{style:{width:n}}),p=s(l);return v.createElement(Zi,{key:p,setRef:function(S){return o(l,S)}},d)})}var eo=function(){function e(){Wr(this,e),Z(this,"maps",void 0),Z(this,"id",0),this.maps=Object.create(null)}return Vr(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 to(e,t,r){var n=v.useState(0),o=Y(n,2),a=o[0],i=o[1],s=h.useRef(new Map),l=h.useRef(new eo),u=h.useRef();function f(){ce.cancel(u.current)}function d(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;f();var S=function(){s.current.forEach(function(g,y){if(g&&g.offsetParent){var R=ot(g),w=R.offsetHeight;l.current.get(y)!==w&&l.current.set(y,R.offsetHeight)}}),i(function(g){return g+1})};m?S():u.current=ce(S)}function p(m,S){var E=e(m),g=s.current.get(E);S?(s.current.set(E,S),d()):s.current.delete(E),!g!=!S&&(S?t==null||t(m):r==null||r(m))}return h.useEffect(function(){return f},[]),[p,d,l.current,a]}function ro(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var vr=ro()?v.useLayoutEffect:v.useEffect,Ge=function(t,r){var n=v.useRef(!0);vr(function(){return t(n.current)},r),vr(function(){return n.current=!1,function(){n.current=!0}},[])};function gr(e){var t=v.useRef();t.current=e;var r=v.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}var no=10;function io(e,t,r,n,o,a,i,s){var l=v.useRef(),u=v.useState(null),f=Y(u,2),d=f[0],p=f[1];return Ge(function(){if(d&&d.times<no){if(!e.current){p(function(X){return te({},X)});return}a();var m=d.targetAlign,S=d.originAlign,E=d.index,g=d.offset,y=e.current.clientHeight,R=!1,w=m,C=null;if(y){for(var x=m||S,D=0,T=0,$=0,j=Math.min(t.length-1,E),V=0;V<=j;V+=1){var J=o(t[V]);T=D;var G=r.get(J);$=T+(G===void 0?n:G),D=$}for(var re=x==="top"?g:y-g,q=j;q>=0;q-=1){var Ce=o(t[q]),ee=r.get(Ce);if(ee===void 0){R=!0;break}if(re-=ee,re<=0)break}switch(x){case"top":C=T-g;break;case"bottom":C=$-y+g;break;default:{var Oe=e.current.scrollTop,se=Oe+y;T<Oe?w="top":$>se&&(w="bottom")}}C!==null&&i(C),C!==d.lastTop&&(R=!0)}R&&p(te(te({},d),{},{times:d.times+1,targetAlign:w,lastTop:C}))}},[d,e.current]),function(m){if(m==null){s();return}if(ce.cancel(l.current),typeof m=="number")i(m);else if(m&&fe(m)==="object"){var S,E=m.align;"index"in m?S=m.index:S=t.findIndex(function(R){return o(R)===m.key});var g=m.offset,y=g===void 0?0:g;p({times:0,index:S,offset:y,originAlign:E})}}}function oo(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(S){return S!==void 0?r(S):s}for(var u=null,f=Math.abs(n-o)!==1,d=0;d<i.length;d+=1){var p=l(a[d]),m=l(i[d]);if(p!==m){u=d,f=f||p!==l(i[d+1]);break}}return u===null?null:{index:u,multiple:f}}function so(e,t,r){var n=v.useState(e),o=Y(n,2),a=o[0],i=o[1],s=v.useState(null),l=Y(s,2),u=l[0],f=l[1];return v.useEffect(function(){var d=oo(a||[],e||[],t);(d==null?void 0:d.index)!==void 0&&(r==null||r(d.index),f(e[d.index])),i(e)},[e]),[u]}var _r=(typeof navigator>"u"?"undefined":fe(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const Yr=function(e,t){var r=h.useRef(!1),n=h.useRef(null);function o(){clearTimeout(n.current),r.current=!0,n.current=setTimeout(function(){r.current=!1},50)}var a=h.useRef({top:e,bottom:t});return a.current.top=e,a.current.bottom=t,function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,l=i<0&&a.current.top||i>0&&a.current.bottom;return s&&l?(clearTimeout(n.current),r.current=!1):(!l||r.current)&&o(),!r.current&&l}};function ao(e,t,r,n,o){var a=h.useRef(0),i=h.useRef(null),s=h.useRef(null),l=h.useRef(!1),u=Yr(t,r);function f(g,y){ce.cancel(i.current),a.current+=y,s.current=y,!u(y)&&(_r||g.preventDefault(),i.current=ce(function(){var R=l.current?10:1;o(a.current*R),a.current=0}))}function d(g,y){o(y,!0),_r||g.preventDefault()}var p=h.useRef(null),m=h.useRef(null);function S(g){if(e){ce.cancel(m.current),m.current=ce(function(){p.current=null},2);var y=g.deltaX,R=g.deltaY,w=g.shiftKey,C=y,x=R;(p.current==="sx"||!p.current&&w&&R&&!y)&&(C=R,x=0,p.current="sx");var D=Math.abs(C),T=Math.abs(x);p.current===null&&(p.current=n&&D>T?"x":"y"),p.current==="y"?f(g,x):d(g,C)}}function E(g){e&&(l.current=g.detail===s.current)}return[S,E]}var lo=14/15;function uo(e,t,r){var n=h.useRef(!1),o=h.useRef(0),a=h.useRef(null),i=h.useRef(null),s,l=function(p){if(n.current){var m=Math.ceil(p.touches[0].pageY),S=o.current-m;o.current=m,r(S)&&p.preventDefault(),clearInterval(i.current),i.current=setInterval(function(){S*=lo,(!r(S,!0)||Math.abs(S)<=.1)&&clearInterval(i.current)},16)}},u=function(){n.current=!1,s()},f=function(p){s(),p.touches.length===1&&!n.current&&(n.current=!0,o.current=Math.ceil(p.touches[0].pageY),a.current=p.target,a.current.addEventListener("touchmove",l),a.current.addEventListener("touchend",u))};s=function(){a.current&&(a.current.removeEventListener("touchmove",l),a.current.removeEventListener("touchend",u))},Ge(function(){return e&&t.current.addEventListener("touchstart",f),function(){var d;(d=t.current)===null||d===void 0||d.removeEventListener("touchstart",f),s(),clearInterval(i.current)}},[e])}var co=20;function Sr(){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,co),Math.floor(r)}function fo(e,t,r,n){var o=v.useMemo(function(){return[new Map,[]]},[e,r.id,n]),a=Y(o,2),i=a[0],s=a[1],l=function(f){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f,p=i.get(f),m=i.get(d);if(p===void 0||m===void 0)for(var S=e.length,E=s.length;E<S;E+=1){var g,y=e[E],R=t(y);i.set(R,E);var w=(g=r.get(R))!==null&&g!==void 0?g:n;if(s[E]=(s[E-1]||0)+w,R===f&&(p=E),R===d&&(m=E),p!==void 0&&m!==void 0)break}return{top:s[p-1]||0,bottom:s[m]}};return l}var ho=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles"],mo=[],po={overflowY:"auto",overflowAnchor:"none"};function vo(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,f=e.data,d=e.children,p=e.itemKey,m=e.virtual,S=e.direction,E=e.scrollWidth,g=e.component,y=g===void 0?"div":g,R=e.onScroll,w=e.onVirtualScroll,C=e.onVisibleChange,x=e.innerProps,D=e.extraRender,T=e.styles,$=ci(e,ho),j=v.useCallback(function(b){return typeof p=="function"?p(b):b==null?void 0:b[p]},[p]),V=to(j,null,null),J=Y(V,4),G=J[0],re=J[1],q=J[2],Ce=J[3],ee=!!(m!==!1&&a&&i),Oe=v.useMemo(function(){return Object.values(q.maps).reduce(function(b,O){return b+O},0)},[q.id,q.maps]),se=ee&&f&&(Math.max(i*f.length,Oe)>a||!!E),X=S==="rtl",He=ht(n,Z({},"".concat(n,"-rtl"),X),o),U=f||mo,Fe=h.useRef(),Ie=h.useRef(),$e=h.useState(0),Ue=Y($e,2),ae=Ue[0],ge=Ue[1],ne=h.useState(0),le=Y(ne,2),z=le[0],W=le[1],de=h.useState(!1),xe=Y(de,2),Be=xe[0],Ne=xe[1],Ke=function(){Ne(!0)},Ze=function(){Ne(!1)},Ct={getKey:j};function Re(b){ge(function(O){var M;typeof b=="function"?M=b(O):M=b;var Q=rn(M);return Fe.current.scrollTop=Q,Q})}var Pe=h.useRef({start:0,end:U.length}),Je=h.useRef(),et=so(U,j),It=Y(et,1),Te=It[0];Je.current=Te;var tt=v.useMemo(function(){if(!ee)return{scrollHeight:void 0,start:0,end:U.length-1,offset:void 0};if(!se){var b;return{scrollHeight:((b=Ie.current)===null||b===void 0?void 0:b.offsetHeight)||0,start:0,end:U.length-1,offset:void 0}}for(var O=0,M,Q,_e,fn=U.length,ke=0;ke<fn;ke+=1){var hn=U[ke],dn=j(hn),lr=q.get(dn),Ht=O+(lr===void 0?i:lr);Ht>=ae&&M===void 0&&(M=ke,Q=O),Ht>ae+a&&_e===void 0&&(_e=ke),O=Ht}return M===void 0&&(M=0,Q=0,_e=Math.ceil(a/i)),_e===void 0&&(_e=U.length-1),_e=Math.min(_e+1,U.length-1),{scrollHeight:O,start:M,end:_e,offset:Q}},[se,ee,ae,U,Ce,a]),Me=tt.scrollHeight,je=tt.start,We=tt.end,Xt=tt.offset;Pe.current.start=je,Pe.current.end=We;var Kr=v.useState({width:0,height:a}),Kt=Y(Kr,2),me=Kt[0],Zr=Kt[1],Jr=function(O){Zr({width:O.width||O.offsetWidth,height:O.height||O.offsetHeight})},Zt=h.useRef(),Jt=h.useRef(),en=v.useMemo(function(){return Sr(me.width,E)},[me.width,E]),tn=v.useMemo(function(){return Sr(me.height,Me)},[me.height,Me]),Nt=Me-a,Pt=h.useRef(Nt);Pt.current=Nt;function rn(b){var O=b;return Number.isNaN(Pt.current)||(O=Math.min(O,Pt.current)),O=Math.max(O,0),O}var er=ae<=0,tr=ae>=Nt,nn=Yr(er,tr),Mt=function(){return{x:X?-z:z,y:ae}},wt=h.useRef(Mt()),At=gr(function(){if(w){var b=Mt();(wt.current.x!==b.x||wt.current.y!==b.y)&&(w(b),wt.current=b)}});function rr(b,O){var M=b;O?(Ut.flushSync(function(){W(M)}),At()):Re(M)}function on(b){var O=b.currentTarget.scrollTop;O!==ae&&Re(O),R==null||R(b),At()}var Lt=function(O){var M=O,Q=E?E-me.width:0;return M=Math.max(M,0),M=Math.min(M,Q),M},sn=gr(function(b,O){O?(Ut.flushSync(function(){W(function(M){var Q=M+(X?-b:b);return Lt(Q)})}),At()):Re(function(M){var Q=M+b;return Q})}),an=ao(ee,er,tr,!!E,sn),nr=Y(an,2),Dt=nr[0],ir=nr[1];uo(ee,Fe,function(b,O){return nn(b,O)?!1:(Dt({preventDefault:function(){},deltaY:b}),!0)}),Ge(function(){function b(M){ee&&M.preventDefault()}var O=Fe.current;return O.addEventListener("wheel",Dt),O.addEventListener("DOMMouseScroll",ir),O.addEventListener("MozMousePixelScroll",b),function(){O.removeEventListener("wheel",Dt),O.removeEventListener("DOMMouseScroll",ir),O.removeEventListener("MozMousePixelScroll",b)}},[ee]),Ge(function(){E&&W(function(b){return Lt(b)})},[me.width,E]);var or=function(){var O,M;(O=Zt.current)===null||O===void 0||O.delayHidden(),(M=Jt.current)===null||M===void 0||M.delayHidden()},sr=io(Fe,U,q,i,j,function(){return re(!0)},Re,or);v.useImperativeHandle(t,function(){return{getScrollInfo:Mt,scrollTo:function(O){function M(Q){return Q&&fe(Q)==="object"&&("left"in Q||"top"in Q)}M(O)?(O.left!==void 0&&W(Lt(O.left)),sr(O.top)):sr(O)}}}),Ge(function(){if(C){var b=U.slice(je,We+1);C(b,U)}},[je,We,U]);var ln=fo(U,j,q,i),un=D==null?void 0:D({start:je,end:We,virtual:se,offsetX:z,offsetY:Xt,rtl:X,getSize:ln}),cn=Ji(U,je,We,E,G,d,Ct),Ve=null;a&&(Ve=te(Z({},l?"height":"maxHeight",a),po),ee&&(Ve.overflowY="hidden",E&&(Ve.overflowX="hidden"),Be&&(Ve.pointerEvents="none")));var ar={};return X&&(ar.dir="rtl"),v.createElement("div",Ye({style:te(te({},u),{},{position:"relative"}),className:He},ar,$),v.createElement(qt,{onResize:Jr},v.createElement(y,{className:"".concat(n,"-holder"),style:Ve,ref:Fe,onScroll:on,onMouseEnter:or},v.createElement(zr,{prefixCls:n,height:Me,offsetX:z,offsetY:Xt,scrollWidth:E,onInnerResize:re,ref:Ie,innerProps:x,rtl:X,extra:un},cn))),se&&Me>a&&v.createElement(pr,{ref:Zt,prefixCls:n,scrollOffset:ae,scrollRange:Me,rtl:X,onScroll:rr,onStartMove:Ke,onStopMove:Ze,spinSize:tn,containerSize:me.height,style:T==null?void 0:T.verticalScrollBar,thumbStyle:T==null?void 0:T.verticalScrollBarThumb}),se&&E>me.width&&v.createElement(pr,{ref:Jt,prefixCls:n,scrollOffset:z,scrollRange:E,rtl:X,onScroll:rr,onStartMove:Ke,onStopMove:Ze,spinSize:en,containerSize:me.width,horizontal:!0,style:T==null?void 0:T.horizontalScrollBar,thumbStyle:T==null?void 0:T.horizontalScrollBarThumb}))}var Xr=v.forwardRef(vo);Xr.displayName="List";function go(e){const{model:t}=e,r=ze.useDependency(_.LocaleService),n=L.useObservable(t.searchString$,"",!0),o=L.useObservable(t.filterItems$,void 0,!0),a=r.t("sheets-filter.panel.filter-only"),i=xt(o),s=i.checked>0&&i.unchecked===0,l=i.checked>0&&i.unchecked>0,u=h.useCallback((m,S)=>{t.onFilterCheckToggled(m,S)},[t]),f=h.useCallback(m=>{t.onFilterOnly(m)},[t]),d=h.useCallback(()=>{t.onCheckAllToggled(!s)},[t,s]),p=h.useCallback(m=>{t.setSearchString(m)},[t]);return h.createElement("div",{className:B.sheetsFilterPanelValuesContainer},h.createElement(K.Input,{value:n,placeholder:r.t("sheets-filter.panel.search-placeholder"),onChange:p}),h.createElement("div",{className:B.sheetsFilterPanelValuesList},h.createElement("div",{className:B.sheetsFilterPanelValuesItem},h.createElement("div",{className:B.sheetsFilterPanelValuesItemInner},h.createElement(K.Checkbox,{indeterminate:l,disabled:o.length===0,checked:s,onChange:d}),h.createElement("span",{className:B.sheetsFilterPanelValuesItemText},`${r.t("sheets-filter.panel.select-all")}`),h.createElement("span",{className:B.sheetsFilterPanelValuesItemCount},`(${i.checked}/${i.checked+i.unchecked})`))),h.createElement("div",{className:B.sheetsFilterPanelValuesVirtual},h.createElement(Xr,{style:{paddingRight:8},data:o,height:190,itemHeight:32,itemKey:m=>`${m.value}----${m.checked}`},m=>h.createElement("div",{className:B.sheetsFilterPanelValuesItem},h.createElement("div",{className:B.sheetsFilterPanelValuesItemInner},h.createElement(K.Checkbox,{checked:m.checked,onChange:()=>u(m,!m.checked)}),h.createElement("span",{className:B.sheetsFilterPanelValuesItemText},m.value),h.createElement("span",{className:B.sheetsFilterPanelValuesItemCount},`(${m.count})`),h.createElement(K.Button,{className:B.sheetsFilterPanelValuesItemExcludeButton,size:"small",type:"link",onClick:()=>f(m)},a)))))))}function _o(){const e=ze.useDependency(be),t=ze.useDependency(_.LocaleService),r=ze.useDependency(_.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$)||P.of(!1),void 0,!1,[o]),i=So(t),s=!L.useObservable(e.hasCriteria$),l=h.useCallback(p=>{r.executeCommand(Mr.id,{filterBy:p})},[r]),u=h.useCallback(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(Qe.id)},[o,r]),f=h.useCallback(()=>{r.executeCommand(Qe.id)},[r]),d=h.useCallback(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(Qe.id)},[o,r]);return h.createElement("div",{className:B.sheetsFilterPanel},h.createElement("div",{className:B.sheetsFilterPanelHeader},h.createElement(K.Segmented,{value:n,options:i,onChange:p=>l(p)})),o?h.createElement("div",{className:B.sheetsFilterPanelContent},n===ut.VALUES?h.createElement(go,{model:o}):h.createElement(ti,{model:o})):null,h.createElement("div",{className:B.sheetsFilterPanelFooter},h.createElement(K.Button,{type:"link",onClick:u,disabled:s},t.t("sheets-filter.panel.clear-filter")),h.createElement("span",{className:B.sheetsFilterPanelFooterPrimaryButtons},h.createElement(K.Button,{type:"default",onClick:f},t.t("sheets-filter.panel.cancel")),h.createElement(K.Button,{disabled:!a,type:"primary",onClick:d},t.t("sheets-filter.panel.confirm")))))}function So(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{label:e.t("sheets-filter.panel.by-values"),value:ut.VALUES},{label:e.t("sheets-filter.panel.by-conditions"),value:ut.CONDITIONS}],[t,e])}const Eo={id:Xe.id,binding:L.KeyCode.L|L.MetaKeys.CTRL_COMMAND|L.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:ve.whenSheetEditorFocused,group:"4_sheet-edit"};function yo(e){const t=e.get(c.SheetsFilterService);return{id:Xe.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,_.UniverInstanceType.UNIVER_SHEET),activated$:t.activeFilterModel$.pipe(P.map(r=>!!r))}}function bo(e){const t=e.get(c.SheetsFilterService);return{id:Cr.id,group:L.MenuGroup.TOOLBAR_OTHERS,type:L.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",positions:[Xe.id],hidden$:L.getMenuHiddenObservable(e,_.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(P.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(P.map(o=>!o)))!=null?n:P.of(!0)}))}}function Oo(e){const t=e.get(c.SheetsFilterService);return{id:Ir.id,group:L.MenuGroup.TOOLBAR_OTHERS,type:L.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",positions:[Xe.id],hidden$:L.getMenuHiddenObservable(e,_.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(P.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(P.map(o=>!o)))!=null?n:P.of(!0)}))}}var Fo=Object.defineProperty,Ro=Object.getOwnPropertyDescriptor,To=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ro(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&&Fo(t,r,o),o},Se=(e,t)=>(r,n)=>t(r,n,e);const Er="FILTER_PANEL_POPUP";let st=class extends _.RxDisposable{constructor(t,r,n,o,a,i,s,l){super();I(this,"_popupDisposable");this._injector=t,this._componentManager=r,this._sheetsFilterPanelService=n,this._sheetCanvasPopupService=o,this._shortcutService=a,this._commandService=i,this._menuService=s,this._contextService=l,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Eo].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_initCommands(){[Xe,Ae,Cr,Ir,Mr,Pr,Qe].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initMenuItems(){[yo,bo,Oo].forEach(t=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(t)))})}_initUI(){this.disposeWithMe(this._componentManager.register(Er,_o)),this.disposeWithMe(this._componentManager.register("FilterSingle",Tr)),this.disposeWithMe(this._contextService.subscribeContextValue$(Le).pipe(P.distinctUntilChanged()).subscribe(t=>{t?this._openFilterPopup():this._closeFilterPopup()}))}_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:Er,direction:"horizontal",closeOnSelfTarget:!0,onClickOutside:()=>this._commandService.syncExecuteCommand(Qe.id)})}_closeFilterPopup(){var t;(t=this._popupDisposable)==null||t.dispose(),this._popupDisposable=null}};st=To([_.OnLifecycle(_.LifecycleStages.Ready,st),Se(0,H.Inject(H.Injector)),Se(1,H.Inject(L.ComponentManager)),Se(2,H.Inject(be)),Se(3,H.Inject(ve.SheetCanvasPopManagerService)),Se(4,L.IShortcutService),Se(5,_.ICommandService),Se(6,L.IMenuService),Se(7,_.IContextService)],st);const Ee=16,Co=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 yr{static drawNoCriteria(t,r,n,o){t.save(),lt.Rect.drawWith(t,{radius:2,width:Ee,height:Ee,fill:o}),t.lineCap="square",t.strokeStyle=n,t.scale(r/Ee,r/Ee),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(),lt.Rect.drawWith(t,{radius:2,width:Ee,height:Ee,fill:o}),t.scale(r/Ee,r/Ee),t.fillStyle=n,t.fill(Co),t.restore()}}var Io=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Po=(e,t,r,n)=>{for(var o=n>1?void 0:n?No(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Io(t,r,o),o},$t=(e,t)=>(r,n)=>t(r,n,e);const pe=16,rt=1;let kt=class extends lt.Shape{constructor(t,r,n,o,a){super(t,r);I(this,"_cellWidth",0);I(this,"_cellHeight",0);I(this,"_filterParams");I(this,"_hovered",!1);this._contextService=n,this._commandService=o,this._themeService=a,this.setShapeProps(r),this.onPointerDownObserver.add(i=>this.onPointerDown(i)),this.onPointerEnterObserver.add(()=>this.onPointerEnter()),this.onPointerLeaveObserver.add(()=>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=pe-n,a=pe-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?yr.drawHasCriteria(t,pe,l,u):yr.drawNoCriteria(t,pe,l,u),t.restore()}onPointerDown(t){if(t.button===2)return;const{col:r,unitId:n,subUnitId:o}=this._filterParams;this._contextService.getContextValue(Le)||setTimeout(()=>{this._commandService.executeCommand(Pr.id,{unitId:n,subUnitId:o,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};kt=Po([$t(2,_.IContextService),$t(3,_.ICommandService),$t(4,H.Inject(_.ThemeService))],kt);var Mo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,Ao=(e,t,r,n)=>{for(var o=n>1?void 0:n?wo(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&&Mo(t,r,o),o},he=(e,t)=>(r,n)=>t(r,n,e);const Lo=1e3,Do=5e3;let at=class extends _.RxDisposable{constructor(t,r,n,o,a,i,s,l,u,f){super();I(this,"_filterRangeShape",null);I(this,"_buttonRenderDisposable",null);I(this,"_filterButtonShapes",[]);this._injector=t,this._sheetSkeletonManagerService=r,this._sheetsFilterService=n,this._themeService=o,this._sheetInterceptorService=a,this._sheetRenderController=i,this._commandService=s,this._univerInstanceService=l,this._renderManagerService=u,this._selectionRenderService=f,[c.SetSheetsFilterRangeMutation,c.SetSheetsFilterCriteriaMutation,c.RemoveSheetsFilterMutation,c.ReCalcSheetsFilterMutation].forEach(d=>this.disposeWithMe(this._sheetRenderController.registerSkeletonChangingMutations(d.id))),this._initRenderer()}_initRenderer(){this._sheetSkeletonManagerService.currentSkeleton$.pipe(P.switchMap(t=>{var s;if(!t)return P.of(null);const{unitId:r}=t,n=this._univerInstanceService.getUniverSheetInstance(r);if(!n)return P.of(null);const o=n.getActiveSheet().getSheetId(),a=(s=this._sheetsFilterService.getFilterModel(r,o))!=null?s:void 0,i=()=>({unitId:r,worksheetId:o,filterModel:a,range:a==null?void 0:a.getRange(),skeleton:t.skeleton});return _.fromCallback(this._commandService.onCommandExecuted).pipe(P.filter(([l])=>l.type===_.CommandType.MUTATION&&l.params.unitId===n.getUnitId()&&c.FILTER_MUTATIONS.has(l.id)),P.throttleTime(20,void 0,{leading:!1,trailing:!0}),P.map(i),P.startWith(i()))}),P.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.convertSelectionRangeToData({range:r,primary:null,style:null}),{rowHeaderWidth:l,columnHeaderHeight:u}=n,f=this._filterRangeShape=new ve.SelectionShape(a,Lo,!0,this._themeService);f.update(i,l,u,{hasAutoFill:!1,fill:"rgba(0, 0, 0, 0.0)",...s}),f.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:f,startRow:d}=r;for(let p=u;p<=f;p++){const m=`sheets-filter-button-${p}`,S=ve.getCoordByCell(d,p,l,a),{startX:E,startY:g,endX:y,endY:R}=S,w=y-E,C=R-g;if(C<=rt||w<=rt)continue;const x=!!n.getFilterColumn(p),D=y-pe-rt,T=R-pe-rt,$={left:D,top:T,height:pe,width:pe,cellHeight:C,cellWidth:w,filterParams:{unitId:o,subUnitId:i,col:p,hasCriteria:x}},j=this._injector.createInstance(kt,m,$);this._filterButtonShapes.push(j)}l.addObjects(this._filterButtonShapes,Do),l.makeDirty()}_interceptCellContent(t){const{startRow:r,startColumn:n,endColumn:o}=t;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(qe.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:pe}})}})}_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=[]}};at=Ao([_.OnLifecycle(_.LifecycleStages.Ready,at),he(0,H.Inject(H.Injector)),he(1,H.Inject(ve.SheetSkeletonManagerService)),he(2,H.Inject(c.SheetsFilterService)),he(3,H.Inject(_.ThemeService)),he(4,H.Inject(qe.SheetInterceptorService)),he(5,H.Inject(ve.SheetRenderController)),he(6,_.ICommandService),he(7,_.IUniverInstanceService),he(8,lt.IRenderManagerService),he(9,ve.ISelectionRenderService)],at);var Ho=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&&Ho(t,r,o),o},br=(e,t)=>(r,n)=>t(r,n,e);const xo="UNIVER_SHEETS_FILTER_UI_PLUGIN";var nt;exports.UniverSheetsFilterUIPlugin=(nt=class extends _.Plugin{constructor(t,r,n){super(),this._injector=r,this._localeService=n,this._localeService.load({zhCN:Or})}onStarting(t){[[be],[st],[at]].forEach(r=>t.add(r))}},I(nt,"type",_.UniverInstanceType.UNIVER_SHEET),I(nt,"pluginName",xo),nt);exports.UniverSheetsFilterUIPlugin=Uo([br(1,H.Inject(H.Injector)),br(2,H.Inject(_.LocaleService))],exports.UniverSheetsFilterUIPlugin);exports.enUS=gn;exports.zhCN=Or;