{
  "version": 3,
  "sources": ["../../../src/api/parser/fix-global-attribute.js"],
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { hasBlockSupport } from '../registration';\nimport { parseWithAttributeSchema } from './get-block-attributes';\n\n/**\n * Given an HTML string and an attribute schema, returns the specified attribute\n * value from the root element in the markup.\n *\n * @param {string} innerHTML       Markup string from which to extract the attribute.\n * @param {string} dataAttribute   The data attribute name to use as wrapper.\n * @param {Object} attributeSchema The attribute schema configuration.\n *\n * @return {string} The attribute value assigned to the root element.\n */\nexport function getHTMLRootElement(\n\tinnerHTML,\n\tdataAttribute,\n\tattributeSchema\n) {\n\tconst parsed = parseWithAttributeSchema(\n\t\t`<div ${ dataAttribute }>${ innerHTML }</div>`,\n\t\tattributeSchema\n\t);\n\treturn parsed;\n}\n\n/**\n * Given a parsed set of block attributes, if the block supports the specified attribute\n * and the attribute is found in the HTML, the attribute is assigned to the block attributes.\n *\n * @param {Object} blockAttributes Original block attributes.\n * @param {Object} blockType       Block type settings.\n * @param {string} innerHTML       Original block markup.\n * @param {string} supportKey      The block support key to check and attribute key to set.\n * @param {string} dataAttribute   The data attribute name to use as wrapper.\n * @param {Object} attributeSchema The attribute schema configuration.\n *\n * @return {Object} Filtered block attributes.\n */\nexport function fixGlobalAttribute(\n\tblockAttributes,\n\tblockType,\n\tinnerHTML,\n\tsupportKey,\n\tdataAttribute,\n\tattributeSchema\n) {\n\tif ( ! hasBlockSupport( blockType, supportKey, false ) ) {\n\t\treturn blockAttributes;\n\t}\n\tconst modifiedBlockAttributes = { ...blockAttributes };\n\tconst attributeValue = getHTMLRootElement(\n\t\tinnerHTML,\n\t\tdataAttribute,\n\t\tattributeSchema\n\t);\n\tif ( attributeValue ) {\n\t\tmodifiedBlockAttributes[ supportKey ] = attributeValue;\n\t}\n\treturn modifiedBlockAttributes;\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAgC;AAChC,kCAAyC;AAYlC,SAAS,mBACf,WACA,eACA,iBACC;AACD,QAAM,aAAS;AAAA,IACd,QAAS,aAAc,IAAK,SAAU;AAAA,IACtC;AAAA,EACD;AACA,SAAO;AACR;AAeO,SAAS,mBACf,iBACA,WACA,WACA,YACA,eACA,iBACC;AACD,MAAK,KAAE,qCAAiB,WAAW,YAAY,KAAM,GAAI;AACxD,WAAO;AAAA,EACR;AACA,QAAM,0BAA0B,EAAE,GAAG,gBAAgB;AACrD,QAAM,iBAAiB;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,MAAK,gBAAiB;AACrB,4BAAyB,UAAW,IAAI;AAAA,EACzC;AACA,SAAO;AACR;",
  "names": []
}
