UNPKG

flyonui

Version:

The easiest, free and open-source Tailwind CSS component library with semantic classes.

16 lines 64.5 kB
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(self,(()=>(()=>{"use strict";var t={287:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});e.default=class{constructor(t,e,i){this.el=t,this.options=e,this.events=i,this.el=t,this.options=e,this.events={}}createCollection(t,e){var i;t.push({id:(null===(i=null==e?void 0:e.el)||void 0===i?void 0:i.id)||t.length+1,element:e})}fireEvent(t,e=null){if(this.events.hasOwnProperty(t))return this.events[t](e)}on(t,e){this.events[t]=e}}},806:function(t,e){ /* * @version: 3.0.1 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ Object.defineProperty(e,"__esModule",{value:!0}),e.menuSearchHistory=e.classToClassList=e.htmlToElement=e.afterTransition=e.dispatch=e.debounce=e.isScrollable=e.isParentOrElementHidden=e.isJson=e.isIpadOS=e.isIOS=e.isDirectChild=e.isFormElement=e.isFocused=e.isEnoughSpace=e.getHighestZIndex=e.getZIndex=e.getClassPropertyAlt=e.getClassProperty=e.stringToBoolean=void 0;e.stringToBoolean=t=>"true"===t;e.getClassProperty=(t,e,i="")=>(window.getComputedStyle(t).getPropertyValue(e)||i).replace(" ","");e.getClassPropertyAlt=(t,e,i="")=>{let s="";return t.classList.forEach((t=>{t.includes(e)&&(s=t)})),s.match(/:(.*)]/)?s.match(/:(.*)]/)[1]:i};const i=t=>window.getComputedStyle(t).getPropertyValue("z-index");e.getZIndex=i;e.getHighestZIndex=t=>{let e=Number.NEGATIVE_INFINITY;return t.forEach((t=>{let s=i(t);"auto"!==s&&(s=parseInt(s,10),s>e&&(e=s))})),e};e.isDirectChild=(t,e)=>{const i=t.children;for(let t=0;t<i.length;t++)if(i[t]===e)return!0;return!1};e.isEnoughSpace=(t,e,i="auto",s=10,n=null)=>{const o=e.getBoundingClientRect(),l=n?n.getBoundingClientRect():null,r=window.innerHeight,a=l?o.top-l.top:o.top,c=(n?l.bottom:r)-o.bottom,d=t.clientHeight+s;return"bottom"===i?c>=d:"top"===i?a>=d:a>=d||c>=d};e.isFocused=t=>document.activeElement===t;e.isFormElement=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement;e.isIOS=()=>!!/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform);e.isIpadOS=()=>navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform);e.isJson=t=>{if("string"!=typeof t)return!1;const e=t.trim()[0],i=t.trim().slice(-1);if("{"===e&&"}"===i||"["===e&&"]"===i)try{return JSON.parse(t),!0}catch(t){return!1}return!1};const s=t=>{if(!t)return!1;return"none"===window.getComputedStyle(t).display||s(t.parentElement)};e.isParentOrElementHidden=s;e.isScrollable=t=>{const e=window.getComputedStyle(t),i=e.overflowY,s=e.overflowX,n=("scroll"===i||"auto"===i)&&t.scrollHeight>t.clientHeight,o=("scroll"===s||"auto"===s)&&t.scrollWidth>t.clientWidth;return n||o};e.debounce=(t,e=200)=>{let i;return(...s)=>{clearTimeout(i),i=setTimeout((()=>{t.apply(this,s)}),e)}};e.dispatch=(t,e,i=null)=>{const s=new CustomEvent(t,{detail:{payload:i},bubbles:!0,cancelable:!0,composed:!1});e.dispatchEvent(s)};e.afterTransition=(t,e)=>{const i=()=>{e(),t.removeEventListener("transitionend",i,!0)},s=window.getComputedStyle(t),n=s.getPropertyValue("transition-duration");"none"!==s.getPropertyValue("transition-property")&&parseFloat(n)>0?t.addEventListener("transitionend",i,!0):e()};e.htmlToElement=t=>{const e=document.createElement("template");return t=t.trim(),e.innerHTML=t,e.content.firstChild};e.classToClassList=(t,e,i=" ",s="add")=>{t.split(i).forEach((t=>"add"===s?e.classList.add(t):e.classList.remove(t)))};const n={historyIndex:-1,addHistory(t){this.historyIndex=t},existsInHistory(t){return t>this.historyIndex},clearHistory(){this.historyIndex=-1}};e.menuSearchHistory=n},917:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BREAKPOINTS=e.COMBO_BOX_ACCESSIBILITY_KEY_SET=e.SELECT_ACCESSIBILITY_KEY_SET=e.TABS_ACCESSIBILITY_KEY_SET=e.OVERLAY_ACCESSIBILITY_KEY_SET=e.DROPDOWN_ACCESSIBILITY_KEY_SET=e.POSITIONS=void 0,e.POSITIONS={auto:"auto","auto-start":"auto-start","auto-end":"auto-end",top:"top","top-start":"top-start","top-end":"top-end",bottom:"bottom","bottom-start":"bottom-start","bottom-end":"bottom-end",right:"right","right-start":"right-start","right-end":"right-end",left:"left","left-start":"left-start","left-end":"left-end"},e.DROPDOWN_ACCESSIBILITY_KEY_SET=["Escape","ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Home","End","Enter"],e.OVERLAY_ACCESSIBILITY_KEY_SET=["Escape","Tab"],e.TABS_ACCESSIBILITY_KEY_SET=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End"],e.SELECT_ACCESSIBILITY_KEY_SET=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End","Escape","Enter","Space","Tab"],e.COMBO_BOX_ACCESSIBILITY_KEY_SET=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End","Escape","Enter"],e.BREAKPOINTS={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536}},949:(t,e,i)=>{i.r(e),i.d(e,{arrow:()=>bt,autoPlacement:()=>mt,autoUpdate:()=>pt,computePosition:()=>xt,detectOverflow:()=>gt,flip:()=>wt,getOverflowAncestors:()=>Q,hide:()=>It,inline:()=>Tt,limitShift:()=>St,offset:()=>ft,platform:()=>ht,shift:()=>vt,size:()=>yt});const s=["top","right","bottom","left"],n=["start","end"],o=s.reduce(((t,e)=>t.concat(e,e+"-"+n[0],e+"-"+n[1])),[]),l=Math.min,r=Math.max,a=Math.round,c=Math.floor,d=t=>({x:t,y:t}),h={left:"right",right:"left",bottom:"top",top:"bottom"},u={start:"end",end:"start"};function p(t,e,i){return r(t,l(e,i))}function g(t,e){return"function"==typeof t?t(e):t}function f(t){return t.split("-")[0]}function m(t){return t.split("-")[1]}function v(t){return"x"===t?"y":"x"}function w(t){return"y"===t?"height":"width"}function y(t){return["top","bottom"].includes(f(t))?"y":"x"}function I(t){return v(y(t))}function b(t,e,i){void 0===i&&(i=!1);const s=m(t),n=I(t),o=w(n);let l="x"===n?s===(i?"end":"start")?"right":"left":"start"===s?"bottom":"top";return e.reference[o]>e.floating[o]&&(l=S(l)),[l,S(l)]}function T(t){return t.replace(/start|end/g,(t=>u[t]))}function S(t){return t.replace(/left|right|bottom|top/g,(t=>h[t]))}function x(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function C(t){const{x:e,y:i,width:s,height:n}=t;return{width:s,height:n,top:i,left:e,right:e+s,bottom:i+n,x:e,y:i}}function E(t,e,i){let{reference:s,floating:n}=t;const o=y(e),l=I(e),r=w(l),a=f(e),c="y"===o,d=s.x+s.width/2-n.width/2,h=s.y+s.height/2-n.height/2,u=s[r]/2-n[r]/2;let p;switch(a){case"top":p={x:d,y:s.y-n.height};break;case"bottom":p={x:d,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:h};break;case"left":p={x:s.x-n.width,y:h};break;default:p={x:s.x,y:s.y}}switch(m(e)){case"start":p[l]-=u*(i&&c?-1:1);break;case"end":p[l]+=u*(i&&c?-1:1)}return p}async function L(t,e){var i;void 0===e&&(e={});const{x:s,y:n,platform:o,rects:l,elements:r,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:u=!1,padding:p=0}=g(e,t),f=x(p),m=r[u?"floating"===h?"reference":"floating":h],v=C(await o.getClippingRect({element:null==(i=await(null==o.isElement?void 0:o.isElement(m)))||i?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(r.floating)),boundary:c,rootBoundary:d,strategy:a})),w="floating"===h?{x:s,y:n,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(r.floating)),I=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},b=C(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:w,offsetParent:y,strategy:a}):w);return{top:(v.top-b.top+f.top)/I.y,bottom:(b.bottom-v.bottom+f.bottom)/I.y,left:(v.left-b.left+f.left)/I.x,right:(b.right-v.right+f.right)/I.x}}function A(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function O(t){return s.some((e=>t[e]>=0))}function M(t){const e=l(...t.map((t=>t.left))),i=l(...t.map((t=>t.top)));return{x:e,y:i,width:r(...t.map((t=>t.right)))-e,height:r(...t.map((t=>t.bottom)))-i}}function P(){return"undefined"!=typeof window}function R(t){return $(t)?(t.nodeName||"").toLowerCase():"#document"}function D(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function F(t){var e;return null==(e=($(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function $(t){return!!P()&&(t instanceof Node||t instanceof D(t).Node)}function H(t){return!!P()&&(t instanceof Element||t instanceof D(t).Element)}function k(t){return!!P()&&(t instanceof HTMLElement||t instanceof D(t).HTMLElement)}function q(t){return!(!P()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof D(t).ShadowRoot)}function W(t){const{overflow:e,overflowX:i,overflowY:s,display:n}=Y(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+i)&&!["inline","contents"].includes(n)}function _(t){return["table","td","th"].includes(R(t))}function N(t){return[":popover-open",":modal"].some((e=>{try{return t.matches(e)}catch(t){return!1}}))}function B(t){const e=V(),i=H(t)?Y(t):t;return["transform","translate","scale","rotate","perspective"].some((t=>!!i[t]&&"none"!==i[t]))||!!i.containerType&&"normal"!==i.containerType||!e&&!!i.backdropFilter&&"none"!==i.backdropFilter||!e&&!!i.filter&&"none"!==i.filter||["transform","translate","scale","rotate","perspective","filter"].some((t=>(i.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(i.contain||"").includes(t)))}function V(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function U(t){return["html","body","#document"].includes(R(t))}function Y(t){return D(t).getComputedStyle(t)}function j(t){return H(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function K(t){if("html"===R(t))return t;const e=t.assignedSlot||t.parentNode||q(t)&&t.host||F(t);return q(e)?e.host:e}function z(t){const e=K(t);return U(e)?t.ownerDocument?t.ownerDocument.body:t.body:k(e)&&W(e)?e:z(e)}function Q(t,e,i){var s;void 0===e&&(e=[]),void 0===i&&(i=!0);const n=z(t),o=n===(null==(s=t.ownerDocument)?void 0:s.body),l=D(n);if(o){const t=J(l);return e.concat(l,l.visualViewport||[],W(n)?n:[],t&&i?Q(t):[])}return e.concat(n,Q(n,[],i))}function J(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function X(t){const e=Y(t);let i=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const n=k(t),o=n?t.offsetWidth:i,l=n?t.offsetHeight:s,r=a(i)!==o||a(s)!==l;return r&&(i=o,s=l),{width:i,height:s,$:r}}function Z(t){return H(t)?t:t.contextElement}function G(t){const e=Z(t);if(!k(e))return d(1);const i=e.getBoundingClientRect(),{width:s,height:n,$:o}=X(e);let l=(o?a(i.width):i.width)/s,r=(o?a(i.height):i.height)/n;return l&&Number.isFinite(l)||(l=1),r&&Number.isFinite(r)||(r=1),{x:l,y:r}}const tt=d(0);function et(t){const e=D(t);return V()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:tt}function it(t,e,i,s){void 0===e&&(e=!1),void 0===i&&(i=!1);const n=t.getBoundingClientRect(),o=Z(t);let l=d(1);e&&(s?H(s)&&(l=G(s)):l=G(t));const r=function(t,e,i){return void 0===e&&(e=!1),!(!i||e&&i!==D(t))&&e}(o,i,s)?et(o):d(0);let a=(n.left+r.x)/l.x,c=(n.top+r.y)/l.y,h=n.width/l.x,u=n.height/l.y;if(o){const t=D(o),e=s&&H(s)?D(s):s;let i=t,n=J(i);for(;n&&s&&e!==i;){const t=G(n),e=n.getBoundingClientRect(),s=Y(n),o=e.left+(n.clientLeft+parseFloat(s.paddingLeft))*t.x,l=e.top+(n.clientTop+parseFloat(s.paddingTop))*t.y;a*=t.x,c*=t.y,h*=t.x,u*=t.y,a+=o,c+=l,i=D(n),n=J(i)}}return C({width:h,height:u,x:a,y:c})}function st(t,e){const i=j(t).scrollLeft;return e?e.left+i:it(F(t)).left+i}function nt(t,e,i){void 0===i&&(i=!1);const s=t.getBoundingClientRect();return{x:s.left+e.scrollLeft-(i?0:st(t,s)),y:s.top+e.scrollTop}}function ot(t,e,i){let s;if("viewport"===e)s=function(t,e){const i=D(t),s=F(t),n=i.visualViewport;let o=s.clientWidth,l=s.clientHeight,r=0,a=0;if(n){o=n.width,l=n.height;const t=V();(!t||t&&"fixed"===e)&&(r=n.offsetLeft,a=n.offsetTop)}return{width:o,height:l,x:r,y:a}}(t,i);else if("document"===e)s=function(t){const e=F(t),i=j(t),s=t.ownerDocument.body,n=r(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),o=r(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let l=-i.scrollLeft+st(t);const a=-i.scrollTop;return"rtl"===Y(s).direction&&(l+=r(e.clientWidth,s.clientWidth)-n),{width:n,height:o,x:l,y:a}}(F(t));else if(H(e))s=function(t,e){const i=it(t,!0,"fixed"===e),s=i.top+t.clientTop,n=i.left+t.clientLeft,o=k(t)?G(t):d(1);return{width:t.clientWidth*o.x,height:t.clientHeight*o.y,x:n*o.x,y:s*o.y}}(e,i);else{const i=et(t);s={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return C(s)}function lt(t,e){const i=K(t);return!(i===e||!H(i)||U(i))&&("fixed"===Y(i).position||lt(i,e))}function rt(t,e,i){const s=k(e),n=F(e),o="fixed"===i,l=it(t,!0,o,e);let r={scrollLeft:0,scrollTop:0};const a=d(0);function c(){a.x=st(n)}if(s||!s&&!o)if(("body"!==R(e)||W(n))&&(r=j(e)),s){const t=it(e,!0,o,e);a.x=t.x+e.clientLeft,a.y=t.y+e.clientTop}else n&&c();o&&!s&&n&&c();const h=!n||s||o?d(0):nt(n,r);return{x:l.left+r.scrollLeft-a.x-h.x,y:l.top+r.scrollTop-a.y-h.y,width:l.width,height:l.height}}function at(t){return"static"===Y(t).position}function ct(t,e){if(!k(t)||"fixed"===Y(t).position)return null;if(e)return e(t);let i=t.offsetParent;return F(t)===i&&(i=i.ownerDocument.body),i}function dt(t,e){const i=D(t);if(N(t))return i;if(!k(t)){let e=K(t);for(;e&&!U(e);){if(H(e)&&!at(e))return e;e=K(e)}return i}let s=ct(t,e);for(;s&&_(s)&&at(s);)s=ct(s,e);return s&&U(s)&&at(s)&&!B(s)?i:s||function(t){let e=K(t);for(;k(e)&&!U(e);){if(B(e))return e;if(N(e))return null;e=K(e)}return null}(t)||i}const ht={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:i,offsetParent:s,strategy:n}=t;const o="fixed"===n,l=F(s),r=!!e&&N(e.floating);if(s===l||r&&o)return i;let a={scrollLeft:0,scrollTop:0},c=d(1);const h=d(0),u=k(s);if((u||!u&&!o)&&(("body"!==R(s)||W(l))&&(a=j(s)),k(s))){const t=it(s);c=G(s),h.x=t.x+s.clientLeft,h.y=t.y+s.clientTop}const p=!l||u||o?d(0):nt(l,a,!0);return{width:i.width*c.x,height:i.height*c.y,x:i.x*c.x-a.scrollLeft*c.x+h.x+p.x,y:i.y*c.y-a.scrollTop*c.y+h.y+p.y}},getDocumentElement:F,getClippingRect:function(t){let{element:e,boundary:i,rootBoundary:s,strategy:n}=t;const o=[..."clippingAncestors"===i?N(e)?[]:function(t,e){const i=e.get(t);if(i)return i;let s=Q(t,[],!1).filter((t=>H(t)&&"body"!==R(t))),n=null;const o="fixed"===Y(t).position;let l=o?K(t):t;for(;H(l)&&!U(l);){const e=Y(l),i=B(l);i||"fixed"!==e.position||(n=null),(o?!i&&!n:!i&&"static"===e.position&&n&&["absolute","fixed"].includes(n.position)||W(l)&&!i&&lt(t,l))?s=s.filter((t=>t!==l)):n=e,l=K(l)}return e.set(t,s),s}(e,this._c):[].concat(i),s],a=o[0],c=o.reduce(((t,i)=>{const s=ot(e,i,n);return t.top=r(s.top,t.top),t.right=l(s.right,t.right),t.bottom=l(s.bottom,t.bottom),t.left=r(s.left,t.left),t}),ot(e,a,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:dt,getElementRects:async function(t){const e=this.getOffsetParent||dt,i=this.getDimensions,s=await i(t.floating);return{reference:rt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:i}=X(t);return{width:e,height:i}},getScale:G,isElement:H,isRTL:function(t){return"rtl"===Y(t).direction}};function ut(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function pt(t,e,i,s){void 0===s&&(s={});const{ancestorScroll:n=!0,ancestorResize:o=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:d="function"==typeof IntersectionObserver,animationFrame:h=!1}=s,u=Z(t),p=n||o?[...u?Q(u):[],...Q(e)]:[];p.forEach((t=>{n&&t.addEventListener("scroll",i,{passive:!0}),o&&t.addEventListener("resize",i)}));const g=u&&d?function(t,e){let i,s=null;const n=F(t);function o(){var t;clearTimeout(i),null==(t=s)||t.disconnect(),s=null}return function a(d,h){void 0===d&&(d=!1),void 0===h&&(h=1),o();const u=t.getBoundingClientRect(),{left:p,top:g,width:f,height:m}=u;if(d||e(),!f||!m)return;const v={rootMargin:-c(g)+"px "+-c(n.clientWidth-(p+f))+"px "+-c(n.clientHeight-(g+m))+"px "+-c(p)+"px",threshold:r(0,l(1,h))||1};let w=!0;function y(e){const s=e[0].intersectionRatio;if(s!==h){if(!w)return a();s?a(!1,s):i=setTimeout((()=>{a(!1,1e-7)}),1e3)}1!==s||ut(u,t.getBoundingClientRect())||a(),w=!1}try{s=new IntersectionObserver(y,{...v,root:n.ownerDocument})}catch(t){s=new IntersectionObserver(y,v)}s.observe(t)}(!0),o}(u,i):null;let f,m=-1,v=null;a&&(v=new ResizeObserver((t=>{let[s]=t;s&&s.target===u&&v&&(v.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var t;null==(t=v)||t.observe(e)}))),i()})),u&&!h&&v.observe(u),v.observe(e));let w=h?it(t):null;return h&&function e(){const s=it(t);w&&!ut(w,s)&&i();w=s,f=requestAnimationFrame(e)}(),i(),()=>{var t;p.forEach((t=>{n&&t.removeEventListener("scroll",i),o&&t.removeEventListener("resize",i)})),null==g||g(),null==(t=v)||t.disconnect(),v=null,h&&cancelAnimationFrame(f)}}const gt=L,ft=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var i,s;const{x:n,y:o,placement:l,middlewareData:r}=e,a=await async function(t,e){const{placement:i,platform:s,elements:n}=t,o=await(null==s.isRTL?void 0:s.isRTL(n.floating)),l=f(i),r=m(i),a="y"===y(i),c=["left","top"].includes(l)?-1:1,d=o&&a?-1:1,h=g(e,t);let{mainAxis:u,crossAxis:p,alignmentAxis:v}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return r&&"number"==typeof v&&(p="end"===r?-1*v:v),a?{x:p*d,y:u*c}:{x:u*c,y:p*d}}(e,t);return l===(null==(i=r.offset)?void 0:i.placement)&&null!=(s=r.arrow)&&s.alignmentOffset?{}:{x:n+a.x,y:o+a.y,data:{...a,placement:l}}}}},mt=function(t){return void 0===t&&(t={}),{name:"autoPlacement",options:t,async fn(e){var i,s,n;const{rects:l,middlewareData:r,placement:a,platform:c,elements:d}=e,{crossAxis:h=!1,alignment:u,allowedPlacements:p=o,autoAlignment:v=!0,...w}=g(t,e),y=void 0!==u||p===o?function(t,e,i){return(t?[...i.filter((e=>m(e)===t)),...i.filter((e=>m(e)!==t))]:i.filter((t=>f(t)===t))).filter((i=>!t||m(i)===t||!!e&&T(i)!==i))}(u||null,v,p):p,I=await L(e,w),S=(null==(i=r.autoPlacement)?void 0:i.index)||0,x=y[S];if(null==x)return{};const C=b(x,l,await(null==c.isRTL?void 0:c.isRTL(d.floating)));if(a!==x)return{reset:{placement:y[0]}};const E=[I[f(x)],I[C[0]],I[C[1]]],A=[...(null==(s=r.autoPlacement)?void 0:s.overflows)||[],{placement:x,overflows:E}],O=y[S+1];if(O)return{data:{index:S+1,overflows:A},reset:{placement:O}};const M=A.map((t=>{const e=m(t.placement);return[t.placement,e&&h?t.overflows.slice(0,2).reduce(((t,e)=>t+e),0):t.overflows[0],t.overflows]})).sort(((t,e)=>t[1]-e[1])),P=(null==(n=M.filter((t=>t[2].slice(0,m(t[0])?2:3).every((t=>t<=0))))[0])?void 0:n[0])||M[0][0];return P!==a?{data:{index:S+1,overflows:A},reset:{placement:P}}:{}}}},vt=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:i,y:s,placement:n}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:r={fn:t=>{let{x:e,y:i}=t;return{x:e,y:i}}},...a}=g(t,e),c={x:i,y:s},d=await L(e,a),h=y(f(n)),u=v(h);let m=c[u],w=c[h];if(o){const t="y"===u?"bottom":"right";m=p(m+d["y"===u?"top":"left"],m,m-d[t])}if(l){const t="y"===h?"bottom":"right";w=p(w+d["y"===h?"top":"left"],w,w-d[t])}const I=r.fn({...e,[u]:m,[h]:w});return{...I,data:{x:I.x-i,y:I.y-s,enabled:{[u]:o,[h]:l}}}}}},wt=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var i,s;const{placement:n,middlewareData:o,rects:l,initialPlacement:r,platform:a,elements:c}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:u,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...I}=g(t,e);if(null!=(i=o.arrow)&&i.alignmentOffset)return{};const x=f(n),C=y(r),E=f(r)===r,A=await(null==a.isRTL?void 0:a.isRTL(c.floating)),O=u||(E||!w?[S(r)]:function(t){const e=S(t);return[T(t),e,T(e)]}(r)),M="none"!==v;!u&&M&&O.push(...function(t,e,i,s){const n=m(t);let o=function(t,e,i){const s=["left","right"],n=["right","left"],o=["top","bottom"],l=["bottom","top"];switch(t){case"top":case"bottom":return i?e?n:s:e?s:n;case"left":case"right":return e?o:l;default:return[]}}(f(t),"start"===i,s);return n&&(o=o.map((t=>t+"-"+n)),e&&(o=o.concat(o.map(T)))),o}(r,w,v,A));const P=[r,...O],R=await L(e,I),D=[];let F=(null==(s=o.flip)?void 0:s.overflows)||[];if(d&&D.push(R[x]),h){const t=b(n,l,A);D.push(R[t[0]],R[t[1]])}if(F=[...F,{placement:n,overflows:D}],!D.every((t=>t<=0))){var $,H;const t=((null==($=o.flip)?void 0:$.index)||0)+1,e=P[t];if(e){var k;const i="alignment"===h&&C!==y(e),s=(null==(k=F[0])?void 0:k.overflows[0])>0;if(!i||s)return{data:{index:t,overflows:F},reset:{placement:e}}}let i=null==(H=F.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:H.placement;if(!i)switch(p){case"bestFit":{var q;const t=null==(q=F.filter((t=>{if(M){const e=y(t.placement);return e===C||"y"===e}return!0})).map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:q[0];t&&(i=t);break}case"initialPlacement":i=r}if(n!==i)return{reset:{placement:i}}}return{}}}},yt=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){var i,s;const{placement:n,rects:o,platform:a,elements:c}=e,{apply:d=()=>{},...h}=g(t,e),u=await L(e,h),p=f(n),v=m(n),w="y"===y(n),{width:I,height:b}=o.floating;let T,S;"top"===p||"bottom"===p?(T=p,S=v===(await(null==a.isRTL?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(S=p,T="end"===v?"top":"bottom");const x=b-u.top-u.bottom,C=I-u.left-u.right,E=l(b-u[T],x),A=l(I-u[S],C),O=!e.middlewareData.shift;let M=E,P=A;if(null!=(i=e.middlewareData.shift)&&i.enabled.x&&(P=C),null!=(s=e.middlewareData.shift)&&s.enabled.y&&(M=x),O&&!v){const t=r(u.left,0),e=r(u.right,0),i=r(u.top,0),s=r(u.bottom,0);w?P=I-2*(0!==t||0!==e?t+e:r(u.left,u.right)):M=b-2*(0!==i||0!==s?i+s:r(u.top,u.bottom))}await d({...e,availableWidth:P,availableHeight:M});const R=await a.getDimensions(c.floating);return I!==R.width||b!==R.height?{reset:{rects:!0}}:{}}}},It=function(t){return void 0===t&&(t={}),{name:"hide",options:t,async fn(e){const{rects:i}=e,{strategy:s="referenceHidden",...n}=g(t,e);switch(s){case"referenceHidden":{const t=A(await L(e,{...n,elementContext:"reference"}),i.reference);return{data:{referenceHiddenOffsets:t,referenceHidden:O(t)}}}case"escaped":{const t=A(await L(e,{...n,altBoundary:!0}),i.floating);return{data:{escapedOffsets:t,escaped:O(t)}}}default:return{}}}}},bt=t=>({name:"arrow",options:t,async fn(e){const{x:i,y:s,placement:n,rects:o,platform:r,elements:a,middlewareData:c}=e,{element:d,padding:h=0}=g(t,e)||{};if(null==d)return{};const u=x(h),f={x:i,y:s},v=I(n),y=w(v),b=await r.getDimensions(d),T="y"===v,S=T?"top":"left",C=T?"bottom":"right",E=T?"clientHeight":"clientWidth",L=o.reference[y]+o.reference[v]-f[v]-o.floating[y],A=f[v]-o.reference[v],O=await(null==r.getOffsetParent?void 0:r.getOffsetParent(d));let M=O?O[E]:0;M&&await(null==r.isElement?void 0:r.isElement(O))||(M=a.floating[E]||o.floating[y]);const P=L/2-A/2,R=M/2-b[y]/2-1,D=l(u[S],R),F=l(u[C],R),$=D,H=M-b[y]-F,k=M/2-b[y]/2+P,q=p($,k,H),W=!c.arrow&&null!=m(n)&&k!==q&&o.reference[y]/2-(k<$?D:F)-b[y]/2<0,_=W?k<$?k-$:k-H:0;return{[v]:f[v]+_,data:{[v]:q,centerOffset:k-q-_,...W&&{alignmentOffset:_}},reset:W}}}),Tt=function(t){return void 0===t&&(t={}),{name:"inline",options:t,async fn(e){const{placement:i,elements:s,rects:n,platform:o,strategy:a}=e,{padding:c=2,x:d,y:h}=g(t,e),u=Array.from(await(null==o.getClientRects?void 0:o.getClientRects(s.reference))||[]),p=function(t){const e=t.slice().sort(((t,e)=>t.y-e.y)),i=[];let s=null;for(let t=0;t<e.length;t++){const n=e[t];!s||n.y-s.y>s.height/2?i.push([n]):i[i.length-1].push(n),s=n}return i.map((t=>C(M(t))))}(u),m=C(M(u)),v=x(c);const w=await o.getElementRects({reference:{getBoundingClientRect:function(){if(2===p.length&&p[0].left>p[1].right&&null!=d&&null!=h)return p.find((t=>d>t.left-v.left&&d<t.right+v.right&&h>t.top-v.top&&h<t.bottom+v.bottom))||m;if(p.length>=2){if("y"===y(i)){const t=p[0],e=p[p.length-1],s="top"===f(i),n=t.top,o=e.bottom,l=s?t.left:e.left,r=s?t.right:e.right;return{top:n,bottom:o,left:l,right:r,width:r-l,height:o-n,x:l,y:n}}const t="left"===f(i),e=r(...p.map((t=>t.right))),s=l(...p.map((t=>t.left))),n=p.filter((i=>t?i.left===s:i.right===e)),o=n[0].top,a=n[n.length-1].bottom;return{top:o,bottom:a,left:s,right:e,width:e-s,height:a-o,x:s,y:o}}return m}},floating:s.floating,strategy:a});return n.reference.x!==w.reference.x||n.reference.y!==w.reference.y||n.reference.width!==w.reference.width||n.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},St=function(t){return void 0===t&&(t={}),{options:t,fn(e){const{x:i,y:s,placement:n,rects:o,middlewareData:l}=e,{offset:r=0,mainAxis:a=!0,crossAxis:c=!0}=g(t,e),d={x:i,y:s},h=y(n),u=v(h);let p=d[u],m=d[h];const w=g(r,e),I="number"==typeof w?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(a){const t="y"===u?"height":"width",e=o.reference[u]-o.floating[t]+I.mainAxis,i=o.reference[u]+o.reference[t]-I.mainAxis;p<e?p=e:p>i&&(p=i)}if(c){var b,T;const t="y"===u?"width":"height",e=["top","left"].includes(f(n)),i=o.reference[h]-o.floating[t]+(e&&(null==(b=l.offset)?void 0:b[h])||0)+(e?0:I.crossAxis),s=o.reference[h]+o.reference[t]+(e?0:(null==(T=l.offset)?void 0:T[h])||0)-(e?I.crossAxis:0);m<i?m=i:m>s&&(m=s)}return{[u]:p,[h]:m}}}},xt=(t,e,i)=>{const s=new Map,n={platform:ht,...i},o={...n.platform,_c:s};return(async(t,e,i)=>{const{placement:s="bottom",strategy:n="absolute",middleware:o=[],platform:l}=i,r=o.filter(Boolean),a=await(null==l.isRTL?void 0:l.isRTL(e));let c=await l.getElementRects({reference:t,floating:e,strategy:n}),{x:d,y:h}=E(c,s,a),u=s,p={},g=0;for(let i=0;i<r.length;i++){const{name:o,fn:f}=r[i],{x:m,y:v,data:w,reset:y}=await f({x:d,y:h,initialPlacement:s,placement:u,strategy:n,middlewareData:p,rects:c,platform:l,elements:{reference:t,floating:e}});d=null!=m?m:d,h=null!=v?v:h,p={...p,[o]:{...p[o],...w}},y&&g<=50&&(g++,"object"==typeof y&&(y.placement&&(u=y.placement),y.rects&&(c=!0===y.rects?await l.getElementRects({reference:t,floating:e,strategy:n}):y.rects),({x:d,y:h}=E(c,u,a))),i=-1)}return{x:d,y:h,placement:u,strategy:n,middlewareData:p}})(t,e,{...n,platform:o})}},956:function(t,e,i){ /* * HSSelect * @version: 3.0.1 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ var s=this&&this.__awaiter||function(t,e,i,s){return new(i||(i=Promise))((function(n,o){function l(t){try{a(s.next(t))}catch(t){o(t)}}function r(t){try{a(s.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(l,r)}a((s=s.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(806),l=i(949),r=n(i(287)),a=i(917);class c extends r.default{constructor(t,e){var i,s,n,o;super(t,e),this.optionId=0;const l=t.getAttribute("data-select"),r=l?JSON.parse(l):{},a=Object.assign(Object.assign({},r),e);this.value=(null==a?void 0:a.value)||this.el.value||null,this.placeholder=(null==a?void 0:a.placeholder)||"Select...",this.hasSearch=(null==a?void 0:a.hasSearch)||!1,this.minSearchLength=null!==(i=null==a?void 0:a.minSearchLength)&&void 0!==i?i:0,this.preventSearchFocus=(null==a?void 0:a.preventSearchFocus)||!1,this.mode=(null==a?void 0:a.mode)||"default",this.viewport=void 0!==(null==a?void 0:a.viewport)?document.querySelector(null==a?void 0:a.viewport):null,this.isOpened=Boolean(null==a?void 0:a.isOpened)||!1,this.isMultiple=this.el.hasAttribute("multiple")||!1,this.isDisabled=this.el.hasAttribute("disabled")||!1,this.selectedItems=[],this.apiUrl=(null==a?void 0:a.apiUrl)||null,this.apiQuery=(null==a?void 0:a.apiQuery)||null,this.apiOptions=(null==a?void 0:a.apiOptions)||null,this.apiSearchQueryKey=(null==a?void 0:a.apiSearchQueryKey)||null,this.apiDataPart=(null==a?void 0:a.apiDataPart)||null,this.apiFieldsMap=(null==a?void 0:a.apiFieldsMap)||null,this.apiIconTag=(null==a?void 0:a.apiIconTag)||null,this.wrapperClasses=(null==a?void 0:a.wrapperClasses)||null,this.toggleTag=(null==a?void 0:a.toggleTag)||null,this.toggleClasses=(null==a?void 0:a.toggleClasses)||null,this.toggleCountText=void 0===typeof(null==a?void 0:a.toggleCountText)?null:a.toggleCountText,this.toggleCountTextPlacement=(null==a?void 0:a.toggleCountTextPlacement)||"postfix",this.toggleCountTextMinItems=(null==a?void 0:a.toggleCountTextMinItems)||1,this.toggleCountTextMode=(null==a?void 0:a.toggleCountTextMode)||"countAfterLimit",this.toggleSeparators={items:(null===(s=null==a?void 0:a.toggleSeparators)||void 0===s?void 0:s.items)||", ",betweenItemsAndCounter:(null===(n=null==a?void 0:a.toggleSeparators)||void 0===n?void 0:n.betweenItemsAndCounter)||"and"},this.tagsItemTemplate=(null==a?void 0:a.tagsItemTemplate)||null,this.tagsItemClasses=(null==a?void 0:a.tagsItemClasses)||null,this.tagsInputId=(null==a?void 0:a.tagsInputId)||null,this.tagsInputClasses=(null==a?void 0:a.tagsInputClasses)||null,this.dropdownTag=(null==a?void 0:a.dropdownTag)||null,this.dropdownClasses=(null==a?void 0:a.dropdownClasses)||null,this.dropdownDirectionClasses=(null==a?void 0:a.dropdownDirectionClasses)||null,this.dropdownSpace=(null==a?void 0:a.dropdownSpace)||10,this.dropdownPlacement=(null==a?void 0:a.dropdownPlacement)||null,this.dropdownVerticalFixedPlacement=(null==a?void 0:a.dropdownVerticalFixedPlacement)||null,this.dropdownScope=(null==a?void 0:a.dropdownScope)||"parent",this.searchTemplate=(null==a?void 0:a.searchTemplate)||null,this.searchWrapperTemplate=(null==a?void 0:a.searchWrapperTemplate)||null,this.searchWrapperClasses=(null==a?void 0:a.searchWrapperClasses)||"bg-base-100 sticky top-0 mb-2 px-2 pt-3",this.searchId=(null==a?void 0:a.searchId)||null,this.searchLimit=(null==a?void 0:a.searchLimit)||1/0,this.isSearchDirectMatch=void 0===(null==a?void 0:a.isSearchDirectMatch)||(null==a?void 0:a.isSearchDirectMatch),this.searchClasses=(null==a?void 0:a.searchClasses)||"border-base-content/40 focus:border-primary focus:outline-primary bg-base-100 block w-full rounded-field border px-3 py-2 text-base focus:outline-1",this.searchPlaceholder=(null==a?void 0:a.searchPlaceholder)||"Search...",this.searchNoResultTemplate=(null==a?void 0:a.searchNoResultTemplate)||"<span></span>",this.searchNoResultText=(null==a?void 0:a.searchNoResultText)||"No results found",this.searchNoResultClasses=(null==a?void 0:a.searchNoResultClasses)||"block advance-select-option",this.optionAllowEmptyOption=void 0!==(null==a?void 0:a.optionAllowEmptyOption)&&(null==a?void 0:a.optionAllowEmptyOption),this.optionTemplate=(null==a?void 0:a.optionTemplate)||null,this.optionTag=(null==a?void 0:a.optionTag)||null,this.optionClasses=(null==a?void 0:a.optionClasses)||null,this.extraMarkup=(null==a?void 0:a.extraMarkup)||null,this.descriptionClasses=(null==a?void 0:a.descriptionClasses)||null,this.iconClasses=(null==a?void 0:a.iconClasses)||null,this.isAddTagOnEnter=null===(o=null==a?void 0:a.isAddTagOnEnter)||void 0===o||o,this.animationInProcess=!1,this.selectOptions=[],this.remoteOptions=[],this.tagsInputHelper=null,this.init()}wrapperClick(t){t.target.closest("[data-select-dropdown]")||t.target.closest("[data-tag-value]")||this.tagsInput.focus()}toggleClick(){if(this.isDisabled)return!1;this.toggleFn()}tagsInputFocus(){this.isOpened||this.open()}tagsInputInput(){this.calculateInputWidth()}tagsInputInputSecond(t){this.searchOptions(t.target.value)}tagsInputKeydown(t){if("Enter"===t.key&&this.isAddTagOnEnter){const e=t.target.value;if(this.selectOptions.find((t=>t.val===e)))return!1;this.addSelectOption(e,e),this.buildOption(e,e),this.dropdown.querySelector(`[data-value="${e}"]`).click(),this.resetTagsInputField()}}searchInput(t){const e=t.target.value;this.apiUrl?this.remoteSearch(e):this.searchOptions(e)}setValue(t){if(this.value=t,this.clearSelections(),Array.isArray(t))if("tags"===this.mode){this.unselectMultipleItems(),this.selectMultipleItems(),this.selectedItems=[];this.wrapper.querySelectorAll("[data-tag-value]").forEach((t=>t.remove())),this.setTagsItems(),this.reassignTagsInputPlaceholder(this.value.length?"":this.placeholder)}else this.toggleTextWrapper.innerHTML=this.value.length?this.stringFromValue():this.placeholder,this.unselectMultipleItems(),this.selectMultipleItems();else this.setToggleTitle(),this.toggle.querySelector("[data-icon]")&&this.setToggleIcon(),this.toggle.querySelector("[data-title]")&&this.setToggleTitle(),this.selectSingleItem()}init(){this.createCollection(window.$hsSelectCollection,this),this.build()}build(){if(this.el.style.display="none",this.el.children&&Array.from(this.el.children).filter((t=>this.optionAllowEmptyOption||!this.optionAllowEmptyOption&&t.value&&""!==t.value)).forEach((t=>{const e=t.getAttribute("data-select-option");this.selectOptions=[...this.selectOptions,{title:t.textContent,val:t.value,disabled:t.disabled,options:"undefined"!==e?JSON.parse(e):null}]})),this.isMultiple){const t=Array.from(this.el.children).filter((t=>t.selected));if(t){const e=[];t.forEach((t=>{e.push(t.value)})),this.value=e}}this.buildWrapper(),"tags"===this.mode?this.buildTags():this.buildToggle(),this.buildDropdown(),this.extraMarkup&&this.buildExtraMarkup()}buildWrapper(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("advance-select","relative"),"tags"===this.mode&&(this.onWrapperClickListener=t=>this.wrapperClick(t),this.wrapper.addEventListener("click",this.onWrapperClickListener)),this.wrapperClasses&&(0,o.classToClassList)(this.wrapperClasses,this.wrapper),this.el.before(this.wrapper),this.wrapper.append(this.el)}buildExtraMarkup(){const t=t=>{const e=(0,o.htmlToElement)(t);return this.wrapper.append(e),e},e=t=>{t.classList.contains("--prevent-click")||t.addEventListener("click",(t=>{t.stopPropagation(),this.toggleFn()}))};if(Array.isArray(this.extraMarkup))this.extraMarkup.forEach((i=>{const s=t(i);e(s)}));else{const i=t(this.extraMarkup);e(i)}}buildToggle(){var t,e;let i,s;this.toggleTextWrapper=document.createElement("span"),this.toggleTextWrapper.classList.add("truncate"),this.toggle=(0,o.htmlToElement)(this.toggleTag||"<div></div>"),i=this.toggle.querySelector("[data-icon]"),s=this.toggle.querySelector("[data-title]"),!this.isMultiple&&i&&this.setToggleIcon(),!this.isMultiple&&s&&this.setToggleTitle(),this.isMultiple?this.toggleTextWrapper.innerHTML=this.value.length?this.stringFromValue():this.placeholder:this.toggleTextWrapper.innerHTML=(null===(t=this.getItemByValue(this.value))||void 0===t?void 0:t.title)||this.placeholder,s||this.toggle.append(this.toggleTextWrapper),this.toggleClasses&&(0,o.classToClassList)(this.toggleClasses,this.toggle),this.isDisabled&&this.toggle.classList.add("disabled"),this.wrapper&&this.wrapper.append(this.toggle),(null===(e=this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.isOpened?this.toggle.ariaExpanded="true":this.toggle.ariaExpanded="false"),this.onToggleClickListener=()=>this.toggleClick(),this.toggle.addEventListener("click",this.onToggleClickListener)}setToggleIcon(){var t;const e=this.getItemByValue(this.value),i=this.toggle.querySelector("[data-icon]");if(i){i.innerHTML="";const s=(0,o.htmlToElement)(this.apiUrl&&this.apiIconTag?this.apiIconTag||"":(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.icon)||"");this.value&&this.apiUrl&&this.apiIconTag&&e[this.apiFieldsMap.icon]&&(s.src=e[this.apiFieldsMap.icon]||""),i.append(s),s?i.classList.remove("hidden"):i.classList.add("hidden")}}setToggleTitle(){var t,e;const i=this.toggle.querySelector("[data-title]");i?(i.innerHTML=(null===(t=this.getItemByValue(this.value))||void 0===t?void 0:t.title)||this.placeholder,i.classList.add("truncate"),this.toggle.append(i)):this.toggle.innerText=(null===(e=this.getItemByValue(this.value))||void 0===e?void 0:e.title)||this.placeholder}buildTags(){this.isDisabled&&this.wrapper.classList.add("disabled"),this.buildTagsInput(),this.setTagsItems()}reassignTagsInputPlaceholder(t){this.tagsInput.placeholder=t,this.tagsInputHelper.innerHTML=t,this.calculateInputWidth()}buildTagsItem(t){var e,i,s,n;const l=this.getItemByValue(t);let r,a,c,d;const h=document.createElement("div");if(h.setAttribute("data-tag-value",t),this.tagsItemClasses&&(0,o.classToClassList)(this.tagsItemClasses,h),this.tagsItemTemplate&&(r=(0,o.htmlToElement)(this.tagsItemTemplate),h.append(r)),(null===(e=null==l?void 0:l.options)||void 0===e?void 0:e.icon)||this.apiIconTag){const t=(0,o.htmlToElement)(this.apiUrl&&this.apiIconTag?this.apiIconTag:null===(i=null==l?void 0:l.options)||void 0===i?void 0:i.icon);this.apiUrl&&this.apiIconTag&&l[this.apiFieldsMap.icon]&&(t.src=l[this.apiFieldsMap.icon]||""),d=r?r.querySelector("[data-icon]"):document.createElement("span"),d.append(t),r||h.append(d)}!r||!r.querySelector("[data-icon]")||(null===(s=null==l?void 0:l.options)||void 0===s?void 0:s.icon)||this.apiUrl||this.apiIconTag||l[null===(n=this.apiFieldsMap)||void 0===n?void 0:n.icon]||r.querySelector("[data-icon]").classList.add("hidden"),a=r?r.querySelector("[data-title]"):document.createElement("span"),a.textContent=l.title||"",r||h.append(a),r?c=r.querySelector("[data-remove]"):(c=document.createElement("span"),c.textContent="X",h.append(c)),c.addEventListener("click",(()=>{this.value=this.value.filter((e=>e!==t)),this.selectedItems=this.selectedItems.filter((e=>e!==t)),this.value.length||this.reassignTagsInputPlaceholder(this.placeholder),this.unselectMultipleItems(),this.selectMultipleItems(),h.remove(),this.triggerChangeEventForNativeSelect()})),this.wrapper.append(h)}getItemByValue(t){return this.apiUrl?this.remoteOptions.find((e=>`${e[this.apiFieldsMap.val]}`===t||e[this.apiFieldsMap.title]===t)):this.selectOptions.find((e=>e.val===t))}setTagsItems(){this.value&&this.value.forEach((t=>{this.selectedItems.includes(t)||this.buildTagsItem(t),this.selectedItems=this.selectedItems.includes(t)?this.selectedItems:[...this.selectedItems,t]})),this.isOpened&&this.floatingUIInstance&&this.floatingUIInstance.update()}buildTagsInput(){this.tagsInput=document.createElement("input"),this.tagsInputId&&(this.tagsInput.id=this.tagsInputId),this.tagsInputClasses&&(0,o.classToClassList)(this.tagsInputClasses,this.tagsInput),this.onTagsInputFocusListener=()=>this.tagsInputFocus(),this.onTagsInputInputListener=()=>this.tagsInputInput(),this.onTagsInputInputSecondListener=(0,o.debounce)((t=>this.tagsInputInputSecond(t))),this.onTagsInputKeydownListener=t=>this.tagsInputKeydown(t),this.tagsInput.addEventListener("focus",this.onTagsInputFocusListener),this.tagsInput.addEventListener("input",this.onTagsInputInputListener),this.tagsInput.addEventListener("input",this.onTagsInputInputSecondListener),this.tagsInput.addEventListener("keydown",this.onTagsInputKeydownListener),this.wrapper.append(this.tagsInput),setTimeout((()=>{this.adjustInputWidth(),this.reassignTagsInputPlaceholder(this.value.length?"":this.placeholder)}))}buildDropdown(){this.dropdown=(0,o.htmlToElement)(this.dropdownTag||"<div></div>"),this.dropdown.setAttribute("data-select-dropdown",""),"parent"===this.dropdownScope&&(this.dropdown.classList.add("absolute"),this.dropdownVerticalFixedPlacement||this.dropdown.classList.add("top-full")),this.dropdown.role="listbox",this.dropdown.tabIndex=-1,this.dropdown.ariaOrientation="vertical",this.isOpened||this.dropdown.classList.add("hidden"),this.dropdownClasses&&(0,o.classToClassList)(this.dropdownClasses,this.dropdown),this.wrapper&&this.wrapper.append(this.dropdown),this.dropdown&&this.hasSearch&&this.buildSearch(),this.selectOptions&&this.selectOptions.forEach(((t,e)=>this.buildOption(t.title,t.val,t.disabled,t.selected,t.options,`${e}`))),this.apiUrl&&this.optionsFromRemoteData(),"window"===this.dropdownScope&&this.buildFloatingUI()}buildFloatingUI(){document.body.appendChild(this.dropdown);const t="tags"===this.mode?this.wrapper:this.toggle,e={placement:a.POSITIONS[this.dropdownPlacement]||"bottom",strategy:"fixed",middleware:[(0,l.offset)(0)]},i=()=>{(0,l.computePosition)(t,this.dropdown,e).then((({x:t,y:e,placement:i})=>{Object.assign(this.dropdown.style,{position:"fixed",left:`${t}px`,top:`${e}px`}),this.dropdown.setAttribute("data-placement",i)}))};i();const s=(0,l.autoUpdate)(t,this.dropdown,i);this.floatingUIInstance={update:i,destroy:s}}updateDropdownWidth(){const t="tags"===this.mode?this.wrapper:this.toggle;this.dropdown.style.width=`${t.clientWidth}px`}buildSearch(){let t;this.searchWrapper=(0,o.htmlToElement)(this.searchWrapperTemplate||"<div></div>"),this.searchWrapperClasses&&(0,o.classToClassList)(this.searchWrapperClasses,this.searchWrapper),t=this.searchWrapper.querySelector("[data-input]");const e=(0,o.htmlToElement)(this.searchTemplate||'<input type="text">');this.search="INPUT"===e.tagName?e:e.querySelector(":scope input"),this.search.placeholder=this.searchPlaceholder,this.searchClasses&&(0,o.classToClassList)(this.searchClasses,this.search),this.searchId&&(this.search.id=this.searchId),this.onSearchInputListener=(0,o.debounce)((t=>this.searchInput(t))),this.search.addEventListener("input",this.onSearchInputListener),t?t.append(e):this.searchWrapper.append(e),this.dropdown.append(this.searchWrapper)}buildOption(t,e,i=!1,s=!1,n,l="1",r){var a;let c=null,d=null,h=null,u=null;const p=(0,o.htmlToElement)(this.optionTag||"<div></div>");if(p.setAttribute("data-value",e),p.setAttribute("data-title-value",t),p.setAttribute("tabIndex",l),p.classList.add("cursor-pointer"),p.setAttribute("data-id",r||`${this.optionId}`),r||this.optionId++,i&&p.classList.add("disabled"),s&&(this.isMultiple?this.value=[...this.value,e]:this.value=e),this.optionTemplate&&(c=(0,o.htmlToElement)(this.optionTemplate),p.append(c)),c?(d=c.querySelector("[data-title]"),d.textContent=t||""):p.textContent=t||"",n){if(n.icon){const e=(0,o.htmlToElement)(null!==(a=this.apiIconTag)&&void 0!==a?a:n.icon);if(e.classList.add("max-w-full"),this.apiUrl&&(e.setAttribute("alt",t),e.setAttribute("src",n.icon)),c)h=c.querySelector("[data-icon]"),h.append(e);else{const t=(0,o.htmlToElement)("<div></div>");this.iconClasses&&(0,o.classToClassList)(this.iconClasses,t),t.append(e),p.append(t)}}if(n.description)if(c)u=c.querySelector("[data-description]"),u&&u.append(n.description);else{const t=(0,o.htmlToElement)("<div></div>");t.textContent=n.description,this.descriptionClasses&&(0,o.classToClassList)(this.descriptionClasses,t),p.append(t)}}c&&c.querySelector("[data-icon]")&&!n&&!(null==n?void 0:n.icon)&&c.querySelector("[data-icon]").classList.add("hidden"),this.value&&(this.isMultiple?this.value.includes(e):this.value===e)&&p.classList.add("selected"),i||p.addEventListener("click",(()=>this.onSelectOption(e))),this.optionClasses&&(0,o.classToClassList)(this.optionClasses,p),this.dropdown&&this.dropdown.append(p),s&&this.setNewValue()}buildOptionFromRemoteData(t,e,i=!1,s=!1,n="1",o,l){n?this.buildOption(t,e,i,s,l,n,o):alert("ID parameter is required for generating remote options! Please check your API endpoint have it.")}buildOptionsFromRemoteData(t){t.forEach(((t,e)=>{let i=null,s="",n="";const o={id:"",val:"",title:"",icon:null,description:null,rest:{}};Object.keys(t).forEach((e=>{var l;t[this.apiFieldsMap.id]&&(i=t[this.apiFieldsMap.id]),(t[this.apiFieldsMap.val]||t[this.apiFieldsMap.title])&&(n=t[this.apiFieldsMap.val]||t[this.apiFieldsMap.title]),t[this.apiFieldsMap.title]&&(s=t[this.apiFieldsMap.title]),t[this.apiFieldsMap.icon]&&(o.icon=t[this.apiFieldsMap.icon]),t[null===(l=this.apiFieldsMap)||void 0===l?void 0:l.description]&&(o.description=t[this.apiFieldsMap.description]),o.rest[e]=t[e]}));const l="string"==typeof this.value&&this.value===`${n}`||Array.isArray(this.value)&&this.value.includes(`${n}`);this.buildOriginalOption(s,`${n}`,i,!1,l,o),this.buildOptionFromRemoteData(s,`${n}`,!1,l,`${e}`,i,o)})),this.sortElements(this.el,"option"),this.sortElements(this.dropdown,"[data-value]")}optionsFromRemoteData(){return s(this,arguments,void 0,(function*(t=""){const e=yield this.apiRequest(t);this.remoteOptions=e,e.length?this.buildOptionsFromRemoteData(this.remoteOptions):console.log("There is no data were responded!")}))}apiRequest(){return s(this,arguments,void 0,(function*(t=""){try{let e=this.apiUrl;const i=this.apiSearchQueryKey?`${this.apiSearchQueryKey}=${t.toLowerCase()}`:null,s=`${this.apiQuery}`,n=this.apiOptions||{};i&&(e+=`?${i}`),this.apiQuery&&(e+=`${i?"&":"?"}${s}`);const o=yield fetch(e,n),l=yield o.json();return this.apiDataPart?l[this.apiDataPart]:l}catch(t){console.error(t)}}))}sortElements(t,e){const i=Array.from(t.querySelectorAll(e));i.sort(((t,e)=>{const i=t.classList.contains("selected")||t.hasAttribute("selected"),s=e.classList.contains("selected")||e.hasAttribute("selected");return i&&!s?-1:!i&&s?1:0})),i.forEach((e=>t.appendChild(e)))}remoteSearch(t){return s(this,void 0,void 0,(function*(){if(t.length<=this.minSearchLength){const t=yield this.apiRequest("");return this.remoteOptions=t,Array.from(this.dropdown.querySelectorAll("[data-value]")).forEach((t=>t.remove())),Array.from(this.el.querySelectorAll("option[value]")).forEach((t=>{t.remove()})),t.length?this.buildOptionsFromRemoteData(t):console.log("No data responded!"),!1}const e=yield this.apiRequest(t);this.remoteOptions=e;let i=e.map((t=>`${t.id}`)),s=null;const n=this.dropdown.querySelectorAll("[data-value]");this.el.querySelectorAll("[data-select-option]").forEach((t=>{var e;const s=t.getAttribute("data-id");i.includes(s)||(null===(e=this.value)||void 0===e?void 0:e.includes(t.value))||this.destroyOriginalOption(t.value)})),n.forEach((t=>{var e;const s=t.getAttribute("data-id");i.includes(s)||(null===(e=this.value)||void 0===e?void 0:e.includes(t.getAttribute("data-value")))?i=i.filter((t=>t!==s)):this.destroyOption(t.getAttribute("data-value"))})),s=e.filter((t=>i.includes(`${t.id}`))),s.length?this.buildOptionsFromRemoteData(s):console.log("There is no data were responded!")}))}destroyOption(t){const e=this.dropdown.querySelector(`[data-value="${t}"]`);if(!e)return!1;e.remove()}buildOriginalOption(t,e,i,s,n,l){const r=(0,o.htmlToElement)("<option></option>");r.setAttribute("value",e),s&&r.setAttribute("disabled","disabled"),n&&r.setAttribute("selected","selected"),i&&r.setAttribute("data-id",i),r.setAttribute("data-select-option",JSON.stringify(l)),r.innerText=t,this.el.append(r)}destroyOriginalOption(t){const e=this.el.querySelector(`[value="${t}"]`);if(!e)return!1;e.remove()}buildTagsInputHelper(){this.tagsInputHelper=document.createElement("span"),this.tagsInputHelper.style.fontSize=window.getComputedStyle(this.tagsInput).fontSize,this.tagsInputHelper.style.fontFamily=window.getComputedStyle(this.tagsInput).fontFamily,this.tagsInputHelper.style.fontWeight=window.getComputedStyle(this.tagsInput).fontWeight,this.tagsInputHelper.style.letterSpacing=window.getComputedStyle(this.tagsInput).letterSpacing,this.tagsInputHelper.style.visibility="hidden",this.tagsInputHelper.style.whiteSpace="pre",this.tagsInputHelper.style.position="absolute",this.wrapper.appendChild(this.tagsInputHelper)}calculateInputWidth(){this.tagsInputHelper.textContent=this.tagsInput.value||this.tagsInput.placeholder;const t=parseInt(window.getComputedStyle(this.tagsInput).paddingLeft)+parseInt(window.getComputedStyle(this.tagsInput).paddingRight),e=parseInt(window.getComputedStyle(this.tagsInput).borderLeftWidth)+parseInt(window.getComputedStyle(this.tagsInput).borderRightWidth),i=this.tagsInputHelper.offsetWidth+t+e,s=this.wrapper.offsetWidth-(parseInt(window.getComputedStyle(this.wrapper).paddingLeft)+parseInt(window.getComputedStyle(this.wrapper).paddingRight));this.tagsInput.style.width=`${Math.min(i,s)+2}px`}adjustInputWidth(){this.buildTagsInputHelper(),this.calculateInputWidth()}onSelectOption(t){if(this.clearSelections(),this.isMultiple?(this.value=this.value.includes(t)?Array.from(this.value).filter((e=>e!==t)):[...Array.from(this.value),t],this.selectMultipleItems(),this.setNewValue()):(this.value=t,this.selectSingleItem(),this.setNewValue()),this.fireEvent("change",this.value),"tags"===this.mode){const t=this.selectedItems.filter((t=>!this.value.includes(t)));t.length&&t.forEach((t=>{this.selectedItems=this.selectedItems.filter((e=>e!==t)),this.wrapper.querySelector(`[data-tag-value="${t}"]`).remove()})),this.resetTagsInputField()}this.isMultiple||(this.toggle.querySelector("[data-icon]")&&this.setToggleIcon(),this.toggle.querySelector("[data-title]")&&this.setToggleTitle(),this.close(!0)),this.value.length||"tags"!==this.mode||this.reassignTagsInputPlaceholder(this.placeholder),this.isOpened&&"tags"===this.mode&&this.tagsInput&&this.tagsInput.focus(),this.triggerChangeEventForNativeSelect()}triggerChangeEventForNativeSelect(){const t=new Event("change",{bubbles:!0});this.el.dispatchEvent(t),(0,o.dispatch)("change.advance.select",this.el,this.value)}addSelectOption(t,e,i,s,n){this.selectOptions=[...this.selectOptions,{title:t,val:e,disabled:i,selected:s,options:n}]}removeSelectOption(t,e=!1){if(!!!this.selectOptions.some((e=>e.val===t)))return!1;this.selectOptions=this.selectOptions.filter((e=>e.val!==t)),this.value=e?this.value.filter((e=>e!==t)):t}resetTagsInputField(){this.tagsInput.value="",this.reassignTagsInputPlaceholder(""),this.searchOptions("")}clearSelections(){Array.from(this.dropdown.children).forEach((t=>{t.classList.contains("selected")&&t.classList.remove("selected")})),