function z(e,o=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(o)}function E(e,o=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(o)}function I(e,o="expected all items to be functions, instead received the following types: "){if(!e.every(s=>typeof s=="function")){const s=e.map(t=>typeof t=="function"?`function ${t.name||"unnamed"}()`:typeof t).join(", ");throw new TypeError(`${o}[${s}]`)}}var R=e=>Array.isArray(e)?e:[e];function x(e){const o=Array.isArray(e[0])?e[0]:e;return I(o,"createSelector expects all input-selectors to be functions, but received the following types: "),o}function L(e,o){const s=[],{length:t}=e;for(let r=0;r<t;r++)s.push(e[r].apply(null,o));return s}var O=class{constructor(e){this.value=e}deref(){return this.value}},$=typeof WeakRef<"u"?WeakRef:O,D=0,C=1;function v(){return{s:D,v:void 0,o:null,p:null}}function S(e,o={}){let s=v();const{resultEqualityCheck:t}=o;let r,a=0;function c(){var g;let n=s;const{length:d}=arguments;for(let p=0,m=d;p<m;p++){const f=arguments[p];if(typeof f=="function"||typeof f=="object"&&f!==null){let l=n.o;l===null&&(n.o=l=new WeakMap);const y=l.get(f);y===void 0?(n=v(),l.set(f,n)):n=y}else{let l=n.p;l===null&&(n.p=l=new Map);const y=l.get(f);y===void 0?(n=v(),l.set(f,n)):n=y}}const u=n;let i;if(n.s===C)i=n.v;else if(i=e.apply(null,arguments),a++,t){const p=((g=r==null?void 0:r.deref)==null?void 0:g.call(r))??r;p!=null&&t(p,i)&&(i=p,a!==0&&a--),r=typeof i=="object"&&i!==null||typeof i=="function"?new $(i):i}return u.s=C,u.v=i,i}return c.clearCache=()=>{s=v(),c.resetResultsCount()},c.resultsCount=()=>a,c.resetResultsCount=()=>{a=0},c}function F(e,...o){const s=typeof e=="function"?{memoize:e,memoizeOptions:o}:e,t=(...r)=>{let a=0,c=0,n,d={},u=r.pop();typeof u=="object"&&(d=u,u=r.pop()),z(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const i={...s,...d},{memoize:g,memoizeOptions:p=[],argsMemoize:m=S,argsMemoizeOptions:f=[]}=i,l=R(p),y=R(f),b=x(r),A=g(function(){return a++,u.apply(null,arguments)},...l),j=m(function(){c++;const k=L(b,arguments);return n=A.apply(null,k),n},...y);return Object.assign(j,{resultFunc:u,memoizedResultFunc:A,dependencies:b,dependencyRecomputations:()=>c,resetDependencyRecomputations:()=>{c=0},lastResult:()=>n,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:g,argsMemoize:m})};return Object.assign(t,{withTypes:()=>t}),t}var w=F(S),W=Object.assign((e,o=w)=>{E(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const s=Object.keys(e),t=s.map(a=>e[a]);return o(t,(...a)=>a.reduce((c,n,d)=>(c[s[d]]=n,c),{}))},{withTypes:()=>W});const h=e=>e.article,M=e=>h(e).entities,K=e=>h(e).currentArticle,P=e=>h(e).isLoading,q=e=>h(e).filters,U=e=>h(e).error,V=w([M],e=>{const o=e.flatMap(t=>t.tags);return Array.from(new Set(o)).map(t=>({id:t,label:t}))}),T=e=>{const[o,s,t]=e.split(".").map(Number);return new Date(t,s-1,o).getTime()},B=w([M,q],(e,o)=>{const{search:s,category:t,tags:r}=o,a=s.toLowerCase();return e.filter(c=>{const n=t==="all"||c.category===t,d=c.title.toLowerCase().includes(a)||c.description.toLowerCase().includes(a),u=r.length===0||r.every(i=>c.tags.includes(i));return n&&d&&u}).sort((c,n)=>T(n.createdAt)-T(c.createdAt))});export{V as a,M as b,K as c,P as d,U as e,B as f,q as g};