diff --git a/extensions/mentions/js/dist/forum.js b/extensions/mentions/js/dist/forum.js
index e2670b411..e1a66e476 100644
--- a/extensions/mentions/js/dist/forum.js
+++ b/extensions/mentions/js/dist/forum.js
@@ -1,2 +1,2 @@
-(()=>{var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e),t.d(e,{filterPostMentions:()=>Pt,filterUserMentions:()=>wt});var n={};t.r(n),t.d(n,{default:()=>R,insertMention:()=>L});var o={};t.r(o),t.d(o,{filterPostMentions:()=>Pt,filterUserMentions:()=>wt});const r=flarum.core.compat["common/extend"],s=flarum.core.compat["forum/app"];var i=t.n(s);const a=flarum.core.compat["forum/components/NotificationGrid"];var u=t.n(a);const c=flarum.core.compat["common/utils/string"],f=flarum.core.compat["forum/components/CommentPost"];var l=t.n(f);const d=flarum.core.compat["forum/components/PostPreview"];var p=t.n(d);const h=flarum.core.compat["common/components/LoadingIndicator"];var v=t.n(h);const g=flarum.core.compat["common/Model"];var y=t.n(g);const b=flarum.core.compat["common/models/Post"];var w=t.n(b);const P=flarum.core.compat["common/components/Link"];var x=t.n(P);const C=flarum.core.compat["common/helpers/punctuateSeries"];var M=t.n(C);const T=flarum.core.compat["common/helpers/username"];var _=t.n(T);const B=flarum.core.compat["common/helpers/icon"];var A=t.n(B);const k=flarum.core.compat["common/components/Button"];var N=t.n(k);const S=flarum.core.compat["forum/utils/DiscussionControls"];var H=t.n(S);const D=flarum.core.compat["forum/components/EditPostComposer"];var I=t.n(D);const U=flarum.core.compat["common/utils/extractText"];var j=t.n(U),E=function(){return j()(i().translator.trans("core.lib.username.deleted_text"))};function W(t,e){return void 0===e&&(e=!0),t?((e?t.displayName():t.username())||E()).replace(/"#[a-z]{0,3}[0-9]+/,"_"):E().replace(/"#[a-z]{0,3}[0-9]+/,"_")}function O(t,e){return void 0===e?i().forum.attribute("allowUsernameMentionFormat")?"@"+W(t,!1):'@"'+W(t)+'"#'+t.id():'@"'+W(t)+'"#p'+e}function L(t,e,n){return new Promise((function(o){var r=O(t.user(),t.id())+" ";e.fields.content()||(e.body.attrs.originalContent=r);var s=e.editor.getSelectionRange()[0],i=e.fields.content().slice(0,s),a=0==i.length?0:3-i.match(/(\n{0,2})$/)[0].length;return e.editor.insertAtCursor(Array(a).join("\n")+(n?"> "+r+n.trim().replace(/\n/g,"\n> ")+"\n\n":r),!1),o(e)}))}function R(t,e){return i().composer.bodyMatches(I())&&i().composer.body.attrs.post.discussion()===t.discussion()?L(t,i().composer,e):H().replyAction.call(t.discussion()).then((function(n){return L(t,n,e)}))}function q(t,e){return q=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},q(t,e)}function J(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,q(t,e)}const F=flarum.core.compat["common/Fragment"];var z=t.n(F),Q=function(t){function e(e){var n;return(n=t.call(this)||this).post=e,n}J(e,t);var n=e.prototype;return n.view=function(){var t=this;return m("button",{class:"Button PostQuoteButton",onclick:function(){R(t.post,t.content)}},A()("fas fa-quote-left",{className:"Button-icon"}),i().translator.trans("flarum-mentions.forum.post.quote_button"))},n.show=function(t,e){var n=this.$().show(),o=n.offsetParent().offset();n.css("left",t-o.left).css("top",e-o.top),this.hideHandler=this.hide.bind(this),$(document).on("mouseup",this.hideHandler)},n.showStart=function(t,e){var n=this.$();this.show(t,$(window).scrollTop()+e-n.outerHeight()-5)},n.showEnd=function(t,e){var n=this.$();this.show(t-n.outerWidth(),$(window).scrollTop()+e+5)},n.hide=function(){this.$().hide(),$(document).off("mouseup",this.hideHandler)},e}(z());function X(t){var e=window.getSelection();if(null!=e&&e.rangeCount){var n=e.getRangeAt(0),o=n.commonAncestorContainer;if(t[0]===o||$.contains(t[0],o)){var r=$("<div>").append(n.cloneContents());return r.find("img.emoji").replaceWith((function(){return this.alt})),r.find("img").replaceWith((function(){return"![]("+this.src+")"})),r.find("a").replaceWith((function(){return"["+this.innerText+"]("+this.href+")"})),r.text()}}return""}const Y=flarum.core.compat["common/components/TextEditor"];var G=t.n(Y);const K=flarum.core.compat["common/components/TextEditorButton"];var V=t.n(K);const Z=flarum.core.compat["forum/components/ReplyComposer"];var tt=t.n(Z);const et=flarum.core.compat["common/helpers/avatar"];var nt=t.n(et);const ot=flarum.core.compat["common/helpers/highlight"];var rt=t.n(ot);const st=flarum.core.compat["forum/utils/KeyboardNavigatable"];var it=t.n(st);const at=flarum.core.compat["common/utils/throttleDebounce"];var ut=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return(e=t.call.apply(t,[this].concat(o))||this).items=[],e.active=!1,e.index=0,e.keyWasJustPressed=!1,e}J(e,t);var n=e.prototype;return n.view=function(){return m("ul",{className:"Dropdown-menu MentionsDropdown"},this.items.map((function(t){return m("li",null,t)})))},n.show=function(t,e){this.$().show().css({left:t+"px",top:e+"px"}),this.active=!0},n.hide=function(){this.$().hide(),this.active=!1},n.navigate=function(t){var e=this;this.keyWasJustPressed=!0,this.setIndex(this.index+t,!0),clearTimeout(this.keyWasJustPressedTimeout),this.keyWasJustPressedTimeout=setTimeout((function(){return e.keyWasJustPressed=!1}),500)},n.complete=function(){this.$("li").eq(this.index).find("button").click()},n.setIndex=function(t,e){if(!this.keyWasJustPressed||e){var n=this.$(),o=n.find("li"),r=t;r<0?r=o.length-1:r>=o.length&&(r=0),this.index=r;var s=o.removeClass("active").eq(r).addClass("active");if(e){var i,a=n.scrollTop(),u=n.offset().top,c=u+n.outerHeight(),m=s.offset().top,f=m+s.outerHeight();m<u?i=a-u+m-parseInt(n.css("padding-top"),10):f>c&&(i=a-c+f+parseInt(n.css("padding-bottom"),10)),void 0!==i&&n.stop(!0).animate({scrollTop:i},100)}}},e}(z()),ct=(0,at.throttle)(250,(function(t,e,n,o,r,s){var a=t.toLowerCase();e.includes(a)||(i().store.find("users",{filter:{q:t},page:{limit:5}}).then((function(t){t.forEach((function(t){o.has(t.id())||(o.add(t.id()),n.push(t))})),s()})),e.push(a))}));const mt=flarum.core.compat["forum/components/Notification"];var ft=t.n(mt),lt=function(t){function e(){return t.apply(this,arguments)||this}J(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-reply"},n.href=function(){var t=this.attrs.notification,e=t.subject(),n=t.content();return i().route.discussion(e.discussion(),n&&n.replyNumber)},n.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.post_mentioned_text",{user:t,count:1})},n.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain(),200)},e}(ft()),dt=function(t){function e(){return t.apply(this,arguments)||this}J(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-at"},n.href=function(){var t=this.attrs.notification.subject();return i().route.discussion(t.discussion(),t.number())},n.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.user_mentioned_text",{user:t})},n.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain(),200)},e}(ft());const pt=flarum.core.compat["forum/components/UserPage"];var ht=t.n(pt);const vt=flarum.core.compat["common/components/LinkButton"];var gt=t.n(vt);const yt=flarum.core.compat["forum/components/PostsUserPage"];var bt=function(t){function e(){return t.apply(this,arguments)||this}return J(e,t),e.prototype.loadResults=function(t){return i().store.find("posts",{filter:{type:"comment",mentioned:this.user.id()},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})},e}(t.n(yt)());function wt(t){var e;if(i().forum.attribute("allowUsernameMentionFormat")&&t.hasAttribute("username")?e=i().store.getBy("users","username",t.getAttribute("username")):t.hasAttribute("id")&&(e=i().store.getById("users",t.getAttribute("id"))),e)return t.setAttribute("id",e.id()),t.setAttribute("slug",e.slug()),t.setAttribute("displayname",j()(_()(e))),!0;t.invalidate()}function Pt(t){var e=i().store.getById("posts",t.getAttribute("id"));if(e)return t.setAttribute("discussionid",e.discussion().id()),t.setAttribute("number",e.number()),t.setAttribute("displayname",j()(_()(e.user()))),!0}const xt={"mentions/components/MentionsUserPage":bt,"mentions/components/PostMentionedNotification":lt,"mentions/components/UserMentionedNotification":dt,"mentions/fragments/AutocompleteDropdown":ut,"mentions/fragments/PostQuoteButton":Q,"mentions/utils/getCleanDisplayName":W,"mentions/utils/getMentionText":O,"mentions/utils/reply":n,"mentions/utils/selectedText":X,"mentions/utils/textFormatter":o},$t=flarum.core;i().initializers.add("flarum-mentions",(function(){var t,e;!function(){function t(){var t=this.attrs.post.contentHtml();if(t!==this.oldPostContentHtml&&!this.isEditing()){this.oldPostContentHtml=t;var e=this.attrs.post,n=this.$();this.$().on("click",".UserMention:not(.UserMention--deleted), .PostMention:not(.PostMention--deleted)",(function(t){m.route.set(this.getAttribute("href")),t.preventDefault()})),this.$(".PostMention:not(.PostMention--deleted)").each((function(){var t,o=$(this),r=o.data("id"),s=$('<ul class="Dropdown-menu PostMention-preview fade"/>');n.append(s);var i=function(){return $('.PostStream-item[data-id="'+r+'"]')},a=function(){var t=i(),a=!1;if(t.length){var u=t.offset().top,c=window.pageYOffset;u>c&&u+t.height()<c+$(window).height()&&(t.addClass("pulsate"),a=!0)}if(!a){var f=function(){var t=s.outerHeight(!0),e=0;o.offset().top-t<$(window).scrollTop()+$("#header").outerHeight()?e+=o.outerHeight(!0):e-=t,s.show().css("top",o.offset().top-n.offset().top+e).css("left",o.offsetParent().offset().left-n.offset().left).css("max-width",o.offsetParent().width())},l=function(t){var n=t.discussion();m.render(s[0],[n!==e.discussion()?m("li",null,m("span",{className:"PostMention-preview-discussion"},n.title())):"",m("li",null,p().component({post:t}))]),f()},d=app.store.getById("posts",r);d&&d.discussion()?l(d):(m.render(s[0],v().component()),app.store.find("posts",r).then(l),f()),setTimeout((function(){return s.off("transitionend").addClass("in")}))}},u=function(){i().removeClass("pulsate"),s.hasClass("in")&&s.removeClass("in").one("transitionend",(function(){return s.hide()}))};o.on("touchend",(function(t){t.cancelable&&t.preventDefault()})),o.add(s).hover((function(){clearTimeout(t),t=setTimeout(a,250)}),(function(){clearTimeout(t),i().removeClass("pulsate"),t=setTimeout(u,250)})).on("touchend",(function(t){a(),t.stopPropagation()})),$(document).on("touchend",u)}))}}(0,r.extend)(l().prototype,"oncreate",t),(0,r.extend)(l().prototype,"onupdate",t)}(),function(){function t(){this.$(".Post-mentionedBy-preview").removeClass("in").one("transitionend",(function(){$(this).hide()}))}w().prototype.mentionedBy=y().hasMany("mentionedBy"),(0,r.extend)(l().prototype,"oncreate",(function(){var e,n=this,o=this.attrs.post.mentionedBy();if(o&&o.length){var r=$('<ul class="Dropdown-menu Post-mentionedBy-preview fade"/>');this.$().append(r);var s=this.$(),i=this.$(".Post-mentionedBy"),a=function(){!r.hasClass("in")&&r.is(":visible")||(m.render(r[0],o.map((function(e){return m("li",{"data-number":e.number()},p().component({post:e,onclick:t.bind(n)}))}))),r.show().css("top",i.offset().top-s.offset().top+i.outerHeight(!0)).css("left",i.offsetParent().offset().left-s.offset().left).css("max-width",s.width()),setTimeout((function(){return r.off("transitionend").addClass("in")})))};i.add(r).hover((function(){clearTimeout(e),e=setTimeout(a,250)}),(function(){clearTimeout(e),e=setTimeout(t,250)})),this.$().find(".Post-mentionedBy-summary a").hover((function(){r.find('[data-number="'+$(this).data("number")+'"]').addClass("active")}),(function(){r.find("[data-number]").removeClass("active")}))}})),(0,r.extend)(l().prototype,"footerItems",(function(e){var n=this,o=this.attrs.post.mentionedBy();if(o&&o.length){var r=[],s=o.sort((function(t){return t.user()===i().session.user?-1:0})).filter((function(t){var e=t.user();if(-1===r.indexOf(e))return r.push(e),!0})),a=s.length>4,u=s.slice(0,a?3:4).map((function(e){var o=e.user();return m(x(),{href:i().route.post(e),onclick:t.bind(n),"data-number":e.number()},i().session.user===o?i().translator.trans("flarum-mentions.forum.post.you_text"):_()(o))}));if(a){var c=s.length-u.length;u.push(i().translator.trans("flarum-mentions.forum.post.others_text",{count:c}))}e.add("replies",m("div",{className:"Post-mentionedBy"},m("span",{className:"Post-mentionedBy-summary"},A()("fas fa-reply"),i().translator.trans("flarum-mentions.forum.post.mentioned_by"+(s[0].user()===i().session.user?"_self":"")+"_text",{count:u.length,users:M()(u)}))))}}))}(),(0,r.extend)(l().prototype,"actionItems",(function(t){var e=this.attrs.post;e.isHidden()||i().session.user&&!e.discussion().canReply()||t.add("reply",m(N(),{className:"Button Button--link",onclick:function(){return R(e)}},i().translator.trans("flarum-mentions.forum.post.reply_link")))})),(0,r.extend)(l().prototype,"oncreate",(function(){var t=this.attrs.post;if(!(t.isHidden()||i().session.user&&!t.discussion().canReply())){var e=this.$(".Post-body"),n=$('<div class="Post-quoteButtonContainer"></div>'),o=new Q(t),r=function(t){setTimeout((function(){var r=X(e);if(r){o.content=r,m.render(n[0],o.render());var s=window.getSelection().getRangeAt(0).getClientRects(),i=s[0];if(t.clientY<i.bottom&&t.clientX-i.right<i.left-t.clientX)o.showStart(i.left,i.top);else{var a=s[s.length-1];o.showEnd(a.right,a.bottom)}}}),1)};this.$().after(n).on("mouseup",r),"ontouchstart"in window&&document.addEventListener("selectionchange",r,!1)}})),t=$('<div class="ComposerBody-mentionsDropdownContainer"></div>'),e=new ut,(0,r.extend)(G().prototype,"oncreate",(function(){var n=this.$(".TextEditor-editor").wrap('<div class="ComposerBody-mentionsWrapper"></div>');this.navigator=new(it()),this.navigator.when((function(){return e.active})).onUp((function(){return e.navigate(-1)})).onDown((function(){return e.navigate(1)})).onSelect(e.complete.bind(e)).onCancel(e.hide.bind(e)).bindTo(n),n.after(t)})),(0,r.extend)(G().prototype,"buildEditorParams",(function(n){var o,r,s,a,u=this,f=[],l=Array.from(i().store.all("users")),d=new Set(l.map((function(t){return t.id()})));n.inputListeners.push((function(){var n=u.attrs.composer.editor.getSelectionRange(),p=n[0];if(!(n[1]-p>0)){var h=u.attrs.composer.editor.getLastNChars(30);r=0;for(var v=h.length-1;v>=0;v--)if("@"===h.substr(v,1)&&(0==v||/\s/.test(h.substr(v-1,1)))){o=v+1,r=p-h.length+v+1;break}if(e.hide(),e.active=!1,r){s=h.substring(o).toLowerCase(),a=s.match(/^["|“]((?:(?!"#).)+)$/),s=a&&a[1]||s;var g=function(t,n,o,i){void 0===i&&(i="");var a=_()(t);return s&&(a.children=[rt()(a.text,s)],delete a.text),m("button",{className:"PostPreview "+i,onclick:function(){return function(t){u.attrs.composer.editor.replaceBeforeCursor(r-1,t+" "),e.hide()}(n)},onmouseenter:function(){e.setIndex($(this).parent().index())}},m("span",{className:"PostPreview-content"},nt()(t),a," ",o))},y=function(t){return[t.username(),t.displayName()].some((function(t){return t.toLowerCase().substr(0,s.length)===s}))},b=function(){var n=[];if(s&&l.forEach((function(t){y(t)&&n.push(g(t,O(t),"","MentionsDropdown-user"))})),u.attrs.composer.bodyMatches(tt())||u.attrs.composer.bodyMatches(I())){var o=u.attrs.composer.body.attrs,a=o.post,f=a&&a.discussion()||o.discussion;f&&f.posts().filter((function(t){return t&&"comment"===t.contentType()&&(!a||t.number()<a.number())})).sort((function(t,e){return e.createdAt()-t.createdAt()})).filter((function(t){var e=t.user();return e&&y(e)})).splice(0,5).forEach((function(t){var e=t.user();n.push(g(e,O(e,t.id()),[i().translator.trans("flarum-mentions.forum.composer.reply_to_post_text",{number:t.number()})," — ",(0,c.truncate)(t.contentPlain(),200)],"MentionsDropdown-post"))}))}if(n.length){e.items=n,m.render(t[0],e.render()),e.show();var d=u.attrs.composer.editor.getCaretCoordinates(r),p=e.$().outerWidth(),h=e.$().outerHeight(),v=e.$().offsetParent(),b=d.left,w=d.top+15;w+h>v.height()&&(w=d.top-h-15),b+p>v.width()&&(b=v.width()-p),w=Math.max(-(v.offset().top-$(document).scrollTop()),w),b=Math.max(-v.offset().left,b),e.show(b,w)}else e.active=!1,e.hide()};e.active=!0,b(),e.setIndex(0),e.$().scrollTop(0),s.length>1&&i().forum.attribute("canSearchUsers")&&ct(s,f,l,d,e,b)}}}))})),(0,r.extend)(G().prototype,"toolbarItems",(function(t){var e=this;t.add("mention",m(V(),{onclick:function(){return e.attrs.composer.editor.insertAtCursor(" @")},icon:"fas fa-at"},i().translator.trans("flarum-mentions.forum.composer.mention_tooltip")))})),i().notificationComponents.postMentioned=lt,i().notificationComponents.userMentioned=dt,(0,r.extend)(u().prototype,"notificationTypes",(function(t){t.add("postMentioned",{name:"postMentioned",icon:"fas fa-reply",label:i().translator.trans("flarum-mentions.forum.settings.notify_post_mentioned_label")}),t.add("userMentioned",{name:"userMentioned",icon:"fas fa-at",label:i().translator.trans("flarum-mentions.forum.settings.notify_user_mentioned_label")})})),i().routes["user.mentions"]={path:"/u/:username/mentions",component:bt},(0,r.extend)(ht().prototype,"navItems",(function(t){var e=this.user;t.add("mentions",gt().component({href:i().route("user.mentions",{username:e.slug()}),name:"mentions",icon:"fas fa-at"},i().translator.trans("flarum-mentions.forum.user.mentions_link")),80)})),c.getPlainContent.removeSelectors.push("a.PostMention")})),Object.assign($t.compat,xt)})(),module.exports=e})();
+(()=>{var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e),t.d(e,{filterPostMentions:()=>Pt,filterUserMentions:()=>wt});var n={};t.r(n),t.d(n,{default:()=>R,insertMention:()=>L});var o={};t.r(o),t.d(o,{filterPostMentions:()=>Pt,filterUserMentions:()=>wt});const r=flarum.core.compat["common/extend"],s=flarum.core.compat["forum/app"];var i=t.n(s);const a=flarum.core.compat["forum/components/NotificationGrid"];var u=t.n(a);const c=flarum.core.compat["common/utils/string"],f=flarum.core.compat["forum/components/CommentPost"];var l=t.n(f);const d=flarum.core.compat["forum/components/PostPreview"];var p=t.n(d);const h=flarum.core.compat["common/components/LoadingIndicator"];var v=t.n(h);const g=flarum.core.compat["common/Model"];var y=t.n(g);const b=flarum.core.compat["common/models/Post"];var w=t.n(b);const P=flarum.core.compat["common/components/Link"];var x=t.n(P);const C=flarum.core.compat["common/helpers/punctuateSeries"];var M=t.n(C);const T=flarum.core.compat["common/helpers/username"];var _=t.n(T);const B=flarum.core.compat["common/helpers/icon"];var A=t.n(B);const k=flarum.core.compat["common/components/Button"];var N=t.n(k);const S=flarum.core.compat["forum/utils/DiscussionControls"];var H=t.n(S);const D=flarum.core.compat["forum/components/EditPostComposer"];var I=t.n(D);const U=flarum.core.compat["common/utils/extractText"];var j=t.n(U),E=function(){return j()(i().translator.trans("core.lib.username.deleted_text"))};function W(t,e){return void 0===e&&(e=!0),t?((e?t.displayName():t.username())||E()).replace(/"#[a-z]{0,3}[0-9]+/,"_"):E().replace(/"#[a-z]{0,3}[0-9]+/,"_")}function O(t,e){return void 0===e?i().forum.attribute("allowUsernameMentionFormat")?"@"+W(t,!1):'@"'+W(t)+'"#'+t.id():'@"'+W(t)+'"#p'+e}function L(t,e,n){return new Promise((function(o){var r=O(t.user(),t.id())+" ";e.fields.content()||(e.body.attrs.originalContent=r);var s=e.editor.getSelectionRange()[0],i=e.fields.content().slice(0,s),a=0==i.length?0:3-i.match(/(\n{0,2})$/)[0].length;return e.editor.insertAtCursor(Array(a).join("\n")+(n?"> "+r+n.trim().replace(/\n/g,"\n> ")+"\n\n":r),!1),o(e)}))}function R(t,e){return i().composer.bodyMatches(I())&&i().composer.body.attrs.post.discussion()===t.discussion()?L(t,i().composer,e):H().replyAction.call(t.discussion()).then((function(n){return L(t,n,e)}))}function q(t,e){return q=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},q(t,e)}function J(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,q(t,e)}const F=flarum.core.compat["common/Fragment"];var z=t.n(F),Q=function(t){function e(e){var n;return(n=t.call(this)||this).post=e,n}J(e,t);var n=e.prototype;return n.view=function(){var t=this;return m("button",{class:"Button PostQuoteButton",onclick:function(){R(t.post,t.content)}},A()("fas fa-quote-left",{className:"Button-icon"}),i().translator.trans("flarum-mentions.forum.post.quote_button"))},n.show=function(t,e){var n=this.$().show(),o=n.offsetParent().offset();n.css("left",t-o.left).css("top",e-o.top),this.hideHandler=this.hide.bind(this),$(document).on("mouseup",this.hideHandler)},n.showStart=function(t,e){var n=this.$();this.show(t,$(window).scrollTop()+e-n.outerHeight()-5)},n.showEnd=function(t,e){var n=this.$();this.show(t-n.outerWidth(),$(window).scrollTop()+e+5)},n.hide=function(){this.$().hide(),$(document).off("mouseup",this.hideHandler)},e}(z());function X(t){var e=window.getSelection();if(null!=e&&e.rangeCount){var n=e.getRangeAt(0),o=n.commonAncestorContainer;if(t[0]===o||$.contains(t[0],o)){var r=$("<div>").append(n.cloneContents());return r.find("img.emoji").replaceWith((function(){return this.alt})),r.find("img").replaceWith((function(){return"![]("+this.src+")"})),r.find("a").replaceWith((function(){return"["+this.innerText+"]("+this.href+")"})),r.text()}}return""}const Y=flarum.core.compat["common/components/TextEditor"];var G=t.n(Y);const K=flarum.core.compat["common/components/TextEditorButton"];var V=t.n(K);const Z=flarum.core.compat["forum/components/ReplyComposer"];var tt=t.n(Z);const et=flarum.core.compat["common/helpers/avatar"];var nt=t.n(et);const ot=flarum.core.compat["common/helpers/highlight"];var rt=t.n(ot);const st=flarum.core.compat["forum/utils/KeyboardNavigatable"];var it=t.n(st);const at=flarum.core.compat["common/utils/throttleDebounce"];var ut=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return(e=t.call.apply(t,[this].concat(o))||this).items=[],e.active=!1,e.index=0,e.keyWasJustPressed=!1,e}J(e,t);var n=e.prototype;return n.view=function(){return m("ul",{className:"Dropdown-menu MentionsDropdown"},this.items.map((function(t){return m("li",null,t)})))},n.show=function(t,e){this.$().show().css({left:t+"px",top:e+"px"}),this.active=!0},n.hide=function(){this.$().hide(),this.active=!1},n.navigate=function(t){var e=this;this.keyWasJustPressed=!0,this.setIndex(this.index+t,!0),clearTimeout(this.keyWasJustPressedTimeout),this.keyWasJustPressedTimeout=setTimeout((function(){return e.keyWasJustPressed=!1}),500)},n.complete=function(){this.$("li").eq(this.index).find("button").click()},n.setIndex=function(t,e){if(!this.keyWasJustPressed||e){var n=this.$(),o=n.find("li"),r=t;r<0?r=o.length-1:r>=o.length&&(r=0),this.index=r;var s=o.removeClass("active").eq(r).addClass("active");if(e){var i,a=n.scrollTop(),u=n.offset().top,c=u+n.outerHeight(),m=s.offset().top,f=m+s.outerHeight();m<u?i=a-u+m-parseInt(n.css("padding-top"),10):f>c&&(i=a-c+f+parseInt(n.css("padding-bottom"),10)),void 0!==i&&n.stop(!0).animate({scrollTop:i},100)}}},e}(z()),ct=(0,at.throttle)(250,(function(t,e,n,o,r,s){var a=t.toLowerCase();e.includes(a)||(i().store.find("users",{filter:{q:t},page:{limit:5}}).then((function(t){t.forEach((function(t){o.has(t.id())||(o.add(t.id()),n.push(t))})),s()})),e.push(a))}));const mt=flarum.core.compat["forum/components/Notification"];var ft=t.n(mt),lt=function(t){function e(){return t.apply(this,arguments)||this}J(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-reply"},n.href=function(){var t=this.attrs.notification,e=t.subject(),n=t.content();return i().route.discussion(e.discussion(),n&&n.replyNumber)},n.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.post_mentioned_text",{user:t,count:1})},n.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain()||"",200)},e}(ft()),dt=function(t){function e(){return t.apply(this,arguments)||this}J(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-at"},n.href=function(){var t=this.attrs.notification.subject();return i().route.discussion(t.discussion(),t.number())},n.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.user_mentioned_text",{user:t})},n.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain(),200)},e}(ft());const pt=flarum.core.compat["forum/components/UserPage"];var ht=t.n(pt);const vt=flarum.core.compat["common/components/LinkButton"];var gt=t.n(vt);const yt=flarum.core.compat["forum/components/PostsUserPage"];var bt=function(t){function e(){return t.apply(this,arguments)||this}return J(e,t),e.prototype.loadResults=function(t){return i().store.find("posts",{filter:{type:"comment",mentioned:this.user.id()},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})},e}(t.n(yt)());function wt(t){var e;if(i().forum.attribute("allowUsernameMentionFormat")&&t.hasAttribute("username")?e=i().store.getBy("users","username",t.getAttribute("username")):t.hasAttribute("id")&&(e=i().store.getById("users",t.getAttribute("id"))),e)return t.setAttribute("id",e.id()),t.setAttribute("slug",e.slug()),t.setAttribute("displayname",j()(_()(e))),!0;t.invalidate()}function Pt(t){var e=i().store.getById("posts",t.getAttribute("id"));if(e)return t.setAttribute("discussionid",e.discussion().id()),t.setAttribute("number",e.number()),t.setAttribute("displayname",j()(_()(e.user()))),!0}const xt={"mentions/components/MentionsUserPage":bt,"mentions/components/PostMentionedNotification":lt,"mentions/components/UserMentionedNotification":dt,"mentions/fragments/AutocompleteDropdown":ut,"mentions/fragments/PostQuoteButton":Q,"mentions/utils/getCleanDisplayName":W,"mentions/utils/getMentionText":O,"mentions/utils/reply":n,"mentions/utils/selectedText":X,"mentions/utils/textFormatter":o},$t=flarum.core;i().initializers.add("flarum-mentions",(function(){var t,e;!function(){function t(){var t=this.attrs.post.contentHtml();if(t!==this.oldPostContentHtml&&!this.isEditing()){this.oldPostContentHtml=t;var e=this.attrs.post,n=this.$();this.$().on("click",".UserMention:not(.UserMention--deleted), .PostMention:not(.PostMention--deleted)",(function(t){m.route.set(this.getAttribute("href")),t.preventDefault()})),this.$(".PostMention:not(.PostMention--deleted)").each((function(){var t,o=$(this),r=o.data("id"),s=$('<ul class="Dropdown-menu PostMention-preview fade"/>');n.append(s);var i=function(){return $('.PostStream-item[data-id="'+r+'"]')},a=function(){var t=i(),a=!1;if(t.length){var u=t.offset().top,c=window.pageYOffset;u>c&&u+t.height()<c+$(window).height()&&(t.addClass("pulsate"),a=!0)}if(!a){var f=function(){var t=s.outerHeight(!0),e=0;o.offset().top-t<$(window).scrollTop()+$("#header").outerHeight()?e+=o.outerHeight(!0):e-=t,s.show().css("top",o.offset().top-n.offset().top+e).css("left",o.offsetParent().offset().left-n.offset().left).css("max-width",o.offsetParent().width())},l=function(t){var n=t.discussion();m.render(s[0],[n!==e.discussion()?m("li",null,m("span",{className:"PostMention-preview-discussion"},n.title())):"",m("li",null,p().component({post:t}))]),f()},d=app.store.getById("posts",r);d&&d.discussion()?l(d):(m.render(s[0],v().component()),app.store.find("posts",r).then(l),f()),setTimeout((function(){return s.off("transitionend").addClass("in")}))}},u=function(){i().removeClass("pulsate"),s.hasClass("in")&&s.removeClass("in").one("transitionend",(function(){return s.hide()}))};o.on("touchend",(function(t){t.cancelable&&t.preventDefault()})),o.add(s).hover((function(){clearTimeout(t),t=setTimeout(a,250)}),(function(){clearTimeout(t),i().removeClass("pulsate"),t=setTimeout(u,250)})).on("touchend",(function(t){a(),t.stopPropagation()})),$(document).on("touchend",u)}))}}(0,r.extend)(l().prototype,"oncreate",t),(0,r.extend)(l().prototype,"onupdate",t)}(),function(){function t(){this.$(".Post-mentionedBy-preview").removeClass("in").one("transitionend",(function(){$(this).hide()}))}w().prototype.mentionedBy=y().hasMany("mentionedBy"),(0,r.extend)(l().prototype,"oncreate",(function(){var e,n=this,o=this.attrs.post.mentionedBy();if(o&&o.length){var r=$('<ul class="Dropdown-menu Post-mentionedBy-preview fade"/>');this.$().append(r);var s=this.$(),i=this.$(".Post-mentionedBy"),a=function(){!r.hasClass("in")&&r.is(":visible")||(m.render(r[0],o.map((function(e){return m("li",{"data-number":e.number()},p().component({post:e,onclick:t.bind(n)}))}))),r.show().css("top",i.offset().top-s.offset().top+i.outerHeight(!0)).css("left",i.offsetParent().offset().left-s.offset().left).css("max-width",s.width()),setTimeout((function(){return r.off("transitionend").addClass("in")})))};i.add(r).hover((function(){clearTimeout(e),e=setTimeout(a,250)}),(function(){clearTimeout(e),e=setTimeout(t,250)})),this.$().find(".Post-mentionedBy-summary a").hover((function(){r.find('[data-number="'+$(this).data("number")+'"]').addClass("active")}),(function(){r.find("[data-number]").removeClass("active")}))}})),(0,r.extend)(l().prototype,"footerItems",(function(e){var n=this,o=this.attrs.post.mentionedBy();if(o&&o.length){var r=[],s=o.sort((function(t){return t.user()===i().session.user?-1:0})).filter((function(t){var e=t.user();if(-1===r.indexOf(e))return r.push(e),!0})),a=s.length>4,u=s.slice(0,a?3:4).map((function(e){var o=e.user();return m(x(),{href:i().route.post(e),onclick:t.bind(n),"data-number":e.number()},i().session.user===o?i().translator.trans("flarum-mentions.forum.post.you_text"):_()(o))}));if(a){var c=s.length-u.length;u.push(i().translator.trans("flarum-mentions.forum.post.others_text",{count:c}))}e.add("replies",m("div",{className:"Post-mentionedBy"},m("span",{className:"Post-mentionedBy-summary"},A()("fas fa-reply"),i().translator.trans("flarum-mentions.forum.post.mentioned_by"+(s[0].user()===i().session.user?"_self":"")+"_text",{count:u.length,users:M()(u)}))))}}))}(),(0,r.extend)(l().prototype,"actionItems",(function(t){var e=this.attrs.post;e.isHidden()||i().session.user&&!e.discussion().canReply()||t.add("reply",m(N(),{className:"Button Button--link",onclick:function(){return R(e)}},i().translator.trans("flarum-mentions.forum.post.reply_link")))})),(0,r.extend)(l().prototype,"oncreate",(function(){var t=this.attrs.post;if(!(t.isHidden()||i().session.user&&!t.discussion().canReply())){var e=this.$(".Post-body"),n=$('<div class="Post-quoteButtonContainer"></div>'),o=new Q(t),r=function(t){setTimeout((function(){var r=X(e);if(r){o.content=r,m.render(n[0],o.render());var s=window.getSelection().getRangeAt(0).getClientRects(),i=s[0];if(t.clientY<i.bottom&&t.clientX-i.right<i.left-t.clientX)o.showStart(i.left,i.top);else{var a=s[s.length-1];o.showEnd(a.right,a.bottom)}}}),1)};this.$().after(n).on("mouseup",r),"ontouchstart"in window&&document.addEventListener("selectionchange",r,!1)}})),t=$('<div class="ComposerBody-mentionsDropdownContainer"></div>'),e=new ut,(0,r.extend)(G().prototype,"oncreate",(function(){var n=this.$(".TextEditor-editor").wrap('<div class="ComposerBody-mentionsWrapper"></div>');this.navigator=new(it()),this.navigator.when((function(){return e.active})).onUp((function(){return e.navigate(-1)})).onDown((function(){return e.navigate(1)})).onSelect(e.complete.bind(e)).onCancel(e.hide.bind(e)).bindTo(n),n.after(t)})),(0,r.extend)(G().prototype,"buildEditorParams",(function(n){var o,r,s,a,u=this,f=[],l=Array.from(i().store.all("users")),d=new Set(l.map((function(t){return t.id()})));n.inputListeners.push((function(){var n=u.attrs.composer.editor.getSelectionRange(),p=n[0];if(!(n[1]-p>0)){var h=u.attrs.composer.editor.getLastNChars(30);r=0;for(var v=h.length-1;v>=0;v--)if("@"===h.substr(v,1)&&(0==v||/\s/.test(h.substr(v-1,1)))){o=v+1,r=p-h.length+v+1;break}if(e.hide(),e.active=!1,r){s=h.substring(o).toLowerCase(),a=s.match(/^["|“]((?:(?!"#).)+)$/),s=a&&a[1]||s;var g=function(t,n,o,i){void 0===i&&(i="");var a=_()(t);return s&&(a.children=[rt()(a.text,s)],delete a.text),m("button",{className:"PostPreview "+i,onclick:function(){return function(t){u.attrs.composer.editor.replaceBeforeCursor(r-1,t+" "),e.hide()}(n)},onmouseenter:function(){e.setIndex($(this).parent().index())}},m("span",{className:"PostPreview-content"},nt()(t),a," ",o))},y=function(t){return[t.username(),t.displayName()].some((function(t){return t.toLowerCase().substr(0,s.length)===s}))},b=function(){var n=[];if(s&&l.forEach((function(t){y(t)&&n.push(g(t,O(t),"","MentionsDropdown-user"))})),u.attrs.composer.bodyMatches(tt())||u.attrs.composer.bodyMatches(I())){var o=u.attrs.composer.body.attrs,a=o.post,f=a&&a.discussion()||o.discussion;f&&f.posts().filter((function(t){return t&&"comment"===t.contentType()&&(!a||t.number()<a.number())})).sort((function(t,e){return e.createdAt()-t.createdAt()})).filter((function(t){var e=t.user();return e&&y(e)})).splice(0,5).forEach((function(t){var e=t.user();n.push(g(e,O(e,t.id()),[i().translator.trans("flarum-mentions.forum.composer.reply_to_post_text",{number:t.number()})," — ",(0,c.truncate)(t.contentPlain(),200)],"MentionsDropdown-post"))}))}if(n.length){e.items=n,m.render(t[0],e.render()),e.show();var d=u.attrs.composer.editor.getCaretCoordinates(r),p=e.$().outerWidth(),h=e.$().outerHeight(),v=e.$().offsetParent(),b=d.left,w=d.top+15;w+h>v.height()&&(w=d.top-h-15),b+p>v.width()&&(b=v.width()-p),w=Math.max(-(v.offset().top-$(document).scrollTop()),w),b=Math.max(-v.offset().left,b),e.show(b,w)}else e.active=!1,e.hide()};e.active=!0,b(),e.setIndex(0),e.$().scrollTop(0),s.length>1&&i().forum.attribute("canSearchUsers")&&ct(s,f,l,d,e,b)}}}))})),(0,r.extend)(G().prototype,"toolbarItems",(function(t){var e=this;t.add("mention",m(V(),{onclick:function(){return e.attrs.composer.editor.insertAtCursor(" @")},icon:"fas fa-at"},i().translator.trans("flarum-mentions.forum.composer.mention_tooltip")))})),i().notificationComponents.postMentioned=lt,i().notificationComponents.userMentioned=dt,(0,r.extend)(u().prototype,"notificationTypes",(function(t){t.add("postMentioned",{name:"postMentioned",icon:"fas fa-reply",label:i().translator.trans("flarum-mentions.forum.settings.notify_post_mentioned_label")}),t.add("userMentioned",{name:"userMentioned",icon:"fas fa-at",label:i().translator.trans("flarum-mentions.forum.settings.notify_user_mentioned_label")})})),i().routes["user.mentions"]={path:"/u/:username/mentions",component:bt},(0,r.extend)(ht().prototype,"navItems",(function(t){var e=this.user;t.add("mentions",gt().component({href:i().route("user.mentions",{username:e.slug()}),name:"mentions",icon:"fas fa-at"},i().translator.trans("flarum-mentions.forum.user.mentions_link")),80)})),c.getPlainContent.removeSelectors.push("a.PostMention")})),Object.assign($t.compat,xt)})(),module.exports=e})();
 //# sourceMappingURL=forum.js.map
\ No newline at end of file
diff --git a/extensions/mentions/js/dist/forum.js.map b/extensions/mentions/js/dist/forum.js.map
index 550c17851..248b0e8ec 100644
--- a/extensions/mentions/js/dist/forum.js.map
+++ b/extensions/mentions/js/dist/forum.js.map
@@ -1 +1 @@
-{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,oOCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,qC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,uBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,gC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,gC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,sC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,gB,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,O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5BA,IAAAA,uBAAAA,cAA2CuJ,GAC3CvJ,IAAAA,uBAAAA,cAA2CiK,IAG3CwD,EAAAA,EAAAA,QAAO+E,IAAAA,UAA4B,qBAAqB,SAAUpM,GAChEA,EAAMiD,IAAI,gBAAiB,CACzBoI,KAAM,gBACNpO,KAAM,eACNoP,MAAOzS,IAAAA,WAAAA,MAAqB,gEAG9BoG,EAAMiD,IAAI,gBAAiB,CACzBoI,KAAM,gBACNpO,KAAM,YACNoP,MAAOzS,IAAAA,WAAAA,MAAqB,mEAKhCA,IAAAA,OAAAA,iBAA8B,CAAE0S,KAAM,wBAAyBC,UAAWxI,KAC1EsD,EAAAA,EAAAA,QAAOmF,KAAAA,UAAoB,YAAY,SAAUxM,GAC/C,IAAMlG,EAAOyD,KAAKzD,KAClBkG,EAAMiD,IACJ,WACAwJ,KAAAA,UACE,CACE5M,KAAMjG,IAAAA,MAAU,gBAAiB,CAAEK,SAAUH,EAAK6K,SAClD0G,KAAM,WACNpO,KAAM,aAERrD,IAAAA,WAAAA,MAAqB,6CAEvB,OAKJ8S,EAAAA,gBAAAA,gBAAAA,KAAqC,oBASvC/T,OAAOgU,OAAOlT,GAAAA,OAAQmT,K","sources":["webpack://@flarum/mentions/webpack/bootstrap","webpack://@flarum/mentions/webpack/runtime/compat get default export","webpack://@flarum/mentions/webpack/runtime/define property getters","webpack://@flarum/mentions/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/mentions/webpack/runtime/make namespace object","webpack://@flarum/mentions/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/NotificationGrid']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/utils/string']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/PostPreview']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/Model']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/models/Post']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/Link']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/utils/DiscussionControls']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/EditPostComposer']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@flarum/mentions/./src/forum/utils/getCleanDisplayName.js","webpack://@flarum/mentions/./src/forum/utils/getMentionText.js","webpack://@flarum/mentions/./src/forum/utils/reply.js","webpack://@flarum/mentions/../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@flarum/mentions/../../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@flarum/mentions/external root \"flarum.core.compat['common/Fragment']\"","webpack://@flarum/mentions/./src/forum/fragments/PostQuoteButton.js","webpack://@flarum/mentions/./src/forum/utils/selectedText.js","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/TextEditor']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/TextEditorButton']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/ReplyComposer']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/highlight']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/utils/KeyboardNavigatable']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/utils/throttleDebounce']\"","webpack://@flarum/mentions/./src/forum/fragments/AutocompleteDropdown.js","webpack://@flarum/mentions/./src/forum/addComposerAutocomplete.js","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/Notification']\"","webpack://@flarum/mentions/./src/forum/components/PostMentionedNotification.js","webpack://@flarum/mentions/./src/forum/components/UserMentionedNotification.js","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/UserPage']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/LinkButton']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/PostsUserPage']\"","webpack://@flarum/mentions/./src/forum/components/MentionsUserPage.js","webpack://@flarum/mentions/./src/forum/utils/textFormatter.js","webpack://@flarum/mentions/./src/forum/compat.js","webpack://@flarum/mentions/external assign \"flarum.core\"","webpack://@flarum/mentions/./src/forum/index.js","webpack://@flarum/mentions/./src/forum/addPostMentionPreviews.js","webpack://@flarum/mentions/./src/forum/addMentionedByList.js","webpack://@flarum/mentions/./src/forum/addPostReplyAction.js","webpack://@flarum/mentions/./src/forum/addPostQuoteButton.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/NotificationGrid'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/string'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/PostPreview'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/punctuateSeries'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/DiscussionControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/EditPostComposer'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","import app from 'flarum/forum/app';\nimport extractText from 'flarum/common/utils/extractText';\n\n/**\n * Whether to use the old mentions format.\n *\n * `'@username'` or `'@\"Display name\"'`\n */\nexport const shouldUseOldFormat = () => app.forum.attribute('allowUsernameMentionFormat') || false;\n\nconst getDeletedUserText = () => extractText(app.translator.trans('core.lib.username.deleted_text'));\n\n/**\n * Fetches a user's username or display name.\n *\n * Chooses based on the format option set in the admin settings page.\n *\n * @param user An instance of the User model to fetch the username for\n * @param useDisplayName If `true`, uses `user.displayName()`, otherwise, uses `user.username()`\n */\nexport default function getCleanDisplayName(user, useDisplayName = true) {\n  if (!user) return getDeletedUserText().replace(/\"#[a-z]{0,3}[0-9]+/, '_');\n\n  const text = (useDisplayName ? user.displayName() : user.username()) || getDeletedUserText();\n\n  return text.replace(/\"#[a-z]{0,3}[0-9]+/, '_');\n}\n","import getCleanDisplayName, { shouldUseOldFormat } from './getCleanDisplayName';\n\n/**\n * Fetches the mention text for a specified user (and optionally a post ID for replies).\n *\n * Automatically determines which mention syntax to be used based on the option in the\n * admin dashboard. Also performs display name clean-up automatically.\n *\n * @example <caption>New display name syntax</caption>\n * // '@\"User\"#1'\n * getMentionText(User) // User is ID 1, display name is 'User'\n *\n * @example <caption>Replying</caption>\n * // '@\"User\"#p13'\n * getMentionText(User, 13) // User display name is 'User', post ID is 13\n *\n * @example <caption>Using old syntax</caption>\n * // '@username'\n * getMentionText(User) // User's username is 'username'\n */\nexport default function getMentionText(user, postId) {\n  if (postId === undefined) {\n    if (shouldUseOldFormat()) {\n      // Plain @username\n      const cleanText = getCleanDisplayName(user, false);\n      return `@${cleanText}`;\n    }\n    // @\"Display name\"#UserID\n    const cleanText = getCleanDisplayName(user);\n    return `@\"${cleanText}\"#${user.id()}`;\n  } else {\n    // @\"Display name\"#pPostID\n    const cleanText = getCleanDisplayName(user);\n    return `@\"${cleanText}\"#p${postId}`;\n  }\n}\n","import app from 'flarum/forum/app';\nimport DiscussionControls from 'flarum/forum/utils/DiscussionControls';\nimport EditPostComposer from 'flarum/forum/components/EditPostComposer';\nimport getMentionText from './getMentionText';\n\nexport function insertMention(post, composer, quote) {\n  return new Promise((resolve) => {\n    const user = post.user();\n    const mention = getMentionText(user, post.id()) + ' ';\n\n    // If the composer is empty, then assume we're starting a new reply.\n    // In which case we don't want the user to have to confirm if they\n    // close the composer straight away.\n    if (!composer.fields.content()) {\n      composer.body.attrs.originalContent = mention;\n    }\n\n    const cursorPosition = composer.editor.getSelectionRange()[0];\n    const preceding = composer.fields.content().slice(0, cursorPosition);\n    const precedingNewlines = preceding.length == 0 ? 0 : 3 - preceding.match(/(\\n{0,2})$/)[0].length;\n\n    composer.editor.insertAtCursor(\n      Array(precedingNewlines).join('\\n') + // Insert up to two newlines, depending on preceding whitespace\n        (quote ? '> ' + mention + quote.trim().replace(/\\n/g, '\\n> ') + '\\n\\n' : mention),\n      false\n    );\n    return resolve(composer);\n  });\n}\n\nexport default function reply(post, quote) {\n  if (app.composer.bodyMatches(EditPostComposer) && app.composer.body.attrs.post.discussion() === post.discussion()) {\n    // If we're already editing a post in the discussion of post we're quoting,\n    // insert the mention directly.\n    return insertMention(post, app.composer, quote);\n  } else {\n    // The default \"Reply\" action behavior will only open a new composer if\n    // necessary, but it will always be a ReplyComposer, hence the exceptional\n    // case above.\n    return DiscussionControls.replyAction.call(post.discussion()).then((composer) => insertMention(post, composer, quote));\n  }\n}\n","export default function _setPrototypeOf(o, p) {\n  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n    o.__proto__ = p;\n    return o;\n  };\n\n  return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n  subClass.prototype = Object.create(superClass.prototype);\n  subClass.prototype.constructor = subClass;\n  setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Fragment'];","import app from 'flarum/forum/app';\nimport Fragment from 'flarum/common/Fragment';\nimport icon from 'flarum/common/helpers/icon';\n\nimport reply from '../utils/reply';\n\nexport default class PostQuoteButton extends Fragment {\n  constructor(post) {\n    super();\n\n    this.post = post;\n  }\n\n  view() {\n    return (\n      <button\n        class=\"Button PostQuoteButton\"\n        onclick={() => {\n          reply(this.post, this.content);\n        }}\n      >\n        {icon('fas fa-quote-left', { className: 'Button-icon' })}\n        {app.translator.trans('flarum-mentions.forum.post.quote_button')}\n      </button>\n    );\n  }\n\n  show(left, top) {\n    const $this = this.$().show();\n    const parentOffset = $this.offsetParent().offset();\n\n    $this.css('left', left - parentOffset.left).css('top', top - parentOffset.top);\n\n    this.hideHandler = this.hide.bind(this);\n    $(document).on('mouseup', this.hideHandler);\n  }\n\n  showStart(left, top) {\n    const $this = this.$();\n\n    this.show(left, $(window).scrollTop() + top - $this.outerHeight() - 5);\n  }\n\n  showEnd(right, bottom) {\n    const $this = this.$();\n\n    this.show(right - $this.outerWidth(), $(window).scrollTop() + bottom + 5);\n  }\n\n  hide() {\n    this.$().hide();\n    $(document).off('mouseup', this.hideHandler);\n  }\n}\n","/**\n * Finds the selected text in the provided composer body.\n */\nexport default function selectedText(body) {\n  const selection = window.getSelection();\n\n  if (selection?.rangeCount) {\n    const range = selection.getRangeAt(0);\n    const parent = range.commonAncestorContainer;\n\n    if (body[0] === parent || $.contains(body[0], parent)) {\n      const clone = $('<div>').append(range.cloneContents());\n\n      // Replace emoji images with their shortcode (found in alt attribute)\n      clone.find('img.emoji').replaceWith(function () {\n        return this.alt;\n      });\n\n      // Replace all other images with a Markdown image\n      clone.find('img').replaceWith(function () {\n        return `![](${this.src})`;\n      });\n\n      // Replace all links with a Markdown link\n      clone.find('a').replaceWith(function () {\n        return `[${this.innerText}](${this.href})`;\n      });\n\n      return clone.text();\n    }\n  }\n  return '';\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/TextEditor'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/TextEditorButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/ReplyComposer'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/highlight'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/KeyboardNavigatable'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/throttleDebounce'];","import Fragment from 'flarum/common/Fragment';\n\nexport default class AutocompleteDropdown extends Fragment {\n  items = [];\n  active = false;\n  index = 0;\n  keyWasJustPressed = false;\n\n  view() {\n    return (\n      <ul className=\"Dropdown-menu MentionsDropdown\">\n        {this.items.map((item) => (\n          <li>{item}</li>\n        ))}\n      </ul>\n    );\n  }\n\n  show(left, top) {\n    this.$()\n      .show()\n      .css({\n        left: left + 'px',\n        top: top + 'px',\n      });\n    this.active = true;\n  }\n\n  hide() {\n    this.$().hide();\n    this.active = false;\n  }\n\n  navigate(delta) {\n    this.keyWasJustPressed = true;\n    this.setIndex(this.index + delta, true);\n    clearTimeout(this.keyWasJustPressedTimeout);\n    this.keyWasJustPressedTimeout = setTimeout(() => (this.keyWasJustPressed = false), 500);\n  }\n\n  complete() {\n    this.$('li').eq(this.index).find('button').click();\n  }\n\n  setIndex(index, scrollToItem) {\n    if (this.keyWasJustPressed && !scrollToItem) return;\n\n    const $dropdown = this.$();\n    const $items = $dropdown.find('li');\n    let rangedIndex = index;\n\n    if (rangedIndex < 0) {\n      rangedIndex = $items.length - 1;\n    } else if (rangedIndex >= $items.length) {\n      rangedIndex = 0;\n    }\n\n    this.index = rangedIndex;\n\n    const $item = $items.removeClass('active').eq(rangedIndex).addClass('active');\n\n    if (scrollToItem) {\n      const dropdownScroll = $dropdown.scrollTop();\n      const dropdownTop = $dropdown.offset().top;\n      const dropdownBottom = dropdownTop + $dropdown.outerHeight();\n      const itemTop = $item.offset().top;\n      const itemBottom = itemTop + $item.outerHeight();\n\n      let scrollTop;\n      if (itemTop < dropdownTop) {\n        scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt($dropdown.css('padding-top'), 10);\n      } else if (itemBottom > dropdownBottom) {\n        scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt($dropdown.css('padding-bottom'), 10);\n      }\n\n      if (typeof scrollTop !== 'undefined') {\n        $dropdown.stop(true).animate({ scrollTop }, 100);\n      }\n    }\n  }\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport TextEditor from 'flarum/common/components/TextEditor';\nimport TextEditorButton from 'flarum/common/components/TextEditorButton';\nimport ReplyComposer from 'flarum/forum/components/ReplyComposer';\nimport EditPostComposer from 'flarum/forum/components/EditPostComposer';\nimport avatar from 'flarum/common/helpers/avatar';\nimport usernameHelper from 'flarum/common/helpers/username';\nimport highlight from 'flarum/common/helpers/highlight';\nimport KeyboardNavigatable from 'flarum/forum/utils/KeyboardNavigatable';\nimport { truncate } from 'flarum/common/utils/string';\nimport { throttle } from 'flarum/common/utils/throttleDebounce';\n\nimport AutocompleteDropdown from './fragments/AutocompleteDropdown';\nimport getMentionText from './utils/getMentionText';\n\nconst throttledSearch = throttle(\n  250, // 250ms timeout\n  function (typed, searched, returnedUsers, returnedUserIds, dropdown, buildSuggestions) {\n    const typedLower = typed.toLowerCase();\n    if (!searched.includes(typedLower)) {\n      app.store.find('users', { filter: { q: typed }, page: { limit: 5 } }).then((results) => {\n        results.forEach((u) => {\n          if (!returnedUserIds.has(u.id())) {\n            returnedUserIds.add(u.id());\n            returnedUsers.push(u);\n          }\n        });\n\n        buildSuggestions();\n      });\n      searched.push(typedLower);\n    }\n  }\n);\n\nexport default function addComposerAutocomplete() {\n  const $container = $('<div class=\"ComposerBody-mentionsDropdownContainer\"></div>');\n  const dropdown = new AutocompleteDropdown();\n\n  extend(TextEditor.prototype, 'oncreate', function () {\n    const $editor = this.$('.TextEditor-editor').wrap('<div class=\"ComposerBody-mentionsWrapper\"></div>');\n\n    this.navigator = new KeyboardNavigatable();\n    this.navigator\n      .when(() => dropdown.active)\n      .onUp(() => dropdown.navigate(-1))\n      .onDown(() => dropdown.navigate(1))\n      .onSelect(dropdown.complete.bind(dropdown))\n      .onCancel(dropdown.hide.bind(dropdown))\n      .bindTo($editor);\n\n    $editor.after($container);\n  });\n\n  extend(TextEditor.prototype, 'buildEditorParams', function (params) {\n    const searched = [];\n    let relMentionStart;\n    let absMentionStart;\n    let typed;\n    let matchTyped;\n\n    // We store users returned from an API here to preserve order in which they are returned\n    // This prevents the user list jumping around while users are returned.\n    // We also use a hashset for user IDs to provide O(1) lookup for the users already in the list.\n    const returnedUsers = Array.from(app.store.all('users'));\n    const returnedUserIds = new Set(returnedUsers.map((u) => u.id()));\n\n    const applySuggestion = (replacement) => {\n      this.attrs.composer.editor.replaceBeforeCursor(absMentionStart - 1, replacement + ' ');\n\n      dropdown.hide();\n    };\n\n    params.inputListeners.push(() => {\n      const selection = this.attrs.composer.editor.getSelectionRange();\n\n      const cursor = selection[0];\n\n      if (selection[1] - cursor > 0) return;\n\n      // Search backwards from the cursor for an '@' symbol. If we find one,\n      // we will want to show the autocomplete dropdown!\n      const lastChunk = this.attrs.composer.editor.getLastNChars(30);\n      absMentionStart = 0;\n      for (let i = lastChunk.length - 1; i >= 0; i--) {\n        const character = lastChunk.substr(i, 1);\n        if (character === '@' && (i == 0 || /\\s/.test(lastChunk.substr(i - 1, 1)))) {\n          relMentionStart = i + 1;\n          absMentionStart = cursor - lastChunk.length + i + 1;\n          break;\n        }\n      }\n\n      dropdown.hide();\n      dropdown.active = false;\n\n      if (absMentionStart) {\n        typed = lastChunk.substring(relMentionStart).toLowerCase();\n        matchTyped = typed.match(/^[\"|“]((?:(?!\"#).)+)$/);\n        typed = (matchTyped && matchTyped[1]) || typed;\n\n        const makeSuggestion = function (user, replacement, content, className = '') {\n          const username = usernameHelper(user);\n\n          if (typed) {\n            username.children = [highlight(username.text, typed)];\n            delete username.text;\n          }\n\n          return (\n            <button\n              className={'PostPreview ' + className}\n              onclick={() => applySuggestion(replacement)}\n              onmouseenter={function () {\n                dropdown.setIndex($(this).parent().index());\n              }}\n            >\n              <span className=\"PostPreview-content\">\n                {avatar(user)}\n                {username} {content}\n              </span>\n            </button>\n          );\n        };\n\n        const userMatches = function (user) {\n          const names = [user.username(), user.displayName()];\n\n          return names.some((name) => name.toLowerCase().substr(0, typed.length) === typed);\n        };\n\n        const buildSuggestions = () => {\n          const suggestions = [];\n\n          // If the user has started to type a username, then suggest users\n          // matching that username.\n          if (typed) {\n            returnedUsers.forEach((user) => {\n              if (!userMatches(user)) return;\n\n              suggestions.push(makeSuggestion(user, getMentionText(user), '', 'MentionsDropdown-user'));\n            });\n          }\n\n          // If the user is replying to a discussion, or if they are editing a\n          // post, then we can suggest other posts in the discussion to mention.\n          // We will add the 5 most recent comments in the discussion which\n          // match any username characters that have been typed.\n          if (this.attrs.composer.bodyMatches(ReplyComposer) || this.attrs.composer.bodyMatches(EditPostComposer)) {\n            const composerAttrs = this.attrs.composer.body.attrs;\n            const composerPost = composerAttrs.post;\n            const discussion = (composerPost && composerPost.discussion()) || composerAttrs.discussion;\n\n            if (discussion) {\n              discussion\n                .posts()\n                // Filter to only comment posts, and replies before this message\n                .filter((post) => post && post.contentType() === 'comment' && (!composerPost || post.number() < composerPost.number()))\n                // Sort by new to old\n                .sort((a, b) => b.createdAt() - a.createdAt())\n                // Filter to where the user matches what is being typed\n                .filter((post) => {\n                  const user = post.user();\n                  return user && userMatches(user);\n                })\n                // Get the first 5\n                .splice(0, 5)\n                // Make the suggestions\n                .forEach((post) => {\n                  const user = post.user();\n                  suggestions.push(\n                    makeSuggestion(\n                      user,\n                      getMentionText(user, post.id()),\n                      [\n                        app.translator.trans('flarum-mentions.forum.composer.reply_to_post_text', { number: post.number() }),\n                        ' — ',\n                        truncate(post.contentPlain(), 200),\n                      ],\n                      'MentionsDropdown-post'\n                    )\n                  );\n                });\n            }\n          }\n\n          if (suggestions.length) {\n            dropdown.items = suggestions;\n            m.render($container[0], dropdown.render());\n\n            dropdown.show();\n            const coordinates = this.attrs.composer.editor.getCaretCoordinates(absMentionStart);\n            const width = dropdown.$().outerWidth();\n            const height = dropdown.$().outerHeight();\n            const parent = dropdown.$().offsetParent();\n            let left = coordinates.left;\n            let top = coordinates.top + 15;\n\n            // Keep the dropdown inside the editor.\n            if (top + height > parent.height()) {\n              top = coordinates.top - height - 15;\n            }\n            if (left + width > parent.width()) {\n              left = parent.width() - width;\n            }\n\n            // Prevent the dropdown from going off screen on mobile\n            top = Math.max(-(parent.offset().top - $(document).scrollTop()), top);\n            left = Math.max(-parent.offset().left, left);\n\n            dropdown.show(left, top);\n          } else {\n            dropdown.active = false;\n            dropdown.hide();\n          }\n        };\n\n        dropdown.active = true;\n\n        buildSuggestions();\n\n        dropdown.setIndex(0);\n        dropdown.$().scrollTop(0);\n\n        // Don't send API calls searching for users until at least 2 characters have been typed.\n        // This focuses the mention results on users and posts in the discussion.\n        if (typed.length > 1 && app.forum.attribute('canSearchUsers')) {\n          throttledSearch(typed, searched, returnedUsers, returnedUserIds, dropdown, buildSuggestions);\n        }\n      }\n    });\n  });\n\n  extend(TextEditor.prototype, 'toolbarItems', function (items) {\n    items.add(\n      'mention',\n      <TextEditorButton onclick={() => this.attrs.composer.editor.insertAtCursor(' @')} icon=\"fas fa-at\">\n        {app.translator.trans('flarum-mentions.forum.composer.mention_tooltip')}\n      </TextEditorButton>\n    );\n  });\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Notification'];","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default class PostMentionedNotification extends Notification {\n  icon() {\n    return 'fas fa-reply';\n  }\n\n  href() {\n    const notification = this.attrs.notification;\n    const post = notification.subject();\n    const content = notification.content();\n\n    return app.route.discussion(post.discussion(), content && content.replyNumber);\n  }\n\n  content() {\n    const notification = this.attrs.notification;\n    const user = notification.fromUser();\n\n    return app.translator.trans('flarum-mentions.forum.notifications.post_mentioned_text', { user, count: 1 });\n  }\n\n  excerpt() {\n    return truncate(this.attrs.notification.subject().contentPlain(), 200);\n  }\n}\n","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default class UserMentionedNotification extends Notification {\n  icon() {\n    return 'fas fa-at';\n  }\n\n  href() {\n    const post = this.attrs.notification.subject();\n\n    return app.route.discussion(post.discussion(), post.number());\n  }\n\n  content() {\n    const user = this.attrs.notification.fromUser();\n\n    return app.translator.trans('flarum-mentions.forum.notifications.user_mentioned_text', { user });\n  }\n\n  excerpt() {\n    return truncate(this.attrs.notification.subject().contentPlain(), 200);\n  }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LinkButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/PostsUserPage'];","import app from 'flarum/forum/app';\nimport PostsUserPage from 'flarum/forum/components/PostsUserPage';\n\n/**\n * The `MentionsUserPage` component shows post which user Mentioned at\n */\nexport default class MentionsUserPage extends PostsUserPage {\n  /**\n   * Load a new page of the user's activity feed.\n   *\n   * @param {Integer} [offset] The position to start getting results from.\n   * @return {Promise}\n   * @protected\n   */\n  loadResults(offset) {\n    return app.store.find('posts', {\n      filter: {\n        type: 'comment',\n        mentioned: this.user.id(),\n      },\n      page: { offset, limit: this.loadLimit },\n      sort: '-createdAt',\n    });\n  }\n}\n","import app from 'flarum/forum/app';\nimport username from 'flarum/common/helpers/username';\nimport extractText from 'flarum/common/utils/extractText';\n\nexport function filterUserMentions(tag) {\n  let user;\n\n  if (app.forum.attribute('allowUsernameMentionFormat') && tag.hasAttribute('username'))\n    user = app.store.getBy('users', 'username', tag.getAttribute('username'));\n  else if (tag.hasAttribute('id')) user = app.store.getById('users', tag.getAttribute('id'));\n\n  if (user) {\n    tag.setAttribute('id', user.id());\n    tag.setAttribute('slug', user.slug());\n    tag.setAttribute('displayname', extractText(username(user)));\n\n    return true;\n  }\n\n  tag.invalidate();\n}\n\nexport function filterPostMentions(tag) {\n  const post = app.store.getById('posts', tag.getAttribute('id'));\n\n  if (post) {\n    tag.setAttribute('discussionid', post.discussion().id());\n    tag.setAttribute('number', post.number());\n    tag.setAttribute('displayname', extractText(username(post.user())));\n\n    return true;\n  }\n}\n","import MentionsUserPage from './components/MentionsUserPage';\nimport PostMentionedNotification from './components/PostMentionedNotification';\nimport UserMentionedNotification from './components/UserMentionedNotification';\nimport AutocompleteDropdown from './fragments/AutocompleteDropdown';\nimport PostQuoteButton from './fragments/PostQuoteButton';\nimport getCleanDisplayName from './utils/getCleanDisplayName';\nimport getMentionText from './utils/getMentionText';\nimport * as reply from './utils/reply';\nimport selectedText from './utils/selectedText';\nimport * as textFormatter from './utils/textFormatter';\n\nexport default {\n  'mentions/components/MentionsUserPage': MentionsUserPage,\n  'mentions/components/PostMentionedNotification': PostMentionedNotification,\n  'mentions/components/UserMentionedNotification': UserMentionedNotification,\n  'mentions/fragments/AutocompleteDropdown': AutocompleteDropdown,\n  'mentions/fragments/PostQuoteButton': PostQuoteButton,\n  'mentions/utils/getCleanDisplayName': getCleanDisplayName,\n  'mentions/utils/getMentionText': getMentionText,\n  'mentions/utils/reply': reply,\n  'mentions/utils/selectedText': selectedText,\n  'mentions/utils/textFormatter': textFormatter,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core;","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport NotificationGrid from 'flarum/forum/components/NotificationGrid';\nimport { getPlainContent } from 'flarum/common/utils/string';\n\nimport addPostMentionPreviews from './addPostMentionPreviews';\nimport addMentionedByList from './addMentionedByList';\nimport addPostReplyAction from './addPostReplyAction';\nimport addPostQuoteButton from './addPostQuoteButton';\nimport addComposerAutocomplete from './addComposerAutocomplete';\nimport PostMentionedNotification from './components/PostMentionedNotification';\nimport UserMentionedNotification from './components/UserMentionedNotification';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport MentionsUserPage from './components/MentionsUserPage';\n\napp.initializers.add('flarum-mentions', function () {\n  // For every mention of a post inside a post's content, set up a hover handler\n  // that shows a preview of the mentioned post.\n  addPostMentionPreviews();\n\n  // In the footer of each post, show information about who has replied (i.e.\n  // who the post has been mentioned by).\n  addMentionedByList();\n\n  // Add a 'reply' control to the footer of each post. When clicked, it will\n  // open up the composer and add a post mention to its contents.\n  addPostReplyAction();\n\n  // Show a Quote button when Post text is selected\n  addPostQuoteButton();\n\n  // After typing '@' in the composer, show a dropdown suggesting a bunch of\n  // posts or users that the user could mention.\n  addComposerAutocomplete();\n\n  app.notificationComponents.postMentioned = PostMentionedNotification;\n  app.notificationComponents.userMentioned = UserMentionedNotification;\n\n  // Add notification preferences.\n  extend(NotificationGrid.prototype, 'notificationTypes', function (items) {\n    items.add('postMentioned', {\n      name: 'postMentioned',\n      icon: 'fas fa-reply',\n      label: app.translator.trans('flarum-mentions.forum.settings.notify_post_mentioned_label'),\n    });\n\n    items.add('userMentioned', {\n      name: 'userMentioned',\n      icon: 'fas fa-at',\n      label: app.translator.trans('flarum-mentions.forum.settings.notify_user_mentioned_label'),\n    });\n  });\n\n  // Add mentions tab in user profile\n  app.routes['user.mentions'] = { path: '/u/:username/mentions', component: MentionsUserPage };\n  extend(UserPage.prototype, 'navItems', function (items) {\n    const user = this.user;\n    items.add(\n      'mentions',\n      LinkButton.component(\n        {\n          href: app.route('user.mentions', { username: user.slug() }),\n          name: 'mentions',\n          icon: 'fas fa-at',\n        },\n        app.translator.trans('flarum-mentions.forum.user.mentions_link')\n      ),\n      80\n    );\n  });\n\n  // Remove post mentions when rendering post previews.\n  getPlainContent.removeSelectors.push('a.PostMention');\n});\n\nexport * from './utils/textFormatter';\n\n// Expose compat API\nimport mentionsCompat from './compat';\nimport { compat } from '@flarum/core/forum';\n\nObject.assign(compat, mentionsCompat);\n","import { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport PostPreview from 'flarum/forum/components/PostPreview';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nexport default function addPostMentionPreviews() {\n  function addPreviews() {\n    const contentHtml = this.attrs.post.contentHtml();\n\n    if (contentHtml === this.oldPostContentHtml || this.isEditing()) return;\n\n    this.oldPostContentHtml = contentHtml;\n\n    const parentPost = this.attrs.post;\n    const $parentPost = this.$();\n\n    this.$().on('click', '.UserMention:not(.UserMention--deleted), .PostMention:not(.PostMention--deleted)', function (e) {\n      m.route.set(this.getAttribute('href'));\n      e.preventDefault();\n    });\n\n    this.$('.PostMention:not(.PostMention--deleted)').each(function () {\n      const $this = $(this);\n      const id = $this.data('id');\n      let timeout;\n\n      // Wrap the mention link in a wrapper element so that we can insert a\n      // preview popup as its sibling and relatively position it.\n      const $preview = $('<ul class=\"Dropdown-menu PostMention-preview fade\"/>');\n      $parentPost.append($preview);\n\n      const getPostElement = () => {\n        return $(`.PostStream-item[data-id=\"${id}\"]`);\n      };\n\n      const showPreview = () => {\n        // When the user hovers their mouse over the mention, look for the\n        // post that it's referring to in the stream, and determine if it's\n        // in the viewport. If it is, we will \"pulsate\" it.\n        const $post = getPostElement();\n        let visible = false;\n        if ($post.length) {\n          const top = $post.offset().top;\n          const scrollTop = window.pageYOffset;\n          if (top > scrollTop && top + $post.height() < scrollTop + $(window).height()) {\n            $post.addClass('pulsate');\n            visible = true;\n          }\n        }\n\n        // Otherwise, we will show a popup preview of the post. If the post\n        // hasn't yet been loaded, we will need to do that.\n        if (!visible) {\n          // Position the preview so that it appears above the mention.\n          // (The offsetParent should be .Post-body.)\n          const positionPreview = () => {\n            const previewHeight = $preview.outerHeight(true);\n            let offset = 0;\n\n            // If the preview goes off the top of the viewport, reposition it to\n            // be below the mention.\n            if ($this.offset().top - previewHeight < $(window).scrollTop() + $('#header').outerHeight()) {\n              offset += $this.outerHeight(true);\n            } else {\n              offset -= previewHeight;\n            }\n\n            $preview\n              .show()\n              .css('top', $this.offset().top - $parentPost.offset().top + offset)\n              .css('left', $this.offsetParent().offset().left - $parentPost.offset().left)\n              .css('max-width', $this.offsetParent().width());\n          };\n\n          const showPost = (post) => {\n            const discussion = post.discussion();\n\n            m.render($preview[0], [\n              discussion !== parentPost.discussion() ? (\n                <li>\n                  <span className=\"PostMention-preview-discussion\">{discussion.title()}</span>\n                </li>\n              ) : (\n                ''\n              ),\n              <li>{PostPreview.component({ post })}</li>,\n            ]);\n            positionPreview();\n          };\n\n          const post = app.store.getById('posts', id);\n          if (post && post.discussion()) {\n            showPost(post);\n          } else {\n            m.render($preview[0], LoadingIndicator.component());\n            app.store.find('posts', id).then(showPost);\n            positionPreview();\n          }\n\n          setTimeout(() => $preview.off('transitionend').addClass('in'));\n        }\n      };\n\n      const hidePreview = () => {\n        getPostElement().removeClass('pulsate');\n        if ($preview.hasClass('in')) {\n          $preview.removeClass('in').one('transitionend', () => $preview.hide());\n        }\n      };\n\n      // On a touch (mobile) device we cannot hover the link to reveal the preview.\n      // Instead we cancel the navigation so that a click reveals the preview.\n      // Users can then click on the preview to go to the post if desired.\n      $this.on('touchend', (e) => {\n        if (e.cancelable) {\n          e.preventDefault();\n        }\n      });\n\n      $this\n        .add($preview)\n        .hover(\n          () => {\n            clearTimeout(timeout);\n            timeout = setTimeout(showPreview, 250);\n          },\n          () => {\n            clearTimeout(timeout);\n            getPostElement().removeClass('pulsate');\n            timeout = setTimeout(hidePreview, 250);\n          }\n        )\n        .on('touchend', (e) => {\n          showPreview();\n          e.stopPropagation();\n        });\n\n      $(document).on('touchend', hidePreview);\n    });\n  }\n\n  extend(CommentPost.prototype, 'oncreate', addPreviews);\n  extend(CommentPost.prototype, 'onupdate', addPreviews);\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Model from 'flarum/common/Model';\nimport Post from 'flarum/common/models/Post';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Link from 'flarum/common/components/Link';\nimport PostPreview from 'flarum/forum/components/PostPreview';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\nimport icon from 'flarum/common/helpers/icon';\n\nexport default function addMentionedByList() {\n  Post.prototype.mentionedBy = Model.hasMany('mentionedBy');\n\n  function hidePreview() {\n    this.$('.Post-mentionedBy-preview')\n      .removeClass('in')\n      .one('transitionend', function () {\n        $(this).hide();\n      });\n  }\n\n  extend(CommentPost.prototype, 'oncreate', function () {\n    let timeout;\n    const post = this.attrs.post;\n    const replies = post.mentionedBy();\n\n    if (replies && replies.length) {\n      const $preview = $('<ul class=\"Dropdown-menu Post-mentionedBy-preview fade\"/>');\n      this.$().append($preview);\n\n      const $parentPost = this.$();\n      const $this = this.$('.Post-mentionedBy');\n\n      const showPreview = () => {\n        if (!$preview.hasClass('in') && $preview.is(':visible')) return;\n\n        // When the user hovers their mouse over the list of people who have\n        // replied to the post, render a list of reply previews into a\n        // popup.\n        m.render(\n          $preview[0],\n          replies.map((reply) => (\n            <li data-number={reply.number()}>\n              {PostPreview.component({\n                post: reply,\n                onclick: hidePreview.bind(this),\n              })}\n            </li>\n          ))\n        );\n\n        $preview\n          .show()\n          .css('top', $this.offset().top - $parentPost.offset().top + $this.outerHeight(true))\n          .css('left', $this.offsetParent().offset().left - $parentPost.offset().left)\n          .css('max-width', $parentPost.width());\n\n        setTimeout(() => $preview.off('transitionend').addClass('in'));\n      };\n\n      $this.add($preview).hover(\n        () => {\n          clearTimeout(timeout);\n          timeout = setTimeout(showPreview, 250);\n        },\n        () => {\n          clearTimeout(timeout);\n          timeout = setTimeout(hidePreview, 250);\n        }\n      );\n\n      // Whenever the user hovers their mouse over a particular name in the\n      // list of repliers, highlight the corresponding post in the preview\n      // popup.\n      this.$()\n        .find('.Post-mentionedBy-summary a')\n        .hover(\n          function () {\n            $preview.find('[data-number=\"' + $(this).data('number') + '\"]').addClass('active');\n          },\n          function () {\n            $preview.find('[data-number]').removeClass('active');\n          }\n        );\n    }\n  });\n\n  extend(CommentPost.prototype, 'footerItems', function (items) {\n    const post = this.attrs.post;\n    const replies = post.mentionedBy();\n\n    if (replies && replies.length) {\n      const users = [];\n      const repliers = replies\n        .sort((reply) => (reply.user() === app.session.user ? -1 : 0))\n        .filter((reply) => {\n          const user = reply.user();\n          if (users.indexOf(user) === -1) {\n            users.push(user);\n            return true;\n          }\n        });\n\n      const limit = 4;\n      const overLimit = repliers.length > limit;\n\n      // Create a list of unique users who have replied. So even if a user has\n      // replied twice, they will only be in this array once.\n      const names = repliers.slice(0, overLimit ? limit - 1 : limit).map((reply) => {\n        const user = reply.user();\n\n        return (\n          <Link href={app.route.post(reply)} onclick={hidePreview.bind(this)} data-number={reply.number()}>\n            {app.session.user === user ? app.translator.trans('flarum-mentions.forum.post.you_text') : username(user)}\n          </Link>\n        );\n      });\n\n      // If there are more users that we've run out of room to display, add a \"x\n      // others\" name to the end of the list. Clicking on it will display a modal\n      // with a full list of names.\n      if (overLimit) {\n        const count = repliers.length - names.length;\n\n        names.push(app.translator.trans('flarum-mentions.forum.post.others_text', { count }));\n      }\n\n      items.add(\n        'replies',\n        <div className=\"Post-mentionedBy\">\n          <span className=\"Post-mentionedBy-summary\">\n            {icon('fas fa-reply')}\n            {app.translator.trans('flarum-mentions.forum.post.mentioned_by' + (repliers[0].user() === app.session.user ? '_self' : '') + '_text', {\n              count: names.length,\n              users: punctuateSeries(names),\n            })}\n          </span>\n        </div>\n      );\n    }\n  });\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Button from 'flarum/common/components/Button';\nimport CommentPost from 'flarum/forum/components/CommentPost';\n\nimport reply from './utils/reply';\n\nexport default function () {\n  extend(CommentPost.prototype, 'actionItems', function (items) {\n    const post = this.attrs.post;\n\n    if (post.isHidden() || (app.session.user && !post.discussion().canReply())) return;\n\n    items.add(\n      'reply',\n      <Button className=\"Button Button--link\" onclick={() => reply(post)}>\n        {app.translator.trans('flarum-mentions.forum.post.reply_link')}\n      </Button>\n    );\n  });\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\n\nimport PostQuoteButton from './fragments/PostQuoteButton';\nimport selectedText from './utils/selectedText';\n\nexport default function addPostQuoteButton() {\n  extend(CommentPost.prototype, 'oncreate', function () {\n    const post = this.attrs.post;\n\n    if (post.isHidden() || (app.session.user && !post.discussion().canReply())) return;\n\n    const $postBody = this.$('.Post-body');\n\n    // Wrap the quote button in a wrapper element so that we can render\n    // button into it.\n    const $container = $('<div class=\"Post-quoteButtonContainer\"></div>');\n\n    const button = new PostQuoteButton(post);\n\n    const handler = function (e) {\n      setTimeout(() => {\n        const content = selectedText($postBody);\n        if (content) {\n          button.content = content;\n          m.render($container[0], button.render());\n\n          const rects = window.getSelection().getRangeAt(0).getClientRects();\n          const firstRect = rects[0];\n\n          if (e.clientY < firstRect.bottom && e.clientX - firstRect.right < firstRect.left - e.clientX) {\n            button.showStart(firstRect.left, firstRect.top);\n          } else {\n            const lastRect = rects[rects.length - 1];\n            button.showEnd(lastRect.right, lastRect.bottom);\n          }\n        }\n      }, 1);\n    };\n\n    this.$().after($container).on('mouseup', handler);\n\n    if ('ontouchstart' in window) {\n      document.addEventListener('selectionchange', handler, false);\n    }\n  });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","getDeletedUserText","extractText","app","getCleanDisplayName","user","useDisplayName","displayName","username","replace","getMentionText","postId","undefined","id","insertMention","post","composer","quote","Promise","resolve","mention","fields","content","body","attrs","originalContent","cursorPosition","editor","getSelectionRange","preceding","slice","precedingNewlines","length","match","insertAtCursor","Array","join","trim","reply","EditPostComposer","discussion","DiscussionControls","then","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","PostQuoteButton","view","class","onclick","icon","className","show","left","top","$this","this","$","parentOffset","offsetParent","offset","css","hideHandler","hide","bind","document","on","showStart","window","scrollTop","outerHeight","showEnd","right","bottom","outerWidth","off","Fragment","selectedText","selection","getSelection","rangeCount","range","getRangeAt","parent","commonAncestorContainer","contains","clone","append","cloneContents","find","replaceWith","alt","src","innerText","href","text","AutocompleteDropdown","items","active","index","keyWasJustPressed","map","item","navigate","delta","setIndex","clearTimeout","keyWasJustPressedTimeout","setTimeout","complete","eq","click","scrollToItem","$dropdown","$items","rangedIndex","$item","removeClass","addClass","dropdownScroll","dropdownTop","dropdownBottom","itemTop","itemBottom","parseInt","stop","animate","throttledSearch","throttle","typed","searched","returnedUsers","returnedUserIds","dropdown","buildSuggestions","typedLower","toLowerCase","includes","filter","q","page","limit","results","forEach","u","has","add","push","PostMentionedNotification","notification","subject","replyNumber","fromUser","count","excerpt","truncate","contentPlain","Notification","UserMentionedNotification","number","MentionsUserPage","loadResults","type","mentioned","loadLimit","sort","PostsUserPage","filterUserMentions","tag","hasAttribute","getAttribute","setAttribute","slug","invalidate","filterPostMentions","textFormatter","$container","addPreviews","contentHtml","oldPostContentHtml","isEditing","parentPost","$parentPost","e","m","route","set","preventDefault","each","timeout","data","$preview","getPostElement","showPreview","$post","visible","pageYOffset","height","positionPreview","previewHeight","width","showPost","render","title","PostPreview","store","getById","LoadingIndicator","hidePreview","hasClass","one","cancelable","hover","stopPropagation","extend","CommentPost","addPostMentionPreviews","Post","Model","replies","mentionedBy","is","users","repliers","indexOf","overLimit","names","punctuateSeries","addMentionedByList","isHidden","canReply","$postBody","button","handler","rects","getClientRects","firstRect","clientY","clientX","lastRect","after","addEventListener","TextEditor","$editor","wrap","navigator","KeyboardNavigatable","when","onUp","onDown","onSelect","onCancel","bindTo","params","relMentionStart","absMentionStart","matchTyped","from","Set","inputListeners","cursor","lastChunk","getLastNChars","i","substr","test","substring","makeSuggestion","replacement","usernameHelper","children","highlight","replaceBeforeCursor","applySuggestion","onmouseenter","avatar","userMatches","some","name","suggestions","bodyMatches","ReplyComposer","composerAttrs","composerPost","posts","contentType","b","createdAt","splice","coordinates","getCaretCoordinates","Math","max","NotificationGrid","label","path","component","UserPage","LinkButton","getPlainContent","assign","mentionsCompat"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,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IAAMlG,EAAOyD,KAAKzD,KAClBkG,EAAMiD,IACJ,WACAwJ,KAAAA,UACE,CACE5M,KAAMjG,IAAAA,MAAU,gBAAiB,CAAEK,SAAUH,EAAK6K,SAClD0G,KAAM,WACNpO,KAAM,aAERrD,IAAAA,WAAAA,MAAqB,6CAEvB,OAKJ8S,EAAAA,gBAAAA,gBAAAA,KAAqC,oBASvC/T,OAAOgU,OAAOlT,GAAAA,OAAQmT,K","sources":["webpack://@flarum/mentions/webpack/bootstrap","webpack://@flarum/mentions/webpack/runtime/compat get default export","webpack://@flarum/mentions/webpack/runtime/define property getters","webpack://@flarum/mentions/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/mentions/webpack/runtime/make namespace object","webpack://@flarum/mentions/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/NotificationGrid']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/utils/string']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/PostPreview']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/Model']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/models/Post']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/Link']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/utils/DiscussionControls']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/EditPostComposer']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@flarum/mentions/./src/forum/utils/getCleanDisplayName.js","webpack://@flarum/mentions/./src/forum/utils/getMentionText.js","webpack://@flarum/mentions/./src/forum/utils/reply.js","webpack://@flarum/mentions/../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@flarum/mentions/../../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@flarum/mentions/external root \"flarum.core.compat['common/Fragment']\"","webpack://@flarum/mentions/./src/forum/fragments/PostQuoteButton.js","webpack://@flarum/mentions/./src/forum/utils/selectedText.js","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/TextEditor']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/TextEditorButton']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/ReplyComposer']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/helpers/highlight']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/utils/KeyboardNavigatable']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/utils/throttleDebounce']\"","webpack://@flarum/mentions/./src/forum/fragments/AutocompleteDropdown.js","webpack://@flarum/mentions/./src/forum/addComposerAutocomplete.js","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/Notification']\"","webpack://@flarum/mentions/./src/forum/components/PostMentionedNotification.js","webpack://@flarum/mentions/./src/forum/components/UserMentionedNotification.js","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/UserPage']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/components/LinkButton']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['forum/components/PostsUserPage']\"","webpack://@flarum/mentions/./src/forum/components/MentionsUserPage.js","webpack://@flarum/mentions/./src/forum/utils/textFormatter.js","webpack://@flarum/mentions/./src/forum/compat.js","webpack://@flarum/mentions/external assign \"flarum.core\"","webpack://@flarum/mentions/./src/forum/index.js","webpack://@flarum/mentions/./src/forum/addPostMentionPreviews.js","webpack://@flarum/mentions/./src/forum/addMentionedByList.js","webpack://@flarum/mentions/./src/forum/addPostReplyAction.js","webpack://@flarum/mentions/./src/forum/addPostQuoteButton.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/NotificationGrid'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/string'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/PostPreview'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/punctuateSeries'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/DiscussionControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/EditPostComposer'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","import app from 'flarum/forum/app';\nimport extractText from 'flarum/common/utils/extractText';\n\n/**\n * Whether to use the old mentions format.\n *\n * `'@username'` or `'@\"Display name\"'`\n */\nexport const shouldUseOldFormat = () => app.forum.attribute('allowUsernameMentionFormat') || false;\n\nconst getDeletedUserText = () => extractText(app.translator.trans('core.lib.username.deleted_text'));\n\n/**\n * Fetches a user's username or display name.\n *\n * Chooses based on the format option set in the admin settings page.\n *\n * @param user An instance of the User model to fetch the username for\n * @param useDisplayName If `true`, uses `user.displayName()`, otherwise, uses `user.username()`\n */\nexport default function getCleanDisplayName(user, useDisplayName = true) {\n  if (!user) return getDeletedUserText().replace(/\"#[a-z]{0,3}[0-9]+/, '_');\n\n  const text = (useDisplayName ? user.displayName() : user.username()) || getDeletedUserText();\n\n  return text.replace(/\"#[a-z]{0,3}[0-9]+/, '_');\n}\n","import getCleanDisplayName, { shouldUseOldFormat } from './getCleanDisplayName';\n\n/**\n * Fetches the mention text for a specified user (and optionally a post ID for replies).\n *\n * Automatically determines which mention syntax to be used based on the option in the\n * admin dashboard. Also performs display name clean-up automatically.\n *\n * @example <caption>New display name syntax</caption>\n * // '@\"User\"#1'\n * getMentionText(User) // User is ID 1, display name is 'User'\n *\n * @example <caption>Replying</caption>\n * // '@\"User\"#p13'\n * getMentionText(User, 13) // User display name is 'User', post ID is 13\n *\n * @example <caption>Using old syntax</caption>\n * // '@username'\n * getMentionText(User) // User's username is 'username'\n */\nexport default function getMentionText(user, postId) {\n  if (postId === undefined) {\n    if (shouldUseOldFormat()) {\n      // Plain @username\n      const cleanText = getCleanDisplayName(user, false);\n      return `@${cleanText}`;\n    }\n    // @\"Display name\"#UserID\n    const cleanText = getCleanDisplayName(user);\n    return `@\"${cleanText}\"#${user.id()}`;\n  } else {\n    // @\"Display name\"#pPostID\n    const cleanText = getCleanDisplayName(user);\n    return `@\"${cleanText}\"#p${postId}`;\n  }\n}\n","import app from 'flarum/forum/app';\nimport DiscussionControls from 'flarum/forum/utils/DiscussionControls';\nimport EditPostComposer from 'flarum/forum/components/EditPostComposer';\nimport getMentionText from './getMentionText';\n\nexport function insertMention(post, composer, quote) {\n  return new Promise((resolve) => {\n    const user = post.user();\n    const mention = getMentionText(user, post.id()) + ' ';\n\n    // If the composer is empty, then assume we're starting a new reply.\n    // In which case we don't want the user to have to confirm if they\n    // close the composer straight away.\n    if (!composer.fields.content()) {\n      composer.body.attrs.originalContent = mention;\n    }\n\n    const cursorPosition = composer.editor.getSelectionRange()[0];\n    const preceding = composer.fields.content().slice(0, cursorPosition);\n    const precedingNewlines = preceding.length == 0 ? 0 : 3 - preceding.match(/(\\n{0,2})$/)[0].length;\n\n    composer.editor.insertAtCursor(\n      Array(precedingNewlines).join('\\n') + // Insert up to two newlines, depending on preceding whitespace\n        (quote ? '> ' + mention + quote.trim().replace(/\\n/g, '\\n> ') + '\\n\\n' : mention),\n      false\n    );\n    return resolve(composer);\n  });\n}\n\nexport default function reply(post, quote) {\n  if (app.composer.bodyMatches(EditPostComposer) && app.composer.body.attrs.post.discussion() === post.discussion()) {\n    // If we're already editing a post in the discussion of post we're quoting,\n    // insert the mention directly.\n    return insertMention(post, app.composer, quote);\n  } else {\n    // The default \"Reply\" action behavior will only open a new composer if\n    // necessary, but it will always be a ReplyComposer, hence the exceptional\n    // case above.\n    return DiscussionControls.replyAction.call(post.discussion()).then((composer) => insertMention(post, composer, quote));\n  }\n}\n","export default function _setPrototypeOf(o, p) {\n  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n    o.__proto__ = p;\n    return o;\n  };\n\n  return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n  subClass.prototype = Object.create(superClass.prototype);\n  subClass.prototype.constructor = subClass;\n  setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Fragment'];","import app from 'flarum/forum/app';\nimport Fragment from 'flarum/common/Fragment';\nimport icon from 'flarum/common/helpers/icon';\n\nimport reply from '../utils/reply';\n\nexport default class PostQuoteButton extends Fragment {\n  constructor(post) {\n    super();\n\n    this.post = post;\n  }\n\n  view() {\n    return (\n      <button\n        class=\"Button PostQuoteButton\"\n        onclick={() => {\n          reply(this.post, this.content);\n        }}\n      >\n        {icon('fas fa-quote-left', { className: 'Button-icon' })}\n        {app.translator.trans('flarum-mentions.forum.post.quote_button')}\n      </button>\n    );\n  }\n\n  show(left, top) {\n    const $this = this.$().show();\n    const parentOffset = $this.offsetParent().offset();\n\n    $this.css('left', left - parentOffset.left).css('top', top - parentOffset.top);\n\n    this.hideHandler = this.hide.bind(this);\n    $(document).on('mouseup', this.hideHandler);\n  }\n\n  showStart(left, top) {\n    const $this = this.$();\n\n    this.show(left, $(window).scrollTop() + top - $this.outerHeight() - 5);\n  }\n\n  showEnd(right, bottom) {\n    const $this = this.$();\n\n    this.show(right - $this.outerWidth(), $(window).scrollTop() + bottom + 5);\n  }\n\n  hide() {\n    this.$().hide();\n    $(document).off('mouseup', this.hideHandler);\n  }\n}\n","/**\n * Finds the selected text in the provided composer body.\n */\nexport default function selectedText(body) {\n  const selection = window.getSelection();\n\n  if (selection?.rangeCount) {\n    const range = selection.getRangeAt(0);\n    const parent = range.commonAncestorContainer;\n\n    if (body[0] === parent || $.contains(body[0], parent)) {\n      const clone = $('<div>').append(range.cloneContents());\n\n      // Replace emoji images with their shortcode (found in alt attribute)\n      clone.find('img.emoji').replaceWith(function () {\n        return this.alt;\n      });\n\n      // Replace all other images with a Markdown image\n      clone.find('img').replaceWith(function () {\n        return `![](${this.src})`;\n      });\n\n      // Replace all links with a Markdown link\n      clone.find('a').replaceWith(function () {\n        return `[${this.innerText}](${this.href})`;\n      });\n\n      return clone.text();\n    }\n  }\n  return '';\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/TextEditor'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/TextEditorButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/ReplyComposer'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/highlight'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/KeyboardNavigatable'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/throttleDebounce'];","import Fragment from 'flarum/common/Fragment';\n\nexport default class AutocompleteDropdown extends Fragment {\n  items = [];\n  active = false;\n  index = 0;\n  keyWasJustPressed = false;\n\n  view() {\n    return (\n      <ul className=\"Dropdown-menu MentionsDropdown\">\n        {this.items.map((item) => (\n          <li>{item}</li>\n        ))}\n      </ul>\n    );\n  }\n\n  show(left, top) {\n    this.$()\n      .show()\n      .css({\n        left: left + 'px',\n        top: top + 'px',\n      });\n    this.active = true;\n  }\n\n  hide() {\n    this.$().hide();\n    this.active = false;\n  }\n\n  navigate(delta) {\n    this.keyWasJustPressed = true;\n    this.setIndex(this.index + delta, true);\n    clearTimeout(this.keyWasJustPressedTimeout);\n    this.keyWasJustPressedTimeout = setTimeout(() => (this.keyWasJustPressed = false), 500);\n  }\n\n  complete() {\n    this.$('li').eq(this.index).find('button').click();\n  }\n\n  setIndex(index, scrollToItem) {\n    if (this.keyWasJustPressed && !scrollToItem) return;\n\n    const $dropdown = this.$();\n    const $items = $dropdown.find('li');\n    let rangedIndex = index;\n\n    if (rangedIndex < 0) {\n      rangedIndex = $items.length - 1;\n    } else if (rangedIndex >= $items.length) {\n      rangedIndex = 0;\n    }\n\n    this.index = rangedIndex;\n\n    const $item = $items.removeClass('active').eq(rangedIndex).addClass('active');\n\n    if (scrollToItem) {\n      const dropdownScroll = $dropdown.scrollTop();\n      const dropdownTop = $dropdown.offset().top;\n      const dropdownBottom = dropdownTop + $dropdown.outerHeight();\n      const itemTop = $item.offset().top;\n      const itemBottom = itemTop + $item.outerHeight();\n\n      let scrollTop;\n      if (itemTop < dropdownTop) {\n        scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt($dropdown.css('padding-top'), 10);\n      } else if (itemBottom > dropdownBottom) {\n        scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt($dropdown.css('padding-bottom'), 10);\n      }\n\n      if (typeof scrollTop !== 'undefined') {\n        $dropdown.stop(true).animate({ scrollTop }, 100);\n      }\n    }\n  }\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport TextEditor from 'flarum/common/components/TextEditor';\nimport TextEditorButton from 'flarum/common/components/TextEditorButton';\nimport ReplyComposer from 'flarum/forum/components/ReplyComposer';\nimport EditPostComposer from 'flarum/forum/components/EditPostComposer';\nimport avatar from 'flarum/common/helpers/avatar';\nimport usernameHelper from 'flarum/common/helpers/username';\nimport highlight from 'flarum/common/helpers/highlight';\nimport KeyboardNavigatable from 'flarum/forum/utils/KeyboardNavigatable';\nimport { truncate } from 'flarum/common/utils/string';\nimport { throttle } from 'flarum/common/utils/throttleDebounce';\n\nimport AutocompleteDropdown from './fragments/AutocompleteDropdown';\nimport getMentionText from './utils/getMentionText';\n\nconst throttledSearch = throttle(\n  250, // 250ms timeout\n  function (typed, searched, returnedUsers, returnedUserIds, dropdown, buildSuggestions) {\n    const typedLower = typed.toLowerCase();\n    if (!searched.includes(typedLower)) {\n      app.store.find('users', { filter: { q: typed }, page: { limit: 5 } }).then((results) => {\n        results.forEach((u) => {\n          if (!returnedUserIds.has(u.id())) {\n            returnedUserIds.add(u.id());\n            returnedUsers.push(u);\n          }\n        });\n\n        buildSuggestions();\n      });\n      searched.push(typedLower);\n    }\n  }\n);\n\nexport default function addComposerAutocomplete() {\n  const $container = $('<div class=\"ComposerBody-mentionsDropdownContainer\"></div>');\n  const dropdown = new AutocompleteDropdown();\n\n  extend(TextEditor.prototype, 'oncreate', function () {\n    const $editor = this.$('.TextEditor-editor').wrap('<div class=\"ComposerBody-mentionsWrapper\"></div>');\n\n    this.navigator = new KeyboardNavigatable();\n    this.navigator\n      .when(() => dropdown.active)\n      .onUp(() => dropdown.navigate(-1))\n      .onDown(() => dropdown.navigate(1))\n      .onSelect(dropdown.complete.bind(dropdown))\n      .onCancel(dropdown.hide.bind(dropdown))\n      .bindTo($editor);\n\n    $editor.after($container);\n  });\n\n  extend(TextEditor.prototype, 'buildEditorParams', function (params) {\n    const searched = [];\n    let relMentionStart;\n    let absMentionStart;\n    let typed;\n    let matchTyped;\n\n    // We store users returned from an API here to preserve order in which they are returned\n    // This prevents the user list jumping around while users are returned.\n    // We also use a hashset for user IDs to provide O(1) lookup for the users already in the list.\n    const returnedUsers = Array.from(app.store.all('users'));\n    const returnedUserIds = new Set(returnedUsers.map((u) => u.id()));\n\n    const applySuggestion = (replacement) => {\n      this.attrs.composer.editor.replaceBeforeCursor(absMentionStart - 1, replacement + ' ');\n\n      dropdown.hide();\n    };\n\n    params.inputListeners.push(() => {\n      const selection = this.attrs.composer.editor.getSelectionRange();\n\n      const cursor = selection[0];\n\n      if (selection[1] - cursor > 0) return;\n\n      // Search backwards from the cursor for an '@' symbol. If we find one,\n      // we will want to show the autocomplete dropdown!\n      const lastChunk = this.attrs.composer.editor.getLastNChars(30);\n      absMentionStart = 0;\n      for (let i = lastChunk.length - 1; i >= 0; i--) {\n        const character = lastChunk.substr(i, 1);\n        if (character === '@' && (i == 0 || /\\s/.test(lastChunk.substr(i - 1, 1)))) {\n          relMentionStart = i + 1;\n          absMentionStart = cursor - lastChunk.length + i + 1;\n          break;\n        }\n      }\n\n      dropdown.hide();\n      dropdown.active = false;\n\n      if (absMentionStart) {\n        typed = lastChunk.substring(relMentionStart).toLowerCase();\n        matchTyped = typed.match(/^[\"|“]((?:(?!\"#).)+)$/);\n        typed = (matchTyped && matchTyped[1]) || typed;\n\n        const makeSuggestion = function (user, replacement, content, className = '') {\n          const username = usernameHelper(user);\n\n          if (typed) {\n            username.children = [highlight(username.text, typed)];\n            delete username.text;\n          }\n\n          return (\n            <button\n              className={'PostPreview ' + className}\n              onclick={() => applySuggestion(replacement)}\n              onmouseenter={function () {\n                dropdown.setIndex($(this).parent().index());\n              }}\n            >\n              <span className=\"PostPreview-content\">\n                {avatar(user)}\n                {username} {content}\n              </span>\n            </button>\n          );\n        };\n\n        const userMatches = function (user) {\n          const names = [user.username(), user.displayName()];\n\n          return names.some((name) => name.toLowerCase().substr(0, typed.length) === typed);\n        };\n\n        const buildSuggestions = () => {\n          const suggestions = [];\n\n          // If the user has started to type a username, then suggest users\n          // matching that username.\n          if (typed) {\n            returnedUsers.forEach((user) => {\n              if (!userMatches(user)) return;\n\n              suggestions.push(makeSuggestion(user, getMentionText(user), '', 'MentionsDropdown-user'));\n            });\n          }\n\n          // If the user is replying to a discussion, or if they are editing a\n          // post, then we can suggest other posts in the discussion to mention.\n          // We will add the 5 most recent comments in the discussion which\n          // match any username characters that have been typed.\n          if (this.attrs.composer.bodyMatches(ReplyComposer) || this.attrs.composer.bodyMatches(EditPostComposer)) {\n            const composerAttrs = this.attrs.composer.body.attrs;\n            const composerPost = composerAttrs.post;\n            const discussion = (composerPost && composerPost.discussion()) || composerAttrs.discussion;\n\n            if (discussion) {\n              discussion\n                .posts()\n                // Filter to only comment posts, and replies before this message\n                .filter((post) => post && post.contentType() === 'comment' && (!composerPost || post.number() < composerPost.number()))\n                // Sort by new to old\n                .sort((a, b) => b.createdAt() - a.createdAt())\n                // Filter to where the user matches what is being typed\n                .filter((post) => {\n                  const user = post.user();\n                  return user && userMatches(user);\n                })\n                // Get the first 5\n                .splice(0, 5)\n                // Make the suggestions\n                .forEach((post) => {\n                  const user = post.user();\n                  suggestions.push(\n                    makeSuggestion(\n                      user,\n                      getMentionText(user, post.id()),\n                      [\n                        app.translator.trans('flarum-mentions.forum.composer.reply_to_post_text', { number: post.number() }),\n                        ' — ',\n                        truncate(post.contentPlain(), 200),\n                      ],\n                      'MentionsDropdown-post'\n                    )\n                  );\n                });\n            }\n          }\n\n          if (suggestions.length) {\n            dropdown.items = suggestions;\n            m.render($container[0], dropdown.render());\n\n            dropdown.show();\n            const coordinates = this.attrs.composer.editor.getCaretCoordinates(absMentionStart);\n            const width = dropdown.$().outerWidth();\n            const height = dropdown.$().outerHeight();\n            const parent = dropdown.$().offsetParent();\n            let left = coordinates.left;\n            let top = coordinates.top + 15;\n\n            // Keep the dropdown inside the editor.\n            if (top + height > parent.height()) {\n              top = coordinates.top - height - 15;\n            }\n            if (left + width > parent.width()) {\n              left = parent.width() - width;\n            }\n\n            // Prevent the dropdown from going off screen on mobile\n            top = Math.max(-(parent.offset().top - $(document).scrollTop()), top);\n            left = Math.max(-parent.offset().left, left);\n\n            dropdown.show(left, top);\n          } else {\n            dropdown.active = false;\n            dropdown.hide();\n          }\n        };\n\n        dropdown.active = true;\n\n        buildSuggestions();\n\n        dropdown.setIndex(0);\n        dropdown.$().scrollTop(0);\n\n        // Don't send API calls searching for users until at least 2 characters have been typed.\n        // This focuses the mention results on users and posts in the discussion.\n        if (typed.length > 1 && app.forum.attribute('canSearchUsers')) {\n          throttledSearch(typed, searched, returnedUsers, returnedUserIds, dropdown, buildSuggestions);\n        }\n      }\n    });\n  });\n\n  extend(TextEditor.prototype, 'toolbarItems', function (items) {\n    items.add(\n      'mention',\n      <TextEditorButton onclick={() => this.attrs.composer.editor.insertAtCursor(' @')} icon=\"fas fa-at\">\n        {app.translator.trans('flarum-mentions.forum.composer.mention_tooltip')}\n      </TextEditorButton>\n    );\n  });\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Notification'];","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default class PostMentionedNotification extends Notification {\n  icon() {\n    return 'fas fa-reply';\n  }\n\n  href() {\n    const notification = this.attrs.notification;\n    const post = notification.subject();\n    const content = notification.content();\n\n    return app.route.discussion(post.discussion(), content && content.replyNumber);\n  }\n\n  content() {\n    const notification = this.attrs.notification;\n    const user = notification.fromUser();\n\n    return app.translator.trans('flarum-mentions.forum.notifications.post_mentioned_text', { user, count: 1 });\n  }\n\n  excerpt() {\n    return truncate(this.attrs.notification.subject().contentPlain() || '', 200);\n  }\n}\n","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default class UserMentionedNotification extends Notification {\n  icon() {\n    return 'fas fa-at';\n  }\n\n  href() {\n    const post = this.attrs.notification.subject();\n\n    return app.route.discussion(post.discussion(), post.number());\n  }\n\n  content() {\n    const user = this.attrs.notification.fromUser();\n\n    return app.translator.trans('flarum-mentions.forum.notifications.user_mentioned_text', { user });\n  }\n\n  excerpt() {\n    return truncate(this.attrs.notification.subject().contentPlain(), 200);\n  }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LinkButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/PostsUserPage'];","import app from 'flarum/forum/app';\nimport PostsUserPage from 'flarum/forum/components/PostsUserPage';\n\n/**\n * The `MentionsUserPage` component shows post which user Mentioned at\n */\nexport default class MentionsUserPage extends PostsUserPage {\n  /**\n   * Load a new page of the user's activity feed.\n   *\n   * @param {Integer} [offset] The position to start getting results from.\n   * @return {Promise}\n   * @protected\n   */\n  loadResults(offset) {\n    return app.store.find('posts', {\n      filter: {\n        type: 'comment',\n        mentioned: this.user.id(),\n      },\n      page: { offset, limit: this.loadLimit },\n      sort: '-createdAt',\n    });\n  }\n}\n","import app from 'flarum/forum/app';\nimport username from 'flarum/common/helpers/username';\nimport extractText from 'flarum/common/utils/extractText';\n\nexport function filterUserMentions(tag) {\n  let user;\n\n  if (app.forum.attribute('allowUsernameMentionFormat') && tag.hasAttribute('username'))\n    user = app.store.getBy('users', 'username', tag.getAttribute('username'));\n  else if (tag.hasAttribute('id')) user = app.store.getById('users', tag.getAttribute('id'));\n\n  if (user) {\n    tag.setAttribute('id', user.id());\n    tag.setAttribute('slug', user.slug());\n    tag.setAttribute('displayname', extractText(username(user)));\n\n    return true;\n  }\n\n  tag.invalidate();\n}\n\nexport function filterPostMentions(tag) {\n  const post = app.store.getById('posts', tag.getAttribute('id'));\n\n  if (post) {\n    tag.setAttribute('discussionid', post.discussion().id());\n    tag.setAttribute('number', post.number());\n    tag.setAttribute('displayname', extractText(username(post.user())));\n\n    return true;\n  }\n}\n","import MentionsUserPage from './components/MentionsUserPage';\nimport PostMentionedNotification from './components/PostMentionedNotification';\nimport UserMentionedNotification from './components/UserMentionedNotification';\nimport AutocompleteDropdown from './fragments/AutocompleteDropdown';\nimport PostQuoteButton from './fragments/PostQuoteButton';\nimport getCleanDisplayName from './utils/getCleanDisplayName';\nimport getMentionText from './utils/getMentionText';\nimport * as reply from './utils/reply';\nimport selectedText from './utils/selectedText';\nimport * as textFormatter from './utils/textFormatter';\n\nexport default {\n  'mentions/components/MentionsUserPage': MentionsUserPage,\n  'mentions/components/PostMentionedNotification': PostMentionedNotification,\n  'mentions/components/UserMentionedNotification': UserMentionedNotification,\n  'mentions/fragments/AutocompleteDropdown': AutocompleteDropdown,\n  'mentions/fragments/PostQuoteButton': PostQuoteButton,\n  'mentions/utils/getCleanDisplayName': getCleanDisplayName,\n  'mentions/utils/getMentionText': getMentionText,\n  'mentions/utils/reply': reply,\n  'mentions/utils/selectedText': selectedText,\n  'mentions/utils/textFormatter': textFormatter,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core;","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport NotificationGrid from 'flarum/forum/components/NotificationGrid';\nimport { getPlainContent } from 'flarum/common/utils/string';\n\nimport addPostMentionPreviews from './addPostMentionPreviews';\nimport addMentionedByList from './addMentionedByList';\nimport addPostReplyAction from './addPostReplyAction';\nimport addPostQuoteButton from './addPostQuoteButton';\nimport addComposerAutocomplete from './addComposerAutocomplete';\nimport PostMentionedNotification from './components/PostMentionedNotification';\nimport UserMentionedNotification from './components/UserMentionedNotification';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport MentionsUserPage from './components/MentionsUserPage';\n\napp.initializers.add('flarum-mentions', function () {\n  // For every mention of a post inside a post's content, set up a hover handler\n  // that shows a preview of the mentioned post.\n  addPostMentionPreviews();\n\n  // In the footer of each post, show information about who has replied (i.e.\n  // who the post has been mentioned by).\n  addMentionedByList();\n\n  // Add a 'reply' control to the footer of each post. When clicked, it will\n  // open up the composer and add a post mention to its contents.\n  addPostReplyAction();\n\n  // Show a Quote button when Post text is selected\n  addPostQuoteButton();\n\n  // After typing '@' in the composer, show a dropdown suggesting a bunch of\n  // posts or users that the user could mention.\n  addComposerAutocomplete();\n\n  app.notificationComponents.postMentioned = PostMentionedNotification;\n  app.notificationComponents.userMentioned = UserMentionedNotification;\n\n  // Add notification preferences.\n  extend(NotificationGrid.prototype, 'notificationTypes', function (items) {\n    items.add('postMentioned', {\n      name: 'postMentioned',\n      icon: 'fas fa-reply',\n      label: app.translator.trans('flarum-mentions.forum.settings.notify_post_mentioned_label'),\n    });\n\n    items.add('userMentioned', {\n      name: 'userMentioned',\n      icon: 'fas fa-at',\n      label: app.translator.trans('flarum-mentions.forum.settings.notify_user_mentioned_label'),\n    });\n  });\n\n  // Add mentions tab in user profile\n  app.routes['user.mentions'] = { path: '/u/:username/mentions', component: MentionsUserPage };\n  extend(UserPage.prototype, 'navItems', function (items) {\n    const user = this.user;\n    items.add(\n      'mentions',\n      LinkButton.component(\n        {\n          href: app.route('user.mentions', { username: user.slug() }),\n          name: 'mentions',\n          icon: 'fas fa-at',\n        },\n        app.translator.trans('flarum-mentions.forum.user.mentions_link')\n      ),\n      80\n    );\n  });\n\n  // Remove post mentions when rendering post previews.\n  getPlainContent.removeSelectors.push('a.PostMention');\n});\n\nexport * from './utils/textFormatter';\n\n// Expose compat API\nimport mentionsCompat from './compat';\nimport { compat } from '@flarum/core/forum';\n\nObject.assign(compat, mentionsCompat);\n","import { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport PostPreview from 'flarum/forum/components/PostPreview';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nexport default function addPostMentionPreviews() {\n  function addPreviews() {\n    const contentHtml = this.attrs.post.contentHtml();\n\n    if (contentHtml === this.oldPostContentHtml || this.isEditing()) return;\n\n    this.oldPostContentHtml = contentHtml;\n\n    const parentPost = this.attrs.post;\n    const $parentPost = this.$();\n\n    this.$().on('click', '.UserMention:not(.UserMention--deleted), .PostMention:not(.PostMention--deleted)', function (e) {\n      m.route.set(this.getAttribute('href'));\n      e.preventDefault();\n    });\n\n    this.$('.PostMention:not(.PostMention--deleted)').each(function () {\n      const $this = $(this);\n      const id = $this.data('id');\n      let timeout;\n\n      // Wrap the mention link in a wrapper element so that we can insert a\n      // preview popup as its sibling and relatively position it.\n      const $preview = $('<ul class=\"Dropdown-menu PostMention-preview fade\"/>');\n      $parentPost.append($preview);\n\n      const getPostElement = () => {\n        return $(`.PostStream-item[data-id=\"${id}\"]`);\n      };\n\n      const showPreview = () => {\n        // When the user hovers their mouse over the mention, look for the\n        // post that it's referring to in the stream, and determine if it's\n        // in the viewport. If it is, we will \"pulsate\" it.\n        const $post = getPostElement();\n        let visible = false;\n        if ($post.length) {\n          const top = $post.offset().top;\n          const scrollTop = window.pageYOffset;\n          if (top > scrollTop && top + $post.height() < scrollTop + $(window).height()) {\n            $post.addClass('pulsate');\n            visible = true;\n          }\n        }\n\n        // Otherwise, we will show a popup preview of the post. If the post\n        // hasn't yet been loaded, we will need to do that.\n        if (!visible) {\n          // Position the preview so that it appears above the mention.\n          // (The offsetParent should be .Post-body.)\n          const positionPreview = () => {\n            const previewHeight = $preview.outerHeight(true);\n            let offset = 0;\n\n            // If the preview goes off the top of the viewport, reposition it to\n            // be below the mention.\n            if ($this.offset().top - previewHeight < $(window).scrollTop() + $('#header').outerHeight()) {\n              offset += $this.outerHeight(true);\n            } else {\n              offset -= previewHeight;\n            }\n\n            $preview\n              .show()\n              .css('top', $this.offset().top - $parentPost.offset().top + offset)\n              .css('left', $this.offsetParent().offset().left - $parentPost.offset().left)\n              .css('max-width', $this.offsetParent().width());\n          };\n\n          const showPost = (post) => {\n            const discussion = post.discussion();\n\n            m.render($preview[0], [\n              discussion !== parentPost.discussion() ? (\n                <li>\n                  <span className=\"PostMention-preview-discussion\">{discussion.title()}</span>\n                </li>\n              ) : (\n                ''\n              ),\n              <li>{PostPreview.component({ post })}</li>,\n            ]);\n            positionPreview();\n          };\n\n          const post = app.store.getById('posts', id);\n          if (post && post.discussion()) {\n            showPost(post);\n          } else {\n            m.render($preview[0], LoadingIndicator.component());\n            app.store.find('posts', id).then(showPost);\n            positionPreview();\n          }\n\n          setTimeout(() => $preview.off('transitionend').addClass('in'));\n        }\n      };\n\n      const hidePreview = () => {\n        getPostElement().removeClass('pulsate');\n        if ($preview.hasClass('in')) {\n          $preview.removeClass('in').one('transitionend', () => $preview.hide());\n        }\n      };\n\n      // On a touch (mobile) device we cannot hover the link to reveal the preview.\n      // Instead we cancel the navigation so that a click reveals the preview.\n      // Users can then click on the preview to go to the post if desired.\n      $this.on('touchend', (e) => {\n        if (e.cancelable) {\n          e.preventDefault();\n        }\n      });\n\n      $this\n        .add($preview)\n        .hover(\n          () => {\n            clearTimeout(timeout);\n            timeout = setTimeout(showPreview, 250);\n          },\n          () => {\n            clearTimeout(timeout);\n            getPostElement().removeClass('pulsate');\n            timeout = setTimeout(hidePreview, 250);\n          }\n        )\n        .on('touchend', (e) => {\n          showPreview();\n          e.stopPropagation();\n        });\n\n      $(document).on('touchend', hidePreview);\n    });\n  }\n\n  extend(CommentPost.prototype, 'oncreate', addPreviews);\n  extend(CommentPost.prototype, 'onupdate', addPreviews);\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Model from 'flarum/common/Model';\nimport Post from 'flarum/common/models/Post';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Link from 'flarum/common/components/Link';\nimport PostPreview from 'flarum/forum/components/PostPreview';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\nimport icon from 'flarum/common/helpers/icon';\n\nexport default function addMentionedByList() {\n  Post.prototype.mentionedBy = Model.hasMany('mentionedBy');\n\n  function hidePreview() {\n    this.$('.Post-mentionedBy-preview')\n      .removeClass('in')\n      .one('transitionend', function () {\n        $(this).hide();\n      });\n  }\n\n  extend(CommentPost.prototype, 'oncreate', function () {\n    let timeout;\n    const post = this.attrs.post;\n    const replies = post.mentionedBy();\n\n    if (replies && replies.length) {\n      const $preview = $('<ul class=\"Dropdown-menu Post-mentionedBy-preview fade\"/>');\n      this.$().append($preview);\n\n      const $parentPost = this.$();\n      const $this = this.$('.Post-mentionedBy');\n\n      const showPreview = () => {\n        if (!$preview.hasClass('in') && $preview.is(':visible')) return;\n\n        // When the user hovers their mouse over the list of people who have\n        // replied to the post, render a list of reply previews into a\n        // popup.\n        m.render(\n          $preview[0],\n          replies.map((reply) => (\n            <li data-number={reply.number()}>\n              {PostPreview.component({\n                post: reply,\n                onclick: hidePreview.bind(this),\n              })}\n            </li>\n          ))\n        );\n\n        $preview\n          .show()\n          .css('top', $this.offset().top - $parentPost.offset().top + $this.outerHeight(true))\n          .css('left', $this.offsetParent().offset().left - $parentPost.offset().left)\n          .css('max-width', $parentPost.width());\n\n        setTimeout(() => $preview.off('transitionend').addClass('in'));\n      };\n\n      $this.add($preview).hover(\n        () => {\n          clearTimeout(timeout);\n          timeout = setTimeout(showPreview, 250);\n        },\n        () => {\n          clearTimeout(timeout);\n          timeout = setTimeout(hidePreview, 250);\n        }\n      );\n\n      // Whenever the user hovers their mouse over a particular name in the\n      // list of repliers, highlight the corresponding post in the preview\n      // popup.\n      this.$()\n        .find('.Post-mentionedBy-summary a')\n        .hover(\n          function () {\n            $preview.find('[data-number=\"' + $(this).data('number') + '\"]').addClass('active');\n          },\n          function () {\n            $preview.find('[data-number]').removeClass('active');\n          }\n        );\n    }\n  });\n\n  extend(CommentPost.prototype, 'footerItems', function (items) {\n    const post = this.attrs.post;\n    const replies = post.mentionedBy();\n\n    if (replies && replies.length) {\n      const users = [];\n      const repliers = replies\n        .sort((reply) => (reply.user() === app.session.user ? -1 : 0))\n        .filter((reply) => {\n          const user = reply.user();\n          if (users.indexOf(user) === -1) {\n            users.push(user);\n            return true;\n          }\n        });\n\n      const limit = 4;\n      const overLimit = repliers.length > limit;\n\n      // Create a list of unique users who have replied. So even if a user has\n      // replied twice, they will only be in this array once.\n      const names = repliers.slice(0, overLimit ? limit - 1 : limit).map((reply) => {\n        const user = reply.user();\n\n        return (\n          <Link href={app.route.post(reply)} onclick={hidePreview.bind(this)} data-number={reply.number()}>\n            {app.session.user === user ? app.translator.trans('flarum-mentions.forum.post.you_text') : username(user)}\n          </Link>\n        );\n      });\n\n      // If there are more users that we've run out of room to display, add a \"x\n      // others\" name to the end of the list. Clicking on it will display a modal\n      // with a full list of names.\n      if (overLimit) {\n        const count = repliers.length - names.length;\n\n        names.push(app.translator.trans('flarum-mentions.forum.post.others_text', { count }));\n      }\n\n      items.add(\n        'replies',\n        <div className=\"Post-mentionedBy\">\n          <span className=\"Post-mentionedBy-summary\">\n            {icon('fas fa-reply')}\n            {app.translator.trans('flarum-mentions.forum.post.mentioned_by' + (repliers[0].user() === app.session.user ? '_self' : '') + '_text', {\n              count: names.length,\n              users: punctuateSeries(names),\n            })}\n          </span>\n        </div>\n      );\n    }\n  });\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Button from 'flarum/common/components/Button';\nimport CommentPost from 'flarum/forum/components/CommentPost';\n\nimport reply from './utils/reply';\n\nexport default function () {\n  extend(CommentPost.prototype, 'actionItems', function (items) {\n    const post = this.attrs.post;\n\n    if (post.isHidden() || (app.session.user && !post.discussion().canReply())) return;\n\n    items.add(\n      'reply',\n      <Button className=\"Button Button--link\" onclick={() => reply(post)}>\n        {app.translator.trans('flarum-mentions.forum.post.reply_link')}\n      </Button>\n    );\n  });\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\n\nimport PostQuoteButton from './fragments/PostQuoteButton';\nimport selectedText from './utils/selectedText';\n\nexport default function addPostQuoteButton() {\n  extend(CommentPost.prototype, 'oncreate', function () {\n    const post = this.attrs.post;\n\n    if (post.isHidden() || (app.session.user && !post.discussion().canReply())) return;\n\n    const $postBody = this.$('.Post-body');\n\n    // Wrap the quote button in a wrapper element so that we can render\n    // button into it.\n    const $container = $('<div class=\"Post-quoteButtonContainer\"></div>');\n\n    const button = new PostQuoteButton(post);\n\n    const handler = function (e) {\n      setTimeout(() => {\n        const content = selectedText($postBody);\n        if (content) {\n          button.content = content;\n          m.render($container[0], button.render());\n\n          const rects = window.getSelection().getRangeAt(0).getClientRects();\n          const firstRect = rects[0];\n\n          if (e.clientY < firstRect.bottom && e.clientX - firstRect.right < firstRect.left - e.clientX) {\n            button.showStart(firstRect.left, firstRect.top);\n          } else {\n            const lastRect = rects[rects.length - 1];\n            button.showEnd(lastRect.right, lastRect.bottom);\n          }\n        }\n      }, 1);\n    };\n\n    this.$().after($container).on('mouseup', handler);\n\n    if ('ontouchstart' in window) {\n      document.addEventListener('selectionchange', handler, false);\n    }\n  });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","getDeletedUserText","extractText","app","getCleanDisplayName","user","useDisplayName","displayName","username","replace","getMentionText","postId","undefined","id","insertMention","post","composer","quote","Promise","resolve","mention","fields","content","body","attrs","originalContent","cursorPosition","editor","getSelectionRange","preceding","slice","precedingNewlines","length","match","insertAtCursor","Array","join","trim","reply","EditPostComposer","discussion","DiscussionControls","then","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","PostQuoteButton","view","class","onclick","icon","className","show","left","top","$this","this","$","parentOffset","offsetParent","offset","css","hideHandler","hide","bind","document","on","showStart","window","scrollTop","outerHeight","showEnd","right","bottom","outerWidth","off","Fragment","selectedText","selection","getSelection","rangeCount","range","getRangeAt","parent","commonAncestorContainer","contains","clone","append","cloneContents","find","replaceWith","alt","src","innerText","href","text","AutocompleteDropdown","items","active","index","keyWasJustPressed","map","item","navigate","delta","setIndex","clearTimeout","keyWasJustPressedTimeout","setTimeout","complete","eq","click","scrollToItem","$dropdown","$items","rangedIndex","$item","removeClass","addClass","dropdownScroll","dropdownTop","dropdownBottom","itemTop","itemBottom","parseInt","stop","animate","throttledSearch","throttle","typed","searched","returnedUsers","returnedUserIds","dropdown","buildSuggestions","typedLower","toLowerCase","includes","filter","q","page","limit","results","forEach","u","has","add","push","PostMentionedNotification","notification","subject","replyNumber","fromUser","count","excerpt","truncate","contentPlain","Notification","UserMentionedNotification","number","MentionsUserPage","loadResults","type","mentioned","loadLimit","sort","PostsUserPage","filterUserMentions","tag","hasAttribute","getAttribute","setAttribute","slug","invalidate","filterPostMentions","textFormatter","$container","addPreviews","contentHtml","oldPostContentHtml","isEditing","parentPost","$parentPost","e","m","route","set","preventDefault","each","timeout","data","$preview","getPostElement","showPreview","$post","visible","pageYOffset","height","positionPreview","previewHeight","width","showPost","render","title","PostPreview","store","getById","LoadingIndicator","hidePreview","hasClass","one","cancelable","hover","stopPropagation","extend","CommentPost","addPostMentionPreviews","Post","Model","replies","mentionedBy","is","users","repliers","indexOf","overLimit","names","punctuateSeries","addMentionedByList","isHidden","canReply","$postBody","button","handler","rects","getClientRects","firstRect","clientY","clientX","lastRect","after","addEventListener","TextEditor","$editor","wrap","navigator","KeyboardNavigatable","when","onUp","onDown","onSelect","onCancel","bindTo","params","relMentionStart","absMentionStart","matchTyped","from","Set","inputListeners","cursor","lastChunk","getLastNChars","i","substr","test","substring","makeSuggestion","replacement","usernameHelper","children","highlight","replaceBeforeCursor","applySuggestion","onmouseenter","avatar","userMatches","some","name","suggestions","bodyMatches","ReplyComposer","composerAttrs","composerPost","posts","contentType","b","createdAt","splice","coordinates","getCaretCoordinates","Math","max","NotificationGrid","label","path","component","UserPage","LinkButton","getPlainContent","assign","mentionsCompat"],"sourceRoot":""}
\ No newline at end of file