{"version":3,"sources":["webpack://module.exports/webpack/bootstrap","webpack://module.exports/external \"flarum.core.compat['app']\"","webpack://module.exports/external \"flarum.core.compat['extend']\"","webpack://module.exports/external \"flarum.core.compat['components/IndexPage']\"","webpack://module.exports/external \"flarum.core.compat['components/DiscussionList']\"","webpack://module.exports/external \"flarum.core.compat['components/Button']\"","webpack://module.exports/external \"flarum.core.compat['components/DiscussionPage']\"","webpack://module.exports/./src/forum/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","external_flarum_core_compat_app_default","a","initializers","add","loadPusher","deferred","$","getScript","socket","Pusher","forum","attribute","authEndpoint","cluster","auth","headers","X-CSRF-Token","session","csrfToken","resolve","main","subscribe","user","id","pusher","promise","pushedUpdates","external_flarum_core_compat_extend_","DiscussionList_default","x","isInitialized","context","_this","this","then","channels","data","params","props","q","sort","filter","tags","tag","store","getBy","tagIds","indexOf","String","discussionId","current","discussion","push","IndexPage_default","setTitleCount","length","redraw","unbind","vdom","_this2","count","children","unshift","Button_default","component","className","onclick","refresh","loadingUpdated","loading","translator","transChoice","returned","index","splice","DiscussionPage_default","_this3","stream","oldCount","commentsCount","find","update","document","hasFocus","Math","max","window","one","items","remove","pushAttributes","unreadNotificationsCount","newNotificationsCount","cache","notifications"],"mappings":"2BACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QA0DA,OArDAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EA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yB,EAAKzB,WAAW5B,OAASA,GAAMqD,EAAKC,OAAQ,CACjE,IAAMC,EAAWF,EAAKzB,WAAW4B,gBAEjC/E,EAAAC,EAAI2C,MAAMoC,KAAK,cAAeJ,EAAKzB,WAAW5B,MAAMW,KAAK,WACvD0C,EAAKC,OAAOI,SAEPC,SAASC,aACZnF,EAAAC,EAAIqD,cAAc8B,KAAKC,IAAI,EAAGT,EAAKzB,WAAW4B,gBAAkBD,IAEhExE,EAAEgF,QAAQC,IAAI,QAAS,kBAAMvF,EAAAC,EAAIqD,cAAc,WAMvD/E,OAAAoD,EAAA,OAAApD,CAAOwD,EAAS,WAAY,kBAAMI,EAASf,KAAKqC,OAAO,iBAI3DlF,OAAAoD,EAAA,OAAApD,CAAO8E,EAAApD,EAAUR,UAAW,cAAe,SAAA+F,GACzCA,EAAMC,OAAO,aAGfzF,EAAAC,EAAIuB,OAAOU,KAAK,SAAAC,GACVA,EAASb,MACXa,EAASb,KAAKjC,KAAK,eAAgB,WACjCW,EAAAC,EAAIgB,QAAQK,KAAKoE,gBACfC,yBAA0B3F,EAAAC,EAAIgB,QAAQK,KAAKqE,2BAA6B,EACxEC,sBAAuB5F,EAAAC,EAAIgB,QAAQK,KAAKsE,wBAA0B,WAE7D5F,EAAAC,EAAI4F,MAAMC,cACjB7H,EAAEuF","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 21);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/IndexPage'];","module.exports = flarum.core.compat['components/DiscussionList'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/DiscussionPage'];","/*global Pusher*/\n\nimport { extend } from 'flarum/extend';\nimport app from 'flarum/app';\nimport DiscussionList from 'flarum/components/DiscussionList';\nimport DiscussionPage from 'flarum/components/DiscussionPage';\nimport IndexPage from 'flarum/components/IndexPage';\nimport Button from 'flarum/components/Button';\n\napp.initializers.add('flarum-pusher', () => {\n const loadPusher = m.deferred();\n\n $.getScript('//js.pusher.com/3.0/pusher.min.js', () => {\n const socket = new Pusher(app.forum.attribute('pusherKey'), {\n authEndpoint: app.forum.attribute('apiUrl') + '/pusher/auth',\n cluster: app.forum.attribute('pusherCluster'),\n auth: {\n headers: {\n 'X-CSRF-Token': app.session.csrfToken\n }\n }\n });\n\n loadPusher.resolve({\n main: socket.subscribe('public'),\n user: app.session.user ? socket.subscribe('private-user' + app.session.user.id()) : null\n });\n });\n\n app.pusher = loadPusher.promise;\n app.pushedUpdates = [];\n\n extend(DiscussionList.prototype, 'config', function(x, isInitialized, context) {\n if (isInitialized) return;\n\n app.pusher.then(channels => {\n channels.main.bind('newPost', data => {\n const params = this.props.params;\n\n if (!params.q && !params.sort && !params.filter) {\n if (params.tags) {\n const tag = app.store.getBy('tags', 'slug', params.tags);\n\n if (data.tagIds.indexOf(tag.id()) === -1) return;\n }\n\n const id = String(data.discussionId);\n\n if ((!app.current.discussion || id !== app.current.discussion.id()) && app.pushedUpdates.indexOf(id) === -1) {\n app.pushedUpdates.push(id);\n\n if (app.current instanceof IndexPage) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n\n m.redraw();\n }\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPost'));\n });\n });\n\n extend(DiscussionList.prototype, 'view', function(vdom) {\n if (app.pushedUpdates) {\n const count = app.pushedUpdates.length;\n\n if (count) {\n vdom.children.unshift(\n Button.component({\n className: 'Button Button--block DiscussionList-update',\n onclick: () => {\n this.refresh(false).then(() => {\n this.loadingUpdated = false;\n app.pushedUpdates = [];\n app.setTitleCount(0);\n m.redraw();\n });\n this.loadingUpdated = true;\n },\n loading: this.loadingUpdated,\n children: app.translator.transChoice('flarum-pusher.forum.discussion_list.show_updates_text', count, {count})\n })\n );\n }\n }\n });\n\n // Prevent any newly-created discussions from triggering the discussion list\n // update button showing.\n // TODO: Might be better pause the response to the push updates while the\n // composer is loading? idk\n extend(DiscussionList.prototype, 'addDiscussion', function(returned, discussion) {\n const index = app.pushedUpdates.indexOf(discussion.id());\n\n if (index !== -1) {\n app.pushedUpdates.splice(index, 1);\n }\n\n if (app.current instanceof IndexPage) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n\n m.redraw();\n });\n\n extend(DiscussionPage.prototype, 'config', function(x, isInitialized, context) {\n if (isInitialized) return;\n\n app.pusher.then(channels => {\n channels.main.bind('newPost', data => {\n const id = String(data.discussionId);\n\n if (this.discussion && this.discussion.id() === id && this.stream) {\n const oldCount = this.discussion.commentsCount();\n\n app.store.find('discussions', this.discussion.id()).then(() => {\n this.stream.update();\n\n if (!document.hasFocus()) {\n app.setTitleCount(Math.max(0, this.discussion.commentsCount() - oldCount));\n\n $(window).one('focus', () => app.setTitleCount(0));\n }\n });\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPost'));\n });\n });\n\n extend(IndexPage.prototype, 'actionItems', items => {\n items.remove('refresh');\n });\n\n app.pusher.then(channels => {\n if (channels.user) {\n channels.user.bind('notification', () => {\n app.session.user.pushAttributes({\n unreadNotificationsCount: app.session.user.unreadNotificationsCount() + 1,\n newNotificationsCount: app.session.user.newNotificationsCount() + 1\n });\n delete app.cache.notifications;\n m.redraw();\n });\n }\n });\n});\n"],"sourceRoot":""}