flyonui
Version:
The easiest, free and open-source Tailwind CSS component library with semantic classes.
16 lines • 23.3 kB
JavaScript
var t={179:(t,e,n)=>{n.d(e,{lP:()=>o});const o={auto:"auto","auto-start":"auto-start","auto-end":"auto-end",top:"top","top-start":"top-start","top-end":"top-end",bottom:"bottom","bottom-start":"bottom-start","bottom-end":"bottom-end",right:"right","right-start":"right-start","right-end":"right-end",left:"left","left-start":"left-start","left-end":"left-end"}},392:(t,e,n)=>{n.d(e,{JD:()=>i,gj:()=>o,yd:()=>l});
/*
* @version: 3.2.2
* @author: Preline Labs Ltd.
* @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
* Copyright 2024 Preline Labs Ltd.
*/
const o=(t,e,n="")=>(window.getComputedStyle(t).getPropertyValue(e)||n).replace(" ",""),i=(t,e,n=null)=>{const o=new CustomEvent(t,{detail:{payload:n},bubbles:!0,cancelable:!0,composed:!1});e.dispatchEvent(o)},l=(t,e)=>{const n=()=>{e(),t.removeEventListener("transitionend",n,!0)},o=window.getComputedStyle(t),i=o.getPropertyValue("transition-duration");"none"!==o.getPropertyValue("transition-property")&&parseFloat(i)>0?t.addEventListener("transitionend",n,!0):e()}},663:(t,e,n)=>{n.d(e,{ll:()=>xt,rD:()=>Et,UU:()=>Tt,cY:()=>bt,BN:()=>Lt});const o=Math.min,i=Math.max,l=Math.round,s=Math.floor,r=t=>({x:t,y:t}),c={left:"right",right:"left",bottom:"top",top:"bottom"},a={start:"end",end:"start"};function u(t,e,n){return i(t,o(e,n))}function h(t,e){return"function"==typeof t?t(e):t}function f(t){return t.split("-")[0]}function d(t){return t.split("-")[1]}function g(t){return"x"===t?"y":"x"}function p(t){return"y"===t?"height":"width"}const m=new Set(["top","bottom"]);function v(t){return m.has(f(t))?"y":"x"}function w(t){return g(v(t))}function y(t){return t.replace(/start|end/g,t=>a[t])}const x=["left","right"],b=["right","left"],L=["top","bottom"],T=["bottom","top"];function E(t,e,n,o){const i=d(t);let l=function(t,e,n){switch(t){case"top":case"bottom":return n?e?b:x:e?x:b;case"left":case"right":return e?L:T;default:return[]}}(f(t),"start"===n,o);return i&&(l=l.map(t=>t+"-"+i),e&&(l=l.concat(l.map(y)))),l}function C(t){return t.replace(/left|right|bottom|top/g,t=>c[t])}function R(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function A(t,e,n){let{reference:o,floating:i}=t;const l=v(e),s=w(e),r=p(s),c=f(e),a="y"===l,u=o.x+o.width/2-i.width/2,h=o.y+o.height/2-i.height/2,g=o[r]/2-i[r]/2;let m;switch(c){case"top":m={x:u,y:o.y-i.height};break;case"bottom":m={x:u,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:h};break;case"left":m={x:o.x-i.width,y:h};break;default:m={x:o.x,y:o.y}}switch(d(e)){case"start":m[s]-=g*(n&&a?-1:1);break;case"end":m[s]+=g*(n&&a?-1:1)}return m}async function S(t,e){var n;void 0===e&&(e={});const{x:o,y:i,platform:l,rects:s,elements:r,strategy:c}=t,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:g=0}=h(e,t),p=function(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}(g),m=r[d?"floating"===f?"reference":"floating":f],v=R(await l.getClippingRect({element:null==(n=await(null==l.isElement?void 0:l.isElement(m)))||n?m:m.contextElement||await(null==l.getDocumentElement?void 0:l.getDocumentElement(r.floating)),boundary:a,rootBoundary:u,strategy:c})),w="floating"===f?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(null==l.getOffsetParent?void 0:l.getOffsetParent(r.floating)),x=await(null==l.isElement?void 0:l.isElement(y))&&await(null==l.getScale?void 0:l.getScale(y))||{x:1,y:1},b=R(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:w,offsetParent:y,strategy:c}):w);return{top:(v.top-b.top+p.top)/x.y,bottom:(b.bottom-v.bottom+p.bottom)/x.y,left:(v.left-b.left+p.left)/x.x,right:(b.right-v.right+p.right)/x.x}}const k=new Set(["left","top"]);function F(){return"undefined"!=typeof window}function P(t){return O(t)?(t.nodeName||"").toLowerCase():"#document"}function D(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function M(t){var e;return null==(e=(O(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function O(t){return!!F()&&(t instanceof Node||t instanceof D(t).Node)}function U(t){return!!F()&&(t instanceof Element||t instanceof D(t).Element)}function H(t){return!!F()&&(t instanceof HTMLElement||t instanceof D(t).HTMLElement)}function I(t){return!(!F()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof D(t).ShadowRoot)}const $=new Set(["inline","contents"]);function B(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=K(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!$.has(i)}const j=new Set(["table","td","th"]);function V(t){return j.has(P(t))}const W=[":popover-open",":modal"];function N(t){return W.some(e=>{try{return t.matches(e)}catch(t){return!1}})}const q=["transform","translate","scale","rotate","perspective"],z=["transform","translate","scale","rotate","perspective","filter"],_=["paint","layout","strict","content"];function Y(t){const e=J(),n=U(t)?K(t):t;return q.some(t=>!!n[t]&&"none"!==n[t])||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||z.some(t=>(n.willChange||"").includes(t))||_.some(t=>(n.contain||"").includes(t))}function J(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const X=new Set(["html","body","#document"]);function G(t){return X.has(P(t))}function K(t){return D(t).getComputedStyle(t)}function Q(t){return U(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Z(t){if("html"===P(t))return t;const e=t.assignedSlot||t.parentNode||I(t)&&t.host||M(t);return I(e)?e.host:e}function tt(t){const e=Z(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:H(e)&&B(e)?e:tt(e)}function et(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=tt(t),l=i===(null==(o=t.ownerDocument)?void 0:o.body),s=D(i);if(l){const t=nt(s);return e.concat(s,s.visualViewport||[],B(i)?i:[],t&&n?et(t):[])}return e.concat(i,et(i,[],n))}function nt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ot(t){const e=K(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=H(t),s=i?t.offsetWidth:n,r=i?t.offsetHeight:o,c=l(n)!==s||l(o)!==r;return c&&(n=s,o=r),{width:n,height:o,$:c}}function it(t){return U(t)?t:t.contextElement}function lt(t){const e=it(t);if(!H(e))return r(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:s}=ot(e);let c=(s?l(n.width):n.width)/o,a=(s?l(n.height):n.height)/i;return c&&Number.isFinite(c)||(c=1),a&&Number.isFinite(a)||(a=1),{x:c,y:a}}const st=r(0);function rt(t){const e=D(t);return J()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:st}function ct(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const i=t.getBoundingClientRect(),l=it(t);let s=r(1);e&&(o?U(o)&&(s=lt(o)):s=lt(t));const c=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==D(t))&&e}(l,n,o)?rt(l):r(0);let a=(i.left+c.x)/s.x,u=(i.top+c.y)/s.y,h=i.width/s.x,f=i.height/s.y;if(l){const t=D(l),e=o&&U(o)?D(o):o;let n=t,i=nt(n);for(;i&&o&&e!==n;){const t=lt(i),e=i.getBoundingClientRect(),o=K(i),l=e.left+(i.clientLeft+parseFloat(o.paddingLeft))*t.x,s=e.top+(i.clientTop+parseFloat(o.paddingTop))*t.y;a*=t.x,u*=t.y,h*=t.x,f*=t.y,a+=l,u+=s,n=D(i),i=nt(n)}}return R({width:h,height:f,x:a,y:u})}function at(t,e){const n=Q(t).scrollLeft;return e?e.left+n:ct(M(t)).left+n}function ut(t,e,n){void 0===n&&(n=!1);const o=t.getBoundingClientRect();return{x:o.left+e.scrollLeft-(n?0:at(t,o)),y:o.top+e.scrollTop}}const ht=new Set(["absolute","fixed"]);function ft(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=D(t),o=M(t),i=n.visualViewport;let l=o.clientWidth,s=o.clientHeight,r=0,c=0;if(i){l=i.width,s=i.height;const t=J();(!t||t&&"fixed"===e)&&(r=i.offsetLeft,c=i.offsetTop)}return{width:l,height:s,x:r,y:c}}(t,n);else if("document"===e)o=function(t){const e=M(t),n=Q(t),o=t.ownerDocument.body,l=i(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),s=i(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+at(t);const c=-n.scrollTop;return"rtl"===K(o).direction&&(r+=i(e.clientWidth,o.clientWidth)-l),{width:l,height:s,x:r,y:c}}(M(t));else if(U(e))o=function(t,e){const n=ct(t,!0,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,l=H(t)?lt(t):r(1);return{width:t.clientWidth*l.x,height:t.clientHeight*l.y,x:i*l.x,y:o*l.y}}(e,n);else{const n=rt(t);o={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return R(o)}function dt(t,e){const n=Z(t);return!(n===e||!U(n)||G(n))&&("fixed"===K(n).position||dt(n,e))}function gt(t,e,n){const o=H(e),i=M(e),l="fixed"===n,s=ct(t,!0,l,e);let c={scrollLeft:0,scrollTop:0};const a=r(0);function u(){a.x=at(i)}if(o||!o&&!l)if(("body"!==P(e)||B(i))&&(c=Q(e)),o){const t=ct(e,!0,l,e);a.x=t.x+e.clientLeft,a.y=t.y+e.clientTop}else i&&u();l&&!o&&i&&u();const h=!i||o||l?r(0):ut(i,c);return{x:s.left+c.scrollLeft-a.x-h.x,y:s.top+c.scrollTop-a.y-h.y,width:s.width,height:s.height}}function pt(t){return"static"===K(t).position}function mt(t,e){if(!H(t)||"fixed"===K(t).position)return null;if(e)return e(t);let n=t.offsetParent;return M(t)===n&&(n=n.ownerDocument.body),n}function vt(t,e){const n=D(t);if(N(t))return n;if(!H(t)){let e=Z(t);for(;e&&!G(e);){if(U(e)&&!pt(e))return e;e=Z(e)}return n}let o=mt(t,e);for(;o&&V(o)&&pt(o);)o=mt(o,e);return o&&G(o)&&pt(o)&&!Y(o)?n:o||function(t){let e=Z(t);for(;H(e)&&!G(e);){if(Y(e))return e;if(N(e))return null;e=Z(e)}return null}(t)||n}const wt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const l="fixed"===i,s=M(o),c=!!e&&N(e.floating);if(o===s||c&&l)return n;let a={scrollLeft:0,scrollTop:0},u=r(1);const h=r(0),f=H(o);if((f||!f&&!l)&&(("body"!==P(o)||B(s))&&(a=Q(o)),H(o))){const t=ct(o);u=lt(o),h.x=t.x+o.clientLeft,h.y=t.y+o.clientTop}const d=!s||f||l?r(0):ut(s,a,!0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+h.x+d.x,y:n.y*u.y-a.scrollTop*u.y+h.y+d.y}},getDocumentElement:M,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:l,strategy:s}=t;const r=[..."clippingAncestors"===n?N(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=et(t,[],!1).filter(t=>U(t)&&"body"!==P(t)),i=null;const l="fixed"===K(t).position;let s=l?Z(t):t;for(;U(s)&&!G(s);){const e=K(s),n=Y(s);n||"fixed"!==e.position||(i=null),(l?!n&&!i:!n&&"static"===e.position&&i&&ht.has(i.position)||B(s)&&!n&&dt(t,s))?o=o.filter(t=>t!==s):i=e,s=Z(s)}return e.set(t,o),o}(e,this._c):[].concat(n),l],c=r[0],a=r.reduce((t,n)=>{const l=ft(e,n,s);return t.top=i(l.top,t.top),t.right=o(l.right,t.right),t.bottom=o(l.bottom,t.bottom),t.left=i(l.left,t.left),t},ft(e,c,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:vt,getElementRects:async function(t){const e=this.getOffsetParent||vt,n=this.getDimensions,o=await n(t.floating);return{reference:gt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=ot(t);return{width:e,height:n}},getScale:lt,isElement:U,isRTL:function(t){return"rtl"===K(t).direction}};function yt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function xt(t,e,n,l){void 0===l&&(l={});const{ancestorScroll:r=!0,ancestorResize:c=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:u="function"==typeof IntersectionObserver,animationFrame:h=!1}=l,f=it(t),d=r||c?[...f?et(f):[],...et(e)]:[];d.forEach(t=>{r&&t.addEventListener("scroll",n,{passive:!0}),c&&t.addEventListener("resize",n)});const g=f&&u?function(t,e){let n,l=null;const r=M(t);function c(){var t;clearTimeout(n),null==(t=l)||t.disconnect(),l=null}return function a(u,h){void 0===u&&(u=!1),void 0===h&&(h=1),c();const f=t.getBoundingClientRect(),{left:d,top:g,width:p,height:m}=f;if(u||e(),!p||!m)return;const v={rootMargin:-s(g)+"px "+-s(r.clientWidth-(d+p))+"px "+-s(r.clientHeight-(g+m))+"px "+-s(d)+"px",threshold:i(0,o(1,h))||1};let w=!0;function y(e){const o=e[0].intersectionRatio;if(o!==h){if(!w)return a();o?a(!1,o):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==o||yt(f,t.getBoundingClientRect())||a(),w=!1}try{l=new IntersectionObserver(y,{...v,root:r.ownerDocument})}catch(t){l=new IntersectionObserver(y,v)}l.observe(t)}(!0),c}(f,n):null;let p,m=-1,v=null;a&&(v=new ResizeObserver(t=>{let[o]=t;o&&o.target===f&&v&&(v.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var t;null==(t=v)||t.observe(e)})),n()}),f&&!h&&v.observe(f),v.observe(e));let w=h?ct(t):null;return h&&function e(){const o=ct(t);w&&!yt(w,o)&&n();w=o,p=requestAnimationFrame(e)}(),n(),()=>{var t;d.forEach(t=>{r&&t.removeEventListener("scroll",n),c&&t.removeEventListener("resize",n)}),null==g||g(),null==(t=v)||t.disconnect(),v=null,h&&cancelAnimationFrame(p)}}const bt=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:l,placement:s,middlewareData:r}=e,c=await async function(t,e){const{placement:n,platform:o,elements:i}=t,l=await(null==o.isRTL?void 0:o.isRTL(i.floating)),s=f(n),r=d(n),c="y"===v(n),a=k.has(s)?-1:1,u=l&&c?-1:1,g=h(e,t);let{mainAxis:p,crossAxis:m,alignmentAxis:w}="number"==typeof g?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return r&&"number"==typeof w&&(m="end"===r?-1*w:w),c?{x:m*u,y:p*a}:{x:p*a,y:m*u}}(e,t);return s===(null==(n=r.offset)?void 0:n.placement)&&null!=(o=r.arrow)&&o.alignmentOffset?{}:{x:i+c.x,y:l+c.y,data:{...c,placement:s}}}}},Lt=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:l=!0,crossAxis:s=!1,limiter:r={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...c}=h(t,e),a={x:n,y:o},d=await S(e,c),p=v(f(i)),m=g(p);let w=a[m],y=a[p];if(l){const t="y"===m?"bottom":"right";w=u(w+d["y"===m?"top":"left"],w,w-d[t])}if(s){const t="y"===p?"bottom":"right";y=u(y+d["y"===p?"top":"left"],y,y-d[t])}const x=r.fn({...e,[m]:w,[p]:y});return{...x,data:{x:x.x-n,y:x.y-o,enabled:{[m]:l,[p]:s}}}}}},Tt=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:l,rects:s,initialPlacement:r,platform:c,elements:a}=e,{mainAxis:u=!0,crossAxis:g=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:L=!0,...T}=h(t,e);if(null!=(n=l.arrow)&&n.alignmentOffset)return{};const R=f(i),A=v(r),k=f(r)===r,F=await(null==c.isRTL?void 0:c.isRTL(a.floating)),P=m||(k||!L?[C(r)]:function(t){const e=C(t);return[y(t),e,y(e)]}(r)),D="none"!==b;!m&&D&&P.push(...E(r,L,b,F));const M=[r,...P],O=await S(e,T),U=[];let H=(null==(o=l.flip)?void 0:o.overflows)||[];if(u&&U.push(O[R]),g){const t=function(t,e,n){void 0===n&&(n=!1);const o=d(t),i=w(t),l=p(i);let s="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[l]>e.floating[l]&&(s=C(s)),[s,C(s)]}(i,s,F);U.push(O[t[0]],O[t[1]])}if(H=[...H,{placement:i,overflows:U}],!U.every(t=>t<=0)){var I,$;const t=((null==(I=l.flip)?void 0:I.index)||0)+1,e=M[t];if(e){if(!("alignment"===g&&A!==v(e))||H.every(t=>v(t.placement)!==A||t.overflows[0]>0))return{data:{index:t,overflows:H},reset:{placement:e}}}let n=null==($=H.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:$.placement;if(!n)switch(x){case"bestFit":{var B;const t=null==(B=H.filter(t=>{if(D){const e=v(t.placement);return e===A||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:B[0];t&&(n=t);break}case"initialPlacement":n=r}if(i!==n)return{reset:{placement:n}}}return{}}}},Et=(t,e,n)=>{const o=new Map,i={platform:wt,...n},l={...i.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:l=[],platform:s}=n,r=l.filter(Boolean),c=await(null==s.isRTL?void 0:s.isRTL(e));let a=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:h}=A(a,o,c),f=o,d={},g=0;for(let n=0;n<r.length;n++){const{name:l,fn:p}=r[n],{x:m,y:v,data:w,reset:y}=await p({x:u,y:h,initialPlacement:o,placement:f,strategy:i,middlewareData:d,rects:a,platform:s,elements:{reference:t,floating:e}});u=null!=m?m:u,h=null!=v?v:h,d={...d,[l]:{...d[l],...w}},y&&g<=50&&(g++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(a=!0===y.rects?await s.getElementRects({reference:t,floating:e,strategy:i}):y.rects),({x:u,y:h}=A(a,f,c))),n=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:d}})(t,e,{...i,platform:l})}},709:(t,e,n)=>{n.d(e,{A:()=>o});class o{constructor(t,e,n){this.el=t,this.options=e,this.events=n,this.el=t,this.options=e,this.events={}}createCollection(t,e){var n;t.push({id:(null===(n=null==e?void 0:e.el)||void 0===n?void 0:n.id)||t.length+1,element:e})}fireEvent(t,e=null){if(this.events.hasOwnProperty(t))return this.events[t](e)}on(t,e){this.events[t]=e}}}},e={};function n(o){var i=e[o];if(void 0!==i)return i.exports;var l=e[o]={exports:{}};return t[o](l,l.exports,n),l.exports}n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o={};n.d(o,{A:()=>a});var i=n(663),l=n(392),s=n(709),r=n(179);
/*
* HSTooltip
* @version: 3.2.2
* @author: Preline Labs Ltd.
* @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
* Copyright 2024 Preline Labs Ltd.
*/
class c extends s.A{constructor(t,e,n){super(t,e,n),this.cleanupAutoUpdate=null,this.el&&(this.toggle=this.el.querySelector(".tooltip-toggle")||this.el,this.content=this.el.querySelector(".tooltip-content"),this.eventMode=(0,l.gj)(this.el,"--trigger")||"hover",this.preventFloatingUI=(0,l.gj)(this.el,"--prevent-popper","false"),this.placement=(0,l.gj)(this.el,"--placement"),this.strategy=(0,l.gj)(this.el,"--strategy"),this.scope=(0,l.gj)(this.el,"--scope")||"parent"),this.el&&this.toggle&&this.content&&this.init()}toggleClick(){this.click()}toggleMouseEnter(){this.enter()}toggleMouseLeave(){this.leave()}toggleHandle(){this.hide(),this.toggle.removeEventListener("click",this.onToggleHandleListener,!0),this.toggle.removeEventListener("blur",this.onToggleHandleListener,!0)}init(){this.createCollection(window.$hsTooltipCollection,this),this.onToggleFocusListener=()=>this.enter(),this.onToggleBlurListener=()=>this.hide(),this.toggle.addEventListener("focus",this.onToggleFocusListener),this.toggle.addEventListener("blur",this.onToggleBlurListener),"click"===this.eventMode?(this.onToggleClickListener=()=>this.toggleClick(),this.toggle.addEventListener("click",this.onToggleClickListener)):"hover"===this.eventMode&&(this.onToggleMouseEnterListener=()=>this.toggleMouseEnter(),this.onToggleMouseLeaveListener=()=>this.toggleMouseLeave(),this.toggle.addEventListener("mouseenter",this.onToggleMouseEnterListener),this.toggle.addEventListener("mouseleave",this.onToggleMouseLeaveListener)),"false"===this.preventFloatingUI&&this.buildFloatingUI()}enter(){this._show()}leave(){this.hide()}click(){this.el.classList.contains("show")?this.hide():(this._show(),this.onToggleHandleListener=()=>{setTimeout(()=>this.toggleHandle())},this.toggle.addEventListener("click",this.onToggleHandleListener,!0),this.toggle.addEventListener("blur",this.onToggleHandleListener,!0))}buildFloatingUI(){var t;"window"===this.scope&&document.body.appendChild(this.content);const e=null!==(t=r.lP[this.placement])&&void 0!==t?t:"top",n=new Set(["top","top-start","top-end","bottom","bottom-start","bottom-end"]).has(e),o="false"===this.preventFloatingUI,l=o&&n,s=o,c=[(0,i.cY)(0),...l?[(0,i.BN)()]:[],...s?[(0,i.UU)()]:[]];(0,i.rD)(this.toggle,this.content,{placement:r.lP[this.placement]||"top",strategy:this.strategy||"fixed",middleware:c}).then(({x:t,y:e})=>{Object.assign(this.content.style,{position:this.strategy||"fixed",left:`${t}px`,top:`${e}px`})}),this.cleanupAutoUpdate=(0,i.ll)(this.toggle,this.content,()=>{(0,i.rD)(this.toggle,this.content,{placement:r.lP[this.placement]||"top",strategy:this.strategy||"fixed",middleware:c}).then(({x:t,y:e})=>{Object.assign(this.content.style,{left:`${t}px`,top:`${e}px`})})})}_show(){this.content.classList.remove("hidden"),"window"===this.scope&&this.content.classList.add("show"),"false"!==this.preventFloatingUI||this.cleanupAutoUpdate||this.buildFloatingUI(),setTimeout(()=>{this.el.classList.add("show"),this.fireEvent("show",this.el),(0,l.JD)("show.tooltip",this.el,this.el)})}show(){"click"===this.eventMode?this.click():this.enter(),this.toggle.focus(),this.toggle.style.outline="none"}hide(){this.el.classList.remove("show"),"window"===this.scope&&this.content.classList.remove("show"),"false"===this.preventFloatingUI&&this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),this.fireEvent("hide",this.el),(0,l.JD)("hide.tooltip",this.el,this.el),(0,l.yd)(this.content,()=>{if(this.el.classList.contains("show"))return!1;this.content.classList.add("hidden"),this.toggle.style.outline=""})}destroy(){this.el.classList.remove("show"),this.content.classList.add("hidden"),this.toggle.removeEventListener("focus",this.onToggleFocusListener),this.toggle.removeEventListener("blur",this.onToggleBlurListener),"click"===this.eventMode?this.toggle.removeEventListener("click",this.onToggleClickListener):"hover"===this.eventMode&&(this.toggle.removeEventListener("mouseenter",this.onToggleMouseEnterListener),this.toggle.removeEventListener("mouseleave",this.onToggleMouseLeaveListener)),this.toggle.removeEventListener("click",this.onToggleHandleListener,!0),this.toggle.removeEventListener("blur",this.onToggleHandleListener,!0),this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),window.$hsTooltipCollection=window.$hsTooltipCollection.filter(({element:t})=>t.el!==this.el)}static findInCollection(t){return window.$hsTooltipCollection.find(e=>t instanceof c?e.element.el===t.el:"string"==typeof t?e.element.el===document.querySelector(t):e.element.el===t)||null}static getInstance(t,e=!1){const n=window.$hsTooltipCollection.find(e=>e.element.el===("string"==typeof t?document.querySelector(t):t));return n?e?n:n.element.el:null}static autoInit(){window.$hsTooltipCollection||(window.$hsTooltipCollection=[]),window.$hsTooltipCollection&&(window.$hsTooltipCollection=window.$hsTooltipCollection.filter(({element:t})=>document.contains(t.el))),document.querySelectorAll(".tooltip:not(.--prevent-on-load-init)").forEach(t=>{window.$hsTooltipCollection.find(e=>{var n;return(null===(n=null==e?void 0:e.element)||void 0===n?void 0:n.el)===t})||new c(t)})}static show(t){const e=c.findInCollection(t);e&&e.element.show()}static hide(t){const e=c.findInCollection(t);e&&e.element.hide()}static on(t,e,n){const o=c.findInCollection(e);o&&(o.element.events[t]=n)}}window.addEventListener("load",()=>{c.autoInit()}),"undefined"!=typeof window&&(window.HSTooltip=c);const a=c,u=o.A;export{u as default};