UNPKG

@codeperate/cdp-ui-library

Version:

Codeperate UI Library

1 lines 20.2 kB
import{r as t,h as n,H as e,a as r}from"./p-21e532ba.js";import{d as o}from"./p-c571c098.js";var i="top",a="bottom",u="right",f="left",c=[i,a,u,f],s=c.reduce((function(t,n){return t.concat([n+"-start",n+"-end"])}),[]),p=[].concat(c,["auto"]).reduce((function(t,n){return t.concat([n,n+"-start",n+"-end"])}),[]),d=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function l(t){return t?(t.nodeName||"").toLowerCase():null}function v(t){if(null==t)return window;if("[object Window]"!==t.toString()){var n=t.ownerDocument;return n&&n.defaultView||window}return t}function h(t){return t instanceof v(t).Element||t instanceof Element}function b(t){return t instanceof v(t).HTMLElement||t instanceof HTMLElement}function m(t){return"undefined"!=typeof ShadowRoot&&(t instanceof v(t).ShadowRoot||t instanceof ShadowRoot)}function y(t){return t.split("-")[0]}function w(t){var n=t.getBoundingClientRect();return{width:n.width,height:n.height,top:n.top,right:n.right,bottom:n.bottom,left:n.left,x:n.left,y:n.top}}function g(t){var n=w(t),e=t.offsetWidth,r=t.offsetHeight;return Math.abs(n.width-e)<=1&&(e=n.width),Math.abs(n.height-r)<=1&&(r=n.height),{x:t.offsetLeft,y:t.offsetTop,width:e,height:r}}function x(t,n){var e=n.getRootNode&&n.getRootNode();if(t.contains(n))return!0;if(e&&m(e)){var r=n;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function O(t){return v(t).getComputedStyle(t)}function j(t){return["table","td","th"].indexOf(l(t))>=0}function E(t){return((h(t)?t.ownerDocument:t.document)||window.document).documentElement}function M(t){return"html"===l(t)?t:t.assignedSlot||t.parentNode||(m(t)?t.host:null)||E(t)}function k(t){return b(t)&&"fixed"!==O(t).position?t.offsetParent:null}function L(t){for(var n=v(t),e=k(t);e&&j(e)&&"static"===O(e).position;)e=k(e);return e&&("html"===l(e)||"body"===l(e)&&"static"===O(e).position)?n:e||function(t){var n=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&b(t)&&"fixed"===O(t).position)return null;for(var e=M(t);b(e)&&["html","body"].indexOf(l(e))<0;){var r=O(e);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||n&&"filter"===r.willChange||n&&r.filter&&"none"!==r.filter)return e;e=e.parentNode}return null}(t)||n}function P(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}var R=Math.max,q=Math.min,B=Math.round;function H(t,n,e){return R(t,q(n,e))}function W(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function S(t,n){return n.reduce((function(n,e){return n[e]=t,n}),{})}var C={top:"auto",right:"auto",bottom:"auto",left:"auto"};function T(t){var n,e=t.popper,r=t.popperRect,o=t.placement,c=t.offsets,s=t.position,p=t.gpuAcceleration,d=t.adaptive,l=t.roundOffsets,h=!0===l?function(t){var n=t.y,e=window.devicePixelRatio||1;return{x:B(B(t.x*e)/e)||0,y:B(B(n*e)/e)||0}}(c):"function"==typeof l?l(c):c,b=h.x,m=void 0===b?0:b,y=h.y,w=void 0===y?0:y,g=c.hasOwnProperty("x"),x=c.hasOwnProperty("y"),j=f,M=i,k=window;if(d){var P=L(e),R="clientHeight",q="clientWidth";P===v(e)&&"static"!==O(P=E(e)).position&&(R="scrollHeight",q="scrollWidth"),P=P,o===i&&(M=a,w-=P[R]-r.height,w*=p?1:-1),o===f&&(j=u,m-=P[q]-r.width,m*=p?1:-1)}var H,W=Object.assign({position:s},d&&C);return Object.assign({},W,p?((H={})[M]=x?"0":"",H[j]=g?"0":"",H.transform=(k.devicePixelRatio||1)<2?"translate("+m+"px, "+w+"px)":"translate3d("+m+"px, "+w+"px, 0)",H):((n={})[M]=x?w+"px":"",n[j]=g?m+"px":"",n.transform="",n))}var I={passive:!0},z={left:"right",right:"left",bottom:"top",top:"bottom"};function A(t){return t.replace(/left|right|bottom|top/g,(function(t){return z[t]}))}var D={start:"end",end:"start"};function _(t){return t.replace(/start|end/g,(function(t){return D[t]}))}function U(t){var n=v(t);return{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function V(t){return w(E(t)).left+U(t).scrollLeft}function F(t){var n=O(t);return/auto|scroll|overlay|hidden/.test(n.overflow+n.overflowY+n.overflowX)}function G(t){return["html","body","#document"].indexOf(l(t))>=0?t.ownerDocument.body:b(t)&&F(t)?t:G(M(t))}function J(t,n){var e;void 0===n&&(n=[]);var r=G(t),o=r===(null==(e=t.ownerDocument)?void 0:e.body),i=v(r),a=o?[i].concat(i.visualViewport||[],F(r)?r:[]):r,u=n.concat(a);return o?u:u.concat(J(M(a)))}function K(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function N(t,n){return"viewport"===n?K(function(t){var n=v(t),e=E(t),r=n.visualViewport,o=e.clientWidth,i=e.clientHeight,a=0,u=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,u=r.offsetTop)),{width:o,height:i,x:a+V(t),y:u}}(t)):b(n)?function(t){var n=w(t);return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}(n):K(function(t){var n,e=E(t),r=U(t),o=null==(n=t.ownerDocument)?void 0:n.body,i=R(e.scrollWidth,e.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=R(e.scrollHeight,e.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),u=-r.scrollLeft+V(t),f=-r.scrollTop;return"rtl"===O(o||e).direction&&(u+=R(e.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:u,y:f}}(E(t)))}function Q(t){return t.split("-")[1]}function X(t){var n,e=t.reference,r=t.element,o=t.placement,c=o?y(o):null,s=o?Q(o):null,p=e.x+e.width/2-r.width/2,d=e.y+e.height/2-r.height/2;switch(c){case i:n={x:p,y:e.y-r.height};break;case a:n={x:p,y:e.y+e.height};break;case u:n={x:e.x+e.width,y:d};break;case f:n={x:e.x-r.width,y:d};break;default:n={x:e.x,y:e.y}}var l=c?P(c):null;if(null!=l){var v="y"===l?"height":"width";switch(s){case"start":n[l]=n[l]-(e[v]/2-r[v]/2);break;case"end":n[l]=n[l]+(e[v]/2-r[v]/2)}}return n}function Y(t,n){void 0===n&&(n={});var e=n.placement,r=void 0===e?t.placement:e,o=n.boundary,f=void 0===o?"clippingParents":o,s=n.rootBoundary,p=void 0===s?"viewport":s,d=n.elementContext,v=void 0===d?"popper":d,m=n.altBoundary,y=void 0!==m&&m,g=n.padding,j=void 0===g?0:g,k=W("number"!=typeof j?j:S(j,c)),P=t.elements.reference,B=t.rects.popper,H=t.elements[y?"popper"===v?"reference":"popper":v],C=function(t,n,e){var r="clippingParents"===n?function(t){var n=J(M(t)),e=["absolute","fixed"].indexOf(O(t).position)>=0&&b(t)?L(t):t;return h(e)?n.filter((function(t){return h(t)&&x(t,e)&&"body"!==l(t)})):[]}(t):[].concat(n),o=[].concat(r,[e]),i=o.reduce((function(n,e){var r=N(t,e);return n.top=R(r.top,n.top),n.right=q(r.right,n.right),n.bottom=q(r.bottom,n.bottom),n.left=R(r.left,n.left),n}),N(t,o[0]));return i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}(h(H)?H:H.contextElement||E(t.elements.popper),f,p),T=w(P),I=X({reference:T,element:B,strategy:"absolute",placement:r}),z=K(Object.assign({},B,I)),A="popper"===v?z:T,D={top:C.top-A.top+k.top,bottom:A.bottom-C.bottom+k.bottom,left:C.left-A.left+k.left,right:A.right-C.right+k.right},_=t.modifiersData.offset;if("popper"===v&&_){var U=_[r];Object.keys(D).forEach((function(t){var n=[u,a].indexOf(t)>=0?1:-1,e=[i,a].indexOf(t)>=0?"y":"x";D[t]+=U[e]*n}))}return D}function Z(t,n){void 0===n&&(n={});var e=n.boundary,r=n.rootBoundary,o=n.padding,i=n.flipVariations,a=n.allowedAutoPlacements,u=void 0===a?p:a,f=Q(n.placement),d=f?i?s:s.filter((function(t){return Q(t)===f})):c,l=d.filter((function(t){return u.indexOf(t)>=0}));0===l.length&&(l=d);var v=l.reduce((function(n,i){return n[i]=Y(t,{placement:i,boundary:e,rootBoundary:r,padding:o})[y(i)],n}),{});return Object.keys(v).sort((function(t,n){return v[t]-v[n]}))}function $(t,n,e){return void 0===e&&(e={x:0,y:0}),{top:t.top-n.height-e.y,right:t.right-n.width+e.x,bottom:t.bottom-n.height+e.y,left:t.left-n.width-e.x}}function tt(t){return[i,u,a,f].some((function(n){return t[n]>=0}))}function nt(t,n,e){void 0===e&&(e=!1);var r,o,i=E(n),a=w(t),u=b(n),f={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(u||!u&&!e)&&(("body"!==l(n)||F(i))&&(f=(r=n)!==v(r)&&b(r)?{scrollLeft:(o=r).scrollLeft,scrollTop:o.scrollTop}:U(r)),b(n)?((c=w(n)).x+=n.clientLeft,c.y+=n.clientTop):i&&(c.x=V(i))),{x:a.left+f.scrollLeft-c.x,y:a.top+f.scrollTop-c.y,width:a.width,height:a.height}}function et(t){var n=new Map,e=new Set,r=[];function o(t){e.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!e.has(t)){var r=n.get(t);r&&o(r)}})),r.push(t)}return t.forEach((function(t){n.set(t.name,t)})),t.forEach((function(t){e.has(t.name)||o(t)})),r}var rt={placement:"bottom",modifiers:[],strategy:"absolute"};function ot(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return!n.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function it(t){void 0===t&&(t={});var n=t.defaultModifiers,e=void 0===n?[]:n,r=t.defaultOptions,o=void 0===r?rt:r;return function(t,n,r){void 0===r&&(r=o);var i,a,u={placement:"bottom",orderedModifiers:[],options:Object.assign({},rt,o),modifiersData:{},elements:{reference:t,popper:n},attributes:{},styles:{}},f=[],c=!1,s={state:u,setOptions:function(r){p(),u.options=Object.assign({},o,u.options,r),u.scrollParents={reference:h(t)?J(t):t.contextElement?J(t.contextElement):[],popper:J(n)};var i,a,c=function(t){var n=et(t);return d.reduce((function(t,e){return t.concat(n.filter((function(t){return t.phase===e})))}),[])}((i=[].concat(e,u.options.modifiers),a=i.reduce((function(t,n){var e=t[n.name];return t[n.name]=e?Object.assign({},e,n,{options:Object.assign({},e.options,n.options),data:Object.assign({},e.data,n.data)}):n,t}),{}),Object.keys(a).map((function(t){return a[t]}))));return u.orderedModifiers=c.filter((function(t){return t.enabled})),u.orderedModifiers.forEach((function(t){var n=t.options,e=t.effect;if("function"==typeof e){var r=e({state:u,name:t.name,instance:s,options:void 0===n?{}:n});f.push(r||function(){})}})),s.update()},forceUpdate:function(){if(!c){var t=u.elements,n=t.reference,e=t.popper;if(ot(n,e)){u.rects={reference:nt(n,L(e),"fixed"===u.options.strategy),popper:g(e)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach((function(t){return u.modifiersData[t.name]=Object.assign({},t.data)}));for(var r=0;r<u.orderedModifiers.length;r++)if(!0!==u.reset){var o=u.orderedModifiers[r],i=o.fn,a=o.options;"function"==typeof i&&(u=i({state:u,options:void 0===a?{}:a,name:o.name,instance:s})||u)}else u.reset=!1,r=-1}}},update:(i=function(){return new Promise((function(t){s.forceUpdate(),t(u)}))},function(){return a||(a=new Promise((function(t){Promise.resolve().then((function(){a=void 0,t(i())}))}))),a}),destroy:function(){p(),c=!0}};if(!ot(t,n))return s;function p(){f.forEach((function(t){return t()})),f=[]}return s.setOptions(r).then((function(t){!c&&r.onFirstUpdate&&r.onFirstUpdate(t)})),s}}var at=it({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var n=t.state,e=t.instance,r=t.options,o=r.scroll,i=void 0===o||o,a=r.resize,u=void 0===a||a,f=v(n.elements.popper),c=[].concat(n.scrollParents.reference,n.scrollParents.popper);return i&&c.forEach((function(t){t.addEventListener("scroll",e.update,I)})),u&&f.addEventListener("resize",e.update,I),function(){i&&c.forEach((function(t){t.removeEventListener("scroll",e.update,I)})),u&&f.removeEventListener("resize",e.update,I)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var n=t.state;n.modifiersData[t.name]=X({reference:n.rects.reference,element:n.rects.popper,strategy:"absolute",placement:n.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var n=t.state,e=t.options,r=e.gpuAcceleration,o=void 0===r||r,i=e.adaptive,a=void 0===i||i,u=e.roundOffsets,f=void 0===u||u,c={placement:y(n.placement),popper:n.elements.popper,popperRect:n.rects.popper,gpuAcceleration:o};null!=n.modifiersData.popperOffsets&&(n.styles.popper=Object.assign({},n.styles.popper,T(Object.assign({},c,{offsets:n.modifiersData.popperOffsets,position:n.options.strategy,adaptive:a,roundOffsets:f})))),null!=n.modifiersData.arrow&&(n.styles.arrow=Object.assign({},n.styles.arrow,T(Object.assign({},c,{offsets:n.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-placement":n.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var n=t.state;Object.keys(n.elements).forEach((function(t){var e=n.styles[t]||{},r=n.attributes[t]||{},o=n.elements[t];b(o)&&l(o)&&(Object.assign(o.style,e),Object.keys(r).forEach((function(t){var n=r[t];!1===n?o.removeAttribute(t):o.setAttribute(t,!0===n?"":n)})))}))},effect:function(t){var n=t.state,e={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(n.elements.popper.style,e.popper),n.styles=e,n.elements.arrow&&Object.assign(n.elements.arrow.style,e.arrow),function(){Object.keys(n.elements).forEach((function(t){var r=n.elements[t],o=n.attributes[t]||{},i=Object.keys(n.styles.hasOwnProperty(t)?n.styles[t]:e[t]).reduce((function(t,n){return t[n]="",t}),{});b(r)&&l(r)&&(Object.assign(r.style,i),Object.keys(o).forEach((function(t){r.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var n=t.state,e=t.name,r=t.options.offset,o=void 0===r?[0,0]:r,a=p.reduce((function(t,e){return t[e]=function(t,n,e){var r=y(t),o=[f,i].indexOf(r)>=0?-1:1,a="function"==typeof e?e(Object.assign({},n,{placement:t})):e,c=a[0],s=a[1];return c=c||0,s=(s||0)*o,[f,u].indexOf(r)>=0?{x:s,y:c}:{x:c,y:s}}(e,n.rects,o),t}),{}),c=a[n.placement],s=c.y;null!=n.modifiersData.popperOffsets&&(n.modifiersData.popperOffsets.x+=c.x,n.modifiersData.popperOffsets.y+=s),n.modifiersData[e]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var n=t.state,e=t.options,r=t.name;if(!n.modifiersData[r]._skip){for(var o=e.mainAxis,c=void 0===o||o,s=e.altAxis,p=void 0===s||s,d=e.fallbackPlacements,l=e.padding,v=e.boundary,h=e.rootBoundary,b=e.altBoundary,m=e.flipVariations,w=void 0===m||m,g=e.allowedAutoPlacements,x=n.options.placement,O=y(x),j=d||(O!==x&&w?function(t){if("auto"===y(t))return[];var n=A(t);return[_(t),n,_(n)]}(x):[A(x)]),E=[x].concat(j).reduce((function(t,e){return t.concat("auto"===y(e)?Z(n,{placement:e,boundary:v,rootBoundary:h,padding:l,flipVariations:w,allowedAutoPlacements:g}):e)}),[]),M=n.rects.reference,k=n.rects.popper,L=new Map,P=!0,R=E[0],q=0;q<E.length;q++){var B=E[q],H=y(B),W="start"===Q(B),S=[i,a].indexOf(H)>=0,C=S?"width":"height",T=Y(n,{placement:B,boundary:v,rootBoundary:h,altBoundary:b,padding:l}),I=S?W?u:f:W?a:i;M[C]>k[C]&&(I=A(I));var z=A(I),D=[];if(c&&D.push(T[H]<=0),p&&D.push(T[I]<=0,T[z]<=0),D.every((function(t){return t}))){R=B,P=!1;break}L.set(B,D)}if(P)for(var U=function(t){var n=E.find((function(n){var e=L.get(n);if(e)return e.slice(0,t).every((function(t){return t}))}));if(n)return R=n,"break"},V=w?3:1;V>0&&"break"!==U(V);V--);n.placement!==R&&(n.modifiersData[r]._skip=!0,n.placement=R,n.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var n=t.state,e=t.options,r=t.name,o=e.mainAxis,c=void 0===o||o,s=e.altAxis,p=void 0!==s&&s,d=e.tether,l=void 0===d||d,v=e.tetherOffset,h=void 0===v?0:v,b=Y(n,{boundary:e.boundary,rootBoundary:e.rootBoundary,padding:e.padding,altBoundary:e.altBoundary}),m=y(n.placement),w=Q(n.placement),x=!w,O=P(m),j="x"===O?"y":"x",E=n.modifiersData.popperOffsets,M=n.rects.reference,k=n.rects.popper,B="function"==typeof h?h(Object.assign({},n.rects,{placement:n.placement})):h,W={x:0,y:0};if(E){if(c||p){var S="y"===O?i:f,C="y"===O?a:u,T="y"===O?"height":"width",I=E[O],z=E[O]+b[S],A=E[O]-b[C],D=l?-k[T]/2:0,_="start"===w?M[T]:k[T],U="start"===w?-k[T]:-M[T],V=n.elements.arrow,F=l&&V?g(V):{width:0,height:0},G=n.modifiersData["arrow#persistent"]?n.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},J=G[S],K=G[C],N=H(0,M[T],F[T]),X=x?M[T]/2-D-N-J-B:_-N-J-B,Z=x?-M[T]/2+D+N+K+B:U+N+K+B,$=n.elements.arrow&&L(n.elements.arrow),tt=n.modifiersData.offset?n.modifiersData.offset[n.placement][O]:0,nt=E[O]+X-tt-($?"y"===O?$.clientTop||0:$.clientLeft||0:0),et=E[O]+Z-tt;if(c){var rt=H(l?q(z,nt):z,I,l?R(A,et):A);E[O]=rt,W[O]=rt-I}if(p){var ot=E[j],it=ot+b["x"===O?i:f],at=ot-b["x"===O?a:u],ut=H(l?q(it,nt):it,ot,l?R(at,et):at);E[j]=ut,W[j]=ut-ot}}n.modifiersData[r]=W}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var n,e=t.state,r=t.name,o=t.options,s=e.elements.arrow,p=e.modifiersData.popperOffsets,d=y(e.placement),l=P(d),v=[f,u].indexOf(d)>=0?"height":"width";if(s&&p){var h=function(t,n){return W("number"!=typeof(t="function"==typeof t?t(Object.assign({},n.rects,{placement:n.placement})):t)?t:S(t,c))}(o.padding,e),b=g(s),m="y"===l?i:f,w="y"===l?a:u,x=e.rects.reference[v]+e.rects.reference[l]-p[l]-e.rects.popper[v],O=p[l]-e.rects.reference[l],j=L(s),E=j?"y"===l?j.clientHeight||0:j.clientWidth||0:0,M=E/2-b[v]/2+(x/2-O/2),k=H(h[m],M,E-b[v]-h[w]);e.modifiersData[r]=((n={})[l]=k,n.centerOffset=k-M,n)}},effect:function(t){var n=t.state,e=t.options.element,r=void 0===e?"[data-popper-arrow]":e;null!=r&&("string"!=typeof r||(r=n.elements.popper.querySelector(r)))&&x(n.elements.popper,r)&&(n.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var n=t.state,e=t.name,r=n.rects.reference,o=n.rects.popper,i=n.modifiersData.preventOverflow,a=Y(n,{elementContext:"reference"}),u=Y(n,{altBoundary:!0}),f=$(a,r),c=$(u,o,i),s=tt(f),p=tt(c);n.modifiersData[e]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:s,hasPopperEscaped:p},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":s,"data-popper-escaped":p})}}]});const ut=class{constructor(n){t(this,n),this.defaultConfig={showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"],classList:{tooltip:"bg-gray-600 text-white rounded w-max px-2 py-1 z-10 block",arrow:"bg-gray-600 transform-gpu rotate-45 w-2 h-2"},option:{strategy:"fixed",placement:"bottom"}},this._config={},this.props={display:!1}}componentWillLoad(){this._config=o(this.config,this.defaultConfig),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.createProxy()}componentDidLoad(){const{showEvents:t,hideEvents:n}=this._config;t&&t.forEach((t=>{this.rootEl.addEventListener(t,this.show)})),n&&n.forEach((t=>{this.rootEl.addEventListener(t,this.hide)})),this.props.display&&(this.popperInstance=at(this.rootEl,this.tooltipEl,this._config.option))}componentDidRender(){this.popperInstance&&this.popperInstance.update()}async show(){this._props.display=!0}async hide(){this._props.display=!1}disconnectedCallback(){const{showEvents:t,hideEvents:n}=this._config;t&&t.forEach((t=>{this.rootEl.removeEventListener(t,this.show)})),n&&n.forEach((t=>{this.rootEl.removeEventListener(t,this.hide)}))}configChangeHandler(){this.props.display?this.popperInstance=at(this.rootEl,this.tooltipEl,this._config.option):this.props.display&&(this.popperInstance?this.popperInstance.destroy():this.popperInstance=null)}createProxy(){var t;this._props=new Proxy(this.props,null!==(t=this._config.proxyHandler)&&void 0!==t?t:{set:(t,n,e,r)=>(this.props=Object.assign(Object.assign({},t),{[n]:e}),Reflect.set(t,n,e,r))})}render(){const{classList:t,arrow:r}=this._config,o=t.tooltip+(this.props.display?"":" !hidden");return n(e,{class:"relative"},n("slot",null),n("div",{ref:t=>this.tooltipEl=t,class:o},n("slot",{name:"tooltip"}),r?n("div",{id:"arrow","data-popper-arrow":!0},n("div",{class:t.arrow})):null))}get rootEl(){return r(this)}static get watchers(){return{props:["configChangeHandler"]}}};ut.style="cdp-tooltip div[data-popper-placement^='top']>#arrow{bottom:-4px}cdp-tooltip div[data-popper-placement^='bottom']>#arrow{top:-4px}cdp-tooltip div[data-popper-placement^='left']>#arrow{right:-4px}cdp-tooltip div[data-popper-placement^='right']>#arrow{left:-4px}";export{ut as cdp_tooltip}