Test/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.min.js
2026-04-09 22:54:00 +07:00

1 line
2.9 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).FloatingUIUtilsDOM={})}(this,(function(t){"use strict";function e(){return"undefined"!=typeof window}function n(t){return i(t)?(t.nodeName||"").toLowerCase():"#document"}function o(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function r(t){var e;return null==(e=(i(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function i(t){return!!e()&&(t instanceof Node||t instanceof o(t).Node)}function l(t){return!!e()&&(t instanceof Element||t instanceof o(t).Element)}function c(t){return!!e()&&(t instanceof HTMLElement||t instanceof o(t).HTMLElement)}function u(t){return!(!e()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof o(t).ShadowRoot)}function s(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=g(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&"inline"!==r&&"contents"!==r}function f(t){try{if(t.matches(":popover-open"))return!0}catch(t){}try{return t.matches(":modal")}catch(t){return!1}}const a=/transform|translate|scale|rotate|perspective|filter/,d=/paint|layout|strict|content/,m=t=>!!t&&"none"!==t;let p;function w(t){const e=l(t)?g(t):t;return m(e.transform)||m(e.translate)||m(e.scale)||m(e.rotate)||m(e.perspective)||!v()&&(m(e.backdropFilter)||m(e.filter))||a.test(e.willChange||"")||d.test(e.contain||"")}function v(){return null==p&&(p="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),p}function y(t){return/^(html|body|#document)$/.test(n(t))}function g(t){return o(t).getComputedStyle(t)}function h(t){if("html"===n(t))return t;const e=t.assignedSlot||t.parentNode||u(t)&&t.host||r(t);return u(e)?e.host:e}function b(t){const e=h(t);return y(e)?t.ownerDocument?t.ownerDocument.body:t.body:c(e)&&s(e)?e:b(e)}function S(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}t.getComputedStyle=g,t.getContainingBlock=function(t){let e=h(t);for(;c(e)&&!y(e);){if(w(e))return e;if(f(e))return null;e=h(e)}return null},t.getDocumentElement=r,t.getFrameElement=S,t.getNearestOverflowAncestor=b,t.getNodeName=n,t.getNodeScroll=function(t){return l(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}},t.getOverflowAncestors=function t(e,n,r){var i;void 0===n&&(n=[]),void 0===r&&(r=!0);const l=b(e),c=l===(null==(i=e.ownerDocument)?void 0:i.body),u=o(l);if(c){const e=S(u);return n.concat(u,u.visualViewport||[],s(l)?l:[],e&&r?t(e):[])}return n.concat(l,t(l,[],r))},t.getParentNode=h,t.getWindow=o,t.isContainingBlock=w,t.isElement=l,t.isHTMLElement=c,t.isLastTraversableNode=y,t.isNode=i,t.isOverflowElement=s,t.isShadowRoot=u,t.isTableElement=function(t){return/^(table|td|th)$/.test(n(t))},t.isTopLayer=f,t.isWebKit=v}));