efficient-storefront-blocks 0.134.1 → 0.134.2

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.
@@ -4552,17 +4552,22 @@ em.text-accent {
4552
4552
  top: 79.31cqw;
4553
4553
  }
4554
4554
  /* The 360° frames are white-ground renders: multiplied, their white is the
4555
- ground and the floor shadows show under the wheel (SpinLayer). */
4556
- .sf-photo-ground-studio [data-spin-frame] {
4555
+ ground and the floor shadows show under the wheel (SpinLayer). The frames'
4556
+ layer is multiplied as ONE picture: the two frames of a crossfade blend over
4557
+ each other first, as they are. Multiplied one by one, the next frame
4558
+ darkened the one under it and the wheel jumped bright at every step. */
4559
+ .sf-photo-ground-studio [data-spin-frames] {
4557
4560
  mix-blend-mode: multiply;
4561
+ isolation: isolate;
4558
4562
  }
4559
4563
  /* The Flat ground on a light page (the well's `bg-bg`, ProductGallery
4560
4564
  groundClass): multiplied too, so the frame's white is the page colour and no
4561
4565
  white square shows on an off-white page. On a dark page the well has no
4562
4566
  paint and the frame is drawn as it is: a white-ground render cannot sit on
4563
4567
  a dark ground without its white. */
4564
- .bg-bg > [data-spin-well] [data-spin-frame] {
4568
+ .bg-bg > [data-spin-well] [data-spin-frames] {
4565
4569
  mix-blend-mode: multiply;
4570
+ isolation: isolate;
4566
4571
  }
4567
4572
  .sf-photo-ground-studio::after {
4568
4573
  top: 78.75cqw;
@@ -1 +1 @@
1
- "use client";import{jsx as b,Fragment as de,jsxs as H}from"react/jsx-runtime";import{createContext as $e,useCallback as fe,useContext as Oe,useEffect as h,useRef as p,useState as d}from"react";import{VIEW_TABLET_MIN as Re}from"efficient-easel/screen/lib/content/view-tiers";import{cssStringBody as Ce}from"efficient-web-builder/format/lib/document/style-text";import{HALF_SIZES as $,sizedImage as We}from"efficient-web-builder/format/lib/sized-image";import{prefersReducedMotion as G}from"efficient-web-builder/render/components/useReducedMotion";import{STAGE_PHOTO_BOX as Ue}from"../../lib/sections/hero-gallery.js";import{DEFAULT_SPIN_AUTO_TURN as je,DEFAULT_SPIN_HINT as Xe,SPIN_HINT_HIDE_MS as ze,SPIN_HINT_SHOW_MS as me,SPIN_RESUME_MS as Be,isFullTurn as he,spinAutoTurnStep as qe,spinBlend as Ge,spinClampPosition as Ke,spinFrameIndex as O,spinPositionAfterDrag as pe,spinCell as K,spinStartPosition as Z}from"../../lib/sections/spin-sets.js";const Ze=.3,Qe=.85,we=24,ge=4,ye=1e3,be=77/72,ve=`${(1-be)/2*100}%`,Se=`${be*100}%`,Q={left:ve,top:ve,width:Se,height:Se},Ve=`(max-width: ${Re-.02}px)`,V=new Map,Ee=new Map;function Y(t,v){let w=V.get(t);return w||(w=new Promise(M=>{const l=new Image,A=()=>{V.delete(t),Ee.delete(t),M(null)},S=()=>M({w:l.naturalWidth,h:l.naturalHeight});l.onload=()=>{if(typeof l.decode!="function")return S();l.decode().then(S,A)},l.onerror=A,v&&(l.sizes=$,l.srcset=v),l.src=t,Ee.set(t,l)}),V.set(t,w)),w}const Ye=$e({autoTurn:je,turnHint:Xe});let R=!1;const Je="M3 4.5c3.2 3.6 18.8 3.6 22 0M5.6 2.6 3 4.5l3 1.2M22.4 2.6 25 4.5l-3 1.2",F=t=>We(t,{fallbackWidth:ye,maxWidth:ye}),_e=(t,v)=>!!t.frames&&v===t.frames[0],Pe=t=>({...Q,backgroundImage:`url("${Ce(t.url)}")`,backgroundSize:`${t.cols*100}% ${t.rows*100}%`,backgroundPosition:`${t.cols>1?t.col*100/(t.cols-1):0}% ${t.rows>1?t.row*100/(t.rows-1):0}%`});function et({set:t,name:v,poster:w}){const[M,l]=d(null),A=p(null),[S,J]=d(()=>Z(t)),L=p(null),C=p(0),g=p(S),N=p(null),E=p(null),{autoTurn:f,turnHint:W}=Oe(Ye),[ke,U]=d(!1),[xe,ee]=d(!1),[j,te]=d(0),ne=p(0),[Ae,re]=d(!1),[Ie,Te]=d(!0),[oe,Fe]=d(null),i=t.count,[X,se]=d(null),z=p(null),[_,ie]=d(null),y=he(t),P=O(S,i,y),I=t.frames?t.frames[P]:t.startFrame??"";h(()=>{const e=A.current;e?.complete&&e.naturalWidth>0&&l(I)},[I]);const T=fe(e=>{const n=Ke(e,i,y);return g.current=n,J(n),n},[i,y]),D=fe(()=>cancelAnimationFrame(C.current),[]);h(()=>{const e=window.matchMedia?.(Ve);if(!e)return ie(!1);const n=()=>ie(e.matches);return n(),e.addEventListener?.("change",n),()=>e.removeEventListener?.("change",n)},[]),h(()=>{if(!t.sheets||!t.startFrame||_===null)return;const e=_?t.sheets.phone:t.sheets.desktop,n=`${t.startFrame} ${e.urls[0]}`;if(E.current===n)return;E.current=n,se({key:n,sheet:e,ready:new Set});const r=Math.floor(Z(t)/(e.cols*e.rows)),u=e.urls.map((c,o)=>e.urls[(r+o)%e.urls.length]),a=F(t.startFrame);Y(a.src,a.srcSet).then(()=>{for(const c of u)Y(c).then(o=>{!o||o.w!==e.cols*e.frame||o.h!==e.rows*e.frame||E.current===n&&se(m=>m?.key===n?{...m,ready:new Set(m.ready).add(c)}:m)})})},[t,_]),h(()=>{if(!t.frames)return;const e=t.frames,n=e[0];if(E.current===n)return;E.current=n;const r=O(Z(t),i,he(t)),u=[];for(let c=0;c<ge;c+=1)for(let o=c;o<i;o+=ge)u.push((r+o)%i);const a=c=>{const o=F(e[c]);return Y(o.src,o.srcSet)};a(u[0]).then(()=>Promise.all(u.slice(1).map(a))).then(c=>{E.current===n&&c.every(Boolean)&&Fe(n)})},[i,t]),h(()=>D,[D]),h(()=>{if(!W||R)return;const e=window.setTimeout(()=>U(!R),me),n=window.setTimeout(()=>{R=!0,U(!1)},me+ze);return()=>{window.clearTimeout(e),window.clearTimeout(n)}},[W]),h(()=>{const e=L.current;if(!f||!e)return;if(typeof IntersectionObserver>"u")return re(!0);const n=new IntersectionObserver(r=>re(r.some(u=>u.isIntersecting)));return n.observe(e),()=>n.disconnect()},[f]),h(()=>{if(!f)return;const e=()=>Te(document.visibilityState!=="hidden");return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[f]);const Me=e=>{D(),f&&ee(!0),W&&(R=!0,U(!1)),e.currentTarget.setPointerCapture?.(e.pointerId),N.current={x0:e.clientX,f0:g.current,last:e.clientX,speed:0}},Le=e=>{const n=N.current,r=L.current;!n||!r||(n.speed=e.clientX-n.last,n.last=e.clientX,T(pe(n.f0,e.clientX-n.x0,r.clientWidth,i)))},ae=()=>{const e=N.current;N.current=null,f&&e&&(ee(!1),te(a=>a+1));const n=L.current;if(!e||!n||G())return;let r=Math.max(-we,Math.min(we,e.speed));const u=()=>{if(Math.abs(r)<Ze)return;const a=pe(g.current,r,n.clientWidth,i);T(a)===a&&(r*=Qe,C.current=requestAnimationFrame(u))};C.current=requestAnimationFrame(u)},Ne=e=>{const n=e.key==="ArrowRight"||e.key==="ArrowUp"?1:e.key==="ArrowLeft"||e.key==="ArrowDown"?-1:0;if(e.key==="Home")T(0);else if(e.key==="End")T(i-1);else if(n)T(Math.round(g.current)+n);else return;D(),f&&te(r=>r+1),e.preventDefault()},s=t.sheets&&X&&X.key.startsWith(`${t.startFrame} `)?X:null;s&&s.ready.has(K(s.sheet,P).url)&&(z.current={key:s.key,frame:P});const B=s&&z.current?.key===s.key?z.current.frame:null,k=s&&B!==null?{...K(s.sheet,B),cols:s.sheet.cols,rows:s.sheet.rows}:null,x=Ge(S,i,y,G()),q=s&&x.b!==null&&B===P?K(s.sheet,x.b):null,ce=k&&q&&s.ready.has(q.url)?{...q,cols:k.cols,rows:k.rows}:null,le=!s&&t.frames&&x.b!==null&&_e(t,oe)?t.frames[x.b]:null,De=t.frames?_e(t,oe):!!s&&s.ready.size===s.sheet.urls.length,ue=f&&De&&Ae&&Ie&&!xe;return h(()=>{if(!ue)return;const e=ne.current!==j;let n=-1,r=-1,u=1,a=0;const c=o=>{if(a=requestAnimationFrame(c),n<0&&(n=o),e&&o-n<Be)return;if(ne.current=j,r<0){r=o;return}const m=qe(t,g.current,u,o-r);r=o,u=m.way;const He=O(g.current,i,y);g.current=m.position,(!G()||O(m.position,i,y)!==He)&&J(m.position)};return a=requestAnimationFrame(c),()=>cancelAnimationFrame(a)},[ue,j,t,i,y]),H("div",{ref:L,"data-spin-well":!0,role:"slider",tabIndex:0,"aria-label":`${v}, 360° view: drag or use the arrow keys to turn`,"aria-valuemin":1,"aria-valuemax":i,"aria-valuenow":P+1,"aria-valuetext":`Angle ${P+1} of ${i}`,"data-spin-auto-turn":f?"":void 0,onKeyDown:Ne,className:"absolute inset-0 select-none overflow-hidden cursor-grab active:cursor-grabbing focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-fg",style:{touchAction:"pan-y"},onPointerDown:Me,onPointerMove:Le,onPointerUp:ae,onPointerCancel:ae,onTouchStart:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),onTouchEnd:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[k?H(de,{children:[b("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:Pe(k)}),ce?b("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:{...Pe(ce),opacity:x.mix}}):null]}):H(de,{children:[b("img",{...F(I),ref:A,onLoad:()=>l(I),sizes:$,alt:"",draggable:!1,fetchPriority:"high","data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:Q}),le?b("img",{...F(le),sizes:$,alt:"",draggable:!1,"data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:{...Q,opacity:x.mix}}):null]}),w&&!k&&M!==I?b("img",{...F(w),sizes:$,alt:"",draggable:!1,"data-spin-poster":!0,className:`pointer-events-none absolute inset-[6%] ${Ue} object-contain`}):null,ke?H("span",{"data-spin-hint":!0,className:`pointer-events-none absolute inset-x-0 flex flex-col items-center gap-1 text-xs text-fg ${_?"bottom-3":"bottom-5"}`,children:[_?null:b("svg",{viewBox:"0 0 28 12",width:"28",height:"12","aria-hidden":"true",children:b("path",{d:Je,fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),_?"Swipe to turn":"Drag to turn"]}):null]})}export{Ye as SpinChoices,et as default};
1
+ "use client";import{jsx as p,Fragment as le,jsxs as $}from"react/jsx-runtime";import{createContext as Ne,useCallback as ue,useContext as $e,useEffect as h,useRef as g,useState as d}from"react";import{VIEW_TABLET_MIN as Re}from"efficient-easel/screen/lib/content/view-tiers";import{cssStringBody as Oe}from"efficient-web-builder/format/lib/document/style-text";import{HALF_SIZES as R,sizedImage as Ce}from"efficient-web-builder/format/lib/sized-image";import{prefersReducedMotion as z}from"efficient-web-builder/render/components/useReducedMotion";import{STAGE_PHOTO_BOX as He}from"../../lib/sections/hero-gallery.js";import{DEFAULT_SPIN_AUTO_TURN as We,DEFAULT_SPIN_HINT as Ue,SPIN_RESUME_MS as je,isFullTurn as de,spinAutoTurnStep as Xe,spinBlend as ze,spinClampPosition as Be,spinFrameIndex as O,spinPositionAfterDrag as fe,spinCell as B,spinStartPosition as q}from"../../lib/sections/spin-sets.js";const qe=.3,Ge=.85,me=24,pe=4,he=1e3,ge=77/72,we=`${(1-ge)/2*100}%`,be=`${ge*100}%`,G={left:we,top:we,width:be,height:be},Ke=`(max-width: ${Re-.02}px)`,K=new Map,ve=new Map;function Z(t,y){let w=K.get(t);return w||(w=new Promise(M=>{const l=new Image,F=()=>{K.delete(t),ve.delete(t),M(null)},S=()=>M({w:l.naturalWidth,h:l.naturalHeight});l.onload=()=>{if(typeof l.decode!="function")return S();l.decode().then(S,F)},l.onerror=F,y&&(l.sizes=R,l.srcset=y),l.src=t,ve.set(t,l)}),K.set(t,w)),w}const Ze=Ne({autoTurn:We,turnHint:Ue}),Qe="M3 4.5c3.2 3.6 18.8 3.6 22 0M5.6 2.6 3 4.5l3 1.2M22.4 2.6 25 4.5l-3 1.2",L=t=>Ce(t,{fallbackWidth:he,maxWidth:he}),ye=(t,y)=>!!t.frames&&y===t.frames[0],Se=t=>({...G,backgroundImage:`url("${Oe(t.url)}")`,backgroundSize:`${t.cols*100}% ${t.rows*100}%`,backgroundPosition:`${t.cols>1?t.col*100/(t.cols-1):0}% ${t.rows>1?t.row*100/(t.rows-1):0}%`});function Ve({set:t,name:y,poster:w}){const[M,l]=d(null),F=g(null),[S,Q]=d(()=>q(t)),T=g(null),C=g(0),b=g(S),D=g(null),E=g(null),{autoTurn:f,turnHint:Ee}=$e(Ze),[ke,V]=d(!1),[xe,Y]=d(!1),[H,J]=d(0),ee=g(0),[Ae,te]=d(!1),[Pe,Fe]=d(!0),[ne,_e]=d(null),a=t.count,[W,re]=d(null),U=g(null),[k,oe]=d(null),v=de(t),x=O(S,a,v),_=t.frames?t.frames[x]:t.startFrame??"";h(()=>{const e=F.current;e?.complete&&e.naturalWidth>0&&l(_)},[_]);const I=ue(e=>{const n=Be(e,a,v);return b.current=n,Q(n),n},[a,v]),N=ue(()=>cancelAnimationFrame(C.current),[]);h(()=>{const e=window.matchMedia?.(Ke);if(!e)return oe(!1);const n=()=>oe(e.matches);return n(),e.addEventListener?.("change",n),()=>e.removeEventListener?.("change",n)},[]),h(()=>{if(!t.sheets||!t.startFrame||k===null)return;const e=k?t.sheets.phone:t.sheets.desktop,n=`${t.startFrame} ${e.urls[0]}`;if(E.current===n)return;E.current=n,re({key:n,sheet:e,ready:new Set});const r=Math.floor(q(t)/(e.cols*e.rows)),u=e.urls.map((c,o)=>e.urls[(r+o)%e.urls.length]),i=L(t.startFrame);Z(i.src,i.srcSet).then(()=>{for(const c of u)Z(c).then(o=>{!o||o.w!==e.cols*e.frame||o.h!==e.rows*e.frame||E.current===n&&re(m=>m?.key===n?{...m,ready:new Set(m.ready).add(c)}:m)})})},[t,k]),h(()=>{if(!t.frames)return;const e=t.frames,n=e[0];if(E.current===n)return;E.current=n;const r=O(q(t),a,de(t)),u=[];for(let c=0;c<pe;c+=1)for(let o=c;o<a;o+=pe)u.push((r+o)%a);const i=c=>{const o=L(e[c]);return Z(o.src,o.srcSet)};i(u[0]).then(()=>Promise.all(u.slice(1).map(i))).then(c=>{E.current===n&&c.every(Boolean)&&_e(n)})},[a,t]),h(()=>N,[N]),h(()=>{const e=T.current;if(!f||!e)return;if(typeof IntersectionObserver>"u")return te(!0);const n=new IntersectionObserver(r=>te(r.some(u=>u.isIntersecting)));return n.observe(e),()=>n.disconnect()},[f]),h(()=>{if(!f)return;const e=()=>Fe(document.visibilityState!=="hidden");return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[f]);const Ie=e=>{N(),f&&Y(!0),V(!0),e.currentTarget.setPointerCapture?.(e.pointerId),D.current={x0:e.clientX,f0:b.current,last:e.clientX,speed:0}},Le=e=>{const n=D.current,r=T.current;!n||!r||(n.speed=e.clientX-n.last,n.last=e.clientX,I(fe(n.f0,e.clientX-n.x0,r.clientWidth,a)))},se=()=>{const e=D.current;D.current=null,V(!1),f&&e&&(Y(!1),J(i=>i+1));const n=T.current;if(!e||!n||z())return;let r=Math.max(-me,Math.min(me,e.speed));const u=()=>{if(Math.abs(r)<qe)return;const i=fe(b.current,r,n.clientWidth,a);I(i)===i&&(r*=Ge,C.current=requestAnimationFrame(u))};C.current=requestAnimationFrame(u)},Me=e=>{const n=e.key==="ArrowRight"||e.key==="ArrowUp"?1:e.key==="ArrowLeft"||e.key==="ArrowDown"?-1:0;if(e.key==="Home")I(0);else if(e.key==="End")I(a-1);else if(n)I(Math.round(b.current)+n);else return;N(),f&&J(r=>r+1),e.preventDefault()},s=t.sheets&&W&&W.key.startsWith(`${t.startFrame} `)?W:null;s&&s.ready.has(B(s.sheet,x).url)&&(U.current={key:s.key,frame:x});const j=s&&U.current?.key===s.key?U.current.frame:null,A=s&&j!==null?{...B(s.sheet,j),cols:s.sheet.cols,rows:s.sheet.rows}:null,P=ze(S,a,v,z()),X=s&&P.b!==null&&j===x?B(s.sheet,P.b):null,ae=A&&X&&s.ready.has(X.url)?{...X,cols:A.cols,rows:A.rows}:null,ie=!s&&t.frames&&P.b!==null&&ye(t,ne)?t.frames[P.b]:null,Te=t.frames?ye(t,ne):!!s&&s.ready.size===s.sheet.urls.length,ce=f&&Te&&Ae&&Pe&&!xe;return h(()=>{if(!ce)return;const e=ee.current!==H;let n=-1,r=-1,u=1,i=0;const c=o=>{if(i=requestAnimationFrame(c),n<0&&(n=o),e&&o-n<je)return;if(ee.current=H,r<0){r=o;return}const m=Xe(t,b.current,u,o-r);r=o,u=m.way;const De=O(b.current,a,v);b.current=m.position,(!z()||O(m.position,a,v)!==De)&&Q(m.position)};return i=requestAnimationFrame(c),()=>cancelAnimationFrame(i)},[ce,H,t,a,v]),$("div",{ref:T,"data-spin-well":!0,role:"slider",tabIndex:0,"aria-label":`${y}, 360° view: drag or use the arrow keys to turn`,"aria-valuemin":1,"aria-valuemax":a,"aria-valuenow":x+1,"aria-valuetext":`Angle ${x+1} of ${a}`,"data-spin-auto-turn":f?"":void 0,onKeyDown:Me,className:"absolute inset-0 select-none overflow-hidden cursor-grab active:cursor-grabbing focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-fg",style:{touchAction:"pan-y"},onPointerDown:Ie,onPointerMove:Le,onPointerUp:se,onPointerCancel:se,onTouchStart:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),onTouchEnd:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[p("div",{"data-spin-frames":!0,className:"pointer-events-none absolute inset-0",children:A?$(le,{children:[p("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:Se(A)}),ae?p("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:{...Se(ae),opacity:P.mix}}):null]}):$(le,{children:[p("img",{...L(_),ref:F,onLoad:()=>l(_),sizes:R,alt:"",draggable:!1,fetchPriority:"high","data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:G}),ie?p("img",{...L(ie),sizes:R,alt:"",draggable:!1,"data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:{...G,opacity:P.mix}}):null]})}),w&&!A&&M!==_?p("img",{...L(w),sizes:R,alt:"",draggable:!1,"data-spin-poster":!0,className:`pointer-events-none absolute inset-[6%] ${He} object-contain`}):null,Ee&&!ke?$("span",{"data-spin-hint":!0,className:`pointer-events-none absolute inset-x-0 flex flex-col items-center gap-1 text-xs text-fg ${k?"bottom-3":"bottom-5"}`,children:[k?null:p("svg",{viewBox:"0 0 28 12",width:"28",height:"12","aria-hidden":"true",children:p("path",{d:Qe,fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),k?"Swipe to turn":"Drag to turn"]}):null]})}export{Ze as SpinChoices,Ve as default};
@@ -21,8 +21,6 @@ export type SpinSets = Record<string, Record<string, SpinSet>>;
21
21
  export declare const DEFAULT_SPIN_AUTO_TURN = false;
22
22
  export declare const DEFAULT_SPIN_HINT = false;
23
23
  export declare function parseSpinSwitch(v: unknown): boolean;
24
- export declare const SPIN_HINT_SHOW_MS = 1000;
25
- export declare const SPIN_HINT_HIDE_MS = 6000;
26
24
  export declare const SPIN_TURN_MS = 14000;
27
25
  export declare const SPIN_RESUME_MS = 5000;
28
26
  export declare const DEFAULT_SPIN_AUTO_ARC = 160;
@@ -1 +1 @@
1
- import{resolveMedia as m}from"efficient-web-builder/render/lib/media";const x=4096,c=360,M=.9,E=!1,U=!1;function F(t){return t===!0}const j=1e3,R=6e3,S=14e3,y=1e-6,L=5e3,N=160;function D(t,n,r,e){const o=t.autoArc??N;if(a(t)&&o<c)return g(t.count,o,n,r,e*t.count/S);const i=a(t)?c:t.arc,s=n+r*e*t.count*c/(S*i);if(a(t))return{position:(s%t.count+t.count)%t.count,way:r};const u=t.count-y;return s>=u?{position:u,way:-1}:s<=0?{position:0,way:1}:{position:s,way:r}}const h=t=>Array.isArray(t)&&t.length>0&&t.every(n=>typeof n=="string"&&n.length>0),_=t=>m(t)??t,p=t=>Number.isInteger(t)&&t>0;function A(t,n){if(!t||typeof t!="object")return null;const{frame:r,cols:e,rows:o,urls:i}=t;return!p(r)||!p(e)||!p(o)||!h(i)||r*e>x||r*o>x||i.length!==Math.ceil(n/(e*o))?null:{frame:r,cols:e,rows:o,urls:i.map(_)}}function T(t){const{frames:n,count:r,startFrame:e,sheets:o}=t,i=h(n)?{count:n.length,frames:n.map(_)}:null;if(o&&typeof o=="object"&&p(r)&&typeof e=="string"&&e){const s=A(o.desktop,r),u=A(o.phone,r);if(s&&u)return{count:r,startFrame:_(e),sheets:{desktop:s,phone:u}}}return i}function I(t){if(!t||typeof t!="object")return null;const{arc:n,start:r}=t,e=T(t);if(!e)return null;if(n!==void 0){if(typeof n!="number"||!(n>0&&n<=c))return null;e.arc=n}const{autoArc:o}=t;return typeof o=="number"&&o>0&&o<=c&&(e.autoArc=o),Number.isInteger(r)&&r>=0&&r<e.count&&(e.start=r),e}function O(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,e]of Object.entries(t)){if(!e||typeof e!="object"||Array.isArray(e))continue;const o={};for(const[i,s]of Object.entries(e)){const u=I(s);u&&(o[i]=u)}Object.keys(o).length>0&&(n[r]=o)}return n}function k(t,n,r){return r?t[n]?.[r]??null:null}function w(t,n){const r=Object.keys(t?.[n]??{});return r.length>0?{finish:r}:null}function a(t){return t.arc===void 0||t.arc>=c}function g(t,n,r,e,o){const i=t*n/(2*c),s=(r%t+t)%t,u=s>t/2?s-t:s;let f=u>i?-1:u<-i?1:e,l=u+f*o;return f===1&&u<=i&&l>=i?[l,f]=[i,-1]:f===-1&&u>=-i&&l<=-i&&([l,f]=[-i,1]),{position:(l%t+t)%t,way:f}}function b(t){return a(t)?0:Math.floor(t.count/2)}function H(t){return t.start??b(t)}function d(t,n,r=!0){return r?(Math.floor(t)%n+n)%n:Math.max(0,Math.min(n-1,Math.floor(t)))}function C(t,n,r,e){const o=d(t,n,r),i=t-Math.floor(t),s=r?(o+1)%n:o+1<n?o+1:null;return e||i===0||s===null?{a:o,b:null,mix:0}:{a:o,b:s,mix:i}}function W(t,n,r){return r?t:Math.max(0,Math.min(n-1,t))}function B(t,n,r,e){return r<=0?t:t-n/r*e*M}function G(t,n){const r=t.cols*t.rows,e=n%r;return{url:t.urls[Math.floor(n/r)],col:e%t.cols,row:Math.floor(e/t.cols)}}export{N as DEFAULT_SPIN_AUTO_ARC,E as DEFAULT_SPIN_AUTO_TURN,U as DEFAULT_SPIN_HINT,R as SPIN_HINT_HIDE_MS,j as SPIN_HINT_SHOW_MS,L as SPIN_RESUME_MS,x as SPIN_SHEET_MAX_SIDE,S as SPIN_TURN_MS,a as isFullTurn,O as parseSpinSets,F as parseSpinSwitch,D as spinAutoTurnStep,C as spinBlend,G as spinCell,W as spinClampPosition,d as spinFrameIndex,B as spinPositionAfterDrag,w as spinPreference,k as spinSetFor,H as spinStartPosition};
1
+ import{resolveMedia as m}from"efficient-web-builder/render/lib/media";const h=4096,c=360,y=.9,E=!1,U=!1;function F(n){return n===!0}const S=14e3,M=1e-6,j=5e3,g=160;function R(n,t,r,e){const o=n.autoArc??g;if(a(n)&&o<c)return d(n.count,o,t,r,e*n.count/S);const i=a(n)?c:n.arc,s=t+r*e*n.count*c/(S*i);if(a(n))return{position:(s%n.count+n.count)%n.count,way:r};const u=n.count-M;return s>=u?{position:u,way:-1}:s<=0?{position:0,way:1}:{position:s,way:r}}const _=n=>Array.isArray(n)&&n.length>0&&n.every(t=>typeof t=="string"&&t.length>0),x=n=>m(n)??n,p=n=>Number.isInteger(n)&&n>0;function A(n,t){if(!n||typeof n!="object")return null;const{frame:r,cols:e,rows:o,urls:i}=n;return!p(r)||!p(e)||!p(o)||!_(i)||r*e>h||r*o>h||i.length!==Math.ceil(t/(e*o))?null:{frame:r,cols:e,rows:o,urls:i.map(x)}}function T(n){const{frames:t,count:r,startFrame:e,sheets:o}=n,i=_(t)?{count:t.length,frames:t.map(x)}:null;if(o&&typeof o=="object"&&p(r)&&typeof e=="string"&&e){const s=A(o.desktop,r),u=A(o.phone,r);if(s&&u)return{count:r,startFrame:x(e),sheets:{desktop:s,phone:u}}}return i}function b(n){if(!n||typeof n!="object")return null;const{arc:t,start:r}=n,e=T(n);if(!e)return null;if(t!==void 0){if(typeof t!="number"||!(t>0&&t<=c))return null;e.arc=t}const{autoArc:o}=n;return typeof o=="number"&&o>0&&o<=c&&(e.autoArc=o),Number.isInteger(r)&&r>=0&&r<e.count&&(e.start=r),e}function L(n){if(!n||typeof n!="object"||Array.isArray(n))return{};const t={};for(const[r,e]of Object.entries(n)){if(!e||typeof e!="object"||Array.isArray(e))continue;const o={};for(const[i,s]of Object.entries(e)){const u=b(s);u&&(o[i]=u)}Object.keys(o).length>0&&(t[r]=o)}return t}function k(n,t,r){return r?n[t]?.[r]??null:null}function w(n,t){const r=Object.keys(n?.[t]??{});return r.length>0?{finish:r}:null}function a(n){return n.arc===void 0||n.arc>=c}function d(n,t,r,e,o){const i=n*t/(2*c),s=(r%n+n)%n,u=s>n/2?s-n:s;let f=u>i?-1:u<-i?1:e,l=u+f*o;return f===1&&u<=i&&l>=i?[l,f]=[i,-1]:f===-1&&u>=-i&&l<=-i&&([l,f]=[-i,1]),{position:(l%n+n)%n,way:f}}function N(n){return a(n)?0:Math.floor(n.count/2)}function D(n){return n.start??N(n)}function I(n,t,r=!0){return r?(Math.floor(n)%t+t)%t:Math.max(0,Math.min(t-1,Math.floor(n)))}function O(n,t,r,e){const o=I(n,t,r),i=n-Math.floor(n),s=r?(o+1)%t:o+1<t?o+1:null;return e||i===0||s===null?{a:o,b:null,mix:0}:{a:o,b:s,mix:i}}function C(n,t,r){return r?n:Math.max(0,Math.min(t-1,n))}function H(n,t,r,e){return r<=0?n:n-t/r*e*y}function B(n,t){const r=n.cols*n.rows,e=t%r;return{url:n.urls[Math.floor(t/r)],col:e%n.cols,row:Math.floor(e/n.cols)}}export{g as DEFAULT_SPIN_AUTO_ARC,E as DEFAULT_SPIN_AUTO_TURN,U as DEFAULT_SPIN_HINT,j as SPIN_RESUME_MS,h as SPIN_SHEET_MAX_SIDE,S as SPIN_TURN_MS,a as isFullTurn,L as parseSpinSets,F as parseSpinSwitch,R as spinAutoTurnStep,O as spinBlend,B as spinCell,C as spinClampPosition,I as spinFrameIndex,H as spinPositionAfterDrag,w as spinPreference,k as spinSetFor,D as spinStartPosition};