File: /www/wwwroot/www.waciwang.com/wp-content/plugins/gutenberg/build/scripts/html-entities/index.js.map
{
"version": 3,
"sources": ["../../../packages/html-entities/src/index.ts"],
"sourcesContent": ["let _decodeTextArea: HTMLTextAreaElement | undefined;\n\n/**\n * Decodes the HTML entities from a given string.\n *\n * @param html String that contain HTML entities.\n *\n * @example\n * ```js\n * import { decodeEntities } from '@wordpress/html-entities';\n *\n * const result = decodeEntities( 'á' );\n * console.log( result ); // result will be \"\u00E1\"\n * ```\n *\n * @return The decoded string.\n */\nexport function decodeEntities( html: string ): string {\n\t// Not a string, or no entities to decode.\n\tif ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {\n\t\treturn html;\n\t}\n\n\t// Create a textarea for decoding entities, that we can reuse.\n\tif ( undefined === _decodeTextArea ) {\n\t\tif (\n\t\t\tdocument.implementation &&\n\t\t\tdocument.implementation.createHTMLDocument\n\t\t) {\n\t\t\t_decodeTextArea = document.implementation\n\t\t\t\t.createHTMLDocument( '' )\n\t\t\t\t.createElement( 'textarea' );\n\t\t} else {\n\t\t\t_decodeTextArea = document.createElement( 'textarea' );\n\t\t}\n\t}\n\n\t_decodeTextArea.innerHTML = html;\n\tconst decoded = _decodeTextArea.textContent ?? '';\n\t_decodeTextArea.innerHTML = '';\n\n\t/**\n\t * Cast to string, HTMLTextAreaElement should always have `string` textContent.\n\t *\n\t * > The `textContent` property of the `Node` interface represents the text content of the\n\t * > node and its descendants.\n\t * >\n\t * > Value: A string or `null`\n\t * >\n\t * > * If the node is a `document` or a Doctype, `textContent` returns `null`.\n\t * > * If the node is a CDATA section, comment, processing instruction, or text node,\n\t * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.\n\t * > * For other node types, `textContent returns the concatenation of the textContent of\n\t * > every child node, excluding comments and processing instructions. (This is an empty\n\t * > string if the node has no children.)\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n\t */\n\treturn decoded;\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAI;AAiBG,WAAS,eAAgB,MAAuB;AAEtD,QAAK,aAAa,OAAO,QAAQ,OAAO,KAAK,QAAS,GAAI,GAAI;AAC7D,aAAO;IACR;AAGA,QAAK,WAAc,iBAAkB;AACpC,UACC,SAAS,kBACT,SAAS,eAAe,oBACvB;AACD,0BAAkB,SAAS,eACzB,mBAAoB,EAAG,EACvB,cAAe,UAAW;MAC7B,OAAO;AACN,0BAAkB,SAAS,cAAe,UAAW;MACtD;IACD;AAEA,oBAAgB,YAAY;AAC5B,UAAM,UAAU,gBAAgB,eAAe;AAC/C,oBAAgB,YAAY;AAmB5B,WAAO;EACR;",
"names": []
}