module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var s=e[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(o,s,function(e){return t[e]}.bind(null,s));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=15)}([function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat.extend},function(t,e,n){"use strict";function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}n.d(e,"a",function(){return o})},,,,,,function(t,e){t.exports=flarum.core.compat["components/AdminNav"]},function(t,e){t.exports=flarum.core.compat["components/AdminLinkButton"]},function(t,e){t.exports=flarum.core.compat.Component},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["utils/saveSettings"]},function(t,e){t.exports=flarum.core.compat["components/Alert"]},,function(t,e,n){"use strict";n.r(e);var o=n(1),s=n(0),r=n.n(s),a=n(8),i=n.n(a),u=n(9),p=n.n(u),c=n(2),l=n(10),f=n.n(l),d=n(11),h=n.n(d),g=n(12),v=n.n(g),b=n(13),w=n.n(b),x=function(t){function e(){return t.apply(this,arguments)||this}Object(c.a)(e,t);var n=e.prototype;return n.init=function(){var t=this,e=app.data.settings;this.values={},this.settingsPrefix="flagrow.ads",this.positions=["under-header","between-posts","under-nav-items"],this.settings=["start-from-post","between-n-posts"],this.positions.forEach(function(n){return t.values[n]=m.prop(e[t.addPrefix(n)])}),this.settings.forEach(function(n){return t.values[n]=m.prop(e[t.addPrefix(n)])})},n.view=function(){var t=this;return[m("div",{className:"AdsPage"},[m("form",{onsubmit:this.onsubmit.bind(this)},m("fieldset",{className:"AdsPage-settings"},[m("legend",{},app.translator.trans("flagrow-ads.admin.settings.start-from-post")),m("input",{value:this.values["start-from-post"]()||1,className:"FormControl",oninput:m.withAttr("value",this.values["start-from-post"])})]),m("fieldset",{className:"AdsPage-settings"},[m("legend",{},app.translator.trans("flagrow-ads.admin.settings.between-n-posts")),m("input",{value:this.values["between-n-posts"]()||5,className:"FormControl",oninput:m.withAttr("value",this.values["between-n-posts"])})]),this.positions.map(function(e){return m("fieldset",{className:"AdsPage-"+e},[m("legend",{},app.translator.trans("flagrow-ads.admin.positions."+e+".title")),m("textarea",{value:t.values[e]()||null,className:"FormControl",placeholder:app.translator.trans("flagrow-ads.admin.positions."+e+".placeholder"),oninput:m.withAttr("value",t.values[e])})])}),h.a.component({type:"submit",className:"Button Button--primary",children:app.translator.trans("flagrow-ads.admin.buttons.save"),loading:this.loading,disabled:!this.changed()}))])]},n.changed=function(){var t=this,e=this.positions.some(function(e){return t.values[e]()!==app.data.settings[t.addPrefix(e)]}),n=this.settings.some(function(e){return t.values[e]()!==app.data.settings[t.addPrefix(e)]});return e||n},n.onsubmit=function(t){var e=this;if(t.preventDefault(),!this.loading){this.loading=!0,app.alerts.dismiss(this.successAlert);var n={};this.positions.forEach(function(t){return n[e.addPrefix(t)]=e.values[t]()}),this.settings.forEach(function(t){return n[e.addPrefix(t)]=e.values[t]()}),v()(n).then(function(){app.alerts.show(e.successAlert=new w.a({type:"success",children:app.translator.trans("core.admin.basics.saved_message")}))}).catch(function(){}).then(function(){e.loading=!1,m.redraw()})}},n.addPrefix=function(t){return this.settingsPrefix+"."+t},e}(f.a);r.a.initializers.add("flagrow-ads",function(){app.routes["flagrow-ads"]={path:"/flagrow/ads",component:x.component()},app.extensionSettings["flagrow-ads"]=function(){return m.route(app.route("flagrow-ads"))},Object(o.extend)(i.a.prototype,"items",function(t){t.add("flagrow-ads",p.a.component({href:app.route("flagrow-ads"),icon:"fas fa-audio-description",children:"Ads",description:app.translator.trans("flagrow-ads.admin.tab.description")}))})})}]);
//# sourceMappingURL=admin.js.map