@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
5 lines • 19.2 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import{A as t}from"./common-Cx_AGO_M.js";const n=Math.min;const e=Math.max;const o=Math.round;const i=Math.floor;const r=t=>({x:t,y:t});const c={left:"right",right:"left",bottom:"top",top:"bottom"};function s(t,o,i){return e(t,n(o,i))}function l(t,n){return typeof t==="function"?t(n):t}function f(t){return t.split("-")[0]}function a(t){return t.split("-")[1]}function u(t){return t==="x"?"y":"x"}function d(t){return t==="y"?"height":"width"}function m(t){const n=t[0];return n==="t"||n==="b"?"y":"x"}function p(t){return u(m(t))}function y(t,n,e){if(e===void 0){e=false}const o=a(t);const i=p(t);const r=d(i);let c=i==="x"?o===(e?"end":"start")?"right":"left":o==="start"?"bottom":"top";if(n.reference[r]>n.floating[r]){c=O(c)}return[c,O(c)]}function h(t){const n=O(t);return[x(t),n,x(n)]}function x(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const w=["left","right"];const g=["right","left"];const v=["top","bottom"];const b=["bottom","top"];function A(t,n,e){switch(t){case"top":case"bottom":if(e)return n?g:w;return n?w:g;case"left":case"right":return n?v:b;default:return[]}}function S(t,n,e,o){const i=a(t);let r=A(f(t),e==="start",o);if(i){r=r.map((t=>t+"-"+i));if(n){r=r.concat(r.map(x))}}return r}function O(t){const n=f(t);return c[n]+t.slice(n.length)}function R(t){return{top:0,right:0,bottom:0,left:0,...t}}function k(t){return typeof t!=="number"?R(t):{top:t,right:t,bottom:t,left:t}}function F(t){const{x:n,y:e,width:o,height:i}=t;return{width:o,height:i,top:e,left:n,right:n+o,bottom:e+i,x:n,y:e}}function $(t,n,e){let{reference:o,floating:i}=t;const r=m(n);const c=p(n);const s=d(c);const l=f(n);const u=r==="y";const y=o.x+o.width/2-i.width/2;const h=o.y+o.height/2-i.height/2;const x=o[s]/2-i[s]/2;let w;switch(l){case"top":w={x:y,y:o.y-i.height};break;case"bottom":w={x:y,y:o.y+o.height};break;case"right":w={x:o.x+o.width,y:h};break;case"left":w={x:o.x-i.width,y:h};break;default:w={x:o.x,y:o.y}}switch(a(n)){case"start":w[c]-=x*(e&&u?-1:1);break;case"end":w[c]+=x*(e&&u?-1:1);break}return w}async function C(t,n){var e;if(n===void 0){n={}}const{x:o,y:i,platform:r,rects:c,elements:s,strategy:f}=t;const{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=false,padding:p=0}=l(n,t);const y=k(p);const h=d==="floating"?"reference":"floating";const x=s[m?h:d];const w=F(await r.getClippingRect({element:((e=await(r.isElement==null?void 0:r.isElement(x)))!=null?e:true)?x:x.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(s.floating)),boundary:a,rootBoundary:u,strategy:f}));const g=d==="floating"?{x:o,y:i,width:c.floating.width,height:c.floating.height}:c.reference;const v=await(r.getOffsetParent==null?void 0:r.getOffsetParent(s.floating));const b=await(r.isElement==null?void 0:r.isElement(v))?await(r.getScale==null?void 0:r.getScale(v))||{x:1,y:1}:{x:1,y:1};const A=F(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:v,strategy:f}):g);return{top:(w.top-A.top+y.top)/b.y,bottom:(A.bottom-w.bottom+y.bottom)/b.y,left:(w.left-A.left+y.left)/b.x,right:(A.right-w.right+y.right)/b.x}}const D=50;const M=async(t,n,e)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:c}=e;const s=c.detectOverflow?c:{...c,detectOverflow:C};const l=await(c.isRTL==null?void 0:c.isRTL(n));let f=await c.getElementRects({reference:t,floating:n,strategy:i});let{x:a,y:u}=$(f,o,l);let d=o;let m=0;const p={};for(let e=0;e<r.length;e++){const y=r[e];if(!y){continue}const{name:h,fn:x}=y;const{x:w,y:g,data:v,reset:b}=await x({x:a,y:u,initialPlacement:o,placement:d,strategy:i,middlewareData:p,rects:f,platform:s,elements:{reference:t,floating:n}});a=w!=null?w:a;u=g!=null?g:u;p[h]={...p[h],...v};if(b&&m<D){m++;if(typeof b==="object"){if(b.placement){d=b.placement}if(b.rects){f=b.rects===true?await c.getElementRects({reference:t,floating:n,strategy:i}):b.rects}({x:a,y:u}=$(f,d,l))}e=-1}}return{x:a,y:u,placement:d,strategy:i,middlewareData:p}};const T=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:i,placement:r,rects:c,platform:f,elements:u,middlewareData:m}=e;const{element:y,padding:h=0}=l(t,e)||{};if(y==null){return{}}const x=k(h);const w={x:o,y:i};const g=p(r);const v=d(g);const b=await f.getDimensions(y);const A=g==="y";const S=A?"top":"left";const O=A?"bottom":"right";const R=A?"clientHeight":"clientWidth";const F=c.reference[v]+c.reference[g]-w[g]-c.floating[v];const $=w[g]-c.reference[g];const C=await(f.getOffsetParent==null?void 0:f.getOffsetParent(y));let D=C?C[R]:0;if(!D||!await(f.isElement==null?void 0:f.isElement(C))){D=u.floating[R]||c.floating[v]}const M=F/2-$/2;const T=D/2-b[v]/2-1;const E=n(x[S],T);const P=n(x[O],T);const j=E;const z=D-b[v]-P;const L=D/2-b[v]/2+M;const B=s(j,L,z);const I=!m.arrow&&a(r)!=null&&L!==B&&c.reference[v]/2-(L<j?E:P)-b[v]/2<0;const N=I?L<j?L-j:L-z:0;return{[g]:w[g]+N,data:{[g]:B,centerOffset:L-B-N,...I&&{alignmentOffset:N}},reset:I}}});const E=function(t){if(t===void 0){t={}}return{name:"flip",options:t,async fn(n){var e,o;const{placement:i,middlewareData:r,rects:c,initialPlacement:s,platform:a,elements:u}=n;const{mainAxis:d=true,crossAxis:p=true,fallbackPlacements:x,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=true,...b}=l(t,n);if((e=r.arrow)!=null&&e.alignmentOffset){return{}}const A=f(i);const R=m(s);const k=f(s)===s;const F=await(a.isRTL==null?void 0:a.isRTL(u.floating));const $=x||(k||!v?[O(s)]:h(s));const C=g!=="none";if(!x&&C){$.push(...S(s,v,g,F))}const D=[s,...$];const M=await a.detectOverflow(n,b);const T=[];let E=((o=r.flip)==null?void 0:o.overflows)||[];if(d){T.push(M[A])}if(p){const t=y(i,c,F);T.push(M[t[0]],M[t[1]])}E=[...E,{placement:i,overflows:T}];if(!T.every((t=>t<=0))){var P,j;const t=(((P=r.flip)==null?void 0:P.index)||0)+1;const n=D[t];if(n){const e=p==="alignment"?R!==m(n):false;if(!e||E.every((t=>m(t.placement)===R?t.overflows[0]>0:true))){return{data:{index:t,overflows:E},reset:{placement:n}}}}let e=(j=E.filter((t=>t.overflows[0]<=0)).sort(((t,n)=>t.overflows[1]-n.overflows[1]))[0])==null?void 0:j.placement;if(!e){switch(w){case"bestFit":{var z;const t=(z=E.filter((t=>{if(C){const n=m(t.placement);return n===R||n==="y"}return true})).map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,n)=>t+n),0)])).sort(((t,n)=>t[1]-n[1]))[0])==null?void 0:z[0];if(t){e=t}break}case"initialPlacement":e=s;break}}if(i!==e){return{reset:{placement:e}}}}return{}}}};const P=new Set(["left","top"]);async function j(t,n){const{placement:e,platform:o,elements:i}=t;const r=await(o.isRTL==null?void 0:o.isRTL(i.floating));const c=f(e);const s=a(e);const u=m(e)==="y";const d=P.has(c)?-1:1;const p=r&&u?-1:1;const y=l(n,t);let{mainAxis:h,crossAxis:x,alignmentAxis:w}=typeof y==="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};if(s&&typeof w==="number"){x=s==="end"?w*-1:w}return u?{x:x*p,y:h*d}:{x:h*d,y:x*p}}const z=function(t){if(t===void 0){t=0}return{name:"offset",options:t,async fn(n){var e,o;const{x:i,y:r,placement:c,middlewareData:s}=n;const l=await j(n,t);if(c===((e=s.offset)==null?void 0:e.placement)&&(o=s.arrow)!=null&&o.alignmentOffset){return{}}return{x:i+l.x,y:r+l.y,data:{...l,placement:c}}}}};const L=function(t){if(t===void 0){t={}}return{name:"shift",options:t,async fn(n){const{x:e,y:o,placement:i,platform:r}=n;const{mainAxis:c=true,crossAxis:a=false,limiter:d={fn:t=>{let{x:n,y:e}=t;return{x:n,y:e}}},...p}=l(t,n);const y={x:e,y:o};const h=await r.detectOverflow(n,p);const x=m(f(i));const w=u(x);let g=y[w];let v=y[x];if(c){const t=w==="y"?"top":"left";const n=w==="y"?"bottom":"right";const e=g+h[t];const o=g-h[n];g=s(e,g,o)}if(a){const t=x==="y"?"top":"left";const n=x==="y"?"bottom":"right";const e=v+h[t];const o=v-h[n];v=s(e,v,o)}const b=d.fn({...n,[w]:g,[x]:v});return{...b,data:{x:b.x-e,y:b.y-o,enabled:{[w]:c,[x]:a}}}}}};function B(){return typeof window!=="undefined"}function I(t){if(q(t)){return(t.nodeName||"").toLowerCase()}return"#document"}function N(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function _(t){var n;return(n=(q(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function q(t){if(!B()){return false}return t instanceof Node||t instanceof N(t).Node}function H(t){if(!B()){return false}return t instanceof Element||t instanceof N(t).Element}function G(t){if(!B()){return false}return t instanceof HTMLElement||t instanceof N(t).HTMLElement}function V(t){if(!B()||typeof ShadowRoot==="undefined"){return false}return t instanceof ShadowRoot||t instanceof N(t).ShadowRoot}function W(t){const{overflow:n,overflowX:e,overflowY:o,display:i}=ot(t);return/auto|scroll|overlay|hidden|clip/.test(n+o+e)&&i!=="inline"&&i!=="contents"}function X(t){return/^(table|td|th)$/.test(I(t))}function Y(t){try{if(t.matches(":popover-open")){return true}}catch(t){}try{return t.matches(":modal")}catch(t){return false}}const J=/transform|translate|scale|rotate|perspective|filter/;const K=/paint|layout|strict|content/;const Q=t=>!!t&&t!=="none";let U;function Z(t){const n=H(t)?ot(t):t;return Q(n.transform)||Q(n.translate)||Q(n.scale)||Q(n.rotate)||Q(n.perspective)||!nt()&&(Q(n.backdropFilter)||Q(n.filter))||J.test(n.willChange||"")||K.test(n.contain||"")}function tt(t){let n=rt(t);while(G(n)&&!et(n)){if(Z(n)){return n}else if(Y(n)){return null}n=rt(n)}return null}function nt(){if(U==null){U=typeof CSS!=="undefined"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}return U}function et(t){return/^(html|body|#document)$/.test(I(t))}function ot(t){return N(t).getComputedStyle(t)}function it(t){if(H(t)){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}return{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function rt(t){if(I(t)==="html"){return t}const n=t.assignedSlot||t.parentNode||V(t)&&t.host||_(t);return V(n)?n.host:n}function ct(t){const n=rt(t);if(et(n)){return t.ownerDocument?t.ownerDocument.body:t.body}if(G(n)&&W(n)){return n}return ct(n)}function st(t,n,e){var o;if(n===void 0){n=[]}if(e===void 0){e=true}const i=ct(t);const r=i===((o=t.ownerDocument)==null?void 0:o.body);const c=N(i);if(r){const t=lt(c);return n.concat(c,c.visualViewport||[],W(i)?i:[],t&&e?st(t):[])}else{return n.concat(i,st(i,[],e))}}function lt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ft(t){const n=ot(t);let e=parseFloat(n.width)||0;let i=parseFloat(n.height)||0;const r=G(t);const c=r?t.offsetWidth:e;const s=r?t.offsetHeight:i;const l=o(e)!==c||o(i)!==s;if(l){e=c;i=s}return{width:e,height:i,$:l}}function at(t){return!H(t)?t.contextElement:t}function ut(t){const n=at(t);if(!G(n)){return r(1)}const e=n.getBoundingClientRect();const{width:i,height:c,$:s}=ft(n);let l=(s?o(e.width):e.width)/i;let f=(s?o(e.height):e.height)/c;if(!l||!Number.isFinite(l)){l=1}if(!f||!Number.isFinite(f)){f=1}return{x:l,y:f}}const dt=r(0);function mt(t){const n=N(t);if(!nt()||!n.visualViewport){return dt}return{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function pt(t,n,e){if(n===void 0){n=false}if(!e||n&&e!==N(t)){return false}return n}function yt(t,n,e,o){if(n===void 0){n=false}if(e===void 0){e=false}const i=t.getBoundingClientRect();const c=at(t);let s=r(1);if(n){if(o){if(H(o)){s=ut(o)}}else{s=ut(t)}}const l=pt(c,e,o)?mt(c):r(0);let f=(i.left+l.x)/s.x;let a=(i.top+l.y)/s.y;let u=i.width/s.x;let d=i.height/s.y;if(c){const t=N(c);const n=o&&H(o)?N(o):o;let e=t;let i=lt(e);while(i&&o&&n!==e){const t=ut(i);const n=i.getBoundingClientRect();const o=ot(i);const r=n.left+(i.clientLeft+parseFloat(o.paddingLeft))*t.x;const c=n.top+(i.clientTop+parseFloat(o.paddingTop))*t.y;f*=t.x;a*=t.y;u*=t.x;d*=t.y;f+=r;a+=c;e=N(i);i=lt(e)}}return F({width:u,height:d,x:f,y:a})}function ht(t,n){const e=it(t).scrollLeft;if(!n){return yt(_(t)).left+e}return n.left+e}function xt(t,n){const e=t.getBoundingClientRect();const o=e.left+n.scrollLeft-ht(t,e);const i=e.top+n.scrollTop;return{x:o,y:i}}function wt(t){let{elements:n,rect:e,offsetParent:o,strategy:i}=t;const c=i==="fixed";const s=_(o);const l=n?Y(n.floating):false;if(o===s||l&&c){return e}let f={scrollLeft:0,scrollTop:0};let a=r(1);const u=r(0);const d=G(o);if(d||!d&&!c){if(I(o)!=="body"||W(s)){f=it(o)}if(d){const t=yt(o);a=ut(o);u.x=t.x+o.clientLeft;u.y=t.y+o.clientTop}}const m=s&&!d&&!c?xt(s,f):r(0);return{width:e.width*a.x,height:e.height*a.y,x:e.x*a.x-f.scrollLeft*a.x+u.x+m.x,y:e.y*a.y-f.scrollTop*a.y+u.y+m.y}}function gt(t){return Array.from(t.getClientRects())}function vt(t){const n=_(t);const o=it(t);const i=t.ownerDocument.body;const r=e(n.scrollWidth,n.clientWidth,i.scrollWidth,i.clientWidth);const c=e(n.scrollHeight,n.clientHeight,i.scrollHeight,i.clientHeight);let s=-o.scrollLeft+ht(t);const l=-o.scrollTop;if(ot(i).direction==="rtl"){s+=e(n.clientWidth,i.clientWidth)-r}return{width:r,height:c,x:s,y:l}}const bt=25;function At(t,n){const e=N(t);const o=_(t);const i=e.visualViewport;let r=o.clientWidth;let c=o.clientHeight;let s=0;let l=0;if(i){r=i.width;c=i.height;const t=nt();if(!t||t&&n==="fixed"){s=i.offsetLeft;l=i.offsetTop}}const f=ht(o);if(f<=0){const t=o.ownerDocument;const n=t.body;const e=getComputedStyle(n);const i=t.compatMode==="CSS1Compat"?parseFloat(e.marginLeft)+parseFloat(e.marginRight)||0:0;const c=Math.abs(o.clientWidth-n.clientWidth-i);if(c<=bt){r-=c}}else if(f<=bt){r+=f}return{width:r,height:c,x:s,y:l}}function St(t,n){const e=yt(t,true,n==="fixed");const o=e.top+t.clientTop;const i=e.left+t.clientLeft;const c=G(t)?ut(t):r(1);const s=t.clientWidth*c.x;const l=t.clientHeight*c.y;const f=i*c.x;const a=o*c.y;return{width:s,height:l,x:f,y:a}}function Ot(t,n,e){let o;if(n==="viewport"){o=At(t,e)}else if(n==="document"){o=vt(_(t))}else if(H(n)){o=St(n,e)}else{const e=mt(t);o={x:n.x-e.x,y:n.y-e.y,width:n.width,height:n.height}}return F(o)}function Rt(t,n){const e=rt(t);if(e===n||!H(e)||et(e)){return false}return ot(e).position==="fixed"||Rt(e,n)}function kt(t,n){const e=n.get(t);if(e){return e}let o=st(t,[],false).filter((t=>H(t)&&I(t)!=="body"));let i=null;const r=ot(t).position==="fixed";let c=r?rt(t):t;while(H(c)&&!et(c)){const n=ot(c);const e=Z(c);if(!e&&n.position==="fixed"){i=null}const s=r?!e&&!i:!e&&n.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||W(c)&&!e&&Rt(t,c);if(s){o=o.filter((t=>t!==c))}else{i=n}c=rt(c)}n.set(t,o);return o}function Ft(t){let{element:o,boundary:i,rootBoundary:r,strategy:c}=t;const s=i==="clippingAncestors"?Y(o)?[]:kt(o,this._c):[].concat(i);const l=[...s,r];const f=Ot(o,l[0],c);let a=f.top;let u=f.right;let d=f.bottom;let m=f.left;for(let t=1;t<l.length;t++){const i=Ot(o,l[t],c);a=e(i.top,a);u=n(i.right,u);d=n(i.bottom,d);m=e(i.left,m)}return{width:u-m,height:d-a,x:m,y:a}}function $t(t){const{width:n,height:e}=ft(t);return{width:n,height:e}}function Ct(t,n,e){const o=G(n);const i=_(n);const c=e==="fixed";const s=yt(t,true,c,n);let l={scrollLeft:0,scrollTop:0};const f=r(0);function a(){f.x=ht(i)}if(o||!o&&!c){if(I(n)!=="body"||W(i)){l=it(n)}if(o){const t=yt(n,true,c,n);f.x=t.x+n.clientLeft;f.y=t.y+n.clientTop}else if(i){a()}}if(c&&!o&&i){a()}const u=i&&!o&&!c?xt(i,l):r(0);const d=s.left+l.scrollLeft-f.x-u.x;const m=s.top+l.scrollTop-f.y-u.y;return{x:d,y:m,width:s.width,height:s.height}}function Dt(t){return ot(t).position==="static"}function Mt(t,n){if(!G(t)||ot(t).position==="fixed"){return null}if(n){return n(t)}let e=t.offsetParent;if(_(t)===e){e=e.ownerDocument.body}return e}function Tt(t,n){const e=N(t);if(Y(t)){return e}if(!G(t)){let n=rt(t);while(n&&!et(n)){if(H(n)&&!Dt(n)){return n}n=rt(n)}return e}let o=Mt(t,n);while(o&&X(o)&&Dt(o)){o=Mt(o,n)}if(o&&et(o)&&Dt(o)&&!Z(o)){return e}return o||tt(t)||e}const Et=async function(t){const n=this.getOffsetParent||Tt;const e=this.getDimensions;const o=await e(t.floating);return{reference:Ct(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Pt(t){return ot(t).direction==="rtl"}const jt={convertOffsetParentRelativeRectToViewportRelativeRect:wt,getDocumentElement:_,getClippingRect:Ft,getOffsetParent:Tt,getElementRects:Et,getClientRects:gt,getDimensions:$t,getScale:ut,isElement:H,isRTL:Pt};function zt(t,n){return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}function Lt(t,o){let r=null;let c;const s=_(t);function l(){var t;clearTimeout(c);(t=r)==null||t.disconnect();r=null}function f(a,u){if(a===void 0){a=false}if(u===void 0){u=1}l();const d=t.getBoundingClientRect();const{left:m,top:p,width:y,height:h}=d;if(!a){o()}if(!y||!h){return}const x=i(p);const w=i(s.clientWidth-(m+y));const g=i(s.clientHeight-(p+h));const v=i(m);const b=-x+"px "+-w+"px "+-g+"px "+-v+"px";const A={rootMargin:b,threshold:e(0,n(1,u))||1};let S=true;function O(n){const e=n[0].intersectionRatio;if(e!==u){if(!S){return f()}if(!e){c=setTimeout((()=>{f(false,1e-7)}),1e3)}else{f(false,e)}}if(e===1&&!zt(d,t.getBoundingClientRect())){f()}S=false}try{r=new IntersectionObserver(O,{...A,root:s.ownerDocument})}catch(t){r=new IntersectionObserver(O,A)}r.observe(t)}f(true);return l}function Bt(t,n,e,o){if(o===void 0){o={}}const{ancestorScroll:i=true,ancestorResize:r=true,elementResize:c=typeof ResizeObserver==="function",layoutShift:s=typeof IntersectionObserver==="function",animationFrame:l=false}=o;const f=at(t);const a=i||r?[...f?st(f):[],...n?st(n):[]]:[];a.forEach((t=>{i&&t.addEventListener("scroll",e,{passive:true});r&&t.addEventListener("resize",e)}));const u=f&&s?Lt(f,e):null;let d=-1;let m=null;if(c){m=new ResizeObserver((t=>{let[o]=t;if(o&&o.target===f&&m&&n){m.unobserve(n);cancelAnimationFrame(d);d=requestAnimationFrame((()=>{var t;(t=m)==null||t.observe(n)}))}e()}));if(f&&!l){m.observe(f)}if(n){m.observe(n)}}let p;let y=l?yt(t):null;if(l){h()}function h(){const n=yt(t);if(y&&!zt(y,n)){e()}y=n;p=requestAnimationFrame(h)}e();return()=>{var t;a.forEach((t=>{i&&t.removeEventListener("scroll",e);r&&t.removeEventListener("resize",e)}));u==null||u();(t=m)==null||t.disconnect();m=null;if(l){cancelAnimationFrame(p)}}}const It=z;const Nt=L;const _t=E;const qt=T;const Ht=(t,n,e)=>{const o=new Map;const i={platform:jt,...e};const r={...i.platform,_c:o};return M(t,n,{...i,platform:r})};const Gt=async({floatingElement:n,referenceElement:e,arrowElement:o,align:i="top"})=>{var r,c,s;if(!t()){const t=[It((r=o===null||o===void 0?void 0:o.offsetHeight)!==null&&r!==void 0?r:10),_t(),Nt()];if(o){t.push(qt({element:o}))}const{x:l,y:f,middlewareData:a,placement:u}=await Ht(e,n,{placement:i,middleware:t,strategy:"fixed"});Object.assign(n.style,{left:`${l}px`,top:`${f}px`,visibility:"visible"});if(o){if((c=a.arrow)===null||c===void 0?void 0:c.x){Object.assign(o.style,{left:`${a.arrow.x}px`,top:u==="bottom"?`${-o.offsetHeight/2}px`:"",bottom:u==="top"?`${-o.offsetHeight/2}px`:""})}else if((s=a.arrow)===null||s===void 0?void 0:s.y){Object.assign(o.style,{left:u==="right"?`${-o.offsetWidth/2}px`:"",right:u==="left"?`${-o.offsetWidth/2}px`:"",top:`${a.arrow.y}px`})}}}};export{Gt as a,Bt as b};
//# sourceMappingURL=align-floating-elements-D5XJiLiU.js.map