sv-bootstrap-tooltip
Version:
Tooltip(Bootstrap) component for Svelte
3 lines (2 loc) • 24.5 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self)["sv-bootstrap-tooltip"]=t()}(this,(function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function r(e){return"function"==typeof e}function i(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function a(e,t,n,o){return e[1]&&o?function(e,t){for(const n in t)e[n]=t[n];return e}(n.ctx.slice(),e[1](o(t))):n.ctx}function s(e,t,n,o,r,i,s){const c=function(e,t,n,o){if(e[2]&&o){const r=e[2](o(n));if(void 0===t.dirty)return r;if("object"==typeof r){const e=[],n=Math.max(t.dirty.length,r.length);for(let o=0;o<n;o+=1)e[o]=t.dirty[o]|r[o];return e}return t.dirty|r}return t.dirty}(t,o,r,i);if(c){const r=a(t,n,o,s);e.p(r,c)}}function c(e,t){e.appendChild(t)}function f(e,t,n){e.insertBefore(t,n||null)}function u(e){e.parentNode.removeChild(e)}function l(e){return document.createElement(e)}function p(e){return document.createTextNode(e)}function d(){return p("")}function m(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function h(e){return Array.from(e.childNodes)}function g(e,t,n,o){for(let o=0;o<e.length;o+=1){const r=e[o];if(r.nodeName===t){let t=0;const i=[];for(;t<r.attributes.length;){const e=r.attributes[t++];n[e.name]||i.push(e.name)}for(let e=0;e<i.length;e++)r.removeAttribute(i[e]);return e.splice(o,1)[0]}}return o?function(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}(t):l(t)}function v(e){return function(e,t){for(let n=0;n<e.length;n+=1){const o=e[n];if(3===o.nodeType)return o.data=""+t,e.splice(n,1)[0]}return p(t)}(e," ")}let b;function y(e){b=e}function x(){if(!b)throw new Error("Function called outside component initialization");return b}const w=[],O=[],j=[],E=[],$=Promise.resolve();let D=!1;function M(){D||(D=!0,$.then(B))}function k(){return M(),$}function L(e){j.push(e)}let A=!1;const P=new Set;function B(){if(!A){A=!0;do{for(let e=0;e<w.length;e+=1){const t=w[e];y(t),_(t.$$)}for(w.length=0;O.length;)O.pop()();for(let e=0;e<j.length;e+=1){const t=j[e];P.has(t)||(P.add(t),t())}j.length=0}while(w.length);for(;E.length;)E.pop()();D=!1,A=!1,P.clear()}}function _(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(L)}}const W=new Set;let T;function C(e,t){e&&e.i&&(W.delete(e),e.i(t))}function H(e,t,n,o){if(e&&e.o){if(W.has(e))return;W.add(e),T.c.push((()=>{W.delete(e),o&&(n&&e.d(1),o())})),e.o(t)}}function N(i,a,s,c,f,l,p=[-1]){const d=b;y(i);const m=a.props||{},g=i.$$={fragment:null,ctx:null,props:l,update:e,not_equal:f,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(d?d.$$.context:[]),callbacks:n(),dirty:p};let v=!1;if(g.ctx=s?s(i,m,((e,t,...n)=>{const o=n.length?n[0]:t;return g.ctx&&f(g.ctx[e],g.ctx[e]=o)&&(g.bound[e]&&g.bound[e](o),v&&function(e,t){-1===e.$$.dirty[0]&&(w.push(e),M(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(i,e)),t})):[],g.update(),v=!0,o(g.before_update),g.fragment=!!c&&c(g.ctx),a.target){if(a.hydrate){const e=h(a.target);g.fragment&&g.fragment.l(e),e.forEach(u)}else g.fragment&&g.fragment.c();a.intro&&C(i.$$.fragment),function(e,n,i){const{fragment:a,on_mount:s,on_destroy:c,after_update:f}=e.$$;a&&a.m(n,i),L((()=>{const n=s.map(t).filter(r);c?c.push(...n):o(n),e.$$.on_mount=[]})),f.forEach(L)}(i,a.target,a.anchor),B()}y(d)}function S(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left,x:t.left,y:t.top}}function q(e){if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t?t.defaultView:window}return e}function R(e){var t=q(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function V(e){return e instanceof q(e).Element||e instanceof Element}function I(e){return e instanceof q(e).HTMLElement||e instanceof HTMLElement}function z(e){return e?(e.nodeName||"").toLowerCase():null}function U(e){return(V(e)?e.ownerDocument:e.document).documentElement}function F(e){return S(U(e)).left+R(e).scrollLeft}function X(e){return q(e).getComputedStyle(e)}function Y(e){var t=X(e),n=t.overflow,o=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function G(e,t,n){void 0===n&&(n=!1);var o,r=U(t),i=S(e),a=I(t),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(a||!a&&!n)&&(("body"!==z(t)||Y(r))&&(s=(o=t)!==q(o)&&I(o)?function(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}(o):R(o)),I(t)?((c=S(t)).x+=t.clientLeft,c.y+=t.clientTop):r&&(c.x=F(r))),{x:i.left+s.scrollLeft-c.x,y:i.top+s.scrollTop-c.y,width:i.width,height:i.height}}function J(e){return{x:e.offsetLeft,y:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}}function K(e){return"html"===z(e)?e:e.assignedSlot||e.parentNode||e.host||U(e)}function Q(e){return["html","body","#document"].indexOf(z(e))>=0?e.ownerDocument.body:I(e)&&Y(e)?e:Q(K(e))}function Z(e,t){void 0===t&&(t=[]);var n=Q(e),o="body"===z(n),r=q(n),i=o?[r].concat(r.visualViewport||[],Y(n)?n:[]):n,a=t.concat(i);return o?a:a.concat(Z(K(i)))}function ee(e){return["table","td","th"].indexOf(z(e))>=0}function te(e){return I(e)&&"fixed"!==X(e).position?e.offsetParent:null}function ne(e){for(var t=q(e),n=te(e);n&&ee(n)&&"static"===X(n).position;)n=te(n);return n&&"body"===z(n)&&"static"===X(n).position?t:n||function(e){for(var t=K(e);I(t)&&["html","body"].indexOf(z(t))<0;){var n=X(t);if("none"!==n.transform||"none"!==n.perspective||"auto"!==n.willChange)return t;t=t.parentNode}return null}(e)||t}var oe="top",re="bottom",ie="right",ae="left",se="auto",ce=[oe,re,ie,ae],fe="start",ue="end",le="viewport",pe="popper",de=ce.reduce((function(e,t){return e.concat([t+"-"+fe,t+"-"+ue])}),[]),me=[].concat(ce,[se]).reduce((function(e,t){return e.concat([t,t+"-"+fe,t+"-"+ue])}),[]),he=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function ge(e){var t=new Map,n=new Set,o=[];function r(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var o=t.get(e);o&&r(o)}})),o.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||r(e)})),o}function ve(e){return e.split("-")[0]}var be={placement:"bottom",modifiers:[],strategy:"absolute"};function ye(){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 xe(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,o=void 0===n?[]:n,r=t.defaultOptions,i=void 0===r?be:r;return function(e,t,n){void 0===n&&(n=i);var r,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign(Object.assign({},be),i),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},c=[],f=!1,u={state:s,setOptions:function(n){l(),s.options=Object.assign(Object.assign(Object.assign({},i),s.options),n),s.scrollParents={reference:V(e)?Z(e):e.contextElement?Z(e.contextElement):[],popper:Z(t)};var r,a,f=function(e){var t=ge(e);return he.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}((r=[].concat(o,s.options.modifiers),a=r.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign(Object.assign(Object.assign({},n),t),{},{options:Object.assign(Object.assign({},n.options),t.options),data:Object.assign(Object.assign({},n.data),t.data)}):t,e}),{}),Object.keys(a).map((function(e){return a[e]}))));return s.orderedModifiers=f.filter((function(e){return e.enabled})),s.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,o=void 0===n?{}:n,r=e.effect;if("function"==typeof r){var i=r({state:s,name:t,instance:u,options:o}),a=function(){};c.push(i||a)}})),u.update()},forceUpdate:function(){if(!f){var e=s.elements,t=e.reference,n=e.popper;if(ye(t,n)){s.rects={reference:G(t,ne(n),"fixed"===s.options.strategy),popper:J(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 o=0;o<s.orderedModifiers.length;o++)if(!0!==s.reset){var r=s.orderedModifiers[o],i=r.fn,a=r.options,c=void 0===a?{}:a,l=r.name;"function"==typeof i&&(s=i({state:s,options:c,name:l,instance:u})||s)}else s.reset=!1,o=-1}}},update:(r=function(){return new Promise((function(e){u.forceUpdate(),e(s)}))},function(){return a||(a=new Promise((function(e){Promise.resolve().then((function(){a=void 0,e(r())}))}))),a}),destroy:function(){l(),f=!0}};if(!ye(e,t))return u;function l(){c.forEach((function(e){return e()})),c=[]}return u.setOptions(n).then((function(e){!f&&n.onFirstUpdate&&n.onFirstUpdate(e)})),u}}var we={passive:!0};function Oe(e){return e.split("-")[1]}function je(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Ee(e){var t,n=e.reference,o=e.element,r=e.placement,i=r?ve(r):null,a=r?Oe(r):null,s=n.x+n.width/2-o.width/2,c=n.y+n.height/2-o.height/2;switch(i){case oe:t={x:s,y:n.y-o.height};break;case re:t={x:s,y:n.y+n.height};break;case ie:t={x:n.x+n.width,y:c};break;case ae:t={x:n.x-o.width,y:c};break;default:t={x:n.x,y:n.y}}var f=i?je(i):null;if(null!=f){var u="y"===f?"height":"width";switch(a){case fe:t[f]=Math.floor(t[f])-Math.floor(n[u]/2-o[u]/2);break;case ue:t[f]=Math.floor(t[f])+Math.ceil(n[u]/2-o[u]/2)}}return t}var $e={top:"auto",right:"auto",bottom:"auto",left:"auto"};function De(e){var t,n=e.popper,o=e.popperRect,r=e.placement,i=e.offsets,a=e.position,s=e.gpuAcceleration,c=e.adaptive,f=function(e){var t=e.x,n=e.y,o=window.devicePixelRatio||1;return{x:Math.round(t*o)/o||0,y:Math.round(n*o)/o||0}}(i),u=f.x,l=f.y,p=i.hasOwnProperty("x"),d=i.hasOwnProperty("y"),m=ae,h=oe,g=window;if(c){var v=ne(n);v===q(n)&&(v=U(n)),r===oe&&(h=re,l-=v.clientHeight-o.height,l*=s?1:-1),r===ae&&(m=ie,u-=v.clientWidth-o.width,u*=s?1:-1)}var b,y=Object.assign({position:a},c&&$e);return s?Object.assign(Object.assign({},y),{},((b={})[h]=d?"0":"",b[m]=p?"0":"",b.transform=(g.devicePixelRatio||1)<2?"translate("+u+"px, "+l+"px)":"translate3d("+u+"px, "+l+"px, 0)",b)):Object.assign(Object.assign({},y),{},((t={})[h]=d?l+"px":"",t[m]=p?u+"px":"",t.transform="",t))}var Me={left:"right",right:"left",bottom:"top",top:"bottom"};function ke(e){return e.replace(/left|right|bottom|top/g,(function(e){return Me[e]}))}var Le={start:"end",end:"start"};function Ae(e){return e.replace(/start|end/g,(function(e){return Le[e]}))}function Pe(e,t){var n=Boolean(t.getRootNode&&t.getRootNode().host);if(e.contains(t))return!0;if(n){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Be(e){return Object.assign(Object.assign({},e),{},{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function _e(e,t){return t===le?Be(function(e){var t=q(e),n=U(e),o=t.visualViewport,r=n.clientWidth,i=n.clientHeight,a=0,s=0;return o&&(r=o.width,i=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=o.offsetLeft,s=o.offsetTop)),{width:r,height:i,x:a+F(e),y:s}}(e)):I(t)?function(e){var t=S(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):Be(function(e){var t=U(e),n=R(e),o=e.ownerDocument.body,r=Math.max(t.scrollWidth,t.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Math.max(t.scrollHeight,t.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-n.scrollLeft+F(e),s=-n.scrollTop;return"rtl"===X(o||t).direction&&(a+=Math.max(t.clientWidth,o?o.clientWidth:0)-r),{width:r,height:i,x:a,y:s}}(U(e)))}function We(e,t,n){var o="clippingParents"===t?function(e){var t=Z(e),n=["absolute","fixed"].indexOf(X(e).position)>=0&&I(e)?ne(e):e;return V(n)?t.filter((function(e){return V(e)&&Pe(e,n)})):[]}(e):[].concat(t),r=[].concat(o,[n]),i=r[0],a=r.reduce((function(t,n){var o=_e(e,n);return t.top=Math.max(o.top,t.top),t.right=Math.min(o.right,t.right),t.bottom=Math.min(o.bottom,t.bottom),t.left=Math.max(o.left,t.left),t}),_e(e,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Te(e){return Object.assign(Object.assign({},{top:0,right:0,bottom:0,left:0}),e)}function Ce(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function He(e,t){void 0===t&&(t={});var n=t,o=n.placement,r=void 0===o?e.placement:o,i=n.boundary,a=void 0===i?"clippingParents":i,s=n.rootBoundary,c=void 0===s?le:s,f=n.elementContext,u=void 0===f?pe:f,l=n.altBoundary,p=void 0!==l&&l,d=n.padding,m=void 0===d?0:d,h=Te("number"!=typeof m?m:Ce(m,ce)),g=u===pe?"reference":pe,v=e.elements.reference,b=e.rects.popper,y=e.elements[p?g:u],x=We(V(y)?y:y.contextElement||U(e.elements.popper),a,c),w=S(v),O=Ee({reference:w,element:b,strategy:"absolute",placement:r}),j=Be(Object.assign(Object.assign({},b),O)),E=u===pe?j:w,$={top:x.top-E.top+h.top,bottom:E.bottom-x.bottom+h.bottom,left:x.left-E.left+h.left,right:E.right-x.right+h.right},D=e.modifiersData.offset;if(u===pe&&D){var M=D[r];Object.keys($).forEach((function(e){var t=[ie,re].indexOf(e)>=0?1:-1,n=[oe,re].indexOf(e)>=0?"y":"x";$[e]+=M[n]*t}))}return $}function Ne(e,t){void 0===t&&(t={});var n=t,o=n.placement,r=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,f=void 0===c?me:c,u=Oe(o),l=(u?s?de:de.filter((function(e){return Oe(e)===u})):ce).filter((function(e){return f.indexOf(e)>=0})).reduce((function(t,n){return t[n]=He(e,{placement:n,boundary:r,rootBoundary:i,padding:a})[ve(n)],t}),{});return Object.keys(l).sort((function(e,t){return l[e]-l[t]}))}function Se(e,t,n){return Math.max(e,Math.min(t,n))}function qe(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 Re(e){return[oe,ie,re,ae].some((function(t){return e[t]>=0}))}var Ve=xe({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,o=e.options,r=o.scroll,i=void 0===r||r,a=o.resize,s=void 0===a||a,c=q(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&f.forEach((function(e){e.addEventListener("scroll",n.update,we)})),s&&c.addEventListener("resize",n.update,we),function(){i&&f.forEach((function(e){e.removeEventListener("scroll",n.update,we)})),s&&c.removeEventListener("resize",n.update,we)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=Ee({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,o=n.gpuAcceleration,r=void 0===o||o,i=n.adaptive,a=void 0===i||i,s={placement:ve(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign(Object.assign({},t.styles.popper),De(Object.assign(Object.assign({},s),{},{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign(Object.assign({},t.styles.arrow),De(Object.assign(Object.assign({},s),{},{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1})))),t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-placement":t.placement})},data:{}},{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]||{},o=t.attributes[e]||{},r=t.elements[e];I(r)&&z(r)&&(Object.assign(r.style,n),Object.keys(o).forEach((function(e){var t=o[e];!1===t?r.removeAttribute(e):r.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.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var o=t.elements[e],r=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});I(o)&&z(o)&&(Object.assign(o.style,i),Object.keys(r).forEach((function(e){o.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,o=e.name,r=n.offset,i=void 0===r?[0,0]:r,a=me.reduce((function(e,n){return e[n]=function(e,t,n){var o=ve(e),r=[ae,oe].indexOf(o)>=0?-1:1,i="function"==typeof n?n(Object.assign(Object.assign({},t),{},{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*r,[ae,ie].indexOf(o)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],c=s.x,f=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=f),t.modifiersData[o]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var r=n.mainAxis,i=void 0===r||r,a=n.altAxis,s=void 0===a||a,c=n.fallbackPlacements,f=n.padding,u=n.boundary,l=n.rootBoundary,p=n.altBoundary,d=n.flipVariations,m=void 0===d||d,h=n.allowedAutoPlacements,g=t.options.placement,v=ve(g),b=c||(v===g||!m?[ke(g)]:function(e){if(ve(e)===se)return[];var t=ke(e);return[Ae(e),t,Ae(t)]}(g)),y=[g].concat(b).reduce((function(e,n){return e.concat(ve(n)===se?Ne(t,{placement:n,boundary:u,rootBoundary:l,padding:f,flipVariations:m,allowedAutoPlacements:h}):n)}),[]),x=t.rects.reference,w=t.rects.popper,O=new Map,j=!0,E=y[0],$=0;$<y.length;$++){var D=y[$],M=ve(D),k=Oe(D)===fe,L=[oe,re].indexOf(M)>=0,A=L?"width":"height",P=He(t,{placement:D,boundary:u,rootBoundary:l,altBoundary:p,padding:f}),B=L?k?ie:ae:k?re:oe;x[A]>w[A]&&(B=ke(B));var _=ke(B),W=[];if(i&&W.push(P[M]<=0),s&&W.push(P[B]<=0,P[_]<=0),W.every((function(e){return e}))){E=D,j=!1;break}O.set(D,W)}if(j)for(var T=function(e){var t=y.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return E=t,"break"},C=m?3:1;C>0;C--){if("break"===T(C))break}t.placement!==E&&(t.modifiersData[o]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,o=e.name,r=n.mainAxis,i=void 0===r||r,a=n.altAxis,s=void 0!==a&&a,c=n.boundary,f=n.rootBoundary,u=n.altBoundary,l=n.padding,p=n.tether,d=void 0===p||p,m=n.tetherOffset,h=void 0===m?0:m,g=He(t,{boundary:c,rootBoundary:f,padding:l,altBoundary:u}),v=ve(t.placement),b=Oe(t.placement),y=!b,x=je(v),w="x"===x?"y":"x",O=t.modifiersData.popperOffsets,j=t.rects.reference,E=t.rects.popper,$="function"==typeof h?h(Object.assign(Object.assign({},t.rects),{},{placement:t.placement})):h,D={x:0,y:0};if(O){if(i){var M="y"===x?oe:ae,k="y"===x?re:ie,L="y"===x?"height":"width",A=O[x],P=O[x]+g[M],B=O[x]-g[k],_=d?-E[L]/2:0,W=b===fe?j[L]:E[L],T=b===fe?-E[L]:-j[L],C=t.elements.arrow,H=d&&C?J(C):{width:0,height:0},N=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},S=N[M],q=N[k],R=Se(0,j[L],H[L]),V=y?j[L]/2-_-R-S-$:W-R-S-$,I=y?-j[L]/2+_+R+q+$:T+R+q+$,z=t.elements.arrow&&ne(t.elements.arrow),U=z?"y"===x?z.clientTop||0:z.clientLeft||0:0,F=t.modifiersData.offset?t.modifiersData.offset[t.placement][x]:0,X=O[x]+V-F-U,Y=O[x]+I-F,G=Se(d?Math.min(P,X):P,A,d?Math.max(B,Y):B);O[x]=G,D[x]=G-A}if(s){var K="x"===x?oe:ae,Q="x"===x?re:ie,Z=O[w],ee=Se(Z+g[K],Z,Z-g[Q]);O[w]=ee,D[w]=ee-Z}t.modifiersData[o]=D}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,o=e.name,r=n.elements.arrow,i=n.modifiersData.popperOffsets,a=ve(n.placement),s=je(a),c=[ae,ie].indexOf(a)>=0?"height":"width";if(r&&i){var f=n.modifiersData[o+"#persistent"].padding,u=J(r),l="y"===s?oe:ae,p="y"===s?re:ie,d=n.rects.reference[c]+n.rects.reference[s]-i[s]-n.rects.popper[c],m=i[s]-n.rects.reference[s],h=ne(r),g=h?"y"===s?h.clientHeight||0:h.clientWidth||0:0,v=d/2-m/2,b=f[l],y=g-u[c]-f[p],x=g/2-u[c]/2+v,w=Se(b,x,y),O=s;n.modifiersData[o]=((t={})[O]=w,t.centerOffset=w-x,t)}},effect:function(e){var t=e.state,n=e.options,o=e.name,r=n.element,i=void 0===r?"[data-popper-arrow]":r,a=n.padding,s=void 0===a?0:a;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&Pe(t.elements.popper,i)&&(t.elements.arrow=i,t.modifiersData[o+"#persistent"]={padding:Te("number"!=typeof s?s:Ce(s,ce))})},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,o=t.rects.reference,r=t.rects.popper,i=t.modifiersData.preventOverflow,a=He(t,{elementContext:"reference"}),s=He(t,{altBoundary:!0}),c=qe(a,o),f=qe(s,r,i),u=Re(c),l=Re(f);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:f,isReferenceHidden:u,hasPopperEscaped:l},t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-reference-hidden":u,"data-popper-escaped":l})}}]});function Ie(e){let t,n,o,r,i,d;const b=e[11].default,y=function(e,t,n,o){if(e){const r=a(e,t,n,o);return e[0](r)}}(b,e,e[10],null);return{c(){t=l("div"),n=l("div"),o=p(" "),r=l("div"),y&&y.c(),this.h()},l(e){t=g(e,"DIV",{class:!0,role:!0});var i=h(t);n=g(i,"DIV",{class:!0}),h(n).forEach(u),o=v(i),r=g(i,"DIV",{class:!0});var a=h(r);y&&y.l(a),a.forEach(u),i.forEach(u),this.h()},h(){m(n,"class","arrow"),m(r,"class","tooltip-inner"),m(t,"class",i="tooltip fade bs-tooltip-"+e[1]+" show"),m(t,"role","tooltip")},m(i,a){f(i,t,a),c(t,n),e[12](n),c(t,o),c(t,r),y&&y.m(r,null),e[13](t),d=!0},p(e,n){y&&y.p&&1024&n[0]&&s(y,b,e,e[10],n,null,null),(!d||2&n[0]&&i!==(i="tooltip fade bs-tooltip-"+e[1]+" show"))&&m(t,"class",i)},i(e){d||(C(y,e),d=!0)},o(e){H(y,e),d=!1},d(n){n&&u(t),e[12](null),y&&y.d(n),e[13](null)}}}function ze(e){let t,n,r=e[0]&&Ie(e);return{c(){r&&r.c(),t=d()},l(e){r&&r.l(e),t=d()},m(e,o){r&&r.m(e,o),f(e,t,o),n=!0},p(e,n){e[0]?r?(r.p(e,n),1&n[0]&&C(r,1)):(r=Ie(e),r.c(),C(r,1),r.m(t.parentNode,t)):r&&(T={r:0,c:[],p:T},H(r,1,1,(()=>{r=null})),T.r||o(T.c),T=T.p)},i(e){n||(C(r),n=!0)},o(e){H(r),n=!1},d(e){r&&r.d(e),e&&u(t)}}}function Ue(e,...t){return e.addEventListener(...t),{remove:()=>e.removeEventListener(...t)}}function Fe(e,t,n){const o=()=>{};let r,i,a,s,c,f,{open:u=!1}=t,{triggerElement:l}=t,{flip:p=!0}=t,{placement:d="top"}=t,{trigger:m="hover|focus"}=t,{offset:h=[0,4]}=t,{onOpened:g=o}=t,{onClosed:v=o}=t,b=[];function y(e){b.push(e)}function w(){!async function(){await k(),a=Ve(l,r,{placement:d,modifiers:[{name:"arrow",options:{element:i}},{name:"flip",enabled:p},{name:"offset",options:{offset:h}},{name:"preventOverflow",options:{altBoundary:!0}}]})}(),g()}function j(){s&&function(){const e=Ue(l,"mouseenter",(e=>{n(0,u=!0)})),t=Ue(l,"mouseleave",(e=>{n(0,u=!1)}));y(e),y(t)}(),f&&y(Ue(l,"click",(e=>{n(0,u=!u)}))),c&&function(){const e=Ue(l,"focus",(e=>{n(0,u=!0)})),t=Ue(l,"blur",(e=>{n(0,u=!1)}));y(e),y(t)}()}function E(){a&&(a.destroy(),a=null)}var $;$=async()=>{!function(){const e=m.split("|");s=e.includes("hover"),c=e.includes("focus"),f=e.includes("click")}(),await k(),j()},x().$$.on_mount.push($),function(e){x().$$.on_destroy.push(e)}((()=>{b.forEach((e=>e.remove())),E()}));let{$$slots:D={},$$scope:M}=t;return e.$set=e=>{"open"in e&&n(0,u=e.open),"triggerElement"in e&&n(4,l=e.triggerElement),"flip"in e&&n(5,p=e.flip),"placement"in e&&n(1,d=e.placement),"trigger"in e&&n(6,m=e.trigger),"offset"in e&&n(7,h=e.offset),"onOpened"in e&&n(8,g=e.onOpened),"onClosed"in e&&n(9,v=e.onClosed),"$$scope"in e&&n(10,M=e.$$scope)},e.$$.update=()=>{1&e.$$.dirty[0]&&(u?w():(E(),v()))},[u,d,r,i,l,p,m,h,g,v,M,D,function(e){O[e?"unshift":"push"]((()=>{i=e,n(3,i)}))},function(e){O[e?"unshift":"push"]((()=>{r=e,n(2,r)}))}]}return class extends class{$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(){}}{constructor(e){super(),N(this,e,Fe,ze,i,{open:0,triggerElement:4,flip:5,placement:1,trigger:6,offset:7,onOpened:8,onClosed:9},[-1,-1])}}}));
//# sourceMappingURL=index.js.map