text: module.exports=function(t){var r={};function e(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=t,e.c=r,e.d=function(t,r,o){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var n in t)e.d(o,n,function(r){return t[r]}.bind(null,n));return o},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=23)}([function(t,r){t.exports=flarum.core.compat["forum/app"]},function(t,r,e){"use strict";e.d(r,"a",(function(){return o}));var o=function(){function t(){}return t.prototype.sortMap=function(){return{username_az:"username",username_za:"-username",newest:"-joinedAt",oldest:"joinedAt",most_discussions:"-discussionCount",least_discussions:"discussionCount"}},t}()},function(t,r){t.exports=flarum.core.compat["common/components/Button"]},function(t,r){t.exports=flarum.core.compat["common/Component"]},function(t,r){t.exports=flarum.core.compat["common/utils/ItemList"]},function(t,r){t.exports=flarum.core.compat["common/components/LinkButton"]},function(t,r){t.exports=flarum.core.compat["forum/components/UserCard"]},function(t,r){t.exports=flarum.core.compat["common/helpers/listItems"]},function(t,r){t.exports=flarum.core.compat["forum/components/IndexPage"]},function(t,r){t.exports=flarum.core.compat["common/extend"]},function(t,r){t.exports=flarum.core.compat["common/components/UsersSearchSource"]},function(t,r){t.exports=flarum.core.compat["common/components/IndexPage"]},function(t,r){t.exports=flarum.core.compat["common/components/Page"]},function(t,r){t.exports=flarum.core.compat["common/components/Select"]},function(t,r){t.exports=flarum.core.compat["common/components/SelectDropdown"]},function(t,r){t.exports=flarum.core.compat["common/components/Dropdown"]},function(t,r){t.exports=flarum.core.compat["common/components/LoadingIndicator"]},function(t,r){t.exports=flarum.core.compat["common/components/Placeholder"]},function(t,r){t.exports=flarum.core.compat["common/utils/humanTime"]},function(t,r){t.exports=flarum.core.compat["common/helpers/icon"]},function(t,r){t.exports=flarum.core.compat["common/utils/withAttr"]},function(t,r){t.exports=flarum.core.compat["common/components/Separator"]},,function(t,r,e){"use strict";e.r(r),e.d(r,"UserDirectoryPage",(function(){return rt})),e.d(r,"UserDirectoryList",(function(){return E})),e.d(r,"UserDirectoryListItem",(function(){return T})),e.d(r,"UserDirectoryState",(function(){return K})),e.d(r,"SortMap",(function(){return J.a})),e.d(r,"CheckableButton",(function(){return W})),e.d(r,"components",(function(){return et}));var o=e(9),n=e(0),s=e.n(n),a=e(10),i=e.n(a),u=e(5),c=e.n(u),l=e(11),p=e.n(l);function f(t,r){return(f=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function d(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,f(t,r)}var h=e(12),y=e.n(h),v=e(4),b=e.n(v),g=e(7),x=e.n(g),P=e(8),_=e.n(P),S=e(13),N=e.n(S),w=e(2),I=e.n(w),D=e(14),j=e.n(D),B=e(15),C=e.n(B),U=e(3),k=e.n(U),F=e(16),q=e.n(F),G=e(17),O=e.n(G),L=e(6),M=e.n(L),A=e(18),R=e.n(A),z=function(t){function r(){return t.apply(this,arguments)||this}return d(r,t),r.prototype.infoItems=function(){var t=new b.a,r=this.attrs.user;return t.add("joined",app.translator.trans("core.forum.user.joined_date_text",{ago:R()(r.joinTime())})),t},r}(M.a),T=function(t){function r(){return t.apply(this,arguments)||this}return d(r,t),r.prototype.view=function(t){var r=this.attrs,e=r.user,o=r.useSmallCards,n={user:e,className:"UserCard--directory"+(o?" UserCard--small":""),controlsButtonClassName:"Button Button--icon Button--flat"};return m("div",{className:"User"},o?z.component(n):M.a.component(n))},r}(k.a),E=function(t){function r(){return t.apply(this,arguments)||this}return d(r,t),r.prototype.view=function(){var t,r=this.attrs.state,e=r.getParams(),o=s.a.forum.attribute("userDirectorySmallCards");if(r.isLoading()?t=q.a.component():r.moreResults&&(t=I.a.component({className:"Button",onclick:r.loadMore.bind(r)},s.a.translator.trans("fof-user-directory.forum.page.load_more_button"))),r.empty()){var n=s.a.translator.trans("fof-user-directory.forum.page.empty_text");return m("div",{className:"DiscussionList"},O.a.component({text:n}))}return m("div",{className:"UserDirectoryList"+(r.isSearchResults()?" UserDirectoryList--searchResults":"")+(o?" UserDirectoryList--small-cards":"")},m("ul",{className:"UserDirectoryList-users"},r.users.map((function(t){return m("li",{key:t.id(),"data-id":t.id()},T.component({user:t,params:e,useSmallCards:o}))}))),m("div",{className:"UserDirectoryList-loadMore"},t))},r}(k.a);function H(){return(H=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t}).apply(this,arguments)}var J=e(1),K=function(){function t(t,r){void 0===t&&(t={}),void 0===r&&(r=window.app),this.params=t,this.app=r,this.users=[],this.moreResults=!1,this.loading=!1,this.qBuilder={}}var r=t.prototype;return r.requestParams=function(){var t={include:[],filter:{}},r=this.params.sort||app.forum.attribute("userDirectoryDefaultSort");return t.sort=this.sortMap()[r],this.params.q&&(t.filter.q=this.params.q),t},r.sortMap=function(){return H({default:""},(new J.a).sortMap())},r.getParams=function(){return this.params},r.clear=function(){this.users=[],m.redraw()},r.refreshParams=function(t){var r=this;this.hasUsers()&&!Object.keys(t).some((function(e){return r.getParams()[e]!==t[e]}))||(this.params=t,Object.assign(this.qBuilder,t.qBuilder||{}),this.params.q=Object.values(this.qBuilder).join(" ").trim(),this.refresh())},r.refresh=function(){var t=this;return this.loading=!0,this.clear(),this.loadResults().then((function(r){t.users=[],t.parseResults(r)}),(function(){t.loading=!1,m.redraw()}))},r.loadResults=function(t){var r=this.app.preloadedApiDocument();if(r)return Promise.resolve(r);var e=this.requestParams();return e.page={offset:t},e.include=e.include.join(","),this.app.store.find("users",e)},r.loadMore=function(){this.loading=!0,this.loadResults(this.users.length).then(this.parseResults.bind(this))},r.parseResults=function(t){var r;return(r=this.users).push.apply(r,t),this.loading=!1,this.moreResults=!!t.payload.links&&!!t.payload.links.next,m.redraw(),t},r.hasUsers=function(){return this.users.length>0},r.isLoading=function(){return this.loading},r.isSearchResults=function(){return!!this.params.q},r.empty=function(){return!this.hasUsers()&&!this.isLoading()},t}(),Q=e(19),V=e.n(Q),W=function(t){function r(){return t.apply(this,arguments)||this}return d(r,t),r.prototype.getButtonContent=function(r){var e=t.prototype.getButtonContent.call(this,r);return this.attrs.checked&&e.push(V()("fas fa-check",{className:"Button-icon ButtonCheck"})),e},r}(I.a),X=e(20),Y=e.n(X),Z=function(t){function r(){return t.apply(this,arguments)||this}d(r,t);var e=r.prototype;return e.oninit=function(r){t.prototype.oninit.call(this,r)},e.view=function(){var t=this;return m("div",{className:"Form-group Usersearchbox"},m("input",{className:"FormControl",placeholder:s.a.translator.trans("fof-user-directory.forum.search.field.placeholder"),value:this.filter,oninput:Y()("value",(function(r){t.filter=r,t.performNewSearch()}))}))},e.performNewSearch=function(){this.attrs.state.refreshParams(H({},this.attrs.state.getParams(),{qBuilder:{filter:this.filter}}))},r}(k.a),$=e(21),tt=e.n($),rt=function(t){function r(){return t.apply(this,arguments)||this}d(r,t);var e=r.prototype;return e.oninit=function(r){t.prototype.oninit.call(this,r),this.state=new K({}),this.state.refreshParams(s.a.search.params()),this.bodyClass="User--directory";var e=[];this.params().q&&Array.from(this.params().q.matchAll(/group:([\d,]+)/g)).forEach((function(t){e.push(t[1])})),this.enabledGroupFilters=e.join(",").split(",").filter((function(t){return t})),this.enabledSpecialGroupFilters=[],s.a.history.push("users",s.a.translator.trans("fof-user-directory.forum.header.back_to_user_directory_tooltip"))},e.view=function(){return m("div",{className:"IndexPage"},_.a.prototype.hero(),m("div",{className:"container"},m("div",{className:"sideNavContainer"},m("nav",{className:"IndexPage-nav sideNav"},m("ul",null,x()(this.sidebarItems().toArray()))),m("div",{className:"IndexPage-results sideNavOffset"},m("div",{className:"IndexPage-toolbar"},m("ul",{className:"IndexPage-toolbar-view"},x()(this.viewItems().toArray())),m("ul",{className:"IndexPage-toolbar-action"},x()(this.actionItems().toArray()))),m(E,{state:this.state})))))},e.sidebarItems=function(){var t=_.a.prototype.sidebarItems();return t.replace("nav",j.a.component({buttonClassName:"Button",className:"App-titleControl"},this.navItems().toArray())),t},e.navItems=function(){var t=_.a.prototype.navItems(),r=this.stickyParams();return t.add("fof-user-directory",c.a.component({href:s.a.route("fof_user_directory",r),icon:"far fa-address-book"},s.a.translator.trans("fof-user-directory.forum.page.nav")),85),t},e.viewItems=function(){var t=new b.a,r=this.state.sortMap(),e={};for(var o in r)e[o]=s.a.translator.trans("fof-user-directory.lib.sort."+o);return t.add("sort",N.a.component({options:e,value:this.state.getParams().sort||s.a.forum.attribute("userDirectoryDefaultSort"),onchange:this.changeParams.bind(this)})),t.add("filterGroups",C.a.component({caretIcon:"fas fa-filter",label:s.a.translator.trans("fof-user-directory.forum.page.filter_button"),buttonClassName:"FormControl",className:"GroupFilterDropdown"},this.groupItems().toArray())),t.add("search",Z.component({state:this.state})),t},e.groupItems=function(){var t=this,r=new b.a;return s.a.store.all("groups").filter((function(t){return"2"!==t.id()&&"3"!==t.id()})).forEach((function(e){r.add(e.namePlural(),W.component({className:"GroupFilterButton",icon:e.icon(),checked:t.enabledGroupFilters.includes(e.id()),onclick:function(){var r=e.id();t.enabledGroupFilters.includes(r)?t.enabledGroupFilters=t.enabledGroupFilters.filter((function(t){return t!=r})):t.enabledGroupFilters.push(r),t.changeParams(t.params().sort)}},e.namePlural()))})),s.a.initializers.has("flarum-suspend")&&s.a.forum.attribute("hasSuspendPermission")&&(r.add("suspend",W.component({className:"GroupFilterButton",icon:"fas fa-ban",checked:"is:suspended"===this.enabledSpecialGroupFilters["flarum-suspend"],onclick:function(){var r="flarum-suspend";"is:suspended"===t.enabledSpecialGroupFilters[r]?t.enabledSpecialGroupFilters[r]="":t.enabledSpecialGroupFilters[r]="is:suspended",t.changeParams(t.params().sort)}},s.a.translator.trans("flarum-suspend.forum.user_badge.suspended_tooltip")),90),r.add("seperator",tt.a.component(),50)),r},e.actionItems=function(){var t=this,r=new b.a;return r.add("refresh",I.a.component({title:s.a.translator.trans("fof-user-directory.forum.page.refresh_tooltip"),icon:"fas fa-sync",className:"Button Button--icon",onclick:function(){t.state.refresh(),s.a.session.user&&(s.a.store.find("users",s.a.session.user.id()),m.redraw())}})),r},e.changeParams=function(t){var r=this.params();t===s.a.forum.attribute("userDirectoryDefaultSort")?delete r.sort:r.sort=t;var e="";for(var o in this.enabledSpecialGroupFilters)e+=this.enabledSpecialGroupFilters[o]+" ";this.enabledGroupFilters.length>0?r.qBuilder={groups:"group:"+this.enabledGroupFilters.join(",")}:r.qBuilder={groups:"",q:e.trim()},this.state.refreshParams(r)},e.stickyParams=function(){return{sort:m.route.param("sort"),q:m.route.param("q")}},e.params=function(){return this.stickyParams()},r}(y.a),et={CheckableButton:W,SearchField:Z,SmallUserCard:z,UserDirectoryList:E,UserDirectoryListItem:T,UserDirectoryPage:rt};s.a.initializers.add("fof-user-directory",(function(t){t.routes.fof_user_directory={path:"/users",component:rt},Object(o.extend)(i.a.prototype,"view",(function(r,e){r&&!t.forum.attribute("userDirectoryDisableGlobalSearchSource")&&(e=e.toLowerCase(),r.splice(1,0,m("li",c.a.component({href:t.route("fof_user_directory",{q:e}),icon:"fas fa-search"},t.translator.trans("fof-user-directory.forum.search.users_heading",{query:e})))))})),Object(o.extend)(p.a.prototype,"navItems",(function(r){t.forum.attribute("canSeeUserDirectoryLink")&&r.add("fof-user-directory",c.a.component({href:t.route("fof_user_directory"),icon:"far fa-address-book"},t.translator.trans("fof-user-directory.forum.page.nav")),85)}))}))}]);
  //# sourceMappingURL=forum.js.map