From 6505ca5b95405a57553f02b102e9c9c825bb1862 Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Thu, 10 Nov 2022 23:30:18 +0000 Subject: [PATCH] Bundled output for commit 259db92b9a8da063116e38c4034fe6c1bef42cbf Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- js/dist/admin.js.map | 2 +- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index 55827c2..74c9518 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.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,CAAM,ECLdF,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,IAE1E,ECNDR,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,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAAA,IAAqB,mBAAmB,WACtCA,IAAAA,cAAAA,IACO,mBACJC,gBAAgB,CACfC,QAAS,wCACTC,KAAM,UACNC,MAAOJ,IAAAA,WAAAA,MAAqB,8DAC5BK,KAAML,IAAAA,WAAAA,MAAqB,+DAE5BM,mBACC,CACEC,WAAY,gBACZH,MAAOJ,IAAAA,WAAAA,MAAqB,0DAC5BQ,KAAM,aAER,QAEL,G","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['admin/app']\"","webpack://@flarum/mentions/./src/admin/index.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['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('flarum-mentions', function () {\n app.extensionData\n .for('flarum-mentions')\n .registerSetting({\n setting: 'flarum-mentions.allow_username_format',\n type: 'boolean',\n label: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_label'),\n help: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_text'),\n })\n .registerPermission(\n {\n permission: 'mentionGroups',\n label: app.translator.trans('flarum-mentions.admin.permissions.mention_groups_label'),\n icon: 'fas fa-at',\n },\n 'start'\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","app","registerSetting","setting","type","label","help","registerPermission","permission","icon"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.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,CAAM,ECLdF,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,IAE1E,ECNDR,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,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAAA,IAAqB,mBAAmB,WACtCA,IAAAA,cAAAA,IACO,mBACJC,gBAAgB,CACfC,QAAS,wCACTC,KAAM,UACNC,MAAOJ,IAAAA,WAAAA,MAAqB,8DAC5BK,KAAML,IAAAA,WAAAA,MAAqB,+DAE5BM,mBACC,CACEC,WAAY,gBACZH,MAAOJ,IAAAA,WAAAA,MAAqB,0DAC5BQ,KAAM,aAER,QAEN,G","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['admin/app']\"","webpack://@flarum/mentions/./src/admin/index.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['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('flarum-mentions', function () {\n app.extensionData\n .for('flarum-mentions')\n .registerSetting({\n setting: 'flarum-mentions.allow_username_format',\n type: 'boolean',\n label: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_label'),\n help: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_text'),\n })\n .registerPermission(\n {\n permission: 'mentionGroups',\n label: app.translator.trans('flarum-mentions.admin.permissions.mention_groups_label'),\n icon: 'fas fa-at',\n },\n 'start'\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","app","registerSetting","setting","type","label","help","registerPermission","permission","icon"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index ed952b8..e56bfca 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:n=>{var e=n&&n.__esModule?()=>n.default:()=>n;return t.d(e,{a:e}),e},d:(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};(()=>{"use strict";t.r(n),t.d(n,{filterGroupMentions:()=>Nt,filterPostMentions:()=>kt,filterUserMentions:()=>At});var e={};t.r(e),t.d(e,{default:()=>O,insertMention:()=>W});var o={};t.r(o),t.d(o,{filterGroupMentions:()=>Nt,filterPostMentions:()=>kt,filterUserMentions:()=>At});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 M=flarum.core.compat["common/helpers/punctuateSeries"];var C=t.n(M);const _=flarum.core.compat["common/helpers/username"];var T=t.n(_);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 D=t.n(S);const I=flarum.core.compat["forum/components/EditPostComposer"];var U=t.n(I);const E=flarum.core.compat["common/utils/extractText"];var H=t.n(E),j=function(){return H()(i().translator.trans("core.lib.username.deleted_text"))};function G(t,n){return void 0===n&&(n=!0),t?((n?t.displayName():t.username())||j()).replace(/"#[a-z]{0,3}[0-9]+/,"_"):j().replace(/"#[a-z]{0,3}[0-9]+/,"_")}function L(t,n,e){if(void 0!==t&&void 0===n)return i().forum.attribute("allowUsernameMentionFormat")?"@"+G(t,!1):'@"'+G(t)+'"#'+t.id();if(void 0!==t&&void 0!==n)return'@"'+G(t)+'"#p'+n;if(void 0!==e)return'@"'+e.namePlural()+'"#g'+e.id();throw"No parameters were passed"}function W(t,n,e){return new Promise((function(o){var r=L(t.user(),t.id())+" ";n.fields.content()||(n.body.attrs.originalContent=r);var s=n.editor.getSelectionRange()[0],i=n.fields.content().slice(0,s),a=0==i.length?0:3-i.match(/(\n{0,2})$/)[0].length;return n.editor.insertAtCursor(Array(a).join("\n")+(e?"> "+r+e.trim().replace(/\n/g,"\n> ")+"\n\n":r),!1),o(n)}))}function O(t,n){return i().composer.bodyMatches(U())&&i().composer.body.attrs.post.discussion()===t.discussion()?W(t,i().composer,n):D().replyAction.call(t.discussion()).then((function(e){return W(t,e,n)}))}function R(t,n){return R=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t},R(t,n)}function q(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,R(t,n)}const J=flarum.core.compat["common/Fragment"];var F=t.n(J),z=function(t){function n(n){var e;return(e=t.call(this)||this).post=n,e}q(n,t);var e=n.prototype;return e.view=function(){var t=this;return m("button",{class:"Button PostQuoteButton",onclick:function(){O(t.post,t.content)}},A()("fas fa-quote-left",{className:"Button-icon"}),i().translator.trans("flarum-mentions.forum.post.quote_button"))},e.show=function(t,n){var e=this.$().show(),o=e.offsetParent().offset();e.css("left",t-o.left).css("top",n-o.top),this.hideHandler=this.hide.bind(this),$(document).on("mouseup",this.hideHandler)},e.showStart=function(t,n){var e=this.$();this.show(t,$(window).scrollTop()+n-e.outerHeight()-5)},e.showEnd=function(t,n){var e=this.$();this.show(t-e.outerWidth(),$(window).scrollTop()+n+5)},e.hide=function(){this.$().hide(),$(document).off("mouseup",this.hideHandler)},n}(F());function Q(t){var n=window.getSelection();if(!n.isCollapsed){var e=n.getRangeAt(0),o=e.commonAncestorContainer;if(t[0]===o||$.contains(t[0],o)){var r=$("
").append(e.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 X=flarum.core.compat["common/components/TextEditor"];var Y=t.n(X);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 nt=flarum.core.compat["common/helpers/avatar"];var et=t.n(nt);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"],ut=flarum.core.compat["common/components/Badge"];var ct=t.n(ut);const mt=flarum.core.compat["common/models/Group"];var ft=t.n(mt),lt=function(t){function n(){for(var n,e=arguments.length,o=new Array(e),r=0;r=o.length&&(r=0),this.index=r;var s=o.removeClass("active").eq(r).addClass("active");if(n){var i,a=e.scrollTop(),u=e.offset().top,c=u+e.outerHeight(),m=s.offset().top,f=m+s.outerHeight();mc&&(i=a-c+f+parseInt(e.css("padding-bottom"),10)),void 0!==i&&e.stop(!0).animate({scrollTop:i},100)}}},n}(F()),dt=(0,at.throttle)(250,(function(t,n,e,o,r,s){var a=t.toLowerCase();n.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()),e.push(t))})),s()})),n.push(a))}));const pt=flarum.core.compat["forum/components/Notification"];var ht=t.n(pt),vt=function(t){function n(){return t.apply(this,arguments)||this}q(n,t);var e=n.prototype;return e.icon=function(){return"fas fa-reply"},e.href=function(){var t=this.attrs.notification,n=t.subject(),e=t.content();return i().route.discussion(n.discussion(),e&&e.replyNumber)},e.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.post_mentioned_text",{user:t,count:1})},e.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain()||"",200)},n}(ht()),gt=function(t){function n(){return t.apply(this,arguments)||this}q(n,t);var e=n.prototype;return e.icon=function(){return"fas fa-at"},e.href=function(){var t=this.attrs.notification.subject();return i().route.discussion(t.discussion(),t.number())},e.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.user_mentioned_text",{user:t})},e.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain(),200)},n}(ht()),yt=function(t){function n(){return t.apply(this,arguments)||this}q(n,t);var e=n.prototype;return e.icon=function(){return"fas fa-at"},e.href=function(){var t=this.attrs.notification.subject();return i().route.discussion(t.discussion(),t.number())},e.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.group_mentioned_text",{user:t})},e.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain(),200)},n}(ht());const bt=flarum.core.compat["forum/components/UserPage"];var wt=t.n(bt);const Pt=flarum.core.compat["common/components/LinkButton"];var xt=t.n(Pt);const Mt=flarum.core.compat["forum/components/PostsUserPage"];var $t=function(t){function n(){return t.apply(this,arguments)||this}return q(n,t),n.prototype.loadResults=function(t){return i().store.find("posts",{filter:{type:"comment",mentioned:this.user.id()},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})},n}(t.n(Mt)());const Ct=flarum.core.compat["common/models/User"];var _t=t.n(Ct);const Tt=flarum.core.compat["common/utils/isDark"];var Bt=t.n(Tt);function At(t){var n;if(i().forum.attribute("allowUsernameMentionFormat")&&t.hasAttribute("username")?n=i().store.getBy("users","username",t.getAttribute("username")):t.hasAttribute("id")&&(n=i().store.getById("users",t.getAttribute("id"))),n)return t.setAttribute("id",n.id()),t.setAttribute("slug",n.slug()),t.setAttribute("displayname",H()(T()(n))),!0;t.invalidate()}function kt(t){var n=i().store.getById("posts",t.getAttribute("id"));if(n)return t.setAttribute("discussionid",n.discussion().id()),t.setAttribute("number",n.number()),t.setAttribute("displayname",H()(T()(n.user()))),!0}function Nt(t){var n,e;if(null!=(n=i().session)&&null!=(e=n.user)&&e.canMentionGroups()){var o=i().store.getById("groups",t.getAttribute("id"));if(o)return t.setAttribute("groupname",H()(o.namePlural())),t.setAttribute("icon",o.icon()),t.setAttribute("color",o.color()),t.setAttribute("class",Bt()(o.color())?"GroupMention--light":"GroupMention--dark"),!0}t.invalidate()}const St={"mentions/components/MentionsUserPage":$t,"mentions/components/PostMentionedNotification":vt,"mentions/components/UserMentionedNotification":gt,"mentions/components/GroupMentionedNotification":yt,"mentions/fragments/AutocompleteDropdown":lt,"mentions/fragments/PostQuoteButton":z,"mentions/utils/getCleanDisplayName":G,"mentions/utils/getMentionText":L,"mentions/utils/reply":e,"mentions/utils/selectedText":Q,"mentions/utils/textFormatter":o},Dt=flarum.core;i().initializers.add("flarum-mentions",(function(){var t,n;_t().prototype.canMentionGroups=y().attribute("canMentionGroups"),function(){function t(){var t=this.attrs.post.contentHtml();if(t!==this.oldPostContentHtml&&!this.isEditing()){this.oldPostContentHtml=t;var n=this.attrs.post,e=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=$('
'),n=new lt,(0,r.extend)(Y().prototype,"oncreate",(function(){var e=this.$(".TextEditor-editor").wrap('
');this.navigator=new(it()),this.navigator.when((function(){return n.active})).onUp((function(){return n.navigate(-1)})).onDown((function(){return n.navigate(1)})).onSelect(n.complete.bind(n)).onCancel(n.hide.bind(n)).bindTo(e),e.after(t)})),(0,r.extend)(Y().prototype,"buildEditorParams",(function(e){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()}))),p=Array.from(i().store.all("groups").filter((function(t){return t.id()!=ft().GUEST_ID&&t.id()!=ft().MEMBER_ID}))),h=function(t){u.attrs.composer.editor.replaceBeforeCursor(r-1,t+" "),n.hide()};e.inputListeners.push((function(){var e=u.attrs.composer.editor.getSelectionRange(),v=e[0];if(!(e[1]-v>0)){var g=u.attrs.composer.editor.getLastNChars(30);r=0;for(var y=g.length-1;y>=0;y--)if("@"===g.substr(y,1)&&(0==y||/\s/.test(g.substr(y-1,1)))){o=y+1,r=v-g.length+y+1;break}if(n.hide(),n.active=!1,r){s=g.substring(o).toLowerCase(),a=s.match(/^["|“]((?:(?!"#).)+)$/),s=a&&a[1]||s;var b=function(t,e,o,r){void 0===r&&(r="");var i=T()(t);return s&&(i.children=[rt()(i.text,s)],delete i.text),m("button",{className:"PostPreview "+r,onclick:function(){return h(e)},onmouseenter:function(){n.setIndex($(this).parent().index())}},m("span",{className:"PostPreview-content"},et()(t),i," ",o))},w=function(t){return[t.username(),t.displayName()].some((function(t){return t.toLowerCase().substr(0,s.length)===s}))},P=function(){var e,o,a=[];if(s&&(l.forEach((function(t){w(t)&&a.push(b(t,L(t),"","MentionsDropdown-user"))})),null!=(e=i().session)&&null!=(o=e.user)&&o.canMentionGroups()&&p.forEach((function(t){(function(t){return[t.nameSingular(),t.namePlural()].some((function(t){return t.toLowerCase().substr(0,s.length)===s}))})(t)&&a.push(function(t,e,o,r){void 0===r&&(r="");var i=t.namePlural().toLowerCase();return s&&(i=rt()(i,s)),m("button",{className:"PostPreview "+r,onclick:function(){return h(e)},onmouseenter:function(){n.setIndex($(this).parent().index())}},m("span",{className:"PostPreview-content"},m(ct(),{class:"Avatar Badge Badge--group--"+t.id()+" Badge-icon ",color:t.color(),type:"group",icon:t.icon()}),m("span",{className:"username"},i)))}(t,L(void 0,void 0,t),0,"MentionsDropdown-group"))}))),u.attrs.composer.bodyMatches(tt())||u.attrs.composer.bodyMatches(U())){var f=u.attrs.composer.body.attrs,d=f.post,v=d&&d.discussion()||f.discussion;v&&v.posts().filter((function(t){return t&&"comment"===t.contentType()&&(!d||t.number()x.height()&&(C=g.top-P-15),M+y>x.width()&&(M=x.width()-y),C=Math.max(-(x.offset().top-$(document).scrollTop()),C),M=Math.max(-x.offset().left,M),n.show(M,C)}else n.active=!1,n.hide()};n.active=!0,P(),n.setIndex(0),n.$().scrollTop(0),s.length>1&&i().forum.attribute("canSearchUsers")&&dt(s,f,l,d,n,P)}}}))})),(0,r.extend)(Y().prototype,"toolbarItems",(function(t){var n=this;t.add("mention",m(V(),{onclick:function(){return n.attrs.composer.editor.insertAtCursor(" @")},icon:"fas fa-at"},i().translator.trans("flarum-mentions.forum.composer.mention_tooltip")))})),i().notificationComponents.postMentioned=vt,i().notificationComponents.userMentioned=gt,i().notificationComponents.groupMentioned=yt,(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")}),t.add("groupMentioned",{name:"groupMentioned",icon:"fas fa-at",label:i().translator.trans("flarum-mentions.forum.settings.notify_group_mentioned_label")})})),i().routes["user.mentions"]={path:"/u/:username/mentions",component:$t},(0,r.extend)(wt().prototype,"navItems",(function(t){var n=this.user;t.add("mentions",xt().component({href:i().route("user.mentions",{username:n.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(Dt.compat,St)})(),module.exports=n})(); +(()=>{var t={n:n=>{var e=n&&n.__esModule?()=>n.default:()=>n;return t.d(e,{a:e}),e},d:(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};(()=>{"use strict";t.r(n),t.d(n,{filterGroupMentions:()=>Nt,filterPostMentions:()=>kt,filterUserMentions:()=>At});var e={};t.r(e),t.d(e,{default:()=>W,insertMention:()=>L});var o={};t.r(o),t.d(o,{filterGroupMentions:()=>Nt,filterPostMentions:()=>kt,filterUserMentions:()=>At});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 M=flarum.core.compat["common/helpers/punctuateSeries"];var C=t.n(M);const _=flarum.core.compat["common/helpers/username"];var T=t.n(_);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 D=t.n(S);const I=flarum.core.compat["forum/components/EditPostComposer"];var U=t.n(I);const j=flarum.core.compat["common/utils/extractText"];var E=t.n(j),H=function(){return E()(i().translator.trans("core.lib.username.deleted_text"))};function O(t,n){return void 0===n&&(n=!0),t?((n?t.displayName():t.username())||H()).replace(/"#[a-z]{0,3}[0-9]+/,"_"):H().replace(/"#[a-z]{0,3}[0-9]+/,"_")}function G(t,n,e){if(void 0!==t&&void 0===n)return i().forum.attribute("allowUsernameMentionFormat")?"@"+O(t,!1):'@"'+O(t)+'"#'+t.id();if(void 0!==t&&void 0!==n)return'@"'+O(t)+'"#p'+n;if(void 0!==e)return'@"'+e.namePlural()+'"#g'+e.id();throw"No parameters were passed"}function L(t,n,e){return new Promise((function(o){var r=G(t.user(),t.id())+" ";n.fields.content()||(n.body.attrs.originalContent=r);var s=n.editor.getSelectionRange()[0],i=n.fields.content().slice(0,s),a=0==i.length?0:3-i.match(/(\n{0,2})$/)[0].length;return n.editor.insertAtCursor(Array(a).join("\n")+(e?"> "+r+e.trim().replace(/\n/g,"\n> ")+"\n\n":r),!1),o(n)}))}function W(t,n){return i().composer.bodyMatches(U())&&i().composer.body.attrs.post.discussion()===t.discussion()?L(t,i().composer,n):D().replyAction.call(t.discussion()).then((function(e){return L(t,e,n)}))}function R(t,n){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},R(t,n)}function q(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,R(t,n)}const J=flarum.core.compat["common/Fragment"];var F=t.n(J),z=function(t){function n(n){var e;return(e=t.call(this)||this).post=n,e}q(n,t);var e=n.prototype;return e.view=function(){var t=this;return m("button",{class:"Button PostQuoteButton",onclick:function(){W(t.post,t.content)}},A()("fas fa-quote-left",{className:"Button-icon"}),i().translator.trans("flarum-mentions.forum.post.quote_button"))},e.show=function(t,n){var e=this.$().show(),o=e.offsetParent().offset();e.css("left",t-o.left).css("top",n-o.top),this.hideHandler=this.hide.bind(this),$(document).on("mouseup",this.hideHandler)},e.showStart=function(t,n){var e=this.$();this.show(t,$(window).scrollTop()+n-e.outerHeight()-5)},e.showEnd=function(t,n){var e=this.$();this.show(t-e.outerWidth(),$(window).scrollTop()+n+5)},e.hide=function(){this.$().hide(),$(document).off("mouseup",this.hideHandler)},n}(F());function Q(t){var n=window.getSelection();if(!n.isCollapsed){var e=n.getRangeAt(0),o=e.commonAncestorContainer;if(t[0]===o||$.contains(t[0],o)){var r=$("
").append(e.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 X=flarum.core.compat["common/components/TextEditor"];var Y=t.n(X);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 nt=flarum.core.compat["common/helpers/avatar"];var et=t.n(nt);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"],ut=flarum.core.compat["common/components/Badge"];var ct=t.n(ut);const mt=flarum.core.compat["common/models/Group"];var ft=t.n(mt),lt=function(t){function n(){for(var n,e=arguments.length,o=new Array(e),r=0;r=o.length&&(r=0),this.index=r;var s=o.removeClass("active").eq(r).addClass("active");if(n){var i,a=e.scrollTop(),u=e.offset().top,c=u+e.outerHeight(),m=s.offset().top,f=m+s.outerHeight();mc&&(i=a-c+f+parseInt(e.css("padding-bottom"),10)),void 0!==i&&e.stop(!0).animate({scrollTop:i},100)}}},n}(F()),dt=(0,at.throttle)(250,(function(t,n,e,o,r,s){var a=t.toLowerCase();n.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()),e.push(t))})),s()})),n.push(a))}));const pt=flarum.core.compat["forum/components/Notification"];var ht=t.n(pt),vt=function(t){function n(){return t.apply(this,arguments)||this}q(n,t);var e=n.prototype;return e.icon=function(){return"fas fa-reply"},e.href=function(){var t=this.attrs.notification,n=t.subject(),e=t.content();return i().route.discussion(n.discussion(),e&&e.replyNumber)},e.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.post_mentioned_text",{user:t,count:1})},e.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain()||"",200)},n}(ht()),gt=function(t){function n(){return t.apply(this,arguments)||this}q(n,t);var e=n.prototype;return e.icon=function(){return"fas fa-at"},e.href=function(){var t=this.attrs.notification.subject();return i().route.discussion(t.discussion(),t.number())},e.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.user_mentioned_text",{user:t})},e.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain(),200)},n}(ht()),yt=function(t){function n(){return t.apply(this,arguments)||this}q(n,t);var e=n.prototype;return e.icon=function(){return"fas fa-at"},e.href=function(){var t=this.attrs.notification.subject();return i().route.discussion(t.discussion(),t.number())},e.content=function(){var t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.group_mentioned_text",{user:t})},e.excerpt=function(){return(0,c.truncate)(this.attrs.notification.subject().contentPlain(),200)},n}(ht());const bt=flarum.core.compat["forum/components/UserPage"];var wt=t.n(bt);const Pt=flarum.core.compat["common/components/LinkButton"];var xt=t.n(Pt);const Mt=flarum.core.compat["forum/components/PostsUserPage"];var $t=function(t){function n(){return t.apply(this,arguments)||this}return q(n,t),n.prototype.loadResults=function(t){return i().store.find("posts",{filter:{type:"comment",mentioned:this.user.id()},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})},n}(t.n(Mt)());const Ct=flarum.core.compat["common/models/User"];var _t=t.n(Ct);const Tt=flarum.core.compat["common/utils/isDark"];var Bt=t.n(Tt);function At(t){var n;if(i().forum.attribute("allowUsernameMentionFormat")&&t.hasAttribute("username")?n=i().store.getBy("users","username",t.getAttribute("username")):t.hasAttribute("id")&&(n=i().store.getById("users",t.getAttribute("id"))),n)return t.setAttribute("id",n.id()),t.setAttribute("slug",n.slug()),t.setAttribute("displayname",E()(T()(n))),!0;t.invalidate()}function kt(t){var n=i().store.getById("posts",t.getAttribute("id"));if(n)return t.setAttribute("discussionid",n.discussion().id()),t.setAttribute("number",n.number()),t.setAttribute("displayname",E()(T()(n.user()))),!0}function Nt(t){var n,e;if(null!=(n=i().session)&&null!=(e=n.user)&&e.canMentionGroups()){var o=i().store.getById("groups",t.getAttribute("id"));if(o)return t.setAttribute("groupname",E()(o.namePlural())),t.setAttribute("icon",o.icon()),t.setAttribute("color",o.color()),t.setAttribute("class",Bt()(o.color())?"GroupMention--light":"GroupMention--dark"),!0}t.invalidate()}const St={"mentions/components/MentionsUserPage":$t,"mentions/components/PostMentionedNotification":vt,"mentions/components/UserMentionedNotification":gt,"mentions/components/GroupMentionedNotification":yt,"mentions/fragments/AutocompleteDropdown":lt,"mentions/fragments/PostQuoteButton":z,"mentions/utils/getCleanDisplayName":O,"mentions/utils/getMentionText":G,"mentions/utils/reply":e,"mentions/utils/selectedText":Q,"mentions/utils/textFormatter":o},Dt=flarum.core;i().initializers.add("flarum-mentions",(function(){var t,n;_t().prototype.canMentionGroups=y().attribute("canMentionGroups"),function(){function t(){var t=this.attrs.post.contentHtml();if(t!==this.oldPostContentHtml&&!this.isEditing()){this.oldPostContentHtml=t;var n=this.attrs.post,e=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=$('
'),n=new lt,(0,r.extend)(Y().prototype,"oncreate",(function(){var e=this.$(".TextEditor-editor").wrap('
');this.navigator=new(it()),this.navigator.when((function(){return n.active})).onUp((function(){return n.navigate(-1)})).onDown((function(){return n.navigate(1)})).onSelect(n.complete.bind(n)).onCancel(n.hide.bind(n)).bindTo(e),e.after(t)})),(0,r.extend)(Y().prototype,"buildEditorParams",(function(e){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()}))),p=Array.from(i().store.all("groups").filter((function(t){return t.id()!=ft().GUEST_ID&&t.id()!=ft().MEMBER_ID}))),h=function(t){u.attrs.composer.editor.replaceBeforeCursor(r-1,t+" "),n.hide()};e.inputListeners.push((function(){var e=u.attrs.composer.editor.getSelectionRange(),v=e[0];if(!(e[1]-v>0)){var g=u.attrs.composer.editor.getLastNChars(30);r=0;for(var y=g.length-1;y>=0;y--)if("@"===g.substr(y,1)&&(0==y||/\s/.test(g.substr(y-1,1)))){o=y+1,r=v-g.length+y+1;break}if(n.hide(),n.active=!1,r){s=g.substring(o).toLowerCase(),a=s.match(/^["|“]((?:(?!"#).)+)$/),s=a&&a[1]||s;var b=function(t,e,o,r){void 0===r&&(r="");var i=T()(t);return s&&(i.children=[rt()(i.text,s)],delete i.text),m("button",{className:"PostPreview "+r,onclick:function(){return h(e)},onmouseenter:function(){n.setIndex($(this).parent().index())}},m("span",{className:"PostPreview-content"},et()(t),i," ",o))},w=function(t){return[t.username(),t.displayName()].some((function(t){return t.toLowerCase().substr(0,s.length)===s}))},P=function(){var e,o,a=[];if(s&&(l.forEach((function(t){w(t)&&a.push(b(t,G(t),"","MentionsDropdown-user"))})),null!=(e=i().session)&&null!=(o=e.user)&&o.canMentionGroups()&&p.forEach((function(t){(function(t){return[t.nameSingular(),t.namePlural()].some((function(t){return t.toLowerCase().substr(0,s.length)===s}))})(t)&&a.push(function(t,e,o,r){void 0===r&&(r="");var i=t.namePlural().toLowerCase();return s&&(i=rt()(i,s)),m("button",{className:"PostPreview "+r,onclick:function(){return h(e)},onmouseenter:function(){n.setIndex($(this).parent().index())}},m("span",{className:"PostPreview-content"},m(ct(),{class:"Avatar Badge Badge--group--"+t.id()+" Badge-icon ",color:t.color(),type:"group",icon:t.icon()}),m("span",{className:"username"},i)))}(t,G(void 0,void 0,t),0,"MentionsDropdown-group"))}))),u.attrs.composer.bodyMatches(tt())||u.attrs.composer.bodyMatches(U())){var f=u.attrs.composer.body.attrs,d=f.post,v=d&&d.discussion()||f.discussion;v&&v.posts().filter((function(t){return t&&"comment"===t.contentType()&&(!d||t.number()x.height()&&(C=g.top-P-15),M+y>x.width()&&(M=x.width()-y),C=Math.max(-(x.offset().top-$(document).scrollTop()),C),M=Math.max(-x.offset().left,M),n.show(M,C)}else n.active=!1,n.hide()};n.active=!0,P(),n.setIndex(0),n.$().scrollTop(0),s.length>1&&i().forum.attribute("canSearchUsers")&&dt(s,f,l,d,n,P)}}}))})),(0,r.extend)(Y().prototype,"toolbarItems",(function(t){var n=this;t.add("mention",m(V(),{onclick:function(){return n.attrs.composer.editor.insertAtCursor(" @")},icon:"fas fa-at"},i().translator.trans("flarum-mentions.forum.composer.mention_tooltip")))})),i().notificationComponents.postMentioned=vt,i().notificationComponents.userMentioned=gt,i().notificationComponents.groupMentioned=yt,(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")}),t.add("groupMentioned",{name:"groupMentioned",icon:"fas fa-at",label:i().translator.trans("flarum-mentions.forum.settings.notify_group_mentioned_label")})})),i().routes["user.mentions"]={path:"/u/:username/mentions",component:$t},(0,r.extend)(wt().prototype,"navItems",(function(t){var n=this.user;t.add("mentions",xt().component({href:i().route("user.mentions",{username:n.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(Dt.compat,St)})(),module.exports=n})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 71992fa..6f4fd3c 100644 --- a/js/dist/forum.js.map +++ b/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,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,E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OvT,IAAAA,WAAAA,MAAqB,gEAG9BsG,EAAMiD,IAAI,gBAAiB,CACzB4I,KAAM,gBACN5O,KAAM,YACNgQ,MAAOvT,IAAAA,WAAAA,MAAqB,gEAG9BsG,EAAMiD,IAAI,iBAAkB,CAC1B4I,KAAM,iBACN5O,KAAM,YACNgQ,MAAOvT,IAAAA,WAAAA,MAAqB,gEAE/B,IAGDA,IAAAA,OAAAA,iBAA8B,CAAEwT,KAAM,wBAAyBC,UAAWnJ,KAC1E4D,EAAAA,EAAAA,QAAOwF,KAAAA,UAAoB,YAAY,SAAUpN,GAC/C,IAAMpG,EAAO2D,KAAK3D,KAClBoG,EAAMiD,IACJ,WACAoK,KAAAA,UACE,CACExN,KAAMnG,IAAAA,MAAU,gBAAiB,CAAEK,SAAUH,EAAKgL,SAClDiH,KAAM,WACN5O,KAAM,aAERvD,IAAAA,WAAAA,MAAqB,6CAEvB,GAEH,IAGD4T,EAAAA,gBAAAA,gBAAAA,KAAqC,gBACtC,IAQD7U,OAAO8U,OAAOhU,GAAAA,OAAQiU,G","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/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/models/Group']\"","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/./src/forum/components/GroupMentionedNotification.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/external root \"flarum.core.compat['common/models/User']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/utils/isDark']\"","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, or group).\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 New display name syntax\n * // '@\"User\"#1'\n * getMentionText(User) // User is ID 1, display name is 'User'\n *\n * @example Replying\n * // '@\"User\"#p13'\n * getMentionText(User, 13) // User display name is 'User', post ID is 13\n *\n * @example Using old syntax\n * // '@username'\n * getMentionText(User) // User's username is 'username'\n *\n * @example Group mention\n * // '@\"Mods\"#g4'\n * getMentionText(undefined, undefined, group) // Group display name is 'Mods', group ID is 4\n */\nexport default function getMentionText(user, postId, group) {\n if (user !== undefined && 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 if (user !== undefined && postId !== undefined) {\n // @\"Display name\"#pPostID\n const cleanText = getCleanDisplayName(user);\n return `@\"${cleanText}\"#p${postId}`;\n } else if (group !== undefined) {\n // @\"Name Plural\"#gGroupID\n return `@\"${group.namePlural()}\"#g${group.id()}`;\n } else {\n throw 'No parameters were passed';\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 {\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 \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.isCollapsed) {\n const range = selection.getRangeAt(0);\n const parent = range.commonAncestorContainer;\n\n if (body[0] === parent || $.contains(body[0], parent)) {\n const clone = $('
').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'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Badge'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Group'];","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
    \n {this.items.map((item) => (\n
  • {item}
  • \n ))}\n
\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';\nimport Badge from 'flarum/common/components/Badge';\nimport Group from 'flarum/common/models/Group';\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\n searched.push(typedLower);\n }\n }\n);\n\nexport default function addComposerAutocomplete() {\n const $container = $('
');\n const dropdown = new AutocompleteDropdown();\n\n extend(TextEditor.prototype, 'oncreate', function () {\n const $editor = this.$('.TextEditor-editor').wrap('
');\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 // Store groups, but exclude the two virtual groups - 'Guest' and 'Member'.\n const returnedGroups = Array.from(\n app.store.all('groups').filter((group) => {\n return group.id() != Group.GUEST_ID && group.id() != Group.MEMBER_ID;\n })\n );\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 applySuggestion(replacement)}\n onmouseenter={function () {\n dropdown.setIndex($(this).parent().index());\n }}\n >\n \n {avatar(user)}\n {username} {content}\n \n \n );\n };\n\n const makeGroupSuggestion = function (group, replacement, content, className = '') {\n let groupName = group.namePlural().toLowerCase();\n\n if (typed) {\n groupName = highlight(groupName, typed);\n }\n\n return (\n applySuggestion(replacement)}\n onmouseenter={function () {\n dropdown.setIndex($(this).parent().index());\n }}\n >\n \n \n {groupName}\n \n \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 groupMatches = function (group) {\n const names = [group.nameSingular(), group.namePlural()];\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 // ... or groups.\n if (app.session?.user?.canMentionGroups()) {\n returnedGroups.forEach((group) => {\n if (!groupMatches(group)) return;\n\n suggestions.push(makeGroupSuggestion(group, getMentionText(undefined, undefined, group), '', 'MentionsDropdown-group'));\n });\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 this.attrs.composer.editor.insertAtCursor(' @')} icon=\"fas fa-at\">\n {app.translator.trans('flarum-mentions.forum.composer.mention_tooltip')}\n \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","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default class GroupMentionedNotification 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.group_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","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/User'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/isDark'];","import app from 'flarum/forum/app';\nimport username from 'flarum/common/helpers/username';\nimport extractText from 'flarum/common/utils/extractText';\nimport isDark from 'flarum/common/utils/isDark';\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\nexport function filterGroupMentions(tag) {\n if (app.session?.user?.canMentionGroups()) {\n const group = app.store.getById('groups', tag.getAttribute('id'));\n\n if (group) {\n tag.setAttribute('groupname', extractText(group.namePlural()));\n tag.setAttribute('icon', group.icon());\n tag.setAttribute('color', group.color());\n tag.setAttribute('class', isDark(group.color()) ? 'GroupMention--light' : 'GroupMention--dark');\n\n return true;\n }\n }\n\n tag.invalidate();\n}\n","import GroupMentionedNotification from './components/GroupMentionedNotification';\nimport 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/components/GroupMentionedNotification': GroupMentionedNotification,\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 GroupMentionedNotification from './components/GroupMentionedNotification';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport MentionsUserPage from './components/MentionsUserPage';\nimport User from 'flarum/common/models/User';\nimport Model from 'flarum/common/Model';\n\napp.initializers.add('flarum-mentions', function () {\n User.prototype.canMentionGroups = Model.attribute('canMentionGroups');\n\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 app.notificationComponents.groupMentioned = GroupMentionedNotification;\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 items.add('groupMentioned', {\n name: 'groupMentioned',\n icon: 'fas fa-at',\n label: app.translator.trans('flarum-mentions.forum.settings.notify_group_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 = $('
    ');\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
  • \n {discussion.title()}\n
  • \n ) : (\n ''\n ),\n
  • {PostPreview.component({ post })}
  • ,\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 = $('
      ');\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
    • \n {PostPreview.component({\n post: reply,\n onclick: hidePreview.bind(this),\n })}\n
    • \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 \n {app.session.user === user ? app.translator.trans('flarum-mentions.forum.post.you_text') : username(user)}\n \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
      \n \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 \n
      \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 \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 = $('
      ');\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","group","undefined","id","namePlural","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","isCollapsed","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","GroupMentionedNotification","MentionsUserPage","loadResults","type","mentioned","loadLimit","sort","PostsUserPage","filterUserMentions","tag","hasAttribute","getAttribute","setAttribute","slug","invalidate","filterPostMentions","filterGroupMentions","canMentionGroups","color","isDark","textFormatter","$container","User","Model","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","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","returnedGroups","Group","applySuggestion","replacement","replaceBeforeCursor","inputListeners","cursor","lastChunk","getLastNChars","i","substr","test","substring","makeSuggestion","usernameHelper","children","highlight","onmouseenter","avatar","userMatches","some","name","suggestions","nameSingular","groupMatches","groupName","makeGroupSuggestion","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,CAAM,ECLdF,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,IAE1E,ECNDR,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,GAAO,G,0RCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OA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D,IAAI,iBAAkB,CAC1B4I,KAAM,iBACN3O,KAAM,YACN+P,MAAOvT,IAAAA,WAAAA,MAAqB,gEAEhC,IAGAA,IAAAA,OAAAA,iBAA8B,CAAEwT,KAAM,wBAAyBC,UAAWnJ,KAC1E4D,EAAAA,EAAAA,QAAOwF,KAAAA,UAAoB,YAAY,SAAUpN,GAC/C,IAAMpG,EAAO4D,KAAK5D,KAClBoG,EAAMiD,IACJ,WACAoK,KAAAA,UACE,CACExN,KAAMnG,IAAAA,MAAU,gBAAiB,CAAEK,SAAUH,EAAKgL,SAClDiH,KAAM,WACN3O,KAAM,aAERxD,IAAAA,WAAAA,MAAqB,6CAEvB,GAEJ,IAGA4T,EAAAA,gBAAAA,gBAAAA,KAAqC,gBACvC,IAQA7U,OAAO8U,OAAOhU,GAAAA,OAAQiU,G","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/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/models/Group']\"","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/./src/forum/components/GroupMentionedNotification.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/external root \"flarum.core.compat['common/models/User']\"","webpack://@flarum/mentions/external root \"flarum.core.compat['common/utils/isDark']\"","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, or group).\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 New display name syntax\n * // '@\"User\"#1'\n * getMentionText(User) // User is ID 1, display name is 'User'\n *\n * @example Replying\n * // '@\"User\"#p13'\n * getMentionText(User, 13) // User display name is 'User', post ID is 13\n *\n * @example Using old syntax\n * // '@username'\n * getMentionText(User) // User's username is 'username'\n *\n * @example Group mention\n * // '@\"Mods\"#g4'\n * getMentionText(undefined, undefined, group) // Group display name is 'Mods', group ID is 4\n */\nexport default function getMentionText(user, postId, group) {\n if (user !== undefined && 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 if (user !== undefined && postId !== undefined) {\n // @\"Display name\"#pPostID\n const cleanText = getCleanDisplayName(user);\n return `@\"${cleanText}\"#p${postId}`;\n } else if (group !== undefined) {\n // @\"Name Plural\"#gGroupID\n return `@\"${group.namePlural()}\"#g${group.id()}`;\n } else {\n throw 'No parameters were passed';\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 ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\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 {\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 \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.isCollapsed) {\n const range = selection.getRangeAt(0);\n const parent = range.commonAncestorContainer;\n\n if (body[0] === parent || $.contains(body[0], parent)) {\n const clone = $('
      ').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'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Badge'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Group'];","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
        \n {this.items.map((item) => (\n
      • {item}
      • \n ))}\n
      \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';\nimport Badge from 'flarum/common/components/Badge';\nimport Group from 'flarum/common/models/Group';\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\n searched.push(typedLower);\n }\n }\n);\n\nexport default function addComposerAutocomplete() {\n const $container = $('
      ');\n const dropdown = new AutocompleteDropdown();\n\n extend(TextEditor.prototype, 'oncreate', function () {\n const $editor = this.$('.TextEditor-editor').wrap('
      ');\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 // Store groups, but exclude the two virtual groups - 'Guest' and 'Member'.\n const returnedGroups = Array.from(\n app.store.all('groups').filter((group) => {\n return group.id() != Group.GUEST_ID && group.id() != Group.MEMBER_ID;\n })\n );\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 applySuggestion(replacement)}\n onmouseenter={function () {\n dropdown.setIndex($(this).parent().index());\n }}\n >\n \n {avatar(user)}\n {username} {content}\n \n \n );\n };\n\n const makeGroupSuggestion = function (group, replacement, content, className = '') {\n let groupName = group.namePlural().toLowerCase();\n\n if (typed) {\n groupName = highlight(groupName, typed);\n }\n\n return (\n applySuggestion(replacement)}\n onmouseenter={function () {\n dropdown.setIndex($(this).parent().index());\n }}\n >\n \n \n {groupName}\n \n \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 groupMatches = function (group) {\n const names = [group.nameSingular(), group.namePlural()];\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 // ... or groups.\n if (app.session?.user?.canMentionGroups()) {\n returnedGroups.forEach((group) => {\n if (!groupMatches(group)) return;\n\n suggestions.push(makeGroupSuggestion(group, getMentionText(undefined, undefined, group), '', 'MentionsDropdown-group'));\n });\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 this.attrs.composer.editor.insertAtCursor(' @')} icon=\"fas fa-at\">\n {app.translator.trans('flarum-mentions.forum.composer.mention_tooltip')}\n \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","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default class GroupMentionedNotification 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.group_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","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/User'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/isDark'];","import app from 'flarum/forum/app';\nimport username from 'flarum/common/helpers/username';\nimport extractText from 'flarum/common/utils/extractText';\nimport isDark from 'flarum/common/utils/isDark';\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\nexport function filterGroupMentions(tag) {\n if (app.session?.user?.canMentionGroups()) {\n const group = app.store.getById('groups', tag.getAttribute('id'));\n\n if (group) {\n tag.setAttribute('groupname', extractText(group.namePlural()));\n tag.setAttribute('icon', group.icon());\n tag.setAttribute('color', group.color());\n tag.setAttribute('class', isDark(group.color()) ? 'GroupMention--light' : 'GroupMention--dark');\n\n return true;\n }\n }\n\n tag.invalidate();\n}\n","import GroupMentionedNotification from './components/GroupMentionedNotification';\nimport 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/components/GroupMentionedNotification': GroupMentionedNotification,\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 GroupMentionedNotification from './components/GroupMentionedNotification';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport MentionsUserPage from './components/MentionsUserPage';\nimport User from 'flarum/common/models/User';\nimport Model from 'flarum/common/Model';\n\napp.initializers.add('flarum-mentions', function () {\n User.prototype.canMentionGroups = Model.attribute('canMentionGroups');\n\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 app.notificationComponents.groupMentioned = GroupMentionedNotification;\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 items.add('groupMentioned', {\n name: 'groupMentioned',\n icon: 'fas fa-at',\n label: app.translator.trans('flarum-mentions.forum.settings.notify_group_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 = $('
        ');\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
      • \n {discussion.title()}\n
      • \n ) : (\n ''\n ),\n
      • {PostPreview.component({ post })}
      • ,\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 = $('
          ');\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
        • \n {PostPreview.component({\n post: reply,\n onclick: hidePreview.bind(this),\n })}\n
        • \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 \n {app.session.user === user ? app.translator.trans('flarum-mentions.forum.post.you_text') : username(user)}\n \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
          \n \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 \n
          \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 \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 = $('
          ');\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","group","undefined","id","namePlural","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","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","PostQuoteButton","view","class","onclick","icon","className","show","left","top","$this","this","$","parentOffset","offsetParent","offset","css","hideHandler","hide","document","on","showStart","window","scrollTop","outerHeight","showEnd","right","bottom","outerWidth","off","Fragment","selectedText","selection","getSelection","isCollapsed","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","GroupMentionedNotification","MentionsUserPage","loadResults","type","mentioned","loadLimit","sort","PostsUserPage","filterUserMentions","tag","hasAttribute","getAttribute","setAttribute","slug","invalidate","filterPostMentions","filterGroupMentions","canMentionGroups","color","isDark","textFormatter","$container","User","Model","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","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","returnedGroups","Group","applySuggestion","replacement","replaceBeforeCursor","inputListeners","cursor","lastChunk","getLastNChars","i","substr","test","substring","makeSuggestion","usernameHelper","children","highlight","onmouseenter","avatar","userMatches","some","name","suggestions","nameSingular","groupMatches","groupName","makeGroupSuggestion","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