WordPress/wp-includes/js/dist/dom.min.js
Peter Wilson abde9678b4 Build tools: Use hashed module IDs for minified files.
Further improves webpack configuration for editor files to use hashed module IDs in the compressed (`*.min.js`) production files.

Follow up to [50940].

Props gziolo, peterwilsoncc.
Fixes #53192.


Built from https://develop.svn.wordpress.org/trunk@51035


git-svn-id: http://core.svn.wordpress.org/trunk@50644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-27 00:17:06 +00:00

2 lines
13 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.dom=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="2sUP")}({"2sUP":function(t,e,n){"use strict";n.r(e),n.d(e,"focus",(function(){return et})),n.d(e,"computeCaretRect",(function(){return C})),n.d(e,"documentHasTextSelection",(function(){return w})),n.d(e,"documentHasUncollapsedSelection",(function(){return S})),n.d(e,"documentHasSelection",(function(){return T})),n.d(e,"getRectangleFromRange",(function(){return N})),n.d(e,"getScrollContainer",(function(){return x})),n.d(e,"getOffsetParent",(function(){return R})),n.d(e,"isEntirelySelected",(function(){return D})),n.d(e,"isHorizontalEdge",(function(){return I})),n.d(e,"isNumberInput",(function(){return O})),n.d(e,"isTextField",(function(){return v})),n.d(e,"isVerticalEdge",(function(){return _})),n.d(e,"placeCaretAtHorizontalEdge",(function(){return V})),n.d(e,"placeCaretAtVerticalEdge",(function(){return F})),n.d(e,"replace",(function(){return z})),n.d(e,"remove",(function(){return U})),n.d(e,"insertAfter",(function(){return B})),n.d(e,"unwrap",(function(){return k})),n.d(e,"replaceTag",(function(){return q})),n.d(e,"wrap",(function(){return X})),n.d(e,"__unstableStripHTML",(function(){return Y})),n.d(e,"isEmpty",(function(){return G})),n.d(e,"removeInvalidHTML",(function(){return Z})),n.d(e,"isRTL",(function(){return L})),n.d(e,"getPhrasingContentSchema",(function(){return J})),n.d(e,"isPhrasingContent",(function(){return K})),n.d(e,"isTextContent",(function(){return Q})),n.d(e,"getFilesFromDataTransfer",(function(){return tt}));var r={};n.r(r),n.d(r,"find",(function(){return c}));var o={};n.r(o),n.d(o,"isTabbableIndex",(function(){return l})),n.d(o,"find",(function(){return h})),n.d(o,"findPrevious",(function(){return b})),n.d(o,"findNext",(function(){return g}));const i=["[tabindex]","a[href]","button:not([disabled])",'input:not([type="hidden"]):not([disabled])',"select:not([disabled])","textarea:not([disabled])","iframe","object","embed","area[href]","[contenteditable]:not([contenteditable=false])"].join(",");function u(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0}function c(t){const e=t.querySelectorAll(i);return Array.from(e).filter(t=>{if(!u(t)||function(t){return"iframe"===t.nodeName.toLowerCase()&&"-1"===t.getAttribute("tabindex")}(t))return!1;const{nodeName:e}=t;return"AREA"!==e||function(t){const e=t.closest("map[name]");if(!e)return!1;const n=t.ownerDocument.querySelector('img[usemap="#'+e.name+'"]');return!!n&&u(n)}(t)})}var a=n("YLtl");function s(t){const e=t.getAttribute("tabindex");return null===e?0:parseInt(e,10)}function l(t){return-1!==s(t)}function d(t,e){return{element:t,index:e}}function f(t){return t.element}function m(t,e){const n=s(t.element),r=s(e.element);return n===r?t.index-e.index:n-r}function p(t){return t.filter(l).map(d).sort(m).map(f).reduce(function(){const t={};return function(e,n){const{nodeName:r,type:o,checked:i,name:u}=n;if("INPUT"!==r||"radio"!==o||!u)return e.concat(n);const c=t.hasOwnProperty(u);if(!(i||!c))return e;if(c){const n=t[u];e=Object(a.without)(e,n)}return t[u]=n,e.concat(n)}}(),[])}function h(t){return p(c(t))}function b(t){const e=c(t.ownerDocument.body),n=e.indexOf(t);return e.length=n,Object(a.last)(p(e))}function g(t){const e=c(t.ownerDocument.body),n=e.indexOf(t),r=e.slice(n+1).filter(e=>!t.contains(e));return Object(a.first)(p(r))}function y(t,e){0}function N(t){if(!t.collapsed){const e=Array.from(t.getClientRects());if(1===e.length)return e[0];const n=e.filter(({width:t})=>t>1);if(0===n.length)return t.getBoundingClientRect();if(1===n.length)return n[0];let{top:r,bottom:o,left:i,right:u}=n[0];for(const{top:t,bottom:e,left:c,right:a}of n)t<r&&(r=t),e>o&&(o=e),c<i&&(i=c),a>u&&(u=a);return new window.DOMRect(i,r,u-i,o-r)}const{startContainer:e}=t,{ownerDocument:n}=e;if("BR"===e.nodeName){const{parentNode:r}=e;y();const o=Array.from(r.childNodes).indexOf(e);y(),(t=n.createRange()).setStart(r,o),t.setEnd(r,o)}let r=t.getClientRects()[0];if(!r){y();const e=n.createTextNode("");(t=t.cloneRange()).insertNode(e),r=t.getClientRects()[0],y(e.parentNode),e.parentNode.removeChild(e)}return r}function C(t){const e=t.getSelection();y();const n=e.rangeCount?e.getRangeAt(0):null;return n?N(n):null}function w(t){y(t.defaultView);const e=t.defaultView.getSelection();y();const n=e.rangeCount?e.getRangeAt(0):null;return!!n&&!n.collapsed}function E(t){return!!t&&"INPUT"===t.nodeName}function v(t){return E(t)&&t.type&&!["button","checkbox","hidden","file","radio","image","range","reset","submit","number"].includes(t.type)||"TEXTAREA"===t.nodeName||"true"===t.contentEditable}function O(t){return E(t)&&"number"===t.type&&!!t.valueAsNumber}function S(t){return w(t)||!!t.activeElement&&function(t){if(!v(t)&&!O(t))return!1;try{const{selectionStart:e,selectionEnd:n}=t;return null!==e&&e!==n}catch(t){return!1}}(t.activeElement)}function T(t){return!!t.activeElement&&(v(t.activeElement)||O(t.activeElement)||w(t))}function A(t){return y(t.ownerDocument.defaultView),t.ownerDocument.defaultView.getComputedStyle(t)}function x(t){if(t){if(t.scrollHeight>t.clientHeight){const{overflowY:e}=A(t);if(/(auto|scroll)/.test(e))return t}return x(t.parentNode)}}function R(t){let e;for(;(e=t.parentNode)&&e.nodeType!==e.ELEMENT_NODE;);return e?"static"!==A(e).position?e:e.offsetParent:null}function P(t){return"INPUT"===t.tagName||"TEXTAREA"===t.tagName}function D(t){if(P(t))return 0===t.selectionStart&&t.value.length===t.selectionEnd;if(!t.isContentEditable)return!0;const{ownerDocument:e}=t,{defaultView:n}=e;y();const r=n.getSelection();y();const o=r.rangeCount?r.getRangeAt(0):null;if(!o)return!0;const{startContainer:i,endContainer:u,startOffset:c,endOffset:a}=o;if(i===t&&u===t&&0===c&&a===t.childNodes.length)return!0;const s=t.lastChild;y();const l=s.nodeType===s.TEXT_NODE?s.data.length:s.childNodes.length;return i===t.firstChild&&u===t.lastChild&&0===c&&a===l}function L(t){return"rtl"===A(t).direction}function M(t,e,n,r){const o=r.style.zIndex,i=r.style.position,{position:u="static"}=A(r);"static"===u&&(r.style.position="relative"),r.style.zIndex="10000";const c=function(t,e,n){if(t.caretRangeFromPoint)return t.caretRangeFromPoint(e,n);if(!t.caretPositionFromPoint)return null;const r=t.caretPositionFromPoint(e,n);if(!r)return null;const o=t.createRange();return o.setStart(r.offsetNode,r.offset),o.collapse(!0),o}(t,e,n);return r.style.zIndex=o,r.style.position=i,c}function j(t,e,n=!1){if(P(t))return t.selectionStart===t.selectionEnd&&(e?0===t.selectionStart:t.value.length===t.selectionStart);if(!t.isContentEditable)return!0;const{ownerDocument:r}=t,{defaultView:o}=r;y();const i=o.getSelection();if(!i||!i.rangeCount)return!1;const u=i.getRangeAt(0),c=u.cloneRange(),a=function(t){const{anchorNode:e,focusNode:n,anchorOffset:r,focusOffset:o}=t;y(),y();const i=e.compareDocumentPosition(n);return!(i&e.DOCUMENT_POSITION_PRECEDING)&&(!!(i&e.DOCUMENT_POSITION_FOLLOWING)||(0!==i||r<=o))}(i),s=i.isCollapsed;s||c.collapse(!a);const l=N(c),d=N(u);if(!l||!d)return!1;const f=function(t){const e=Array.from(t.getClientRects());if(!e.length)return;const n=Math.min(...e.map(({top:t})=>t));return Math.max(...e.map(({bottom:t})=>t))-n}(u);if(!s&&f&&f>l.height&&a===e)return!1;const m=L(t)?!e:e,p=t.getBoundingClientRect(),h=M(r,m?p.left+1:p.right-1,e?p.top+1:p.bottom-1,t);if(!h)return!1;const b=N(h);if(!b)return!1;const g=e?"top":"bottom",C=m?"left":"right",w=b[g]-d[g],E=b[C]-l[C],v=Math.abs(w)<=1,O=Math.abs(E)<=1;return n?v:v&&O}function I(t,e){return j(t,e)}function _(t,e){return j(t,e,!0)}function H(t,e){const{ownerDocument:n}=t,r=L(t)?!e:e,o=t.getBoundingClientRect();return M(n,e?o.right-1:o.left+1,r?o.bottom-1:o.top+1,t)}function V(t,e){if(!t)return;if(t.focus(),P(t)){if("number"!=typeof t.selectionStart)return;return void(e?(t.selectionStart=t.value.length,t.selectionEnd=t.value.length):(t.selectionStart=0,t.selectionEnd=0))}if(!t.isContentEditable)return;let n=H(t,e);if(!(n&&n.startContainer&&t.contains(n.startContainer)||(t.scrollIntoView(e),n=H(t,e),n&&n.startContainer&&t.contains(n.startContainer))))return;const{ownerDocument:r}=t,{defaultView:o}=r;y();const i=o.getSelection();y(),i.removeAllRanges(),i.addRange(n)}function F(t,e,n,r=!0){if(!t)return;if(!n||!t.isContentEditable)return void V(t,e);t.focus();const o=n.height/2,i=t.getBoundingClientRect(),u=n.left,c=e?i.bottom-o:i.top+o,{ownerDocument:a}=t,{defaultView:s}=a,l=M(a,u,c,t);if(!l||!t.contains(l.startContainer))return!r||l&&l.startContainer&&l.startContainer.contains(t)?void V(t,e):(t.scrollIntoView(e),void F(t,e,n,!1));y();const d=s.getSelection();y(),d.removeAllRanges(),d.addRange(l)}function B(t,e){y(e.parentNode),e.parentNode.insertBefore(t,e.nextSibling)}function U(t){y(t.parentNode),t.parentNode.removeChild(t)}function z(t,e){y(t.parentNode),B(e,t.parentNode),U(t)}function k(t){const e=t.parentNode;for(y();t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}function q(t,e){const n=t.ownerDocument.createElement(e);for(;t.firstChild;)n.appendChild(t.firstChild);return y(t.parentNode),t.parentNode.replaceChild(n,t),n}function X(t,e){y(e.parentNode),e.parentNode.insertBefore(t,e),t.appendChild(e)}function Y(t){return(new window.DOMParser).parseFromString(t,"text/html").body.textContent||""}function G(t){switch(t.nodeType){case t.TEXT_NODE:return/^[ \f\n\r\t\v\u00a0]*$/.test(t.nodeValue||"");case t.ELEMENT_NODE:return!t.hasAttributes()&&(!t.hasChildNodes()||Array.from(t.childNodes).every(G));default:return!0}}const W={strong:{},em:{},s:{},del:{},ins:{},a:{attributes:["href","target","rel"]},code:{},abbr:{attributes:["title"]},sub:{},sup:{},br:{},small:{},q:{attributes:["cite"]},dfn:{attributes:["title"]},data:{attributes:["value"]},time:{attributes:["datetime"]},var:{},samp:{},kbd:{},i:{},b:{},u:{},mark:{},ruby:{},rt:{},rp:{},bdi:{attributes:["dir"]},bdo:{attributes:["dir"]},wbr:{},"#text":{}};Object(a.without)(Object.keys(W),"#text","br").forEach(t=>{W[t].children=Object(a.omit)(W,t)});const $={...W,audio:{attributes:["src","preload","autoplay","mediagroup","loop","muted"]},canvas:{attributes:["width","height"]},embed:{attributes:["src","type","width","height"]},img:{attributes:["alt","src","srcset","usemap","ismap","width","height"]},object:{attributes:["data","type","name","usemap","form","width","height"]},video:{attributes:["src","poster","preload","autoplay","mediagroup","loop","muted","controls","width","height"]}};function J(t){return"paste"!==t?$:Object(a.omit)({...$,ins:{children:$.ins.children},del:{children:$.del.children}},["u","abbr","data","time","wbr","bdi","bdo"])}function K(t){const e=t.nodeName.toLowerCase();return J().hasOwnProperty(e)||"span"===e}function Q(t){const e=t.nodeName.toLowerCase();return W.hasOwnProperty(e)||"span"===e}function Z(t,e,n){const r=document.implementation.createHTMLDocument("");return r.body.innerHTML=t,function t(e,n,r,o){Array.from(e).forEach(e=>{var i,u;const c=e.nodeName.toLowerCase();if(r.hasOwnProperty(c)&&(!r[c].isMatch||null!==(i=(u=r[c]).isMatch)&&void 0!==i&&i.call(u,e))){if(function(t){return!!t&&t.nodeType===t.ELEMENT_NODE}(e)){const{attributes:i=[],classes:u=[],children:s,require:l=[],allowEmpty:d}=r[c];if(s&&!d&&G(e))return void U(e);if(e.hasAttributes()&&(Array.from(e.attributes).forEach(({name:t})=>{"class"===t||Object(a.includes)(i,t)||e.removeAttribute(t)}),e.classList&&e.classList.length)){const t=u.map(t=>"string"==typeof t?e=>e===t:t instanceof RegExp?e=>t.test(e):a.noop);Array.from(e.classList).forEach(n=>{t.some(t=>t(n))||e.classList.remove(n)}),e.classList.length||e.removeAttribute("class")}if(e.hasChildNodes()){if("*"===s)return;if(s)l.length&&!e.querySelector(l.join(","))?(t(e.childNodes,n,r,o),k(e)):e.parentNode&&"BODY"===e.parentNode.nodeName&&K(e)?(t(e.childNodes,n,r,o),Array.from(e.childNodes).some(t=>!K(t))&&k(e)):t(e.childNodes,n,s,o);else for(;e.firstChild;)U(e.firstChild)}}}else t(e.childNodes,n,r,o),o&&!K(e)&&e.nextElementSibling&&B(n.createElement("br"),e),k(e)})}(r.body.childNodes,r,e,n),r.body.innerHTML}function tt(t){const e=Array.from(t.files);return Array.from(t.items).forEach(t=>{const n=t.getAsFile();n&&!e.find(({name:t,type:e,size:r})=>t===n.name&&e===n.type&&r===n.size)&&e.push(n)}),e}const et={focusable:r,tabbable:o}},YLtl:function(t,e){t.exports=window.lodash}});