From 22f577349adf9926f2c59c44eea3e21b448fc68d Mon Sep 17 00:00:00 2001 From: Jasper Vriends <4417659+jaspervriends@users.noreply.github.com> Date: Fri, 25 Jun 2021 23:38:16 +0200 Subject: [PATCH] Dist --- js/dist/admin.js | 4 ++-- js/dist/admin.js.map | 2 +- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/dist/admin.js b/js/dist/admin.js index b8cad27..603a9ff 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,9 +1,9 @@ -module.exports=function(t){var e={};function a(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)a.d(n,o,function(e){return t[e]}.bind(null,o));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=29)}([function(t,e){t.exports=flarum.core.compat.Model},function(t,e,a){"use strict";function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}a.d(e,"a",(function(){return o}))},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},function(t,e){t.exports=flarum.core.compat["utils/Stream"]},function(t,e){t.exports=flarum.core.compat["utils/ItemList"]},function(t,e){t.exports=flarum.core.compat["utils/mixin"]},function(t,e,a){"use strict";a.d(e,"a",(function(){return h}));var n=a(1),o=a(3),r=a.n(o),i=a(2),s=a.n(i),l=a(11),d=a.n(l),c=a(5),u=a.n(c),p=(a(18),a(9)),h=function(t){function e(){return t.apply(this,arguments)||this}Object(n.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.loading=!1},a.className=function(){return"Modal--small"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum.badge_information")},a.content=function(){var t=this;return m("div",null,m("div",{className:"Modal-body"},this.data().toArray()),this.attrs.userBadgeData&&app.forum.attribute("canGiveBadge")&&m("div",{className:"Modal-footer"},m(s.a,{className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge_confirm"))&&(t.loading=!0,t.attrs.userBadgeData.delete().then((function(){return t.hide()})))},loading:this.loading},app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge"))))},a.data=function(){var t=this,e=new u.a;return e.add("name",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.name"),":")),m("p",null,this.attrs.badge.name()))),e.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.attrs.badge.description()))),this.attrs.userBadgeData&&(this.attrs.userBadgeData.description()||app.forum.attribute("canGiveBadge"))&&e.add("earning_reason",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),":")),m("p",null,this.attrs.userBadgeData.description()?this.attrs.userBadgeData.description():m("i",null,app.translator.trans("v17development-flarum-badges.forum.badge.no_earning_reason"))),m("p",null,app.forum.attribute("canGiveBadge")&&m("a",{href:"#",onclick:function(e){e.preventDefault(),app.modal.show(p.a,{badge:t.attrs.userBadgeData})}},app.translator.trans("v17development-flarum-badges.forum.badge.update_earning_reason"))))),this.attrs.userBadgeData&&e.add("earned_date",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_on"),":")),m("p",null,d()(this.attrs.userBadgeData.assignedAt())))),this.attrs.userBadgeData&&e.add("category",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.category"),":")),m("p",null,this.attrs.badge.category()&&this.attrs.badge.category().name(),!this.attrs.badge.category()&&app.translator.trans("v17development-flarum-badges.forum.uncategorized")))),this.attrs.badge&&this.attrs.badge.earnedAmount()&&e.add("earned_amount",m("div",{className:"BadgeModalListItem"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:this.attrs.badge.earnedAmount()})))),e},e}(r.a)},function(t,e){t.exports=flarum.core.compat["common/Component"]},function(t,e,a){"use strict";a.d(e,"a",(function(){return h}));var n=a(1),o=a(3),r=a.n(o),i=a(2),s=a.n(i),l=a(5),d=a.n(l),c=(a(19),a(4)),u=a.n(c),p=a(7),h=function(t){function e(){return t.apply(this,arguments)||this}Object(n.a)(e,t);var a=e.prototype;return a.oninit=function(e){var a=this;t.prototype.oninit.call(this,e),this.selectedBadge=this.attrs.badge?this.attrs.badge.badge():null,this.user=this.attrs.badge?this.attrs.badge.user():this.attrs.user,this.userHasBadge=!1,this.badge=this.attrs.badge?this.attrs.badge:app.store.createRecord("userBadges"),this.description=u()(this.badge.description()),this.categories={},this.uncategorizedBadges=[],this.loading=!1,this.attrs.badge||(this.loading=!0,app.store.find("badges",{include:"category"}).then((function(t){t.forEach((function(t){if(t.category()){var e=t.category();a.categories[e.id()]?a.categories[e.id()].badges.push(t):a.categories[e.id()]={category:e,badges:[t]}}else a.uncategorizedBadges.push(t)})),a.loading=!1,m.redraw()})))},a.className=function(){return"Modal--small BadgeModal"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum."+(this.badge.exists?"update":"give")+"_badge")},a.content=function(){return m("div",null,m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray())),m("div",{className:"Modal-footer"},m(s.a,{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.userHasBadge},app.translator.trans("core.forum.composer_edit.submit_button"))))},a.fields=function(){var t=this,e=new d.a;return e.add("badge",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.badge"))),m("div",{className:"Select"},m("select",{value:this.selectedBadge?this.selectedBadge.id():"empty",disabled:!!this.attrs.badge,onchange:function(e){"empty"!==e.target.value&&(t.selectedBadge=app.store.getById("badges",e.target.value),t.checkUserHasBadge(t.selectedBadge))},className:"Select-input FormControl"},m("option",{value:"empty"},app.translator.trans("v17development-flarum-badges.forum.select_badge")),!this.attrs.badge&&Object.values(this.categories).map((function(t){var e=t.category,a=t.badges;return m("optgroup",{label:e.name()},a.map((function(t){return m("option",{value:t.id()},t.name())})))})),!this.attrs.badge&&this.uncategorizedBadges.length>=1&&m("optgroup",{label:app.translator.trans("v17development-flarum-badges.forum.uncategorized")},this.uncategorizedBadges.map((function(t){return m("option",{value:t.id()},t.name())}))),!!this.attrs.badge&&m("option",{value:this.selectedBadge.id()},this.selectedBadge.name())),m("i",{class:"icon fas fa-caret-down Select-caret"})),this.userHasBadge&&m("p",{className:"UserHasBadge"},app.translator.trans("v17development-flarum-badges.forum.user_has_badge"))),30),e.add("badge_description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.selectedBadge?this.selectedBadge.description():app.translator.trans("v17development-flarum-badges.forum.select_badge"))),30),e.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"))),m("textarea",{className:"FormControl",placeholder:app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),bidi:this.description})),30),e},a.checkUserHasBadge=function(t){var e=!1;this.user.userBadges().map((function(a){a.badge()==t&&(e=!0)})),this.userHasBadge=e,m.redraw()},a.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0,this.badge.save({description:this.description(),relationships:this.attrs.badge?{}:{badge:this.selectedBadge,user:this.user}}).then((function(){e.attrs.badge?app.modal.show(p.a,{badge:e.attrs.badge.badge(),userBadgeData:e.attrs.badge}):e.hide(),m.redraw()}),(function(t){e.loading=!1,e.handleErrors(t)}))},e}(r.a)},function(t,e,a){"use strict";a.d(e,"a",(function(){return l}));var n=a(1),o=a(0),r=a.n(o),i=a(6),s=a.n(i),l=(a(7),function(t){function e(){return t.apply(this,arguments)||this}return Object(n.a)(e,t),e.prototype.apiEndpoint=function(){return"/badges"+(this.exists?"/"+this.data.id:"")},e}(s()(r.a,{name:r.a.attribute("name"),icon:r.a.attribute("icon"),order:r.a.attribute("order"),image:r.a.attribute("image"),description:r.a.attribute("description"),isVisible:r.a.attribute("isVisible"),createdAt:r.a.attribute("createdAt"),earnedAmount:r.a.attribute("earnedAmount"),category:r.a.hasOne("category")})))},function(t,e){t.exports=flarum.core.compat["helpers/fullTime"]},function(t,e,a){"use strict";a.d(e,"a",(function(){return s}));var n=a(1),o=a(0),r=a.n(o),i=a(6),s=function(t){function e(){return t.apply(this,arguments)||this}return Object(n.a)(e,t),e.prototype.apiEndpoint=function(){return"/badge_categories"+(this.exists?"/"+this.data.id:"")},e}(a.n(i)()(r.a,{name:r.a.attribute("name"),order:r.a.attribute("order"),description:r.a.attribute("description"),isEnabled:r.a.attribute("isEnabled"),createdAt:r.a.attribute("createdAt"),users:r.a.hasMany("users"),badges:r.a.hasMany("badges")}))},function(t,e){t.exports=flarum.core.compat["components/LoadingIndicator"]},function(t,e){t.exports=flarum.core.compat["components/Switch"]},,,function(t,e){t.exports=flarum.core.compat.Component},function(t,e){t.exports=flarum.core.compat["components/Link"]},function(t,e){t.exports=flarum.core.compat["components/Select"]},,,,,,function(t,e){t.exports=flarum.core.compat["components/Dropdown"]},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e){t.exports=flarum.core.compat["components/ExtensionPage"]},function(t,e){t.exports=flarum.core.compat["utils/saveSettings"]},function(t,e,a){"use strict";a.r(e);var n=a(10),o=a(12),r=a(1),i=a(17),s=a.n(i),l=a(2),d=a.n(l),c=a(25),u=a.n(c),p=a(26),h=a.n(p),f=!1,g=!1,v=[];var b=function(t){function e(){return t.apply(this,arguments)||this}Object(r.a)(e,t);var a=e.prototype;return a.oninit=function(e){var a,n=this;t.prototype.oninit.call(this,e),this.loaded=!1,a=function(){return n.loaded=!0},g?a():f?v.push(a):(f=!0,app.store.find("badges").then((function(){g=!0,f=!1,a(),v.map((function(t){return t()})),m.redraw()})))},a.view=function(){var t=this;if(!this.loaded)return m("div",{className:"Form-group"},m("label",null,this.attrs.label),m(d.a,{className:"Button Button--danger",style:{float:"none"},loading:!0},app.translator.trans("v17development-flarum-badges.admin.auto_moderator.badge_selector.loading_badges")));var e=app.store.getById("badges",this.attrs.value),a=e?[h()(e.icon()),"\t",e.name()]:app.translator.trans("v17development-flarum-badges.admin.auto_moderator.badge_selector.placeholder");return m("div",{className:"Form-group"},m("label",null,this.attrs.label),this.attrs.disabled?m("div",{className:"Button Button--danger"},a):m(u.a,{label:a,disabled:this.attrs.disabled,buttonClassName:"Button Button--danger"},app.store.all("badges").map((function(a){return d.a.component({active:e&&e.id()===a.id(),disabled:e&&e.id()===a.id(),icon:a.icon(),onclick:function(){t.attrs.onchange(a.id())}},a.name())}))))},e}(s.a),y=function(t){function e(){return t.apply(this,arguments)||this}return Object(r.a)(e,t),e.prototype.view=function(){var t=this.attrs.settings;return m(b,{value:t().badge_id,onchange:function(e){return t({badge_id:e})}})},e}(s.a); +module.exports=function(t){var e={};function a(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)a.d(n,o,function(e){return t[e]}.bind(null,o));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=37)}([function(t,e,a){"use strict";function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}a.d(e,"a",(function(){return o}))},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["utils/Stream"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},function(t,e){t.exports=flarum.core.compat["common/Component"]},function(t,e){t.exports=flarum.core.compat["utils/ItemList"]},function(t,e){t.exports=flarum.core.compat["components/LoadingIndicator"]},function(t,e){t.exports=flarum.core.compat["components/LinkButton"]},function(t,e){t.exports=flarum.core.compat["utils/mixin"]},function(t,e,a){"use strict";a.d(e,"a",(function(){return f}));var n=a(0),o=a(4),r=a.n(o),i=a(2),s=a.n(i),l=a(17),d=a.n(l),c=a(6),u=a.n(c),p=a(8),h=a.n(p),g=a(11),f=function(t){function e(){return t.apply(this,arguments)||this}Object(n.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.loading=!1},a.className=function(){return"Modal--small"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum.badge_information")},a.content=function(){var t=this;return m("div",null,m("div",{className:"Modal-body"},this.data().toArray()),m("div",{className:"Modal-footer"},m(h.a,{href:app.route("badges.item",{id:this.attrs.badge.id()}),className:"Button",style:{margin:"0 10px"}},app.translator.trans("v17development-flarum-badges.forum.badge.badge_details")),this.attrs.userBadgeData&&app.forum.attribute("canGiveBadge")&&m(s.a,{className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge_confirm"))&&(t.loading=!0,t.attrs.userBadgeData.delete().then((function(){return t.hide()})))},loading:this.loading},app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge"))))},a.data=function(){var t=this,e=new u.a;return e.add("name",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.name"),":")),m("p",null,this.attrs.badge.name()))),e.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.attrs.badge.description()))),this.attrs.userBadgeData&&(this.attrs.userBadgeData.description()||app.forum.attribute("canGiveBadge"))&&e.add("earning_reason",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),":")),m("p",null,this.attrs.userBadgeData.description()?this.attrs.userBadgeData.description():m("i",null,app.translator.trans("v17development-flarum-badges.forum.badge.no_earning_reason"))),m("p",null,app.forum.attribute("canGiveBadge")&&m("a",{href:"#",onclick:function(e){e.preventDefault(),app.modal.show(g.a,{badge:t.attrs.userBadgeData})}},app.translator.trans("v17development-flarum-badges.forum.badge.update_earning_reason"))))),this.attrs.userBadgeData&&e.add("earned_date",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_on"),":")),m("p",null,d()(this.attrs.userBadgeData.assignedAt())))),this.attrs.userBadgeData&&e.add("category",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.category"),":")),m("p",null,this.attrs.badge.category()&&this.attrs.badge.category().name(),!this.attrs.badge.category()&&app.translator.trans("v17development-flarum-badges.forum.uncategorized")))),this.attrs.badge&&this.attrs.badge.earnedAmount()&&e.add("earned_amount",m("div",{className:"BadgeModalListItem"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:this.attrs.badge.earnedAmount()})))),e},e}(r.a)},function(t,e,a){"use strict";a.d(e,"a",(function(){return h}));var n=a(0),o=a(4),r=a.n(o),i=a(2),s=a.n(i),l=a(6),d=a.n(l),c=(a(23),a(3)),u=a.n(c),p=a(10),h=function(t){function e(){return t.apply(this,arguments)||this}Object(n.a)(e,t);var a=e.prototype;return a.oninit=function(e){var a=this;t.prototype.oninit.call(this,e),this.selectedBadge=this.attrs.badge?this.attrs.badge.badge():null,this.user=this.attrs.badge?this.attrs.badge.user():this.attrs.user,this.userHasBadge=!1,this.badge=this.attrs.badge?this.attrs.badge:app.store.createRecord("userBadges"),this.description=u()(this.badge.description()),this.categories={},this.uncategorizedBadges=[],this.loading=!1,this.attrs.badge||(this.loading=!0,app.store.find("badges",{include:"category"}).then((function(t){t.forEach((function(t){if(t.category()){var e=t.category();a.categories[e.id()]?a.categories[e.id()].badges.push(t):a.categories[e.id()]={category:e,badges:[t]}}else a.uncategorizedBadges.push(t)})),a.loading=!1,m.redraw()})))},a.className=function(){return"Modal--small BadgeModal"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum."+(this.badge.exists?"update":"give")+"_badge")},a.content=function(){return m("div",null,m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray())),m("div",{className:"Modal-footer"},m(s.a,{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.userHasBadge},app.translator.trans("core.forum.composer_edit.submit_button"))))},a.fields=function(){var t=this,e=new d.a;return e.add("badge",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.badge"))),m("div",{className:"Select"},m("select",{value:this.selectedBadge?this.selectedBadge.id():"empty",disabled:!!this.attrs.badge,onchange:function(e){"empty"!==e.target.value&&(t.selectedBadge=app.store.getById("badges",e.target.value),t.checkUserHasBadge(t.selectedBadge))},className:"Select-input FormControl"},m("option",{value:"empty"},app.translator.trans("v17development-flarum-badges.forum.select_badge")),!this.attrs.badge&&Object.values(this.categories).map((function(t){var e=t.category,a=t.badges;return m("optgroup",{label:e.name()},a.map((function(t){return m("option",{value:t.id()},t.name())})))})),!this.attrs.badge&&this.uncategorizedBadges.length>=1&&m("optgroup",{label:app.translator.trans("v17development-flarum-badges.forum.uncategorized")},this.uncategorizedBadges.map((function(t){return m("option",{value:t.id()},t.name())}))),!!this.attrs.badge&&m("option",{value:this.selectedBadge.id()},this.selectedBadge.name())),m("i",{class:"icon fas fa-caret-down Select-caret"})),this.userHasBadge&&m("p",{className:"UserHasBadge"},app.translator.trans("v17development-flarum-badges.forum.user_has_badge"))),30),e.add("badge_description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.selectedBadge?this.selectedBadge.description():app.translator.trans("v17development-flarum-badges.forum.select_badge"))),30),e.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"))),m("textarea",{className:"FormControl",placeholder:app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),bidi:this.description})),30),e},a.checkUserHasBadge=function(t){var e=!1;this.user.userBadges().map((function(a){a.badge()==t&&(e=!0)})),this.userHasBadge=e,m.redraw()},a.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0,this.badge.save({description:this.description(),relationships:this.attrs.badge?{}:{badge:this.selectedBadge,user:this.user}}).then((function(){e.attrs.badge?app.modal.show(p.a,{badge:e.attrs.badge.badge(),userBadgeData:e.attrs.badge}):e.hide(),m.redraw()}),(function(t){e.loading=!1,e.handleErrors(t)}))},e}(r.a)},,,function(t,e){t.exports=flarum.core.compat["components/Switch"]},,function(t,e,a){"use strict";a.d(e,"a",(function(){return l}));var n=a(0),o=a(1),r=a.n(o),i=a(9),s=a.n(i),l=(a(10),function(t){function e(){return t.apply(this,arguments)||this}return Object(n.a)(e,t),e.prototype.apiEndpoint=function(){return"/badges"+(this.exists?"/"+this.data.id:"")},e}(s()(r.a,{name:r.a.attribute("name"),icon:r.a.attribute("icon"),order:r.a.attribute("order"),image:r.a.attribute("image"),description:r.a.attribute("description"),isVisible:r.a.attribute("isVisible"),createdAt:r.a.attribute("createdAt"),earnedAmount:r.a.attribute("earnedAmount"),category:r.a.hasOne("category")})))},function(t,e){t.exports=flarum.core.compat["helpers/fullTime"]},function(t,e,a){"use strict";a.d(e,"a",(function(){return s}));var n=a(0),o=a(1),r=a.n(o),i=a(9),s=function(t){function e(){return t.apply(this,arguments)||this}return Object(n.a)(e,t),e.prototype.apiEndpoint=function(){return"/badge_categories"+(this.exists?"/"+this.data.id:"")},e}(a.n(i)()(r.a,{name:r.a.attribute("name"),order:r.a.attribute("order"),description:r.a.attribute("description"),isEnabled:r.a.attribute("isEnabled"),createdAt:r.a.attribute("createdAt"),isTable:r.a.attribute("isTable"),users:r.a.hasMany("users"),badges:r.a.hasMany("badges")}))},,,,function(t,e){t.exports=flarum.core.compat.Component},function(t,e){t.exports=flarum.core.compat["components/Select"]},,,,,,,,,function(t,e){t.exports=flarum.core.compat["components/Dropdown"]},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e){t.exports=flarum.core.compat["components/ExtensionPage"]},function(t,e){t.exports=flarum.core.compat["utils/saveSettings"]},,function(t,e,a){"use strict";a.r(e);var n=a(16),o=a(18),r=a(0),i=a(22),s=a.n(i),l=a(2),d=a.n(l),c=a(32),u=a.n(c),p=a(33),h=a.n(p),g=!1,f=!1,v=[];var b=function(t){function e(){return t.apply(this,arguments)||this}Object(r.a)(e,t);var a=e.prototype;return a.oninit=function(e){var a,n=this;t.prototype.oninit.call(this,e),this.loaded=!1,a=function(){return n.loaded=!0},f?a():g?v.push(a):(g=!0,app.store.find("badges").then((function(){f=!0,g=!1,a(),v.map((function(t){return t()})),m.redraw()})))},a.view=function(){var t=this;if(!this.loaded)return m("div",{className:"Form-group"},m("label",null,this.attrs.label),m(d.a,{className:"Button Button--danger",style:{float:"none"},loading:!0},app.translator.trans("v17development-flarum-badges.admin.auto_moderator.badge_selector.loading_badges")));var e=app.store.getById("badges",this.attrs.value),a=e?[h()(e.icon()),"\t",e.name()]:app.translator.trans("v17development-flarum-badges.admin.auto_moderator.badge_selector.placeholder");return m("div",{className:"Form-group"},m("label",null,this.attrs.label),this.attrs.disabled?m("div",{className:"Button Button--danger"},a):m(u.a,{label:a,disabled:this.attrs.disabled,buttonClassName:"Button Button--danger"},app.store.all("badges").map((function(a){return d.a.component({active:e&&e.id()===a.id(),disabled:e&&e.id()===a.id(),icon:a.icon(),onclick:function(){t.attrs.onchange(a.id())}},a.name())}))))},e}(s.a),y=function(t){function e(){return t.apply(this,arguments)||this}return Object(r.a)(e,t),e.prototype.view=function(){var t=this.attrs.settings;return m(b,{value:t().badge_id,onchange:function(e){return t({badge_id:e})}})},e}(s.a); /**! * Sortable 1.13.0 * @author RubaXa * @author owenm * @license MIT */ -function _(t){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function w(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function N(){return(N=Object.assign||function(t){for(var e=1;e=0||(o[a]=t[a]);return o}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(o[a]=t[a])}return o}function D(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var C=D(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),B=D(/Edge/i),x=D(/firefox/i),T=D(/safari/i)&&!D(/chrome/i)&&!D(/android/i),M=D(/iP(ad|od|hone)/i),O=D(/chrome/i)&&D(/android/i),I={capture:!1,passive:!1};function A(t,e,a){t.addEventListener(e,a,!C&&I)}function P(t,e,a){t.removeEventListener(e,a,!C&&I)}function k(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function F(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function R(t,e,a,n){if(t){a=a||document;do{if(null!=e&&(">"===e[0]?t.parentNode===a&&k(t,e):k(t,e))||n&&t===a)return t;if(t===a)break}while(t=F(t))}return null}var j,X=/\s+/g;function L(t,e,a){if(t&&e)if(t.classList)t.classList[a?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(X," ").replace(" "+e+" "," ");t.className=(n+(a?" "+e:"")).replace(X," ")}}function Y(t,e,a){var n=t&&t.style;if(n){if(void 0===a)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(a=t.currentStyle),void 0===e?a:a[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=a+("string"==typeof a?"":"px")}}function H(t,e){var a="";if("string"==typeof t)a=t;else do{var n=Y(t,"transform");n&&"none"!==n&&(a=n+" "+a)}while(!e&&(t=t.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(a)}function z(t,e,a){if(t){var n=t.getElementsByTagName(e),o=0,r=n.length;if(a)for(;o=r:o<=r))return n;if(n===W())break;n=Q(n,!1)}return!1}function G(t,e,a){for(var n=0,o=0,r=t.children;o2&&void 0!==arguments[2]?arguments[2]:{},n=a.evt,o=S(a,["evt"]);st.pluginEvent.bind(ee)(t,e,E({dragEl:ut,parentEl:pt,ghostEl:mt,rootEl:ht,nextEl:ft,lastDownEl:gt,cloneEl:vt,cloneHidden:bt,dragStarted:Ot,putSortable:St,activeSortable:ee.active,originalEvent:n,oldIndex:yt,oldDraggableIndex:wt,newIndex:_t,newDraggableIndex:Nt,hideGhostForTarget:Zt,unhideGhostForTarget:Qt,cloneNowHidden:function(){bt=!0},cloneNowShown:function(){bt=!1},dispatchSortableEvent:function(t){ct({sortable:e,name:t,originalEvent:n})}},o))};function ct(t){lt(E({putSortable:St,cloneEl:vt,targetEl:ut,rootEl:ht,oldIndex:yt,oldDraggableIndex:wt,newIndex:_t,newDraggableIndex:Nt},t))}var ut,pt,mt,ht,ft,gt,vt,bt,yt,_t,wt,Nt,Et,St,Dt,Ct,Bt,xt,Tt,Mt,Ot,It,At,Pt,kt,Ft=!1,Rt=!1,jt=[],Xt=!1,Lt=!1,Yt=[],Ht=!1,zt=[],Wt="undefined"!=typeof document,Ut=M,Vt=B||C?"cssFloat":"float",Gt=Wt&&!O&&!M&&"draggable"in document.createElement("div"),Kt=function(){if(Wt){if(C)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),$t=function(t,e){var a=Y(t),n=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),o=G(t,0,e),r=G(t,1,e),i=o&&Y(o),s=r&&Y(r),l=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+U(o).width,d=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+U(r).width;if("flex"===a.display)return"column"===a.flexDirection||"column-reverse"===a.flexDirection?"vertical":"horizontal";if("grid"===a.display)return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&i.float&&"none"!==i.float){var c="left"===i.float?"left":"right";return!r||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||l>=n&&"none"===a[Vt]||r&&"none"===a[Vt]&&l+d>n)?"vertical":"horizontal"},qt=function(t){function e(t,a){return function(n,o,r,i){var s=n.options.group.name&&o.options.group.name&&n.options.group.name===o.options.group.name;if(null==t&&(a||s))return!0;if(null==t||!1===t)return!1;if(a&&"clone"===t)return t;if("function"==typeof t)return e(t(n,o,r,i),a)(n,o,r,i);var l=(a?n:o).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var a={},n=t.group;n&&"object"==_(n)||(n={name:n}),a.name=n.name,a.checkPull=e(n.pull,!0),a.checkPut=e(n.put),a.revertClone=n.revertClone,t.group=a},Zt=function(){!Kt&&mt&&Y(mt,"display","none")},Qt=function(){!Kt&&mt&&Y(mt,"display","")};Wt&&document.addEventListener("click",(function(t){if(Rt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Rt=!1,!1}),!0);var Jt=function(t){if(ut){t=t.touches?t.touches[0]:t;var e=(o=t.clientX,r=t.clientY,jt.some((function(t){if(!K(t)){var e=U(t),a=t[nt].options.emptyInsertThreshold,n=o>=e.left-a&&o<=e.right+a,s=r>=e.top-a&&r<=e.bottom+a;return a&&n&&s?i=t:void 0}})),i);if(e){var a={};for(var n in t)t.hasOwnProperty(n)&&(a[n]=t[n]);a.target=a.rootEl=e,a.preventDefault=void 0,a.stopPropagation=void 0,e[nt]._onDragOver(a)}}var o,r,i},te=function(t){ut&&ut.parentNode[nt]._isOutsideThisEl(t.target)};function ee(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=N({},e),t[nt]=this;var a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return $t(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==ee.supportPointer&&"PointerEvent"in window&&!T,emptyInsertThreshold:5};for(var n in st.initializePlugins(this,t,a),a)!(n in e)&&(e[n]=a[n]);for(var o in qt(e),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!e.forceFallback&&Gt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?A(t,"pointerdown",this._onTapStart):(A(t,"mousedown",this._onTapStart),A(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(A(t,"dragover",this),A(t,"dragenter",this)),jt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),N(this,ot())}function ae(t,e,a,n,o,r,i,s){var l,d,c=t[nt],u=c.options.onMove;return!window.CustomEvent||C||B?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=a,l.draggedRect=n,l.related=o||e,l.relatedRect=r||U(e),l.willInsertAfter=s,l.originalEvent=i,t.dispatchEvent(l),u&&(d=u.call(c,l,i)),d}function ne(t){t.draggable=!1}function oe(){Ht=!1}function re(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,a=e.length,n=0;a--;)n+=e.charCodeAt(a);return n.toString(36)}function ie(t){return setTimeout(t,0)}function se(t){return clearTimeout(t)}ee.prototype={constructor:ee,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(It=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,ut):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,a=this.el,n=this.options,o=n.preventOnFilter,r=t.type,i=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,s=(i||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,d=n.filter;if(function(t){zt.length=0;var e=t.getElementsByTagName("input"),a=e.length;for(;a--;){var n=e[a];n.checked&&zt.push(n)}}(a),!ut&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||n.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!T||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=R(s,n.draggable,a,!1))&&s.animated||gt===s)){if(yt=q(s),wt=q(s,n.draggable),"function"==typeof d){if(d.call(this,t,s,this))return ct({sortable:e,rootEl:l,name:"filter",targetEl:s,toEl:a,fromEl:a}),dt("filter",e,{evt:t}),void(o&&t.cancelable&&t.preventDefault())}else if(d&&(d=d.split(",").some((function(n){if(n=R(l,n.trim(),a,!1))return ct({sortable:e,rootEl:n,name:"filter",targetEl:s,fromEl:a,toEl:a}),dt("filter",e,{evt:t}),!0}))))return void(o&&t.cancelable&&t.preventDefault());n.handle&&!R(l,n.handle,a,!1)||this._prepareDragStart(t,i,s)}}},_prepareDragStart:function(t,e,a){var n,o=this,r=o.el,i=o.options,s=r.ownerDocument;if(a&&!ut&&a.parentNode===r){var l=U(a);if(ht=r,pt=(ut=a).parentNode,ft=ut.nextSibling,gt=a,Et=i.group,ee.dragged=ut,Dt={target:ut,clientX:(e||t).clientX,clientY:(e||t).clientY},Tt=Dt.clientX-l.left,Mt=Dt.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,ut.style["will-change"]="all",n=function(){dt("delayEnded",o,{evt:t}),ee.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!x&&o.nativeDraggable&&(ut.draggable=!0),o._triggerDragStart(t,e),ct({sortable:o,name:"choose",originalEvent:t}),L(ut,i.chosenClass,!0))},i.ignore.split(",").forEach((function(t){z(ut,t.trim(),ne)})),A(s,"dragover",Jt),A(s,"mousemove",Jt),A(s,"touchmove",Jt),A(s,"mouseup",o._onDrop),A(s,"touchend",o._onDrop),A(s,"touchcancel",o._onDrop),x&&this.nativeDraggable&&(this.options.touchStartThreshold=4,ut.draggable=!0),dt("delayStart",this,{evt:t}),!i.delay||i.delayOnTouchOnly&&!e||this.nativeDraggable&&(B||C))n();else{if(ee.eventCanceled)return void this._onDrop();A(s,"mouseup",o._disableDelayedDrag),A(s,"touchend",o._disableDelayedDrag),A(s,"touchcancel",o._disableDelayedDrag),A(s,"mousemove",o._delayedDragTouchMoveHandler),A(s,"touchmove",o._delayedDragTouchMoveHandler),i.supportPointer&&A(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(n,i.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){ut&&ne(ut),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;P(t,"mouseup",this._disableDelayedDrag),P(t,"touchend",this._disableDelayedDrag),P(t,"touchcancel",this._disableDelayedDrag),P(t,"mousemove",this._delayedDragTouchMoveHandler),P(t,"touchmove",this._delayedDragTouchMoveHandler),P(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?A(document,"pointermove",this._onTouchMove):A(document,e?"touchmove":"mousemove",this._onTouchMove):(A(ut,"dragend",this),A(ht,"dragstart",this._onDragStart));try{document.selection?ie((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(Ft=!1,ht&&ut){dt("dragStarted",this,{evt:e}),this.nativeDraggable&&A(document,"dragover",te);var a=this.options;!t&&L(ut,a.dragClass,!1),L(ut,a.ghostClass,!0),ee.active=this,t&&this._appendGhost(),ct({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Ct){this._lastX=Ct.clientX,this._lastY=Ct.clientY,Zt();for(var t=document.elementFromPoint(Ct.clientX,Ct.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ct.clientX,Ct.clientY))!==e;)e=t;if(ut.parentNode[nt]._isOutsideThisEl(t),e)do{if(e[nt]){if(e[nt]._onDragOver({clientX:Ct.clientX,clientY:Ct.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Qt()}},_onTouchMove:function(t){if(Dt){var e=this.options,a=e.fallbackTolerance,n=e.fallbackOffset,o=t.touches?t.touches[0]:t,r=mt&&H(mt,!0),i=mt&&r&&r.a,s=mt&&r&&r.d,l=Ut&&kt&&Z(kt),d=(o.clientX-Dt.clientX+n.x)/(i||1)+(l?l[0]-Yt[0]:0)/(i||1),c=(o.clientY-Dt.clientY+n.y)/(s||1)+(l?l[1]-Yt[1]:0)/(s||1);if(!ee.active&&!Ft){if(a&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))n.right+10||t.clientX<=n.right&&t.clientY>n.bottom&&t.clientX>=n.left:t.clientX>n.right&&t.clientY>n.top||t.clientX<=n.right&&t.clientY>n.bottom+10}(t,o,this)&&!f.animated){if(f===ut)return O(!1);if(f&&r===t.target&&(i=f),i&&(a=U(i)),!1!==ae(ht,r,ut,e,i,a,t,!!i))return M(),r.appendChild(ut),pt=r,I(),O(!0)}else if(i.parentNode===r){a=U(i);var g,v,b,y=ut.parentNode!==r,_=!function(t,e,a){var n=a?t.left:t.top,o=a?t.right:t.bottom,r=a?t.width:t.height,i=a?e.left:e.top,s=a?e.right:e.bottom,l=a?e.width:e.height;return n===i||o===s||n+r/2===i+l/2}(ut.animated&&ut.toRect||e,i.animated&&i.toRect||a,o),w=o?"top":"left",N=V(i,"top","top")||V(ut,"top","top"),S=N?N.scrollTop:void 0;if(It!==i&&(v=a[w],Xt=!1,Lt=!_&&s.invertSwap||y),0!==(g=function(t,e,a,n,o,r,i,s){var l=n?t.clientY:t.clientX,d=n?a.height:a.width,c=n?a.top:a.left,u=n?a.bottom:a.right,p=!1;if(!i)if(s&&Ptc+d*r/2:lu-Pt)return-At}else if(l>c+d*(1-o)/2&&lu-d*r/2))return l>c+d/2?1:-1;return 0}(t,i,a,o,_?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Lt,It===i))){var D=q(ut);do{D-=g,b=pt.children[D]}while(b&&("none"===Y(b,"display")||b===mt))}if(0===g||b===i)return O(!1);It=i,At=g;var C=i.nextElementSibling,B=!1,x=ae(ht,r,ut,e,i,a,t,B=1===g);if(!1!==x)return 1!==x&&-1!==x||(B=1===x),Ht=!0,setTimeout(oe,30),M(),B&&!C?r.appendChild(ut):i.parentNode.insertBefore(ut,B?C:i),N&&et(N,0,S-N.scrollTop),pt=ut.parentNode,void 0===v||Lt||(Pt=Math.abs(v-U(i)[w])),I(),O(!0)}if(r.contains(ut))return O(!1)}return!1}function T(s,l){dt(s,m,E({evt:t,isOwner:c,axis:o?"vertical":"horizontal",revert:n,dragRect:e,targetRect:a,canSort:u,fromSortable:p,target:i,completed:O,onMove:function(a,n){return ae(ht,r,ut,e,a,U(a),t,n)},changed:I},l))}function M(){T("dragOverAnimationCapture"),m.captureAnimationState(),m!==p&&p.captureAnimationState()}function O(e){return T("dragOverCompleted",{insertion:e}),e&&(c?d._hideClone():d._showClone(m),m!==p&&(L(ut,St?St.options.ghostClass:d.options.ghostClass,!1),L(ut,s.ghostClass,!0)),St!==m&&m!==ee.active?St=m:m===ee.active&&St&&(St=null),p===m&&(m._ignoreWhileAnimating=i),m.animateAll((function(){T("dragOverAnimationComplete"),m._ignoreWhileAnimating=null})),m!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(i===ut&&!ut.animated||i===r&&!i.animated)&&(It=null),s.dragoverBubble||t.rootEl||i===document||(ut.parentNode[nt]._isOutsideThisEl(t.target),!e&&Jt(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),h=!0}function I(){_t=q(ut),Nt=q(ut,s.draggable),ct({sortable:m,name:"change",toEl:r,newIndex:_t,newDraggableIndex:Nt,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){P(document,"mousemove",this._onTouchMove),P(document,"touchmove",this._onTouchMove),P(document,"pointermove",this._onTouchMove),P(document,"dragover",Jt),P(document,"mousemove",Jt),P(document,"touchmove",Jt)},_offUpEvents:function(){var t=this.el.ownerDocument;P(t,"mouseup",this._onDrop),P(t,"touchend",this._onDrop),P(t,"pointerup",this._onDrop),P(t,"touchcancel",this._onDrop),P(document,"selectstart",this)},_onDrop:function(t){var e=this.el,a=this.options;_t=q(ut),Nt=q(ut,a.draggable),dt("drop",this,{evt:t}),pt=ut&&ut.parentNode,_t=q(ut),Nt=q(ut,a.draggable),ee.eventCanceled||(Ft=!1,Lt=!1,Xt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),se(this.cloneId),se(this._dragStartId),this.nativeDraggable&&(P(document,"drop",this),P(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),T&&Y(document.body,"user-select",""),Y(ut,"transform",""),t&&(Ot&&(t.cancelable&&t.preventDefault(),!a.dropBubble&&t.stopPropagation()),mt&&mt.parentNode&&mt.parentNode.removeChild(mt),(ht===pt||St&&"clone"!==St.lastPutMode)&&vt&&vt.parentNode&&vt.parentNode.removeChild(vt),ut&&(this.nativeDraggable&&P(ut,"dragend",this),ne(ut),ut.style["will-change"]="",Ot&&!Ft&&L(ut,St?St.options.ghostClass:this.options.ghostClass,!1),L(ut,this.options.chosenClass,!1),ct({sortable:this,name:"unchoose",toEl:pt,newIndex:null,newDraggableIndex:null,originalEvent:t}),ht!==pt?(_t>=0&&(ct({rootEl:pt,name:"add",toEl:pt,fromEl:ht,originalEvent:t}),ct({sortable:this,name:"remove",toEl:pt,originalEvent:t}),ct({rootEl:pt,name:"sort",toEl:pt,fromEl:ht,originalEvent:t}),ct({sortable:this,name:"sort",toEl:pt,originalEvent:t})),St&&St.save()):_t!==yt&&_t>=0&&(ct({sortable:this,name:"update",toEl:pt,originalEvent:t}),ct({sortable:this,name:"sort",toEl:pt,originalEvent:t})),ee.active&&(null!=_t&&-1!==_t||(_t=yt,Nt=wt),ct({sortable:this,name:"end",toEl:pt,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){dt("nulling",this),ht=ut=pt=mt=ft=vt=gt=bt=Dt=Ct=Ot=_t=Nt=yt=wt=It=At=St=Et=ee.dragged=ee.ghost=ee.clone=ee.active=null,zt.forEach((function(t){t.checked=!0})),zt.length=Bt=xt=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":ut&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],a=this.el.children,n=0,o=a.length,r=this.options;n=0||(o[a]=t[a]);return o}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(o[a]=t[a])}return o}function D(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var C=D(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),B=D(/Edge/i),x=D(/firefox/i),T=D(/safari/i)&&!D(/chrome/i)&&!D(/android/i),M=D(/iP(ad|od|hone)/i),O=D(/chrome/i)&&D(/android/i),I={capture:!1,passive:!1};function k(t,e,a){t.addEventListener(e,a,!C&&I)}function A(t,e,a){t.removeEventListener(e,a,!C&&I)}function P(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function F(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function R(t,e,a,n){if(t){a=a||document;do{if(null!=e&&(">"===e[0]?t.parentNode===a&&P(t,e):P(t,e))||n&&t===a)return t;if(t===a)break}while(t=F(t))}return null}var j,X=/\s+/g;function L(t,e,a){if(t&&e)if(t.classList)t.classList[a?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(X," ").replace(" "+e+" "," ");t.className=(n+(a?" "+e:"")).replace(X," ")}}function Y(t,e,a){var n=t&&t.style;if(n){if(void 0===a)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(a=t.currentStyle),void 0===e?a:a[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=a+("string"==typeof a?"":"px")}}function H(t,e){var a="";if("string"==typeof t)a=t;else do{var n=Y(t,"transform");n&&"none"!==n&&(a=n+" "+a)}while(!e&&(t=t.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(a)}function z(t,e,a){if(t){var n=t.getElementsByTagName(e),o=0,r=n.length;if(a)for(;o=r:o<=r))return n;if(n===W())break;n=Q(n,!1)}return!1}function G(t,e,a){for(var n=0,o=0,r=t.children;o2&&void 0!==arguments[2]?arguments[2]:{},n=a.evt,o=S(a,["evt"]);st.pluginEvent.bind(ee)(t,e,E({dragEl:ut,parentEl:pt,ghostEl:mt,rootEl:ht,nextEl:gt,lastDownEl:ft,cloneEl:vt,cloneHidden:bt,dragStarted:Ot,putSortable:St,activeSortable:ee.active,originalEvent:n,oldIndex:yt,oldDraggableIndex:wt,newIndex:_t,newDraggableIndex:Nt,hideGhostForTarget:Zt,unhideGhostForTarget:Qt,cloneNowHidden:function(){bt=!0},cloneNowShown:function(){bt=!1},dispatchSortableEvent:function(t){ct({sortable:e,name:t,originalEvent:n})}},o))};function ct(t){lt(E({putSortable:St,cloneEl:vt,targetEl:ut,rootEl:ht,oldIndex:yt,oldDraggableIndex:wt,newIndex:_t,newDraggableIndex:Nt},t))}var ut,pt,mt,ht,gt,ft,vt,bt,yt,_t,wt,Nt,Et,St,Dt,Ct,Bt,xt,Tt,Mt,Ot,It,kt,At,Pt,Ft=!1,Rt=!1,jt=[],Xt=!1,Lt=!1,Yt=[],Ht=!1,zt=[],Wt="undefined"!=typeof document,Ut=M,Vt=B||C?"cssFloat":"float",Gt=Wt&&!O&&!M&&"draggable"in document.createElement("div"),Kt=function(){if(Wt){if(C)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),$t=function(t,e){var a=Y(t),n=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),o=G(t,0,e),r=G(t,1,e),i=o&&Y(o),s=r&&Y(r),l=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+U(o).width,d=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+U(r).width;if("flex"===a.display)return"column"===a.flexDirection||"column-reverse"===a.flexDirection?"vertical":"horizontal";if("grid"===a.display)return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&i.float&&"none"!==i.float){var c="left"===i.float?"left":"right";return!r||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||l>=n&&"none"===a[Vt]||r&&"none"===a[Vt]&&l+d>n)?"vertical":"horizontal"},qt=function(t){function e(t,a){return function(n,o,r,i){var s=n.options.group.name&&o.options.group.name&&n.options.group.name===o.options.group.name;if(null==t&&(a||s))return!0;if(null==t||!1===t)return!1;if(a&&"clone"===t)return t;if("function"==typeof t)return e(t(n,o,r,i),a)(n,o,r,i);var l=(a?n:o).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var a={},n=t.group;n&&"object"==_(n)||(n={name:n}),a.name=n.name,a.checkPull=e(n.pull,!0),a.checkPut=e(n.put),a.revertClone=n.revertClone,t.group=a},Zt=function(){!Kt&&mt&&Y(mt,"display","none")},Qt=function(){!Kt&&mt&&Y(mt,"display","")};Wt&&document.addEventListener("click",(function(t){if(Rt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Rt=!1,!1}),!0);var Jt=function(t){if(ut){t=t.touches?t.touches[0]:t;var e=(o=t.clientX,r=t.clientY,jt.some((function(t){if(!K(t)){var e=U(t),a=t[nt].options.emptyInsertThreshold,n=o>=e.left-a&&o<=e.right+a,s=r>=e.top-a&&r<=e.bottom+a;return a&&n&&s?i=t:void 0}})),i);if(e){var a={};for(var n in t)t.hasOwnProperty(n)&&(a[n]=t[n]);a.target=a.rootEl=e,a.preventDefault=void 0,a.stopPropagation=void 0,e[nt]._onDragOver(a)}}var o,r,i},te=function(t){ut&&ut.parentNode[nt]._isOutsideThisEl(t.target)};function ee(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=N({},e),t[nt]=this;var a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return $t(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==ee.supportPointer&&"PointerEvent"in window&&!T,emptyInsertThreshold:5};for(var n in st.initializePlugins(this,t,a),a)!(n in e)&&(e[n]=a[n]);for(var o in qt(e),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!e.forceFallback&&Gt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?k(t,"pointerdown",this._onTapStart):(k(t,"mousedown",this._onTapStart),k(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(k(t,"dragover",this),k(t,"dragenter",this)),jt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),N(this,ot())}function ae(t,e,a,n,o,r,i,s){var l,d,c=t[nt],u=c.options.onMove;return!window.CustomEvent||C||B?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=a,l.draggedRect=n,l.related=o||e,l.relatedRect=r||U(e),l.willInsertAfter=s,l.originalEvent=i,t.dispatchEvent(l),u&&(d=u.call(c,l,i)),d}function ne(t){t.draggable=!1}function oe(){Ht=!1}function re(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,a=e.length,n=0;a--;)n+=e.charCodeAt(a);return n.toString(36)}function ie(t){return setTimeout(t,0)}function se(t){return clearTimeout(t)}ee.prototype={constructor:ee,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(It=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,ut):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,a=this.el,n=this.options,o=n.preventOnFilter,r=t.type,i=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,s=(i||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,d=n.filter;if(function(t){zt.length=0;var e=t.getElementsByTagName("input"),a=e.length;for(;a--;){var n=e[a];n.checked&&zt.push(n)}}(a),!ut&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||n.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!T||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=R(s,n.draggable,a,!1))&&s.animated||ft===s)){if(yt=q(s),wt=q(s,n.draggable),"function"==typeof d){if(d.call(this,t,s,this))return ct({sortable:e,rootEl:l,name:"filter",targetEl:s,toEl:a,fromEl:a}),dt("filter",e,{evt:t}),void(o&&t.cancelable&&t.preventDefault())}else if(d&&(d=d.split(",").some((function(n){if(n=R(l,n.trim(),a,!1))return ct({sortable:e,rootEl:n,name:"filter",targetEl:s,fromEl:a,toEl:a}),dt("filter",e,{evt:t}),!0}))))return void(o&&t.cancelable&&t.preventDefault());n.handle&&!R(l,n.handle,a,!1)||this._prepareDragStart(t,i,s)}}},_prepareDragStart:function(t,e,a){var n,o=this,r=o.el,i=o.options,s=r.ownerDocument;if(a&&!ut&&a.parentNode===r){var l=U(a);if(ht=r,pt=(ut=a).parentNode,gt=ut.nextSibling,ft=a,Et=i.group,ee.dragged=ut,Dt={target:ut,clientX:(e||t).clientX,clientY:(e||t).clientY},Tt=Dt.clientX-l.left,Mt=Dt.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,ut.style["will-change"]="all",n=function(){dt("delayEnded",o,{evt:t}),ee.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!x&&o.nativeDraggable&&(ut.draggable=!0),o._triggerDragStart(t,e),ct({sortable:o,name:"choose",originalEvent:t}),L(ut,i.chosenClass,!0))},i.ignore.split(",").forEach((function(t){z(ut,t.trim(),ne)})),k(s,"dragover",Jt),k(s,"mousemove",Jt),k(s,"touchmove",Jt),k(s,"mouseup",o._onDrop),k(s,"touchend",o._onDrop),k(s,"touchcancel",o._onDrop),x&&this.nativeDraggable&&(this.options.touchStartThreshold=4,ut.draggable=!0),dt("delayStart",this,{evt:t}),!i.delay||i.delayOnTouchOnly&&!e||this.nativeDraggable&&(B||C))n();else{if(ee.eventCanceled)return void this._onDrop();k(s,"mouseup",o._disableDelayedDrag),k(s,"touchend",o._disableDelayedDrag),k(s,"touchcancel",o._disableDelayedDrag),k(s,"mousemove",o._delayedDragTouchMoveHandler),k(s,"touchmove",o._delayedDragTouchMoveHandler),i.supportPointer&&k(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(n,i.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){ut&&ne(ut),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;A(t,"mouseup",this._disableDelayedDrag),A(t,"touchend",this._disableDelayedDrag),A(t,"touchcancel",this._disableDelayedDrag),A(t,"mousemove",this._delayedDragTouchMoveHandler),A(t,"touchmove",this._delayedDragTouchMoveHandler),A(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?k(document,"pointermove",this._onTouchMove):k(document,e?"touchmove":"mousemove",this._onTouchMove):(k(ut,"dragend",this),k(ht,"dragstart",this._onDragStart));try{document.selection?ie((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(Ft=!1,ht&&ut){dt("dragStarted",this,{evt:e}),this.nativeDraggable&&k(document,"dragover",te);var a=this.options;!t&&L(ut,a.dragClass,!1),L(ut,a.ghostClass,!0),ee.active=this,t&&this._appendGhost(),ct({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Ct){this._lastX=Ct.clientX,this._lastY=Ct.clientY,Zt();for(var t=document.elementFromPoint(Ct.clientX,Ct.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ct.clientX,Ct.clientY))!==e;)e=t;if(ut.parentNode[nt]._isOutsideThisEl(t),e)do{if(e[nt]){if(e[nt]._onDragOver({clientX:Ct.clientX,clientY:Ct.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Qt()}},_onTouchMove:function(t){if(Dt){var e=this.options,a=e.fallbackTolerance,n=e.fallbackOffset,o=t.touches?t.touches[0]:t,r=mt&&H(mt,!0),i=mt&&r&&r.a,s=mt&&r&&r.d,l=Ut&&Pt&&Z(Pt),d=(o.clientX-Dt.clientX+n.x)/(i||1)+(l?l[0]-Yt[0]:0)/(i||1),c=(o.clientY-Dt.clientY+n.y)/(s||1)+(l?l[1]-Yt[1]:0)/(s||1);if(!ee.active&&!Ft){if(a&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))n.right+10||t.clientX<=n.right&&t.clientY>n.bottom&&t.clientX>=n.left:t.clientX>n.right&&t.clientY>n.top||t.clientX<=n.right&&t.clientY>n.bottom+10}(t,o,this)&&!g.animated){if(g===ut)return O(!1);if(g&&r===t.target&&(i=g),i&&(a=U(i)),!1!==ae(ht,r,ut,e,i,a,t,!!i))return M(),r.appendChild(ut),pt=r,I(),O(!0)}else if(i.parentNode===r){a=U(i);var f,v,b,y=ut.parentNode!==r,_=!function(t,e,a){var n=a?t.left:t.top,o=a?t.right:t.bottom,r=a?t.width:t.height,i=a?e.left:e.top,s=a?e.right:e.bottom,l=a?e.width:e.height;return n===i||o===s||n+r/2===i+l/2}(ut.animated&&ut.toRect||e,i.animated&&i.toRect||a,o),w=o?"top":"left",N=V(i,"top","top")||V(ut,"top","top"),S=N?N.scrollTop:void 0;if(It!==i&&(v=a[w],Xt=!1,Lt=!_&&s.invertSwap||y),0!==(f=function(t,e,a,n,o,r,i,s){var l=n?t.clientY:t.clientX,d=n?a.height:a.width,c=n?a.top:a.left,u=n?a.bottom:a.right,p=!1;if(!i)if(s&&Atc+d*r/2:lu-At)return-kt}else if(l>c+d*(1-o)/2&&lu-d*r/2))return l>c+d/2?1:-1;return 0}(t,i,a,o,_?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Lt,It===i))){var D=q(ut);do{D-=f,b=pt.children[D]}while(b&&("none"===Y(b,"display")||b===mt))}if(0===f||b===i)return O(!1);It=i,kt=f;var C=i.nextElementSibling,B=!1,x=ae(ht,r,ut,e,i,a,t,B=1===f);if(!1!==x)return 1!==x&&-1!==x||(B=1===x),Ht=!0,setTimeout(oe,30),M(),B&&!C?r.appendChild(ut):i.parentNode.insertBefore(ut,B?C:i),N&&et(N,0,S-N.scrollTop),pt=ut.parentNode,void 0===v||Lt||(At=Math.abs(v-U(i)[w])),I(),O(!0)}if(r.contains(ut))return O(!1)}return!1}function T(s,l){dt(s,m,E({evt:t,isOwner:c,axis:o?"vertical":"horizontal",revert:n,dragRect:e,targetRect:a,canSort:u,fromSortable:p,target:i,completed:O,onMove:function(a,n){return ae(ht,r,ut,e,a,U(a),t,n)},changed:I},l))}function M(){T("dragOverAnimationCapture"),m.captureAnimationState(),m!==p&&p.captureAnimationState()}function O(e){return T("dragOverCompleted",{insertion:e}),e&&(c?d._hideClone():d._showClone(m),m!==p&&(L(ut,St?St.options.ghostClass:d.options.ghostClass,!1),L(ut,s.ghostClass,!0)),St!==m&&m!==ee.active?St=m:m===ee.active&&St&&(St=null),p===m&&(m._ignoreWhileAnimating=i),m.animateAll((function(){T("dragOverAnimationComplete"),m._ignoreWhileAnimating=null})),m!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(i===ut&&!ut.animated||i===r&&!i.animated)&&(It=null),s.dragoverBubble||t.rootEl||i===document||(ut.parentNode[nt]._isOutsideThisEl(t.target),!e&&Jt(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),h=!0}function I(){_t=q(ut),Nt=q(ut,s.draggable),ct({sortable:m,name:"change",toEl:r,newIndex:_t,newDraggableIndex:Nt,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){A(document,"mousemove",this._onTouchMove),A(document,"touchmove",this._onTouchMove),A(document,"pointermove",this._onTouchMove),A(document,"dragover",Jt),A(document,"mousemove",Jt),A(document,"touchmove",Jt)},_offUpEvents:function(){var t=this.el.ownerDocument;A(t,"mouseup",this._onDrop),A(t,"touchend",this._onDrop),A(t,"pointerup",this._onDrop),A(t,"touchcancel",this._onDrop),A(document,"selectstart",this)},_onDrop:function(t){var e=this.el,a=this.options;_t=q(ut),Nt=q(ut,a.draggable),dt("drop",this,{evt:t}),pt=ut&&ut.parentNode,_t=q(ut),Nt=q(ut,a.draggable),ee.eventCanceled||(Ft=!1,Lt=!1,Xt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),se(this.cloneId),se(this._dragStartId),this.nativeDraggable&&(A(document,"drop",this),A(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),T&&Y(document.body,"user-select",""),Y(ut,"transform",""),t&&(Ot&&(t.cancelable&&t.preventDefault(),!a.dropBubble&&t.stopPropagation()),mt&&mt.parentNode&&mt.parentNode.removeChild(mt),(ht===pt||St&&"clone"!==St.lastPutMode)&&vt&&vt.parentNode&&vt.parentNode.removeChild(vt),ut&&(this.nativeDraggable&&A(ut,"dragend",this),ne(ut),ut.style["will-change"]="",Ot&&!Ft&&L(ut,St?St.options.ghostClass:this.options.ghostClass,!1),L(ut,this.options.chosenClass,!1),ct({sortable:this,name:"unchoose",toEl:pt,newIndex:null,newDraggableIndex:null,originalEvent:t}),ht!==pt?(_t>=0&&(ct({rootEl:pt,name:"add",toEl:pt,fromEl:ht,originalEvent:t}),ct({sortable:this,name:"remove",toEl:pt,originalEvent:t}),ct({rootEl:pt,name:"sort",toEl:pt,fromEl:ht,originalEvent:t}),ct({sortable:this,name:"sort",toEl:pt,originalEvent:t})),St&&St.save()):_t!==yt&&_t>=0&&(ct({sortable:this,name:"update",toEl:pt,originalEvent:t}),ct({sortable:this,name:"sort",toEl:pt,originalEvent:t})),ee.active&&(null!=_t&&-1!==_t||(_t=yt,Nt=wt),ct({sortable:this,name:"end",toEl:pt,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){dt("nulling",this),ht=ut=pt=mt=gt=vt=ft=bt=Dt=Ct=Ot=_t=Nt=yt=wt=It=kt=St=Et=ee.dragged=ee.ghost=ee.clone=ee.active=null,zt.forEach((function(t){t.checked=!0})),zt.length=Bt=xt=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":ut&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],a=this.el.children,n=0,o=a.length,r=this.options;n\n
{this.data().toArray()}
\n {this.attrs.userBadgeData && app.forum.attribute(\"canGiveBadge\") && (\n
\n {\n if (\n confirm(\n app.translator.trans(\n \"v17development-flarum-badges.forum.moderation.remove_badge_confirm\"\n )\n )\n ) {\n this.loading = true;\n this.attrs.userBadgeData.delete().then(() => this.hide());\n }\n }}\n loading={this.loading}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.moderation.remove_badge\"\n )}\n \n
\n )}\n \n );\n }\n\n data() {\n const items = new ItemList();\n\n // Badge name\n items.add(\n \"name\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.name\"\n )}\n :\n \n

\n

{this.attrs.badge.name()}

\n
\n );\n\n // Badge description\n items.add(\n \"description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.description\"\n )}\n :\n \n

\n

{this.attrs.badge.description()}

\n
\n );\n\n // Badge earning reason\n if (\n this.attrs.userBadgeData &&\n (this.attrs.userBadgeData.description() ||\n app.forum.attribute(\"canGiveBadge\"))\n ) {\n items.add(\n \"earning_reason\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earning_reason\"\n )}\n :\n \n

\n\n

\n {this.attrs.userBadgeData.description() ? (\n this.attrs.userBadgeData.description()\n ) : (\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.no_earning_reason\"\n )}\n \n )}\n

\n

\n {app.forum.attribute(\"canGiveBadge\") && (\n {\n e.preventDefault();\n app.modal.show(GiveBadgeModal, {\n badge: this.attrs.userBadgeData,\n });\n }}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.update_earning_reason\"\n )}\n \n )}\n

\n
\n );\n }\n\n // Badge earned on\n if (this.attrs.userBadgeData) {\n items.add(\n \"earned_date\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_on\"\n )}\n :\n \n

\n

{fullTime(this.attrs.userBadgeData.assignedAt())}

\n
\n );\n }\n\n // Badge category\n if (this.attrs.userBadgeData) {\n items.add(\n \"category\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.category\"\n )}\n :\n \n

\n

\n {this.attrs.badge.category() && this.attrs.badge.category().name()}\n\n {/* Uncategorized */}\n {!this.attrs.badge.category() &&\n app.translator.trans(\n \"v17development-flarum-badges.forum.uncategorized\"\n )}\n {/* \n {app.translator.trans(\n \"v17development-flarum-badges.forum.all_badges\"\n )}\n */}\n

\n
\n );\n }\n\n // Badge category\n if (this.attrs.badge && this.attrs.badge.earnedAmount()) {\n items.add(\n \"earned_amount\",\n
\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_count\",\n {\n count: this.attrs.badge.earnedAmount(),\n }\n )}\n

\n
\n );\n }\n\n return items;\n }\n}\n","module.exports = flarum.core.compat['common/Component'];","import Modal from \"flarum/components/Modal\";\nimport Button from \"flarum/components/Button\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Select from \"flarum/components/Select\";\nimport Stream from \"flarum/utils/Stream\";\nimport BadgeModal from \"./BadgeModal\";\n\nexport default class GiveBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Select image\n this.selectedBadge = this.attrs.badge ? this.attrs.badge.badge() : null;\n\n // Current user\n this.user = this.attrs.badge ? this.attrs.badge.user() : this.attrs.user;\n\n // User has badge\n this.userHasBadge = false;\n\n // Badge model\n this.badge = this.attrs.badge\n ? this.attrs.badge\n : app.store.createRecord(\"userBadges\");\n\n // Earning reason\n this.description = Stream(this.badge.description());\n\n // List of available bagges\n this.categories = {};\n\n this.uncategorizedBadges = [];\n\n this.loading = false;\n\n // Load all available badges\n if (!this.attrs.badge) {\n this.loading = true;\n\n app.store\n .find(\"badges\", {\n include: \"category\",\n })\n .then((badges) => {\n badges.forEach((badge) => {\n // Categorized\n if (badge.category()) {\n const category = badge.category();\n\n if (!this.categories[category.id()]) {\n this.categories[category.id()] = {\n category,\n badges: [badge],\n };\n } else {\n this.categories[category.id()].badges.push(badge);\n }\n }\n // Uncategorized\n else {\n this.uncategorizedBadges.push(badge);\n }\n });\n\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n }\n }\n\n className() {\n return \"Modal--small BadgeModal\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.forum.${\n this.badge.exists ? \"update\" : \"give\"\n }_badge`\n );\n }\n\n content() {\n return (\n
\n
\n
{this.fields().toArray()}
\n
\n\n
\n \n {app.translator.trans(\"core.forum.composer_edit.submit_button\")}\n \n
\n
\n );\n }\n\n fields() {\n const items = new ItemList();\n\n // Badge selector\n items.add(\n \"badge\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badge\"\n )}\n \n

\n\n
\n {\n if (e.target.value === \"empty\") return;\n this.selectedBadge = app.store.getById(\"badges\", e.target.value);\n\n // Check if the user already has this badge\n this.checkUserHasBadge(this.selectedBadge);\n }}\n className=\"Select-input FormControl\"\n >\n \n\n {/* When no badge is selected, show all available badges */}\n {!this.attrs.badge &&\n Object.values(this.categories).map(({ category, badges }) => (\n \n {badges.map((badge) => (\n \n ))}\n \n ))}\n\n {!this.attrs.badge && this.uncategorizedBadges.length >= 1 && (\n \n {this.uncategorizedBadges.map((badge) => (\n \n ))}\n \n )}\n\n {/* When a badge is already assigned */}\n {!!this.attrs.badge && (\n \n )}\n \n \n
\n\n {this.userHasBadge && (\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.user_has_badge\"\n )}\n

\n )}\n
,\n 30\n );\n\n // Badge description\n items.add(\n \"badge_description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.description\"\n )}\n :\n \n

\n

\n {this.selectedBadge\n ? this.selectedBadge.description()\n : app.translator.trans(\n \"v17development-flarum-badges.forum.select_badge\"\n )}\n

\n
,\n 30\n );\n\n // Badge earning reason\n items.add(\n \"description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earning_reason\"\n )}\n \n

\n \n
,\n 30\n );\n\n return items;\n }\n\n checkUserHasBadge(badge) {\n let foundBadge = false;\n\n this.user.userBadges().map((userBadge) => {\n if (userBadge.badge() == badge) {\n foundBadge = true;\n }\n });\n\n this.userHasBadge = foundBadge;\n\n m.redraw();\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n description: this.description(),\n relationships: this.attrs.badge\n ? {}\n : {\n badge: this.selectedBadge,\n user: this.user,\n },\n })\n .then(\n () => {\n // Re-open badge modal\n if (this.attrs.badge) {\n app.modal.show(BadgeModal, {\n badge: this.attrs.badge.badge(),\n userBadgeData: this.attrs.badge,\n });\n } else {\n this.hide();\n }\n\n m.redraw();\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\nimport BadgeModal from \"../../forum/components/BadgeModal\";\n\nexport default class Badge extends mixin(Model, {\n name: Model.attribute(\"name\"),\n icon: Model.attribute(\"icon\"),\n order: Model.attribute(\"order\"),\n image: Model.attribute(\"image\"),\n description: Model.attribute(\"description\"),\n isVisible: Model.attribute(\"isVisible\"),\n createdAt: Model.attribute(\"createdAt\"),\n earnedAmount: Model.attribute(\"earnedAmount\"),\n category: Model.hasOne(\"category\"),\n}) {\n apiEndpoint() {\n return \"/badges\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","module.exports = flarum.core.compat['helpers/fullTime'];","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\n\nexport default class BadgeCategory extends mixin(Model, {\n name: Model.attribute(\"name\"),\n order: Model.attribute(\"order\"),\n description: Model.attribute(\"description\"),\n isEnabled: Model.attribute(\"isEnabled\"),\n createdAt: Model.attribute(\"createdAt\"),\n users: Model.hasMany(\"users\"),\n badges: Model.hasMany(\"badges\"),\n}) {\n apiEndpoint() {\n return \"/badge_categories\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['components/Link'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Dropdown'];","module.exports = flarum.core.compat['helpers/icon'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['utils/saveSettings'];","let loading = false;\nlet hasLoaded = false;\nlet onLoadedCallbacks = [];\n\nexport default function loadAllBadges(onLoadedCallback) {\n // Badges have already been loaded\n if (hasLoaded) {\n onLoadedCallback();\n return;\n }\n\n // Load badges if not already loading\n if (!loading) {\n loading = true;\n\n // Load badges\n app.store.find(\"badges\").then(() => {\n hasLoaded = true;\n loading = false;\n\n onLoadedCallback();\n\n // Give callback\n onLoadedCallbacks.map((cb) => cb());\n\n m.redraw();\n });\n } else {\n onLoadedCallbacks.push(onLoadedCallback);\n }\n}\n","import Component from \"flarum/Component\";\nimport Button from \"flarum/components/Button\";\nimport Dropdown from \"flarum/components/Dropdown\";\nimport icon from \"flarum/helpers/icon\";\nimport loadAllBadges from \"../utils/loadBadges\";\n\nexport default class BadgeSelector extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loaded = false;\n\n // Load badges\n loadAllBadges(() => (this.loaded = true));\n }\n\n view() {\n if (!this.loaded) {\n return (\n
\n \n\n \n {app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.badge_selector.loading_badges\"\n )}\n \n
\n );\n }\n\n const badge = app.store.getById(\"badges\", this.attrs.value);\n const label = badge\n ? [icon(badge.icon()), \"\\t\", badge.name()]\n : app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.badge_selector.placeholder\"\n );\n return (\n
\n \n\n {this.attrs.disabled ? (\n
{label}
\n ) : (\n \n {app.store.all(\"badges\").map((g) =>\n Button.component(\n {\n active: badge && badge.id() === g.id(),\n disabled: badge && badge.id() === g.id(),\n icon: g.icon(),\n onclick: () => {\n this.attrs.onchange(g.id());\n },\n },\n g.name()\n )\n )}\n \n )}\n
\n );\n }\n}\n","import Component from \"flarum/Component\";\nimport BadgeSelector from \"./BadgeSelector\";\n\nexport default class BadgeActionDriverSettings extends Component {\n view() {\n const settings = this.attrs.settings;\n\n return (\n settings({ badge_id: val })}\n />\n );\n }\n}\n","/**!\n * Sortable 1.13.0\n * @author\tRubaXa \n * @author\towenm \n * @license MIT\n */\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nvar version = \"1.13.0\";\n\nfunction userAgent(pattern) {\n if (typeof window !== 'undefined' && window.navigator) {\n return !!\n /*@__PURE__*/\n navigator.userAgent.match(pattern);\n }\n}\n\nvar IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\\.|msie|iemobile|Windows Phone)/i);\nvar Edge = userAgent(/Edge/i);\nvar FireFox = userAgent(/firefox/i);\nvar Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);\nvar IOS = userAgent(/iP(ad|od|hone)/i);\nvar ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);\n\nvar captureMode = {\n capture: false,\n passive: false\n};\n\nfunction on(el, event, fn) {\n el.addEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction off(el, event, fn) {\n el.removeEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction matches(\n/**HTMLElement*/\nel,\n/**String*/\nselector) {\n if (!selector) return;\n selector[0] === '>' && (selector = selector.substring(1));\n\n if (el) {\n try {\n if (el.matches) {\n return el.matches(selector);\n } else if (el.msMatchesSelector) {\n return el.msMatchesSelector(selector);\n } else if (el.webkitMatchesSelector) {\n return el.webkitMatchesSelector(selector);\n }\n } catch (_) {\n return false;\n }\n }\n\n return false;\n}\n\nfunction getParentOrHost(el) {\n return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;\n}\n\nfunction closest(\n/**HTMLElement*/\nel,\n/**String*/\nselector,\n/**HTMLElement*/\nctx, includeCTX) {\n if (el) {\n ctx = ctx || document;\n\n do {\n if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {\n return el;\n }\n\n if (el === ctx) break;\n /* jshint boss:true */\n } while (el = getParentOrHost(el));\n }\n\n return null;\n}\n\nvar R_SPACE = /\\s+/g;\n\nfunction toggleClass(el, name, state) {\n if (el && name) {\n if (el.classList) {\n el.classList[state ? 'add' : 'remove'](name);\n } else {\n var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');\n el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');\n }\n }\n}\n\nfunction css(el, prop, val) {\n var style = el && el.style;\n\n if (style) {\n if (val === void 0) {\n if (document.defaultView && document.defaultView.getComputedStyle) {\n val = document.defaultView.getComputedStyle(el, '');\n } else if (el.currentStyle) {\n val = el.currentStyle;\n }\n\n return prop === void 0 ? val : val[prop];\n } else {\n if (!(prop in style) && prop.indexOf('webkit') === -1) {\n prop = '-webkit-' + prop;\n }\n\n style[prop] = val + (typeof val === 'string' ? '' : 'px');\n }\n }\n}\n\nfunction matrix(el, selfOnly) {\n var appliedTransforms = '';\n\n if (typeof el === 'string') {\n appliedTransforms = el;\n } else {\n do {\n var transform = css(el, 'transform');\n\n if (transform && transform !== 'none') {\n appliedTransforms = transform + ' ' + appliedTransforms;\n }\n /* jshint boss:true */\n\n } while (!selfOnly && (el = el.parentNode));\n }\n\n var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;\n /*jshint -W056 */\n\n return matrixFn && new matrixFn(appliedTransforms);\n}\n\nfunction find(ctx, tagName, iterator) {\n if (ctx) {\n var list = ctx.getElementsByTagName(tagName),\n i = 0,\n n = list.length;\n\n if (iterator) {\n for (; i < n; i++) {\n iterator(list[i], i);\n }\n }\n\n return list;\n }\n\n return [];\n}\n\nfunction getWindowScrollingElement() {\n var scrollingElement = document.scrollingElement;\n\n if (scrollingElement) {\n return scrollingElement;\n } else {\n return document.documentElement;\n }\n}\n/**\n * Returns the \"bounding client rect\" of given element\n * @param {HTMLElement} el The element whose boundingClientRect is wanted\n * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container\n * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr\n * @param {[Boolean]} undoScale Whether the container's scale() should be undone\n * @param {[HTMLElement]} container The parent the element will be placed in\n * @return {Object} The boundingClientRect of el, with specified adjustments\n */\n\n\nfunction getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {\n if (!el.getBoundingClientRect && el !== window) return;\n var elRect, top, left, bottom, right, height, width;\n\n if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {\n elRect = el.getBoundingClientRect();\n top = elRect.top;\n left = elRect.left;\n bottom = elRect.bottom;\n right = elRect.right;\n height = elRect.height;\n width = elRect.width;\n } else {\n top = 0;\n left = 0;\n bottom = window.innerHeight;\n right = window.innerWidth;\n height = window.innerHeight;\n width = window.innerWidth;\n }\n\n if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {\n // Adjust for translate()\n container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)\n // Not needed on <= IE11\n\n if (!IE11OrLess) {\n do {\n if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {\n var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container\n\n top -= containerRect.top + parseInt(css(container, 'border-top-width'));\n left -= containerRect.left + parseInt(css(container, 'border-left-width'));\n bottom = top + elRect.height;\n right = left + elRect.width;\n break;\n }\n /* jshint boss:true */\n\n } while (container = container.parentNode);\n }\n }\n\n if (undoScale && el !== window) {\n // Adjust for scale()\n var elMatrix = matrix(container || el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d;\n\n if (elMatrix) {\n top /= scaleY;\n left /= scaleX;\n width /= scaleX;\n height /= scaleY;\n bottom = top + height;\n right = left + width;\n }\n }\n\n return {\n top: top,\n left: left,\n bottom: bottom,\n right: right,\n width: width,\n height: height\n };\n}\n/**\n * Checks if a side of an element is scrolled past a side of its parents\n * @param {HTMLElement} el The element who's side being scrolled out of view is in question\n * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')\n * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')\n * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element\n */\n\n\nfunction isScrolledPast(el, elSide, parentSide) {\n var parent = getParentAutoScrollElement(el, true),\n elSideVal = getRect(el)[elSide];\n /* jshint boss:true */\n\n while (parent) {\n var parentSideVal = getRect(parent)[parentSide],\n visible = void 0;\n\n if (parentSide === 'top' || parentSide === 'left') {\n visible = elSideVal >= parentSideVal;\n } else {\n visible = elSideVal <= parentSideVal;\n }\n\n if (!visible) return parent;\n if (parent === getWindowScrollingElement()) break;\n parent = getParentAutoScrollElement(parent, false);\n }\n\n return false;\n}\n/**\n * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)\n * and non-draggable elements\n * @param {HTMLElement} el The parent element\n * @param {Number} childNum The index of the child\n * @param {Object} options Parent Sortable's options\n * @return {HTMLElement} The child at index childNum, or null if not found\n */\n\n\nfunction getChild(el, childNum, options) {\n var currentChild = 0,\n i = 0,\n children = el.children;\n\n while (i < children.length) {\n if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) {\n if (currentChild === childNum) {\n return children[i];\n }\n\n currentChild++;\n }\n\n i++;\n }\n\n return null;\n}\n/**\n * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)\n * @param {HTMLElement} el Parent element\n * @param {selector} selector Any other elements that should be ignored\n * @return {HTMLElement} The last child, ignoring ghostEl\n */\n\n\nfunction lastChild(el, selector) {\n var last = el.lastElementChild;\n\n while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {\n last = last.previousElementSibling;\n }\n\n return last || null;\n}\n/**\n * Returns the index of an element within its parent for a selected set of\n * elements\n * @param {HTMLElement} el\n * @param {selector} selector\n * @return {number}\n */\n\n\nfunction index(el, selector) {\n var index = 0;\n\n if (!el || !el.parentNode) {\n return -1;\n }\n /* jshint boss:true */\n\n\n while (el = el.previousElementSibling) {\n if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {\n index++;\n }\n }\n\n return index;\n}\n/**\n * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.\n * The value is returned in real pixels.\n * @param {HTMLElement} el\n * @return {Array} Offsets in the format of [left, top]\n */\n\n\nfunction getRelativeScrollOffset(el) {\n var offsetLeft = 0,\n offsetTop = 0,\n winScroller = getWindowScrollingElement();\n\n if (el) {\n do {\n var elMatrix = matrix(el),\n scaleX = elMatrix.a,\n scaleY = elMatrix.d;\n offsetLeft += el.scrollLeft * scaleX;\n offsetTop += el.scrollTop * scaleY;\n } while (el !== winScroller && (el = el.parentNode));\n }\n\n return [offsetLeft, offsetTop];\n}\n/**\n * Returns the index of the object within the given array\n * @param {Array} arr Array that may or may not hold the object\n * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find\n * @return {Number} The index of the object in the array, or -1\n */\n\n\nfunction indexOfObject(arr, obj) {\n for (var i in arr) {\n if (!arr.hasOwnProperty(i)) continue;\n\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);\n }\n }\n\n return -1;\n}\n\nfunction getParentAutoScrollElement(el, includeSelf) {\n // skip to window\n if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();\n var elem = el;\n var gotSelf = false;\n\n do {\n // we don't need to get elem css if it isn't even overflowing in the first place (performance)\n if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {\n var elemCSS = css(elem);\n\n if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {\n if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();\n if (gotSelf || includeSelf) return elem;\n gotSelf = true;\n }\n }\n /* jshint boss:true */\n\n } while (elem = elem.parentNode);\n\n return getWindowScrollingElement();\n}\n\nfunction extend(dst, src) {\n if (dst && src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dst[key] = src[key];\n }\n }\n }\n\n return dst;\n}\n\nfunction isRectEqual(rect1, rect2) {\n return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);\n}\n\nvar _throttleTimeout;\n\nfunction throttle(callback, ms) {\n return function () {\n if (!_throttleTimeout) {\n var args = arguments,\n _this = this;\n\n if (args.length === 1) {\n callback.call(_this, args[0]);\n } else {\n callback.apply(_this, args);\n }\n\n _throttleTimeout = setTimeout(function () {\n _throttleTimeout = void 0;\n }, ms);\n }\n };\n}\n\nfunction cancelThrottle() {\n clearTimeout(_throttleTimeout);\n _throttleTimeout = void 0;\n}\n\nfunction scrollBy(el, x, y) {\n el.scrollLeft += x;\n el.scrollTop += y;\n}\n\nfunction clone(el) {\n var Polymer = window.Polymer;\n var $ = window.jQuery || window.Zepto;\n\n if (Polymer && Polymer.dom) {\n return Polymer.dom(el).cloneNode(true);\n } else if ($) {\n return $(el).clone(true)[0];\n } else {\n return el.cloneNode(true);\n }\n}\n\nfunction setRect(el, rect) {\n css(el, 'position', 'absolute');\n css(el, 'top', rect.top);\n css(el, 'left', rect.left);\n css(el, 'width', rect.width);\n css(el, 'height', rect.height);\n}\n\nfunction unsetRect(el) {\n css(el, 'position', '');\n css(el, 'top', '');\n css(el, 'left', '');\n css(el, 'width', '');\n css(el, 'height', '');\n}\n\nvar expando = 'Sortable' + new Date().getTime();\n\nfunction AnimationStateManager() {\n var animationStates = [],\n animationCallbackId;\n return {\n captureAnimationState: function captureAnimationState() {\n animationStates = [];\n if (!this.options.animation) return;\n var children = [].slice.call(this.el.children);\n children.forEach(function (child) {\n if (css(child, 'display') === 'none' || child === Sortable.ghost) return;\n animationStates.push({\n target: child,\n rect: getRect(child)\n });\n\n var fromRect = _objectSpread({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation\n\n\n if (child.thisAnimationDuration) {\n var childMatrix = matrix(child, true);\n\n if (childMatrix) {\n fromRect.top -= childMatrix.f;\n fromRect.left -= childMatrix.e;\n }\n }\n\n child.fromRect = fromRect;\n });\n },\n addAnimationState: function addAnimationState(state) {\n animationStates.push(state);\n },\n removeAnimationState: function removeAnimationState(target) {\n animationStates.splice(indexOfObject(animationStates, {\n target: target\n }), 1);\n },\n animateAll: function animateAll(callback) {\n var _this = this;\n\n if (!this.options.animation) {\n clearTimeout(animationCallbackId);\n if (typeof callback === 'function') callback();\n return;\n }\n\n var animating = false,\n animationTime = 0;\n animationStates.forEach(function (state) {\n var time = 0,\n target = state.target,\n fromRect = target.fromRect,\n toRect = getRect(target),\n prevFromRect = target.prevFromRect,\n prevToRect = target.prevToRect,\n animatingRect = state.rect,\n targetMatrix = matrix(target, true);\n\n if (targetMatrix) {\n // Compensate for current animation\n toRect.top -= targetMatrix.f;\n toRect.left -= targetMatrix.e;\n }\n\n target.toRect = toRect;\n\n if (target.thisAnimationDuration) {\n // Could also check if animatingRect is between fromRect and toRect\n if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect\n (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {\n // If returning to same place as started from animation and on same axis\n time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);\n }\n } // if fromRect != toRect: animate\n\n\n if (!isRectEqual(toRect, fromRect)) {\n target.prevFromRect = fromRect;\n target.prevToRect = toRect;\n\n if (!time) {\n time = _this.options.animation;\n }\n\n _this.animate(target, animatingRect, toRect, time);\n }\n\n if (time) {\n animating = true;\n animationTime = Math.max(animationTime, time);\n clearTimeout(target.animationResetTimer);\n target.animationResetTimer = setTimeout(function () {\n target.animationTime = 0;\n target.prevFromRect = null;\n target.fromRect = null;\n target.prevToRect = null;\n target.thisAnimationDuration = null;\n }, time);\n target.thisAnimationDuration = time;\n }\n });\n clearTimeout(animationCallbackId);\n\n if (!animating) {\n if (typeof callback === 'function') callback();\n } else {\n animationCallbackId = setTimeout(function () {\n if (typeof callback === 'function') callback();\n }, animationTime);\n }\n\n animationStates = [];\n },\n animate: function animate(target, currentRect, toRect, duration) {\n if (duration) {\n css(target, 'transition', '');\n css(target, 'transform', '');\n var elMatrix = matrix(this.el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d,\n translateX = (currentRect.left - toRect.left) / (scaleX || 1),\n translateY = (currentRect.top - toRect.top) / (scaleY || 1);\n target.animatingX = !!translateX;\n target.animatingY = !!translateY;\n css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');\n this.forRepaintDummy = repaint(target); // repaint\n\n css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));\n css(target, 'transform', 'translate3d(0,0,0)');\n typeof target.animated === 'number' && clearTimeout(target.animated);\n target.animated = setTimeout(function () {\n css(target, 'transition', '');\n css(target, 'transform', '');\n target.animated = false;\n target.animatingX = false;\n target.animatingY = false;\n }, duration);\n }\n }\n };\n}\n\nfunction repaint(target) {\n return target.offsetWidth;\n}\n\nfunction calculateRealTime(animatingRect, fromRect, toRect, options) {\n return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;\n}\n\nvar plugins = [];\nvar defaults = {\n initializeByDefault: true\n};\nvar PluginManager = {\n mount: function mount(plugin) {\n // Set default static properties\n for (var option in defaults) {\n if (defaults.hasOwnProperty(option) && !(option in plugin)) {\n plugin[option] = defaults[option];\n }\n }\n\n plugins.forEach(function (p) {\n if (p.pluginName === plugin.pluginName) {\n throw \"Sortable: Cannot mount plugin \".concat(plugin.pluginName, \" more than once\");\n }\n });\n plugins.push(plugin);\n },\n pluginEvent: function pluginEvent(eventName, sortable, evt) {\n var _this = this;\n\n this.eventCanceled = false;\n\n evt.cancel = function () {\n _this.eventCanceled = true;\n };\n\n var eventNameGlobal = eventName + 'Global';\n plugins.forEach(function (plugin) {\n if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable\n\n if (sortable[plugin.pluginName][eventNameGlobal]) {\n sortable[plugin.pluginName][eventNameGlobal](_objectSpread({\n sortable: sortable\n }, evt));\n } // Only fire plugin event if plugin is enabled in this sortable,\n // and plugin has event defined\n\n\n if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {\n sortable[plugin.pluginName][eventName](_objectSpread({\n sortable: sortable\n }, evt));\n }\n });\n },\n initializePlugins: function initializePlugins(sortable, el, defaults, options) {\n plugins.forEach(function (plugin) {\n var pluginName = plugin.pluginName;\n if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;\n var initialized = new plugin(sortable, el, sortable.options);\n initialized.sortable = sortable;\n initialized.options = sortable.options;\n sortable[pluginName] = initialized; // Add default options from plugin\n\n _extends(defaults, initialized.defaults);\n });\n\n for (var option in sortable.options) {\n if (!sortable.options.hasOwnProperty(option)) continue;\n var modified = this.modifyOption(sortable, option, sortable.options[option]);\n\n if (typeof modified !== 'undefined') {\n sortable.options[option] = modified;\n }\n }\n },\n getEventProperties: function getEventProperties(name, sortable) {\n var eventProperties = {};\n plugins.forEach(function (plugin) {\n if (typeof plugin.eventProperties !== 'function') return;\n\n _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));\n });\n return eventProperties;\n },\n modifyOption: function modifyOption(sortable, name, value) {\n var modifiedValue;\n plugins.forEach(function (plugin) {\n // Plugin must exist on the Sortable\n if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin\n\n if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {\n modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);\n }\n });\n return modifiedValue;\n }\n};\n\nfunction dispatchEvent(_ref) {\n var sortable = _ref.sortable,\n rootEl = _ref.rootEl,\n name = _ref.name,\n targetEl = _ref.targetEl,\n cloneEl = _ref.cloneEl,\n toEl = _ref.toEl,\n fromEl = _ref.fromEl,\n oldIndex = _ref.oldIndex,\n newIndex = _ref.newIndex,\n oldDraggableIndex = _ref.oldDraggableIndex,\n newDraggableIndex = _ref.newDraggableIndex,\n originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n extraEventProperties = _ref.extraEventProperties;\n sortable = sortable || rootEl && rootEl[expando];\n if (!sortable) return;\n var evt,\n options = sortable.options,\n onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent(name, {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent(name, true, true);\n }\n\n evt.to = toEl || rootEl;\n evt.from = fromEl || rootEl;\n evt.item = targetEl || rootEl;\n evt.clone = cloneEl;\n evt.oldIndex = oldIndex;\n evt.newIndex = newIndex;\n evt.oldDraggableIndex = oldDraggableIndex;\n evt.newDraggableIndex = newDraggableIndex;\n evt.originalEvent = originalEvent;\n evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;\n\n var allEventProperties = _objectSpread({}, extraEventProperties, PluginManager.getEventProperties(name, sortable));\n\n for (var option in allEventProperties) {\n evt[option] = allEventProperties[option];\n }\n\n if (rootEl) {\n rootEl.dispatchEvent(evt);\n }\n\n if (options[onName]) {\n options[onName].call(sortable, evt);\n }\n}\n\nvar pluginEvent = function pluginEvent(eventName, sortable) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n originalEvent = _ref.evt,\n data = _objectWithoutProperties(_ref, [\"evt\"]);\n\n PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({\n dragEl: dragEl,\n parentEl: parentEl,\n ghostEl: ghostEl,\n rootEl: rootEl,\n nextEl: nextEl,\n lastDownEl: lastDownEl,\n cloneEl: cloneEl,\n cloneHidden: cloneHidden,\n dragStarted: moved,\n putSortable: putSortable,\n activeSortable: Sortable.active,\n originalEvent: originalEvent,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n hideGhostForTarget: _hideGhostForTarget,\n unhideGhostForTarget: _unhideGhostForTarget,\n cloneNowHidden: function cloneNowHidden() {\n cloneHidden = true;\n },\n cloneNowShown: function cloneNowShown() {\n cloneHidden = false;\n },\n dispatchSortableEvent: function dispatchSortableEvent(name) {\n _dispatchEvent({\n sortable: sortable,\n name: name,\n originalEvent: originalEvent\n });\n }\n }, data));\n};\n\nfunction _dispatchEvent(info) {\n dispatchEvent(_objectSpread({\n putSortable: putSortable,\n cloneEl: cloneEl,\n targetEl: dragEl,\n rootEl: rootEl,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex\n }, info));\n}\n\nvar dragEl,\n parentEl,\n ghostEl,\n rootEl,\n nextEl,\n lastDownEl,\n cloneEl,\n cloneHidden,\n oldIndex,\n newIndex,\n oldDraggableIndex,\n newDraggableIndex,\n activeGroup,\n putSortable,\n awaitingDragStarted = false,\n ignoreNextClick = false,\n sortables = [],\n tapEvt,\n touchEvt,\n lastDx,\n lastDy,\n tapDistanceLeft,\n tapDistanceTop,\n moved,\n lastTarget,\n lastDirection,\n pastFirstInvertThresh = false,\n isCircumstantialInvert = false,\n targetMoveDistance,\n // For positioning ghost absolutely\nghostRelativeParent,\n ghostRelativeParentInitialScroll = [],\n // (left, top)\n_silent = false,\n savedInputChecked = [];\n/** @const */\n\nvar documentExists = typeof document !== 'undefined',\n PositionGhostAbsolutely = IOS,\n CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',\n // This will not pass for IE9, because IE9 DnD only works on anchors\nsupportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),\n supportCssPointerEvents = function () {\n if (!documentExists) return; // false when <= IE11\n\n if (IE11OrLess) {\n return false;\n }\n\n var el = document.createElement('x');\n el.style.cssText = 'pointer-events:auto';\n return el.style.pointerEvents === 'auto';\n}(),\n _detectDirection = function _detectDirection(el, options) {\n var elCSS = css(el),\n elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),\n child1 = getChild(el, 0, options),\n child2 = getChild(el, 1, options),\n firstChildCSS = child1 && css(child1),\n secondChildCSS = child2 && css(child2),\n firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,\n secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;\n\n if (elCSS.display === 'flex') {\n return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';\n }\n\n if (elCSS.display === 'grid') {\n return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';\n }\n\n if (child1 && firstChildCSS[\"float\"] && firstChildCSS[\"float\"] !== 'none') {\n var touchingSideChild2 = firstChildCSS[\"float\"] === 'left' ? 'left' : 'right';\n return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';\n }\n\n return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';\n},\n _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {\n var dragElS1Opp = vertical ? dragRect.left : dragRect.top,\n dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,\n dragElOppLength = vertical ? dragRect.width : dragRect.height,\n targetS1Opp = vertical ? targetRect.left : targetRect.top,\n targetS2Opp = vertical ? targetRect.right : targetRect.bottom,\n targetOppLength = vertical ? targetRect.width : targetRect.height;\n return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;\n},\n\n/**\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\n * @param {Number} x X position\n * @param {Number} y Y position\n * @return {HTMLElement} Element of the first found nearest Sortable\n */\n_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {\n var ret;\n sortables.some(function (sortable) {\n if (lastChild(sortable)) return;\n var rect = getRect(sortable),\n threshold = sortable[expando].options.emptyInsertThreshold,\n insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,\n insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;\n\n if (threshold && insideHorizontally && insideVertically) {\n return ret = sortable;\n }\n });\n return ret;\n},\n _prepareGroup = function _prepareGroup(options) {\n function toFn(value, pull) {\n return function (to, from, dragEl, evt) {\n var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;\n\n if (value == null && (pull || sameGroup)) {\n // Default pull value\n // Default pull and put value if same group\n return true;\n } else if (value == null || value === false) {\n return false;\n } else if (pull && value === 'clone') {\n return value;\n } else if (typeof value === 'function') {\n return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);\n } else {\n var otherGroup = (pull ? to : from).options.group.name;\n return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;\n }\n };\n }\n\n var group = {};\n var originalGroup = options.group;\n\n if (!originalGroup || _typeof(originalGroup) != 'object') {\n originalGroup = {\n name: originalGroup\n };\n }\n\n group.name = originalGroup.name;\n group.checkPull = toFn(originalGroup.pull, true);\n group.checkPut = toFn(originalGroup.put);\n group.revertClone = originalGroup.revertClone;\n options.group = group;\n},\n _hideGhostForTarget = function _hideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', 'none');\n }\n},\n _unhideGhostForTarget = function _unhideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', '');\n }\n}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position\n\n\nif (documentExists) {\n document.addEventListener('click', function (evt) {\n if (ignoreNextClick) {\n evt.preventDefault();\n evt.stopPropagation && evt.stopPropagation();\n evt.stopImmediatePropagation && evt.stopImmediatePropagation();\n ignoreNextClick = false;\n return false;\n }\n }, true);\n}\n\nvar nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {\n if (dragEl) {\n evt = evt.touches ? evt.touches[0] : evt;\n\n var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);\n\n if (nearest) {\n // Create imitation event\n var event = {};\n\n for (var i in evt) {\n if (evt.hasOwnProperty(i)) {\n event[i] = evt[i];\n }\n }\n\n event.target = event.rootEl = nearest;\n event.preventDefault = void 0;\n event.stopPropagation = void 0;\n\n nearest[expando]._onDragOver(event);\n }\n }\n};\n\nvar _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {\n if (dragEl) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n }\n};\n/**\n * @class Sortable\n * @param {HTMLElement} el\n * @param {Object} [options]\n */\n\n\nfunction Sortable(el, options) {\n if (!(el && el.nodeType && el.nodeType === 1)) {\n throw \"Sortable: `el` must be an HTMLElement, not \".concat({}.toString.call(el));\n }\n\n this.el = el; // root element\n\n this.options = options = _extends({}, options); // Export instance\n\n el[expando] = this;\n var defaults = {\n group: null,\n sort: true,\n disabled: false,\n store: null,\n handle: null,\n draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',\n swapThreshold: 1,\n // percentage; 0 <= x <= 1\n invertSwap: false,\n // invert always\n invertedSwapThreshold: null,\n // will be set to same as swapThreshold if default\n removeCloneOnHide: true,\n direction: function direction() {\n return _detectDirection(el, this.options);\n },\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n ignore: 'a, img',\n filter: null,\n preventOnFilter: true,\n animation: 0,\n easing: null,\n setData: function setData(dataTransfer, dragEl) {\n dataTransfer.setData('Text', dragEl.textContent);\n },\n dropBubble: false,\n dragoverBubble: false,\n dataIdAttr: 'data-id',\n delay: 0,\n delayOnTouchOnly: false,\n touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,\n forceFallback: false,\n fallbackClass: 'sortable-fallback',\n fallbackOnBody: false,\n fallbackTolerance: 0,\n fallbackOffset: {\n x: 0,\n y: 0\n },\n supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,\n emptyInsertThreshold: 5\n };\n PluginManager.initializePlugins(this, el, defaults); // Set default options\n\n for (var name in defaults) {\n !(name in options) && (options[name] = defaults[name]);\n }\n\n _prepareGroup(options); // Bind all private methods\n\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n } // Setup drag mode\n\n\n this.nativeDraggable = options.forceFallback ? false : supportDraggable;\n\n if (this.nativeDraggable) {\n // Touch start threshold cannot be greater than the native dragstart threshold\n this.options.touchStartThreshold = 1;\n } // Bind events\n\n\n if (options.supportPointer) {\n on(el, 'pointerdown', this._onTapStart);\n } else {\n on(el, 'mousedown', this._onTapStart);\n on(el, 'touchstart', this._onTapStart);\n }\n\n if (this.nativeDraggable) {\n on(el, 'dragover', this);\n on(el, 'dragenter', this);\n }\n\n sortables.push(this.el); // Restore sorting\n\n options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager\n\n _extends(this, AnimationStateManager());\n}\n\nSortable.prototype =\n/** @lends Sortable.prototype */\n{\n constructor: Sortable,\n _isOutsideThisEl: function _isOutsideThisEl(target) {\n if (!this.el.contains(target) && target !== this.el) {\n lastTarget = null;\n }\n },\n _getDirection: function _getDirection(evt, target) {\n return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;\n },\n _onTapStart: function _onTapStart(\n /** Event|TouchEvent */\n evt) {\n if (!evt.cancelable) return;\n\n var _this = this,\n el = this.el,\n options = this.options,\n preventOnFilter = options.preventOnFilter,\n type = evt.type,\n touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,\n target = (touch || evt).target,\n originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,\n filter = options.filter;\n\n _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.\n\n\n if (dragEl) {\n return;\n }\n\n if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {\n return; // only left button and enabled\n } // cancel dnd if original target is content editable\n\n\n if (originalTarget.isContentEditable) {\n return;\n } // Safari ignores further event handling after mousedown\n\n\n if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {\n return;\n }\n\n target = closest(target, options.draggable, el, false);\n\n if (target && target.animated) {\n return;\n }\n\n if (lastDownEl === target) {\n // Ignoring duplicate `down`\n return;\n } // Get the index of the dragged element within its parent\n\n\n oldIndex = index(target);\n oldDraggableIndex = index(target, options.draggable); // Check filter\n\n if (typeof filter === 'function') {\n if (filter.call(this, evt, target, this)) {\n _dispatchEvent({\n sortable: _this,\n rootEl: originalTarget,\n name: 'filter',\n targetEl: target,\n toEl: el,\n fromEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n } else if (filter) {\n filter = filter.split(',').some(function (criteria) {\n criteria = closest(originalTarget, criteria.trim(), el, false);\n\n if (criteria) {\n _dispatchEvent({\n sortable: _this,\n rootEl: criteria,\n name: 'filter',\n targetEl: target,\n fromEl: el,\n toEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n return true;\n }\n });\n\n if (filter) {\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n }\n\n if (options.handle && !closest(originalTarget, options.handle, el, false)) {\n return;\n } // Prepare `dragstart`\n\n\n this._prepareDragStart(evt, touch, target);\n },\n _prepareDragStart: function _prepareDragStart(\n /** Event */\n evt,\n /** Touch */\n touch,\n /** HTMLElement */\n target) {\n var _this = this,\n el = _this.el,\n options = _this.options,\n ownerDocument = el.ownerDocument,\n dragStartFn;\n\n if (target && !dragEl && target.parentNode === el) {\n var dragRect = getRect(target);\n rootEl = el;\n dragEl = target;\n parentEl = dragEl.parentNode;\n nextEl = dragEl.nextSibling;\n lastDownEl = target;\n activeGroup = options.group;\n Sortable.dragged = dragEl;\n tapEvt = {\n target: dragEl,\n clientX: (touch || evt).clientX,\n clientY: (touch || evt).clientY\n };\n tapDistanceLeft = tapEvt.clientX - dragRect.left;\n tapDistanceTop = tapEvt.clientY - dragRect.top;\n this._lastX = (touch || evt).clientX;\n this._lastY = (touch || evt).clientY;\n dragEl.style['will-change'] = 'all';\n\n dragStartFn = function dragStartFn() {\n pluginEvent('delayEnded', _this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n _this._onDrop();\n\n return;\n } // Delayed drag has been triggered\n // we can re-enable the events: touchmove/mousemove\n\n\n _this._disableDelayedDragEvents();\n\n if (!FireFox && _this.nativeDraggable) {\n dragEl.draggable = true;\n } // Bind the events: dragstart/dragend\n\n\n _this._triggerDragStart(evt, touch); // Drag start event\n\n\n _dispatchEvent({\n sortable: _this,\n name: 'choose',\n originalEvent: evt\n }); // Chosen item\n\n\n toggleClass(dragEl, options.chosenClass, true);\n }; // Disable \"draggable\"\n\n\n options.ignore.split(',').forEach(function (criteria) {\n find(dragEl, criteria.trim(), _disableDraggable);\n });\n on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mouseup', _this._onDrop);\n on(ownerDocument, 'touchend', _this._onDrop);\n on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)\n\n if (FireFox && this.nativeDraggable) {\n this.options.touchStartThreshold = 4;\n dragEl.draggable = true;\n }\n\n pluginEvent('delayStart', this, {\n evt: evt\n }); // Delay is impossible for native DnD in Edge or IE\n\n if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n } // If the user moves the pointer or let go the click or touch\n // before the delay has been reached:\n // disable the delayed drag\n\n\n on(ownerDocument, 'mouseup', _this._disableDelayedDrag);\n on(ownerDocument, 'touchend', _this._disableDelayedDrag);\n on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);\n on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);\n on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);\n options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);\n _this._dragStartTimer = setTimeout(dragStartFn, options.delay);\n } else {\n dragStartFn();\n }\n }\n },\n _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(\n /** TouchEvent|PointerEvent **/\n e) {\n var touch = e.touches ? e.touches[0] : e;\n\n if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {\n this._disableDelayedDrag();\n }\n },\n _disableDelayedDrag: function _disableDelayedDrag() {\n dragEl && _disableDraggable(dragEl);\n clearTimeout(this._dragStartTimer);\n\n this._disableDelayedDragEvents();\n },\n _disableDelayedDragEvents: function _disableDelayedDragEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._disableDelayedDrag);\n off(ownerDocument, 'touchend', this._disableDelayedDrag);\n off(ownerDocument, 'touchcancel', this._disableDelayedDrag);\n off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);\n },\n _triggerDragStart: function _triggerDragStart(\n /** Event */\n evt,\n /** Touch */\n touch) {\n touch = touch || evt.pointerType == 'touch' && evt;\n\n if (!this.nativeDraggable || touch) {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._onTouchMove);\n } else if (touch) {\n on(document, 'touchmove', this._onTouchMove);\n } else {\n on(document, 'mousemove', this._onTouchMove);\n }\n } else {\n on(dragEl, 'dragend', this);\n on(rootEl, 'dragstart', this._onDragStart);\n }\n\n try {\n if (document.selection) {\n // Timeout neccessary for IE9\n _nextTick(function () {\n document.selection.empty();\n });\n } else {\n window.getSelection().removeAllRanges();\n }\n } catch (err) {}\n },\n _dragStarted: function _dragStarted(fallback, evt) {\n\n awaitingDragStarted = false;\n\n if (rootEl && dragEl) {\n pluginEvent('dragStarted', this, {\n evt: evt\n });\n\n if (this.nativeDraggable) {\n on(document, 'dragover', _checkOutsideTargetEl);\n }\n\n var options = this.options; // Apply effect\n\n !fallback && toggleClass(dragEl, options.dragClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n Sortable.active = this;\n fallback && this._appendGhost(); // Drag start event\n\n _dispatchEvent({\n sortable: this,\n name: 'start',\n originalEvent: evt\n });\n } else {\n this._nulling();\n }\n },\n _emulateDragOver: function _emulateDragOver() {\n if (touchEvt) {\n this._lastX = touchEvt.clientX;\n this._lastY = touchEvt.clientY;\n\n _hideGhostForTarget();\n\n var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n var parent = target;\n\n while (target && target.shadowRoot) {\n target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n if (target === parent) break;\n parent = target;\n }\n\n dragEl.parentNode[expando]._isOutsideThisEl(target);\n\n if (parent) {\n do {\n if (parent[expando]) {\n var inserted = void 0;\n inserted = parent[expando]._onDragOver({\n clientX: touchEvt.clientX,\n clientY: touchEvt.clientY,\n target: target,\n rootEl: parent\n });\n\n if (inserted && !this.options.dragoverBubble) {\n break;\n }\n }\n\n target = parent; // store last element\n }\n /* jshint boss:true */\n while (parent = parent.parentNode);\n }\n\n _unhideGhostForTarget();\n }\n },\n _onTouchMove: function _onTouchMove(\n /**TouchEvent*/\n evt) {\n if (tapEvt) {\n var options = this.options,\n fallbackTolerance = options.fallbackTolerance,\n fallbackOffset = options.fallbackOffset,\n touch = evt.touches ? evt.touches[0] : evt,\n ghostMatrix = ghostEl && matrix(ghostEl, true),\n scaleX = ghostEl && ghostMatrix && ghostMatrix.a,\n scaleY = ghostEl && ghostMatrix && ghostMatrix.d,\n relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),\n dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),\n dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging\n\n if (!Sortable.active && !awaitingDragStarted) {\n if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {\n return;\n }\n\n this._onDragStart(evt, true);\n }\n\n if (ghostEl) {\n if (ghostMatrix) {\n ghostMatrix.e += dx - (lastDx || 0);\n ghostMatrix.f += dy - (lastDy || 0);\n } else {\n ghostMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: dx,\n f: dy\n };\n }\n\n var cssMatrix = \"matrix(\".concat(ghostMatrix.a, \",\").concat(ghostMatrix.b, \",\").concat(ghostMatrix.c, \",\").concat(ghostMatrix.d, \",\").concat(ghostMatrix.e, \",\").concat(ghostMatrix.f, \")\");\n css(ghostEl, 'webkitTransform', cssMatrix);\n css(ghostEl, 'mozTransform', cssMatrix);\n css(ghostEl, 'msTransform', cssMatrix);\n css(ghostEl, 'transform', cssMatrix);\n lastDx = dx;\n lastDy = dy;\n touchEvt = touch;\n }\n\n evt.cancelable && evt.preventDefault();\n }\n },\n _appendGhost: function _appendGhost() {\n // Bug if using scale(): https://stackoverflow.com/questions/2637058\n // Not being adjusted for\n if (!ghostEl) {\n var container = this.options.fallbackOnBody ? document.body : rootEl,\n rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),\n options = this.options; // Position absolutely\n\n if (PositionGhostAbsolutely) {\n // Get relatively positioned parent\n ghostRelativeParent = container;\n\n while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {\n ghostRelativeParent = ghostRelativeParent.parentNode;\n }\n\n if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {\n if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();\n rect.top += ghostRelativeParent.scrollTop;\n rect.left += ghostRelativeParent.scrollLeft;\n } else {\n ghostRelativeParent = getWindowScrollingElement();\n }\n\n ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);\n }\n\n ghostEl = dragEl.cloneNode(true);\n toggleClass(ghostEl, options.ghostClass, false);\n toggleClass(ghostEl, options.fallbackClass, true);\n toggleClass(ghostEl, options.dragClass, true);\n css(ghostEl, 'transition', '');\n css(ghostEl, 'transform', '');\n css(ghostEl, 'box-sizing', 'border-box');\n css(ghostEl, 'margin', 0);\n css(ghostEl, 'top', rect.top);\n css(ghostEl, 'left', rect.left);\n css(ghostEl, 'width', rect.width);\n css(ghostEl, 'height', rect.height);\n css(ghostEl, 'opacity', '0.8');\n css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');\n css(ghostEl, 'zIndex', '100000');\n css(ghostEl, 'pointerEvents', 'none');\n Sortable.ghost = ghostEl;\n container.appendChild(ghostEl); // Set transform-origin\n\n css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');\n }\n },\n _onDragStart: function _onDragStart(\n /**Event*/\n evt,\n /**boolean*/\n fallback) {\n var _this = this;\n\n var dataTransfer = evt.dataTransfer;\n var options = _this.options;\n pluginEvent('dragStart', this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n }\n\n pluginEvent('setupClone', this);\n\n if (!Sortable.eventCanceled) {\n cloneEl = clone(dragEl);\n cloneEl.draggable = false;\n cloneEl.style['will-change'] = '';\n\n this._hideClone();\n\n toggleClass(cloneEl, this.options.chosenClass, false);\n Sortable.clone = cloneEl;\n } // #1143: IFrame support workaround\n\n\n _this.cloneId = _nextTick(function () {\n pluginEvent('clone', _this);\n if (Sortable.eventCanceled) return;\n\n if (!_this.options.removeCloneOnHide) {\n rootEl.insertBefore(cloneEl, dragEl);\n }\n\n _this._hideClone();\n\n _dispatchEvent({\n sortable: _this,\n name: 'clone'\n });\n });\n !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events\n\n if (fallback) {\n ignoreNextClick = true;\n _this._loopId = setInterval(_this._emulateDragOver, 50);\n } else {\n // Undo what was set in _prepareDragStart before drag started\n off(document, 'mouseup', _this._onDrop);\n off(document, 'touchend', _this._onDrop);\n off(document, 'touchcancel', _this._onDrop);\n\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move';\n options.setData && options.setData.call(_this, dataTransfer, dragEl);\n }\n\n on(document, 'drop', _this); // #1276 fix:\n\n css(dragEl, 'transform', 'translateZ(0)');\n }\n\n awaitingDragStarted = true;\n _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));\n on(document, 'selectstart', _this);\n moved = true;\n\n if (Safari) {\n css(document.body, 'user-select', 'none');\n }\n },\n // Returns true - if no further action is needed (either inserted or another condition)\n _onDragOver: function _onDragOver(\n /**Event*/\n evt) {\n var el = this.el,\n target = evt.target,\n dragRect,\n targetRect,\n revert,\n options = this.options,\n group = options.group,\n activeSortable = Sortable.active,\n isOwner = activeGroup === group,\n canSort = options.sort,\n fromSortable = putSortable || activeSortable,\n vertical,\n _this = this,\n completedFired = false;\n\n if (_silent) return;\n\n function dragOverEvent(name, extra) {\n pluginEvent(name, _this, _objectSpread({\n evt: evt,\n isOwner: isOwner,\n axis: vertical ? 'vertical' : 'horizontal',\n revert: revert,\n dragRect: dragRect,\n targetRect: targetRect,\n canSort: canSort,\n fromSortable: fromSortable,\n target: target,\n completed: completed,\n onMove: function onMove(target, after) {\n return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);\n },\n changed: changed\n }, extra));\n } // Capture animation state\n\n\n function capture() {\n dragOverEvent('dragOverAnimationCapture');\n\n _this.captureAnimationState();\n\n if (_this !== fromSortable) {\n fromSortable.captureAnimationState();\n }\n } // Return invocation when dragEl is inserted (or completed)\n\n\n function completed(insertion) {\n dragOverEvent('dragOverCompleted', {\n insertion: insertion\n });\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n } else {\n activeSortable._showClone(_this);\n }\n\n if (_this !== fromSortable) {\n // Set ghost class to new sortable's ghost class\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n }\n\n if (putSortable !== _this && _this !== Sortable.active) {\n putSortable = _this;\n } else if (_this === Sortable.active && putSortable) {\n putSortable = null;\n } // Animation\n\n\n if (fromSortable === _this) {\n _this._ignoreWhileAnimating = target;\n }\n\n _this.animateAll(function () {\n dragOverEvent('dragOverAnimationComplete');\n _this._ignoreWhileAnimating = null;\n });\n\n if (_this !== fromSortable) {\n fromSortable.animateAll();\n fromSortable._ignoreWhileAnimating = null;\n }\n } // Null lastTarget if it is not inside a previously swapped element\n\n\n if (target === dragEl && !dragEl.animated || target === el && !target.animated) {\n lastTarget = null;\n } // no bubbling and not fallback\n\n\n if (!options.dragoverBubble && !evt.rootEl && target !== document) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted\n\n\n !insertion && nearestEmptyInsertDetectEvent(evt);\n }\n\n !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();\n return completedFired = true;\n } // Call when dragEl has been inserted\n\n\n function changed() {\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n _dispatchEvent({\n sortable: _this,\n name: 'change',\n toEl: el,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n originalEvent: evt\n });\n }\n\n if (evt.preventDefault !== void 0) {\n evt.cancelable && evt.preventDefault();\n }\n\n target = closest(target, options.draggable, el, true);\n dragOverEvent('dragOver');\n if (Sortable.eventCanceled) return completedFired;\n\n if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {\n return completed(false);\n }\n\n ignoreNextClick = false;\n\n if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list\n : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {\n vertical = this._getDirection(evt, target) === 'vertical';\n dragRect = getRect(dragEl);\n dragOverEvent('dragOverValid');\n if (Sortable.eventCanceled) return completedFired;\n\n if (revert) {\n parentEl = rootEl; // actualization\n\n capture();\n\n this._hideClone();\n\n dragOverEvent('revert');\n\n if (!Sortable.eventCanceled) {\n if (nextEl) {\n rootEl.insertBefore(dragEl, nextEl);\n } else {\n rootEl.appendChild(dragEl);\n }\n }\n\n return completed(true);\n }\n\n var elLastChild = lastChild(el, options.draggable);\n\n if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {\n // If already at end of list: Do not insert\n if (elLastChild === dragEl) {\n return completed(false);\n } // assign target only if condition is true\n\n\n if (elLastChild && el === evt.target) {\n target = elLastChild;\n }\n\n if (target) {\n targetRect = getRect(target);\n }\n\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {\n capture();\n el.appendChild(dragEl);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (target.parentNode === el) {\n targetRect = getRect(target);\n var direction = 0,\n targetBeforeFirstSwap,\n differentLevel = dragEl.parentNode !== el,\n differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),\n side1 = vertical ? 'top' : 'left',\n scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),\n scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;\n\n if (lastTarget !== target) {\n targetBeforeFirstSwap = targetRect[side1];\n pastFirstInvertThresh = false;\n isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;\n }\n\n direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);\n var sibling;\n\n if (direction !== 0) {\n // Check if target is beside dragEl in respective direction (ignoring hidden elements)\n var dragIndex = index(dragEl);\n\n do {\n dragIndex -= direction;\n sibling = parentEl.children[dragIndex];\n } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));\n } // If dragEl is already beside target: Do not insert\n\n\n if (direction === 0 || sibling === target) {\n return completed(false);\n }\n\n lastTarget = target;\n lastDirection = direction;\n var nextSibling = target.nextElementSibling,\n after = false;\n after = direction === 1;\n\n var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);\n\n if (moveVector !== false) {\n if (moveVector === 1 || moveVector === -1) {\n after = moveVector === 1;\n }\n\n _silent = true;\n setTimeout(_unsilent, 30);\n capture();\n\n if (after && !nextSibling) {\n el.appendChild(dragEl);\n } else {\n target.parentNode.insertBefore(dragEl, after ? nextSibling : target);\n } // Undo chrome's scroll adjustment (has no effect on other browsers)\n\n\n if (scrolledPastTop) {\n scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);\n }\n\n parentEl = dragEl.parentNode; // actualization\n // must be done before animation\n\n if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {\n targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);\n }\n\n changed();\n return completed(true);\n }\n }\n\n if (el.contains(dragEl)) {\n return completed(false);\n }\n }\n\n return false;\n },\n _ignoreWhileAnimating: null,\n _offMoveEvents: function _offMoveEvents() {\n off(document, 'mousemove', this._onTouchMove);\n off(document, 'touchmove', this._onTouchMove);\n off(document, 'pointermove', this._onTouchMove);\n off(document, 'dragover', nearestEmptyInsertDetectEvent);\n off(document, 'mousemove', nearestEmptyInsertDetectEvent);\n off(document, 'touchmove', nearestEmptyInsertDetectEvent);\n },\n _offUpEvents: function _offUpEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._onDrop);\n off(ownerDocument, 'touchend', this._onDrop);\n off(ownerDocument, 'pointerup', this._onDrop);\n off(ownerDocument, 'touchcancel', this._onDrop);\n off(document, 'selectstart', this);\n },\n _onDrop: function _onDrop(\n /**Event*/\n evt) {\n var el = this.el,\n options = this.options; // Get the index of the dragged element within its parent\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n pluginEvent('drop', this, {\n evt: evt\n });\n parentEl = dragEl && dragEl.parentNode; // Get again after plugin event\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n if (Sortable.eventCanceled) {\n this._nulling();\n\n return;\n }\n\n awaitingDragStarted = false;\n isCircumstantialInvert = false;\n pastFirstInvertThresh = false;\n clearInterval(this._loopId);\n clearTimeout(this._dragStartTimer);\n\n _cancelNextTick(this.cloneId);\n\n _cancelNextTick(this._dragStartId); // Unbind events\n\n\n if (this.nativeDraggable) {\n off(document, 'drop', this);\n off(el, 'dragstart', this._onDragStart);\n }\n\n this._offMoveEvents();\n\n this._offUpEvents();\n\n if (Safari) {\n css(document.body, 'user-select', '');\n }\n\n css(dragEl, 'transform', '');\n\n if (evt) {\n if (moved) {\n evt.cancelable && evt.preventDefault();\n !options.dropBubble && evt.stopPropagation();\n }\n\n ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n // Remove clone(s)\n cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);\n }\n\n if (dragEl) {\n if (this.nativeDraggable) {\n off(dragEl, 'dragend', this);\n }\n\n _disableDraggable(dragEl);\n\n dragEl.style['will-change'] = ''; // Remove classes\n // ghostClass is added in dragStarted\n\n if (moved && !awaitingDragStarted) {\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);\n }\n\n toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event\n\n _dispatchEvent({\n sortable: this,\n name: 'unchoose',\n toEl: parentEl,\n newIndex: null,\n newDraggableIndex: null,\n originalEvent: evt\n });\n\n if (rootEl !== parentEl) {\n if (newIndex >= 0) {\n // Add event\n _dispatchEvent({\n rootEl: parentEl,\n name: 'add',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n }); // Remove event\n\n\n _dispatchEvent({\n sortable: this,\n name: 'remove',\n toEl: parentEl,\n originalEvent: evt\n }); // drag from one list and drop into another\n\n\n _dispatchEvent({\n rootEl: parentEl,\n name: 'sort',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n\n putSortable && putSortable.save();\n } else {\n if (newIndex !== oldIndex) {\n if (newIndex >= 0) {\n // drag & drop within the same list\n _dispatchEvent({\n sortable: this,\n name: 'update',\n toEl: parentEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n }\n }\n\n if (Sortable.active) {\n /* jshint eqnull:true */\n if (newIndex == null || newIndex === -1) {\n newIndex = oldIndex;\n newDraggableIndex = oldDraggableIndex;\n }\n\n _dispatchEvent({\n sortable: this,\n name: 'end',\n toEl: parentEl,\n originalEvent: evt\n }); // Save sorting\n\n\n this.save();\n }\n }\n }\n\n this._nulling();\n },\n _nulling: function _nulling() {\n pluginEvent('nulling', this);\n rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;\n savedInputChecked.forEach(function (el) {\n el.checked = true;\n });\n savedInputChecked.length = lastDx = lastDy = 0;\n },\n handleEvent: function handleEvent(\n /**Event*/\n evt) {\n switch (evt.type) {\n case 'drop':\n case 'dragend':\n this._onDrop(evt);\n\n break;\n\n case 'dragenter':\n case 'dragover':\n if (dragEl) {\n this._onDragOver(evt);\n\n _globalDragOver(evt);\n }\n\n break;\n\n case 'selectstart':\n evt.preventDefault();\n break;\n }\n },\n\n /**\n * Serializes the item into an array of string.\n * @returns {String[]}\n */\n toArray: function toArray() {\n var order = [],\n el,\n children = this.el.children,\n i = 0,\n n = children.length,\n options = this.options;\n\n for (; i < n; i++) {\n el = children[i];\n\n if (closest(el, options.draggable, this.el, false)) {\n order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));\n }\n }\n\n return order;\n },\n\n /**\n * Sorts the elements according to the array.\n * @param {String[]} order order of the items\n */\n sort: function sort(order, useAnimation) {\n var items = {},\n rootEl = this.el;\n this.toArray().forEach(function (id, i) {\n var el = rootEl.children[i];\n\n if (closest(el, this.options.draggable, rootEl, false)) {\n items[id] = el;\n }\n }, this);\n useAnimation && this.captureAnimationState();\n order.forEach(function (id) {\n if (items[id]) {\n rootEl.removeChild(items[id]);\n rootEl.appendChild(items[id]);\n }\n });\n useAnimation && this.animateAll();\n },\n\n /**\n * Save the current sorting\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n\n /**\n * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.\n * @param {HTMLElement} el\n * @param {String} [selector] default: `options.draggable`\n * @returns {HTMLElement|null}\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n\n /**\n * Set/get option\n * @param {string} name\n * @param {*} [value]\n * @returns {*}\n */\n option: function option(name, value) {\n var options = this.options;\n\n if (value === void 0) {\n return options[name];\n } else {\n var modifiedValue = PluginManager.modifyOption(this, name, value);\n\n if (typeof modifiedValue !== 'undefined') {\n options[name] = modifiedValue;\n } else {\n options[name] = value;\n }\n\n if (name === 'group') {\n _prepareGroup(options);\n }\n }\n },\n\n /**\n * Destroy\n */\n destroy: function destroy() {\n pluginEvent('destroy', this);\n var el = this.el;\n el[expando] = null;\n off(el, 'mousedown', this._onTapStart);\n off(el, 'touchstart', this._onTapStart);\n off(el, 'pointerdown', this._onTapStart);\n\n if (this.nativeDraggable) {\n off(el, 'dragover', this);\n off(el, 'dragenter', this);\n } // Remove draggable attributes\n\n\n Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {\n el.removeAttribute('draggable');\n });\n\n this._onDrop();\n\n this._disableDelayedDragEvents();\n\n sortables.splice(sortables.indexOf(this.el), 1);\n this.el = el = null;\n },\n _hideClone: function _hideClone() {\n if (!cloneHidden) {\n pluginEvent('hideClone', this);\n if (Sortable.eventCanceled) return;\n css(cloneEl, 'display', 'none');\n\n if (this.options.removeCloneOnHide && cloneEl.parentNode) {\n cloneEl.parentNode.removeChild(cloneEl);\n }\n\n cloneHidden = true;\n }\n },\n _showClone: function _showClone(putSortable) {\n if (putSortable.lastPutMode !== 'clone') {\n this._hideClone();\n\n return;\n }\n\n if (cloneHidden) {\n pluginEvent('showClone', this);\n if (Sortable.eventCanceled) return; // show clone at dragEl or original position\n\n if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {\n rootEl.insertBefore(cloneEl, dragEl);\n } else if (nextEl) {\n rootEl.insertBefore(cloneEl, nextEl);\n } else {\n rootEl.appendChild(cloneEl);\n }\n\n if (this.options.group.revertClone) {\n this.animate(dragEl, cloneEl);\n }\n\n css(cloneEl, 'display', '');\n cloneHidden = false;\n }\n }\n};\n\nfunction _globalDragOver(\n/**Event*/\nevt) {\n if (evt.dataTransfer) {\n evt.dataTransfer.dropEffect = 'move';\n }\n\n evt.cancelable && evt.preventDefault();\n}\n\nfunction _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {\n var evt,\n sortable = fromEl[expando],\n onMoveFn = sortable.options.onMove,\n retVal; // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent('move', {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent('move', true, true);\n }\n\n evt.to = toEl;\n evt.from = fromEl;\n evt.dragged = dragEl;\n evt.draggedRect = dragRect;\n evt.related = targetEl || toEl;\n evt.relatedRect = targetRect || getRect(toEl);\n evt.willInsertAfter = willInsertAfter;\n evt.originalEvent = originalEvent;\n fromEl.dispatchEvent(evt);\n\n if (onMoveFn) {\n retVal = onMoveFn.call(sortable, evt, originalEvent);\n }\n\n return retVal;\n}\n\nfunction _disableDraggable(el) {\n el.draggable = false;\n}\n\nfunction _unsilent() {\n _silent = false;\n}\n\nfunction _ghostIsLast(evt, vertical, sortable) {\n var rect = getRect(lastChild(sortable.el, sortable.options.draggable));\n var spacer = 10;\n return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer;\n}\n\nfunction _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {\n var mouseOnAxis = vertical ? evt.clientY : evt.clientX,\n targetLength = vertical ? targetRect.height : targetRect.width,\n targetS1 = vertical ? targetRect.top : targetRect.left,\n targetS2 = vertical ? targetRect.bottom : targetRect.right,\n invert = false;\n\n if (!invertSwap) {\n // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold\n if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {\n // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2\n // check if past first invert threshold on side opposite of lastDirection\n if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {\n // past first invert threshold, do not restrict inverted threshold to dragEl shadow\n pastFirstInvertThresh = true;\n }\n\n if (!pastFirstInvertThresh) {\n // dragEl shadow (target move distance shadow)\n if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow\n : mouseOnAxis > targetS2 - targetMoveDistance) {\n return -lastDirection;\n }\n } else {\n invert = true;\n }\n } else {\n // Regular\n if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {\n return _getInsertDirection(target);\n }\n }\n }\n\n invert = invert || invertSwap;\n\n if (invert) {\n // Invert of regular\n if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {\n return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;\n }\n }\n\n return 0;\n}\n/**\n * Gets the direction dragEl must be swapped relative to target in order to make it\n * seem that dragEl has been \"inserted\" into that element's position\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\n * @return {Number} Direction dragEl must be swapped\n */\n\n\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n/**\n * Generate id\n * @param {HTMLElement} el\n * @returns {String}\n * @private\n */\n\n\nfunction _generateId(el) {\n var str = el.tagName + el.className + el.src + el.href + el.textContent,\n i = str.length,\n sum = 0;\n\n while (i--) {\n sum += str.charCodeAt(i);\n }\n\n return sum.toString(36);\n}\n\nfunction _saveInputCheckedState(root) {\n savedInputChecked.length = 0;\n var inputs = root.getElementsByTagName('input');\n var idx = inputs.length;\n\n while (idx--) {\n var el = inputs[idx];\n el.checked && savedInputChecked.push(el);\n }\n}\n\nfunction _nextTick(fn) {\n return setTimeout(fn, 0);\n}\n\nfunction _cancelNextTick(id) {\n return clearTimeout(id);\n} // Fixed #973:\n\n\nif (documentExists) {\n on(document, 'touchmove', function (evt) {\n if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {\n evt.preventDefault();\n }\n });\n} // Export utils\n\n\nSortable.utils = {\n on: on,\n off: off,\n css: css,\n find: find,\n is: function is(el, selector) {\n return !!closest(el, selector, el, false);\n },\n extend: extend,\n throttle: throttle,\n closest: closest,\n toggleClass: toggleClass,\n clone: clone,\n index: index,\n nextTick: _nextTick,\n cancelNextTick: _cancelNextTick,\n detectDirection: _detectDirection,\n getChild: getChild\n};\n/**\n * Get the Sortable instance of an element\n * @param {HTMLElement} element The element\n * @return {Sortable|undefined} The instance of Sortable\n */\n\nSortable.get = function (element) {\n return element[expando];\n};\n/**\n * Mount a plugin to Sortable\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\n */\n\n\nSortable.mount = function () {\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n\n if (plugins[0].constructor === Array) plugins = plugins[0];\n plugins.forEach(function (plugin) {\n if (!plugin.prototype || !plugin.prototype.constructor) {\n throw \"Sortable: Mounted plugin must be a constructor function, not \".concat({}.toString.call(plugin));\n }\n\n if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils);\n PluginManager.mount(plugin);\n });\n};\n/**\n * Create sortable instance\n * @param {HTMLElement} el\n * @param {Object} [options]\n */\n\n\nSortable.create = function (el, options) {\n return new Sortable(el, options);\n}; // Export\n\n\nSortable.version = version;\n\nvar autoScrolls = [],\n scrollEl,\n scrollRootEl,\n scrolling = false,\n lastAutoScrollX,\n lastAutoScrollY,\n touchEvt$1,\n pointerElemChangedInterval;\n\nfunction AutoScrollPlugin() {\n function AutoScroll() {\n this.defaults = {\n scroll: true,\n scrollSensitivity: 30,\n scrollSpeed: 10,\n bubbleScroll: true\n }; // Bind all private methods\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n }\n\n AutoScroll.prototype = {\n dragStarted: function dragStarted(_ref) {\n var originalEvent = _ref.originalEvent;\n\n if (this.sortable.nativeDraggable) {\n on(document, 'dragover', this._handleAutoScroll);\n } else {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._handleFallbackAutoScroll);\n } else if (originalEvent.touches) {\n on(document, 'touchmove', this._handleFallbackAutoScroll);\n } else {\n on(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref2) {\n var originalEvent = _ref2.originalEvent;\n\n // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)\n if (!this.options.dragOverBubble && !originalEvent.rootEl) {\n this._handleAutoScroll(originalEvent);\n }\n },\n drop: function drop() {\n if (this.sortable.nativeDraggable) {\n off(document, 'dragover', this._handleAutoScroll);\n } else {\n off(document, 'pointermove', this._handleFallbackAutoScroll);\n off(document, 'touchmove', this._handleFallbackAutoScroll);\n off(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n\n clearPointerElemChangedInterval();\n clearAutoScrolls();\n cancelThrottle();\n },\n nulling: function nulling() {\n touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;\n autoScrolls.length = 0;\n },\n _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {\n this._handleAutoScroll(evt, true);\n },\n _handleAutoScroll: function _handleAutoScroll(evt, fallback) {\n var _this = this;\n\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n elem = document.elementFromPoint(x, y);\n touchEvt$1 = evt; // IE does not seem to have native autoscroll,\n // Edge's autoscroll seems too conditional,\n // MACOS Safari does not have autoscroll,\n // Firefox and Chrome are good\n\n if (fallback || Edge || IE11OrLess || Safari) {\n autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change\n\n var ogElemScroller = getParentAutoScrollElement(elem, true);\n\n if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {\n pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour\n\n pointerElemChangedInterval = setInterval(function () {\n var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);\n\n if (newElem !== ogElemScroller) {\n ogElemScroller = newElem;\n clearAutoScrolls();\n }\n\n autoScroll(evt, _this.options, newElem, fallback);\n }, 10);\n lastAutoScrollX = x;\n lastAutoScrollY = y;\n }\n } else {\n // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll\n if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {\n clearAutoScrolls();\n return;\n }\n\n autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);\n }\n }\n };\n return _extends(AutoScroll, {\n pluginName: 'scroll',\n initializeByDefault: true\n });\n}\n\nfunction clearAutoScrolls() {\n autoScrolls.forEach(function (autoScroll) {\n clearInterval(autoScroll.pid);\n });\n autoScrolls = [];\n}\n\nfunction clearPointerElemChangedInterval() {\n clearInterval(pointerElemChangedInterval);\n}\n\nvar autoScroll = throttle(function (evt, options, rootEl, isFallback) {\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n if (!options.scroll) return;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n sens = options.scrollSensitivity,\n speed = options.scrollSpeed,\n winScroller = getWindowScrollingElement();\n var scrollThisInstance = false,\n scrollCustomFn; // New scroll root, set scrollEl\n\n if (scrollRootEl !== rootEl) {\n scrollRootEl = rootEl;\n clearAutoScrolls();\n scrollEl = options.scroll;\n scrollCustomFn = options.scrollFn;\n\n if (scrollEl === true) {\n scrollEl = getParentAutoScrollElement(rootEl, true);\n }\n }\n\n var layersOut = 0;\n var currentParent = scrollEl;\n\n do {\n var el = currentParent,\n rect = getRect(el),\n top = rect.top,\n bottom = rect.bottom,\n left = rect.left,\n right = rect.right,\n width = rect.width,\n height = rect.height,\n canScrollX = void 0,\n canScrollY = void 0,\n scrollWidth = el.scrollWidth,\n scrollHeight = el.scrollHeight,\n elCSS = css(el),\n scrollPosX = el.scrollLeft,\n scrollPosY = el.scrollTop;\n\n if (el === winScroller) {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');\n } else {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');\n }\n\n var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);\n var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);\n\n if (!autoScrolls[layersOut]) {\n for (var i = 0; i <= layersOut; i++) {\n if (!autoScrolls[i]) {\n autoScrolls[i] = {};\n }\n }\n }\n\n if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {\n autoScrolls[layersOut].el = el;\n autoScrolls[layersOut].vx = vx;\n autoScrolls[layersOut].vy = vy;\n clearInterval(autoScrolls[layersOut].pid);\n\n if (vx != 0 || vy != 0) {\n scrollThisInstance = true;\n /* jshint loopfunc:true */\n\n autoScrolls[layersOut].pid = setInterval(function () {\n // emulate drag over during autoscroll (fallback), emulating native DnD behaviour\n if (isFallback && this.layer === 0) {\n Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely\n\n }\n\n var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;\n var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;\n\n if (typeof scrollCustomFn === 'function') {\n if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {\n return;\n }\n }\n\n scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);\n }.bind({\n layer: layersOut\n }), 24);\n }\n }\n\n layersOut++;\n } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));\n\n scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not\n}, 30);\n\nvar drop = function drop(_ref) {\n var originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n dragEl = _ref.dragEl,\n activeSortable = _ref.activeSortable,\n dispatchSortableEvent = _ref.dispatchSortableEvent,\n hideGhostForTarget = _ref.hideGhostForTarget,\n unhideGhostForTarget = _ref.unhideGhostForTarget;\n if (!originalEvent) return;\n var toSortable = putSortable || activeSortable;\n hideGhostForTarget();\n var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;\n var target = document.elementFromPoint(touch.clientX, touch.clientY);\n unhideGhostForTarget();\n\n if (toSortable && !toSortable.el.contains(target)) {\n dispatchSortableEvent('spill');\n this.onSpill({\n dragEl: dragEl,\n putSortable: putSortable\n });\n }\n};\n\nfunction Revert() {}\n\nRevert.prototype = {\n startIndex: null,\n dragStart: function dragStart(_ref2) {\n var oldDraggableIndex = _ref2.oldDraggableIndex;\n this.startIndex = oldDraggableIndex;\n },\n onSpill: function onSpill(_ref3) {\n var dragEl = _ref3.dragEl,\n putSortable = _ref3.putSortable;\n this.sortable.captureAnimationState();\n\n if (putSortable) {\n putSortable.captureAnimationState();\n }\n\n var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);\n\n if (nextSibling) {\n this.sortable.el.insertBefore(dragEl, nextSibling);\n } else {\n this.sortable.el.appendChild(dragEl);\n }\n\n this.sortable.animateAll();\n\n if (putSortable) {\n putSortable.animateAll();\n }\n },\n drop: drop\n};\n\n_extends(Revert, {\n pluginName: 'revertOnSpill'\n});\n\nfunction Remove() {}\n\nRemove.prototype = {\n onSpill: function onSpill(_ref4) {\n var dragEl = _ref4.dragEl,\n putSortable = _ref4.putSortable;\n var parentSortable = putSortable || this.sortable;\n parentSortable.captureAnimationState();\n dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n parentSortable.animateAll();\n },\n drop: drop\n};\n\n_extends(Remove, {\n pluginName: 'removeOnSpill'\n});\n\nvar lastSwapEl;\n\nfunction SwapPlugin() {\n function Swap() {\n this.defaults = {\n swapClass: 'sortable-swap-highlight'\n };\n }\n\n Swap.prototype = {\n dragStart: function dragStart(_ref) {\n var dragEl = _ref.dragEl;\n lastSwapEl = dragEl;\n },\n dragOverValid: function dragOverValid(_ref2) {\n var completed = _ref2.completed,\n target = _ref2.target,\n onMove = _ref2.onMove,\n activeSortable = _ref2.activeSortable,\n changed = _ref2.changed,\n cancel = _ref2.cancel;\n if (!activeSortable.options.swap) return;\n var el = this.sortable.el,\n options = this.options;\n\n if (target && target !== el) {\n var prevSwapEl = lastSwapEl;\n\n if (onMove(target) !== false) {\n toggleClass(target, options.swapClass, true);\n lastSwapEl = target;\n } else {\n lastSwapEl = null;\n }\n\n if (prevSwapEl && prevSwapEl !== lastSwapEl) {\n toggleClass(prevSwapEl, options.swapClass, false);\n }\n }\n\n changed();\n completed(true);\n cancel();\n },\n drop: function drop(_ref3) {\n var activeSortable = _ref3.activeSortable,\n putSortable = _ref3.putSortable,\n dragEl = _ref3.dragEl;\n var toSortable = putSortable || this.sortable;\n var options = this.options;\n lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);\n\n if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {\n if (dragEl !== lastSwapEl) {\n toSortable.captureAnimationState();\n if (toSortable !== activeSortable) activeSortable.captureAnimationState();\n swapNodes(dragEl, lastSwapEl);\n toSortable.animateAll();\n if (toSortable !== activeSortable) activeSortable.animateAll();\n }\n }\n },\n nulling: function nulling() {\n lastSwapEl = null;\n }\n };\n return _extends(Swap, {\n pluginName: 'swap',\n eventProperties: function eventProperties() {\n return {\n swapItem: lastSwapEl\n };\n }\n });\n}\n\nfunction swapNodes(n1, n2) {\n var p1 = n1.parentNode,\n p2 = n2.parentNode,\n i1,\n i2;\n if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;\n i1 = index(n1);\n i2 = index(n2);\n\n if (p1.isEqualNode(p2) && i1 < i2) {\n i2++;\n }\n\n p1.insertBefore(n2, p1.children[i1]);\n p2.insertBefore(n1, p2.children[i2]);\n}\n\nvar multiDragElements = [],\n multiDragClones = [],\n lastMultiDragSelect,\n // for selection with modifier key down (SHIFT)\nmultiDragSortable,\n initialFolding = false,\n // Initial multi-drag fold when drag started\nfolding = false,\n // Folding any other time\ndragStarted = false,\n dragEl$1,\n clonesFromRect,\n clonesHidden;\n\nfunction MultiDragPlugin() {\n function MultiDrag(sortable) {\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n\n if (sortable.options.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\n }\n\n on(document, 'keydown', this._checkKeyDown);\n on(document, 'keyup', this._checkKeyUp);\n this.defaults = {\n selectedClass: 'sortable-selected',\n multiDragKey: null,\n setData: function setData(dataTransfer, dragEl) {\n var data = '';\n\n if (multiDragElements.length && multiDragSortable === sortable) {\n multiDragElements.forEach(function (multiDragElement, i) {\n data += (!i ? '' : ', ') + multiDragElement.textContent;\n });\n } else {\n data = dragEl.textContent;\n }\n\n dataTransfer.setData('Text', data);\n }\n };\n }\n\n MultiDrag.prototype = {\n multiDragKeyDown: false,\n isMultiDrag: false,\n delayStartGlobal: function delayStartGlobal(_ref) {\n var dragged = _ref.dragEl;\n dragEl$1 = dragged;\n },\n delayEnded: function delayEnded() {\n this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);\n },\n setupClone: function setupClone(_ref2) {\n var sortable = _ref2.sortable,\n cancel = _ref2.cancel;\n if (!this.isMultiDrag) return;\n\n for (var i = 0; i < multiDragElements.length; i++) {\n multiDragClones.push(clone(multiDragElements[i]));\n multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;\n multiDragClones[i].draggable = false;\n multiDragClones[i].style['will-change'] = '';\n toggleClass(multiDragClones[i], this.options.selectedClass, false);\n multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);\n }\n\n sortable._hideClone();\n\n cancel();\n },\n clone: function clone(_ref3) {\n var sortable = _ref3.sortable,\n rootEl = _ref3.rootEl,\n dispatchSortableEvent = _ref3.dispatchSortableEvent,\n cancel = _ref3.cancel;\n if (!this.isMultiDrag) return;\n\n if (!this.options.removeCloneOnHide) {\n if (multiDragElements.length && multiDragSortable === sortable) {\n insertMultiDragClones(true, rootEl);\n dispatchSortableEvent('clone');\n cancel();\n }\n }\n },\n showClone: function showClone(_ref4) {\n var cloneNowShown = _ref4.cloneNowShown,\n rootEl = _ref4.rootEl,\n cancel = _ref4.cancel;\n if (!this.isMultiDrag) return;\n insertMultiDragClones(false, rootEl);\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', '');\n });\n cloneNowShown();\n clonesHidden = false;\n cancel();\n },\n hideClone: function hideClone(_ref5) {\n var _this = this;\n\n var sortable = _ref5.sortable,\n cloneNowHidden = _ref5.cloneNowHidden,\n cancel = _ref5.cancel;\n if (!this.isMultiDrag) return;\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', 'none');\n\n if (_this.options.removeCloneOnHide && clone.parentNode) {\n clone.parentNode.removeChild(clone);\n }\n });\n cloneNowHidden();\n clonesHidden = true;\n cancel();\n },\n dragStartGlobal: function dragStartGlobal(_ref6) {\n var sortable = _ref6.sortable;\n\n if (!this.isMultiDrag && multiDragSortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n }\n\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.sortableIndex = index(multiDragElement);\n }); // Sort multi-drag elements\n\n multiDragElements = multiDragElements.sort(function (a, b) {\n return a.sortableIndex - b.sortableIndex;\n });\n dragStarted = true;\n },\n dragStarted: function dragStarted(_ref7) {\n var _this2 = this;\n\n var sortable = _ref7.sortable;\n if (!this.isMultiDrag) return;\n\n if (this.options.sort) {\n // Capture rects,\n // hide multi drag elements (by positioning them absolute),\n // set multi drag elements rects to dragRect,\n // show multi drag elements,\n // animate to rects,\n // unset rects & remove from DOM\n sortable.captureAnimationState();\n\n if (this.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n css(multiDragElement, 'position', 'absolute');\n });\n var dragRect = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRect);\n });\n folding = true;\n initialFolding = true;\n }\n }\n\n sortable.animateAll(function () {\n folding = false;\n initialFolding = false;\n\n if (_this2.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n } // Remove all auxiliary multidrag items from el, if sorting enabled\n\n\n if (_this2.options.sort) {\n removeMultiDragElements();\n }\n });\n },\n dragOver: function dragOver(_ref8) {\n var target = _ref8.target,\n completed = _ref8.completed,\n cancel = _ref8.cancel;\n\n if (folding && ~multiDragElements.indexOf(target)) {\n completed(false);\n cancel();\n }\n },\n revert: function revert(_ref9) {\n var fromSortable = _ref9.fromSortable,\n rootEl = _ref9.rootEl,\n sortable = _ref9.sortable,\n dragRect = _ref9.dragRect;\n\n if (multiDragElements.length > 1) {\n // Setup unfold animation\n multiDragElements.forEach(function (multiDragElement) {\n sortable.addAnimationState({\n target: multiDragElement,\n rect: folding ? getRect(multiDragElement) : dragRect\n });\n unsetRect(multiDragElement);\n multiDragElement.fromRect = dragRect;\n fromSortable.removeAnimationState(multiDragElement);\n });\n folding = false;\n insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref10) {\n var sortable = _ref10.sortable,\n isOwner = _ref10.isOwner,\n insertion = _ref10.insertion,\n activeSortable = _ref10.activeSortable,\n parentEl = _ref10.parentEl,\n putSortable = _ref10.putSortable;\n var options = this.options;\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n }\n\n initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location\n\n if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {\n // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible\n var dragRectAbsolute = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted\n // while folding, and so that we can capture them again because old sortable will no longer be fromSortable\n\n parentEl.appendChild(multiDragElement);\n });\n folding = true;\n } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out\n\n\n if (!isOwner) {\n // Only remove if not folding (folding will remove them anyways)\n if (!folding) {\n removeMultiDragElements();\n }\n\n if (multiDragElements.length > 1) {\n var clonesHiddenBefore = clonesHidden;\n\n activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden\n\n\n if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {\n multiDragClones.forEach(function (clone) {\n activeSortable.addAnimationState({\n target: clone,\n rect: clonesFromRect\n });\n clone.fromRect = clonesFromRect;\n clone.thisAnimationDuration = null;\n });\n }\n } else {\n activeSortable._showClone(sortable);\n }\n }\n }\n },\n dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {\n var dragRect = _ref11.dragRect,\n isOwner = _ref11.isOwner,\n activeSortable = _ref11.activeSortable;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n });\n\n if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {\n clonesFromRect = _extends({}, dragRect);\n var dragMatrix = matrix(dragEl$1, true);\n clonesFromRect.top -= dragMatrix.f;\n clonesFromRect.left -= dragMatrix.e;\n }\n },\n dragOverAnimationComplete: function dragOverAnimationComplete() {\n if (folding) {\n folding = false;\n removeMultiDragElements();\n }\n },\n drop: function drop(_ref12) {\n var evt = _ref12.originalEvent,\n rootEl = _ref12.rootEl,\n parentEl = _ref12.parentEl,\n sortable = _ref12.sortable,\n dispatchSortableEvent = _ref12.dispatchSortableEvent,\n oldIndex = _ref12.oldIndex,\n putSortable = _ref12.putSortable;\n var toSortable = putSortable || this.sortable;\n if (!evt) return;\n var options = this.options,\n children = parentEl.children; // Multi-drag selection\n\n if (!dragStarted) {\n if (options.multiDragKey && !this.multiDragKeyDown) {\n this._deselectMultiDrag();\n }\n\n toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));\n\n if (!~multiDragElements.indexOf(dragEl$1)) {\n multiDragElements.push(dragEl$1);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: dragEl$1,\n originalEvt: evt\n }); // Modifier activated, select from last to dragEl\n\n if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {\n var lastIndex = index(lastMultiDragSelect),\n currentIndex = index(dragEl$1);\n\n if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {\n // Must include lastMultiDragSelect (select it), in case modified selection from no selection\n // (but previous selection existed)\n var n, i;\n\n if (currentIndex > lastIndex) {\n i = lastIndex;\n n = currentIndex;\n } else {\n i = currentIndex;\n n = lastIndex + 1;\n }\n\n for (; i < n; i++) {\n if (~multiDragElements.indexOf(children[i])) continue;\n toggleClass(children[i], options.selectedClass, true);\n multiDragElements.push(children[i]);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: children[i],\n originalEvt: evt\n });\n }\n }\n } else {\n lastMultiDragSelect = dragEl$1;\n }\n\n multiDragSortable = toSortable;\n } else {\n multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);\n lastMultiDragSelect = null;\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'deselect',\n targetEl: dragEl$1,\n originalEvt: evt\n });\n }\n } // Multi-drag drop\n\n\n if (dragStarted && this.isMultiDrag) {\n // Do not \"unfold\" after around dragEl if reverted\n if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {\n var dragRect = getRect(dragEl$1),\n multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');\n if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;\n toSortable.captureAnimationState();\n\n if (!initialFolding) {\n if (options.animation) {\n dragEl$1.fromRect = dragRect;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n\n if (multiDragElement !== dragEl$1) {\n var rect = folding ? getRect(multiDragElement) : dragRect;\n multiDragElement.fromRect = rect; // Prepare unfold animation\n\n toSortable.addAnimationState({\n target: multiDragElement,\n rect: rect\n });\n }\n });\n } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert\n // properly they must all be removed\n\n\n removeMultiDragElements();\n multiDragElements.forEach(function (multiDragElement) {\n if (children[multiDragIndex]) {\n parentEl.insertBefore(multiDragElement, children[multiDragIndex]);\n } else {\n parentEl.appendChild(multiDragElement);\n }\n\n multiDragIndex++;\n }); // If initial folding is done, the elements may have changed position because they are now\n // unfolding around dragEl, even though dragEl may not have his index changed, so update event\n // must be fired here as Sortable will not.\n\n if (oldIndex === index(dragEl$1)) {\n var update = false;\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement.sortableIndex !== index(multiDragElement)) {\n update = true;\n return;\n }\n });\n\n if (update) {\n dispatchSortableEvent('update');\n }\n }\n } // Must be done after capturing individual rects (scroll bar)\n\n\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n toSortable.animateAll();\n }\n\n multiDragSortable = toSortable;\n } // Remove clones if necessary\n\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n multiDragClones.forEach(function (clone) {\n clone.parentNode && clone.parentNode.removeChild(clone);\n });\n }\n },\n nullingGlobal: function nullingGlobal() {\n this.isMultiDrag = dragStarted = false;\n multiDragClones.length = 0;\n },\n destroyGlobal: function destroyGlobal() {\n this._deselectMultiDrag();\n\n off(document, 'pointerup', this._deselectMultiDrag);\n off(document, 'mouseup', this._deselectMultiDrag);\n off(document, 'touchend', this._deselectMultiDrag);\n off(document, 'keydown', this._checkKeyDown);\n off(document, 'keyup', this._checkKeyUp);\n },\n _deselectMultiDrag: function _deselectMultiDrag(evt) {\n if (typeof dragStarted !== \"undefined\" && dragStarted) return; // Only deselect if selection is in this sortable\n\n if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable\n\n if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click\n\n if (evt && evt.button !== 0) return;\n\n while (multiDragElements.length) {\n var el = multiDragElements[0];\n toggleClass(el, this.options.selectedClass, false);\n multiDragElements.shift();\n dispatchEvent({\n sortable: this.sortable,\n rootEl: this.sortable.el,\n name: 'deselect',\n targetEl: el,\n originalEvt: evt\n });\n }\n },\n _checkKeyDown: function _checkKeyDown(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = true;\n }\n },\n _checkKeyUp: function _checkKeyUp(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = false;\n }\n }\n };\n return _extends(MultiDrag, {\n // Static methods & properties\n pluginName: 'multiDrag',\n utils: {\n /**\r\n * Selects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be selected\r\n */\n select: function select(el) {\n var sortable = el.parentNode[expando];\n if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;\n\n if (multiDragSortable && multiDragSortable !== sortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n\n multiDragSortable = sortable;\n }\n\n toggleClass(el, sortable.options.selectedClass, true);\n multiDragElements.push(el);\n },\n\n /**\r\n * Deselects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be deselected\r\n */\n deselect: function deselect(el) {\n var sortable = el.parentNode[expando],\n index = multiDragElements.indexOf(el);\n if (!sortable || !sortable.options.multiDrag || !~index) return;\n toggleClass(el, sortable.options.selectedClass, false);\n multiDragElements.splice(index, 1);\n }\n },\n eventProperties: function eventProperties() {\n var _this3 = this;\n\n var oldIndicies = [],\n newIndicies = [];\n multiDragElements.forEach(function (multiDragElement) {\n oldIndicies.push({\n multiDragElement: multiDragElement,\n index: multiDragElement.sortableIndex\n }); // multiDragElements will already be sorted if folding\n\n var newIndex;\n\n if (folding && multiDragElement !== dragEl$1) {\n newIndex = -1;\n } else if (folding) {\n newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');\n } else {\n newIndex = index(multiDragElement);\n }\n\n newIndicies.push({\n multiDragElement: multiDragElement,\n index: newIndex\n });\n });\n return {\n items: _toConsumableArray(multiDragElements),\n clones: [].concat(multiDragClones),\n oldIndicies: oldIndicies,\n newIndicies: newIndicies\n };\n },\n optionListeners: {\n multiDragKey: function multiDragKey(key) {\n key = key.toLowerCase();\n\n if (key === 'ctrl') {\n key = 'Control';\n } else if (key.length > 1) {\n key = key.charAt(0).toUpperCase() + key.substr(1);\n }\n\n return key;\n }\n }\n });\n}\n\nfunction insertMultiDragElements(clonesInserted, rootEl) {\n multiDragElements.forEach(function (multiDragElement, i) {\n var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(multiDragElement, target);\n } else {\n rootEl.appendChild(multiDragElement);\n }\n });\n}\n/**\r\n * Insert multi-drag clones\r\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\r\n * @param {HTMLElement} rootEl\r\n */\n\n\nfunction insertMultiDragClones(elementsInserted, rootEl) {\n multiDragClones.forEach(function (clone, i) {\n var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(clone, target);\n } else {\n rootEl.appendChild(clone);\n }\n });\n}\n\nfunction removeMultiDragElements() {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);\n });\n}\n\nSortable.mount(new AutoScrollPlugin());\nSortable.mount(Remove, Revert);\n\nexport default Sortable;\nexport { MultiDragPlugin as MultiDrag, Sortable, SwapPlugin as Swap };\n","import Modal from \"flarum/components/Modal\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Button from \"flarum/components/Button\";\nimport Switch from \"flarum/components/Switch\";\nimport Stream from \"flarum/utils/Stream\";\n\nexport default class ConfirmModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return \"Modal--small FlarumBadgesConfirmModal\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.admin.confirm_dialog.title`\n );\n }\n\n content() {\n return [\n
\n

{this.attrs.text}

\n
,\n\n
\n {Button.component(\n {\n className: \"Button\",\n disabled: this.loading,\n onclick: () => this.hide(),\n },\n app.translator.trans(\n \"v17development-flarum-badges.admin.confirm_dialog.no\"\n )\n )}\n {Button.component(\n {\n className: \"Button Button--primary\",\n loading: this.loading,\n onclick: () => this.confirm(),\n },\n app.translator.trans(\n \"v17development-flarum-badges.admin.confirm_dialog.yes\"\n )\n )}\n
,\n ];\n }\n\n /**\n * Confirm\n */\n confirm() {\n // Act as promise\n if (this.attrs.promise) {\n this.loading = true;\n\n this.attrs.onconfirm(\n () => this.hide(),\n () => {\n this.loading = false;\n m.redraw();\n }\n );\n return;\n }\n\n this.attrs.onconfirm();\n this.hide();\n }\n}\n","import Modal from \"flarum/components/Modal\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Button from \"flarum/components/Button\";\nimport Switch from \"flarum/components/Switch\";\nimport Stream from \"flarum/utils/Stream\";\n\nexport default class EditBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Badge model\n this.badge = this.attrs.badge\n ? this.attrs.badge\n : app.store.createRecord(\"badges\");\n\n // Name\n this.name = Stream(this.badge.name());\n\n // Icon\n this.icon = Stream(this.badge.icon());\n\n // Description\n this.description = Stream(this.badge.description());\n\n // Is visible\n this.isVisible = Stream(this.badge.exists ? this.badge.isVisible() : true);\n }\n\n className() {\n return \"Modal--small\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.admin.${\n this.badge.exists ? \"update_badge\" : \"new_badge\"\n }`\n );\n }\n\n content() {\n return [\n
\n
{this.data().toArray()}
\n
,\n
\n {Button.component(\n {\n type: \"submit\",\n className: \"Button Button--primary\",\n loading: this.loading,\n },\n app.translator.trans(\"core.admin.settings.submit_button\")\n )}\n
,\n ];\n }\n\n data() {\n const items = new ItemList();\n\n items.add(\n \"name\",\n
\n \n \n
,\n 50\n );\n\n items.add(\n \"icon\",\n
\n \n \n \n
,\n 50\n );\n\n items.add(\n \"description\",\n
\n \n \n
,\n 50\n );\n\n // Enabled\n items.add(\n \"enabled\",\n
\n {Switch.component(\n {\n state: this.isVisible() == true,\n onchange: (val) => this.isVisible(val),\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge.visible\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge.visible_description\"\n )}\n
,\n ]\n )}\n
,\n 50\n );\n\n return items;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n name: this.name(),\n icon: this.icon(),\n description: this.description(),\n isVisible: this.isVisible(),\n })\n .then(\n () => this.hide(),\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Component from \"flarum/common/Component\";\nimport Button from \"flarum/components/Button\";\nimport ConfirmModal from \"./ConfirmModal\";\nimport EditBadgeModal from \"./EditBadgeModal\";\n\nexport default class SortableBadge extends Component {\n oninit(attrs) {\n super.oninit(attrs);\n\n this.loading = false;\n }\n\n view() {\n const badge = this.attrs.badge;\n\n if (!badge) return null;\n\n return (\n \n
\n \n \n app.modal.show(EditBadgeModal, {\n badge,\n })\n }\n >\n {badge.name()}\n \n \n \n \n app.modal.show(EditBadgeModal, {\n badge,\n })\n }\n >\n \n \n \n app.modal.show(ConfirmModal, {\n text: app.translator.trans(\n \"v17development-flarum-badges.admin.confirm_messages.delete_badge\"\n ),\n promise: true,\n onconfirm: (resolve, reject) =>\n badge.delete().then(resolve).catch(reject),\n })\n }\n >\n \n \n \n
\n \n );\n }\n}\n","import Modal from \"flarum/components/Modal\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Button from \"flarum/components/Button\";\nimport Switch from \"flarum/components/Switch\";\nimport Stream from \"flarum/utils/Stream\";\n\nexport default class EditBadgeCategoryModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Badge model\n this.badgeCategory = this.attrs.badgeCategory\n ? this.attrs.badgeCategory\n : app.store.createRecord(\"badgeCategories\");\n\n // Name\n this.name = Stream(this.badgeCategory.name());\n\n // Description\n this.description = Stream(this.badgeCategory.description());\n\n // Is enabled\n this.isEnabled = Stream(\n this.badgeCategory.exists ? this.badgeCategory.isEnabled() : true\n );\n }\n\n className() {\n return \"Modal--small\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.admin.${\n this.badgeCategory.exists ? \"update_category\" : \"create_category\"\n }`\n );\n }\n\n content() {\n return [\n
\n
{this.data().toArray()}
\n
,\n
\n {Button.component(\n {\n type: \"submit\",\n className: \"Button Button--primary\",\n loading: this.loading,\n },\n app.translator.trans(\"core.admin.settings.submit_button\")\n )}\n
,\n ];\n }\n\n data() {\n const items = new ItemList();\n\n items.add(\n \"name\",\n
\n \n \n
,\n 50\n );\n\n items.add(\n \"description\",\n
\n \n \n
,\n 50\n );\n\n // Enabled\n items.add(\n \"enabled\",\n
\n {Switch.component(\n {\n state: this.isEnabled() == true,\n onchange: (val) => this.isEnabled(val),\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge_category.enabled\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge_category.enabled_description\"\n )}\n
,\n ]\n )}\n
,\n 50\n );\n\n return items;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badgeCategory\n .save({\n name: this.name(),\n description: this.description(),\n isEnabled: this.isEnabled(),\n })\n .then(\n () => {\n this.hide();\n\n if (this.attrs.onCreate) {\n this.attrs.onCreate();\n }\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Component from \"flarum/common/Component\";\nimport Button from \"flarum/components/Button\";\nimport saveSettings from \"flarum/utils/saveSettings\";\n\nexport default class InstallAutoModerationMessage extends Component {\n view() {\n // Message is dismissed\n if (\n typeof app.data.settings.badges_install_automoderation !== \"undefined\"\n ) {\n return null;\n }\n\n const extensionInstalled =\n typeof app.data.extensions[\"askvortsov-auto-moderator\"] !== \"undefined\";\n\n return (\n
\n
\n {app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.not_installed.title\"\n )}\n
\n
\n {app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.not_installed.content\",\n {\n a: (\n \n ),\n }\n )}\n
\n
\n \n \n\n \n {app.translator.trans(\n extensionInstalled\n ? \"core.admin.extension.open_modal\"\n : \"v17development-flarum-badges.admin.auto_moderator.not_installed.install\"\n )}\n \n \n \n saveSettings({\n badges_install_automoderation: \"dismissed\",\n })\n }\n icon={\"fas fa-times\"}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.not_installed.dismiss\"\n )}\n \n
\n
\n );\n }\n}\n","import sortable from \"sortablejs\";\nimport ExtensionPage from \"flarum/components/ExtensionPage\";\nimport LoadingIndicator from \"flarum/components/LoadingIndicator\";\nimport SortableBadge from \"./SortableBadge\";\nimport Button from \"flarum/components/Button\";\nimport EditBadgeModal from \"./EditBadgeModal\";\nimport EditBadgeCategoryModal from \"./EditBadgeCategoryModal\";\nimport ConfirmModal from \"./ConfirmModal\";\nimport InstallAutoModerationMessage from \"./InstallAutoModerationMessage\";\n\nexport default class SettingsPage extends ExtensionPage {\n oninit(attrs) {\n super.oninit(attrs);\n\n this.loading = true;\n\n this.updating = false;\n this.forcedRefreshKey = 0;\n\n app.store.find(\"badge_categories\").then(() => {\n app.store.find(\"badges\").then(() => {\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n });\n }\n\n content() {\n const categories = app.store\n .all(\"badgeCategories\")\n .sort((a, b) => a.order() - b.order());\n\n const uncategorizedBadges = app.store\n .all(\"badges\")\n .filter((badge) => badge.category() == false);\n\n return (\n
\n {app.data.settings.extensions_enabled.indexOf(\n \"askvortsov-auto-moderator\"\n ) === -1 && }\n\n
\n \n app.modal.show(EditBadgeCategoryModal, {\n onCreate: () => this.nextRefreshKey(),\n })\n }\n icon={\"fas fa-project-diagram\"}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.admin.create_category\"\n )}\n \n app.modal.show(EditBadgeModal)}\n icon={\"fas fa-icons\"}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.admin.new_badge\"\n )}\n \n
\n\n
\n {!this.loading && (\n \n {categories &&\n categories.map((category, key) => {\n return (\n \n
\n \n {!category.isEnabled() && (\n \n )}\n {category.name()}\n \n\n \n \n app.modal.show(EditBadgeCategoryModal, {\n badgeCategory: category,\n })\n }\n >\n {app.translator.trans(\n \"v17development-flarum-badges.admin.edit_category\"\n )}\n \n \n this.updateCategorySort(category, \"up\")\n }\n className={key === 0 ? \"LinkDisabled\" : null}\n >\n \n \n \n this.updateCategorySort(category, \"down\")\n }\n className={\n key === categories.length - 1\n ? \"LinkDisabled\"\n : null\n }\n >\n \n \n \n app.modal.show(ConfirmModal, {\n text: app.translator.trans(\n \"v17development-flarum-badges.admin.confirm_messages.delete_category\"\n ),\n promise: true,\n onconfirm: (resolve, reject) => {\n const badges = category.badges();\n\n category\n .delete()\n .then(() => {\n resolve();\n\n badges.forEach((badge) =>\n badge.pushData({\n relationships: {\n category: null,\n },\n })\n );\n })\n .catch(reject);\n },\n })\n }\n >\n \n \n \n
\n\n
    \n {category.badges() &&\n category\n .badges()\n .sort((a, b) => a.order() - b.order())\n .map((badge) => )}\n
\n
\n );\n })}\n\n {/* Uncategorized badges */}\n
\n
\n \n \n {app.translator.trans(\n \"v17development-flarum-badges.admin.uncategorized\"\n )}\n \n \n
\n\n
    \n {uncategorizedBadges\n .sort((a, b) => a.order() - b.order())\n .map((badge) => (\n \n ))}\n
\n
\n
\n )}\n \n\n {this.loading && }\n\n {!this.loading &&\n uncategorizedBadges.length === 0 &&\n categories.length === 0 && (\n

\n {app.translator.trans(\n \"v17development-flarum-badges.admin.nothing_here_yet\"\n )}\n

\n )}\n \n );\n }\n\n onBadgeListReady(vnode) {\n this.$(\".SortableBadges\")\n .get()\n .map((e) => {\n sortable.create(e, {\n group: \"tags\",\n animation: 150,\n swapThreshold: 0.65,\n dragClass: \"SortableBadges-dragging\",\n ghostClass: \"SortableBadges-placeholder\",\n direction: \"horizontal\",\n onSort: (e) => this.onSortUpdate(e),\n });\n });\n }\n\n /**\n *\n * @param {categoryObject} category\n * @param {string} action\n * @returns\n */\n updateCategorySort(category, action) {\n const newPosition =\n action === \"up\" ? category.order() - 1 : category.order() + 1;\n const order = [];\n\n console.log(category.id(), action, newPosition);\n\n // Bring to top\n if (newPosition <= 0) {\n order.push(category.id());\n }\n\n // Get all categories\n const categories = app.store\n .all(\"badgeCategories\")\n .sort((a, b) => a.order() - b.order());\n\n // Loop through the categories\n categories.forEach((obj, key) => {\n // Skip current category\n if (obj === category) return;\n\n // Add before current key\n if (newPosition !== 0 && key === newPosition && action === \"up\") {\n order.push(category.id());\n }\n\n // Add object\n order.push(obj.id());\n\n // Add after current key\n if (key === newPosition && action === \"down\") {\n order.push(category.id());\n }\n });\n\n // Save list\n app\n .request({\n url: app.forum.attribute(\"apiUrl\") + \"/badge_categories/order\",\n method: \"POST\",\n body: { order },\n })\n .catch((e) => console.error(e))\n .then((payload) => {\n app.store.pushPayload(payload);\n\n this.nextRefreshKey();\n });\n }\n\n /**\n * Sort badges\n */\n onSortUpdate() {\n // Skip if already updating\n if (this.updating) return;\n\n this.updating = true;\n\n // Get through the categories and find the children currently attached to them\n const order = this.$(\".FlarumBadgeCategory\")\n .map(function () {\n return {\n id: $(this).data(\"id\") ? $(this).data(\"id\") : null,\n children: $(this)\n .find(\"li\")\n .map(function () {\n return $(this).data(\"id\");\n })\n .get(),\n };\n })\n .get();\n\n app\n .request({\n url: app.forum.attribute(\"apiUrl\") + \"/badges/order\",\n method: \"POST\",\n body: { order },\n })\n .catch((e) => console.error(e))\n .then(() => {\n // Update local store\n order.map((categoryObject) => {\n const category =\n categoryObject.id !== null\n ? app.store.getById(\"badgeCategories\", categoryObject.id)\n : null;\n\n // Loop through the badges\n const badges = categoryObject.children.map(\n (badgeId, badgePosition) => {\n const badge = app.store.getById(\"badges\", badgeId);\n\n badge.pushData({\n attributes: {\n order: badgePosition,\n },\n relationships: {\n category,\n },\n });\n\n return badge;\n }\n );\n\n // Update the category\n if (category) {\n category.pushData({\n relationships: {\n badges: {\n data: badges.map((badge) => ({\n type: \"badges\",\n id: badge.id(),\n })),\n },\n },\n });\n }\n });\n\n this.updating = false;\n this.nextRefreshKey();\n });\n }\n\n nextRefreshKey() {\n this.forcedRefreshKey++;\n m.redraw();\n }\n}\n","import Badge from \"../common/models/Badge\";\nimport BadgeCategory from \"../common/models/BadgeCategory\";\nimport BadgeActionDriverSettings from \"./components/BadgeActionDriverSettings\";\nimport SettingsPage from \"./components/SettingsPage\";\n\napp.initializers.add(\"v17development-user-badges\", () => {\n app.store.models.badges = Badge;\n app.store.models.badgeCategories = BadgeCategory;\n\n // Register extension settings page\n app.extensionData\n .for(\"v17development-user-badges\")\n .registerPage(SettingsPage);\n\n app.extensionData\n .for(\"v17development-badges\")\n .registerPermission(\n {\n icon: \"fas fa-user-tag\",\n label: app.translator.trans(\n \"v17development-flarum-badges.admin.permissions.give_badge\"\n ),\n permission: \"badges.giveBadge\",\n },\n \"moderate\",\n 90\n )\n .registerPermission(\n {\n icon: \"fas fa-user-times\",\n label: app.translator.trans(\n \"v17development-flarum-badges.admin.permissions.take_badge\"\n ),\n permission: \"badges.removeBadge\",\n },\n \"moderate\",\n 90\n );\n\n // Auto moderation\n if (app.autoModeratorForms) {\n app.autoModeratorForms.action.give_badge = BadgeActionDriverSettings;\n app.autoModeratorForms.action.remove_badge = BadgeActionDriverSettings;\n\n app.autoModeratorForms.requirement.has_badge = BadgeActionDriverSettings;\n }\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@v17development/flarum-badges/webpack/bootstrap","webpack://@v17development/flarum-badges/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@v17development/flarum-badges/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@v17development/flarum-badges/external \"flarum.core.compat['Model']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Button']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['utils/Stream']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Modal']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['common/Component']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['utils/ItemList']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/LinkButton']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['utils/mixin']\"","webpack://@v17development/flarum-badges/./src/forum/components/BadgeModal.js","webpack://@v17development/flarum-badges/./src/forum/components/GiveBadgeModal.js","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Switch']\"","webpack://@v17development/flarum-badges/./src/common/models/Badge.js","webpack://@v17development/flarum-badges/external \"flarum.core.compat['helpers/fullTime']\"","webpack://@v17development/flarum-badges/./src/common/models/BadgeCategory.js","webpack://@v17development/flarum-badges/external \"flarum.core.compat['Component']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Select']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Dropdown']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['helpers/icon']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@v17development/flarum-badges/./src/admin/utils/loadBadges.js","webpack://@v17development/flarum-badges/./src/admin/components/BadgeSelector.js","webpack://@v17development/flarum-badges/./src/admin/components/BadgeActionDriverSettings.js","webpack://@v17development/flarum-badges/./node_modules/sortablejs/modular/sortable.esm.js","webpack://@v17development/flarum-badges/./src/admin/components/ConfirmModal.js","webpack://@v17development/flarum-badges/./src/admin/components/EditBadgeModal.js","webpack://@v17development/flarum-badges/./src/admin/components/SortableBadge.js","webpack://@v17development/flarum-badges/./src/admin/components/EditBadgeCategoryModal.js","webpack://@v17development/flarum-badges/./src/admin/components/InstallAutoModerationMessage.js","webpack://@v17development/flarum-badges/./src/admin/components/SettingsPage.js","webpack://@v17development/flarum-badges/./src/admin/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","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","flarum","core","compat","BadgeModal","oninit","vnode","this","loading","className","title","app","translator","trans","content","data","toArray","href","route","id","attrs","badge","style","margin","userBadgeData","forum","attribute","onclick","confirm","then","hide","items","ItemList","add","description","e","preventDefault","modal","show","GiveBadgeModal","fullTime","assignedAt","category","earnedAmount","count","Modal","selectedBadge","user","userHasBadge","store","createRecord","Stream","categories","uncategorizedBadges","find","include","badges","forEach","push","redraw","exists","fields","type","disabled","onchange","target","getById","checkUserHasBadge","values","map","label","length","class","placeholder","bidi","foundBadge","userBadges","userBadge","onsubmit","save","relationships","response","handleErrors","Badge","apiEndpoint","mixin","Model","icon","order","image","isVisible","createdAt","hasOne","BadgeCategory","isEnabled","isTable","users","hasMany","hasLoaded","onLoadedCallbacks","BadgeSelector","onLoadedCallback","loaded","cb","view","float","buttonClassName","all","g","Button","component","active","Component","BadgeActionDriverSettings","settings","badge_id","val","_typeof","obj","iterator","_defineProperty","configurable","writable","_extends","assign","arguments","source","apply","_objectSpread","ownKeys","keys","getOwnPropertySymbols","concat","filter","sym","getOwnPropertyDescriptor","_objectWithoutProperties","excluded","sourceKeys","indexOf","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","userAgent","pattern","window","navigator","match","IE11OrLess","Edge","FireFox","Safari","IOS","ChromeForAndroid","captureMode","capture","passive","on","el","event","fn","addEventListener","off","removeEventListener","matches","selector","substring","msMatchesSelector","webkitMatchesSelector","_","getParentOrHost","host","document","nodeType","parentNode","closest","ctx","includeCTX","_throttleTimeout","R_SPACE","toggleClass","state","classList","replace","css","prop","defaultView","getComputedStyle","currentStyle","matrix","selfOnly","appliedTransforms","transform","matrixFn","DOMMatrix","WebKitCSSMatrix","CSSMatrix","MSCSSMatrix","tagName","list","getElementsByTagName","getWindowScrollingElement","scrollingElement","documentElement","getRect","relativeToContainingBlock","relativeToNonStaticParent","undoScale","container","getBoundingClientRect","elRect","top","left","bottom","right","height","width","innerHeight","innerWidth","containerRect","parseInt","elMatrix","scaleX","a","scaleY","isScrolledPast","elSide","parentSide","parent","getParentAutoScrollElement","elSideVal","parentSideVal","getChild","childNum","options","currentChild","children","display","Sortable","ghost","dragged","draggable","lastChild","last","lastElementChild","previousElementSibling","index","nodeName","toUpperCase","clone","getRelativeScrollOffset","offsetLeft","offsetTop","winScroller","scrollLeft","scrollTop","includeSelf","elem","gotSelf","clientWidth","scrollWidth","clientHeight","scrollHeight","elemCSS","overflowX","overflowY","body","isRectEqual","rect1","rect2","Math","round","throttle","callback","ms","args","_this","setTimeout","scrollBy","x","y","Polymer","$","jQuery","Zepto","dom","cloneNode","expando","Date","getTime","AnimationStateManager","animationCallbackId","animationStates","captureAnimationState","animation","slice","child","rect","fromRect","thisAnimationDuration","childMatrix","f","addAnimationState","removeAnimationState","splice","arr","Number","indexOfObject","animateAll","clearTimeout","animating","animationTime","time","toRect","prevFromRect","prevToRect","animatingRect","targetMatrix","sqrt","pow","calculateRealTime","animate","max","animationResetTimer","currentRect","duration","translateX","translateY","animatingX","animatingY","forRepaintDummy","offsetWidth","repaint","easing","animated","plugins","defaults","initializeByDefault","PluginManager","mount","plugin","option","pluginName","pluginEvent","eventName","sortable","evt","eventCanceled","cancel","eventNameGlobal","initializePlugins","initialized","modified","modifyOption","getEventProperties","eventProperties","modifiedValue","optionListeners","dispatchEvent","_ref","rootEl","targetEl","cloneEl","toEl","fromEl","oldIndex","newIndex","oldDraggableIndex","newDraggableIndex","originalEvent","putSortable","extraEventProperties","onName","charAt","substr","CustomEvent","createEvent","initEvent","bubbles","cancelable","to","from","item","pullMode","lastPutMode","undefined","allEventProperties","dragEl","parentEl","ghostEl","nextEl","lastDownEl","cloneHidden","dragStarted","moved","activeSortable","hideGhostForTarget","_hideGhostForTarget","unhideGhostForTarget","_unhideGhostForTarget","cloneNowHidden","cloneNowShown","dispatchSortableEvent","_dispatchEvent","info","activeGroup","tapEvt","touchEvt","lastDx","lastDy","tapDistanceLeft","tapDistanceTop","lastTarget","lastDirection","targetMoveDistance","ghostRelativeParent","awaitingDragStarted","ignoreNextClick","sortables","pastFirstInvertThresh","isCircumstantialInvert","ghostRelativeParentInitialScroll","_silent","savedInputChecked","documentExists","PositionGhostAbsolutely","CSSFloatProperty","supportDraggable","createElement","supportCssPointerEvents","cssText","pointerEvents","_detectDirection","elCSS","elWidth","paddingLeft","paddingRight","borderLeftWidth","borderRightWidth","child1","child2","firstChildCSS","secondChildCSS","firstChildWidth","marginLeft","marginRight","secondChildWidth","flexDirection","gridTemplateColumns","split","touchingSideChild2","clear","_prepareGroup","toFn","pull","sameGroup","group","otherGroup","join","originalGroup","checkPull","checkPut","put","revertClone","stopPropagation","stopImmediatePropagation","nearestEmptyInsertDetectEvent","touches","nearest","clientX","clientY","some","threshold","emptyInsertThreshold","insideHorizontally","insideVertically","ret","_onDragOver","_checkOutsideTargetEl","_isOutsideThisEl","toString","sort","handle","test","swapThreshold","invertSwap","invertedSwapThreshold","removeCloneOnHide","direction","ghostClass","chosenClass","dragClass","ignore","preventOnFilter","setData","dataTransfer","textContent","dropBubble","dragoverBubble","dataIdAttr","delay","delayOnTouchOnly","touchStartThreshold","devicePixelRatio","forceFallback","fallbackClass","fallbackOnBody","fallbackTolerance","fallbackOffset","supportPointer","nativeDraggable","_onTapStart","_onMove","dragRect","targetRect","willInsertAfter","retVal","onMoveFn","onMove","draggedRect","related","relatedRect","_disableDraggable","_unsilent","_generateId","str","src","sum","charCodeAt","_nextTick","_cancelNextTick","contains","_getDirection","touch","pointerType","originalTarget","shadowRoot","path","composedPath","root","inputs","idx","checked","_saveInputCheckedState","button","isContentEditable","criteria","trim","_prepareDragStart","dragStartFn","ownerDocument","nextSibling","_lastX","_lastY","_onDrop","_disableDelayedDragEvents","_triggerDragStart","_disableDelayedDrag","_delayedDragTouchMoveHandler","_dragStartTimer","abs","floor","_onTouchMove","_onDragStart","selection","empty","getSelection","removeAllRanges","err","_dragStarted","fallback","_appendGhost","_nulling","_emulateDragOver","elementFromPoint","ghostMatrix","relativeScrollOffset","dx","dy","b","cssMatrix","appendChild","_hideClone","cloneId","insertBefore","_loopId","setInterval","effectAllowed","_dragStartId","revert","vertical","isOwner","canSort","fromSortable","completedFired","dragOverEvent","_ignoreWhileAnimating","completed","elLastChild","_ghostIsLast","changed","targetBeforeFirstSwap","sibling","differentLevel","differentRowCol","dragElS1Opp","dragElS2Opp","dragElOppLength","targetS1Opp","targetS2Opp","targetOppLength","_dragElInRowColumn","side1","scrolledPastTop","scrollBefore","isLastTarget","mouseOnAxis","targetLength","targetS1","targetS2","invert","_getInsertDirection","_getSwapDirection","dragIndex","nextElementSibling","after","moveVector","extra","axis","insertion","_showClone","_offMoveEvents","_offUpEvents","clearInterval","removeChild","handleEvent","dropEffect","_globalDragOver","getAttribute","useAnimation","set","destroy","Array","querySelectorAll","removeAttribute","utils","is","extend","dst","nextTick","cancelNextTick","detectDirection","element","_len","_key","version","scrollEl","scrollRootEl","lastAutoScrollX","lastAutoScrollY","touchEvt$1","pointerElemChangedInterval","autoScrolls","scrolling","clearAutoScrolls","autoScroll","pid","clearPointerElemChangedInterval","isFallback","scroll","scrollCustomFn","sens","scrollSensitivity","speed","scrollSpeed","scrollThisInstance","scrollFn","layersOut","currentParent","canScrollX","canScrollY","scrollPosX","scrollPosY","vx","vy","layer","scrollOffsetY","scrollOffsetX","bubbleScroll","drop","toSortable","changedTouches","onSpill","Revert","Remove","startIndex","dragStart","_ref2","_ref3","_ref4","parentSortable","AutoScroll","_handleAutoScroll","_handleFallbackAutoScroll","dragOverCompleted","dragOverBubble","nulling","ogElemScroller","newElem","ConfirmModal","text","promise","onconfirm","EditBadgeModal","Switch","SortableBadge","data-id","resolve","reject","EditBadgeCategoryModal","badgeCategory","onCreate","InstallAutoModerationMessage","badges_install_automoderation","extensionInstalled","extensions","saveSettings","SettingsPage","updating","forcedRefreshKey","extensions_enabled","nextRefreshKey","oncreate","onBadgeListReady","updateCategorySort","pushData","size","onSort","onSortUpdate","action","newPosition","console","log","request","url","method","error","payload","pushPayload","categoryObject","badgeId","badgePosition","attributes","ExtensionPage","initializers","models","badgeCategories","extensionData","registerPage","registerPermission","permission","autoModeratorForms","give_badge","remove_badge","requirement","has_badge"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAA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kBACNjB,MAAO3D,IAAIC,WAAWC,MACpB,6DAEF2uB,WAAY,oBAEd,WACA,IAEDD,mBACC,CACEhqB,KAAM,oBACNjB,MAAO3D,IAAIC,WAAWC,MACpB,6DAEF2uB,WAAY,sBAEd,WACA,IAIA7uB,IAAI8uB,qBACN9uB,IAAI8uB,mBAAmBtB,OAAOuB,WAAazoB,EAC3CtG,IAAI8uB,mBAAmBtB,OAAOwB,aAAe1oB,EAE7CtG,IAAI8uB,mBAAmBG,YAAYC,UAAY5oB","file":"admin.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 = 37);\n","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}","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}","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/LinkButton'];","module.exports = flarum.core.compat['utils/mixin'];","import Modal from \"flarum/components/Modal\";\nimport Button from \"flarum/components/Button\";\nimport fullTime from \"flarum/helpers/fullTime\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport LinkButton from \"flarum/components/LinkButton\";\nimport GiveBadgeModal from \"./GiveBadgeModal\";\n\nexport default class BadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return \"Modal--small\";\n }\n\n title() {\n return app.translator.trans(\n \"v17development-flarum-badges.forum.badge_information\"\n );\n }\n\n content() {\n return (\n
\n
{this.data().toArray()}
\n
\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badge_details\"\n )}\n \n\n {this.attrs.userBadgeData && app.forum.attribute(\"canGiveBadge\") && (\n {\n if (\n confirm(\n app.translator.trans(\n \"v17development-flarum-badges.forum.moderation.remove_badge_confirm\"\n )\n )\n ) {\n this.loading = true;\n this.attrs.userBadgeData.delete().then(() => this.hide());\n }\n }}\n loading={this.loading}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.moderation.remove_badge\"\n )}\n \n )}\n
\n
\n );\n }\n\n data() {\n const items = new ItemList();\n\n // Badge name\n items.add(\n \"name\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.name\"\n )}\n :\n \n

\n

{this.attrs.badge.name()}

\n
\n );\n\n // Badge description\n items.add(\n \"description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.description\"\n )}\n :\n \n

\n

{this.attrs.badge.description()}

\n
\n );\n\n // Badge earning reason\n if (\n this.attrs.userBadgeData &&\n (this.attrs.userBadgeData.description() ||\n app.forum.attribute(\"canGiveBadge\"))\n ) {\n items.add(\n \"earning_reason\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earning_reason\"\n )}\n :\n \n

\n\n

\n {this.attrs.userBadgeData.description() ? (\n this.attrs.userBadgeData.description()\n ) : (\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.no_earning_reason\"\n )}\n \n )}\n

\n

\n {app.forum.attribute(\"canGiveBadge\") && (\n {\n e.preventDefault();\n app.modal.show(GiveBadgeModal, {\n badge: this.attrs.userBadgeData,\n });\n }}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.update_earning_reason\"\n )}\n \n )}\n

\n
\n );\n }\n\n // Badge earned on\n if (this.attrs.userBadgeData) {\n items.add(\n \"earned_date\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_on\"\n )}\n :\n \n

\n

{fullTime(this.attrs.userBadgeData.assignedAt())}

\n
\n );\n }\n\n // Badge category\n if (this.attrs.userBadgeData) {\n items.add(\n \"category\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.category\"\n )}\n :\n \n

\n

\n {this.attrs.badge.category() && this.attrs.badge.category().name()}\n\n {/* Uncategorized */}\n {!this.attrs.badge.category() &&\n app.translator.trans(\n \"v17development-flarum-badges.forum.uncategorized\"\n )}\n {/* \n {app.translator.trans(\n \"v17development-flarum-badges.forum.all_badges\"\n )}\n */}\n

\n
\n );\n }\n\n // Badge category\n if (this.attrs.badge && this.attrs.badge.earnedAmount()) {\n items.add(\n \"earned_amount\",\n
\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_count\",\n {\n count: this.attrs.badge.earnedAmount(),\n }\n )}\n

\n
\n );\n }\n\n return items;\n }\n}\n","import Modal from \"flarum/components/Modal\";\nimport Button from \"flarum/components/Button\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Select from \"flarum/components/Select\";\nimport Stream from \"flarum/utils/Stream\";\nimport BadgeModal from \"./BadgeModal\";\n\nexport default class GiveBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Select image\n this.selectedBadge = this.attrs.badge ? this.attrs.badge.badge() : null;\n\n // Current user\n this.user = this.attrs.badge ? this.attrs.badge.user() : this.attrs.user;\n\n // User has badge\n this.userHasBadge = false;\n\n // Badge model\n this.badge = this.attrs.badge\n ? this.attrs.badge\n : app.store.createRecord(\"userBadges\");\n\n // Earning reason\n this.description = Stream(this.badge.description());\n\n // List of available bagges\n this.categories = {};\n\n this.uncategorizedBadges = [];\n\n this.loading = false;\n\n // Load all available badges\n if (!this.attrs.badge) {\n this.loading = true;\n\n app.store\n .find(\"badges\", {\n include: \"category\",\n })\n .then((badges) => {\n badges.forEach((badge) => {\n // Categorized\n if (badge.category()) {\n const category = badge.category();\n\n if (!this.categories[category.id()]) {\n this.categories[category.id()] = {\n category,\n badges: [badge],\n };\n } else {\n this.categories[category.id()].badges.push(badge);\n }\n }\n // Uncategorized\n else {\n this.uncategorizedBadges.push(badge);\n }\n });\n\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n }\n }\n\n className() {\n return \"Modal--small BadgeModal\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.forum.${\n this.badge.exists ? \"update\" : \"give\"\n }_badge`\n );\n }\n\n content() {\n return (\n
\n
\n
{this.fields().toArray()}
\n
\n\n
\n \n {app.translator.trans(\"core.forum.composer_edit.submit_button\")}\n \n
\n
\n );\n }\n\n fields() {\n const items = new ItemList();\n\n // Badge selector\n items.add(\n \"badge\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badge\"\n )}\n \n

\n\n
\n {\n if (e.target.value === \"empty\") return;\n this.selectedBadge = app.store.getById(\"badges\", e.target.value);\n\n // Check if the user already has this badge\n this.checkUserHasBadge(this.selectedBadge);\n }}\n className=\"Select-input FormControl\"\n >\n \n\n {/* When no badge is selected, show all available badges */}\n {!this.attrs.badge &&\n Object.values(this.categories).map(({ category, badges }) => (\n \n {badges.map((badge) => (\n \n ))}\n \n ))}\n\n {!this.attrs.badge && this.uncategorizedBadges.length >= 1 && (\n \n {this.uncategorizedBadges.map((badge) => (\n \n ))}\n \n )}\n\n {/* When a badge is already assigned */}\n {!!this.attrs.badge && (\n \n )}\n \n \n
\n\n {this.userHasBadge && (\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.user_has_badge\"\n )}\n

\n )}\n
,\n 30\n );\n\n // Badge description\n items.add(\n \"badge_description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.description\"\n )}\n :\n \n

\n

\n {this.selectedBadge\n ? this.selectedBadge.description()\n : app.translator.trans(\n \"v17development-flarum-badges.forum.select_badge\"\n )}\n

\n
,\n 30\n );\n\n // Badge earning reason\n items.add(\n \"description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earning_reason\"\n )}\n \n

\n \n
,\n 30\n );\n\n return items;\n }\n\n checkUserHasBadge(badge) {\n let foundBadge = false;\n\n this.user.userBadges().map((userBadge) => {\n if (userBadge.badge() == badge) {\n foundBadge = true;\n }\n });\n\n this.userHasBadge = foundBadge;\n\n m.redraw();\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n description: this.description(),\n relationships: this.attrs.badge\n ? {}\n : {\n badge: this.selectedBadge,\n user: this.user,\n },\n })\n .then(\n () => {\n // Re-open badge modal\n if (this.attrs.badge) {\n app.modal.show(BadgeModal, {\n badge: this.attrs.badge.badge(),\n userBadgeData: this.attrs.badge,\n });\n } else {\n this.hide();\n }\n\n m.redraw();\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","module.exports = flarum.core.compat['components/Switch'];","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\nimport BadgeModal from \"../../forum/components/BadgeModal\";\n\nexport default class Badge extends mixin(Model, {\n name: Model.attribute(\"name\"),\n icon: Model.attribute(\"icon\"),\n order: Model.attribute(\"order\"),\n image: Model.attribute(\"image\"),\n description: Model.attribute(\"description\"),\n isVisible: Model.attribute(\"isVisible\"),\n createdAt: Model.attribute(\"createdAt\"),\n earnedAmount: Model.attribute(\"earnedAmount\"),\n category: Model.hasOne(\"category\"),\n}) {\n apiEndpoint() {\n return \"/badges\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","module.exports = flarum.core.compat['helpers/fullTime'];","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\n\nexport default class BadgeCategory extends mixin(Model, {\n name: Model.attribute(\"name\"),\n order: Model.attribute(\"order\"),\n description: Model.attribute(\"description\"),\n isEnabled: Model.attribute(\"isEnabled\"),\n createdAt: Model.attribute(\"createdAt\"),\n isTable: Model.attribute(\"isTable\"),\n users: Model.hasMany(\"users\"),\n badges: Model.hasMany(\"badges\"),\n}) {\n apiEndpoint() {\n return \"/badge_categories\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Dropdown'];","module.exports = flarum.core.compat['helpers/icon'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['utils/saveSettings'];","let loading = false;\nlet hasLoaded = false;\nlet onLoadedCallbacks = [];\n\nexport default function loadAllBadges(onLoadedCallback) {\n // Badges have already been loaded\n if (hasLoaded) {\n onLoadedCallback();\n return;\n }\n\n // Load badges if not already loading\n if (!loading) {\n loading = true;\n\n // Load badges\n app.store.find(\"badges\").then(() => {\n hasLoaded = true;\n loading = false;\n\n onLoadedCallback();\n\n // Give callback\n onLoadedCallbacks.map((cb) => cb());\n\n m.redraw();\n });\n } else {\n onLoadedCallbacks.push(onLoadedCallback);\n }\n}\n","import Component from \"flarum/Component\";\nimport Button from \"flarum/components/Button\";\nimport Dropdown from \"flarum/components/Dropdown\";\nimport icon from \"flarum/helpers/icon\";\nimport loadAllBadges from \"../utils/loadBadges\";\n\nexport default class BadgeSelector extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loaded = false;\n\n // Load badges\n loadAllBadges(() => (this.loaded = true));\n }\n\n view() {\n if (!this.loaded) {\n return (\n
\n \n\n \n {app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.badge_selector.loading_badges\"\n )}\n \n
\n );\n }\n\n const badge = app.store.getById(\"badges\", this.attrs.value);\n const label = badge\n ? [icon(badge.icon()), \"\\t\", badge.name()]\n : app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.badge_selector.placeholder\"\n );\n return (\n
\n \n\n {this.attrs.disabled ? (\n
{label}
\n ) : (\n \n {app.store.all(\"badges\").map((g) =>\n Button.component(\n {\n active: badge && badge.id() === g.id(),\n disabled: badge && badge.id() === g.id(),\n icon: g.icon(),\n onclick: () => {\n this.attrs.onchange(g.id());\n },\n },\n g.name()\n )\n )}\n \n )}\n
\n );\n }\n}\n","import Component from \"flarum/Component\";\nimport BadgeSelector from \"./BadgeSelector\";\n\nexport default class BadgeActionDriverSettings extends Component {\n view() {\n const settings = this.attrs.settings;\n\n return (\n settings({ badge_id: val })}\n />\n );\n }\n}\n","/**!\n * Sortable 1.13.0\n * @author\tRubaXa \n * @author\towenm \n * @license MIT\n */\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nvar version = \"1.13.0\";\n\nfunction userAgent(pattern) {\n if (typeof window !== 'undefined' && window.navigator) {\n return !!\n /*@__PURE__*/\n navigator.userAgent.match(pattern);\n }\n}\n\nvar IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\\.|msie|iemobile|Windows Phone)/i);\nvar Edge = userAgent(/Edge/i);\nvar FireFox = userAgent(/firefox/i);\nvar Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);\nvar IOS = userAgent(/iP(ad|od|hone)/i);\nvar ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);\n\nvar captureMode = {\n capture: false,\n passive: false\n};\n\nfunction on(el, event, fn) {\n el.addEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction off(el, event, fn) {\n el.removeEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction matches(\n/**HTMLElement*/\nel,\n/**String*/\nselector) {\n if (!selector) return;\n selector[0] === '>' && (selector = selector.substring(1));\n\n if (el) {\n try {\n if (el.matches) {\n return el.matches(selector);\n } else if (el.msMatchesSelector) {\n return el.msMatchesSelector(selector);\n } else if (el.webkitMatchesSelector) {\n return el.webkitMatchesSelector(selector);\n }\n } catch (_) {\n return false;\n }\n }\n\n return false;\n}\n\nfunction getParentOrHost(el) {\n return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;\n}\n\nfunction closest(\n/**HTMLElement*/\nel,\n/**String*/\nselector,\n/**HTMLElement*/\nctx, includeCTX) {\n if (el) {\n ctx = ctx || document;\n\n do {\n if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {\n return el;\n }\n\n if (el === ctx) break;\n /* jshint boss:true */\n } while (el = getParentOrHost(el));\n }\n\n return null;\n}\n\nvar R_SPACE = /\\s+/g;\n\nfunction toggleClass(el, name, state) {\n if (el && name) {\n if (el.classList) {\n el.classList[state ? 'add' : 'remove'](name);\n } else {\n var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');\n el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');\n }\n }\n}\n\nfunction css(el, prop, val) {\n var style = el && el.style;\n\n if (style) {\n if (val === void 0) {\n if (document.defaultView && document.defaultView.getComputedStyle) {\n val = document.defaultView.getComputedStyle(el, '');\n } else if (el.currentStyle) {\n val = el.currentStyle;\n }\n\n return prop === void 0 ? val : val[prop];\n } else {\n if (!(prop in style) && prop.indexOf('webkit') === -1) {\n prop = '-webkit-' + prop;\n }\n\n style[prop] = val + (typeof val === 'string' ? '' : 'px');\n }\n }\n}\n\nfunction matrix(el, selfOnly) {\n var appliedTransforms = '';\n\n if (typeof el === 'string') {\n appliedTransforms = el;\n } else {\n do {\n var transform = css(el, 'transform');\n\n if (transform && transform !== 'none') {\n appliedTransforms = transform + ' ' + appliedTransforms;\n }\n /* jshint boss:true */\n\n } while (!selfOnly && (el = el.parentNode));\n }\n\n var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;\n /*jshint -W056 */\n\n return matrixFn && new matrixFn(appliedTransforms);\n}\n\nfunction find(ctx, tagName, iterator) {\n if (ctx) {\n var list = ctx.getElementsByTagName(tagName),\n i = 0,\n n = list.length;\n\n if (iterator) {\n for (; i < n; i++) {\n iterator(list[i], i);\n }\n }\n\n return list;\n }\n\n return [];\n}\n\nfunction getWindowScrollingElement() {\n var scrollingElement = document.scrollingElement;\n\n if (scrollingElement) {\n return scrollingElement;\n } else {\n return document.documentElement;\n }\n}\n/**\n * Returns the \"bounding client rect\" of given element\n * @param {HTMLElement} el The element whose boundingClientRect is wanted\n * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container\n * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr\n * @param {[Boolean]} undoScale Whether the container's scale() should be undone\n * @param {[HTMLElement]} container The parent the element will be placed in\n * @return {Object} The boundingClientRect of el, with specified adjustments\n */\n\n\nfunction getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {\n if (!el.getBoundingClientRect && el !== window) return;\n var elRect, top, left, bottom, right, height, width;\n\n if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {\n elRect = el.getBoundingClientRect();\n top = elRect.top;\n left = elRect.left;\n bottom = elRect.bottom;\n right = elRect.right;\n height = elRect.height;\n width = elRect.width;\n } else {\n top = 0;\n left = 0;\n bottom = window.innerHeight;\n right = window.innerWidth;\n height = window.innerHeight;\n width = window.innerWidth;\n }\n\n if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {\n // Adjust for translate()\n container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)\n // Not needed on <= IE11\n\n if (!IE11OrLess) {\n do {\n if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {\n var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container\n\n top -= containerRect.top + parseInt(css(container, 'border-top-width'));\n left -= containerRect.left + parseInt(css(container, 'border-left-width'));\n bottom = top + elRect.height;\n right = left + elRect.width;\n break;\n }\n /* jshint boss:true */\n\n } while (container = container.parentNode);\n }\n }\n\n if (undoScale && el !== window) {\n // Adjust for scale()\n var elMatrix = matrix(container || el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d;\n\n if (elMatrix) {\n top /= scaleY;\n left /= scaleX;\n width /= scaleX;\n height /= scaleY;\n bottom = top + height;\n right = left + width;\n }\n }\n\n return {\n top: top,\n left: left,\n bottom: bottom,\n right: right,\n width: width,\n height: height\n };\n}\n/**\n * Checks if a side of an element is scrolled past a side of its parents\n * @param {HTMLElement} el The element who's side being scrolled out of view is in question\n * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')\n * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')\n * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element\n */\n\n\nfunction isScrolledPast(el, elSide, parentSide) {\n var parent = getParentAutoScrollElement(el, true),\n elSideVal = getRect(el)[elSide];\n /* jshint boss:true */\n\n while (parent) {\n var parentSideVal = getRect(parent)[parentSide],\n visible = void 0;\n\n if (parentSide === 'top' || parentSide === 'left') {\n visible = elSideVal >= parentSideVal;\n } else {\n visible = elSideVal <= parentSideVal;\n }\n\n if (!visible) return parent;\n if (parent === getWindowScrollingElement()) break;\n parent = getParentAutoScrollElement(parent, false);\n }\n\n return false;\n}\n/**\n * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)\n * and non-draggable elements\n * @param {HTMLElement} el The parent element\n * @param {Number} childNum The index of the child\n * @param {Object} options Parent Sortable's options\n * @return {HTMLElement} The child at index childNum, or null if not found\n */\n\n\nfunction getChild(el, childNum, options) {\n var currentChild = 0,\n i = 0,\n children = el.children;\n\n while (i < children.length) {\n if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) {\n if (currentChild === childNum) {\n return children[i];\n }\n\n currentChild++;\n }\n\n i++;\n }\n\n return null;\n}\n/**\n * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)\n * @param {HTMLElement} el Parent element\n * @param {selector} selector Any other elements that should be ignored\n * @return {HTMLElement} The last child, ignoring ghostEl\n */\n\n\nfunction lastChild(el, selector) {\n var last = el.lastElementChild;\n\n while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {\n last = last.previousElementSibling;\n }\n\n return last || null;\n}\n/**\n * Returns the index of an element within its parent for a selected set of\n * elements\n * @param {HTMLElement} el\n * @param {selector} selector\n * @return {number}\n */\n\n\nfunction index(el, selector) {\n var index = 0;\n\n if (!el || !el.parentNode) {\n return -1;\n }\n /* jshint boss:true */\n\n\n while (el = el.previousElementSibling) {\n if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {\n index++;\n }\n }\n\n return index;\n}\n/**\n * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.\n * The value is returned in real pixels.\n * @param {HTMLElement} el\n * @return {Array} Offsets in the format of [left, top]\n */\n\n\nfunction getRelativeScrollOffset(el) {\n var offsetLeft = 0,\n offsetTop = 0,\n winScroller = getWindowScrollingElement();\n\n if (el) {\n do {\n var elMatrix = matrix(el),\n scaleX = elMatrix.a,\n scaleY = elMatrix.d;\n offsetLeft += el.scrollLeft * scaleX;\n offsetTop += el.scrollTop * scaleY;\n } while (el !== winScroller && (el = el.parentNode));\n }\n\n return [offsetLeft, offsetTop];\n}\n/**\n * Returns the index of the object within the given array\n * @param {Array} arr Array that may or may not hold the object\n * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find\n * @return {Number} The index of the object in the array, or -1\n */\n\n\nfunction indexOfObject(arr, obj) {\n for (var i in arr) {\n if (!arr.hasOwnProperty(i)) continue;\n\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);\n }\n }\n\n return -1;\n}\n\nfunction getParentAutoScrollElement(el, includeSelf) {\n // skip to window\n if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();\n var elem = el;\n var gotSelf = false;\n\n do {\n // we don't need to get elem css if it isn't even overflowing in the first place (performance)\n if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {\n var elemCSS = css(elem);\n\n if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {\n if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();\n if (gotSelf || includeSelf) return elem;\n gotSelf = true;\n }\n }\n /* jshint boss:true */\n\n } while (elem = elem.parentNode);\n\n return getWindowScrollingElement();\n}\n\nfunction extend(dst, src) {\n if (dst && src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dst[key] = src[key];\n }\n }\n }\n\n return dst;\n}\n\nfunction isRectEqual(rect1, rect2) {\n return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);\n}\n\nvar _throttleTimeout;\n\nfunction throttle(callback, ms) {\n return function () {\n if (!_throttleTimeout) {\n var args = arguments,\n _this = this;\n\n if (args.length === 1) {\n callback.call(_this, args[0]);\n } else {\n callback.apply(_this, args);\n }\n\n _throttleTimeout = setTimeout(function () {\n _throttleTimeout = void 0;\n }, ms);\n }\n };\n}\n\nfunction cancelThrottle() {\n clearTimeout(_throttleTimeout);\n _throttleTimeout = void 0;\n}\n\nfunction scrollBy(el, x, y) {\n el.scrollLeft += x;\n el.scrollTop += y;\n}\n\nfunction clone(el) {\n var Polymer = window.Polymer;\n var $ = window.jQuery || window.Zepto;\n\n if (Polymer && Polymer.dom) {\n return Polymer.dom(el).cloneNode(true);\n } else if ($) {\n return $(el).clone(true)[0];\n } else {\n return el.cloneNode(true);\n }\n}\n\nfunction setRect(el, rect) {\n css(el, 'position', 'absolute');\n css(el, 'top', rect.top);\n css(el, 'left', rect.left);\n css(el, 'width', rect.width);\n css(el, 'height', rect.height);\n}\n\nfunction unsetRect(el) {\n css(el, 'position', '');\n css(el, 'top', '');\n css(el, 'left', '');\n css(el, 'width', '');\n css(el, 'height', '');\n}\n\nvar expando = 'Sortable' + new Date().getTime();\n\nfunction AnimationStateManager() {\n var animationStates = [],\n animationCallbackId;\n return {\n captureAnimationState: function captureAnimationState() {\n animationStates = [];\n if (!this.options.animation) return;\n var children = [].slice.call(this.el.children);\n children.forEach(function (child) {\n if (css(child, 'display') === 'none' || child === Sortable.ghost) return;\n animationStates.push({\n target: child,\n rect: getRect(child)\n });\n\n var fromRect = _objectSpread({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation\n\n\n if (child.thisAnimationDuration) {\n var childMatrix = matrix(child, true);\n\n if (childMatrix) {\n fromRect.top -= childMatrix.f;\n fromRect.left -= childMatrix.e;\n }\n }\n\n child.fromRect = fromRect;\n });\n },\n addAnimationState: function addAnimationState(state) {\n animationStates.push(state);\n },\n removeAnimationState: function removeAnimationState(target) {\n animationStates.splice(indexOfObject(animationStates, {\n target: target\n }), 1);\n },\n animateAll: function animateAll(callback) {\n var _this = this;\n\n if (!this.options.animation) {\n clearTimeout(animationCallbackId);\n if (typeof callback === 'function') callback();\n return;\n }\n\n var animating = false,\n animationTime = 0;\n animationStates.forEach(function (state) {\n var time = 0,\n target = state.target,\n fromRect = target.fromRect,\n toRect = getRect(target),\n prevFromRect = target.prevFromRect,\n prevToRect = target.prevToRect,\n animatingRect = state.rect,\n targetMatrix = matrix(target, true);\n\n if (targetMatrix) {\n // Compensate for current animation\n toRect.top -= targetMatrix.f;\n toRect.left -= targetMatrix.e;\n }\n\n target.toRect = toRect;\n\n if (target.thisAnimationDuration) {\n // Could also check if animatingRect is between fromRect and toRect\n if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect\n (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {\n // If returning to same place as started from animation and on same axis\n time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);\n }\n } // if fromRect != toRect: animate\n\n\n if (!isRectEqual(toRect, fromRect)) {\n target.prevFromRect = fromRect;\n target.prevToRect = toRect;\n\n if (!time) {\n time = _this.options.animation;\n }\n\n _this.animate(target, animatingRect, toRect, time);\n }\n\n if (time) {\n animating = true;\n animationTime = Math.max(animationTime, time);\n clearTimeout(target.animationResetTimer);\n target.animationResetTimer = setTimeout(function () {\n target.animationTime = 0;\n target.prevFromRect = null;\n target.fromRect = null;\n target.prevToRect = null;\n target.thisAnimationDuration = null;\n }, time);\n target.thisAnimationDuration = time;\n }\n });\n clearTimeout(animationCallbackId);\n\n if (!animating) {\n if (typeof callback === 'function') callback();\n } else {\n animationCallbackId = setTimeout(function () {\n if (typeof callback === 'function') callback();\n }, animationTime);\n }\n\n animationStates = [];\n },\n animate: function animate(target, currentRect, toRect, duration) {\n if (duration) {\n css(target, 'transition', '');\n css(target, 'transform', '');\n var elMatrix = matrix(this.el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d,\n translateX = (currentRect.left - toRect.left) / (scaleX || 1),\n translateY = (currentRect.top - toRect.top) / (scaleY || 1);\n target.animatingX = !!translateX;\n target.animatingY = !!translateY;\n css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');\n this.forRepaintDummy = repaint(target); // repaint\n\n css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));\n css(target, 'transform', 'translate3d(0,0,0)');\n typeof target.animated === 'number' && clearTimeout(target.animated);\n target.animated = setTimeout(function () {\n css(target, 'transition', '');\n css(target, 'transform', '');\n target.animated = false;\n target.animatingX = false;\n target.animatingY = false;\n }, duration);\n }\n }\n };\n}\n\nfunction repaint(target) {\n return target.offsetWidth;\n}\n\nfunction calculateRealTime(animatingRect, fromRect, toRect, options) {\n return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;\n}\n\nvar plugins = [];\nvar defaults = {\n initializeByDefault: true\n};\nvar PluginManager = {\n mount: function mount(plugin) {\n // Set default static properties\n for (var option in defaults) {\n if (defaults.hasOwnProperty(option) && !(option in plugin)) {\n plugin[option] = defaults[option];\n }\n }\n\n plugins.forEach(function (p) {\n if (p.pluginName === plugin.pluginName) {\n throw \"Sortable: Cannot mount plugin \".concat(plugin.pluginName, \" more than once\");\n }\n });\n plugins.push(plugin);\n },\n pluginEvent: function pluginEvent(eventName, sortable, evt) {\n var _this = this;\n\n this.eventCanceled = false;\n\n evt.cancel = function () {\n _this.eventCanceled = true;\n };\n\n var eventNameGlobal = eventName + 'Global';\n plugins.forEach(function (plugin) {\n if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable\n\n if (sortable[plugin.pluginName][eventNameGlobal]) {\n sortable[plugin.pluginName][eventNameGlobal](_objectSpread({\n sortable: sortable\n }, evt));\n } // Only fire plugin event if plugin is enabled in this sortable,\n // and plugin has event defined\n\n\n if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {\n sortable[plugin.pluginName][eventName](_objectSpread({\n sortable: sortable\n }, evt));\n }\n });\n },\n initializePlugins: function initializePlugins(sortable, el, defaults, options) {\n plugins.forEach(function (plugin) {\n var pluginName = plugin.pluginName;\n if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;\n var initialized = new plugin(sortable, el, sortable.options);\n initialized.sortable = sortable;\n initialized.options = sortable.options;\n sortable[pluginName] = initialized; // Add default options from plugin\n\n _extends(defaults, initialized.defaults);\n });\n\n for (var option in sortable.options) {\n if (!sortable.options.hasOwnProperty(option)) continue;\n var modified = this.modifyOption(sortable, option, sortable.options[option]);\n\n if (typeof modified !== 'undefined') {\n sortable.options[option] = modified;\n }\n }\n },\n getEventProperties: function getEventProperties(name, sortable) {\n var eventProperties = {};\n plugins.forEach(function (plugin) {\n if (typeof plugin.eventProperties !== 'function') return;\n\n _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));\n });\n return eventProperties;\n },\n modifyOption: function modifyOption(sortable, name, value) {\n var modifiedValue;\n plugins.forEach(function (plugin) {\n // Plugin must exist on the Sortable\n if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin\n\n if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {\n modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);\n }\n });\n return modifiedValue;\n }\n};\n\nfunction dispatchEvent(_ref) {\n var sortable = _ref.sortable,\n rootEl = _ref.rootEl,\n name = _ref.name,\n targetEl = _ref.targetEl,\n cloneEl = _ref.cloneEl,\n toEl = _ref.toEl,\n fromEl = _ref.fromEl,\n oldIndex = _ref.oldIndex,\n newIndex = _ref.newIndex,\n oldDraggableIndex = _ref.oldDraggableIndex,\n newDraggableIndex = _ref.newDraggableIndex,\n originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n extraEventProperties = _ref.extraEventProperties;\n sortable = sortable || rootEl && rootEl[expando];\n if (!sortable) return;\n var evt,\n options = sortable.options,\n onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent(name, {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent(name, true, true);\n }\n\n evt.to = toEl || rootEl;\n evt.from = fromEl || rootEl;\n evt.item = targetEl || rootEl;\n evt.clone = cloneEl;\n evt.oldIndex = oldIndex;\n evt.newIndex = newIndex;\n evt.oldDraggableIndex = oldDraggableIndex;\n evt.newDraggableIndex = newDraggableIndex;\n evt.originalEvent = originalEvent;\n evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;\n\n var allEventProperties = _objectSpread({}, extraEventProperties, PluginManager.getEventProperties(name, sortable));\n\n for (var option in allEventProperties) {\n evt[option] = allEventProperties[option];\n }\n\n if (rootEl) {\n rootEl.dispatchEvent(evt);\n }\n\n if (options[onName]) {\n options[onName].call(sortable, evt);\n }\n}\n\nvar pluginEvent = function pluginEvent(eventName, sortable) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n originalEvent = _ref.evt,\n data = _objectWithoutProperties(_ref, [\"evt\"]);\n\n PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({\n dragEl: dragEl,\n parentEl: parentEl,\n ghostEl: ghostEl,\n rootEl: rootEl,\n nextEl: nextEl,\n lastDownEl: lastDownEl,\n cloneEl: cloneEl,\n cloneHidden: cloneHidden,\n dragStarted: moved,\n putSortable: putSortable,\n activeSortable: Sortable.active,\n originalEvent: originalEvent,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n hideGhostForTarget: _hideGhostForTarget,\n unhideGhostForTarget: _unhideGhostForTarget,\n cloneNowHidden: function cloneNowHidden() {\n cloneHidden = true;\n },\n cloneNowShown: function cloneNowShown() {\n cloneHidden = false;\n },\n dispatchSortableEvent: function dispatchSortableEvent(name) {\n _dispatchEvent({\n sortable: sortable,\n name: name,\n originalEvent: originalEvent\n });\n }\n }, data));\n};\n\nfunction _dispatchEvent(info) {\n dispatchEvent(_objectSpread({\n putSortable: putSortable,\n cloneEl: cloneEl,\n targetEl: dragEl,\n rootEl: rootEl,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex\n }, info));\n}\n\nvar dragEl,\n parentEl,\n ghostEl,\n rootEl,\n nextEl,\n lastDownEl,\n cloneEl,\n cloneHidden,\n oldIndex,\n newIndex,\n oldDraggableIndex,\n newDraggableIndex,\n activeGroup,\n putSortable,\n awaitingDragStarted = false,\n ignoreNextClick = false,\n sortables = [],\n tapEvt,\n touchEvt,\n lastDx,\n lastDy,\n tapDistanceLeft,\n tapDistanceTop,\n moved,\n lastTarget,\n lastDirection,\n pastFirstInvertThresh = false,\n isCircumstantialInvert = false,\n targetMoveDistance,\n // For positioning ghost absolutely\nghostRelativeParent,\n ghostRelativeParentInitialScroll = [],\n // (left, top)\n_silent = false,\n savedInputChecked = [];\n/** @const */\n\nvar documentExists = typeof document !== 'undefined',\n PositionGhostAbsolutely = IOS,\n CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',\n // This will not pass for IE9, because IE9 DnD only works on anchors\nsupportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),\n supportCssPointerEvents = function () {\n if (!documentExists) return; // false when <= IE11\n\n if (IE11OrLess) {\n return false;\n }\n\n var el = document.createElement('x');\n el.style.cssText = 'pointer-events:auto';\n return el.style.pointerEvents === 'auto';\n}(),\n _detectDirection = function _detectDirection(el, options) {\n var elCSS = css(el),\n elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),\n child1 = getChild(el, 0, options),\n child2 = getChild(el, 1, options),\n firstChildCSS = child1 && css(child1),\n secondChildCSS = child2 && css(child2),\n firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,\n secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;\n\n if (elCSS.display === 'flex') {\n return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';\n }\n\n if (elCSS.display === 'grid') {\n return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';\n }\n\n if (child1 && firstChildCSS[\"float\"] && firstChildCSS[\"float\"] !== 'none') {\n var touchingSideChild2 = firstChildCSS[\"float\"] === 'left' ? 'left' : 'right';\n return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';\n }\n\n return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';\n},\n _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {\n var dragElS1Opp = vertical ? dragRect.left : dragRect.top,\n dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,\n dragElOppLength = vertical ? dragRect.width : dragRect.height,\n targetS1Opp = vertical ? targetRect.left : targetRect.top,\n targetS2Opp = vertical ? targetRect.right : targetRect.bottom,\n targetOppLength = vertical ? targetRect.width : targetRect.height;\n return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;\n},\n\n/**\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\n * @param {Number} x X position\n * @param {Number} y Y position\n * @return {HTMLElement} Element of the first found nearest Sortable\n */\n_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {\n var ret;\n sortables.some(function (sortable) {\n if (lastChild(sortable)) return;\n var rect = getRect(sortable),\n threshold = sortable[expando].options.emptyInsertThreshold,\n insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,\n insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;\n\n if (threshold && insideHorizontally && insideVertically) {\n return ret = sortable;\n }\n });\n return ret;\n},\n _prepareGroup = function _prepareGroup(options) {\n function toFn(value, pull) {\n return function (to, from, dragEl, evt) {\n var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;\n\n if (value == null && (pull || sameGroup)) {\n // Default pull value\n // Default pull and put value if same group\n return true;\n } else if (value == null || value === false) {\n return false;\n } else if (pull && value === 'clone') {\n return value;\n } else if (typeof value === 'function') {\n return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);\n } else {\n var otherGroup = (pull ? to : from).options.group.name;\n return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;\n }\n };\n }\n\n var group = {};\n var originalGroup = options.group;\n\n if (!originalGroup || _typeof(originalGroup) != 'object') {\n originalGroup = {\n name: originalGroup\n };\n }\n\n group.name = originalGroup.name;\n group.checkPull = toFn(originalGroup.pull, true);\n group.checkPut = toFn(originalGroup.put);\n group.revertClone = originalGroup.revertClone;\n options.group = group;\n},\n _hideGhostForTarget = function _hideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', 'none');\n }\n},\n _unhideGhostForTarget = function _unhideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', '');\n }\n}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position\n\n\nif (documentExists) {\n document.addEventListener('click', function (evt) {\n if (ignoreNextClick) {\n evt.preventDefault();\n evt.stopPropagation && evt.stopPropagation();\n evt.stopImmediatePropagation && evt.stopImmediatePropagation();\n ignoreNextClick = false;\n return false;\n }\n }, true);\n}\n\nvar nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {\n if (dragEl) {\n evt = evt.touches ? evt.touches[0] : evt;\n\n var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);\n\n if (nearest) {\n // Create imitation event\n var event = {};\n\n for (var i in evt) {\n if (evt.hasOwnProperty(i)) {\n event[i] = evt[i];\n }\n }\n\n event.target = event.rootEl = nearest;\n event.preventDefault = void 0;\n event.stopPropagation = void 0;\n\n nearest[expando]._onDragOver(event);\n }\n }\n};\n\nvar _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {\n if (dragEl) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n }\n};\n/**\n * @class Sortable\n * @param {HTMLElement} el\n * @param {Object} [options]\n */\n\n\nfunction Sortable(el, options) {\n if (!(el && el.nodeType && el.nodeType === 1)) {\n throw \"Sortable: `el` must be an HTMLElement, not \".concat({}.toString.call(el));\n }\n\n this.el = el; // root element\n\n this.options = options = _extends({}, options); // Export instance\n\n el[expando] = this;\n var defaults = {\n group: null,\n sort: true,\n disabled: false,\n store: null,\n handle: null,\n draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',\n swapThreshold: 1,\n // percentage; 0 <= x <= 1\n invertSwap: false,\n // invert always\n invertedSwapThreshold: null,\n // will be set to same as swapThreshold if default\n removeCloneOnHide: true,\n direction: function direction() {\n return _detectDirection(el, this.options);\n },\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n ignore: 'a, img',\n filter: null,\n preventOnFilter: true,\n animation: 0,\n easing: null,\n setData: function setData(dataTransfer, dragEl) {\n dataTransfer.setData('Text', dragEl.textContent);\n },\n dropBubble: false,\n dragoverBubble: false,\n dataIdAttr: 'data-id',\n delay: 0,\n delayOnTouchOnly: false,\n touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,\n forceFallback: false,\n fallbackClass: 'sortable-fallback',\n fallbackOnBody: false,\n fallbackTolerance: 0,\n fallbackOffset: {\n x: 0,\n y: 0\n },\n supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,\n emptyInsertThreshold: 5\n };\n PluginManager.initializePlugins(this, el, defaults); // Set default options\n\n for (var name in defaults) {\n !(name in options) && (options[name] = defaults[name]);\n }\n\n _prepareGroup(options); // Bind all private methods\n\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n } // Setup drag mode\n\n\n this.nativeDraggable = options.forceFallback ? false : supportDraggable;\n\n if (this.nativeDraggable) {\n // Touch start threshold cannot be greater than the native dragstart threshold\n this.options.touchStartThreshold = 1;\n } // Bind events\n\n\n if (options.supportPointer) {\n on(el, 'pointerdown', this._onTapStart);\n } else {\n on(el, 'mousedown', this._onTapStart);\n on(el, 'touchstart', this._onTapStart);\n }\n\n if (this.nativeDraggable) {\n on(el, 'dragover', this);\n on(el, 'dragenter', this);\n }\n\n sortables.push(this.el); // Restore sorting\n\n options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager\n\n _extends(this, AnimationStateManager());\n}\n\nSortable.prototype =\n/** @lends Sortable.prototype */\n{\n constructor: Sortable,\n _isOutsideThisEl: function _isOutsideThisEl(target) {\n if (!this.el.contains(target) && target !== this.el) {\n lastTarget = null;\n }\n },\n _getDirection: function _getDirection(evt, target) {\n return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;\n },\n _onTapStart: function _onTapStart(\n /** Event|TouchEvent */\n evt) {\n if (!evt.cancelable) return;\n\n var _this = this,\n el = this.el,\n options = this.options,\n preventOnFilter = options.preventOnFilter,\n type = evt.type,\n touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,\n target = (touch || evt).target,\n originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,\n filter = options.filter;\n\n _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.\n\n\n if (dragEl) {\n return;\n }\n\n if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {\n return; // only left button and enabled\n } // cancel dnd if original target is content editable\n\n\n if (originalTarget.isContentEditable) {\n return;\n } // Safari ignores further event handling after mousedown\n\n\n if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {\n return;\n }\n\n target = closest(target, options.draggable, el, false);\n\n if (target && target.animated) {\n return;\n }\n\n if (lastDownEl === target) {\n // Ignoring duplicate `down`\n return;\n } // Get the index of the dragged element within its parent\n\n\n oldIndex = index(target);\n oldDraggableIndex = index(target, options.draggable); // Check filter\n\n if (typeof filter === 'function') {\n if (filter.call(this, evt, target, this)) {\n _dispatchEvent({\n sortable: _this,\n rootEl: originalTarget,\n name: 'filter',\n targetEl: target,\n toEl: el,\n fromEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n } else if (filter) {\n filter = filter.split(',').some(function (criteria) {\n criteria = closest(originalTarget, criteria.trim(), el, false);\n\n if (criteria) {\n _dispatchEvent({\n sortable: _this,\n rootEl: criteria,\n name: 'filter',\n targetEl: target,\n fromEl: el,\n toEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n return true;\n }\n });\n\n if (filter) {\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n }\n\n if (options.handle && !closest(originalTarget, options.handle, el, false)) {\n return;\n } // Prepare `dragstart`\n\n\n this._prepareDragStart(evt, touch, target);\n },\n _prepareDragStart: function _prepareDragStart(\n /** Event */\n evt,\n /** Touch */\n touch,\n /** HTMLElement */\n target) {\n var _this = this,\n el = _this.el,\n options = _this.options,\n ownerDocument = el.ownerDocument,\n dragStartFn;\n\n if (target && !dragEl && target.parentNode === el) {\n var dragRect = getRect(target);\n rootEl = el;\n dragEl = target;\n parentEl = dragEl.parentNode;\n nextEl = dragEl.nextSibling;\n lastDownEl = target;\n activeGroup = options.group;\n Sortable.dragged = dragEl;\n tapEvt = {\n target: dragEl,\n clientX: (touch || evt).clientX,\n clientY: (touch || evt).clientY\n };\n tapDistanceLeft = tapEvt.clientX - dragRect.left;\n tapDistanceTop = tapEvt.clientY - dragRect.top;\n this._lastX = (touch || evt).clientX;\n this._lastY = (touch || evt).clientY;\n dragEl.style['will-change'] = 'all';\n\n dragStartFn = function dragStartFn() {\n pluginEvent('delayEnded', _this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n _this._onDrop();\n\n return;\n } // Delayed drag has been triggered\n // we can re-enable the events: touchmove/mousemove\n\n\n _this._disableDelayedDragEvents();\n\n if (!FireFox && _this.nativeDraggable) {\n dragEl.draggable = true;\n } // Bind the events: dragstart/dragend\n\n\n _this._triggerDragStart(evt, touch); // Drag start event\n\n\n _dispatchEvent({\n sortable: _this,\n name: 'choose',\n originalEvent: evt\n }); // Chosen item\n\n\n toggleClass(dragEl, options.chosenClass, true);\n }; // Disable \"draggable\"\n\n\n options.ignore.split(',').forEach(function (criteria) {\n find(dragEl, criteria.trim(), _disableDraggable);\n });\n on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mouseup', _this._onDrop);\n on(ownerDocument, 'touchend', _this._onDrop);\n on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)\n\n if (FireFox && this.nativeDraggable) {\n this.options.touchStartThreshold = 4;\n dragEl.draggable = true;\n }\n\n pluginEvent('delayStart', this, {\n evt: evt\n }); // Delay is impossible for native DnD in Edge or IE\n\n if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n } // If the user moves the pointer or let go the click or touch\n // before the delay has been reached:\n // disable the delayed drag\n\n\n on(ownerDocument, 'mouseup', _this._disableDelayedDrag);\n on(ownerDocument, 'touchend', _this._disableDelayedDrag);\n on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);\n on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);\n on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);\n options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);\n _this._dragStartTimer = setTimeout(dragStartFn, options.delay);\n } else {\n dragStartFn();\n }\n }\n },\n _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(\n /** TouchEvent|PointerEvent **/\n e) {\n var touch = e.touches ? e.touches[0] : e;\n\n if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {\n this._disableDelayedDrag();\n }\n },\n _disableDelayedDrag: function _disableDelayedDrag() {\n dragEl && _disableDraggable(dragEl);\n clearTimeout(this._dragStartTimer);\n\n this._disableDelayedDragEvents();\n },\n _disableDelayedDragEvents: function _disableDelayedDragEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._disableDelayedDrag);\n off(ownerDocument, 'touchend', this._disableDelayedDrag);\n off(ownerDocument, 'touchcancel', this._disableDelayedDrag);\n off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);\n },\n _triggerDragStart: function _triggerDragStart(\n /** Event */\n evt,\n /** Touch */\n touch) {\n touch = touch || evt.pointerType == 'touch' && evt;\n\n if (!this.nativeDraggable || touch) {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._onTouchMove);\n } else if (touch) {\n on(document, 'touchmove', this._onTouchMove);\n } else {\n on(document, 'mousemove', this._onTouchMove);\n }\n } else {\n on(dragEl, 'dragend', this);\n on(rootEl, 'dragstart', this._onDragStart);\n }\n\n try {\n if (document.selection) {\n // Timeout neccessary for IE9\n _nextTick(function () {\n document.selection.empty();\n });\n } else {\n window.getSelection().removeAllRanges();\n }\n } catch (err) {}\n },\n _dragStarted: function _dragStarted(fallback, evt) {\n\n awaitingDragStarted = false;\n\n if (rootEl && dragEl) {\n pluginEvent('dragStarted', this, {\n evt: evt\n });\n\n if (this.nativeDraggable) {\n on(document, 'dragover', _checkOutsideTargetEl);\n }\n\n var options = this.options; // Apply effect\n\n !fallback && toggleClass(dragEl, options.dragClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n Sortable.active = this;\n fallback && this._appendGhost(); // Drag start event\n\n _dispatchEvent({\n sortable: this,\n name: 'start',\n originalEvent: evt\n });\n } else {\n this._nulling();\n }\n },\n _emulateDragOver: function _emulateDragOver() {\n if (touchEvt) {\n this._lastX = touchEvt.clientX;\n this._lastY = touchEvt.clientY;\n\n _hideGhostForTarget();\n\n var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n var parent = target;\n\n while (target && target.shadowRoot) {\n target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n if (target === parent) break;\n parent = target;\n }\n\n dragEl.parentNode[expando]._isOutsideThisEl(target);\n\n if (parent) {\n do {\n if (parent[expando]) {\n var inserted = void 0;\n inserted = parent[expando]._onDragOver({\n clientX: touchEvt.clientX,\n clientY: touchEvt.clientY,\n target: target,\n rootEl: parent\n });\n\n if (inserted && !this.options.dragoverBubble) {\n break;\n }\n }\n\n target = parent; // store last element\n }\n /* jshint boss:true */\n while (parent = parent.parentNode);\n }\n\n _unhideGhostForTarget();\n }\n },\n _onTouchMove: function _onTouchMove(\n /**TouchEvent*/\n evt) {\n if (tapEvt) {\n var options = this.options,\n fallbackTolerance = options.fallbackTolerance,\n fallbackOffset = options.fallbackOffset,\n touch = evt.touches ? evt.touches[0] : evt,\n ghostMatrix = ghostEl && matrix(ghostEl, true),\n scaleX = ghostEl && ghostMatrix && ghostMatrix.a,\n scaleY = ghostEl && ghostMatrix && ghostMatrix.d,\n relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),\n dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),\n dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging\n\n if (!Sortable.active && !awaitingDragStarted) {\n if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {\n return;\n }\n\n this._onDragStart(evt, true);\n }\n\n if (ghostEl) {\n if (ghostMatrix) {\n ghostMatrix.e += dx - (lastDx || 0);\n ghostMatrix.f += dy - (lastDy || 0);\n } else {\n ghostMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: dx,\n f: dy\n };\n }\n\n var cssMatrix = \"matrix(\".concat(ghostMatrix.a, \",\").concat(ghostMatrix.b, \",\").concat(ghostMatrix.c, \",\").concat(ghostMatrix.d, \",\").concat(ghostMatrix.e, \",\").concat(ghostMatrix.f, \")\");\n css(ghostEl, 'webkitTransform', cssMatrix);\n css(ghostEl, 'mozTransform', cssMatrix);\n css(ghostEl, 'msTransform', cssMatrix);\n css(ghostEl, 'transform', cssMatrix);\n lastDx = dx;\n lastDy = dy;\n touchEvt = touch;\n }\n\n evt.cancelable && evt.preventDefault();\n }\n },\n _appendGhost: function _appendGhost() {\n // Bug if using scale(): https://stackoverflow.com/questions/2637058\n // Not being adjusted for\n if (!ghostEl) {\n var container = this.options.fallbackOnBody ? document.body : rootEl,\n rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),\n options = this.options; // Position absolutely\n\n if (PositionGhostAbsolutely) {\n // Get relatively positioned parent\n ghostRelativeParent = container;\n\n while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {\n ghostRelativeParent = ghostRelativeParent.parentNode;\n }\n\n if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {\n if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();\n rect.top += ghostRelativeParent.scrollTop;\n rect.left += ghostRelativeParent.scrollLeft;\n } else {\n ghostRelativeParent = getWindowScrollingElement();\n }\n\n ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);\n }\n\n ghostEl = dragEl.cloneNode(true);\n toggleClass(ghostEl, options.ghostClass, false);\n toggleClass(ghostEl, options.fallbackClass, true);\n toggleClass(ghostEl, options.dragClass, true);\n css(ghostEl, 'transition', '');\n css(ghostEl, 'transform', '');\n css(ghostEl, 'box-sizing', 'border-box');\n css(ghostEl, 'margin', 0);\n css(ghostEl, 'top', rect.top);\n css(ghostEl, 'left', rect.left);\n css(ghostEl, 'width', rect.width);\n css(ghostEl, 'height', rect.height);\n css(ghostEl, 'opacity', '0.8');\n css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');\n css(ghostEl, 'zIndex', '100000');\n css(ghostEl, 'pointerEvents', 'none');\n Sortable.ghost = ghostEl;\n container.appendChild(ghostEl); // Set transform-origin\n\n css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');\n }\n },\n _onDragStart: function _onDragStart(\n /**Event*/\n evt,\n /**boolean*/\n fallback) {\n var _this = this;\n\n var dataTransfer = evt.dataTransfer;\n var options = _this.options;\n pluginEvent('dragStart', this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n }\n\n pluginEvent('setupClone', this);\n\n if (!Sortable.eventCanceled) {\n cloneEl = clone(dragEl);\n cloneEl.draggable = false;\n cloneEl.style['will-change'] = '';\n\n this._hideClone();\n\n toggleClass(cloneEl, this.options.chosenClass, false);\n Sortable.clone = cloneEl;\n } // #1143: IFrame support workaround\n\n\n _this.cloneId = _nextTick(function () {\n pluginEvent('clone', _this);\n if (Sortable.eventCanceled) return;\n\n if (!_this.options.removeCloneOnHide) {\n rootEl.insertBefore(cloneEl, dragEl);\n }\n\n _this._hideClone();\n\n _dispatchEvent({\n sortable: _this,\n name: 'clone'\n });\n });\n !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events\n\n if (fallback) {\n ignoreNextClick = true;\n _this._loopId = setInterval(_this._emulateDragOver, 50);\n } else {\n // Undo what was set in _prepareDragStart before drag started\n off(document, 'mouseup', _this._onDrop);\n off(document, 'touchend', _this._onDrop);\n off(document, 'touchcancel', _this._onDrop);\n\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move';\n options.setData && options.setData.call(_this, dataTransfer, dragEl);\n }\n\n on(document, 'drop', _this); // #1276 fix:\n\n css(dragEl, 'transform', 'translateZ(0)');\n }\n\n awaitingDragStarted = true;\n _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));\n on(document, 'selectstart', _this);\n moved = true;\n\n if (Safari) {\n css(document.body, 'user-select', 'none');\n }\n },\n // Returns true - if no further action is needed (either inserted or another condition)\n _onDragOver: function _onDragOver(\n /**Event*/\n evt) {\n var el = this.el,\n target = evt.target,\n dragRect,\n targetRect,\n revert,\n options = this.options,\n group = options.group,\n activeSortable = Sortable.active,\n isOwner = activeGroup === group,\n canSort = options.sort,\n fromSortable = putSortable || activeSortable,\n vertical,\n _this = this,\n completedFired = false;\n\n if (_silent) return;\n\n function dragOverEvent(name, extra) {\n pluginEvent(name, _this, _objectSpread({\n evt: evt,\n isOwner: isOwner,\n axis: vertical ? 'vertical' : 'horizontal',\n revert: revert,\n dragRect: dragRect,\n targetRect: targetRect,\n canSort: canSort,\n fromSortable: fromSortable,\n target: target,\n completed: completed,\n onMove: function onMove(target, after) {\n return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);\n },\n changed: changed\n }, extra));\n } // Capture animation state\n\n\n function capture() {\n dragOverEvent('dragOverAnimationCapture');\n\n _this.captureAnimationState();\n\n if (_this !== fromSortable) {\n fromSortable.captureAnimationState();\n }\n } // Return invocation when dragEl is inserted (or completed)\n\n\n function completed(insertion) {\n dragOverEvent('dragOverCompleted', {\n insertion: insertion\n });\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n } else {\n activeSortable._showClone(_this);\n }\n\n if (_this !== fromSortable) {\n // Set ghost class to new sortable's ghost class\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n }\n\n if (putSortable !== _this && _this !== Sortable.active) {\n putSortable = _this;\n } else if (_this === Sortable.active && putSortable) {\n putSortable = null;\n } // Animation\n\n\n if (fromSortable === _this) {\n _this._ignoreWhileAnimating = target;\n }\n\n _this.animateAll(function () {\n dragOverEvent('dragOverAnimationComplete');\n _this._ignoreWhileAnimating = null;\n });\n\n if (_this !== fromSortable) {\n fromSortable.animateAll();\n fromSortable._ignoreWhileAnimating = null;\n }\n } // Null lastTarget if it is not inside a previously swapped element\n\n\n if (target === dragEl && !dragEl.animated || target === el && !target.animated) {\n lastTarget = null;\n } // no bubbling and not fallback\n\n\n if (!options.dragoverBubble && !evt.rootEl && target !== document) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted\n\n\n !insertion && nearestEmptyInsertDetectEvent(evt);\n }\n\n !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();\n return completedFired = true;\n } // Call when dragEl has been inserted\n\n\n function changed() {\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n _dispatchEvent({\n sortable: _this,\n name: 'change',\n toEl: el,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n originalEvent: evt\n });\n }\n\n if (evt.preventDefault !== void 0) {\n evt.cancelable && evt.preventDefault();\n }\n\n target = closest(target, options.draggable, el, true);\n dragOverEvent('dragOver');\n if (Sortable.eventCanceled) return completedFired;\n\n if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {\n return completed(false);\n }\n\n ignoreNextClick = false;\n\n if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list\n : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {\n vertical = this._getDirection(evt, target) === 'vertical';\n dragRect = getRect(dragEl);\n dragOverEvent('dragOverValid');\n if (Sortable.eventCanceled) return completedFired;\n\n if (revert) {\n parentEl = rootEl; // actualization\n\n capture();\n\n this._hideClone();\n\n dragOverEvent('revert');\n\n if (!Sortable.eventCanceled) {\n if (nextEl) {\n rootEl.insertBefore(dragEl, nextEl);\n } else {\n rootEl.appendChild(dragEl);\n }\n }\n\n return completed(true);\n }\n\n var elLastChild = lastChild(el, options.draggable);\n\n if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {\n // If already at end of list: Do not insert\n if (elLastChild === dragEl) {\n return completed(false);\n } // assign target only if condition is true\n\n\n if (elLastChild && el === evt.target) {\n target = elLastChild;\n }\n\n if (target) {\n targetRect = getRect(target);\n }\n\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {\n capture();\n el.appendChild(dragEl);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (target.parentNode === el) {\n targetRect = getRect(target);\n var direction = 0,\n targetBeforeFirstSwap,\n differentLevel = dragEl.parentNode !== el,\n differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),\n side1 = vertical ? 'top' : 'left',\n scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),\n scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;\n\n if (lastTarget !== target) {\n targetBeforeFirstSwap = targetRect[side1];\n pastFirstInvertThresh = false;\n isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;\n }\n\n direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);\n var sibling;\n\n if (direction !== 0) {\n // Check if target is beside dragEl in respective direction (ignoring hidden elements)\n var dragIndex = index(dragEl);\n\n do {\n dragIndex -= direction;\n sibling = parentEl.children[dragIndex];\n } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));\n } // If dragEl is already beside target: Do not insert\n\n\n if (direction === 0 || sibling === target) {\n return completed(false);\n }\n\n lastTarget = target;\n lastDirection = direction;\n var nextSibling = target.nextElementSibling,\n after = false;\n after = direction === 1;\n\n var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);\n\n if (moveVector !== false) {\n if (moveVector === 1 || moveVector === -1) {\n after = moveVector === 1;\n }\n\n _silent = true;\n setTimeout(_unsilent, 30);\n capture();\n\n if (after && !nextSibling) {\n el.appendChild(dragEl);\n } else {\n target.parentNode.insertBefore(dragEl, after ? nextSibling : target);\n } // Undo chrome's scroll adjustment (has no effect on other browsers)\n\n\n if (scrolledPastTop) {\n scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);\n }\n\n parentEl = dragEl.parentNode; // actualization\n // must be done before animation\n\n if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {\n targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);\n }\n\n changed();\n return completed(true);\n }\n }\n\n if (el.contains(dragEl)) {\n return completed(false);\n }\n }\n\n return false;\n },\n _ignoreWhileAnimating: null,\n _offMoveEvents: function _offMoveEvents() {\n off(document, 'mousemove', this._onTouchMove);\n off(document, 'touchmove', this._onTouchMove);\n off(document, 'pointermove', this._onTouchMove);\n off(document, 'dragover', nearestEmptyInsertDetectEvent);\n off(document, 'mousemove', nearestEmptyInsertDetectEvent);\n off(document, 'touchmove', nearestEmptyInsertDetectEvent);\n },\n _offUpEvents: function _offUpEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._onDrop);\n off(ownerDocument, 'touchend', this._onDrop);\n off(ownerDocument, 'pointerup', this._onDrop);\n off(ownerDocument, 'touchcancel', this._onDrop);\n off(document, 'selectstart', this);\n },\n _onDrop: function _onDrop(\n /**Event*/\n evt) {\n var el = this.el,\n options = this.options; // Get the index of the dragged element within its parent\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n pluginEvent('drop', this, {\n evt: evt\n });\n parentEl = dragEl && dragEl.parentNode; // Get again after plugin event\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n if (Sortable.eventCanceled) {\n this._nulling();\n\n return;\n }\n\n awaitingDragStarted = false;\n isCircumstantialInvert = false;\n pastFirstInvertThresh = false;\n clearInterval(this._loopId);\n clearTimeout(this._dragStartTimer);\n\n _cancelNextTick(this.cloneId);\n\n _cancelNextTick(this._dragStartId); // Unbind events\n\n\n if (this.nativeDraggable) {\n off(document, 'drop', this);\n off(el, 'dragstart', this._onDragStart);\n }\n\n this._offMoveEvents();\n\n this._offUpEvents();\n\n if (Safari) {\n css(document.body, 'user-select', '');\n }\n\n css(dragEl, 'transform', '');\n\n if (evt) {\n if (moved) {\n evt.cancelable && evt.preventDefault();\n !options.dropBubble && evt.stopPropagation();\n }\n\n ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n // Remove clone(s)\n cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);\n }\n\n if (dragEl) {\n if (this.nativeDraggable) {\n off(dragEl, 'dragend', this);\n }\n\n _disableDraggable(dragEl);\n\n dragEl.style['will-change'] = ''; // Remove classes\n // ghostClass is added in dragStarted\n\n if (moved && !awaitingDragStarted) {\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);\n }\n\n toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event\n\n _dispatchEvent({\n sortable: this,\n name: 'unchoose',\n toEl: parentEl,\n newIndex: null,\n newDraggableIndex: null,\n originalEvent: evt\n });\n\n if (rootEl !== parentEl) {\n if (newIndex >= 0) {\n // Add event\n _dispatchEvent({\n rootEl: parentEl,\n name: 'add',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n }); // Remove event\n\n\n _dispatchEvent({\n sortable: this,\n name: 'remove',\n toEl: parentEl,\n originalEvent: evt\n }); // drag from one list and drop into another\n\n\n _dispatchEvent({\n rootEl: parentEl,\n name: 'sort',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n\n putSortable && putSortable.save();\n } else {\n if (newIndex !== oldIndex) {\n if (newIndex >= 0) {\n // drag & drop within the same list\n _dispatchEvent({\n sortable: this,\n name: 'update',\n toEl: parentEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n }\n }\n\n if (Sortable.active) {\n /* jshint eqnull:true */\n if (newIndex == null || newIndex === -1) {\n newIndex = oldIndex;\n newDraggableIndex = oldDraggableIndex;\n }\n\n _dispatchEvent({\n sortable: this,\n name: 'end',\n toEl: parentEl,\n originalEvent: evt\n }); // Save sorting\n\n\n this.save();\n }\n }\n }\n\n this._nulling();\n },\n _nulling: function _nulling() {\n pluginEvent('nulling', this);\n rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;\n savedInputChecked.forEach(function (el) {\n el.checked = true;\n });\n savedInputChecked.length = lastDx = lastDy = 0;\n },\n handleEvent: function handleEvent(\n /**Event*/\n evt) {\n switch (evt.type) {\n case 'drop':\n case 'dragend':\n this._onDrop(evt);\n\n break;\n\n case 'dragenter':\n case 'dragover':\n if (dragEl) {\n this._onDragOver(evt);\n\n _globalDragOver(evt);\n }\n\n break;\n\n case 'selectstart':\n evt.preventDefault();\n break;\n }\n },\n\n /**\n * Serializes the item into an array of string.\n * @returns {String[]}\n */\n toArray: function toArray() {\n var order = [],\n el,\n children = this.el.children,\n i = 0,\n n = children.length,\n options = this.options;\n\n for (; i < n; i++) {\n el = children[i];\n\n if (closest(el, options.draggable, this.el, false)) {\n order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));\n }\n }\n\n return order;\n },\n\n /**\n * Sorts the elements according to the array.\n * @param {String[]} order order of the items\n */\n sort: function sort(order, useAnimation) {\n var items = {},\n rootEl = this.el;\n this.toArray().forEach(function (id, i) {\n var el = rootEl.children[i];\n\n if (closest(el, this.options.draggable, rootEl, false)) {\n items[id] = el;\n }\n }, this);\n useAnimation && this.captureAnimationState();\n order.forEach(function (id) {\n if (items[id]) {\n rootEl.removeChild(items[id]);\n rootEl.appendChild(items[id]);\n }\n });\n useAnimation && this.animateAll();\n },\n\n /**\n * Save the current sorting\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n\n /**\n * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.\n * @param {HTMLElement} el\n * @param {String} [selector] default: `options.draggable`\n * @returns {HTMLElement|null}\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n\n /**\n * Set/get option\n * @param {string} name\n * @param {*} [value]\n * @returns {*}\n */\n option: function option(name, value) {\n var options = this.options;\n\n if (value === void 0) {\n return options[name];\n } else {\n var modifiedValue = PluginManager.modifyOption(this, name, value);\n\n if (typeof modifiedValue !== 'undefined') {\n options[name] = modifiedValue;\n } else {\n options[name] = value;\n }\n\n if (name === 'group') {\n _prepareGroup(options);\n }\n }\n },\n\n /**\n * Destroy\n */\n destroy: function destroy() {\n pluginEvent('destroy', this);\n var el = this.el;\n el[expando] = null;\n off(el, 'mousedown', this._onTapStart);\n off(el, 'touchstart', this._onTapStart);\n off(el, 'pointerdown', this._onTapStart);\n\n if (this.nativeDraggable) {\n off(el, 'dragover', this);\n off(el, 'dragenter', this);\n } // Remove draggable attributes\n\n\n Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {\n el.removeAttribute('draggable');\n });\n\n this._onDrop();\n\n this._disableDelayedDragEvents();\n\n sortables.splice(sortables.indexOf(this.el), 1);\n this.el = el = null;\n },\n _hideClone: function _hideClone() {\n if (!cloneHidden) {\n pluginEvent('hideClone', this);\n if (Sortable.eventCanceled) return;\n css(cloneEl, 'display', 'none');\n\n if (this.options.removeCloneOnHide && cloneEl.parentNode) {\n cloneEl.parentNode.removeChild(cloneEl);\n }\n\n cloneHidden = true;\n }\n },\n _showClone: function _showClone(putSortable) {\n if (putSortable.lastPutMode !== 'clone') {\n this._hideClone();\n\n return;\n }\n\n if (cloneHidden) {\n pluginEvent('showClone', this);\n if (Sortable.eventCanceled) return; // show clone at dragEl or original position\n\n if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {\n rootEl.insertBefore(cloneEl, dragEl);\n } else if (nextEl) {\n rootEl.insertBefore(cloneEl, nextEl);\n } else {\n rootEl.appendChild(cloneEl);\n }\n\n if (this.options.group.revertClone) {\n this.animate(dragEl, cloneEl);\n }\n\n css(cloneEl, 'display', '');\n cloneHidden = false;\n }\n }\n};\n\nfunction _globalDragOver(\n/**Event*/\nevt) {\n if (evt.dataTransfer) {\n evt.dataTransfer.dropEffect = 'move';\n }\n\n evt.cancelable && evt.preventDefault();\n}\n\nfunction _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {\n var evt,\n sortable = fromEl[expando],\n onMoveFn = sortable.options.onMove,\n retVal; // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent('move', {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent('move', true, true);\n }\n\n evt.to = toEl;\n evt.from = fromEl;\n evt.dragged = dragEl;\n evt.draggedRect = dragRect;\n evt.related = targetEl || toEl;\n evt.relatedRect = targetRect || getRect(toEl);\n evt.willInsertAfter = willInsertAfter;\n evt.originalEvent = originalEvent;\n fromEl.dispatchEvent(evt);\n\n if (onMoveFn) {\n retVal = onMoveFn.call(sortable, evt, originalEvent);\n }\n\n return retVal;\n}\n\nfunction _disableDraggable(el) {\n el.draggable = false;\n}\n\nfunction _unsilent() {\n _silent = false;\n}\n\nfunction _ghostIsLast(evt, vertical, sortable) {\n var rect = getRect(lastChild(sortable.el, sortable.options.draggable));\n var spacer = 10;\n return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer;\n}\n\nfunction _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {\n var mouseOnAxis = vertical ? evt.clientY : evt.clientX,\n targetLength = vertical ? targetRect.height : targetRect.width,\n targetS1 = vertical ? targetRect.top : targetRect.left,\n targetS2 = vertical ? targetRect.bottom : targetRect.right,\n invert = false;\n\n if (!invertSwap) {\n // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold\n if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {\n // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2\n // check if past first invert threshold on side opposite of lastDirection\n if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {\n // past first invert threshold, do not restrict inverted threshold to dragEl shadow\n pastFirstInvertThresh = true;\n }\n\n if (!pastFirstInvertThresh) {\n // dragEl shadow (target move distance shadow)\n if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow\n : mouseOnAxis > targetS2 - targetMoveDistance) {\n return -lastDirection;\n }\n } else {\n invert = true;\n }\n } else {\n // Regular\n if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {\n return _getInsertDirection(target);\n }\n }\n }\n\n invert = invert || invertSwap;\n\n if (invert) {\n // Invert of regular\n if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {\n return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;\n }\n }\n\n return 0;\n}\n/**\n * Gets the direction dragEl must be swapped relative to target in order to make it\n * seem that dragEl has been \"inserted\" into that element's position\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\n * @return {Number} Direction dragEl must be swapped\n */\n\n\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n/**\n * Generate id\n * @param {HTMLElement} el\n * @returns {String}\n * @private\n */\n\n\nfunction _generateId(el) {\n var str = el.tagName + el.className + el.src + el.href + el.textContent,\n i = str.length,\n sum = 0;\n\n while (i--) {\n sum += str.charCodeAt(i);\n }\n\n return sum.toString(36);\n}\n\nfunction _saveInputCheckedState(root) {\n savedInputChecked.length = 0;\n var inputs = root.getElementsByTagName('input');\n var idx = inputs.length;\n\n while (idx--) {\n var el = inputs[idx];\n el.checked && savedInputChecked.push(el);\n }\n}\n\nfunction _nextTick(fn) {\n return setTimeout(fn, 0);\n}\n\nfunction _cancelNextTick(id) {\n return clearTimeout(id);\n} // Fixed #973:\n\n\nif (documentExists) {\n on(document, 'touchmove', function (evt) {\n if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {\n evt.preventDefault();\n }\n });\n} // Export utils\n\n\nSortable.utils = {\n on: on,\n off: off,\n css: css,\n find: find,\n is: function is(el, selector) {\n return !!closest(el, selector, el, false);\n },\n extend: extend,\n throttle: throttle,\n closest: closest,\n toggleClass: toggleClass,\n clone: clone,\n index: index,\n nextTick: _nextTick,\n cancelNextTick: _cancelNextTick,\n detectDirection: _detectDirection,\n getChild: getChild\n};\n/**\n * Get the Sortable instance of an element\n * @param {HTMLElement} element The element\n * @return {Sortable|undefined} The instance of Sortable\n */\n\nSortable.get = function (element) {\n return element[expando];\n};\n/**\n * Mount a plugin to Sortable\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\n */\n\n\nSortable.mount = function () {\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n\n if (plugins[0].constructor === Array) plugins = plugins[0];\n plugins.forEach(function (plugin) {\n if (!plugin.prototype || !plugin.prototype.constructor) {\n throw \"Sortable: Mounted plugin must be a constructor function, not \".concat({}.toString.call(plugin));\n }\n\n if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils);\n PluginManager.mount(plugin);\n });\n};\n/**\n * Create sortable instance\n * @param {HTMLElement} el\n * @param {Object} [options]\n */\n\n\nSortable.create = function (el, options) {\n return new Sortable(el, options);\n}; // Export\n\n\nSortable.version = version;\n\nvar autoScrolls = [],\n scrollEl,\n scrollRootEl,\n scrolling = false,\n lastAutoScrollX,\n lastAutoScrollY,\n touchEvt$1,\n pointerElemChangedInterval;\n\nfunction AutoScrollPlugin() {\n function AutoScroll() {\n this.defaults = {\n scroll: true,\n scrollSensitivity: 30,\n scrollSpeed: 10,\n bubbleScroll: true\n }; // Bind all private methods\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n }\n\n AutoScroll.prototype = {\n dragStarted: function dragStarted(_ref) {\n var originalEvent = _ref.originalEvent;\n\n if (this.sortable.nativeDraggable) {\n on(document, 'dragover', this._handleAutoScroll);\n } else {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._handleFallbackAutoScroll);\n } else if (originalEvent.touches) {\n on(document, 'touchmove', this._handleFallbackAutoScroll);\n } else {\n on(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref2) {\n var originalEvent = _ref2.originalEvent;\n\n // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)\n if (!this.options.dragOverBubble && !originalEvent.rootEl) {\n this._handleAutoScroll(originalEvent);\n }\n },\n drop: function drop() {\n if (this.sortable.nativeDraggable) {\n off(document, 'dragover', this._handleAutoScroll);\n } else {\n off(document, 'pointermove', this._handleFallbackAutoScroll);\n off(document, 'touchmove', this._handleFallbackAutoScroll);\n off(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n\n clearPointerElemChangedInterval();\n clearAutoScrolls();\n cancelThrottle();\n },\n nulling: function nulling() {\n touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;\n autoScrolls.length = 0;\n },\n _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {\n this._handleAutoScroll(evt, true);\n },\n _handleAutoScroll: function _handleAutoScroll(evt, fallback) {\n var _this = this;\n\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n elem = document.elementFromPoint(x, y);\n touchEvt$1 = evt; // IE does not seem to have native autoscroll,\n // Edge's autoscroll seems too conditional,\n // MACOS Safari does not have autoscroll,\n // Firefox and Chrome are good\n\n if (fallback || Edge || IE11OrLess || Safari) {\n autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change\n\n var ogElemScroller = getParentAutoScrollElement(elem, true);\n\n if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {\n pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour\n\n pointerElemChangedInterval = setInterval(function () {\n var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);\n\n if (newElem !== ogElemScroller) {\n ogElemScroller = newElem;\n clearAutoScrolls();\n }\n\n autoScroll(evt, _this.options, newElem, fallback);\n }, 10);\n lastAutoScrollX = x;\n lastAutoScrollY = y;\n }\n } else {\n // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll\n if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {\n clearAutoScrolls();\n return;\n }\n\n autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);\n }\n }\n };\n return _extends(AutoScroll, {\n pluginName: 'scroll',\n initializeByDefault: true\n });\n}\n\nfunction clearAutoScrolls() {\n autoScrolls.forEach(function (autoScroll) {\n clearInterval(autoScroll.pid);\n });\n autoScrolls = [];\n}\n\nfunction clearPointerElemChangedInterval() {\n clearInterval(pointerElemChangedInterval);\n}\n\nvar autoScroll = throttle(function (evt, options, rootEl, isFallback) {\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n if (!options.scroll) return;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n sens = options.scrollSensitivity,\n speed = options.scrollSpeed,\n winScroller = getWindowScrollingElement();\n var scrollThisInstance = false,\n scrollCustomFn; // New scroll root, set scrollEl\n\n if (scrollRootEl !== rootEl) {\n scrollRootEl = rootEl;\n clearAutoScrolls();\n scrollEl = options.scroll;\n scrollCustomFn = options.scrollFn;\n\n if (scrollEl === true) {\n scrollEl = getParentAutoScrollElement(rootEl, true);\n }\n }\n\n var layersOut = 0;\n var currentParent = scrollEl;\n\n do {\n var el = currentParent,\n rect = getRect(el),\n top = rect.top,\n bottom = rect.bottom,\n left = rect.left,\n right = rect.right,\n width = rect.width,\n height = rect.height,\n canScrollX = void 0,\n canScrollY = void 0,\n scrollWidth = el.scrollWidth,\n scrollHeight = el.scrollHeight,\n elCSS = css(el),\n scrollPosX = el.scrollLeft,\n scrollPosY = el.scrollTop;\n\n if (el === winScroller) {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');\n } else {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');\n }\n\n var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);\n var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);\n\n if (!autoScrolls[layersOut]) {\n for (var i = 0; i <= layersOut; i++) {\n if (!autoScrolls[i]) {\n autoScrolls[i] = {};\n }\n }\n }\n\n if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {\n autoScrolls[layersOut].el = el;\n autoScrolls[layersOut].vx = vx;\n autoScrolls[layersOut].vy = vy;\n clearInterval(autoScrolls[layersOut].pid);\n\n if (vx != 0 || vy != 0) {\n scrollThisInstance = true;\n /* jshint loopfunc:true */\n\n autoScrolls[layersOut].pid = setInterval(function () {\n // emulate drag over during autoscroll (fallback), emulating native DnD behaviour\n if (isFallback && this.layer === 0) {\n Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely\n\n }\n\n var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;\n var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;\n\n if (typeof scrollCustomFn === 'function') {\n if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {\n return;\n }\n }\n\n scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);\n }.bind({\n layer: layersOut\n }), 24);\n }\n }\n\n layersOut++;\n } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));\n\n scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not\n}, 30);\n\nvar drop = function drop(_ref) {\n var originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n dragEl = _ref.dragEl,\n activeSortable = _ref.activeSortable,\n dispatchSortableEvent = _ref.dispatchSortableEvent,\n hideGhostForTarget = _ref.hideGhostForTarget,\n unhideGhostForTarget = _ref.unhideGhostForTarget;\n if (!originalEvent) return;\n var toSortable = putSortable || activeSortable;\n hideGhostForTarget();\n var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;\n var target = document.elementFromPoint(touch.clientX, touch.clientY);\n unhideGhostForTarget();\n\n if (toSortable && !toSortable.el.contains(target)) {\n dispatchSortableEvent('spill');\n this.onSpill({\n dragEl: dragEl,\n putSortable: putSortable\n });\n }\n};\n\nfunction Revert() {}\n\nRevert.prototype = {\n startIndex: null,\n dragStart: function dragStart(_ref2) {\n var oldDraggableIndex = _ref2.oldDraggableIndex;\n this.startIndex = oldDraggableIndex;\n },\n onSpill: function onSpill(_ref3) {\n var dragEl = _ref3.dragEl,\n putSortable = _ref3.putSortable;\n this.sortable.captureAnimationState();\n\n if (putSortable) {\n putSortable.captureAnimationState();\n }\n\n var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);\n\n if (nextSibling) {\n this.sortable.el.insertBefore(dragEl, nextSibling);\n } else {\n this.sortable.el.appendChild(dragEl);\n }\n\n this.sortable.animateAll();\n\n if (putSortable) {\n putSortable.animateAll();\n }\n },\n drop: drop\n};\n\n_extends(Revert, {\n pluginName: 'revertOnSpill'\n});\n\nfunction Remove() {}\n\nRemove.prototype = {\n onSpill: function onSpill(_ref4) {\n var dragEl = _ref4.dragEl,\n putSortable = _ref4.putSortable;\n var parentSortable = putSortable || this.sortable;\n parentSortable.captureAnimationState();\n dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n parentSortable.animateAll();\n },\n drop: drop\n};\n\n_extends(Remove, {\n pluginName: 'removeOnSpill'\n});\n\nvar lastSwapEl;\n\nfunction SwapPlugin() {\n function Swap() {\n this.defaults = {\n swapClass: 'sortable-swap-highlight'\n };\n }\n\n Swap.prototype = {\n dragStart: function dragStart(_ref) {\n var dragEl = _ref.dragEl;\n lastSwapEl = dragEl;\n },\n dragOverValid: function dragOverValid(_ref2) {\n var completed = _ref2.completed,\n target = _ref2.target,\n onMove = _ref2.onMove,\n activeSortable = _ref2.activeSortable,\n changed = _ref2.changed,\n cancel = _ref2.cancel;\n if (!activeSortable.options.swap) return;\n var el = this.sortable.el,\n options = this.options;\n\n if (target && target !== el) {\n var prevSwapEl = lastSwapEl;\n\n if (onMove(target) !== false) {\n toggleClass(target, options.swapClass, true);\n lastSwapEl = target;\n } else {\n lastSwapEl = null;\n }\n\n if (prevSwapEl && prevSwapEl !== lastSwapEl) {\n toggleClass(prevSwapEl, options.swapClass, false);\n }\n }\n\n changed();\n completed(true);\n cancel();\n },\n drop: function drop(_ref3) {\n var activeSortable = _ref3.activeSortable,\n putSortable = _ref3.putSortable,\n dragEl = _ref3.dragEl;\n var toSortable = putSortable || this.sortable;\n var options = this.options;\n lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);\n\n if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {\n if (dragEl !== lastSwapEl) {\n toSortable.captureAnimationState();\n if (toSortable !== activeSortable) activeSortable.captureAnimationState();\n swapNodes(dragEl, lastSwapEl);\n toSortable.animateAll();\n if (toSortable !== activeSortable) activeSortable.animateAll();\n }\n }\n },\n nulling: function nulling() {\n lastSwapEl = null;\n }\n };\n return _extends(Swap, {\n pluginName: 'swap',\n eventProperties: function eventProperties() {\n return {\n swapItem: lastSwapEl\n };\n }\n });\n}\n\nfunction swapNodes(n1, n2) {\n var p1 = n1.parentNode,\n p2 = n2.parentNode,\n i1,\n i2;\n if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;\n i1 = index(n1);\n i2 = index(n2);\n\n if (p1.isEqualNode(p2) && i1 < i2) {\n i2++;\n }\n\n p1.insertBefore(n2, p1.children[i1]);\n p2.insertBefore(n1, p2.children[i2]);\n}\n\nvar multiDragElements = [],\n multiDragClones = [],\n lastMultiDragSelect,\n // for selection with modifier key down (SHIFT)\nmultiDragSortable,\n initialFolding = false,\n // Initial multi-drag fold when drag started\nfolding = false,\n // Folding any other time\ndragStarted = false,\n dragEl$1,\n clonesFromRect,\n clonesHidden;\n\nfunction MultiDragPlugin() {\n function MultiDrag(sortable) {\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n\n if (sortable.options.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\n }\n\n on(document, 'keydown', this._checkKeyDown);\n on(document, 'keyup', this._checkKeyUp);\n this.defaults = {\n selectedClass: 'sortable-selected',\n multiDragKey: null,\n setData: function setData(dataTransfer, dragEl) {\n var data = '';\n\n if (multiDragElements.length && multiDragSortable === sortable) {\n multiDragElements.forEach(function (multiDragElement, i) {\n data += (!i ? '' : ', ') + multiDragElement.textContent;\n });\n } else {\n data = dragEl.textContent;\n }\n\n dataTransfer.setData('Text', data);\n }\n };\n }\n\n MultiDrag.prototype = {\n multiDragKeyDown: false,\n isMultiDrag: false,\n delayStartGlobal: function delayStartGlobal(_ref) {\n var dragged = _ref.dragEl;\n dragEl$1 = dragged;\n },\n delayEnded: function delayEnded() {\n this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);\n },\n setupClone: function setupClone(_ref2) {\n var sortable = _ref2.sortable,\n cancel = _ref2.cancel;\n if (!this.isMultiDrag) return;\n\n for (var i = 0; i < multiDragElements.length; i++) {\n multiDragClones.push(clone(multiDragElements[i]));\n multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;\n multiDragClones[i].draggable = false;\n multiDragClones[i].style['will-change'] = '';\n toggleClass(multiDragClones[i], this.options.selectedClass, false);\n multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);\n }\n\n sortable._hideClone();\n\n cancel();\n },\n clone: function clone(_ref3) {\n var sortable = _ref3.sortable,\n rootEl = _ref3.rootEl,\n dispatchSortableEvent = _ref3.dispatchSortableEvent,\n cancel = _ref3.cancel;\n if (!this.isMultiDrag) return;\n\n if (!this.options.removeCloneOnHide) {\n if (multiDragElements.length && multiDragSortable === sortable) {\n insertMultiDragClones(true, rootEl);\n dispatchSortableEvent('clone');\n cancel();\n }\n }\n },\n showClone: function showClone(_ref4) {\n var cloneNowShown = _ref4.cloneNowShown,\n rootEl = _ref4.rootEl,\n cancel = _ref4.cancel;\n if (!this.isMultiDrag) return;\n insertMultiDragClones(false, rootEl);\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', '');\n });\n cloneNowShown();\n clonesHidden = false;\n cancel();\n },\n hideClone: function hideClone(_ref5) {\n var _this = this;\n\n var sortable = _ref5.sortable,\n cloneNowHidden = _ref5.cloneNowHidden,\n cancel = _ref5.cancel;\n if (!this.isMultiDrag) return;\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', 'none');\n\n if (_this.options.removeCloneOnHide && clone.parentNode) {\n clone.parentNode.removeChild(clone);\n }\n });\n cloneNowHidden();\n clonesHidden = true;\n cancel();\n },\n dragStartGlobal: function dragStartGlobal(_ref6) {\n var sortable = _ref6.sortable;\n\n if (!this.isMultiDrag && multiDragSortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n }\n\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.sortableIndex = index(multiDragElement);\n }); // Sort multi-drag elements\n\n multiDragElements = multiDragElements.sort(function (a, b) {\n return a.sortableIndex - b.sortableIndex;\n });\n dragStarted = true;\n },\n dragStarted: function dragStarted(_ref7) {\n var _this2 = this;\n\n var sortable = _ref7.sortable;\n if (!this.isMultiDrag) return;\n\n if (this.options.sort) {\n // Capture rects,\n // hide multi drag elements (by positioning them absolute),\n // set multi drag elements rects to dragRect,\n // show multi drag elements,\n // animate to rects,\n // unset rects & remove from DOM\n sortable.captureAnimationState();\n\n if (this.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n css(multiDragElement, 'position', 'absolute');\n });\n var dragRect = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRect);\n });\n folding = true;\n initialFolding = true;\n }\n }\n\n sortable.animateAll(function () {\n folding = false;\n initialFolding = false;\n\n if (_this2.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n } // Remove all auxiliary multidrag items from el, if sorting enabled\n\n\n if (_this2.options.sort) {\n removeMultiDragElements();\n }\n });\n },\n dragOver: function dragOver(_ref8) {\n var target = _ref8.target,\n completed = _ref8.completed,\n cancel = _ref8.cancel;\n\n if (folding && ~multiDragElements.indexOf(target)) {\n completed(false);\n cancel();\n }\n },\n revert: function revert(_ref9) {\n var fromSortable = _ref9.fromSortable,\n rootEl = _ref9.rootEl,\n sortable = _ref9.sortable,\n dragRect = _ref9.dragRect;\n\n if (multiDragElements.length > 1) {\n // Setup unfold animation\n multiDragElements.forEach(function (multiDragElement) {\n sortable.addAnimationState({\n target: multiDragElement,\n rect: folding ? getRect(multiDragElement) : dragRect\n });\n unsetRect(multiDragElement);\n multiDragElement.fromRect = dragRect;\n fromSortable.removeAnimationState(multiDragElement);\n });\n folding = false;\n insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref10) {\n var sortable = _ref10.sortable,\n isOwner = _ref10.isOwner,\n insertion = _ref10.insertion,\n activeSortable = _ref10.activeSortable,\n parentEl = _ref10.parentEl,\n putSortable = _ref10.putSortable;\n var options = this.options;\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n }\n\n initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location\n\n if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {\n // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible\n var dragRectAbsolute = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted\n // while folding, and so that we can capture them again because old sortable will no longer be fromSortable\n\n parentEl.appendChild(multiDragElement);\n });\n folding = true;\n } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out\n\n\n if (!isOwner) {\n // Only remove if not folding (folding will remove them anyways)\n if (!folding) {\n removeMultiDragElements();\n }\n\n if (multiDragElements.length > 1) {\n var clonesHiddenBefore = clonesHidden;\n\n activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden\n\n\n if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {\n multiDragClones.forEach(function (clone) {\n activeSortable.addAnimationState({\n target: clone,\n rect: clonesFromRect\n });\n clone.fromRect = clonesFromRect;\n clone.thisAnimationDuration = null;\n });\n }\n } else {\n activeSortable._showClone(sortable);\n }\n }\n }\n },\n dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {\n var dragRect = _ref11.dragRect,\n isOwner = _ref11.isOwner,\n activeSortable = _ref11.activeSortable;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n });\n\n if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {\n clonesFromRect = _extends({}, dragRect);\n var dragMatrix = matrix(dragEl$1, true);\n clonesFromRect.top -= dragMatrix.f;\n clonesFromRect.left -= dragMatrix.e;\n }\n },\n dragOverAnimationComplete: function dragOverAnimationComplete() {\n if (folding) {\n folding = false;\n removeMultiDragElements();\n }\n },\n drop: function drop(_ref12) {\n var evt = _ref12.originalEvent,\n rootEl = _ref12.rootEl,\n parentEl = _ref12.parentEl,\n sortable = _ref12.sortable,\n dispatchSortableEvent = _ref12.dispatchSortableEvent,\n oldIndex = _ref12.oldIndex,\n putSortable = _ref12.putSortable;\n var toSortable = putSortable || this.sortable;\n if (!evt) return;\n var options = this.options,\n children = parentEl.children; // Multi-drag selection\n\n if (!dragStarted) {\n if (options.multiDragKey && !this.multiDragKeyDown) {\n this._deselectMultiDrag();\n }\n\n toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));\n\n if (!~multiDragElements.indexOf(dragEl$1)) {\n multiDragElements.push(dragEl$1);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: dragEl$1,\n originalEvt: evt\n }); // Modifier activated, select from last to dragEl\n\n if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {\n var lastIndex = index(lastMultiDragSelect),\n currentIndex = index(dragEl$1);\n\n if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {\n // Must include lastMultiDragSelect (select it), in case modified selection from no selection\n // (but previous selection existed)\n var n, i;\n\n if (currentIndex > lastIndex) {\n i = lastIndex;\n n = currentIndex;\n } else {\n i = currentIndex;\n n = lastIndex + 1;\n }\n\n for (; i < n; i++) {\n if (~multiDragElements.indexOf(children[i])) continue;\n toggleClass(children[i], options.selectedClass, true);\n multiDragElements.push(children[i]);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: children[i],\n originalEvt: evt\n });\n }\n }\n } else {\n lastMultiDragSelect = dragEl$1;\n }\n\n multiDragSortable = toSortable;\n } else {\n multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);\n lastMultiDragSelect = null;\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'deselect',\n targetEl: dragEl$1,\n originalEvt: evt\n });\n }\n } // Multi-drag drop\n\n\n if (dragStarted && this.isMultiDrag) {\n // Do not \"unfold\" after around dragEl if reverted\n if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {\n var dragRect = getRect(dragEl$1),\n multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');\n if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;\n toSortable.captureAnimationState();\n\n if (!initialFolding) {\n if (options.animation) {\n dragEl$1.fromRect = dragRect;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n\n if (multiDragElement !== dragEl$1) {\n var rect = folding ? getRect(multiDragElement) : dragRect;\n multiDragElement.fromRect = rect; // Prepare unfold animation\n\n toSortable.addAnimationState({\n target: multiDragElement,\n rect: rect\n });\n }\n });\n } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert\n // properly they must all be removed\n\n\n removeMultiDragElements();\n multiDragElements.forEach(function (multiDragElement) {\n if (children[multiDragIndex]) {\n parentEl.insertBefore(multiDragElement, children[multiDragIndex]);\n } else {\n parentEl.appendChild(multiDragElement);\n }\n\n multiDragIndex++;\n }); // If initial folding is done, the elements may have changed position because they are now\n // unfolding around dragEl, even though dragEl may not have his index changed, so update event\n // must be fired here as Sortable will not.\n\n if (oldIndex === index(dragEl$1)) {\n var update = false;\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement.sortableIndex !== index(multiDragElement)) {\n update = true;\n return;\n }\n });\n\n if (update) {\n dispatchSortableEvent('update');\n }\n }\n } // Must be done after capturing individual rects (scroll bar)\n\n\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n toSortable.animateAll();\n }\n\n multiDragSortable = toSortable;\n } // Remove clones if necessary\n\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n multiDragClones.forEach(function (clone) {\n clone.parentNode && clone.parentNode.removeChild(clone);\n });\n }\n },\n nullingGlobal: function nullingGlobal() {\n this.isMultiDrag = dragStarted = false;\n multiDragClones.length = 0;\n },\n destroyGlobal: function destroyGlobal() {\n this._deselectMultiDrag();\n\n off(document, 'pointerup', this._deselectMultiDrag);\n off(document, 'mouseup', this._deselectMultiDrag);\n off(document, 'touchend', this._deselectMultiDrag);\n off(document, 'keydown', this._checkKeyDown);\n off(document, 'keyup', this._checkKeyUp);\n },\n _deselectMultiDrag: function _deselectMultiDrag(evt) {\n if (typeof dragStarted !== \"undefined\" && dragStarted) return; // Only deselect if selection is in this sortable\n\n if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable\n\n if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click\n\n if (evt && evt.button !== 0) return;\n\n while (multiDragElements.length) {\n var el = multiDragElements[0];\n toggleClass(el, this.options.selectedClass, false);\n multiDragElements.shift();\n dispatchEvent({\n sortable: this.sortable,\n rootEl: this.sortable.el,\n name: 'deselect',\n targetEl: el,\n originalEvt: evt\n });\n }\n },\n _checkKeyDown: function _checkKeyDown(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = true;\n }\n },\n _checkKeyUp: function _checkKeyUp(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = false;\n }\n }\n };\n return _extends(MultiDrag, {\n // Static methods & properties\n pluginName: 'multiDrag',\n utils: {\n /**\r\n * Selects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be selected\r\n */\n select: function select(el) {\n var sortable = el.parentNode[expando];\n if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;\n\n if (multiDragSortable && multiDragSortable !== sortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n\n multiDragSortable = sortable;\n }\n\n toggleClass(el, sortable.options.selectedClass, true);\n multiDragElements.push(el);\n },\n\n /**\r\n * Deselects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be deselected\r\n */\n deselect: function deselect(el) {\n var sortable = el.parentNode[expando],\n index = multiDragElements.indexOf(el);\n if (!sortable || !sortable.options.multiDrag || !~index) return;\n toggleClass(el, sortable.options.selectedClass, false);\n multiDragElements.splice(index, 1);\n }\n },\n eventProperties: function eventProperties() {\n var _this3 = this;\n\n var oldIndicies = [],\n newIndicies = [];\n multiDragElements.forEach(function (multiDragElement) {\n oldIndicies.push({\n multiDragElement: multiDragElement,\n index: multiDragElement.sortableIndex\n }); // multiDragElements will already be sorted if folding\n\n var newIndex;\n\n if (folding && multiDragElement !== dragEl$1) {\n newIndex = -1;\n } else if (folding) {\n newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');\n } else {\n newIndex = index(multiDragElement);\n }\n\n newIndicies.push({\n multiDragElement: multiDragElement,\n index: newIndex\n });\n });\n return {\n items: _toConsumableArray(multiDragElements),\n clones: [].concat(multiDragClones),\n oldIndicies: oldIndicies,\n newIndicies: newIndicies\n };\n },\n optionListeners: {\n multiDragKey: function multiDragKey(key) {\n key = key.toLowerCase();\n\n if (key === 'ctrl') {\n key = 'Control';\n } else if (key.length > 1) {\n key = key.charAt(0).toUpperCase() + key.substr(1);\n }\n\n return key;\n }\n }\n });\n}\n\nfunction insertMultiDragElements(clonesInserted, rootEl) {\n multiDragElements.forEach(function (multiDragElement, i) {\n var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(multiDragElement, target);\n } else {\n rootEl.appendChild(multiDragElement);\n }\n });\n}\n/**\r\n * Insert multi-drag clones\r\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\r\n * @param {HTMLElement} rootEl\r\n */\n\n\nfunction insertMultiDragClones(elementsInserted, rootEl) {\n multiDragClones.forEach(function (clone, i) {\n var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(clone, target);\n } else {\n rootEl.appendChild(clone);\n }\n });\n}\n\nfunction removeMultiDragElements() {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);\n });\n}\n\nSortable.mount(new AutoScrollPlugin());\nSortable.mount(Remove, Revert);\n\nexport default Sortable;\nexport { MultiDragPlugin as MultiDrag, Sortable, SwapPlugin as Swap };\n","import Modal from \"flarum/components/Modal\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Button from \"flarum/components/Button\";\nimport Switch from \"flarum/components/Switch\";\nimport Stream from \"flarum/utils/Stream\";\n\nexport default class ConfirmModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return \"Modal--small FlarumBadgesConfirmModal\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.admin.confirm_dialog.title`\n );\n }\n\n content() {\n return [\n
\n

{this.attrs.text}

\n
,\n\n
\n {Button.component(\n {\n className: \"Button\",\n disabled: this.loading,\n onclick: () => this.hide(),\n },\n app.translator.trans(\n \"v17development-flarum-badges.admin.confirm_dialog.no\"\n )\n )}\n {Button.component(\n {\n className: \"Button Button--primary\",\n loading: this.loading,\n onclick: () => this.confirm(),\n },\n app.translator.trans(\n \"v17development-flarum-badges.admin.confirm_dialog.yes\"\n )\n )}\n
,\n ];\n }\n\n /**\n * Confirm\n */\n confirm() {\n // Act as promise\n if (this.attrs.promise) {\n this.loading = true;\n\n this.attrs.onconfirm(\n () => this.hide(),\n () => {\n this.loading = false;\n m.redraw();\n }\n );\n return;\n }\n\n this.attrs.onconfirm();\n this.hide();\n }\n}\n","import Modal from \"flarum/components/Modal\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Button from \"flarum/components/Button\";\nimport Switch from \"flarum/components/Switch\";\nimport Stream from \"flarum/utils/Stream\";\n\nexport default class EditBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Badge model\n this.badge = this.attrs.badge\n ? this.attrs.badge\n : app.store.createRecord(\"badges\");\n\n // Name\n this.name = Stream(this.badge.name());\n\n // Icon\n this.icon = Stream(this.badge.icon());\n\n // Description\n this.description = Stream(this.badge.description());\n\n // Is visible\n this.isVisible = Stream(this.badge.exists ? this.badge.isVisible() : true);\n }\n\n className() {\n return \"Modal--small\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.admin.${\n this.badge.exists ? \"update_badge\" : \"new_badge\"\n }`\n );\n }\n\n content() {\n return [\n
\n
{this.data().toArray()}
\n
,\n
\n {Button.component(\n {\n type: \"submit\",\n className: \"Button Button--primary\",\n loading: this.loading,\n },\n app.translator.trans(\"core.admin.settings.submit_button\")\n )}\n
,\n ];\n }\n\n data() {\n const items = new ItemList();\n\n items.add(\n \"name\",\n
\n \n \n
,\n 50\n );\n\n items.add(\n \"icon\",\n
\n \n \n \n
,\n 50\n );\n\n items.add(\n \"description\",\n
\n \n \n
,\n 50\n );\n\n // Enabled\n items.add(\n \"enabled\",\n
\n {Switch.component(\n {\n state: this.isVisible() == true,\n onchange: (val) => this.isVisible(val),\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge.visible\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge.visible_description\"\n )}\n
,\n ]\n )}\n
,\n 50\n );\n\n return items;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n name: this.name(),\n icon: this.icon(),\n description: this.description(),\n isVisible: this.isVisible(),\n })\n .then(\n () => this.hide(),\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Component from \"flarum/common/Component\";\nimport Button from \"flarum/components/Button\";\nimport ConfirmModal from \"./ConfirmModal\";\nimport EditBadgeModal from \"./EditBadgeModal\";\n\nexport default class SortableBadge extends Component {\n oninit(attrs) {\n super.oninit(attrs);\n\n this.loading = false;\n }\n\n view() {\n const badge = this.attrs.badge;\n\n if (!badge) return null;\n\n return (\n \n
\n \n \n app.modal.show(EditBadgeModal, {\n badge,\n })\n }\n >\n {badge.name()}\n \n \n \n \n app.modal.show(EditBadgeModal, {\n badge,\n })\n }\n >\n \n \n \n app.modal.show(ConfirmModal, {\n text: app.translator.trans(\n \"v17development-flarum-badges.admin.confirm_messages.delete_badge\"\n ),\n promise: true,\n onconfirm: (resolve, reject) =>\n badge.delete().then(resolve).catch(reject),\n })\n }\n >\n \n \n \n
\n \n );\n }\n}\n","import Modal from \"flarum/components/Modal\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Button from \"flarum/components/Button\";\nimport Switch from \"flarum/components/Switch\";\nimport Stream from \"flarum/utils/Stream\";\n\nexport default class EditBadgeCategoryModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Badge model\n this.badgeCategory = this.attrs.badgeCategory\n ? this.attrs.badgeCategory\n : app.store.createRecord(\"badgeCategories\");\n\n // Name\n this.name = Stream(this.badgeCategory.name());\n\n // Description\n this.description = Stream(this.badgeCategory.description());\n\n // Is enabled\n this.isTable = Stream(\n this.badgeCategory.exists ? this.badgeCategory.isTable() : true\n );\n\n // Is enabled\n this.isEnabled = Stream(\n this.badgeCategory.exists ? this.badgeCategory.isEnabled() : true\n );\n }\n\n className() {\n return \"Modal--small\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.admin.${\n this.badgeCategory.exists ? \"update_category\" : \"create_category\"\n }`\n );\n }\n\n content() {\n return [\n
\n
{this.data().toArray()}
\n
,\n
\n {Button.component(\n {\n type: \"submit\",\n className: \"Button Button--primary\",\n loading: this.loading,\n },\n app.translator.trans(\"core.admin.settings.submit_button\")\n )}\n
,\n ];\n }\n\n data() {\n const items = new ItemList();\n\n items.add(\n \"name\",\n
\n \n \n
,\n 50\n );\n\n items.add(\n \"description\",\n
\n \n \n
,\n 50\n );\n\n // Enabled\n items.add(\n \"blockview\",\n
\n {Switch.component(\n {\n state: this.isTable() === false,\n onchange: (val) => this.isTable(!val),\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge_category.blockview\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge_category.blockview_description\"\n )}\n
,\n ]\n )}\n
,\n 50\n );\n\n // Enabled\n items.add(\n \"enabled\",\n
\n {Switch.component(\n {\n state: this.isEnabled() == true,\n onchange: (val) => this.isEnabled(val),\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge_category.enabled\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-badges.admin.badge_category.enabled_description\"\n )}\n
,\n ]\n )}\n
,\n 50\n );\n\n return items;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badgeCategory\n .save({\n name: this.name(),\n description: this.description(),\n isTable: this.isTable(),\n isEnabled: this.isEnabled(),\n })\n .then(\n () => {\n this.hide();\n\n if (this.attrs.onCreate) {\n this.attrs.onCreate();\n }\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Component from \"flarum/common/Component\";\nimport Button from \"flarum/components/Button\";\nimport saveSettings from \"flarum/utils/saveSettings\";\n\nexport default class InstallAutoModerationMessage extends Component {\n view() {\n // Message is dismissed\n if (\n typeof app.data.settings.badges_install_automoderation !== \"undefined\"\n ) {\n return null;\n }\n\n const extensionInstalled =\n typeof app.data.extensions[\"askvortsov-auto-moderator\"] !== \"undefined\";\n\n return (\n
\n
\n {app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.not_installed.title\"\n )}\n
\n
\n {app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.not_installed.content\",\n {\n a: (\n \n ),\n }\n )}\n
\n
\n \n \n\n \n {app.translator.trans(\n extensionInstalled\n ? \"core.admin.extension.open_modal\"\n : \"v17development-flarum-badges.admin.auto_moderator.not_installed.install\"\n )}\n \n \n \n saveSettings({\n badges_install_automoderation: \"dismissed\",\n })\n }\n icon={\"fas fa-times\"}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.admin.auto_moderator.not_installed.dismiss\"\n )}\n \n
\n
\n );\n }\n}\n","import sortable from \"sortablejs\";\nimport ExtensionPage from \"flarum/components/ExtensionPage\";\nimport LoadingIndicator from \"flarum/components/LoadingIndicator\";\nimport SortableBadge from \"./SortableBadge\";\nimport Button from \"flarum/components/Button\";\nimport EditBadgeModal from \"./EditBadgeModal\";\nimport EditBadgeCategoryModal from \"./EditBadgeCategoryModal\";\nimport ConfirmModal from \"./ConfirmModal\";\nimport InstallAutoModerationMessage from \"./InstallAutoModerationMessage\";\n\nexport default class SettingsPage extends ExtensionPage {\n oninit(attrs) {\n super.oninit(attrs);\n\n this.loading = true;\n\n this.updating = false;\n this.forcedRefreshKey = 0;\n\n app.store.find(\"badge_categories\").then(() => {\n app.store.find(\"badges\").then(() => {\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n });\n }\n\n content() {\n const categories = app.store\n .all(\"badgeCategories\")\n .sort((a, b) => a.order() - b.order());\n\n const uncategorizedBadges = app.store\n .all(\"badges\")\n .filter((badge) => badge.category() == false);\n\n return (\n
\n {app.data.settings.extensions_enabled.indexOf(\n \"askvortsov-auto-moderator\"\n ) === -1 && }\n\n
\n \n app.modal.show(EditBadgeCategoryModal, {\n onCreate: () => this.nextRefreshKey(),\n })\n }\n icon={\"fas fa-project-diagram\"}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.admin.create_category\"\n )}\n \n app.modal.show(EditBadgeModal)}\n icon={\"fas fa-icons\"}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.admin.new_badge\"\n )}\n \n
\n\n
\n {!this.loading && (\n \n {categories &&\n categories.map((category, key) => {\n return (\n \n
\n \n {!category.isEnabled() && (\n \n )}\n {category.name()}\n \n\n \n \n app.modal.show(EditBadgeCategoryModal, {\n badgeCategory: category,\n })\n }\n >\n {app.translator.trans(\n \"v17development-flarum-badges.admin.edit_category\"\n )}\n \n \n this.updateCategorySort(category, \"up\")\n }\n className={key === 0 ? \"LinkDisabled\" : null}\n >\n \n \n \n this.updateCategorySort(category, \"down\")\n }\n className={\n key === categories.length - 1\n ? \"LinkDisabled\"\n : null\n }\n >\n \n \n \n app.modal.show(ConfirmModal, {\n text: app.translator.trans(\n \"v17development-flarum-badges.admin.confirm_messages.delete_category\"\n ),\n promise: true,\n onconfirm: (resolve, reject) => {\n const badges = category.badges();\n\n category\n .delete()\n .then(() => {\n resolve();\n\n badges.forEach((badge) =>\n badge.pushData({\n relationships: {\n category: null,\n },\n })\n );\n })\n .catch(reject);\n },\n })\n }\n >\n \n \n \n
\n\n
    \n {category.badges() &&\n category\n .badges()\n .sort((a, b) => a.order() - b.order())\n .map((badge) => )}\n
\n
\n );\n })}\n\n {/* Uncategorized badges */}\n
\n
\n \n \n {app.translator.trans(\n \"v17development-flarum-badges.admin.uncategorized\"\n )}\n \n \n
\n\n
    \n {uncategorizedBadges\n .sort((a, b) => a.order() - b.order())\n .map((badge) => (\n \n ))}\n
\n
\n
\n )}\n \n\n {this.loading && }\n\n {!this.loading &&\n uncategorizedBadges.length === 0 &&\n categories.length === 0 && (\n

\n {app.translator.trans(\n \"v17development-flarum-badges.admin.nothing_here_yet\"\n )}\n

\n )}\n \n );\n }\n\n onBadgeListReady(vnode) {\n this.$(\".SortableBadges\")\n .get()\n .map((e) => {\n sortable.create(e, {\n group: \"tags\",\n animation: 150,\n swapThreshold: 0.65,\n dragClass: \"SortableBadges-dragging\",\n ghostClass: \"SortableBadges-placeholder\",\n direction: \"horizontal\",\n onSort: (e) => this.onSortUpdate(e),\n });\n });\n }\n\n /**\n *\n * @param {categoryObject} category\n * @param {string} action\n * @returns\n */\n updateCategorySort(category, action) {\n const newPosition =\n action === \"up\" ? category.order() - 1 : category.order() + 1;\n const order = [];\n\n console.log(category.id(), action, newPosition);\n\n // Bring to top\n if (newPosition <= 0) {\n order.push(category.id());\n }\n\n // Get all categories\n const categories = app.store\n .all(\"badgeCategories\")\n .sort((a, b) => a.order() - b.order());\n\n // Loop through the categories\n categories.forEach((obj, key) => {\n // Skip current category\n if (obj === category) return;\n\n // Add before current key\n if (newPosition !== 0 && key === newPosition && action === \"up\") {\n order.push(category.id());\n }\n\n // Add object\n order.push(obj.id());\n\n // Add after current key\n if (key === newPosition && action === \"down\") {\n order.push(category.id());\n }\n });\n\n // Save list\n app\n .request({\n url: app.forum.attribute(\"apiUrl\") + \"/badge_categories/order\",\n method: \"POST\",\n body: { order },\n })\n .catch((e) => console.error(e))\n .then((payload) => {\n app.store.pushPayload(payload);\n\n this.nextRefreshKey();\n });\n }\n\n /**\n * Sort badges\n */\n onSortUpdate() {\n // Skip if already updating\n if (this.updating) return;\n\n this.updating = true;\n\n // Get through the categories and find the children currently attached to them\n const order = this.$(\".FlarumBadgeCategory\")\n .map(function () {\n return {\n id: $(this).data(\"id\") ? $(this).data(\"id\") : null,\n children: $(this)\n .find(\"li\")\n .map(function () {\n return $(this).data(\"id\");\n })\n .get(),\n };\n })\n .get();\n\n app\n .request({\n url: app.forum.attribute(\"apiUrl\") + \"/badges/order\",\n method: \"POST\",\n body: { order },\n })\n .catch((e) => console.error(e))\n .then(() => {\n // Update local store\n order.map((categoryObject) => {\n const category =\n categoryObject.id !== null\n ? app.store.getById(\"badgeCategories\", categoryObject.id)\n : null;\n\n // Loop through the badges\n const badges = categoryObject.children.map(\n (badgeId, badgePosition) => {\n const badge = app.store.getById(\"badges\", badgeId);\n\n badge.pushData({\n attributes: {\n order: badgePosition,\n },\n relationships: {\n category,\n },\n });\n\n return badge;\n }\n );\n\n // Update the category\n if (category) {\n category.pushData({\n relationships: {\n badges: {\n data: badges.map((badge) => ({\n type: \"badges\",\n id: badge.id(),\n })),\n },\n },\n });\n }\n });\n\n this.updating = false;\n this.nextRefreshKey();\n });\n }\n\n nextRefreshKey() {\n this.forcedRefreshKey++;\n m.redraw();\n }\n}\n","import Badge from \"../common/models/Badge\";\nimport BadgeCategory from \"../common/models/BadgeCategory\";\nimport BadgeActionDriverSettings from \"./components/BadgeActionDriverSettings\";\nimport SettingsPage from \"./components/SettingsPage\";\n\napp.initializers.add(\"v17development-user-badges\", () => {\n app.store.models.badges = Badge;\n app.store.models.badgeCategories = BadgeCategory;\n\n // Register extension settings page\n app.extensionData\n .for(\"v17development-user-badges\")\n .registerPage(SettingsPage);\n\n app.extensionData\n .for(\"v17development-badges\")\n .registerPermission(\n {\n icon: \"fas fa-user-tag\",\n label: app.translator.trans(\n \"v17development-flarum-badges.admin.permissions.give_badge\"\n ),\n permission: \"badges.giveBadge\",\n },\n \"moderate\",\n 90\n )\n .registerPermission(\n {\n icon: \"fas fa-user-times\",\n label: app.translator.trans(\n \"v17development-flarum-badges.admin.permissions.take_badge\"\n ),\n permission: \"badges.removeBadge\",\n },\n \"moderate\",\n 90\n );\n\n // Auto moderation\n if (app.autoModeratorForms) {\n app.autoModeratorForms.action.give_badge = BadgeActionDriverSettings;\n app.autoModeratorForms.action.remove_badge = BadgeActionDriverSettings;\n\n app.autoModeratorForms.requirement.has_badge = BadgeActionDriverSettings;\n }\n});\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 978102b..8107730 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(e){var t={};function a(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=e,a.c=t,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=30)}([function(e,t){e.exports=flarum.core.compat.Model},function(e,t,a){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}a.d(t,"a",(function(){return n}))},function(e,t){e.exports=flarum.core.compat["components/Button"]},function(e,t){e.exports=flarum.core.compat["components/Modal"]},function(e,t){e.exports=flarum.core.compat["utils/Stream"]},function(e,t){e.exports=flarum.core.compat["utils/ItemList"]},function(e,t){e.exports=flarum.core.compat["utils/mixin"]},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var r=a(1),n=a(3),s=a.n(n),o=a(2),i=a.n(o),d=a(11),u=a.n(d),l=a(5),c=a.n(l),p=(a(18),a(9)),g=function(e){function t(){return e.apply(this,arguments)||this}Object(r.a)(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.loading=!1},a.className=function(){return"Modal--small"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum.badge_information")},a.content=function(){var e=this;return m("div",null,m("div",{className:"Modal-body"},this.data().toArray()),this.attrs.userBadgeData&&app.forum.attribute("canGiveBadge")&&m("div",{className:"Modal-footer"},m(i.a,{className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge_confirm"))&&(e.loading=!0,e.attrs.userBadgeData.delete().then((function(){return e.hide()})))},loading:this.loading},app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge"))))},a.data=function(){var e=this,t=new c.a;return t.add("name",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.name"),":")),m("p",null,this.attrs.badge.name()))),t.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.attrs.badge.description()))),this.attrs.userBadgeData&&(this.attrs.userBadgeData.description()||app.forum.attribute("canGiveBadge"))&&t.add("earning_reason",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),":")),m("p",null,this.attrs.userBadgeData.description()?this.attrs.userBadgeData.description():m("i",null,app.translator.trans("v17development-flarum-badges.forum.badge.no_earning_reason"))),m("p",null,app.forum.attribute("canGiveBadge")&&m("a",{href:"#",onclick:function(t){t.preventDefault(),app.modal.show(p.a,{badge:e.attrs.userBadgeData})}},app.translator.trans("v17development-flarum-badges.forum.badge.update_earning_reason"))))),this.attrs.userBadgeData&&t.add("earned_date",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_on"),":")),m("p",null,u()(this.attrs.userBadgeData.assignedAt())))),this.attrs.userBadgeData&&t.add("category",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.category"),":")),m("p",null,this.attrs.badge.category()&&this.attrs.badge.category().name(),!this.attrs.badge.category()&&app.translator.trans("v17development-flarum-badges.forum.uncategorized")))),this.attrs.badge&&this.attrs.badge.earnedAmount()&&t.add("earned_amount",m("div",{className:"BadgeModalListItem"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:this.attrs.badge.earnedAmount()})))),t},t}(s.a)},function(e,t){e.exports=flarum.core.compat["common/Component"]},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var r=a(1),n=a(3),s=a.n(n),o=a(2),i=a.n(o),d=a(5),u=a.n(d),l=(a(19),a(4)),c=a.n(l),p=a(7),g=function(e){function t(){return e.apply(this,arguments)||this}Object(r.a)(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.selectedBadge=this.attrs.badge?this.attrs.badge.badge():null,this.user=this.attrs.badge?this.attrs.badge.user():this.attrs.user,this.userHasBadge=!1,this.badge=this.attrs.badge?this.attrs.badge:app.store.createRecord("userBadges"),this.description=c()(this.badge.description()),this.categories={},this.uncategorizedBadges=[],this.loading=!1,this.attrs.badge||(this.loading=!0,app.store.find("badges",{include:"category"}).then((function(e){e.forEach((function(e){if(e.category()){var t=e.category();a.categories[t.id()]?a.categories[t.id()].badges.push(e):a.categories[t.id()]={category:t,badges:[e]}}else a.uncategorizedBadges.push(e)})),a.loading=!1,m.redraw()})))},a.className=function(){return"Modal--small BadgeModal"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum."+(this.badge.exists?"update":"give")+"_badge")},a.content=function(){return m("div",null,m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray())),m("div",{className:"Modal-footer"},m(i.a,{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.userHasBadge},app.translator.trans("core.forum.composer_edit.submit_button"))))},a.fields=function(){var e=this,t=new u.a;return t.add("badge",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.badge"))),m("div",{className:"Select"},m("select",{value:this.selectedBadge?this.selectedBadge.id():"empty",disabled:!!this.attrs.badge,onchange:function(t){"empty"!==t.target.value&&(e.selectedBadge=app.store.getById("badges",t.target.value),e.checkUserHasBadge(e.selectedBadge))},className:"Select-input FormControl"},m("option",{value:"empty"},app.translator.trans("v17development-flarum-badges.forum.select_badge")),!this.attrs.badge&&Object.values(this.categories).map((function(e){var t=e.category,a=e.badges;return m("optgroup",{label:t.name()},a.map((function(e){return m("option",{value:e.id()},e.name())})))})),!this.attrs.badge&&this.uncategorizedBadges.length>=1&&m("optgroup",{label:app.translator.trans("v17development-flarum-badges.forum.uncategorized")},this.uncategorizedBadges.map((function(e){return m("option",{value:e.id()},e.name())}))),!!this.attrs.badge&&m("option",{value:this.selectedBadge.id()},this.selectedBadge.name())),m("i",{class:"icon fas fa-caret-down Select-caret"})),this.userHasBadge&&m("p",{className:"UserHasBadge"},app.translator.trans("v17development-flarum-badges.forum.user_has_badge"))),30),t.add("badge_description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.selectedBadge?this.selectedBadge.description():app.translator.trans("v17development-flarum-badges.forum.select_badge"))),30),t.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"))),m("textarea",{className:"FormControl",placeholder:app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),bidi:this.description})),30),t},a.checkUserHasBadge=function(e){var t=!1;this.user.userBadges().map((function(a){a.badge()==e&&(t=!0)})),this.userHasBadge=t,m.redraw()},a.onsubmit=function(e){var t=this;e.preventDefault(),this.loading=!0,this.badge.save({description:this.description(),relationships:this.attrs.badge?{}:{badge:this.selectedBadge,user:this.user}}).then((function(){t.attrs.badge?app.modal.show(p.a,{badge:t.attrs.badge.badge(),userBadgeData:t.attrs.badge}):t.hide(),m.redraw()}),(function(e){t.loading=!1,t.handleErrors(e)}))},t}(s.a)},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var r=a(1),n=a(0),s=a.n(n),o=a(6),i=a.n(o),d=(a(7),function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.apiEndpoint=function(){return"/badges"+(this.exists?"/"+this.data.id:"")},t}(i()(s.a,{name:s.a.attribute("name"),icon:s.a.attribute("icon"),order:s.a.attribute("order"),image:s.a.attribute("image"),description:s.a.attribute("description"),isVisible:s.a.attribute("isVisible"),createdAt:s.a.attribute("createdAt"),earnedAmount:s.a.attribute("earnedAmount"),category:s.a.hasOne("category")})))},function(e,t){e.exports=flarum.core.compat["helpers/fullTime"]},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var r=a(1),n=a(0),s=a.n(n),o=a(6),i=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.apiEndpoint=function(){return"/badge_categories"+(this.exists?"/"+this.data.id:"")},t}(a.n(o)()(s.a,{name:s.a.attribute("name"),order:s.a.attribute("order"),description:s.a.attribute("description"),isEnabled:s.a.attribute("isEnabled"),createdAt:s.a.attribute("createdAt"),users:s.a.hasMany("users"),badges:s.a.hasMany("badges")}))},function(e,t){e.exports=flarum.core.compat["components/LoadingIndicator"]},,function(e,t){e.exports=flarum.core.compat["components/UserPage"]},function(e,t){e.exports=flarum.core.compat["components/Page"]},,function(e,t){e.exports=flarum.core.compat["components/Link"]},function(e,t){e.exports=flarum.core.compat["components/Select"]},function(e,t){e.exports=flarum.core.compat.extend},function(e,t){e.exports=flarum.core.compat["models/User"]},function(e,t){e.exports=flarum.core.compat["utils/UserControls"]},function(e,t){e.exports=flarum.core.compat["components/LinkButton"]},function(e,t){e.exports=flarum.core.compat["common/components/Tooltip"]},,,,,,function(e,t,a){"use strict";a.r(t);var r=a(20),n=a(0),s=a.n(n),o=a(21),i=a.n(o),d=a(15),u=a.n(d),l=a(22),c=a.n(l),p=a(23),g=a.n(p),f=a(2),b=a.n(f),h=a(10),v=a(12),y=a(1),B=a(6),_=function(e){function t(){return e.apply(this,arguments)||this}return Object(y.a)(t,e),t.prototype.apiEndpoint=function(){return"/user_badges"+(this.exists?"/"+this.data.id:"")},t}(a.n(B)()(s.a,{user:s.a.hasOne("user"),badge:s.a.hasOne("badge"),description:s.a.attribute("description"),isPrimary:s.a.attribute("isPrimary"),assignedAt:s.a.attribute("assignedAt")})),x=a(13),N=a.n(x),O=a(8),M=a.n(O),j=a(24),D=a.n(j),w=a(7),A=function(e){function t(){return e.apply(this,arguments)||this}return Object(y.a)(t,e),t.prototype.view=function(){var e=this;return this.attrs.badge.isVisible()?m(D.a,{text:""+(this.attrs.badge.description()?this.attrs.badge.description():"")},m("span",{className:"UserBadge",onclick:function(){return app.modal.show(w.a,{badge:e.attrs.badge,userBadgeData:e.attrs.userBadgeData})}},m("i",{className:this.attrs.badge.icon()})," ",this.attrs.badge.name())):null},t}(M.a),I=function(e){function t(){return e.apply(this,arguments)||this}return Object(y.a)(t,e),t.prototype.view=function(){var e={},t=[];return this.attrs.user.userBadges().map((function(a){if(!a)return null;if(a.badge().category()){var r=a.badge().category();e[r.id()]?e[r.id()].badges.push(a):e[r.id()]={category:r,badges:[a]}}else t.push(a)})),m("div",{className:"UserBadges"},0===Object.keys(e).length&&m("div",{className:"Placeholder"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.user_no_badges"))),Object.keys(e).length>=1&&Object.keys(e).sort((function(t,a){return e[t].category.order()-e[a].category.order()})).map((function(t){var a=e[t].category,r=e[t].badges;return a.isEnabled()?m("div",{className:"UserBadgesCategory"},m("h3",null,a.name()),a.description()&&m("p",null,a.description()),r.sort((function(e,t){return e.badge().order()-t.badge().order()})).map((function(e){return m(A,{badge:e.badge(),userBadgeData:e})}))):null})),t.length>=1&&m("div",{className:"UserBadgesCategory"},m("h3",null,app.translator.trans("v17development-flarum-badges.forum.uncategorized")),t.sort((function(e,t){return e.badge().order()-t.badge().order()})).map((function(e){return m(A,{badge:e.badge(),userBadgeData:e})}))))},t}(M.a),L=function(e){function t(){return e.apply(this,arguments)||this}Object(y.a)(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.user=null,this.loading=!0,this.loadUser(m.route.param("username"))},a.content=function(){return!this.user||this.loading?m(N.a,{size:46}):I.component({user:this.user})},a.show=function(t){var a=this;e.prototype.show.call(this,t),this.user=t,app.store.find("users",t.id(),{include:"userBadges,userBadges.badge,userBadges.badge.category"}).then((function(){a.loading=!1,m.redraw()}))},t}(u.a),P=a(16),k=a.n(P),U=(k.a,k.a,a(9));app.initializers.add("v17development-flarum-badges",(function(e){e.store.models.badges=h.a,e.store.models.badgeCategories=v.a,e.store.models.userBadges=_,i.a.prototype.userBadges=s.a.hasMany("userBadges"),i.a.prototype.userPrimaryBadge=s.a.hasOne("userPrimaryBadge"),e.routes["user.badges"]={path:"/u/:username/badges",component:L},Object(r.extend)(u.a.prototype,"navItems",(function(t){t.add("badges",g.a.component({href:e.route("user.badges",{username:this.user.username()}),name:"badges",icon:"fas fa-user-tag"},[e.translator.trans("v17development-flarum-badges.forum.badge.badges"),m("span",{className:"Button-badge"},this.user.userBadges().length)]),90)})),Object(r.extend)(c.a,"moderationControls",(function(t,a){e.forum.attribute("canGiveBadge")&&t.add("test",m(b.a,{icon:"fas fa-user-tag",onclick:function(){return e.modal.show(U.a,{user:a})}},e.translator.trans("v17development-flarum-badges.forum.give_badge")))}))}))}]); +module.exports=function(e){var t={};function a(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=e,a.c=t,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=36)}([function(e,t,a){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}a.d(t,"a",(function(){return n}))},function(e,t){e.exports=flarum.core.compat.Model},function(e,t){e.exports=flarum.core.compat["components/Button"]},function(e,t){e.exports=flarum.core.compat["utils/Stream"]},function(e,t){e.exports=flarum.core.compat["components/Modal"]},function(e,t){e.exports=flarum.core.compat["common/Component"]},function(e,t){e.exports=flarum.core.compat["utils/ItemList"]},function(e,t){e.exports=flarum.core.compat["components/LoadingIndicator"]},function(e,t){e.exports=flarum.core.compat["components/LinkButton"]},function(e,t){e.exports=flarum.core.compat["utils/mixin"]},function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var r=a(0),n=a(4),s=a.n(n),o=a(2),i=a.n(o),d=a(17),u=a.n(d),l=a(6),c=a.n(l),p=a(8),g=a.n(p),f=a(11),b=function(e){function t(){return e.apply(this,arguments)||this}Object(r.a)(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.loading=!1},a.className=function(){return"Modal--small"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum.badge_information")},a.content=function(){var e=this;return m("div",null,m("div",{className:"Modal-body"},this.data().toArray()),m("div",{className:"Modal-footer"},m(g.a,{href:app.route("badges.item",{id:this.attrs.badge.id()}),className:"Button",style:{margin:"0 10px"}},app.translator.trans("v17development-flarum-badges.forum.badge.badge_details")),this.attrs.userBadgeData&&app.forum.attribute("canGiveBadge")&&m(i.a,{className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge_confirm"))&&(e.loading=!0,e.attrs.userBadgeData.delete().then((function(){return e.hide()})))},loading:this.loading},app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge"))))},a.data=function(){var e=this,t=new c.a;return t.add("name",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.name"),":")),m("p",null,this.attrs.badge.name()))),t.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.attrs.badge.description()))),this.attrs.userBadgeData&&(this.attrs.userBadgeData.description()||app.forum.attribute("canGiveBadge"))&&t.add("earning_reason",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),":")),m("p",null,this.attrs.userBadgeData.description()?this.attrs.userBadgeData.description():m("i",null,app.translator.trans("v17development-flarum-badges.forum.badge.no_earning_reason"))),m("p",null,app.forum.attribute("canGiveBadge")&&m("a",{href:"#",onclick:function(t){t.preventDefault(),app.modal.show(f.a,{badge:e.attrs.userBadgeData})}},app.translator.trans("v17development-flarum-badges.forum.badge.update_earning_reason"))))),this.attrs.userBadgeData&&t.add("earned_date",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_on"),":")),m("p",null,u()(this.attrs.userBadgeData.assignedAt())))),this.attrs.userBadgeData&&t.add("category",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.category"),":")),m("p",null,this.attrs.badge.category()&&this.attrs.badge.category().name(),!this.attrs.badge.category()&&app.translator.trans("v17development-flarum-badges.forum.uncategorized")))),this.attrs.badge&&this.attrs.badge.earnedAmount()&&t.add("earned_amount",m("div",{className:"BadgeModalListItem"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:this.attrs.badge.earnedAmount()})))),t},t}(s.a)},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var r=a(0),n=a(4),s=a.n(n),o=a(2),i=a.n(o),d=a(6),u=a.n(d),l=(a(23),a(3)),c=a.n(l),p=a(10),g=function(e){function t(){return e.apply(this,arguments)||this}Object(r.a)(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.selectedBadge=this.attrs.badge?this.attrs.badge.badge():null,this.user=this.attrs.badge?this.attrs.badge.user():this.attrs.user,this.userHasBadge=!1,this.badge=this.attrs.badge?this.attrs.badge:app.store.createRecord("userBadges"),this.description=c()(this.badge.description()),this.categories={},this.uncategorizedBadges=[],this.loading=!1,this.attrs.badge||(this.loading=!0,app.store.find("badges",{include:"category"}).then((function(e){e.forEach((function(e){if(e.category()){var t=e.category();a.categories[t.id()]?a.categories[t.id()].badges.push(e):a.categories[t.id()]={category:t,badges:[e]}}else a.uncategorizedBadges.push(e)})),a.loading=!1,m.redraw()})))},a.className=function(){return"Modal--small BadgeModal"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum."+(this.badge.exists?"update":"give")+"_badge")},a.content=function(){return m("div",null,m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray())),m("div",{className:"Modal-footer"},m(i.a,{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.userHasBadge},app.translator.trans("core.forum.composer_edit.submit_button"))))},a.fields=function(){var e=this,t=new u.a;return t.add("badge",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.badge"))),m("div",{className:"Select"},m("select",{value:this.selectedBadge?this.selectedBadge.id():"empty",disabled:!!this.attrs.badge,onchange:function(t){"empty"!==t.target.value&&(e.selectedBadge=app.store.getById("badges",t.target.value),e.checkUserHasBadge(e.selectedBadge))},className:"Select-input FormControl"},m("option",{value:"empty"},app.translator.trans("v17development-flarum-badges.forum.select_badge")),!this.attrs.badge&&Object.values(this.categories).map((function(e){var t=e.category,a=e.badges;return m("optgroup",{label:t.name()},a.map((function(e){return m("option",{value:e.id()},e.name())})))})),!this.attrs.badge&&this.uncategorizedBadges.length>=1&&m("optgroup",{label:app.translator.trans("v17development-flarum-badges.forum.uncategorized")},this.uncategorizedBadges.map((function(e){return m("option",{value:e.id()},e.name())}))),!!this.attrs.badge&&m("option",{value:this.selectedBadge.id()},this.selectedBadge.name())),m("i",{class:"icon fas fa-caret-down Select-caret"})),this.userHasBadge&&m("p",{className:"UserHasBadge"},app.translator.trans("v17development-flarum-badges.forum.user_has_badge"))),30),t.add("badge_description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.selectedBadge?this.selectedBadge.description():app.translator.trans("v17development-flarum-badges.forum.select_badge"))),30),t.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"))),m("textarea",{className:"FormControl",placeholder:app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),bidi:this.description})),30),t},a.checkUserHasBadge=function(e){var t=!1;this.user.userBadges().map((function(a){a.badge()==e&&(t=!0)})),this.userHasBadge=t,m.redraw()},a.onsubmit=function(e){var t=this;e.preventDefault(),this.loading=!0,this.badge.save({description:this.description(),relationships:this.attrs.badge?{}:{badge:this.selectedBadge,user:this.user}}).then((function(){t.attrs.badge?app.modal.show(p.a,{badge:t.attrs.badge.badge(),userBadgeData:t.attrs.badge}):t.hide(),m.redraw()}),(function(e){t.loading=!1,t.handleErrors(e)}))},t}(s.a)},function(e,t){e.exports=flarum.core.compat["components/IndexPage"]},function(e,t){e.exports=flarum.core.compat["components/Link"]},,function(e,t){e.exports=flarum.core.compat.extend},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var r=a(0),n=a(1),s=a.n(n),o=a(9),i=a.n(o),d=(a(10),function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.apiEndpoint=function(){return"/badges"+(this.exists?"/"+this.data.id:"")},t}(i()(s.a,{name:s.a.attribute("name"),icon:s.a.attribute("icon"),order:s.a.attribute("order"),image:s.a.attribute("image"),description:s.a.attribute("description"),isVisible:s.a.attribute("isVisible"),createdAt:s.a.attribute("createdAt"),earnedAmount:s.a.attribute("earnedAmount"),category:s.a.hasOne("category")})))},function(e,t){e.exports=flarum.core.compat["helpers/fullTime"]},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var r=a(0),n=a(1),s=a.n(n),o=a(9),i=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.apiEndpoint=function(){return"/badge_categories"+(this.exists?"/"+this.data.id:"")},t}(a.n(o)()(s.a,{name:s.a.attribute("name"),order:s.a.attribute("order"),description:s.a.attribute("description"),isEnabled:s.a.attribute("isEnabled"),createdAt:s.a.attribute("createdAt"),isTable:s.a.attribute("isTable"),users:s.a.hasMany("users"),badges:s.a.hasMany("badges")}))},function(e,t){e.exports=flarum.core.compat["components/UserPage"]},function(e,t){e.exports=flarum.core.compat["components/Page"]},function(e,t){e.exports=flarum.core.compat["common/helpers/listItems"]},,function(e,t){e.exports=flarum.core.compat["components/Select"]},function(e,t){e.exports=flarum.core.compat["models/User"]},function(e,t){e.exports=flarum.core.compat["utils/UserControls"]},function(e,t){e.exports=flarum.core.compat["common/components/Tooltip"]},function(e,t){e.exports=flarum.core.compat["helpers/avatar"]},function(e,t){e.exports=flarum.core.compat["helpers/humanTime"]},function(e,t){e.exports=flarum.core.compat["common/states/PaginatedListState"]},function(e,t){e.exports=flarum.core.compat["forum/components/Notification"]},function(e,t){e.exports=flarum.core.compat["forum/components/NotificationGrid"]},,,,,function(e,t,a){"use strict";a.r(t);var r=a(15),n=a(1),s=a.n(n),o=a(24),i=a.n(o),d=a(19),u=a.n(d),l=a(25),c=a.n(l),p=a(8),g=a.n(p),f=a(2),b=a.n(f),h=a(16),v=a(18),y=a(0),B=a(9),N=function(e){function t(){return e.apply(this,arguments)||this}return Object(y.a)(t,e),t.prototype.apiEndpoint=function(){return"/user_badges"+(this.exists?"/"+this.data.id:"")},t}(a.n(B)()(s.a,{user:s.a.hasOne("user"),badge:s.a.hasOne("badge"),description:s.a.attribute("description"),isPrimary:s.a.attribute("isPrimary"),assignedAt:s.a.attribute("assignedAt")})),x=a(7),_=a.n(x),O=a(5),I=a.n(O),j=a(26),w=a.n(j),L=a(10),P=function(e){function t(){return e.apply(this,arguments)||this}return Object(y.a)(t,e),t.prototype.view=function(){var e=this;return this.attrs.badge.isVisible()?m(w.a,{text:""+(this.attrs.badge.description()?this.attrs.badge.description():"")},m("span",{className:"UserBadge",onclick:function(){return app.modal.show(L.a,{badge:e.attrs.badge,userBadgeData:e.attrs.userBadgeData})}},m("i",{className:this.attrs.badge.icon()})," ",this.attrs.badge.name())):null},t}(I.a),M=function(e){function t(){return e.apply(this,arguments)||this}return Object(y.a)(t,e),t.prototype.view=function(){var e={},t=[];return this.attrs.user.userBadges().map((function(a){if(!a)return null;if(a.badge().category()){var r=a.badge().category();e[r.id()]?e[r.id()].badges.push(a):e[r.id()]={category:r,badges:[a]}}else t.push(a)})),m("div",{className:"UserBadges"},0===Object.keys(e).length&&m("div",{className:"Placeholder"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.user_no_badges"))),Object.keys(e).length>=1&&Object.keys(e).sort((function(t,a){return e[t].category.order()-e[a].category.order()})).map((function(t){var a=e[t].category,r=e[t].badges;return a.isEnabled()?m("div",{className:"UserBadgesCategory"},m("h3",null,a.name()),a.description()&&m("p",null,a.description()),r.sort((function(e,t){return e.badge().order()-t.badge().order()})).map((function(e){return m(P,{badge:e.badge(),userBadgeData:e})}))):null})),t.length>=1&&m("div",{className:"UserBadgesCategory"},m("h3",null,app.translator.trans("v17development-flarum-badges.forum.uncategorized")),t.sort((function(e,t){return e.badge().order()-t.badge().order()})).map((function(e){return m(P,{badge:e.badge(),userBadgeData:e})}))))},t}(I.a),A=function(e){function t(){return e.apply(this,arguments)||this}Object(y.a)(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.user=null,this.loading=!0,this.loadUser(m.route.param("username"))},a.content=function(){return!this.user||this.loading?m(_.a,{size:46}):M.component({user:this.user})},a.show=function(t){var a=this;e.prototype.show.call(this,t),this.user=t,app.store.find("users",t.id(),{include:"userBadges,userBadges.badge,userBadges.badge.category"}).then((function(){a.loading=!1,m.redraw()}))},t}(u.a),U=a(20),C=a.n(U),D=a(12),T=a.n(D),S=a(21),k=a.n(S),z=a(13),E=a.n(z),H=function(e){function t(){return e.apply(this,arguments)||this}return Object(y.a)(t,e),t.prototype.view=function(){if(!this.attrs.badges)return null;var e=this.attrs.badges;return m("table",{width:"100%",className:"BadgeTable"},m("thead",null,m("tr",null,m("th",{scope:"col"},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),m("th",{scope:"col"},app.translator.trans("v17development-flarum-badges.forum.badge.description")))),m("tbody",null,e.map((function(e){return m("tr",null,m("td",null,m(E.a,{href:app.route("badges.item",{id:e.id()}),className:"UserBadge"},m("i",{className:e.icon()})," ",e.name())),m("td",null,e.description(),m("div",{className:"BadgeTableRewarded"},app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:e.earnedAmount()}))))}))))},t}(I.a),G=function(e){function t(){return e.apply(this,arguments)||this}return Object(y.a)(t,e),t.prototype.view=function(){if(!this.attrs.badges)return null;var e=this.attrs.badges;return m("ul",{className:"BadgeCategoryList"},e.map((function(e){return m("li",null,m(E.a,{href:app.route("badges.item",{id:e.id()}),className:"BadgeContainer"},m("div",{className:"BadgeContainerInfo"},m("span",{className:"UserBadge"},m("i",{className:e.icon()})," ",e.name()),m("p",{className:"BadgeDescription"},e.description()),m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:e.earnedAmount()})))))})))},t}(I.a),R=function(e){function t(){return e.apply(this,arguments)||this}Object(y.a)(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.bodyClass="App--index",this.loading=!0,app.history.push("badgeOverviewPage"),app.setTitle(app.translator.trans("v17development-flarum-badges.forum.badge.badges")),app.store.find("badge_categories").then((function(){a.loading=!1,m.redraw()}))},a.view=function(){var e=app.store.all("badgeCategories").sort((function(e,t){return e.order()-t.order()}));return m("div",{className:"IndexPage"},m("div",{className:"container"},m("div",{className:"sideNavContainer"},m("nav",{className:"IndexPage-nav sideNav"},m("ul",null,k()(T.a.prototype.sidebarItems().toArray()))),m("div",{className:"IndexPage-results sideNavOffset"},m("h2",{className:"BadgeOverviewTitle"},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),this.loading&&m(_.a,{size:"large"}),!this.loading&&e.map((function(e){var t=e.badges().sort((function(e,t){return e.order()-t.order()}));return m("div",{className:"BadgeCategory"},m("h3",null,e.name()),e.description()&&m("p",null,e.description()),e.isTable()&&m(H,{badges:t}),!e.isTable()&&m(G,{badges:t}))}))))))},t}(C.a),F=a(27),V=a.n(F),q=a(28),J=a.n(q),K=function(e){function t(){return e.apply(this,arguments)||this}Object(y.a)(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.attrs.state.refreshParams({filter:{badge:this.attrs.badgeId},sort:"-assignedAt"})},a.view=function(){var e=this.attrs.state,t=null;return e.isInitialLoading()||e.isLoadingNext()?t=_.a.component({size:"large"}):e.hasNext()&&(t=b.a.component({className:"Button",icon:"fas fa-chevron-down",onclick:e.loadNext.bind(e)},app.translator.trans("core.forum.discussion_list.load_more_button"))),e.isInitialLoading()&&e.isEmpty()?m(_.a,null):e.isEmpty()?m("div",{className:"BadgeUserList-empty"},app.translator.trans("v17development-flarum-badges.forum.no_received")):m("div",null,m("ul",{className:"BadgeUserList"},e.getPages().map((function(e){return e.items.map((function(e){return m("li",null,m(E.a,{href:app.route("user.badges",{username:e.user().username()}),className:"BadgeUserList-user"},V()(e.user()),m("div",{className:"BadgeUserList-userinfo"},m("h4",null,e.user().displayName()),m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.received_on",{date:J()(e.assignedAt())})))))}))}))),t&&m("div",{className:"SupportSearchList-loadMore"},t))},t}(I.a),Q=function(e){function t(){return e.apply(this,arguments)||this}Object(y.a)(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.bodyClass="App--index";var r=app.store.getById("badges",m.route.param("id"));this.loading=!r,r?(app.history.push("badgeItemPage",r.name()),this.setTitle(r)):app.store.find("badges/"+m.route.param("id")).then((function(e){a.loading=!1,app.history.push("badgeItemPage",e.name()),a.setTitle(e),m.redraw()}))},a.setTitle=function(e){app.setTitle(e.name()+" - "+app.translator.trans("v17development-flarum-badges.forum.badge.badges"))},a.view=function(){var e=app.store.getById("badges",m.route.param("id"));return m("div",{className:"IndexPage"},m("div",{className:"container"},m("div",{className:"sideNavContainer"},m("nav",{className:"IndexPage-nav sideNav"},m("ul",null,k()(T.a.prototype.sidebarItems().toArray()))),m("div",{className:"IndexPage-results sideNavOffset"},m(g.a,{href:app.route("badges"),icon:"fas fa-chevron-left",className:"Button BadgesOverviewButton"},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),this.loading&&m(_.a,{size:"large"}),!this.loading&&m("div",{className:"BadgeUserListInfo"},m("i",{className:e.icon()}),m("div",{className:"BadgeUserListInfo-meta"},m("h3",null,e.name()),m("p",null,e.description()))),e&&m("h3",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_by_count",{count:e.earnedAmount()})),!this.loading&&m(K,{state:app.userBadgeListState,badgeId:e.id()})))))},t}(C.a),W=a(11);function X(){Object(r.extend)(T.a.prototype,"navItems",(function(e){return e.add("badges",m(g.a,{icon:"fas fa-id-badge",href:app.route("badges")},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),15),e}))}function Y(e,t){for(var a=0;a\n
{this.data().toArray()}
\n {this.attrs.userBadgeData && app.forum.attribute(\"canGiveBadge\") && (\n
\n {\n if (\n confirm(\n app.translator.trans(\n \"v17development-flarum-badges.forum.moderation.remove_badge_confirm\"\n )\n )\n ) {\n this.loading = true;\n this.attrs.userBadgeData.delete().then(() => this.hide());\n }\n }}\n loading={this.loading}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.moderation.remove_badge\"\n )}\n \n
\n )}\n \n );\n }\n\n data() {\n const items = new ItemList();\n\n // Badge name\n items.add(\n \"name\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.name\"\n )}\n :\n \n

\n

{this.attrs.badge.name()}

\n
\n );\n\n // Badge description\n items.add(\n \"description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.description\"\n )}\n :\n \n

\n

{this.attrs.badge.description()}

\n
\n );\n\n // Badge earning reason\n if (\n this.attrs.userBadgeData &&\n (this.attrs.userBadgeData.description() ||\n app.forum.attribute(\"canGiveBadge\"))\n ) {\n items.add(\n \"earning_reason\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earning_reason\"\n )}\n :\n \n

\n\n

\n {this.attrs.userBadgeData.description() ? (\n this.attrs.userBadgeData.description()\n ) : (\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.no_earning_reason\"\n )}\n \n )}\n

\n

\n {app.forum.attribute(\"canGiveBadge\") && (\n {\n e.preventDefault();\n app.modal.show(GiveBadgeModal, {\n badge: this.attrs.userBadgeData,\n });\n }}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.update_earning_reason\"\n )}\n \n )}\n

\n
\n );\n }\n\n // Badge earned on\n if (this.attrs.userBadgeData) {\n items.add(\n \"earned_date\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_on\"\n )}\n :\n \n

\n

{fullTime(this.attrs.userBadgeData.assignedAt())}

\n
\n );\n }\n\n // Badge category\n if (this.attrs.userBadgeData) {\n items.add(\n \"category\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.category\"\n )}\n :\n \n

\n

\n {this.attrs.badge.category() && this.attrs.badge.category().name()}\n\n {/* Uncategorized */}\n {!this.attrs.badge.category() &&\n app.translator.trans(\n \"v17development-flarum-badges.forum.uncategorized\"\n )}\n {/* \n {app.translator.trans(\n \"v17development-flarum-badges.forum.all_badges\"\n )}\n */}\n

\n
\n );\n }\n\n // Badge category\n if (this.attrs.badge && this.attrs.badge.earnedAmount()) {\n items.add(\n \"earned_amount\",\n
\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_count\",\n {\n count: this.attrs.badge.earnedAmount(),\n }\n )}\n

\n
\n );\n }\n\n return items;\n }\n}\n","module.exports = flarum.core.compat['common/Component'];","import Modal from \"flarum/components/Modal\";\nimport Button from \"flarum/components/Button\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Select from \"flarum/components/Select\";\nimport Stream from \"flarum/utils/Stream\";\nimport BadgeModal from \"./BadgeModal\";\n\nexport default class GiveBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Select image\n this.selectedBadge = this.attrs.badge ? this.attrs.badge.badge() : null;\n\n // Current user\n this.user = this.attrs.badge ? this.attrs.badge.user() : this.attrs.user;\n\n // User has badge\n this.userHasBadge = false;\n\n // Badge model\n this.badge = this.attrs.badge\n ? this.attrs.badge\n : app.store.createRecord(\"userBadges\");\n\n // Earning reason\n this.description = Stream(this.badge.description());\n\n // List of available bagges\n this.categories = {};\n\n this.uncategorizedBadges = [];\n\n this.loading = false;\n\n // Load all available badges\n if (!this.attrs.badge) {\n this.loading = true;\n\n app.store\n .find(\"badges\", {\n include: \"category\",\n })\n .then((badges) => {\n badges.forEach((badge) => {\n // Categorized\n if (badge.category()) {\n const category = badge.category();\n\n if (!this.categories[category.id()]) {\n this.categories[category.id()] = {\n category,\n badges: [badge],\n };\n } else {\n this.categories[category.id()].badges.push(badge);\n }\n }\n // Uncategorized\n else {\n this.uncategorizedBadges.push(badge);\n }\n });\n\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n }\n }\n\n className() {\n return \"Modal--small BadgeModal\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.forum.${\n this.badge.exists ? \"update\" : \"give\"\n }_badge`\n );\n }\n\n content() {\n return (\n
\n
\n
{this.fields().toArray()}
\n
\n\n
\n \n {app.translator.trans(\"core.forum.composer_edit.submit_button\")}\n \n
\n
\n );\n }\n\n fields() {\n const items = new ItemList();\n\n // Badge selector\n items.add(\n \"badge\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badge\"\n )}\n \n

\n\n
\n {\n if (e.target.value === \"empty\") return;\n this.selectedBadge = app.store.getById(\"badges\", e.target.value);\n\n // Check if the user already has this badge\n this.checkUserHasBadge(this.selectedBadge);\n }}\n className=\"Select-input FormControl\"\n >\n \n\n {/* When no badge is selected, show all available badges */}\n {!this.attrs.badge &&\n Object.values(this.categories).map(({ category, badges }) => (\n \n {badges.map((badge) => (\n \n ))}\n \n ))}\n\n {!this.attrs.badge && this.uncategorizedBadges.length >= 1 && (\n \n {this.uncategorizedBadges.map((badge) => (\n \n ))}\n \n )}\n\n {/* When a badge is already assigned */}\n {!!this.attrs.badge && (\n \n )}\n \n \n
\n\n {this.userHasBadge && (\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.user_has_badge\"\n )}\n

\n )}\n
,\n 30\n );\n\n // Badge description\n items.add(\n \"badge_description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.description\"\n )}\n :\n \n

\n

\n {this.selectedBadge\n ? this.selectedBadge.description()\n : app.translator.trans(\n \"v17development-flarum-badges.forum.select_badge\"\n )}\n

\n
,\n 30\n );\n\n // Badge earning reason\n items.add(\n \"description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earning_reason\"\n )}\n \n

\n \n
,\n 30\n );\n\n return items;\n }\n\n checkUserHasBadge(badge) {\n let foundBadge = false;\n\n this.user.userBadges().map((userBadge) => {\n if (userBadge.badge() == badge) {\n foundBadge = true;\n }\n });\n\n this.userHasBadge = foundBadge;\n\n m.redraw();\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n description: this.description(),\n relationships: this.attrs.badge\n ? {}\n : {\n badge: this.selectedBadge,\n user: this.user,\n },\n })\n .then(\n () => {\n // Re-open badge modal\n if (this.attrs.badge) {\n app.modal.show(BadgeModal, {\n badge: this.attrs.badge.badge(),\n userBadgeData: this.attrs.badge,\n });\n } else {\n this.hide();\n }\n\n m.redraw();\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\nimport BadgeModal from \"../../forum/components/BadgeModal\";\n\nexport default class Badge extends mixin(Model, {\n name: Model.attribute(\"name\"),\n icon: Model.attribute(\"icon\"),\n order: Model.attribute(\"order\"),\n image: Model.attribute(\"image\"),\n description: Model.attribute(\"description\"),\n isVisible: Model.attribute(\"isVisible\"),\n createdAt: Model.attribute(\"createdAt\"),\n earnedAmount: Model.attribute(\"earnedAmount\"),\n category: Model.hasOne(\"category\"),\n}) {\n apiEndpoint() {\n return \"/badges\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","module.exports = flarum.core.compat['helpers/fullTime'];","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\n\nexport default class BadgeCategory extends mixin(Model, {\n name: Model.attribute(\"name\"),\n order: Model.attribute(\"order\"),\n description: Model.attribute(\"description\"),\n isEnabled: Model.attribute(\"isEnabled\"),\n createdAt: Model.attribute(\"createdAt\"),\n users: Model.hasMany(\"users\"),\n badges: Model.hasMany(\"badges\"),\n}) {\n apiEndpoint() {\n return \"/badge_categories\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/UserPage'];","module.exports = flarum.core.compat['components/Page'];","module.exports = flarum.core.compat['components/Link'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['models/User'];","module.exports = flarum.core.compat['utils/UserControls'];","module.exports = flarum.core.compat['components/LinkButton'];","module.exports = flarum.core.compat['common/components/Tooltip'];","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\n\nexport default class UserBadge extends mixin(Model, {\n user: Model.hasOne(\"user\"),\n badge: Model.hasOne(\"badge\"),\n description: Model.attribute(\"description\"),\n isPrimary: Model.attribute(\"isPrimary\"),\n assignedAt: Model.attribute(\"assignedAt\"),\n}) {\n apiEndpoint() {\n return \"/user_badges\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","import Component from \"flarum/common/Component\";\nimport Tooltip from \"flarum/common/components/Tooltip\";\nimport BadgeModal from \"./BadgeModal\";\n\nexport default class UserBadge extends Component {\n view() {\n // Hide badge when not enabled\n if (!this.attrs.badge.isVisible()) {\n return null;\n }\n\n return (\n \n \n app.modal.show(BadgeModal, {\n badge: this.attrs.badge,\n userBadgeData: this.attrs.userBadgeData,\n })\n }\n >\n {this.attrs.badge.name()}\n \n \n );\n }\n}\n","import Component from \"flarum/common/Component\";\nimport UserBadge from \"./UserBadge\";\n\nexport default class UserBadgeList extends Component {\n view() {\n const categories = {};\n const uncategorized = [];\n\n this.attrs.user.userBadges().map((userBadge) => {\n if (!userBadge) return null;\n\n // Categorized\n if (userBadge.badge().category()) {\n const category = userBadge.badge().category();\n\n if (!categories[category.id()]) {\n categories[category.id()] = {\n category,\n badges: [userBadge],\n };\n } else {\n categories[category.id()].badges.push(userBadge);\n }\n }\n // Uncategorized\n else {\n uncategorized.push(userBadge);\n }\n });\n\n return (\n
\n {Object.keys(categories).length === 0 && (\n
\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.user_no_badges\"\n )}\n

\n
\n )}\n\n {Object.keys(categories).length >= 1 &&\n Object.keys(categories)\n .sort(\n (a, b) =>\n categories[a].category.order() - categories[b].category.order()\n )\n .map((id) => {\n const category = categories[id].category;\n const badges = categories[id].badges;\n\n if (!category.isEnabled()) return null;\n\n return (\n
\n

{category.name()}

\n\n {category.description() &&

{category.description()}

}\n\n {badges\n .sort((a, b) => a.badge().order() - b.badge().order())\n .map((userBadge) => (\n \n ))}\n
\n );\n })}\n\n {/* Uncategorized badges */}\n {uncategorized.length >= 1 && (\n
\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.uncategorized\"\n )}\n

\n\n {uncategorized\n .sort((a, b) => a.badge().order() - b.badge().order())\n .map((userBadge) => (\n \n ))}\n
\n )}\n
\n );\n }\n}\n","import UserPage from \"flarum/components/UserPage\";\nimport LoadingIndicator from \"flarum/components/LoadingIndicator\";\nimport UserBadgeList from \"./UserBadgeList\";\n\nexport default class BadgesProfilePage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.user = null;\n\n this.loading = true;\n\n this.loadUser(m.route.param(\"username\"));\n }\n\n content() {\n if (!this.user || this.loading) {\n return ;\n }\n\n return UserBadgeList.component({\n user: this.user,\n });\n }\n\n show(user) {\n super.show(user);\n this.user = user;\n\n app.store\n .find(\"users\", user.id(), {\n include: \"userBadges,userBadges.badge,userBadges.badge.category\",\n })\n .then(() => {\n this.loading = false;\n m.redraw();\n });\n }\n}\n","import Page from \"flarum/components/Page\";\n\nexport default class BadgesOverviewPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n }\n\n view() {\n return

Badge page

;\n }\n}\n","import Page from \"flarum/components/Page\";\n\nexport default class BadgeItemPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n }\n\n view() {\n return

Badge page

;\n }\n}\n","import { extend } from \"flarum/extend\";\nimport Model from \"flarum/Model\";\nimport User from \"flarum/models/User\";\nimport UserPage from \"flarum/components/UserPage\";\nimport UserControls from \"flarum/utils/UserControls\";\nimport LinkButton from \"flarum/components/LinkButton\";\nimport Button from \"flarum/components/Button\";\nimport Badge from \"../common/models/Badge\";\nimport BadgeCategory from \"../common/models/BadgeCategory\";\nimport UserBadge from \"../common/models/UserBadge\";\nimport BadgesProfilePage from \"./components/BadgesProfilePage\";\nimport BadgesOverviewPage from \"./components/BadgesOverviewPage\";\nimport BadgeItemPage from \"./components/BadgeItemPage\";\nimport GiveBadgeModal from \"./components/GiveBadgeModal\";\n\napp.initializers.add(\"v17development-flarum-badges\", (app) => {\n app.store.models.badges = Badge;\n app.store.models.badgeCategories = BadgeCategory;\n app.store.models.userBadges = UserBadge;\n\n User.prototype.userBadges = Model.hasMany(\"userBadges\");\n User.prototype.userPrimaryBadge = Model.hasOne(\"userPrimaryBadge\");\n\n // Add user badges to the user profile\n app.routes[\"user.badges\"] = {\n path: \"/u/:username/badges\",\n component: BadgesProfilePage,\n };\n\n // Future\n // // Badges overview page\n // app.routes[\"badges\"] = {\n // path: \"/badges\",\n // component: BadgesOverviewPage,\n // };\n\n // // Badges overview page\n // app.routes[\"badges.category\"] = {\n // path: \"/badges/category/:id\",\n // component: BadgesOverviewPage,\n // };\n\n // // Badge item page\n // app.routes[\"badges.item\"] = {\n // path: \"/badges/:id\",\n // component: BadgeItemPage,\n // };\n\n // Add uploads to user page menu items\n extend(UserPage.prototype, \"navItems\", function (items) {\n items.add(\n \"badges\",\n LinkButton.component(\n {\n href: app.route(\"user.badges\", {\n username: this.user.username(),\n }),\n name: \"badges\",\n icon: \"fas fa-user-tag\",\n },\n [\n app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badges\"\n ),\n {this.user.userBadges().length},\n ]\n ),\n 90\n );\n });\n\n extend(UserControls, \"moderationControls\", function (items, user) {\n // User can give badges\n if (app.forum.attribute(\"canGiveBadge\")) {\n items.add(\n \"test\",\n \n app.modal.show(GiveBadgeModal, {\n user: user,\n })\n }\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.give_badge\"\n )}\n \n );\n }\n });\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@v17development/flarum-badges/webpack/bootstrap","webpack://@v17development/flarum-badges/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@v17development/flarum-badges/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@v17development/flarum-badges/external \"flarum.core.compat['Model']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Button']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['utils/Stream']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Modal']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['common/Component']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['utils/ItemList']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/LinkButton']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['utils/mixin']\"","webpack://@v17development/flarum-badges/./src/forum/components/BadgeModal.js","webpack://@v17development/flarum-badges/./src/forum/components/GiveBadgeModal.js","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/IndexPage']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Link']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['extend']\"","webpack://@v17development/flarum-badges/./src/common/models/Badge.js","webpack://@v17development/flarum-badges/external \"flarum.core.compat['helpers/fullTime']\"","webpack://@v17development/flarum-badges/./src/common/models/BadgeCategory.js","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/UserPage']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Page']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['common/helpers/listItems']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['components/Select']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['models/User']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['utils/UserControls']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['common/components/Tooltip']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['helpers/avatar']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['helpers/humanTime']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['common/states/PaginatedListState']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['forum/components/Notification']\"","webpack://@v17development/flarum-badges/external \"flarum.core.compat['forum/components/NotificationGrid']\"","webpack://@v17development/flarum-badges/./src/common/models/UserBadge.js","webpack://@v17development/flarum-badges/./src/forum/components/UserBadge.js","webpack://@v17development/flarum-badges/./src/forum/components/UserBadgeList.js","webpack://@v17development/flarum-badges/./src/forum/components/BadgesProfilePage.js","webpack://@v17development/flarum-badges/./src/forum/components/BadgeCategoryList/TableView.js","webpack://@v17development/flarum-badges/./src/forum/components/BadgeCategoryList/BlockListView.js","webpack://@v17development/flarum-badges/./src/forum/components/BadgesOverviewPage.js","webpack://@v17development/flarum-badges/./src/forum/components/BadgeUserList.js","webpack://@v17development/flarum-badges/./src/forum/components/BadgeItemPage.js","webpack://@v17development/flarum-badges/./src/forum/addSidebarNav.js","webpack://@v17development/flarum-badges/./node_modules/@babel/runtime/helpers/esm/createClass.js","webpack://@v17development/flarum-badges/./src/forum/states/UserBadgeListState.js","webpack://@v17development/flarum-badges/./src/forum/notification/BadgeReceivedNotification.js","webpack://@v17development/flarum-badges/./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","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","flarum","core","compat","BadgeModal","oninit","vnode","this","loading","className","title","app","translator","trans","content","data","toArray","href","route","id","attrs","badge","style","margin","userBadgeData","forum","attribute","onclick","confirm","then","hide","items","ItemList","add","description","e","preventDefault","modal","show","GiveBadgeModal","fullTime","assignedAt","category","earnedAmount","count","Modal","selectedBadge","user","userHasBadge","store","createRecord","Stream","categories","uncategorizedBadges","find","include","badges","forEach","push","redraw","exists","fields","type","disabled","onchange","target","getById","checkUserHasBadge","values","map","label","length","class","placeholder","bidi","foundBadge","userBadges","userBadge","onsubmit","save","relationships","response","handleErrors","Badge","apiEndpoint","mixin","Model","icon","order","image","isVisible","createdAt","hasOne","BadgeCategory","isEnabled","isTable","users","hasMany","UserBadge","isPrimary","view","text","Component","UserBadgeList","uncategorized","keys","sort","a","b","BadgesProfilePage","loadUser","param","size","component","UserPage","TableView","width","scope","BlockListView","BadgesOverviewPage","bodyClass","history","setTitle","all","listItems","IndexPage","sidebarItems","Page","BadgeUserList","state","refreshParams","filter","badgeId","isInitialLoading","isLoadingNext","LoadingIndicator","hasNext","Button","loadNext","isEmpty","getPages","pg","username","avatar","displayName","date","humanTime","BadgeItemPage","found","userBadgeListState","addSidebarNav","extend","_defineProperties","props","descriptor","configurable","writable","UserBadgeListState","pageSize","Constructor","protoProps","staticProps","PaginatedListState","BadgeReceivedNotification","session","excerpt","subject","notification","Notification","initializers","models","badgeCategories","User","userPrimaryBadge","routes","path","notificationComponents","badgeReceived","NotificationGrid","LinkButton","UserControls"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,E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AAMW,QAAQ,cAC1C2E,IAAKtL,UAAUuL,iBAAmBvF,IAAMM,OAAO,oBAG/CjF,EAAImK,OAAO,eAAiB,CAC1BC,KAAM,sBACN9D,UAAWJ,GAIblG,EAAImK,OAAOtH,OAAS,CAClBuH,KAAM,UACN9D,UAAWM,GAWb5G,EAAImK,OAAO,eAAiB,CAC1BC,KAAM,cACN9D,UAAWkC,GAGbG,IAEA3I,EAAI0I,mBAAqB,IAAIQ,EAG7BlJ,EAAIqK,uBAAuBC,cAAgBd,GAG3CZ,iBAAO2B,KAAiB5L,UAAW,qBAAqB,SAAUyC,GAChEA,EAAME,IAAI,gBAAiB,CACzBhE,KAAM,gBACNsH,KAAM,kBACNjB,MAAO3D,EAAIC,WAAWC,MACpB,iEAMN0I,iBAAOrC,IAAS5H,UAAW,YAAY,SAAUyC,GAC/CA,EAAME,IACJ,SACAkJ,IAAWlE,UACT,CACEhG,KAAMN,EAAIO,MAAM,cAAe,CAC7B4H,SAAUvI,KAAKwC,KAAK+F,aAEtB7K,KAAM,SACNsH,KAAM,mBAER,CACE5E,EAAIC,WAAWC,MACb,mDAEF,UAAMJ,UAAU,gBAAgBF,KAAKwC,KAAK6B,aAAaL,UAG3D,OAIJgF,iBAAO6B,IAAc,sBAAsB,SAAUrJ,EAAOgB,GAEtDpC,EAAIc,MAAMC,UAAU,iBACtBK,EAAME,IACJ,OACA,EAAC,IAAD,CACEsD,KAAK,kBACL5D,QAAS,kBACPhB,EAAI0B,MAAMC,KAAKC,IAAgB,CAC7BQ,KAAMA,MAITpC,EAAIC,WAAWC,MACd","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 = 36);\n","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}","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}","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/LinkButton'];","module.exports = flarum.core.compat['utils/mixin'];","import Modal from \"flarum/components/Modal\";\nimport Button from \"flarum/components/Button\";\nimport fullTime from \"flarum/helpers/fullTime\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport LinkButton from \"flarum/components/LinkButton\";\nimport GiveBadgeModal from \"./GiveBadgeModal\";\n\nexport default class BadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return \"Modal--small\";\n }\n\n title() {\n return app.translator.trans(\n \"v17development-flarum-badges.forum.badge_information\"\n );\n }\n\n content() {\n return (\n
\n
{this.data().toArray()}
\n
\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badge_details\"\n )}\n \n\n {this.attrs.userBadgeData && app.forum.attribute(\"canGiveBadge\") && (\n {\n if (\n confirm(\n app.translator.trans(\n \"v17development-flarum-badges.forum.moderation.remove_badge_confirm\"\n )\n )\n ) {\n this.loading = true;\n this.attrs.userBadgeData.delete().then(() => this.hide());\n }\n }}\n loading={this.loading}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.moderation.remove_badge\"\n )}\n \n )}\n
\n
\n );\n }\n\n data() {\n const items = new ItemList();\n\n // Badge name\n items.add(\n \"name\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.name\"\n )}\n :\n \n

\n

{this.attrs.badge.name()}

\n
\n );\n\n // Badge description\n items.add(\n \"description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.description\"\n )}\n :\n \n

\n

{this.attrs.badge.description()}

\n
\n );\n\n // Badge earning reason\n if (\n this.attrs.userBadgeData &&\n (this.attrs.userBadgeData.description() ||\n app.forum.attribute(\"canGiveBadge\"))\n ) {\n items.add(\n \"earning_reason\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earning_reason\"\n )}\n :\n \n

\n\n

\n {this.attrs.userBadgeData.description() ? (\n this.attrs.userBadgeData.description()\n ) : (\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.no_earning_reason\"\n )}\n \n )}\n

\n

\n {app.forum.attribute(\"canGiveBadge\") && (\n {\n e.preventDefault();\n app.modal.show(GiveBadgeModal, {\n badge: this.attrs.userBadgeData,\n });\n }}\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.update_earning_reason\"\n )}\n \n )}\n

\n
\n );\n }\n\n // Badge earned on\n if (this.attrs.userBadgeData) {\n items.add(\n \"earned_date\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_on\"\n )}\n :\n \n

\n

{fullTime(this.attrs.userBadgeData.assignedAt())}

\n
\n );\n }\n\n // Badge category\n if (this.attrs.userBadgeData) {\n items.add(\n \"category\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.category\"\n )}\n :\n \n

\n

\n {this.attrs.badge.category() && this.attrs.badge.category().name()}\n\n {/* Uncategorized */}\n {!this.attrs.badge.category() &&\n app.translator.trans(\n \"v17development-flarum-badges.forum.uncategorized\"\n )}\n {/* \n {app.translator.trans(\n \"v17development-flarum-badges.forum.all_badges\"\n )}\n */}\n

\n
\n );\n }\n\n // Badge category\n if (this.attrs.badge && this.attrs.badge.earnedAmount()) {\n items.add(\n \"earned_amount\",\n
\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_count\",\n {\n count: this.attrs.badge.earnedAmount(),\n }\n )}\n

\n
\n );\n }\n\n return items;\n }\n}\n","import Modal from \"flarum/components/Modal\";\nimport Button from \"flarum/components/Button\";\nimport ItemList from \"flarum/utils/ItemList\";\nimport Select from \"flarum/components/Select\";\nimport Stream from \"flarum/utils/Stream\";\nimport BadgeModal from \"./BadgeModal\";\n\nexport default class GiveBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Select image\n this.selectedBadge = this.attrs.badge ? this.attrs.badge.badge() : null;\n\n // Current user\n this.user = this.attrs.badge ? this.attrs.badge.user() : this.attrs.user;\n\n // User has badge\n this.userHasBadge = false;\n\n // Badge model\n this.badge = this.attrs.badge\n ? this.attrs.badge\n : app.store.createRecord(\"userBadges\");\n\n // Earning reason\n this.description = Stream(this.badge.description());\n\n // List of available bagges\n this.categories = {};\n\n this.uncategorizedBadges = [];\n\n this.loading = false;\n\n // Load all available badges\n if (!this.attrs.badge) {\n this.loading = true;\n\n app.store\n .find(\"badges\", {\n include: \"category\",\n })\n .then((badges) => {\n badges.forEach((badge) => {\n // Categorized\n if (badge.category()) {\n const category = badge.category();\n\n if (!this.categories[category.id()]) {\n this.categories[category.id()] = {\n category,\n badges: [badge],\n };\n } else {\n this.categories[category.id()].badges.push(badge);\n }\n }\n // Uncategorized\n else {\n this.uncategorizedBadges.push(badge);\n }\n });\n\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n }\n }\n\n className() {\n return \"Modal--small BadgeModal\";\n }\n\n title() {\n return app.translator.trans(\n `v17development-flarum-badges.forum.${\n this.badge.exists ? \"update\" : \"give\"\n }_badge`\n );\n }\n\n content() {\n return (\n
\n
\n
{this.fields().toArray()}
\n
\n\n
\n \n {app.translator.trans(\"core.forum.composer_edit.submit_button\")}\n \n
\n
\n );\n }\n\n fields() {\n const items = new ItemList();\n\n // Badge selector\n items.add(\n \"badge\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badge\"\n )}\n \n

\n\n
\n {\n if (e.target.value === \"empty\") return;\n this.selectedBadge = app.store.getById(\"badges\", e.target.value);\n\n // Check if the user already has this badge\n this.checkUserHasBadge(this.selectedBadge);\n }}\n className=\"Select-input FormControl\"\n >\n \n\n {/* When no badge is selected, show all available badges */}\n {!this.attrs.badge &&\n Object.values(this.categories).map(({ category, badges }) => (\n \n {badges.map((badge) => (\n \n ))}\n \n ))}\n\n {!this.attrs.badge && this.uncategorizedBadges.length >= 1 && (\n \n {this.uncategorizedBadges.map((badge) => (\n \n ))}\n \n )}\n\n {/* When a badge is already assigned */}\n {!!this.attrs.badge && (\n \n )}\n \n \n
\n\n {this.userHasBadge && (\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.user_has_badge\"\n )}\n

\n )}\n
,\n 30\n );\n\n // Badge description\n items.add(\n \"badge_description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.description\"\n )}\n :\n \n

\n

\n {this.selectedBadge\n ? this.selectedBadge.description()\n : app.translator.trans(\n \"v17development-flarum-badges.forum.select_badge\"\n )}\n

\n
,\n 30\n );\n\n // Badge earning reason\n items.add(\n \"description\",\n
\n

\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earning_reason\"\n )}\n \n

\n \n
,\n 30\n );\n\n return items;\n }\n\n checkUserHasBadge(badge) {\n let foundBadge = false;\n\n this.user.userBadges().map((userBadge) => {\n if (userBadge.badge() == badge) {\n foundBadge = true;\n }\n });\n\n this.userHasBadge = foundBadge;\n\n m.redraw();\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n description: this.description(),\n relationships: this.attrs.badge\n ? {}\n : {\n badge: this.selectedBadge,\n user: this.user,\n },\n })\n .then(\n () => {\n // Re-open badge modal\n if (this.attrs.badge) {\n app.modal.show(BadgeModal, {\n badge: this.attrs.badge.badge(),\n userBadgeData: this.attrs.badge,\n });\n } else {\n this.hide();\n }\n\n m.redraw();\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","module.exports = flarum.core.compat['components/IndexPage'];","module.exports = flarum.core.compat['components/Link'];","module.exports = flarum.core.compat['extend'];","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\nimport BadgeModal from \"../../forum/components/BadgeModal\";\n\nexport default class Badge extends mixin(Model, {\n name: Model.attribute(\"name\"),\n icon: Model.attribute(\"icon\"),\n order: Model.attribute(\"order\"),\n image: Model.attribute(\"image\"),\n description: Model.attribute(\"description\"),\n isVisible: Model.attribute(\"isVisible\"),\n createdAt: Model.attribute(\"createdAt\"),\n earnedAmount: Model.attribute(\"earnedAmount\"),\n category: Model.hasOne(\"category\"),\n}) {\n apiEndpoint() {\n return \"/badges\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","module.exports = flarum.core.compat['helpers/fullTime'];","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\n\nexport default class BadgeCategory extends mixin(Model, {\n name: Model.attribute(\"name\"),\n order: Model.attribute(\"order\"),\n description: Model.attribute(\"description\"),\n isEnabled: Model.attribute(\"isEnabled\"),\n createdAt: Model.attribute(\"createdAt\"),\n isTable: Model.attribute(\"isTable\"),\n users: Model.hasMany(\"users\"),\n badges: Model.hasMany(\"badges\"),\n}) {\n apiEndpoint() {\n return \"/badge_categories\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","module.exports = flarum.core.compat['components/UserPage'];","module.exports = flarum.core.compat['components/Page'];","module.exports = flarum.core.compat['common/helpers/listItems'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['models/User'];","module.exports = flarum.core.compat['utils/UserControls'];","module.exports = flarum.core.compat['common/components/Tooltip'];","module.exports = flarum.core.compat['helpers/avatar'];","module.exports = flarum.core.compat['helpers/humanTime'];","module.exports = flarum.core.compat['common/states/PaginatedListState'];","module.exports = flarum.core.compat['forum/components/Notification'];","module.exports = flarum.core.compat['forum/components/NotificationGrid'];","import Model from \"flarum/Model\";\nimport mixin from \"flarum/utils/mixin\";\n\nexport default class UserBadge extends mixin(Model, {\n user: Model.hasOne(\"user\"),\n badge: Model.hasOne(\"badge\"),\n description: Model.attribute(\"description\"),\n isPrimary: Model.attribute(\"isPrimary\"),\n assignedAt: Model.attribute(\"assignedAt\"),\n}) {\n apiEndpoint() {\n return \"/user_badges\" + (this.exists ? \"/\" + this.data.id : \"\");\n }\n}\n","import Component from \"flarum/common/Component\";\nimport Tooltip from \"flarum/common/components/Tooltip\";\nimport BadgeModal from \"./BadgeModal\";\n\nexport default class UserBadge extends Component {\n view() {\n // Hide badge when not enabled\n if (!this.attrs.badge.isVisible()) {\n return null;\n }\n\n return (\n \n \n app.modal.show(BadgeModal, {\n badge: this.attrs.badge,\n userBadgeData: this.attrs.userBadgeData,\n })\n }\n >\n {this.attrs.badge.name()}\n \n \n );\n }\n}\n","import Component from \"flarum/common/Component\";\nimport UserBadge from \"./UserBadge\";\n\nexport default class UserBadgeList extends Component {\n view() {\n const categories = {};\n const uncategorized = [];\n\n this.attrs.user.userBadges().map((userBadge) => {\n if (!userBadge) return null;\n\n // Categorized\n if (userBadge.badge().category()) {\n const category = userBadge.badge().category();\n\n if (!categories[category.id()]) {\n categories[category.id()] = {\n category,\n badges: [userBadge],\n };\n } else {\n categories[category.id()].badges.push(userBadge);\n }\n }\n // Uncategorized\n else {\n uncategorized.push(userBadge);\n }\n });\n\n return (\n
\n {Object.keys(categories).length === 0 && (\n
\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.user_no_badges\"\n )}\n

\n
\n )}\n\n {Object.keys(categories).length >= 1 &&\n Object.keys(categories)\n .sort(\n (a, b) =>\n categories[a].category.order() - categories[b].category.order()\n )\n .map((id) => {\n const category = categories[id].category;\n const badges = categories[id].badges;\n\n if (!category.isEnabled()) return null;\n\n return (\n
\n

{category.name()}

\n\n {category.description() &&

{category.description()}

}\n\n {badges\n .sort((a, b) => a.badge().order() - b.badge().order())\n .map((userBadge) => (\n \n ))}\n
\n );\n })}\n\n {/* Uncategorized badges */}\n {uncategorized.length >= 1 && (\n
\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.uncategorized\"\n )}\n

\n\n {uncategorized\n .sort((a, b) => a.badge().order() - b.badge().order())\n .map((userBadge) => (\n \n ))}\n
\n )}\n
\n );\n }\n}\n","import UserPage from \"flarum/components/UserPage\";\nimport LoadingIndicator from \"flarum/components/LoadingIndicator\";\nimport UserBadgeList from \"./UserBadgeList\";\n\nexport default class BadgesProfilePage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.user = null;\n\n this.loading = true;\n\n this.loadUser(m.route.param(\"username\"));\n }\n\n content() {\n if (!this.user || this.loading) {\n return ;\n }\n\n return UserBadgeList.component({\n user: this.user,\n });\n }\n\n show(user) {\n super.show(user);\n this.user = user;\n\n app.store\n .find(\"users\", user.id(), {\n include: \"userBadges,userBadges.badge,userBadges.badge.category\",\n })\n .then(() => {\n this.loading = false;\n m.redraw();\n });\n }\n}\n","import Component from \"flarum/common/Component\";\nimport Link from \"flarum/components/Link\";\n\nexport default class TableView extends Component {\n view() {\n if (!this.attrs.badges) {\n return null;\n }\n\n const badges = this.attrs.badges;\n\n return (\n \n \n \n \n \n \n \n \n {badges.map((badge) => {\n return (\n \n \n \n \n );\n })}\n \n
\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badges\"\n )}\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.description\"\n )}\n
\n \n {badge.name()}\n \n \n {badge.description()}\n\n
\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_count\",\n {\n count: badge.earnedAmount(),\n }\n )}\n
\n
\n );\n }\n}\n","import Component from \"flarum/common/Component\";\nimport Link from \"flarum/components/Link\";\n\nexport default class BlockListView extends Component {\n view() {\n if (!this.attrs.badges) {\n return null;\n }\n\n const badges = this.attrs.badges;\n\n return (\n
    \n {badges.map((badge) => {\n return (\n
  • \n \n
    \n \n {badge.name()}\n \n\n

    {badge.description()}

    \n\n

    \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_count\",\n {\n count: badge.earnedAmount(),\n }\n )}\n

    \n
    \n \n
  • \n );\n })}\n
\n );\n }\n}\n","import Page from \"flarum/components/Page\";\nimport IndexPage from \"flarum/components/IndexPage\";\nimport listItems from \"flarum/common/helpers/listItems\";\nimport LoadingIndicator from \"flarum/components/LoadingIndicator\";\nimport TableView from \"./BadgeCategoryList/TableView\";\nimport BlockListView from \"./BadgeCategoryList/BlockListView\";\n\nexport default class BadgesOverviewPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.bodyClass = \"App--index\";\n\n this.loading = true;\n\n app.history.push(\"badgeOverviewPage\");\n\n app.setTitle(\n app.translator.trans(\"v17development-flarum-badges.forum.badge.badges\")\n );\n\n // Load badge categories\n app.store.find(\"badge_categories\").then(() => {\n this.loading = false;\n\n m.redraw();\n });\n }\n\n view() {\n const categories = app.store\n .all(\"badgeCategories\")\n .sort((a, b) => a.order() - b.order());\n\n return (\n
\n
\n
\n \n
\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badges\"\n )}\n

\n\n {this.loading && }\n\n {!this.loading &&\n categories.map((category) => {\n const badges = category\n .badges()\n .sort((a, b) => a.order() - b.order());\n\n return (\n
\n

{category.name()}

\n {category.description() && (\n

{category.description()}

\n )}\n\n {category.isTable() && }\n\n {!category.isTable() && }\n
\n );\n })}\n
\n
\n
\n
\n );\n }\n}\n","import Component from \"flarum/common/Component\";\nimport Button from \"flarum/components/Button\";\nimport Link from \"flarum/components/Link\";\nimport LoadingIndicator from \"flarum/components/LoadingIndicator\";\nimport avatar from \"flarum/helpers/avatar\";\nimport humanTime from \"flarum/helpers/humanTime\";\n\nexport default class BadgeUserList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Load articles\n this.attrs.state.refreshParams({\n filter: {\n badge: this.attrs.badgeId,\n },\n sort: \"-assignedAt\",\n });\n }\n\n view() {\n const state = this.attrs.state;\n\n let loading = null;\n\n if (state.isInitialLoading() || state.isLoadingNext()) {\n loading = LoadingIndicator.component({\n size: \"large\",\n });\n } else if (state.hasNext()) {\n loading = Button.component(\n {\n className: \"Button\",\n icon: \"fas fa-chevron-down\",\n onclick: state.loadNext.bind(state),\n },\n app.translator.trans(\"core.forum.discussion_list.load_more_button\")\n );\n }\n\n // No items\n if (state.isInitialLoading() && state.isEmpty()) {\n return ;\n }\n\n // No items\n if (state.isEmpty()) {\n return (\n
\n {app.translator.trans(\n \"v17development-flarum-badges.forum.no_received\"\n )}\n
\n );\n }\n\n return (\n
\n
    \n {state.getPages().map((pg) => {\n return pg.items.map((userBadge) => {\n return (\n
  • \n \n {avatar(userBadge.user())}\n\n
    \n

    {userBadge.user().displayName()}

    \n\n

    \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.received_on\",\n {\n date: humanTime(userBadge.assignedAt()),\n }\n )}\n

    \n
    \n \n
  • \n );\n });\n })}\n
\n\n {loading &&
{loading}
}\n
\n );\n }\n}\n","import Page from \"flarum/components/Page\";\nimport IndexPage from \"flarum/components/IndexPage\";\nimport listItems from \"flarum/common/helpers/listItems\";\nimport LoadingIndicator from \"flarum/components/LoadingIndicator\";\nimport LinkButton from \"flarum/components/LinkButton\";\nimport BadgeUserList from \"./BadgeUserList\";\n\nexport default class BadgeItemPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.bodyClass = \"App--index\";\n\n const found = app.store.getById(\"badges\", m.route.param(\"id\"));\n\n this.loading = !found;\n\n if (!found) {\n // Load badge categories\n app.store.find(`badges/${m.route.param(\"id\")}`).then((badge) => {\n this.loading = false;\n\n app.history.push(\"badgeItemPage\", badge.name());\n\n this.setTitle(badge);\n\n m.redraw();\n });\n } else {\n app.history.push(\"badgeItemPage\", found.name());\n\n this.setTitle(found);\n }\n }\n\n setTitle(badge) {\n app.setTitle(\n `${badge.name()} - ${app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badges\"\n )}`\n );\n }\n\n view() {\n const badge = app.store.getById(\"badges\", m.route.param(\"id\"));\n\n return (\n
\n
\n
\n \n
\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badges\"\n )}\n \n\n {this.loading && }\n\n {!this.loading && (\n
\n \n\n
\n

{badge.name()}

\n

{badge.description()}

\n
\n
\n )}\n\n {badge && (\n

\n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.earned_by_count\",\n {\n count: badge.earnedAmount(),\n }\n )}\n

\n )}\n\n {!this.loading && (\n \n )}\n
\n
\n
\n
\n );\n }\n}\n","import { extend } from \"flarum/extend\";\nimport IndexPage from \"flarum/components/IndexPage\";\nimport LinkButton from \"flarum/components/LinkButton\";\n\nexport default function addSidebarNav() {\n extend(IndexPage.prototype, \"navItems\", function (items) {\n items.add(\n \"badges\",\n \n {app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badges\"\n )}\n ,\n 15\n );\n\n return items;\n });\n}\n","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","import PaginatedListState from \"flarum/common/states/PaginatedListState\";\n\nexport default class UserBadgeListState extends PaginatedListState {\n constructor() {\n super({}, 1, 18);\n\n this.pageSize = 18;\n }\n\n get type() {\n return \"user_badges\";\n }\n}\n","import Notification from \"flarum/forum/components/Notification\";\n\nexport default class BadgeReceivedNotification extends Notification {\n icon() {\n return \"\";\n }\n\n href() {\n return app.route(\"user.badges\", {\n username: app.session.user.username(),\n });\n }\n\n content() {\n return app.translator.trans(\n \"v17development-flarum-badges.forum.notification.title\"\n );\n }\n\n excerpt() {\n const subject = this.attrs.notification.subject();\n\n return (\n
\n \n\n {subject.badge().name()}\n
\n );\n }\n}\n","import { extend } from \"flarum/extend\";\nimport Model from \"flarum/Model\";\nimport User from \"flarum/models/User\";\nimport UserPage from \"flarum/components/UserPage\";\nimport UserControls from \"flarum/utils/UserControls\";\nimport LinkButton from \"flarum/components/LinkButton\";\nimport Button from \"flarum/components/Button\";\nimport Badge from \"../common/models/Badge\";\nimport BadgeCategory from \"../common/models/BadgeCategory\";\nimport UserBadge from \"../common/models/UserBadge\";\nimport BadgesProfilePage from \"./components/BadgesProfilePage\";\nimport BadgesOverviewPage from \"./components/BadgesOverviewPage\";\nimport BadgeItemPage from \"./components/BadgeItemPage\";\nimport GiveBadgeModal from \"./components/GiveBadgeModal\";\nimport addSidebarNav from \"./addSidebarNav\";\nimport UserBadgeListState from \"./states/UserBadgeListState\";\nimport BadgeReceivedNotification from \"./notification/BadgeReceivedNotification\";\nimport NotificationGrid from \"flarum/forum/components/NotificationGrid\";\n\napp.initializers.add(\"v17development-flarum-badges\", (app) => {\n app.store.models.badges = Badge;\n app.store.models.badgeCategories = BadgeCategory;\n app.store.models.userBadges = UserBadge;\n\n User.prototype.userBadges = Model.hasMany(\"userBadges\");\n User.prototype.userPrimaryBadge = Model.hasOne(\"userPrimaryBadge\");\n\n // Add user badges to the user profile\n app.routes[\"user.badges\"] = {\n path: \"/u/:username/badges\",\n component: BadgesProfilePage,\n };\n\n // Badges overview page\n app.routes.badges = {\n path: \"/badges\",\n component: BadgesOverviewPage,\n };\n\n // Future\n // // Badges overview page\n // app.routes[\"badges.category\"] = {\n // path: \"/badges/category/:id\",\n // component: BadgesOverviewPage,\n // };\n\n // Badge item page\n app.routes[\"badges.item\"] = {\n path: \"/badges/:id\",\n component: BadgeItemPage,\n };\n\n addSidebarNav();\n\n app.userBadgeListState = new UserBadgeListState();\n\n // Badge received notification\n app.notificationComponents.badgeReceived = BadgeReceivedNotification;\n\n // Enable badge notifications?\n extend(NotificationGrid.prototype, \"notificationTypes\", function (items) {\n items.add(\"badgeReceived\", {\n name: \"badgeReceived\",\n icon: \"fas fa-user-tag\",\n label: app.translator.trans(\n \"v17development-flarum-badges.forum.notification.settings\"\n ),\n });\n });\n\n // Add uploads to user page menu items\n extend(UserPage.prototype, \"navItems\", function (items) {\n items.add(\n \"badges\",\n LinkButton.component(\n {\n href: app.route(\"user.badges\", {\n username: this.user.username(),\n }),\n name: \"badges\",\n icon: \"fas fa-user-tag\",\n },\n [\n app.translator.trans(\n \"v17development-flarum-badges.forum.badge.badges\"\n ),\n {this.user.userBadges().length},\n ]\n ),\n 90\n );\n });\n\n extend(UserControls, \"moderationControls\", function (items, user) {\n // User can give badges\n if (app.forum.attribute(\"canGiveBadge\")) {\n items.add(\n \"test\",\n \n app.modal.show(GiveBadgeModal, {\n user: user,\n })\n }\n >\n {app.translator.trans(\n \"v17development-flarum-badges.forum.give_badge\"\n )}\n \n );\n }\n });\n});\n"],"sourceRoot":""} \ No newline at end of file