UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

4 lines 22.4 kB
/*! * KoliBri - The accessible HTML-Standard */ import{E as processEnv}from"./common-7RW_NFNf.js";const min=Math.min,max=Math.max,round=Math.round,floor=Math.floor,createCoords=e=>({x:e,y:e}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"},oppositeAlignmentMap={start:"end",end:"start"};function clamp(e,t,n){return max(e,min(t,n))}function evaluate(e,t){return"function"==typeof e?e(t):e}function getSide(e){return e.split("-")[0]}function getAlignment(e){return e.split("-")[1]}function getOppositeAxis(e){return"x"===e?"y":"x"}function getAxisLength(e){return"y"===e?"height":"width"}const yAxisSides=new Set(["top","bottom"]);function getSideAxis(e){return yAxisSides.has(getSide(e))?"y":"x"}function getAlignmentAxis(e){return getOppositeAxis(getSideAxis(e))}function getAlignmentSides(e,t,n){void 0===n&&(n=!1);const o=getAlignment(e),i=getAlignmentAxis(e),r=getAxisLength(i);let l="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[r]>t.floating[r]&&(l=getOppositePlacement(l)),[l,getOppositePlacement(l)]}function getExpandedPlacements(e){const t=getOppositePlacement(e);return[getOppositeAlignmentPlacement(e),t,getOppositeAlignmentPlacement(t)]}function getOppositeAlignmentPlacement(e){return e.replace(/start|end/g,(e=>oppositeAlignmentMap[e]))}const lrPlacement=["left","right"],rlPlacement=["right","left"],tbPlacement=["top","bottom"],btPlacement=["bottom","top"];function getSideList(e,t,n){switch(e){case"top":case"bottom":return n?t?rlPlacement:lrPlacement:t?lrPlacement:rlPlacement;case"left":case"right":return t?tbPlacement:btPlacement;default:return[]}}function getOppositeAxisPlacements(e,t,n,o){const i=getAlignment(e);let r=getSideList(getSide(e),"start"===n,o);return i&&(r=r.map((e=>e+"-"+i)),t&&(r=r.concat(r.map(getOppositeAlignmentPlacement)))),r}function getOppositePlacement(e){return e.replace(/left|right|bottom|top/g,(e=>oppositeSideMap[e]))}function expandPaddingObject(e){return{top:0,right:0,bottom:0,left:0,...e}}function getPaddingObject(e){return"number"!=typeof e?expandPaddingObject(e):{top:e,right:e,bottom:e,left:e}}function rectToClientRect(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function computeCoordsFromPlacement(e,t,n){let{reference:o,floating:i}=e;const r=getSideAxis(t),l=getAlignmentAxis(t),s=getAxisLength(l),a=getSide(t),c="y"===r,f=o.x+o.width/2-i.width/2,g=o.y+o.height/2-i.height/2,u=o[s]/2-i[s]/2;let d;switch(a){case"top":d={x:f,y:o.y-i.height};break;case"bottom":d={x:f,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:g};break;case"left":d={x:o.x-i.width,y:g};break;default:d={x:o.x,y:o.y}}switch(getAlignment(t)){case"start":d[l]-=u*(n&&c?-1:1);break;case"end":d[l]+=u*(n&&c?-1:1)}return d}const computePosition$1=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,s=r.filter(Boolean),a=await(null==l.isRTL?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:g}=computeCoordsFromPlacement(c,o,a),u=o,d={},m=0;for(let n=0;n<s.length;n++){const{name:r,fn:p}=s[n],{x:h,y:w,data:y,reset:x}=await p({x:f,y:g,initialPlacement:o,placement:u,strategy:i,middlewareData:d,rects:c,platform:l,elements:{reference:e,floating:t}});f=null!=h?h:f,g=null!=w?w:g,d={...d,[r]:{...d[r],...y}},x&&m<=50&&(m++,"object"==typeof x&&(x.placement&&(u=x.placement),x.rects&&(c=!0===x.rects?await l.getElementRects({reference:e,floating:t,strategy:i}):x.rects),({x:f,y:g}=computeCoordsFromPlacement(c,u,a))),n=-1)}return{x:f,y:g,placement:u,strategy:i,middlewareData:d}};async function detectOverflow(e,t){var n;void 0===t&&(t={});const{x:o,y:i,platform:r,rects:l,elements:s,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:g="floating",altBoundary:u=!1,padding:d=0}=evaluate(t,e),m=getPaddingObject(d),p=s[u?"floating"===g?"reference":"floating":g],h=rectToClientRect(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(p)))||n?p:p.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:a})),w="floating"===g?{x:o,y:i,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),x=await(null==r.isElement?void 0:r.isElement(y))&&await(null==r.getScale?void 0:r.getScale(y))||{x:1,y:1},v=rectToClientRect(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:y,strategy:a}):w);return{top:(h.top-v.top+m.top)/x.y,bottom:(v.bottom-h.bottom+m.bottom)/x.y,left:(h.left-v.left+m.left)/x.x,right:(v.right-h.right+m.right)/x.x}}const arrow$1=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:r,platform:l,elements:s,middlewareData:a}=t,{element:c,padding:f=0}=evaluate(e,t)||{};if(null==c)return{};const g=getPaddingObject(f),u={x:n,y:o},d=getAlignmentAxis(i),m=getAxisLength(d),p=await l.getDimensions(c),h="y"===d,w=h?"top":"left",y=h?"bottom":"right",x=h?"clientHeight":"clientWidth",v=r.reference[m]+r.reference[d]-u[d]-r.floating[m],b=u[d]-r.reference[d],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(c));let A=E?E[x]:0;A&&await(null==l.isElement?void 0:l.isElement(E))||(A=s.floating[x]||r.floating[m]);const S=v/2-b/2,R=A/2-p[m]/2-1,C=min(g[w],R),O=min(g[y],R),P=C,T=A-p[m]-O,L=A/2-p[m]/2+S,N=clamp(P,L,T),D=!a.arrow&&null!=getAlignment(i)&&L!==N&&r.reference[m]/2-(L<P?C:O)-p[m]/2<0,W=D?L<P?L-P:L-T:0;return{[d]:u[d]+W,data:{[d]:N,centerOffset:L-N-W,...D&&{alignmentOffset:W}},reset:D}}}),flip$1=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:r,rects:l,initialPlacement:s,platform:a,elements:c}=t,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:u,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...h}=evaluate(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const w=getSide(i),y=getSideAxis(s),x=getSide(s)===s,v=await(null==a.isRTL?void 0:a.isRTL(c.floating)),b=u||(x||!p?[getOppositePlacement(s)]:getExpandedPlacements(s)),E="none"!==m;!u&&E&&b.push(...getOppositeAxisPlacements(s,p,m,v));const A=[s,...b],S=await detectOverflow(t,h),R=[];let C=(null==(o=r.flip)?void 0:o.overflows)||[];if(f&&R.push(S[w]),g){const e=getAlignmentSides(i,l,v);R.push(S[e[0]],S[e[1]])}if(C=[...C,{placement:i,overflows:R}],!R.every((e=>e<=0))){var O,P;const e=((null==(O=r.flip)?void 0:O.index)||0)+1,t=A[e];if(t){if(!("alignment"===g&&y!==getSideAxis(t))||C.every((e=>e.overflows[0]>0&&getSideAxis(e.placement)===y)))return{data:{index:e,overflows:C},reset:{placement:t}}}let n=null==(P=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(d){case"bestFit":{var T;const e=null==(T=C.filter((e=>{if(E){const t=getSideAxis(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}},originSides=new Set(["left","top"]);async function convertValueToCoords(e,t){const{placement:n,platform:o,elements:i}=e,r=await(null==o.isRTL?void 0:o.isRTL(i.floating)),l=getSide(n),s=getAlignment(n),a="y"===getSideAxis(n),c=originSides.has(l)?-1:1,f=r&&a?-1:1,g=evaluate(t,e);let{mainAxis:u,crossAxis:d,alignmentAxis:m}="number"==typeof g?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return s&&"number"==typeof m&&(d="end"===s?-1*m:m),a?{x:d*f,y:u*c}:{x:u*c,y:d*f}}const offset$1=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:l,middlewareData:s}=t,a=await convertValueToCoords(t,e);return l===(null==(n=s.offset)?void 0:n.placement)&&null!=(o=s.arrow)&&o.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:l}}}}},shift$1=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...a}=evaluate(e,t),c={x:n,y:o},f=await detectOverflow(t,a),g=getSideAxis(getSide(i)),u=getOppositeAxis(g);let d=c[u],m=c[g];if(r){const e="y"===u?"bottom":"right";d=clamp(d+f["y"===u?"top":"left"],d,d-f[e])}if(l){const e="y"===g?"bottom":"right";m=clamp(m+f["y"===g?"top":"left"],m,m-f[e])}const p=s.fn({...t,[u]:d,[g]:m});return{...p,data:{x:p.x-n,y:p.y-o,enabled:{[u]:r,[g]:l}}}}}};function hasWindow(){return"undefined"!=typeof window}function getNodeName(e){return isNode(e)?(e.nodeName||"").toLowerCase():"#document"}function getWindow(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function getDocumentElement(e){var t;return null==(t=(isNode(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function isNode(e){return!!hasWindow()&&(e instanceof Node||e instanceof getWindow(e).Node)}function isElement(e){return!!hasWindow()&&(e instanceof Element||e instanceof getWindow(e).Element)}function isHTMLElement(e){return!!hasWindow()&&(e instanceof HTMLElement||e instanceof getWindow(e).HTMLElement)}function isShadowRoot(e){return!(!hasWindow()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof getWindow(e).ShadowRoot)}const invalidOverflowDisplayValues=new Set(["inline","contents"]);function isOverflowElement(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=getComputedStyle(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!invalidOverflowDisplayValues.has(i)}const tableElements=new Set(["table","td","th"]);function isTableElement(e){return tableElements.has(getNodeName(e))}const topLayerSelectors=[":popover-open",":modal"];function isTopLayer(e){return topLayerSelectors.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}const transformProperties=["transform","translate","scale","rotate","perspective"],willChangeValues=["transform","translate","scale","rotate","perspective","filter"],containValues=["paint","layout","strict","content"];function isContainingBlock(e){const t=isWebKit(),n=isElement(e)?getComputedStyle(e):e;return transformProperties.some((e=>!!n[e]&&"none"!==n[e]))||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||willChangeValues.some((e=>(n.willChange||"").includes(e)))||containValues.some((e=>(n.contain||"").includes(e)))}function getContainingBlock(e){let t=getParentNode(e);for(;isHTMLElement(t)&&!isLastTraversableNode(t);){if(isContainingBlock(t))return t;if(isTopLayer(t))return null;t=getParentNode(t)}return null}function isWebKit(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const lastTraversableNodeNames=new Set(["html","body","#document"]);function isLastTraversableNode(e){return lastTraversableNodeNames.has(getNodeName(e))}function getComputedStyle(e){return getWindow(e).getComputedStyle(e)}function getNodeScroll(e){return isElement(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function getParentNode(e){if("html"===getNodeName(e))return e;const t=e.assignedSlot||e.parentNode||isShadowRoot(e)&&e.host||getDocumentElement(e);return isShadowRoot(t)?t.host:t}function getNearestOverflowAncestor(e){const t=getParentNode(e);return isLastTraversableNode(t)?e.ownerDocument?e.ownerDocument.body:e.body:isHTMLElement(t)&&isOverflowElement(t)?t:getNearestOverflowAncestor(t)}function getOverflowAncestors(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=getNearestOverflowAncestor(e),r=i===(null==(o=e.ownerDocument)?void 0:o.body),l=getWindow(i);if(r){const e=getFrameElement(l);return t.concat(l,l.visualViewport||[],isOverflowElement(i)?i:[],e&&n?getOverflowAncestors(e):[])}return t.concat(i,getOverflowAncestors(i,[],n))}function getFrameElement(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function getCssDimensions(e){const t=getComputedStyle(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=isHTMLElement(e),r=i?e.offsetWidth:n,l=i?e.offsetHeight:o,s=round(n)!==r||round(o)!==l;return s&&(n=r,o=l),{width:n,height:o,$:s}}function unwrapElement(e){return isElement(e)?e:e.contextElement}function getScale(e){const t=unwrapElement(e);if(!isHTMLElement(t))return createCoords(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=getCssDimensions(t);let l=(r?round(n.width):n.width)/o,s=(r?round(n.height):n.height)/i;return l&&Number.isFinite(l)||(l=1),s&&Number.isFinite(s)||(s=1),{x:l,y:s}}const noOffsets=createCoords(0);function getVisualOffsets(e){const t=getWindow(e);return isWebKit()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:noOffsets}function shouldAddVisualOffsets(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==getWindow(e))&&t}function getBoundingClientRect(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=unwrapElement(e);let l=createCoords(1);t&&(o?isElement(o)&&(l=getScale(o)):l=getScale(e));const s=shouldAddVisualOffsets(r,n,o)?getVisualOffsets(r):createCoords(0);let a=(i.left+s.x)/l.x,c=(i.top+s.y)/l.y,f=i.width/l.x,g=i.height/l.y;if(r){const e=getWindow(r),t=o&&isElement(o)?getWindow(o):o;let n=e,i=getFrameElement(n);for(;i&&o&&t!==n;){const e=getScale(i),t=i.getBoundingClientRect(),o=getComputedStyle(i),r=t.left+(i.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(i.clientTop+parseFloat(o.paddingTop))*e.y;a*=e.x,c*=e.y,f*=e.x,g*=e.y,a+=r,c+=l,n=getWindow(i),i=getFrameElement(n)}}return rectToClientRect({width:f,height:g,x:a,y:c})}function getWindowScrollBarX(e,t){const n=getNodeScroll(e).scrollLeft;return t?t.left+n:getBoundingClientRect(getDocumentElement(e)).left+n}function getHTMLOffset(e,t,n){void 0===n&&(n=!1);const o=e.getBoundingClientRect();return{x:o.left+t.scrollLeft-(n?0:getWindowScrollBarX(e,o)),y:o.top+t.scrollTop}}function convertOffsetParentRelativeRectToViewportRelativeRect(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r="fixed"===i,l=getDocumentElement(o),s=!!t&&isTopLayer(t.floating);if(o===l||s&&r)return n;let a={scrollLeft:0,scrollTop:0},c=createCoords(1);const f=createCoords(0),g=isHTMLElement(o);if((g||!g&&!r)&&(("body"!==getNodeName(o)||isOverflowElement(l))&&(a=getNodeScroll(o)),isHTMLElement(o))){const e=getBoundingClientRect(o);c=getScale(o),f.x=e.x+o.clientLeft,f.y=e.y+o.clientTop}const u=!l||g||r?createCoords(0):getHTMLOffset(l,a,!0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+f.x+u.x,y:n.y*c.y-a.scrollTop*c.y+f.y+u.y}}function getClientRects(e){return Array.from(e.getClientRects())}function getDocumentRect(e){const t=getDocumentElement(e),n=getNodeScroll(e),o=e.ownerDocument.body,i=max(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=max(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+getWindowScrollBarX(e);const s=-n.scrollTop;return"rtl"===getComputedStyle(o).direction&&(l+=max(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:l,y:s}}function getViewportRect(e,t){const n=getWindow(e),o=getDocumentElement(e),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,s=0,a=0;if(i){r=i.width,l=i.height;const e=isWebKit();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,a=i.offsetTop)}return{width:r,height:l,x:s,y:a}}function getInnerBoundingClientRect(e,t){const n=getBoundingClientRect(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=isHTMLElement(e)?getScale(e):createCoords(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:i*r.x,y:o*r.y}}function getClientRectFromClippingAncestor(e,t,n){let o;if("viewport"===t)o=getViewportRect(e,n);else if("document"===t)o=getDocumentRect(getDocumentElement(e));else if(isElement(t))o=getInnerBoundingClientRect(t,n);else{const n=getVisualOffsets(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return rectToClientRect(o)}function hasFixedPositionAncestor(e,t){const n=getParentNode(e);return!(n===t||!isElement(n)||isLastTraversableNode(n))&&("fixed"===getComputedStyle(n).position||hasFixedPositionAncestor(n,t))}function getClippingElementAncestors(e,t){const n=t.get(e);if(n)return n;let o=getOverflowAncestors(e,[],!1).filter((e=>isElement(e)&&"body"!==getNodeName(e))),i=null;const r="fixed"===getComputedStyle(e).position;let l=r?getParentNode(e):e;for(;isElement(l)&&!isLastTraversableNode(l);){const t=getComputedStyle(l),n=isContainingBlock(l);n||"fixed"!==t.position||(i=null);(r?!n&&!i:!n&&"static"===t.position&&!!i&&["absolute","fixed"].includes(i.position)||isOverflowElement(l)&&!n&&hasFixedPositionAncestor(e,l))?o=o.filter((e=>e!==l)):i=t,l=getParentNode(l)}return t.set(e,o),o}function getClippingRect(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const r=[..."clippingAncestors"===n?isTopLayer(t)?[]:getClippingElementAncestors(t,this._c):[].concat(n),o],l=r[0],s=r.reduce(((e,n)=>{const o=getClientRectFromClippingAncestor(t,n,i);return e.top=max(o.top,e.top),e.right=min(o.right,e.right),e.bottom=min(o.bottom,e.bottom),e.left=max(o.left,e.left),e}),getClientRectFromClippingAncestor(t,l,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function getDimensions(e){const{width:t,height:n}=getCssDimensions(e);return{width:t,height:n}}function getRectRelativeToOffsetParent(e,t,n){const o=isHTMLElement(t),i=getDocumentElement(t),r="fixed"===n,l=getBoundingClientRect(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const a=createCoords(0);function c(){a.x=getWindowScrollBarX(i)}if(o||!o&&!r)if(("body"!==getNodeName(t)||isOverflowElement(i))&&(s=getNodeScroll(t)),o){const e=getBoundingClientRect(t,!0,r,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else i&&c();r&&!o&&i&&c();const f=!i||o||r?createCoords(0):getHTMLOffset(i,s);return{x:l.left+s.scrollLeft-a.x-f.x,y:l.top+s.scrollTop-a.y-f.y,width:l.width,height:l.height}}function isStaticPositioned(e){return"static"===getComputedStyle(e).position}function getTrueOffsetParent(e,t){if(!isHTMLElement(e)||"fixed"===getComputedStyle(e).position)return null;if(t)return t(e);let n=e.offsetParent;return getDocumentElement(e)===n&&(n=n.ownerDocument.body),n}function getOffsetParent(e,t){const n=getWindow(e);if(isTopLayer(e))return n;if(!isHTMLElement(e)){let t=getParentNode(e);for(;t&&!isLastTraversableNode(t);){if(isElement(t)&&!isStaticPositioned(t))return t;t=getParentNode(t)}return n}let o=getTrueOffsetParent(e,t);for(;o&&isTableElement(o)&&isStaticPositioned(o);)o=getTrueOffsetParent(o,t);return o&&isLastTraversableNode(o)&&isStaticPositioned(o)&&!isContainingBlock(o)?n:o||getContainingBlock(e)||n}const getElementRects=async function(e){const t=this.getOffsetParent||getOffsetParent,n=this.getDimensions,o=await n(e.floating);return{reference:getRectRelativeToOffsetParent(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function isRTL(e){return"rtl"===getComputedStyle(e).direction}const platform={convertOffsetParentRelativeRectToViewportRelativeRect:convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement:getDocumentElement,getClippingRect:getClippingRect,getOffsetParent:getOffsetParent,getElementRects:getElementRects,getClientRects:getClientRects,getDimensions:getDimensions,getScale:getScale,isElement:isElement,isRTL:isRTL};function rectsAreEqual(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function observeMove(e,t){let n,o=null;const i=getDocumentElement(e);function r(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(s,a){void 0===s&&(s=!1),void 0===a&&(a=1),r();const c=e.getBoundingClientRect(),{left:f,top:g,width:u,height:d}=c;if(s||t(),!u||!d)return;const m={rootMargin:-floor(g)+"px "+-floor(i.clientWidth-(f+u))+"px "+-floor(i.clientHeight-(g+d))+"px "+-floor(f)+"px",threshold:max(0,min(1,a))||1};let p=!0;function h(t){const o=t[0].intersectionRatio;if(o!==a){if(!p)return l();o?l(!1,o):n=setTimeout((()=>{l(!1,1e-7)}),1e3)}1!==o||rectsAreEqual(c,e.getBoundingClientRect())||l(),p=!1}try{o=new IntersectionObserver(h,{...m,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(h,m)}o.observe(e)}(!0),r}function autoUpdate(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:a=!1}=o,c=unwrapElement(e),f=i||r?[...c?getOverflowAncestors(c):[],...getOverflowAncestors(t)]:[];f.forEach((e=>{i&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)}));const g=c&&s?observeMove(c,n):null;let u,d=-1,m=null;l&&(m=new ResizeObserver((e=>{let[o]=e;o&&o.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame((()=>{var e;null==(e=m)||e.observe(t)}))),n()})),c&&!a&&m.observe(c),m.observe(t));let p=a?getBoundingClientRect(e):null;return a&&function t(){const o=getBoundingClientRect(e);p&&!rectsAreEqual(p,o)&&n();p=o,u=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach((e=>{i&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)})),null==g||g(),null==(e=m)||e.disconnect(),m=null,a&&cancelAnimationFrame(u)}}const offset=offset$1,shift=shift$1,flip=flip$1,arrow=arrow$1,computePosition=(e,t,n)=>{const o=new Map,i={platform:platform,...n},r={...i.platform,_c:o};return computePosition$1(e,t,{...i,platform:r})},alignFloatingElements=async({floatingElement:e,referenceElement:t,arrowElement:n,align:o="top"})=>{var i,r,l;if("test"!==processEnv){const s=[offset(null!==(i=null==n?void 0:n.offsetHeight)&&void 0!==i?i:10),flip(),shift()];n&&s.push(arrow({element:n}));const{x:a,y:c,middlewareData:f,placement:g}=await computePosition(t,e,{placement:o,middleware:s,strategy:"fixed"});Object.assign(e.style,{left:`${a}px`,top:`${c}px`,visibility:"visible"}),n&&((null===(r=f.arrow)||void 0===r?void 0:r.x)?Object.assign(n.style,{left:`${f.arrow.x}px`,top:"bottom"===g?-n.offsetHeight/2+"px":"",bottom:"top"===g?-n.offsetHeight/2+"px":""}):(null===(l=f.arrow)||void 0===l?void 0:l.y)&&Object.assign(n.style,{left:"right"===g?-n.offsetWidth/2+"px":"",right:"left"===g?-n.offsetWidth/2+"px":"",top:`${f.arrow.y}px`}))}};export{alignFloatingElements as a,autoUpdate as b};