Viewing File: /home/ubuntu/vedadeals-frontend-base/node_modules/@motionone/dom/dist/size-webpack-animate.js

var t={d:(e,i)=>{for(var a in i)t.o(i,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:i[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{j:()=>G});class i{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const a=new WeakMap;function n(t){return a.has(t)||a.set(t,{transforms:[],values:new Map}),a.get(t)}const s=()=>{},r=t=>t,o=["","X","Y","Z"],l={x:"translateX",y:"translateY",z:"translateZ"},c={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},u={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:c,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:r},skew:c},h=new Map,d=t=>`--motion-${t}`,f=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{o.forEach((e=>{f.push(t+e),h.set(d(t+e),u[t])}))}));const m=(t,e)=>f.indexOf(t)-f.indexOf(e),p=new Set(f),y=t=>p.has(t),g=(t,e)=>`${t} ${e}(var(${d(e)}))`,v=t=>t.startsWith("--"),T=new Set,w={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},S=t=>"number"==typeof t,b=t=>"object"==typeof t&&Boolean(t.createAnimation),A=t=>Array.isArray(t)&&!S(t[0]),D=(t,e,i)=>-i*t+i*e+t,O=(t,e,i)=>e-t==0?1:(i-t)/(e-t);function k(t,e){const i=t[t.length-1];for(let a=1;a<=e;a++){const n=O(0,e,a);t.push(D(i,1,n))}}const x=(t,e,i)=>Math.min(Math.max(i,t),e);const j=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function M(t,e,i,a){if(t===e&&i===a)return r;return n=>0===n||1===n?n:j(function(t,e,i,a,n){let s,r,o=0;do{r=e+(i-e)/2,s=j(r,a,n)-t,s>0?i=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(n,0,1,t,i),e,a)}const P={ease:M(.25,.1,.25,1),"ease-in":M(.42,0,1,1),"ease-in-out":M(.42,0,.58,1),"ease-out":M(0,0,.58,1)},R=/\((.*?)\)/;function E(t){if("function"==typeof t)return t;if(Array.isArray(t))return M(...t);if(P[t])return P[t];if(t.startsWith("steps")){const e=R.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>i=>{const a=(i="end"===e?Math.min(i,.999):Math.max(i,.001))*t,n="end"===e?Math.floor(a):Math.ceil(a);return x(0,1,n/t)})(parseFloat(t[0]),t[1].trim())}}return r}class V{constructor(t,e=[0,1],{easing:i,duration:a=w.duration,delay:n=w.delay,endDelay:s=w.endDelay,repeat:o=w.repeat,offset:l,direction:c="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=r,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),i=i||w.easing,b(i)){const t=i.createAnimation(e,(()=>"0"),!0);i=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(a=t.duration)}this.repeat=o,this.easing=A(i)?r:E(i),this.updateDuration(a);const u=function(t,e=function(t){const e=[0];return k(e,t-1),e}(t.length),i=r){const a=t.length,n=a-e.length;return n>0&&k(e,n),n=>{let s=0;for(;s<a-2&&!(n<e[s+1]);s++);let r=x(0,1,O(e[s],e[s+1],n));const o=function(t,e){return A(t)?t[((t,e,i)=>{const a=e-0;return((i-0)%a+a)%a+0})(0,t.length,e)]:t}(i,s);return r=o(r),D(t[s],t[s+1],r)}}(e,l,A(i)?i.map(E):r);this.tick=e=>{var i;let a=0;a=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=a,a/=1e3,a=Math.max(a-n,0),"finished"===this.playState&&void 0===this.pauseTime&&(a=this.totalDuration);const r=a/this.duration;let o=Math.floor(r),l=r%1;!l&&r>=1&&(l=1),1===l&&o--;const h=o%2;("reverse"===c||"alternate"===c&&h||"alternate-reverse"===c&&!h)&&(l=1-l);const d=a>=this.totalDuration?1:Math.min(l,1),f=u(this.easing(d));t(f),void 0===this.pauseTime&&("finished"===this.playState||a>=this.totalDuration+s)?(this.playState="finished",null===(i=this.resolve)||void 0===i||i.call(this,f)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const $=t=>1e3*t,q=t=>(t=>Array.isArray(t)&&S(t[0]))(t)?F(t):t,F=([t,e,i,a])=>`cubic-bezier(${t}, ${e}, ${i}, ${a})`,U=t=>document.createElement("div").animate(t,{duration:.001}),C={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{U({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(U({opacity:[0,1]}).finished)},I={},_={};for(const t in C)_[t]=()=>(void 0===I[t]&&(I[t]=C[t]()),I[t]);function W(t){return l[t]&&(t=l[t]),y(t)?d(t):t}const z=(t,e,i)=>{e=W(e),v(e)?t.style.setProperty(e,i):t.style[e]=i};function B(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function K(t,e,a,r={}){const o=window.__MOTION_DEV_TOOLS_RECORD,c=!1!==r.record&&o;let u,{duration:d=w.duration,delay:f=w.delay,endDelay:p=w.endDelay,repeat:D=w.repeat,easing:O=w.easing,direction:k,offset:x,allowWebkitAcceleration:j=!1}=r;const M=n(t);let P=_.waapi();const R=y(e);R&&((t,e)=>{l[e]&&(e=l[e]);const{transforms:i}=n(t);var a,s;s=e,-1===(a=i).indexOf(s)&&a.push(s),t.style.transform=(t=>t.sort(m).reduce(g,"").trim())(i)})(t,e);const E=W(e),F=function(t,e){return t.has(e)||t.set(e,new i),t.get(e)}(M.values,E),U=h.get(E);return B(F.animation,!(b(O)&&F.generator)&&!1!==r.record),()=>{const i=()=>{var e,i;return null!==(i=null!==(e=((t,e)=>{e=W(e);let i=v(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!i&&0!==i){const t=h.get(e);t&&(i=t.initialValue)}return i})(t,E))&&void 0!==e?e:null==U?void 0:U.initialValue)&&void 0!==i?i:0};let n=function(t,e){for(let i=0;i<t.length;i++)null===t[i]&&(t[i]=i?t[i-1]:e());return t}((t=>Array.isArray(t)?t:[t])(a),i);if(b(O)){const t=O.createAnimation(n,i,R,E,F);O=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(d=t.duration)}if(v(E)&&(_.cssRegisterProperty()?function(t){if(!T.has(t)){T.add(t);try{const{syntax:e,initialValue:i}=h.has(t)?h.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:i})}catch(t){}}}(E):P=!1),P){U&&(n=n.map((t=>S(t)?U.toDefaultUnit(t):t))),1!==n.length||_.partialKeyframes()&&!c||n.unshift(i());const e={delay:$(f),duration:$(d),endDelay:$(p),easing:A(O)?void 0:q(O),direction:k,iterations:D+1,fill:"both"};u=t.animate({[E]:n,offset:x,easing:A(O)?O.map(q):void 0},e),u.finished||(u.finished=new Promise(((t,e)=>{u.onfinish=t,u.oncancel=e})));const a=n[n.length-1];u.finished.then((()=>{z(t,E,a),u.cancel()})).catch(s),j||(u.playbackRate=1.000001)}else if(R)n=n.map((t=>"string"==typeof t?parseFloat(t):t)),1===n.length&&n.unshift(parseFloat(i())),u=new V((e=>{U&&(e=U.toDefaultUnit(e)),z(t,E,e)}),n,Object.assign(Object.assign({},r),{duration:d,easing:O}));else{const e=n[n.length-1];z(t,E,U&&S(e)?U.toDefaultUnit(e):e)}return c&&o(t,e,n,{duration:d,delay:f,easing:O,repeat:D,offset:x},"motion-one"),F.setAnimation(u),u}}const N=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t),X=t=>t(),Y={get:(t,e)=>{const i=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":return((null==i?void 0:i[e])||0)/1e3;case"playbackRate":case"playState":return null==i?void 0:i[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(Z)).catch(s)),t.finished;case"stop":return()=>{t.animations.forEach((t=>B(t)))};case"forEachNative":return e=>{t.animations.forEach((i=>e(i,t)))};default:return void 0===(null==i?void 0:i[e])?void 0:()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,i)=>{switch(e){case"currentTime":i=$(i);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=i;return!0}return!1}},Z=t=>t.finished;function L(t,e,i){return"function"==typeof t?t(e,i):t}function G(t,e,i={}){const a=(t=function(t,e){return"string"==typeof t?t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t||[])}(t)).length,n=[];for(let s=0;s<a;s++){const r=t[s];for(const t in e){const o=N(i,t);o.delay=L(o.delay,s,a);const l=K(r,t,e[t],o);n.push(l)}}return((t,e,i=w.duration)=>new Proxy({animations:t.map(X).filter(Boolean),duration:i,options:e},Y))(n,i,i.duration)}var H=e.j;export{H as animate};
Back to Directory File Manager