"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),s=require("react"),j=require("react-redux"),g=require("semantic-ui-react"),I=require("../reducers/data.js"),q=e=>{const{editing:o=!1,"data-group":t,onApply:a,"data-app":h="csv","data-label":m="Apply",filters:c,initialFilters:y,apply:u}=e,[d,f]=s.useState(!1),[S,b]=s.useState(y),x=(n,p)=>{for(let i in p){if(n[i].length!==p[i].length)return!0;for(let r=0;r<n[i].length;r++)if(n[i][r]!==p[i][r])return!0}return!1};return s.useEffect(()=>{const n=x(c,S);n&&f(n),b(c)},[c]),s.useEffect(()=>{u!=null&&f(!1)},[u]),l.jsxs(g.Container,{fluid:!0,className:`data-filters-apply ignore ${d?"":"disabled"} ${o?"editing":""}`,onClick:n=>{d&&a({app:h,group:t})},children:[l.jsx("span",{children:m}),l.jsx("span",{children:l.jsx(g.Icon,{name:"chevron circle right",className:"custom-apply-icon"})})]})},v=(e,o)=>{const{"data-group":t,"data-app":a="csv"}=o;return{apply:e.getIn(["data","filters-settings",a,t,"apply"]),filters:e.getIn(["data","filters",a,t])?e.getIn(["data","filters",a,t]).toJS():{},initialFilters:e.getIn(["data","filters","initial",a,t])?e.getIn(["data","filters","initial",a,t]).toJS():{}}},C={onApply:I.applyFilter},R=j.connect(v,C)(q);exports.default=R;
