/*!
 * Built by Revolist OU ❤️
 */
import{b as t}from"./data.store.js";import"@stencil/core/internal/client";import"./platform.js";import{a as n,g as r}from"./dimension.helpers.js";function e(t,n){return!(n&&t&&!(t.target instanceof Element&&t.target.classList.contains(n)))}function o(t,n,r){if(function(t){return!!t.touches}(t)){if(t.touches.length>0){const o=t.touches[0];return e(o,r)?o[n]||0:null}return null}return t[n]||0}function i(n,r){const e={};for(let o in n){const n=parseInt(o,10);e[n]=t(r,n)}return e}function s(t,n){if(t.defaultPrevented)return null;const r=o(t,"clientX"),e=o(t,"clientY");if(null===r||null===e)return null;const i=u({x:r,y:e},n);return c(i,n.lastCell)?null:i}function u({x:t,y:n},{el:e,rows:o,cols:i}){const{top:s,left:u,height:l,width:c}=e.getBoundingClientRect();let f=n-s,a=t-u;f>=l&&(f=l-1),a>=c&&(a=c-1);const p=r(o,f),x=r(i,a);return x.itemIndex<0&&(x.itemIndex=0),p.itemIndex<0&&(p.itemIndex=0),{x:x.itemIndex,y:p.itemIndex}}function l(t,n,r,e=!1){const o=(r,o=0)=>{const i={x:t.x,y:t.y},s=e?{x:t.x1,y:t.y1}:i;return(s[r]>n[r]?s:i)[r]+=o,{start:i,end:s}};return r.x?o("x",r.x):r.y?o("y",r.y):null}function c({x:t,y:n},r){return t>=r.x||n>=r.y}function f({x:t,y:n}){return t<0||n<0}function a(t){return{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`}}function p({x:t,y:r,x1:e,y1:o},i,s){const u=n(i,r).start,l=n(s,t).start,c=n(i,o).end,f=n(s,e).end;return{left:l,right:f,top:u,bottom:c,width:f-l,height:c-u}}export{p as a,l as b,f as c,u as d,i as e,s as f,o as g,c as i,a as s,e as v}