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,QAAoBkB,MACtBlB,IAAAA,QAAAA,IAAgB,UAAUmB,SAG5BC,EAAEC,QACJ,GACF,GCzBAlB,EAAAA,EAAAA,QAAOmB,IAAAA,UAA+B,iBAAiB,SAAUC,IAC3DvB,IAAAA,QAAAA,QAAoBwB,MAAcxB,IAAAA,QAAAA,QAAoBkB,OACxDK,EAAOE,QAAQC,KAAK,YAExB,KAEAvB,EAAAA,EAAAA,QAAOwB,IAAAA,UAA8B,aAAa,SAAUjB,GAC1D,IAAMC,EAAanB,KAAKC,MAAMkB,WAE9B,GAAIA,EAAWN,aAAeb,KAAKC,MAAM8B,OAAOK,IAAMjB,EAAWkB,qBAAsB,CACrF,IAAMC,EAAYnB,EAAWmB,YAE7B,GAAIA,EAAW,CACb,IAAMC,GAAUC,EAAAA,EAAAA,UAASF,EAAUG,eAAgB,KAGnDvB,EAAMX,IAAI,UAAW,aAAMgC,IAAiB,IAC9C,CACF,CACF,KCtBA5B,EAAAA,EAAAA,QAAOwB,IAAAA,UAA8B,gBAAgB,SAAUlC,GACzDD,KAAKC,MAAMkB,WAAWN,aACxBZ,EAAMyC,UAAYC,IAAU1C,EAAMyC,UAAW,8BAEjD,GJSF,G","sources":["webpack://@flarum/sticky/webpack/bootstrap","webpack://@flarum/sticky/webpack/runtime/compat get default export","webpack://@flarum/sticky/webpack/runtime/define property getters","webpack://@flarum/sticky/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/sticky/webpack/runtime/make namespace object","webpack://@flarum/sticky/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['common/Model']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['forum/utils/DiscussionControls']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['forum/states/DiscussionListState']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['forum/components/DiscussionListItem']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['forum/components/IndexPage']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['common/utils/string']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['common/utils/classList']\"","webpack://@flarum/sticky/external root \"flarum.core.compat['common/extenders']\"","webpack://@flarum/sticky/../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@flarum/sticky/external root \"flarum.core.compat['forum/components/EventPost']\"","webpack://@flarum/sticky/./src/forum/components/DiscussionStickiedPost.js","webpack://@flarum/sticky/../../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@flarum/sticky/./src/forum/extend.ts","webpack://@flarum/sticky/./src/forum/index.js","webpack://@flarum/sticky/./src/forum/addStickyBadge.js","webpack://@flarum/sticky/./src/forum/addStickyControl.js","webpack://@flarum/sticky/./src/forum/addStickyExcerpt.js","webpack://@flarum/sticky/./src/forum/addStickyClass.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['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Discussion'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Badge'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/DiscussionControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/states/DiscussionListState'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionListItem'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/string'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/classList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","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}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/EventPost'];","import EventPost from 'flarum/forum/components/EventPost';\n\nexport default class DiscussionStickiedPost extends EventPost {\n icon() {\n return 'fas fa-thumbtack';\n }\n\n descriptionKey() {\n return this.attrs.post.content().sticky\n ? 'flarum-sticky.forum.post_stream.discussion_stickied_text'\n : 'flarum-sticky.forum.post_stream.discussion_unstickied_text';\n }\n}\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}","import Extend from 'flarum/common/extenders';\nimport DiscussionStickiedPost from './components/DiscussionStickiedPost';\n\nexport default [new Extend.PostTypes().add('discussionStickied', DiscussionStickiedPost)];\n","import app from 'flarum/forum/app';\nimport Model from 'flarum/common/Model';\nimport Discussion from 'flarum/common/models/Discussion';\n\nimport addStickyBadge from './addStickyBadge';\nimport addStickyControl from './addStickyControl';\nimport addStickyExcerpt from './addStickyExcerpt';\nimport addStickyClass from './addStickyClass';\n\nexport { default as extend } from './extend';\n\napp.initializers.add('flarum-sticky', () => {\n Discussion.prototype.isSticky = Model.attribute('isSticky');\n Discussion.prototype.canSticky = Model.attribute('canSticky');\n\n addStickyBadge();\n addStickyControl();\n addStickyExcerpt();\n addStickyClass();\n});\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Badge from 'flarum/common/components/Badge';\n\nexport default function addStickyBadge() {\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.isSticky()) {\n badges.add(\n 'sticky',\n Badge.component({\n type: 'sticky',\n label: app.translator.trans('flarum-sticky.forum.badge.sticky_tooltip'),\n icon: 'fas fa-thumbtack',\n }),\n 10\n );\n }\n });\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionControls from 'flarum/forum/utils/DiscussionControls';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport Button from 'flarum/common/components/Button';\n\nexport default function addStickyControl() {\n extend(DiscussionControls, 'moderationControls', function (items, discussion) {\n if (discussion.canSticky()) {\n items.add(\n 'sticky',\n Button.component(\n {\n icon: 'fas fa-thumbtack',\n onclick: this.stickyAction.bind(discussion),\n },\n app.translator.trans(\n discussion.isSticky()\n ? 'flarum-sticky.forum.discussion_controls.unsticky_button'\n : 'flarum-sticky.forum.discussion_controls.sticky_button'\n )\n )\n );\n }\n });\n\n DiscussionControls.stickyAction = function () {\n this.save({ isSticky: !this.isSticky() }).then(() => {\n if (app.current.matches(DiscussionPage)) {\n app.current.get('stream').update();\n }\n\n m.redraw();\n });\n };\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionListState from 'flarum/forum/states/DiscussionListState';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default function addStickyControl() {\n extend(DiscussionListState.prototype, 'requestParams', function (params) {\n if (app.current.matches(IndexPage) || app.current.matches(DiscussionPage)) {\n params.include.push('firstPost');\n }\n });\n\n extend(DiscussionListItem.prototype, 'infoItems', function (items) {\n const discussion = this.attrs.discussion;\n\n if (discussion.isSticky() && !this.attrs.params.q && !discussion.lastReadPostNumber()) {\n const firstPost = discussion.firstPost();\n\n if (firstPost) {\n const excerpt = truncate(firstPost.contentPlain(), 175);\n\n // Wrapping in
because ItemList entries need to be vnodes\n items.add('excerpt',
{excerpt}
, -100);\n }\n }\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport classList from 'flarum/common/utils/classList';\n\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\n\nexport default function addStickyClass() {\n extend(DiscussionListItem.prototype, 'elementAttrs', function (attrs) {\n if (this.attrs.discussion.isSticky()) {\n attrs.className = classList(attrs.className, 'DiscussionListItem--sticky');\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","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","DiscussionStickiedPost","subClass","superClass","create","constructor","icon","descriptionKey","this","attrs","post","content","sticky","EventPost","Extend","add","app","Discussion","Model","extend","badges","isSticky","Badge","type","label","DiscussionControls","items","discussion","canSticky","Button","onclick","stickyAction","save","then","DiscussionPage","update","m","redraw","DiscussionListState","params","IndexPage","include","push","DiscussionListItem","q","lastReadPostNumber","firstPost","excerpt","truncate","contentPlain","className","classList"],"sourceRoot":""}