@nethesis/phone-island 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/App.js.map +1 -1
  3. package/dist/components/CallView/index.js +1 -1
  4. package/dist/components/CallView/index.js.map +1 -1
  5. package/dist/components/Socket.js +1 -1
  6. package/dist/components/Socket.js.map +1 -1
  7. package/dist/components/WebRTC.js +1 -1
  8. package/dist/components/WebRTC.js.map +1 -1
  9. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs.js +1 -1
  10. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs.js.map +1 -1
  11. package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs.js +1 -1
  12. package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs.js.map +1 -1
  13. package/dist/node_modules/js-base64/base64.mjs.js +1 -1
  14. package/dist/node_modules/js-base64/base64.mjs.js.map +1 -1
  15. package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.mjs.js.map +1 -1
  16. package/dist/node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs.js.map +1 -1
  17. package/dist/node_modules/motion-dom/dist/es/events/add-dom-event.mjs.js +1 -1
  18. package/dist/node_modules/motion-dom/dist/es/events/add-dom-event.mjs.js.map +1 -1
  19. package/dist/node_modules/motion-dom/dist/es/frameloop/batcher.mjs.js +1 -1
  20. package/dist/node_modules/motion-dom/dist/es/frameloop/batcher.mjs.js.map +1 -1
  21. package/dist/node_modules/motion-dom/dist/es/frameloop/render-step.mjs.js +1 -1
  22. package/dist/node_modules/motion-dom/dist/es/frameloop/render-step.mjs.js.map +1 -1
  23. package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js +1 -1
  24. package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js.map +1 -1
  25. package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js +1 -1
  26. package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js.map +1 -1
  27. package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js +1 -1
  28. package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js.map +1 -1
  29. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.mjs.js +1 -1
  30. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.mjs.js.map +1 -1
  31. package/dist/node_modules/motion-dom/dist/es/utils/border-radius.mjs.js +2 -0
  32. package/dist/node_modules/motion-dom/dist/es/utils/border-radius.mjs.js.map +1 -0
  33. package/dist/package.json.js +1 -1
  34. package/package.json +1 -1
  35. package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js +0 -2
  36. package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../animation/animate/single-value.mjs.js"),e=require("../../animation/optimized-appear/get-appear-id.mjs.js"),i=require("../../animation/utils/get-value-transition.mjs.js"),s=require("../../frameloop/microtask.mjs.js"),o=require("../../frameloop/sync-time.mjs.js"),a=require("../styles/scale-correction.mjs.js"),r=require("../../utils/delay.mjs.js"),n=require("../../utils/is-svg-element.mjs.js"),l=require("../../utils/is-svg-svg-element.mjs.js"),h=require("../../utils/mix/number.mjs.js"),c=require("../../value/index.mjs.js"),u=require("../../value/utils/resolve-motion-value.mjs.js"),d=require("../animation/mix-values.mjs.js"),m=require("../geometry/copy.mjs.js"),p=require("../geometry/delta-apply.mjs.js"),y=require("../geometry/delta-calc.mjs.js"),g=require("../geometry/delta-remove.mjs.js"),v=require("../geometry/models.mjs.js"),f=require("../geometry/utils.mjs.js"),x=require("../shared/stack.mjs.js"),j=require("../styles/transform.mjs.js"),T=require("../utils/each-axis.mjs.js"),D=require("../utils/flat-tree.mjs.js"),B=require("../utils/has-transform.mjs.js"),P=require("./state.mjs.js"),S=require("../../frameloop/frame.mjs.js"),A=require("../../../../../motion-utils/dist/es/noop.mjs.js"),R=require("../../../../../motion-utils/dist/es/subscription-manager.mjs.js"),V=require("../../../../../motion-utils/dist/es/clamp.mjs.js");const L=["","X","Y","Z"];let k=0;function E(t,e,i,s){const{latestValues:o}=e;o[t]&&(i[t]=o[t],e.setStaticValue(t,0),s&&(s[t]=0))}function w(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:i}=t.options;if(!i)return;const s=e.getOptimisedAppearId(i);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:e,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",S.frame,!(e||i))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&w(o)}function C(t){t.updateLayout()}function U(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:s}=t.layout,{animationType:o}=t.options,a=e.source!==t.layout.source;if("size"===o)T.eachAxis((t=>{const s=a?e.measuredBox[t]:e.layoutBox[t],o=y.calcLength(s);s.min=i[t].min,s.max=s.min+o}));else if("x"===o||"y"===o){const t="x"===o?"y":"x";m.copyAxisInto(a?e.measuredBox[t]:e.layoutBox[t],i[t])}else it(o,e.layoutBox,i)&&T.eachAxis((s=>{const o=a?e.measuredBox[s]:e.layoutBox[s],r=y.calcLength(i[s]);o.max=o.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+r)}));const r=v.createDelta();y.calcBoxDelta(r,i,e.layoutBox);const n=v.createDelta();a?y.calcBoxDelta(n,t.applyTransform(s,!0),e.measuredBox):y.calcBoxDelta(n,i,e.layoutBox);const l=!f.isDeltaZero(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:o,layout:a}=s;if(o&&a){const r=t.options.layoutAnchor||void 0,n=v.createBox();y.calcRelativePosition(n,e.layoutBox,o.layoutBox,r);const l=v.createBox();y.calcRelativePosition(l,i,a.layoutBox,r),f.boxEqualsRounded(n,l)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=l,t.relativeTargetOrigin=n,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:n,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function I(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function F(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function q(t){t.clearSnapshot()}function b(t){t.clearMeasurements()}function O(t){t.isLayoutDirty=!0,t.updateLayout()}function M(t){t.isLayoutDirty=!1}function N(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function z(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function H(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function W(t){t.resolveTargetDelta()}function G(t){t.calcProjection()}function Z(t){t.resetSkewAndRotation()}function $(t){t.removeLeadSnapshot()}function X(t,e,i){t.translate=h.mixNumber(e.translate,0,i),t.scale=h.mixNumber(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function Y(t,e,i,s){t.min=h.mixNumber(e.min,i.min,s),t.max=h.mixNumber(e.max,i.max,s)}function _(t,e,i,s){Y(t.x,e.x,i.x,s),Y(t.y,e.y,i.y,s)}function J(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const K={duration:.45,ease:[.4,0,.1,1]},Q=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),tt=Q("applewebkit/")&&!Q("chrome/")?Math.round:A.noop;function et(t){t.min=tt(t.min),t.max=tt(t.max)}function it(t,e,i){return"position"===t||"preserve-aspect"===t&&!y.isNear(f.aspectRatio(e),f.aspectRatio(i),.2)}function st(t){return t!==t.root&&t.scroll?.wasRoot}exports.cleanDirtyNodes=F,exports.createProjectionNode=function(e){let{attachResizeListener:T,defaultParent:A,measureScroll:Y,checkIsScrollRoot:Q,resetTransform:tt}=e;return class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A?.();this.id=k++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(I),this.nodes.forEach(W),this.nodes.forEach(G),this.nodes.forEach(F)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=e?e.root||e:this,this.path=e?[...e.path,e]:[],this.parent=e,this.depth=e?e.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new D.FlatTree)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new R.SubscriptionManager),this.eventHandlers.get(t).add(e)}notifyListeners(t){const e=this.eventHandlers.get(t);for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];e&&e.notify(...s)}hasListeners(t){return this.eventHandlers.has(t)}mount(t){if(this.instance)return;this.isSVG=n.isSVGElement(t)&&!l.isSVGSVGElement(t),this.instance=t;const{layoutId:e,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||e)&&(this.isLayoutDirty=!0),T){let e,i=0;const s=()=>this.root.updateBlockedByResize=!1;S.frame.read((()=>{i=window.innerWidth})),T(t,(()=>{const t=window.innerWidth;t!==i&&(i=t,this.root.updateBlockedByResize=!0,e&&e(),e=r.delay(s,250),P.globalProjectionState.hasAnimatedSinceResize&&(P.globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(H)))}))}e&&this.root.registerSharedNode(e,this),!1!==this.options.animate&&o&&(e||s)&&this.addEventListener("didUpdate",(t=>{let{delta:e,hasLayoutChanged:s,hasRelativeLayoutChanged:a,layout:r}=t;if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const n=this.options.transition||o.getDefaultTransition()||K,{onLayoutAnimationStart:l,onLayoutAnimationComplete:h}=o.getProps(),c=!this.targetLayout||!f.boxEqualsRounded(this.targetLayout,r),u=!s&&a;if(this.options.layoutRoot||this.resumeFrom||u||s&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...i.getValueTransition(n,"layout"),onPlay:l,onComplete:h};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,u,t.path)}else s||H(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),S.cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Z),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&w(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked()){const t=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),t&&this.nodes.forEach(O),void this.nodes.forEach(b)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(M);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(N),this.nodes.forEach(z),this.nodes.forEach(C),this.nodes.forEach(U)):this.nodes.forEach(M),this.clearAllSnapshots();const t=o.time.now();S.frameData.delta=V.clamp(0,1e3/60,t-S.frameData.timestamp),S.frameData.timestamp=t,S.frameData.isProcessing=!0,S.frameSteps.update.process(S.frameData),S.frameSteps.preRender.process(S.frameData),S.frameSteps.render.process(S.frameData),S.frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,s.microtask.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(q),this.sharedNodes.forEach($)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,S.frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){S.frame.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||y.calcLength(this.snapshot.measuredBox.x)||y.calcLength(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=v.createBox()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"measure",e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&this.instance){const e=Q(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:Y(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!tt)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!f.isDeltaZero(this.projectionDelta),i=this.getTransformTemplate(),s=i?i(this.latestValues,""):void 0,o=s!==this.prevTransformTemplateValue;t&&this.instance&&(e||B.hasTransform(this.latestValues)||o)&&(tt(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.measurePageBox();let i=this.removeElementScroll(e);var s;return t&&(i=this.removeTransform(i)),et((s=i).x),et(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return v.createBox();const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(st))){const{scroll:t}=this.root;t&&(p.translateAxis(e.x,t.offset.x),p.translateAxis(e.y,t.offset.y))}return e}removeElementScroll(t){const e=v.createBox();if(m.copyBoxInto(e,t),this.scroll?.wasRoot)return e;for(let i=0;i<this.path.length;i++){const s=this.path[i],{scroll:o,options:a}=s;s!==this.root&&o&&a.layoutScroll&&(o.wasRoot&&m.copyBoxInto(e,t),p.translateAxis(e.x,o.offset.x),p.translateAxis(e.y,o.offset.y))}return e}applyTransform(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=(arguments.length>2?arguments[2]:void 0)||v.createBox();m.copyBoxInto(i,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(p.translateAxis(i.x,-s.scroll.offset.x),p.translateAxis(i.y,-s.scroll.offset.y)),B.hasTransform(s.latestValues)&&p.transformBox(i,s.latestValues,s.layout?.layoutBox)}return B.hasTransform(this.latestValues)&&p.transformBox(i,this.latestValues,this.layout?.layoutBox),i}removeTransform(t){const e=v.createBox();m.copyBoxInto(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!B.hasTransform(i.latestValues))continue;let s;i.instance&&(B.hasScale(i.latestValues)&&i.updateSnapshot(),s=v.createBox(),m.copyBoxInto(s,i.measurePageBox())),g.removeBoxTransforms(e,i.latestValues,i.snapshot?.layoutBox,s)}return B.hasTransform(this.latestValues)&&g.removeBoxTransforms(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==S.frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=e.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=e.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=e.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==e;if(!(t||i&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:s,layoutId:o}=this.options;if(!this.layout||!s&&!o)return;this.resolvedRelativeTargetAt=S.frameData.timestamp;const a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=v.createBox(),this.targetWithTransforms=v.createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),y.calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):m.copyBoxInto(this.target,this.layout.layoutBox),p.applyBoxDelta(this.target,this.targetDelta)):m.copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&a&&Boolean(a.resumingFrom)===Boolean(this.resumingFrom)&&!a.options.layoutScroll&&a.target&&1!==this.animationProgress?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!B.hasScale(this.parent.latestValues)&&!B.has2DTranslate(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,i){this.relativeParent=t,this.linkedParentVersion=t.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=v.createBox(),this.relativeTargetOrigin=v.createBox(),y.calcRelativePosition(this.relativeTargetOrigin,e,i,this.options.layoutAnchor||void 0),m.copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===S.frameData.timestamp&&(i=!1),i)return;const{layout:s,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!s&&!o)return;m.copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,r=this.treeScale.y;p.applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,e),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms=v.createBox());const{target:n}=t;n?(this.projectionDelta&&this.prevProjectionDelta?(m.copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),m.copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),y.calcBoxDelta(this.projectionDelta,this.layoutCorrected,n,this.latestValues),this.treeScale.x===a&&this.treeScale.y===r&&f.axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)&&f.axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",n))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.options.visualElement?.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=v.createDelta(),this.projectionDelta=v.createDelta(),this.projectionDeltaWithTransform=v.createDelta()}setAnimationOrigin(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=this.snapshot,o=s?s.latestValues:{},a={...this.latestValues},r=v.createDelta();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const n=v.createBox(),l=(s?s.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,p=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(J));let g;this.animationProgress=0;const x=i?.interpolateProjection(t);this.mixTargetDelta=e=>{const i=e/1e3,s=x?.(i);s?(r.x.translate=s.x,r.x.scale=h.mixNumber(t.x.scale,1,i),r.x.origin=t.x.origin,r.x.originPoint=t.x.originPoint,r.y.translate=s.y,r.y.scale=h.mixNumber(t.y.scale,1,i),r.y.origin=t.y.origin,r.y.originPoint=t.y.originPoint):(X(r.x,t.x,i),X(r.y,t.y,i)),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(y.calcRelativePosition(n,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),_(this.relativeTarget,this.relativeTargetOrigin,n,i),g&&f.boxEquals(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=v.createBox()),m.copyBoxInto(g,this.relativeTarget)),l&&(this.animationValues=a,d.mixValues(a,o,this.latestValues,i,p,u)),s&&void 0!==s.rotate&&(this.animationValues||(this.animationValues=a),this.animationValues.pathRotation=s.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(S.cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=S.frame.update((()=>{P.globalProjectionState.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=c.motionValue(0)),this.motionValue.jump(0,!1),this.currentAnimation=t.animateSingleValue(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:s,latestValues:o}=t;if(e&&i&&s){if(this!==t&&this.layout&&s&&it(this.options.animationType,this.layout.layoutBox,s.layoutBox)){i=this.target||v.createBox();const e=y.calcLength(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const s=y.calcLength(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+s}m.copyBoxInto(e,i),p.transformBox(e,o),y.calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,e,o)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new x.NodeStack);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote(){let{needsReset:t,transition:e,preserveFollowOpacity:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this.getStack();s&&s.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const s={};i.z&&E("z",t,s,this.animationValues);for(let e=0;e<L.length;e++)E(`rotate${L[e]}`,t,s,this.animationValues),E(`skew${L[e]}`,t,s,this.animationValues);t.render();for(const e in s)t.setStaticValue(e,s[e]),this.animationValues&&(this.animationValues[e]=s[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");const s=this.getLead();if(!this.projectionDelta||!this.layout||!s.target)return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||""),void(this.hasProjected&&!B.hasTransform(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const o=s.animationValues||s.latestValues;this.applyTransformsToTarget();let r=j.buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,o);i&&(r=i(o,r)),t.transform=r;const{x:n,y:l}=this.projectionDelta;t.transformOrigin=`${100*n.origin}% ${100*l.origin}% 0`,s.animationValues?t.opacity=s===this?o.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:t.opacity=s===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0;for(const e in a.scaleCorrectors){if(void 0===o[e])continue;const{correct:i,applyTo:n,isCSSVariable:l}=a.scaleCorrectors[e],h="none"===r?o[e]:i(o[e],s);if(n){const e=n.length;for(let i=0;i<e;i++)t[n[i]]=h}else l?this.options.visualElement.renderState.vars[e]=h:t[e]=h}this.options.layoutId&&(t.pointerEvents=s===this?u.resolveMotionValue(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>t.currentAnimation?.stop())),this.root.nodes.forEach(b),this.root.sharedNodes.clear()}}},exports.mixAxis=Y,exports.mixBox=_,exports.propagateDirtyNodes=I;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../animation/animate/single-value.mjs.js"),e=require("../../animation/optimized-appear/get-appear-id.mjs.js"),i=require("../../animation/utils/get-value-transition.mjs.js"),s=require("../../frameloop/microtask.mjs.js"),o=require("../../frameloop/sync-time.mjs.js"),a=require("../styles/scale-correction.mjs.js"),r=require("../../utils/delay.mjs.js"),n=require("../../utils/is-svg-element.mjs.js"),l=require("../../utils/is-svg-svg-element.mjs.js"),h=require("../../utils/mix/number.mjs.js"),c=require("../../value/index.mjs.js"),u=require("../../value/utils/resolve-motion-value.mjs.js"),d=require("../animation/mix-values.mjs.js"),m=require("../geometry/copy.mjs.js"),p=require("../geometry/delta-apply.mjs.js"),y=require("../geometry/delta-calc.mjs.js"),g=require("../geometry/delta-remove.mjs.js"),v=require("../geometry/models.mjs.js"),f=require("../geometry/utils.mjs.js"),x=require("../shared/stack.mjs.js"),j=require("../styles/transform.mjs.js"),T=require("../utils/each-axis.mjs.js"),D=require("../utils/flat-tree.mjs.js"),B=require("../utils/has-transform.mjs.js"),P=require("./state.mjs.js"),S=require("../../frameloop/frame.mjs.js"),A=require("../../../../../motion-utils/dist/es/noop.mjs.js"),R=require("../../../../../motion-utils/dist/es/subscription-manager.mjs.js"),V=require("../../../../../motion-utils/dist/es/clamp.mjs.js");const L=["","X","Y","Z"];let k=0;function E(t,e,i,s){const{latestValues:o}=e;o[t]&&(i[t]=o[t],e.setStaticValue(t,0),s&&(s[t]=0))}function w(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:i}=t.options;if(!i)return;const s=e.getOptimisedAppearId(i);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:e,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",S.frame,!(e||i))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&w(o)}function C(t){t.updateLayout()}function U(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:s}=t.layout,{animationType:o}=t.options,a=e.source!==t.layout.source;if("size"===o)T.eachAxis((t=>{const s=a?e.measuredBox[t]:e.layoutBox[t],o=y.calcLength(s);s.min=i[t].min,s.max=s.min+o}));else if("x"===o||"y"===o){const t="x"===o?"y":"x";m.copyAxisInto(a?e.measuredBox[t]:e.layoutBox[t],i[t])}else it(o,e.layoutBox,i)&&T.eachAxis((s=>{const o=a?e.measuredBox[s]:e.layoutBox[s],r=y.calcLength(i[s]);o.max=o.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+r)}));const r=v.createDelta();y.calcBoxDelta(r,i,e.layoutBox);const n=v.createDelta();a?y.calcBoxDelta(n,t.applyTransform(s,!0),e.measuredBox):y.calcBoxDelta(n,i,e.layoutBox);const l=!f.isDeltaZero(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:o,layout:a}=s;if(o&&a){const r=t.options.layoutAnchor||void 0,n=v.createBox();y.calcRelativePosition(n,e.layoutBox,o.layoutBox,r);const l=v.createBox();y.calcRelativePosition(l,i,a.layoutBox,r),f.boxEqualsRounded(n,l)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=l,t.relativeTargetOrigin=n,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:n,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function I(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function F(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function q(t){t.clearSnapshot()}function b(t){t.clearMeasurements()}function O(t){t.isLayoutDirty=!0,t.updateLayout()}function M(t){t.isLayoutDirty=!1}function N(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function z(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function H(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function W(t){t.resolveTargetDelta()}function G(t){t.calcProjection()}function Z(t){t.resetSkewAndRotation()}function $(t){t.removeLeadSnapshot()}function X(t,e,i){t.translate=h.mixNumber(e.translate,0,i),t.scale=h.mixNumber(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function Y(t,e,i,s){t.min=h.mixNumber(e.min,i.min,s),t.max=h.mixNumber(e.max,i.max,s)}function _(t,e,i,s){Y(t.x,e.x,i.x,s),Y(t.y,e.y,i.y,s)}function J(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const K={duration:.45,ease:[.4,0,.1,1]},Q=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),tt=Q("applewebkit/")&&!Q("chrome/")?Math.round:A.noop;function et(t){t.min=tt(t.min),t.max=tt(t.max)}function it(t,e,i){return"position"===t||"preserve-aspect"===t&&!y.isNear(f.aspectRatio(e),f.aspectRatio(i),.2)}function st(t){return t!==t.root&&t.scroll?.wasRoot}exports.cleanDirtyNodes=F,exports.createProjectionNode=function(e){let{attachResizeListener:T,defaultParent:A,measureScroll:Y,checkIsScrollRoot:Q,resetTransform:tt}=e;return class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A?.();this.id=k++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(I),this.nodes.forEach(W),this.nodes.forEach(G),this.nodes.forEach(F)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=e?e.root||e:this,this.path=e?[...e.path,e]:[],this.parent=e,this.depth=e?e.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new D.FlatTree)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new R.SubscriptionManager),this.eventHandlers.get(t).add(e)}notifyListeners(t){const e=this.eventHandlers.get(t);for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];e&&e.notify(...s)}hasListeners(t){return this.eventHandlers.has(t)}mount(t){if(this.instance)return;this.isSVG=n.isSVGElement(t)&&!l.isSVGSVGElement(t),this.instance=t;const{layoutId:e,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||e)&&(this.isLayoutDirty=!0),T){let e,i=0;const s=()=>this.root.updateBlockedByResize=!1;S.frame.read((()=>{i=window.innerWidth})),T(t,(()=>{const t=window.innerWidth;t!==i&&(i=t,this.root.updateBlockedByResize=!0,e&&e(),e=r.delay(s,250),P.globalProjectionState.hasAnimatedSinceResize&&(P.globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(H)))}))}e&&this.root.registerSharedNode(e,this),!1!==this.options.animate&&o&&(e||s)&&this.addEventListener("didUpdate",(t=>{let{delta:e,hasLayoutChanged:s,hasRelativeLayoutChanged:a,layout:r}=t;if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const n=this.options.transition||o.getDefaultTransition()||K,{onLayoutAnimationStart:l,onLayoutAnimationComplete:h}=o.getProps(),c=!this.targetLayout||!f.boxEqualsRounded(this.targetLayout,r),u=!s&&a;if(this.options.layoutRoot||this.resumeFrom||u||s&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...i.getValueTransition(n,"layout"),onPlay:l,onComplete:h};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,u,t.path)}else s||H(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),S.cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Z),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&w(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked()){const t=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),t&&this.nodes.forEach(O),void this.nodes.forEach(b)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(M);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(N),this.nodes.forEach(z),this.nodes.forEach(C),this.nodes.forEach(U)):this.nodes.forEach(M),this.clearAllSnapshots();const t=o.time.now();S.frameData.delta=V.clamp(0,1e3/60,t-S.frameData.timestamp),S.frameData.timestamp=t,S.frameData.isProcessing=!0,S.frameSteps.update.process(S.frameData),S.frameSteps.preRender.process(S.frameData),S.frameSteps.render.process(S.frameData),S.frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,s.microtask.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(q),this.sharedNodes.forEach($)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,S.frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){S.frame.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||y.calcLength(this.snapshot.measuredBox.x)||y.calcLength(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=v.createBox()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"measure",e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&this.instance){const e=Q(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:Y(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!tt)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!f.isDeltaZero(this.projectionDelta),i=this.getTransformTemplate(),s=i?i(this.latestValues,""):void 0,o=s!==this.prevTransformTemplateValue;t&&this.instance&&(e||B.hasTransform(this.latestValues)||o)&&(tt(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.measurePageBox();let i=this.removeElementScroll(e);var s;return t&&(i=this.removeTransform(i)),et((s=i).x),et(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return v.createBox();const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(st))){const{scroll:t}=this.root;t&&(p.translateAxis(e.x,t.offset.x),p.translateAxis(e.y,t.offset.y))}return e}removeElementScroll(t){const e=v.createBox();if(m.copyBoxInto(e,t),this.scroll?.wasRoot)return e;for(let i=0;i<this.path.length;i++){const s=this.path[i],{scroll:o,options:a}=s;s!==this.root&&o&&a.layoutScroll&&(o.wasRoot&&m.copyBoxInto(e,t),p.translateAxis(e.x,o.offset.x),p.translateAxis(e.y,o.offset.y))}return e}applyTransform(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=(arguments.length>2?arguments[2]:void 0)||v.createBox();m.copyBoxInto(i,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(p.translateAxis(i.x,-s.scroll.offset.x),p.translateAxis(i.y,-s.scroll.offset.y)),B.hasTransform(s.latestValues)&&p.transformBox(i,s.latestValues,s.layout?.layoutBox)}return B.hasTransform(this.latestValues)&&p.transformBox(i,this.latestValues,this.layout?.layoutBox),i}removeTransform(t){const e=v.createBox();m.copyBoxInto(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!B.hasTransform(i.latestValues))continue;let s;i.instance&&(B.hasScale(i.latestValues)&&i.updateSnapshot(),s=v.createBox(),m.copyBoxInto(s,i.measurePageBox())),g.removeBoxTransforms(e,i.latestValues,i.snapshot?.layoutBox,s)}return B.hasTransform(this.latestValues)&&g.removeBoxTransforms(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==S.frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=e.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=e.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=e.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==e;if(!(t||i&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:s,layoutId:o}=this.options;if(!this.layout||!s&&!o)return;this.resolvedRelativeTargetAt=S.frameData.timestamp;const a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=v.createBox(),this.targetWithTransforms=v.createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),y.calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):m.copyBoxInto(this.target,this.layout.layoutBox),p.applyBoxDelta(this.target,this.targetDelta)):m.copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&a&&Boolean(a.resumingFrom)===Boolean(this.resumingFrom)&&!a.options.layoutScroll&&a.target&&1!==this.animationProgress?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!B.hasScale(this.parent.latestValues)&&!B.has2DTranslate(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,i){this.relativeParent=t,this.linkedParentVersion=t.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=v.createBox(),this.relativeTargetOrigin=v.createBox(),y.calcRelativePosition(this.relativeTargetOrigin,e,i,this.options.layoutAnchor||void 0),m.copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===S.frameData.timestamp&&(i=!1),i)return;const{layout:s,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!s&&!o)return;m.copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,r=this.treeScale.y;p.applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,e),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms=v.createBox());const{target:n}=t;n?(this.projectionDelta&&this.prevProjectionDelta?(m.copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),m.copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),y.calcBoxDelta(this.projectionDelta,this.layoutCorrected,n,this.latestValues),this.treeScale.x===a&&this.treeScale.y===r&&f.axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)&&f.axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",n))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.options.visualElement?.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=v.createDelta(),this.projectionDelta=v.createDelta(),this.projectionDeltaWithTransform=v.createDelta()}setAnimationOrigin(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=this.snapshot,o=s?s.latestValues:{},a={...this.latestValues},r=v.createDelta();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const n=v.createBox(),l=(s?s.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,p=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(J));let g;this.animationProgress=0;const x=i?.interpolateProjection(t);this.mixTargetDelta=e=>{const i=e/1e3,s=x?.(i);s?(r.x.translate=s.x,r.x.scale=h.mixNumber(t.x.scale,1,i),r.x.origin=t.x.origin,r.x.originPoint=t.x.originPoint,r.y.translate=s.y,r.y.scale=h.mixNumber(t.y.scale,1,i),r.y.origin=t.y.origin,r.y.originPoint=t.y.originPoint):(X(r.x,t.x,i),X(r.y,t.y,i)),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(y.calcRelativePosition(n,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),_(this.relativeTarget,this.relativeTargetOrigin,n,i),g&&f.boxEquals(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=v.createBox()),m.copyBoxInto(g,this.relativeTarget)),l&&(this.animationValues=a,d.mixValues(a,o,this.latestValues,i,p,u)),s&&void 0!==s.rotate&&(this.animationValues||(this.animationValues=a),this.animationValues.pathRotation=s.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(S.cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=S.frame.update((()=>{P.globalProjectionState.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=c.motionValue(0)),this.motionValue.jump(0,!1),this.currentAnimation=t.animateSingleValue(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:s,latestValues:o}=t;if(e&&i&&s){if(this!==t&&this.layout&&s&&it(this.options.animationType,this.layout.layoutBox,s.layoutBox)){i=this.target||v.createBox();const e=y.calcLength(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const s=y.calcLength(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+s}m.copyBoxInto(e,i),p.transformBox(e,o),y.calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,e,o)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new x.NodeStack);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote(){let{needsReset:t,transition:e,preserveFollowOpacity:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this.getStack();s&&s.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const s={};i.z&&E("z",t,s,this.animationValues);for(let e=0;e<L.length;e++)E(`rotate${L[e]}`,t,s,this.animationValues),E(`skew${L[e]}`,t,s,this.animationValues);t.render();for(const e in s)t.setStaticValue(e,s[e]),this.animationValues&&(this.animationValues[e]=s[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");const s=this.getLead();if(!this.projectionDelta||!this.layout||!s.target)return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||""),void(this.hasProjected&&!B.hasTransform(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const o=s.animationValues||s.latestValues;this.applyTransformsToTarget();let r=j.buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,o);i&&(r=i(o,r)),t.transform=r;const{x:n,y:l}=this.projectionDelta;t.transformOrigin=`${100*n.origin}% ${100*l.origin}% 0`,s.animationValues?t.opacity=s===this?o.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:t.opacity=s===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0;for(const e in a.scaleCorrectors){if(void 0===o[e])continue;const{correct:i,applyTo:n,isCSSVariable:l}=a.scaleCorrectors[e],h="none"===r?o[e]:i(o[e],s);if(n){const e=n.length;for(let i=0;i<e;i++)t[n[i]]=h}else l?this.options.visualElement.renderState.vars[e]=h:t[e]=h}this.options.layoutId&&(t.pointerEvents=s===this?u.resolveMotionValue(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>t.currentAnimation?.stop())),this.root.nodes.forEach(b),this.root.sharedNodes.clear()}}},exports.mixAxis=Y,exports.mixBox=_,exports.propagateDirtyNodes=I;
2
2
  //# sourceMappingURL=create-projection-node.mjs.js.map