{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./_src/js/shared-ui.js","webpack:///./node_modules/@wpmudev/shared-ui/js/modals.js","webpack:///./node_modules/@wpmudev/shared-ui/js/notifications.js","webpack:///(webpack)/buildin/global.js","webpack:///./node_modules/@wpmudev/shared-ui/js/a11y-dialog.js"],"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","A11yDialog","$","window","SUI","document","addEventListener","mainEl","dialogs","each","this","id","jQuery","delay","slideUp","click","e","preventDefault","parent","stop","g","Function","eval","__WEBPACK_AMD_DEFINE_RESULT__","global","focusedBeforeDialog","FOCUSABLE_ELEMENTS","node","targets","_show","show","_hide","hide","_maintainFocus","_bindKeypress","_listeners","toArray","collection","Array","slice","$$","selector","context","querySelectorAll","setFocusToFirstItem","focusableChildren","getFocusableChildren","length","focus","join","filter","child","offsetWidth","offsetHeight","getClientRects","_targets","target","NodeList","isPrototypeOf","Element","collect","siblings","parentNode","childNodes","nodeType","splice","indexOf","getSiblings","setAttribute","shown","_openers","forEach","opener","_closers","concat","closer","_fire","event","overlay","getElementsByClassName","className","removeAttribute","original","getAttribute","activeElement","body","getElementsByTagName","classList","add","timeout_node","setTimeout","removeEventListener","remove","destroy","on","type","handler","push","off","index","listener","which","focusedItemIndex","shiftKey","trapTabKey","contains","undefined","apply"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,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AAyB,WAAA4D,GAAA7B,QAAA8B,GAMA,OAJAG,GAAA,GACAzF,KAAAyB,WAAA4D,GAAA9B,OAAAkC,EAAA,GAGAzF,MAWAT,EAAAJ,UAAA+E,MAAA,SAAAmB,EAAAlB,IACAnE,KAAAyB,WAAA4D,QAEAxB,QAAA,SAAA6B,GACAA,EAAA1F,KAAAiB,KAAAkD,IACKpF,KAAAiB,QAULT,EAAAJ,UAAAqC,cAAA,SAAA2C,GAGAnE,KAAA2D,OA/QA,KA+QAQ,EAAAwB,QACAxB,EAAA5D,iBACAP,KAAAsB,QAKAtB,KAAA2D,OAvRA,IAuRAQ,EAAAwB,OA8FA,SAAA1E,EAAAkD,GACA,IAAAhC,EAAAC,EAAAnB,GACA2E,EAAAzD,EAAAqB,QAAA7D,SAAA+E,eAKAP,EAAA0B,UAAA,IAAAD,GACAzD,IAAAE,OAAA,GAAAC,QACA6B,EAAA5D,kBAIK4D,EAAA0B,UAAAD,IAAAzD,EAAAE,OAAA,IACLF,EAAA,GAAAG,QACA6B,EAAA5D,kBA5GAuF,CAAA9F,KAAAiB,KAAAkD,IAWA5E,EAAAJ,UAAAoC,eAAA,SAAA4C,GAGAnE,KAAA2D,QAAA3D,KAAAiB,KAAA8E,SAAA5B,EAAArB,SACAZ,EAAAlC,KAAAiB,YAkHA,IAAA3D,QAAA,IAAAA,EAAAD,QACAC,EAAAD,QAAAkC,OAIKyG,KAFLnF,EAAA,WACA,OAAAtB,GACK0G,MAAA5I,SAAAC,EAAAD,QAAAwD,GAlaL,MAsaC,IAAAC,GAAArB","file":"shared-ui.min.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 = 128);\n","/**\n * Shared UI JS libraries. Use only what we need to keep the vendor file size smaller.\n */\nrequire('@wpmudev/shared-ui/js/a11y-dialog');\nrequire('@wpmudev/shared-ui/js/modals');\nrequire('@wpmudev/shared-ui/js/notifications');","( function( $ ) {\n\n\t// Enable strict mode.\n\t'use strict';\n\n\t// Define global SUI object if it doesn't exist.\n\tif ( 'object' !== typeof window.SUI ) {\n\t\twindow.SUI = {};\n\t}\n\n\tdocument.addEventListener( 'DOMContentLoaded', function() {\n\t\tvar mainEl = $( '.sui-wrap' );\n\t\tSUI.dialogs = {};\n\n\t\t// Init the dialog elements.\n\t\t$( '.sui-dialog' ).each( function() {\n\t\t\tSUI.dialogs[this.id] = new A11yDialog( this, mainEl );\n\t\t});\n\n\t});\n\n}( jQuery ) );\n","( function( $ ) {\n\n\t// This will auto hide the top notice if the classes .sui-can-dismiss or .sui-cant-dismiss aren't present.\n\t$( 'SUI_BODY_CLASS .sui-notice-top:not(.sui-can-dismiss, .sui-cant-dismiss)' ).delay( 3000 ).slideUp( 'slow' );\n\n\t$( 'SUI_BODY_CLASS .sui-notice-dismiss' ).click( function( e ) {\n\t\te.preventDefault();\n\n $( this ).parent().stop().slideUp( 'slow' );\n\n\t\treturn false;\n\t});\n\n}( jQuery ) );\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 || Function(\"return this\")() || (1, eval)(\"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","/* global NodeList, Element, define */\n\n(function (global) {\n 'use strict';\n\n var FOCUSABLE_ELEMENTS = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'iframe', 'object', 'embed', '[contenteditable]', '[tabindex]:not([tabindex^=\"-\"])'];\n var TAB_KEY = 9;\n var ESCAPE_KEY = 27;\n var focusedBeforeDialog;\n\n /**\n * Define the constructor to instantiate a dialog\n *\n * @constructor\n * @param {Element} node\n * @param {(NodeList | Element | string)} targets\n */\n function A11yDialog (node, targets) {\n // Prebind the functions that will be bound in addEventListener and\n // removeEventListener to avoid losing references\n this._show = this.show.bind(this);\n this._hide = this.hide.bind(this);\n this._maintainFocus = this._maintainFocus.bind(this);\n this._bindKeypress = this._bindKeypress.bind(this);\n\n // Keep a reference of the node on the instance\n this.node = node;\n\n // Keep an object of listener types mapped to callback functions\n this._listeners = {};\n\n // Initialise everything needed for the dialog to work properly\n this.create(targets);\n }\n\n /**\n * Set up everything necessary for the dialog to be functioning\n *\n * @param {(NodeList | Element | string)} targets\n * @return {this}\n */\n A11yDialog.prototype.create = function (targets) {\n // Keep a collection of nodes to disable/enable when toggling the dialog\n this._targets = this._targets || collect(targets) || getSiblings(this.node);\n\n // Make sure the dialog element is disabled on load, and that the `shown`\n // property is synced with its value\n this.node.setAttribute('aria-hidden', true);\n this.shown = false;\n\n // Keep a collection of dialog openers, each of which will be bound a click\n // event listener to open the dialog\n this._openers = $$('[data-a11y-dialog-show=\"' + this.node.id + '\"]');\n this._openers.forEach(function (opener) {\n opener.addEventListener('click', this._show);\n }.bind(this));\n\n // Keep a collection of dialog closers, each of which will be bound a click\n // event listener to close the dialog\n this._closers = $$('[data-a11y-dialog-hide]', this.node)\n .concat($$('[data-a11y-dialog-hide=\"' + this.node.id + '\"]'));\n this._closers.forEach(function (closer) {\n closer.addEventListener('click', this._hide);\n }.bind(this));\n\n // Execute all callbacks registered for the `create` event\n this._fire('create');\n\n return this;\n };\n\n /**\n * Show the dialog element, disable all the targets (siblings), trap the\n * current focus within it, listen for some specific key presses and fire all\n * registered callbacks for `show` event\n *\n * @param {Event} event\n * @return {this}\n */\n A11yDialog.prototype.show = function (event) {\n // If the dialog is already open, abort\n if (this.shown) {\n return this;\n }\n\n var overlay = this.node.getElementsByClassName('sui-dialog-overlay');\n var content = this.node.getElementsByClassName('sui-dialog-content');\n content[0].className = 'sui-dialog-content sui-bounce-in';\n overlay[0].className = 'sui-dialog-overlay sui-fade-in';\n\n this.shown = true;\n this.node.removeAttribute('aria-hidden');\n\n // Iterate over the targets to disable them by setting their `aria-hidden`\n // attribute to `true`; in case they already have this attribute, keep a\n // reference of their original value to be able to restore it later\n this._targets.forEach(function (target) {\n var original = target.getAttribute('aria-hidden');\n\n if (original) {\n target.setAttribute('data-a11y-dialog-original', original);\n }\n\n target.setAttribute('aria-hidden', 'true');\n });\n\n // Keep a reference to the currently focused element to be able to restore\n // it later, then set the focus to the first focusable child of the dialog\n // element\n focusedBeforeDialog = document.activeElement;\n setFocusToFirstItem(this.node);\n\n // Bind a focus event listener to the body element to make sure the focus\n // stays trapped inside the dialog while open, and start listening for some\n // specific key presses (TAB and ESC)\n document.body.addEventListener('focus', this._maintainFocus, true);\n document.addEventListener('keydown', this._bindKeypress);\n\n // Add overlay class to document body.\n document.getElementsByTagName( 'html' )[0].classList.add( 'sui-has-overlay' );\n\n // Execute all callbacks registered for the `show` event\n this._fire('show', event);\n\n return this;\n };\n\n /**\n * Hide the dialog element, enable all the targets (siblings), restore the\n * focus to the previously active element, stop listening for some specific\n * key presses and fire all registered callbacks for `hide` event\n *\n * @param {Event} event\n * @return {this}\n */\n A11yDialog.prototype.hide = function (event) {\n // If the dialog is already closed, abort\n if (!this.shown) {\n return this;\n }\n\n\n var overlay = this.node.getElementsByClassName('sui-dialog-overlay');\n\n var content = this.node.getElementsByClassName('sui-dialog-content');\n\n content[0].className = 'sui-dialog-content sui-bounce-out';\n\n overlay[0].className = 'sui-dialog-overlay sui-fade-out';\n\n this.shown = false;\n // This has been set so there is enough time for the animation to show\n var timeout_node = this.node;\n setTimeout(function () {\n\t\ttimeout_node.setAttribute('aria-hidden', 'true');\n\t}, 300);\n\n // Iterate over the targets to enable them by remove their `aria-hidden`\n // attribute or resetting them to their initial value\n this._targets.forEach(function (target) {\n var original = target.getAttribute('data-a11y-dialog-original');\n\n\n if (original) {\n target.setAttribute('aria-hidden', original);\n target.removeAttribute('data-a11y-dialog-original');\n } else {\n target.removeAttribute('aria-hidden');\n }\n });\n\n // If their was a focused element before the dialog was opened, restore the\n // focus back to it\n if (focusedBeforeDialog) {\n focusedBeforeDialog.focus();\n }\n\n // Remove the focus event listener to the body element and stop listening\n // for specific key presses\n document.body.removeEventListener('focus', this._maintainFocus, true);\n document.removeEventListener('keydown', this._bindKeypress);\n\n // Remove overlay class to document body.\n document.getElementsByTagName( 'html' )[0].classList.remove( 'sui-has-overlay' );\n\n // Execute all callbacks registered for the `hide` event\n this._fire('hide', event);\n\n return this;\n };\n\n /**\n * Destroy the current instance (after making sure the dialog has been hidden)\n * and remove all associated listeners from dialog openers and closers\n *\n * @return {this}\n */\n A11yDialog.prototype.destroy = function () {\n // Hide the dialog to avoid destroying an open instance\n this.hide();\n\n // Remove the click event listener from all dialog openers\n this._openers.forEach(function (opener) {\n opener.removeEventListener('click', this._show);\n }.bind(this));\n\n // Remove the click event listener from all dialog closers\n this._closers.forEach(function (closer) {\n closer.removeEventListener('click', this._hide);\n }.bind(this));\n\n // Execute all callbacks registered for the `destroy` event\n this._fire('destroy');\n\n // Keep an object of listener types mapped to callback functions\n this._listeners = {};\n\n return this;\n };\n\n /**\n * Register a new callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\n A11yDialog.prototype.on = function (type, handler) {\n if (typeof this._listeners[type] === 'undefined') {\n this._listeners[type] = [];\n }\n\n this._listeners[type].push(handler);\n\n return this;\n };\n\n /**\n * Unregister an existing callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\n A11yDialog.prototype.off = function (type, handler) {\n var index = this._listeners[type].indexOf(handler);\n\n if (index > -1) {\n this._listeners[type].splice(index, 1);\n }\n\n return this;\n };\n\n /**\n * Iterate over all registered handlers for given type and call them all with\n * the dialog element as first argument, event as second argument (if any).\n *\n * @access private\n * @param {string} type\n * @param {Event} event\n */\n A11yDialog.prototype._fire = function (type, event) {\n var listeners = this._listeners[type] || [];\n\n listeners.forEach(function (listener) {\n listener(this.node, event);\n }.bind(this));\n };\n\n /**\n * Private event handler used when listening to some specific key presses\n * (namely ESCAPE and TAB)\n *\n * @access private\n * @param {Event} event\n */\n A11yDialog.prototype._bindKeypress = function (event) {\n // If the dialog is shown and the ESCAPE key is being pressed, prevent any\n // further effects from the ESCAPE key and hide the dialog\n if (this.shown && event.which === ESCAPE_KEY) {\n event.preventDefault();\n this.hide();\n }\n\n // If the dialog is shown and the TAB key is being pressed, make sure the\n // focus stays trapped within the dialog element\n if (this.shown && event.which === TAB_KEY) {\n trapTabKey(this.node, event);\n }\n };\n\n /**\n * Private event handler used when making sure the focus stays within the\n * currently open dialog\n *\n * @access private\n * @param {Event} event\n */\n A11yDialog.prototype._maintainFocus = function (event) {\n // If the dialog is shown and the focus is not within the dialog element,\n // move it back to its first focusable child\n if (this.shown && !this.node.contains(event.target)) {\n setFocusToFirstItem(this.node);\n }\n };\n\n /**\n * Convert a NodeList into an array\n *\n * @param {NodeList} collection\n * @return {Array}\n */\n function toArray (collection) {\n return Array.prototype.slice.call(collection);\n }\n\n /**\n * Query the DOM for nodes matching the given selector, scoped to context (or\n * the whole document)\n *\n * @param {String} selector\n * @param {Element} [context = document]\n * @return {Array}\n */\n function $$ (selector, context) {\n return toArray((context || document).querySelectorAll(selector));\n }\n\n /**\n * Return an array of Element based on given argument (NodeList, Element or\n * string representing a selector)\n *\n * @param {(NodeList | Element | string)} target\n * @return {Array}\n */\n function collect (target) {\n if (NodeList.prototype.isPrototypeOf(target)) {\n return toArray(target);\n }\n\n if (Element.prototype.isPrototypeOf(target)) {\n return [target];\n }\n\n if (typeof target === 'string') {\n return $$(target);\n }\n }\n\n /**\n * Set the focus to the first focusable child of the given element\n *\n * @param {Element} node\n */\n function setFocusToFirstItem (node) {\n var focusableChildren = getFocusableChildren(node);\n\n if (focusableChildren.length) {\n focusableChildren[0].focus();\n }\n }\n\n /**\n * Get the focusable children of the given element\n *\n * @param {Element} node\n * @return {Array}\n */\n function getFocusableChildren (node) {\n return $$(FOCUSABLE_ELEMENTS.join(','), node).filter(function (child) {\n return !!(child.offsetWidth || child.offsetHeight || child.getClientRects().length);\n });\n }\n\n /**\n * Trap the focus inside the given element\n *\n * @param {Element} node\n * @param {Event} event\n */\n function trapTabKey (node, event) {\n var focusableChildren = getFocusableChildren(node);\n var focusedItemIndex = focusableChildren.indexOf(document.activeElement);\n\n // If the SHIFT key is being pressed while tabbing (moving backwards) and\n // the currently focused item is the first one, move the focus to the last\n // focusable item from the dialog element\n if (event.shiftKey && focusedItemIndex === 0) {\n focusableChildren[focusableChildren.length - 1].focus();\n event.preventDefault();\n // If the SHIFT key is not being pressed (moving forwards) and the currently\n // focused item is the last one, move the focus to the first focusable item\n // from the dialog element\n } else if (!event.shiftKey && focusedItemIndex === focusableChildren.length - 1) {\n focusableChildren[0].focus();\n event.preventDefault();\n }\n }\n\n /**\n * Retrieve siblings from given element\n *\n * @param {Element} node\n * @return {Array}\n */\n function getSiblings (node) {\n var nodes = toArray(node.parentNode.childNodes);\n var siblings = nodes.filter(function (node) {\n return node.nodeType === 1;\n });\n\n siblings.splice(siblings.indexOf(node), 1);\n\n return siblings;\n }\n\n if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {\n module.exports = A11yDialog;\n } else if (typeof define === 'function' && define.amd) {\n define('A11yDialog', [], function () {\n return A11yDialog;\n });\n } else if (typeof global === 'object') {\n global.A11yDialog = A11yDialog;\n }\n}(typeof global !== 'undefined' ? global : window));\n"],"sourceRoot":""}