)\s*$/.test(beforeHTML)) { - return segmentHTMLToShortcodeBlock(HTML, lastIndex); - } - - var attributes = Object(external_lodash_["mapValues"])(Object(external_lodash_["pickBy"])(transformation.attributes, function (schema) { - return schema.shortcode; - }), // Passing all of `match` as second argument is intentionally broad - // but shouldn't be too relied upon. - // - // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926 - function (schema) { - return schema.shortcode(match.shortcode.attrs, match); - }); - var block = createBlock(transformation.blockName, getBlockAttributes(Object(objectSpread["a" /* default */])({}, registration_getBlockType(transformation.blockName), { - attributes: transformation.attributes - }), match.shortcode.content, attributes)); - return [beforeHTML, block].concat(Object(toConsumableArray["a" /* default */])(segmentHTMLToShortcodeBlock(HTML.substr(lastIndex)))); - } - - return [HTML]; -} - -/* harmony default export */ var shortcode_converter = (segmentHTMLToShortcodeBlock); - -// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/comment-remover.js -/** - * WordPress dependencies - */ - -/** - * Browser dependencies - */ - -var comment_remover_COMMENT_NODE = window.Node.COMMENT_NODE; -/** - * Looks for comments, and removes them. - * - * @param {Node} node The node to be processed. - * @return {void} - */ - -/* harmony default export */ var comment_remover = (function (node) { - if (node.nodeType === comment_remover_COMMENT_NODE) { - Object(external_this_wp_dom_["remove"])(node); - } -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/is-inline-content.js -/** - * External dependencies - */ - -/** - * Internal dependencies - */ - - -/** - * Checks if the given node should be considered inline content, optionally - * depending on a context tag. - * - * @param {Node} node Node name. - * @param {string} contextTag Tag name. - * - * @return {boolean} True if the node is inline content, false if nohe. - */ - -function isInline(node, contextTag) { - if (isPhrasingContent(node)) { - return true; - } - - if (!contextTag) { - return false; - } - - var tag = node.nodeName.toLowerCase(); - var inlineWhitelistTagGroups = [['ul', 'li', 'ol'], ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']]; - return inlineWhitelistTagGroups.some(function (tagGroup) { - return Object(external_lodash_["difference"])([tag, contextTag], tagGroup).length === 0; - }); -} - -function deepCheck(nodes, contextTag) { - return nodes.every(function (node) { - return isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag); - }); -} - -function isDoubleBR(node) { - return node.nodeName === 'BR' && node.previousSibling && node.previousSibling.nodeName === 'BR'; -} - -/* harmony default export */ var is_inline_content = (function (HTML, contextTag) { - var doc = document.implementation.createHTMLDocument(''); - doc.body.innerHTML = HTML; - var nodes = Array.from(doc.body.children); - return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag); -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content-reducer.js -/** - * WordPress dependencies - */ - -/* harmony default export */ var phrasing_content_reducer = (function (node, doc) { - // In jsdom-jscore, 'node.style' can be null. - // TODO: Explore fixing this by patching jsdom-jscore. - if (node.nodeName === 'SPAN' && node.style) { - var _node$style = node.style, - fontWeight = _node$style.fontWeight, - fontStyle = _node$style.fontStyle, - textDecorationLine = _node$style.textDecorationLine, - verticalAlign = _node$style.verticalAlign; - - if (fontWeight === 'bold' || fontWeight === '700') { - Object(external_this_wp_dom_["wrap"])(doc.createElement('strong'), node); - } - - if (fontStyle === 'italic') { - Object(external_this_wp_dom_["wrap"])(doc.createElement('em'), node); - } - - if (textDecorationLine === 'line-through') { - Object(external_this_wp_dom_["wrap"])(doc.createElement('s'), node); - } - - if (verticalAlign === 'super') { - Object(external_this_wp_dom_["wrap"])(doc.createElement('sup'), node); - } else if (verticalAlign === 'sub') { - Object(external_this_wp_dom_["wrap"])(doc.createElement('sub'), node); - } - } else if (node.nodeName === 'B') { - node = Object(external_this_wp_dom_["replaceTag"])(node, 'strong'); - } else if (node.nodeName === 'I') { - node = Object(external_this_wp_dom_["replaceTag"])(node, 'em'); - } else if (node.nodeName === 'A') { - // In jsdom-jscore, 'node.target' can be null. - // TODO: Explore fixing this by patching jsdom-jscore. - if (node.target && node.target.toLowerCase() === '_blank') { - node.rel = 'noreferrer noopener'; - } else { - node.removeAttribute('target'); - node.removeAttribute('rel'); - } - } -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/head-remover.js -/* harmony default export */ var head_remover = (function (node) { - if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'NOSCRIPT' && node.nodeName !== 'TEMPLATE' && node.nodeName !== 'STYLE') { - return; - } - - node.parentNode.removeChild(node); -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-converter.js -/** - * Browser dependencies - */ -var _window = window, - ms_list_converter_parseInt = _window.parseInt; - -function ms_list_converter_isList(node) { - return node.nodeName === 'OL' || node.nodeName === 'UL'; -} - -/* harmony default export */ var ms_list_converter = (function (node, doc) { - if (node.nodeName !== 'P') { - return; - } - - var style = node.getAttribute('style'); - - if (!style) { - return; - } // Quick check. - - - if (style.indexOf('mso-list') === -1) { - return; - } - - var matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style); - - if (!matches) { - return; - } - - var level = ms_list_converter_parseInt(matches[1], 10) - 1 || 0; - var prevNode = node.previousElementSibling; // Add new list if no previous. - - if (!prevNode || !ms_list_converter_isList(prevNode)) { - // See https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type. - var type = node.textContent.trim().slice(0, 1); - var isNumeric = /[1iIaA]/.test(type); - var newListNode = doc.createElement(isNumeric ? 'ol' : 'ul'); - - if (isNumeric) { - newListNode.setAttribute('type', type); - } - - node.parentNode.insertBefore(newListNode, node); - } - - var listNode = node.previousElementSibling; - var listType = listNode.nodeName; - var listItem = doc.createElement('li'); - var receivingNode = listNode; // Remove the first span with list info. - - node.removeChild(node.firstElementChild); // Add content. - - while (node.firstChild) { - listItem.appendChild(node.firstChild); - } // Change pointer depending on indentation level. - - - while (level--) { - receivingNode = receivingNode.lastElementChild || receivingNode; // If it's a list, move pointer to the last item. - - if (ms_list_converter_isList(receivingNode)) { - receivingNode = receivingNode.lastElementChild || receivingNode; - } - } // Make sure we append to a list. - - - if (!ms_list_converter_isList(receivingNode)) { - receivingNode = receivingNode.appendChild(doc.createElement(listType)); - } // Append the list item to the list. - - - receivingNode.appendChild(listItem); // Remove the wrapper paragraph. - - node.parentNode.removeChild(node); -}); +} // EXTERNAL MODULE: external {"this":["wp","blob"]} -var external_this_wp_blob_ = __webpack_require__(35); +var external_this_wp_blob_ = __webpack_require__(44); // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/image-corrector.js @@ -10733,7 +11797,7 @@ var image_corrector_window = window, atob = image_corrector_window.atob, File = image_corrector_window.File; -/* harmony default export */ var image_corrector = (function (node) { +function imageCorrector(node) { if (node.nodeName !== 'IMG') { return; } @@ -10784,10 +11848,216 @@ if (node.height === 1 || node.width === 1) { node.parentNode.removeChild(node); } -}); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/blockquote-normaliser.js +/** + * Internal dependencies + */ + +function blockquoteNormaliser(node) { + if (node.nodeName !== 'BLOCKQUOTE') { + return; + } + + node.innerHTML = normaliseBlocks(node.innerHTML); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/figure-content-reducer.js +/** + * External dependencies + */ + +/** + * Internal dependencies + */ + + +/** + * Whether or not the given node is figure content. + * + * @param {Node} node The node to check. + * @param {Object} schema The schema to use. + * + * @return {boolean} True if figure content, false if not. + */ + +function isFigureContent(node, schema) { + var tag = node.nodeName.toLowerCase(); // We are looking for tags that can be a child of the figure tag, excluding + // `figcaption` and any phrasing content. + + if (tag === 'figcaption' || isTextContent(node)) { + return false; + } + + return Object(external_this_lodash_["has"])(schema, ['figure', 'children', tag]); +} +/** + * Whether or not the given node can have an anchor. + * + * @param {Node} node The node to check. + * @param {Object} schema The schema to use. + * + * @return {boolean} True if it can, false if not. + */ + + +function canHaveAnchor(node, schema) { + var tag = node.nodeName.toLowerCase(); + return Object(external_this_lodash_["has"])(schema, ['figure', 'children', 'a', 'children', tag]); +} +/** + * Wraps the given element in a figure element. + * + * @param {Element} element The element to wrap. + * @param {Element} beforeElement The element before which to place the figure. + */ + + +function wrapFigureContent(element) { + var beforeElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : element; + var figure = element.ownerDocument.createElement('figure'); + beforeElement.parentNode.insertBefore(figure, beforeElement); + figure.appendChild(element); +} +/** + * This filter takes figure content out of paragraphs, wraps it in a figure + * element, and moves any anchors with it if needed. + * + * @param {Node} node The node to filter. + * @param {Document} doc The document of the node. + * @param {Object} schema The schema to use. + * + * @return {void} + */ + + +function figureContentReducer(node, doc, schema) { + if (!isFigureContent(node, schema)) { + return; + } + + var nodeToInsert = node; + var parentNode = node.parentNode; // If the figure content can have an anchor and its parent is an anchor with + // only the figure content, take the anchor out instead of just the content. + + if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) { + nodeToInsert = node.parentNode; + } + + var wrapper = nodeToInsert.closest('p,div'); // If wrapped in a paragraph or div, only extract if it's aligned or if + // there is no text content. + // Otherwise, if directly at the root, wrap in a figure element. + + if (wrapper) { + // In jsdom-jscore, 'node.classList' can be undefined. + // In this case, default to extract as it offers a better UI experience on mobile. + if (!node.classList) { + wrapFigureContent(nodeToInsert, wrapper); + } else if (node.classList.contains('alignright') || node.classList.contains('alignleft') || node.classList.contains('aligncenter') || !wrapper.textContent.trim()) { + wrapFigureContent(nodeToInsert, wrapper); + } + } else if (nodeToInsert.parentNode.nodeName === 'BODY') { + wrapFigureContent(nodeToInsert); + } +} + +// EXTERNAL MODULE: external {"this":["wp","shortcode"]} +var external_this_wp_shortcode_ = __webpack_require__(125); + +// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/shortcode-converter.js + + + +function shortcode_converter_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function shortcode_converter_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { shortcode_converter_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { shortcode_converter_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + + + +function segmentHTMLToShortcodeBlock(HTML) { + var lastIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var excludedBlockNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + // Get all matches. + var transformsFrom = getBlockTransforms('from'); + var transformation = findTransform(transformsFrom, function (transform) { + return excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === 'shortcode' && Object(external_this_lodash_["some"])(Object(external_this_lodash_["castArray"])(transform.tag), function (tag) { + return Object(external_this_wp_shortcode_["regexp"])(tag).test(HTML); + }); + }); + + if (!transformation) { + return [HTML]; + } + + var transformTags = Object(external_this_lodash_["castArray"])(transformation.tag); + var transformTag = Object(external_this_lodash_["find"])(transformTags, function (tag) { + return Object(external_this_wp_shortcode_["regexp"])(tag).test(HTML); + }); + var match; + var previousIndex = lastIndex; + + if (match = Object(external_this_wp_shortcode_["next"])(transformTag, HTML, lastIndex)) { + lastIndex = match.index + match.content.length; + var beforeHTML = HTML.substr(0, match.index); + var afterHTML = HTML.substr(lastIndex); // If the shortcode content does not contain HTML and the shortcode is + // not on a new line (or in paragraph from Markdown converter), + // consider the shortcode as inline text, and thus skip conversion for + // this segment. + + if (!Object(external_this_lodash_["includes"])(match.shortcode.content || '', '<') && !(/(\n|
)\s*$/.test(beforeHTML) && /^\s*(\n|<\/p>)/.test(afterHTML))) { + return segmentHTMLToShortcodeBlock(HTML, lastIndex); + } // If a transformation's `isMatch` predicate fails for the inbound + // shortcode, try again by excluding the current block type. + // + // This is the only call to `segmentHTMLToShortcodeBlock` that should + // ever carry over `excludedBlockNames`. Other calls in the module + // should skip that argument as a way to reset the exclusion state, so + // that one `isMatch` fail in an HTML fragment doesn't prevent any + // valid matches in subsequent fragments. + + + if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) { + return segmentHTMLToShortcodeBlock(HTML, previousIndex, [].concat(Object(toConsumableArray["a" /* default */])(excludedBlockNames), [transformation.blockName])); + } + + var attributes = Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["pickBy"])(transformation.attributes, function (schema) { + return schema.shortcode; + }), // Passing all of `match` as second argument is intentionally broad + // but shouldn't be too relied upon. + // + // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926 + function (schema) { + return schema.shortcode(match.shortcode.attrs, match); + }); + var block = createBlock(transformation.blockName, getBlockAttributes(shortcode_converter_objectSpread({}, registration_getBlockType(transformation.blockName), { + attributes: transformation.attributes + }), match.shortcode.content, attributes)); + return [beforeHTML, block].concat(Object(toConsumableArray["a" /* default */])(segmentHTMLToShortcodeBlock(HTML.substr(lastIndex)))); + } + + return [HTML]; +} + +/* harmony default export */ var shortcode_converter = (segmentHTMLToShortcodeBlock); // EXTERNAL MODULE: ./node_modules/showdown/dist/showdown.js -var showdown = __webpack_require__(206); +var showdown = __webpack_require__(269); var showdown_default = /*#__PURE__*/__webpack_require__.n(showdown); // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/markdown-converter.js @@ -10830,45 +12100,158 @@ */ -/* harmony default export */ var markdown_converter = (function (text) { +function markdownConverter(text) { return converter.makeHtml(slackMarkdownVariantCorrector(text)); -}); +} // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/iframe-remover.js /** - * WordPress dependencies - */ - -/** * Removes iframes. * * @param {Node} node The node to check. * * @return {void} */ - -/* harmony default export */ var iframe_remover = (function (node) { +function iframeRemover(node) { if (node.nodeName === 'IFRAME') { - Object(external_this_wp_dom_["remove"])(node); - } -}); + var text = node.ownerDocument.createTextNode(node.src); + node.parentNode.replaceChild(text, node); + } +} // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/google-docs-uid-remover.js /** * WordPress dependencies */ -/* harmony default export */ var google_docs_uid_remover = (function (node) { +function googleDocsUIdRemover(node) { if (!node.id || node.id.indexOf('docs-internal-guid-') !== 0) { return; } Object(external_this_wp_dom_["unwrap"])(node); -}); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/html-formatting-remover.js +/** + * Internal dependencies + */ + + +function isFormattingSpace(character) { + return character === ' ' || character === '\r' || character === '\n' || character === '\t'; +} +/** + * Removes spacing that formats HTML. + * + * @see https://www.w3.org/TR/css-text-3/#white-space-processing + * + * @param {Node} node The node to be processed. + * @return {void} + */ + + +function htmlFormattingRemover(node) { + if (node.nodeType !== node.TEXT_NODE) { + return; + } // Ignore pre content. Note that this does not use Element#closest due to + // a combination of (a) node may not be Element and (b) node.parentElement + // does not have full support in all browsers (Internet Exporer). + // + // See: https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement#Browser_compatibility + + /** @type {Node?} */ + + + var parent = node; + + while (parent = parent.parentNode) { + if (parent.nodeType === window.Node.ELEMENT_NODE && parent.nodeName === 'PRE') { + return; + } + } // First, replace any sequence of HTML formatting space with a single space. + + + var newData = node.data.replace(/[ \r\n\t]+/g, ' '); // Remove the leading space if the text element is at the start of a block, + // is preceded by a line break element, or has a space in the previous + // node. + + if (newData[0] === ' ') { + var previousSibling = getSibling(node, 'previous'); + + if (!previousSibling || previousSibling.nodeName === 'BR' || previousSibling.textContent.slice(-1) === ' ') { + newData = newData.slice(1); + } + } // Remove the trailing space if the text element is at the end of a block, + // is succeded by a line break element, or has a space in the next text + // node. + + + if (newData[newData.length - 1] === ' ') { + var nextSibling = getSibling(node, 'next'); + + if (!nextSibling || nextSibling.nodeName === 'BR' || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) { + newData = newData.slice(0, -1); + } + } // If there's no data left, remove the node, so `previousSibling` stays + // accurate. Otherwise, update the node data. + + + if (!newData) { + node.parentNode.removeChild(node); + } else { + node.data = newData; + } +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/br-remover.js +/** + * Internal dependencies + */ + +/** + * Removes trailing br elements from text-level content. + * + * @param {Element} node Node to check. + */ + +function brRemover(node) { + if (node.nodeName !== 'BR') { + return; + } + + if (getSibling(node, 'next')) { + return; + } + + node.parentNode.removeChild(node); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/empty-paragraph-remover.js +/** + * Removes empty paragraph elements. + * + * @param {Element} node Node to check. + */ +function emptyParagraphRemover(node) { + if (node.nodeName !== 'P') { + return; + } + + if (node.hasChildNodes()) { + return; + } + + node.parentNode.removeChild(node); +} // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/paste-handler.js +function paste_handler_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function paste_handler_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { paste_handler_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { paste_handler_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + /** * External dependencies */ @@ -10897,6 +12280,10 @@ + + + + /** * Browser dependencies */ @@ -10912,20 +12299,21 @@ */ function filterInlineHTML(HTML) { - HTML = deepFilterHTML(HTML, [google_docs_uid_remover, phrasing_content_reducer, comment_remover]); - HTML = removeInvalidHTML(HTML, getPhrasingContentSchema(), { + HTML = deepFilterHTML(HTML, [googleDocsUIdRemover, phrasingContentReducer, commentRemover]); + HTML = removeInvalidHTML(HTML, getPhrasingContentSchema('paste'), { inline: true - }); // Allows us to ask for this information when we get a report. + }); + HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]); // Allows us to ask for this information when we get a report. paste_handler_console.log('Processed inline HTML:\n\n', HTML); return HTML; } function getRawTransformations() { - return Object(external_lodash_["filter"])(getBlockTransforms('from'), { + return Object(external_this_lodash_["filter"])(getBlockTransforms('from'), { type: 'raw' }).map(function (transform) { - return transform.isMatch ? transform : Object(objectSpread["a" /* default */])({}, transform, { + return transform.isMatch ? transform : paste_handler_objectSpread({}, transform, { isMatch: function isMatch(node) { return transform.selector && node.matches(transform.selector); } @@ -10974,14 +12362,14 @@ /** * Converts an HTML string to known blocks. Strips everything else. * - * @param {string} [options.HTML] The HTML to convert. - * @param {string} [options.plainText] Plain text version. - * @param {string} [options.mode] Handle content as blocks or inline content. - * * 'AUTO': Decide based on the content passed. - * * 'INLINE': Always handle as inline content, and return string. - * * 'BLOCKS': Always handle as blocks, and return array of blocks. - * @param {Array} [options.tagName] The tag into which content will be inserted. - * @param {boolean} [options.canUserUseUnfilteredHTML] Whether or not the user can use unfiltered HTML. + * @param {Object} options + * @param {string} [options.HTML] The HTML to convert. + * @param {string} [options.plainText] Plain text version. + * @param {string} [options.mode] Handle content as blocks or inline content. + * * 'AUTO': Decide based on the content passed. + * * 'INLINE': Always handle as inline content, and return string. + * * 'BLOCKS': Always handle as blocks, and return array of blocks. + * @param {Array} [options.tagName] The tag into which content will be inserted. * * @return {Array|string} A list of blocks or a string, depending on `handlerMode`. */ @@ -10994,11 +12382,12 @@ plainText = _ref3$plainText === void 0 ? '' : _ref3$plainText, _ref3$mode = _ref3.mode, mode = _ref3$mode === void 0 ? 'AUTO' : _ref3$mode, - tagName = _ref3.tagName, - _ref3$canUserUseUnfil = _ref3.canUserUseUnfilteredHTML, - canUserUseUnfilteredHTML = _ref3$canUserUseUnfil === void 0 ? false : _ref3$canUserUseUnfil; + tagName = _ref3.tagName; // First of all, strip any meta tags. - HTML = HTML.replace(/]+>/, ''); // If we detect block delimiters in HTML, parse entirely as blocks. + HTML = HTML.replace(/]+>/g, ''); // Strip Windows markers. + + HTML = HTML.replace(/^\s*]*>\s*
]*>(?:\s*)?/i, ''); + HTML = HTML.replace(/(?:\s*)?<\/body>\s*<\/html>\s*$/i, ''); // If we detect block delimiters in HTML, parse entirely as blocks. if (mode !== 'INLINE') { // Check plain text if there is no HTML. @@ -11024,7 +12413,7 @@ if (plainText && (!HTML || isPlain(HTML))) { - HTML = markdown_converter(plainText); // Switch to inline mode if: + HTML = markdownConverter(plainText); // Switch to inline mode if: // * The current mode is AUTO. // * The original plain text had no line breaks. // * The original plain text was not an HTML paragraph. @@ -11047,42 +12436,38 @@ var hasShortcodes = pieces.length > 1; - if (mode === 'AUTO' && !hasShortcodes && is_inline_content(HTML, tagName)) { + if (mode === 'AUTO' && !hasShortcodes && isInlineContent(HTML, tagName)) { return filterInlineHTML(HTML); } var rawTransforms = getRawTransformations(); - var phrasingContentSchema = getPhrasingContentSchema(); - var blockContentSchema = getBlockContentSchema(rawTransforms); - var blocks = Object(external_lodash_["compact"])(Object(external_lodash_["flatMap"])(pieces, function (piece) { + var phrasingContentSchema = getPhrasingContentSchema('paste'); + var blockContentSchema = getBlockContentSchema(rawTransforms, phrasingContentSchema, true); + var blocks = Object(external_this_lodash_["compact"])(Object(external_this_lodash_["flatMap"])(pieces, function (piece) { // Already a block from shortcode. if (typeof piece !== 'string') { return piece; } - var filters = [google_docs_uid_remover, ms_list_converter, head_remover, list_reducer, image_corrector, phrasing_content_reducer, special_comment_converter, comment_remover, figure_content_reducer, blockquote_normaliser]; - - if (!canUserUseUnfilteredHTML) { - // Should run before `figureContentReducer`. - filters.unshift(iframe_remover); - } - - var schema = Object(objectSpread["a" /* default */])({}, blockContentSchema, phrasingContentSchema); + var filters = [googleDocsUIdRemover, msListConverter, headRemover, listReducer, imageCorrector, phrasingContentReducer, specialCommentConverter, commentRemover, iframeRemover, figureContentReducer, blockquoteNormaliser]; + + var schema = paste_handler_objectSpread({}, blockContentSchema, {}, phrasingContentSchema); piece = deepFilterHTML(piece, filters, blockContentSchema); piece = removeInvalidHTML(piece, schema); - piece = normalise_blocks(piece); // Allows us to ask for this information when we get a report. + piece = normaliseBlocks(piece); + piece = deepFilterHTML(piece, [htmlFormattingRemover, brRemover, emptyParagraphRemover], blockContentSchema); // Allows us to ask for this information when we get a report. paste_handler_console.log('Processed HTML piece:\n\n', piece); return htmlToBlocks({ html: piece, rawTransforms: rawTransforms }); - })); // If we're allowed to return inline content and there is only one block + })); // If we're allowed to return inline content, and there is only one inlineable block, // and the original plain text content does not have any line breaks, then // treat it as inline paste. - if (mode === 'AUTO' && blocks.length === 1) { + if (mode === 'AUTO' && blocks.length === 1 && registration_hasBlockSupport(blocks[0].name, '__unstablePasteTextInline', false)) { var trimmedPlainText = plainText.trim(); if (trimmedPlainText !== '' && trimmedPlainText.indexOf('\n') === -1) { @@ -11096,6 +12481,10 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/index.js +function raw_handling_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function raw_handling_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { raw_handling_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { raw_handling_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + /** * External dependencies */ @@ -11116,11 +12505,12 @@ + function raw_handling_getRawTransformations() { - return Object(external_lodash_["filter"])(getBlockTransforms('from'), { + return Object(external_this_lodash_["filter"])(getBlockTransforms('from'), { type: 'raw' }).map(function (transform) { - return transform.isMatch ? transform : Object(objectSpread["a" /* default */])({}, transform, { + return transform.isMatch ? transform : raw_handling_objectSpread({}, transform, { isMatch: function isMatch(node) { return transform.selector && node.matches(transform.selector); } @@ -11169,6 +12559,7 @@ /** * Converts an HTML string to known blocks. * + * @param {Object} $1 * @param {string} $1.HTML The HTML to convert. * * @return {Array} A list of blocks. @@ -11188,8 +12579,9 @@ var pieces = shortcode_converter(HTML); var rawTransforms = raw_handling_getRawTransformations(); - var blockContentSchema = getBlockContentSchema(rawTransforms); - return Object(external_lodash_["compact"])(Object(external_lodash_["flatMap"])(pieces, function (piece) { + var phrasingContentSchema = getPhrasingContentSchema(); + var blockContentSchema = getBlockContentSchema(rawTransforms, phrasingContentSchema); + return Object(external_this_lodash_["compact"])(Object(external_this_lodash_["flatMap"])(pieces, function (piece) { // Already a block from shortcode. if (typeof piece !== 'string') { return piece; @@ -11199,13 +12591,13 @@ var filters = [// Needed to adjust invalid lists. - list_reducer, // Needed to create more and nextpage blocks. - special_comment_converter, // Needed to create media blocks. - figure_content_reducer, // Needed to create the quote block, which cannot handle text + listReducer, // Needed to create more and nextpage blocks. + specialCommentConverter, // Needed to create media blocks. + figureContentReducer, // Needed to create the quote block, which cannot handle text // without wrapper paragraphs. - blockquote_normaliser]; + blockquoteNormaliser]; piece = deepFilterHTML(piece, filters, blockContentSchema); - piece = normalise_blocks(piece); + piece = normaliseBlocks(piece); return raw_handling_htmlToBlocks({ html: piece, rawTransforms: rawTransforms @@ -11218,10 +12610,12 @@ * WordPress dependencies */ +/** @typedef {import('../store/reducer').WPBlockCategory} WPBlockCategory */ + /** * Returns all the block categories. * - * @return {Object[]} Block categories. + * @return {WPBlockCategory[]} Block categories. */ function categories_getCategories() { @@ -11230,7 +12624,7 @@ /** * Sets the block categories. * - * @param {Object[]} categories Block categories. + * @param {WPBlockCategory[]} categories Block categories. */ function categories_setCategories(categories) { @@ -11239,8 +12633,9 @@ /** * Updates a category. * - * @param {string} slug Block category slug. - * @param {Object} category Object containing the category properties that should be updated. + * @param {string} slug Block category slug. + * @param {WPBlockCategory} category Object containing the category properties + * that should be updated. */ function categories_updateCategory(slug, category) { @@ -11251,6 +12646,10 @@ +function templates_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function templates_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { templates_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { templates_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + /** * External dependencies */ @@ -11278,7 +12677,7 @@ function doBlocksMatchTemplate() { var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var template = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - return blocks.length === template.length && Object(external_lodash_["every"])(template, function (_ref, index) { + return blocks.length === template.length && Object(external_this_lodash_["every"])(template, function (_ref, index) { var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 3), name = _ref2[0], innerBlocksTemplate = _ref2[2]; @@ -11310,7 +12709,7 @@ return blocks; } - return Object(external_lodash_["map"])(template, function (_ref3, index) { + return Object(external_this_lodash_["map"])(template, function (_ref3, index) { var _ref4 = Object(slicedToArray["a" /* default */])(_ref3, 3), name = _ref4[0], attributes = _ref4[1], @@ -11320,7 +12719,7 @@ if (block && block.name === name) { var innerBlocks = synchronizeBlocksWithTemplate(block.innerBlocks, innerBlocksTemplate); - return Object(objectSpread["a" /* default */])({}, block, { + return templates_objectSpread({}, block, { innerBlocks: innerBlocks }); } // To support old templates that were using the "children" format @@ -11331,21 +12730,21 @@ var blockType = registration_getBlockType(name); var isHTMLAttribute = function isHTMLAttribute(attributeDefinition) { - return Object(external_lodash_["get"])(attributeDefinition, ['source']) === 'html'; + return Object(external_this_lodash_["get"])(attributeDefinition, ['source']) === 'html'; }; var isQueryAttribute = function isQueryAttribute(attributeDefinition) { - return Object(external_lodash_["get"])(attributeDefinition, ['source']) === 'query'; + return Object(external_this_lodash_["get"])(attributeDefinition, ['source']) === 'query'; }; var normalizeAttributes = function normalizeAttributes(schema, values) { - return Object(external_lodash_["mapValues"])(values, function (value, key) { + return Object(external_this_lodash_["mapValues"])(values, function (value, key) { return normalizeAttribute(schema[key], value); }); }; var normalizeAttribute = function normalizeAttribute(definition, value) { - if (isHTMLAttribute(definition) && Object(external_lodash_["isArray"])(value)) { + if (isHTMLAttribute(definition) && Object(external_this_lodash_["isArray"])(value)) { // Introduce a deprecated call at this point // When we're confident that "children" format should be removed from the templates. return Object(external_this_wp_element_["renderToString"])(value); @@ -11360,7 +12759,7 @@ return value; }; - var normalizedAttributes = normalizeAttributes(Object(external_lodash_["get"])(blockType, ['attributes'], {}), attributes); + var normalizedAttributes = normalizeAttributes(Object(external_this_lodash_["get"])(blockType, ['attributes'], {}), attributes); return createBlock(name, normalizedAttributes, synchronizeBlocksWithTemplate([], innerBlocksTemplate)); }); } @@ -11379,55 +12778,6 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/index.js -/* concated harmony reexport createBlock */__webpack_require__.d(__webpack_exports__, "createBlock", function() { return createBlock; }); -/* concated harmony reexport cloneBlock */__webpack_require__.d(__webpack_exports__, "cloneBlock", function() { return cloneBlock; }); -/* concated harmony reexport getPossibleBlockTransformations */__webpack_require__.d(__webpack_exports__, "getPossibleBlockTransformations", function() { return getPossibleBlockTransformations; }); -/* concated harmony reexport switchToBlockType */__webpack_require__.d(__webpack_exports__, "switchToBlockType", function() { return switchToBlockType; }); -/* concated harmony reexport getBlockTransforms */__webpack_require__.d(__webpack_exports__, "getBlockTransforms", function() { return getBlockTransforms; }); -/* concated harmony reexport findTransform */__webpack_require__.d(__webpack_exports__, "findTransform", function() { return findTransform; }); -/* concated harmony reexport parse */__webpack_require__.d(__webpack_exports__, "parse", function() { return parser; }); -/* concated harmony reexport getBlockAttributes */__webpack_require__.d(__webpack_exports__, "getBlockAttributes", function() { return getBlockAttributes; }); -/* concated harmony reexport parseWithAttributeSchema */__webpack_require__.d(__webpack_exports__, "parseWithAttributeSchema", function() { return parseWithAttributeSchema; }); -/* concated harmony reexport pasteHandler */__webpack_require__.d(__webpack_exports__, "pasteHandler", function() { return pasteHandler; }); -/* concated harmony reexport rawHandler */__webpack_require__.d(__webpack_exports__, "rawHandler", function() { return rawHandler; }); -/* concated harmony reexport getPhrasingContentSchema */__webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return getPhrasingContentSchema; }); -/* concated harmony reexport serialize */__webpack_require__.d(__webpack_exports__, "serialize", function() { return serialize; }); -/* concated harmony reexport getBlockContent */__webpack_require__.d(__webpack_exports__, "getBlockContent", function() { return getBlockContent; }); -/* concated harmony reexport getBlockDefaultClassName */__webpack_require__.d(__webpack_exports__, "getBlockDefaultClassName", function() { return getBlockDefaultClassName; }); -/* concated harmony reexport getBlockMenuDefaultClassName */__webpack_require__.d(__webpack_exports__, "getBlockMenuDefaultClassName", function() { return getBlockMenuDefaultClassName; }); -/* concated harmony reexport getSaveElement */__webpack_require__.d(__webpack_exports__, "getSaveElement", function() { return getSaveElement; }); -/* concated harmony reexport getSaveContent */__webpack_require__.d(__webpack_exports__, "getSaveContent", function() { return getSaveContent; }); -/* concated harmony reexport isValidBlockContent */__webpack_require__.d(__webpack_exports__, "isValidBlockContent", function() { return isValidBlockContent; }); -/* concated harmony reexport getCategories */__webpack_require__.d(__webpack_exports__, "getCategories", function() { return categories_getCategories; }); -/* concated harmony reexport setCategories */__webpack_require__.d(__webpack_exports__, "setCategories", function() { return categories_setCategories; }); -/* concated harmony reexport updateCategory */__webpack_require__.d(__webpack_exports__, "updateCategory", function() { return categories_updateCategory; }); -/* concated harmony reexport registerBlockType */__webpack_require__.d(__webpack_exports__, "registerBlockType", function() { return registerBlockType; }); -/* concated harmony reexport unregisterBlockType */__webpack_require__.d(__webpack_exports__, "unregisterBlockType", function() { return unregisterBlockType; }); -/* concated harmony reexport setFreeformContentHandlerName */__webpack_require__.d(__webpack_exports__, "setFreeformContentHandlerName", function() { return setFreeformContentHandlerName; }); -/* concated harmony reexport getFreeformContentHandlerName */__webpack_require__.d(__webpack_exports__, "getFreeformContentHandlerName", function() { return getFreeformContentHandlerName; }); -/* concated harmony reexport setUnregisteredTypeHandlerName */__webpack_require__.d(__webpack_exports__, "setUnregisteredTypeHandlerName", function() { return setUnregisteredTypeHandlerName; }); -/* concated harmony reexport getUnregisteredTypeHandlerName */__webpack_require__.d(__webpack_exports__, "getUnregisteredTypeHandlerName", function() { return getUnregisteredTypeHandlerName; }); -/* concated harmony reexport setDefaultBlockName */__webpack_require__.d(__webpack_exports__, "setDefaultBlockName", function() { return registration_setDefaultBlockName; }); -/* concated harmony reexport getDefaultBlockName */__webpack_require__.d(__webpack_exports__, "getDefaultBlockName", function() { return registration_getDefaultBlockName; }); -/* concated harmony reexport getBlockType */__webpack_require__.d(__webpack_exports__, "getBlockType", function() { return registration_getBlockType; }); -/* concated harmony reexport getBlockTypes */__webpack_require__.d(__webpack_exports__, "getBlockTypes", function() { return registration_getBlockTypes; }); -/* concated harmony reexport getBlockSupport */__webpack_require__.d(__webpack_exports__, "getBlockSupport", function() { return registration_getBlockSupport; }); -/* concated harmony reexport hasBlockSupport */__webpack_require__.d(__webpack_exports__, "hasBlockSupport", function() { return registration_hasBlockSupport; }); -/* concated harmony reexport isReusableBlock */__webpack_require__.d(__webpack_exports__, "isReusableBlock", function() { return isReusableBlock; }); -/* concated harmony reexport getChildBlockNames */__webpack_require__.d(__webpack_exports__, "getChildBlockNames", function() { return registration_getChildBlockNames; }); -/* concated harmony reexport hasChildBlocks */__webpack_require__.d(__webpack_exports__, "hasChildBlocks", function() { return registration_hasChildBlocks; }); -/* concated harmony reexport hasChildBlocksWithInserterSupport */__webpack_require__.d(__webpack_exports__, "hasChildBlocksWithInserterSupport", function() { return registration_hasChildBlocksWithInserterSupport; }); -/* concated harmony reexport unstable__bootstrapServerSideBlockDefinitions */__webpack_require__.d(__webpack_exports__, "unstable__bootstrapServerSideBlockDefinitions", function() { return unstable__bootstrapServerSideBlockDefinitions; }); -/* concated harmony reexport registerBlockStyle */__webpack_require__.d(__webpack_exports__, "registerBlockStyle", function() { return registration_registerBlockStyle; }); -/* concated harmony reexport unregisterBlockStyle */__webpack_require__.d(__webpack_exports__, "unregisterBlockStyle", function() { return registration_unregisterBlockStyle; }); -/* concated harmony reexport isUnmodifiedDefaultBlock */__webpack_require__.d(__webpack_exports__, "isUnmodifiedDefaultBlock", function() { return isUnmodifiedDefaultBlock; }); -/* concated harmony reexport normalizeIconObject */__webpack_require__.d(__webpack_exports__, "normalizeIconObject", function() { return normalizeIconObject; }); -/* concated harmony reexport isValidIcon */__webpack_require__.d(__webpack_exports__, "isValidIcon", function() { return isValidIcon; }); -/* concated harmony reexport doBlocksMatchTemplate */__webpack_require__.d(__webpack_exports__, "doBlocksMatchTemplate", function() { return doBlocksMatchTemplate; }); -/* concated harmony reexport synchronizeBlocksWithTemplate */__webpack_require__.d(__webpack_exports__, "synchronizeBlocksWithTemplate", function() { return synchronizeBlocksWithTemplate; }); -/* concated harmony reexport children */__webpack_require__.d(__webpack_exports__, "children", function() { return api_children; }); -/* concated harmony reexport node */__webpack_require__.d(__webpack_exports__, "node", function() { return api_node; }); -/* concated harmony reexport withBlockContentContext */__webpack_require__.d(__webpack_exports__, "withBlockContentContext", function() { return withBlockContentContext; }); // A "block" is the abstract term used to describe units of markup that, // when composed together, form the content or layout of a page. // The API for blocks is exposed via `wp.blocks`. @@ -11448,36 +12798,43 @@ /***/ }), -/***/ 37: +/***/ 5: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; } /***/ }), -/***/ 38: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); -} +/***/ 6: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["primitives"]; }()); /***/ }), -/***/ 42: +/***/ 64: /***/ (function(module, exports) { (function() { module.exports = this["wp"]["isShallowEqual"]; }()); /***/ }), -/***/ 45: +/***/ 66: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.1 @@ -12678,190 +14035,42 @@ /***/ }), -/***/ 5: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["data"]; }()); - -/***/ }), - -/***/ 57: +/***/ 75: /***/ (function(module, exports) { (function() { module.exports = this["wp"]["htmlEntities"]; }()); /***/ }), -/***/ 6: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["compose"]; }()); - -/***/ }), - -/***/ 65: -/***/ (function(module, exports, __webpack_require__) { - -var rng = __webpack_require__(87); -var bytesToUuid = __webpack_require__(88); - -function v4(options, buf, offset) { - var i = buf && offset || 0; - - if (typeof(options) == 'string') { - buf = options === 'binary' ? new Array(16) : null; - options = null; - } - options = options || {}; - - var rnds = options.random || (options.rng || rng)(); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = (rnds[6] & 0x0f) | 0x40; - rnds[8] = (rnds[8] & 0x3f) | 0x80; - - // Copy bytes to buffer, if provided - if (buf) { - for (var ii = 0; ii < 16; ++ii) { - buf[i + ii] = rnds[ii]; - } - } - - return buf || bytesToUuid(rnds); -} - -module.exports = v4; - - -/***/ }), - -/***/ 66: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["autop"]; }()); - -/***/ }), - -/***/ 7: +/***/ 8: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); -/* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); - -function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - - ownKeys.forEach(function (key) { - Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); - }); - } - - return target; -} - -/***/ }), - -/***/ 87: -/***/ (function(module, exports) { - -// Unique ID creation requires a high quality random # generator. In the -// browser this is a little complicated due to unknown quality of Math.random() -// and inconsistent support for the `crypto` API. We do the best we can via -// feature-detection - -// getRandomValues needs to be invoked in a context where "this" is a Crypto -// implementation. Also, find the complete implementation of crypto on IE11. -var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) || - (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto)); - -if (getRandomValues) { - // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto - var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef - - module.exports = function whatwgRNG() { - getRandomValues(rnds8); - return rnds8; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); +function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; }; -} else { - // Math.random()-based (RNG) - // - // If all else fails, use Math.random(). It's fast, but is of unspecified - // quality. - var rnds = new Array(16); - - module.exports = function mathRNG() { - for (var i = 0, r; i < 16; i++) { - if ((i & 0x03) === 0) r = Math.random() * 0x100000000; - rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; - } - - return rnds; - }; -} - - -/***/ }), - -/***/ 88: -/***/ (function(module, exports) { - -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ -var byteToHex = []; -for (var i = 0; i < 256; ++i) { - byteToHex[i] = (i + 0x100).toString(16).substr(1); -} - -function bytesToUuid(buf, offset) { - var i = offset || 0; - var bth = byteToHex; - // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - return ([bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]]]).join(''); -} - -module.exports = bytesToUuid; - + + return _extends.apply(this, arguments); +} /***/ }), /***/ 9: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["compose"]; }()); /***/ })