{"version":3,"sources":["/w/extensions/Popups/webpack/bootstrap","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/defineProperty.js","/w/extensions/Popups/./node_modules/redux-thunk/dist/redux-thunk.min.js","/w/extensions/Popups/./node_modules/redux/dist/redux.min.js","/w/extensions/Popups/(webpack)/buildin/global.js","/w/extensions/Popups/(webpack)/buildin/module.js","/w/extensions/Popups/./src/constants.js","/w/extensions/Popups/./src/bracketedPixelRatio.js","/w/extensions/Popups/./src/preview/model.js","/w/extensions/Popups/./src/formatter.js","/w/extensions/Popups/./src/gateway/mediawiki.js","/w/extensions/Popups/./src/gateway/rest.js","/w/extensions/Popups/./src/gateway/restFormatters.js","/w/extensions/Popups/./src/gateway/page.js","/w/extensions/Popups/./src/gateway/reference.js","/w/extensions/Popups/./src/ui/templates/templateUtil.js","/w/extensions/Popups/./src/ui/templates/settingsDialog/settingsDialog.js","/w/extensions/Popups/./src/ui/settingsDialogRenderer.js","/w/extensions/Popups/./src/ui/settingsDialog.js","/w/extensions/Popups/./src/changeListener.js","/w/extensions/Popups/./src/title.js","/w/extensions/Popups/./src/wait.js","/w/extensions/Popups/./src/ui/thumbnail.js","/w/extensions/Popups/./src/ui/templates/popup/popup.js","/w/extensions/Popups/./src/ui/templates/preview/preview.js","/w/extensions/Popups/./src/ui/templates/referencePreview/referencePreview.js","/w/extensions/Popups/./src/ui/templates/pagePreview/pagePreview.js","/w/extensions/Popups/./src/ui/renderer.js","/w/extensions/Popups/./src/changeListeners/syncUserSettings.js","/w/extensions/Popups/./src/changeListeners/index.js","/w/extensions/Popups/./src/changeListeners/footerLink.js","/w/extensions/Popups/./src/changeListeners/linkTitle.js","/w/extensions/Popups/./src/changeListeners/pageviews.js","/w/extensions/Popups/./src/changeListeners/render.js","/w/extensions/Popups/./src/changeListeners/settings.js","/w/extensions/Popups/./src/changeListeners/statsv.js","/w/extensions/Popups/./src/actionTypes.js","/w/extensions/Popups/./src/actions.js","/w/extensions/Popups/./src/reducers/nextState.js","/w/extensions/Popups/./src/reducers/index.js","/w/extensions/Popups/./src/reducers/pageviews.js","/w/extensions/Popups/./src/reducers/preview.js","/w/extensions/Popups/./src/reducers/settings.js","/w/extensions/Popups/./src/reducers/statsv.js","/w/extensions/Popups/./src/index.js","/w/extensions/Popups/./src/setUserConfigFlags.js","/w/extensions/Popups/./src/experiments.js","/w/extensions/Popups/./src/userSettings.js","/w/extensions/Popups/./src/isReferencePreviewsEnabled.js","/w/extensions/Popups/./src/instrumentation/statsv.js","/w/extensions/Popups/./src/isPagePreviewsEnabled.js","/w/extensions/Popups/./src/previewBehavior.js","/w/extensions/Popups/./src/integrations/mwpopups.js","/w/extensions/Popups/./src/ui/pointer-mask.svg"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","obj","configurable","writable","e","id","loaded","dispatch","getState","withExtraArgument","default","observable","self","window","global","Math","random","toString","substring","split","join","INIT","REPLACE","PROBE_UNKNOWN_ACTION","type","apply","this","arguments","u","a","length","Array","reduce","createStore","Error","f","slice","h","push","indexOf","splice","y","getPrototypeOf","subscribe","replaceReducer","TypeError","next","unsubscribe","combineReducers","keys","forEach","bindActionCreators","applyMiddleware","map","getOwnPropertySymbols","concat","filter","getOwnPropertyDescriptor","compose","__DO_NOT_USE__ActionTypes","g","Function","webpackPolyfill","deprecate","paths","children","bpr","dpr","devicePixelRatio","bracketedPixelRatio","BRACKETED_DEVICE_PIXEL_RATIO","THUMBNAIL_SIZE","max","EXTRACT_LENGTH","previewTypes","TYPE_GENERIC","TYPE_PAGE","TYPE_DISAMBIGUATION","TYPE_REFERENCE","createModel","title","url","languageCode","languageDirection","extract","thumbnail","pageId","processedExtract","processExtract","undefined","getPagePreviewType","createNullModel","getPreviewType","el","config","getNamespaceId","getMainText","isSelfLink","getFragment","$","parent","hasClass","formatPlainTextExtract","plainTextExtract","elements","boldIdentifier","snip","replace","trim","escapedTitle","mw","util","escapeRegExp","regExp","RegExp","part","text","document","createTextNode","makeTitleInExtractBold","extractPageFromResponse","data","query","pages","result","extend","formatter","convertPageToModel","page","canonicalurl","pagelanguagehtmlcode","pagelanguagedir","pageid","createRESTBaseGateway","ajax","extractParser","fetch","endpoint","encodeURIComponent","headers","Accept","acceptLanguage","fetchPreviewForTitle","titleText","getPrefixedDb","xhr","then","catch","jqXHR","textStatus","errorThrown","Deferred","reject","exception","promise","abort","generateThumbnailData","original","thumbSize","parts","source","lastPart","originalIsSafe","filename","test","isSafeImgFormat","filenamePxIndex","width","height","floor","Title","getUrl","lang","dir","originalimage","parseHTMLResponse","extract_html","parseHTML","parsePlainTextResponse","createPagePreviewGateway","gatewayConfig","constants","restConfig","api","action","prop","formatversion","redirects","exintro","exchars","explaintext","exsectionformat","piprop","pithumbsize","pilicense","rvprop","inprop","titles","smaxage","maxage","uselang","createMediaWikiApiGateway","Api","formatters","createReferenceGateway","scrapeReferenceType","$referenceText","KNOWN_TYPES","find","each","index","element","classNames","className","idSelector","escapeSelector","scrapeReferenceText","readyState","model","html","referenceType","sourceElementId","parentNode","resolve","escapeHTML","str","escape","templates","createNodeFromTemplate","div","createElement","innerHTML","firstElementChild","cloneNode","renderSettingsDialog","heading","saveLabel","closeLabel","helpText","okLabel","choices","description","isChecked","escapeChoices","createSettingsDialogRenderer","referencePreviewsAvaliable","$dialog","$overlay","boundActions","msg","createSettingsDialog","addClass","on","enabled","is","saveSettings","hideSettings","appendTo","show","hide","toggleHelp","visible","$el","setEnabled","registerChangeListener","store","callback","previousState","state","fromElement","hash","host","location","pathname","search","isOwnPageAnchorLink","newFromText","decodeURIComponent","contentNamespaces","mwTitle","namespace","isValid","href","linkHref","Uri","hostname","queryLength","pattern","matches","exec","path","fragment","getTitle","wait","delay","deferred","setTimeout","SIZES","w","createThumbnail","rawThumbnail","useCSSClipPath","thumbWidth","thumbHeight","tall","x","aspectRatio","isSquare","img","isNarrow","src","thumbnailWidth","thumbnailHeight","nsSvg","line","createElementNS","points","setAttribute","$thumbnailSVGImage","setAttributeNS","attr","$thumbnail","xmlns","append","createThumbnailSVG","isTall","offset","renderPopup","container","appendChild","renderPreview","showTitle","extractMsg","linkMsg","$popup","remove","LOGGING_SCHEMA","isTracking","renderReferencePreview","titleMsg","message","exists","replaceWith","target","rel","removeClass","tabindex","track","scrolledToBottom","scrollTop","scrollHeight","clientHeight","isOpenRecorded","scrollbarsPresent","isScrollRecorded","isScrolling","$extract","hasHorizontalScroll","scrollWidth","clientWidth","scrollbarHeight","offsetHeight","hasVerticalScroll","scrollbarWidth","offsetWidth","css","bottom","right","toggleClass","navigator","sendBeacon","renderPagePreview","withCSSClipPath","linkTitle","extractWidth","getExtractWidth","init","supportsCSSClipPath","body","pointerMaskSVG","render","preview","hasThumbnail","createPagePreview","createDisambiguationPreview","createReferencePreview","createEmptyPreview","createPreviewWithType","event","token","measures","$link","behavior","layout","isPreviewTall","pointerSpaceSize","offsetLeft","flippedX","flippedY","offsetTop","pageY","getClosestYPosition","clientRects","top","clientTop","clientY","pageX","left","windowWidth","windowHeight","createLayout","classes","predefinedLandscapeImageHeight","popup","maskID","getThumbnailClipPathID","matrix","scaleX","translateX","min","getElementById","setThumbnailClipPath","layoutPreview","hasPointerOnImage","getClasses","first","trigger","previewDwell","previewAbandon","click","settingsUrl","stopPropagation","showSettings","bindBehavior","previewShow","documentElement","getAttribute","fadeInClass","fadeOutClass","CSS","supports","rects","isTop","minY","rect","deltaY","abs","ceil","syncIfChanged","oldState","newState","sync","current","footerLink","$footerLink","$footer","createFooterLink","preventDefault","settings","shouldShowFooterLink","savedTitle","oldLink","activeLink","previewType","destroyTitleAttr","pageviews","pageviewTracker","pageview","source_page_id","source_namespace","namespaceId","source_title","source_url","page_id","page_namespace","page_title","pageviewLogged","previewBehavior","shouldShow","renderer","fetchResponse","activeToken","settingsObj","showHelp","statsv","statsvObj","statsvLogged","syncUserSettings","userSettings","storePreviewCount","storePagePreviewsEnabled","storeReferencePreviewsEnabled","timedAction","baseAction","timestamp","now","boot","initiallyEnabled","user","editCount","types","isNavPopupsEnabled","sessionToken","sessionId","pageToken","getPageviewToken","isAnon","gateway","chain","err","fetchType","when","FETCH_COMPLETE_TARGET_DELAY","getDwellDelay","ex","showNullPreview","linkDwell","generateToken","isNewInteraction","abandon","linkClick","currentToken","validType","oldValue","newValue","nextState","updates","hasOwn","constructor","clone","actionTypes","isUserDwelling","wasClicked","nothingChanged","every","userOptedOut","some","anyDisabled","fetchStartedAt","linkDwellStartedAt","EXCLUDED_LINK_SELECTORS","popupsFlags","parseInt","set","mwExperiments","storage","Redux","generateRandomSessionId","pagePreviewGateway","referenceGateway","isPagePreviewsEnabled","isReferencePreviewsEnabled","referencePreviewsState","options","settingsDialog","experiments","weightedBoolean","trueWeight","getBucket","buckets","true","false","statsvTracker","bucketingRate","isStatsvEnabled","getStatsvTracker","getPageviewTracker","createIsPagePreviewsEnabled","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","reducers","ReduxThunk","actions","createPreviewBehavior","registerActions","changeListeners","registerChangeListeners","popups","isEnabled","createMediaWikiPopupsObject","selectors","excludedLinksSelector","validLinkSelector","rendererInit","titleFromElement","$target","$window","getClientRects","log","warn"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,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AAOoE,EAAgBlE,KAAMoF,GAAGhB,OAAQyL,GAG9C,OAAS/P,GACR,KAAKkD,EAAaE,UACjB+a,EAAUyC,EACV,MACD,KAAK1d,EAAaI,eACjB6a,EAAU0C,EACV,MACD,QACC,OAGF,IAAMmC,EAAUre,EAAGzE,MACb+iB,EAAUte,EAAGtF,QAEbyX,EAAW,CAChBgB,MAAOlB,EAAMkB,MACbN,MAAOZ,EAAMY,MACbK,QAASjB,EAAMiB,QACf9O,MAAOia,EAAQja,QACfC,OAAQga,EAAQha,SAChB8J,OAAQkQ,EAAQlQ,SAChB4E,YAAaxX,KAAKgjB,iBAClBlL,YAAaiL,EAAQla,QACrBkP,aAAcgL,EAAQja,SACtBqL,UAAW4O,EAAQ5O,aAGpBrG,EAAa4Q,UAAW7O,EAAS7P,KAAM4W,EAAUqH,EAASU,EAAe7e,OAEzEoO,GAAI,gBAAiByU,GAAmB,WACxBE,EAAkB7iB,KAAMoF,GAAGhB,SAG1C0J,EAAa+Q,aAGd3Q,GAAI,QAASyU,GAAmB,WAChC,IAAM9S,EAAUgT,EAAkB7iB,KAAMoF,GAAGhB,QACtCyL,GACC7M,EAAaE,YAAcgB,EAAgBlE,KAAMoF,GAAGhB,OAAQyL,IAChE/B,EAAagR,UAAW9e,cA3D3BoF,GAAG6d,IAAIC,KAAM,oDAlEb,GAmIF/jB,OAAOqhB,MAAQA,EACfrhB,OAAO6iB,WAAaA,G,0CS9PpB1lB,EAAOD,QAAU","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.js\");\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define([],e):\"object\"==typeof exports?exports.ReduxThunk=e():t.ReduxThunk=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p=\"\",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e){\"use strict\";function n(t){return function(e){var n=e.dispatch,o=e.getState;return function(e){return function(r){return\"function\"==typeof r?r(n,o,t):e(r)}}}}e.__esModule=!0;var o=n();o.withExtraArgument=n,e.default=o}])});","!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?t(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],t):t(e.Redux={})}(this,function(e){\"use strict\";var t=function(e){var t,r=e.Symbol;return\"function\"==typeof r?r.observable?t=r.observable:(t=r(\"observable\"),r.observable=t):t=\"@@observable\",t}(\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof module?module:Function(\"return this\")()),r=function(){return Math.random().toString(36).substring(7).split(\"\").join(\".\")},n={INIT:\"@@redux/INIT\"+r(),REPLACE:\"@@redux/REPLACE\"+r(),PROBE_UNKNOWN_ACTION:function(){return\"@@redux/PROBE_UNKNOWN_ACTION\"+r()}};function o(e,t){var r=t&&t.type;return\"Given \"+(r&&'action \"'+r+'\"'||\"an action\")+', reducer \"'+e+'\" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function i(e,t){return function(){return t(e.apply(this,arguments))}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}e.createStore=function e(r,o,i){var u;if(\"function\"==typeof o&&\"function\"==typeof i||\"function\"==typeof i&&\"function\"==typeof arguments[3])throw Error(\"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function\");if(\"function\"==typeof o&&void 0===i&&(i=o,o=void 0),void 0!==i){if(\"function\"!=typeof i)throw Error(\"Expected the enhancer to be a function.\");return i(e)(r,o)}if(\"function\"!=typeof r)throw Error(\"Expected the reducer to be a function.\");var a=r,c=o,f=[],s=f,d=!1;function l(){s===f&&(s=f.slice())}function p(){if(d)throw Error(\"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.\");return c}function h(e){if(\"function\"!=typeof e)throw Error(\"Expected the listener to be a function.\");if(d)throw Error(\"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.\");var t=!0;return l(),s.push(e),function(){if(t){if(d)throw Error(\"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.\");t=!1,l();var r=s.indexOf(e);s.splice(r,1)}}}function y(e){if(!function(e){if(\"object\"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw Error(\"Actions must be plain objects. Use custom middleware for async actions.\");if(void 0===e.type)throw Error('Actions may not have an undefined \"type\" property. Have you misspelled a constant?');if(d)throw Error(\"Reducers may not dispatch actions.\");try{d=!0,c=a(c,e)}finally{d=!1}for(var t=f=s,r=0;t.length>r;r++)(0,t[r])();return e}return y({type:n.INIT}),(u={dispatch:y,subscribe:h,getState:p,replaceReducer:function(e){if(\"function\"!=typeof e)throw Error(\"Expected the nextReducer to be a function.\");a=e,y({type:n.REPLACE})}})[t]=function(){var e,r=h;return(e={subscribe:function(e){if(\"object\"!=typeof e||null===e)throw new TypeError(\"Expected the observer to be an object.\");function t(){e.next&&e.next(p())}return t(),{unsubscribe:r(t)}}})[t]=function(){return this},e},u},e.combineReducers=function(e){for(var t=Object.keys(e),r={},i=0;t.length>i;i++){var u=t[i];\"function\"==typeof e[u]&&(r[u]=e[u])}var a,c=Object.keys(r);try{!function(e){Object.keys(e).forEach(function(t){var r=e[t];if(void 0===r(void 0,{type:n.INIT}))throw Error('Reducer \"'+t+\"\\\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.\");if(void 0===r(void 0,{type:n.PROBE_UNKNOWN_ACTION()}))throw Error('Reducer \"'+t+\"\\\" returned undefined when probed with a random type. Don't try to handle \"+n.INIT+' or other actions in \"redux/*\" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}(r)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var n=!1,i={},u=0;c.length>u;u++){var f=c[u],s=e[f],d=(0,r[f])(s,t);if(void 0===d){var l=o(f,t);throw Error(l)}i[f]=d,n=n||d!==s}return n?i:e}},e.bindActionCreators=function(e,t){if(\"function\"==typeof e)return i(e,t);if(\"object\"!=typeof e||null===e)throw Error(\"bindActionCreators expected an object or a function, instead received \"+(null===e?\"null\":typeof e)+'. Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?');for(var r=Object.keys(e),n={},o=0;r.length>o;o++){var u=r[o],a=e[u];\"function\"==typeof a&&(n[u]=i(a,t))}return n},e.applyMiddleware=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw Error(\"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.\")},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},i=t.map(function(e){return e(o)});return function(e){for(var t=1;arguments.length>t;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);\"function\"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){u(e,t,r[t])})}return e}({},r,{dispatch:n=a.apply(void 0,i)(r.dispatch)})}}},e.compose=a,e.__DO_NOT_USE__ActionTypes=n,Object.defineProperty(e,\"__esModule\",{value:!0})});\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","import bracketedPixelRatio from './bracketedPixelRatio';\n\nconst bpr = bracketedPixelRatio();\n\nexport default {\n\tBRACKETED_DEVICE_PIXEL_RATIO: bpr,\n\t// See https://phabricator.wikimedia.org/T272169: requesting a larger thumbnail to avoid bluriness\n\tTHUMBNAIL_SIZE: 320 * Math.max( bpr, 1.5 ),\n\tEXTRACT_LENGTH: 525\n};\n","/**\n * @module bracketedPixelRatio\n */\n\n/**\n * Normalizes a user's device pixel ratio to either 1, 1.5, or 2.\n *\n * This is important when the server resizes images on the fly in order to\n * reduce the work it has to do for device pixel ratios that deviate from a\n * set of common ratios.\n *\n * Adapted from mediawiki/core /resources/src/jquery/jquery.hidpi.js\n *\n * @param {number} [dpr=window.devicePixelRatio]\n * @return {number} The bracketed device pixel ratio\n */\nexport default function ( dpr = window.devicePixelRatio ) {\n\tif ( !dpr ) {\n\t\t// Probably legacy browser so assume 1\n\t\treturn 1;\n\t}\n\n\tif ( dpr > 1.5 ) {\n\t\treturn 2;\n\t}\n\n\tif ( dpr > 1 ) {\n\t\treturn 1.5;\n\t}\n\n\treturn 1;\n}\n","/**\n * @module preview/model\n */\n\n/**\n * Page Preview types as defined in Schema:Popups\n * https://meta.wikimedia.org/wiki/Schema:Popups\n *\n * @constant {Object}\n */\nconst previewTypes = {\n\t/** Empty preview used in error situations */\n\tTYPE_GENERIC: 'generic',\n\t/** Standard page preview with or without thumbnail */\n\tTYPE_PAGE: 'page',\n\t/** Disambiguation page preview */\n\tTYPE_DISAMBIGUATION: 'disambiguation',\n\t/** Reference preview */\n\tTYPE_REFERENCE: 'reference'\n};\n\nexport { previewTypes };\n\n/**\n * Preview Model\n *\n * @typedef {Object} PreviewModel\n * @property {string} url The canonical URL of the page being previewed\n * @property {string} type One of the previewTypes.TYPE_… constants.\n *\n * @global\n */\n\n/**\n * @typedef {Object} PagePreviewModel\n * @extends PreviewModel\n * @property {string} title\n * @property {Array|undefined} extract `undefined` if the extract isn't\n * viable, e.g. if it's empty after having ellipsis and parentheticals\n * removed; this can be used to present default or error states\n * @property {string} languageCode\n * @property {string} languageDirection Either \"ltr\" or \"rtl\", or an empty string if undefined.\n * @property {{source: string, width: number, height: number}|undefined} thumbnail\n * @property {number} pageId Currently not used by any known popup type.\n *\n * @global\n */\n\n/**\n * @typedef {Object} ReferencePreviewModel\n * @extends PreviewModel\n * @property {string} extract An HTML snippet, not necessarily with a single top-level node\n * @property {string} referenceType A type identifier, e.g. \"web\"\n * @property {string} sourceElementId ID of the parent element that triggered the preview\n *\n * @global\n */\n\n/**\n * Creates a page preview model.\n *\n * @param {string} title\n * @param {string} url The canonical URL of the page being previewed\n * @param {string} languageCode\n * @param {string} languageDirection Either \"ltr\" or \"rtl\"\n * @param {Array|undefined|null} extract\n * @param {string} type\n * @param {{source: string, width: number, height: number}|undefined} [thumbnail]\n * @param {number} [pageId]\n * @return {PagePreviewModel}\n */\nexport function createModel(\n\ttitle,\n\turl,\n\tlanguageCode,\n\tlanguageDirection,\n\textract,\n\ttype,\n\tthumbnail,\n\tpageId\n) {\n\tconst processedExtract = processExtract( extract ),\n\t\tpreviewType = getPagePreviewType( type, processedExtract );\n\n\treturn {\n\t\ttitle,\n\t\turl,\n\t\tlanguageCode,\n\t\tlanguageDirection,\n\t\textract: processedExtract,\n\t\ttype: previewType,\n\t\tthumbnail,\n\t\tpageId\n\t};\n}\n\n/**\n * Creates an empty page preview model.\n *\n * @param {string} title\n * @param {string} url\n * @return {PagePreviewModel}\n */\nexport function createNullModel( title, url ) {\n\treturn createModel( title, url, '', '', [], '' );\n}\n\n/**\n * Determines the applicable popup type based on title and link element.\n *\n * @param {HTMLAnchorElement} el\n * @param {mw.Map} config\n * @param {mw.Title} title\n * @return {string|null} One of the previewTypes.TYPE_… constants\n */\nexport function getPreviewType( el, config, title ) {\n\tif ( !isSelfLink( title, config ) ) {\n\t\treturn previewTypes.TYPE_PAGE;\n\t}\n\n\t// The other selector can potentially pick up self-links with a class=\"reference\"\n\t// parent, but no fragment\n\tif ( title.getFragment() &&\n\t\tconfig.get( 'wgPopupsReferencePreviews' ) &&\n\t\t// eslint-disable-next-line no-jquery/no-class-state\n\t\t$( el ).parent().hasClass( 'reference' )\n\t) {\n\t\treturn previewTypes.TYPE_REFERENCE;\n\t}\n\n\treturn null;\n}\n\n/**\n * @param {mw.Title} title\n * @param {mw.Map} config\n * @return {boolean} True when the link points to the current page.\n */\nfunction isSelfLink( title, config ) {\n\treturn title.getNamespaceId() === config.get( 'wgNamespaceNumber' ) &&\n\t\ttitle.getMainText() === config.get( 'wgTitle' );\n}\n\n/**\n * Processes the extract returned by the TextExtracts MediaWiki API query\n * module.\n *\n * If the extract is `undefined`, `null`, or empty, then `undefined` is\n * returned.\n *\n * @param {Array|undefined|null} extract\n * @return {Array|undefined} Array when extract is an not empty array, undefined\n * otherwise\n */\nfunction processExtract( extract ) {\n\tif ( extract === undefined || extract === null || extract.length === 0 ) {\n\t\treturn undefined;\n\t}\n\treturn extract;\n}\n\n/**\n * Determines the page preview type based on whether or not:\n * a. Is the preview empty.\n * b. The preview type matches one of previewTypes.\n * c. Assume standard page preview if both above are false\n *\n * @param {string} type\n * @param {Array|undefined} [processedExtract]\n * @return {string} One of the previewTypes.TYPE_… constants.\n */\n\nfunction getPagePreviewType( type, processedExtract ) {\n\tif ( processedExtract === undefined ) {\n\t\treturn previewTypes.TYPE_GENERIC;\n\t}\n\n\tswitch ( type ) {\n\t\tcase previewTypes.TYPE_GENERIC:\n\t\tcase previewTypes.TYPE_DISAMBIGUATION:\n\t\tcase previewTypes.TYPE_PAGE:\n\t\t\treturn type;\n\t\tdefault:\n\t\t\t/**\n\t\t\t * Assume type=\"page\" if extract exists & not one of previewTypes.\n\t\t\t * Note:\n\t\t\t * - Restbase response includes \"type\" prop but other gateways don't.\n\t\t\t * - event-logging Schema:Popups requires type=\"page\" but restbase\n\t\t\t * provides type=\"standard\". Model must conform to event-logging schema.\n\t\t\t */\n\t\t\treturn previewTypes.TYPE_PAGE;\n\t}\n}\n","/**\n * Improves the plain text extracts\n *\n * @param {string} plainTextExtract\n * @param {string} title\n * @return {Array}\n */\nexport function formatPlainTextExtract( plainTextExtract, title ) {\n\tlet extract = plainTextExtract;\n\tif ( plainTextExtract === undefined ) {\n\t\treturn [];\n\t}\n\n\t// After cleaning the extract it may have been blanked\n\tif ( extract.length === 0 ) {\n\t\treturn [];\n\t}\n\n\textract = makeTitleInExtractBold( extract, title );\n\treturn extract;\n}\n\n/**\n * Converts the extract into a list of elements, which correspond to fragments\n * of the extract. Fragments that match the title verbatim are wrapped in a\n * `` element.\n *\n * Using the bolded elements of the extract of the page directly is covered by\n * [T141651](https://phabricator.wikimedia.org/T141651).\n *\n * Extracted from `mw.popups.renderer.article.getProcessedElements`.\n *\n * @param {string} extract\n * @param {string} title\n * @return {Array} A set of HTML Elements\n */\nfunction makeTitleInExtractBold( extract, title ) {\n\tconst elements = [],\n\t\tboldIdentifier = ``,\n\t\tsnip = ``;\n\n\ttitle = title.replace( /\\s+/g, ' ' ).trim(); // Remove extra white spaces\n\tconst escapedTitle = mw.util.escapeRegExp( title );\n\tconst regExp = new RegExp( `(^|\\\\s)(${escapedTitle})(|$)`, 'i' );\n\n\t// Remove text in parentheses along with the parentheses\n\textract = extract.replace( /\\s+/, ' ' ); // Remove extra white spaces\n\n\t// Make title bold in the extract text\n\t// As the extract is html escaped there can be no such string in it\n\t// Also, the title is escaped of RegExp elements thus can't have \"*\"\n\textract = extract.replace(\n\t\tregExp,\n\t\t`$1${snip}${boldIdentifier}$2${snip}$3`\n\t);\n\textract = extract.split( snip );\n\n\textract.forEach( ( part ) => {\n\t\tif ( part.indexOf( boldIdentifier ) === 0 ) {\n\t\t\telements.push( $( '' )\n\t\t\t\t.text( part.slice( boldIdentifier.length ) ) );\n\t\t} else {\n\t\t\telements.push( document.createTextNode( part ) );\n\t\t}\n\t} );\n\n\treturn elements;\n}\n","/**\n * @module gateway/mediawiki\n */\n\nimport { createModel } from '../preview/model';\nimport * as formatter from '../formatter';\n\n// Public and private cache lifetime (5 minutes)\n//\n// FIXME: Move this to src/constants.js.\nconst CACHE_LIFETIME = 300;\n\n/**\n * @typedef {Gateway} MediaWikiGateway\n * @property {function(Object): Object} extractPageFromResponse\n * @property {function(Object): Object} formatPlainTextExtract\n */\n\n/**\n * Creates an instance of the MediaWiki API gateway.\n *\n * @param {mw.Api} api\n * @param {Object} config Configuration that affects the major behavior of the\n * gateway.\n * @param {number} config.THUMBNAIL_SIZE The length of the major dimension of\n * the thumbnail.\n * @param {number} config.EXTRACT_LENGTH The maximum length, in characters,\n * of the extract.\n * @param {string} config.acceptLanguage The accepted language sent in the\n * header\n * @return {MediaWikiGateway}\n */\nexport default function createMediaWikiApiGateway( api, config ) {\n\tfunction fetch( title ) {\n\t\treturn api.get( {\n\t\t\taction: 'query',\n\t\t\tprop: 'info|extracts|pageimages|revisions|info',\n\t\t\tformatversion: 2,\n\t\t\tredirects: true,\n\t\t\texintro: mw.config.get( 'wgPopupsTextExtractsIntroOnly', true ),\n\t\t\texchars: config.EXTRACT_LENGTH,\n\n\t\t\t// There is an added geometric limit on .mwe-popups-extract\n\t\t\t// so that text does not overflow from the card.\n\t\t\texplaintext: true,\n\t\t\texsectionformat: 'plain',\n\n\t\t\tpiprop: 'thumbnail',\n\t\t\tpithumbsize: config.THUMBNAIL_SIZE,\n\t\t\tpilicense: 'any',\n\t\t\trvprop: 'timestamp',\n\t\t\tinprop: 'url',\n\t\t\ttitles: title,\n\t\t\tsmaxage: CACHE_LIFETIME,\n\t\t\tmaxage: CACHE_LIFETIME,\n\t\t\tuselang: 'content'\n\t\t}, {\n\t\t\theaders: {\n\t\t\t\t'X-Analytics': 'preview=1',\n\t\t\t\t'Accept-Language': config.acceptLanguage\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * @param {mw.Title} title\n\t * @return {AbortPromise}\n\t */\n\tfunction fetchPreviewForTitle( title ) {\n\t\tconst xhr = fetch( title.getPrefixedDb() );\n\t\treturn xhr.then( ( data ) => {\n\t\t\tconst page = extractPageFromResponse( data );\n\t\t\tconst plainTextExtract = formatPlainTextExtract( page );\n\t\t\treturn convertPageToModel( plainTextExtract );\n\t\t} ).promise( {\n\t\t\tabort() {\n\t\t\t\txhr.abort();\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn {\n\t\tfetch,\n\t\textractPageFromResponse,\n\t\tconvertPageToModel,\n\t\tfetchPreviewForTitle,\n\t\tformatPlainTextExtract\n\t};\n}\n\n/**\n * Extracts page data from the API response.\n *\n * @method\n * @name MediaWikiGateway#extractPageFromResponse\n * @param {Object} data The response\n * @throws {Error} If the response is empty or doesn't contain data about the\n * page\n * @return {Object}\n */\nfunction extractPageFromResponse( data ) {\n\tif (\n\t\tdata.query &&\n\t\tdata.query.pages &&\n\t\tdata.query.pages.length\n\t) {\n\t\treturn data.query.pages[ 0 ];\n\t}\n\n\tthrow new Error( 'API response `query.pages` is empty.' );\n}\n\n/**\n * Make plain text nicer by applying formatter.\n *\n * @method\n * @name MediaWikiGateway#formatPlainTextExtract\n * @param {Object} data The response\n * @return {Object}\n */\nfunction formatPlainTextExtract( data ) {\n\tconst result = $.extend( {}, data );\n\tresult.extract = formatter.formatPlainTextExtract( data.extract, data.title );\n\treturn result;\n}\n\n/**\n * Converts the API response to a preview model.\n *\n * @method\n * @name MediaWikiGateway#convertPageToModel\n * @param {Object} page\n * @return {PagePreviewModel}\n */\nfunction convertPageToModel( page ) {\n\treturn createModel(\n\t\tpage.title,\n\t\tpage.canonicalurl,\n\t\tpage.pagelanguagehtmlcode,\n\t\tpage.pagelanguagedir,\n\t\tpage.extract,\n\t\tpage.type,\n\t\tpage.thumbnail,\n\t\tpage.pageid\n\t);\n}\n","/**\n * @module gateway/rest\n */\n\nimport { createModel } from '../preview/model';\n\nconst RESTBASE_PROFILE = 'https://www.mediawiki.org/wiki/Specs/Summary/1.2.0';\n\n/** @typedef {function(JQuery.AjaxSettings=): JQuery.jqXHR} Ajax */\n\n/**\n * Creates an instance of the RESTBase gateway.\n *\n * This gateway differs from the {@link MediaWikiGateway MediaWiki gateway} in\n * that it fetches page data from [the RESTBase page summary endpoint][0].\n *\n * [0]: https://en.wikipedia.org/api/rest_v1/#!/Page_content/get_page_summary_title\n *\n * @param {Ajax} ajax A function with the same signature as `jQuery.ajax`\n * @param {Object} config Configuration that affects the major behavior of the\n * gateway.\n * @param {Function} extractParser A function that takes response and returns\n * parsed extract\n * @return {Gateway}\n */\nexport default function createRESTBaseGateway( ajax, config, extractParser ) {\n\t/**\n\t * Fetches page data from [the RESTBase page summary endpoint][0].\n\t *\n\t * [0]: https://en.wikipedia.org/api/rest_v1/#!/Page_content/get_page_summary_title\n\t *\n\t * @method\n\t * @name RESTBaseGateway#fetch\n\t * @param {string} title\n\t * @return {JQuery.jqXHR}\n\t */\n\tfunction fetch( title ) {\n\t\tconst endpoint = config.endpoint;\n\n\t\treturn ajax( {\n\t\t\turl: endpoint + encodeURIComponent( title ),\n\t\t\theaders: {\n\t\t\t\tAccept: `application/json; charset=utf-8; profile=\"${RESTBASE_PROFILE}\"`,\n\t\t\t\t'Accept-Language': config.acceptLanguage\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * @param {mw.Title} title\n\t * @return {AbortPromise}\n\t */\n\tfunction fetchPreviewForTitle( title ) {\n\t\tconst titleText = title.getPrefixedDb(),\n\t\t\txhr = fetch( titleText );\n\t\treturn xhr.then( ( page ) => {\n\t\t\t// Endpoint response may be empty or simply missing a title.\n\t\t\tpage = page || {};\n\t\t\tpage.title = page.title || titleText;\n\t\t\t// And extract may be omitted if empty string\n\t\t\tpage.extract = page.extract || '';\n\t\t\treturn convertPageToModel(\n\t\t\t\tpage, config.THUMBNAIL_SIZE, extractParser\n\t\t\t);\n\t\t} ).catch( ( jqXHR, textStatus, errorThrown ) => {\n\t\t\t// The client will choose how to handle these errors which may include\n\t\t\t// those due to HTTP 4xx and 5xx status. The rejection typing matches\n\t\t\t// fetch failures.\n\t\t\treturn $.Deferred().reject( 'http', {\n\t\t\t\txhr: jqXHR,\n\t\t\t\ttextStatus,\n\t\t\t\texception: errorThrown\n\t\t\t} );\n\t\t} ).promise( { abort() { xhr.abort(); } } );\n\t}\n\n\treturn {\n\t\tfetch,\n\t\tconvertPageToModel,\n\t\tfetchPreviewForTitle\n\t};\n}\n\n/**\n * Checks whether the `originalImage` property contains an image\n * format that's safe to render.\n * https://www.mediawiki.org/wiki/Help:Images#Supported_media_types_for_images\n *\n * @param {string} filename\n *\n * @return {boolean}\n */\nfunction isSafeImgFormat( filename ) {\n\tconst safeImage = new RegExp( /\\.(jpg|jpeg|png|gif)$/i );\n\treturn safeImage.test( filename );\n}\n\n/**\n * Resizes the thumbnail to the requested width, preserving its aspect ratio.\n *\n * The requested width is limited to that of the original image unless the image\n * is an SVG, which can be scaled infinitely.\n *\n * This function is only intended to mangle the pretty thumbnail URLs used on\n * Wikimedia Commons. Once [an official thumb API](https://phabricator.wikimedia.org/T66214)\n * is fully specified and implemented, this function can be made more general.\n *\n * @param {Object} thumbnail The thumbnail image\n * @param {Object} original The original image\n * @param {number} thumbSize The requested size\n * @return {{source: string, width: number, height: number}|undefined}\n */\nfunction generateThumbnailData( thumbnail, original, thumbSize ) {\n\tconst parts = thumbnail.source.split( '/' ),\n\t\tlastPart = parts[ parts.length - 1 ],\n\t\toriginalIsSafe = isSafeImgFormat( original.source ) || undefined;\n\n\t// The last part, the thumbnail's full filename, is in the following form:\n\t// ${width}px-${filename}.${extension}. Splitting the thumbnail's filename\n\t// makes this function resilient to the thumbnail not having the same\n\t// extension as the original image, which is definitely the case for SVG's\n\t// where the thumbnail's extension is .svg.png.\n\tconst filenamePxIndex = lastPart.indexOf( 'px-' );\n\tif ( filenamePxIndex === -1 ) {\n\t\t// The thumbnail size is not customizable. Presumably, RESTBase requested a\n\t\t// width greater than the original and so MediaWiki returned the original's\n\t\t// URL instead of a thumbnail compatible URL. An original URL does not have\n\t\t// a \"thumb\" path, e.g.:\n\t\t//\n\t\t// https://upload.wikimedia.org/wikipedia/commons/a/aa/Red_Giant_Earth_warm.jpg\n\t\t//\n\t\t// Instead of:\n\t\t//\n\t\t// https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Red_Giant_Earth_warm.jpg/512px-Red_Giant_Earth_warm.jpg\n\t\t//\n\t\t// Use the original if it's a supported image format.\n\t\treturn originalIsSafe && original;\n\t}\n\tconst filename = lastPart.slice( filenamePxIndex + 3 );\n\n\t// Scale the thumbnail's largest dimension.\n\tlet width, height;\n\tif ( thumbnail.width > thumbnail.height ) {\n\t\twidth = thumbSize;\n\t\theight = Math.floor( ( thumbSize / thumbnail.width ) * thumbnail.height );\n\t} else {\n\t\twidth = Math.floor( ( thumbSize / thumbnail.height ) * thumbnail.width );\n\t\theight = thumbSize;\n\t}\n\n\t// If the image isn't an SVG, then it shouldn't be scaled past its original\n\t// dimensions.\n\tif ( width >= original.width && filename.indexOf( '.svg' ) === -1 ) {\n\t\t// if the image format is not supported, it shouldn't be rendered.\n\t\treturn originalIsSafe && original;\n\t}\n\n\tparts[ parts.length - 1 ] = `${width}px-${filename}`;\n\n\treturn {\n\t\tsource: parts.join( '/' ),\n\t\twidth,\n\t\theight\n\t};\n}\n\n/**\n * Converts the API response to a preview model.\n *\n * @method\n * @name RESTBaseGateway#convertPageToModel\n * @param {Object} page\n * @param {number} thumbSize\n * @param {Function} extractParser\n * @return {PagePreviewModel}\n */\nexport function convertPageToModel( page, thumbSize, extractParser ) {\n\treturn createModel(\n\t\tpage.title,\n\t\tnew mw.Title( page.title ).getUrl(),\n\t\tpage.lang,\n\t\tpage.dir,\n\t\textractParser( page ),\n\t\tpage.type,\n\t\tpage.thumbnail ?\n\t\t\tgenerateThumbnailData(\n\t\t\t\tpage.thumbnail, page.originalimage, thumbSize\n\t\t\t) : undefined,\n\t\tpage.pageid\n\t);\n}\n","import * as formatter from '../formatter';\n\n/**\n * Prepare extract\n *\n * @param {Object} page Rest response\n * @return {Array} An array of DOM Elements\n */\nexport function parseHTMLResponse( page ) {\n\tconst extract = page.extract_html;\n\n\treturn extract.length === 0 ? [] : $.parseHTML( extract );\n}\n\n/**\n * Prepare extract\n *\n * @param {Object} page Rest response\n * @return {Array} An array of DOM Elements\n */\nexport function parsePlainTextResponse( page ) {\n\treturn formatter.formatPlainTextExtract( page.extract, page.title );\n}\n","/**\n * @module gateway/page\n */\n\nimport constants from '../constants';\nimport createMediaWikiApiGateway from './mediawiki';\nimport createRESTBaseGateway from './rest';\nimport * as formatters from './restFormatters';\n\n/**\n * Creates a page preview gateway with sensible values for the dependencies.\n *\n * @param {mw.Map} config\n * @return {Gateway}\n */\nexport default function createPagePreviewGateway( config ) {\n\tconst gatewayConfig = $.extend( {}, constants, {\n\t\tacceptLanguage: config.get( 'wgPageContentLanguage' )\n\t} );\n\tconst restConfig = $.extend( {}, gatewayConfig, {\n\t\tendpoint: config.get( 'wgPopupsRestGatewayEndpoint' )\n\t} );\n\tswitch ( config.get( 'wgPopupsGateway' ) ) {\n\t\tcase 'mwApiPlain':\n\t\t\treturn createMediaWikiApiGateway( new mw.Api(), gatewayConfig );\n\t\tcase 'restbasePlain':\n\t\t\treturn createRESTBaseGateway(\n\t\t\t\t$.ajax, restConfig, formatters.parsePlainTextResponse );\n\t\tcase 'restbaseHTML':\n\t\t\treturn createRESTBaseGateway(\n\t\t\t\t$.ajax, restConfig, formatters.parseHTMLResponse );\n\t\tdefault:\n\t\t\tthrow new Error( 'Unknown gateway' );\n\t}\n}\n","/**\n * @module gateway/reference\n */\n\nimport { previewTypes } from '../preview/model';\n\n/**\n * @return {Gateway}\n */\nexport default function createReferenceGateway() {\n\n\tfunction scrapeReferenceText( id ) {\n\t\tconst idSelector = `#${$.escapeSelector( id )}`;\n\n\t\t/**\n\t\t * Same alternative selectors with and without mw-… as in the RESTbased endpoint.\n\t\t *\n\t\t * @see https://phabricator.wikimedia.org/diffusion/GMOA/browse/master/lib/transformations/references/structureReferenceListContent.js$138\n\t\t */\n\t\treturn $( `${idSelector} .mw-reference-text, ${idSelector} .reference-text` );\n\t}\n\n\t/**\n\t * Attempts to find a single reference type identifier, limited to a list of known types.\n\t * - When a `class=\"…\"` attribute mentions multiple known types, the last one is used, following\n\t * CSS semantics.\n\t * - When there are multiple tags, the first with a known type is used.\n\t *\n\t * @param {JQuery} $referenceText\n\t * @return {string|null}\n\t */\n\tfunction scrapeReferenceType( $referenceText ) {\n\t\tconst KNOWN_TYPES = [ 'book', 'journal', 'news', 'note', 'web' ];\n\t\tlet type = null;\n\t\t$referenceText.find( 'cite[class]' ).each( ( index, element ) => {\n\t\t\tconst classNames = element.className.split( /\\s+/ );\n\t\t\tfor ( let i = classNames.length; i--; ) {\n\t\t\t\tif ( KNOWN_TYPES.indexOf( classNames[ i ] ) !== -1 ) {\n\t\t\t\t\ttype = classNames[ i ];\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t\treturn type;\n\t}\n\n\t/**\n\t * @param {mw.Title} title\n\t * @param {HTMLAnchorElement} el\n\t * @return {AbortPromise}\n\t */\n\tfunction fetchPreviewForTitle( title, el ) {\n\t\t// Need to encode the fragment again as mw.Title returns it as decoded text\n\t\tconst id = title.getFragment().replace( / /g, '_' ),\n\t\t\t$referenceText = scrapeReferenceText( id );\n\n\t\tif ( !$referenceText.length ||\n\t\t\t// Skip references that don't contain anything but whitespace, e.g. a single  \n\t\t\t( !$referenceText.text().trim() && !$referenceText.children().length )\n\t\t) {\n\t\t\treturn $.Deferred().reject(\n\t\t\t\t'Footnote not found or empty',\n\t\t\t\t// Required to set `showNullPreview` to false and not open an error popup\n\t\t\t\t{ textStatus: 'abort', xhr: { readyState: 0 } }\n\t\t\t).promise( { abort() {} } );\n\t\t}\n\n\t\tconst model = {\n\t\t\turl: `#${id}`,\n\t\t\textract: $referenceText.html(),\n\t\t\ttype: previewTypes.TYPE_REFERENCE,\n\t\t\treferenceType: scrapeReferenceType( $referenceText ),\n\t\t\t// Note: Even the top-most HTMLHtmlElement is guaranteed to have a parent.\n\t\t\tsourceElementId: el.parentNode.id\n\t\t};\n\n\t\treturn $.Deferred().resolve( model ).promise( { abort() {} } );\n\t}\n\n\treturn {\n\t\tfetchPreviewForTitle\n\t};\n}\n","/**\n * @module templateUtil\n */\n\n/**\n * @param {string} str\n * @return {string} The string with any HTML entities escaped.\n */\nexport function escapeHTML( str ) {\n\treturn mw.html.escape( str );\n}\n\nconst templates = {};\n/**\n * @param {string} html markup of the template\n * @return {Element} a cloned root element of the template\n */\nexport function createNodeFromTemplate( html ) {\n\tif ( !templates[ html ] ) {\n\t\t// TODO: use