From f30b87260bfdf9b9eb0bbfbf351d91c6923dc9b9 Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Sun, 3 Nov 2024 17:06:22 +0000 Subject: [PATCH] Bundled output for commit e90f6022c05703d2efa7828a52d2d06f313e3e22 Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/dist/forum.js b/js/dist/forum.js index 1743d44..6b1f8bf 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={649: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:()=>N});const t=flarum.core.compat["forum/app"];var e=o.n(t);const i=flarum.core.compat["common/extend"];o(649);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 f(t,e){return f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},f(t,e)}const p=flarum.core.compat["common/Component"];var d=o.n(p);const h=flarum.core.compat["common/components/LoadingIndicator"];var b=o.n(h);const v=flarum.core.compat["common/components/Button"];var g=o.n(v);const y=flarum.core.compat["common/utils/classList"];var x=o.n(y);const B=flarum.core.compat["common/utils/extractText"];var S=o.n(B),w=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,f(o,r);var n=i.prototype;return n.oninit=function(o){t.prototype.oninit.call(this,o),this.editing=!1,this.loading=!1,this.textareaRows="5",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.displayName()})},n.view=function(){var t,o=this,r=this.attrs.user,i=this.attrs.editable&&this.attrs.user.attribute("canEditBio");if(this.editing){var n=this.tempBio,a=null!=n?n:r.bio();t=m("form",{onsubmit:this.save.bind(this)},m("textarea",{className:"FormControl",placeholder:S()(this.bioPlaceholder),rows:this.textareaRows,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))}}),m("div",{className:"UserBio-actions"},m(g(),{className:"Button Button--primary",type:"submit"},e().translator.trans("fof-user-bio.forum.profile.save_button")),m(g(),{className:"Button",type:"reset",onclick:this.reset.bind(this)},e().translator.trans("fof-user-bio.forum.profile.cancel_button"))))}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")||5;t=m("div",{className:"UserBio-content",onclick:i?this.edit.bind(this):function(){},onkeydown:i?this.onkeydown.bind(this):function(){},style:{"--bio-max-lines":l},role:i?"button":void 0,tabindex:i?"0":void 0,"aria-label":i?e().translator.trans("fof-user-bio.forum.profile.edit_bio_label"):void 0},s)}return m("div",{className:"UserBio "+x()({editable:i,editing:this.editing})},t)},n.onkeydown=function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.edit(t))},n.edit=function(t){if(!t.ctrlKey&&!t.metaKey){t.preventDefault();var e=window.getSelection(),o=e.anchorOffset,r=e.anchorNode&&t.target.className.includes("UserBio")?e.anchorNode:t.target,i=this.countTextLengthBefore(r),n=t.currentTarget.scrollTop,a=i+o;this.textareaRows=getComputedStyle(t.currentTarget).getPropertyValue("--bio-max-lines")||"5",this.editing=!0,m.redraw.sync(),this.$("textarea").trigger("focus").prop("selectionStart",a).prop("selectionEnd",a).prop("scrollTop",n)}},n.save=function(t){var e=this;t.preventDefault();var o=this.$("textarea").val(),r=this.attrs.user,i=this.$("textarea").prop("selectionStart");this.isDirty()&&(this.loading=!0,r.save({bio:o}).catch((function(){e.tempBio=o,e.tempSelector=i,e.edit()})).then((function(){e.loading=!1,delete e.tempBio,m.redraw()}))),this.editing=!1,m.redraw()},n.reset=function(t){t.preventDefault(),this.isDirty()&&!confirm(S()(e().translator.trans("fof-user-bio.forum.profile.cancel_confirm")))||(this.editing=!1,delete this.tempBio,m.redraw())},n.isDirty=function(){var t=this.$("textarea").val();return this.attrs.user.bio()!==t},n.countTextLengthBefore=function(t){if(!t||t instanceof HTMLElement&&t.className.includes("UserBio"))return 0;var e=0;if(t.previousSibling)for(var o=t.previousSibling;o;o=o.previousSibling)e+=o.textContent.length;return t.parentNode,e+this.countTextLengthBefore(t.parentNode)},i}(d()),N={UserBio:w};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(w,{user:e,editable:this.attrs.editable}),-100)}))}))})(),module.exports=r})(); +(()=>{var t={649: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:()=>_});const t=flarum.core.compat["forum/app"];var e=o.n(t);const i=flarum.core.compat["common/extend"];o(649);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 f(t,e){return f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},f(t,e)}const p=flarum.core.compat["common/Component"];var d=o.n(p);const h=flarum.core.compat["common/components/LoadingIndicator"];var b=o.n(h);const v=flarum.core.compat["common/components/Button"];var g=o.n(v);const y=flarum.core.compat["common/utils/classList"];var x=o.n(y);const B=flarum.core.compat["common/utils/extractText"];var S=o.n(B),w=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,f(o,r);var n=i.prototype;return n.oninit=function(o){t.prototype.oninit.call(this,o),this.editing=!1,this.loading=!1,this.textareaRows="5",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.displayName()})},n.view=function(){var t,o=this,r=this.attrs.user,i=this.attrs.editable&&this.attrs.user.attribute("canEditBio");if(this.editing){var n=this.tempBio,a=null!=n?n:r.bio();t=m("form",{onsubmit:this.save.bind(this)},m("textarea",{className:"FormControl",placeholder:S()(this.bioPlaceholder),rows:this.textareaRows,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))}}),m("div",{className:"UserBio-actions"},m(g(),{className:"Button Button--primary",type:"submit"},e().translator.trans("fof-user-bio.forum.profile.save_button")),m(g(),{className:"Button",type:"reset",onclick:this.reset.bind(this)},e().translator.trans("fof-user-bio.forum.profile.cancel_button"))))}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",target:"_blank"})+"

"):i&&(s=m("p",{className:"UserBio-placeholder"},this.bioPlaceholder))}var l=e().forum.attribute("fof-user-bio.maxLines")||5;t=m("div",{className:"UserBio-content",onclick:i?this.edit.bind(this):function(){},onkeydown:i?this.onkeydown.bind(this):function(){},style:{"--bio-max-lines":l},role:i?"button":void 0,tabindex:i?"0":void 0,"aria-label":i?e().translator.trans("fof-user-bio.forum.profile.edit_bio_label"):void 0},s)}return m("div",{className:"UserBio "+x()({editable:i,editing:this.editing})},t)},n.onkeydown=function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.edit(t))},n.edit=function(t){if(!t.ctrlKey&&!t.metaKey){t.preventDefault();var e=window.getSelection(),o=e.anchorOffset,r=e.anchorNode&&t.target.className.includes("UserBio")?e.anchorNode:t.target,i=this.countTextLengthBefore(r),n=t.currentTarget.scrollTop,a=i+o;this.textareaRows=getComputedStyle(t.currentTarget).getPropertyValue("--bio-max-lines")||"5",this.editing=!0,m.redraw.sync(),this.$("textarea").trigger("focus").prop("selectionStart",a).prop("selectionEnd",a).prop("scrollTop",n)}},n.save=function(t){var e=this;t.preventDefault();var o=this.$("textarea").val(),r=this.attrs.user,i=this.$("textarea").prop("selectionStart");this.isDirty()&&(this.loading=!0,r.save({bio:o}).catch((function(){e.tempBio=o,e.tempSelector=i,e.edit()})).then((function(){e.loading=!1,delete e.tempBio,m.redraw()}))),this.editing=!1,m.redraw()},n.reset=function(t){t.preventDefault(),this.isDirty()&&!confirm(S()(e().translator.trans("fof-user-bio.forum.profile.cancel_confirm")))||(this.editing=!1,delete this.tempBio,m.redraw())},n.isDirty=function(){var t=this.$("textarea").val();return this.attrs.user.bio()!==t},n.countTextLengthBefore=function(t){if(!t||t instanceof HTMLElement&&t.className.includes("UserBio"))return 0;var e=0;if(t.previousSibling)for(var o=t.previousSibling;o;o=o.previousSibling)e+=o.textContent.length;return t.parentNode,e+this.countTextLengthBefore(t.parentNode)},i}(d()),_={UserBio:w};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(w,{user:e,editable:this.attrs.editable}),-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 13f6327..ada0128 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,EAAEC,EAAEC,EAAyK,OAA1HD,EAAE,wHAA6H,GAA5KD,EAAE,GAAGG,UAAUC,OAAOZ,EAAEa,KAAKF,UAAU,GAAG,IAAsIC,QAAuDL,EAAEC,EAAE,GAAGF,EAAE,WAAW,IAAIQ,EAAO,IAAIT,KAATS,EAAE,GAAYP,EAAEG,EAAEH,EAAEF,GAAG,aAAaA,GAAGS,EAAEC,KAAK,IAAIV,EAAE,KAAKK,EAAE,KAAK,OAAOI,CAAC,CAAzF,GAA6FE,KAAK,IAAWC,KAAKC,QAAQT,GAAE,SAASK,EAAET,EAAEG,GAC/Z,MAAM,GAAGH,IAD4Z,mBAAoBE,EAAEY,SAASZ,EAAEY,SAASX,QACzf,IAAS,YAAYA,EAAE,IAAIF,EAAE,IAAIE,EAAE,OAAmB,KADyNS,KAAKC,QAAQT,EAAE,wBACtO,CAAE,GAAEI,KAAKI,K,GCA7DG,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,CAAC,GAOX,OAHAE,EAAoBL,GAAUT,KAAKa,EAAOD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G,KAAK4H,YAAaE,QAAQxD,IAAYrB,IAAAA,WAAeM,MAAM,iDAC9DvD,KAAK6C,SAAU,SACR7C,KAAK8D,QACZE,EAAEuD,SAEN,EAAC7E,EAEDkF,QAAA,WACE,IAAMjG,EAAQ3B,KAAKwF,EAAE,YAAYmC,MAGjC,OAFa3H,KAAKsD,MAAMF,KAEZW,QAAUpC,CACxB,EAEAe,EAKAsE,sBAAA,SAAsBJ,GACpB,IAAKA,GAAeA,aAAsBmB,aAAenB,EAAWxC,UAAU0C,SAAS,WAAa,OAAO,EAE3G,IAAInH,EAAS,EAEb,GAAIiH,EAAWoB,gBACb,IAAK,IAAIC,EAAOrB,EAAWoB,gBAAiBC,EAAMA,EAAOA,EAAKD,gBAC5DrI,GAAUsI,EAAKC,YAAYvI,OAO/B,OAHeiH,EAAWuB,WAGnBxI,EAASK,KAAKgH,sBAAsBJ,EAAWuB,WACxD,EAAChG,CAAA,CA7PyB,CAASiG,KETxBC,EAAa,CACxBlG,QAAAA,GCOFc,IAAAA,aAAiBqF,IAAI,gBAAgB,WACnCC,IAAAA,UAAexE,IAAMyE,IAAAA,UAAgB,OACrCD,IAAAA,UAAejD,QAAUkD,IAAAA,UAAgB,YAEzCC,EAAAA,EAAAA,QAAOC,IAAAA,UAAoB,aAAa,SAAUC,GAChD,IAAIvF,EAAOpD,KAAKsD,MAAMF,KAEjBA,EAAKF,UAAU,eAIpByF,EAAML,IAAI,MAAOtE,EAAC7B,EAAO,CAACiB,KAAMA,EAAMS,SAAU7D,KAAKsD,MAAMO,YAAe,IAC5E,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['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/components/Button']\"","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['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/components/Button'];","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 Button from 'flarum/common/components/Button';\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 the bio is currently being edited.\n *\n * @type {boolean}\n */\n this.editing = false;\n\n /**\n * Whether the bio is currently being saved.\n *\n * @type {boolean}\n */\n this.loading = false;\n\n /**\n * The rows to show in the textarea by default when editing.\n * This is set to 5 by default, but can be overridden by the `--bio-max-lines` CSS variable.\n *\n * @type {string}\n */\n this.textareaRows = '5';\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.displayName(),\n });\n }\n\n view() {\n const user = this.attrs.user;\n const editable = this.attrs.editable && this.attrs.user.attribute('canEditBio');\n let content;\n\n if (this.editing) {\n const tempBio = this.tempBio;\n const value = tempBio ?? user.bio();\n\n const focusIfErrored = (vnode) => {\n const textarea = vnode.dom;\n\n textarea.value = value;\n\n if (tempBio !== undefined) {\n textarea.value = tempBio;\n textarea.focus();\n\n if (this.tempSelector !== undefined) {\n textarea.selectionStart = this.tempSelector;\n textarea.selectionEnd = this.tempSelector;\n\n delete this.tempSelector;\n }\n }\n };\n\n content = (\n
\n \n
\n \n \n
\n \n );\n } else {\n let subContent;\n\n if (this.loading) {\n subContent = (\n

\n \n

\n );\n } else {\n const bioHtml = user.bioHtml();\n\n if (bioHtml) {\n subContent = m.trust(bioHtml);\n } else if (user.bio()) {\n subContent = m.trust('

' + $('

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

');\n } else if (editable) {\n subContent =

{this.bioPlaceholder}

;\n }\n }\n\n const maxLines = app.forum.attribute('fof-user-bio.maxLines') || 5;\n\n content = (\n undefined}\n onclick={editable ? this.edit.bind(this) : () => undefined}\n onkeydown={editable ? this.onkeydown.bind(this) : () => undefined}\n style={{ '--bio-max-lines': maxLines }}\n role={editable ? 'button' : undefined}\n tabindex={editable ? '0' : undefined}\n aria-label={editable ? app.translator.trans('fof-user-bio.forum.profile.edit_bio_label') : undefined}\n >\n {subContent}\n
\n );\n }\n\n return (\n \n {content}\n
\n );\n }\n\n onkeydown(e) {\n // Allow keyboard navigation to turn editing mode on\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.edit(e);\n }\n }\n\n /**\n * Edit the bio.\n * @param {MouseEvent} e\n */\n edit(e) {\n // If the click is special, do not switch to editing mode.\n // e.g. allows for Ctrl+Click to open a link in a new tab\n if (e.ctrlKey || e.metaKey) return;\n\n e.preventDefault();\n\n // Maintain the scroll position & cursor position when editing\n const selection = window.getSelection();\n const lineIndex = selection.anchorOffset;\n\n // Sometimes, links are clicked and the anchorNode is either null or the UserBio-content itself\n const clickedNode = !selection.anchorNode || !e.target.className.includes('UserBio') ? e.target : selection.anchorNode;\n const lengthBefore = this.countTextLengthBefore(clickedNode);\n\n const currentScroll = e.currentTarget.scrollTop;\n const index = lengthBefore + lineIndex;\n\n // Show the same number of lines to avoid layout shift\n this.textareaRows = getComputedStyle(e.currentTarget).getPropertyValue('--bio-max-lines') || '5';\n\n this.editing = true;\n m.redraw.sync();\n\n this.$('textarea').trigger('focus').prop('selectionStart', index).prop('selectionEnd', index).prop('scrollTop', currentScroll);\n }\n\n /**\n * Save the bio.\n */\n save(e) {\n e.preventDefault();\n\n const value = this.$('textarea').val();\n const user = this.attrs.user;\n const tempSelector = this.$('textarea').prop('selectionStart');\n\n // Don't constantly try to save when blurring textarea\n if (this.isDirty()) {\n this.loading = true;\n\n user\n .save({ bio: value })\n .catch(() => {\n this.tempBio = value;\n this.tempSelector = tempSelector;\n this.edit();\n })\n .then(() => {\n this.loading = false;\n delete this.tempBio;\n m.redraw();\n });\n }\n\n this.editing = false;\n m.redraw();\n }\n\n reset(e) {\n // Don't want to actually reset the form\n e.preventDefault();\n\n // Either nothing changed or we want to confirm the loss of changes\n if (!this.isDirty() || confirm(extractText(app.translator.trans('fof-user-bio.forum.profile.cancel_confirm')))) {\n this.editing = false;\n delete this.tempBio;\n m.redraw();\n }\n }\n\n isDirty() {\n const value = this.$('textarea').val();\n const user = this.attrs.user;\n\n return user.bio() !== value;\n }\n\n /**\n *\n * @param {Node} anchorNode\n * @returns {number}\n */\n countTextLengthBefore(anchorNode) {\n if (!anchorNode || (anchorNode instanceof HTMLElement && anchorNode.className.includes('UserBio'))) return 0;\n\n let length = 0;\n\n if (anchorNode.previousSibling) {\n for (let prev = anchorNode.previousSibling; prev; prev = prev.previousSibling) {\n length += prev.textContent.length;\n }\n }\n\n const parent = anchorNode.parentNode;\n\n // We need to recursively call this function if the anchorNode is not a direct child of UserBio-content\n return length + this.countTextLengthBefore(anchorNode.parentNode);\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 UserBio from './UserBio';\n\nexport const components = {\n UserBio,\n};\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport 'autolink-js';\nimport UserCard from 'flarum/forum/components/UserCard';\nimport User from 'flarum/common/models/User';\nimport Model from 'flarum/common/Model';\nimport UserBio from './components/UserBio';\n\nexport * from './components';\n\napp.initializers.add('fof-user-bio', () => {\n User.prototype.bio = Model.attribute('bio');\n User.prototype.bioHtml = Model.attribute('bioHtml');\n\n extend(UserCard.prototype, 'infoItems', function (items) {\n let user = this.attrs.user;\n\n if (!user.attribute('canViewBio')) {\n return;\n }\n\n items.add('bio', , -100);\n });\n});\n"],"names":["h","slice","String","prototype","autoLink","b","f","d","a","e","g","arguments","length","call","c","push","join","this","replace","callback","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","n","getter","__esModule","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","hasOwnProperty","r","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","__proto__","UserBio","_Component","subClass","superClass","apply","create","constructor","_proto","oninit","vnode","editing","loading","textareaRows","bioMaxLength","app","attribute","bioPlaceholder","user","id","attrs","trans","username","displayName","view","content","_this","editable","tempBio","bio","m","onsubmit","save","bind","className","placeholder","extractText","rows","maxlength","oncreate","textarea","dom","focus","tempSelector","selectionStart","selectionEnd","Button","type","onclick","reset","subContent","LoadingIndicator","bioHtml","trust","$","text","html","rel","maxLines","edit","onkeydown","style","role","tabindex","classList","preventDefault","ctrlKey","metaKey","selection","window","getSelection","lineIndex","anchorOffset","clickedNode","anchorNode","target","includes","lengthBefore","countTextLengthBefore","currentScroll","currentTarget","scrollTop","index","getComputedStyle","getPropertyValue","redraw","sync","trigger","_this2","val","isDirty","then","confirm","HTMLElement","previousSibling","prev","textContent","parentNode","Component","components","add","User","Model","extend","UserCard","items"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"6BAAA,WAAY,IAAIA,EAAE,GAAGC,MAAMC,OAAOC,UAAUC,SAAS,WAAW,IAAIC,EAAEC,EAAEC,EAAEC,EAAEC,EAAEC,EAAyK,OAA1HD,EAAE,wHAA6H,GAA5KD,EAAE,GAAGG,UAAUC,OAAOZ,EAAEa,KAAKF,UAAU,GAAG,IAAs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,CAAA,CA/PyB,CAASiG,KETxBC,EAAa,CACxBlG,QAAAA,GCOFc,IAAAA,aAAiBqF,IAAI,gBAAgB,WACnCC,IAAAA,UAAexE,IAAMyE,IAAAA,UAAgB,OACrCD,IAAAA,UAAejD,QAAUkD,IAAAA,UAAgB,YAEzCC,EAAAA,EAAAA,QAAOC,IAAAA,UAAoB,aAAa,SAAUC,GAChD,IAAIvF,EAAOpD,KAAKsD,MAAMF,KAEjBA,EAAKF,UAAU,eAIpByF,EAAML,IAAI,MAAOtE,EAAC7B,EAAO,CAACiB,KAAMA,EAAMS,SAAU7D,KAAKsD,MAAMO,YAAe,IAC5E,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['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/components/Button']\"","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['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/components/Button'];","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 Button from 'flarum/common/components/Button';\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 the bio is currently being edited.\n *\n * @type {boolean}\n */\n this.editing = false;\n\n /**\n * Whether the bio is currently being saved.\n *\n * @type {boolean}\n */\n this.loading = false;\n\n /**\n * The rows to show in the textarea by default when editing.\n * This is set to 5 by default, but can be overridden by the `--bio-max-lines` CSS variable.\n *\n * @type {string}\n */\n this.textareaRows = '5';\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.displayName(),\n });\n }\n\n view() {\n const user = this.attrs.user;\n const editable = this.attrs.editable && this.attrs.user.attribute('canEditBio');\n let content;\n\n if (this.editing) {\n const tempBio = this.tempBio;\n const value = tempBio ?? user.bio();\n\n const focusIfErrored = (vnode) => {\n const textarea = vnode.dom;\n\n textarea.value = value;\n\n if (tempBio !== undefined) {\n textarea.value = tempBio;\n textarea.focus();\n\n if (this.tempSelector !== undefined) {\n textarea.selectionStart = this.tempSelector;\n textarea.selectionEnd = this.tempSelector;\n\n delete this.tempSelector;\n }\n }\n };\n\n content = (\n
\n \n
\n \n \n
\n \n );\n } else {\n let subContent;\n\n if (this.loading) {\n subContent = (\n

\n \n

\n );\n } else {\n const bioHtml = user.bioHtml();\n\n if (bioHtml) {\n subContent = m.trust(bioHtml);\n } else if (user.bio()) {\n subContent = m.trust(\n '

' + $('

').text(user.bio()).html().replace(/\\n/g, '
').autoLink({ rel: 'nofollow ugc', target: '_blank' }) + '

'\n );\n } else if (editable) {\n subContent =

{this.bioPlaceholder}

;\n }\n }\n\n const maxLines = app.forum.attribute('fof-user-bio.maxLines') || 5;\n\n content = (\n undefined}\n onclick={editable ? this.edit.bind(this) : () => undefined}\n onkeydown={editable ? this.onkeydown.bind(this) : () => undefined}\n style={{ '--bio-max-lines': maxLines }}\n role={editable ? 'button' : undefined}\n tabindex={editable ? '0' : undefined}\n aria-label={editable ? app.translator.trans('fof-user-bio.forum.profile.edit_bio_label') : undefined}\n >\n {subContent}\n
\n );\n }\n\n return (\n \n {content}\n
\n );\n }\n\n onkeydown(e) {\n // Allow keyboard navigation to turn editing mode on\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.edit(e);\n }\n }\n\n /**\n * Edit the bio.\n * @param {MouseEvent} e\n */\n edit(e) {\n // If the click is special, do not switch to editing mode.\n // e.g. allows for Ctrl+Click to open a link in a new tab\n if (e.ctrlKey || e.metaKey) return;\n\n e.preventDefault();\n\n // Maintain the scroll position & cursor position when editing\n const selection = window.getSelection();\n const lineIndex = selection.anchorOffset;\n\n // Sometimes, links are clicked and the anchorNode is either null or the UserBio-content itself\n const clickedNode = !selection.anchorNode || !e.target.className.includes('UserBio') ? e.target : selection.anchorNode;\n const lengthBefore = this.countTextLengthBefore(clickedNode);\n\n const currentScroll = e.currentTarget.scrollTop;\n const index = lengthBefore + lineIndex;\n\n // Show the same number of lines to avoid layout shift\n this.textareaRows = getComputedStyle(e.currentTarget).getPropertyValue('--bio-max-lines') || '5';\n\n this.editing = true;\n m.redraw.sync();\n\n this.$('textarea').trigger('focus').prop('selectionStart', index).prop('selectionEnd', index).prop('scrollTop', currentScroll);\n }\n\n /**\n * Save the bio.\n */\n save(e) {\n e.preventDefault();\n\n const value = this.$('textarea').val();\n const user = this.attrs.user;\n const tempSelector = this.$('textarea').prop('selectionStart');\n\n // Don't constantly try to save when blurring textarea\n if (this.isDirty()) {\n this.loading = true;\n\n user\n .save({ bio: value })\n .catch(() => {\n this.tempBio = value;\n this.tempSelector = tempSelector;\n this.edit();\n })\n .then(() => {\n this.loading = false;\n delete this.tempBio;\n m.redraw();\n });\n }\n\n this.editing = false;\n m.redraw();\n }\n\n reset(e) {\n // Don't want to actually reset the form\n e.preventDefault();\n\n // Either nothing changed or we want to confirm the loss of changes\n if (!this.isDirty() || confirm(extractText(app.translator.trans('fof-user-bio.forum.profile.cancel_confirm')))) {\n this.editing = false;\n delete this.tempBio;\n m.redraw();\n }\n }\n\n isDirty() {\n const value = this.$('textarea').val();\n const user = this.attrs.user;\n\n return user.bio() !== value;\n }\n\n /**\n *\n * @param {Node} anchorNode\n * @returns {number}\n */\n countTextLengthBefore(anchorNode) {\n if (!anchorNode || (anchorNode instanceof HTMLElement && anchorNode.className.includes('UserBio'))) return 0;\n\n let length = 0;\n\n if (anchorNode.previousSibling) {\n for (let prev = anchorNode.previousSibling; prev; prev = prev.previousSibling) {\n length += prev.textContent.length;\n }\n }\n\n const parent = anchorNode.parentNode;\n\n // We need to recursively call this function if the anchorNode is not a direct child of UserBio-content\n return length + this.countTextLengthBefore(anchorNode.parentNode);\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 UserBio from './UserBio';\n\nexport const components = {\n UserBio,\n};\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport 'autolink-js';\nimport UserCard from 'flarum/forum/components/UserCard';\nimport User from 'flarum/common/models/User';\nimport Model from 'flarum/common/Model';\nimport UserBio from './components/UserBio';\n\nexport * from './components';\n\napp.initializers.add('fof-user-bio', () => {\n User.prototype.bio = Model.attribute('bio');\n User.prototype.bioHtml = Model.attribute('bioHtml');\n\n extend(UserCard.prototype, 'infoItems', function (items) {\n let user = this.attrs.user;\n\n if (!user.attribute('canViewBio')) {\n return;\n }\n\n items.add('bio', , -100);\n });\n});\n"],"names":["h","slice","String","prototype","autoLink","b","f","d","a","e","g","arguments","length","call","c","push","join","this","replace","callback","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","n","getter","__esModule","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","hasOwnProperty","r","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","__proto__","UserBio","_Component","subClass","superClass","apply","create","constructor","_proto","oninit","vnode","editing","loading","textareaRows","bioMaxLength","app","attribute","bioPlaceholder","user","id","attrs","trans","username","displayName","view","content","_this","editable","tempBio","bio","m","onsubmit","save","bind","className","placeholder","extractText","rows","maxlength","oncreate","textarea","dom","focus","tempSelector","selectionStart","selectionEnd","Button","type","onclick","reset","subContent","LoadingIndicator","bioHtml","trust","$","text","html","rel","target","maxLines","edit","onkeydown","style","role","tabindex","classList","preventDefault","ctrlKey","metaKey","selection","window","getSelection","lineIndex","anchorOffset","clickedNode","anchorNode","includes","lengthBefore","countTextLengthBefore","currentScroll","currentTarget","scrollTop","index","getComputedStyle","getPropertyValue","redraw","sync","trigger","_this2","val","isDirty","then","confirm","HTMLElement","previousSibling","prev","textContent","parentNode","Component","components","add","User","Model","extend","UserCard","items"],"sourceRoot":""} \ No newline at end of file