diff --git a/js/dist/admin.js b/js/dist/admin.js index 54d50f0..22cd948 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var e={n:r=>{var o=r&&r.__esModule?()=>r.default:()=>r;return e.d(o,{a:o}),o},d:(r,o)=>{for(var t in o)e.o(o,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:o[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r);const o=flarum.core.compat["admin/app"];var t=e.n(o);t().initializers.add("fof-user-bio",(function(){t().extensionData.for("fof-user-bio").registerPermission({icon:"fas fa-pen",label:t().translator.trans("fof-user-bio.admin.permission.view"),permission:"fof-user-bio.view",allowGuest:!0},"view").registerPermission({icon:"fas fa-pen",label:t().translator.trans("fof-user-bio.admin.permission.editOwn"),permission:"fof-user-bio.editOwn"},"start").registerPermission({icon:"fas fa-pen",label:t().translator.trans("fof-user-bio.admin.permission.editAny"),permission:"fof-user-bio.editAny"},"moderate").registerSetting({label:t().translator.trans("fof-user-bio.admin.setting.bioLimit"),setting:"fof-user-bio.maxLength",type:"number",placeholder:200}).registerSetting({label:t().translator.trans("fof-user-bio.admin.setting.allowFormatting"),help:t().translator.trans("fof-user-bio.admin.setting.allowFormatting_help"),setting:"fof-user-bio.allowFormatting",type:"boolean"})}))})(),module.exports=r})(); +(()=>{var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var i in t)e.o(t,i)&&!e.o(r,i)&&Object.defineProperty(r,i,{enumerable:!0,get:t[i]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r);const t=flarum.core.compat["admin/app"];var i=e.n(t);i().initializers.add("fof-user-bio",(function(){i().extensionData.for("fof-user-bio").registerPermission({icon:"fas fa-pen",label:i().translator.trans("fof-user-bio.admin.permission.view"),permission:"fof-user-bio.view",allowGuest:!0},"view").registerPermission({icon:"fas fa-pen",label:i().translator.trans("fof-user-bio.admin.permission.editOwn"),permission:"fof-user-bio.editOwn"},"start").registerPermission({icon:"fas fa-pen",label:i().translator.trans("fof-user-bio.admin.permission.editAny"),permission:"fof-user-bio.editAny"},"moderate").registerSetting({label:i().translator.trans("fof-user-bio.admin.setting.bioLimit"),setting:"fof-user-bio.maxLength",type:"number",placeholder:200}).registerSetting({label:i().translator.trans("fof-user-bio.admin.setting.maxLines"),setting:"fof-user-bio.maxLines",type:"number",placeholder:5,min:5}).registerSetting({label:i().translator.trans("fof-user-bio.admin.setting.allowFormatting"),help:i().translator.trans("fof-user-bio.admin.setting.allowFormatting_help"),setting:"fof-user-bio.allowFormatting",type:"boolean"})}))})(),module.exports=r})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index c1395c0..b669916 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,aAAiBC,IAAI,gBAAgB,WACnCD,IAAAA,cAAA,IACO,gBACJE,mBACC,CACEC,KAAM,aACNC,MAAOJ,IAAAA,WAAeK,MAAM,sCAC5BC,WAAY,oBACZC,YAAY,GAEd,QAEDL,mBACC,CACEC,KAAM,aACNC,MAAOJ,IAAAA,WAAeK,MAAM,yCAC5BC,WAAY,wBAEd,SAEDJ,mBACC,CACEC,KAAM,aACNC,MAAOJ,IAAAA,WAAeK,MAAM,yCAC5BC,WAAY,wBAEd,YAEDE,gBAAgB,CACfJ,MAAOJ,IAAAA,WAAeK,MAAM,uCAC5BI,QAAS,yBACTC,KAAM,SACNC,YAAa,MAEdH,gBAAgB,CACfJ,MAAOJ,IAAAA,WAAeK,MAAM,8CAC5BO,KAAMZ,IAAAA,WAAeK,MAAM,mDAC3BI,QAAS,+BACTC,KAAM,WAEX,G","sources":["webpack://@fof/user-bio/webpack/bootstrap","webpack://@fof/user-bio/webpack/runtime/compat get default export","webpack://@fof/user-bio/webpack/runtime/define property getters","webpack://@fof/user-bio/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/user-bio/webpack/runtime/make namespace object","webpack://@fof/user-bio/external root \"flarum.core.compat['admin/app']\"","webpack://@fof/user-bio/./src/admin/index.ts"],"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('fof-user-bio', () => {\n app.extensionData\n .for('fof-user-bio')\n .registerPermission(\n {\n icon: 'fas fa-pen',\n label: app.translator.trans('fof-user-bio.admin.permission.view'),\n permission: 'fof-user-bio.view',\n allowGuest: true,\n },\n 'view'\n )\n .registerPermission(\n {\n icon: 'fas fa-pen',\n label: app.translator.trans('fof-user-bio.admin.permission.editOwn'),\n permission: 'fof-user-bio.editOwn',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pen',\n label: app.translator.trans('fof-user-bio.admin.permission.editAny'),\n permission: 'fof-user-bio.editAny',\n },\n 'moderate'\n )\n .registerSetting({\n label: app.translator.trans('fof-user-bio.admin.setting.bioLimit'),\n setting: 'fof-user-bio.maxLength',\n type: 'number',\n placeholder: 200,\n })\n .registerSetting({\n label: app.translator.trans('fof-user-bio.admin.setting.allowFormatting'),\n help: app.translator.trans('fof-user-bio.admin.setting.allowFormatting_help'),\n setting: 'fof-user-bio.allowFormatting',\n type: 'boolean',\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","add","registerPermission","icon","label","trans","permission","allowGuest","registerSetting","setting","type","placeholder","help"],"sour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,WAAeK,MAAM,8CAC5BQ,KAAMb,IAAAA,WAAeK,MAAM,mDAC3BI,QAAS,+BACTC,KAAM,WAEX,G","sources":["webpack://@fof/user-bio/webpack/bootstrap","webpack://@fof/user-bio/webpack/runtime/compat get default export","webpack://@fof/user-bio/webpack/runtime/define property getters","webpack://@fof/user-bio/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/user-bio/webpack/runtime/make namespace object","webpack://@fof/user-bio/external root \"flarum.core.compat['admin/app']\"","webpack://@fof/user-bio/./src/admin/index.ts"],"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('fof-user-bio', () => {\n app.extensionData\n .for('fof-user-bio')\n .registerPermission(\n {\n icon: 'fas fa-pen',\n label: app.translator.trans('fof-user-bio.admin.permission.view'),\n permission: 'fof-user-bio.view',\n allowGuest: true,\n },\n 'view'\n )\n .registerPermission(\n {\n icon: 'fas fa-pen',\n label: app.translator.trans('fof-user-bio.admin.permission.editOwn'),\n permission: 'fof-user-bio.editOwn',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pen',\n label: app.translator.trans('fof-user-bio.admin.permission.editAny'),\n permission: 'fof-user-bio.editAny',\n },\n 'moderate'\n )\n .registerSetting({\n label: app.translator.trans('fof-user-bio.admin.setting.bioLimit'),\n setting: 'fof-user-bio.maxLength',\n type: 'number',\n placeholder: 200,\n })\n .registerSetting({\n label: app.translator.trans('fof-user-bio.admin.setting.maxLines'),\n setting: 'fof-user-bio.maxLines',\n type: 'number',\n placeholder: 5,\n min: 5,\n })\n .registerSetting({\n label: app.translator.trans('fof-user-bio.admin.setting.allowFormatting'),\n help: app.translator.trans('fof-user-bio.admin.setting.allowFormatting_help'),\n setting: 'fof-user-bio.allowFormatting',\n type: 'boolean',\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","add","registerPermission","icon","label","trans","permission","allowGuest","registerSetting","setting","type","placeholder","min","help"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index aff3502..d99984b 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={561:function(){(function(){var t=[].slice;String.prototype.autoLink=function(){var o,e,r,i,n,a;return n=/(^|[\s\n]|<[A-Za-z]*\/?>)((?:https?|ftp):\/\/[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi,0<(i=1<=arguments.length?t.call(arguments,0):[]).length?(r=i[0],e=function(){var t;for(o in t=[],r)a=r[o],"callback"!==o&&t.push(" "+o+"='"+a+"'");return t}().join(""),this.replace(n,(function(t,o,i){return""+o+(("function"==typeof r.callback?r.callback(i):void 0)||""+i+"")}))):this.replace(n,"$1$2")}}).call(this)}},o={};function e(r){var i=o[r];if(void 0!==i)return i.exports;var n=o[r]={exports:{}};return t[r].call(n.exports,n,n.exports,e),n.exports}e.n=t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},e.d=(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},e.o=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),e.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";e.r(r),e.d(r,{components:()=>P});const t=flarum.core.compat["forum/app"];var o=e.n(t);const i=flarum.core.compat["common/extend"];e(561),flarum.core.compat["common/utils/computed"];const n=flarum.core.compat["forum/components/UserCard"];var a=e.n(n);const s=flarum.core.compat["common/models/User"];var c=e.n(s);const u=flarum.core.compat["common/Model"];var l=e.n(u);function p(t,o){return p=Object.setPrototypeOf||function(t,o){return t.__proto__=o,t},p(t,o)}const f=flarum.core.compat["common/Component"];var d=e.n(f);const h=flarum.core.compat["common/components/LoadingIndicator"];var b=e.n(h);const v=flarum.core.compat["common/utils/classList"];var g=e.n(v);const y=flarum.core.compat["common/utils/extractText"];var x=e.n(y),w=function(t){var e,r;function i(){return t.apply(this,arguments)||this}r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,p(e,r);var n=i.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.editing=!1,this.loading=!1,this.bioMaxLength=o().forum.attribute("fof-user-bio.maxLength"),this.bioPlaceholder=o().session&&o().session.user&&o().session.user.id()===this.attrs.user.id()?o().translator.trans("fof-user-bio.forum.userbioPlaceholder"):o().translator.trans("fof-user-bio.forum.userbioPlaceholderOtherUser",{username:this.attrs.user.username()})},n.view=function(){var t,o=this.attrs.user,e=this.attrs.user.attribute("canEditBio");if(this.editing)t=m("textarea",{className:"FormControl",placeholder:x()(this.bioPlaceholder),rows:"3",maxlength:this.bioMaxLength,value:o.bio()});else{var r;if(this.loading)r=m("p",{className:"UserBio-placeholder"},m(b(),null));else{var i=o.bioHtml();i?r=m.trust(i):o.bio()?r=m.trust("

"+$("

").text(o.bio()).html().replace(/\n/g,"
").autoLink({rel:"nofollow ugc"})+"

"):e&&(r=m("p",{className:"UserBio-placeholder"},this.bioPlaceholder))}t=m("div",{className:"UserBio-content",onclick:e?this.edit.bind(this):function(){}},r)}return m("div",{className:"UserBio "+g()({editable:e,editing:this.editing})},t)},n.edit=function(){this.editing=!0,m.redraw.sync();var t=this,o=function(o){o.shiftKey||(o.preventDefault(),t.save($(this).val()))};this.$("textarea").focus().bind("blur",o).bind("keydown","return",o),m.redraw()},n.save=function(t){var o=this,e=this.attrs.user;e.bio()!==t&&(this.loading=!0,e.save({bio:t}).catch((function(){})).then((function(){o.loading=!1,m.redraw()}))),this.editing=!1,m.redraw()},i}(d()),P={UserBio:w};o().initializers.add("fof-user-bio",(function(){c().prototype.bio=l().attribute("bio"),c().prototype.bioHtml=l().attribute("bioHtml"),(0,i.extend)(a().prototype,"infoItems",(function(t){var o=this.attrs.user;o.attribute("canViewBio")&&t.add("bio",m(w,{user:o}),-100)}))}))})(),module.exports=r})(); +(()=>{var t={561:function(){(function(){var t=[].slice;String.prototype.autoLink=function(){var e,o,r,i,n,a;return n=/(^|[\s\n]|<[A-Za-z]*\/?>)((?:https?|ftp):\/\/[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi,0<(i=1<=arguments.length?t.call(arguments,0):[]).length?(r=i[0],o=function(){var t;for(e in t=[],r)a=r[e],"callback"!==e&&t.push(" "+e+"='"+a+"'");return t}().join(""),this.replace(n,(function(t,e,i){return""+e+(("function"==typeof r.callback?r.callback(i):void 0)||""+i+"")}))):this.replace(n,"$1$2")}}).call(this)}},e={};function o(r){var i=e[r];if(void 0!==i)return i.exports;var n=e[r]={exports:{}};return t[r].call(n.exports,n,n.exports,o),n.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";o.r(r),o.d(r,{components:()=>B});const t=flarum.core.compat["forum/app"];var e=o.n(t);const i=flarum.core.compat["common/extend"];o(561),flarum.core.compat["common/utils/computed"];const n=flarum.core.compat["forum/components/UserCard"];var a=o.n(n);const s=flarum.core.compat["common/models/User"];var c=o.n(s);const l=flarum.core.compat["common/Model"];var u=o.n(l);function p(t,e){return p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},p(t,e)}const f=flarum.core.compat["common/Component"];var d=o.n(f);const h=flarum.core.compat["common/components/LoadingIndicator"];var b=o.n(h);const v=flarum.core.compat["common/utils/classList"];var g=o.n(v);const y=flarum.core.compat["common/utils/extractText"];var x=o.n(y),S=function(t){var o,r;function i(){return t.apply(this,arguments)||this}r=t,(o=i).prototype=Object.create(r.prototype),o.prototype.constructor=o,p(o,r);var n=i.prototype;return n.oninit=function(o){t.prototype.oninit.call(this,o),this.editing=!1,this.loading=!1,this.bioMaxLength=e().forum.attribute("fof-user-bio.maxLength"),this.bioPlaceholder=e().session&&e().session.user&&e().session.user.id()===this.attrs.user.id()?e().translator.trans("fof-user-bio.forum.userbioPlaceholder"):e().translator.trans("fof-user-bio.forum.userbioPlaceholderOtherUser",{username:this.attrs.user.username()})},n.view=function(){var t,o=this,r=this.attrs.user,i=this.attrs.user.attribute("canEditBio");if(this.editing){var n=this.tempBio,a=null!=n?n:r.bio();t=m("textarea",{className:"FormControl",placeholder:x()(this.bioPlaceholder),rows:"3",maxlength:this.bioMaxLength,oncreate:function(t){var e=t.dom;e.value=a,void 0!==n&&(e.value=n,e.focus(),void 0!==o.tempSelector&&(e.selectionStart=o.tempSelector,e.selectionEnd=o.tempSelector,delete o.tempSelector))}})}else{var s;if(this.loading)s=m("p",{className:"UserBio-placeholder"},m(b(),null));else{var c=r.bioHtml();c?s=m.trust(c):r.bio()?s=m.trust("

"+$("

").text(r.bio()).html().replace(/\n/g,"
").autoLink({rel:"nofollow ugc"})+"

"):i&&(s=m("p",{className:"UserBio-placeholder"},this.bioPlaceholder))}var l=e().forum.attribute("fof-user-bio.maxLines");t=m("div",{className:"UserBio-content",onclick:i?this.edit.bind(this):function(){},style:{"--bio-max-lines":l}},s)}return m("div",{className:"UserBio "+g()({editable:i,editing:this.editing})},t)},n.edit=function(){this.editing=!0,m.redraw.sync();var t=this,e=function(e){e.shiftKey||(e.preventDefault(),t.save(e.target.value,"blur"===e.type))};this.$("textarea").trigger("focus").on("blur",e).bind("keydown","return",e),m.redraw()},n.save=function(t,e){var o=this,r=this.attrs.user,i=this.$("textarea").prop("selectionStart"),n=e&&t===this.tempBio;n||r.bio()===t||(this.loading=!0,r.save({bio:t}).catch((function(){o.tempBio=t,o.tempSelector=i,o.edit()})).then((function(){o.loading=!1,delete o.tempBio,m.redraw()}))),n&&delete this.tempBio,this.editing=!1,m.redraw()},i}(d()),B={UserBio:S};e().initializers.add("fof-user-bio",(function(){c().prototype.bio=u().attribute("bio"),c().prototype.bioHtml=u().attribute("bioHtml"),(0,i.extend)(a().prototype,"infoItems",(function(t){var e=this.attrs.user;e.attribute("canViewBio")&&t.add("bio",m(S,{user:e}),-100)}))}))})(),module.exports=r})(); //# 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 002ee26..67a6c39 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"6BAAA,WAAY,IAAIA,EAAE,GAAGC,MAAMC,OAAOC,UAAUC,SAAS,WAAW,IAAIC,EAAEC,EAAEC,EAAEC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lC,IACjB3B,KAAK2C,SAAU,EAEfK,EACG4B,KAAK,CAAEf,IAAKlC,IADf,OAES,WAAQ,IACdsD,MAAK,WACJ,EAAKtC,SAAU,EACfqB,EAAEU,QACH,KAGL1E,KAAK0C,SAAU,EACfsB,EAAEU,QACH,E,EA/HkBvC,CAAgB+C,KERxBC,EAAa,CACxBhD,QAAAA,GCQFU,IAAAA,aAAiBuC,IAAI,gBAAgB,WACnCC,IAAAA,UAAexB,IAAMyB,IAAAA,UAAgB,OACrCD,IAAAA,UAAetB,QAAUuB,IAAAA,UAAgB,YAEzCC,EAAAA,EAAAA,QAAOC,IAAAA,UAAoB,aAAa,SAAUC,GAChD,IAAIzC,EAAOhD,KAAKkD,MAAMF,KAEjBA,EAAKF,UAAU,eAIpB2C,EAAML,IAAI,MAAO,EAACjD,EAAD,CAASa,KAAMA,KAAW,IAC5C,GACF,G","sources":["webpack://@fof/user-bio/./node_modules/autolink-js/autolink-min.js","webpack://@fof/user-bio/webpack/bootstrap","webpack://@fof/user-bio/webpack/runtime/compat get default export","webpack://@fof/user-bio/webpack/runtime/define property getters","webpack://@fof/user-bio/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/user-bio/webpack/runtime/make namespace object","webpack://@fof/user-bio/external root \"flarum.core.compat['forum/app']\"","webpack://@fof/user-bio/external root \"flarum.core.compat['common/extend']\"","webpack://@fof/user-bio/external root \"flarum.core.compat['common/utils/computed']\"","webpack://@fof/user-bio/external root \"flarum.core.compat['forum/components/UserCard']\"","webpack://@fof/user-bio/external root \"flarum.core.compat['common/models/User']\"","webpack://@fof/user-bio/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/user-bio/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/user-bio/external root \"flarum.core.compat['common/Component']\"","webpack://@fof/user-bio/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@fof/user-bio/external root \"flarum.core.compat['common/utils/classList']\"","webpack://@fof/user-bio/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@fof/user-bio/./src/forum/components/UserBio.js","webpack://@fof/user-bio/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/user-bio/./src/forum/components/index.js","webpack://@fof/user-bio/./src/forum/index.js"],"sourcesContent":["(function(){var h=[].slice;String.prototype.autoLink=function(){var b,f,d,a,e,g;a=1<=arguments.length?h.call(arguments,0):[];e=/(^|[\\s\\n]|<[A-Za-z]*\\/?>)((?:https?|ftp):\\/\\/[\\-A-Z0-9+\\u0026\\u2019@#\\/%?=()~_|!:,.;]*[\\-A-Z0-9+\\u0026@#\\/%=~()_|])/gi;if(!(0$2\");d=a[0];f=function(){var c;c=[];for(b in d)g=d[b],\"callback\"!==b&&c.push(\" \"+b+\"='\"+g+\"'\");return c}().join(\"\");return this.replace(e,function(c,b,a){c=(\"function\"===typeof d.callback?d.callback(a):\nvoid 0)||\"\"+a+\"\";return\"\"+b+c})}}).call(this);\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/computed'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserCard'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/User'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","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}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/classList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\n\n/**\n * The `UserBio` component displays a user's bio, optionally letting the user\n * edit it.\n */\nexport default class UserBio extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n /**\n * Whether or not the bio is currently being edited.\n *\n * @type {Boolean}\n */\n this.editing = false;\n\n /**\n * Whether or not the bio is currently being saved.\n *\n * @type {Boolean}\n */\n this.loading = false;\n\n /**\n * The max configured character count the bio may be\n */\n this.bioMaxLength = app.forum.attribute('fof-user-bio.maxLength');\n\n /**\n * The placeholder shown in the bio textbox when no input is set.\n */\n this.bioPlaceholder =\n app.session && app.session.user && app.session.user.id() === this.attrs.user.id()\n ? // Normal placeholder if they're looking at their own profile\n app.translator.trans('fof-user-bio.forum.userbioPlaceholder')\n : // Special placeholder if someone else is viewing their profile with edit access\n app.translator.trans('fof-user-bio.forum.userbioPlaceholderOtherUser', {\n username: this.attrs.user.username(),\n });\n }\n\n view() {\n const user = this.attrs.user;\n const editable = this.attrs.user.attribute('canEditBio');\n let content;\n\n if (this.editing) {\n content = (\n