"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),g=require("react"),f=require("react-redux"),m=require("react-intl"),x=require("./DataContext.js"),S=require("../reducers/data.js"),a=require("semantic-ui-react");class j extends g.Component{componentDidMount(){const{categories:e}=this.props;!e&&!this.props.loading&&this.props.onLoadData(this.props)}componentDidUpdate(e,i,c){const{app:s,filters:n,source:r,store:l,params:d,csv:p,group:u,editing:h}=this.props;(n!=e.filters||JSON.stringify(d)!=JSON.stringify(e.params)||s!=e.app||e.source!=r||p!=e.csv)&&(s==="csv"?this.props.onSetData({app:s,csv:p,store:l,params:d,group:u}):(h&&(d.v=(Math.random()+1).toString(36).substring(7)),this.setState({showLoading:!1}),this.props.onLoadData(this.props),setTimeout(this.checkLoadingTime,100)))}render(){const{data:e,loading:i,error:c}=this.props;return i?t.jsx(a.Container,{}):e?t.jsx(x.CategoriesContext.Provider,{value:e.toJS(),children:this.props.children}):c?t.jsxs(a.Segment,{color:"red",children:[t.jsx("h1",{children:"500"}),t.jsx("p",{children:"Wasn't able to load data"})]}):t.jsx(a.Container,{children:t.jsxs(a.Segment,{color:"red",children:[t.jsx("h1",{children:"404"}),t.jsx("p",{children:"Can't find this page"})]})})}}const C=(o,e)=>{const{app:i,params:c,dvzProxyDatasetId:s,uniqueStorage:n}=e,r=["data","categories",i];return s&&r.push(s),n&&r.push(n),{data:o.getIn([...r,"items"]),error:o.getIn([...r,"error"]),loading:o.getIn([...r,"loading"])}},D={onLoadData:S.getCategories},q=f.connect(C,D)(m.injectIntl(j));exports.default=q;
