MediaWiki:Gadget-ondemand-criteriaCheck.js (MediaWiki&Gadget-ondemand-criteriaCheckQjs)
Перейти к навигации
Перейти к поиску
JS-код ниже относится к скрытому гаджету «Автоматическая проверка соответствия критериям на выборах, в голосованиях, при присвоении флагов и в иных случаях» (править описание). Он вызывается по умолчанию на страницах в категории Википедия:Страницы с гаджетом по требованию criteriaCheck.
После сохранения или недавних изменений очистите кэш браузера.
// См. https://ru.wikipedia.org/wiki/Википедия:Глобальный_код/Автоматическая_проверка_соответствия_критериям
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 15);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(7);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
module.exports = _asyncToGenerator;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
var arrayWithoutHoles = __webpack_require__(12);
var iterableToArray = __webpack_require__(13);
var nonIterableSpread = __webpack_require__(14);
function _toConsumableArray(arr) {
return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
}
module.exports = _toConsumableArray;
/***/ }),
/* 3 */,
/* 4 */
/***/ (function(module, exports) {
function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
function _typeof(obj) {
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
module.exports = _typeof = function _typeof(obj) {
return _typeof2(obj);
};
} else {
module.exports = _typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
};
}
return _typeof(obj);
}
module.exports = _typeof;
/***/ }),
/* 5 */
/***/ (function(module, exports) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
module.exports = _classCallCheck;
/***/ }),
/* 6 */
/***/ (function(module, exports) {
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
module.exports = _createClass;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var runtime = (function (exports) {
"use strict";
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined; // More compressible than void 0.
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []);
// The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
}
exports.wrap = wrap;
// Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
return { type: "normal", arg: fn.call(obj, arg) };
} catch (err) {
return { type: "throw", arg: err };
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
// Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {};
// Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
// This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = {};
IteratorPrototype[iteratorSymbol] = function () {
return this;
};
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype &&
NativeIteratorPrototype !== Op &&
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype =
Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunctionPrototype[toStringTagSymbol] =
GeneratorFunction.displayName = "GeneratorFunction";
// Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
prototype[method] = function(arg) {
return this._invoke(method, arg);
};
});
}
exports.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor
? ctor === GeneratorFunction ||
// For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction"
: false;
};
exports.mark = function(genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
if (!(toStringTagSymbol in genFun)) {
genFun[toStringTagSymbol] = "GeneratorFunction";
}
}
genFun.prototype = Object.create(Gp);
return genFun;
};
// Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
exports.awrap = function(arg) {
return { __await: arg };
};
function AsyncIterator(generator) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value = result.value;
if (value &&
typeof value === "object" &&
hasOwn.call(value, "__await")) {
return Promise.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
});
}
return Promise.resolve(value).then(function(unwrapped) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration.
result.value = unwrapped;
resolve(result);
}, function(error) {
// If a rejected Promise was yielded, throw the rejection back
// into the async generator function so it can be handled there.
return invoke("throw", error, resolve, reject);
});
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new Promise(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise =
// If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise.then(
callInvokeWithMethodAndArg,
// Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg
) : callInvokeWithMethodAndArg();
}
// Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
return this;
};
exports.AsyncIterator = AsyncIterator;
// Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
exports.async = function(innerFn, outerFn, self, tryLocsList) {
var iter = new AsyncIterator(
wrap(innerFn, outerFn, self, tryLocsList)
);
return exports.isGeneratorFunction(outerFn)
? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
}
// Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if (context.method === "next") {
// Setting context._sent for legacy support of Babel's
// function.sent implementation.
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done
? GenStateCompleted
: GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted;
// Dispatch the exception by looping back around to the
// context.dispatchException(context.arg) call above.
context.method = "throw";
context.arg = record.arg;
}
}
};
}
// Call delegate.iterator[context.method](context.arg) and handle the
// result, either by returning a { value, done } result from the
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
context.delegate = null;
if (context.method === "throw") {
// Note: ["return"] must be used for ES3 parsing compatibility.
if (delegate.iterator["return"]) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
return ContinueSentinel;
}
}
context.method = "throw";
context.arg = new TypeError(
"The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (! info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
// Assign the result of the finished delegate to the temporary
// variable specified by delegate.resultName (see delegateYield).
context[delegate.resultName] = info.value;
// Resume execution at the desired location (see delegateYield).
context.next = delegate.nextLoc;
// If context.method was "throw" but the delegate handled the
// exception, let the outer generator proceed normally. If
// context.method was "next", forget context.arg since it has been
// "consumed" by the delegate iterator. If context.method was
// "return", allow the original .return call to continue in the
// outer generator.
if (context.method !== "return") {
context.method = "next";
context.arg = undefined;
}
} else {
// Re-yield the result returned by the delegate method.
return info;
}
// The delegate iterator is finished, so forget it and continue with
// the outer generator.
context.delegate = null;
return ContinueSentinel;
}
// Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods(Gp);
Gp[toStringTagSymbol] = "Generator";
// A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
Gp[iteratorSymbol] = function() {
return this;
};
Gp.toString = function() {
return "[object Generator]";
};
function pushTryEntry(locs) {
var entry = { tryLoc: locs[0] };
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
function Context(tryLocsList) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
// Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
}
// To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1, next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined;
next.done = true;
return next;
};
return next.next = next;
}
}
// Return an iterator with no values.
return { next: doneResult };
}
exports.values = values;
function doneResult() {
return { value: undefined, done: true };
}
Context.prototype = {
constructor: Context,
reset: function(skipTempReset) {
this.prev = 0;
this.next = 0;
// Resetting context._sent for legacy support of Babel's
// function.sent implementation.
this.sent = this._sent = undefined;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
// Not sure about the optimal order of these conditions:
if (name.charAt(0) === "t" &&
hasOwn.call(this, name) &&
!isNaN(+name.slice(1))) {
this[name] = undefined;
}
}
}
},
stop: function() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
context.method = "next";
context.arg = undefined;
}
return !! caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev &&
hasOwn.call(entry, "finallyLoc") &&
this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry &&
(type === "break" ||
type === "continue") &&
finallyEntry.tryLoc <= arg &&
arg <= finallyEntry.finallyLoc) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" ||
record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
}
},
"catch": function(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
// The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error("illegal catch attempt");
},
delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
if (this.method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
this.arg = undefined;
}
return ContinueSentinel;
}
};
// Regardless of whether this script is executing as a CommonJS module
// or not, return the runtime object so that we can declare the variable
// regeneratorRuntime in the outer scope, which allows this module to be
// injected easily by `bin/regenerator --include-runtime script.js`.
return exports;
}(
// If this script is executing as a CommonJS module, use module.exports
// as the regeneratorRuntime namespace. Otherwise create a new empty
// object. Either way, the resulting object will be used to initialize
// the regeneratorRuntime variable at the top of this file.
true ? module.exports : undefined
));
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
// This module should not be running in strict mode, so the above
// assignment should always work unless something is misconfigured. Just
// in case runtime.js accidentally runs in strict mode, we can escape
// strict mode using a global Function call. This could conceivably fail
// if a Content Security Policy forbids using Function, but in that case
// the proper solution is to fix the accidental strict mode problem. If
// you've misconfigured your bundler to force strict mode and applied a
// CSP to forbid Function, and you're not willing to fix either of those
// problems, please detail your unique predicament in a GitHub issue.
Function("r", "regeneratorRuntime = r")(runtime);
}
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(9);
if (typeof content === 'string') {
content = [[module.i, content, '']];
}
var options = {}
options.insert = "head";
options.singleton = false;
var update = __webpack_require__(11)(content, options);
if (content.locals) {
module.exports = content.locals;
}
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// Module
exports.push([module.i, ".criteriaCheck-message-withText {\r\n display: flex;\r\n}\r\n\r\n.criteriaCheck-message-accented {\r\n font-weight: bold;\r\n}\r\n\r\n.criteriaCheck-message-big {\r\n font-weight: normal;\r\n margin: 0.5em 0;\r\n}\r\n\r\n.criteriaCheck-message-big + .criteriaCheck-message-big {\r\n margin-top: -0.25em;\r\n}\r\n\r\n.criteriaCheck-message-big {\r\n font-size: 120%;\r\n}\r\n\r\n.criteriaCheck-buttonsBlock {\r\n margin: 0.5em 0;\r\n}\r\n\r\n.criteriaCheck-button {\r\n margin-right: 0.5em;\r\n}\r\n\r\n.criteriaCheck-icon {\r\n display: inline-block;\r\n width: 20px;\r\n height: 20px;\r\n background-position: center center;\r\n background-size: 20px 20px;\r\n background-repeat: no-repeat;\r\n margin-right: 0.5em;\r\n vertical-align: top;\r\n}\r\n\r\n.criteriaCheck-message-withText .criteriaCheck-icon {\r\n flex-shrink: 0;\r\n}\r\n\r\n.criteriaCheck-icon + .criteriaCheck-icon {\r\n margin-left: -0.5em;\r\n}\r\n\r\n.criteriaCheck-message-big .criteriaCheck-icon {\r\n width: 24px;\r\n height: 24px;\r\n background-size: 24px 24px;\r\n}\r\n\r\n.criteriaCheck-icon-check {\r\n background-image: url(\"https://upload.wikimedia.org/wikipedia/commons/f/f6/OOjs_UI_icon_check-constructive.svg\");\r\n}\r\n\r\n.criteriaCheck-icon-close {\r\n background-image: url(\"https://upload.wikimedia.org/wikipedia/commons/7/77/OOjs_UI_icon_close-ltr-destructive.svg\");\r\n}\r\n\r\n.criteriaCheck-icon-help {\r\n background-image: url(\"https://upload.wikimedia.org/wikipedia/commons/b/b2/OOjs_UI_icon_help-ltr.svg\");\r\n}\r\n\r\n.criteriaCheck-icon-error {\r\n background-image: url(\"https://upload.wikimedia.org/wikipedia/commons/4/4e/OOjs_UI_icon_error-destructive.svg\");\r\n}\r\n\r\n.criteriaCheck-icon-loading {\r\n background-image: url(\"https://upload.wikimedia.org/wikipedia/commons/d/de/Ajax-loader.gif\");\r\n}\r\n\r\n.criteriaCheck-icon-warning {\r\n background-image: url(\"https://upload.wikimedia.org/wikipedia/commons/3/3b/OOjs_UI_icon_alert-warning.svg\");\r\n}\r\n\r\n.criteriaCheck-sandbox {\r\n display: none;\r\n}", ""]);
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
// eslint-disable-next-line func-names
module.exports = function (useSourceMap) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if (item[2]) {
return "@media ".concat(item[2], "{").concat(content, "}");
}
return content;
}).join('');
}; // import a list of modules into the list
// eslint-disable-next-line func-names
list.i = function (modules, mediaQuery) {
if (typeof modules === 'string') {
// eslint-disable-next-line no-param-reassign
modules = [[null, modules, '']];
}
var alreadyImportedModules = {};
for (var i = 0; i < this.length; i++) {
// eslint-disable-next-line prefer-destructuring
var id = this[i][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
for (var _i = 0; _i < modules.length; _i++) {
var item = modules[_i]; // skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if (item[0] == null || !alreadyImportedModules[item[0]]) {
if (mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if (mediaQuery) {
item[2] = "(".concat(item[2], ") and (").concat(mediaQuery, ")");
}
list.push(item);
}
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return "/*# sourceURL=".concat(cssMapping.sourceRoot).concat(source, " */");
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
} // Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
return "/*# ".concat(data, " */");
}
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var stylesInDom = {};
var isOldIE = function isOldIE() {
var memo;
return function memorize() {
if (typeof memo === 'undefined') {
// Test for IE <= 9 as proposed by Browserhacks
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
// Tests for existence of standard globals is to allow style-loader
// to operate correctly into non-standard environments
// @see https://github.com/webpack-contrib/style-loader/issues/177
memo = Boolean(window && document && document.all && !window.atob);
}
return memo;
};
}();
var getTarget = function getTarget() {
var memo = {};
return function memorize(target) {
if (typeof memo[target] === 'undefined') {
var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
try {
// This will throw an exception if access to iframe is blocked
// due to cross-origin restrictions
styleTarget = styleTarget.contentDocument.head;
} catch (e) {
// istanbul ignore next
styleTarget = null;
}
}
memo[target] = styleTarget;
}
return memo[target];
};
}();
function listToStyles(list, options) {
var styles = [];
var newStyles = {};
for (var i = 0; i < list.length; i++) {
var item = list[i];
var id = options.base ? item[0] + options.base : item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {
css: css,
media: media,
sourceMap: sourceMap
};
if (!newStyles[id]) {
styles.push(newStyles[id] = {
id: id,
parts: [part]
});
} else {
newStyles[id].parts.push(part);
}
}
return styles;
}
function addStylesToDom(styles, options) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
var j = 0;
if (domStyle) {
domStyle.refs++;
for (; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for (; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {
id: item.id,
refs: 1,
parts: parts
};
}
}
}
function insertStyleElement(options) {
var style = document.createElement('style');
if (typeof options.attributes.nonce === 'undefined') {
var nonce = true ? __webpack_require__.nc : undefined;
if (nonce) {
options.attributes.nonce = nonce;
}
}
Object.keys(options.attributes).forEach(function (key) {
style.setAttribute(key, options.attributes[key]);
});
if (typeof options.insert === 'function') {
options.insert(style);
} else {
var target = getTarget(options.insert || 'head');
if (!target) {
throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
}
target.appendChild(style);
}
return style;
}
function removeStyleElement(style) {
// istanbul ignore if
if (style.parentNode === null) {
return false;
}
style.parentNode.removeChild(style);
}
/* istanbul ignore next */
var replaceText = function replaceText() {
var textStore = [];
return function replace(index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
}();
function applyToSingletonTag(style, index, remove, obj) {
var css = remove ? '' : obj.css; // For old IE
/* istanbul ignore if */
if (style.styleSheet) {
style.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = style.childNodes;
if (childNodes[index]) {
style.removeChild(childNodes[index]);
}
if (childNodes.length) {
style.insertBefore(cssNode, childNodes[index]);
} else {
style.appendChild(cssNode);
}
}
}
function applyToTag(style, options, obj) {
var css = obj.css;
var media = obj.media;
var sourceMap = obj.sourceMap;
if (media) {
style.setAttribute('media', media);
}
if (sourceMap && btoa) {
css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
} // For old IE
/* istanbul ignore if */
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
while (style.firstChild) {
style.removeChild(style.firstChild);
}
style.appendChild(document.createTextNode(css));
}
}
var singleton = null;
var singletonCounter = 0;
function addStyle(obj, options) {
var style;
var update;
var remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
style = singleton || (singleton = insertStyleElement(options));
update = applyToSingletonTag.bind(null, style, styleIndex, false);
remove = applyToSingletonTag.bind(null, style, styleIndex, true);
} else {
style = insertStyleElement(options);
update = applyToTag.bind(null, style, options);
remove = function remove() {
removeStyleElement(style);
};
}
update(obj);
return function updateStyle(newObj) {
if (newObj) {
if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {
return;
}
update(obj = newObj);
} else {
remove();
}
};
}
module.exports = function (list, options) {
options = options || {};
options.attributes = typeof options.attributes === 'object' ? options.attributes : {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (!options.singleton && typeof options.singleton !== 'boolean') {
options.singleton = isOldIE();
}
var styles = listToStyles(list, options);
addStylesToDom(styles, options);
return function update(newList) {
var mayRemove = [];
for (var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if (domStyle) {
domStyle.refs--;
mayRemove.push(domStyle);
}
}
if (newList) {
var newStyles = listToStyles(newList, options);
addStylesToDom(newStyles, options);
}
for (var _i = 0; _i < mayRemove.length; _i++) {
var _domStyle = mayRemove[_i];
if (_domStyle.refs === 0) {
for (var j = 0; j < _domStyle.parts.length; j++) {
_domStyle.parts[j]();
}
delete stylesInDom[_domStyle.id];
}
}
};
};
/***/ }),
/* 12 */
/***/ (function(module, exports) {
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
module.exports = _arrayWithoutHoles;
/***/ }),
/* 13 */
/***/ (function(module, exports) {
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
module.exports = _iterableToArray;
/***/ }),
/* 14 */
/***/ (function(module, exports) {
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
module.exports = _nonIterableSpread;
/***/ }),
/* 15 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
var regenerator = __webpack_require__(0);
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(1);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./src/style.css
var style = __webpack_require__(8);
// CONCATENATED MODULE: ./src/cc.js
window.criteriaCheck = {};
/* harmony default export */ var cc = (window.criteriaCheck);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(2);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/typeof.js
var helpers_typeof = __webpack_require__(4);
var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_typeof);
// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/toInteger/index.js
function toInteger(dirtyNumber) {
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
return NaN;
}
var number = Number(dirtyNumber);
if (isNaN(number)) {
return number;
}
return number < 0 ? Math.ceil(number) : Math.floor(number);
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/toDate/index.js
/**
* @name toDate
* @category Common Helpers
* @summary Convert the given argument to an instance of Date.
*
* @description
* Convert the given argument to an instance of Date.
*
* If the argument is an instance of Date, the function returns its clone.
*
* If the argument is a number, it is treated as a timestamp.
*
* If the argument is none of the above, the function returns Invalid Date.
*
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
*
* @param {Date|Number} argument - the value to convert
* @returns {Date} the parsed date in the local time zone
* @throws {TypeError} 1 argument required
*
* @example
* // Clone the date:
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Convert the timestamp to date:
* const result = toDate(1392098430000)
* //=> Tue Feb 11 2014 11:30:30
*/
function toDate(argument) {
if (arguments.length < 1) {
throw new TypeError('1 argument required, but only ' + arguments.length + ' present');
}
var argStr = Object.prototype.toString.call(argument); // Clone the date
if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
return new Date(argument.getTime());
} else if (typeof argument === 'number' || argStr === '[object Number]') {
return new Date(argument);
} else {
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
// eslint-disable-next-line no-console
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
console.warn(new Error().stack);
}
return new Date(NaN);
}
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/addDays/index.js
/**
* @name addDays
* @category Day Helpers
* @summary Add the specified number of days to the given date.
*
* @description
* Add the specified number of days to the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of days to be added
* @returns {Date} the new date with the days added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 10 days to 1 September 2014:
* var result = addDays(new Date(2014, 8, 1), 10)
* //=> Thu Sep 11 2014 00:00:00
*/
function addDays(dirtyDate, dirtyAmount) {
if (arguments.length < 2) {
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
}
var date = toDate(dirtyDate);
var amount = toInteger(dirtyAmount);
date.setDate(date.getDate() + amount);
return date;
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/subDays/index.js
/**
* @name subDays
* @category Day Helpers
* @summary Subtract the specified number of days from the given date.
*
* @description
* Subtract the specified number of days from the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of days to be subtracted
* @returns {Date} the new date with the days subtracted
* @throws {TypeError} 2 arguments required
*
* @example
* // Subtract 10 days from 1 September 2014:
* var result = subDays(new Date(2014, 8, 1), 10)
* //=> Fri Aug 22 2014 00:00:00
*/
function subDays(dirtyDate, dirtyAmount) {
if (arguments.length < 2) {
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
}
var amount = toInteger(dirtyAmount);
return addDays(dirtyDate, -amount);
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/getDaysInMonth/index.js
/**
* @name getDaysInMonth
* @category Month Helpers
* @summary Get the number of days in a month of the given date.
*
* @description
* Get the number of days in a month of the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the given date
* @returns {Number} the number of days in a month
* @throws {TypeError} 1 argument required
*
* @example
* // How many days are in February 2000?
* var result = getDaysInMonth(new Date(2000, 1))
* //=> 29
*/
function getDaysInMonth(dirtyDate) {
if (arguments.length < 1) {
throw new TypeError('1 argument required, but only ' + arguments.length + ' present');
}
var date = toDate(dirtyDate);
var year = date.getFullYear();
var monthIndex = date.getMonth();
var lastDayOfMonth = new Date(0);
lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
lastDayOfMonth.setHours(0, 0, 0, 0);
return lastDayOfMonth.getDate();
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/addMonths/index.js
/**
* @name addMonths
* @category Month Helpers
* @summary Add the specified number of months to the given date.
*
* @description
* Add the specified number of months to the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be added
* @returns {Date} the new date with the months added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 5 months to 1 September 2014:
* var result = addMonths(new Date(2014, 8, 1), 5)
* //=> Sun Feb 01 2015 00:00:00
*/
function addMonths(dirtyDate, dirtyAmount) {
if (arguments.length < 2) {
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
}
var date = toDate(dirtyDate);
var amount = toInteger(dirtyAmount);
var desiredMonth = date.getMonth() + amount;
var dateWithDesiredMonth = new Date(0);
dateWithDesiredMonth.setFullYear(date.getFullYear(), desiredMonth, 1);
dateWithDesiredMonth.setHours(0, 0, 0, 0);
var daysInMonth = getDaysInMonth(dateWithDesiredMonth); // Set the last day of the new month
// if the original date was the last day of the longer month
date.setMonth(desiredMonth, Math.min(daysInMonth, date.getDate()));
return date;
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/subMonths/index.js
/**
* @name subMonths
* @category Month Helpers
* @summary Subtract the specified number of months from the given date.
*
* @description
* Subtract the specified number of months from the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be subtracted
* @returns {Date} the new date with the months subtracted
* @throws {TypeError} 2 arguments required
*
* @example
* // Subtract 5 months from 1 February 2015:
* var result = subMonths(new Date(2015, 1, 1), 5)
* //=> Mon Sep 01 2014 00:00:00
*/
function subMonths(dirtyDate, dirtyAmount) {
if (arguments.length < 2) {
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
}
var amount = toInteger(dirtyAmount);
return addMonths(dirtyDate, -amount);
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/addYears/index.js
/**
* @name addYears
* @category Year Helpers
* @summary Add the specified number of years to the given date.
*
* @description
* Add the specified number of years to the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of years to be added
* @returns {Date} the new date with the years added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 5 years to 1 September 2014:
* var result = addYears(new Date(2014, 8, 1), 5)
* //=> Sun Sep 01 2019 00:00:00
*/
function addYears(dirtyDate, dirtyAmount) {
if (arguments.length < 2) {
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
}
var amount = toInteger(dirtyAmount);
return addMonths(dirtyDate, amount * 12);
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/subYears/index.js
/**
* @name subYears
* @category Year Helpers
* @summary Subtract the specified number of years from the given date.
*
* @description
* Subtract the specified number of years from the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of years to be subtracted
* @returns {Date} the new date with the years subtracted
* @throws {TypeError} 2 arguments required
*
* @example
* // Subtract 5 years from 1 September 2014:
* var result = subYears(new Date(2014, 8, 1), 5)
* //=> Tue Sep 01 2009 00:00:00
*/
function subYears(dirtyDate, dirtyAmount) {
if (arguments.length < 2) {
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
}
var amount = toInteger(dirtyAmount);
return addYears(dirtyDate, -amount);
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/addMilliseconds/index.js
/**
* @name addMilliseconds
* @category Millisecond Helpers
* @summary Add the specified number of milliseconds to the given date.
*
* @description
* Add the specified number of milliseconds to the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of milliseconds to be added
* @returns {Date} the new date with the milliseconds added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
* var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
* //=> Thu Jul 10 2014 12:45:30.750
*/
function addMilliseconds(dirtyDate, dirtyAmount) {
if (arguments.length < 2) {
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
}
var timestamp = toDate(dirtyDate).getTime();
var amount = toInteger(dirtyAmount);
return new Date(timestamp + amount);
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/addSeconds/index.js
/**
* @name addSeconds
* @category Second Helpers
* @summary Add the specified number of seconds to the given date.
*
* @description
* Add the specified number of seconds to the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of seconds to be added
* @returns {Date} the new date with the seconds added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 30 seconds to 10 July 2014 12:45:00:
* var result = addSeconds(new Date(2014, 6, 10, 12, 45, 0), 30)
* //=> Thu Jul 10 2014 12:45:30
*/
function addSeconds(dirtyDate, dirtyAmount) {
if (arguments.length < 2) {
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
}
var amount = toInteger(dirtyAmount);
return addMilliseconds(dirtyDate, amount * 1000);
}
// CONCATENATED MODULE: ./node_modules/date-fns/esm/subSeconds/index.js
/**
* @name subSeconds
* @category Second Helpers
* @summary Subtract the specified number of seconds from the given date.
*
* @description
* Subtract the specified number of seconds from the given date.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of seconds to be subtracted
* @returns {Date} the new date with the seconds subtracted
* @throws {TypeError} 2 arguments required
*
* @example
* // Subtract 30 seconds from 10 July 2014 12:45:00:
* var result = subSeconds(new Date(2014, 6, 10, 12, 45, 0), 30)
* //=> Thu Jul 10 2014 12:44:30
*/
function subSeconds(dirtyDate, dirtyAmount) {
if (arguments.length < 2) {
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
}
var amount = toInteger(dirtyAmount);
return addSeconds(dirtyDate, -amount);
}
// CONCATENATED MODULE: ./src/util.js
// Чтобы сделать возможным автоматическую генерации кода вызова этих функций без использования eval
// (см. https://stackoverflow.com/questions/9464921/dynamically-call-local-function-in-javascript)
var dateFns = {
subDays: subDays,
subMonths: subMonths,
subYears: subYears
};
var captureUserRegexp = /(?:Участник:|Участница:|Обсуждение_участника:|Обсуждение_участницы:|Служебная:Вклад\/)([^#\/]+)/;
/* harmony default export */ var util = ({
prepareDate: function prepareDate(date, isPeriodEnd) {
if (!date) return;
var addOneDay = false;
if (typeof_default()(date) !== 'object') {
if (date.indexOf(':') !== -1) {
date += 'Z';
} else if (isPeriodEnd) {
addOneDay = true;
}
date = new Date(date);
}
if (addOneDay) {
date = addDays(date, 1);
}
return isPeriodEnd ? subSeconds(date, 1) : date;
},
ddmmyyyyToYyyymmdd: function ddmmyyyyToYyyymmdd(ddmmyyyy) {
var date = ddmmyyyy.match(/(\d{2})-(\d{2})-(\d{4})/);
return date && "".concat(date[3], "-").concat(date[2], "-").concat(date[1]);
},
getMonthNumber: function getMonthNumber(mesyats) {
var month = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'].indexOf(mesyats) + 1;
return month || null;
},
plural: function plural(count, one, two, five) {
var cases = [five, one, two, two, two, five]; // 0, 1, 2, 3, 4, 5
return count % 100 > 4 && count % 100 < 20 ? five : cases[Math.min(count % 10, 5)];
},
getLastMatch: function getLastMatch(s, regexp) {
if (!regexp.global) {
console.error('Функция работает только с регулярными выражениями с флагом global.');
return;
}
var matches;
var lastMatch;
while (matches = regexp.exec(s)) {
lastMatch = matches;
}
return lastMatch;
},
filterUserLinks: function filterUserLinks() {
return decodeURIComponent($(this).attr('href')).match(captureUserRegexp);
},
getUserNameFromLink: function getUserNameFromLink($link) {
var userMatches = decodeURIComponent($link.attr('href')).match(captureUserRegexp);
return userMatches && userMatches[1].replace(/&action=edit.*/, '').replace(/_/g, ' ');
},
removeDuplicates: function removeDuplicates(array) {
return toConsumableArray_default()(new Set(array));
},
isntVotePage: function isntVotePage(entry) {
var title = entry.title;
var isAdminElection = title.startsWith('Википедия:Заявки на статус администратора/') && title !== 'Википедия:Заявки на статус администратора/Шаблон' && title !== 'Википедия:Заявки на статус администратора/Шаблон требований к голосующим' && title !== 'Википедия:Заявки на статус администратора/styles.css';
var isBureaucratElection = title.startsWith('Википедия:Заявки на статус администратора/') && title !== 'Википедия:Заявки на статус администратора/Шаблон' && title !== 'Википедия:Заявки на статус администратора/Шаблон требований к голосующим' && title !== 'Википедия:Заявки на статус администратора/styles.css';
var isConfirmation = title.startsWith('Википедия:Конфирмации/') && title !== 'Википедия:Конфирмации/Шаблон';
var isArbcomElection = title.startsWith('Википедия:Выборы арбитров/');
return !(isAdminElection || isBureaucratElection || isConfirmation || isArbcomElection);
},
isntAutomaticAction: function isntAutomaticAction(event) {
var notCountedActions = ['approve-a', 'approve-ia', 'approve2-a', 'approve2-ia', 'autopatrol', 'autopromote', 'delete_redir', 'hit', 'move', 'move_prot', 'move_redir', 'renameuser', 'thank'];
return !(notCountedActions.indexOf(event.action) !== -1 || event.type === 'create' && event.action === 'create' || event.type === 'newusers');
},
createSubFunc: function createSubFunc(value, unit) {
var ending;
switch (unit) {
case 'day':
ending = 'days';
break;
case 'month':
ending = 'months';
break;
case 'year':
ending = 'years';
break;
case 'days':
case 'years':
case 'days':
ending = unit;
}
if (!ending) return;
return function (date) {
return dateFns['sub' + ending[0].toUpperCase() + ending.slice(1)].call(null, date, value);
};
},
calcOptimalLimit: function calcOptimalLimit(neededEditCount) {
return Math.round(Math.max(neededEditCount, 200) * 1.2);
},
otherThanMeets: function otherThanMeets(result) {
return result.conclusion !== 'meets';
}
});
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/classCallCheck.js
var classCallCheck = __webpack_require__(5);
var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createClass.js
var createClass = __webpack_require__(6);
var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass);
// CONCATENATED MODULE: ./src/User.js
var isCurrentUserSysop = mw.config.get('wgUserGroups').indexOf('sysop') !== -1;
var User_User =
/*#__PURE__*/
function () {
function User(name) {
classCallCheck_default()(this, User);
this.name = name;
if (cc.admin && cc.admin.isRelevantPage()) {
this.nameWhenVoted = name;
this.votes = [];
}
}
createClass_default()(User, [{
key: "changeName",
value: function changeName(newName) {
this.name = newName;
this.missing = null;
this.infoRequest = null;
}
}, {
key: "checkOne",
value: function () {
var _checkOne = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee(criterion) {
var entry, options, result;
return regenerator_default.a.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (cc.apiRateLimit) {
_context.next = 8;
break;
}
_context.t0 = cc.currentUser;
if (!_context.t0) {
_context.next = 6;
break;
}
_context.next = 5;
return cc.currentUser.getUserInfo();
case 5:
_context.t0 = _context.sent;
case 6:
entry = _context.t0;
cc.apiRateLimit = entry && entry.rights && entry.rights.indexOf('apihighlimits') !== -1 ? 5000 : 500;
case 8:
options = Object.assign({}, criterion);
delete options.type;
delete options.text;
if (!criterion.needsManualCheck) {
_context.next = 15;
break;
}
result = {
result: 'needsManualCheck'
};
_context.next = 32;
break;
case 15:
if (!this.missing) {
_context.next = 19;
break;
}
result = {
result: 'userMissing'
};
_context.next = 32;
break;
case 19:
if (!this[criterion.type]) {
_context.next = 25;
break;
}
_context.next = 22;
return this[criterion.type](options);
case 22:
result = _context.sent;
_context.next = 32;
break;
case 25:
if (!cc.customHandlers[criterion.type]) {
_context.next = 31;
break;
}
_context.next = 28;
return cc.customHandlers[criterion.type](this, options);
case 28:
result = _context.sent;
_context.next = 32;
break;
case 31:
throw new Error("\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0442\u0438\u043F \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u044F ".concat(criterion.type, "."));
case 32:
result.user = this;
result.criterion = criterion;
return _context.abrupt("return", result);
case 35:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function checkOne(_x) {
return _checkOne.apply(this, arguments);
}
return checkOne;
}()
}, {
key: "check",
value: function () {
var _check = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee2(criteria) {
var _this = this;
var results, dataRename, entry, newUserName, renameDate, dataMove, entryMove, newUserNameMove, renameDateMove;
return regenerator_default.a.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!Array.isArray(criteria)) {
criteria = [criteria];
}
case 1:
if (false) {}
_context2.next = 4;
return Promise.all(criteria.map(function (criterion) {
return _this.checkOne(criterion);
}));
case 4:
results = _context2.sent;
if (!(!this.missing && !results.some(function (result) {
return ['notMeets', 'notEnoughRights'].indexOf(result.result) !== -1;
}))) {
_context2.next = 7;
break;
}
return _context2.abrupt("break", 34);
case 7:
_context2.next = 9;
return new mw.Api().get({
action: 'query',
list: 'logevents',
letype: 'renameuser',
letitle: 'Участник:' + this.name,
formatversion: 2
});
case 9:
dataRename = _context2.sent;
entry = dataRename && dataRename.query && dataRename.query.logevents && dataRename.query.logevents[0];
newUserName = entry && entry.params && entry.params.newuser;
renameDate = entry && entry.timestamp && new Date(entry.timestamp);
if (!(newUserName && (!this.votes || !this.votes.length || renameDate > this.votes[0].date))) {
_context2.next = 17;
break;
}
this.changeName(newUserName);
_context2.next = 32;
break;
case 17:
if (!this.missing) {
_context2.next = 31;
break;
}
_context2.next = 20;
return new mw.Api().get({
action: 'query',
list: 'logevents',
letype: 'move',
letitle: 'Участник:' + this.name,
formatversion: 2
});
case 20:
dataMove = _context2.sent;
entryMove = dataMove && dataMove.query && dataMove.query.logevents && dataMove.query.logevents[0];
newUserNameMove = entryMove && entryMove.comment && // Не всегда умещается, см. https://ru.wikipedia.org/w/index.php?title=Участник:Hausratte&action=history
entryMove.comment.indexOf('Автоматическое переим') !== -1 && entryMove.ns && entryMove.ns === 2 && entryMove.params && entryMove.params.target_title && entryMove.params.target_title.slice(entryMove.params.target_title.indexOf(':') + 1);
renameDateMove = entryMove && entryMove.timestamp && new Date(entryMove.timestamp);
if (!(newUserNameMove && (!this.votes || !this.votes.length || renameDateMove > this.votes[0].date))) {
_context2.next = 28;
break;
}
this.changeName(newUserNameMove);
_context2.next = 29;
break;
case 28:
return _context2.abrupt("break", 34);
case 29:
_context2.next = 32;
break;
case 31:
return _context2.abrupt("break", 34);
case 32:
_context2.next = 1;
break;
case 34:
return _context2.abrupt("return", results);
case 35:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function check(_x2) {
return _check.apply(this, arguments);
}
return check;
}()
}, {
key: "getUserInfo",
value: function getUserInfo() {
var _this2 = this;
if (this.infoRequest) {
return this.infoRequest;
} else {
this.infoRequest = new mw.Api().get({
action: 'query',
list: 'users',
ususers: this.name,
usprop: 'registration|editcount|groups|rights',
formatversion: 2
}).then(function (data) {
var entry = data && data.query && data.query.users && data.query.users[0];
if (entry && entry.missing) {
// Если критериев, требующих получения списка users, нет, это свойство останется
// незаполненным
_this2.missing = true;
}
return entry;
});
return this.infoRequest;
}
}
}, {
key: "requestContribs",
value: function () {
var _requestContribs = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee3(options, enoughEditCount) {
var contribs, uccontinue, doContinue, uclimit, data, entries;
return regenerator_default.a.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
contribs = [];
case 1:
uclimit = void 0;
if (enoughEditCount) {
uclimit = Math.min(cc.apiRateLimit, options.filterVotes ? cc.util.calcOptimalLimit(enoughEditCount - contribs.length) : enoughEditCount - contribs.length);
} else {
uclimit = cc.apiRateLimit;
}
_context3.next = 5;
return new mw.Api().get({
list: 'usercontribs',
ucprop: 'title|timestamp',
ucuser: this.name,
ucnamespace: options.ns,
ucstart: options.periodStart && options.periodStart.toISOString(),
ucend: options.periodEnd && options.periodEnd.toISOString(),
ucdir: 'newer',
uclimit: uclimit,
uccontinue: uccontinue,
formatversion: 2
});
case 5:
data = _context3.sent;
entries = data && data.query && data.query.usercontribs;
if (entries) {
_context3.next = 9;
break;
}
return _context3.abrupt("break", 15);
case 9:
if (options.filterVotes) {
entries = entries.filter(cc.util.isntVotePage);
}
contribs.push.apply(contribs, toConsumableArray_default()(entries));
uccontinue = data && data["continue"] && data["continue"].uccontinue;
doContinue = uccontinue && (!enoughEditCount || contribs.length < enoughEditCount);
if (options.filterVotes && uclimit < cc.apiRateLimit && doContinue) {
console.info("\u041D\u0435\u043E\u043F\u0442\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0441\u0447\u0451\u0442 \u0432 \u0444\u0443\u043D\u043A\u0446\u0438\u0438 calcOptimalLimit: \u0437\u0430\u043F\u0440\u043E\u0448\u0435\u043D\u043E ".concat(uclimit, ", \u043D\u0430\u0448\u043B\u043E\u0441\u044C ").concat(entries.length, ", \u043F\u0440\u0438\u0448\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044C \u0435\u0449\u0451 \u0437\u0430\u043F\u0438\u0441\u0438. \u0423\u0447\u0430\u0441\u0442\u043D\u0438\u043A ").concat(this.name, "."), entries);
}
case 14:
if (doContinue) {
_context3.next = 1;
break;
}
case 15:
return _context3.abrupt("return", contribs);
case 16:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function requestContribs(_x3, _x4) {
return _requestContribs.apply(this, arguments);
}
return requestContribs;
}()
}, {
key: "requestDeletedContribs",
value: function () {
var _requestDeletedContribs = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee4(options, enoughEditCount) {
var deletedContribs, adrcontinue, doContinue, adrlimit, data, entries, revisions, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, entry;
return regenerator_default.a.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
deletedContribs = [];
case 1:
adrlimit = void 0;
if (enoughEditCount) {
adrlimit = Math.min(cc.apiRateLimit, options.filterVotes ? cc.util.calcOptimalLimit(enoughEditCount - deletedContribs.length) : enoughEditCount - deletedContribs.length);
} else {
adrlimit = cc.apiRateLimit;
}
_context4.next = 5;
return new mw.Api().get({
action: 'query',
list: 'alldeletedrevisions',
adrprop: 'timestamp',
adruser: this.name,
adrstart: options.periodStart && options.periodStart.toISOString(),
adrend: options.periodEnd && options.periodEnd.toISOString(),
adrdir: 'newer',
adrlimit: adrlimit,
adrcontinue: adrcontinue,
formatversion: 2
});
case 5:
data = _context4.sent;
entries = data && data.query && data.query.alldeletedrevisions;
if (entries) {
_context4.next = 9;
break;
}
return _context4.abrupt("break", 35);
case 9:
if (options.filterVotes) {
entries = entries.filter(cc.util.isntVotePage);
}
revisions = [];
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context4.prev = 14;
for (_iterator = entries[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
entry = _step.value;
revisions.push.apply(revisions, toConsumableArray_default()(entry.revisions));
}
_context4.next = 22;
break;
case 18:
_context4.prev = 18;
_context4.t0 = _context4["catch"](14);
_didIteratorError = true;
_iteratorError = _context4.t0;
case 22:
_context4.prev = 22;
_context4.prev = 23;
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
case 25:
_context4.prev = 25;
if (!_didIteratorError) {
_context4.next = 28;
break;
}
throw _iteratorError;
case 28:
return _context4.finish(25);
case 29:
return _context4.finish(22);
case 30:
deletedContribs.push.apply(deletedContribs, revisions);
adrcontinue = data && data["continue"] && data["continue"].adrcontinue;
doContinue = adrcontinue && (!enoughEditCount || deletedContribs.length < enoughEditCount);
if (options.filterVotes && adrlimit < cc.apiRateLimit && doContinue) {
console.info("\u041D\u0435\u043E\u043F\u0442\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0441\u0447\u0451\u0442 \u0432 \u0444\u0443\u043D\u043A\u0446\u0438\u0438 calcOptimalLimit: \u0437\u0430\u043F\u0440\u043E\u0448\u0435\u043D\u043E ".concat(adrlimit, ", \u043D\u0430\u0448\u043B\u043E\u0441\u044C ").concat(revisions.length, ", \u043F\u0440\u0438\u0448\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044C \u0435\u0449\u0451 \u0437\u0430\u043F\u0438\u0441\u0438. \u0423\u0447\u0430\u0441\u0442\u043D\u0438\u043A ").concat(this.name, "."), entries);
}
case 34:
if (doContinue) {
_context4.next = 1;
break;
}
case 35:
return _context4.abrupt("return", deletedContribs);
case 36:
case "end":
return _context4.stop();
}
}
}, _callee4, this, [[14, 18, 22, 30], [23,, 25, 29]]);
}));
function requestDeletedContribs(_x5, _x6) {
return _requestDeletedContribs.apply(this, arguments);
}
return requestDeletedContribs;
}()
}, {
key: "collectActions",
value: function () {
var _collectActions = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee5(options, enoughActionCount) {
var actions, contribs, deletedContribs, lecontinue, data, entries;
return regenerator_default.a.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
actions = [];
if (options.deleted == undefined) {
options.deleted = true;
}
_context5.next = 4;
return this.requestContribs(options, enoughActionCount);
case 4:
contribs = _context5.sent;
actions.push.apply(actions, toConsumableArray_default()(contribs));
if (!(options.deleted && isCurrentUserSysop && (!enoughActionCount || actions.length < enoughActionCount))) {
_context5.next = 11;
break;
}
_context5.next = 9;
return this.requestDeletedContribs(options, enoughActionCount && enoughActionCount - actions.length);
case 9:
deletedContribs = _context5.sent;
actions.push.apply(actions, toConsumableArray_default()(deletedContribs));
case 11:
if (!(!enoughActionCount || actions.length < enoughActionCount)) {
_context5.next = 22;
break;
}
case 12:
_context5.next = 14;
return new mw.Api().get({
action: 'query',
list: 'logevents',
leprop: 'timestamp|type',
leuser: this.name,
lestart: options.periodStart && options.periodStart.toISOString(),
leend: options.periodEnd && options.periodEnd.toISOString(),
ledir: 'newer',
lelimit: cc.apiRateLimit,
lecontinue: lecontinue,
formatversion: 2
});
case 14:
data = _context5.sent;
entries = data && data.query && data.query.logevents;
if (entries) {
_context5.next = 18;
break;
}
return _context5.abrupt("break", 22);
case 18:
entries = entries.filter(cc.util.isntAutomaticAction);
actions.push.apply(actions, toConsumableArray_default()(entries));
lecontinue = data && data["continue"] && data["continue"].lecontinue;
case 21:
if (lecontinue && (!enoughActionCount || actions.length < enoughActionCount)) {
_context5.next = 12;
break;
}
case 22:
actions.sort(function (a, b) {
if (a.timestamp > b.timestamp) {
return 1;
} else if (a.timestamp < b.timestamp) {
return -1;
} else {
return 0;
}
});
return _context5.abrupt("return", actions);
case 24:
case "end":
return _context5.stop();
}
}
}, _callee5, this);
}));
function collectActions(_x7, _x8) {
return _collectActions.apply(this, arguments);
}
return collectActions;
}()
/* Функции типов критериев */
}, {
key: "editCountNotLess",
value: function () {
var _editCountNotLess = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee6(options) {
var safeValue, edits, deletedContribs;
return regenerator_default.a.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
options.periodStart = cc.util.prepareDate(options.periodStart);
options.periodEnd = cc.util.prepareDate(options.periodEnd, true);
options.meaningful = Boolean(Number(options.meaningful));
options.deleted = Boolean(Number(options.deleted));
if (options.meaningful && options.margin == undefined) {
options.margin = 0.5;
}
if (options.margin == undefined) {
options.margin = 0;
}
safeValue = Math.round(options.value * (1 + options.margin));
_context6.next = 9;
return this.requestContribs(options, safeValue);
case 9:
edits = _context6.sent;
if (!(edits.length >= safeValue)) {
_context6.next = 14;
break;
}
return _context6.abrupt("return", {
result: 'meets',
editCount: edits.length
});
case 14:
if (!(options.deleted && isCurrentUserSysop)) {
_context6.next = 19;
break;
}
_context6.next = 17;
return this.requestDeletedContribs(options, safeValue - edits.length);
case 17:
deletedContribs = _context6.sent;
edits.push.apply(edits, toConsumableArray_default()(deletedContribs));
case 19:
if (!(edits.length >= safeValue)) {
_context6.next = 23;
break;
}
return _context6.abrupt("return", {
result: 'meets',
editCount: edits.length,
edits: edits
});
case 23:
if (!(edits.length >= options.value)) {
_context6.next = 27;
break;
}
return _context6.abrupt("return", {
result: !options.deleted || isCurrentUserSysop ? 'possiblyMeets' : 'notEnoughRights',
editCount: edits.length,
edits: edits
});
case 27:
return _context6.abrupt("return", {
result: !options.deleted || isCurrentUserSysop ? 'notMeets' : 'notEnoughRights',
editCount: edits.length,
edits: edits
});
case 28:
case "end":
return _context6.stop();
}
}
}, _callee6, this);
}));
function editCountNotLess(_x9) {
return _editCountNotLess.apply(this, arguments);
}
return editCountNotLess;
}()
}, {
key: "registrationDateNotLater",
value: function () {
var _registrationDateNotLater = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee7(options) {
var entry, registrationDate, overallEditCount, dataUc;
return regenerator_default.a.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
options.value = cc.util.prepareDate(options.value, true);
_context7.next = 3;
return this.getUserInfo();
case 3:
entry = _context7.sent;
if (!this.missing) {
_context7.next = 6;
break;
}
return _context7.abrupt("return", {
result: 'userMissing'
});
case 6:
registrationDate = entry && entry.registration && new Date(entry.registration);
overallEditCount = entry && entry.editcount; // У зарегистрировавшихся до 2 декабря 2005 года нет даты регистрации
if (!(entry && !entry.registration)) {
_context7.next = 13;
break;
}
_context7.next = 11;
return new mw.Api().get({
action: 'query',
list: 'usercontribs',
ucuser: this.name,
ucdir: 'newer',
uclimit: 1,
formatversion: 2
});
case 11:
dataUc = _context7.sent;
registrationDate = dataUc && dataUc.query && dataUc.query.usercontribs && dataUc.query.usercontribs[0] && dataUc.query.usercontribs[0].timestamp && new Date(dataUc.query.usercontribs[0].timestamp);
case 13:
return _context7.abrupt("return", {
result: registrationDate <= options.value ? 'meets' : 'notMeets',
registrationDate: registrationDate,
overallEditCount: overallEditCount
});
case 14:
case "end":
return _context7.stop();
}
}
}, _callee7, this);
}));
function registrationDateNotLater(_x10) {
return _registrationDateNotLater.apply(this, arguments);
}
return registrationDateNotLater;
}()
}, {
key: "editsBetweenDates",
value: function () {
var _editsBetweenDates = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee8(options) {
var data;
return regenerator_default.a.wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
options.periodStart = cc.util.prepareDate(options.periodStart);
options.periodEnd = cc.util.prepareDate(options.periodEnd, true);
_context8.next = 4;
return new mw.Api().get({
action: 'query',
list: 'usercontribs',
ucuser: this.name,
ucstart: options.periodStart.toISOString(),
ucend: options.periodEnd.toISOString(),
ucdir: 'newer',
uclimit: 1,
formatversion: 2
});
case 4:
data = _context8.sent;
if (!(data && data.query && data.query.usercontribs && data.query.usercontribs.length)) {
_context8.next = 9;
break;
}
return _context8.abrupt("return", {
result: 'meets'
});
case 9:
return _context8.abrupt("return", {
result: 'notMeets'
});
case 10:
case "end":
return _context8.stop();
}
}
}, _callee8, this);
}));
function editsBetweenDates(_x11) {
return _editsBetweenDates.apply(this, arguments);
}
return editsBetweenDates;
}()
}, {
key: "hadFlagFor",
value: function () {
var _hadFlagFor = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee9(options) {
var lecontinue, entries, data, logEvents, multiplierMin, multiplierMax, neededPeriodMin, neededPeriodMax, periodsCount, result, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, flag, period, lastEndedHavingFlag, lastStartedHavingFlag, i, entry, newGroups, startedHavingFlag, endedHavingFlag, laterEntry, laterNewGroups, subFunc;
return regenerator_default.a.wrap(function _callee9$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
options.referenceDate = cc.util.prepareDate(options.referenceDate, true);
if (!options.flags) {
options.flags = options.flag && [options.flag];
}
entries = [];
case 3:
_context9.next = 5;
return new mw.Api().get({
action: 'query',
list: 'logevents',
letype: 'rights',
letitle: 'Участник:' + this.name,
leend: options.referenceDate && options.referenceDate.toISOString(),
lelimit: cc.apiRateLimit,
ledir: 'newer',
formatversion: 2
});
case 5:
data = _context9.sent;
logEvents = data && data.query && data.query.logevents;
if (logEvents) {
_context9.next = 9;
break;
}
return _context9.abrupt("break", 12);
case 9:
entries.push.apply(entries, toConsumableArray_default()(logEvents));
lecontinue = data && data["continue"] && data["continue"].lecontinue;
case 11:
if (lecontinue) {
_context9.next = 3;
break;
}
case 12:
_context9.t0 = options.unit;
_context9.next = _context9.t0 === 'year' ? 15 : _context9.t0 === 'years' ? 15 : _context9.t0 === 'month' ? 18 : _context9.t0 === 'months' ? 18 : _context9.t0 === 'day' ? 21 : _context9.t0 === 'days' ? 21 : 22;
break;
case 15:
multiplierMin = 1000 * 60 * 60 * 24 * 365;
multiplierMax = 1000 * 60 * 60 * 24 * 366;
return _context9.abrupt("break", 22);
case 18:
multiplierMin = 1000 * 60 * 60 * 24 * 28;
multiplierMax = 1000 * 60 * 60 * 24 * 31;
return _context9.abrupt("break", 22);
case 21:
multiplierMin = multiplierMax = 1000 * 60 * 60 * 24;
case 22:
neededPeriodMin = multiplierMin * options.value;
neededPeriodMax = multiplierMax * options.value;
periodsCount = 0;
_iteratorNormalCompletion2 = true;
_didIteratorError2 = false;
_iteratorError2 = undefined;
_context9.prev = 28;
_iterator2 = options.flags[Symbol.iterator]();
case 30:
if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {
_context9.next = 72;
break;
}
flag = _step2.value;
period = 0;
lastEndedHavingFlag = void 0;
lastStartedHavingFlag = void 0;
i = 0;
case 36:
if (!(i < entries.length)) {
_context9.next = 58;
break;
}
entry = entries[i];
newGroups = entry.params && entry.params.newgroups;
if (!(newGroups && newGroups.indexOf(flag) !== -1)) {
_context9.next = 55;
break;
}
startedHavingFlag = new Date(entry.timestamp);
lastStartedHavingFlag = startedHavingFlag;
endedHavingFlag = void 0;
i++;
case 44:
if (!(i < entries.length)) {
_context9.next = 53;
break;
}
laterEntry = entries[i];
laterNewGroups = laterEntry.params && laterEntry.params.newgroups;
if (!(laterNewGroups && !(laterNewGroups.indexOf(flag) !== -1))) {
_context9.next = 50;
break;
}
lastEndedHavingFlag = endedHavingFlag = new Date(entries[i].timestamp);
return _context9.abrupt("break", 53);
case 50:
i++;
_context9.next = 44;
break;
case 53:
period += (endedHavingFlag ? endedHavingFlag.getTime() : Date.now()) - startedHavingFlag.getTime();
periodsCount++;
case 55:
i++;
_context9.next = 36;
break;
case 58:
if (!(period >= neededPeriodMax)) {
_context9.next = 62;
break;
}
return _context9.abrupt("return", {
result: 'meets',
flag: flag,
period: period
});
case 62:
if (!(periodsCount === 1)) {
_context9.next = 68;
break;
}
// Если период всего один, вычисляем по классическим правилам для дат (например, 1 месяц
// назад для 31 марта — 28 февраля в невисокосном году)
subFunc = cc.util.createSubFunc(options.value, options.unit);
if (!(subFunc(lastEndedHavingFlag) > lastStartedHavingFlag)) {
_context9.next = 66;
break;
}
return _context9.abrupt("return", {
result: 'meets',
flag: flag,
period: period
});
case 66:
_context9.next = 69;
break;
case 68:
if (period >= neededPeriodMin) {
// Если периодов несколько и трактовка количества месяцев/лет может отличаться, оставляем
// выводы на усмотрение бюрократам
result = {
result: 'possiblyMeets',
flag: flag,
period: period
};
}
case 69:
_iteratorNormalCompletion2 = true;
_context9.next = 30;
break;
case 72:
_context9.next = 78;
break;
case 74:
_context9.prev = 74;
_context9.t1 = _context9["catch"](28);
_didIteratorError2 = true;
_iteratorError2 = _context9.t1;
case 78:
_context9.prev = 78;
_context9.prev = 79;
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
case 81:
_context9.prev = 81;
if (!_didIteratorError2) {
_context9.next = 84;
break;
}
throw _iteratorError2;
case 84:
return _context9.finish(81);
case 85:
return _context9.finish(78);
case 86:
return _context9.abrupt("return", result || {
result: 'notMeets'
});
case 87:
case "end":
return _context9.stop();
}
}
}, _callee9, this, [[28, 74, 78, 86], [79,, 81, 85]]);
}));
function hadFlagFor(_x12) {
return _hadFlagFor.apply(this, arguments);
}
return hadFlagFor;
}()
}, {
key: "notLostFlagInLast",
value: function () {
var _notLostFlagInLast = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee10(options) {
var subFunc, lecontinue, entries, data, logEvents, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, flag, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, entry, oldGroups, newGroups;
return regenerator_default.a.wrap(function _callee10$(_context10) {
while (1) {
switch (_context10.prev = _context10.next) {
case 0:
options.referenceDate = cc.util.prepareDate(options.referenceDate || new Date());
subFunc = cc.util.createSubFunc(options.value, options.unit);
if (!options.flags) {
options.flags = options.flag && [options.flag];
}
entries = [];
case 4:
_context10.next = 6;
return new mw.Api().get({
action: 'query',
list: 'logevents',
letype: 'rights',
letitle: 'Участник:' + this.name,
lestart: subFunc(options.referenceDate).toISOString(),
leend: options.referenceDate.toISOString(),
lelimit: cc.apiRateLimit,
ledir: 'newer',
formatversion: 2
});
case 6:
data = _context10.sent;
logEvents = data && data.query && data.query.logevents;
if (logEvents) {
_context10.next = 10;
break;
}
return _context10.abrupt("break", 13);
case 10:
entries.push.apply(entries, toConsumableArray_default()(logEvents));
lecontinue = data && data["continue"] && data["continue"].lecontinue;
case 12:
if (lecontinue) {
_context10.next = 4;
break;
}
case 13:
_iteratorNormalCompletion3 = true;
_didIteratorError3 = false;
_iteratorError3 = undefined;
_context10.prev = 16;
_iterator3 = options.flags[Symbol.iterator]();
case 18:
if (_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done) {
_context10.next = 51;
break;
}
flag = _step3.value;
_iteratorNormalCompletion4 = true;
_didIteratorError4 = false;
_iteratorError4 = undefined;
_context10.prev = 23;
_iterator4 = entries[Symbol.iterator]();
case 25:
if (_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done) {
_context10.next = 34;
break;
}
entry = _step4.value;
oldGroups = entry.params && entry.params.oldgroups;
newGroups = entry.params && entry.params.newgroups;
if (!(oldGroups && newGroups && oldGroups.indexOf(flag) !== -1 && !(newGroups.indexOf(flag) !== -1))) {
_context10.next = 31;
break;
}
return _context10.abrupt("return", {
result: 'notMeets',
flag: flag,
lostFlagTimestamp: entry.timestamp
});
case 31:
_iteratorNormalCompletion4 = true;
_context10.next = 25;
break;
case 34:
_context10.next = 40;
break;
case 36:
_context10.prev = 36;
_context10.t0 = _context10["catch"](23);
_didIteratorError4 = true;
_iteratorError4 = _context10.t0;
case 40:
_context10.prev = 40;
_context10.prev = 41;
if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) {
_iterator4["return"]();
}
case 43:
_context10.prev = 43;
if (!_didIteratorError4) {
_context10.next = 46;
break;
}
throw _iteratorError4;
case 46:
return _context10.finish(43);
case 47:
return _context10.finish(40);
case 48:
_iteratorNormalCompletion3 = true;
_context10.next = 18;
break;
case 51:
_context10.next = 57;
break;
case 53:
_context10.prev = 53;
_context10.t1 = _context10["catch"](16);
_didIteratorError3 = true;
_iteratorError3 = _context10.t1;
case 57:
_context10.prev = 57;
_context10.prev = 58;
if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
_iterator3["return"]();
}
case 60:
_context10.prev = 60;
if (!_didIteratorError3) {
_context10.next = 63;
break;
}
throw _iteratorError3;
case 63:
return _context10.finish(60);
case 64:
return _context10.finish(57);
case 65:
return _context10.abrupt("return", {
result: 'meets'
});
case 66:
case "end":
return _context10.stop();
}
}
}, _callee10, this, [[16, 53, 57, 65], [23, 36, 40, 48], [41,, 43, 47], [58,, 60, 64]]);
}));
function notLostFlagInLast(_x13) {
return _notLostFlagInLast.apply(this, arguments);
}
return notLostFlagInLast;
}()
}, {
key: "notInactiveFor",
value: function () {
var _notInactiveFor = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee11(options) {
var subFunc, actions, i, previousDate, currentDate;
return regenerator_default.a.wrap(function _callee11$(_context11) {
while (1) {
switch (_context11.prev = _context11.next) {
case 0:
options.periodStart = cc.util.prepareDate(options.periodStart);
options.periodEnd = cc.util.prepareDate(options.periodEnd, true);
subFunc = cc.util.createSubFunc(options.value, options.unit);
_context11.next = 5;
return this.collectActions(options);
case 5:
actions = _context11.sent;
i = 0;
case 7:
if (!(i <= actions.length)) {
_context11.next = 15;
break;
}
previousDate = i === 0 ? options.periodStart : new Date(actions[i - 1].timestamp);
currentDate = i === actions.length ? options.periodEnd : new Date(actions[i].timestamp);
if (!(subFunc(currentDate) > previousDate)) {
_context11.next = 12;
break;
}
return _context11.abrupt("return", {
result: isCurrentUserSysop ? 'notMeets' : 'notEnoughRights',
inactivityPeriodStart: previousDate,
inactivityPeriodEnd: currentDate
});
case 12:
i++;
_context11.next = 7;
break;
case 15:
return _context11.abrupt("return", {
result: 'meets'
});
case 16:
case "end":
return _context11.stop();
}
}
}, _callee11, this);
}));
function notInactiveFor(_x14) {
return _notInactiveFor.apply(this, arguments);
}
return notInactiveFor;
}()
}, {
key: "actionCountNotLess",
value: function () {
var _actionCountNotLess = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee12(options) {
var actions;
return regenerator_default.a.wrap(function _callee12$(_context12) {
while (1) {
switch (_context12.prev = _context12.next) {
case 0:
options.periodStart = cc.util.prepareDate(options.periodStart);
options.periodEnd = cc.util.prepareDate(options.periodEnd, true);
_context12.next = 4;
return this.collectActions(options, options.value);
case 4:
actions = _context12.sent;
if (!(actions.length < options.value)) {
_context12.next = 9;
break;
}
return _context12.abrupt("return", {
result: isCurrentUserSysop ? 'notMeets' : 'notEnoughRights',
actionCount: actions.length,
actions: actions
});
case 9:
return _context12.abrupt("return", {
result: 'meets',
actionCount: actions.length,
actions: actions
});
case 10:
case "end":
return _context12.stop();
}
}
}, _callee12, this);
}));
function actionCountNotLess(_x15) {
return _actionCountNotLess.apply(this, arguments);
}
return actionCountNotLess;
}()
}, {
key: "noActiveBlockBetweenDates",
value: function () {
var _noActiveBlockBetweenDates = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee13(options) {
var data, entry, partiallyBlockedInSpecifiedNs;
return regenerator_default.a.wrap(function _callee13$(_context13) {
while (1) {
switch (_context13.prev = _context13.next) {
case 0:
options.periodStart = cc.util.prepareDate(options.periodStart);
options.periodEnd = cc.util.prepareDate(options.periodEnd, true);
_context13.next = 4;
return new mw.Api().get({
action: 'query',
list: 'blocks',
bkprop: 'timestamp|expiry|restrictions',
bkuser: this.name,
formatversion: 2
});
case 4:
data = _context13.sent;
entry = data && data.query && data.query.blocks && data.query.blocks[0];
if (entry) {
_context13.next = 8;
break;
}
return _context13.abrupt("return");
case 8:
partiallyBlockedInSpecifiedNs = false;
if (options.ns && entry.restrictions && entry.restrictions.namespaces && entry.restrictions.namespaces.indexOf(options.ns) !== -1) {
partiallyBlockedInSpecifiedNs = true;
}
if (!(new Date(entry.timestamp) <= options.periodStart && (entry.expiry === 'infinity' || new Date(entry.expiry) > options.periodEnd) && (!entry.restrictions || Array.isArray(entry.restrictions) && !entry.restrictions.length || partiallyBlockedInSpecifiedNs))) {
_context13.next = 14;
break;
}
return _context13.abrupt("return", {
result: 'notMeets'
});
case 14:
return _context13.abrupt("return", {
result: 'meets'
});
case 15:
case "end":
return _context13.stop();
}
}
}, _callee13, this);
}));
function noActiveBlockBetweenDates(_x16) {
return _noActiveBlockBetweenDates.apply(this, arguments);
}
return noActiveBlockBetweenDates;
}()
}]);
return User;
}();
// CONCATENATED MODULE: ./src/applications/admin.js
function extractVotes() {
return $('#За').closest('h3').nextUntil('h3:has([id^="Вопросы"])').filter('ol').children('li').map(function (i, li) {
var date;
var $li = $(li);
var $el = $li.clone();
$el.find('li, dd').remove();
var text = $el.text();
var matches = cc.util.getLastMatch(text, /(\b\d?\d):(\d\d), (\d\d?) ([а-я]+) (\d\d\d\d) \(UTC\)/g);
if (matches) {
var hours = matches[1];
var minutes = matches[2];
var day = matches[3];
var month = cc.util.getMonthNumber(matches[4]);
var year = matches[5];
if (!month) return;
date = new Date("".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes, "Z"));
}
var $userLinks = $el.find('a').filter(cc.util.filterUserLinks);
var usersInMsg = $userLinks.map(function (i, el) {
return cc.util.getUserNameFromLink($(el));
}).get();
var authorName = usersInMsg[usersInMsg.length - 1];
if (!authorName) return;
var author = cc.getUser(authorName);
var vote = {
$el: $li,
author: author,
date: date,
confusingAuthor: cc.util.removeDuplicates(usersInMsg).length > 1 && (!/\(UTC\)\s*/.test(text) || text.indexOf('(UTC)') !== text.lastIndexOf('(UTC)') || $userLinks.closest('small').length),
anchor: "vote".concat(i)
};
author.votes.push(vote);
return vote;
}).get();
}
function updateButtonsBlock() {
$buttonsBlock.children().detach();
$(buttons).map(function (i, el) {
return el.hide ? null : el.$element[0];
}).appendTo($buttonsBlock);
}
function showButton(id) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = buttons[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var button = _step.value;
if (id === button.bindings.click[0].method.name) {
button.hide = false;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
updateButtonsBlock();
}
function hideButton(id) {
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = buttons[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var button = _step2.value;
if (id === button.bindings.click[0].method.name) {
button.hide = true;
}
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
updateButtonsBlock();
}
var $criteriaBox;
var buttons;
var $buttonsBlock;
var rawCriteria = false;
var candidate;
var voterCriteria;
var candidateCriteria;
var admin_votingPeriod;
var votingPeriodOk;
var resultsTable;
var _isRelevantPage;
/* harmony default export */ var admin = ({
getAdminCandidateCriteria: function getAdminCandidateCriteria(votingPeriod) {
return [{
text: 'стаж регистрации в русскоязычном разделе Википедии не менее 6 месяцев',
type: 'registrationDateNotLater',
// Прибавляем один день согласно тому, как считается разница в критериях для голосующих и на
// выборах в АК
value: addDays(subMonths(votingPeriod.startTimeless, 6), 1)
}, {
text: 'не менее 1000 правок',
type: 'editCountNotLess',
value: 1000,
periodEnd: votingPeriod.start
}, {
text: 'не баллотировавшийся в администраторы в последние 3 месяца',
needsManualCheck: true
}, {
text: 'не лишённый полномочий администратора в последние 3 месяца',
type: 'notLostFlagInLast',
flag: 'sysop',
value: 3,
unit: 'month',
referenceDate: votingPeriod.startTimeless
}];
},
getBureaucratCandidateCriteria: function getBureaucratCandidateCriteria(votingPeriod) {
return [{
text: 'стаж регистрации в русскоязычном разделе Википедии не менее 2 лет',
type: 'registrationDateNotLater',
// Прибавляем один день согласно тому, как считается разница в критериях для голосующих и на
// выборах в АК
value: addDays(subYears(votingPeriod.startTimeless, 2), 1)
}, {
text: 'не менее 2000 правок',
type: 'editCountNotLess',
value: 2000,
periodEnd: votingPeriod.start
}, {
text: 'выполнявший обязанности администратора Википедии либо арбитра в течение не менее полугода до момента выдвижения',
type: 'hadFlagFor',
flags: ['sysop', 'arbcom'],
value: 6,
unit: 'month',
referenceDate: votingPeriod.startTimeless
}, {
text: 'не имевший за последний год периодов неактивности в русской Википедии длительностью более 3 месяцев',
type: 'notInactiveFor',
value: 3,
unit: 'month',
periodStart: subYears(votingPeriod.startTimeless, 1),
periodEnd: votingPeriod.startTimeless
}, {
text: 'не имевший за последние полгода до момента выдвижения взысканий, наложенных Арбитражным комитетом по итогам рассмотрения исков против кандидата',
needsManualCheck: true,
comment: '(См. [[Арбитраж:Решения]].)'
}, {
text: 'не баллотировавшийся в бюрократы в последние 3 месяца',
needsManualCheck: true
}, {
text: 'не лишённый полномочий бюрократа в последние 3 месяца',
type: 'notLostFlagInLast',
flag: 'bureaucrat',
value: 3,
unit: 'month',
referenceDate: votingPeriod.startTimeless
}];
},
isRelevantPage: function isRelevantPage() {
if (typeof _isRelevantPage === 'undefined') {
_isRelevantPage = Boolean($('.criteriaCheck-adminElection, .criteriaCheck-bureaucratElection, .criteriaCheck-confirmation').length);
}
return _isRelevantPage;
},
main: function main() {
// Данные по голосующим
$criteriaBox = $('.criteriaCheck-criteria');
voterCriteria = cc.extractCriteria($criteriaBox);
if (!$criteriaBox.length) {
$criteriaBox = $('#Требования_к_голосующим').closest('h3').next('div');
$criteriaBox.addClass('criteriaCheck-criteria');
}
var criteria4End;
if (!voterCriteria.length) {
rawCriteria = true;
var $criteria = $criteriaBox.find('li');
var criteria1Text = $criteria.eq(0).text().replace(/[,;.]$/, '');
var criteria1Matches = criteria1Text.match(/(\d+) прав/);
var criteria1Value = criteria1Matches && Number(criteria1Matches[1]);
var criteria2Text = $criteria.eq(1).text().replace(/[,;.]$/, '');
var criteria2Matches = criteria2Text.match(/\d{2}-\d{2}-\d{4}/);
var criteria2Value = criteria2Matches && cc.util.ddmmyyyyToYyyymmdd(criteria2Matches[0]);
var criteria3Text = $criteria.eq(2).text().replace(/[,;.]$/, '');
var criteria3Matches = criteria3Text.match(/(\d{2}-\d{2}-\d{4}) по (\d{2}-\d{2}-\d{4})/);
var criteria3Start = criteria3Matches && cc.util.ddmmyyyyToYyyymmdd(criteria3Matches[1]);
var criteria3End = criteria3Matches && cc.util.ddmmyyyyToYyyymmdd(criteria3Matches[2]);
var criteria4Text = $criteria.eq(3).text().replace(/[,;.]$/, '');
var criteria4Matches = criteria4Text.match(/(\d{2}-\d{2}-\d{4}) по (\d{2}-\d{2}-\d{4})/);
var criteria4Start = criteria4Matches && cc.util.ddmmyyyyToYyyymmdd(criteria4Matches[1]);
criteria4End = criteria4Matches && cc.util.ddmmyyyyToYyyymmdd(criteria4Matches[2]);
voterCriteria = [{
text: criteria1Text,
type: 'editCountNotLess',
ns: 0,
value: criteria1Value,
periodEnd: criteria4End,
meaningful: true
}, {
text: criteria2Text,
type: 'registrationDateNotLater',
value: criteria2Value
}, {
text: criteria3Text,
type: 'editsBetweenDates',
periodStart: criteria3Start,
periodEnd: criteria3End
}, {
text: criteria4Text,
type: 'editsBetweenDates',
periodStart: criteria4Start,
periodEnd: criteria4End
}];
}
var deriveDates = function deriveDates(votingPeriod) {
if (!votingPeriod.start) return;
votingPeriod.startTimeless = cc.util.prepareDate(votingPeriod.start.replace(/ [0-9:]+$/g, ''));
votingPeriod.start = cc.util.prepareDate(votingPeriod.start);
if (!votingPeriod.start) return;
votingPeriod.end = cc.util.prepareDate(votingPeriod.end, true);
return votingPeriod;
};
admin_votingPeriod = Object.assign({}, $('.criteriaCheck-votingPeriod').data());
admin_votingPeriod = deriveDates(admin_votingPeriod);
if (!admin_votingPeriod && // Удостоверяемся, что критерий тот, который нам нужен
voterCriteria.length === 4 && voterCriteria[3].type === 'editsBetweenDates' && voterCriteria[3].periodEnd) {
admin_votingPeriod = deriveDates({
start: voterCriteria[3].periodEnd
});
}
votingPeriodOk = admin_votingPeriod && admin_votingPeriod.start && admin_votingPeriod.end; // Данные по кандидату
candidate = $criteriaBox.length && cc.getUser(cc.util.getUserNameFromLink($('h2').find('a').filter(cc.util.filterUserLinks).first()));
if (admin_votingPeriod) {
if ($('.criteriaCheck-adminElection').length) {
candidateCriteria = cc.admin.getAdminCandidateCriteria(admin_votingPeriod);
}
if ($('.criteriaCheck-bureaucratElection').length) {
candidateCriteria = cc.admin.getBureaucratCandidateCriteria(admin_votingPeriod);
}
} // Парсим таблицу результатов
resultsTable = {
supportVotesCount: Number($('.criteriaCheck-supportVotesCount').text()),
opposeVotesCount: Number($('.criteriaCheck-opposeVotesCount').text()),
neutralVotesCount: Number($('.criteriaCheck-neutralVotesCount').text()),
supportPercent: Number($('.criteriaCheck-supportPercent').text().replace(/[^0-9,.]/g, '').replace(/,/, '.'))
};
resultsTable.totalVotes = resultsTable.supportVotesCount + resultsTable.opposeVotesCount + resultsTable.neutralVotesCount; // Выводим в глобальный объект на случай, если какой-то скрипт захочет воспользоваться данными
cc.admin.candidate = candidate;
cc.admin.voterCriteria = voterCriteria;
cc.admin.candidateCriteria = candidateCriteria;
cc.admin.votingPeriod = admin_votingPeriod;
cc.admin.resultsTable = resultsTable; // Создаём блок ссылок
$buttonsBlock = $('<div>').addClass('criteriaCheck-buttonsBlock');
buttons = [];
if (mw.config.get('wgUserName')) {
var $button = new OO.ui.ButtonWidget({
label: 'Проверить, соответствую ли я требованиям',
classes: ['criteriaCheck-button']
});
$button.on('click', cc.admin.checkMe);
buttons.push($button);
}
if (mw.config.get('wgUserGroups').indexOf('bureaucrat') !== -1 || cc.currentUser === candidate) {
var _$button = new OO.ui.ButtonWidget({
label: 'Проверить все голоса',
classes: ['criteriaCheck-button']
});
_$button.on('click', cc.admin.checkAll);
buttons.push(_$button);
}
if (candidateCriteria && (mw.config.get('wgUserGroups').indexOf('bureaucrat') !== -1 || cc.currentUser === candidate)) {
var _$button2 = new OO.ui.ButtonWidget({
label: 'Проверить соответствие кандидата требованиям для выдвижения',
classes: ['criteriaCheck-button']
});
_$button2.on('click', cc.admin.checkCandidate);
buttons.push(_$button2);
}
;
updateButtonsBlock();
$buttonsBlock.appendTo($criteriaBox);
},
checkMe: function () {
var _checkMe = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee() {
var $checkingMessage, summary, message, text, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, result, _text, currentDate;
return regenerator_default.a.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
hideButton('checkMe');
$checkingMessage = cc.createMessage({
icon: 'loading',
text: 'Проверяем…',
big: true
}).appendTo($criteriaBox);
message = {
icons: [],
texts: []
};
_context.prev = 3;
_context.t0 = cc;
_context.next = 7;
return cc.currentUser.check(voterCriteria);
case 7:
_context.t1 = _context.sent;
summary = _context.t0.summarize.call(_context.t0, _context.t1);
_context.next = 16;
break;
case 11:
_context.prev = 11;
_context.t2 = _context["catch"](3);
console.error(_context.t2);
message = {
icons: ['error'],
texts: ['Не удалось завершить проверку. См. подробности в консоли (F12 → Консоль). ']
};
showButton('checkMe');
case 16:
if (!summary) {
_context.next = 48;
break;
}
if (!(summary.conclusion === 'meets')) {
_context.next = 21;
break;
}
message = {
icons: ['check'],
texts: ['Ура, вы соответствуете требованиям и можете голосовать. ']
};
_context.next = 48;
break;
case 21:
if (!(summary.conclusion === 'notMeets')) {
_context.next = 27;
break;
}
text = "\u041A \u0441\u043E\u0436\u0430\u043B\u0435\u043D\u0438\u044E, \u0432\u044B \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0435 \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044E: <em>".concat(summary.firstFailedResult.criterion.text, "</em>. ");
if (summary.firstFailedResult.criterion.type === 'editCountNotLess') {
text += "\u0423 \u0432\u0430\u0441 \u0442\u043E\u043B\u044C\u043A\u043E ".concat(summary.firstFailedResult.editCount, " \u043F\u0440\u0430\u0432\u043E\u043A. ");
}
message = {
icons: ['close'],
texts: [text]
};
_context.next = 48;
break;
case 27:
if (!(summary.conclusion === 'possiblyMeets')) {
_context.next = 48;
break;
}
message.icons = ['help'];
_iteratorNormalCompletion3 = true;
_didIteratorError3 = false;
_iteratorError3 = undefined;
_context.prev = 32;
for (_iterator3 = summary.results.filter(cc.util.otherThanMeets)[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
result = _step3.value;
_text = "\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044E: <em>".concat(result.criterion.text, "</em>. ");
if (result.criterion.type === 'editCountNotLess') {
_text += "У вас " + result.editCount + " правок, но, согласно [[Википедия:Правила выборов администраторов и бюрократов#Кто может голосовать на выборах бюрократов и администраторов|правилам]], незначительные правки не учитываются при подсчёте. Требуется ручной подсчёт. ";
}
message.texts.push(_text);
}
_context.next = 40;
break;
case 36:
_context.prev = 36;
_context.t3 = _context["catch"](32);
_didIteratorError3 = true;
_iteratorError3 = _context.t3;
case 40:
_context.prev = 40;
_context.prev = 41;
if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
_iterator3["return"]();
}
case 43:
_context.prev = 43;
if (!_didIteratorError3) {
_context.next = 46;
break;
}
throw _iteratorError3;
case 46:
return _context.finish(43);
case 47:
return _context.finish(40);
case 48:
currentDate = new Date();
if (votingPeriodOk && (currentDate < admin_votingPeriod.start || currentDate > admin_votingPeriod.end || $criteriaBox.closest('.ruwiki-closedDiscussion').length)) {
message.texts[message.texts.length - 1] += currentDate < admin_votingPeriod.start ? 'Однако, голосование ещё не началось. ' : 'Однако, голосование уже закончилось. ';
}
message.big = true;
$checkingMessage.remove();
$criteriaBox.append(cc.createMessage(message));
case 53:
case "end":
return _context.stop();
}
}
}, _callee, null, [[3, 11], [32, 36, 40, 48], [41,, 43, 47]]);
}));
function checkMe() {
return _checkMe.apply(this, arguments);
}
return checkMe;
}(),
checkAll: function () {
var _checkAll = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee2() {
var $criteriaBoxMessage, $checkedPercent, votes, votesSummary, i, vote, $target, $message, message, category, badTiming, fitsOtherCriteria, j, summary, logLink, _text2, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, result, _text3, _logLink, formUserList, text, icons, userList, _userList, _userList2;
return regenerator_default.a.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
hideButton('checkAll');
$('.criteriaCheck-message').filter(function () {
return !$(this).closest($criteriaBox).length;
}).remove();
$criteriaBoxMessage = cc.createMessage({
icon: 'loading',
text: 'Проверяем все голоса (<span class="criteriaCheck-checkedPercent">0</span>%)…',
big: true
}).appendTo($criteriaBox);
$checkedPercent = $criteriaBoxMessage.find('.criteriaCheck-checkedPercent');
votes = extractVotes();
cc.admin.votes = votes;
votesSummary = {
meets: [],
notMeets: [],
possiblyMeets: [],
error: []
};
i = 0;
case 8:
if (!(i < votes.length)) {
_context2.next = 96;
break;
}
$checkedPercent.text(Math.round(i / votes.length * 100));
vote = votes[i];
$target = vote.$el.contents().first().is('p, div') ? vote.$el.contents().first() : vote.$el;
$message = cc.createMessage({
icon: 'loading'
});
$target.prepend($message);
message = {
icons: [],
texts: []
};
category = void 0;
badTiming = false;
fitsOtherCriteria = true;
if (votingPeriodOk && vote.date && (vote.date < admin_votingPeriod.start || vote.date > admin_votingPeriod.end)) {
badTiming = true;
category = 'notMeets';
message = {
icons: ['close'],
texts: [vote.date < admin_votingPeriod.start ? 'Голос подан до начала голосования.' : 'Голос подан после окончания голосования.']
};
}
j = 0;
case 20:
if (!(j < i)) {
_context2.next = 28;
break;
}
if (!(votes[j].author.name === vote.author.name)) {
_context2.next = 25;
break;
}
category = 'notMeets';
message = {
icons: ['close'],
texts: [vote.author.nameWhenVoted + ' уже голосовал.']
};
return _context2.abrupt("break", 28);
case 25:
j++;
_context2.next = 20;
break;
case 28:
summary = void 0;
if (category) {
_context2.next = 43;
break;
}
_context2.prev = 30;
_context2.t0 = cc;
_context2.next = 34;
return vote.author.check(voterCriteria);
case 34:
_context2.t1 = _context2.sent;
summary = _context2.t0.summarize.call(_context2.t0, _context2.t1);
_context2.next = 43;
break;
case 38:
_context2.prev = 38;
_context2.t2 = _context2["catch"](30);
console.error(_context2.t2);
category = 'error';
message = {
icons: ['error'],
texts: ['Не удалось завершить проверку. См. подробности в консоли (F12 → Консоль).']
};
case 43:
if (!summary) {
_context2.next = 83;
break;
}
category = summary.conclusion;
if (!(summary.conclusion === 'meets')) {
_context2.next = 49;
break;
}
message = {
icons: ['check'],
texts: []
};
_context2.next = 83;
break;
case 49:
if (!(summary.conclusion === 'userMissing' || summary.warnings.indexOf('0edits') !== -1)) {
_context2.next = 56;
break;
}
category = 'possiblyMeets';
logLink = mw.util.getUrl('Служебная:Журналы', {
page: 'Участник:' + vote.author.name
});
message = {
icons: ['help'],
texts: [summary.conclusion === 'userMissing' ? "Участник " + vote.author.name + " не найден. Скорее всего, он был переименован, но в [" + logLink + " журнале] не найдено записи об этом. Необходима ручная проверка. " : "У участника " + vote.author.name + " всего 0 правок. Скорее всего, он был переименован, но в [" + logLink + " журнале] не найдено записи об этом. Необходима ручная проверка. "]
};
fitsOtherCriteria = false;
_context2.next = 83;
break;
case 56:
if (!(summary.conclusion === 'notMeets')) {
_context2.next = 62;
break;
}
_text2 = "\u0423\u0447\u0430\u0441\u0442\u043D\u0438\u043A \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044E: <em>".concat(summary.firstFailedResult.criterion.text, "</em>. ");
if (summary.firstFailedResult.criterion.type === 'editCountNotLess') {
_text2 += "\u0423 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u0442\u043E\u043B\u044C\u043A\u043E ".concat(summary.firstFailedResult.editCount, " \u043F\u0440\u0430\u0432\u043E\u043A. ");
}
message = {
icons: ['close'],
texts: [_text2]
};
_context2.next = 83;
break;
case 62:
if (!(summary.conclusion === 'possiblyMeets')) {
_context2.next = 83;
break;
}
message.icons = ['help'];
_iteratorNormalCompletion4 = true;
_didIteratorError4 = false;
_iteratorError4 = undefined;
_context2.prev = 67;
for (_iterator4 = summary.results.filter(cc.util.otherThanMeets)[Symbol.iterator](); !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
result = _step4.value;
_text3 = "\u0423\u0447\u0430\u0441\u0442\u043D\u0438\u043A \u043C\u043E\u0436\u0435\u0442 \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044E: <em>".concat(result.criterion.text, "</em>. ");
if (result.criterion.type === 'editCountNotLess') {
_text3 += "\u0423 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 ".concat(result.editCount, " \u043F\u0440\u0430\u0432\u043E\u043A. ");
}
_text3 += 'Необходима ручная проверка. '; // Если встретятся 2 и больше possiblyMeets или будет сомнение, что критерии проверены для
// того участника (если в реплике больше одной ссылки на участника; см., например,
// [[Википедия:Заявки на статус бюрократа/Deinocheirus]]), текст и во втором случае иконки
// должны накапливаться.
message.texts.push(_text3);
}
_context2.next = 75;
break;
case 71:
_context2.prev = 71;
_context2.t3 = _context2["catch"](67);
_didIteratorError4 = true;
_iteratorError4 = _context2.t3;
case 75:
_context2.prev = 75;
_context2.prev = 76;
if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) {
_iterator4["return"]();
}
case 78:
_context2.prev = 78;
if (!_didIteratorError4) {
_context2.next = 81;
break;
}
throw _iteratorError4;
case 81:
return _context2.finish(78);
case 82:
return _context2.finish(75);
case 83:
if (vote.confusingAuthor && !badTiming) {
category = 'possiblyMeets';
message.icons.push('help');
message.texts.push("\u0418\u0437-\u0437\u0430 \u0441\u0442\u0440\u0430\u043D\u043D\u043E\u0439 \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0438 \u0441\u043A\u0440\u0438\u043F\u0442 \u043C\u043E\u0433 \u043F\u0435\u0440\u0435\u043F\u0443\u0442\u0430\u0442\u044C, \u043A\u0442\u043E \u0430\u0432\u0442\u043E\u0440 \u044D\u0442\u043E\u0433\u043E \u0433\u043E\u043B\u043E\u0441\u0430 (\u043E\u043D \u0434\u0443\u043C\u0430\u0435\u0442, \u0447\u0442\u043E \u044D\u0442\u043E ".concat(vote.author.nameWhenVoted, "). "));
fitsOtherCriteria = false;
}
if (vote.author.name !== vote.author.nameWhenVoted) {
_logLink = mw.util.getUrl('Служебная:Журналы', {
page: 'Участник:' + vote.author.nameWhenVoted
});
message.texts.push("Соответствие требованиям определялось для учётной записи " + vote.author.name + ", в которую [" + logLink + " была переименована] учётная запись " + vote.author.nameWhenVoted + ".");
}
if (votingPeriodOk && !vote.date) {
if (category === 'meets' || category === 'possiblyMeets') {
message.texts.push('Не удалось определить время голоса. Необходимо проверить, подан ли голос вовремя. ');
if (!vote.confusingAuthor) {
category = 'possiblyMeets';
message.icons = ['help'];
}
}
}
if (category === 'possiblyMeets' && fitsOtherCriteria) {
message.texts[message.texts.length - 1] += 'Остальным требованиям участник соответствует. ';
}
message.icons = cc.util.removeDuplicates(message.icons);
message.accented = true;
vote.summary = summary;
votesSummary[category].push(vote);
$message.remove();
$target.prepend(cc.createMessage(message, vote.anchor));
case 93:
i++;
_context2.next = 8;
break;
case 96:
$checkedPercent.text('100');
cc.admin.votesSummary = votesSummary;
formUserList = function formUserList(votes) {
return votes.reduce(function (s, vote) {
return s + "[[#" + vote.anchor + "|" + vote.author.nameWhenVoted + "]], ";
}, '').slice(0, -2);
};
text = 'Проверка завершена. ';
if (votes.length) {
if (rawCriteria) {
text += 'Не были найдены метаданные о требованиях, поэтому они извлекались прямо из текста, что могло привести к ошибкам (к примеру, неизвестно время начала голосования, поэтому все правки в день начала включались при определении соответствия 1-му и 4-му требованию). ';
}
if (!votingPeriodOk) {
text += 'Не были найдены корректные метаданные о дате начала и конца голосования, поэтому время подачи голосов не проверялось. ';
}
} else {
text += 'Никто ещё не голосовал. ';
}
icons = [];
if (votesSummary.error.length) {
icons.push('error');
userList = formUserList(votesSummary.error);
text += "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C ".concat(votesSummary.error.length, " ").concat(cc.util.plural(votesSummary.error.length, 'голос', 'голоса', 'голосов'), ": ").concat(userList, ". ");
showButton('checkAll');
}
if (votesSummary.notMeets.length) {
icons.push('close');
_userList = formUserList(votesSummary.notMeets);
text += "".concat(votesSummary.notMeets.length, " ").concat(cc.util.plural(votesSummary.notMeets.length, 'голос', 'голоса', 'голосов'), " \u043D\u0435 ").concat(cc.util.plural(votesSummary.notMeets.length, 'соответствует', 'соответствуют', 'соответствуют'), " \u043F\u0440\u0430\u0432\u0438\u043B\u0430\u043C: ").concat(_userList, ". ");
}
if (votesSummary.possiblyMeets.length) {
icons.push('help');
_userList2 = formUserList(votesSummary.possiblyMeets);
text += "\u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u0430 \u0440\u0443\u0447\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 ".concat(votesSummary.possiblyMeets.length, " ").concat(cc.util.plural(votesSummary.possiblyMeets.length, 'голоса', 'голосов', 'голосов'), ": ").concat(_userList2, ". ");
}
if (votesSummary.meets.length) {
icons.push('check');
text += "".concat(votesSummary.meets.length, " ").concat(cc.util.plural(votesSummary.meets.length, 'голос соответствует', 'голоса соответствуют', 'голосов соответствуют'), " \u043F\u0440\u0430\u0432\u0438\u043B\u0430\u043C. ");
}
$criteriaBoxMessage.remove();
$criteriaBox.append(cc.createMessage({
text: text,
icons: icons,
big: true
}));
if (votes.length && (resultsTable.totalVotes === votes.length || !resultsTable.totalVotes && resultsTable.totalVotes !== 0)) {
$criteriaBox.append(cc.createMessage({
text: 'Так как участники не всегда корректно используют вики-разметку, нет гарантии, что скрипт верно извлёк все голоса. Пожалуйста, убедитесь, что все голоса были проверены: пройдитесь по списку голосов и удостоверьтесь, что у каждого голоса стоит отметка. ',
icon: 'warning'
}));
} else if (resultsTable.totalVotes || resultsTable.totalVotes === 0) {
$criteriaBox.append(cc.createMessage({
text: "<b>\u0427\u0438\u0441\u043B\u043E \u0433\u043E\u043B\u043E\u0441\u043E\u0432 \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u043E \u0442\u0430\u0431\u043B\u0438\u0446\u0435 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u043E\u0432 (".concat(resultsTable.totalVotes, ") \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u0447\u0438\u0441\u043B\u043E\u043C \u0433\u043E\u043B\u043E\u0441\u043E\u0432 \u0441 \u0442\u043E\u0447\u043A\u0438 \u0437\u0440\u0435\u043D\u0438\u044F \u0441\u043A\u0440\u0438\u043F\u0442\u0430 (").concat(votes.length, ").</b> ") + (resultsTable.totalVotes > votes.length ? 'Пожалуйста, пройдитесь по списку голосов, найдите недостающие голоса и проверьте их вручную. ' : 'Пожалуйста, пройдитесь по списку голосов и удостоверьтесь в том, что отметки на них стоят корректно. '),
icon: 'warning'
}));
}
case 109:
case "end":
return _context2.stop();
}
}
}, _callee2, null, [[30, 38], [67, 71, 75, 83], [76,, 78, 82]]);
}));
function checkAll() {
return _checkAll.apply(this, arguments);
}
return checkAll;
}(),
checkCandidate: function () {
var _checkCandidate = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee3() {
var $checkingMessage, summary, message, fitsOtherCriteria, text, _iteratorNormalCompletion5, _didIteratorError5, _iteratorError5, _iterator5, _step5, result, _text4, _text5, _text6, distance;
return regenerator_default.a.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
hideButton('checkCandidate');
$checkingMessage = cc.createMessage({
icon: 'loading',
text: 'Проверяем кандидата…',
big: true
}).appendTo($criteriaBox);
message = {
icons: [],
texts: []
};
fitsOtherCriteria = true;
_context3.prev = 4;
_context3.t0 = cc;
_context3.next = 8;
return candidate.check(candidateCriteria);
case 8:
_context3.t1 = _context3.sent;
summary = _context3.t0.summarize.call(_context3.t0, _context3.t1);
_context3.next = 17;
break;
case 12:
_context3.prev = 12;
_context3.t2 = _context3["catch"](4);
console.error(_context3.t2);
message = {
icons: ['error'],
texts: ['Не удалось завершить проверку. См. подробности в консоли (F12 → Консоль). ']
};
showButton('checkCandidate');
case 17:
if (!summary) {
_context3.next = 51;
break;
}
if (!(summary.conclusion === 'meets')) {
_context3.next = 22;
break;
}
message = {
icons: ['check'],
texts: []
};
_context3.next = 49;
break;
case 22:
if (!(summary.conclusion === 'notMeets')) {
_context3.next = 28;
break;
}
text = "\u041A\u0430\u043D\u0434\u0438\u0434\u0430\u0442 \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044E: <em>".concat(summary.firstFailedResult.criterion.text, "</em>. ");
if (summary.firstFailedResult.criterion.type === 'editCountNotLess') {
text += "\u0423 \u043D\u0435\u0433\u043E \u0442\u043E\u043B\u044C\u043A\u043E ".concat(summary.firstFailedResult.editCount, " \u043F\u0440\u0430\u0432\u043E\u043A. ");
}
message = {
icons: ['close'],
texts: [text]
};
_context3.next = 49;
break;
case 28:
if (!(summary.conclusion === 'possiblyMeets')) {
_context3.next = 49;
break;
}
message.icons = ['help'];
_iteratorNormalCompletion5 = true;
_didIteratorError5 = false;
_iteratorError5 = undefined;
_context3.prev = 33;
for (_iterator5 = summary.results.filter(cc.util.otherThanMeets)[Symbol.iterator](); !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
result = _step5.value;
if (result.result === 'notEnoughRights') {
_text4 = "\u0423 \u0432\u0430\u0441 \u043D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043F\u0440\u0430\u0432, \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0432\u0441\u0435 \u0434\u0430\u043D\u043D\u044B\u0435, \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u0435 \u0434\u043B\u044F \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u044F \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044F \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044E: <em>".concat(result.criterion.text, "</em>. \u0421\u043E\u0433\u043B\u0430\u0441\u043D\u043E \u0442\u0435\u043C \u0434\u0430\u043D\u043D\u044B\u043C, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C, \u043A\u0430\u043D\u0434\u0438\u0434\u0430\u0442 \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044F\u043C. ");
message.texts.push(_text4);
fitsOtherCriteria = false;
} else if (result.result === 'needsManualCheck') {
_text5 = "\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0440\u0443\u0447\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044F \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044E: <em>".concat(result.criterion.text, "</em>. ");
if (result.criterion.comment) {
_text5 += result.criterion.comment + ' ';
}
message.texts.push(_text5);
} else if (result.result === 'possiblyMeets') {
_text6 = "\u041A\u0430\u043D\u0434\u0438\u0434\u0430\u0442 \u043C\u043E\u0436\u0435\u0442 \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044E: <em>".concat(result.criterion.text, "</em>. ");
if (result.criterion.type === 'hadFlagFor') {
distance = period % (1000 * 60 * 60 * 24);
_text6 += "\u041A\u0430\u043D\u0434\u0430\u0434\u0430\u0442 \u043E\u0431\u043B\u0430\u0434\u0430\u043B \u0444\u043B\u0430\u0433\u043E\u043C ".concat(result.flag, " \u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435 ").concat(plural(distance, 'дня', 'дней', 'дней'), ". ");
}
message.texts.push(_text6);
}
}
_context3.next = 41;
break;
case 37:
_context3.prev = 37;
_context3.t3 = _context3["catch"](33);
_didIteratorError5 = true;
_iteratorError5 = _context3.t3;
case 41:
_context3.prev = 41;
_context3.prev = 42;
if (!_iteratorNormalCompletion5 && _iterator5["return"] != null) {
_iterator5["return"]();
}
case 44:
_context3.prev = 44;
if (!_didIteratorError5) {
_context3.next = 47;
break;
}
throw _iteratorError5;
case 47:
return _context3.finish(44);
case 48:
return _context3.finish(41);
case 49:
if (summary.result === 'meets') {
message.texts.push('Кандидат соответствует требованиям для выдвижения. ');
}
if (summary.conclusion === 'possiblyMeets' && fitsOtherCriteria) {
message.texts[message.texts.length - 1] += 'Остальным требованиям кандидат соответствует. ';
}
case 51:
message.big = true;
$checkingMessage.remove();
$criteriaBox.append(cc.createMessage(message));
case 54:
case "end":
return _context3.stop();
}
}
}, _callee3, null, [[4, 12], [33, 37, 41, 49], [42,, 44, 48]]);
}));
function checkCandidate() {
return _checkCandidate.apply(this, arguments);
}
return checkCandidate;
}()
});
// CONCATENATED MODULE: ./src/applications/arbcom.js
/* harmony default export */ var arbcom = ({
getVoterCriteria: function getVoterCriteria(nominationStartDate) {
return [{
text: 'стаж не менее трёх месяцев',
type: 'registrationDateNotLater',
// addDays, потому что трактовка с датой невключительно закреплена на основных страницах
// выборов
value: addDays(subMonths(nominationStartDate, 3), 1)
}, {
text: 'не менее 500 действий к началу выдвижения кандидатов',
type: 'actionCountNotLess',
value: 500,
periodEnd: nominationStartDate,
filterVotes: true
}, {
text: 'не менее 100 действий за последние полгода до начала выдвижения кандидатов',
type: 'actionCountNotLess',
value: 100,
periodStart: subMonths(nominationStartDate, 6),
periodEnd: nominationStartDate,
filterVotes: true
}];
},
getCandidateCriteria: function getCandidateCriteria(nominationStartDate) {
return [{
text: 'с момента регистрации в русской Википедии до момента начала номинации кандидатов прошло не менее 8 месяцев',
type: 'registrationDateNotLater',
// addDays, потому что эта трактовка закреплена на основных страницах выборов
value: addDays(subMonths(nominationStartDate, 8), 1)
}, {
text: 'сделал в русской Википедии не менее 2000 правок до момента начала номинации',
type: 'editCountNotLess',
value: 2000,
periodEnd: nominationStartDate
}, {
text: 'Кандидатом в арбитры не может быть бессрочно заблокированный участник, а также участник, имеющий на момент начала выдвижения кандидатур блокировку, срок действия которой истекает после окончания процедуры обсуждения кандидатур арбитров',
type: 'noActiveBlockBetweenDates',
ns: 4,
periodStart: nominationStartDate,
periodEnd: addDays(nominationStartDate, 10)
}];
},
extractVoters: function () {
var _extractVoters = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee(election) {
var response, text, content, $sandbox, $userLinks, voters;
return regenerator_default.a.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (election) {
_context.next = 2;
break;
}
return _context.abrupt("return");
case 2:
election = encodeURI(election.replace(/ /g, '_'));
_context.next = 5;
return fetch("https://ru.wikipedia.org/wiki/%D0%92%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%8F:%D0%92%D1%8B%D0%B1%D0%BE%D1%80%D1%8B_%D0%B0%D1%80%D0%B1%D0%B8%D1%82%D1%80%D0%BE%D0%B2/".concat(election, "/%D0%93%D0%BE%D0%BB%D0%BE%D1%81%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5/*"), {
credentials: 'omit'
});
case 5:
response = _context.sent;
_context.next = 8;
return response.text();
case 8:
text = _context.sent;
content = text.replace(/^[\s\S]+id="mw-content-text"[^>]+>/, '').replace(/<\/div><noscript>[\s\S]+$/, '');
$sandbox = $('<div>').addClass('criteriaCheck-sandbox').append(content).appendTo('body');
$userLinks = $sandbox.find('.mw-parser-output table:has(td[id]) a').filter(cc.util.filterUserLinks);
voters = cc.util.removeDuplicates($userLinks.map(function (i, el) {
return cc.util.getUserNameFromLink($(el));
}).get());
$sandbox.remove();
return _context.abrupt("return", voters);
case 15:
case "end":
return _context.stop();
}
}
}, _callee);
}));
function extractVoters(_x) {
return _extractVoters.apply(this, arguments);
}
return extractVoters;
}()
});
// CONCATENATED MODULE: ./src/index.js
mw.loader.using(['mediawiki.api', 'mediawiki.util', 'oojs', 'oojs-ui']).done(function () {
cc.util = util;
cc.admin = admin;
cc.arbcom = arbcom;
cc.customHandlers = [];
cc.createMessage = function (message, anchor) {
function parseText(text) {
mw.messages.set('criteriaCheck-temp', text);
return mw.message('criteriaCheck-temp').parse();
}
if (!message.icons) {
message.icons = message.icon ? [message.icon] : [];
}
var $icons = message.icons.map(function (icon) {
return $('<span>').addClass('criteriaCheck-icon').addClass('criteriaCheck-icon-' + icon);
});
if (!message.texts) {
message.texts = message.text ? [message.text] : [];
}
var text = message.texts.length === 1 ? message.texts[0] : message.texts.reduce(function (s, text, i) {
return "".concat(s).concat(i + 1, ". ").concat(text, " ");
}, '');
var $el = $(text ? '<div>' : '<span>').addClass('criteriaCheck-message').attr('id', anchor).append($icons);
if (text) {
text = parseText(text);
var $text = $('<span>').append(text);
$el.addClass('criteriaCheck-message-withText').append($text);
}
if (message.accented) {
$el.addClass('criteriaCheck-message-accented');
}
if (message.big) {
$el.addClass('criteriaCheck-message-big');
}
return $el;
};
cc.getUser = function (name) {
if (!name) return;
cc.users = cc.users || [];
if (!cc.users[name]) {
cc.users[name] = new User_User(name);
}
return cc.users[name];
};
cc.extractCriteria = function ($container) {
return $container.find('[data-criterion]').map(function () {
var data = Object.assign({}, $(this).data());
data.text = $(this).text().replace(/[,;.]$/, '');
data.type = data.criterion;
delete data.criterion;
return data;
}).get();
};
cc.summarize = function (results) {
var details = [];
var conclusion = 'meets';
var warnings = [];
var summary = {};
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = results[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var result = _step.value;
if (result.result === 'userMissing') {
conclusion = 'userMissing';
break;
} else if (result.result === 'notMeets') {
conclusion = 'notMeets';
summary.firstFailedResult = result;
} else if (['possiblyMeets', 'notEnoughRights', 'needsManualCheck'].indexOf(result.result) !== -1 && conclusion !== 'notMeets') {
conclusion = 'possiblyMeets';
}
if (['notEnoughRights', 'needsManualCheck'].indexOf(result.result) !== -1) {
warnings.push(result.result);
}
if (result.overallEditCount === 0) {
warnings.push('0edits');
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
warnings = cc.util.removeDuplicates(warnings);
if (conclusion !== 'userMissing') {
summary.results = results;
summary.warnings = warnings;
}
summary.conclusion = conclusion;
summary.user = results && results[0].user;
return summary;
};
cc.check =
/*#__PURE__*/
function () {
var _ref = asyncToGenerator_default()(
/*#__PURE__*/
regenerator_default.a.mark(function _callee(userNames, criteria, callback) {
var doSummarize,
results,
_iteratorNormalCompletion2,
_didIteratorError2,
_iteratorError2,
_iterator2,
_step2,
userName,
result,
_args = arguments;
return regenerator_default.a.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
doSummarize = _args.length > 3 && _args[3] !== undefined ? _args[3] : true;
if (typeof userNames === 'string') {
userNames = [userNames];
}
results = [];
_iteratorNormalCompletion2 = true;
_didIteratorError2 = false;
_iteratorError2 = undefined;
_context.prev = 6;
_iterator2 = userNames[Symbol.iterator]();
case 8:
if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {
_context.next = 19;
break;
}
userName = _step2.value;
_context.next = 12;
return cc.getUser(userName).check(criteria);
case 12:
result = _context.sent;
if (doSummarize) {
result = cc.summarize(result);
}
results.push(result);
if (callback) {
callback(result);
}
case 16:
_iteratorNormalCompletion2 = true;
_context.next = 8;
break;
case 19:
_context.next = 25;
break;
case 21:
_context.prev = 21;
_context.t0 = _context["catch"](6);
_didIteratorError2 = true;
_iteratorError2 = _context.t0;
case 25:
_context.prev = 25;
_context.prev = 26;
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
case 28:
_context.prev = 28;
if (!_didIteratorError2) {
_context.next = 31;
break;
}
throw _iteratorError2;
case 31:
return _context.finish(28);
case 32:
return _context.finish(25);
case 33:
return _context.abrupt("return", results);
case 34:
case "end":
return _context.stop();
}
}
}, _callee, null, [[6, 21, 25, 33], [26,, 28, 32]]);
}));
return function (_x, _x2, _x3) {
return _ref.apply(this, arguments);
};
}();
cc.addHandler = function (criterionType, handler) {
cc.customHandlers[criterionType] = handler;
};
cc.currentUser = cc.getUser(mw.config.get('wgUserName'));
if (cc.admin.isRelevantPage()) {
cc.admin.main();
} // Предзагружаем иконки
var $div = $('<div>').css({
position: 'absolute',
top: -10000
}).append(cc.createMessage({
icons: ['check', 'close', 'help', 'error', 'loading', 'warning']
})).appendTo('body');
setTimeout(function () {
$div.remove();
}, 1);
});
/***/ })
/******/ ]);