@wordpress/dom 3.9.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.12.0 (2022-06-29)
6
+
7
+ ## 3.11.0 (2022-06-15)
8
+
9
+ ## 3.10.0 (2022-06-01)
10
+
5
11
  ## 3.9.0 (2022-05-18)
6
12
 
7
13
  ### Deprecation
@@ -28,7 +28,7 @@ var _isElement = _interopRequireDefault(require("./is-element"));
28
28
  /**
29
29
  * Internal dependencies
30
30
  */
31
-
31
+ const noop = () => {};
32
32
  /* eslint-disable jsdoc/valid-types */
33
33
 
34
34
  /**
@@ -54,6 +54,8 @@ var _isElement = _interopRequireDefault(require("./is-element"));
54
54
  * @param {Schema} schema An array of functions that can mutate with the provided node.
55
55
  * @param {boolean} inline Whether to clean for inline mode.
56
56
  */
57
+
58
+
57
59
  function cleanNodeList(nodeList, doc, schema, inline) {
58
60
  Array.from(nodeList).forEach((
59
61
  /** @type {Node & { nextElementSibling?: unknown }} */
@@ -105,7 +107,7 @@ function cleanNodeList(nodeList, doc, schema, inline) {
105
107
  className) => item.test(className);
106
108
  }
107
109
 
108
- return _lodash.noop;
110
+ return noop;
109
111
  });
110
112
  Array.from(node.classList).forEach(name => {
111
113
  if (!mattchers.some(isMatch => isMatch(name))) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"names":["cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","noop","some","remove","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA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B,UADO,EAEZlC,GAFY,EAGZC,MAHY,EAIZC,MAJY,CAAb;AAMA,mCAAQI,IAAR,EAPC,CAQD;AACA;AACA;AACA,aAdD,MAcO,IACNA,IAAI,CAAC6B,UAAL,IACA7B,IAAI,CAAC6B,UAAL,CAAgB3B,QAAhB,KAA6B,MAD7B,IAEA,wCAAmBF,IAAnB,CAHM,EAIL;AACDR,cAAAA,aAAa,CACZQ,IAAI,CAAC4B,UADO,EAEZlC,GAFY,EAGZC,MAHY,EAIZC,MAJY,CAAb;;AAOA,kBACCC,KAAK,CAACC,IAAN,CAAYE,IAAI,CAAC4B,UAAjB,EAA8BL,IAA9B,CACGO,KAAF,IAAa,CAAE,wCAAmBA,KAAnB,CADhB,CADD,EAIE;AACD,qCAAQ9B,IAAR;AACA;AACD,aAnBM,MAmBA;AACNR,cAAAA,aAAa,CACZQ,IAAI,CAAC4B,UADO,EAEZlC,GAFY,EAGZc,QAHY,EAIZZ,MAJY,CAAb;AAMA,aA3Cc,CA4Cf;;AACA,WA7CD,MA6CO;AACN,mBAAQI,IAAI,CAAC+B,UAAb,EAA0B;AACzB,mCAAQ/B,IAAI,CAAC+B,UAAb;AACA;AACD;AACD;AACD,OAtHA,CAuHD;;AACA,KA3HD,MA2HO;AACNvC,MAAAA,aAAa,CAAEQ,IAAI,CAAC4B,UAAP,EAAmBlC,GAAnB,EAAwBC,MAAxB,EAAgCC,MAAhC,CAAb,CADM,CAGN;AACA;;AACA,UACCA,MAAM,IACN,CAAE,wCAAmBI,IAAnB,CADF,IAEAA,IAAI,CAACgC,kBAHN,EAIE;AACD,kCAAatC,GAAG,CAACuC,aAAJ,CAAmB,IAAnB,CAAb,EAAwCjC,IAAxC;AACA;;AAED,2BAAQA,IAAR;AACA;AACD,GAjJD;AAkJA","sourcesContent":["/**\n * External dependencies\n */\nimport { includes, noop } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport isEmpty from './is-empty';\nimport remove from './remove';\nimport unwrap from './unwrap';\nimport { isPhrasingContent } from '../phrasing-content';\nimport insertAfter from './insert-after';\nimport isElement from './is-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef SchemaItem\n * @property {string[]} [attributes] Attributes.\n * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against.\n * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.\n * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.\n * @property {boolean} allowEmpty Whether to allow nodes without children.\n * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.\n */\n\n/** @typedef {{ [tag: string]: SchemaItem }} Schema */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on a node\n * list.\n *\n * @param {NodeList} nodeList The nodeList to filter.\n * @param {Document} doc The document of the nodeList.\n * @param {Schema} schema An array of functions that can mutate with the provided node.\n * @param {boolean} inline Whether to clean for inline mode.\n */\nexport default function cleanNodeList( nodeList, doc, schema, inline ) {\n\tArray.from( nodeList ).forEach( (\n\t\t/** @type {Node & { nextElementSibling?: unknown }} */ node\n\t) => {\n\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t// function, or with an isMatch function that matches the node.\n\t\tif (\n\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t) {\n\t\t\tif ( isElement( node ) ) {\n\t\t\t\tconst {\n\t\t\t\t\tattributes = [],\n\t\t\t\t\tclasses = [],\n\t\t\t\t\tchildren,\n\t\t\t\t\trequire = [],\n\t\t\t\t\tallowEmpty,\n\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t// remove the node.\n\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\tremove( node );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t! includes( attributes, name )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\tclassName === item;\n\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\titem.test( className );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\tisMatch( name )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnode.classList.remove( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t// If the node is at the top, phrasing content, and\n\t\t\t\t\t\t\t// contains children that are block content, unwrap\n\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t( child ) => ! isPhrasingContent( child )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t} else {\n\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t// are not phrasing content.\n\t\t\tif (\n\t\t\t\tinline &&\n\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\tnode.nextElementSibling\n\t\t\t) {\n\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t}\n\n\t\t\tunwrap( node );\n\t\t}\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"names":["noop","cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","some","remove","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAQA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACe,SAASC,aAAT,CAAwBC,QAAxB,EAAkCC,GAAlC,EAAuCC,MAAvC,EAA+CC,MAA/C,EAAwD;AACtEC,EAAAA,KAAK,CAACC,IAAN,CAAYL,QAAZ,EAAuBM,OAAvB,CACC;AAAE;AAAuDC,EAAAA,IAAzD,KAAmE;AAAA;;AAClE,UAAMC,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ACC,IAAN,CAAYE,IAAI,CAAC2B,UAAjB,EAA8BL,IAA9B,CACGO,KAAF,IACC,CAAE,wCAAmBA,KAAnB,CAFJ,CADD,EAKE;AACD,qCAAQ7B,IAAR;AACA;AACD,aApBM,MAoBA;AACNR,cAAAA,aAAa,CACZQ,IAAI,CAAC2B,UADO,EAEZjC,GAFY,EAGZc,QAHY,EAIZZ,MAJY,CAAb;AAMA,aA5Cc,CA6Cf;;AACA,WA9CD,MA8CO;AACN,mBAAQI,IAAI,CAAC8B,UAAb,EAA0B;AACzB,mCAAQ9B,IAAI,CAAC8B,UAAb;AACA;AACD;AACD;AACD,OAzHA,CA0HD;;AACA,KA9HD,MA8HO;AACNtC,MAAAA,aAAa,CAAEQ,IAAI,CAAC2B,UAAP,EAAmBjC,GAAnB,EAAwBC,MAAxB,EAAgCC,MAAhC,CAAb,CADM,CAGN;AACA;;AACA,UACCA,MAAM,IACN,CAAE,wCAAmBI,IAAnB,CADF,IAEAA,IAAI,CAAC+B,kBAHN,EAIE;AACD,kCAAarC,GAAG,CAACsC,aAAJ,CAAmB,IAAnB,CAAb,EAAwChC,IAAxC;AACA;;AAED,2BAAQA,IAAR;AACA;AACD,GAnJF;AAqJA","sourcesContent":["/**\n * External dependencies\n */\nimport { includes } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport isEmpty from './is-empty';\nimport remove from './remove';\nimport unwrap from './unwrap';\nimport { isPhrasingContent } from '../phrasing-content';\nimport insertAfter from './insert-after';\nimport isElement from './is-element';\n\nconst noop = () => {};\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef SchemaItem\n * @property {string[]} [attributes] Attributes.\n * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against.\n * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.\n * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.\n * @property {boolean} allowEmpty Whether to allow nodes without children.\n * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.\n */\n\n/** @typedef {{ [tag: string]: SchemaItem }} Schema */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on a node\n * list.\n *\n * @param {NodeList} nodeList The nodeList to filter.\n * @param {Document} doc The document of the nodeList.\n * @param {Schema} schema An array of functions that can mutate with the provided node.\n * @param {boolean} inline Whether to clean for inline mode.\n */\nexport default function cleanNodeList( nodeList, doc, schema, inline ) {\n\tArray.from( nodeList ).forEach(\n\t\t( /** @type {Node & { nextElementSibling?: unknown }} */ node ) => {\n\t\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t\t// function, or with an isMatch function that matches the node.\n\t\t\tif (\n\t\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t\t) {\n\t\t\t\tif ( isElement( node ) ) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tattributes = [],\n\t\t\t\t\t\tclasses = [],\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trequire = [],\n\t\t\t\t\t\tallowEmpty,\n\t\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t\t// remove the node.\n\t\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\t\tremove( node );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t\t! includes( attributes, name )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => className === item;\n\t\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => item.test( className );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\t\tisMatch( name )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tnode.classList.remove( name );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t// If the node is at the top, phrasing content, and\n\t\t\t\t\t\t\t\t// contains children that are block content, unwrap\n\t\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t\t( child ) =>\n\t\t\t\t\t\t\t\t\t\t\t! isPhrasingContent( child )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t\t} else {\n\t\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t\t// are not phrasing content.\n\t\t\t\tif (\n\t\t\t\t\tinline &&\n\t\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\t\tnode.nextElementSibling\n\t\t\t\t) {\n\t\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t\t}\n\n\t\t\t\tunwrap( node );\n\t\t\t}\n\t\t}\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"names":["getRectangleFromRange","range","collapsed","rects","Array","from","getClientRects","length","filteredRects","filter","width","getBoundingClientRect","top","furthestTop","bottom","furthestBottom","left","furthestLeft","right","furthestRight","window","DOMRect","startContainer","ownerDocument","nodeName","parentNode","index","childNodes","indexOf","createRange","setStart","setEnd","rect","padNode","createTextNode","cloneRange","insertNode","removeChild"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAT,CAAgCC,KAAhC,EAAwC;AACtD;AACA;AACA;AACA,MAAK,CAAEA,KAAK,CAACC,SAAb,EAAyB;AACxB,UAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYJ,KAAK,CAACK,cAAN,EAAZ,CAAd,CADwB,CAGxB;;AACA,QAAKH,KAAK,CAACI,MAAN,KAAiB,CAAtB,EAA0B;AACzB,aAAOJ,KAAK,CAAE,CAAF,CAAZ;AACA,KANuB,CAQxB;;;AACA,UAA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,cAAvB;AACA,0CAAiBG,UAAjB,EAA6B,YAA7B;AACA,UAAMC,KAAK;AAAG;AAAwBtB,IAAAA,KAAK,CAACC,IAAN,CACrCoB,UAAU,CAACE,UAD0B,CAAF,CAEhCC,OAFgC,CAEvBN,cAFuB,CAApC;AAIA,0CAAiBC,aAAjB,EAAgC,eAAhC;AACAtB,IAAAA,KAAK,GAAGsB,aAAa,CAACM,WAAd,EAAR;AACA5B,IAAAA,KAAK,CAAC6B,QAAN,CAAgBL,UAAhB,EAA4BC,KAA5B;AACAzB,IAAAA,KAAK,CAAC8B,MAAN,CAAcN,UAAd,EAA0BC,KAA1B;AACA;;AAED,MAAIM,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAX,CA/DsD,CAiEtD;AACA;AACA;AACA;AACA;;AACA,MAAK,CAAE0B,IAAP,EAAc;AACb,0CAAiBT,aAAjB,EAAgC,eAAhC;AACA,UAAMU,OAAO,GAAGV,aAAa,CAACW,cAAd,CAA8B,QAA9B,CAAhB,CAFa,CAGb;;AACAjC,IAAAA,KAAK,GAAGA,KAAK,CAACkC,UAAN,EAAR;AACAlC,IAAAA,KAAK,CAACmC,UAAN,CAAkBH,OAAlB;AACAD,IAAAA,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAP;AACA,0CAAiB2B,OAAO,CAACR,UAAzB,EAAqC,oBAArC;AACAQ,IAAAA,OAAO,CAACR,UAAR,CAAmBY,WAAnB,CAAgCJ,OAAhC;AACA;;AAED,SAAOD,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) furthestTop = top;\n\t\t\tif ( bottom > furthestBottom ) furthestBottom = bottom;\n\t\t\tif ( left < furthestLeft ) furthestLeft = left;\n\t\t\tif ( right > furthestRight ) furthestRight = right;\n\t\t}\n\n\t\treturn new window.DOMRect(\n\t\t\tfurthestLeft,\n\t\t\tfurthestTop,\n\t\t\tfurthestRight - furthestLeft,\n\t\t\tfurthestBottom - furthestTop\n\t\t);\n\t}\n\n\tconst { startContainer } = range;\n\tconst { ownerDocument } = startContainer;\n\n\t// Correct invalid \"BR\" ranges. The cannot contain any children.\n\tif ( startContainer.nodeName === 'BR' ) {\n\t\tconst { parentNode } = startContainer;\n\t\tassertIsDefined( parentNode, 'parentNode' );\n\t\tconst index = /** @type {Node[]} */ ( Array.from(\n\t\t\tparentNode.childNodes\n\t\t) ).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tlet rect = range.getClientRects()[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"names":["getRectangleFromRange","range","collapsed","rects","Array","from","getClientRects","length","filteredRects","filter","width","getBoundingClientRect","top","furthestTop","bottom","furthestBottom","left","furthestLeft","right","furthestRight","window","DOMRect","startContainer","ownerDocument","nodeName","parentNode","index","childNodes","indexOf","createRange","setStart","setEnd","rect","padNode","createTextNode","cloneRange","insertNode","removeChild"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAT,CAAgCC,KAAhC,EAAwC;AACtD;AACA;AACA;AACA,MAAK,CAAEA,KAAK,CAACC,SAAb,EAAyB;AACxB,UAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYJ,KAAK,CAACK,cAAN,EAAZ,CAAd,CADwB,CAGxB;;AACA,QAAKH,KAAK,CAACI,MAAN,KAAiB,CAAtB,EAA0B;AACzB,aAAOJ,KAAK,CAAE,CAAF,CAAZ;AACA,KANuB,CAQxB;;;AACA,UAAMK,aAAa,GAAGL,KAAK,CAACM,MAAN,CAAc;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aAAiBA,KAAK,GAAG,CAAzB;AAAA,KAAd,CAAtB,CATwB,CAWxB;;AACA,QAAKF,aAAa,CAACD,MAAd,KAAyB,CAA9B,EAAkC;AACjC,aAAON,KAAK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IAAAA,KAAK,GAAGsB,aAAa,CAACM,WAAd,EAAR;AACA5B,IAAAA,KAAK,CAAC6B,QAAN,CAAgBL,UAAhB,EAA4BC,KAA5B;AACAzB,IAAAA,KAAK,CAAC8B,MAAN,CAAcN,UAAd,EAA0BC,KAA1B;AACA;;AAED,MAAIM,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAX,CA/DsD,CAiEtD;AACA;AACA;AACA;AACA;;AACA,MAAK,CAAE0B,IAAP,EAAc;AACb,0CAAiBT,aAAjB,EAAgC,eAAhC;AACA,UAAMU,OAAO,GAAGV,aAAa,CAACW,cAAd,CAA8B,QAA9B,CAAhB,CAFa,CAGb;;AACAjC,IAAAA,KAAK,GAAGA,KAAK,CAACkC,UAAN,EAAR;AACAlC,IAAAA,KAAK,CAACmC,UAAN,CAAkBH,OAAlB;AACAD,IAAAA,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAP;AACA,0CAAiB2B,OAAO,CAACR,UAAzB,EAAqC,oBAArC;AACAQ,IAAAA,OAAO,CAACR,UAAR,CAAmBY,WAAnB,CAAgCJ,OAAhC;AACA;;AAED,SAAOD,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) furthestTop = top;\n\t\t\tif ( bottom > furthestBottom ) furthestBottom = bottom;\n\t\t\tif ( left < furthestLeft ) furthestLeft = left;\n\t\t\tif ( right > furthestRight ) furthestRight = right;\n\t\t}\n\n\t\treturn new window.DOMRect(\n\t\t\tfurthestLeft,\n\t\t\tfurthestTop,\n\t\t\tfurthestRight - furthestLeft,\n\t\t\tfurthestBottom - furthestTop\n\t\t);\n\t}\n\n\tconst { startContainer } = range;\n\tconst { ownerDocument } = startContainer;\n\n\t// Correct invalid \"BR\" ranges. The cannot contain any children.\n\tif ( startContainer.nodeName === 'BR' ) {\n\t\tconst { parentNode } = startContainer;\n\t\tassertIsDefined( parentNode, 'parentNode' );\n\t\tconst index = /** @type {Node[]} */ (\n\t\t\tArray.from( parentNode.childNodes )\n\t\t).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tlet rect = range.getClientRects()[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/input-field-has-uncollapsed-selection.js"],"names":["inputFieldHasUncollapsedSelection","element","selectionStart","selectionEnd","error"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,iCAAT,CAA4CC,OAA5C,EAAsD;AACpE,MAAK,CAAE,iCAAoBA,OAApB,CAAF,IAAmC,CAAE,0BAAaA,OAAb,CAA1C,EAAmE;AAClE,WAAO,KAAP;AACA,GAHmE,CAKpE;AACA;AACA;;;AACA,MAAI;AACH,UAAM;AACLC,MAAAA,cADK;AAELC,MAAAA;AAFK;AAGF;AAAwDF,IAAAA,OAH5D;AAIA,WACC;AACA;AACA;AACAC,MAAAA,cAAc,KAAK,IAAnB,IACA;AACAA,MAAAA,cAAc,KAAKC;AANpB;AAQA,GAbD,CAaE,OAAQC,KAAR,EAAgB;AACjB;AACA;AACA,WAAO,IAAP;AACA;AACD","sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textareaa element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst {\n\t\t\tselectionStart,\n\t\t\tselectionEnd,\n\t\t} = /** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch ( error ) {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/input-field-has-uncollapsed-selection.js"],"names":["inputFieldHasUncollapsedSelection","element","selectionStart","selectionEnd","error"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,iCAAT,CAA4CC,OAA5C,EAAsD;AACpE,MAAK,CAAE,iCAAoBA,OAApB,CAAF,IAAmC,CAAE,0BAAaA,OAAb,CAA1C,EAAmE;AAClE,WAAO,KAAP;AACA,GAHmE,CAKpE;AACA;AACA;;;AACA,MAAI;AACH,UAAM;AAAEC,MAAAA,cAAF;AAAkBC,MAAAA;AAAlB;AACL;AAAwDF,IAAAA,OADzD;AAEA,WACC;AACA;AACA;AACAC,MAAAA,cAAc,KAAK,IAAnB,IACA;AACAA,MAAAA,cAAc,KAAKC;AANpB;AAQA,GAXD,CAWE,OAAQC,KAAR,EAAgB;AACjB;AACA;AACA,WAAO,IAAP;AACA;AACD","sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textareaa element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst { selectionStart, selectionEnd } =\n\t\t\t/** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch ( error ) {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-edge.js"],"names":["isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalD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AH,GAAY,OAA/C;AACA,QAAMa,YAAY,GAAGH,QAAQ,CAAEC,YAAF,CAAR,GAA2Bd,SAAS,CAAEc,YAAF,CAAzD;AACA,QAAMG,cAAc,GACnBJ,QAAQ,CAAEE,cAAF,CAAR,GAA6BhB,kBAAkB,CAAEgB,cAAF,CADhD,CAhG4E,CAmG5E;;AACA,QAAMG,eAAe,GAAGC,IAAI,CAACC,GAAL,CAAUJ,YAAV,KAA4B,CAApD;AACA,QAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAL,CAAUH,cAAV,KAA8B,CAAxD;AAEA,SAAOpC,YAAY,GAChBqC,eADgB,GAEhBA,eAAe,IAAIG,iBAFtB;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {Element} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! (/** @type {HTMLElement} */ ( container ).isContentEditable) ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = hiddenCaretRangeFromPoint(\n\t\townerDocument,\n\t\tx,\n\t\ty,\n\t\t/** @type {HTMLElement} */ ( container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/is-edge.js"],"names":["isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AATA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,MAAT,CAAiBC,SAAjB,EAA4BC,SAA5B,EAA8D;AAAA,MAAvBC,YAAuB,uEAAR,KAAQ;;AAC5E,MACC,gCAAmBF,SAAnB,KACA,OAAOA,SAAS,CAACG,cAAjB,KAAoC,QAFrC,EAGE;AACD,QAAKH,SAAS,CAACG,cAAV,KAA6BH,SAAS,CAACI,YAA5C,EAA2D;AAC1D,aAAO,KAAP;AACA;;AAED,QAAKH,SAAL,EAAiB;AAChB,aAAOD,SAAS,CAACG,cAAV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eHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {Element} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! ( /** @type {HTMLElement} */ ( container ).isContentEditable ) ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = hiddenCaretRangeFromPoint(\n\t\townerDocument,\n\t\tx,\n\t\ty,\n\t\t/** @type {HTMLElement} */ ( container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-empty.js"],"names":["isEmpty","element","nodeType","TEXT_NODE","test","nodeValue","ELEMENT_NODE","hasAttributes","hasChildNodes","Array","from","childNodes","every"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,OAAT,CAAkBC,OAAlB,EAA4B;AAC1C,UAASA,OAAO,CAACC,QAAjB;AACC,SAAKD,OAAO,CAACE,SAAb;AACC;AACA;AACA,aAAO,yBAAyBC,IAAzB,CAA+BH,OAAO,CAACI,SAAR,IAAqB,EAApD,CAAP;;AACD,SAAKJ,OAAO,CAACK,YAAb;AACC,UAAKL,OAAO,CAACM,aAAR,EAAL,EAA+B;AAC9B,eAAO,KAAP;AACA,OAFD,MAEO,IAAK,CAAEN,OAAO,CAACO,aAAR,EAAP,EAAiC;AACvC,eAAO,IAAP;AACA;;AAED;AAAO;AAA2BC,QAAAA,KAAK,CAACC,IAAN,CACjCT,OAAO,CAACU,UADyB,CAAF,CAE5BC,KAF4B,CAErBZ,OAFqB;AAAhC;;AAGD;AACC,aAAO,IAAP;AAhBF;AAkBA","sourcesContent":["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ ( Array.from(\n\t\t\t\telement.childNodes\n\t\t\t) ).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/is-empty.js"],"names":["isEmpty","element","nodeType","TEXT_NODE","test","nodeValue","ELEMENT_NODE","hasAttributes","hasChildNodes","Array","from","childNodes","every"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,OAAT,CAAkBC,OAAlB,EAA4B;AAC1C,UAASA,OAAO,CAACC,QAAjB;AACC,SAAKD,OAAO,CAACE,SAAb;AACC;AACA;AACA,aAAO,yBAAyBC,IAAzB,CAA+BH,OAAO,CAACI,SAAR,IAAqB,EAApD,CAAP;;AACD,SAAKJ,OAAO,CAACK,YAAb;AACC,UAAKL,OAAO,CAACM,aAAR,EAAL,EAA+B;AAC9B,eAAO,KAAP;AACA,OAFD,MAEO,IAAK,CAAEN,OAAO,CAACO,aAAR,EAAP,EAAiC;AACvC,eAAO,IAAP;AACA;;AAED;AAAO;AACNC,QAAAA,KAAK,CAACC,IAAN,CAAYT,OAAO,CAACU,UAApB,CAD+B,CAE9BC,KAF8B,CAEvBZ,OAFuB;AAAhC;;AAGD;AACC,aAAO,IAAP;AAhBF;AAkBA","sourcesContent":["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ (\n\t\t\t\tArray.from( element.childNodes )\n\t\t\t).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { includes, noop } from 'lodash';
4
+ import { includes } from 'lodash';
5
5
  /**
6
6
  * Internal dependencies
7
7
  */
@@ -12,6 +12,8 @@ import unwrap from './unwrap';
12
12
  import { isPhrasingContent } from '../phrasing-content';
13
13
  import insertAfter from './insert-after';
14
14
  import isElement from './is-element';
15
+
16
+ const noop = () => {};
15
17
  /* eslint-disable jsdoc/valid-types */
16
18
 
17
19
  /**
@@ -38,6 +40,7 @@ import isElement from './is-element';
38
40
  * @param {boolean} inline Whether to clean for inline mode.
39
41
  */
40
42
 
43
+
41
44
  export default function cleanNodeList(nodeList, doc, schema, inline) {
42
45
  Array.from(nodeList).forEach((
43
46
  /** @type {Node & { nextElementSibling?: unknown }} */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"names":["includes","noop","isEmpty","remove","unwrap","isPhrasingContent","insertAfter","isElement","cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","some","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,IAAnB,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,SAAP,MAAsB,cAAtB;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA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CAQD;AACA;AACA;AACA,aAdD,MAcO,IACNA,IAAI,CAAC2B,UAAL,IACA3B,IAAI,CAAC2B,UAAL,CAAgBzB,QAAhB,KAA6B,MAD7B,IAEAb,iBAAiB,CAAEW,IAAF,CAHX,EAIL;AACDR,cAAAA,aAAa,CACZQ,IAAI,CAAC0B,UADO,EAEZhC,GAFY,EAGZC,MAHY,EAIZC,MAJY,CAAb;;AAOA,kBACCC,KAAK,CAACC,IAAN,CAAYE,IAAI,CAAC0B,UAAjB,EAA8BJ,IAA9B,CACGM,KAAF,IAAa,CAAEvC,iBAAiB,CAAEuC,KAAF,CADjC,CADD,EAIE;AACDxC,gBAAAA,MAAM,CAAEY,IAAF,CAAN;AACA;AACD,aAnBM,MAmBA;AACNR,cAAAA,aAAa,CACZQ,IAAI,CAAC0B,UADO,EAEZhC,GAFY,EAGZc,QAHY,EAIZZ,MAJY,CAAb;AAMA,aA3Cc,CA4Cf;;AACA,WA7CD,MA6CO;AACN,mBAAQI,IAAI,CAAC6B,UAAb,EAA0B;AACzB1C,cAAAA,MAAM,CAAEa,IAAI,CAAC6B,UAAP,CAAN;AACA;AACD;AACD;AACD,OAtHA,CAuHD;;AACA,KA3HD,MA2HO;AACNrC,MAAAA,aAAa,CAAEQ,IAAI,CAAC0B,UAAP,EAAmBhC,GAAnB,EAAwBC,MAAxB,EAAgCC,MAAhC,CAAb,CADM,CAGN;AACA;;AACA,UACCA,MAAM,IACN,CAAEP,iBAAiB,CAAEW,IAAF,CADnB,IAEAA,IAAI,CAAC8B,kBAHN,EAIE;AACDxC,QAAAA,WAAW,CAAEI,GAAG,CAACqC,aAAJ,CAAmB,IAAnB,CAAF,EAA6B/B,IAA7B,CAAX;AACA;;AAEDZ,MAAAA,MAAM,CAAEY,IAAF,CAAN;AACA;AACD,GAjJD;AAkJA","sourcesContent":["/**\n * External dependencies\n */\nimport { includes, noop } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport isEmpty from './is-empty';\nimport remove from './remove';\nimport unwrap from './unwrap';\nimport { isPhrasingContent } from '../phrasing-content';\nimport insertAfter from './insert-after';\nimport isElement from './is-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef SchemaItem\n * @property {string[]} [attributes] Attributes.\n * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against.\n * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.\n * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.\n * @property {boolean} allowEmpty Whether to allow nodes without children.\n * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.\n */\n\n/** @typedef {{ [tag: string]: SchemaItem }} Schema */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on a node\n * list.\n *\n * @param {NodeList} nodeList The nodeList to filter.\n * @param {Document} doc The document of the nodeList.\n * @param {Schema} schema An array of functions that can mutate with the provided node.\n * @param {boolean} inline Whether to clean for inline mode.\n */\nexport default function cleanNodeList( nodeList, doc, schema, inline ) {\n\tArray.from( nodeList ).forEach( (\n\t\t/** @type {Node & { nextElementSibling?: unknown }} */ node\n\t) => {\n\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t// function, or with an isMatch function that matches the node.\n\t\tif (\n\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t) {\n\t\t\tif ( isElement( node ) ) {\n\t\t\t\tconst {\n\t\t\t\t\tattributes = [],\n\t\t\t\t\tclasses = [],\n\t\t\t\t\tchildren,\n\t\t\t\t\trequire = [],\n\t\t\t\t\tallowEmpty,\n\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t// remove the node.\n\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\tremove( node );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t! includes( attributes, name )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\tclassName === item;\n\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\titem.test( className );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\tisMatch( name )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnode.classList.remove( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t// If the node is at the top, phrasing content, and\n\t\t\t\t\t\t\t// contains children that are block content, unwrap\n\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t( child ) => ! isPhrasingContent( child )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t} else {\n\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t// are not phrasing content.\n\t\t\tif (\n\t\t\t\tinline &&\n\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\tnode.nextElementSibling\n\t\t\t) {\n\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t}\n\n\t\t\tunwrap( node );\n\t\t}\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"names":["includes","isEmpty","remove","unwrap","isPhrasingContent","insertAfter","isElement","noop","cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","some","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,SAAP,MAAsB,cAAtB;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;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AA,MAAM,CAAEa,IAAF,CAAN,CAPC,CAQD;AACA;AACA;AACA,aAdD,MAcO,IACNA,IAAI,CAAC2B,UAAL,IACA3B,IAAI,CAAC2B,UAAL,CAAgBzB,QAAhB,KAA6B,MAD7B,IAEAd,iBAAiB,CAAEY,IAAF,CAHX,EAIL;AACDR,cAAAA,aAAa,CACZQ,IAAI,CAAC0B,UADO,EAEZhC,GAFY,EAGZC,MAHY,EAIZC,MAJY,CAAb;;AAOA,kBACCC,KAAK,CAACC,IAAN,CAAYE,IAAI,CAAC0B,UAAjB,EAA8BJ,IAA9B,CACGM,KAAF,IACC,CAAExC,iBAAiB,CAAEwC,KAAF,CAFrB,CADD,EAKE;AACDzC,gBAAAA,MAAM,CAAEa,IAAF,CAAN;AACA;AACD,aApBM,MAoBA;AACNR,cAAAA,aAAa,CACZQ,IAAI,CAAC0B,UADO,EAEZhC,GAFY,EAGZc,QAHY,EAIZZ,MAJY,CAAb;AAMA,aA5Cc,CA6Cf;;AACA,WA9CD,MA8CO;AACN,mBAAQI,IAAI,CAAC6B,UAAb,EAA0B;AACzB3C,cAAAA,MAAM,CAAEc,IAAI,CAAC6B,UAAP,CAAN;AACA;AACD;AACD;AACD,OAzHA,CA0HD;;AACA,KA9HD,MA8HO;AACNrC,MAAAA,aAAa,CAAEQ,IAAI,CAAC0B,UAAP,EAAmBhC,GAAnB,EAAwBC,MAAxB,EAAgCC,MAAhC,CAAb,CADM,CAGN;AACA;;AACA,UACCA,MAAM,IACN,CAAER,iBAAiB,CAAEY,IAAF,CADnB,IAEAA,IAAI,CAAC8B,kBAHN,EAIE;AACDzC,QAAAA,WAAW,CAAEK,GAAG,CAACqC,aAAJ,CAAmB,IAAnB,CAAF,EAA6B/B,IAA7B,CAAX;AACA;;AAEDb,MAAAA,MAAM,CAAEa,IAAF,CAAN;AACA;AACD,GAnJF;AAqJA","sourcesContent":["/**\n * External dependencies\n */\nimport { includes } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport isEmpty from './is-empty';\nimport remove from './remove';\nimport unwrap from './unwrap';\nimport { isPhrasingContent } from '../phrasing-content';\nimport insertAfter from './insert-after';\nimport isElement from './is-element';\n\nconst noop = () => {};\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef SchemaItem\n * @property {string[]} [attributes] Attributes.\n * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against.\n * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.\n * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.\n * @property {boolean} allowEmpty Whether to allow nodes without children.\n * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.\n */\n\n/** @typedef {{ [tag: string]: SchemaItem }} Schema */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on a node\n * list.\n *\n * @param {NodeList} nodeList The nodeList to filter.\n * @param {Document} doc The document of the nodeList.\n * @param {Schema} schema An array of functions that can mutate with the provided node.\n * @param {boolean} inline Whether to clean for inline mode.\n */\nexport default function cleanNodeList( nodeList, doc, schema, inline ) {\n\tArray.from( nodeList ).forEach(\n\t\t( /** @type {Node & { nextElementSibling?: unknown }} */ node ) => {\n\t\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t\t// function, or with an isMatch function that matches the node.\n\t\t\tif (\n\t\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t\t) {\n\t\t\t\tif ( isElement( node ) ) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tattributes = [],\n\t\t\t\t\t\tclasses = [],\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trequire = [],\n\t\t\t\t\t\tallowEmpty,\n\t\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t\t// remove the node.\n\t\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\t\tremove( node );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t\t! includes( attributes, name )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => className === item;\n\t\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => item.test( className );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\t\tisMatch( name )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tnode.classList.remove( name );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t// If the node is at the top, phrasing content, and\n\t\t\t\t\t\t\t\t// contains children that are block content, unwrap\n\t\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t\t( child ) =>\n\t\t\t\t\t\t\t\t\t\t\t! isPhrasingContent( child )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t\t} else {\n\t\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t\t// are not phrasing content.\n\t\t\t\tif (\n\t\t\t\t\tinline &&\n\t\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\t\tnode.nextElementSibling\n\t\t\t\t) {\n\t\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t\t}\n\n\t\t\t\tunwrap( node );\n\t\t\t}\n\t\t}\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"names":["assertIsDefined","getRectangleFromRange","range","collapsed","rects","Array","from","getClientRects","length","filteredRects","filter","width","getBoundingClientRect","top","furthestTop","bottom","furthestBottom","left","furthestLeft","right","furthestRight","window","DOMRect","startContainer","ownerDocument","nodeName","parentNode","index","childNodes","indexOf","createRange","setStart","setEnd","rect","padNode","createTextNode","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BH,OAAlB;AACAD,IAAAA,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAP;AACAP,IAAAA,eAAe,CAAEkC,OAAO,CAACR,UAAV,EAAsB,oBAAtB,CAAf;AACAQ,IAAAA,OAAO,CAACR,UAAR,CAAmBY,WAAnB,CAAgCJ,OAAhC;AACA;;AAED,SAAOD,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) furthestTop = top;\n\t\t\tif ( bottom > furthestBottom ) furthestBottom = bottom;\n\t\t\tif ( left < furthestLeft ) furthestLeft = left;\n\t\t\tif ( right > furthestRight ) furthestRight = right;\n\t\t}\n\n\t\treturn new window.DOMRect(\n\t\t\tfurthestLeft,\n\t\t\tfurthestTop,\n\t\t\tfurthestRight - furthestLeft,\n\t\t\tfurthestBottom - furthestTop\n\t\t);\n\t}\n\n\tconst { startContainer } = range;\n\tconst { ownerDocument } = startContainer;\n\n\t// Correct invalid \"BR\" ranges. The cannot contain any children.\n\tif ( startContainer.nodeName === 'BR' ) {\n\t\tconst { parentNode } = startContainer;\n\t\tassertIsDefined( parentNode, 'parentNode' );\n\t\tconst index = /** @type {Node[]} */ ( Array.from(\n\t\t\tparentNode.childNodes\n\t\t) ).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tlet rect = range.getClientRects()[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"names":["assertIsDefined","getRectangleFromRange","range","collapsed","rects","Array","from","getClientRects","length","filteredRects","filter","width","getBoundingClientRect","top","furthestTop","bottom","furthestBottom","left","furthestLeft","right","furthestRight","window","DOMRect","startContainer","ownerDocument","nodeName","parentNode","index","childNodes","indexOf","createRange","setStart","setEnd","rect","padNode","createTextNode","cloneRange","insertNode","removeChild"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,4BAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AAC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AACR,UAAV,EAAsB,oBAAtB,CAAf;AACAQ,IAAAA,OAAO,CAACR,UAAR,CAAmBY,WAAnB,CAAgCJ,OAAhC;AACA;;AAED,SAAOD,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) furthestTop = top;\n\t\t\tif ( bottom > furthestBottom ) furthestBottom = bottom;\n\t\t\tif ( left < furthestLeft ) furthestLeft = left;\n\t\t\tif ( right > furthestRight ) furthestRight = right;\n\t\t}\n\n\t\treturn new window.DOMRect(\n\t\t\tfurthestLeft,\n\t\t\tfurthestTop,\n\t\t\tfurthestRight - furthestLeft,\n\t\t\tfurthestBottom - furthestTop\n\t\t);\n\t}\n\n\tconst { startContainer } = range;\n\tconst { ownerDocument } = startContainer;\n\n\t// Correct invalid \"BR\" ranges. The cannot contain any children.\n\tif ( startContainer.nodeName === 'BR' ) {\n\t\tconst { parentNode } = startContainer;\n\t\tassertIsDefined( parentNode, 'parentNode' );\n\t\tconst index = /** @type {Node[]} */ (\n\t\t\tArray.from( parentNode.childNodes )\n\t\t).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tlet rect = range.getClientRects()[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/input-field-has-uncollapsed-selection.js"],"names":["isTextField","isHTMLInputElement","inputFieldHasUncollapsedSelection","element","selectionStart","selectionEnd","error"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAP,MAAwB,iBAAxB;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,iCAAT,CAA4CC,OAA5C,EAAsD;AACpE,MAAK,CAAEF,kBAAkB,CAAEE,OAAF,CAApB,IAAmC,CAAEH,WAAW,CAAEG,OAAF,CAArD,EAAmE;AAClE,WAAO,KAAP;AACA,GAHmE,CAKpE;AACA;AACA;;;AACA,MAAI;AACH,UAAM;AACLC,MAAAA,cADK;AAELC,MAAAA;AAFK;AAGF;AAAwDF,IAAAA,OAH5D;AAIA,WACC;AACA;AACA;AACAC,MAAAA,cAAc,KAAK,IAAnB,IACA;AACAA,MAAAA,cAAc,KAAKC;AANpB;AAQA,GAbD,CAaE,OAAQC,KAAR,EAAgB;AACjB;AACA;AACA,WAAO,IAAP;AACA;AACD","sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textareaa element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst {\n\t\t\tselectionStart,\n\t\t\tselectionEnd,\n\t\t} = /** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch ( error ) {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/input-field-has-uncollapsed-selection.js"],"names":["isTextField","isHTMLInputElement","inputFieldHasUncollapsedSelection","element","selectionStart","selectionEnd","error"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAP,MAAwB,iBAAxB;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,iCAAT,CAA4CC,OAA5C,EAAsD;AACpE,MAAK,CAAEF,kBAAkB,CAAEE,OAAF,CAApB,IAAmC,CAAEH,WAAW,CAAEG,OAAF,CAArD,EAAmE;AAClE,WAAO,KAAP;AACA,GAHmE,CAKpE;AACA;AACA;;;AACA,MAAI;AACH,UAAM;AAAEC,MAAAA,cAAF;AAAkBC,MAAAA;AAAlB;AACL;AAAwDF,IAAAA,OADzD;AAEA,WACC;AACA;AACA;AACAC,MAAAA,cAAc,KAAK,IAAnB,IACA;AACAA,MAAAA,cAAc,KAAKC;AANpB;AAQA,GAXD,CAWE,OAAQC,KAAR,EAAgB;AACjB;AACA;AACA,WAAO,IAAP;AACA;AACD","sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textareaa element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst { selectionStart, selectionEnd } =\n\t\t\t/** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch ( error ) {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-edge.js"],"names":["isRTL","getRangeHeight","getRectangleFromRange","isSelectionForward","hiddenCaretRangeFromPoint","assertIsDefined","isInputOrTextArea","isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,KAAP,MAAkB,UAAlB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,SAASC,eAAT,QAAgC,4BAAhC;AACA,OAAOC,iBAAP,MAA8B,yBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,MA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Ec,YAAF,CAAzD;AACA,QAAMG,cAAc,GACnBJ,QAAQ,CAAEE,cAAF,CAAR,GAA6BhB,kBAAkB,CAAEgB,cAAF,CADhD,CAhG4E,CAmG5E;;AACA,QAAMG,eAAe,GAAGC,IAAI,CAACC,GAAL,CAAUJ,YAAV,KAA4B,CAApD;AACA,QAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAL,CAAUH,cAAV,KAA8B,CAAxD;AAEA,SAAOpC,YAAY,GAChBqC,eADgB,GAEhBA,eAAe,IAAIG,iBAFtB;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {Element} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! (/** @type {HTMLElement} */ ( container ).isContentEditable) ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = hiddenCaretRangeFromPoint(\n\t\townerDocument,\n\t\tx,\n\t\ty,\n\t\t/** @type {HTMLElement} */ ( container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/is-edge.js"],"names":["isRTL","getRangeHeight","getRectangleFromRange","isSelectionForward","hiddenCaretRangeFromPoint","assertIsDefined","isInputOrTextArea","isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,KAAP,MAAkB,UAAlB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,SAASC,eAAT,QAAgC,4BAAhC;AACA,OAAOC,iBAAP,MAA8B,yBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,MAAT,CAAiBC,SAAjB,EAA4BC,SAA5B,EAA8D;AAAA,MAAvBC,YAAuB,uEAAR,KAAQ;;AAC5E,MACCJ,iBAAiB,CAAEE,SAAF,CAAjB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5E;;AACA,QAAMG,eAAe,GAAGC,IAAI,CAACC,GAAL,CAAUJ,YAAV,KAA4B,CAApD;AACA,QAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAL,CAAUH,cAAV,KAA8B,CAAxD;AAEA,SAAOpC,YAAY,GAChBqC,eADgB,GAEhBA,eAAe,IAAIG,iBAFtB;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {Element} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! ( /** @type {HTMLElement} */ ( container ).isContentEditable ) ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = hiddenCaretRangeFromPoint(\n\t\townerDocument,\n\t\tx,\n\t\ty,\n\t\t/** @type {HTMLElement} */ ( container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-empty.js"],"names":["isEmpty","element","nodeType","TEXT_NODE","test","nodeValue","ELEMENT_NODE","hasAttributes","hasChildNodes","Array","from","childNodes","every"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,OAAT,CAAkBC,OAAlB,EAA4B;AAC1C,UAASA,OAAO,CAACC,QAAjB;AACC,SAAKD,OAAO,CAACE,SAAb;AACC;AACA;AACA,aAAO,yBAAyBC,IAAzB,CAA+BH,OAAO,CAACI,SAAR,IAAqB,EAApD,CAAP;;AACD,SAAKJ,OAAO,CAACK,YAAb;AACC,UAAKL,OAAO,CAACM,aAAR,EAAL,EAA+B;AAC9B,eAAO,KAAP;AACA,OAFD,MAEO,IAAK,CAAEN,OAAO,CAACO,aAAR,EAAP,EAAiC;AACvC,eAAO,IAAP;AACA;;AAED;AAAO;AAA2BC,QAAAA,KAAK,CAACC,IAAN,CACjCT,OAAO,CAACU,UADyB,CAAF,CAE5BC,KAF4B,CAErBZ,OAFqB;AAAhC;;AAGD;AACC,aAAO,IAAP;AAhBF;AAkBA","sourcesContent":["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ ( Array.from(\n\t\t\t\telement.childNodes\n\t\t\t) ).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/is-empty.js"],"names":["isEmpty","element","nodeType","TEXT_NODE","test","nodeValue","ELEMENT_NODE","hasAttributes","hasChildNodes","Array","from","childNodes","every"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,OAAT,CAAkBC,OAAlB,EAA4B;AAC1C,UAASA,OAAO,CAACC,QAAjB;AACC,SAAKD,OAAO,CAACE,SAAb;AACC;AACA;AACA,aAAO,yBAAyBC,IAAzB,CAA+BH,OAAO,CAACI,SAAR,IAAqB,EAApD,CAAP;;AACD,SAAKJ,OAAO,CAACK,YAAb;AACC,UAAKL,OAAO,CAACM,aAAR,EAAL,EAA+B;AAC9B,eAAO,KAAP;AACA,OAFD,MAEO,IAAK,CAAEN,OAAO,CAACO,aAAR,EAAP,EAAiC;AACvC,eAAO,IAAP;AACA;;AAED;AAAO;AACNC,QAAAA,KAAK,CAACC,IAAN,CAAYT,OAAO,CAACU,UAApB,CAD+B,CAE9BC,KAF8B,CAEvBZ,OAFuB;AAAhC;;AAGD;AACC,aAAO,IAAP;AAhBF;AAkBA","sourcesContent":["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ (\n\t\t\t\tArray.from( element.childNodes )\n\t\t\t).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"clean-node-list.d.ts","sourceRoot":"","sources":["../../src/dom/clean-node-list.js"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AAEH,sDAAsD;AAGtD;;;;;;;;GAQG;AACH,gDALW,QAAQ,OACR,QAAQ,UACR,MAAM,UACN,OAAO,QAqJjB;;;;;;;;;;;;;;;;;;;;;;;gBAnKa,OAAO;;;;sBACA,IAAI,KAAK,OAAO"}
1
+ {"version":3,"file":"clean-node-list.d.ts","sourceRoot":"","sources":["../../src/dom/clean-node-list.js"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AAEH,sDAAsD;AAGtD;;;;;;;;GAQG;AACH,gDALW,QAAQ,OACR,QAAQ,UACR,MAAM,UACN,OAAO,QAwJjB;;;;;;;;;;;;;;;;;;;;;;;gBAtKa,OAAO;;;;sBACA,IAAI,KAAK,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"input-field-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/input-field-has-uncollapsed-selection.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH,mEAJW,OAAO,GAEN,OAAO,CA4BlB"}
1
+ {"version":3,"file":"input-field-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/input-field-has-uncollapsed-selection.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH,mEAJW,OAAO,GAEN,OAAO,CA0BlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/dom",
3
- "version": "3.9.0",
3
+ "version": "3.12.0",
4
4
  "description": "DOM utilities module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "198fa129cf1af8dc615918987ea6795cd40ab7df"
38
+ "gitHead": "a80eeb62ec7cb1418b9915c277e084a29d6665e3"
39
39
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { includes, noop } from 'lodash';
4
+ import { includes } from 'lodash';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -13,6 +13,8 @@ import { isPhrasingContent } from '../phrasing-content';
13
13
  import insertAfter from './insert-after';
14
14
  import isElement from './is-element';
15
15
 
16
+ const noop = () => {};
17
+
16
18
  /* eslint-disable jsdoc/valid-types */
17
19
  /**
18
20
  * @typedef SchemaItem
@@ -37,150 +39,153 @@ import isElement from './is-element';
37
39
  * @param {boolean} inline Whether to clean for inline mode.
38
40
  */
39
41
  export default function cleanNodeList( nodeList, doc, schema, inline ) {
40
- Array.from( nodeList ).forEach( (
41
- /** @type {Node & { nextElementSibling?: unknown }} */ node
42
- ) => {
43
- const tag = node.nodeName.toLowerCase();
44
-
45
- // It's a valid child, if the tag exists in the schema without an isMatch
46
- // function, or with an isMatch function that matches the node.
47
- if (
48
- schema.hasOwnProperty( tag ) &&
49
- ( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )
50
- ) {
51
- if ( isElement( node ) ) {
52
- const {
53
- attributes = [],
54
- classes = [],
55
- children,
56
- require = [],
57
- allowEmpty,
58
- } = schema[ tag ];
59
-
60
- // If the node is empty and it's supposed to have children,
61
- // remove the node.
62
- if ( children && ! allowEmpty && isEmpty( node ) ) {
63
- remove( node );
64
- return;
65
- }
66
-
67
- if ( node.hasAttributes() ) {
68
- // Strip invalid attributes.
69
- Array.from( node.attributes ).forEach( ( { name } ) => {
70
- if (
71
- name !== 'class' &&
72
- ! includes( attributes, name )
73
- ) {
74
- node.removeAttribute( name );
75
- }
76
- } );
77
-
78
- // Strip invalid classes.
79
- // In jsdom-jscore, 'node.classList' can be undefined.
80
- // TODO: Explore patching this in jsdom-jscore.
81
- if ( node.classList && node.classList.length ) {
82
- const mattchers = classes.map( ( item ) => {
83
- if ( typeof item === 'string' ) {
84
- return ( /** @type {string} */ className ) =>
85
- className === item;
86
- } else if ( item instanceof RegExp ) {
87
- return ( /** @type {string} */ className ) =>
88
- item.test( className );
89
- }
42
+ Array.from( nodeList ).forEach(
43
+ ( /** @type {Node & { nextElementSibling?: unknown }} */ node ) => {
44
+ const tag = node.nodeName.toLowerCase();
90
45
 
91
- return noop;
92
- } );
46
+ // It's a valid child, if the tag exists in the schema without an isMatch
47
+ // function, or with an isMatch function that matches the node.
48
+ if (
49
+ schema.hasOwnProperty( tag ) &&
50
+ ( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )
51
+ ) {
52
+ if ( isElement( node ) ) {
53
+ const {
54
+ attributes = [],
55
+ classes = [],
56
+ children,
57
+ require = [],
58
+ allowEmpty,
59
+ } = schema[ tag ];
60
+
61
+ // If the node is empty and it's supposed to have children,
62
+ // remove the node.
63
+ if ( children && ! allowEmpty && isEmpty( node ) ) {
64
+ remove( node );
65
+ return;
66
+ }
93
67
 
94
- Array.from( node.classList ).forEach( ( name ) => {
68
+ if ( node.hasAttributes() ) {
69
+ // Strip invalid attributes.
70
+ Array.from( node.attributes ).forEach( ( { name } ) => {
95
71
  if (
96
- ! mattchers.some( ( isMatch ) =>
97
- isMatch( name )
98
- )
72
+ name !== 'class' &&
73
+ ! includes( attributes, name )
99
74
  ) {
100
- node.classList.remove( name );
75
+ node.removeAttribute( name );
101
76
  }
102
77
  } );
103
78
 
104
- if ( ! node.classList.length ) {
105
- node.removeAttribute( 'class' );
79
+ // Strip invalid classes.
80
+ // In jsdom-jscore, 'node.classList' can be undefined.
81
+ // TODO: Explore patching this in jsdom-jscore.
82
+ if ( node.classList && node.classList.length ) {
83
+ const mattchers = classes.map( ( item ) => {
84
+ if ( typeof item === 'string' ) {
85
+ return (
86
+ /** @type {string} */ className
87
+ ) => className === item;
88
+ } else if ( item instanceof RegExp ) {
89
+ return (
90
+ /** @type {string} */ className
91
+ ) => item.test( className );
92
+ }
93
+
94
+ return noop;
95
+ } );
96
+
97
+ Array.from( node.classList ).forEach( ( name ) => {
98
+ if (
99
+ ! mattchers.some( ( isMatch ) =>
100
+ isMatch( name )
101
+ )
102
+ ) {
103
+ node.classList.remove( name );
104
+ }
105
+ } );
106
+
107
+ if ( ! node.classList.length ) {
108
+ node.removeAttribute( 'class' );
109
+ }
106
110
  }
107
111
  }
108
- }
109
-
110
- if ( node.hasChildNodes() ) {
111
- // Do not filter any content.
112
- if ( children === '*' ) {
113
- return;
114
- }
115
112
 
116
- // Continue if the node is supposed to have children.
117
- if ( children ) {
118
- // If a parent requires certain children, but it does
119
- // not have them, drop the parent and continue.
120
- if (
121
- require.length &&
122
- ! node.querySelector( require.join( ',' ) )
123
- ) {
124
- cleanNodeList(
125
- node.childNodes,
126
- doc,
127
- schema,
128
- inline
129
- );
130
- unwrap( node );
131
- // If the node is at the top, phrasing content, and
132
- // contains children that are block content, unwrap
133
- // the node because it is invalid.
134
- } else if (
135
- node.parentNode &&
136
- node.parentNode.nodeName === 'BODY' &&
137
- isPhrasingContent( node )
138
- ) {
139
- cleanNodeList(
140
- node.childNodes,
141
- doc,
142
- schema,
143
- inline
144
- );
113
+ if ( node.hasChildNodes() ) {
114
+ // Do not filter any content.
115
+ if ( children === '*' ) {
116
+ return;
117
+ }
145
118
 
119
+ // Continue if the node is supposed to have children.
120
+ if ( children ) {
121
+ // If a parent requires certain children, but it does
122
+ // not have them, drop the parent and continue.
146
123
  if (
147
- Array.from( node.childNodes ).some(
148
- ( child ) => ! isPhrasingContent( child )
149
- )
124
+ require.length &&
125
+ ! node.querySelector( require.join( ',' ) )
150
126
  ) {
127
+ cleanNodeList(
128
+ node.childNodes,
129
+ doc,
130
+ schema,
131
+ inline
132
+ );
151
133
  unwrap( node );
134
+ // If the node is at the top, phrasing content, and
135
+ // contains children that are block content, unwrap
136
+ // the node because it is invalid.
137
+ } else if (
138
+ node.parentNode &&
139
+ node.parentNode.nodeName === 'BODY' &&
140
+ isPhrasingContent( node )
141
+ ) {
142
+ cleanNodeList(
143
+ node.childNodes,
144
+ doc,
145
+ schema,
146
+ inline
147
+ );
148
+
149
+ if (
150
+ Array.from( node.childNodes ).some(
151
+ ( child ) =>
152
+ ! isPhrasingContent( child )
153
+ )
154
+ ) {
155
+ unwrap( node );
156
+ }
157
+ } else {
158
+ cleanNodeList(
159
+ node.childNodes,
160
+ doc,
161
+ children,
162
+ inline
163
+ );
152
164
  }
165
+ // Remove children if the node is not supposed to have any.
153
166
  } else {
154
- cleanNodeList(
155
- node.childNodes,
156
- doc,
157
- children,
158
- inline
159
- );
160
- }
161
- // Remove children if the node is not supposed to have any.
162
- } else {
163
- while ( node.firstChild ) {
164
- remove( node.firstChild );
167
+ while ( node.firstChild ) {
168
+ remove( node.firstChild );
169
+ }
165
170
  }
166
171
  }
167
172
  }
168
- }
169
- // Invalid child. Continue with schema at the same place and unwrap.
170
- } else {
171
- cleanNodeList( node.childNodes, doc, schema, inline );
173
+ // Invalid child. Continue with schema at the same place and unwrap.
174
+ } else {
175
+ cleanNodeList( node.childNodes, doc, schema, inline );
176
+
177
+ // For inline mode, insert a line break when unwrapping nodes that
178
+ // are not phrasing content.
179
+ if (
180
+ inline &&
181
+ ! isPhrasingContent( node ) &&
182
+ node.nextElementSibling
183
+ ) {
184
+ insertAfter( doc.createElement( 'br' ), node );
185
+ }
172
186
 
173
- // For inline mode, insert a line break when unwrapping nodes that
174
- // are not phrasing content.
175
- if (
176
- inline &&
177
- ! isPhrasingContent( node ) &&
178
- node.nextElementSibling
179
- ) {
180
- insertAfter( doc.createElement( 'br' ), node );
187
+ unwrap( node );
181
188
  }
182
-
183
- unwrap( node );
184
189
  }
185
- } );
190
+ );
186
191
  }
@@ -63,9 +63,9 @@ export default function getRectangleFromRange( range ) {
63
63
  if ( startContainer.nodeName === 'BR' ) {
64
64
  const { parentNode } = startContainer;
65
65
  assertIsDefined( parentNode, 'parentNode' );
66
- const index = /** @type {Node[]} */ ( Array.from(
67
- parentNode.childNodes
68
- ) ).indexOf( startContainer );
66
+ const index = /** @type {Node[]} */ (
67
+ Array.from( parentNode.childNodes )
68
+ ).indexOf( startContainer );
69
69
 
70
70
  assertIsDefined( ownerDocument, 'ownerDocument' );
71
71
  range = ownerDocument.createRange();
@@ -30,10 +30,8 @@ export default function inputFieldHasUncollapsedSelection( element ) {
30
30
  // `selectionEnd` on non-text <input> elements, so a try/catch construct is
31
31
  // necessary.
32
32
  try {
33
- const {
34
- selectionStart,
35
- selectionEnd,
36
- } = /** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );
33
+ const { selectionStart, selectionEnd } =
34
+ /** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );
37
35
  return (
38
36
  // `null` means the input type doesn't implement selection, thus we
39
37
  // cannot determine whether the selection is collapsed, so we
@@ -36,7 +36,7 @@ export default function isEdge( container, isReverse, onlyVertical = false ) {
36
36
  return container.value.length === container.selectionStart;
37
37
  }
38
38
 
39
- if ( ! (/** @type {HTMLElement} */ ( container ).isContentEditable) ) {
39
+ if ( ! ( /** @type {HTMLElement} */ ( container ).isContentEditable ) ) {
40
40
  return true;
41
41
  }
42
42
 
@@ -19,9 +19,9 @@ export default function isEmpty( element ) {
19
19
  return true;
20
20
  }
21
21
 
22
- return /** @type {Element[]} */ ( Array.from(
23
- element.childNodes
24
- ) ).every( isEmpty );
22
+ return /** @type {Element[]} */ (
23
+ Array.from( element.childNodes )
24
+ ).every( isEmpty );
25
25
  default:
26
26
  return true;
27
27
  }
@@ -1 +1 @@
1
- {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","./src/data-transfer.js","./src/focusable.js","../../node_modules/@types/lodash/common/common.d.ts","../../node_modules/@types/lodash/common/array.d.ts","../../node_modules/@types/lodash/common/collection.d.ts","../../node_modules/@types/lodash/common/date.d.ts","../../node_modules/@types/lodash/common/function.d.ts","../../node_modules/@types/lodash/common/lang.d.ts","../../node_modules/@types/lodash/common/math.d.ts","../../node_modules/@types/lodash/common/number.d.ts","../../node_modules/@types/lodash/common/object.d.ts","../../node_modules/@types/lodash/common/seq.d.ts","../../node_modules/@types/lodash/common/string.d.ts","../../node_modules/@types/lodash/common/util.d.ts","../../node_modules/@types/lodash/index.d.ts","./src/tabbable.js","./src/utils/assert-is-defined.ts","./src/dom/get-rectangle-from-range.js","./src/dom/compute-caret-rect.js","./src/dom/document-has-text-selection.js","./src/dom/is-html-input-element.js","./src/dom/is-text-field.js","./src/dom/input-field-has-uncollapsed-selection.js","./src/dom/document-has-uncollapsed-selection.js","./src/dom/document-has-selection.js","./src/dom/get-computed-style.js","./src/dom/get-scroll-container.js","./src/dom/get-offset-parent.js","./src/dom/is-input-or-text-area.js","./src/dom/is-entirely-selected.js","./src/dom/is-form-element.js","./src/dom/is-rtl.js","./src/dom/get-range-height.js","./src/dom/is-selection-forward.js","./src/dom/caret-range-from-point.js","./src/dom/hidden-caret-range-from-point.js","./src/dom/is-edge.js","./src/dom/is-horizontal-edge.js","../../node_modules/utility-types/dist/aliases-and-guards.d.ts","../../node_modules/utility-types/dist/mapped-types.d.ts","../../node_modules/utility-types/dist/utility-types.d.ts","../../node_modules/utility-types/dist/functional-helpers.d.ts","../../node_modules/utility-types/dist/index.d.ts","../deprecated/build-types/index.d.ts","./src/dom/is-number-input.js","./src/dom/is-vertical-edge.js","./src/dom/place-caret-at-edge.js","./src/dom/place-caret-at-horizontal-edge.js","./src/dom/place-caret-at-vertical-edge.js","./src/dom/insert-after.js","./src/dom/remove.js","./src/dom/replace.js","./src/dom/unwrap.js","./src/dom/replace-tag.js","./src/dom/wrap.js","./src/dom/safe-html.js","./src/dom/strip-html.js","./src/dom/is-empty.js","./src/phrasing-content.js","./src/dom/is-element.js","./src/dom/clean-node-list.js","./src/dom/remove-invalid-html.js","./src/dom/index.js","./src/index.js","../../typings/gutenberg-env/index.d.ts"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"80d2e2a2e1685c82cba3c320f5d077376fadff77fe1f52a4c29f995bdc40ea70","0ca9a18ed362f11af31b31312d27380b605653eb7d9b005abc7ce9af29e6c545","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","438284c7c455a29b9c0e2d1e72abc62ee93d9a163029ffe918a34c5db3b92da2","0c75b204aed9cf6ff1c7b4bed87a3ece0d9d6fc857a6350c0c95ed0c38c814e8","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","c24ad9be9adf28f0927e3d9d9e9cec1c677022356f241ccbbfb97bfe8fb3d1a1","0ec0998e2d085e8ea54266f547976ae152c9dd6cdb9ac4d8a520a230f5ebae84","9364c7566b0be2f7b70ff5285eb34686f83ccb01bda529b82d23b2a844653bfb","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","82251920b05f30981c9a4109cb5f3169dce4b477effc845c6d781044a30e7672","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3e59f00ab03c33717b3130066d4debb272da90eeded4935ff0604c2bc25a5cae","9fa6b83a35e897f340858995ca5d77e901d89fd18644cd4c9e8a4afe0b2e6363",{"version":"0714e2046df66c0e93c3330d30dbc0565b3e8cd3ee302cf99e4ede6220e5fec8","affectsGlobalScope":true},"05ea0a0b2298c74e7d48012e1362258edccc3c90858e7bf2e9cfa9135298a4e8","a7836408f857cb8855443e0ff79d3ed7027415dca85f312c5f9f47daa6cd355d","60c4ae06adc3b6c7e1bbde496c9e2ff9bf3ff2f811675b7a897d460d2b7b814a","99546def4f9cd760e5ee13c0cce45c83aaa3d5474d75cef79c34b1990a808022","1caa056d021a35691778948dcb48eb6f7550110ea33c0d14c03f0445daa93559","4fcfb368b1ba498dab2fd60a1c680c137aacc6df49d8e0e802c9de00f0e047f0","c16b538f18087f31e1b99251169cd93e8d7a1ba8dde51768978f4bde67f318ac","b34200360a82e8441a7c102c9c4c73512353c8d8a43a8000a29b5c67a867a9d1","9c32c48fe5fb3b9929609bbd1d7233ed1fc13ac7aaee602b8dd27a0a90baf9cf","9816eb62d7014f570356c988308e390770fea83993d6eae79788cd79a31ea6dc","dea4257186ad318062499e0aff7122433b1081b7883e95ef78d9b4121fc8e7da","e07d9c569b874918d96c737cc6265494127010a65db231160e46da999db6cd83","f5b932cd4c47954ecb9c5010d848afe821486d5785a3c1c81e670146f4245688","4d31f8f7e9d8a43d2fd3c5a378e390080706392dd4d1541fc6b6f876ed961cf4","756cc95fd142eb928ba7bd366cc2756a902d8a1219182a45a2820e86702b1f3e","df45136f01235aaaaa952d0cc2508bf2e1747157225773bd238a7e65e927fd06","4312fd698114e973469529ec29680789e8ce13ffddcf711a8660c85e522b4069","cb412dab570deef76d26e0c5759e3fbe12625947ac6a82037573c788b7a2d1a4","59fbe797b38f7f549100d38fc9a4c6cd0f4b990407700f5e1979a54c9d8e3ed6","e8be8e4d18f330bdd294cdbe7d3c4a89e8dca65585284745a25c515ecb69249f","8b692a361fc9f2d4102106f168b35cf6f30c9efc66050108001955a1a59b4fd2","59ac58f0ebf648d5e38b01df0cfd02700d475ff8367c3f4695d3632e3db3416b","6199e013116305fa2d162835ad812abfe210076e1249852851c5a80a753f4f3d","bd0d80db12ef1aceefc4f9d3eb88517b9634fa747ae8475981da8655292feab8","55e68fb1618e3f55f7866b8c8415152159309a14b716370081ab0b7af96d876e","bf0491af2455f92282b61807be2be6e7ad7d532e47fac7b698019d3617c28ff7","5d874fb879ab8601c02549817dceb2d0a30729cb7e161625dd6f819bbff1ec0b","ee551a880882770c4f56a0964a9767c9feafe497a5be52652527d098c88d85cb","b192606574769a5566620f9bf19358a3994bc2726ecdeaad9c66f3333b2687c8","905386a2f18ce88642a62d84ddda2e1763d6180a011947f9bc57f8c78589174a","ba688a4815abd9d27b425a819def1721b61e1798acc748b471e54d50a7804bcd","c6684892ae32c0d3fe0c2bb1b7e6bb37ffc86fc91d39c0cfe557aba4816e7766","609b8944af1aa9b73959c0bd766370986176a197c16c27e365e867a0bc85eed8","2ffc9898fdf8f285b73f08ee256ca9a6f20cf3de25c57dd7aa28f7558d3af624","0fb6bab9bd95185809964d513dcfeeab6b5609d280dcc6291b5277e36998afe1","2d18411640dd8fcf1067392b839136628cafef5a648d0d49dc9da2f7d344046e","57597a1e8735ae08b671194c8b64a2c2831fd6ce2793d1bca705dbceb41bdaae","fc9b503ac41bf643bdd2c5bcf21e7e8c052881dd6b94699e3624f3a60e02b0be","665d3d55e94122f2fe1c2dd78dd61774134151557a3b8dd41d49868a642c1277","2259073e3a0fcbd5d873f90465ad8364007668a97c0291a6b6d7975d8edbe30d","02959309d4b7d9a875c4f175abae0a359a074585513d073d1fbb828b704e5663","d0472eb54f481ef265c3407b31df68485efda04e40cc8a7238c8dbdaf93fe81b","70388aac7550e4cb19e9eb5aafba7ed3333fbae173f0d377643f5fa733317ae9","5620e210666cc9ff9409e6b18b23bdfbfd3edfa21a6b12ac28f48933842396b7","0d0dd5ae0237a3571383b9ac701d40220e1d963d0bbb22473c336225b2ed44a7","1e5577dfce1e114e9dc58a7199bdb9e359b30deb86d29a9f0a0b111fc8d29943","dcc4b56e334bd6f9a8680a5dd343e417cdb03bae06bdc4786211d2cdfd7899e8","acbe60d616549a3815593f33a7a34faf0b0d063257c74f3b01bfc20dae42652e","0af026de3ab75c99339016a7aa606da158668df7cfc0c25668c1d1617323da20",{"version":"f254c1abf6bb4c92633159831f924588908da902aa5e04ae45c39bd001f62e2e","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[47,49,50,51,52,53,54,55,56,57,58,59],[47,48,50,51,52,53,54,55,56,57,58,59],[48,49,50,51,52,53,54,55,56,57,58,59],[47,48,49,51,52,53,54,55,56,57,58,59],[47,48,49,50,52,53,54,55,56,57,58,59],[47,48,49,50,51,53,54,55,56,57,58,59],[47,48,49,50,51,52,54,55,56,57,58,59],[47,48,49,50,51,52,53,55,56,57,58,59],[47,48,49,50,51,52,53,54,56,57,58,59],[47,48,49,50,51,52,53,54,55,57,58,59],[47,48,49,50,51,52,53,54,55,56,58,59],[47,48,49,50,51,52,53,54,55,56,57,59],[47,48,49,50,51,52,53,54,55,56,57,58],[83,84,85,86],[83],[84],[87],[59,94,95,97,102,103,104],[61,62],[64,65,66],[61],[64,67],[70],[70,79],[62,63,64,66,68,69,71,72,74,75,76,82,89,90,92,93,94,95,96,97,98,99,100,101,102,106],[65,66],[61,62,73,76,77,78,80],[61,73],[73],[81],[65,88],[65],[61,73,76,80],[91],[105],[61,94,95],[95],[100],[45,46,60,103,107],[59],[46,59]],"referencedMap":[[48,1],[49,2],[47,3],[50,4],[51,5],[52,6],[53,7],[54,8],[55,9],[56,10],[57,11],[58,12],[59,13],[87,14],[84,15],[85,16],[88,17],[105,18],[63,19],[69,20],[64,21],[68,22],[70,21],[72,23],[62,21],[71,23],[80,24],[107,25],[67,26],[94,21],[81,27],[74,28],[75,29],[82,30],[89,31],[76,23],[78,21],[66,32],[90,30],[91,33],[92,34],[93,34],[106,35],[95,21],[98,21],[96,36],[100,37],[101,38],[97,21],[99,21],[108,39],[103,40],[60,41]],"exportedModulesMap":[[48,1],[49,2],[47,3],[50,4],[51,5],[52,6],[53,7],[54,8],[55,9],[56,10],[57,11],[58,12],[59,13],[87,14],[84,15],[85,16],[88,17],[105,18],[63,19],[69,20],[64,21],[68,22],[70,21],[72,23],[62,21],[71,23],[80,24],[107,25],[67,26],[94,21],[81,27],[74,28],[75,29],[82,30],[89,31],[76,23],[78,21],[66,32],[90,30],[91,33],[92,34],[93,34],[106,35],[95,21],[98,21],[96,36],[100,37],[101,38],[97,21],[99,21],[108,39],[103,40],[60,41]],"semanticDiagnosticsPerFile":[48,49,47,50,51,52,53,54,55,56,57,58,59,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,83,86,87,84,85,88,45,79,105,63,69,64,68,70,72,77,62,71,80,107,67,94,81,104,102,74,75,82,65,73,89,76,78,66,90,91,92,93,106,95,98,96,100,101,97,99,46,108,103,60,61,109]},"version":"4.4.2"}
1
+ {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","./src/data-transfer.js","./src/focusable.js","../../node_modules/@types/lodash/common/common.d.ts","../../node_modules/@types/lodash/common/array.d.ts","../../node_modules/@types/lodash/common/collection.d.ts","../../node_modules/@types/lodash/common/date.d.ts","../../node_modules/@types/lodash/common/function.d.ts","../../node_modules/@types/lodash/common/lang.d.ts","../../node_modules/@types/lodash/common/math.d.ts","../../node_modules/@types/lodash/common/number.d.ts","../../node_modules/@types/lodash/common/object.d.ts","../../node_modules/@types/lodash/common/seq.d.ts","../../node_modules/@types/lodash/common/string.d.ts","../../node_modules/@types/lodash/common/util.d.ts","../../node_modules/@types/lodash/index.d.ts","./src/tabbable.js","./src/utils/assert-is-defined.ts","./src/dom/get-rectangle-from-range.js","./src/dom/compute-caret-rect.js","./src/dom/document-has-text-selection.js","./src/dom/is-html-input-element.js","./src/dom/is-text-field.js","./src/dom/input-field-has-uncollapsed-selection.js","./src/dom/document-has-uncollapsed-selection.js","./src/dom/document-has-selection.js","./src/dom/get-computed-style.js","./src/dom/get-scroll-container.js","./src/dom/get-offset-parent.js","./src/dom/is-input-or-text-area.js","./src/dom/is-entirely-selected.js","./src/dom/is-form-element.js","./src/dom/is-rtl.js","./src/dom/get-range-height.js","./src/dom/is-selection-forward.js","./src/dom/caret-range-from-point.js","./src/dom/hidden-caret-range-from-point.js","./src/dom/is-edge.js","./src/dom/is-horizontal-edge.js","../../node_modules/utility-types/dist/aliases-and-guards.d.ts","../../node_modules/utility-types/dist/mapped-types.d.ts","../../node_modules/utility-types/dist/utility-types.d.ts","../../node_modules/utility-types/dist/functional-helpers.d.ts","../../node_modules/utility-types/dist/index.d.ts","../deprecated/build-types/index.d.ts","./src/dom/is-number-input.js","./src/dom/is-vertical-edge.js","./src/dom/place-caret-at-edge.js","./src/dom/place-caret-at-horizontal-edge.js","./src/dom/place-caret-at-vertical-edge.js","./src/dom/insert-after.js","./src/dom/remove.js","./src/dom/replace.js","./src/dom/unwrap.js","./src/dom/replace-tag.js","./src/dom/wrap.js","./src/dom/safe-html.js","./src/dom/strip-html.js","./src/dom/is-empty.js","./src/phrasing-content.js","./src/dom/is-element.js","./src/dom/clean-node-list.js","./src/dom/remove-invalid-html.js","./src/dom/index.js","./src/index.js","../../typings/gutenberg-env/index.d.ts"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"80d2e2a2e1685c82cba3c320f5d077376fadff77fe1f52a4c29f995bdc40ea70","0ca9a18ed362f11af31b31312d27380b605653eb7d9b005abc7ce9af29e6c545","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","438284c7c455a29b9c0e2d1e72abc62ee93d9a163029ffe918a34c5db3b92da2","0c75b204aed9cf6ff1c7b4bed87a3ece0d9d6fc857a6350c0c95ed0c38c814e8","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","c24ad9be9adf28f0927e3d9d9e9cec1c677022356f241ccbbfb97bfe8fb3d1a1","0ec0998e2d085e8ea54266f547976ae152c9dd6cdb9ac4d8a520a230f5ebae84","9364c7566b0be2f7b70ff5285eb34686f83ccb01bda529b82d23b2a844653bfb","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","82251920b05f30981c9a4109cb5f3169dce4b477effc845c6d781044a30e7672","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3e59f00ab03c33717b3130066d4debb272da90eeded4935ff0604c2bc25a5cae","9fa6b83a35e897f340858995ca5d77e901d89fd18644cd4c9e8a4afe0b2e6363",{"version":"0714e2046df66c0e93c3330d30dbc0565b3e8cd3ee302cf99e4ede6220e5fec8","affectsGlobalScope":true},"05ea0a0b2298c74e7d48012e1362258edccc3c90858e7bf2e9cfa9135298a4e8","a7836408f857cb8855443e0ff79d3ed7027415dca85f312c5f9f47daa6cd355d","2942c138536444d9bde15cd036a93d68f4e014770974f992a923f9f9c7749740","99546def4f9cd760e5ee13c0cce45c83aaa3d5474d75cef79c34b1990a808022","1caa056d021a35691778948dcb48eb6f7550110ea33c0d14c03f0445daa93559","4fcfb368b1ba498dab2fd60a1c680c137aacc6df49d8e0e802c9de00f0e047f0","c16b538f18087f31e1b99251169cd93e8d7a1ba8dde51768978f4bde67f318ac","f329cdfc6aa9467443275d35b330b78fccfe85ff28d1a54e415143645c294ed9","9c32c48fe5fb3b9929609bbd1d7233ed1fc13ac7aaee602b8dd27a0a90baf9cf","9816eb62d7014f570356c988308e390770fea83993d6eae79788cd79a31ea6dc","dea4257186ad318062499e0aff7122433b1081b7883e95ef78d9b4121fc8e7da","e07d9c569b874918d96c737cc6265494127010a65db231160e46da999db6cd83","f5b932cd4c47954ecb9c5010d848afe821486d5785a3c1c81e670146f4245688","4d31f8f7e9d8a43d2fd3c5a378e390080706392dd4d1541fc6b6f876ed961cf4","756cc95fd142eb928ba7bd366cc2756a902d8a1219182a45a2820e86702b1f3e","df45136f01235aaaaa952d0cc2508bf2e1747157225773bd238a7e65e927fd06","4312fd698114e973469529ec29680789e8ce13ffddcf711a8660c85e522b4069","cb412dab570deef76d26e0c5759e3fbe12625947ac6a82037573c788b7a2d1a4","59fbe797b38f7f549100d38fc9a4c6cd0f4b990407700f5e1979a54c9d8e3ed6","e8be8e4d18f330bdd294cdbe7d3c4a89e8dca65585284745a25c515ecb69249f","8b692a361fc9f2d4102106f168b35cf6f30c9efc66050108001955a1a59b4fd2","4b8e98da59bd094293f48bcba2b2863f16844f7b628755317c4376d2a57aae6f","6199e013116305fa2d162835ad812abfe210076e1249852851c5a80a753f4f3d","bd0d80db12ef1aceefc4f9d3eb88517b9634fa747ae8475981da8655292feab8","55e68fb1618e3f55f7866b8c8415152159309a14b716370081ab0b7af96d876e","bf0491af2455f92282b61807be2be6e7ad7d532e47fac7b698019d3617c28ff7","5d874fb879ab8601c02549817dceb2d0a30729cb7e161625dd6f819bbff1ec0b","ee551a880882770c4f56a0964a9767c9feafe497a5be52652527d098c88d85cb","b192606574769a5566620f9bf19358a3994bc2726ecdeaad9c66f3333b2687c8","905386a2f18ce88642a62d84ddda2e1763d6180a011947f9bc57f8c78589174a","ba688a4815abd9d27b425a819def1721b61e1798acc748b471e54d50a7804bcd","c6684892ae32c0d3fe0c2bb1b7e6bb37ffc86fc91d39c0cfe557aba4816e7766","609b8944af1aa9b73959c0bd766370986176a197c16c27e365e867a0bc85eed8","2ffc9898fdf8f285b73f08ee256ca9a6f20cf3de25c57dd7aa28f7558d3af624","0fb6bab9bd95185809964d513dcfeeab6b5609d280dcc6291b5277e36998afe1","2d18411640dd8fcf1067392b839136628cafef5a648d0d49dc9da2f7d344046e","57597a1e8735ae08b671194c8b64a2c2831fd6ce2793d1bca705dbceb41bdaae","fc9b503ac41bf643bdd2c5bcf21e7e8c052881dd6b94699e3624f3a60e02b0be","665d3d55e94122f2fe1c2dd78dd61774134151557a3b8dd41d49868a642c1277","2259073e3a0fcbd5d873f90465ad8364007668a97c0291a6b6d7975d8edbe30d","02959309d4b7d9a875c4f175abae0a359a074585513d073d1fbb828b704e5663","d0472eb54f481ef265c3407b31df68485efda04e40cc8a7238c8dbdaf93fe81b","eb89338ad7e6dac4cf3435ed1351b5d8340b9b60f583560e89ae8e9997f1ea31","5620e210666cc9ff9409e6b18b23bdfbfd3edfa21a6b12ac28f48933842396b7","0d0dd5ae0237a3571383b9ac701d40220e1d963d0bbb22473c336225b2ed44a7","72c826c54c1ce32f080967b37539b9ad714696dbb971a2586b271f926c235b09","dcc4b56e334bd6f9a8680a5dd343e417cdb03bae06bdc4786211d2cdfd7899e8","acbe60d616549a3815593f33a7a34faf0b0d063257c74f3b01bfc20dae42652e","0af026de3ab75c99339016a7aa606da158668df7cfc0c25668c1d1617323da20",{"version":"f254c1abf6bb4c92633159831f924588908da902aa5e04ae45c39bd001f62e2e","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[47,49,50,51,52,53,54,55,56,57,58,59],[47,48,50,51,52,53,54,55,56,57,58,59],[48,49,50,51,52,53,54,55,56,57,58,59],[47,48,49,51,52,53,54,55,56,57,58,59],[47,48,49,50,52,53,54,55,56,57,58,59],[47,48,49,50,51,53,54,55,56,57,58,59],[47,48,49,50,51,52,54,55,56,57,58,59],[47,48,49,50,51,52,53,55,56,57,58,59],[47,48,49,50,51,52,53,54,56,57,58,59],[47,48,49,50,51,52,53,54,55,57,58,59],[47,48,49,50,51,52,53,54,55,56,58,59],[47,48,49,50,51,52,53,54,55,56,57,59],[47,48,49,50,51,52,53,54,55,56,57,58],[83,84,85,86],[83],[84],[87],[59,94,95,97,102,103,104],[61,62],[64,65,66],[61],[64,67],[70],[70,79],[62,63,64,66,68,69,71,72,74,75,76,82,89,90,92,93,94,95,96,97,98,99,100,101,102,106],[65,66],[61,62,73,76,77,78,80],[61,73],[73],[81],[65,88],[65],[61,73,76,80],[91],[105],[61,94,95],[95],[100],[45,46,60,103,107],[59],[46,59]],"referencedMap":[[48,1],[49,2],[47,3],[50,4],[51,5],[52,6],[53,7],[54,8],[55,9],[56,10],[57,11],[58,12],[59,13],[87,14],[84,15],[85,16],[88,17],[105,18],[63,19],[69,20],[64,21],[68,22],[70,21],[72,23],[62,21],[71,23],[80,24],[107,25],[67,26],[94,21],[81,27],[74,28],[75,29],[82,30],[89,31],[76,23],[78,21],[66,32],[90,30],[91,33],[92,34],[93,34],[106,35],[95,21],[98,21],[96,36],[100,37],[101,38],[97,21],[99,21],[108,39],[103,40],[60,41]],"exportedModulesMap":[[48,1],[49,2],[47,3],[50,4],[51,5],[52,6],[53,7],[54,8],[55,9],[56,10],[57,11],[58,12],[59,13],[87,14],[84,15],[85,16],[88,17],[105,18],[63,19],[69,20],[64,21],[68,22],[70,21],[72,23],[62,21],[71,23],[80,24],[107,25],[67,26],[94,21],[81,27],[74,28],[75,29],[82,30],[89,31],[76,23],[78,21],[66,32],[90,30],[91,33],[92,34],[93,34],[106,35],[95,21],[98,21],[96,36],[100,37],[101,38],[97,21],[99,21],[108,39],[103,40],[60,41]],"semanticDiagnosticsPerFile":[48,49,47,50,51,52,53,54,55,56,57,58,59,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,83,86,87,84,85,88,45,79,105,63,69,64,68,70,72,77,62,71,80,107,67,94,81,104,102,74,75,82,65,73,89,76,78,66,90,91,92,93,106,95,98,96,100,101,97,99,46,108,103,60,61,109]},"version":"4.4.2"}