module.exports=function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},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 n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},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=10)}([function(t,r){t.exports=flarum.core.compat["forum/app"]},function(t,r,e){t.exports=e(9)},function(t,r,e){"use strict";function n(){return(n=Object.assign||function(t){for(var r=1;r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=e.call(i,"catchLoc"),c=e.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),L(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;L(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:O(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,r,e){"use strict";e.r(r);var n=e(0),o=e.n(n),i=e(5),a=e.n(i),u=e(3);function c(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function s(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)}))}}var l=e(1),f=e.n(l),h=e(4),p=e.n(h),d=e(6),v=e.n(d),y=e(7),g=e.n(y),w=function(){function t(){this.results=new Map,this.type="discussions"}var r=t.prototype;return r.search=function(){var t=s(f.a.mark((function t(r){var e,n,i,a;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=r.toLowerCase(),this.results.set(r,[]),e={filter:{q:r},page:{limit:3},include:"mostRelevantPost"},n=o.a.forum.attribute("apiUrl")+"/blomstra/search/"+this.type,t.next=6,o.a.request({params:e,url:n,method:"GET"});case 6:i=t.sent,a=o.a.store.pushPayload(i),this.results.set(r,a);case 9:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),r.view=function(t){var r=this;t=t.toLowerCase();var e=(this.results.get(t)||[]).map((function(e){var n=e.mostRelevantPost();return m("li",{className:"DiscussionSearchResult","data-index":""+r.type+e.id(),key:""+r.type+e.id()},m(g.a,{href:o.a.route.discussion(e,n&&n.number())},m("div",{className:"DiscussionSearchResult-title"},p()(e.title(),t)),!!n&&m("div",{className:"DiscussionSearchResult-excerpt"},p()(n.contentPlain(),t,100))))}));return m("[",null,m("li",{className:"Dropdown-header"},o.a.translator.trans("core.forum.search.discussions_heading")),m("li",null,m(v.a,{icon:"fas fa-search",href:o.a.route("index",{q:t})},o.a.translator.trans("core.forum.search.all_discussions_button",{query:t}))),e)},t}(),b=e(2),x=e(8),L=e.n(x);o.a.initializers.add("blomstra-search",(function(){Object(u.extend)(a.a.prototype,"sourceItems",(function(t){t.remove("users"),t.remove("discussions"),t.add("discussions",new w)})),Object(u.override)(L.a.prototype,"loadPage",function(){var t=s(f.a.mark((function t(r,e){var n,i,a,u,c;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e&&(e=1),null!=(n=this.requestParams().q)&&n.length){t.next=3;break}return t.abrupt("return",r.call(this,e));case 3:return(i=this.requestParams()).page=Object(b.a)({offset:this.pageSize*(e-1)},i.page),Array.isArray(i.include)&&(i.include=i.include.join(",")),a=o.a.forum.attribute("apiUrl")+"/blomstra/search/"+this.type,t.next=9,o.a.request({params:i,url:a,method:"GET"});case 9:return u=t.sent,c=o.a.store.pushPayload(u),t.abrupt("return",c);case 12:case"end":return t.stop()}}),t,this)})));return function(r,e,n){return t.apply(this,arguments)}}())}))}]); //# sourceMappingURL=forum.js.map