framework/extensions/pusher/js/dist/forum.js.map
flarum-bot 9feb9dd4eb Bundled output for commit 016503d8c3
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2023-06-29 18:24:31 +00:00

1 line
12 KiB
Plaintext
Generated

{"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,+BCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,iBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,mC,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,mC,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,8B,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,4B,aCM5D,qBAAqB,iBAAiB,KACpC,WAAa,iBAELW,OAAO,iEAGb,MAAMC,EAAS,IAAIC,OAAO,oBAAoB,aAAc,CAC1DC,aAAc,GAAGC,OAAO,oBAAoB,UAAW,gBACvDC,QAAS,oBAAoB,i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IAAApB,QAAO,cAA0B,YAAY,WAC3C,iBAAgBC,IACCA,EAAQF,OAChBG,KAAK,WAAWC,IACrB,IAAI8B,EACJ,MAAMtB,EAAKG,OAAOX,EAAKY,cACjBA,EAAuD,OAAvCkB,EAAmBP,KAAKQ,iBAAsB,EAASD,EAAiBtB,KAC9F,GAAIe,KAAKQ,YAAcnB,IAAiBJ,GAAMe,KAAKS,OAAQ,CACzD,IAAIC,EACJ,MAAMC,EAAuE,OAA3DD,EAAwBV,KAAKQ,WAAWI,gBAA0BF,EAAwB,EAC5G,eAAe,cAAerB,GAAce,MAAK,KAC/C,IAAIS,EAGEC,EAAwBC,EAFE,OAA/BF,EAAeb,KAAKS,SAA2BI,EAAaG,SAASZ,KAAKd,EAAEC,QACxE0B,SAASC,aAEZ,kBAAkBC,KAAKC,IAAI,GAA4H,OAAvHN,EAAkE,OAAxCC,EAAoBf,KAAKQ,iBAAsB,EAASO,EAAkBH,gBAA0BE,EAAyB,GAAKH,IAC5LU,OAAOC,iBAAiB,SAAS,IAAM,kBAAkB,IAAI,CAC3DC,MAAM,IAEV,GAEJ,IACA,GAEN,KACA,IAAAjD,QAAO,cAA0B,YAAY,WAC3C,iBAAgBC,IACdA,EAAQF,OAAOmB,OAAO,UAAU,GAEpC,KACA,IAAAlB,QAAO,cAAqB,eAAekD,IACzCA,EAAMC,OAAO,UAAU,IAEzB,iBAAgBlD,IACd,MAAMN,EAAWM,EAAQN,SACrBA,EAASG,MACXH,EAASG,KAAKI,KAAK,gBAAgB,KAE/B,IAAIkD,EAAuBC,EADzB,kBAEF,gCAAgC,CAC9BC,wBAAiG,OAAvEF,EAAwB,4CAAsDA,EAAwB,EAChIG,qBAA2F,OAApEF,EAAwB,yCAAmDA,EAAwB,IAG9H,0BACArC,EAAEC,QAAQ,GAEd,GACA,G","sources":["webpack://@flarum/pusher/webpack/bootstrap","webpack://@flarum/pusher/webpack/runtime/compat get default export","webpack://@flarum/pusher/webpack/runtime/define property getters","webpack://@flarum/pusher/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/pusher/webpack/runtime/make namespace object","webpack://@flarum/pusher/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/pusher/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/pusher/external root \"flarum.reg.get('core', 'forum/components/DiscussionList')\"","webpack://@flarum/pusher/external root \"flarum.reg.get('core', 'forum/components/DiscussionPage')\"","webpack://@flarum/pusher/external root \"flarum.reg.get('core', 'forum/components/IndexPage')\"","webpack://@flarum/pusher/external root \"flarum.reg.get('core', 'common/components/Button')\"","webpack://@flarum/pusher/./src/forum/index.tsx"],"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.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/DiscussionList');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/DiscussionPage');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/IndexPage');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Button');","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionList from 'flarum/forum/components/DiscussionList';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport Button from 'flarum/common/components/Button';\napp.initializers.add('flarum-pusher', () => {\n app.pusher = (async () => {\n // @ts-expect-error\n await import('//cdn.jsdelivr.net/npm/pusher-js@7.0.3/dist/web/pusher.min.js' /* webpackIgnore: true, webpackPrefetch: true */);\n\n // @ts-expect-error Imported dynamically\n const socket = new Pusher(app.forum.attribute('pusherKey'), {\n authEndpoint: \"\".concat(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 return {\n channels: {\n main: socket.subscribe('public'),\n user: app.session.user ? socket.subscribe(\"private-user\".concat(app.session.user.id())) : null\n },\n pusher: socket\n };\n })();\n app.pushedUpdates = [];\n extend(DiscussionList.prototype, 'oncreate', function () {\n app.pusher.then(binding => {\n const pusher = binding.pusher;\n pusher.bind('newPost', data => {\n const params = app.discussions.getParams();\n if (!params.q && !params.sort && !params.filter) {\n if (params.tags) {\n const tag = app.store.getBy('tags', 'slug', params.tags);\n const tagId = tag == null ? void 0 : tag.id();\n if (!tagId || !data.tagIds.includes(tagId)) return;\n }\n const id = String(data.discussionId);\n if ((!app.current.get('discussion') || id !== app.current.get('discussion').id()) && app.pushedUpdates.indexOf(id) === -1) {\n app.pushedUpdates.push(id);\n if (app.current.matches(IndexPage)) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n m.redraw();\n }\n }\n });\n });\n });\n extend(DiscussionList.prototype, 'onremove', function () {\n app.pusher.then(binding => {\n binding.pusher.unbind('newPost');\n });\n });\n extend(DiscussionList.prototype, 'view', function (vdom) {\n if (app.pushedUpdates) {\n const count = app.pushedUpdates.length;\n if (count && typeof vdom === 'object' && vdom && 'children' in vdom && vdom.children instanceof Array) {\n vdom.children.unshift(m(Button, {\n className: \"Button Button--block DiscussionList-update\",\n onclick: () => {\n this.attrs.state.refresh().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 }, app.translator.trans('flarum-pusher.forum.discussion_list.show_updates_text', {\n count\n })));\n }\n }\n });\n extend(DiscussionPage.prototype, 'oncreate', function () {\n app.pusher.then(binding => {\n const pusher = binding.pusher;\n pusher.bind('newPost', data => {\n var _this$discussion;\n const id = String(data.discussionId);\n const discussionId = (_this$discussion = this.discussion) == null ? void 0 : _this$discussion.id();\n if (this.discussion && discussionId === id && this.stream) {\n var _this$discussion$comm;\n const oldCount = (_this$discussion$comm = this.discussion.commentCount()) != null ? _this$discussion$comm : 0;\n app.store.find('discussions', discussionId).then(() => {\n var _this$stream;\n (_this$stream = this.stream) == null ? void 0 : _this$stream.update().then(m.redraw);\n if (!document.hasFocus()) {\n var _this$discussion$comm2, _this$discussion2;\n app.setTitleCount(Math.max(0, ((_this$discussion$comm2 = (_this$discussion2 = this.discussion) == null ? void 0 : _this$discussion2.commentCount()) != null ? _this$discussion$comm2 : 0) - oldCount));\n window.addEventListener('focus', () => app.setTitleCount(0), {\n once: true\n });\n }\n });\n }\n });\n });\n });\n extend(DiscussionPage.prototype, 'onremove', function () {\n app.pusher.then(binding => {\n binding.pusher.unbind('newPost');\n });\n });\n extend(IndexPage.prototype, 'actionItems', items => {\n items.remove('refresh');\n });\n app.pusher.then(binding => {\n const channels = binding.channels;\n if (channels.user) {\n channels.user.bind('notification', () => {\n if (app.session.user) {\n var _app$session$user$unr, _app$session$user$new;\n app.session.user.pushAttributes({\n unreadNotificationCount: (_app$session$user$unr = app.session.user.unreadNotificationCount()) != null ? _app$session$user$unr : 0 + 1,\n newNotificationCount: (_app$session$user$new = app.session.user.newNotificationCount()) != null ? _app$session$user$new : 0 + 1\n });\n }\n app.notifications.clear();\n m.redraw();\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","reg","import","socket","Pusher","authEndpoint","concat","cluster","auth","headers","channels","main","subscribe","user","pusher","extend","binding","bind","data","params","q","sort","filter","tags","tag","tagId","id","tagIds","includes","String","discussionId","m","redraw","unbind","vdom","count","children","Array","unshift","className","onclick","this","attrs","state","refresh","then","loadingUpdated","loading","_this$discussion","discussion","stream","_this$discussion$comm","oldCount","commentCount","_this$stream","_this$discussion$comm2","_this$discussion2","update","document","hasFocus","Math","max","window","addEventListener","once","items","remove","_app$session$user$unr","_app$session$user$new","unreadNotificationCount","newNotificationCount"],"sourceRoot":""}