Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dflex/core-instance

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dflex/core-instance - npm Package Compare versions

Comparing version 3.9.10 to 3.10.0

2

./dist/dflex-core.js

@@ -1,1 +0,1 @@

class t{constructor(t,s){this.x=t,this.y=s}}class s extends t{setAxes(t,s){this.x=t,this.y=s}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,s){return this.x===t&&this.y===s}isNotEqual(t,s){return this.x!==t||this.y!==s}}class i{constructor(t,s,i,h){this.top=t,this.right=s,this.bottom=i,this.left=h}}class h extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,h){return this.top=t,this.right=s,this.bottom=i,this.left=h,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,s,i){"x"===t?(this.left=s,this.right=i):(this.top=s,this.bottom=i)}setOne(t,s,i){"x"===t?-1===s?this.left=i:this.right=i:-1===s?this.top=i:this.bottom=i}getOne(t,s){return"x"===t?-1===s?this.left:this.right:-1===s?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,s){this.top=s,this.left=t}hasEqualPosition(t,s){return this.top===s||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends h{constructor(t,s,i,h){super(t,s,i,h)}setFalsy(){return this.setBox(!1,!1,!1,!1),this}isTruthyByAxis(t){return"x"===t?this.left||this.right:this.top||this.bottom}isTruthyOnSide(t,s){return"x"===t?1===s?this.right:this.left:1===s?this.bottom:this.top}isTruthy(){return this.left||this.right||this.top||this.bottom}}class n extends h{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}l(t){return this.top<t.top}u(t){return this.right>t.right}p(t){return this.bottom>t.bottom}m(t){return this.left<t.left}T(t){return this.top>=t.top}_(t){return this.right<=t.right}O(t){return this.bottom<=t.bottom}v(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,s,i){if(s.setBox(!1,!1,!1,!1),i){if("y"===i){const i=this.l(t),h=this.p(t);return i&&(s.top=!0),h&&(s.bottom=!0),i||h}const h=this.m(t),e=this.u(t);return h&&(s.left=!0),e&&(s.right=!0),h||e}return this.l(t)?(s.top=!0,!0):this.u(t)?(s.right=!0,!0):this.p(t)?(s.bottom=!0,!0):!!this.m(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this.T(t)&&this._(t)&&this.O(t)&&this.v(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:s,left:i,right:h,bottom:e}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),h>this.right&&(this.right=h),e>this.bottom&&(this.bottom=e)}}function r(t,s){return`${t}_${s}`}function o(){}const l="height",u="width",c="position";function a(t){return"x"===t?u:l}function d(t){return"x"===t?"left":"top"}class f extends n{constructor(t,s,i,h){super(t,s,i,h),this.width=s-h,this.height=i-t}setByPointAndDimensions(t,s,i,h){this.top=t,this.left=s,this.width=h,this.height=i,this.right=s+h,this.bottom=t+i}setAxes(t,s){this.left=t,this.right=this.width+t,this.top=s,this.bottom=this.height+s}getDimensionDiff(t,s){const i=a(t);return this[i]-s[i]}getPositionDiff(t,s){return this[d(t)]-s[t]}}class p extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:h,bottom:e,right:r}=t;return s?new n(i+this.y,r-this.x,e-this.y,h+this.x):new n(i-this.y,r+this.x,e+this.y,h-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class m extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}}class g{static containerKey(t,s){return r(t,s)}static depthKey(t){return r(t,"dp")}constructor(t){this.P=t,this.thresholds={},this.isOut={}}D({width:t,height:s}){const i=Math.round(this.P.horizontal*t/100),h=Math.round(this.P.vertical*s/100);this.A=new p(i,h)}S(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t]=new e(!1,!1,!1,!1)}setMainThreshold(t,s,i){this.D(s),this.S(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.A.composeBox(t,!1)}setContainerThreshold(t,s,i,h){this.S(t,i,!1);const{top:e,left:n}=i,{height:r,width:o}=h,l=g.containerKey(s,t),u=g.depthKey(s);this.S(l,{left:n,top:e,right:n+o,bottom:e+r},!1),this.thresholds[u]?this.thresholds[u].assignBiggestBox(this.thresholds[l]):this.S(u,this.thresholds[l],!1)}isOutThreshold(t,s,i){return s.isOutThreshold(this.thresholds[t],this.isOut[t],i)}destroy(){Object.keys(this.thresholds).forEach((t=>{delete this.thresholds[t]})),Object.keys(this.isOut).forEach((t=>{delete this.isOut[t]}))}}function x(t,s,i){const{left:h,top:e,right:n,bottom:r,height:o,width:l}=t.getBoundingClientRect(),u=new f(e,n,r,h);return 0===s&&0===i||u.setByPointAndDimensions(e+i,h+s,o,l),u}function y(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,h){h&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function w(t,s=!1,i=200){const[h,e]=function(t){let s=null,i=!1;function h(){s&&(clearTimeout(s),s=null)}return[function(e,n){const r=e||o;i=!0,n&&h(),s=setTimeout((()=>{i=!1,r()}),t)},h,function(){return i}]}(i),[n,r]=y();let l=performance.now(),u=!1;const c=()=>{if(u)return;const e=performance.now();s||e-l>=i?(n(t,!0),l=e):h(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,r(),e())},c.resume=()=>{u&&(u=!1,c())},c}const T=Object.freeze(["x","y"]);let _=new WeakMap;function O(t,s,i){t.style.setProperty(s,i)}function v(t,s){t.style.removeProperty(s)}function b(t,s,i){const h=function(t){if(_.has(t))return _.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return _.set(t,s),s}(t),{parsedProperties:e,computedStyle:n}=h,r=e.get(s);if(void 0===r){const t=n.getPropertyValue(s),h=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return e.set(s,h),h}return r}function P(t){return b(t,c,!1)}function E(t,s){return b(t,s,!1)}const D=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function A(t,s,i){O(t,"transform",`translate3d(${s}px, ${i}px, 0)`)}class S{static getType(){return"base:element"}static transform=A;constructor(t){this.id=t,this.translate=new p(0,0),this.I=new Set}setAttribute(t,s,i){"INDEX"!==s?this.I.has(s)||(t.setAttribute(D[s],`${i}`),this.I.add(s)):t.setAttribute(D[s],`${i}`)}removeAttribute(t,s){"INDEX"!==s&&this.I.has(s)&&(t.removeAttribute(D[s]),this.I.delete(s))}clearAttributes(t){this.I.forEach((s=>{this.removeAttribute(t,s)})),this.I.clear()}}const I="transition-property",M="transition-delay",B="transition-duration",R="transition-timing-function";const N="transitionend";class F extends S{static getType(){return"core:element"}constructor(t){const{order:s,keys:i,depth:h,readonly:e,animation:n,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...s},this.DOMOrder={...s},this.keys={...i},this.depth=h,this.readonly=e,this.M=n,this.B=o,[this.R]=y(),this.N=!0,this.F=!1,this.L=void 0,this.$=null,this.q=new p(0,0),this.rect=new f(0,0,0,0),this.DOMGrid=new p(0,0)}updateConfig(t,s,i){this.readonly=t,this.M=s,this.B=i}initElmRect(t,s,i){this.rect=x(t,s,i);const{left:h,top:e}=this.rect;this.q.setAxes(h,e),this.C(t)}C(t){const s=function(t){const s=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const s=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return s?[parseFloat(s[5]),parseFloat(s[6])]:null}(b(t,"transform",!1));return s}(t);if(s){const[t,i]=s,h=this.q.x-t,e=this.q.y-i;this.q.setAxes(h,e),this.rect.setByPointAndDimensions(e,h,this.rect.height,this.rect.width),this.translate.setAxes(t,i)}}getDimensions(t){if(this.$)return this.$;const{width:s,height:i}=function(t){return{width:b(t,u,!0),height:b(t,l,!0)}}(t);return this.$=new p(s,i),this.$}getInitialPosition(){return this.q}changeVisibility(t,s){s!==this.N&&(this.N=s,this.F&&this.N&&(this.k(t,null),this.F=!1))}k(t,s,i=o){if(!this.N)return void(this.F=!0);const h=()=>{this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.keys(s).forEach((s=>{v(t,s)}))}(t,s):function(t,s){t.classList.remove(s)}(t,s)}(t,this.B),this.M&&function(t){v(t,I),v(t,M),v(t,B),v(t,R)}(t),s&&t.removeEventListener(N,h),i()};this.R((()=>{if(this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.entries(s).forEach((([s,i])=>{O(t,s,i)}))}(t,s):function(t,s){t.classList.add(s)}(t,s)}(t,this.B),null===s)return F.transform(t,this.translate.x,this.translate.y),void h();t.addEventListener(N,h),function(t,s,i,h){O(t,I,"transform"),O(t,M,"0ms"),O(t,B,`${i}ms`),O(t,R,h)}(t,0,s,this.M.easing),F.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,s){this.setAttribute(t,"INDEX",s),this.VDOMOrder.self=s}assignNewIndex(t,s){t[s]=this.id}j(t,s,i){const h={axes:t,numberOfPassedElm:i,translate:this.translate.getInstance()};void 0===this.L&&(this.L=new Map),this.L.has(s)||this.L.set(s,[]),this.L.get(s).push(h)}G(t,s,i){if(s)return!this.N&&this.F?void(this.F=!1):void this.k(t,i);this.N?this.k(t,i):this.F=!0}V(t,s,i,h){let e=null;if(this.M){const{duration:t}=this.M,i=this.translate.getInstance(),h=this.translate.increase(s).getInstance();e="number"==typeof t?t:function(t,s){const i=t.x-s.x,h=t.y-s.y,e=Math.sqrt(i*i+h*h);return 20*Math.sqrt(e)}(i,h)}else this.translate.increase(s);this.rect.setAxes(this.q.x+this.translate.x,this.q.y+this.translate.y),this.G(t,i,e);const{self:n}=this.VDOMOrder,r=n+h;return this.updateIndex(t,r),[n,r]}H(t,s,i){if(-1!==t)for(let t=0;t<s;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>i.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<s;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=i.x,this.DOMGrid.y-=1)}reconcilePosition(t,s,i,h,e,n,r,o){let l;const u={x:1===s?-1:1,y:s};"z"===t?l=T:(l=[t],u[t]=s),l.forEach((t=>{e[t]*=u[t],this.H(u[t],n,r)})),this.j(t,o,n);const c=s*n,[a,d]=this.V(i,e,!1,c);h[a]="",h[d]=this.id}restorePosition(t){this.k(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,s){this.translate.clone(s),this.k(t,null)}rollBackPosition(t,s){if(void 0===this.L||!this.L.has(s))return;const i=this.L.get(s),{translate:h,axes:e,numberOfPassedElm:n}=i.pop(),r={x:h.x-this.translate.x,y:h.y-this.translate.y};let o=0;const l={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:l.x*n,y:l.y*n})):(o=l[e]*n,this.DOMGrid[e]+=o),this.V(t,r,!0,o),0===i.length)return this.L.delete(s),void(0===this.L.size&&(this.L=void 0));this.rollBackPosition(t,s)}hasTransformedFromOrigin(){return this.q.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t){this.L=void 0,this.translate.setAxes(0,0),this.F=!1,this.DOMOrder.self=this.VDOMOrder.self,v(t,"transform"),function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)}(t,"style"),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:F.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof p?this.translate:null,order:this.VDOMOrder,initialPosition:this.q.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.F,isVisible:this.N}}}class L extends F{static getDistance(t,s,i){let h=t[i]-s.rect["x"===i?"left":"top"];return h+=s.translate[i],h}static getDisplacement(t,s,i){return t[i]-("x"===i?s.rect.right:s.rect.bottom)}getDisplacement(t,s){return L.getDisplacement(this.rect.getPosition(),t,s)}getDistance(t,s){return L.getDistance(this.rect.getPosition(),t,s)}}const z=/(auto|scroll|overlay)/;function $(t){const s=P(t),i=[void 0,!1,new m(!1,!1)],h=function(t,h){let e=0,n=t;try{do{if(e+=1,e>1&&((t,s,i)=>{const h=E(t,"overflow-x"),e=E(t,"overflow-y");if("absolute"===s&&"static"===P(t))return!1;const[,,n]=i,r=(s,i)=>((t,s,i,h)=>{if(z.test(s)){const s=function(t,s){return"y"===s?t.scrollHeight>t.clientHeight:t.scrollWidth>t.clientWidth}(i,t);if(s)return h[t]=!0,!0}return!1})(s,i,t,n);return r("y",e)||r("x",h)})(n,s,i))return e=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{e=0}return null}(t);return h&&"fixed"!==s?i[0]=h:(i[0]=document.documentElement,i[1]=!0),i}const q={horizontal:25,vertical:25},C={horizontal:10,vertical:10};class k{static getType(){return"scroll:container"}constructor(t,s,i,h){this.X=s,this.U=h,this.W={inner:{threshold:null,key:`scroll_inner_${s}`},outer:{threshold:null,key:`scroll_outer_${s}`}},this.K=`scroll__${s}`,[this.Y,this.J,this.hasOverflow]=$(t),this.totalScrollRect=new f(0,0,0,0),this.visibleScrollRect=new f(0,0,0,0),this.Z(),this.tt=i>10,this.J?this.st():this.it(),this.ht(!0)}hasDynamicVisibility(){return this.tt&&this.hasOverflow.isOneTruthy()}et(t,s){const i=this.W[t];if(!s)return void(i.threshold&&(i.threshold.destroy(),i.threshold=null));const h=new g(s);i.threshold=h,h.setMainThreshold(i.key,this.visibleScrollRect,"inner"===t)}nt(t,s){const i=this.K,h=s.toString(),e=this.J?document.body:this.Y;t?e.dataset[i]=h:delete e.dataset[i]}it(){if(this.hasOverflow.isAllFalsy())return this.et("inner",null),this.et("outer",null),void this.nt(!1,!0);this.nt(!0,!0),this.et("inner",null),this.et("inner",C),this.hasDynamicVisibility()&&(this.et("outer",null),this.et("outer",q))}st(){const t=(t,s)=>function(t,s,i,h=!1){const e=a(i);return t[e]/(h?.5:1)>s[e]}(this.totalScrollRect,this.visibleScrollRect,t,s),s=t("x"),i=t("y");this.hasOverflow.setAxes(s,i),this.it()}Z(){const{scrollHeight:t,scrollWidth:s,scrollLeft:i,scrollTop:h,clientHeight:e,clientWidth:n}=this.Y;if(this.totalScrollRect.setByPointAndDimensions(h,i,t,s),this.J)this.visibleScrollRect.setByPointAndDimensions(h,i,e,n);else{const{left:t,top:s}=this.Y.getBoundingClientRect();this.visibleScrollRect.setByPointAndDimensions(s,t,e,n)}}rt(t,s,i){return!!this.totalScrollRect.hasEqualPosition(t,s)&&(this.totalScrollRect.setPosition(t,s),i&&(this.Y.scrollTop=s,this.Y.scrollLeft=t),!0)}scrollTo(t,s){this.rt(-1===t?this.totalScrollRect.left:t,-1===s?this.totalScrollRect.right:s,!0),this.U(this.X)}ot(t){const s=d(t),i=this.totalScrollRect[s],h=function(t){return"x"===t?"right":"bottom"}(t),e=this.totalScrollRect[h],n=a(t);return[i,e,this.visibleScrollRect[n]]}calculateDistance(t,s){const[i,h,e]=this.ot(t);return 1===s?h-(i+e):i}hasScrollableArea(t,s){const[i,h,e]=this.ot(t);return 1===s?i+e<h:i>0}lt=w((()=>{const{scrollLeft:t,scrollTop:s}=this.Y;this.rt(t,s,!1)&&this.U(this.X)}));ut=w((()=>{this.Z(),this.st()}));ht(t){const s=t?"addEventListener":"removeEventListener",i=this.J?window:this.Y,h={passive:!0};i[s]("resize",this.ut,h),i[s]("scroll",this.lt,h)}pauseListeners(t){t?this.lt.pause():this.lt.resume()}getMaximumScrollContainerLeft(){const{left:t,width:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.left}getMaximumScrollContainerTop(){const{top:t,height:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.top}getElmViewportPosition(t,s){const{top:i,left:h}=this.totalScrollRect;return[t-i,s-h]}isElmOutViewport(t){let s,i;if(t instanceof f){const[h,e]=this.getElmViewportPosition(t.top,t.left);s=new n(h,e+t.width,h+t.height,e),i=this.W.outer}else s=t,i=this.W.inner;const{threshold:h,key:e}=i;return[h.isOutThreshold(e,s,this.hasOverflow.y?"y":"x"),h.isOut[e]]}ct(){const{height:t,width:s}=this.visibleScrollRect;return{height:t,width:s}}getSerializedInstance(){return{type:k.getType(),version:3,key:this.X,hasOverFlow:this.hasOverflow.getInstance(),hasDocumentAsContainer:this.J,scrollRect:this.totalScrollRect.getBox(),scrollContainerRect:this.visibleScrollRect.getBox(),visibleScreen:this.ct()}}destroy(){this.ht(!1),this.et("inner",null),this.et("outer",null),this.nt(!1,!0),this.U=void 0,this.Y=void 0}}exports.DFlexBaseElement=S,exports.DFlexElement=L,exports.DFlexParentContainer=class{constructor(t,s,i,h){this.id=t,this.dt=new p(-1,-1),this.grid=new p(-1,-1),this.originLength=i,this.ft=new n(0,0,0,0),this.gt=null;const{left:e,top:r}=h;this.xt=x(s,e,r),this.lastElmPosition=null}yt(t){const s=this.ft;return s.isPositionedY(t)?(this.dt.y+=1,this.dt.x=0,this.ft.setBox(0,0,0,0)):this.dt.x+=1,this.dt.x>this.grid.x&&(this.grid.x=this.dt.x),this.dt.y>this.grid.y&&(this.grid.y=this.dt.y),s.assignBiggestBox(t),this.dt}register(t,s){this.gt?this.gt.assignBiggestBox(t):this.gt=new n(t.top,t.right,t.bottom,t.left);const i=this.yt(t),h=this.gt,e=s;if(!e)return i;const r=h.bottom-h.top,o=h.right-h.left;return e.height<r&&(e.height=r),e.width<o&&(e.width=r),i}extendGrid(t){this.grid[t]+=1}reduceGrid(t){this.grid[t]-=1}getBoundaries(){return this.gt||this.xt.getBox()}resetIndicators(t){this.dt.setAxes(-1,-1),this.grid.setAxes(-1,-1),this.originLength=t,this.ft.setBox(0,0,0,0),this.gt=null,this.lastElmPosition=null}preservePosition(t){this.lastElmPosition?this.lastElmPosition.setAxes(t.x,t.y):this.lastElmPosition=new p(t.x,t.y)}},exports.DFlexScrollContainer=k;
class t{constructor(t,s){this.x=t,this.y=s}}class s extends t{setAxes(t,s){this.x=t,this.y=s}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,s){return this.x===t&&this.y===s}isNotEqual(t,s){return this.x!==t||this.y!==s}}class i{constructor(t,s,i,h){this.top=t,this.right=s,this.bottom=i,this.left=h}}class h extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,h){return this.top=t,this.right=s,this.bottom=i,this.left=h,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,s,i){"x"===t?(this.left=s,this.right=i):(this.top=s,this.bottom=i)}setOne(t,s,i){"x"===t?-1===s?this.left=i:this.right=i:-1===s?this.top=i:this.bottom=i}getOne(t,s){return"x"===t?-1===s?this.left:this.right:-1===s?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,s){this.top=s,this.left=t}hasEqualPosition(t,s){return this.top===s||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends h{constructor(t,s,i,h){super(t,s,i,h)}setFalsy(){return this.setBox(!1,!1,!1,!1),this}isTruthyByAxis(t){return"x"===t?this.left||this.right:this.top||this.bottom}isTruthyOnSide(t,s){return"x"===t?1===s?this.right:this.left:1===s?this.bottom:this.top}isTruthy(){return this.left||this.right||this.top||this.bottom}}class n extends h{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}l(t){return this.top<t.top}u(t){return this.right>t.right}m(t){return this.bottom>t.bottom}p(t){return this.left<t.left}T(t){return this.top>=t.top}_(t){return this.right<=t.right}O(t){return this.bottom<=t.bottom}v(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,s,i){if(s.setBox(!1,!1,!1,!1),i){if("y"===i){const i=this.l(t),h=this.m(t);return i&&(s.top=!0),h&&(s.bottom=!0),i||h}const h=this.p(t),e=this.u(t);return h&&(s.left=!0),e&&(s.right=!0),h||e}return this.l(t)?(s.top=!0,!0):this.u(t)?(s.right=!0,!0):this.m(t)?(s.bottom=!0,!0):!!this.p(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this.T(t)&&this._(t)&&this.O(t)&&this.v(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:s,left:i,right:h,bottom:e}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),h>this.right&&(this.right=h),e>this.bottom&&(this.bottom=e)}}function r(t,s){return`${t}_${s}`}function o(){}const l="height",u="width",c="position";function a(t){return"x"===t?u:l}function d(t){return"x"===t?"left":"top"}class f extends n{constructor(t,s,i,h){super(t,s,i,h),this.width=s-h,this.height=i-t}setByPointAndDimensions(t,s,i,h){this.top=t,this.left=s,this.width=h,this.height=i,this.right=s+h,this.bottom=t+i}setAxes(t,s){this.left=t,this.right=this.width+t,this.top=s,this.bottom=this.height+s}getDimensionDiff(t,s){const i=a(t);return this[i]-s[i]}getPositionDiff(t,s){return this[d(t)]-s[t]}}class m extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:h,bottom:e,right:r}=t;return s?new n(i+this.y,r-this.x,e-this.y,h+this.x):new n(i-this.y,r+this.x,e+this.y,h-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class p extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}}class g{static containerKey(t,s){return r(t,s)}static depthKey(t){return r(t,"dp")}constructor(t){this.D=t,this.thresholds={},this.isOut={}}P({width:t,height:s}){const i=Math.round(this.D.horizontal*t/100),h=Math.round(this.D.vertical*s/100);this.S=new m(i,h)}A(t,s,i){this.thresholds[t]=this.S.composeBox(s,i),this.isOut[t]=new e(!1,!1,!1,!1)}setMainThreshold(t,s,i){this.P(s),this.A(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.S.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.S.composeBox(t,!1)}setContainerThreshold(t,s,i,h){this.A(t,i,!1);const{top:e,left:n}=i,{height:r,width:o}=h,l=g.containerKey(s,t),u=g.depthKey(s);this.A(l,{left:n,top:e,right:n+o,bottom:e+r},!1),this.thresholds[u]?this.thresholds[u].assignBiggestBox(this.thresholds[l]):this.A(u,this.thresholds[l],!1)}isOutThreshold(t,s,i){return s.isOutThreshold(this.thresholds[t],this.isOut[t],i)}destroy(){Object.keys(this.thresholds).forEach((t=>{delete this.thresholds[t]})),Object.keys(this.isOut).forEach((t=>{delete this.isOut[t]}))}}function x(t,s,i){const{left:h,top:e,right:n,bottom:r,height:o,width:l}=t.getBoundingClientRect(),u=new f(e,n,r,h);return 0===s&&0===i||u.setByPointAndDimensions(e+i,h+s,o,l),u}function y(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,h){h&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function w(t,s=!1,i=200){const[h,e]=function(t){let s=null,i=!1;function h(){s&&(clearTimeout(s),s=null)}return[function(e,n){const r=e||o;i=!0,n&&h(),s=setTimeout((()=>{i=!1,r()}),t)},h,function(){return i}]}(i),[n,r]=y();let l=performance.now(),u=!1;const c=()=>{if(u)return;const e=performance.now();s||e-l>=i?(n(t,!0),l=e):h(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,r(),e())},c.resume=()=>{u&&(u=!1,c())},c}const T=Object.freeze(["x","y"]);let _=new WeakMap;function O(t,s,i){t.style.setProperty(s,i)}function v(t,s){t.style.removeProperty(s)}function b(t,s,i){const h=function(t){if(_.has(t))return _.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return _.set(t,s),s}(t),{parsedProperties:e,computedStyle:n}=h,r=e.get(s);if(void 0===r){const t=n.getPropertyValue(s),h=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return e.set(s,h),h}return r}function D(t){return b(t,c,!1)}function P(t,s){return b(t,s,!1)}const E=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function S(t,s,i){O(t,"transform",`translate3d(${s}px, ${i}px, 0)`)}class A{static getType(){return"base:element"}static transform=S;constructor(t){this.id=t,this.translate=new m(0,0),this.I=new Set}setAttribute(t,s,i){"INDEX"!==s?this.I.has(s)||(t.setAttribute(E[s],`${i}`),this.I.add(s)):t.setAttribute(E[s],`${i}`)}removeAttribute(t,s){"INDEX"!==s&&this.I.has(s)&&(t.removeAttribute(E[s]),this.I.delete(s))}clearAttributes(t){this.I.forEach((s=>{this.removeAttribute(t,s)})),this.I.clear()}}const I="transition-property",M="transition-delay",B="transition-duration",R="transition-timing-function";const N="transitionend";class F extends A{static getType(){return"core:element"}constructor(t){const{order:s,keys:i,depth:h,readonly:e,animation:n,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...s},this.DOMOrder={...s},this.keys={...i},this.depth=h,this.readonly=e,this.M=n,this.B=o,[this.R]=y(),this.N=!0,this.F=!1,this.L=void 0,this.C=null,this.$=new m(0,0),this.rect=new f(0,0,0,0),this.DOMGrid=new m(0,0)}updateConfig(t,s,i){this.readonly=t,this.M=s,this.B=i}initElmRect(t,s,i){this.rect=x(t,s,i);const{left:h,top:e}=this.rect;this.$.setAxes(h,e),this.q(t)}q(t){const s=function(t){const s=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const s=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return s?[parseFloat(s[5]),parseFloat(s[6])]:null}(b(t,"transform",!1));return s}(t);if(s){const[t,i]=s,h=this.$.x-t,e=this.$.y-i;this.$.setAxes(h,e),this.rect.setByPointAndDimensions(e,h,this.rect.height,this.rect.width),this.translate.setAxes(t,i)}}getDimensions(t){if(this.C)return this.C;const{width:s,height:i}=function(t){return{width:b(t,u,!0),height:b(t,l,!0)}}(t);return this.C=new m(s,i),this.C}getInitialPosition(){return this.$}changeVisibility(t,s){s!==this.N&&(this.N=s,this.F&&this.N&&(this.k(t,null),this.F=!1))}k(t,s,i=o){if(!this.N)return void(this.F=!0);const h=()=>{this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.keys(s).forEach((s=>{v(t,s)}))}(t,s):function(t,s){t.classList.remove(s)}(t,s)}(t,this.B),this.M&&function(t){v(t,I),v(t,M),v(t,B),v(t,R)}(t),s&&t.removeEventListener(N,h),i()};this.R((()=>{if(this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.entries(s).forEach((([s,i])=>{O(t,s,i)}))}(t,s):function(t,s){t.classList.add(s)}(t,s)}(t,this.B),null===s)return F.transform(t,this.translate.x,this.translate.y),void h();t.addEventListener(N,h),function(t,s,i,h){O(t,I,"transform"),O(t,M,"0ms"),O(t,B,`${i}ms`),O(t,R,h)}(t,0,s,this.M.easing),F.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,s){this.setAttribute(t,"INDEX",s),this.VDOMOrder.self=s}assignNewIndex(t,s){t[s]=this.id}V(t,s,i){const h={axes:t,numberOfPassedElm:i,translate:this.translate.getInstance()};void 0===this.L&&(this.L=new Map),this.L.has(s)||this.L.set(s,[]),this.L.get(s).push(h)}j(t,s,i){if(s)return!this.N&&this.F?void(this.F=!1):void this.k(t,i);this.N?this.k(t,i):this.F=!0}G(t,s,i,h){let e=null;if(this.M){const{duration:t}=this.M,i=this.translate.getInstance(),h=this.translate.increase(s).getInstance();e="number"==typeof t?t:function(t,s){const i=t.x-s.x,h=t.y-s.y,e=Math.sqrt(i*i+h*h);return 20*Math.sqrt(e)}(i,h)}else this.translate.increase(s);this.rect.setAxes(this.$.x+this.translate.x,this.$.y+this.translate.y),this.j(t,i,e);const{self:n}=this.VDOMOrder,r=n+h;return this.updateIndex(t,r),[n,r]}H(t,s,i){if(-1!==t)for(let t=0;t<s;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>i.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<s;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=i.x,this.DOMGrid.y-=1)}reconcilePosition(t,s,i,h,e,n,r,o){let l;const u={x:1===s?-1:1,y:s};"z"===t?l=T:(l=[t],u[t]=s),l.forEach((t=>{e[t]*=u[t],this.H(u[t],n,r)})),this.V(t,o,n);const c=s*n,[a,d]=this.G(i,e,!1,c);h[a]="",h[d]=this.id}restorePosition(t){this.k(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,s){this.translate.clone(s),this.k(t,null)}rollBackPosition(t,s){if(void 0===this.L||!this.L.has(s))return;const i=this.L.get(s),{translate:h,axes:e,numberOfPassedElm:n}=i.pop(),r={x:h.x-this.translate.x,y:h.y-this.translate.y};let o=0;const l={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:l.x*n,y:l.y*n})):(o=l[e]*n,this.DOMGrid[e]+=o),this.G(t,r,!0,o),0===i.length)return this.L.delete(s),void(0===this.L.size&&(this.L=void 0));this.rollBackPosition(t,s)}hasTransformedFromOrigin(){return this.$.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t){this.L=void 0,this.translate.setAxes(0,0),this.F=!1,this.DOMOrder.self=this.VDOMOrder.self,v(t,"transform"),function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)}(t,"style"),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:F.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof m?this.translate:null,order:this.VDOMOrder,initialPosition:this.$.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.F,isVisible:this.N}}}class L extends F{static getDistance(t,s,i){let h=t[i]-s.rect["x"===i?"left":"top"];return h+=s.translate[i],h}static getDisplacement(t,s,i){return t[i]-("x"===i?s.rect.right:s.rect.bottom)}getDisplacement(t,s){return L.getDisplacement(this.rect.getPosition(),t,s)}getDistance(t,s){return L.getDistance(this.rect.getPosition(),t,s)}}const C=/(auto|scroll|overlay)/;function z(t){const s=D(t),i=[void 0,!1,new p(!1,!1)],h=function(t,h){let e=0,n=t;try{do{if(e+=1,e>1&&((t,s,i)=>{const h=P(t,"overflow-x"),e=P(t,"overflow-y");if("absolute"===s&&"static"===D(t))return!1;const[,,n]=i,r=(s,i)=>((t,s,i,h)=>{if(C.test(s)){const s=function(t,s){return"y"===s?t.scrollHeight>t.clientHeight:t.scrollWidth>t.clientWidth}(i,t);if(s)return h[t]=!0,!0}return!1})(s,i,t,n);return r("y",e)||r("x",h)})(n,s,i))return e=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{e=0}return null}(t);return h&&"fixed"!==s?i[0]=h:(i[0]=document.documentElement,i[1]=!0),i}const $={horizontal:25,vertical:25},q={horizontal:10,vertical:10};class k{static getType(){return"scroll:container"}constructor(t,s,i,h){this.X=s,this.U=h,this.W={inner:{threshold:null,key:`scroll_inner_${s}`},outer:{threshold:null,key:`scroll_outer_${s}`}},this.K=`scroll__${s}`,[this.Y,this.J,this.hasOverflow]=z(t),this.totalScrollRect=new f(0,0,0,0),this.visibleScrollRect=new f(0,0,0,0),this.Z=!1,this.refreshScrollAndVisibility(i),this.tt(!0)}hasDynamicVisibility(){return this.Z&&this.hasOverflow.isOneTruthy()}st(t,s){const i=this.W[t];if(!s)return void(i.threshold&&(i.threshold.destroy(),i.threshold=null));const h=new g(s);i.threshold=h,h.setMainThreshold(i.key,this.visibleScrollRect,"inner"===t)}it(t,s){const i=this.K,h=s.toString(),e=this.J?document.body:this.Y;t?e.dataset[i]=h:delete e.dataset[i]}ht(){if(this.hasOverflow.isAllFalsy())return this.st("inner",null),this.st("outer",null),void this.it(!1,!0);this.it(!0,!0),this.st("inner",null),this.st("inner",q),this.hasDynamicVisibility()&&(this.st("outer",null),this.st("outer",$))}et(){const t=(t,s)=>function(t,s,i,h=!1){const e=a(i);return t[e]/(h?.5:1)>s[e]}(this.totalScrollRect,this.visibleScrollRect,t,s),s=t("x"),i=t("y");this.hasOverflow.setAxes(s,i),this.ht()}nt(t,s){return this.Y["x"===t?"scrollWidth":"scrollHeight"]!==s}hasScrollDimensionChanges(){const{width:t,height:s}=this.totalScrollRect;return this.nt("y",s)||this.nt("x",t)}refreshScrollAndVisibility(t){this.rt(),this.Z=t>10,this.J?this.et():this.ht()}rt(){const{scrollHeight:t,scrollWidth:s,scrollLeft:i,scrollTop:h,clientHeight:e,clientWidth:n}=this.Y;if(this.totalScrollRect.setByPointAndDimensions(h,i,t,s),this.J)this.visibleScrollRect.setByPointAndDimensions(h,i,e,n);else{const{left:t,top:s}=this.Y.getBoundingClientRect();this.visibleScrollRect.setByPointAndDimensions(s,t,e,n)}}ot(t,s,i){return!!this.totalScrollRect.hasEqualPosition(t,s)&&(this.totalScrollRect.setPosition(t,s),i&&(this.Y.scrollTop=s,this.Y.scrollLeft=t),!0)}scrollTo(t,s){this.ot(-1===t?this.totalScrollRect.left:t,-1===s?this.totalScrollRect.right:s,!0),this.U(this.X)}lt(t){const s=d(t),i=this.totalScrollRect[s],h=function(t){return"x"===t?"right":"bottom"}(t),e=this.totalScrollRect[h],n=a(t);return[i,e,this.visibleScrollRect[n]]}calculateDistance(t,s){const[i,h,e]=this.lt(t);return 1===s?h-(i+e):i}hasScrollableArea(t,s){const[i,h,e]=this.lt(t);return 1===s?i+e<h:i>0}ut=w((()=>{const{scrollLeft:t,scrollTop:s}=this.Y;this.ot(t,s,!1)&&this.U(this.X)}));ct=w((()=>{this.rt(),this.et()}));tt(t){const s=t?"addEventListener":"removeEventListener",i=this.J?window:this.Y,h={passive:!0};i[s]("resize",this.ct,h),i[s]("scroll",this.ut,h)}pauseListeners(t){t?this.ut.pause():this.ut.resume()}getMaximumScrollContainerLeft(){const{left:t,width:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.left}getMaximumScrollContainerTop(){const{top:t,height:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.top}getElmViewportPosition(t,s){const{top:i,left:h}=this.totalScrollRect;return[t-i,s-h]}isElmOutViewport(t){let s,i;if(t instanceof f){const[h,e]=this.getElmViewportPosition(t.top,t.left);s=new n(h,e+t.width,h+t.height,e),i=this.W.outer}else s=t,i=this.W.inner;const{threshold:h,key:e}=i;return[h.isOutThreshold(e,s,this.hasOverflow.y?"y":"x"),h.isOut[e]]}dt(){const{height:t,width:s}=this.visibleScrollRect;return{height:t,width:s}}getSerializedInstance(){return{type:k.getType(),version:3,key:this.X,hasOverFlow:this.hasOverflow.getInstance(),hasDocumentAsContainer:this.J,scrollRect:this.totalScrollRect.getBox(),scrollContainerRect:this.visibleScrollRect.getBox(),visibleScreen:this.dt()}}destroy(){this.tt(!1),this.st("inner",null),this.st("outer",null),this.it(!1,!0),this.U=void 0,this.Y=void 0}}exports.DFlexBaseElement=A,exports.DFlexElement=L,exports.DFlexParentContainer=class{constructor(t,s,i,h){this.id=t,this.ft=new m(-1,-1),this.grid=new m(-1,-1),this.originLength=i,this.gt=new n(0,0,0,0),this.xt=null;const{left:e,top:r}=h;this.yt=x(s,e,r),this.lastElmPosition=null}wt(t){const s=this.gt;return s.isPositionedY(t)?(this.ft.y+=1,this.ft.x=0,this.gt.setBox(0,0,0,0)):this.ft.x+=1,this.ft.x>this.grid.x&&(this.grid.x=this.ft.x),this.ft.y>this.grid.y&&(this.grid.y=this.ft.y),s.assignBiggestBox(t),this.ft}register(t,s){this.xt?this.xt.assignBiggestBox(t):this.xt=new n(t.top,t.right,t.bottom,t.left);const i=this.wt(t),h=this.xt,e=s;if(!e)return i;const r=h.bottom-h.top,o=h.right-h.left;return e.height<r&&(e.height=r),e.width<o&&(e.width=r),i}extendGrid(t){this.grid[t]+=1}reduceGrid(t){this.grid[t]-=1}getBoundaries(){return this.xt||this.yt.getBox()}resetIndicators(t){this.ft.setAxes(-1,-1),this.grid.setAxes(-1,-1),this.originLength=t,this.gt.setBox(0,0,0,0),this.xt=null,this.lastElmPosition=null}preservePosition(t){this.lastElmPosition?this.lastElmPosition.setAxes(t.x,t.y):this.lastElmPosition=new m(t.x,t.y)}},exports.DFlexScrollContainer=k;

@@ -833,3 +833,3 @@ 'use strict';

function DFlexCreateTimeout(delay) {
function DFlexCreateTimeout(msDelay) {
let id = null;

@@ -852,3 +852,3 @@ let isThrottled = false;

cb();
}, delay);
}, msDelay);
}

@@ -1829,13 +1829,4 @@ function getIsThrottled() {

this.visibleScrollRect = new BoxRect(0, 0, 0, 0);
this._updateScrollRect();
this._isCandidateForDynamicVisibility = branchLength > MAX_NUM_OF_SIBLINGS_BEFORE_DYNAMIC_VISIBILITY;
// If the container is not the document, there is no need to update the overflow status,
// as the overflow has already been detected during initialization.
if (this._isDocumentContainer) {
this._updateOverflow();
} else {
// We certain there's overflow.
this._handleOverflowUpdate();
}
this._isCandidateForDynamicVisibility = false;
this.refreshScrollAndVisibility(branchLength);
this._attachResizeAndScrollListeners(true);

@@ -1901,3 +1892,27 @@ {

}
_hasChangedScrollDimension(axis, prevValue) {
const liveValue = this._containerDOM[axis === "x" ? "scrollWidth" : "scrollHeight"];
return liveValue !== prevValue;
}
hasScrollDimensionChanges() {
const {
width,
height
} = this.totalScrollRect;
return this._hasChangedScrollDimension("y", height) || this._hasChangedScrollDimension("x", width);
}
refreshScrollAndVisibility(branchLength) {
this._updateScrollRect();
this._isCandidateForDynamicVisibility = branchLength > MAX_NUM_OF_SIBLINGS_BEFORE_DYNAMIC_VISIBILITY;
// If the container is not the document, there is no need to update the overflow status,
// as the overflow has already been detected during initialization.
if (this._isDocumentContainer) {
this._updateOverflow();
} else {
// We certain there's overflow.
this._handleOverflowUpdate();
}
}
/**

@@ -1904,0 +1919,0 @@ * Updates the scroll-related rectangles based on the container's dimensions and scroll positions.

@@ -1,1 +0,1 @@

class t{constructor(t,s){this.x=t,this.y=s}}class s extends t{setAxes(t,s){this.x=t,this.y=s}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,s){return this.x===t&&this.y===s}isNotEqual(t,s){return this.x!==t||this.y!==s}}class i{constructor(t,s,i,h){this.top=t,this.right=s,this.bottom=i,this.left=h}}class h extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,h){return this.top=t,this.right=s,this.bottom=i,this.left=h,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,s,i){"x"===t?(this.left=s,this.right=i):(this.top=s,this.bottom=i)}setOne(t,s,i){"x"===t?-1===s?this.left=i:this.right=i:-1===s?this.top=i:this.bottom=i}getOne(t,s){return"x"===t?-1===s?this.left:this.right:-1===s?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,s){this.top=s,this.left=t}hasEqualPosition(t,s){return this.top===s||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends h{constructor(t,s,i,h){super(t,s,i,h)}setFalsy(){return this.setBox(!1,!1,!1,!1),this}isTruthyByAxis(t){return"x"===t?this.left||this.right:this.top||this.bottom}isTruthyOnSide(t,s){return"x"===t?1===s?this.right:this.left:1===s?this.bottom:this.top}isTruthy(){return this.left||this.right||this.top||this.bottom}}class n extends h{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}l(t){return this.top<t.top}u(t){return this.right>t.right}p(t){return this.bottom>t.bottom}m(t){return this.left<t.left}T(t){return this.top>=t.top}_(t){return this.right<=t.right}O(t){return this.bottom<=t.bottom}v(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,s,i){if(s.setBox(!1,!1,!1,!1),i){if("y"===i){const i=this.l(t),h=this.p(t);return i&&(s.top=!0),h&&(s.bottom=!0),i||h}const h=this.m(t),e=this.u(t);return h&&(s.left=!0),e&&(s.right=!0),h||e}return this.l(t)?(s.top=!0,!0):this.u(t)?(s.right=!0,!0):this.p(t)?(s.bottom=!0,!0):!!this.m(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this.T(t)&&this._(t)&&this.O(t)&&this.v(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:s,left:i,right:h,bottom:e}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),h>this.right&&(this.right=h),e>this.bottom&&(this.bottom=e)}}function r(t,s){return`${t}_${s}`}function o(){}const l="height",u="width",c="position";function a(t){return"x"===t?u:l}function d(t){return"x"===t?"left":"top"}class f extends n{constructor(t,s,i,h){super(t,s,i,h),this.width=s-h,this.height=i-t}setByPointAndDimensions(t,s,i,h){this.top=t,this.left=s,this.width=h,this.height=i,this.right=s+h,this.bottom=t+i}setAxes(t,s){this.left=t,this.right=this.width+t,this.top=s,this.bottom=this.height+s}getDimensionDiff(t,s){const i=a(t);return this[i]-s[i]}getPositionDiff(t,s){return this[d(t)]-s[t]}}class p extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:h,bottom:e,right:r}=t;return s?new n(i+this.y,r-this.x,e-this.y,h+this.x):new n(i-this.y,r+this.x,e+this.y,h-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class m extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}}class g{static containerKey(t,s){return r(t,s)}static depthKey(t){return r(t,"dp")}constructor(t){this.P=t,this.thresholds={},this.isOut={}}D({width:t,height:s}){const i=Math.round(this.P.horizontal*t/100),h=Math.round(this.P.vertical*s/100);this.A=new p(i,h)}S(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t]=new e(!1,!1,!1,!1)}setMainThreshold(t,s,i){this.D(s),this.S(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.A.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.A.composeBox(t,!1)}setContainerThreshold(t,s,i,h){this.S(t,i,!1);const{top:e,left:n}=i,{height:r,width:o}=h,l=g.containerKey(s,t),u=g.depthKey(s);this.S(l,{left:n,top:e,right:n+o,bottom:e+r},!1),this.thresholds[u]?this.thresholds[u].assignBiggestBox(this.thresholds[l]):this.S(u,this.thresholds[l],!1)}isOutThreshold(t,s,i){return s.isOutThreshold(this.thresholds[t],this.isOut[t],i)}destroy(){Object.keys(this.thresholds).forEach((t=>{delete this.thresholds[t]})),Object.keys(this.isOut).forEach((t=>{delete this.isOut[t]}))}}function x(t,s,i){const{left:h,top:e,right:n,bottom:r,height:o,width:l}=t.getBoundingClientRect(),u=new f(e,n,r,h);return 0===s&&0===i||u.setByPointAndDimensions(e+i,h+s,o,l),u}function y(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,h){h&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function w(t,s=!1,i=200){const[h,e]=function(t){let s=null,i=!1;function h(){s&&(clearTimeout(s),s=null)}return[function(e,n){const r=e||o;i=!0,n&&h(),s=setTimeout((()=>{i=!1,r()}),t)},h,function(){return i}]}(i),[n,r]=y();let l=performance.now(),u=!1;const c=()=>{if(u)return;const e=performance.now();s||e-l>=i?(n(t,!0),l=e):h(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,r(),e())},c.resume=()=>{u&&(u=!1,c())},c}const T=Object.freeze(["x","y"]);let _=new WeakMap;function O(t,s,i){t.style.setProperty(s,i)}function v(t,s){t.style.removeProperty(s)}function b(t,s,i){const h=function(t){if(_.has(t))return _.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return _.set(t,s),s}(t),{parsedProperties:e,computedStyle:n}=h,r=e.get(s);if(void 0===r){const t=n.getPropertyValue(s),h=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return e.set(s,h),h}return r}function P(t){return b(t,c,!1)}function E(t,s){return b(t,s,!1)}const D=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function A(t,s,i){O(t,"transform",`translate3d(${s}px, ${i}px, 0)`)}class S{static getType(){return"base:element"}static transform=A;constructor(t){this.id=t,this.translate=new p(0,0),this.I=new Set}setAttribute(t,s,i){"INDEX"!==s?this.I.has(s)||(t.setAttribute(D[s],`${i}`),this.I.add(s)):t.setAttribute(D[s],`${i}`)}removeAttribute(t,s){"INDEX"!==s&&this.I.has(s)&&(t.removeAttribute(D[s]),this.I.delete(s))}clearAttributes(t){this.I.forEach((s=>{this.removeAttribute(t,s)})),this.I.clear()}}const I="transition-property",M="transition-delay",B="transition-duration",R="transition-timing-function";const N="transitionend";class F extends S{static getType(){return"core:element"}constructor(t){const{order:s,keys:i,depth:h,readonly:e,animation:n,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...s},this.DOMOrder={...s},this.keys={...i},this.depth=h,this.readonly=e,this.M=n,this.B=o,[this.R]=y(),this.N=!0,this.F=!1,this.L=void 0,this.$=null,this.q=new p(0,0),this.rect=new f(0,0,0,0),this.DOMGrid=new p(0,0)}updateConfig(t,s,i){this.readonly=t,this.M=s,this.B=i}initElmRect(t,s,i){this.rect=x(t,s,i);const{left:h,top:e}=this.rect;this.q.setAxes(h,e),this.C(t)}C(t){const s=function(t){const s=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const s=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return s?[parseFloat(s[5]),parseFloat(s[6])]:null}(b(t,"transform",!1));return s}(t);if(s){const[t,i]=s,h=this.q.x-t,e=this.q.y-i;this.q.setAxes(h,e),this.rect.setByPointAndDimensions(e,h,this.rect.height,this.rect.width),this.translate.setAxes(t,i)}}getDimensions(t){if(this.$)return this.$;const{width:s,height:i}=function(t){return{width:b(t,u,!0),height:b(t,l,!0)}}(t);return this.$=new p(s,i),this.$}getInitialPosition(){return this.q}changeVisibility(t,s){s!==this.N&&(this.N=s,this.F&&this.N&&(this.k(t,null),this.F=!1))}k(t,s,i=o){if(!this.N)return void(this.F=!0);const h=()=>{this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.keys(s).forEach((s=>{v(t,s)}))}(t,s):function(t,s){t.classList.remove(s)}(t,s)}(t,this.B),this.M&&function(t){v(t,I),v(t,M),v(t,B),v(t,R)}(t),s&&t.removeEventListener(N,h),i()};this.R((()=>{if(this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.entries(s).forEach((([s,i])=>{O(t,s,i)}))}(t,s):function(t,s){t.classList.add(s)}(t,s)}(t,this.B),null===s)return F.transform(t,this.translate.x,this.translate.y),void h();t.addEventListener(N,h),function(t,s,i,h){O(t,I,"transform"),O(t,M,"0ms"),O(t,B,`${i}ms`),O(t,R,h)}(t,0,s,this.M.easing),F.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,s){this.setAttribute(t,"INDEX",s),this.VDOMOrder.self=s}assignNewIndex(t,s){t[s]=this.id}j(t,s,i){const h={axes:t,numberOfPassedElm:i,translate:this.translate.getInstance()};void 0===this.L&&(this.L=new Map),this.L.has(s)||this.L.set(s,[]),this.L.get(s).push(h)}G(t,s,i){if(s)return!this.N&&this.F?void(this.F=!1):void this.k(t,i);this.N?this.k(t,i):this.F=!0}V(t,s,i,h){let e=null;if(this.M){const{duration:t}=this.M,i=this.translate.getInstance(),h=this.translate.increase(s).getInstance();e="number"==typeof t?t:function(t,s){const i=t.x-s.x,h=t.y-s.y,e=Math.sqrt(i*i+h*h);return 20*Math.sqrt(e)}(i,h)}else this.translate.increase(s);this.rect.setAxes(this.q.x+this.translate.x,this.q.y+this.translate.y),this.G(t,i,e);const{self:n}=this.VDOMOrder,r=n+h;return this.updateIndex(t,r),[n,r]}H(t,s,i){if(-1!==t)for(let t=0;t<s;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>i.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<s;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=i.x,this.DOMGrid.y-=1)}reconcilePosition(t,s,i,h,e,n,r,o){let l;const u={x:1===s?-1:1,y:s};"z"===t?l=T:(l=[t],u[t]=s),l.forEach((t=>{e[t]*=u[t],this.H(u[t],n,r)})),this.j(t,o,n);const c=s*n,[a,d]=this.V(i,e,!1,c);h[a]="",h[d]=this.id}restorePosition(t){this.k(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,s){this.translate.clone(s),this.k(t,null)}rollBackPosition(t,s){if(void 0===this.L||!this.L.has(s))return;const i=this.L.get(s),{translate:h,axes:e,numberOfPassedElm:n}=i.pop(),r={x:h.x-this.translate.x,y:h.y-this.translate.y};let o=0;const l={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:l.x*n,y:l.y*n})):(o=l[e]*n,this.DOMGrid[e]+=o),this.V(t,r,!0,o),0===i.length)return this.L.delete(s),void(0===this.L.size&&(this.L=void 0));this.rollBackPosition(t,s)}hasTransformedFromOrigin(){return this.q.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t){this.L=void 0,this.translate.setAxes(0,0),this.F=!1,this.DOMOrder.self=this.VDOMOrder.self,v(t,"transform"),function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)}(t,"style"),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:F.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof p?this.translate:null,order:this.VDOMOrder,initialPosition:this.q.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.F,isVisible:this.N}}}class L extends F{static getDistance(t,s,i){let h=t[i]-s.rect["x"===i?"left":"top"];return h+=s.translate[i],h}static getDisplacement(t,s,i){return t[i]-("x"===i?s.rect.right:s.rect.bottom)}getDisplacement(t,s){return L.getDisplacement(this.rect.getPosition(),t,s)}getDistance(t,s){return L.getDistance(this.rect.getPosition(),t,s)}}const z=/(auto|scroll|overlay)/;function $(t){const s=P(t),i=[void 0,!1,new m(!1,!1)],h=function(t,h){let e=0,n=t;try{do{if(e+=1,e>1&&((t,s,i)=>{const h=E(t,"overflow-x"),e=E(t,"overflow-y");if("absolute"===s&&"static"===P(t))return!1;const[,,n]=i,r=(s,i)=>((t,s,i,h)=>{if(z.test(s)){const s=function(t,s){return"y"===s?t.scrollHeight>t.clientHeight:t.scrollWidth>t.clientWidth}(i,t);if(s)return h[t]=!0,!0}return!1})(s,i,t,n);return r("y",e)||r("x",h)})(n,s,i))return e=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{e=0}return null}(t);return h&&"fixed"!==s?i[0]=h:(i[0]=document.documentElement,i[1]=!0),i}const q={horizontal:25,vertical:25},C={horizontal:10,vertical:10};class k{static getType(){return"scroll:container"}constructor(t,s,i,h){this.X=s,this.U=h,this.W={inner:{threshold:null,key:`scroll_inner_${s}`},outer:{threshold:null,key:`scroll_outer_${s}`}},this.K=`scroll__${s}`,[this.Y,this.J,this.hasOverflow]=$(t),this.totalScrollRect=new f(0,0,0,0),this.visibleScrollRect=new f(0,0,0,0),this.Z(),this.tt=i>10,this.J?this.st():this.it(),this.ht(!0)}hasDynamicVisibility(){return this.tt&&this.hasOverflow.isOneTruthy()}et(t,s){const i=this.W[t];if(!s)return void(i.threshold&&(i.threshold.destroy(),i.threshold=null));const h=new g(s);i.threshold=h,h.setMainThreshold(i.key,this.visibleScrollRect,"inner"===t)}nt(t,s){const i=this.K,h=s.toString(),e=this.J?document.body:this.Y;t?e.dataset[i]=h:delete e.dataset[i]}it(){if(this.hasOverflow.isAllFalsy())return this.et("inner",null),this.et("outer",null),void this.nt(!1,!0);this.nt(!0,!0),this.et("inner",null),this.et("inner",C),this.hasDynamicVisibility()&&(this.et("outer",null),this.et("outer",q))}st(){const t=(t,s)=>function(t,s,i,h=!1){const e=a(i);return t[e]/(h?.5:1)>s[e]}(this.totalScrollRect,this.visibleScrollRect,t,s),s=t("x"),i=t("y");this.hasOverflow.setAxes(s,i),this.it()}Z(){const{scrollHeight:t,scrollWidth:s,scrollLeft:i,scrollTop:h,clientHeight:e,clientWidth:n}=this.Y;if(this.totalScrollRect.setByPointAndDimensions(h,i,t,s),this.J)this.visibleScrollRect.setByPointAndDimensions(h,i,e,n);else{const{left:t,top:s}=this.Y.getBoundingClientRect();this.visibleScrollRect.setByPointAndDimensions(s,t,e,n)}}rt(t,s,i){return!!this.totalScrollRect.hasEqualPosition(t,s)&&(this.totalScrollRect.setPosition(t,s),i&&(this.Y.scrollTop=s,this.Y.scrollLeft=t),!0)}scrollTo(t,s){this.rt(-1===t?this.totalScrollRect.left:t,-1===s?this.totalScrollRect.right:s,!0),this.U(this.X)}ot(t){const s=d(t),i=this.totalScrollRect[s],h=function(t){return"x"===t?"right":"bottom"}(t),e=this.totalScrollRect[h],n=a(t);return[i,e,this.visibleScrollRect[n]]}calculateDistance(t,s){const[i,h,e]=this.ot(t);return 1===s?h-(i+e):i}hasScrollableArea(t,s){const[i,h,e]=this.ot(t);return 1===s?i+e<h:i>0}lt=w((()=>{const{scrollLeft:t,scrollTop:s}=this.Y;this.rt(t,s,!1)&&this.U(this.X)}));ut=w((()=>{this.Z(),this.st()}));ht(t){const s=t?"addEventListener":"removeEventListener",i=this.J?window:this.Y,h={passive:!0};i[s]("resize",this.ut,h),i[s]("scroll",this.lt,h)}pauseListeners(t){t?this.lt.pause():this.lt.resume()}getMaximumScrollContainerLeft(){const{left:t,width:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.left}getMaximumScrollContainerTop(){const{top:t,height:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.top}getElmViewportPosition(t,s){const{top:i,left:h}=this.totalScrollRect;return[t-i,s-h]}isElmOutViewport(t){let s,i;if(t instanceof f){const[h,e]=this.getElmViewportPosition(t.top,t.left);s=new n(h,e+t.width,h+t.height,e),i=this.W.outer}else s=t,i=this.W.inner;const{threshold:h,key:e}=i;return[h.isOutThreshold(e,s,this.hasOverflow.y?"y":"x"),h.isOut[e]]}ct(){const{height:t,width:s}=this.visibleScrollRect;return{height:t,width:s}}getSerializedInstance(){return{type:k.getType(),version:3,key:this.X,hasOverFlow:this.hasOverflow.getInstance(),hasDocumentAsContainer:this.J,scrollRect:this.totalScrollRect.getBox(),scrollContainerRect:this.visibleScrollRect.getBox(),visibleScreen:this.ct()}}destroy(){this.ht(!1),this.et("inner",null),this.et("outer",null),this.nt(!1,!0),this.U=void 0,this.Y=void 0}}exports.DFlexBaseElement=S,exports.DFlexElement=L,exports.DFlexParentContainer=class{constructor(t,s,i,h){this.id=t,this.dt=new p(-1,-1),this.grid=new p(-1,-1),this.originLength=i,this.ft=new n(0,0,0,0),this.gt=null;const{left:e,top:r}=h;this.xt=x(s,e,r),this.lastElmPosition=null}yt(t){const s=this.ft;return s.isPositionedY(t)?(this.dt.y+=1,this.dt.x=0,this.ft.setBox(0,0,0,0)):this.dt.x+=1,this.dt.x>this.grid.x&&(this.grid.x=this.dt.x),this.dt.y>this.grid.y&&(this.grid.y=this.dt.y),s.assignBiggestBox(t),this.dt}register(t,s){this.gt?this.gt.assignBiggestBox(t):this.gt=new n(t.top,t.right,t.bottom,t.left);const i=this.yt(t),h=this.gt,e=s;if(!e)return i;const r=h.bottom-h.top,o=h.right-h.left;return e.height<r&&(e.height=r),e.width<o&&(e.width=r),i}extendGrid(t){this.grid[t]+=1}reduceGrid(t){this.grid[t]-=1}getBoundaries(){return this.gt||this.xt.getBox()}resetIndicators(t){this.dt.setAxes(-1,-1),this.grid.setAxes(-1,-1),this.originLength=t,this.ft.setBox(0,0,0,0),this.gt=null,this.lastElmPosition=null}preservePosition(t){this.lastElmPosition?this.lastElmPosition.setAxes(t.x,t.y):this.lastElmPosition=new p(t.x,t.y)}},exports.DFlexScrollContainer=k;
class t{constructor(t,s){this.x=t,this.y=s}}class s extends t{setAxes(t,s){this.x=t,this.y=s}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,s){return this.x===t&&this.y===s}isNotEqual(t,s){return this.x!==t||this.y!==s}}class i{constructor(t,s,i,h){this.top=t,this.right=s,this.bottom=i,this.left=h}}class h extends i{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,s,i,h){return this.top=t,this.right=s,this.bottom=i,this.left=h,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,s,i){"x"===t?(this.left=s,this.right=i):(this.top=s,this.bottom=i)}setOne(t,s,i){"x"===t?-1===s?this.left=i:this.right=i:-1===s?this.top=i:this.bottom=i}getOne(t,s){return"x"===t?-1===s?this.left:this.right:-1===s?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,s){this.top=s,this.left=t}hasEqualPosition(t,s){return this.top===s||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends h{constructor(t,s,i,h){super(t,s,i,h)}setFalsy(){return this.setBox(!1,!1,!1,!1),this}isTruthyByAxis(t){return"x"===t?this.left||this.right:this.top||this.bottom}isTruthyOnSide(t,s){return"x"===t?1===s?this.right:this.left:1===s?this.bottom:this.top}isTruthy(){return this.left||this.right||this.top||this.bottom}}class n extends h{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}l(t){return this.top<t.top}u(t){return this.right>t.right}m(t){return this.bottom>t.bottom}p(t){return this.left<t.left}T(t){return this.top>=t.top}_(t){return this.right<=t.right}O(t){return this.bottom<=t.bottom}v(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,s,i){if(s.setBox(!1,!1,!1,!1),i){if("y"===i){const i=this.l(t),h=this.m(t);return i&&(s.top=!0),h&&(s.bottom=!0),i||h}const h=this.p(t),e=this.u(t);return h&&(s.left=!0),e&&(s.right=!0),h||e}return this.l(t)?(s.top=!0,!0):this.u(t)?(s.right=!0,!0):this.m(t)?(s.bottom=!0,!0):!!this.p(t)&&(s.left=!0,!0)}isInsideThreshold(t){return this.T(t)&&this._(t)&&this.O(t)&&this.v(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:s,left:i,right:h,bottom:e}=t;i<this.left&&(this.left=i),s<this.top&&(this.top=s),h>this.right&&(this.right=h),e>this.bottom&&(this.bottom=e)}}function r(t,s){return`${t}_${s}`}function o(){}const l="height",u="width",c="position";function a(t){return"x"===t?u:l}function d(t){return"x"===t?"left":"top"}class f extends n{constructor(t,s,i,h){super(t,s,i,h),this.width=s-h,this.height=i-t}setByPointAndDimensions(t,s,i,h){this.top=t,this.left=s,this.width=h,this.height=i,this.right=s+h,this.bottom=t+i}setAxes(t,s){this.left=t,this.right=this.width+t,this.top=s,this.bottom=this.height+s}getDimensionDiff(t,s){const i=a(t);return this[i]-s[i]}getPositionDiff(t,s){return this[d(t)]-s[t]}}class m extends s{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,s){const{top:i,left:h,bottom:e,right:r}=t;return s?new n(i+this.y,r-this.x,e-this.y,h+this.x):new n(i-this.y,r+this.x,e+this.y,h-this.x)}onSameAxis(t,s){return"y"===t?s.x===this.x:s.y===this.y}}class p extends s{isOneTruthy(){return this.x||this.y}isAllFalsy(){return!(this.x||this.y)}setFalsy(){this.x=!1,this.y=!1}}class g{static containerKey(t,s){return r(t,s)}static depthKey(t){return r(t,"dp")}constructor(t){this.D=t,this.thresholds={},this.isOut={}}P({width:t,height:s}){const i=Math.round(this.D.horizontal*t/100),h=Math.round(this.D.vertical*s/100);this.S=new m(i,h)}A(t,s,i){this.thresholds[t]=this.S.composeBox(s,i),this.isOut[t]=new e(!1,!1,!1,!1)}setMainThreshold(t,s,i){this.P(s),this.A(t,s,i)}updateMainThreshold(t,s,i){this.thresholds[t]=this.S.composeBox(s,i),this.isOut[t].setFalsy()}getElmMainThreshold(t){return this.S.composeBox(t,!1)}setContainerThreshold(t,s,i,h){this.A(t,i,!1);const{top:e,left:n}=i,{height:r,width:o}=h,l=g.containerKey(s,t),u=g.depthKey(s);this.A(l,{left:n,top:e,right:n+o,bottom:e+r},!1),this.thresholds[u]?this.thresholds[u].assignBiggestBox(this.thresholds[l]):this.A(u,this.thresholds[l],!1)}isOutThreshold(t,s,i){return s.isOutThreshold(this.thresholds[t],this.isOut[t],i)}destroy(){Object.keys(this.thresholds).forEach((t=>{delete this.thresholds[t]})),Object.keys(this.isOut).forEach((t=>{delete this.isOut[t]}))}}function x(t,s,i){const{left:h,top:e,right:n,bottom:r,height:o,width:l}=t.getBoundingClientRect(),u=new f(e,n,r,h);return 0===s&&0===i||u.setByPointAndDimensions(e+i,h+s,o,l),u}function y(){let t=null;function s(){t&&(cancelAnimationFrame(t),t=null)}return[function(i,h){h&&s();try{t=requestAnimationFrame(i)}catch(t){}},s]}function w(t,s=!1,i=200){const[h,e]=function(t){let s=null,i=!1;function h(){s&&(clearTimeout(s),s=null)}return[function(e,n){const r=e||o;i=!0,n&&h(),s=setTimeout((()=>{i=!1,r()}),t)},h,function(){return i}]}(i),[n,r]=y();let l=performance.now(),u=!1;const c=()=>{if(u)return;const e=performance.now();s||e-l>=i?(n(t,!0),l=e):h(c,!0)};return c.isPaused=()=>u,c.pause=()=>{u||(u=!0,r(),e())},c.resume=()=>{u&&(u=!1,c())},c}const T=Object.freeze(["x","y"]);let _=new WeakMap;function O(t,s,i){t.style.setProperty(s,i)}function v(t,s){t.style.removeProperty(s)}function b(t,s,i){const h=function(t){if(_.has(t))return _.get(t);const s={computedStyle:getComputedStyle(t),parsedProperties:new Map};return _.set(t,s),s}(t),{parsedProperties:e,computedStyle:n}=h,r=e.get(s);if(void 0===r){const t=n.getPropertyValue(s),h=i?function(t){const s=parseFloat(t);return Number.isNaN(s)?0:s}(t):t;return e.set(s,h),h}return r}function D(t){return b(t,c,!1)}function P(t,s){return b(t,s,!1)}const E=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function S(t,s,i){O(t,"transform",`translate3d(${s}px, ${i}px, 0)`)}class A{static getType(){return"base:element"}static transform=S;constructor(t){this.id=t,this.translate=new m(0,0),this.I=new Set}setAttribute(t,s,i){"INDEX"!==s?this.I.has(s)||(t.setAttribute(E[s],`${i}`),this.I.add(s)):t.setAttribute(E[s],`${i}`)}removeAttribute(t,s){"INDEX"!==s&&this.I.has(s)&&(t.removeAttribute(E[s]),this.I.delete(s))}clearAttributes(t){this.I.forEach((s=>{this.removeAttribute(t,s)})),this.I.clear()}}const I="transition-property",M="transition-delay",B="transition-duration",R="transition-timing-function";const N="transitionend";class F extends A{static getType(){return"core:element"}constructor(t){const{order:s,keys:i,depth:h,readonly:e,animation:n,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...s},this.DOMOrder={...s},this.keys={...i},this.depth=h,this.readonly=e,this.M=n,this.B=o,[this.R]=y(),this.N=!0,this.F=!1,this.L=void 0,this.C=null,this.$=new m(0,0),this.rect=new f(0,0,0,0),this.DOMGrid=new m(0,0)}updateConfig(t,s,i){this.readonly=t,this.M=s,this.B=i}initElmRect(t,s,i){this.rect=x(t,s,i);const{left:h,top:e}=this.rect;this.$.setAxes(h,e),this.q(t)}q(t){const s=function(t){const s=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const s=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return s?[parseFloat(s[5]),parseFloat(s[6])]:null}(b(t,"transform",!1));return s}(t);if(s){const[t,i]=s,h=this.$.x-t,e=this.$.y-i;this.$.setAxes(h,e),this.rect.setByPointAndDimensions(e,h,this.rect.height,this.rect.width),this.translate.setAxes(t,i)}}getDimensions(t){if(this.C)return this.C;const{width:s,height:i}=function(t){return{width:b(t,u,!0),height:b(t,l,!0)}}(t);return this.C=new m(s,i),this.C}getInitialPosition(){return this.$}changeVisibility(t,s){s!==this.N&&(this.N=s,this.F&&this.N&&(this.k(t,null),this.F=!1))}k(t,s,i=o){if(!this.N)return void(this.F=!0);const h=()=>{this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.keys(s).forEach((s=>{v(t,s)}))}(t,s):function(t,s){t.classList.remove(s)}(t,s)}(t,this.B),this.M&&function(t){v(t,I),v(t,M),v(t,B),v(t,R)}(t),s&&t.removeEventListener(N,h),i()};this.R((()=>{if(this.B&&function(t,s){"string"!=typeof s?function(t,s){Object.entries(s).forEach((([s,i])=>{O(t,s,i)}))}(t,s):function(t,s){t.classList.add(s)}(t,s)}(t,this.B),null===s)return F.transform(t,this.translate.x,this.translate.y),void h();t.addEventListener(N,h),function(t,s,i,h){O(t,I,"transform"),O(t,M,"0ms"),O(t,B,`${i}ms`),O(t,R,h)}(t,0,s,this.M.easing),F.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,s){this.setAttribute(t,"INDEX",s),this.VDOMOrder.self=s}assignNewIndex(t,s){t[s]=this.id}V(t,s,i){const h={axes:t,numberOfPassedElm:i,translate:this.translate.getInstance()};void 0===this.L&&(this.L=new Map),this.L.has(s)||this.L.set(s,[]),this.L.get(s).push(h)}j(t,s,i){if(s)return!this.N&&this.F?void(this.F=!1):void this.k(t,i);this.N?this.k(t,i):this.F=!0}G(t,s,i,h){let e=null;if(this.M){const{duration:t}=this.M,i=this.translate.getInstance(),h=this.translate.increase(s).getInstance();e="number"==typeof t?t:function(t,s){const i=t.x-s.x,h=t.y-s.y,e=Math.sqrt(i*i+h*h);return 20*Math.sqrt(e)}(i,h)}else this.translate.increase(s);this.rect.setAxes(this.$.x+this.translate.x,this.$.y+this.translate.y),this.j(t,i,e);const{self:n}=this.VDOMOrder,r=n+h;return this.updateIndex(t,r),[n,r]}H(t,s,i){if(-1!==t)for(let t=0;t<s;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>i.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<s;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=i.x,this.DOMGrid.y-=1)}reconcilePosition(t,s,i,h,e,n,r,o){let l;const u={x:1===s?-1:1,y:s};"z"===t?l=T:(l=[t],u[t]=s),l.forEach((t=>{e[t]*=u[t],this.H(u[t],n,r)})),this.V(t,o,n);const c=s*n,[a,d]=this.G(i,e,!1,c);h[a]="",h[d]=this.id}restorePosition(t){this.k(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,s){this.translate.clone(s),this.k(t,null)}rollBackPosition(t,s){if(void 0===this.L||!this.L.has(s))return;const i=this.L.get(s),{translate:h,axes:e,numberOfPassedElm:n}=i.pop(),r={x:h.x-this.translate.x,y:h.y-this.translate.y};let o=0;const l={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:l.x*n,y:l.y*n})):(o=l[e]*n,this.DOMGrid[e]+=o),this.G(t,r,!0,o),0===i.length)return this.L.delete(s),void(0===this.L.size&&(this.L=void 0));this.rollBackPosition(t,s)}hasTransformedFromOrigin(){return this.$.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t){this.L=void 0,this.translate.setAxes(0,0),this.F=!1,this.DOMOrder.self=this.VDOMOrder.self,v(t,"transform"),function(t,s){if(!t.hasAttribute(s))return;const i=t.getAttribute(s);i&&""===i.trim()&&t.removeAttribute(s)}(t,"style"),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:F.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof m?this.translate:null,order:this.VDOMOrder,initialPosition:this.$.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.F,isVisible:this.N}}}class L extends F{static getDistance(t,s,i){let h=t[i]-s.rect["x"===i?"left":"top"];return h+=s.translate[i],h}static getDisplacement(t,s,i){return t[i]-("x"===i?s.rect.right:s.rect.bottom)}getDisplacement(t,s){return L.getDisplacement(this.rect.getPosition(),t,s)}getDistance(t,s){return L.getDistance(this.rect.getPosition(),t,s)}}const C=/(auto|scroll|overlay)/;function z(t){const s=D(t),i=[void 0,!1,new p(!1,!1)],h=function(t,h){let e=0,n=t;try{do{if(e+=1,e>1&&((t,s,i)=>{const h=P(t,"overflow-x"),e=P(t,"overflow-y");if("absolute"===s&&"static"===D(t))return!1;const[,,n]=i,r=(s,i)=>((t,s,i,h)=>{if(C.test(s)){const s=function(t,s){return"y"===s?t.scrollHeight>t.clientHeight:t.scrollWidth>t.clientWidth}(i,t);if(s)return h[t]=!0,!0}return!1})(s,i,t,n);return r("y",e)||r("x",h)})(n,s,i))return e=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{e=0}return null}(t);return h&&"fixed"!==s?i[0]=h:(i[0]=document.documentElement,i[1]=!0),i}const $={horizontal:25,vertical:25},q={horizontal:10,vertical:10};class k{static getType(){return"scroll:container"}constructor(t,s,i,h){this.X=s,this.U=h,this.W={inner:{threshold:null,key:`scroll_inner_${s}`},outer:{threshold:null,key:`scroll_outer_${s}`}},this.K=`scroll__${s}`,[this.Y,this.J,this.hasOverflow]=z(t),this.totalScrollRect=new f(0,0,0,0),this.visibleScrollRect=new f(0,0,0,0),this.Z=!1,this.refreshScrollAndVisibility(i),this.tt(!0)}hasDynamicVisibility(){return this.Z&&this.hasOverflow.isOneTruthy()}st(t,s){const i=this.W[t];if(!s)return void(i.threshold&&(i.threshold.destroy(),i.threshold=null));const h=new g(s);i.threshold=h,h.setMainThreshold(i.key,this.visibleScrollRect,"inner"===t)}it(t,s){const i=this.K,h=s.toString(),e=this.J?document.body:this.Y;t?e.dataset[i]=h:delete e.dataset[i]}ht(){if(this.hasOverflow.isAllFalsy())return this.st("inner",null),this.st("outer",null),void this.it(!1,!0);this.it(!0,!0),this.st("inner",null),this.st("inner",q),this.hasDynamicVisibility()&&(this.st("outer",null),this.st("outer",$))}et(){const t=(t,s)=>function(t,s,i,h=!1){const e=a(i);return t[e]/(h?.5:1)>s[e]}(this.totalScrollRect,this.visibleScrollRect,t,s),s=t("x"),i=t("y");this.hasOverflow.setAxes(s,i),this.ht()}nt(t,s){return this.Y["x"===t?"scrollWidth":"scrollHeight"]!==s}hasScrollDimensionChanges(){const{width:t,height:s}=this.totalScrollRect;return this.nt("y",s)||this.nt("x",t)}refreshScrollAndVisibility(t){this.rt(),this.Z=t>10,this.J?this.et():this.ht()}rt(){const{scrollHeight:t,scrollWidth:s,scrollLeft:i,scrollTop:h,clientHeight:e,clientWidth:n}=this.Y;if(this.totalScrollRect.setByPointAndDimensions(h,i,t,s),this.J)this.visibleScrollRect.setByPointAndDimensions(h,i,e,n);else{const{left:t,top:s}=this.Y.getBoundingClientRect();this.visibleScrollRect.setByPointAndDimensions(s,t,e,n)}}ot(t,s,i){return!!this.totalScrollRect.hasEqualPosition(t,s)&&(this.totalScrollRect.setPosition(t,s),i&&(this.Y.scrollTop=s,this.Y.scrollLeft=t),!0)}scrollTo(t,s){this.ot(-1===t?this.totalScrollRect.left:t,-1===s?this.totalScrollRect.right:s,!0),this.U(this.X)}lt(t){const s=d(t),i=this.totalScrollRect[s],h=function(t){return"x"===t?"right":"bottom"}(t),e=this.totalScrollRect[h],n=a(t);return[i,e,this.visibleScrollRect[n]]}calculateDistance(t,s){const[i,h,e]=this.lt(t);return 1===s?h-(i+e):i}hasScrollableArea(t,s){const[i,h,e]=this.lt(t);return 1===s?i+e<h:i>0}ut=w((()=>{const{scrollLeft:t,scrollTop:s}=this.Y;this.ot(t,s,!1)&&this.U(this.X)}));ct=w((()=>{this.rt(),this.et()}));tt(t){const s=t?"addEventListener":"removeEventListener",i=this.J?window:this.Y,h={passive:!0};i[s]("resize",this.ct,h),i[s]("scroll",this.ut,h)}pauseListeners(t){t?this.ut.pause():this.ut.resume()}getMaximumScrollContainerLeft(){const{left:t,width:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.left}getMaximumScrollContainerTop(){const{top:t,height:s}=this.visibleScrollRect;return t+s+this.totalScrollRect.top}getElmViewportPosition(t,s){const{top:i,left:h}=this.totalScrollRect;return[t-i,s-h]}isElmOutViewport(t){let s,i;if(t instanceof f){const[h,e]=this.getElmViewportPosition(t.top,t.left);s=new n(h,e+t.width,h+t.height,e),i=this.W.outer}else s=t,i=this.W.inner;const{threshold:h,key:e}=i;return[h.isOutThreshold(e,s,this.hasOverflow.y?"y":"x"),h.isOut[e]]}dt(){const{height:t,width:s}=this.visibleScrollRect;return{height:t,width:s}}getSerializedInstance(){return{type:k.getType(),version:3,key:this.X,hasOverFlow:this.hasOverflow.getInstance(),hasDocumentAsContainer:this.J,scrollRect:this.totalScrollRect.getBox(),scrollContainerRect:this.visibleScrollRect.getBox(),visibleScreen:this.dt()}}destroy(){this.tt(!1),this.st("inner",null),this.st("outer",null),this.it(!1,!0),this.U=void 0,this.Y=void 0}}exports.DFlexBaseElement=A,exports.DFlexElement=L,exports.DFlexParentContainer=class{constructor(t,s,i,h){this.id=t,this.ft=new m(-1,-1),this.grid=new m(-1,-1),this.originLength=i,this.gt=new n(0,0,0,0),this.xt=null;const{left:e,top:r}=h;this.yt=x(s,e,r),this.lastElmPosition=null}wt(t){const s=this.gt;return s.isPositionedY(t)?(this.ft.y+=1,this.ft.x=0,this.gt.setBox(0,0,0,0)):this.ft.x+=1,this.ft.x>this.grid.x&&(this.grid.x=this.ft.x),this.ft.y>this.grid.y&&(this.grid.y=this.ft.y),s.assignBiggestBox(t),this.ft}register(t,s){this.xt?this.xt.assignBiggestBox(t):this.xt=new n(t.top,t.right,t.bottom,t.left);const i=this.wt(t),h=this.xt,e=s;if(!e)return i;const r=h.bottom-h.top,o=h.right-h.left;return e.height<r&&(e.height=r),e.width<o&&(e.width=r),i}extendGrid(t){this.grid[t]+=1}reduceGrid(t){this.grid[t]-=1}getBoundaries(){return this.xt||this.yt.getBox()}resetIndicators(t){this.ft.setAxes(-1,-1),this.grid.setAxes(-1,-1),this.originLength=t,this.gt.setBox(0,0,0,0),this.xt=null,this.lastElmPosition=null}preservePosition(t){this.lastElmPosition?this.lastElmPosition.setAxes(t.x,t.y):this.lastElmPosition=new m(t.x,t.y)}},exports.DFlexScrollContainer=k;
{
"name": "@dflex/core-instance",
"version": "3.9.10",
"version": "3.10.0",
"description": "Core instance is a DFlex package for interactive DOM element",

@@ -30,3 +30,3 @@ "author": "Jalal Maskoun",

"devDependencies": {
"@dflex/utils": "^3.9.10"
"@dflex/utils": "^3.10.0"
},

@@ -33,0 +33,0 @@ "keywords": [

@@ -487,2 +487,5 @@ declare class AxesPoint<T = number> {

private _updateOverflow;
private _hasChangedScrollDimension;
hasScrollDimensionChanges(): boolean;
refreshScrollAndVisibility(branchLength: number): void;
/**

@@ -489,0 +492,0 @@ * Updates the scroll-related rectangles based on the container's dimensions and scroll positions.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc