diff --git a/README.md b/README.md
index 40fb9a0a..29af56b2 100644
--- a/README.md
+++ b/README.md
@@ -475,6 +475,8 @@ wtf
- **.title()** - get/set the title of the page from the first-sentence
- **.pageID()** - get/set the wikimedia id of the page, if we have it.
+- **.wikidata()** - get/set the wikidata id of the page, if we have it.
+- **.domain()** - get/set the domain of the wiki we're on, if we have it.
- **.url()** - (try to) generate the url for the current article
- **.lang()** - get/set the current language (used for url method)
- **.namespace()** - get/set the wikimedia namespace of the page, if we have it
@@ -654,6 +656,9 @@ wtf.fetch('2016-06-04_-_J.Fernandes_@_FIL,_Lisbon', { domain: 'www.mixesdb.com',
})
```
+for image-urls to work properly, the wiki should also have `Special:Redirect` enabled.
+Some wikis, (like wikia) have intentionally disabled this.
+
### i18n and multi-language:
wikitext is (amazingly) used across all languages, wikis, and even in right-to-left languages.
diff --git a/builds/wtf_wikipedia-client.js b/builds/wtf_wikipedia-client.js
index 450ad04d..ba30f168 100644
--- a/builds/wtf_wikipedia-client.js
+++ b/builds/wtf_wikipedia-client.js
@@ -1,4 +1,4 @@
-/* wtf_wikipedia 8.3.0 MIT */
+/* wtf_wikipedia 8.4.0 MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
@@ -74,7 +74,7 @@
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return Array.from(n);
+ if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
@@ -93,7 +93,7 @@
var isInterWiki = /(wiktionary|wikinews|wikibooks|wikiquote|wikisource|wikispecies|wikiversity|wikivoyage|wikipedia|wikimedia|foundation|meta)\.org/;
var defaults = {
action: 'query',
- prop: 'revisions',
+ prop: 'revisions|pageprops',
//we use the 'revisions' api here, instead of the Raw api, for its CORS-rules..
rvprop: 'content',
maxlag: 5,
@@ -185,10 +185,20 @@
text = page.revisions[0].slots.main['*'];
}
+ page.pageprops = page.pageprops || {};
+ var domain = options.domain;
+
+ if (!domain && options.wiki) {
+ domain = "".concat(options.wiki, ".org");
+ }
+
var meta = Object.assign({}, options, {
title: page.title,
pageID: page.pageid,
- namespace: page.ns
+ namespace: page.ns,
+ domain: domain,
+ wikidata: page.pageprops.wikibase_item,
+ description: page.pageprops['wikibase-shortdesc']
});
try {
@@ -553,7 +563,7 @@
var toJson_1 = toJson$1;
- var server = 'https://wikipedia.org/wiki/Special:Redirect/file/';
+ var server = 'wikipedia.org';
var encodeTitle = function encodeTitle(file) {
var title = file.replace(/^(image|file?)\:/i, ''); //titlecase it
@@ -604,12 +614,15 @@
return [];
},
url: function url() {
- return server + makeSrc(this.file());
+ // let lang = 'en' //this.language() || 'en' //hmm: get actual language?
+ var fileName = makeSrc(this.file());
+ var domain = this.data.domain || server;
+ var path = "wiki/Special:Redirect/file";
+ return "https://".concat(domain, "/").concat(path, "/").concat(fileName);
},
thumbnail: function thumbnail(size) {
size = size || 300;
- var path = makeSrc(this.file());
- return server + path + '?width=' + size;
+ return this.url() + '?width=' + size;
},
format: function format() {
var arr = this.file().split('.');
@@ -678,6 +691,20 @@
return this.data.pageID;
},
+ wikidata: function wikidata(id) {
+ if (id !== undefined) {
+ this.data.wikidata = id;
+ }
+
+ return this.data.wikidata;
+ },
+ domain: function domain(str) {
+ if (str !== undefined) {
+ this.data.domain = str;
+ }
+
+ return this.data.domain;
+ },
language: function language(lang) {
if (lang !== undefined) {
this.data.lang = lang;
@@ -693,7 +720,7 @@
}
var lang = this.language() || 'en';
- var domain = this.data.domain || 'wikipedia.org'; // replace blank to underscore
+ var domain = this.domain() || 'wikipedia.org'; // replace blank to underscore
title = title.replace(/ /g, '_');
title = encodeURIComponent(title);
@@ -780,6 +807,8 @@
return this.sentences(0);
},
images: function images(clue) {
+ var _this2 = this;
+
var arr = _sectionMap(this, 'images', null); //grab image from infobox, first
this.infoboxes().forEach(function (info) {
@@ -795,6 +824,8 @@
obj.images = obj.images || [];
obj.images.forEach(function (img) {
if (img instanceof Image_1 === false) {
+ img.language = _this2.language();
+ img.domain = _this2.domain();
img = new Image_1(img);
}
@@ -2171,7 +2202,7 @@
var ignore_links = /^:?(category|catégorie|Kategorie|Categoría|Categoria|Categorie|Kategoria|تصنيف|image|file|image|fichier|datei|media):/i;
var external_link = /\[(https?|news|ftp|mailto|gopher|irc)(:\/\/[^\]\| ]{4,1500})([\| ].*?)?\]/g;
- var link_reg = /\[\[(.{0,160}?)\]\]([a-z]+)?(\w{0,10})/gi; //allow dangling suffixes - "[[flanders]]s"
+ var link_reg = /\[\[(.{0,160}?)\]\]([a-z]+)?/gi; //allow dangling suffixes - "[[flanders]]s"
var external_links = function external_links(links, str) {
str.replace(external_link, function (raw, protocol, link, text) {
@@ -2323,11 +2354,17 @@
//only kill ref tags if they are selfclosing
wiki = wiki.replace(/ ?< ?(ref) [a-zA-Z0-9=" ]{2,100}\/ ?> ?/g, ' '); //
- //some formatting xml, we'll keep their insides though
+ // convert these html tags to known formatting
+
+ wiki = wiki.replace(/(.*?)<\/i>/g, "''$1''");
+ wiki = wiki.replace(/(.*?)<\/b>/g, "'''$1'''"); // these are better-handled with templates
+
+ wiki = wiki.replace(/(.*?)<\/sub>/g, "{{sub|$1}}");
+ wiki = wiki.replace(/(.*?)<\/sup>/g, "{{sup|$1}}"); //some formatting xml, we'll keep their insides though
wiki = wiki.replace(/ ?<[ \/]?(p|sub|sup|span|nowiki|div|table|br|tr|td|th|pre|pre2|hr)[ \/]?> ?/g, ' '); //,
- wiki = wiki.replace(/ ?<[ \/]?(abbr|bdi|bdo|blockquote|cite|del|dfn|em|i|ins|kbd|mark|q|s|small)[ \/]?> ?/g, ' '); //,
+ wiki = wiki.replace(/ ?<[ \/]?(abbr|bdi|bdo|blockquote|cite|del|dfn|em|ins|kbd|mark|q|s|small)[ \/]?> ?/g, ' '); //,
wiki = wiki.replace(/ ?<[ \/]?h[0-9][ \/]?> ?/g, ' '); //,
@@ -4354,7 +4391,7 @@
"super": true
}; //images are usually [[image:my_pic.jpg]]
- var oneImage = function oneImage(img) {
+ var oneImage = function oneImage(img, doc) {
var m = img.match(file_reg);
if (m === null || !m[2]) {
@@ -4370,7 +4407,9 @@
if (title) {
var obj = {
- file: file
+ file: file,
+ lang: doc.lang,
+ domain: doc.domain
}; //try to grab other metadata, too
img = img.replace(/^\[\[/, '');
@@ -4393,20 +4432,20 @@
obj.caption = parseSentence$4(arr[arr.length - 1]);
}
- return new Image_1(obj, img);
+ return new Image_1(obj);
}
return null;
};
- var parseImages = function parseImages(paragraph) {
+ var parseImages = function parseImages(paragraph, doc) {
var wiki = paragraph.wiki; //parse+remove scary '[[ [[]] ]]' stuff
var matches = nested_find_1(wiki);
matches.forEach(function (s) {
if (isFile.test(s) === true) {
paragraph.images = paragraph.images || [];
- var img = oneImage(s);
+ var img = oneImage(s, doc);
if (img) {
paragraph.images.push(img);
@@ -4563,7 +4602,7 @@
list: list
};
- var parseParagraphs = function parseParagraphs(section) {
+ var parseParagraphs = function parseParagraphs(section, doc) {
var wiki = section.wiki;
var paragraphs = wiki.split(twoNewLines); //don't create empty paragraphs
@@ -4580,7 +4619,7 @@
parse$5.list(paragraph); // parse images
- parse$5.image(paragraph); //parse the sentences
+ parse$5.image(paragraph, doc); //parse the sentences
parseSentences(paragraph);
return new Paragraph_1(paragraph);
@@ -4618,6 +4657,7 @@
var Infobox = function Infobox(obj) {
this._type = obj.type;
+ this.domain = obj.domain;
Object.defineProperty(this, 'data', {
enumerable: false,
value: obj.data
@@ -4662,6 +4702,8 @@
var obj = s.json();
obj.file = obj.text;
obj.text = '';
+ obj.domain = this.domain; // add domain information for image
+
return new Image_1(obj);
},
get: function get() {
@@ -5722,6 +5764,18 @@
}
return str;
+ },
+ //https://en.wikipedia.org/wiki/Template:Sub
+ sub: function sub(tmpl, list) {
+ var obj = parse$3(tmpl, ['text']);
+ list.push(obj);
+ return obj.text || '';
+ },
+ //https://en.wikipedia.org/wiki/Template:Sup
+ sup: function sup(tmpl, list) {
+ var obj = parse$3(tmpl, ['text']);
+ list.push(obj);
+ return obj.text || '';
}
}; //aliases
@@ -6344,19 +6398,19 @@
return '';
},
// https://en.wikipedia.org/wiki/Template:See
- 'see': function see(tmpl, list) {
+ see: function see(tmpl, list) {
var obj = parse$3(tmpl);
list.push(obj);
return '';
},
// https://en.wikipedia.org/wiki/Template:For
- 'for': function _for(tmpl, list) {
+ "for": function _for(tmpl, list) {
var obj = parse$3(tmpl);
list.push(obj);
return '';
},
// https://en.wikipedia.org/wiki/Template:Further
- 'further': function further(tmpl, list) {
+ further: function further(tmpl, list) {
var obj = parse$3(tmpl);
list.push(obj);
return '';
@@ -6368,7 +6422,7 @@
return '';
},
// https://en.wikipedia.org/wiki/Template:Listen
- 'listen': function listen(tmpl, list) {
+ listen: function listen(tmpl, list) {
var obj = parse$3(tmpl);
list.push(obj);
return '';
@@ -6472,7 +6526,8 @@
images = images.map(function (file) {
var img = {
file: file
- };
+ }; // TODO: add lang and domain information
+
return new Image_1(img).json();
});
obj = {
@@ -6602,7 +6657,7 @@
}; //a bunch of aliases for these ones:
// https://en.wikipedia.org/wiki/Category:Tournament_bracket_templates
- var brackets = ['2teambracket', '4team2elimbracket', '8teambracket', '16teambracket', '32teambracket', 'cwsbracket', 'nhlbracket', 'nhlbracket-reseed', '4teambracket-nhl', '4teambracket-ncaa', '4teambracket-mma', '4teambracket-mlb', '8teambracket-nhl', '8teambracket-mlb', '8teambracket-ncaa', '8teambracket-afc', '8teambracket-afl', '8teambracket-tennis3', '8teambracket-tennis5', '16teambracket-nhl', '16teambracket-nhl divisional', '16teambracket-nhl-reseed', '16teambracket-nba', '16teambracket-swtc', '16teambracket-afc', '16teambracket-tennis3', '16teambracket-tennis5'];
+ var brackets = ['2teambracket', '4team2elimbracket', '8teambracket', '16teambracket', '32teambracket', '4roundbracket-byes', 'cwsbracket', 'nhlbracket', 'nhlbracket-reseed', '4teambracket-nhl', '4teambracket-ncaa', '4teambracket-mma', '4teambracket-mlb', '16teambracket-two-reseeds', '8teambracket-nhl', '8teambracket-mlb', '8teambracket-ncaa', '8teambracket-afc', '8teambracket-afl', '8teambracket-tennis3', '8teambracket-tennis5', '16teambracket-nhl', '16teambracket-nhl divisional', '16teambracket-nhl-reseed', '16teambracket-nba', '16teambracket-swtc', '16teambracket-afc', '16teambracket-tennis3', '16teambracket-tennis5'];
brackets.forEach(function (key) {
all[key] = all['4teambracket'];
});
@@ -8174,7 +8229,7 @@
}; //reduce the scary recursive situations
- var allTemplates = function allTemplates(section) {
+ var allTemplates = function allTemplates(section, doc) {
var wiki = section.wiki; // nested data-structure of templates
var list = find(wiki);
@@ -8219,6 +8274,8 @@
}
if (isInfobox$1(obj) === true) {
+ obj.domain = doc.domain; //
+
section.infoboxes.push(new Infobox_1(obj));
return false;
}
@@ -8241,7 +8298,7 @@
//all deities help us. truly -> https://en.wikipedia.org/wiki/Help:Gallery_tag
// - not to be confused with https://en.wikipedia.org/wiki/Template:Gallery...
- var parseGallery = function parseGallery(section) {
+ var parseGallery = function parseGallery(section, doc) {
var wiki = section.wiki;
wiki = wiki.replace(/]*?)>([\s\S]+?)<\/gallery>/g, function (_, attrs, inside) {
var images = inside.split(/\n/g);
@@ -8252,7 +8309,9 @@
images = images.map(function (str) {
var arr = str.split(/\|/);
var obj = {
- file: arr[0].trim()
+ file: arr[0].trim(),
+ lang: doc.language,
+ domain: doc.domain
};
var img = new Image_1(obj).json();
var caption = arr.slice(1).join('|');
@@ -8462,9 +8521,9 @@
// ... others are {{start}}...{{end}}
// -> these are those ones.
- var xmlTemplates = function xmlTemplates(section) {
+ var xmlTemplates = function xmlTemplates(section, doc) {
election(section);
- gallery(section);
+ gallery(section, doc);
math$1(section);
mlb(section);
mma(section);
@@ -8486,11 +8545,11 @@
};
var oneSection = function oneSection(section, doc) {
- parse$6.startEndTemplates(section); //parse-out the tags
+ parse$6.startEndTemplates(section, doc); //parse-out the tags
parse$6.references(section); //parse-out all {{templates}}
- parse$6.templates(section); // //parse the tables
+ parse$6.templates(section, doc); // //parse the tables
parse$6.table(section); //now parse all double-newlines
@@ -8764,7 +8823,7 @@
url = "https://".concat(options.domain, "/").concat(options.path, "?");
}
- url += "format=json&action=query&generator=random&grnnamespace=0&prop=revisions&rvprop=content&grnlimit=1&rvslots=main&origin=*";
+ url += "format=json&action=query&generator=random&grnnamespace=0&prop=revisions|pageprops&rvprop=content&grnlimit=1&rvslots=main&origin=*";
var headers = _headers(options);
return client(url, headers).then(function (res) {
try {
@@ -8879,7 +8938,7 @@
var category = fetchCategory;
- var _version = '8.3.0';
+ var _version = '8.4.0';
var wtf = function wtf(wiki, options) {
return _01Document(wiki, options);
diff --git a/builds/wtf_wikipedia-client.min.js b/builds/wtf_wikipedia-client.min.js
index a7d1302d..c716c579 100644
--- a/builds/wtf_wikipedia-client.min.js
+++ b/builds/wtf_wikipedia-client.min.js
@@ -1 +1 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).wtf=t()}(this,(function(){"use strict";var e=function(e){var t=new URL(e),i=t.pathname.replace(/^\/(wiki\/)?/,"");return i=decodeURIComponent(i),{domain:t.host,title:i}};function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var i=[],n=!0,a=!1,r=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(i.push(o.value),!t||i.length!==t);n=!0);}catch(e){a=!0,r=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw r}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return n(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);iObject.keys(t.data).length?-1:1})),"number"==typeof e?t[e]:t},text:function(e){return e=p(e,E),!0===this.isRedirect()?"":this.sections().map((function(t){return t.text(e)})).join("\n\n")},json:function(e){return e=p(e,E),d(this,e)},debug:function(){return console.log("\n"),this.sections().forEach((function(e){for(var t=" - ",i=0;i500)&&U.test(e)},K=function(e){var t=e.match(U);return t&&t[2]?(R(t[2])||[])[0]:{}},B=["table","code","score","data","categorytree","charinsert","hiero","imagemap","inputbox","nowiki","poem","references","source","syntaxhighlight","timeline"],W="< ?(".concat(B.join("|"),") ?[^>]{0,200}?>"),Y="< ?/ ?(".concat(B.join("|"),") ?>"),Z=new RegExp("".concat(W,"[").concat("\\s\\S","]+?").concat(Y),"ig"),G=function(e){return(e=(e=(e=(e=(e=(e=(e=e.replace(Z," ")).replace(/ ?< ?(span|div|table|data) [a-zA-Z0-9=%\.#:;'" ]{2,100}\/? ?> ?/g," ")).replace(/ ?< ?(ref) [a-zA-Z0-9=" ]{2,100}\/ ?> ?/g," ")).replace(/ ?<[ \/]?(p|sub|sup|span|nowiki|div|table|br|tr|td|th|pre|pre2|hr)[ \/]?> ?/g," ")).replace(/ ?<[ \/]?(abbr|bdi|bdo|blockquote|cite|del|dfn|em|i|ins|kbd|mark|q|s|small)[ \/]?> ?/g," ")).replace(/ ?<[ \/]?h[0-9][ \/]?> ?/g," ")).replace(/ ?< ?br ?\/> ?/g,"\n")).trim()};var H=function(e){var t=e.wiki;t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(//g,"")).replace(/__(NOTOC|NOEDITSECTION|FORCETOC|TOC)__/gi,"")).replace(/~~{1,3}/g,"")).replace(/\r/g,"")).replace(/\u3002/g,". ")).replace(/----/g,"")).replace(/\{\{\}\}/g," – ")).replace(/\{\{\\\}\}/g," / ")).replace(/ /g," "),t=(t=(t=G(t)).replace(/\([,;: ]+?\)/g,"")).replace(/{{(baseball|basketball) (primary|secondary) (style|color).*?\}\}/i,""),e.wiki=t},V=/[\\\.$]/,J=function(e){return"string"!=typeof e&&(e=""),e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/^\$/,"\\u0024")).replace(/\./g,"\\u002e")},Q=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.keys(e),i=0;i0&&(i.paragraphs=n)}if(!0===t.images){var a=e.images().map((function(e){return e.json(t)}));a.length>0&&(i.images=a)}if(!0===t.tables){var r=e.tables().map((function(e){return e.json(t)}));r.length>0&&(i.tables=r)}if(!0===t.templates){var o=e.templates();o.length>0&&(i.templates=o,!0===t.encode&&i.templates.forEach((function(e){return Q(e)})))}if(!0===t.infoboxes){var s=e.infoboxes().map((function(e){return e.json(t)}));s.length>0&&(i.infoboxes=s)}if(!0===t.lists){var c=e.lists().map((function(e){return e.json(t)}));c.length>0&&(i.lists=c)}if(!0===t.references||!0===t.citations){var u=e.references().map((function(e){return e.json(t)}));u.length>0&&(i.references=u)}return!0===t.sentences&&(i.sentences=e.sentences().map((function(e){return e.json(t)}))),i},te={tables:!0,references:!0,paragraphs:!0,templates:!0,infoboxes:!0},ie=function(e){this.depth=e.depth,this.doc=null,this._title=e.title||"",Object.defineProperty(this,"doc",{enumerable:!1,value:null}),e.templates=e.templates||[],Object.defineProperty(this,"data",{enumerable:!1,value:e})},ne={title:function(){return this._title||""},index:function(){if(!this.doc)return null;var e=this.doc.sections().indexOf(this);return-1===e?null:e},indentation:function(){return this.depth},sentences:function(e){var t=this.paragraphs().reduce((function(e,t){return e.concat(t.sentences())}),[]);return"number"==typeof e?t[e]:t||[]},paragraphs:function(e){var t=this.data.paragraphs||[];return"number"==typeof e?t[e]:t||[]},paragraph:function(e){var t=this.data.paragraphs||[];return"number"==typeof e?t[e]:t[0]},links:function(e){var t=[];if(this.infoboxes().forEach((function(i){i.links(e).forEach((function(e){return t.push(e)}))})),this.sentences().forEach((function(i){i.links(e).forEach((function(e){return t.push(e)}))})),this.tables().forEach((function(i){i.links(e).forEach((function(e){return t.push(e)}))})),this.lists().forEach((function(i){i.links(e).forEach((function(e){return t.push(e)}))})),"number"==typeof e)return t[e];if("string"==typeof e){e=e.charAt(0).toUpperCase()+e.substring(1);var i=t.find((function(t){return t.page()===e}));return void 0===i?[]:[i]}return t},tables:function(e){var t=this.data.tables||[];return"number"==typeof e?t[e]:t},templates:function(e){var t=this.data.templates||[];return t=t.map((function(e){return e.json()})),"number"==typeof e?t[e]:"string"==typeof e?(e=e.toLowerCase(),t.filter((function(t){return t.template===e||t.name===e}))):t},infoboxes:function(e){var t=this.data.infoboxes||[];return"number"==typeof e?t[e]:t},coordinates:function(e){var t=[].concat(this.templates("coord"),this.templates("coor"));return"number"==typeof e?t[e]?t[e]:[]:t},lists:function(e){var t=[];return this.paragraphs().forEach((function(e){t=t.concat(e.lists())})),"number"==typeof e?t[e]:t},interwiki:function(e){var t=[];return this.paragraphs().forEach((function(e){t=t.concat(e.interwiki())})),"number"==typeof e?t[e]:t||[]},images:function(e){var t=[];return this.paragraphs().forEach((function(e){t=t.concat(e.images())})),"number"==typeof e?t[e]:t||[]},references:function(e){var t=this.data.references||[];return"number"==typeof e?t[e]:t},remove:function(){if(!this.doc)return null;var e={};e[this.title()]=!0,this.children().forEach((function(t){return e[t.title()]=!0}));var t=this.doc.data.sections;return t=t.filter((function(t){return!0!==e.hasOwnProperty(t.title())})),this.doc.data.sections=t,this.doc},nextSibling:function(){if(!this.doc)return null;for(var e=this.doc.sections(),t=this.index()+1;tthis.depth)for(var a=i+1;athis.depth;a+=1)n.push(t[a]);return"string"==typeof e?(e=e.toLowerCase(),n.find((function(t){return t.title().toLowerCase()===e}))):"number"==typeof e?n[e]:n},parent:function(){if(!this.doc)return null;for(var e=this.doc.sections(),t=this.index();t>=0;t-=1)if(e[t]&&e[t].depth0&&(e.fmt=e.fmt||{},e.fmt.bold=t),i.length>0&&(e.fmt=e.fmt||{},e.fmt.italic=i),e},me=/^[0-9,.]+$/,de={text:!0,links:!0,formatting:!0,numbers:!0},fe=function(e,t){t=p(t,de);var i={},n=e.text();if(!0===t.text&&(i.text=n),!0===t.numbers&&me.test(n)){var a=Number(n.replace(/,/g,""));!1===isNaN(a)&&(i.number=a)}return t.links&&e.links().length>0&&(i.links=e.links().map((function(e){return e.json()}))),t.formatting&&e.data.fmt&&(i.formatting=e.data.fmt),i},ge=function(e){Object.defineProperty(this,"data",{enumerable:!1,value:e})},he={links:function(e){var t=this.data.links||[];if("number"==typeof e)return t[e];if("string"==typeof e){e=e.charAt(0).toUpperCase()+e.substring(1);var i=t.find((function(t){return t.page===e}));return void 0===i?[]:[i]}return t},interwiki:function(e){var t=this.links().filter((function(e){return void 0!==e.wiki}));return"number"==typeof e?t[e]:t},bolds:function(e){var t=[];return this.data&&this.data.fmt&&this.data.fmt.bold&&(t=this.data.fmt.bold||[]),"number"==typeof e?t[e]:t},italics:function(e){var t=[];return this.data&&this.data.fmt&&this.data.fmt.italic&&(t=this.data.fmt.italic||[]),"number"==typeof e?t[e]:t},dates:function(e){var t=[];return"number"==typeof e?t[e]:t},text:function(e){return void 0!==e&&"string"==typeof e&&(this.data.text=e),this.data.text||""},json:function(e){return fe(this,e)}};Object.keys(he).forEach((function(e){ge.prototype[e]=he[e]})),ge.prototype.italic=ge.prototype.italics,ge.prototype.bold=ge.prototype.bolds,ge.prototype.plaintext=ge.prototype.text;var be=ge,ke=["ad","adj","adm","adv","al","alta","approx","apr","apt","arc","ariz","assn","asst","atty","aug","ave","ba","bc","bl","bldg","blvd","brig","bros","ca","cal","calif","capt","cca","cg","cl","cm","cmdr","co","col","colo","comdr","conn","corp","cpl","cres","ct","cyn","dak","dec","def","dept","det","dg","dist","dl","dm","dr","ea","eg","eng","esp","esq","est","etc","ex","exp","feb","fem","fig","fl oz","fl","fla","fm","fr","ft","fy","ga","gal","gb","gen","gov","hg","hon","hr","hrs","hwy","hz","ia","ida","ie","inc","inf","jan","jd","jr","jul","jun","kan","kans","kb","kg","km","kmph","lat","lb","lit","llb","lm","lng","lt","ltd","lx","ma","maj","mar","masc","mb","md","messrs","mg","mi","min","minn","misc","mister","ml","mlle","mm","mme","mph","mps","mr","mrs","ms","mstr","mt","neb","nebr","nee","no","nov","oct","okla","ont","op","ord","oz","pa","pd","penn","penna","phd","pl","pp","pref","prob","prof","pron","ps","psa","pseud","pt","pvt","qt","que","rb","rd","rep","reps","res","rev","sask","sec","sen","sens","sep","sept","sfc","sgt","sir","situ","sq ft","sq","sr","ss","st","supt","surg","tb","tbl","tbsp","tce","td","tel","temp","tenn","tex","tsp","univ","usafa","ut","va","vb","ver","vet","vitro","vivo","vol","vs","vt","wis","wisc","wr","wy","wyo","yb","µg"].concat("[^]][^]]"),we=new RegExp("(^| |')("+ke.join("|")+")[.!?] ?$","i"),ve=new RegExp("[ |.|'|[][A-Z].? *?$","i"),ye=new RegExp("\\.\\.\\.* +?$"),xe=/ c\. $/,$e=new RegExp("[a-zа-яぁ-ゟ][a-zа-яぁ-ゟ゠-ヿ]","iu"),je=function(e){var t=[],i=[];if(!e||"string"!=typeof e||0===e.trim().length)return t;for(var n=function(e){var t=e.split(/(\n+)/);return function(e){var t=[];return e.forEach((function(e){t=t.concat(e)})),t}(t=(t=t.filter((function(e){return e.match(/\S/)}))).map((function(e){return e.split(/(\S.+?[.!?]"?)(?=\s+|$)/g)})))}(e),a=0;ai.length)return!1;var n=e.match(/"/g);return!(n&&n.length%2!=0&&e.length<900)}(o))?i[s+1]=i[s]+(i[s+1]||""):i[s]&&i[s].length>0&&(t.push(i[s]),i[s]="");return 0===t.length?[e]:t};function ze(e){var t,i={text:e};return le(i),i.text=(t=(t=(t=i.text).replace(/\([,;: ]*\)/g,"")).replace(/\( *(; ?)+/g,"("),t=(t=re(t)).replace(/ +\.$/,".")),i=pe(i),new be(i)}var Ee=ze,Oe=function(e){var t=je(e.wiki);(t=t.map(ze))[0]&&t[0].text()&&":"===t[0].text()[0]&&(t=t.slice(1)),e.sentences=t},_e=function(e){return e=(e=e.replace(/^\{\{/,"")).replace(/\}\}$/,"")},Se=function(e){return e=(e=(e=(e||"").trim()).toLowerCase()).replace(/_/g," ")},Ce=function(e){var t=e.split(/\n?\|/);t.forEach((function(e,i){null!==e&&(/\[\[[^\]]+$/.test(e)||/\{\{[^\}]+$/.test(e)||e.split("{{").length!==e.split("}}").length||e.split("[[").length!==e.split("]]").length)&&(t[i+1]=t[i]+"|"+t[i+1],t[i]=null)}));for(var i=(t=(t=t.filter((function(e){return null!==e}))).map((function(e){return(e||"").trim()}))).length-1;i>=0;i-=1){""===t[i]&&t.pop();break}return t},qe=/^[ '-\)\x2D\.0-9_a-z\xC0-\xFF\u0153\u017F\u1E9E\u212A\u212B]+=/i,Ne={template:!0,list:!0,prototype:!0},Ae=function(e,t){var i=0;return e.reduce((function(e,n){if(n=(n||"").trim(),!0===qe.test(n)){var a=function(e){var t=e.split("="),i=t[0]||"";i=i.toLowerCase().trim();var n=t.slice(1).join("=");return Ne.hasOwnProperty(i)&&(i="_"+i),{key:i,val:n.trim()}}(n);if(a.key)return e[a.key]=a.val,e}t&&t[i]?e[t[i]]=n:(e.list=e.list||[],e.list.push(n));return i+=1,e}),{})},Le={classname:!0,style:!0,align:!0,margin:!0,left:!0,break:!0,boxsize:!0,framestyle:!0,item_style:!0,collapsible:!0,list_style_type:!0,"list-style-type":!0,colwidth:!0},De=function(e){return Object.keys(e).forEach((function(t){!0===Le[t.toLowerCase()]&&delete e[t],null!==e[t]&&""!==e[t]||delete e[t]})),e},Ie=Ee,Te=function(e,t){var i=Ie(e);return"json"===t?i.json():"raw"===t?i:i.text()},Pe=function(e,t,i){t=t||[],e=_e(e||"");var n=Ce(e),a=n.shift(),r=Ae(n,t);return(r=De(r))[1]&&t[0]&&!1===r.hasOwnProperty(t[0])&&(r[t[0]]=r[1],delete r[1]),Object.keys(r).forEach((function(e){r[e]="list"!==e?Te(r[e],i):r[e].map((function(e){return Te(e,i)}))})),a&&(r.template=Se(a)),r},Me=function(e){Object.defineProperty(this,"data",{enumerable:!1,value:e})},Re={title:function(){var e=this.data;return e.title||e.encyclopedia||e.author||""},links:function(e){var t=[];if("number"==typeof e)return t[e];if("number"==typeof e)return t[e];if("string"==typeof e){e=e.charAt(0).toUpperCase()+e.substring(1);var i=t.find((function(t){return t.page()===e}));return void 0===i?[]:[i]}return t||[]},text:function(){return""},json:function(){return this.data}};Object.keys(Re).forEach((function(e){Me.prototype[e]=Re[e]}));var Ue=Me,Fe=Ee,Ke=function(e){return/^ *?\{\{ *?(cite|citation)/i.test(e)&&/\}\} *?$/.test(e)&&!1===/citation needed/i.test(e)},Be=function(e){var t=Pe(e);return t.type=t.template.replace(/cite /,""),t.template="citation",t},We=function(e){return{template:"citation",type:"inline",data:{},inline:Fe(e)||{}}},Ye=function(e){var t=[],i=e.wiki;i=(i=(i=(i=i.replace(/ ?[([\s\S]{0,1800}?)<\/ref> ?/gi,(function(e,n){if(Ke(n)){var a=Be(n);a&&t.push(a),i=i.replace(n,"")}else t.push(We(n));return" "}))).replace(/ ?][]{0,200}?\/> ?/gi," ")).replace(/ ?][]{0,200}?>([\s\S]{0,1800}?)<\/ref> ?/gi,(function(e,n){if(Ke(n)){var a=Be(n);a&&t.push(a),i=i.replace(n,"")}else t.push(We(n));return" "}))).replace(/ ?<[ \/]?[a-z0-9]{1,8}[a-z0-9=" ]{2,20}[ \/]?> ?/g," "),e.references=t.map((function(e){return new Ue(e)})),e.wiki=i},Ze=Ee,Ge=/^(={1,5})(.{1,200}?)={1,5}$/,He=function(e,t){var i=t.match(Ge);if(!i)return e.title="",e.depth=0,e;var n=i[2]||"",a={wiki:n=(n=Ze(n).text()).replace(/\{\{.+?\}\}/,"")};Ye(a),n=re(n=a.wiki);var r=0;return i[1]&&(r=i[1].length-2),e.title=n,e.depth=r,e},Ve=function(e){var t=[],i=[];e=function(e){return e=e.filter((function(e){return e&&!0!==/^\|\+/.test(e)})),!0===/^{\|/.test(e[0])&&e.shift(),!0===/^\|}/.test(e[e.length-1])&&e.pop(),!0===/^\|-/.test(e[0])&&e.shift(),e}(e);for(var n=0;n0&&(t.push(i),i=[]):(!(a=a.split(/(?:\|\||!!)/))[0]&&a[1]&&a.shift(),a.forEach((function(e){e=(e=e.replace(/^\| */,"")).trim(),i.push(e)})))}return i.length>0&&t.push(i),t},Je=/.*rowspan *?= *?["']?([0-9]+)["']?[ \|]*/,Qe=/.*colspan *?= *?["']?([0-9]+)["']?[ \|]*/,Xe=function(e){return e=function(e){return e.forEach((function(t,i){t.forEach((function(n,a){var r=n.match(Je);if(null!==r){var o=parseInt(r[1],10);n=n.replace(Je,""),t[a]=n;for(var s=i+1;s0}))}(e))},et=Ee,tt=/^!/,it={name:!0,age:!0,born:!0,date:!0,year:!0,city:!0,country:!0,population:!0,count:!0,number:!0},nt=function(e){return(e=et(e).text()).match(/\|/)&&(e=e.replace(/.+\| ?/,"")),e=(e=(e=e.replace(/style=['"].*?["']/,"")).replace(/^!/,"")).trim()},at=function(e){return(e=e||[]).length-e.filter((function(e){return e})).length>3},rt=function(e){if(e.length<=3)return[];var t=e[0].slice(0);t=t.map((function(e){return e=e.replace(/^\! */,""),e=et(e).text(),e=(e=nt(e)).toLowerCase()}));for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:[],t=[];at(e[0])&&e.shift();var i=e[0];return i&&i[0]&&i[1]&&(/^!/.test(i[0])||/^!/.test(i[1]))&&(t=i.map((function(e){return e=e.replace(/^\! */,""),e=nt(e)})),e.shift()),(i=e[0])&&i[0]&&i[1]&&/^!/.test(i[0])&&/^!/.test(i[1])&&(i.forEach((function(e,i){e=e.replace(/^\! */,""),e=nt(e),!0===Boolean(e)&&(t[i]=e)})),e.shift()),t}(i=Xe(i));if(!n||n.length<=1){n=rt(i);var a=i[i.length-1]||[];n.length<=1&&a.length>2&&(n=rt(i.slice(1))).length>0&&(i=i.slice(2))}return i.map((function(e){return function(e,t){var i={};return e.forEach((function(e,n){var a=t[n]||"col"+(n+1),r=et(e);r.text(nt(r.text())),i[a]=r})),i}(e,n)}))},st=function(e,t){return e.map((function(e){var i={};return Object.keys(e).forEach((function(t){i[t]=e[t].json()})),!0===t.encode&&(i=Q(i)),i}))},ct={},ut=function(e){Object.defineProperty(this,"data",{enumerable:!1,value:e})},lt={links:function(e){var t=[];if(this.data.forEach((function(e){Object.keys(e).forEach((function(i){t=t.concat(e[i].links())}))})),"number"==typeof e)return t[e];if("string"==typeof e){e=e.charAt(0).toUpperCase()+e.substring(1);var i=t.find((function(t){return t.page()===e}));return void 0===i?[]:[i]}return t},keyValue:function(e){var t=this.json(e);return t.forEach((function(e){Object.keys(e).forEach((function(t){e[t]=e[t].text}))})),t},json:function(e){return e=p(e,ct),st(this.data,e)},text:function(){return""}};lt.keyvalue=lt.keyValue,lt.keyval=lt.keyValue,Object.keys(lt).forEach((function(e){ut.prototype[e]=lt[e]}));var pt=ut,mt=/^\s*{\|/,dt=/^\s*\|}/,ft=function(e){for(var t=[],i=e.wiki,n=i.split("\n"),a=[],r=0;r0&&(a[a.length-1]+="\n"+n[r]);else{a[a.length-1]+="\n"+n[r];var o=a.pop();t.push(o)}else a.push(n[r]);var s=[];t.forEach((function(e){if(e){i=(i=i.replace(e+"\n","")).replace(e,"");var t=ot(e);t&&t.length>0&&s.push(new pt(t))}})),s.length>0&&(e.tables=s),e.wiki=i},gt={sentences:!0},ht=function(e,t){var i={};return!0===(t=p(t,gt)).sentences&&(i.sentences=e.sentences().map((function(e){return e.json(t)}))),i},bt={sentences:!0,lists:!0,images:!0},kt=function(e){Object.defineProperty(this,"data",{enumerable:!1,value:e})},wt={sentences:function(e){return"number"==typeof e?this.data.sentences[e]:this.data.sentences||[]},references:function(e){return"number"==typeof e?this.data.references[e]:this.data.references},lists:function(e){return"number"==typeof e?this.data.lists[e]:this.data.lists},images:function(e){return"number"==typeof e?this.data.images[e]:this.data.images||[]},links:function(e){var t=[];if(this.sentences().forEach((function(i){t=t.concat(i.links(e))})),"number"==typeof e)return t[e];if("string"==typeof e){e=e.charAt(0).toUpperCase()+e.substring(1);var i=t.find((function(t){return t.page()===e}));return void 0===i?[]:[i]}return t||[]},interwiki:function(e){var t=[];return this.sentences().forEach((function(e){t=t.concat(e.interwiki())})),"number"==typeof e?t[e]:t||[]},text:function(e){e=p(e,bt);var t=this.sentences().map((function(t){return t.text(e)})).join(" ");return this.lists().forEach((function(e){t+="\n"+e.text()})),t},json:function(e){return e=p(e,bt),ht(this,e)}};wt.citations=wt.references,Object.keys(wt).forEach((function(e){kt.prototype[e]=wt[e]}));var vt=kt;var yt=function(e){for(var t=[],i=[],n=e.split(""),a=0,r=0;r0){for(var s=0,c=0,u=0;uc&&i.push("]"),t.push(i.join("")),i=[]}}return t},xt=Ee,$t=new RegExp("("+C.images.join("|")+"):","i"),jt="(".concat(C.images.join("|"),")"),zt=new RegExp(jt+":(.+?)[\\||\\]]","iu"),Et={thumb:!0,thumbnail:!0,border:!0,right:!0,left:!0,center:!0,top:!0,bottom:!0,none:!0,upright:!0,baseline:!0,middle:!0,sub:!0,super:!0},Ot=function(e){var t=e.wiki;yt(t).forEach((function(i){if(!0===$t.test(i)){e.images=e.images||[];var n=function(e){var t=e.match(zt);if(null===t||!t[2])return null;var i="".concat(t[1],":").concat(t[2]||""),n=(i=i.trim()).charAt(0).toUpperCase()+i.substring(1);if(n=n.replace(/ /g,"_")){var a={file:i};e=(e=e.replace(/^\[\[/,"")).replace(/\]\]$/,"");var r=Pe(e),o=r.list||[];return r.alt&&(a.alt=r.alt),(o=o.filter((function(e){return!1===Et.hasOwnProperty(e)})))[o.length-1]&&(a.caption=xt(o[o.length-1])),new z(a,e)}return null}(i);n&&e.images.push(n),t=t.replace(i,"")}})),e.wiki=t},_t={},St=function(e){Object.defineProperty(this,"data",{enumerable:!1,value:e})},Ct={lines:function(){return this.data},links:function(e){var t=[];if(this.lines().forEach((function(e){t=t.concat(e.links())})),"number"==typeof e)return t[e];if("string"==typeof e){e=e.charAt(0).toUpperCase()+e.substring(1);var i=t.find((function(t){return t.page()===e}));return void 0===i?[]:[i]}return t},json:function(e){return e=p(e,_t),this.lines().map((function(t){return t.json(e)}))},text:function(){return function(e,t){return e.map((function(e){return" * "+e.text(t)})).join("\n")}(this.data)}};Object.keys(Ct).forEach((function(e){St.prototype[e]=Ct[e]}));var qt=St,Nt=Ee,At=/^[#\*:;\|]+/,Lt=/^\*+[^:,\|]{4}/,Dt=/^ ?\#[^:,\|]{4}/,It=/[a-z_0-9\]\}]/i,Tt=function(e){return At.test(e)||Lt.test(e)||Dt.test(e)},Pt=function(e,t){for(var i=[],n=t;n0&&(i.push(r),a+=r.length-1)}else n.push(t[a]);e.lists=i.map((function(e){return new qt(e)})),e.wiki=n.join("\n")}},Ft=function(e){var t=e.wiki,i=t.split(Rt);i=(i=i.filter((function(e){return e&&e.trim().length>0}))).map((function(e){var t={wiki:e,lists:[],sentences:[],images:[]};return Ut.list(t),Ut.image(t),Mt(t),new vt(t)})),e.wiki=t,e.paragraphs=i},Kt=function(e,t){var i=Object.keys(e.data).reduce((function(t,i){return e.data[i]&&(t[i]=e.data[i].json()),t}),{});return!0===t.encode&&(i=Q(i)),i},Bt=function(e){return(e=(e=e.toLowerCase()).replace(/[-_]/g," ")).trim()},Wt=function(e){this._type=e.type,Object.defineProperty(this,"data",{enumerable:!1,value:e.data})},Yt={type:function(){return this._type},links:function(e){var t=this,i=[];if(Object.keys(this.data).forEach((function(e){t.data[e].links().forEach((function(e){return i.push(e)}))})),"number"==typeof e)return i[e];if("string"==typeof e){e=e.charAt(0).toUpperCase()+e.substring(1);var n=i.find((function(t){return t.page()===e}));return void 0===n?[]:[n]}return i},image:function(){var e=this.get("image")||this.get("image2")||this.get("logo");if(!e)return null;var t=e.json();return t.file=t.text,t.text="",new z(t)},get:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e=Bt(e);for(var t=Object.keys(this.data),i=0;i0?a++:a=e.indexOf("{",a+1)){var r=e[a];if("{"===r&&(t+=1),t>0){if("}"===r&&0===(t-=1)){n.push(r);var o=n.join("");n=[],/\{\{/.test(o)&&/\}\}/.test(o)&&i.push(o);continue}if(1===t&&"{"!==r&&"}"!==r){t=0,n=[];continue}n.push(r)}}return i},Ht=function(e){var t=null;return(t=/^\{\{[^\n]+\|/.test(e)?(e.match(/^\{\{(.+?)\|/)||[])[1]:-1!==e.indexOf("\n")?(e.match(/^\{\{(.+?)\n/)||[])[1]:(e.match(/^\{\{(.+?)\}\}$/)||[])[1])&&(t=t.replace(/:.*/,""),t=Se(t)),t||null},Vt=/\{\{/,Jt=function(e){return{body:e=e.replace(/#invoke:/,""),name:Ht(e),children:[]}},Qt=function e(t){var i=t.body.substr(2);return i=i.replace(/\}\}$/,""),t.children=Gt(i),t.children=t.children.map(Jt),0===t.children.length||t.children.forEach((function(t){var i=t.body.substr(2);return Vt.test(i)?e(t):null})),t},Xt=function(e){var t=Gt(e);return t=(t=t.map(Jt)).map(Qt)},ei=["anchor","defaultsort","use list-defined references","void","pp","pp-move-indef","pp-semi-indef","pp-vandalism","r","#tag","div col","pope list end","shipwreck list end","starbox end","end box","end","s-end"].reduce((function(e,t){return e[t]=!0,e}),{}),ti=new RegExp("^(subst.)?("+C.infoboxes.join("|")+")[: \n]","i"),ii=/^infobox /i,ni=/ infobox$/i,ai=/$Year in [A-Z]/i,ri={"gnf protein box":!0,"automatic taxobox":!0,"chembox ":!0,editnotice:!0,geobox:!0,hybridbox:!0,ichnobox:!0,infraspeciesbox:!0,mycomorphbox:!0,oobox:!0,"paraphyletic group":!0,speciesbox:!0,subspeciesbox:!0,"starbox short":!0,taxobox:!0,nhlteamseason:!0,"asian games bid":!0,"canadian federal election results":!0,"dc thomson comic strip":!0,"daytona 24 races":!0,edencharacter:!0,"moldova national football team results":!0,samurai:!0,protein:!0,"sheet authority":!0,"order-of-approx":!0,"bacterial labs":!0,"medical resources":!0,ordination:!0,"hockey team coach":!0,"hockey team gm":!0,"pro hockey team":!0,"hockey team player":!0,"hockey team start":!0,mlbbioret:!0},oi=function(e){return!0===ri.hasOwnProperty(e)||(!!ti.test(e)||(!(!ii.test(e)&&!ni.test(e))||!!ai.test(e)))},si=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.template.match(ti),i=e.template;t&&t[0]&&(i=i.replace(t[0],""));var n={template:"infobox",type:i=i.trim(),data:e};return delete n.data.template,delete n.data.list,n},ci=[void 0,"January","February","March","April","May","June","July","August","September","October","November","December"],ui=ci.reduce((function(e,t,i){return 0===i||(e[t.toLowerCase()]=i),e}),{}),li=function(e){return e<10?"0"+e:String(e)},pi=function(e){var t=String(e.year||"");if(void 0!==e.month&&!0===ci.hasOwnProperty(e.month))if(void 0===e.date)t="".concat(ci[e.month]," ").concat(e.year);else{if(t="".concat(ci[e.month]," ").concat(e.date,", ").concat(e.year),void 0!==e.hour&&void 0!==e.minute){var i="".concat(li(e.hour),":").concat(li(e.minute));void 0!==e.second&&(i=i+":"+li(e.second)),t=i+", "+t}e.tz&&(t+=" (".concat(e.tz,")"))}return t},mi=function(e){for(var t={},i=["year","month","date","hour","minute","second"],n=0;n0&&(n.years=a,i-=31536e6*n.years);var r=Math.floor(i/2592e6,10);r>0&&(n.months=r,i-=2592e6*n.months);var o=Math.floor(i/864e5,10);return o>0&&(n.days=o),n},hi=mi,bi=pi,ki=function(e){return{template:"date",data:e}},wi=function(e){var t=(e=_e(e)).split("|"),i=hi(t.slice(1,4)),n=t.slice(4,7);if(0===n.length){var a=new Date;n=[a.getFullYear(),a.getMonth(),a.getDate()]}return{from:i,to:n=hi(n)}},vi={date:function(e,t){var i=Pe(e,["year","month","date","hour","minute","second","timezone"]),n=hi([i.year,i.month,i.date||i.day]);return i.text=bi(n),i.timezone&&("Z"===i.timezone&&(i.timezone="UTC"),i.text+=" (".concat(i.timezone,")")),i.hour&&i.minute&&(i.second?i.text="".concat(i.hour,":").concat(i.minute,":").concat(i.second,", ")+i.text:i.text="".concat(i.hour,":").concat(i.minute,", ")+i.text),i.text&&t.push(ki(i)),i.text},natural_date:function(e,t){var i=Pe(e,["text"]).text||"",n={};if(/^[0-9]{4}$/.test(i))n.year=parseInt(i,10);else{var a=i.replace(/[a-z]+\/[a-z]+/i,"");a=a.replace(/[0-9]+:[0-9]+(am|pm)?/i,"");var r=new Date(a);!1===isNaN(r.getTime())&&(n.year=r.getFullYear(),n.month=r.getMonth()+1,n.date=r.getDate())}return t.push(ki(n)),i.trim()},one_year:function(e,t){var i=Pe(e,["year"]),n=Number(i.year);return t.push(ki({year:n})),String(n)},two_dates:function(e,t){var i=Pe(e,["b","birth_year","birth_month","birth_date","death_year","death_month","death_date"]);if(i.b&&"b"===i.b.toLowerCase()){var n=hi([i.birth_year,i.birth_month,i.birth_date]);return t.push(ki(n)),bi(n)}var a=hi([i.death_year,i.death_month,i.death_date]);return t.push(ki(a)),bi(a)},age:function(e){var t=wi(e);return gi(t.from,t.to).years||0},"diff-y":function(e){var t=wi(e),i=gi(t.from,t.to);return 1===i.years?i.years+" year":(i.years||0)+" years"},"diff-ym":function(e){var t=wi(e),i=gi(t.from,t.to),n=[];return 1===i.years?n.push(i.years+" year"):i.years&&0!==i.years&&n.push(i.years+" years"),1===i.months?n.push("1 month"):i.months&&0!==i.months&&n.push(i.months+" months"),n.join(", ")},"diff-ymd":function(e){var t=wi(e),i=gi(t.from,t.to),n=[];return 1===i.years?n.push(i.years+" year"):i.years&&0!==i.years&&n.push(i.years+" years"),1===i.months?n.push("1 month"):i.months&&0!==i.months&&n.push(i.months+" months"),1===i.days?n.push("1 day"):i.days&&0!==i.days&&n.push(i.days+" days"),n.join(", ")},"diff-yd":function(e){var t=wi(e),i=gi(t.from,t.to),n=[];return 1===i.years?n.push(i.years+" year"):i.years&&0!==i.years&&n.push(i.years+" years"),i.days+=30*(i.months||0),1===i.days?n.push("1 day"):i.days&&0!==i.days&&n.push(i.days+" days"),n.join(", ")},"diff-d":function(e){var t=wi(e),i=gi(t.from,t.to),n=[];return i.days+=365*(i.years||0),i.days+=30*(i.months||0),1===i.days?n.push("1 day"):i.days&&0!==i.days&&n.push(i.days+" days"),n.join(", ")}},yi=function(e){var t=new Date(e);if(isNaN(t.getTime()))return"";var i=(new Date).getTime()-t.getTime(),n="ago";i<0&&(n="from now",i=Math.abs(i));var a=i/1e3/60/60/24;return a<365?parseInt(a,10)+" days "+n:parseInt(a/365,10)+" years "+n},xi=vi.date,$i=vi.natural_date,ji=["January","February","March","April","May","June","July","August","September","October","November","December"],zi=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Ei=Object.assign({},di,{currentday:function(){var e=new Date;return String(e.getDate())},currentdayname:function(){var e=new Date;return zi[e.getDay()]},currentmonth:function(){var e=new Date;return ji[e.getMonth()]},currentyear:function(){var e=new Date;return String(e.getFullYear())},monthyear:function(){var e=new Date;return ji[e.getMonth()]+" "+e.getFullYear()},"monthyear-1":function(){var e=new Date;return e.setMonth(e.getMonth()-1),ji[e.getMonth()]+" "+e.getFullYear()},"monthyear+1":function(){var e=new Date;return e.setMonth(e.getMonth()+1),ji[e.getMonth()]+" "+e.getFullYear()},date:0,"time ago":function(e){var t=Pe(e,["date","fmt"]).date;return yi(t)},"birth date and age":function(e,t){var i=Pe(e,["year","month","day"]);return i.year&&/[a-z]/i.test(i.year)?$i(e,t):(t.push(i),i=mi([i.year,i.month,i.day]),pi(i))},"birth year and age":function(e,t){var i=Pe(e,["birth_year","birth_month"]);if(i.death_year&&/[a-z]/i.test(i.death_year))return $i(e,t);t.push(i);var n=(new Date).getFullYear()-parseInt(i.birth_year,10);i=mi([i.birth_year,i.birth_month]);var a=pi(i);return n&&(a+=" (age ".concat(n,")")),a},"death year and age":function(e,t){var i=Pe(e,["death_year","birth_year","death_month"]);return i.death_year&&/[a-z]/i.test(i.death_year)?$i(e,t):(t.push(i),i=mi([i.death_year,i.death_month]),pi(i))},"birth date and age2":function(e,t){var i=Pe(e,["at_year","at_month","at_day","birth_year","birth_month","birth_day"]);return t.push(i),i=mi([i.birth_year,i.birth_month,i.birth_day]),pi(i)},"birth based on age as of date":function(e,t){var i=Pe(e,["age","year","month","day"]);t.push(i);var n=parseInt(i.age,10),a=parseInt(i.year,10)-n;return a&&n?"".concat(a," (age ").concat(i.age,")"):"(age ".concat(i.age,")")},"death date and given age":function(e,t){var i=Pe(e,["year","month","day","age"]);t.push(i),i=mi([i.year,i.month,i.day]);var n=pi(i);return i.age&&(n+=" (age ".concat(i.age,")")),n},dts:function(e){e=(e=e.replace(/\|format=[ymd]+/i,"")).replace(/\|abbr=(on|off)/i,"");var t=Pe(e,["year","month","date","bc"]);return t.date&&t.month&&t.year?!0===/[a-z]/.test(t.month)?[t.month,t.date,t.year].join(" "):[t.year,t.month,t.date].join("-"):t.month&&t.year?[t.year,t.month].join("-"):t.year?(t.year<0&&(t.year=Math.abs(t.year)+" BC"),t.year):""},start:xi,end:xi,birth:xi,death:xi,"start date":xi,"end date":xi,"birth date":xi,"death date":xi,"start date and age":xi,"end date and age":xi,"start-date":$i,"end-date":$i,"birth-date":$i,"death-date":$i,"birth-date and age":$i,"birth-date and given age":$i,"death-date and age":$i,"death-date and given age":$i,birthdeathage:vi.two_dates,dob:xi,age:vi.age,"age nts":vi.age,"age in years":vi["diff-y"],"age in years and months":vi["diff-ym"],"age in years, months and days":vi["diff-ymd"],"age in years and days":vi["diff-yd"],"age in days":vi["diff-d"]});Ei.localday=Ei.currentday,Ei.localdayname=Ei.currentdayname,Ei.localmonth=Ei.currentmonth,Ei.localyear=Ei.currentyear,Ei.currentmonthname=Ei.currentmonth,Ei.currentmonthabbrev=Ei.currentmonth,Ei["death date and age"]=Ei["birth date and age"],Ei.bda=Ei["birth date and age"],Ei["birth date based on age at death"]=Ei["birth based on age as of date"];var Oi=Ei,_i={tag:function(e){var t=Pe(e,["tag","open"]);return t.open&&"pair"!==t.open?"":{span:!0,div:!0,p:!0}[t.tag]?t.content||"":"<".concat(t.tag," ").concat(t.attribs||"",">").concat(t.content||"","").concat(t.tag,">")},plural:function(e){e=e.replace(/plural:/,"plural|");var t=Pe(e,["num","word"]),i=Number(t.num),n=t.word;return 1!==i&&(/.y$/.test(n)?n=n.replace(/y$/,"ies"):n+="s"),i+" "+n},"first word":function(e){var t=Pe(e,["text"]),i=t.text;return t.sep?i.split(t.sep)[0]:i.split(" ")[0]},trunc:function(e){var t=Pe(e,["str","len"]);return t.str.substr(0,t.len)},"str mid":function(e){var t=Pe(e,["str","start","end"]),i=parseInt(t.start,10)-1,n=parseInt(t.end,10);return t.str.substr(i,n)},p1:0,p2:1,p3:2,braces:function(e){var t=Pe(e,["text"]),i="";return t.list&&(i="|"+t.list.join("|")),"{{"+(t.text||"")+i+"}}"},nobold:0,noitalic:0,nocaps:0,syntaxhighlight:function(e,t){var i=Pe(e);return t.push(i),i.code||""},samp:function(e,t){var i=Pe(e,["1"]);return t.push(i),i[1]||""},vanchor:0,resize:1,ra:function(e){var t=Pe(e,["hours","minutes","seconds"]);return[t.hours||0,t.minutes||0,t.seconds||0].join(":")},deg2hms:function(e){return(Pe(e,["degrees"]).degrees||"")+"°"},hms2deg:function(e){var t=Pe(e,["hours","minutes","seconds"]);return[t.hours||0,t.minutes||0,t.seconds||0].join(":")},decdeg:function(e){var t=Pe(e,["deg","min","sec","hem","rnd"]);return(t.deg||t.degrees)+"°"},rnd:0,dec:function(e){var t=Pe(e,["degrees","minutes","seconds"]),i=(t.degrees||0)+"°";return t.minutes&&(i+=t.minutes+"′"),t.seconds&&(i+=t.seconds+"″"),i},val:function(e){var t=Pe(e,["number","uncertainty"]),i=t.number;i&&Number(i)&&(i=Number(i).toLocaleString());var n=i||"";return t.p&&(n=t.p+n),t.s&&(n=t.s+n),(t.u||t.ul||t.upl)&&(n=n+" "+(t.u||t.ul||t.upl)),n}};_i.rndfrac=_i.rnd,_i.rndnear=_i.rnd,_i["unité"]=_i.val;["nowrap","nobr","big","cquote","pull quote","small","smaller","midsize","larger","big","kbd","bigger","large","mono","strongbad","stronggood","huge","xt","xt2","!xt","xtn","xtd","dc","dcr","mxt","!mxt","mxtn","mxtd","bxt","!bxt","bxtn","bxtd","delink","pre","var","mvar","pre2","code"].forEach((function(e){_i[e]=function(e){return Pe(e,["text"]).text||""}}));var Si=_i,Ci={plainlist:function(e){var t=(e=_e(e)).split("|");return e=(t=t.slice(1)).join("|"),(t=(t=e.split(/\n ?\* ?/)).filter((function(e){return e}))).join("\n\n")},"collapsible list":function(e,t){var i=Pe(e);t.push(i);var n="";if(i.title&&(n+="'''".concat(i.title,"'''")+"\n\n"),!i.list){i.list=[];for(var a=1;a<10;a+=1)i[a]&&(i.list.push(i[a]),delete i[a])}return i.list=i.list.filter((function(e){return e})),n+=i.list.join("\n\n")},"ordered list":function(e,t){var i=Pe(e);return t.push(i),i.list=i.list||[],i.list.map((function(e,t){return"".concat(t+1,". ").concat(e)})).join("\n\n")},hlist:function(e){var t=Pe(e);return t.list=t.list||[],t.list.join(" · ")},pagelist:function(e){return(Pe(e).list||[]).join(", ")},catlist:function(e){return(Pe(e).list||[]).join(", ")},"br separated entries":function(e){return(Pe(e).list||[]).join("\n\n")},"comma separated entries":function(e){return(Pe(e).list||[]).join(", ")},"anchored list":function(e){var t=Pe(e).list||[];return(t=t.map((function(e,t){return"".concat(t+1,". ").concat(e)}))).join("\n\n")},"bulleted list":function(e){var t=Pe(e).list||[];return(t=(t=t.filter((function(e){return e}))).map((function(e){return"• "+e}))).join("\n\n")},"columns-list":function(e,t){var i=((Pe(e).list||[])[0]||"").split(/\n/);return i=(i=i.filter((function(e){return e}))).map((function(e){return e.replace(/\*/,"")})),t.push({template:"columns-list",list:i}),(i=i.map((function(e){return"• "+e}))).join("\n\n")}};Ci.flatlist=Ci.plainlist,Ci.ublist=Ci.plainlist,Ci["unbulleted list"]=Ci["collapsible list"],Ci.ubl=Ci["collapsible list"],Ci["bare anchored list"]=Ci["anchored list"],Ci["plain list"]=Ci.plainlist,Ci.cmn=Ci["columns-list"],Ci.collist=Ci["columns-list"],Ci["col-list"]=Ci["columns-list"],Ci.columnslist=Ci["columns-list"];var qi=Ci,Ni={convert:function(e){var t=Pe(e,["num","two","three","four"]);return"-"===t.two||"to"===t.two||"and"===t.two?t.four?"".concat(t.num," ").concat(t.two," ").concat(t.three," ").concat(t.four):"".concat(t.num," ").concat(t.two," ").concat(t.three):"".concat(t.num," ").concat(t.two)},term:function(e){var t=Pe(e,["term"]);return"".concat(t.term,":")},defn:0,lino:0,linum:function(e){var t=Pe(e,["num","text"]);return"".concat(t.num,". ").concat(t.text)},ill:function(e){return Pe(e,["text","lan1","text1","lan2","text2"]).text},frac:function(e){var t=Pe(e,["a","b","c"]);return t.c?"".concat(t.a," ").concat(t.b,"/").concat(t.c):t.b?"".concat(t.a,"/").concat(t.b):"1/".concat(t.b)},height:function(e,t){var i=Pe(e);t.push(i);var n=[];return["m","cm","ft","in"].forEach((function(e){!0===i.hasOwnProperty(e)&&n.push(i[e]+e)})),n.join(" ")},"block indent":function(e){var t=Pe(e);return t[1]?"\n"+t[1]+"\n":""},quote:function(e,t){var i=Pe(e,["text","author"]);if(t.push(i),i.text){var n='"'.concat(i.text,'"');return i.author&&(n+="\n\n",n+=" - ".concat(i.author)),n+"\n"}return""},lbs:function(e){var t=Pe(e,["text"]);return"[[".concat(t.text," Lifeboat Station|").concat(t.text,"]]")},lbc:function(e){var t=Pe(e,["text"]);return"[[".concat(t.text,"-class lifeboat|").concat(t.text,"-class]]")},lbb:function(e){var t=Pe(e,["text"]);return"[[".concat(t.text,"-class lifeboat|").concat(t.text,"]]")},own:function(e){var t=Pe(e,["author"]),i="Own work";return t.author&&(i+=" by "+t.author),i},sic:function(e,t){var i=Pe(e,["one","two","three"]),n=(i.one||"")+(i.two||"");return"?"===i.one&&(n=(i.two||"")+(i.three||"")),t.push({template:"sic",word:n}),"y"===i.nolink?n:"".concat(n," [sic]")},formatnum:function(e){e=e.replace(/:/,"|");var t=Pe(e,["number"]).number||"";return t=t.replace(/,/g,""),Number(t).toLocaleString()||""},"#dateformat":function(e){return e=e.replace(/:/,"|"),Pe(e,["date","format"]).date},lc:function(e){return e=e.replace(/:/,"|"),(Pe(e,["text"]).text||"").toLowerCase()},lcfirst:function(e){e=e.replace(/:/,"|");var t=Pe(e,["text"]).text;return t?t[0].toLowerCase()+t.substr(1):""},uc:function(e){return e=e.replace(/:/,"|"),(Pe(e,["text"]).text||"").toUpperCase()},ucfirst:function(e){e=e.replace(/:/,"|");var t=Pe(e,["text"]).text;return t?t[0].toUpperCase()+t.substr(1):""},padleft:function(e){e=e.replace(/:/,"|");var t=Pe(e,["text","num"]);return(t.text||"").padStart(t.num,t.str||"0")},padright:function(e){e=e.replace(/:/,"|");var t=Pe(e,["text","num"]);return(t.text||"").padEnd(t.num,t.str||"0")},abbr:function(e){return Pe(e,["abbr","meaning","ipa"]).abbr},abbrlink:function(e){var t=Pe(e,["abbr","page"]);return t.page?"[[".concat(t.page,"|").concat(t.abbr,"]]"):"[[".concat(t.abbr,"]]")},h:1,finedetail:0,sort:1};Ni["str left"]=Ni.trunc,Ni["str crop"]=Ni.trunc,Ni.tooltip=Ni.abbr,Ni.abbrv=Ni.abbr,Ni.define=Ni.abbr,Ni.cvt=Ni.convert;var Ai=Ni,Li=Object.assign({},Si,qi,Ai);var Di=function(e){var t=e.pop(),i=Number(e[0]||0),n=Number(e[1]||0),a=Number(e[2]||0);if("string"!=typeof t||isNaN(i))return null;var r=1;return/[SW]/i.test(t)&&(r=-1),r*(i+n/60+a/3600)},Ii=function(e){if("number"!=typeof e)return e;return Math.round(1e5*e)/1e5},Ti={s:!0,w:!0},Pi=function(e){var i=Pe(e);i=function(e){return e.list=e.list||[],e.list=e.list.map((function(t){var i=Number(t);if(!isNaN(i))return i;var n=t.split(/:/);return n.length>1?(e.props=e.props||{},e.props[n[0]]=n.slice(1).join(":"),null):t})),e.list=e.list.filter((function(e){return null!==e})),e}(i);var n,a,r=(n=i.list,a=n.map((function(e){return t(e)})).join("|"),2===n.length&&"number|number"===a?{lat:n[0],lon:n[1]}:4===n.length&&"number|string|number|string"===a?(Ti[n[1].toLowerCase()]&&(n[0]*=-1),"w"===n[3].toLowerCase()&&(n[2]*=-1),{lat:n[0],lon:n[2]}):6===n.length?{lat:Di(n.slice(0,3)),lon:Di(n.slice(3))}:8===n.length?{lat:Di(n.slice(0,4)),lon:Di(n.slice(4))}:{});return i.lat=Ii(r.lat),i.lon=Ii(r.lon),i.template="coord",delete i.list,i},Mi={coord:function(e,t){var i=Pi(e);return t.push(i),i.display&&-1===i.display.indexOf("inline")?"":"".concat(i.lat||"","°N, ").concat(i.lon||"","°W")},geo:["lat","lon","zoom"]};Mi.coor=Mi.coord,Mi["coor title dms"]=Mi.coord,Mi["coor title dec"]=Mi.coord,Mi["coor dms"]=Mi.coord,Mi["coor dm"]=Mi.coord,Mi["coor dec"]=Mi.coord;var Ri=Mi,Ui={etyl:1,mention:1,link:1,"la-verb-form":0,"la-ipa":0,sortname:function(e){var t=Pe(e,["first","last","target","sort"]),i="".concat(t.first||""," ").concat(t.last||"");return i=i.trim(),t.nolink?t.target||i:(t.dab&&(i+=" (".concat(t.dab,")"),t.target&&(t.target+=" (".concat(t.dab,")"))),t.target?"[[".concat(t.target,"|").concat(i,"]]"):"[[".concat(i,"]]"))}};["lts","t","tfd links","tiw","tltt","tetl","tsetl","ti","tic","tiw","tlt","ttl","twlh","tl2","tlu","demo","hatnote","xpd","para","elc","xtag","mli","mlix","#invoke","url"].forEach((function(e){Ui[e]=function(e){var t=Pe(e,["first","second"]);return t.second||t.first}})),Ui.m=Ui.mention,Ui["m-self"]=Ui.mention,Ui.l=Ui.link,Ui.ll=Ui.link,Ui["l-self"]=Ui.link;var Fi=Ui,Ki={wikt:"wiktionary",commons:"commons",c:"commons",commonscat:"commonscat",n:"wikinews",q:"wikiquote",s:"wikisource",a:"wikiauthor",b:"wikibooks",voy:"wikivoyage",v:"wikiversity",d:"wikidata",species:"wikispecies",m:"meta",mw:"mediawiki"},Bi={about:function(e,t){var i=Pe(e);return t.push(i),""},main:function(e,t){var i=Pe(e);return t.push(i),""},"main list":function(e,t){var i=Pe(e);return t.push(i),""},see:function(e,t){var i=Pe(e);return t.push(i),""},for:function(e,t){var i=Pe(e);return t.push(i),""},further:function(e,t){var i=Pe(e);return t.push(i),""},"further information":function(e,t){var i=Pe(e);return t.push(i),""},listen:function(e,t){var i=Pe(e);return t.push(i),""},"wide image":["file","width","caption"],redirect:function(e,t){for(var i=Pe(e,["redirect"]),n=i.list||[],a=[],r=0;r0&&t.push(a)}return{template:"playoffbracket",rounds:t}}(e);return t.push(i),""}};["2teambracket","4team2elimbracket","8teambracket","16teambracket","32teambracket","cwsbracket","nhlbracket","nhlbracket-reseed","4teambracket-nhl","4teambracket-ncaa","4teambracket-mma","4teambracket-mlb","8teambracket-nhl","8teambracket-mlb","8teambracket-ncaa","8teambracket-afc","8teambracket-afl","8teambracket-tennis3","8teambracket-tennis5","16teambracket-nhl","16teambracket-nhl divisional","16teambracket-nhl-reseed","16teambracket-nba","16teambracket-swtc","16teambracket-afc","16teambracket-tennis3","16teambracket-tennis5"].forEach((function(e){Qi[e]=Qi["4teambracket"]}));var Xi=Qi,en={"£":"GB£","¥":"¥","৳":"৳","₩":"₩","€":"€","₱":"₱","₹":"₹","₽":"₽","cn¥":"CN¥","gb£":"GB£","india rs":"₹","indian rupee symbol":"₹","indian rupee":"₹","indian rupees":"₹","philippine peso":"₱","russian ruble":"₽","SK won":"₩","turkish lira":"TRY",a$:"A$",au$:"A$",aud:"A$",bdt:"BDT",brl:"BRL",ca$:"CA$",cad:"CA$",chf:"CHF",cny:"CN¥",czk:"czk",dkk:"dkk",dkk2:"dkk",euro:"€",gbp:"GB£",hk$:"HK$",hkd:"HK$",ils:"ILS",inr:"₹",jpy:"¥",myr:"MYR",nis:"ILS",nok:"NOK",nok2:"NOK",nz$:"NZ$",nzd:"NZ$",peso:"peso",pkr:"₨",r$:"BRL",rmb:"CN¥",rub:"₽",ruble:"₽",rupee:"₹",s$:"sgd",sek:"SEK",sek2:"SEK",sfr:"CHF",sgd:"sgd",shekel:"ILS",sheqel:"ILS",ttd:"TTD",us$:"US$",usd:"US$",yen:"¥",zar:"R"},tn=function(e,t){var i=Pe(e,["amount","code"]);t.push(i);var n=i.template||"";switch("currency"===n?(n=i.code)||(i.code=n="usd"):""!==n&&"monnaie"!==n&&"unité"!==n&&"nombre"!==n&&"nb"!==n||(n=i.code),n=(n||"").toLowerCase()){case"us":i.code=n="usd";break;case"uk":i.code=n="gbp"}var a="".concat(en[n]||"").concat(i.amount||"");return i.code&&!en[i.code.toLowerCase()]&&(a+=" "+i.code),a},nn={currency:tn,monnaie:tn,"unité":tn,nombre:tn,nb:tn,iso4217:tn,inrconvert:function(e,t){var i=Pe(e,["rupee_value","currency_formatting"]);t.push(i);var n=i.currency_formatting;if(n){var a=1;switch(n){case"k":a=1e3;break;case"m":a=1e6;break;case"b":a=1e9;break;case"t":a=1e12;break;case"l":a=1e5;break;case"c":a=1e7;break;case"lc":a=1e12}i.rupee_value=i.rupee_value*a}return"inr ".concat(i.rupee_value||"")}};Object.keys(en).forEach((function(e){nn[e]=tn}));var an=nn,rn={"election box begin":function(e,t){var i=Pe(e);return t.push(i),""},"election box candidate":function(e,t){var i=Pe(e);return t.push(i),""},"election box hold with party link":function(e,t){var i=Pe(e);return t.push(i),""},"election box gain with party link":function(e,t){var i=Pe(e);return t.push(i),""}};rn["election box begin no change"]=rn["election box begin"],rn["election box begin no party"]=rn["election box begin"],rn["election box begin no party no change"]=rn["election box begin"],rn["election box inline begin"]=rn["election box begin"],rn["election box inline begin no change"]=rn["election box begin"],rn["election box candidate for alliance"]=rn["election box candidate"],rn["election box candidate minor party"]=rn["election box candidate"],rn["election box candidate no party link no change"]=rn["election box candidate"],rn["election box candidate with party link"]=rn["election box candidate"],rn["election box candidate with party link coalition 1918"]=rn["election box candidate"],rn["election box candidate with party link no change"]=rn["election box candidate"],rn["election box inline candidate"]=rn["election box candidate"],rn["election box inline candidate no change"]=rn["election box candidate"],rn["election box inline candidate with party link"]=rn["election box candidate"],rn["election box inline candidate with party link no change"]=rn["election box candidate"],rn["election box inline incumbent"]=rn["election box candidate"];var on=rn,sn=[["🇦🇩","and","andorra"],["🇦🇪","are","united arab emirates"],["🇦🇫","afg","afghanistan"],["🇦🇬","atg","antigua and barbuda"],["🇦🇮","aia","anguilla"],["🇦🇱","alb","albania"],["🇦🇲","arm","armenia"],["🇦🇴","ago","angola"],["🇦🇶","ata","antarctica"],["🇦🇷","arg","argentina"],["🇦🇸","asm","american samoa"],["🇦🇹","aut","austria"],["🇦🇺","aus","australia"],["🇦🇼","abw","aruba"],["🇦🇽","ala","åland islands"],["🇦🇿","aze","azerbaijan"],["🇧🇦","bih","bosnia and herzegovina"],["🇧🇧","brb","barbados"],["🇧🇩","bgd","bangladesh"],["🇧🇪","bel","belgium"],["🇧🇫","bfa","burkina faso"],["🇧🇬","bgr","bulgaria"],["🇧🇬","bul","bulgaria"],["🇧🇭","bhr","bahrain"],["🇧🇮","bdi","burundi"],["🇧🇯","ben","benin"],["🇧🇱","blm","saint barthélemy"],["🇧🇲","bmu","bermuda"],["🇧🇳","brn","brunei darussalam"],["🇧🇴","bol","bolivia"],["🇧🇶","bes","bonaire, sint eustatius and saba"],["🇧🇷","bra","brazil"],["🇧🇸","bhs","bahamas"],["🇧🇹","btn","bhutan"],["🇧🇻","bvt","bouvet island"],["🇧🇼","bwa","botswana"],["🇧🇾","blr","belarus"],["🇧🇿","blz","belize"],["🇨🇦","can","canada"],["🇨🇨","cck","cocos (keeling) islands"],["🇨🇩","cod","congo"],["🇨🇫","caf","central african republic"],["🇨🇬","cog","congo"],["🇨🇭","che","switzerland"],["🇨🇮","civ","côte d'ivoire"],["🇨🇰","cok","cook islands"],["🇨🇱","chl","chile"],["🇨🇲","cmr","cameroon"],["🇨🇳","chn","china"],["🇨🇴","col","colombia"],["🇨🇷","cri","costa rica"],["🇨🇺","cub","cuba"],["🇨🇻","cpv","cape verde"],["🇨🇼","cuw","curaçao"],["🇨🇽","cxr","christmas island"],["🇨🇾","cyp","cyprus"],["🇨🇿","cze","czech republic"],["🇩🇪","deu","germany"],["🇩🇪","ger","germany"],["🇩🇯","dji","djibouti"],["🇩🇰","dnk","denmark"],["🇩🇲","dma","dominica"],["🇩🇴","dom","dominican republic"],["🇩🇿","dza","algeria"],["🇪🇨","ecu","ecuador"],["🇪🇪","est","estonia"],["🇪🇬","egy","egypt"],["🇪🇭","esh","western sahara"],["🇪🇷","eri","eritrea"],["🇪🇸","esp","spain"],["🇪🇹","eth","ethiopia"],["🇫🇮","fin","finland"],["🇫🇯","fji","fiji"],["🇫🇰","flk","falkland islands (malvinas)"],["🇫🇲","fsm","micronesia"],["🇫🇴","fro","faroe islands"],["🇫🇷","fra","france"],["🇬🇦","gab","gabon"],["🇬🇧","gbr","united kingdom"],["🇬🇩","grd","grenada"],["🇬🇫","guf","french guiana"],["🇬🇬","ggy","guernsey"],["🇬🇭","gha","ghana"],["🇬🇮","gib","gibraltar"],["🇬🇱","grl","greenland"],["🇬🇲","gmb","gambia"],["🇬🇳","gin","guinea"],["🇬🇵","glp","guadeloupe"],["🇬🇶","gnq","equatorial guinea"],["🇬🇷","grc","greece"],["🇬🇸","sgs","south georgia"],["🇬🇹","gtm","guatemala"],["🇬🇺","gum","guam"],["🇬🇼","gnb","guinea-bissau"],["🇬🇾","guy","guyana"],["🇭🇰","hkg","hong kong"],["🇭🇲","hmd","heard island and mcdonald islands"],["🇭🇳","hnd","honduras"],["🇭🇷","hrv","croatia"],["🇭🇹","hti","haiti"],["🇭🇺","hun","hungary"],["🇮🇩","idn","indonesia"],["🇮🇪","irl","ireland"],["🇮🇱","isr","israel"],["🇮🇲","imn","isle of man"],["🇮🇳","ind","india"],["🇮🇴","iot","british indian ocean territory"],["🇮🇶","irq","iraq"],["🇮🇷","irn","iran"],["🇮🇸","isl","iceland"],["🇮🇹","ita","italy"],["🇯🇪","jey","jersey"],["🇯🇲","jam","jamaica"],["🇯🇴","jor","jordan"],["🇯🇵","jpn","japan"],["🇰🇪","ken","kenya"],["🇰🇬","kgz","kyrgyzstan"],["🇰🇭","khm","cambodia"],["🇰🇮","kir","kiribati"],["🇰🇲","com","comoros"],["🇰🇳","kna","saint kitts and nevis"],["🇰🇵","prk","north korea"],["🇰🇷","kor","south korea"],["🇰🇼","kwt","kuwait"],["🇰🇾","cym","cayman islands"],["🇰🇿","kaz","kazakhstan"],["🇱🇦","lao","lao people's democratic republic"],["🇱🇧","lbn","lebanon"],["🇱🇨","lca","saint lucia"],["🇱🇮","lie","liechtenstein"],["🇱🇰","lka","sri lanka"],["🇱🇷","lbr","liberia"],["🇱🇸","lso","lesotho"],["🇱🇹","ltu","lithuania"],["🇱🇺","lux","luxembourg"],["🇱🇻","lva","latvia"],["🇱🇾","lby","libya"],["🇲🇦","mar","morocco"],["🇲🇨","mco","monaco"],["🇲🇩","mda","moldova"],["🇲🇪","mne","montenegro"],["🇲🇫","maf","saint martin (french part)"],["🇲🇬","mdg","madagascar"],["🇲🇭","mhl","marshall islands"],["🇲🇰","mkd","macedonia"],["🇲🇱","mli","mali"],["🇲🇲","mmr","myanmar"],["🇲🇳","mng","mongolia"],["🇲🇴","mac","macao"],["🇲🇵","mnp","northern mariana islands"],["🇲🇶","mtq","martinique"],["🇲🇷","mrt","mauritania"],["🇲🇸","msr","montserrat"],["🇲🇹","mlt","malta"],["🇲🇺","mus","mauritius"],["🇲🇻","mdv","maldives"],["🇲🇼","mwi","malawi"],["🇲🇽","mex","mexico"],["🇲🇾","mys","malaysia"],["🇲🇿","moz","mozambique"],["🇳🇦","nam","namibia"],["🇳🇨","ncl","new caledonia"],["🇳🇪","ner","niger"],["🇳🇫","nfk","norfolk island"],["🇳🇬","nga","nigeria"],["🇳🇮","nic","nicaragua"],["🇳🇱","nld","netherlands"],["🇳🇴","nor","norway"],["🇳🇵","npl","nepal"],["🇳🇷","nru","nauru"],["🇳🇺","niu","niue"],["🇳🇿","nzl","new zealand"],["🇴🇲","omn","oman"],["🇵🇦","pan","panama"],["🇵🇪","per","peru"],["🇵🇫","pyf","french polynesia"],["🇵🇬","png","papua new guinea"],["🇵🇭","phl","philippines"],["🇵🇰","pak","pakistan"],["🇵🇱","pol","poland"],["🇵🇲","spm","saint pierre and miquelon"],["🇵🇳","pcn","pitcairn"],["🇵🇷","pri","puerto rico"],["🇵🇸","pse","palestinian territory"],["🇵🇹","prt","portugal"],["🇵🇼","plw","palau"],["🇵🇾","pry","paraguay"],["🇶🇦","qat","qatar"],["🇷🇪","reu","réunion"],["🇷🇴","rou","romania"],["🇷🇸","srb","serbia"],["🇷🇺","rus","russia"],["🇷🇼","rwa","rwanda"],["🇸🇦","sau","saudi arabia"],["🇸🇧","slb","solomon islands"],["🇸🇨","syc","seychelles"],["🇸🇩","sdn","sudan"],["🇸🇪","swe","sweden"],["🇸🇬","sgp","singapore"],["🇸🇭","shn","saint helena, ascension and tristan da cunha"],["🇸🇮","svn","slovenia"],["🇸🇯","sjm","svalbard and jan mayen"],["🇸🇰","svk","slovakia"],["🇸🇱","sle","sierra leone"],["🇸🇲","smr","san marino"],["🇸🇳","sen","senegal"],["🇸🇴","som","somalia"],["🇸🇷","sur","suriname"],["🇸🇸","ssd","south sudan"],["🇸🇹","stp","sao tome and principe"],["🇸🇻","slv","el salvador"],["🇸🇽","sxm","sint maarten (dutch part)"],["🇸🇾","syr","syrian arab republic"],["🇸🇿","swz","swaziland"],["🇹🇨","tca","turks and caicos islands"],["🇹🇩","tcd","chad"],["🇹🇫","atf","french southern territories"],["🇹🇬","tgo","togo"],["🇹🇭","tha","thailand"],["🇹🇯","tjk","tajikistan"],["🇹🇰","tkl","tokelau"],["🇹🇱","tls","timor-leste"],["🇹🇲","tkm","turkmenistan"],["🇹🇳","tun","tunisia"],["🇹🇴","ton","tonga"],["🇹🇷","tur","turkey"],["🇹🇹","tto","trinidad and tobago"],["🇹🇻","tuv","tuvalu"],["🇹🇼","twn","taiwan"],["🇹🇿","tza","tanzania"],["🇺🇦","ukr","ukraine"],["🇺🇬","uga","uganda"],["🇺🇲","umi","united states minor outlying islands"],["🇺🇸","usa","united states"],["🇺🇸","us","united states"],["🇺🇾","ury","uruguay"],["🇺🇿","uzb","uzbekistan"],["🇻🇦","vat","vatican city"],["🇻🇨","vct","saint vincent and the grenadines"],["🇻🇪","ven","venezuela"],["🇻🇬","vgb","virgin islands, british"],["🇻🇮","vir","virgin islands, u.s."],["🇻🇳","vnm","viet nam"],["🇻🇺","vut","vanuatu"],["","win","west indies"],["🇼🇫","wlf","wallis and futuna"],["🇼🇸","wsm","samoa"],["🇾🇪","yem","yemen"],["🇾🇹","myt","mayotte"],["🇿🇦","zaf","south africa"],["🇿🇲","zmb","zambia"],["🇿🇼 ","zwe","zimbabwe"],["🇺🇳","un","united nations"],["🏴","eng","england"],["🏴","sct","scotland"],["🏴","wal","wales"],["🇪🇺","eu","european union"]],cn={flag:function(e){var t=Pe(e,["flag","variant"]),i=t.flag||"";t.flag=(t.flag||"").toLowerCase();var n=sn.find((function(e){return t.flag===e[1]||t.flag===e[2]}))||[],a=n[0]||"";return"".concat(a," [[").concat(n[2],"|").concat(i,"]]")},flagcountry:function(e){var t=Pe(e,["flag","variant"]);t.flag=(t.flag||"").toLowerCase();var i=sn.find((function(e){return t.flag===e[1]||t.flag===e[2]}))||[],n=i[0]||"";return"".concat(n," [[").concat(i[2],"]]")},flagcu:function(e){var t=Pe(e,["flag","variant"]);t.flag=(t.flag||"").toLowerCase();var i=sn.find((function(e){return t.flag===e[1]||t.flag===e[2]}))||[],n=i[0]||"";return"".concat(n," ").concat(i[2])},flagicon:function(e){var t=Pe(e,["flag","variant"]);t.flag=(t.flag||"").toLowerCase();var i=sn.find((function(e){return t.flag===e[1]||t.flag===e[2]}));return i?"[[".concat(i[2],"|").concat(i[0],"]]"):""},flagdeco:function(e){var t=Pe(e,["flag","variant"]);return t.flag=(t.flag||"").toLowerCase(),(sn.find((function(e){return t.flag===e[1]||t.flag===e[2]}))||[])[0]||""},fb:function(e){var t=Pe(e,["flag","variant"]);t.flag=(t.flag||"").toLowerCase();var i=sn.find((function(e){return t.flag===e[1]||t.flag===e[2]}));return i?"".concat(i[0]," [[").concat(i[2]," national football team|").concat(i[2],"]]"):""},fbicon:function(e){var t=Pe(e,["flag","variant"]);t.flag=(t.flag||"").toLowerCase();var i=sn.find((function(e){return t.flag===e[1]||t.flag===e[2]}));return i?" [[".concat(i[2]," national football team|").concat(i[0],"]]"):""},flagathlete:function(e){var t=Pe(e,["name","flag","variant"]);t.flag=(t.flag||"").toLowerCase();var i=sn.find((function(e){return t.flag===e[1]||t.flag===e[2]}));return i?"".concat(i[0]," [[").concat(t.name||"","]] (").concat(i[1].toUpperCase(),")"):"[[".concat(t.name||"","]]")}};sn.forEach((function(e){cn[e[1]]=function(){return e[0]}})),cn.cr=cn.flagcountry,cn["cr-rt"]=cn.flagcountry,cn.cricon=cn.flagicon;var un=cn,ln=function(e){var t=e.match(/ipac?-(.+)/);return null!==t?!0===q.hasOwnProperty(t[1])?q[t[1]].english_title:t[1]:null},pn={ipa:function(e,t){var i=Pe(e,["transcription","lang","audio"]);return i.lang=ln(i.template),i.template="ipa",t.push(i),""},ipac:function(e,t){var i=Pe(e);return i.transcription=(i.list||[]).join(","),delete i.list,i.lang=ln(i.template),i.template="ipac",t.push(i),""},transl:function(e,t){var i=Pe(e,["lang","text","text2"]);return i.text2&&(i.iso=i.text,i.text=i.text2,delete i.text2),t.push(i),i.text||""}};Object.keys(q).forEach((function(e){pn["ipa-"+e]=pn.ipa,pn["ipac-"+e]=pn.ipac}));var mn=pn,dn={lang:1,"lang-de":0,"rtl-lang":1,taste:0,nihongo:function(e,t){var i=Pe(e,["english","kanji","romaji","extra"]);t.push(i);var n=i.english||i.romaji||"";return i.kanji&&(n+=" (".concat(i.kanji,")")),n}};Object.keys(q).forEach((function(e){dn["lang-"+e]=dn["lang-de"]})),dn.nihongo2=dn.nihongo,dn.nihongo3=dn.nihongo,dn["nihongo-s"]=dn.nihongo,dn["nihongo foot"]=dn.nihongo;var fn=dn,gn=function(e){if(!e.numerator&&!e.denominator)return null;var t=Number(e.numerator)/Number(e.denominator);t*=100;var i=Number(e.decimals);return isNaN(i)&&(i=1),t=t.toFixed(i),Number(t)},hn={math:function(e,t){var i=Pe(e,["formula"]);return t.push(i),"\n\n"+(i.formula||"")+"\n\n"},frac:function(e,t){var i=Pe(e,["a","b","c"]),n={template:"sfrac"};return i.c?(n.integer=i.a,n.numerator=i.b,n.denominator=i.c):i.b?(n.numerator=i.a,n.denominator=i.b):(n.numerator=1,n.denominator=i.a),t.push(n),n.integer?"".concat(n.integer," ").concat(n.numerator,"⁄").concat(n.denominator):"".concat(n.numerator,"⁄").concat(n.denominator)},radic:function(e){var t=Pe(e,["after","before"]);return"".concat(t.before||"","√").concat(t.after||"")},percentage:function(e){var t=Pe(e,["numerator","denominator","decimals"]),i=gn(t);return null===i?"":i+"%"},"percent-done":function(e){var t=Pe(e,["done","total","digits"]),i=gn({numerator:t.done,denominator:t.total,decimals:t.digits});return null===i?"":"".concat(t.done," (").concat(i,"%) done")},"winning percentage":function(e,t){var i=Pe(e,["wins","losses","ties"]);t.push(i);var n=Number(i.wins),a=Number(i.losses),r=Number(i.ties)||0,o=n+a+r;"y"===i.ignore_ties&&(r=0),r&&(n+=r/2);var s=gn({numerator:n,denominator:o,decimals:1});return null===s?"":".".concat(10*s)},winlosspct:function(e,t){var i=Pe(e,["wins","losses"]);t.push(i);var n=Number(i.wins),a=Number(i.losses),r=gn({numerator:n,denominator:n+a,decimals:1});return null===r?"":(r=".".concat(10*r),"".concat(n||0," || ").concat(a||0," || ").concat(r||"-"))}};hn.sfrac=hn.frac,hn.sqrt=hn.radic,hn.pct=hn.percentage,hn.percent=hn.percentage,hn.winpct=hn["winning percentage"],hn.winperc=hn["winning percentage"];var bn=hn,kn=function(e,t,i){var n=Pe(e);return i&&(n.name=n.template,n.template=i),t.push(n),""},wn={persondata:kn,taxobox:kn,citation:kn,portal:kn,reflist:kn,"cite book":kn,"cite journal":kn,"cite web":kn,"commons cat":kn,"portuguese name":["first","second","suffix"],uss:["ship","id"],isbn:function(e,t){var i=Pe(e,["id","id2","id3"]);return t.push(i),"ISBN: "+(i.id||"")},marriage:function(e,t){var i=Pe(e,["spouse","from","to","end"]);t.push(i);var n="".concat(i.spouse||"");return i.from&&(i.to?n+=" (m. ".concat(i.from,"-").concat(i.to,")"):n+=" (m. ".concat(i.from,")")),n},"based on":function(e,t){var i=Pe(e,["title","author"]);return t.push(i),"".concat(i.title," by ").concat(i.author||"")},"video game release":function(e,t){for(var i=["region","date","region2","date2","region3","date3","region4","date4"],n=Pe(e,i),a={template:"video game release",releases:[]},r=0;r0&&t.push(c),""},Zn=function(e){Object.defineProperty(this,"data",{enumerable:!1,value:e})},Gn={text:function(){return""},json:function(){return this.data}};Object.keys(Gn).forEach((function(e){Zn.prototype[e]=Gn[e]}));var Hn=Zn,Vn=new RegExp("^(cite |citation)","i"),Jn={citation:!0,refn:!0,harvnb:!0},Qn=function(e){return"infobox"===e.template&&e.data&&function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)}(e.data)},Xn=function(e){var t=e.wiki,i=Xt(t),n=[];i.forEach((function(e){return function e(i,a){i.parent=a,i.children&&i.children.length>0&&i.children.forEach((function(t){return e(t,i)})),i.out=Yn(i,n);!function e(t,i,n){t.parent&&(t.parent.body=t.parent.body.replace(i,n),e(t.parent,i,n))}(i,i.body,i.out),t=t.replace(i.body,i.out)}(e,null)})),e.infoboxes=e.infoboxes||[],e.references=e.references||[],e.templates=e.templates||[],e.templates=e.templates.concat(n),e.templates=e.templates.filter((function(t){return!0===function(e){return!0===Jn[e.template]||!0===Vn.test(e.template)}(t)?(e.references.push(new Ue(t)),!1):!0!==Qn(t)||(e.infoboxes.push(new Zt(t)),!1)})),e.templates=e.templates.map((function(e){return new Hn(e)})),i.forEach((function(e){t=t.replace(e.body,e.out)})),e.wiki=t},ea=Ee,ta=function(e){var t=e.wiki;t=t.replace(/]*?)>([\s\S]+?)<\/gallery>/g,(function(t,i,n){var a=n.split(/\n/g);return(a=(a=a.filter((function(e){return e&&""!==e.trim()}))).map((function(e){var t=e.split(/\|/),i={file:t[0].trim()},n=new z(i).json(),a=t.slice(1).join("|");return""!==a&&(n.caption=ea(a)),n}))).length>0&&e.templates.push({template:"gallery",images:a,pos:e.title}),""})),e.wiki=t},ia=function(e){var t=e.wiki;t=t.replace(/\{\{election box begin([\s\S]+?)\{\{election box end\}\}/gi,(function(t){var i={wiki:t,templates:[]};Xn(i);var n=i.templates.map((function(e){return e.json()})),a=n.find((function(e){return"election box"===e.template}))||{},r=n.filter((function(e){return"election box candidate"===e.template})),o=n.find((function(e){return"election box gain"===e.template||"election box hold"===e.template}))||{};return(r.length>0||o)&&e.templates.push({template:"election box",title:a.title,candidates:r,summary:o.data}),""})),e.wiki=t},na={coach:["team","year","g","w","l","w-l%","finish","pg","pw","pl","pw-l%"],player:["year","team","gp","gs","mpg","fg%","3p%","ft%","rpg","apg","spg","bpg","ppg"],roster:["player","gp","gs","mpg","fg%","3fg%","ft%","rpg","apg","spg","bpg","ppg"]},aa=function(e){var t=e.wiki;t=t.replace(/\{\{nba (coach|player|roster) statistics start([\s\S]+?)\{\{s-end\}\}/gi,(function(t,i){t=(t=t.replace(/^\{\{.*?\}\}/,"")).replace(/\{\{s-end\}\}/,""),i=i.toLowerCase().trim();var n="! "+na[i].join(" !! "),a=ot("{|\n"+n+"\n"+t+"\n|}");return a=a.map((function(e){return Object.keys(e).forEach((function(t){e[t]=e[t].text()})),e})),e.templates.push({template:"NBA "+i+" statistics",data:a}),""})),e.wiki=t},ra=function(e){var t=e.wiki;t=t.replace(/\{\{mlb game log (section|month)[\s\S]+?\{\{mlb game log (section|month) end\}\}/gi,(function(t){var i=function(e){var t=["#","date","opponent","score","win","loss","save","attendance","record"];return!0===/\|stadium=y/i.test(e)&&t.splice(7,0,"stadium"),!0===/\|time=y/i.test(e)&&t.splice(7,0,"time"),!0===/\|box=y/i.test(e)&&t.push("box"),t}(t);t=(t=t.replace(/^\{\{.*?\}\}/,"")).replace(/\{\{mlb game log (section|month) end\}\}/i,"");var n="! "+i.join(" !! "),a=ot("{|\n"+n+"\n"+t+"\n|}");return a=a.map((function(e){return Object.keys(e).forEach((function(t){e[t]=e[t].text()})),e})),e.templates.push({template:"mlb game log section",data:a}),""})),e.wiki=t},oa=["res","record","opponent","method","event","date","round","time","location","notes"],sa=function(e){var t=e.wiki;t=t.replace(/\{\{mma record start[\s\S]+?\{\{end\}\}/gi,(function(t){t=(t=t.replace(/^\{\{.*?\}\}/,"")).replace(/\{\{end\}\}/i,"");var i="! "+oa.join(" !! "),n=ot("{|\n"+i+"\n"+t+"\n|}");return n=n.map((function(e){return Object.keys(e).forEach((function(t){e[t]=e[t].text()})),e})),e.templates.push({template:"mma record start",data:n}),""})),e.wiki=t},ca=Ee,ua=function(e){var t=e.wiki;t=(t=t.replace(/]