sv-bootstrap-tooltip
Version:
Bootstrap 5 tooltip component for Svelte 5
3 lines (2 loc) • 21.3 kB
JavaScript
;function e(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0}),require("svelte/internal/disclose-version");var t=e(require("svelte/internal/client")),n="top",r="bottom",o="right",i="left",a="auto",s=[n,r,o,i],f="start",c="end",p="viewport",u="popper",l=s.reduce(function(e,t){return e.concat([t+"-"+f,t+"-"+c])},[]),d=[].concat(s,[a]).reduce(function(e,t){return e.concat([t,t+"-"+f,t+"-"+c])},[]),h=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function m(e){return e?(e.nodeName||"").toLowerCase():null}function v(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function g(e){return e instanceof v(e).Element||e instanceof Element}function y(e){return e instanceof v(e).HTMLElement||e instanceof HTMLElement}function b(e){return"undefined"!=typeof ShadowRoot&&(e instanceof v(e).ShadowRoot||e instanceof ShadowRoot)}var w={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];y(o)&&m(o)&&(Object.assign(o.style,n),Object.keys(r).forEach(function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)}))})},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],o=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]="",e},{});y(r)&&m(r)&&(Object.assign(r.style,i),Object.keys(o).forEach(function(e){r.removeAttribute(e)}))})}},requires:["computeStyles"]};function x(e){return e.split("-")[0]}var O=Math.max,j=Math.min,E=Math.round;function D(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function A(){return!/^((?!chrome|android).)*safari/i.test(D())}function k(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var r=e.getBoundingClientRect(),o=1,i=1;t&&y(e)&&(o=e.offsetWidth>0&&E(r.width)/e.offsetWidth||1,i=e.offsetHeight>0&&E(r.height)/e.offsetHeight||1);var a=(g(e)?v(e):window).visualViewport,s=!A()&&n,f=(r.left+(s&&a?a.offsetLeft:0))/o,c=(r.top+(s&&a?a.offsetTop:0))/i,p=r.width/o,u=r.height/i;return{width:p,height:u,top:c,right:f+p,bottom:c+u,left:f,x:f,y:c}}function L(e){var t=k(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function P(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&b(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function M(e){return v(e).getComputedStyle(e)}function W(e){return["table","td","th"].indexOf(m(e))>=0}function B(e){return((g(e)?e.ownerDocument:e.document)||window.document).documentElement}function H(e){return"html"===m(e)?e:e.assignedSlot||e.parentNode||(b(e)?e.host:null)||B(e)}function T(e){return y(e)&&"fixed"!==M(e).position?e.offsetParent:null}function R(e){for(var t=v(e),n=T(e);n&&W(n)&&"static"===M(n).position;)n=T(n);return n&&("html"===m(n)||"body"===m(n)&&"static"===M(n).position)?t:n||function(e){var t=/firefox/i.test(D());if(/Trident/i.test(D())&&y(e)&&"fixed"===M(e).position)return null;var n=H(e);for(b(n)&&(n=n.host);y(n)&&["html","body"].indexOf(m(n))<0;){var r=M(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}function _(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function q(e,t,n){return O(e,j(t,n))}function S(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function C(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var V={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,a=e.state,f=e.name,c=e.options,p=a.elements.arrow,u=a.modifiersData.popperOffsets,l=x(a.placement),d=_(l),h=[i,o].indexOf(l)>=0?"height":"width";if(p&&u){var m=function(e,t){return S("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:C(e,s))}(c.padding,a),v=L(p),g="y"===d?n:i,y="y"===d?r:o,b=a.rects.reference[h]+a.rects.reference[d]-u[d]-a.rects.popper[h],w=u[d]-a.rects.reference[d],O=R(p),j=O?"y"===d?O.clientHeight||0:O.clientWidth||0:0,E=b/2-w/2,D=m[g],A=j-v[h]-m[y],k=j/2-v[h]/2+E,P=q(D,k,A),M=d;a.modifiersData[f]=((t={})[M]=P,t.centerOffset=P-k,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&P(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function N(e){return e.split("-")[1]}var I={top:"auto",right:"auto",bottom:"auto",left:"auto"};function z(e){var t,a=e.popper,s=e.popperRect,f=e.placement,p=e.variation,u=e.offsets,l=e.position,d=e.gpuAcceleration,h=e.adaptive,m=e.roundOffsets,g=e.isFixed,y=u.x,b=void 0===y?0:y,w=u.y,x=void 0===w?0:w,O="function"==typeof m?m({x:b,y:x}):{x:b,y:x};b=O.x,x=O.y;var j=u.hasOwnProperty("x"),D=u.hasOwnProperty("y"),A=i,k=n,L=window;if(h){var P=R(a),W="clientHeight",H="clientWidth";if(P===v(a)&&"static"!==M(P=B(a)).position&&"absolute"===l&&(W="scrollHeight",H="scrollWidth"),f===n||(f===i||f===o)&&p===c)k=r,x-=(g&&P===L&&L.visualViewport?L.visualViewport.height:P[W])-s.height,x*=d?1:-1;if(f===i||(f===n||f===r)&&p===c)A=o,b-=(g&&P===L&&L.visualViewport?L.visualViewport.width:P[H])-s.width,b*=d?1:-1}var T,_=Object.assign({position:l},h&&I),q=!0===m?function(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:E(n*o)/o||0,y:E(r*o)/o||0}}({x:b,y:x},v(a)):{x:b,y:x};return b=q.x,x=q.y,d?Object.assign({},_,((T={})[k]=D?"0":"",T[A]=j?"0":"",T.transform=(L.devicePixelRatio||1)<=1?"translate("+b+"px, "+x+"px)":"translate3d("+b+"px, "+x+"px, 0)",T)):Object.assign({},_,((t={})[k]=D?x+"px":"",t[A]=j?b+"px":"",t.transform="",t))}var F={passive:!0};var U={left:"right",right:"left",bottom:"top",top:"bottom"};function X(e){return e.replace(/left|right|bottom|top/g,function(e){return U[e]})}var Y={start:"end",end:"start"};function $(e){return e.replace(/start|end/g,function(e){return Y[e]})}function G(e){var t=v(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function J(e){return k(B(e)).left+G(e).scrollLeft}function K(e){var t=M(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function Q(e){return["html","body","#document"].indexOf(m(e))>=0?e.ownerDocument.body:y(e)&&K(e)?e:Q(H(e))}function Z(e,t){var n;void 0===t&&(t=[]);var r=Q(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=v(r),a=o?[i].concat(i.visualViewport||[],K(r)?r:[]):r,s=t.concat(a);return o?s:s.concat(Z(H(a)))}function ee(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function te(e,t,n){return t===p?ee(function(e,t){var n=v(e),r=B(e),o=n.visualViewport,i=r.clientWidth,a=r.clientHeight,s=0,f=0;if(o){i=o.width,a=o.height;var c=A();(c||!c&&"fixed"===t)&&(s=o.offsetLeft,f=o.offsetTop)}return{width:i,height:a,x:s+J(e),y:f}}(e,n)):g(t)?function(e,t){var n=k(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):ee(function(e){var t,n=B(e),r=G(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=O(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=O(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-r.scrollLeft+J(e),f=-r.scrollTop;return"rtl"===M(o||n).direction&&(s+=O(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:f}}(B(e)))}function ne(e,t,n,r){var o="clippingParents"===t?function(e){var t=Z(H(e)),n=["absolute","fixed"].indexOf(M(e).position)>=0&&y(e)?R(e):e;return g(n)?t.filter(function(e){return g(e)&&P(e,n)&&"body"!==m(e)}):[]}(e):[].concat(t),i=[].concat(o,[n]),a=i[0],s=i.reduce(function(t,n){var o=te(e,n,r);return t.top=O(o.top,t.top),t.right=j(o.right,t.right),t.bottom=j(o.bottom,t.bottom),t.left=O(o.left,t.left),t},te(e,a,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function re(e){var t,a=e.reference,s=e.element,p=e.placement,u=p?x(p):null,l=p?N(p):null,d=a.x+a.width/2-s.width/2,h=a.y+a.height/2-s.height/2;switch(u){case n:t={x:d,y:a.y-s.height};break;case r:t={x:d,y:a.y+a.height};break;case o:t={x:a.x+a.width,y:h};break;case i:t={x:a.x-s.width,y:h};break;default:t={x:a.x,y:a.y}}var m=u?_(u):null;if(null!=m){var v="y"===m?"height":"width";switch(l){case f:t[m]=t[m]-(a[v]/2-s[v]/2);break;case c:t[m]=t[m]+(a[v]/2-s[v]/2)}}return t}function oe(e,t){void 0===t&&(t={});var i=t,a=i.placement,f=void 0===a?e.placement:a,c=i.strategy,l=void 0===c?e.strategy:c,d=i.boundary,h=void 0===d?"clippingParents":d,m=i.rootBoundary,v=void 0===m?p:m,y=i.elementContext,b=void 0===y?u:y,w=i.altBoundary,x=void 0!==w&&w,O=i.padding,j=void 0===O?0:O,E=S("number"!=typeof j?j:C(j,s)),D=b===u?"reference":u,A=e.rects.popper,L=e.elements[x?D:b],P=ne(g(L)?L:L.contextElement||B(e.elements.popper),h,v,l),M=k(e.elements.reference),W=re({reference:M,element:A,placement:f}),H=ee(Object.assign({},A,W)),T=b===u?H:M,R={top:P.top-T.top+E.top,bottom:T.bottom-P.bottom+E.bottom,left:P.left-T.left+E.left,right:T.right-P.right+E.right},_=e.modifiersData.offset;if(b===u&&_){var q=_[f];Object.keys(R).forEach(function(e){var t=[o,r].indexOf(e)>=0?1:-1,i=[n,r].indexOf(e)>=0?"y":"x";R[e]+=q[i]*t})}return R}function ie(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,f=n.flipVariations,c=n.allowedAutoPlacements,p=void 0===c?d:c,u=N(r),h=u?f?l:l.filter(function(e){return N(e)===u}):s,m=h.filter(function(e){return p.indexOf(e)>=0});0===m.length&&(m=h);var v=m.reduce(function(t,n){return t[n]=oe(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[x(n)],t},{});return Object.keys(v).sort(function(e,t){return v[e]-v[t]})}var ae={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,s=e.options,c=e.name;if(!t.modifiersData[c]._skip){for(var p=s.mainAxis,u=void 0===p||p,l=s.altAxis,d=void 0===l||l,h=s.fallbackPlacements,m=s.padding,v=s.boundary,g=s.rootBoundary,y=s.altBoundary,b=s.flipVariations,w=void 0===b||b,O=s.allowedAutoPlacements,j=t.options.placement,E=x(j),D=h||(E===j||!w?[X(j)]:function(e){if(x(e)===a)return[];var t=X(e);return[$(e),t,$(t)]}(j)),A=[j].concat(D).reduce(function(e,n){return e.concat(x(n)===a?ie(t,{placement:n,boundary:v,rootBoundary:g,padding:m,flipVariations:w,allowedAutoPlacements:O}):n)},[]),k=t.rects.reference,L=t.rects.popper,P=new Map,M=!0,W=A[0],B=0;B<A.length;B++){var H=A[B],T=x(H),R=N(H)===f,_=[n,r].indexOf(T)>=0,q=_?"width":"height",S=oe(t,{placement:H,boundary:v,rootBoundary:g,altBoundary:y,padding:m}),C=_?R?o:i:R?r:n;k[q]>L[q]&&(C=X(C));var V=X(C),I=[];if(u&&I.push(S[T]<=0),d&&I.push(S[C]<=0,S[V]<=0),I.every(function(e){return e})){W=H,M=!1;break}P.set(H,I)}if(M)for(var z=function(e){var t=A.find(function(t){var n=P.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return W=t,"break"},F=w?3:1;F>0;F--){if("break"===z(F))break}t.placement!==W&&(t.modifiersData[c]._skip=!0,t.placement=W,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function se(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function fe(e){return[n,o,r,i].some(function(t){return e[t]>=0})}var ce={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,a=e.options,s=e.name,c=a.mainAxis,p=void 0===c||c,u=a.altAxis,l=void 0!==u&&u,d=a.boundary,h=a.rootBoundary,m=a.altBoundary,v=a.padding,g=a.tether,y=void 0===g||g,b=a.tetherOffset,w=void 0===b?0:b,E=oe(t,{boundary:d,rootBoundary:h,padding:v,altBoundary:m}),D=x(t.placement),A=N(t.placement),k=!A,P=_(D),M="x"===P?"y":"x",W=t.modifiersData.popperOffsets,B=t.rects.reference,H=t.rects.popper,T="function"==typeof w?w(Object.assign({},t.rects,{placement:t.placement})):w,S="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),C=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,V={x:0,y:0};if(W){if(p){var I,z="y"===P?n:i,F="y"===P?r:o,U="y"===P?"height":"width",X=W[P],Y=X+E[z],$=X-E[F],G=y?-H[U]/2:0,J=A===f?B[U]:H[U],K=A===f?-H[U]:-B[U],Q=t.elements.arrow,Z=y&&Q?L(Q):{width:0,height:0},ee=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},te=ee[z],ne=ee[F],re=q(0,B[U],Z[U]),ie=k?B[U]/2-G-re-te-S.mainAxis:J-re-te-S.mainAxis,ae=k?-B[U]/2+G+re+ne+S.mainAxis:K+re+ne+S.mainAxis,se=t.elements.arrow&&R(t.elements.arrow),fe=se?"y"===P?se.clientTop||0:se.clientLeft||0:0,ce=null!=(I=null==C?void 0:C[P])?I:0,pe=X+ae-ce,ue=q(y?j(Y,X+ie-ce-fe):Y,X,y?O($,pe):$);W[P]=ue,V[P]=ue-X}if(l){var le,de="x"===P?n:i,he="x"===P?r:o,me=W[M],ve="y"===M?"height":"width",ge=me+E[de],ye=me-E[he],be=-1!==[n,i].indexOf(D),we=null!=(le=null==C?void 0:C[M])?le:0,xe=be?ge:me-B[ve]-H[ve]-we+S.altAxis,Oe=be?me+B[ve]+H[ve]-we-S.altAxis:ye,je=y&&be?function(e,t,n){var r=q(e,t,n);return r>n?n:r}(xe,me,Oe):q(y?xe:ge,me,y?Oe:ye);W[M]=je,V[M]=je-me}t.modifiersData[s]=V}},requiresIfExists:["offset"]};function pe(e,t,n){void 0===n&&(n=!1);var r,o,i=y(t),a=y(t)&&function(e){var t=e.getBoundingClientRect(),n=E(t.width)/e.offsetWidth||1,r=E(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(t),s=B(t),f=k(e,a,n),c={scrollLeft:0,scrollTop:0},p={x:0,y:0};return(i||!i&&!n)&&(("body"!==m(t)||K(s))&&(c=(r=t)!==v(r)&&y(r)?{scrollLeft:(o=r).scrollLeft,scrollTop:o.scrollTop}:G(r)),y(t)?((p=k(t,!0)).x+=t.clientLeft,p.y+=t.clientTop):s&&(p.x=J(s))),{x:f.left+c.scrollLeft-p.x,y:f.top+c.scrollTop-p.y,width:f.width,height:f.height}}function ue(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}}),r.push(e)}return e.forEach(function(e){t.set(e.name,e)}),e.forEach(function(e){n.has(e.name)||o(e)}),r}var le={placement:"bottom",modifiers:[],strategy:"absolute"};function de(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&"function"==typeof e.getBoundingClientRect)})}function he(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,r=void 0===n?[]:n,o=t.defaultOptions,i=void 0===o?le:o;return function(e,t,n){void 0===n&&(n=i);var o,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},le,i),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},f=[],c=!1,p={state:s,setOptions:function(n){var o="function"==typeof n?n(s.options):n;u(),s.options=Object.assign({},i,s.options,o),s.scrollParents={reference:g(e)?Z(e):e.contextElement?Z(e.contextElement):[],popper:Z(t)};var a,c,l=function(e){var t=ue(e);return h.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}((a=[].concat(r,s.options.modifiers),c=a.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{}),Object.keys(c).map(function(e){return c[e]})));return s.orderedModifiers=l.filter(function(e){return e.enabled}),s.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=void 0===n?{}:n,o=e.effect;if("function"==typeof o){var i=o({state:s,name:t,instance:p,options:r}),a=function(){};f.push(i||a)}}),p.update()},forceUpdate:function(){if(!c){var e=s.elements,t=e.reference,n=e.popper;if(de(t,n)){s.rects={reference:pe(t,R(n),"fixed"===s.options.strategy),popper:L(n)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach(function(e){return s.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<s.orderedModifiers.length;r++)if(!0!==s.reset){var o=s.orderedModifiers[r],i=o.fn,a=o.options,f=void 0===a?{}:a,u=o.name;"function"==typeof i&&(s=i({state:s,options:f,name:u,instance:p})||s)}else s.reset=!1,r=-1}}},update:(o=function(){return new Promise(function(e){p.forceUpdate(),e(s)})},function(){return a||(a=new Promise(function(e){Promise.resolve().then(function(){a=void 0,e(o())})})),a}),destroy:function(){u(),c=!0}};if(!de(e,t))return p;function u(){f.forEach(function(e){return e()}),f=[]}return p.setOptions(n).then(function(e){!c&&n.onFirstUpdate&&n.onFirstUpdate(e)}),p}}var me=he({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,i=void 0===o||o,a=r.resize,s=void 0===a||a,f=v(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&c.forEach(function(e){e.addEventListener("scroll",n.update,F)}),s&&f.addEventListener("resize",n.update,F),function(){i&&c.forEach(function(e){e.removeEventListener("scroll",n.update,F)}),s&&f.removeEventListener("resize",n.update,F)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=re({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,f=void 0===s||s,c={placement:x(t.placement),variation:N(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,z(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:f})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,z(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},w,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,a=e.name,s=r.offset,f=void 0===s?[0,0]:s,c=d.reduce(function(e,r){return e[r]=function(e,t,r){var a=x(e),s=[i,n].indexOf(a)>=0?-1:1,f="function"==typeof r?r(Object.assign({},t,{placement:e})):r,c=f[0],p=f[1];return c=c||0,p=(p||0)*s,[i,o].indexOf(a)>=0?{x:p,y:c}:{x:c,y:p}}(r,t.rects,f),e},{}),p=c[t.placement],u=p.x,l=p.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=l),t.modifiersData[a]=c}},ae,ce,V,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=oe(t,{elementContext:"reference"}),s=oe(t,{altBoundary:!0}),f=se(a,r),c=se(s,o,i),p=fe(f),u=fe(c);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":u})}}]}),ve=t.from_html('<div role="tooltip"><div class="tooltip-arrow"></div> <div class="tooltip-inner"><!></div></div>');function ge(e,n){t.push(n,!0);let r=t.prop(n,"open",15,!1),o=t.prop(n,"triggerElement",3,null),i=t.prop(n,"flip",3,!0),a=t.prop(n,"placement",3,"top"),s=t.prop(n,"trigger",3,"hover|focus"),f=t.prop(n,"offset",19,()=>[0,4]),c=t.prop(n,"onOpened",3,()=>{}),p=t.prop(n,"onClosed",3,()=>{}),u=t.state(null),l=t.state(null);function d(e,...t){return e.addEventListener(...t),{remove:()=>e.removeEventListener(...t)}}t.user_effect(()=>{if(!r()||!t.get(u))return;const e=me(o(),t.get(u),{placement:a(),modifiers:[{name:"arrow",options:{element:t.get(l)}},{name:"flip",enabled:i()},{name:"offset",options:{offset:f()}},{name:"preventOverflow",options:{altBoundary:!0}}]});return c()(),()=>{e.destroy(),p()()}}),t.user_effect(()=>{if(!o())return;const e=s().split("|"),t=[];return e.includes("hover")&&(t.push(d(o(),"mouseenter",()=>{r(!0)})),t.push(d(o(),"mouseleave",()=>{r(!1)}))),e.includes("focus")&&(t.push(d(o(),"focus",()=>{r(!0)})),t.push(d(o(),"blur",()=>{r(!1)}))),e.includes("click")&&t.push(d(o(),"click",()=>{r(!r())})),()=>t.forEach(e=>e.remove())});var h=t.comment(),m=t.first_child(h),v=e=>{var r=ve(),o=t.child(r);t.bind_this(o,e=>t.set(l,e),()=>t.get(l));var i=t.sibling(o,2),s=t.child(i);t.snippet(s,()=>n.children??t.noop),t.reset(i),t.reset(r),t.bind_this(r,e=>t.set(u,e),()=>t.get(u)),t.template_effect(()=>t.set_class(r,1,`tooltip bs-tooltip-${a()??""} fade show`)),t.append(e,r)};t.if(m,e=>{r()&&e(v)}),t.append(e,h),t.pop()}exports.Tooltip=ge,exports.default=ge;
//# sourceMappingURL=index.cjs.map