UNPKG

@popperjs/svelte

Version:

Svelte wrapper for Popper - the positioning library

3 lines (2 loc) 26 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).SveltePopper=t()}(this,(function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function r(e){e.forEach(t)}function o(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,r){return e[1]&&r?function(e,t){for(const n in t)e[n]=t[n];return e}(n.ctx.slice(),e[1](r(t))):n.ctx}function s(e){e.parentNode.removeChild(e)}let f;function c(e){f=e}function p(e){(function(){if(!f)throw new Error("Function called outside component initialization");return f})().$$.on_destroy.push(e)}const u=[],l=[],d=[],m=[],h=Promise.resolve();let g=!1;function y(e){d.push(e)}let b=!1;const v=new Set;function x(){if(!b){b=!0;do{for(let e=0;e<u.length;e+=1){const t=u[e];c(t),w(t.$$)}for(u.length=0;l.length;)l.pop()();for(let e=0;e<d.length;e+=1){const t=d[e];v.has(t)||(v.add(t),t())}d.length=0}while(u.length);for(;m.length;)m.pop()();g=!1,b=!1,v.clear()}}function w(e){if(null!==e.fragment){e.update(),r(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(y)}}const O=new Set;function E(e,t){e&&e.i&&(O.delete(e),e.i(t))}function $(e,t){-1===e.$$.dirty[0]&&(u.push(e),g||(g=!0,h.then(x)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function j(i,a,p,u,l,d,m=[-1]){const h=f;c(i);const g=a.props||{},b=i.$$={fragment:null,ctx:null,props:d,update:e,not_equal:l,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(h?h.$$.context:[]),callbacks:n(),dirty:m};let v=!1;if(b.ctx=p?p(i,g,(e,t,...n)=>{const r=n.length?n[0]:t;return b.ctx&&l(b.ctx[e],b.ctx[e]=r)&&(b.bound[e]&&b.bound[e](r),v&&$(i,e)),t}):[],b.update(),v=!0,r(b.before_update),b.fragment=!!u&&u(b.ctx),a.target){if(a.hydrate){const e=(w=a.target,Array.from(w.childNodes));b.fragment&&b.fragment.l(e),e.forEach(s)}else b.fragment&&b.fragment.c();a.intro&&E(i.$$.fragment),function(e,n,i){const{fragment:a,on_mount:s,on_destroy:f,after_update:c}=e.$$;a&&a.m(n,i),y(()=>{const n=s.map(t).filter(o);f?f.push(...n):r(n),e.$$.on_mount=[]}),c.forEach(y)}(i,a.target,a.anchor),x()}var w;c(h)}const 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 k(e){if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t?t.defaultView:window}return e}function M(e){var t=k(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function P(e){return e instanceof k(e).Element||e instanceof Element}function _(e){return e instanceof k(e).HTMLElement||e instanceof HTMLElement}function q(e){return e?(e.nodeName||"").toLowerCase():null}function L(e){return(P(e)?e.ownerDocument:e.document).documentElement}function N(e){return S(L(e)).left+M(e).scrollLeft}function A(e,t,n){var r;void 0===n&&(n=!1);var o,i,a=S(e),s={scrollLeft:0,scrollTop:0},f={x:0,y:0};return n||("body"!==q(t)&&(s=(o=t)!==k(o)&&_(o)?{scrollLeft:(i=o).scrollLeft,scrollTop:i.scrollTop}:M(o)),_(t)?((f=S(t)).x+=t.clientLeft,f.y+=t.clientTop):(r=L(t))&&(f.x=N(r))),{x:a.left+s.scrollLeft-f.x,y:a.top+s.scrollTop-f.y,width:a.width,height:a.height}}function B(e){return{x:e.offsetLeft,y:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}}function T(e){return"html"===q(e)?e:e.assignedSlot||e.parentNode||e.host||L(e)}function W(e){return k(e).getComputedStyle(e)}function H(e,t){void 0===t&&(t=[]);var n=function e(t){if(["html","body","#document"].indexOf(q(t))>=0)return t.ownerDocument.body;if(_(t)){var n=W(t),r=n.overflow,o=n.overflowX,i=n.overflowY;if(/auto|scroll|overlay|hidden/.test(r+i+o))return t}return e(T(t))}(e),r="body"===q(n),o=k(n),i=r?[o].concat(o.visualViewport||[]):n,a=t.concat(i);return r?a:a.concat(H(T(i)))}function C(e){return["table","td","th"].indexOf(q(e))>=0}function R(e){return _(e)&&"fixed"!==W(e).position?e.offsetParent:null}function V(e){for(var t=k(e),n=R(e);n&&C(n);)n=R(n);return n&&"body"===q(n)&&"static"===W(n).position?t:n||t}var I="top",F="bottom",z="right",U="left",X=[I,F,z,U],Y=X.reduce((function(e,t){return e.concat([t+"-start",t+"-end"])}),[]),J=[].concat(X,["auto"]).reduce((function(e,t){return e.concat([t,t+"-start",t+"-end"])}),[]),G=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function K(e){var t=new Map,n=new Set,r=[];return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||function e(o){n.add(o.name),[].concat(o.requires||[],o.requiresIfExists||[]).forEach((function(r){if(!n.has(r)){var o=t.get(r);o&&e(o)}})),r.push(o)}(e)})),r}function Q(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return[].concat(n).reduce((function(e,t){return e.replace(/%s/,t)}),e)}var Z='Popper: modifier "%s" provided an invalid %s property, expected %s but got %s',ee=["name","enabled","phase","fn","effect","requires","options"];function te(e){return e.split("-")[0]}var ne="Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.",re={placement:"bottom",modifiers:[],strategy:"absolute"};function oe(){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 ie(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,r=void 0===n?[]:n,o=t.defaultOptions,i=void 0===o?re:o;return function(e,t,n){void 0===n&&(n=i);var o,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},re,{},i),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},f=[],c=!1,p={state:s,setOptions:function(n){u(),s.options=Object.assign({},i,{},s.options,{},n),s.scrollParents={reference:P(e)?H(e):e.contextElement?H(e.contextElement):[],popper:H(t)};var o,a,c,l=function(e){var t=K(e);return G.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}(function(e){var t=e.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}),{});return Object.keys(t).map((function(e){return t[e]}))}([].concat(r,s.options.modifiers)));if(s.orderedModifiers=l.filter((function(e){return e.enabled})),"production"!==process.env.NODE_ENV){if(function(e){e.forEach((function(t){Object.keys(t).forEach((function(n){switch(n){case"name":"string"!=typeof t.name&&console.error(Q(Z,String(t.name),'"name"','"string"','"'+String(t.name)+'"'));break;case"enabled":"boolean"!=typeof t.enabled&&console.error(Q(Z,t.name,'"enabled"','"boolean"','"'+String(t.enabled)+'"'));case"phase":G.indexOf(t.phase)<0&&console.error(Q(Z,t.name,'"phase"',"either "+G.join(", "),'"'+String(t.phase)+'"'));break;case"fn":"function"!=typeof t.fn&&console.error(Q(Z,t.name,'"fn"','"function"','"'+String(t.fn)+'"'));break;case"effect":"function"!=typeof t.effect&&console.error(Q(Z,t.name,'"effect"','"function"','"'+String(t.fn)+'"'));break;case"requires":Array.isArray(t.requires)||console.error(Q(Z,t.name,'"requires"','"array"','"'+String(t.requires)+'"'));break;case"requiresIfExists":Array.isArray(t.requiresIfExists)||console.error(Q(Z,t.name,'"requiresIfExists"','"array"','"'+String(t.requiresIfExists)+'"'));break;case"options":case"data":break;default:console.error('PopperJS: an invalid property has been provided to the "'+t.name+'" modifier, valid properties are '+ee.map((function(e){return'"'+e+'"'})).join(", ")+'; but "'+n+'" was provided.')}t.requires&&t.requires.forEach((function(n){null==e.find((function(e){return e.name===n}))&&console.error(Q('Popper: modifier "%s" requires "%s", but "%s" modifier is not available',String(t.name),n,n))}))}))}))}((o=[].concat(l,s.options.modifiers),a=function(e){return e.name},c=new Set,o.filter((function(e){var t=a(e);if(!c.has(t))return c.add(t),!0})))),"auto"===te(s.options.placement))s.orderedModifiers.find((function(e){return"flip"===e.name}))||console.error(['Popper: "auto" placements require the "flip" modifier be',"present and enabled to work."].join(" "));var d=W(t);[d.marginTop,d.marginRight,d.marginBottom,d.marginLeft].some((function(e){return parseFloat(e)}))&&console.warn(['Popper: CSS "margin" styles cannot be used to apply padding',"between the popper and its reference element or boundary.","To replicate margin, use the `offset` modifier, as well as","the `padding` option in the `preventOverflow` and `flip`","modifiers."].join(" "))}return 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});f.push(i||function(){})}})),p.update()},forceUpdate:function(){if(!c){var e=s.elements,t=e.reference,n=e.popper;if(oe(t,n)){s.rects={reference:A(t,V(n),"fixed"===s.options.strategy),popper:B(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,o=0;o<s.orderedModifiers.length;o++){if("production"!==process.env.NODE_ENV&&(r+=1)>100){console.error("Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.");break}if(!0!==s.reset){var i=s.orderedModifiers[o],a=i.fn,f=i.options,u=void 0===f?{}:f,l=i.name;"function"==typeof a&&(s=a({state:s,options:u,name:l,instance:p})||s)}else s.reset=!1,o=-1}}else"production"!==process.env.NODE_ENV&&console.error(ne)}},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(!oe(e,t))return"production"!==process.env.NODE_ENV&&console.error(ne),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 ae={passive:!0};function se(e){return e.split("-")[1]}function fe(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function ce(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?te(o):null,a=o?se(o):null,s=n.x+n.width/2-r.width/2,f=n.y+n.height/2-r.height/2;switch(i){case I:t={x:s,y:n.y-r.height};break;case F:t={x:s,y:n.y+n.height};break;case z:t={x:n.x+n.width,y:f};break;case U:t={x:n.x-r.width,y:f};break;default:t={x:n.x,y:n.y}}var c=i?fe(i):null;if(null!=c){var p="y"===c?"height":"width";switch(a){case"start":t[c]=Math.floor(t[c])-Math.floor(n[p]/2-r[p]/2);break;case"end":t[c]=Math.floor(t[c])+Math.ceil(n[p]/2-r[p]/2)}}return t}var pe={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ue(e){var t,n=e.popper,r=e.popperRect,o=e.placement,i=e.offsets,a=e.position,s=e.gpuAcceleration,f=e.adaptive,c=function(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:Math.round(t*r)/r||0,y:Math.round(n*r)/r||0}}(i),p=c.x,u=c.y,l=i.hasOwnProperty("x"),d=i.hasOwnProperty("y"),m=U,h=I,g=window;if(f){var y=V(n);y===k(n)&&(y=L(n)),o===I&&(h=F,u-=y.clientHeight-r.height,u*=s?1:-1),o===U&&(m=z,p-=y.clientWidth-r.width,p*=s?1:-1)}var b,v=Object.assign({position:a},f&&pe);return s?Object.assign({},v,((b={})[h]=d?"0":"",b[m]=l?"0":"",b.transform=(g.devicePixelRatio||1)<2?"translate("+p+"px, "+u+"px)":"translate3d("+p+"px, "+u+"px, 0)",b)):Object.assign({},v,((t={})[h]=d?u+"px":"",t[m]=l?p+"px":"",t.transform="",t))}var le={left:"right",right:"left",bottom:"top",top:"bottom"};function de(e){return e.replace(/left|right|bottom|top/g,(function(e){return le[e]}))}var me={start:"end",end:"start"};function he(e){return e.replace(/start|end/g,(function(e){return me[e]}))}function ge(e){return parseFloat(e)||0}function ye(e){var t=k(e),n=function(e){var t=_(e)?W(e):{};return{top:ge(t.borderTopWidth),right:ge(t.borderRightWidth),bottom:ge(t.borderBottomWidth),left:ge(t.borderLeftWidth)}}(e),r="html"===q(e),o=N(e),i=e.clientWidth+n.right,a=e.clientHeight+n.bottom;return r&&t.innerHeight-e.clientHeight>50&&(a=t.innerHeight-n.bottom),{top:r?0:e.clientTop,right:e.clientLeft>n.left?n.right:r?t.innerWidth-i-o:e.offsetWidth-i,bottom:r?t.innerHeight-a:e.offsetHeight-a,left:r?o:e.clientLeft}}function be(e,t){var n=Boolean(t.getRootNode&&t.getRootNode().host);if(e.contains(t))return!0;if(n){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ve(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function xe(e,t){return"viewport"===t?ve(function(e){var t=k(e),n=t.visualViewport,r=t.innerWidth,o=t.innerHeight;return n&&/iPhone|iPod|iPad/.test(navigator.platform)&&(r=n.width,o=n.height),{width:r,height:o,x:0,y:0}}(e)):_(t)?S(t):ve(function(e){var t=k(e),n=M(e),r=A(L(e),t);return r.height=Math.max(r.height,t.innerHeight),r.width=Math.max(r.width,t.innerWidth),r.x=-n.scrollLeft,r.y=-n.scrollTop,r}(L(e)))}function we(e,t,n){var r="clippingParents"===t?function(e){var t=H(e),n=["absolute","fixed"].indexOf(W(e).position)>=0&&_(e)?V(e):e;return P(n)?t.filter((function(e){return P(e)&&be(e,n)})):[]}(e):[].concat(t),o=[].concat(r,[n]),i=o[0],a=o.reduce((function(t,n){var r=xe(e,n),o=ye(_(n)?n:L(e));return t.top=Math.max(r.top+o.top,t.top),t.right=Math.min(r.right-o.right,t.right),t.bottom=Math.min(r.bottom-o.bottom,t.bottom),t.left=Math.max(r.left+o.left,t.left),t}),xe(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 Oe(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},{},e)}function Ee(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function $e(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=void 0===r?e.placement:r,i=n.boundary,a=void 0===i?"clippingParents":i,s=n.rootBoundary,f=void 0===s?"viewport":s,c=n.elementContext,p=void 0===c?"popper":c,u=n.altBoundary,l=void 0!==u&&u,d=n.padding,m=void 0===d?0:d,h=Oe("number"!=typeof m?m:Ee(m,X)),g="popper"===p?"reference":"popper",y=e.elements.reference,b=e.rects.popper,v=e.elements[l?g:p],x=we(P(v)?v:v.contextElement||L(e.elements.popper),a,f),w=S(y),O=ce({reference:w,element:b,strategy:"absolute",placement:o}),E=ve(Object.assign({},b,{},O)),$="popper"===p?E:w,j={top:x.top-$.top+h.top,bottom:$.bottom-x.bottom+h.bottom,left:x.left-$.left+h.left,right:$.right-x.right+h.right},D=e.modifiersData.offset;if("popper"===p&&D){var k=D[o];Object.keys(j).forEach((function(e){var t=[z,F].indexOf(e)>=0?1:-1,n=[I,F].indexOf(e)>=0?"y":"x";j[e]+=k[n]*t}))}return j}function je(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=void 0===f?J:f,p=se(r),u=(p?s?Y:Y.filter((function(e){return se(e)===p})):X).filter((function(e){return c.indexOf(e)>=0})).reduce((function(t,n){return t[n]=$e(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[te(n)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}function De(e,t,n){return Math.max(e,Math.min(t,n))}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 ke(e){return[I,z,F,U].some((function(t){return e[t]>=0}))}var Me=ie({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=k(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&c.forEach((function(e){e.addEventListener("scroll",n.update,ae)})),s&&f.addEventListener("resize",n.update,ae),function(){i&&c.forEach((function(e){e.removeEventListener("scroll",n.update,ae)})),s&&f.removeEventListener("resize",n.update,ae)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=ce({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,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i;if("production"!==process.env.NODE_ENV){var s=W(t.elements.popper).transitionProperty||"";a&&["transform","top","right","bottom","left"].some((function(e){return s.indexOf(e)>=0}))&&console.warn(["Popper: Detected CSS transitions on at least one of the following",'CSS properties: "transform", "top", "right", "bottom", "left".',"\n\n",'Disable the "computeStyles" modifier\'s `adaptive` option to allow',"for smooth transitions, or remove these properties from the CSS","transition declaration on the popper element if only transitioning","opacity or background-color for example.","\n\n","We recommend using the popper element as a wrapper around an inner","element that can have any CSS property transitioned for animations."].join(" "))}var f={placement:te(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,{},ue(Object.assign({},f,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,{},ue(Object.assign({},f,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1})))),t.attributes.popper=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]||{},r=t.attributes[e]||{},o=t.elements[e];_(o)&&q(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.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}),{});_(r)&&q(r)&&(Object.assign(r.style,i),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,a=J.reduce((function(e,n){return e[n]=function(e,t,n){var r=te(e),o=[U,I].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[U,z].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],f=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.fallbackPlacements,i=n.padding,a=n.boundary,s=n.rootBoundary,f=n.altBoundary,c=n.flipVariations,p=void 0===c||c,u=n.allowedAutoPlacements,l=t.options.placement,d=te(l),m=o||(d===l||!p?[de(l)]:function(e){if("auto"===te(e))return[];var t=de(e);return[he(e),t,he(t)]}(l)),h=[l].concat(m).reduce((function(e,n){return e.concat("auto"===te(n)?je(t,{placement:n,boundary:a,rootBoundary:s,padding:i,flipVariations:p,allowedAutoPlacements:u}):n)}),[]),g=t.rects.reference,y=t.rects.popper,b=new Map,v=!0,x=h[0],w=0;w<h.length;w++){var O=h[w],E=te(O),$="start"===se(O),j=[I,F].indexOf(E)>=0,D=j?"width":"height",S=$e(t,{placement:O,boundary:a,rootBoundary:s,altBoundary:f,padding:i}),k=j?$?z:U:$?F:I;g[D]>y[D]&&(k=de(k));var M=de(k),P=[S[E]<=0,S[k]<=0,S[M]<=0];if(P.every((function(e){return e}))){x=O,v=!1;break}b.set(O,P)}if(v)for(var _=function(e){var t=h.find((function(t){var n=b.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return x=t,"break"},q=p?3:1;q>0;q--){if("break"===_(q))break}t.placement!==x&&(t.modifiersData[r]._skip=!0,t.placement=x,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0!==a&&a,f=n.boundary,c=n.rootBoundary,p=n.altBoundary,u=n.padding,l=n.tether,d=void 0===l||l,m=n.tetherOffset,h=void 0===m?0:m,g=$e(t,{boundary:f,rootBoundary:c,padding:u,altBoundary:p}),y=te(t.placement),b=se(t.placement),v=!b,x=fe(y),w="x"===x?"y":"x",O=t.modifiersData.popperOffsets,E=t.rects.reference,$=t.rects.popper,j="function"==typeof h?h(Object.assign({},t.rects,{placement:t.placement})):h,D={x:0,y:0};if(O){if(i){var S="y"===x?I:U,k="y"===x?F:z,M="y"===x?"height":"width",P=O[x],_=O[x]+g[S],q=O[x]-g[k],L=d?-$[M]/2:0,N="start"===b?E[M]:$[M],A="start"===b?-$[M]:-E[M],T=t.elements.arrow,W=d&&T?B(T):{width:0,height:0},H=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},C=H[S],R=H[k],X=De(0,E[M],W[M]),Y=v?E[M]/2-L-X-C-j:N-X-C-j,J=v?-E[M]/2+L+X+R+j:A+X+R+j,G=t.elements.arrow&&V(t.elements.arrow),K=G?"y"===x?G.clientTop||0:G.clientLeft||0:0,Q=t.modifiersData.offset?t.modifiersData.offset[t.placement][x]:0,Z=O[x]+Y-Q-K,ee=O[x]+J-Q,ne=De(d?Math.min(_,Z):_,P,d?Math.max(q,ee):q);O[x]=ne,D[x]=ne-P}if(s){var re="x"===x?I:U,oe="x"===x?F:z,ie=O[w],ae=De(ie+g[re],ie,ie-g[oe]);O[w]=ae,D[w]=ae-ie}t.modifiersData[r]=D}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=n.elements.arrow,i=n.modifiersData.popperOffsets,a=te(n.placement),s=fe(a),f=[U,z].indexOf(a)>=0?"height":"width";if(o&&i){var c=n.modifiersData[r+"#persistent"].padding,p=B(o),u="y"===s?I:U,l="y"===s?F:z,d=n.rects.reference[f]+n.rects.reference[s]-i[s]-n.rects.popper[f],m=i[s]-n.rects.reference[s],h=n.elements.arrow&&V(n.elements.arrow),g=h?"y"===s?h.clientHeight||0:h.clientWidth||0:0,y=d/2-m/2,b=c[u],v=g-p[f]-c[l],x=g/2-p[f]/2+y,w=De(b,x,v),O=s;n.modifiersData[r]=((t={})[O]=w,t.centerOffset=w-x,t)}},effect:function(e){var t=e.state,n=e.options,r=e.name,o=n.element,i=void 0===o?"[data-popper-arrow]":o,a=n.padding,s=void 0===a?0:a;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&(be(t.elements.popper,i)?(t.elements.arrow=i,t.modifiersData[r+"#persistent"]={padding:Oe("number"!=typeof s?s:Ee(s,X))}):"production"!==process.env.NODE_ENV&&console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper',"element."].join(" ")))},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{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=$e(t,{elementContext:"reference"}),s=$e(t,{altBoundary:!0}),f=Se(a,r),c=Se(s,o,i),p=ke(f),u=ke(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})}}]});function Pe(e){let t;const n=e[13].default,r=function(e,t,n,r){if(e){const o=a(e,t,n,r);return e[0](o)}}(n,e,e[12],null);return{c(){r&&r.c()},m(e,n){r&&r.m(e,n),t=!0},p(e,[t]){r&&r.p&&4096&t&&r.p(a(n,e,e[12],null),function(e,t,n,r){if(e[2]&&r){const o=e[2](r(n));if(void 0===t.dirty)return o;if("object"==typeof o){const e=[],n=Math.max(t.dirty.length,o.length);for(let r=0;r<n;r+=1)e[r]=t.dirty[r]|o[r];return e}return t.dirty|o}return t.dirty}(n,e[12],t,null))},i(e){t||(E(r,e),t=!0)},o(e){!function(e,t,n,r){if(e&&e.o){if(O.has(e))return;O.add(e),(void 0).c.push(()=>{O.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}}(r,e),t=!1},d(e){r&&r.d(e)}}}function _e(t,n,r){let o,a=e;t.$$.on_destroy.push(()=>a());let{reference:s}=n,{popper:f}=n,{options:c={}}=n;const u=function(t,n=e){let r;const o=[];function a(e){if(i(t,e)&&(t=e,r)){const e=!D.length;for(let e=0;e<o.length;e+=1){const n=o[e];n[1](),D.push(n,t)}if(e){for(let e=0;e<D.length;e+=2)D[e][0](D[e+1]);D.length=0}}}return{set:a,update:function(e){a(e(t))},subscribe:function(i,s=e){const f=[i,s];return o.push(f),1===o.length&&(r=n(a)||e),i(t),()=>{const e=o.indexOf(f);-1!==e&&o.splice(e,1),0===o.length&&(r(),r=null)}}}}({});let l,d,m;a(),a=function(t,...n){if(null==t)return e;const r=t.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(u,e=>r(10,o=e));const h={name:"updateState",enabled:!0,phase:"write",fn:({state:e})=>u.set(e)};p(()=>{m&&m.destroy(),r(9,m=null)});let{styles:g={}}=n,{attributes:y={}}=n,{state:b={}}=n,{$$slots:v={},$$scope:x}=n;return t.$set=e=>{"reference"in e&&r(4,s=e.reference),"popper"in e&&r(5,f=e.popper),"options"in e&&r(6,c=e.options),"styles"in e&&r(1,g=e.styles),"attributes"in e&&r(2,y=e.attributes),"state"in e&&r(3,b=e.state),"$$scope"in e&&r(12,x=e.$$scope)},t.$$.update=()=>{1008&t.$$.dirty&&(d==f&&l==l||(m&&m.destroy(),null!=s&&null!=f&&(r(9,m=Me(s,f,{...c,modifiers:[...c.modifiers,h,{name:"applyStyles",enabled:!1}]})),r(8,d=f),r(7,l=s)))),576&t.$$.dirty&&null!=m&&m.setOptions({...c,modifiers:[...c.modifiers,h,{name:"applyStyles",enabled:!1}]}),1024&t.$$.dirty&&r(1,g=o.styles||{}),1024&t.$$.dirty&&r(2,y=o.attributes||{}),1024&t.$$.dirty&&r(3,b=o)},[u,g,y,b,s,f,c,l,d,m,o,h,x,v]}return class extends class{$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(r(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(),j(this,e,_e,Pe,i,{reference:4,popper:5,options:6,store:0,styles:1,attributes:2,state:3})}get store(){return this.$$.ctx[0]}}})); //# sourceMappingURL=svelte-popper.js.map