efficient-storefront-blocks 0.134.4 → 0.134.5

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.
@@ -1 +1 @@
1
- "use client";import{jsx as o,Fragment as O,jsxs as u}from"react/jsx-runtime";import{useRef as G}from"react";import{photoLabel as N}from"./product-hero/hero-view.js";import R from"./product-hero/SpinLayer.js";import{stageControls as $,useHeldStagePhoto as I}from"./product-hero/stage-photo.js";import{DEFAULT_HERO_CLOSE_UPS_FILL as z,DEFAULT_HERO_GALLERY_GAP as F,DEFAULT_HERO_GALLERY_MARKS as B,DEFAULT_HERO_GALLERY_MODE as V,DEFAULT_HERO_GALLERY_SHOW as v,DEFAULT_HERO_IMAGE_FIT as Y,DEFAULT_HERO_PHOTO_GROUND as W,parseHeroGalleryGap as q,parseHeroCloseUpsFill as X,parseHeroGalleryMarks as Z,parseHeroGalleryMode as w,parseHeroGalleryShow as K,parseHeroImageFit as J,parseHeroPhotoGround as Q,resolveHeroImageFit as ee}from"../lib/sections/hero-gallery.js";import{spinSetFor as te}from"../lib/sections/spin-sets.js";import{productHasComposedRender as ae}from"../lib/wheels/set-mode.js";import{HideTaker as C}from"efficient-web-builder/render/components/ViewHideRoot";import{swipeEnabled as oe,swipeStep as le}from"efficient-web-builder/format/lib/hero-swipe";function ne({product:t,view:e,angleIdx:n,onSelect:c,isLight:l,onLightbox:s,galleryMode:i=V,imageFit:h=Y,style:a,takesViewHide:m=!1,spin:p=re,ground:d=W,show:g=v,marks:y=B,gap:S=F,closeUpsFill:_=z}){const b=te(p,t.slug,e.metaValue),L=se(Q(d),l),f=K(g)==="closeUps"||b?ie(e):e,E=Z(y),T=ce(e,f,X(_)),r=w(i),x=ee(J(h),ae(t)),H=o(ue,{name:t.name,view:f,wellGround:L,angleIdx:n,onSelect:c,onLightbox:s,fit:x,spinSet:b,marks:E,fillsTile:T});return r==="stacked"?o(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,style:a,children:f.photos.length<2&&!b?H:u(O,{children:[o(me,{name:t.name,view:f,wellGround:L,onLightbox:s,fit:x,spinSet:b,gap:q(S),fillsTile:T}),o(pe,{angleIdx:n,total:U(f),onSelect:c,children:H})]})}):u(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,className:r==="tiled"?"flex items-start gap-3 max-view-tablet:gap-2":void 0,style:a,children:[o("div",{className:r==="tiled"?"min-w-0 flex-1":void 0,children:H}),r!=="main"&&o(he,{name:t.name,view:f,angleIdx:n,onSelect:c,isLight:l,tiled:r==="tiled"})]})}function U(t){return t.photos.length>0?t.photos.length:t.thumbFallbackCells}const j="relative flex aspect-square items-center justify-center overflow-hidden",re={},k="sf-photo-ground-studio";function se(t,e){return t==="studio"?k:e?"bg-bg":""}function ie(t){return t.photos.length===0||t.closeUps.length===0?t:{...t,photos:[t.photos[0],...t.closeUps.map(e=>e.url)],captions:[t.captions[0],...t.closeUps.map(e=>e.title)]}}const A=()=>!1;function ce(t,e,n){if(!n||e===t)return A;const c=new Set(t.closeUps.map(l=>l.url));return(l,s)=>s>0&&l!==void 0&&c.has(l)}const M=(t,e,n)=>[t,e.metaValue,n].filter(Boolean).join(" — "),P=(t,e)=>[t,e.metaValue].filter(Boolean).join(" "),D=(t,e)=>`Open ${[t,e.metaValue].filter(Boolean).join(" ")} at full resolution`;function me({name:t,view:e,wellGround:n,onLightbox:c,fit:l,spinSet:s,gap:i,fillsTile:h=A}){const a=s?o(R,{set:s,name:P(t,e),poster:e.photos[0]}):null,m=i===F;return o("div",{"data-hero-stack":!0,className:m?"flex flex-col gap-2 max-view-tablet:hidden":"flex flex-col max-view-tablet:hidden",style:m?void 0:{gap:`${i}px`},children:e.photos.map((p,d)=>{const g=M(t,e,N(e,d));return o("div",{"data-hero-stack-photo":!0,className:[j,n].join(" "),style:{color:e.tint},children:d===0&&a?a:e.stageImage({photo:p,alt:g,label:D(t,e),onZoom:()=>c(p,g),fit:l,eager:d===0,fillsTile:h(p,d)})},p)})})}function pe({angleIdx:t,total:e,onSelect:n,children:c}){const l=G(null),s=G(null),i=oe({count:e}),h=a=>({x:a.touches[0].clientX,y:a.touches[0].clientY});return o("div",{"data-hero-phone-stage":!0,className:"view-tablet:hidden",onTouchStart:a=>{l.current=i&&a.touches.length===1?h(a):null,s.current=l.current},onTouchMove:a=>{l.current&&(a.touches.length!==1?l.current=null:s.current=h(a))},onTouchEnd:()=>{const a=l.current,m=s.current;if(l.current=null,s.current=null,!a||!m)return;const p=le(m.x-a.x,m.y-a.y,t,e);p!==t&&n(p)},children:c})}const de=6;function ue({name:t,view:e,angleIdx:n,onSelect:c,onLightbox:l,fit:s,spinSet:i,wellGround:h,marks:a,fillsTile:m=A}){const p=e.photos[Math.min(n,e.photos.length-1)],d=I(e.photos,p),g=U(e),y=g>=2,S=String(g).padStart(2,"0"),_=Math.min(n,Math.max(e.photos.length-1,0)),b=y||e.captions[_]?N(e,_):"",L=M(t,e,b),f="max-view-tablet:static",E=[`${j} max-view-tablet:col-span-2`,h].join(" ");return u("div",{className:"relative max-view-tablet:grid max-view-tablet:grid-cols-[minmax(0,1fr)_auto] max-view-tablet:items-start max-view-tablet:gap-x-3 max-view-tablet:gap-y-2",style:{color:e.tint},children:[a&&u("div",{className:`absolute left-0 top-0 z-10 flex items-center gap-3 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-fg ${f} max-view-tablet:min-w-0 max-view-tablet:flex-wrap max-view-tablet:gap-x-2 max-view-tablet:gap-y-1`,children:[y&&u(O,{children:[u("span",{className:"text-accent",children:[String(n+1).padStart(2,"0")," / ",S]}),o("span",{className:"text-fg-dim",children:"·"})]}),o("span",{children:t}),e.metaValue&&u(O,{children:[o("span",{className:"text-fg-dim",children:"·"}),o("span",{className:"text-accent",children:e.metaValue})]})]}),a&&y&&o("div",{className:`absolute right-5 top-5 z-10 flex gap-1 ${f}`,children:$(n,g,c).map(r=>o("button",{type:"button","aria-label":r.label,title:r.label,onClick:r.onClick,className:"flex h-7 w-7 items-center justify-center border border-fg-dim/60 text-fg transition-colors hover:border-accent hover:text-accent",children:r.glyph},r.label))}),u("div",{className:E,children:[h!==k&&["top-3 left-3","top-3 right-3","bottom-3 left-3","bottom-3 right-3"].map((r,x)=>o("span",{className:`absolute ${r} h-3 w-3 border border-fg-dim/40`,style:{borderTop:r.includes("top")?"1px solid var(--site-line)":"none",borderBottom:r.includes("bottom")?"1px solid var(--site-line)":"none",borderLeft:r.includes("left")?"1px solid var(--site-line)":"none",borderRight:r.includes("right")?"1px solid var(--site-line)":"none"}},x)),i&&_===0?o(R,{set:i,name:P(t,e),poster:e.photos[0]}):e.stageImage({photo:d,alt:L,label:D(t,e),onZoom:()=>l(d,L),fit:s,fillsTile:m(d,e.photos.indexOf(d??""))})]}),a&&u("div",{className:`absolute bottom-0 left-0 right-0 z-10 flex items-end justify-between gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim ${f} max-view-tablet:col-span-2 max-view-tablet:flex-wrap`,children:[u("span",{className:"flex min-w-0 flex-col gap-1",children:[e.specCaption&&o("span",{children:e.specCaption}),e.referenceNote&&o("span",{"data-hero-reference-note":!0,children:e.referenceNote}),e.galleryHint&&o("span",{"data-hero-gallery-hint":!0,children:e.galleryHint})]}),o("span",{children:e.originCaption})]})]})}function he({name:t,view:e,angleIdx:n,onSelect:c,isLight:l,tiled:s=!1}){const i=U(e);return i<2?null:o("div",{className:s?"order-[-1] flex w-16 flex-col gap-2 max-view-tablet:w-12 max-view-tablet:gap-1":"mt-2 grid grid-cols-4 gap-2 max-view-tablet:gap-1",style:!s&&i>4?{gridTemplateColumns:`repeat(${Math.min(i,de)}, minmax(0, 1fr))`}:void 0,children:Array.from({length:i}).map((h,a)=>{const m=e.photos[a];return u("button",{type:"button",onClick:()=>c(a),"aria-label":`View ${N(e,a)}`,"aria-pressed":a===n,className:["relative flex aspect-square items-center justify-center overflow-hidden transition-colors",l?"bg-bg":"",a===n?"border border-accent":"border border-transparent hover:border-fg-dim"].join(" "),style:{color:e.tint},children:[o("span",{className:"absolute top-1.5 left-2 z-10 font-mono text-[length:var(--size-label,8px)] uppercase tracking-[0.18em] text-fg-dim",children:String(a+1).padStart(2,"0")}),e.thumbImage({photo:m,alt:`${t} — ${N(e,a)}`})]},a)})})}export{ne as default};
1
+ "use client";import{jsx as o,Fragment as O,jsxs as u}from"react/jsx-runtime";import{useRef as F}from"react";import{photoLabel as N}from"./product-hero/hero-view.js";import G from"./product-hero/SpinLayer.js";import{stageControls as $,useHeldStagePhoto as I}from"./product-hero/stage-photo.js";import{DEFAULT_HERO_CLOSE_UPS_FILL as z,DEFAULT_HERO_GALLERY_GAP as R,DEFAULT_HERO_GALLERY_MARKS as V,DEFAULT_HERO_GALLERY_MODE as B,DEFAULT_HERO_GALLERY_SHOW as Y,DEFAULT_HERO_IMAGE_FIT as v,DEFAULT_HERO_PHOTO_GROUND as W,parseHeroGalleryGap as q,parseHeroCloseUpsFill as X,parseHeroGalleryMarks as Z,parseHeroGalleryMode as K,parseHeroGalleryShow as w,parseHeroImageFit as J,parseHeroPhotoGround as Q,resolveHeroImageFit as ee}from"../lib/sections/hero-gallery.js";import{apiSpinFor as te,spinSetFor as ae}from"../lib/sections/spin-sets.js";import{productHasComposedRender as oe}from"../lib/wheels/set-mode.js";import{HideTaker as C}from"efficient-web-builder/render/components/ViewHideRoot";import{swipeEnabled as le,swipeStep as ne}from"efficient-web-builder/format/lib/hero-swipe";function re({product:t,view:e,angleIdx:n,onSelect:c,isLight:l,onLightbox:s,galleryMode:i=B,imageFit:h=v,style:a,takesViewHide:m=!1,spin:p=se,ground:d=W,show:g=Y,marks:y=V,gap:S=R,closeUpsFill:_=z}){const b=ae(p,t.slug,e.metaValue)??te(t.parts,e.metaValue),L=ie(Q(d),l),f=w(g)==="closeUps"||b?ce(e):e,E=Z(y),T=me(e,f,X(_)),r=K(i),x=ee(J(h),oe(t)),H=o(he,{name:t.name,view:f,wellGround:L,angleIdx:n,onSelect:c,onLightbox:s,fit:x,spinSet:b,marks:E,fillsTile:T});return r==="stacked"?o(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,style:a,children:f.photos.length<2&&!b?H:u(O,{children:[o(pe,{name:t.name,view:f,wellGround:L,onLightbox:s,fit:x,spinSet:b,gap:q(S),fillsTile:T}),o(de,{angleIdx:n,total:U(f),onSelect:c,children:H})]})}):u(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,className:r==="tiled"?"flex items-start gap-3 max-view-tablet:gap-2":void 0,style:a,children:[o("div",{className:r==="tiled"?"min-w-0 flex-1":void 0,children:H}),r!=="main"&&o(fe,{name:t.name,view:f,angleIdx:n,onSelect:c,isLight:l,tiled:r==="tiled"})]})}function U(t){return t.photos.length>0?t.photos.length:t.thumbFallbackCells}const j="relative flex aspect-square items-center justify-center overflow-hidden",se={},k="sf-photo-ground-studio";function ie(t,e){return t==="studio"?k:e?"bg-bg":""}function ce(t){return t.photos.length===0||t.closeUps.length===0?t:{...t,photos:[t.photos[0],...t.closeUps.map(e=>e.url)],captions:[t.captions[0],...t.closeUps.map(e=>e.title)]}}const A=()=>!1;function me(t,e,n){if(!n||e===t)return A;const c=new Set(t.closeUps.map(l=>l.url));return(l,s)=>s>0&&l!==void 0&&c.has(l)}const M=(t,e,n)=>[t,e.metaValue,n].filter(Boolean).join(" — "),P=(t,e)=>[t,e.metaValue].filter(Boolean).join(" "),D=(t,e)=>`Open ${[t,e.metaValue].filter(Boolean).join(" ")} at full resolution`;function pe({name:t,view:e,wellGround:n,onLightbox:c,fit:l,spinSet:s,gap:i,fillsTile:h=A}){const a=s?o(G,{set:s,name:P(t,e),poster:e.photos[0]}):null,m=i===R;return o("div",{"data-hero-stack":!0,className:m?"flex flex-col gap-2 max-view-tablet:hidden":"flex flex-col max-view-tablet:hidden",style:m?void 0:{gap:`${i}px`},children:e.photos.map((p,d)=>{const g=M(t,e,N(e,d));return o("div",{"data-hero-stack-photo":!0,className:[j,n].join(" "),style:{color:e.tint},children:d===0&&a?a:e.stageImage({photo:p,alt:g,label:D(t,e),onZoom:()=>c(p,g),fit:l,eager:d===0,fillsTile:h(p,d)})},p)})})}function de({angleIdx:t,total:e,onSelect:n,children:c}){const l=F(null),s=F(null),i=le({count:e}),h=a=>({x:a.touches[0].clientX,y:a.touches[0].clientY});return o("div",{"data-hero-phone-stage":!0,className:"view-tablet:hidden",onTouchStart:a=>{l.current=i&&a.touches.length===1?h(a):null,s.current=l.current},onTouchMove:a=>{l.current&&(a.touches.length!==1?l.current=null:s.current=h(a))},onTouchEnd:()=>{const a=l.current,m=s.current;if(l.current=null,s.current=null,!a||!m)return;const p=ne(m.x-a.x,m.y-a.y,t,e);p!==t&&n(p)},children:c})}const ue=6;function he({name:t,view:e,angleIdx:n,onSelect:c,onLightbox:l,fit:s,spinSet:i,wellGround:h,marks:a,fillsTile:m=A}){const p=e.photos[Math.min(n,e.photos.length-1)],d=I(e.photos,p),g=U(e),y=g>=2,S=String(g).padStart(2,"0"),_=Math.min(n,Math.max(e.photos.length-1,0)),b=y||e.captions[_]?N(e,_):"",L=M(t,e,b),f="max-view-tablet:static",E=[`${j} max-view-tablet:col-span-2`,h].join(" ");return u("div",{className:"relative max-view-tablet:grid max-view-tablet:grid-cols-[minmax(0,1fr)_auto] max-view-tablet:items-start max-view-tablet:gap-x-3 max-view-tablet:gap-y-2",style:{color:e.tint},children:[a&&u("div",{className:`absolute left-0 top-0 z-10 flex items-center gap-3 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-fg ${f} max-view-tablet:min-w-0 max-view-tablet:flex-wrap max-view-tablet:gap-x-2 max-view-tablet:gap-y-1`,children:[y&&u(O,{children:[u("span",{className:"text-accent",children:[String(n+1).padStart(2,"0")," / ",S]}),o("span",{className:"text-fg-dim",children:"·"})]}),o("span",{children:t}),e.metaValue&&u(O,{children:[o("span",{className:"text-fg-dim",children:"·"}),o("span",{className:"text-accent",children:e.metaValue})]})]}),a&&y&&o("div",{className:`absolute right-5 top-5 z-10 flex gap-1 ${f}`,children:$(n,g,c).map(r=>o("button",{type:"button","aria-label":r.label,title:r.label,onClick:r.onClick,className:"flex h-7 w-7 items-center justify-center border border-fg-dim/60 text-fg transition-colors hover:border-accent hover:text-accent",children:r.glyph},r.label))}),u("div",{className:E,children:[h!==k&&["top-3 left-3","top-3 right-3","bottom-3 left-3","bottom-3 right-3"].map((r,x)=>o("span",{className:`absolute ${r} h-3 w-3 border border-fg-dim/40`,style:{borderTop:r.includes("top")?"1px solid var(--site-line)":"none",borderBottom:r.includes("bottom")?"1px solid var(--site-line)":"none",borderLeft:r.includes("left")?"1px solid var(--site-line)":"none",borderRight:r.includes("right")?"1px solid var(--site-line)":"none"}},x)),i&&_===0?o(G,{set:i,name:P(t,e),poster:e.photos[0]}):e.stageImage({photo:d,alt:L,label:D(t,e),onZoom:()=>l(d,L),fit:s,fillsTile:m(d,e.photos.indexOf(d??""))})]}),a&&u("div",{className:`absolute bottom-0 left-0 right-0 z-10 flex items-end justify-between gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim ${f} max-view-tablet:col-span-2 max-view-tablet:flex-wrap`,children:[u("span",{className:"flex min-w-0 flex-col gap-1",children:[e.specCaption&&o("span",{children:e.specCaption}),e.referenceNote&&o("span",{"data-hero-reference-note":!0,children:e.referenceNote}),e.galleryHint&&o("span",{"data-hero-gallery-hint":!0,children:e.galleryHint})]}),o("span",{children:e.originCaption})]})]})}function fe({name:t,view:e,angleIdx:n,onSelect:c,isLight:l,tiled:s=!1}){const i=U(e);return i<2?null:o("div",{className:s?"order-[-1] flex w-16 flex-col gap-2 max-view-tablet:w-12 max-view-tablet:gap-1":"mt-2 grid grid-cols-4 gap-2 max-view-tablet:gap-1",style:!s&&i>4?{gridTemplateColumns:`repeat(${Math.min(i,ue)}, minmax(0, 1fr))`}:void 0,children:Array.from({length:i}).map((h,a)=>{const m=e.photos[a];return u("button",{type:"button",onClick:()=>c(a),"aria-label":`View ${N(e,a)}`,"aria-pressed":a===n,className:["relative flex aspect-square items-center justify-center overflow-hidden transition-colors",l?"bg-bg":"",a===n?"border border-accent":"border border-transparent hover:border-fg-dim"].join(" "),style:{color:e.tint},children:[o("span",{className:"absolute top-1.5 left-2 z-10 font-mono text-[length:var(--size-label,8px)] uppercase tracking-[0.18em] text-fg-dim",children:String(a+1).padStart(2,"0")}),e.thumbImage({photo:m,alt:`${t} — ${N(e,a)}`})]},a)})})}export{re as default};
@@ -1356,6 +1356,11 @@ export interface components {
1356
1356
  hand?: "left" | "right" | null;
1357
1357
  axle?: "front" | "rear" | null;
1358
1358
  renderKey?: string;
1359
+ spin?: components["schemas"]["ComponentSpin"] | null;
1360
+ };
1361
+ ComponentSpin: {
1362
+ frame_count: number;
1363
+ frames: string[];
1359
1364
  };
1360
1365
  WheelVariant: {
1361
1366
  finishName: string;
@@ -6,6 +6,10 @@ export interface SetComponent {
6
6
  prices: Record<string, number | null>;
7
7
  hand?: SpareSide | null;
8
8
  axle?: SpareAxle | null;
9
+ spin?: {
10
+ frame_count: number;
11
+ frames: string[];
12
+ } | null;
9
13
  }
10
14
  export declare function orderLinesForSets(components: SetComponent[], sets: number): {
11
15
  partNumber: string;
@@ -30,6 +30,14 @@ export declare function spinAutoTurnStep(set: SpinSet, position: number, way: 1
30
30
  };
31
31
  export declare function parseSpinSets(v: unknown): SpinSets;
32
32
  export declare function spinSetFor(sets: SpinSets, productSlug: string, finishName: string | undefined): SpinSet | null;
33
+ export declare function apiSpinFor(parts: readonly {
34
+ options: Record<string, string>;
35
+ components: readonly {
36
+ spin?: {
37
+ frames: string[];
38
+ } | null;
39
+ }[];
40
+ }[], finishName: string | undefined): SpinSet | null;
33
41
  export declare function spinPreference(sets: SpinSets | undefined, productSlug: string): {
34
42
  finish: string[];
35
43
  } | null;
@@ -1 +1 @@
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};
1
+ import{resolveMedia as g}from"efficient-web-builder/render/lib/media";const h=4096,f=360,A=.9,E=!1,F=!1;function U(n){return n===!0}const m=14e3,y=1e-6,j=5e3,M=160;function R(n,t,r,e){const o=n.autoArc??M;if(x(n)&&o<f)return d(n.count,o,t,r,e*n.count/m);const i=x(n)?f:n.arc,s=t+r*e*n.count*f/(m*i);if(x(n))return{position:(s%n.count+n.count)%n.count,way:r};const u=n.count-y;return s>=u?{position:u,way:-1}:s<=0?{position:0,way:1}:{position:s,way:r}}const S=n=>Array.isArray(n)&&n.length>0&&n.every(t=>typeof t=="string"&&t.length>0),p=n=>g(n)??n,a=n=>Number.isInteger(n)&&n>0;function _(n,t){if(!n||typeof n!="object")return null;const{frame:r,cols:e,rows:o,urls:i}=n;return!a(r)||!a(e)||!a(o)||!S(i)||r*e>h||r*o>h||i.length!==Math.ceil(t/(e*o))?null:{frame:r,cols:e,rows:o,urls:i.map(p)}}function T(n){const{frames:t,count:r,startFrame:e,sheets:o}=n,i=S(t)?{count:t.length,frames:t.map(p)}:null;if(o&&typeof o=="object"&&a(r)&&typeof e=="string"&&e){const s=_(o.desktop,r),u=_(o.phone,r);if(s&&u)return{count:r,startFrame:p(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<=f))return null;e.arc=t}const{autoArc:o}=n;return typeof o=="number"&&o>0&&o<=f&&(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){if(!t)return null;for(const r of n)if(r.options.finish===t)for(const e of r.components){const o=e.spin?.frames?.filter(i=>typeof i=="string"&&i.length>0)??[];if(o.length>1)return{count:o.length,frames:o.map(p)}}return null}function D(n,t){const r=Object.keys(n?.[t]??{});return r.length>0?{finish:r}:null}function x(n){return n.arc===void 0||n.arc>=f}function d(n,t,r,e,o){const i=n*t/(2*f),s=(r%n+n)%n,u=s>n/2?s-n:s;let c=u>i?-1:u<-i?1:e,l=u+c*o;return c===1&&u<=i&&l>=i?[l,c]=[i,-1]:c===-1&&u>=-i&&l<=-i&&([l,c]=[-i,1]),{position:(l%n+n)%n,way:c}}function N(n){return x(n)?0:Math.floor(n.count/2)}function O(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 C(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 H(n,t,r){return r?n:Math.max(0,Math.min(t-1,n))}function B(n,t,r,e){return r<=0?n:n-t/r*e*A}function G(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{M as DEFAULT_SPIN_AUTO_ARC,E as DEFAULT_SPIN_AUTO_TURN,F as DEFAULT_SPIN_HINT,j as SPIN_RESUME_MS,h as SPIN_SHEET_MAX_SIDE,m as SPIN_TURN_MS,w as apiSpinFor,x as isFullTurn,L as parseSpinSets,U as parseSpinSwitch,R as spinAutoTurnStep,C as spinBlend,G as spinCell,H as spinClampPosition,I as spinFrameIndex,B as spinPositionAfterDrag,D as spinPreference,k as spinSetFor,O as spinStartPosition};