(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{557:function(e,t,r){"use strict";r.r(t);var a=r(5),c=r(16),n=r(14),i=r(11),o=r(33),s=r(237),p=r(6),b=r(7),l=r(9),u=r(8),y=r(10),O=r(0),h=r(3),j=r(87),f=r(55),g=r(37),d=r.n(g),v=r(1),m=r(45),P=function(e){function t(){return Object(p.a)(this,t),Object(l.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(y.a)(t,e),Object(b.a)(t,[{key:"getFilterActions",value:function(){var e=this.props,t=e.currentLibraryTypeKey,r=e.filterAll,a=e.getTypePath,c=e.libraryTypes,n=[{title:Object(v.__)("All"),href:r,isActive:!t}];return c&&Object.keys(c).forEach((function(e){n.push({title:c[e].label,href:a(e),isActive:t===e})})),n}},{key:"render",value:function(){var e=this.props,t=e.libraryTypes,r=e.currentLibraryTypeKey,a=e.renderSearch,c=e.searchDefault,n=Object(v.__)("Library"),i=Object(h.get)(t,r,{});return i.label&&(n+=" - ".concat(i.label)),Object(O.createElement)(m.a,{canAddItem:!1,filterActions:this.getFilterActions(),filterButton:Object(v.__)("Filter"),heading:n,renderSearch:a,searchButton:Object(v.__)("Search"),searchDefault:c,searchPlaceholder:Object(v.__)("Search Libraries")})}}]),t}(O.Component),w=r(42),S=function(e){var t=e.search;return Object(O.createElement)(w.a,{title:t?Object(v.sprintf)(Object(v.__)('No libraries found when searching for "%s"'),t.trim()):Object(v.__)("No libraries found.")})},_=r(295),T=r(81),E=r(54);function D(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}var k=function(e){return e.map((function(e){var t=e.id;return Object(O.createElement)(_.a,{key:"group-".concat(t),id:t})}))},A=function(e){function t(e){var r;return Object(p.a)(this,t),(r=Object(l.a)(this,Object(u.a)(t).call(this,e))).getQueryString=function(){return Object(h.isEmpty)(r.state.search)?"":"?".concat(Object(j.stringify)({s:r.state.search}))},r.renderSearch=function(e){r.setState({search:e},(function(){var e=r.getQueryString(),t=d.a.location.pathname.replace(/(page\/[0-9]*)/g,"page/1");Object(h.isEmpty)(e)?d.a.replace(t):d.a.replace(t+e)}))},r.getBasePath=function(){var e=r.props.libraryType,t="/libraries";return e&&(t="".concat(t,"/type/").concat(e)),t},r.initialSearch=Object(f.getQueryArg)(document.location.search,"s")||"",r.state={search:r.initialSearch},r}return Object(y.a)(t,e),Object(b.a)(t,[{key:"render",value:function(){var e=this.props,t=e.libraryType,r=e.libraryTypes,c=e.getTypePath,n=e.location,i=e.page,o=e.queryParams,s=e.receiveGroups,p=this.state.search,b=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?D(Object(r),!0).forEach((function(t){Object(a.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):D(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},o),l=this.getBasePath();i&&(b.page=i),p&&(b.search=p),t&&(b.library_type=t);var u=Object(O.createElement)(S,{search:p});return Object(O.createElement)("div",null,Object(O.createElement)(P,{currentLibraryTypeKey:t,filterAll:"/libraries",getTypePath:c,libraryTypes:r,location:n,renderSearch:this.renderSearch,searchDefault:this.initialSearch}),Object(O.createElement)(E.a,{addHash:this.getQueryString(),className:"groups grid grid-large-4",path:"/wp-json/dekode-intranet/v1/groups",query:b,render:k,loader:Object(O.createElement)(T.a,null),noPosts:u,paginationPath:l,dispatch:s}))}}]),t}(O.Component);function L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}t.default=Object(c.d)(i.withRouter,Object(n.b)((function(e,t){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){Object(a.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},function(e,t){var r=t.match.params,a=r.libraryType,c=r.page,n=void 0===c?1:c;return{libraryType:a,libraryTypes:Object(s.a)(e,"nb-library",!1).types,page:n}}(e,t),{queryParams:{group_type:"library",per_page:24},getTypePath:function(e){return"/libraries/type/".concat(e)}})}),(function(e){return Object(c.b)({receiveGroups:o.p},e)})))(A)}}]);