MediaWiki:Gadget-libSettings.js

/* Unminified and untranspiled code at https://github.com/galobtter/libSettings - this obviously shouldn't be edited directly. */ !function(n){var o={};function i(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}i.m=n,i.c=o,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function{return t.default}:function{return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t){t.exports=JSON.parse('{"@metadata":{"author":"Galobtter"},"libSettings-settings-title":"Settings","libSettings-save-label":"Save settings","libSettings-cancel-label":"Cancel","libSettings-showDefaults-label":"Show defaults","libSettings-showCurrentSettings-label":"Show current settings","libSettings-save-success-message":"Settings for $1 successfully saved.","libSettings-save-fail-message":"Could not save settings for $1."}')},function(t,e,n){"use strict";function o(t){return(o="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 r(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function s(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super hasn't been called")}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}n.r(e);var i=function{function i(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=s(this,u(i).call(this))).name=t.name,e.defaultValue=t.defaultValue,e.label=t.label,e.type=t.type,e.UIconfig=t.UIconfig||{},e.help=t.help,e.hide=t.hide,e.helpInline=t.helpInline;var n=["libSettings-".concat(e.type,"Option")];if(e.UIconfig.classes=e.UIconfig.classes?e.UIconfig.classes.push(n):n,e.validInput=!0,e.propertyNameUI="value",void 0===e.name||void 0===e.defaultValue){var o=void 0===e.name?"name":"defaultValue";throw Error('[libSettings] "'.concat(o,'" of an Option is required to be defined but is not.'))}if(void 0===e.type)throw Error('[libSettings] "config.type" is required to be defined by classes that extend Option.');return e}var t,e,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(i,OO.EventEmitter),t=i,(e=[{key:"change",value:function{this.emit("change")}},{key:"buildUI",value:function{if(!this.hide)return this.hasUI=!0,this.UI(this[this.propertyNameUI])}},{key:"UI",value:function{return mw.log.error("Function UI not defined by extending class ".concat(this.type,"Option."))}},{key:"value",get:function{return void 0!==this.customValue?this.customValue:this.defaultValue},set:function(t){this.customValue=t}},{key:"customUIValue",get:function{var t;return(t=this.hasUI?this.UIvalue:this.value)!==this.defaultValue?t:void 0}},{key:"UIvalue",get:function{return mw.log.error("Getter UIvalue not defined by extending class ".concat(this.type,"Option."))}}])&&r(t.prototype,e),n&&r(t,n),i};function l(t){return(l="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 c(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function f(t,e){return!e||"object"!==l(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super hasn't been called")}(t):e}function p(t,e,n){return(p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var b=function{return function{function i(t,e,n){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(o=f(this,h(i).call(this,t))).optionsConfig=e,o.height=n,o}var t,e,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)}(i,OO.ui.ProcessDialog),t=i,(e=[{key:"setPropertyNameUI",value:function(e){this.optionsConfig.traverse(function(t){t.propertyNameUI=e})}},{key:"genInternalUI",value:function{var t,e=this.optionsConfig.getConfig,n=1===e.filter(function(t){return!t.hide}).length,o=e.map(function(t){return t.buildUI(n)});return o.filter(function(t){return t}),n?t=o[0]:(t=new OO.ui.BookletLayout({outlined:!0})).addPages(o),t}},{key:"setupUI",value:function{this.content=this.genInternalUI,this.$body.html(this.content.$element),this.changeHandler}},{key:"changeHandler",value:function{var n=!0,o=!1,i=!1;this.optionsConfig.traverse(function(t){if(t.hasUI){t.validInput||(n=!1);var e=t.UIvalue;e!==t.value&&(o=!0),e!==t.defaultValue&&(i=!0)}}),this.actions.setAbilities({save:n&&o,showDefault:i,showCurrentSettings:o})}},{key:"regenUI",value:function{var t;this.content.getCurrentPageName&&(t=this.content.getCurrentPageName),this.setupUI,t&&this.content.setPage(t)}},{key:"getSetupProcess",value:function{var t=this,e=p(h(i.prototype),"getSetupProcess",this).call(this);return e.next(function{return t.setupUI}),e}},{key:"getActionProcess",value:function(t){var e=this;return"save"===t?new OO.ui.Process(function{e.emit("startSave"),e.actions.setAbilities({save:!1,showDefault:!1,showCurrentSettings:!1,cancel:!1}),e.pushPending}):("cancel"===t&&this.close,"showDefault"===t?new OO.ui.Process(function{e.setPropertyNameUI("defaultValue"),e.regenUI}):"showCurrentSettings"===t?new OO.ui.Process(function{e.setPropertyNameUI("value"),e.regenUI}):p(h(i.prototype),"getActionProcess",this).call(this,t))}},{key:"getBodyHeight",value:function{return this.height||1*this.content.$element.outerWidth(!0)/1.61803398875}}])&&c(t.prototype,e),n&&c(t,n),i}};function g(t){return(g="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 v(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function m(t,e){return!e||"object"!==g(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super hasn't been called")}(t):e}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function w(t,e){return(w=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var O=function{function n(e){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(t=m(this,d(n).call(this))).optionsConfig=e.optionsConfig,t.scriptName=e.scriptName,t.optionName="userjs-".concat(e.optionName||e.scriptName),t.size=e.size,t.title=e.title||mw.msg("libSettings-settings-title"),t.useUserOptions=void 0===e.useUserOptions||e.useUserOptions,t.notifyUponSave=void 0===e.notifyUponSave||e.notifyUponSave,t.reloadUponSave=void 0===e.reloadUponSave||e.reloadUponSave,t.userOptions=e.userOptions||{},t.optionsConfig.traverse(function(t){void 0===t.helpInline&&(t.helpInline=e.helpInline)}),t.height=e.height,t.saveLabel=e.saveLabel||mw.msg("libSettings-save-label"),t.cancelLabel=e.cancelLabel||mw.msg("libSettings-cancel-label"),t.showDefaultsLabel=e.showDefaultsLabel||mw.msg("libSettings-showDefaults-label"),t.showCurrentSettingsLabel=e.showCurrentSettingsLabel||mw.msg("libSettings-showCurrentSettings-label"),t.saveMessage=mw.msg("libSettings-save-success-message",t.scriptName),t.saveFailMessage=mw.msg("libSettings-save-fail-message",t.scriptName),t}var t,e,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&w(t,e)}(n,OO.EventEmitter),t=n,(e=[{key:"load",value:function{this.optionsText=mw.user.options.get(this.optionName),this.userOptions=JSON.parse(this.optionsText)||{}}},{key:"get",value:function{return this.options||(this.useUserOptions&&this.load,this.optionsConfig.updateProperty("value",this.userOptions),this.options=this.optionsConfig.retrieveProperty("value")),this.options}},{key:"notifySave",value:function(t){this.notifyUponSave&&(t?(mw.notify(this.saveMessage),this.reloadUponSave&&window.location.reload):mw.notify(this.saveFailMessage,{autoHide:!1}))}},{key:"save",value:function{var t=this;return this.newUserOptions=this.optionsConfig.retrieveProperty("customUIValue"),this.useUserOptions?(this.API=new mw.Api({ajax:{headers:{"Api-User-Agent":"Script ".concat(this.scriptName," using libSettings (w:en:MediaWiki:Gadget-libSettings.js).")}}}),this.API.saveOption(this.optionName,JSON.stringify(this.newUserOptions)).then(function{return t.notifySave(!0)},function{return t.notifySave(!1)}).always(function{t.emit("endSave")})):this.newUserOptions}},{key:"displayMain",value:function{var e=this;if(!this.windowManager){var t=b;t.static.name="settingsDialog",t.static.title=this.title,t.static.actions=[{action:"save",label:this.saveLabel,flags:["primary","progressive"]},{action:"cancel",label:this.cancelLabel,flags:["safe","destructive"]},{action:"showDefault",label:this.showDefaultsLabel}],0<Object.keys(this.userOptions).length&&t.static.actions.push({action:"showCurrentSettings",label:this.showCurrentSettingsLabel}),this.settingsDialog=new t({size:this.size,classes:["libSettings-SettingsDialog"]},this.optionsConfig,this.height),this.settingsDialog.connect(this,{startSave:"save"}),this.connect(this.settingsDialog,{endSave:"close"}),this.optionsConfig.traverse(function(t){t.connect(e.settingsDialog,{change:"changeHandler"})}),this.windowManager=new OO.ui.WindowManager,document.body.appendChild(this.windowManager.$element[0]),this.windowManager.addWindows([this.settingsDialog]),this.windowManager.on("closing",function{})}return this.windowManager.openWindow(this.settingsDialog),this.windowManager}},{key:"display",value:function{var t=this;return this.get,mw.loader.using(["oojs-ui-core","oojs-ui-widgets","oojs-ui-windows"]).then(function{return t.displayMain})}}])&&v(t.prototype,e),o&&v(t,o),n};function S(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var I=function{function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.config=t,this.options=this.depthCopyTraverse}var t,n,o;return t=e,(n=[{key:"depthCopyTraverse",value:function{function e(t){n[t.name]=t}var n={};return this.config.forEach(function(t){t.traverse(e)}),n}},{key:"getConfig",value:function{return this.config}},{key:"traverse",value:function(t){for(var e in this.options)t(this.options[e])}},{key:"retrieveProperty",value:function(t){var e={};for(var n in this.options){var o=this.options[n];e[n]=o[t]}return e}},{key:"updateProperty",value:function(t,e){for(var n in e){var o=e[n],i=this.options[n];i&&(i[t]=o)}}}])&&S(t.prototype,n),o&&S(t,o),e};function U(t){return(U="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 j(t,e){return!e||"object"!==U(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super hasn't been called")}(t):e}function P(t){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _(t,e){return(_=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function C(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function E(t,e,n){return e&&C(t.prototype,e),n&&C(t,n),t}var x=function{function e(t){k(this,e),this.title=t.title,this.level=t.level,this.hide=t.hide,this.preferences=t.preferences,this.UIconfig=t.UIconfig||{}}return E(e,[{key:"traverse",value:function(e){this.preferences.forEach(function(t){"traverse"in Object.getPrototypeOf(t)?t.traverse(function(t){return e(t)}):e(t)})}},{key:"buildUI",value:function(t){if(!this.hide)return this.hasUI=!0,this.UI(t)}},{key:"UI",value:function(t){this.UIconfig.padded=t,this.UIconfig.scrollable=!1;var e=this;return new(function{function t{var n;return k(this,t),n=j(this,P(t).call(this,e.title,e.UIconfig)),e.preferences.forEach(function(t){var e=t.buildUI;e&&n.$element.append(e.$element)}),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_(t,e)}(t,OO.ui.PageLayout),E(t,[{key:"setupOutlineItem",value:function{this.outlineItem.setLabel(e.title),this.outlineItem.setLevel(e.level)}}]),t})}}]),e};function T(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var N=function{function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.header=t.header,this.hide=t.hide,this.options=t.options,this.UIconfig=t.UIconfig||{}}var t,n,o;return t=e,(n=[{key:"traverse",value:function(e){this.options.forEach(function(t){e(t)})}},{key:"buildUI",value:function{if(!this.hide)return this.hasUI=!0,this.UI}},{key:"UI",value:function{this.UIconfig.label=this.header;var t=new OO.ui.FieldsetLayout(this.UIconfig),e=this.options.map(function(t){return t.buildUI});return e=e.filter(function(t){return t}),t.addItems(e),t}}])&&T(t.prototype,n),o&&T(t,o),e};function D(t){return(D="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 L(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function M(t,e){return!e||"object"!==D(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super hasn't been called")}(t):e}function V(t){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function R(t,e){return(R=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var A=function{function e(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t.type="Checkbox",M(this,V(e).call(this,t))}var t,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&R(t,e)}(e,i),t=e,(n=[{key:"UI",value:function(t){return this.UIconfig.name=this.name,this.UIconfig.selected=t,this.UIelement=new OO.ui.CheckboxInputWidget(this.UIconfig),this.UIelement.connect(this,{change:"change"}),new OO.ui.FieldLayout(this.UIelement,{help:this.help,label:this.label,helpInline:this.helpInline,align:"inline"})}},{key:"UIvalue",get:function{return this.UIelement.isSelected}}])&&L(t.prototype,n),o&&L(t,o),e};function W(t){return(W="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 $(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function F(t,e){return!e||"object"!==W(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super hasn't been called")}(t):e}function H(t){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function z(t,e){return(z=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var G=function{function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),t.type=t.type||"Text",(e=F(this,H(n).call(this,t))).widget="TextInputWidget",e}var t,e,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&z(t,e)}(n,i),t=n,(e=[{key:"validate",value:function{var t=this;return this.UIelement.getValidity.then(function{t.validInput=!0},function{t.validInput=!1})}},{key:"UI",value:function(t){var e=this;return this.UIconfig.name=this.name,this.UIconfig.value=t,this.UIelement=new OO.ui[this.widget](this.UIconfig),this.UIelement.connect(this,{change:function{e.validate.then(function{return e.change})}}),this.validate,new OO.ui.FieldLayout(this.UIelement,{text:this.label,help:this.help,helpInline:this.helpInline,align:"top"})}},{key:"UIvalue",get:function{return this.UIelement.getValue}}])&&$(t.prototype,e),o&&$(t,o),n};function J(t){return(J="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 q(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function B(t,e){return!e||"object"!==J(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super hasn't been called")}(t):e}function K(t,e,n){return(K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Q(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Q(t){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function X(t,e){return(X=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var Y=function{function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),t.type="Number",(e=B(this,Q(n).call(this,t))).widget="NumberInputWidget",e}var t,e,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&X(t,e)}(n,G),t=n,(e=[{key:"UIvalue",get:function{return Number(K(Q(n.prototype),"UIvalue",this))}}])&&q(t.prototype,e),o&&q(t,o),n};function Z(t){return(Z="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 tt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function et(t,e){return!e||"object"!==Z(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super hasn't been called")}(t):e}function nt(t){return(nt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ot(t,e){return(ot=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var it=function{function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),t.type="Dropdown",(e=et(this,nt(n).call(this,t))).values=t.values,e}var t,e,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ot(t,e)}(n,i),t=n,(e=[{key:"UI",value:function(n){var o=this;return this.UIconfig.name=this.name,this.UIconfig.options=this.values,this.UIconfig.options.some(function(t,e){if(t.data===n)return o.UIconfig.options.unshift(o.UIconfig.options.splice(e,1)[0]),!0}),this.UIelement=new OO.ui.DropdownInputWidget(this.UIconfig),this.UIelement.connect(this,{change:"change"}),new OO.ui.FieldLayout(this.UIelement,{text:this.label,help:this.help,helpInline:this.helpInline,align:"top"})}},{key:"UIvalue",get:function{return this.UIelement.getValue}}])&&tt(t.prototype,e),o&&tt(t,o),n};mw.libs.libSettings={},mw.libs.libSettings.Option=i,mw.libs.libSettings.Settings=O,mw.libs.libSettings.OptionsConfig=I,mw.libs.libSettings.Page=x,mw.libs.libSettings.Group=N,mw.libs.libSettings.CheckboxOption=A,mw.libs.libSettings.TextOption=G,mw.libs.libSettings.NumberOption=Y,mw.libs.libSettings.DropdownOption=it;var rt=n(0);mw.messages.set(rt),mw.util.addCSS(".libSettings-NumberOption {\n\tmax-width: 15em\n}")}]);