@frybynite/image-cloud 0.3.4 → 0.3.6
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.
- package/dist/image-cloud-auto-init.js +486 -465
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +216 -195
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +11 -2
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/image-cloud.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(A,st){typeof exports=="object"&&typeof module<"u"?st(exports):typeof define=="function"&&define.amd?define(["exports"],st):(A=typeof globalThis<"u"?globalThis:A||self,st(A.ImageCloud={}))})(this,function(A){"use strict";const st=Object.freeze({none:"none",sm:"0 2px 4px rgba(0,0,0,0.1)",md:"0 4px 16px rgba(0,0,0,0.4)",lg:"0 8px 32px rgba(0,0,0,0.5)",glow:"0 0 30px rgba(255,255,255,0.6)"}),yt=Object.freeze({energetic:Object.freeze({overshoot:.25,bounces:2,decayRatio:.5}),playful:Object.freeze({overshoot:.15,bounces:1,decayRatio:.5}),subtle:Object.freeze({overshoot:.08,bounces:1,decayRatio:.5})}),vt=Object.freeze({gentle:Object.freeze({stiffness:150,damping:30,mass:1,oscillations:2}),bouncy:Object.freeze({stiffness:300,damping:15,mass:1,oscillations:4}),wobbly:Object.freeze({stiffness:180,damping:12,mass:1.5,oscillations:5}),snappy:Object.freeze({stiffness:400,damping:25,mass:.8,oscillations:2})}),wt=Object.freeze({gentle:Object.freeze({amplitude:30,frequency:1.5,decay:!0,decayRate:.9,phase:0}),playful:Object.freeze({amplitude:50,frequency:2.5,decay:!0,decayRate:.7,phase:0}),serpentine:Object.freeze({amplitude:60,frequency:3,decay:!1,decayRate:1,phase:0}),flutter:Object.freeze({amplitude:20,frequency:4,decay:!0,decayRate:.5,phase:0})}),St=Object.freeze({type:"linear"}),Et=Object.freeze({mode:"none"}),xt=Object.freeze({mode:"none"}),Ot=Object.freeze({default:Object.freeze({border:Object.freeze({width:0,color:"#000000",radius:0,style:"solid"}),shadow:"none",filter:Object.freeze({}),opacity:1,cursor:"pointer",outline:Object.freeze({width:0,color:"#000000",style:"solid",offset:0})}),hover:Object.freeze({shadow:"none"}),focused:Object.freeze({shadow:"none"})}),oe=Object.freeze({rows:1,amplitude:100,frequency:2,phaseShift:0,synchronization:"offset"}),se=Object.freeze({mobile:Object.freeze({maxWidth:767}),tablet:Object.freeze({maxWidth:1199})}),ae=Object.freeze({mode:"adaptive",minSize:50,maxSize:400,variance:Object.freeze({min:1,max:1})}),re=Object.freeze({mode:"none",range:Object.freeze({min:-15,max:15})}),$t=Object.freeze({sizing:ae,rotation:re}),It=Object.freeze({validateUrls:!0,validationTimeout:5e3,validationMethod:"head",failOnAllMissing:!0,allowedExtensions:["jpg","jpeg","png","gif","webp","bmp"],debugLogging:!1}),w=Object.freeze({loaders:[],config:Object.freeze({loaders:It}),image:$t,layout:Object.freeze({algorithm:"radial",scaleDecay:0,responsive:se,targetCoverage:.6,densityFactor:1,spacing:Object.freeze({padding:50,minGap:20}),debugRadials:!1,debugCenters:!1}),animation:Object.freeze({duration:600,easing:Object.freeze({default:"cubic-bezier(0.4, 0.0, 0.2, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)",focus:"cubic-bezier(0.4, 0.0, 0.2, 1)"}),queue:Object.freeze({enabled:!0,interval:150,maxConcurrent:void 0}),performance:Object.freeze({useGPU:void 0,reduceMotion:void 0}),entry:Object.freeze({start:Object.freeze({position:"nearest-edge",offset:100,circular:Object.freeze({radius:"120%",distribution:"even"})}),timing:Object.freeze({duration:600,stagger:150}),easing:"cubic-bezier(0.25, 1, 0.5, 1)",path:St,rotation:Et,scale:xt})}),interaction:Object.freeze({focus:Object.freeze({scalePercent:.8,zIndex:1e3,animationDuration:void 0}),navigation:Object.freeze({keyboard:void 0,swipe:void 0,mouseWheel:void 0}),gestures:Object.freeze({pinchToZoom:void 0,doubleTapToFocus:void 0})}),rendering:Object.freeze({responsive:Object.freeze({breakpoints:Object.freeze({mobile:768,tablet:void 0,desktop:void 0}),mobileDetection:()=>typeof window>"u"?!1:window.innerWidth<=768}),ui:Object.freeze({showLoadingSpinner:!1,showImageCounter:void 0,showThumbnails:void 0,theme:void 0}),performance:Object.freeze({lazyLoad:void 0,preloadCount:void 0,imageQuality:void 0})}),styling:Ot,debug:!1});function lt(o,t){if(!o)return t||{};if(!t)return{...o};const e={...o};return t.border!==void 0&&(e.border={...o.border,...t.border}),t.borderTop!==void 0&&(e.borderTop={...o.borderTop,...t.borderTop}),t.borderRight!==void 0&&(e.borderRight={...o.borderRight,...t.borderRight}),t.borderBottom!==void 0&&(e.borderBottom={...o.borderBottom,...t.borderBottom}),t.borderLeft!==void 0&&(e.borderLeft={...o.borderLeft,...t.borderLeft}),t.filter!==void 0&&(e.filter={...o.filter,...t.filter}),t.outline!==void 0&&(e.outline={...o.outline,...t.outline}),t.shadow!==void 0&&(e.shadow=t.shadow),t.opacity!==void 0&&(e.opacity=t.opacity),t.cursor!==void 0&&(e.cursor=t.cursor),t.className!==void 0&&(e.className=t.className),t.objectFit!==void 0&&(e.objectFit=t.objectFit),t.aspectRatio!==void 0&&(e.aspectRatio=t.aspectRatio),t.borderRadiusTopLeft!==void 0&&(e.borderRadiusTopLeft=t.borderRadiusTopLeft),t.borderRadiusTopRight!==void 0&&(e.borderRadiusTopRight=t.borderRadiusTopRight),t.borderRadiusBottomRight!==void 0&&(e.borderRadiusBottomRight=t.borderRadiusBottomRight),t.borderRadiusBottomLeft!==void 0&&(e.borderRadiusBottomLeft=t.borderRadiusBottomLeft),e}function ce(o,t){if(!t)return{...o};const e=lt(o.default,t.default),i=lt(lt(e,o.hover),t.hover),n=lt(lt(e,o.focused),t.focused);return{default:e,hover:i,focused:n}}function le(o,t){var i,n,a,r,s,h,l,u;if(!t)return{...o};const e={...o};if(t.sizing!==void 0&&(e.sizing={...o.sizing,...t.sizing},t.sizing.variance)){const c=t.sizing.variance,d=c.min!==void 0&&c.min>=.25&&c.min<=1?c.min:((n=(i=o.sizing)==null?void 0:i.variance)==null?void 0:n.min)??1,f=c.max!==void 0&&c.max>=1&&c.max<=1.75?c.max:((r=(a=o.sizing)==null?void 0:a.variance)==null?void 0:r.max)??1;e.sizing.variance={min:d,max:f}}if(t.rotation!==void 0&&(e.rotation={...o.rotation,...t.rotation},t.rotation.range)){const c=t.rotation.range,d=c.min!==void 0&&c.min>=-180&&c.min<=0?c.min:((h=(s=o.rotation)==null?void 0:s.range)==null?void 0:h.min)??-15,f=c.max!==void 0&&c.max>=0&&c.max<=180?c.max:((u=(l=o.rotation)==null?void 0:l.range)==null?void 0:u.max)??15;e.rotation.range={min:d,max:f}}return e}function he(o){var e;const t=(e=o.layout)==null?void 0:e.rotation;if(t&&"enabled"in t)return{rotation:{mode:t.enabled?"random":"none",range:t.range}}}function de(o){var e,i;const t=(i=(e=o.layout)==null?void 0:e.sizing)==null?void 0:i.variance;if(t)return{sizing:{mode:"adaptive",variance:t}}}function ue(o={}){var h,l;const t=he(o),e=de(o);let i=o.image;(t||e)&&(i={...e||{},...t||{},...i},i.rotation&&(t!=null&&t.rotation)&&((h=o.image)!=null&&h.rotation)&&(i.rotation={...t.rotation,...o.image.rotation}));const n=[...o.loaders??[]];o.images&&o.images.length>0&&n.unshift({static:{sources:[{urls:o.images}]}});const r={loaders:{...It,...((l=o.config)==null?void 0:l.loaders)??{}}},s={loaders:n,config:r,image:le($t,i),layout:{...w.layout},animation:{...w.animation},interaction:{...w.interaction},rendering:{...w.rendering},styling:ce(Ot,o.styling),debug:w.debug};return o.layout&&(s.layout={...w.layout,...o.layout},o.layout.responsive&&(s.layout.responsive={...w.layout.responsive,mobile:o.layout.responsive.mobile?{...w.layout.responsive.mobile,...o.layout.responsive.mobile}:w.layout.responsive.mobile,tablet:o.layout.responsive.tablet?{...w.layout.responsive.tablet,...o.layout.responsive.tablet}:w.layout.responsive.tablet}),o.layout.spacing&&(s.layout.spacing={...w.layout.spacing,...o.layout.spacing})),o.animation&&(s.animation={...w.animation,...o.animation},o.animation.easing&&(s.animation.easing={...w.animation.easing,...o.animation.easing}),o.animation.queue&&(s.animation.queue={...w.animation.queue,...o.animation.queue}),o.animation.performance&&(s.animation.performance={...w.animation.performance,...o.animation.performance}),o.animation.entry&&(s.animation.entry={...w.animation.entry,...o.animation.entry,start:o.animation.entry.start?{...w.animation.entry.start,...o.animation.entry.start,circular:o.animation.entry.start.circular?{...w.animation.entry.start.circular,...o.animation.entry.start.circular}:w.animation.entry.start.circular}:w.animation.entry.start,timing:o.animation.entry.timing?{...w.animation.entry.timing,...o.animation.entry.timing}:w.animation.entry.timing,path:o.animation.entry.path?{...St,...o.animation.entry.path}:w.animation.entry.path,rotation:o.animation.entry.rotation?{...Et,...o.animation.entry.rotation}:w.animation.entry.rotation,scale:o.animation.entry.scale?{...xt,...o.animation.entry.scale}:w.animation.entry.scale})),o.interaction&&(s.interaction={...w.interaction,...o.interaction},o.interaction.focus&&(s.interaction.focus={...w.interaction.focus,...o.interaction.focus}),o.interaction.navigation&&(s.interaction.navigation={...w.interaction.navigation,...o.interaction.navigation}),o.interaction.gestures&&(s.interaction.gestures={...w.interaction.gestures,...o.interaction.gestures})),o.rendering&&(s.rendering={...w.rendering,...o.rendering},o.rendering.responsive&&(s.rendering.responsive={...w.rendering.responsive,...o.rendering.responsive,breakpoints:o.rendering.responsive.breakpoints?{...w.rendering.responsive.breakpoints,...o.rendering.responsive.breakpoints}:w.rendering.responsive.breakpoints,mobileDetection:o.rendering.responsive.mobileDetection?o.rendering.responsive.mobileDetection:w.rendering.responsive.mobileDetection}),o.rendering.ui&&(s.rendering.ui={...w.rendering.ui,...o.rendering.ui}),o.rendering.performance&&(s.rendering.performance={...w.rendering.performance,...o.rendering.performance})),o.debug!==void 0&&(s.debug=o.debug),s}function ge(o,t){return{...o?yt[o]:yt.playful,...t}}function me(o,t){return{...o?vt[o]:vt.gentle,...t}}function fe(o,t){return{...o?wt[o]:wt.gentle,...t}}class Dt{constructor(t){this.activeAnimations=new Map,this.animationIdCounter=0,this.config=t}buildTransformString(t){const e=["translate(-50%, -50%)"];if(t.x!==void 0||t.y!==void 0){const i=t.x??0,n=t.y??0;e.push(`translate(${i}px, ${n}px)`)}return t.rotation!==void 0&&e.push(`rotate(${t.rotation}deg)`),t.scale!==void 0&&e.push(`scale(${t.scale})`),e.join(" ")}animateTransformCancellable(t,e,i,n=null,a=null){this.cancelAllAnimations(t);const r=n??this.config.duration,s=a??this.config.easing.default,h=this.buildTransformString(e),l=this.buildTransformString(i);t.style.transition="none";const u=t.animate([{transform:h},{transform:l}],{duration:r,easing:s,fill:"forwards"}),c={id:`anim-${++this.animationIdCounter}`,element:t,animation:u,fromState:e,toState:i,startTime:performance.now(),duration:r};return this.activeAnimations.set(t,c),u.finished.then(()=>{t.style.transform=l,this.activeAnimations.delete(t)}).catch(()=>{this.activeAnimations.delete(t)}),c}cancelAnimation(t,e=!0){const i=this.getCurrentTransform(t.element);if(t.animation.cancel(),e){const n=this.buildTransformString({x:i.x,y:i.y,rotation:i.rotation,scale:i.scale});t.element.style.transform=n}return this.activeAnimations.delete(t.element),i}cancelAllAnimations(t){const e=this.activeAnimations.get(t);e&&this.cancelAnimation(e,!1);const i=t.getAnimations();for(const n of i)n.cancel()}getCurrentTransform(t){const i=getComputedStyle(t).transform;if(i==="none"||!i)return{x:0,y:0,rotation:0,scale:1};const n=new DOMMatrix(i),a=Math.sqrt(n.a*n.a+n.b*n.b),r=Math.atan2(n.b,n.a)*(180/Math.PI),s=n.e,h=n.f;return{x:s,y:h,rotation:r,scale:a}}hasActiveAnimation(t){return this.activeAnimations.has(t)}getAnimationHandle(t){return this.activeAnimations.get(t)}animateTransform(t,e,i=null,n=null){return new Promise(a=>{const r=i??this.config.duration,s=n??this.config.easing.default;t.style.transition=`transform ${r}ms ${s}, box-shadow ${r}ms ${s}`,t.style.transform=this.buildTransformString(e),setTimeout(()=>{a()},r)})}resetTransform(t,e){return this.animateTransform(t,e)}clearTransition(t){t.style.transition=""}wait(t){return new Promise(e=>setTimeout(e,t))}}function at(o,t,e){return o+(t-o)*e}function pe(o,t,e,i){const{overshoot:n,bounces:a,decayRatio:r}=i,s=e.x-t.x,h=e.y-t.y,l=be(a,r);let u=0,c=0,d=1,f=n,b=!1;for(let g=0;g<l.length;g++)if(o<=l[g].time){c=g===0?0:l[g-1].time,d=l[g].time,f=l[g].overshoot,b=l[g].isOvershoot;break}const p=(o-c)/(d-c);if(b)u=1+f*gt(p);else if(c===0)u=gt(p);else{const g=l.find((y,v)=>y.time>c&&v>0&&l[v-1].isOvershoot),m=1+((g==null?void 0:g.overshoot)||f);u=at(m,1,gt(p))}return{x:t.x+s*u,y:t.y+h*u}}function be(o,t){const e=[];let i=.6;e.push({time:i,overshoot:0,isOvershoot:!1});let n=.15;const r=.4/(o*2);for(let s=0;s<o;s++)i+=r,e.push({time:i,overshoot:n,isOvershoot:!0}),i+=r,e.push({time:i,overshoot:n*t,isOvershoot:!1}),n*=t;return e.push({time:1,overshoot:0,isOvershoot:!1}),e}function ye(o,t,e,i){const{stiffness:n,damping:a,mass:r,oscillations:s}=i,h=e.x-t.x,l=e.y-t.y,u=Math.sqrt(n/r),c=a/(2*Math.sqrt(n*r));let d;if(c<1){const f=u*Math.sqrt(1-c*c),b=Math.exp(-c*u*o*3),p=Math.cos(f*o*s*Math.PI);d=1-b*p}else d=1-Math.exp(-u*o*3);return d=Math.max(0,Math.min(d,1.3)),{x:t.x+h*d,y:t.y+l*d}}function ve(o,t,e,i){const{amplitude:n,frequency:a,decay:r,decayRate:s,phase:h}=i,l=e.x-t.x,u=e.y-t.y,c=Math.sqrt(l*l+u*u),d=c>0?-u/c:0,f=c>0?l/c:1,b=a*Math.PI*2*o+h,p=r?Math.pow(1-o,s):1,g=n*Math.sin(b)*p,m=we(o);return{x:at(t.x,e.x,m)+g*d,y:at(t.y,e.y,m)+g*f}}function gt(o){return 1-(1-o)*(1-o)}function we(o){return 1-Math.pow(1-o,3)}function Se(o,t,e){const{amplitude:i,frequency:n,decay:a}=e,r=Math.sin(o*n*Math.PI*2),s=a?Math.pow(1-o,2):1,h=i*r*s;return t+h}function Ee(o,t,e){const{overshoot:i,bounces:n}=e,a=[];a.push({time:.5,scale:i});let r=i;const s=.5,l=.5/(n*2);let u=.5;for(let d=0;d<n;d++){const f=1-(r-1)*s;u+=l,a.push({time:u,scale:f}),r=1+(r-1)*s*s,u+=l,d<n-1&&a.push({time:u,scale:r})}a.push({time:1,scale:1});let c=1;for(let d=0;d<a.length;d++)if(o<=a[d].time){const f=d===0?0:a[d-1].time,b=d===0?1:a[d-1].scale,p=(o-f)/(a[d].time-f),g=gt(p);c=b+(a[d].scale-b)*g;break}return c*t}function Pt(o){const{element:t,startPosition:e,endPosition:i,pathConfig:n,duration:a,imageWidth:r,imageHeight:s,rotation:h,scale:l,onComplete:u,rotationConfig:c,startRotation:d,scaleConfig:f,startScale:b}=o,p=n.type,g=d!==void 0&&d!==h,m=(c==null?void 0:c.mode)==="wobble",y=(c==null?void 0:c.wobble)||{amplitude:15,frequency:3,decay:!0},v=g||m,I=b!==void 0&&b!==l,R=(f==null?void 0:f.mode)==="pop",S=(f==null?void 0:f.pop)||{overshoot:1.2,bounces:1};if((p==="linear"||p==="arc")&&!v&&!(I||R)){u&&u();return}const j=performance.now(),_=-r/2,P=-s/2;function U(G){const F=G-j,E=Math.min(F/a,1);let C;switch(p){case"bounce":{const N=ge(n.bouncePreset,n.bounce);C=pe(E,e,i,N);break}case"elastic":{const N=me(n.elasticPreset,n.elastic);C=ye(E,e,i,N);break}case"wave":{const N=fe(n.wavePreset,n.wave);C=ve(E,e,i,N);break}default:C={x:at(e.x,i.x,E),y:at(e.y,i.y,E)}}const $=C.x-i.x,L=C.y-i.y;let T;m?T=Se(E,h,y):g?T=at(d,h,E):T=h;let M;R?M=Ee(E,l,S):I?M=at(b,l,E):M=l,t.style.transform=`translate(${_}px, ${P}px) translate(${$}px, ${L}px) rotate(${T}deg) scale(${M})`,E<1?requestAnimationFrame(U):(t.style.transform=`translate(${_}px, ${P}px) rotate(${h}deg) scale(${l})`,u&&u())}requestAnimationFrame(U)}function Ut(o){return o==="bounce"||o==="elastic"||o==="wave"}const xe={radial:"center",spiral:"center",grid:"top",cluster:"nearest-edge",random:"nearest-edge",wave:"left"};class _t{constructor(t,e){this.config=t,this.layoutAlgorithm=e,this.resolvedStartPosition=this.resolveStartPosition(),this.pathConfig=t.path||St,this.rotationConfig=t.rotation||Et,this.scaleConfig=t.scale||xt}resolveStartPosition(){return this.config.start.position?this.config.start.position:xe[this.layoutAlgorithm]||"nearest-edge"}calculateStartPosition(t,e,i,n,a){const r=this.resolvedStartPosition,s=this.config.start.offset??100;switch(r){case"nearest-edge":return this.calculateNearestEdge(t,e,i,s);case"top":return this.calculateEdgePosition("top",t,e,i,s);case"bottom":return this.calculateEdgePosition("bottom",t,e,i,s);case"left":return this.calculateEdgePosition("left",t,e,i,s);case"right":return this.calculateEdgePosition("right",t,e,i,s);case"center":return this.calculateCenterPosition(i,t,e);case"random-edge":return this.calculateRandomEdge(t,e,i,s);case"circular":return this.calculateCircularPosition(t,e,i,n,a);default:return this.calculateNearestEdge(t,e,i,s)}}calculateNearestEdge(t,e,i,n){const a=t.x,r=t.y,s=a,h=i.width-a,l=r,u=i.height-r,c=Math.min(s,h,l,u);let d=t.x,f=t.y;return c===s?d=-(e.width+n):c===h?d=i.width+n:c===l?f=-(e.height+n):f=i.height+n,{x:d,y:f}}calculateEdgePosition(t,e,i,n,a){let r=e.x,s=e.y;switch(t){case"top":s=-(i.height+a);break;case"bottom":s=n.height+a;break;case"left":r=-(i.width+a);break;case"right":r=n.width+a;break}return{x:r,y:s}}calculateCenterPosition(t,e,i){const n=t.width/2,a=t.height/2;return{x:n,y:a,useScale:!0}}calculateRandomEdge(t,e,i,n){const a=["top","bottom","left","right"],r=a[Math.floor(Math.random()*a.length)];return this.calculateEdgePosition(r,t,e,i,n)}calculateCircularPosition(t,e,i,n,a){const r=this.config.start.circular||{},s=r.distribution||"even";let h;const l=r.radius||"120%";if(typeof l=="string"&&l.endsWith("%")){const p=parseFloat(l)/100;h=Math.sqrt(i.width**2+i.height**2)*p/2}else h=typeof l=="number"?l:500;let u;s==="even"?u=n/a*2*Math.PI:u=Math.random()*2*Math.PI;const c=i.width/2,d=i.height/2,f=c+Math.cos(u)*h,b=d+Math.sin(u)*h;return{x:f,y:b}}getAnimationParams(t){const e=this.config.timing.duration,i=this.config.timing.stagger,n=this.config.easing;return{startTransform:"",duration:e,delay:t*i,easing:n}}buildStartTransform(t,e,i,n,a,r,s,h){const l=t.x-e.x,u=t.y-e.y,c=s!==void 0?s:i,d=h!==void 0?h:n,f=a!==void 0?-a/2:0,b=r!==void 0?-r/2:0,p=a!==void 0?`translate(${f}px, ${b}px)`:"translate(-50%, -50%)";return t.useScale?`${p} translate(${l}px, ${u}px) rotate(${c}deg) scale(0)`:`${p} translate(${l}px, ${u}px) rotate(${c}deg) scale(${d})`}buildFinalTransform(t,e,i,n){if(i!==void 0&&n!==void 0){const a=-i/2,r=-n/2;return`translate(${a}px, ${r}px) rotate(${t}deg) scale(${e})`}return`translate(-50%, -50%) rotate(${t}deg) scale(${e})`}getTransitionCSS(){const t=this.config.timing.duration,e=this.config.easing;return this.requiresJSAnimation()?`opacity ${t}ms ease-out`:`opacity ${t}ms ease-out, transform ${t}ms ${e}`}requiresJSAnimation(){return Ut(this.pathConfig.type)}getPathConfig(){return this.pathConfig}getPathType(){return this.pathConfig.type}getTiming(){return{duration:this.config.timing.duration,stagger:this.config.timing.stagger}}getRotationConfig(){return this.rotationConfig}getRotationMode(){return this.rotationConfig.mode}calculateStartRotation(t){switch(this.rotationConfig.mode){case"none":return t;case"settle":{const i=this.rotationConfig.startRotation;if(i===void 0)return t+(Math.random()-.5)*60;if(typeof i=="number")return i;const n=i.max-i.min;return i.min+Math.random()*n}case"spin":{const i=this.rotationConfig.spinCount??1,n=this.resolveSpinDirection(t);return t+i*360*n}case"random":return t+(Math.random()-.5)*60;case"wobble":return t;default:return t}}resolveSpinDirection(t){switch(this.rotationConfig.direction??"auto"){case"clockwise":return-1;case"counterclockwise":return 1;case"random":return Math.random()<.5?1:-1;case"auto":default:return t>=0?1:-1}}requiresJSRotation(){return this.rotationConfig.mode==="wobble"}calculateWobbleRotation(t,e){if(this.rotationConfig.mode!=="wobble")return e;const i=this.rotationConfig.wobble||{amplitude:15,frequency:3,decay:!0},{amplitude:n,frequency:a,decay:r}=i,s=Math.sin(t*a*Math.PI*2),h=r?Math.pow(1-t,2):1,l=n*s*h;return e+l}getScaleConfig(){return this.scaleConfig}getScaleMode(){return this.scaleConfig.mode}calculateStartScale(t){switch(this.scaleConfig.mode){case"none":return t;case"grow":return(this.scaleConfig.startScale??.3)*t;case"shrink":return(this.scaleConfig.startScale??1.5)*t;case"pop":return t;case"random":{const i=this.scaleConfig.range??{min:.5,max:1};return(i.min+Math.random()*(i.max-i.min))*t}default:return t}}requiresJSScale(){return this.scaleConfig.mode==="pop"}calculatePopScale(t,e){if(this.scaleConfig.mode!=="pop")return e;const i=this.scaleConfig.pop||{overshoot:1.2,bounces:1},{overshoot:n,bounces:a}=i,r=this.generateScaleBounceKeyframes(a,n);let s=e;for(let h=0;h<r.length;h++)if(t<=r[h].time){const l=h===0?0:r[h-1].time,u=h===0?e:r[h-1].scale,c=(t-l)/(r[h].time-l),d=this.easeOutQuad(c);s=u+(r[h].scale-u)*d;break}return s*e}generateScaleBounceKeyframes(t,e){const i=[];i.push({time:.5,scale:e});let n=e;const a=.5,s=.5/(t*2);let h=.5;for(let l=0;l<t;l++){const u=1-(n-1)*a;h+=s,i.push({time:h,scale:u}),n=1+(n-1)*a*a,h+=s,l<t-1&&i.push({time:h,scale:n})}return i.push({time:1,scale:1}),i}easeOutQuad(t){return 1-(1-t)*(1-t)}}class Ht{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var S,O,j,_,P,U,G,F,E;const n=[],{width:a,height:r}=e,s=this.config.spacing.padding,h=i.fixedHeight??200,l=((S=this.imageConfig.rotation)==null?void 0:S.mode)??"none",u=((j=(O=this.imageConfig.rotation)==null?void 0:O.range)==null?void 0:j.min)??-15,c=((P=(_=this.imageConfig.rotation)==null?void 0:_.range)==null?void 0:P.max)??15,d=((G=(U=this.imageConfig.sizing)==null?void 0:U.variance)==null?void 0:G.min)??1,f=((E=(F=this.imageConfig.sizing)==null?void 0:F.variance)==null?void 0:E.max)??1,b=d!==1||f!==1,g=h*1.5/2,m=h/2,y=a-s-g,v=r-s-m,I=s+g,R=s+m;for(let C=0;C<t;C++){const $=this.random(I,y),L=this.random(R,v),T=l==="random"?this.random(u,c):0,M=b?this.random(d,f):1,N=h*M,K={id:C,x:$,y:L,rotation:T,scale:M,baseSize:N};n.push(K)}return n}random(t,e){return Math.random()*(e-t)+t}}class Nt{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var O,j,_,P,U,G,F,E,C;const n=[],{width:a,height:r}=e,{debugRadials:s}=this.config,h=i.fixedHeight??200,l=((O=this.imageConfig.rotation)==null?void 0:O.mode)??"none",u=((_=(j=this.imageConfig.rotation)==null?void 0:j.range)==null?void 0:_.min)??-15,c=((U=(P=this.imageConfig.rotation)==null?void 0:P.range)==null?void 0:U.max)??15,d=((F=(G=this.imageConfig.sizing)==null?void 0:G.variance)==null?void 0:F.min)??1,f=((C=(E=this.imageConfig.sizing)==null?void 0:E.variance)==null?void 0:C.max)??1,b=d!==1||f!==1,p=this.config.scaleDecay??0,g=["green","blue","red","yellow","orange","purple"],m=i.fixedHeight??h,y=a/2,v=r/2,I=Math.ceil(Math.sqrt(t));if(t>0){const $=b?this.random(d,f):1,L=m*$;n.push({id:0,x:y,y:v,rotation:l==="random"?this.random(u*.33,c*.33):0,scale:$,baseSize:L,zIndex:100,borderColor:s?"cyan":void 0})}let R=1,S=1;for(;R<t;){const $=S/I,L=p>0?1-$*p*.5:1,T=S*(m*.8),M=T*1.5,N=Math.PI*(3*(M+T)-Math.sqrt((3*M+T)*(M+3*T))),K=this.estimateWidth(m),B=Math.floor(N/(K*.7));if(B===0){S++;continue}const J=2*Math.PI/B,Q=S*(20*Math.PI/180);for(let q=0;q<B&&R<t;q++){const tt=q*J+Q,et=b?this.random(d,f):1,Y=L*et,it=m*Y;let X=y+Math.cos(tt)*M,z=v+Math.sin(tt)*T;const D=this.config.spacing.padding??50,W=it*1.5/2,H=it/2;X-W<D?X=D+W:X+W>a-D&&(X=a-D-W),z-H<D?z=D+H:z+H>r-D&&(z=r-D-H);const nt=l==="random"?this.random(u,c):0;n.push({id:R,x:X,y:z,rotation:nt,scale:Y,baseSize:it,zIndex:Math.max(1,100-S),borderColor:s?g[(S-1)%g.length]:void 0}),R++}S++}return n}estimateWidth(t){return t*1.4}random(t,e){return Math.random()*(e-t)+t}}const Ie={columns:"auto",rows:"auto",stagger:"none",jitter:0,overlap:0,fillDirection:"row",alignment:"center",gap:10,overflowOffset:.25},jt=[{x:1,y:1},{x:-1,y:-1},{x:1,y:-1},{x:-1,y:1},{x:-1,y:0},{x:1,y:0},{x:0,y:-1},{x:0,y:1}];class Gt{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var B,J,Q,q,tt,et,Y,it,X;const n=[],{width:a,height:r}=e,s={...Ie,...this.config.grid},h=this.config.spacing.padding,l=i.fixedHeight??200,u=((B=this.imageConfig.rotation)==null?void 0:B.mode)??"none",c=((Q=(J=this.imageConfig.sizing)==null?void 0:J.variance)==null?void 0:Q.min)??1,d=((tt=(q=this.imageConfig.sizing)==null?void 0:q.variance)==null?void 0:tt.max)??1,f=c!==1||d!==1,b=a-2*h,p=r-2*h,{columns:g,rows:m}=this.calculateGridDimensions(t,b,p,l,s),y=s.stagger==="row",v=s.stagger==="column",I=y?g+.5:g,R=v?m+.5:m,S=(b-s.gap*(g-1))/I,O=(p-s.gap*(m-1))/R,j=y?S/2:0,_=v?O/2:0,P=1+s.overlap,U=Math.min(S,O)*P,G=i.fixedHeight?Math.min(i.fixedHeight,U):U,F=g*S+(g-1)*s.gap+j,E=m*O+(m-1)*s.gap+_,C=h+(b-F)/2,$=h+(p-E)/2,L=g*m,T=s.columns!=="auto"&&s.rows!=="auto",M=T&&t>L;typeof window<"u"&&(window.__gridOverflowDebug={gridConfigColumns:s.columns,gridConfigRows:s.rows,columns:g,rows:m,cellCount:L,hasFixedGrid:T,imageCount:t,isOverflowMode:M});const N=M?new Array(L).fill(0):[],K=Math.min(S,O)*s.overflowOffset;for(let z=0;z<t;z++){let D,k,W=0;if(M&&z>=L){const Z=z-L,V=Z%L;W=Math.floor(Z/L)+1,N[V]++,s.fillDirection==="row"?(D=V%g,k=Math.floor(V/g)):(k=V%m,D=Math.floor(V/m))}else s.fillDirection==="row"?(D=z%g,k=Math.floor(z/g)):(k=z%m,D=Math.floor(z/m));let H=C+D*(S+s.gap)+S/2,nt=$+k*(O+s.gap)+O/2;if(s.stagger==="row"&&k%2===1?H+=S/2:s.stagger==="column"&&D%2===1&&(nt+=O/2),W>0){const Z=(W-1)%jt.length,V=jt[Z];H+=V.x*K,nt+=V.y*K}if(s.jitter>0){const Z=S/2*s.jitter,V=O/2*s.jitter;H+=this.random(-Z,Z),nt+=this.random(-V,V)}let ot=H,rt=nt;if(!M&&s.fillDirection==="row"){const Z=t%g||g;if(k===Math.floor((t-1)/g)&&Z<g){const ne=Z*S+(Z-1)*s.gap;let zt=0;s.alignment==="center"?zt=(F-ne)/2:s.alignment==="end"&&(zt=F-ne),ot+=zt}}const At=f?this.random(c,d):1,ct=G*At,pt=ct*1.5/2,bt=ct/2,Ct=h+pt,Mt=a-h-pt,_e=h+bt,He=r-h-bt;ot=Math.max(Ct,Math.min(ot,Mt)),rt=Math.max(_e,Math.min(rt,He));let Lt=0;if(u==="random"){const Z=((Y=(et=this.imageConfig.rotation)==null?void 0:et.range)==null?void 0:Y.min)??-15,V=((X=(it=this.imageConfig.rotation)==null?void 0:it.range)==null?void 0:X.max)??15;s.jitter>0?Lt=this.random(Z*s.jitter,V*s.jitter):Lt=this.random(Z,V)}let Ft;M&&W>0?Ft=50-W:Ft=M?100+z:z+1,n.push({id:z,x:ot,y:rt,rotation:Lt,scale:At,baseSize:ct,zIndex:Ft})}return n}calculateGridDimensions(t,e,i,n,a){let r,s;if(a.columns!=="auto"&&a.rows!=="auto")r=a.columns,s=a.rows;else if(a.columns!=="auto")r=a.columns,s=Math.ceil(t/r);else if(a.rows!=="auto")s=a.rows,r=Math.ceil(t/s);else{const h=e/i;for(r=Math.max(1,Math.round(Math.sqrt(t*h/1.4))),s=Math.ceil(t/r);r>1&&(r-1)*s>=t;)r--}return{columns:Math.max(1,r),rows:Math.max(1,s)}}random(t,e){return Math.random()*(e-t)+t}}const Te=Math.PI*(3-Math.sqrt(5)),Ae={spiralType:"golden",direction:"counterclockwise",tightness:1,scaleDecay:0,startAngle:0};class kt{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var R,S,O,j,_,P,U,G,F;const n=[],{width:a,height:r}=e,s={...Ae,...this.config.spiral},h=this.config.spacing.padding,l=i.fixedHeight??200,u=((R=this.imageConfig.rotation)==null?void 0:R.mode)??"none",c=((O=(S=this.imageConfig.rotation)==null?void 0:S.range)==null?void 0:O.min)??-15,d=((_=(j=this.imageConfig.rotation)==null?void 0:j.range)==null?void 0:_.max)??15,f=((U=(P=this.imageConfig.sizing)==null?void 0:P.variance)==null?void 0:U.min)??1,b=((F=(G=this.imageConfig.sizing)==null?void 0:G.variance)==null?void 0:F.max)??1,p=f!==1||b!==1,g=this.config.scaleDecay??s.scaleDecay,m=a/2,y=r/2,v=Math.min(m-h-l/2,y-h-l/2),I=s.direction==="clockwise"?-1:1;for(let E=0;E<t;E++){let C,$;if(s.spiralType==="golden")C=E*Te*I+s.startAngle,$=this.calculateGoldenRadius(E,t,v,s.tightness);else if(s.spiralType==="archimedean"){const H=E*.5*s.tightness;C=H*I+s.startAngle,$=this.calculateArchimedeanRadius(H,t,v,s.tightness)}else{const H=E*.3*s.tightness;C=H*I+s.startAngle,$=this.calculateLogarithmicRadius(H,t,v,s.tightness)}const L=m+Math.cos(C)*$,T=y+Math.sin(C)*$,M=$/v,N=g>0?1-M*g*.5:1,K=p?this.random(f,b):1,B=N*K,J=l*B,q=J*1.5/2,tt=J/2,et=h+q,Y=a-h-q,it=h+tt,X=r-h-tt,z=Math.max(et,Math.min(L,Y)),D=Math.max(it,Math.min(T,X));let k=0;if(u==="random"){const H=C*180/Math.PI%360,nt=this.random(c,d);k=s.spiralType==="golden"?nt:H*.1+nt*.9}else u==="tangent"&&(k=this.calculateSpiralTangent(C,$,s));const W=t-E;n.push({id:E,x:z,y:D,rotation:k,scale:B,baseSize:J,zIndex:W})}return n}calculateSpiralTangent(t,e,i){let n;if(i.spiralType==="golden")n=t+Math.PI/2;else if(i.spiralType==="archimedean"){const r=1/i.tightness,s=Math.atan(e/r);n=t+s}else{const r=.15/i.tightness,s=Math.atan(1/r);n=t+s}return n*180/Math.PI%360-90}calculateGoldenRadius(t,e,i,n){const r=i/Math.sqrt(e)*Math.sqrt(t)/n;return Math.min(r,i)}calculateArchimedeanRadius(t,e,i,n){const a=e*.5*n;return t/a*i}calculateLogarithmicRadius(t,e,i,n){const a=i*.05,r=.15/n,s=a*Math.exp(r*t),h=e*.3*n,l=a*Math.exp(r*h);return s/l*i}random(t,e){return Math.random()*(e-t)+t}}const Re={clusterCount:"auto",clusterSpread:150,clusterSpacing:200,density:"uniform",overlap:.3,distribution:"gaussian"};class Wt{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var I,R,S,O,j,_,P,U,G;const n=[],{width:a,height:r}=e,s={...Re,...this.config.cluster},h=this.config.spacing.padding,l=i.fixedHeight??200,u=((I=this.imageConfig.rotation)==null?void 0:I.mode)??"none",c=((S=(R=this.imageConfig.rotation)==null?void 0:R.range)==null?void 0:S.min)??-15,d=((j=(O=this.imageConfig.rotation)==null?void 0:O.range)==null?void 0:j.max)??15,f=((P=(_=this.imageConfig.sizing)==null?void 0:_.variance)==null?void 0:P.min)??1,b=((G=(U=this.imageConfig.sizing)==null?void 0:U.variance)==null?void 0:G.max)??1,p=f!==1||b!==1,g=this.calculateClusterCount(t,s.clusterCount,a,r,s.clusterSpacing),m=this.generateClusterCenters(g,a,r,h,s),y=new Array(g).fill(0);for(let F=0;F<t;F++)y[F%g]++;let v=0;for(let F=0;F<g;F++){const E=m[F],C=y[F];for(let $=0;$<C;$++){let L,T;if(s.distribution==="gaussian")L=this.gaussianRandom()*E.spread,T=this.gaussianRandom()*E.spread;else{const k=this.random(0,Math.PI*2),W=this.random(0,E.spread);L=Math.cos(k)*W,T=Math.sin(k)*W}const M=1+s.overlap*.5,N=1+s.overlap*.3;L/=M,T/=M;const K=p?this.random(f,b):1,B=N*K,J=l*B;let Q=E.x+L,q=E.y+T;const et=J*1.5/2,Y=J/2;Q=Math.max(h+et,Math.min(Q,a-h-et)),q=Math.max(h+Y,Math.min(q,r-h-Y));const it=u==="random"?this.random(c,d):0,z=Math.sqrt(L*L+T*T)/E.spread,D=Math.round((1-z)*50)+1;n.push({id:v,x:Q,y:q,rotation:it,scale:B,baseSize:J,zIndex:D}),v++}}return n}calculateClusterCount(t,e,i,n,a){if(e!=="auto")return Math.max(1,Math.min(e,t));const s=Math.max(1,Math.ceil(t/8)),h=Math.floor(i/a*(n/a)*.6);return Math.max(1,Math.min(s,h,10))}generateClusterCenters(t,e,i,n,a){const r=[],h=n+a.clusterSpread,l=e-n-a.clusterSpread,u=n+a.clusterSpread,c=i-n-a.clusterSpread;for(let d=0;d<t;d++){let f=null,b=-1;for(let p=0;p<100;p++){const g={x:this.random(h,l),y:this.random(u,c),spread:this.calculateClusterSpread(a)};let m=1/0;for(const y of r){const v=g.x-y.x,I=g.y-y.y,R=Math.sqrt(v*v+I*I);m=Math.min(m,R)}if((r.length===0||m>b)&&(f=g,b=m),m>=a.clusterSpacing)break}f&&r.push(f)}return r}calculateClusterSpread(t){return t.density==="uniform"?t.clusterSpread:t.clusterSpread*this.random(.5,1.5)}gaussianRandom(){let t=0,e=0;for(;t===0;)t=Math.random();for(;e===0;)e=Math.random();const i=Math.sqrt(-2*Math.log(t))*Math.cos(2*Math.PI*e);return Math.max(-3,Math.min(3,i))/3}random(t,e){return Math.random()*(e-t)+t}}class Ce{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var M,N,K,B,J,Q,q,tt,et;const n=[],{width:a,height:r}=e,s=i.fixedHeight??200,h=this.config.spacing.padding??50,l=((M=this.imageConfig.rotation)==null?void 0:M.mode)??"none",u=((K=(N=this.imageConfig.rotation)==null?void 0:N.range)==null?void 0:K.min)??-15,c=((J=(B=this.imageConfig.rotation)==null?void 0:B.range)==null?void 0:J.max)??15,d=((q=(Q=this.imageConfig.sizing)==null?void 0:Q.variance)==null?void 0:q.min)??1,f=((et=(tt=this.imageConfig.sizing)==null?void 0:tt.variance)==null?void 0:et.max)??1,b=d!==1||f!==1,p=i.fixedHeight??s,g={...oe,...this.config.wave},{rows:m,amplitude:y,frequency:v,phaseShift:I,synchronization:R}=g,S=Math.ceil(t/m),_=p*1.5/2,P=h+_,U=a-h-_,G=U-P,F=S>1?G/(S-1):0,E=h+y+p/2,C=r-h-y-p/2,$=C-E,L=m>1?$/(m-1):0;let T=0;for(let Y=0;Y<m&&T<t;Y++){const it=m===1?(E+C)/2:E+Y*L;let X=0;R==="offset"?X=Y*I:R==="alternating"&&(X=Y*Math.PI);for(let z=0;z<S&&T<t;z++){const D=S===1?(P+U)/2:P+z*F,k=this.calculateWaveY(D,a,y,v,X),W=D,H=it+k,nt=b?this.random(d,f):1,ot=p*nt;let rt=0;l==="tangent"?rt=this.calculateRotation(D,a,y,v,X):l==="random"&&(rt=this.random(u,c));const ct=ot*1.5/2,Rt=ot/2,pt=h+ct,bt=a-h-ct,Ct=h+Rt,Mt=r-h-Rt;n.push({id:T,x:Math.max(pt,Math.min(W,bt)),y:Math.max(Ct,Math.min(H,Mt)),rotation:rt,scale:nt,baseSize:ot,zIndex:T+1}),T++}}return n}calculateWaveY(t,e,i,n,a){const r=t/e;return i*Math.sin(n*r*2*Math.PI+a)}calculateRotation(t,e,i,n,a){const r=t/e,s=i*n*2*Math.PI*Math.cos(n*r*2*Math.PI+a)/e;return Math.atan(s)*(180/Math.PI)}random(t,e){return Math.random()*(e-t)+t}}class qt{constructor(t){this.config=t.layout,this.imageConfig=t.image,this.layouts=new Map,this.generator=this.initGenerator()}initGenerator(){switch(this.config.algorithm){case"radial":return new Nt(this.config,this.imageConfig);case"grid":return new Gt(this.config,this.imageConfig);case"spiral":return new kt(this.config,this.imageConfig);case"cluster":return new Wt(this.config,this.imageConfig);case"wave":return new Ce(this.config,this.imageConfig);case"random":default:return new Ht(this.config,this.imageConfig)}}generateLayout(t,e,i={}){const n=this.generator.generate(t,e,i);return n.forEach(a=>{this.layouts.set(a.id,a)}),n}getOriginalState(t){return this.layouts.get(Number(t))}reset(){this.layouts.clear()}updateConfig(t){t.layout&&(Object.assign(this.config,t.layout),t.layout.algorithm&&t.layout.algorithm!==this.config.algorithm&&(this.generator=this.initGenerator())),t.image&&Object.assign(this.imageConfig,t.image)}getBreakpoints(){return this.config.responsive??{mobile:{maxWidth:767},tablet:{maxWidth:1199}}}resolveBreakpoint(t){const e=this.getBreakpoints();return t<=e.mobile.maxWidth?"mobile":t<=e.tablet.maxWidth?"tablet":"screen"}resolveBaseHeight(t){const e=this.imageConfig.sizing;if(!e||e.mode==="adaptive")return;const i=e.height;if(i===void 0)return;if(typeof i=="number")return i;const n=i,a=this.resolveBreakpoint(t);return a==="mobile"?n.mobile??n.tablet??n.screen:a==="tablet"?n.tablet??n.screen??n.mobile:n.screen??n.tablet??n.mobile}calculateAdaptiveSize(t,e,i,n){const a=this.imageConfig.sizing,r=this.resolveBaseHeight(n);if(r!==void 0)return{height:r};const s=(a==null?void 0:a.minSize)??50,h=(a==null?void 0:a.maxSize)??400,l=this.config.targetCoverage??.6,u=this.config.densityFactor??1,{width:c,height:d}=t,p=c*d*l/e;let m=Math.sqrt(p/1.4);m*=u,m=Math.min(m,i);let y=this.clamp(m,s,h);if(y===s&&m<s){const v=Math.max(s*.05,20);y=Math.max(v,m)}return{height:y}}clamp(t,e,i){return Math.max(e,Math.min(i,t))}}var x=(o=>(o.IDLE="idle",o.FOCUSING="focusing",o.FOCUSED="focused",o.UNFOCUSING="unfocusing",o.CROSS_ANIMATING="cross_animating",o))(x||{});function Me(o){return o in st}function Le(o){return o?Me(o)?st[o]:o:st.md}function Fe(o){if(!o)return"";const t=[];if(o.grayscale!==void 0&&t.push(`grayscale(${o.grayscale})`),o.blur!==void 0&&t.push(`blur(${o.blur}px)`),o.brightness!==void 0&&t.push(`brightness(${o.brightness})`),o.contrast!==void 0&&t.push(`contrast(${o.contrast})`),o.saturate!==void 0&&t.push(`saturate(${o.saturate})`),o.opacity!==void 0&&t.push(`opacity(${o.opacity})`),o.sepia!==void 0&&t.push(`sepia(${o.sepia})`),o.hueRotate!==void 0&&t.push(`hue-rotate(${o.hueRotate}deg)`),o.invert!==void 0&&t.push(`invert(${o.invert})`),o.dropShadow!==void 0)if(typeof o.dropShadow=="string")t.push(`drop-shadow(${o.dropShadow})`);else{const e=o.dropShadow;t.push(`drop-shadow(${e.x}px ${e.y}px ${e.blur}px ${e.color})`)}return t.join(" ")}function ht(o){if(!o||o.style==="none"||o.width===0)return"none";const t=o.width??0,e=o.style??"solid",i=o.color??"#000000";return`${t}px ${e} ${i}`}function mt(o){var a,r;if(!o)return{};const t={};if(o.borderRadiusTopLeft!==void 0||o.borderRadiusTopRight!==void 0||o.borderRadiusBottomRight!==void 0||o.borderRadiusBottomLeft!==void 0){const s=((a=o.border)==null?void 0:a.radius)??0;o.borderRadiusTopLeft!==void 0?t.borderTopLeftRadius=`${o.borderRadiusTopLeft}px`:s&&(t.borderTopLeftRadius=`${s}px`),o.borderRadiusTopRight!==void 0?t.borderTopRightRadius=`${o.borderRadiusTopRight}px`:s&&(t.borderTopRightRadius=`${s}px`),o.borderRadiusBottomRight!==void 0?t.borderBottomRightRadius=`${o.borderRadiusBottomRight}px`:s&&(t.borderBottomRightRadius=`${s}px`),o.borderRadiusBottomLeft!==void 0?t.borderBottomLeftRadius=`${o.borderRadiusBottomLeft}px`:s&&(t.borderBottomLeftRadius=`${s}px`)}else((r=o.border)==null?void 0:r.radius)!==void 0&&(t.borderRadius=`${o.border.radius}px`);if(o.borderTop||o.borderRight||o.borderBottom||o.borderLeft){const s=o.border||{},h={...s,...o.borderTop},l={...s,...o.borderRight},u={...s,...o.borderBottom},c={...s,...o.borderLeft};t.borderTop=ht(h),t.borderRight=ht(l),t.borderBottom=ht(u),t.borderLeft=ht(c)}else o.border&&(t.border=ht(o.border));o.shadow!==void 0&&(t.boxShadow=Le(o.shadow));const n=Fe(o.filter);if(t.filter=n||"none",o.opacity!==void 0&&(t.opacity=String(o.opacity)),o.cursor!==void 0&&(t.cursor=o.cursor),o.outline&&o.outline.style!=="none"&&(o.outline.width??0)>0){const s=o.outline.width??0,h=o.outline.style??"solid",l=o.outline.color??"#000000";t.outline=`${s}px ${h} ${l}`,o.outline.offset!==void 0&&(t.outlineOffset=`${o.outline.offset}px`)}return o.objectFit!==void 0&&(t.objectFit=o.objectFit),o.aspectRatio!==void 0&&(t.aspectRatio=o.aspectRatio),t}function dt(o,t){t.borderRadius!==void 0&&(o.style.borderRadius=t.borderRadius),t.borderTopLeftRadius!==void 0&&(o.style.borderTopLeftRadius=t.borderTopLeftRadius),t.borderTopRightRadius!==void 0&&(o.style.borderTopRightRadius=t.borderTopRightRadius),t.borderBottomRightRadius!==void 0&&(o.style.borderBottomRightRadius=t.borderBottomRightRadius),t.borderBottomLeftRadius!==void 0&&(o.style.borderBottomLeftRadius=t.borderBottomLeftRadius),t.border!==void 0&&(o.style.border=t.border),t.borderTop!==void 0&&(o.style.borderTop=t.borderTop),t.borderRight!==void 0&&(o.style.borderRight=t.borderRight),t.borderBottom!==void 0&&(o.style.borderBottom=t.borderBottom),t.borderLeft!==void 0&&(o.style.borderLeft=t.borderLeft),t.boxShadow!==void 0&&(o.style.boxShadow=t.boxShadow),t.filter!==void 0&&(o.style.filter=t.filter),t.opacity!==void 0&&(o.style.opacity=t.opacity),t.cursor!==void 0&&(o.style.cursor=t.cursor),t.outline!==void 0&&(o.style.outline=t.outline),t.outlineOffset!==void 0&&(o.style.outlineOffset=t.outlineOffset),t.objectFit!==void 0&&(o.style.objectFit=t.objectFit),t.aspectRatio!==void 0&&(o.style.aspectRatio=t.aspectRatio)}function Yt(o){return o?Array.isArray(o)?o.join(" "):o:""}function ut(o,t){const e=Yt(t);e&&e.split(" ").forEach(i=>{i.trim()&&o.classList.add(i.trim())})}function Xt(o,t){const e=Yt(t);e&&e.split(" ").forEach(i=>{i.trim()&&o.classList.remove(i.trim())})}const Bt={UNFOCUSING:999,FOCUSING:1e3};class Jt{constructor(t,e,i){var n,a;this.state=x.IDLE,this.currentFocus=null,this.focusData=null,this.outgoing=null,this.incoming=null,this.focusGeneration=0,this.config=t,this.animationEngine=e,this.defaultStyles=mt(i==null?void 0:i.default),this.focusedStyles=mt(i==null?void 0:i.focused),this.defaultClassName=(n=i==null?void 0:i.default)==null?void 0:n.className,this.focusedClassName=(a=i==null?void 0:i.focused)==null?void 0:a.className}getState(){return this.state}isAnimating(){return this.state!==x.IDLE&&this.state!==x.FOCUSED}normalizeScalePercent(t){return t>1?t/100:t}calculateFocusDimensions(t,e,i){const n=this.normalizeScalePercent(this.config.scalePercent),a=i.height*n,r=t/e;let s=a,h=s*r;const l=i.width*n;return h>l&&(h=l,s=h/r),{width:h,height:s}}calculateFocusTransform(t,e){const i=t.width/2,n=t.height/2,a=i-e.x,r=n-e.y;return{x:a,y:r,rotation:0,scale:1}}buildDimensionZoomTransform(t){const e=["translate(-50%, -50%)"];if(t.x!==void 0||t.y!==void 0){const i=t.x??0,n=t.y??0;e.push(`translate(${i}px, ${n}px)`)}return t.rotation!==void 0&&e.push(`rotate(${t.rotation}deg)`),e.join(" ")}animateWithDimensions(t,e,i,n,a,r,s,h){const l=this.buildDimensionZoomTransform(e),u=this.buildDimensionZoomTransform(i);return t.style.transition="none",t.animate([{transform:l,width:`${n}px`,height:`${a}px`},{transform:u,width:`${r}px`,height:`${s}px`}],{duration:h,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}applyFocusedStyling(t,e){t.style.zIndex=String(e),t.classList.add("fbn-ic-focused"),dt(t,this.focusedStyles),ut(t,this.focusedClassName)}removeFocusedStyling(t,e){t.style.zIndex=e,t.classList.remove("fbn-ic-focused"),Xt(t,this.focusedClassName),dt(t,this.defaultStyles),ut(t,this.defaultClassName)}startFocusAnimation(t,e,i,n,a){const r=t.style.zIndex||"",s=t.offsetWidth,h=t.offsetHeight,l=this.calculateFocusDimensions(s,h,e),u=this.calculateFocusTransform(e,i);this.applyFocusedStyling(t,Bt.FOCUSING),this.animationEngine.cancelAllAnimations(t);const c=n??{x:0,y:0,rotation:i.rotation,scale:1},d=(a==null?void 0:a.width)??s,f=(a==null?void 0:a.height)??h,b=this.config.animationDuration??600,p=this.animateWithDimensions(t,c,u,d,f,l.width,l.height,b),g={id:`focus-${Date.now()}`,element:t,animation:p,fromState:c,toState:u,startTime:performance.now(),duration:b};return this.focusData={element:t,originalState:i,focusTransform:u,originalZIndex:r,originalWidth:s,originalHeight:h,focusWidth:l.width,focusHeight:l.height},{element:t,originalState:i,animationHandle:g,direction:"in",originalWidth:s,originalHeight:h}}startUnfocusAnimation(t,e,i,n){var b,p,g,m,y;t.style.zIndex=String(Bt.UNFOCUSING),this.animationEngine.cancelAllAnimations(t);const a=i??((b=this.focusData)==null?void 0:b.focusTransform)??{x:0,y:0,rotation:0,scale:1},r=(n==null?void 0:n.width)??((p=this.focusData)==null?void 0:p.focusWidth)??t.offsetWidth,s=(n==null?void 0:n.height)??((g=this.focusData)==null?void 0:g.focusHeight)??t.offsetHeight,h={x:0,y:0,rotation:e.rotation,scale:1},l=((m=this.focusData)==null?void 0:m.originalWidth)??t.offsetWidth,u=((y=this.focusData)==null?void 0:y.originalHeight)??t.offsetHeight,c=this.config.animationDuration??600,d=this.animateWithDimensions(t,a,h,r,s,l,u,c),f={id:`unfocus-${Date.now()}`,element:t,animation:d,fromState:a,toState:h,startTime:performance.now(),duration:c};return{element:t,originalState:e,animationHandle:f,direction:"out",originalWidth:l,originalHeight:u}}async waitForAnimation(t){try{await t.animation.finished}catch{}}resetElementInstantly(t,e,i,n,a){this.animationEngine.cancelAllAnimations(t);const r=["translate(-50%, -50%)"];r.push("translate(0px, 0px)"),r.push(`rotate(${e.rotation}deg)`),t.style.transition="none",t.style.transform=r.join(" "),n!==void 0&&a!==void 0&&(t.style.width=`${n}px`,t.style.height=`${a}px`),this.removeFocusedStyling(t,i)}async focusImage(t,e,i){var a,r,s,h,l,u,c,d,f,b,p,g;if(this.currentFocus===t&&this.state===x.FOCUSED)return this.unfocusImage();if(((a=this.incoming)==null?void 0:a.element)===t&&this.state===x.FOCUSING){const m=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),y={x:m.x,y:m.y,rotation:m.rotation,scale:1},v={width:t.offsetWidth,height:t.offsetHeight};this.outgoing=this.startUnfocusAnimation(t,this.incoming.originalState,y,v),this.incoming=null,this.state=x.UNFOCUSING,await this.waitForAnimation(this.outgoing.animationHandle),this.removeFocusedStyling(this.outgoing.element,((r=this.focusData)==null?void 0:r.originalZIndex)||""),this.outgoing=null,this.currentFocus=null,this.focusData=null,this.state=x.IDLE;return}const n=++this.focusGeneration;switch(this.state){case x.IDLE:if(this.state=x.FOCUSING,this.incoming=this.startFocusAnimation(t,e,i),await this.waitForAnimation(this.incoming.animationHandle),this.focusGeneration!==n)return;this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break;case x.FOCUSED:if(this.state=x.CROSS_ANIMATING,this.currentFocus&&this.focusData&&(this.outgoing=this.startUnfocusAnimation(this.currentFocus,this.focusData.originalState)),this.incoming=this.startFocusAnimation(t,e,i),await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(this.incoming.animationHandle)]),this.focusGeneration!==n)return;this.outgoing&&(this.removeFocusedStyling(this.outgoing.element,((s=this.outgoing.originalState.zIndex)==null?void 0:s.toString())||""),this.outgoing=null),this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break;case x.FOCUSING:if(this.incoming&&(this.animationEngine.cancelAnimation(this.incoming.animationHandle,!1),this.resetElementInstantly(this.incoming.element,this.incoming.originalState,((h=this.focusData)==null?void 0:h.originalZIndex)||"",(l=this.focusData)==null?void 0:l.originalWidth,(u=this.focusData)==null?void 0:u.originalHeight),this.incoming=null),this.incoming=this.startFocusAnimation(t,e,i),await this.waitForAnimation(this.incoming.animationHandle),this.focusGeneration!==n)return;this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break;case x.UNFOCUSING:if(this.state=x.CROSS_ANIMATING,this.incoming=this.startFocusAnimation(t,e,i),await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(this.incoming.animationHandle)]),this.focusGeneration!==n)return;this.outgoing&&(this.removeFocusedStyling(this.outgoing.element,((c=this.outgoing.originalState.zIndex)==null?void 0:c.toString())||""),this.outgoing=null),this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break;case x.CROSS_ANIMATING:if(((d=this.incoming)==null?void 0:d.element)===t)return;if(((f=this.outgoing)==null?void 0:f.element)===t){const m=this.animationEngine.cancelAnimation(this.outgoing.animationHandle,!0),y={x:m.x,y:m.y,rotation:m.rotation,scale:1},v={width:t.offsetWidth,height:t.offsetHeight};if(this.incoming){const I=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),R={x:I.x,y:I.y,rotation:I.rotation,scale:1},S={width:this.incoming.element.offsetWidth,height:this.incoming.element.offsetHeight};this.outgoing=this.startUnfocusAnimation(this.incoming.element,this.incoming.originalState,R,S)}else this.outgoing=null;if(this.incoming=this.startFocusAnimation(t,e,i,y,v),await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(this.incoming.animationHandle)]),this.focusGeneration!==n)return;this.outgoing&&(this.removeFocusedStyling(this.outgoing.element,((b=this.outgoing.originalState.zIndex)==null?void 0:b.toString())||""),this.outgoing=null),this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;return}if(this.outgoing&&(this.animationEngine.cancelAnimation(this.outgoing.animationHandle,!1),this.resetElementInstantly(this.outgoing.element,this.outgoing.originalState,((p=this.outgoing.originalState.zIndex)==null?void 0:p.toString())||"",this.outgoing.originalWidth,this.outgoing.originalHeight),this.outgoing=null),this.incoming){const m=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),y={x:m.x,y:m.y,rotation:m.rotation,scale:1},v={width:this.incoming.element.offsetWidth,height:this.incoming.element.offsetHeight};this.outgoing=this.startUnfocusAnimation(this.incoming.element,this.incoming.originalState,y,v)}if(this.incoming=this.startFocusAnimation(t,e,i),await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(this.incoming.animationHandle)]),this.focusGeneration!==n)return;this.outgoing&&(this.removeFocusedStyling(this.outgoing.element,((g=this.outgoing.originalState.zIndex)==null?void 0:g.toString())||""),this.outgoing=null),this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break}}async unfocusImage(){var a,r,s;const t=++this.focusGeneration;if(!this.currentFocus||!this.focusData){if(this.incoming&&this.state===x.FOCUSING){const h=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),l={x:h.x,y:h.y,rotation:h.rotation,scale:1},u={width:this.incoming.element.offsetWidth,height:this.incoming.element.offsetHeight};if(this.outgoing=this.startUnfocusAnimation(this.incoming.element,this.incoming.originalState,l,u),this.incoming=null,this.state=x.UNFOCUSING,await this.waitForAnimation(this.outgoing.animationHandle),this.focusGeneration!==t)return;this.removeFocusedStyling(this.outgoing.element,((a=this.focusData)==null?void 0:a.originalZIndex)||""),this.outgoing=null,this.focusData=null,this.state=x.IDLE}return}if(this.state===x.CROSS_ANIMATING&&this.incoming){const h=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),l={x:h.x,y:h.y,rotation:h.rotation,scale:1},u={width:this.incoming.element.offsetWidth,height:this.incoming.element.offsetHeight},c=this.startUnfocusAnimation(this.incoming.element,this.incoming.originalState,l,u);if(await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(c.animationHandle)]),this.focusGeneration!==t)return;this.outgoing&&this.removeFocusedStyling(this.outgoing.element,((r=this.outgoing.originalState.zIndex)==null?void 0:r.toString())||""),this.removeFocusedStyling(c.element,((s=this.incoming.originalState.zIndex)==null?void 0:s.toString())||""),this.outgoing=null,this.incoming=null,this.currentFocus=null,this.focusData=null,this.state=x.IDLE;return}this.state=x.UNFOCUSING;const e=this.currentFocus,i=this.focusData.originalState,n=this.focusData.originalZIndex;this.outgoing=this.startUnfocusAnimation(e,i),await this.waitForAnimation(this.outgoing.animationHandle),this.focusGeneration===t&&(this.removeFocusedStyling(e,n),this.outgoing=null,this.currentFocus=null,this.focusData=null,this.state=x.IDLE)}async swapFocus(t,e,i){return this.focusImage(t,e,i)}getCurrentFocus(){return this.currentFocus}isFocused(t){return this.currentFocus===t&&this.state===x.FOCUSED}isTargetingFocus(t){var e;return((e=this.incoming)==null?void 0:e.element)===t}isInvolved(t){var e,i;return this.currentFocus===t||((e=this.incoming)==null?void 0:e.element)===t||((i=this.outgoing)==null?void 0:i.element)===t}setDragOffset(t){if(!this.currentFocus||!this.focusData||this.state!==x.FOCUSED)return;const e=this.currentFocus,i=this.focusData.focusTransform,n=["translate(-50%, -50%)"],a=(i.x??0)+t,r=i.y??0;n.push(`translate(${a}px, ${r}px)`),i.rotation!==void 0&&n.push(`rotate(${i.rotation}deg)`),e.style.transition="none",e.style.transform=n.join(" ")}clearDragOffset(t,e=150){if(!this.currentFocus||!this.focusData||this.state!==x.FOCUSED)return;const i=this.currentFocus,n=this.focusData.focusTransform,a=["translate(-50%, -50%)"],r=n.x??0,s=n.y??0;a.push(`translate(${r}px, ${s}px)`),n.rotation!==void 0&&a.push(`rotate(${n.rotation}deg)`);const h=a.join(" ");t?(i.style.transition=`transform ${e}ms ease-out`,i.style.transform=h,setTimeout(()=>{this.currentFocus===i&&(i.style.transition="none")},e)):(i.style.transition="none",i.style.transform=h)}reset(){var t,e,i,n;this.outgoing&&(this.animationEngine.cancelAnimation(this.outgoing.animationHandle,!1),this.resetElementInstantly(this.outgoing.element,this.outgoing.originalState,((t=this.outgoing.originalState.zIndex)==null?void 0:t.toString())||"",this.outgoing.originalWidth,this.outgoing.originalHeight)),this.incoming&&(this.animationEngine.cancelAnimation(this.incoming.animationHandle,!1),this.resetElementInstantly(this.incoming.element,this.incoming.originalState,((e=this.focusData)==null?void 0:e.originalZIndex)||"",(i=this.focusData)==null?void 0:i.originalWidth,(n=this.focusData)==null?void 0:n.originalHeight)),this.currentFocus&&this.focusData&&this.resetElementInstantly(this.currentFocus,this.focusData.originalState,this.focusData.originalZIndex,this.focusData.originalWidth,this.focusData.originalHeight),this.state=x.IDLE,this.currentFocus=null,this.focusData=null,this.outgoing=null,this.incoming=null}}const ze=50,Oe=.5,$e=20,De=.3,Pe=150,Ue=30,ft=class ft{constructor(t,e){this.enabled=!1,this.touchState=null,this.recentTouchTimestamp=0,this.container=t,this.callbacks=e,this.boundTouchStart=this.handleTouchStart.bind(this),this.boundTouchMove=this.handleTouchMove.bind(this),this.boundTouchEnd=this.handleTouchEnd.bind(this),this.boundTouchCancel=this.handleTouchCancel.bind(this)}enable(){this.enabled||(this.enabled=!0,this.container.style.touchAction="pan-y",this.container.addEventListener("touchstart",this.boundTouchStart,{passive:!1}),this.container.addEventListener("touchmove",this.boundTouchMove,{passive:!1}),this.container.addEventListener("touchend",this.boundTouchEnd,{passive:!0}),this.container.addEventListener("touchcancel",this.boundTouchCancel,{passive:!0}))}disable(){var t;this.enabled&&(this.enabled=!1,this.container.style.touchAction="",this.container.removeEventListener("touchstart",this.boundTouchStart),this.container.removeEventListener("touchmove",this.boundTouchMove),this.container.removeEventListener("touchend",this.boundTouchEnd),this.container.removeEventListener("touchcancel",this.boundTouchCancel),(t=this.touchState)!=null&&t.isDragging&&this.callbacks.onDragEnd(!1),this.touchState=null)}destroy(){this.disable()}hadRecentTouch(){return Date.now()-this.recentTouchTimestamp<ft.TOUCH_CLICK_DELAY}handleTouchStart(t){if(t.touches.length!==1)return;this.recentTouchTimestamp=Date.now();const e=t.touches[0];this.touchState={startX:e.clientX,startY:e.clientY,startTime:performance.now(),currentX:e.clientX,isDragging:!1,isHorizontalSwipe:null}}handleTouchMove(t){if(!this.touchState||t.touches.length!==1)return;const e=t.touches[0],i=e.clientX-this.touchState.startX,n=e.clientY-this.touchState.startY;if(this.touchState.isHorizontalSwipe===null&&Math.sqrt(i*i+n*n)>10){const s=Math.atan2(Math.abs(n),Math.abs(i))*(180/Math.PI);this.touchState.isHorizontalSwipe=s<=Ue}if(this.touchState.isHorizontalSwipe!==!1&&this.touchState.isHorizontalSwipe===!0){t.preventDefault(),this.touchState.isDragging=!0,this.touchState.currentX=e.clientX;const a=i*De;this.callbacks.onDragOffset(a)}}handleTouchEnd(t){if(!this.touchState)return;this.recentTouchTimestamp=Date.now();const e=this.touchState.currentX-this.touchState.startX,i=performance.now()-this.touchState.startTime,n=Math.abs(e)/i,a=Math.abs(e);let r=!1;this.touchState.isHorizontalSwipe===!0&&this.touchState.isDragging&&(a>=ze||n>=Oe&&a>=$e)&&(r=!0,e<0?this.callbacks.onNext():this.callbacks.onPrev()),this.touchState.isDragging&&this.callbacks.onDragEnd(r),this.touchState=null}handleTouchCancel(t){var e;(e=this.touchState)!=null&&e.isDragging&&this.callbacks.onDragEnd(!1),this.touchState=null}};ft.TOUCH_CLICK_DELAY=300;let Tt=ft;class Vt{constructor(t){if(this._prepared=!1,this._discoveredUrls=[],this.apiKey=t.apiKey??"",this.apiEndpoint=t.apiEndpoint??"https://www.googleapis.com/drive/v3/files",this.debugLogging=t.debugLogging??!1,this.sources=t.sources??[],!this.sources||this.sources.length===0)throw new Error("GoogleDriveLoader requires at least one source to be configured")}async prepare(t){this._discoveredUrls=[];for(const e of this.sources)if("folders"in e)for(const i of e.folders){const n=e.recursive!==void 0?e.recursive:!0,a=await this.loadFromFolder(i,t,n);this._discoveredUrls.push(...a)}else if("files"in e){const i=await this.loadFiles(e.files,t);this._discoveredUrls.push(...i)}this._prepared=!0}imagesLength(){if(!this._prepared)throw new Error("GoogleDriveLoader.imagesLength() called before prepare()");return this._discoveredUrls.length}imageURLs(){if(!this._prepared)throw new Error("GoogleDriveLoader.imageURLs() called before prepare()");return[...this._discoveredUrls]}isPrepared(){return this._prepared}extractFolderId(t){const e=[/\/folders\/([a-zA-Z0-9_-]+)/,/id=([a-zA-Z0-9_-]+)/];for(const i of e){const n=t.match(i);if(n&&n[1])return n[1]}return null}async loadFromFolder(t,e,i=!0){const n=this.extractFolderId(t);if(!n)throw new Error("Invalid Google Drive folder URL. Please check the URL format.");if(!this.apiKey||this.apiKey==="YOUR_API_KEY_HERE")return this.loadImagesDirectly(n,e);try{return i?await this.loadImagesRecursively(n,e):await this.loadImagesFromSingleFolder(n,e)}catch(a){return console.error("Error loading from Google Drive API:",a),this.loadImagesDirectly(n,e)}}async loadImagesFromSingleFolder(t,e){const i=[],n=`'${t}' in parents and trashed=false`,r=`${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`,s=await fetch(r);if(!s.ok)throw new Error(`API request failed: ${s.status} ${s.statusText}`);const l=(await s.json()).files.filter(u=>u.mimeType.startsWith("image/")&&e.isAllowed(u.name));return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`),l.forEach(u=>{i.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`),this.log(`Added file: ${u.name}`)}),i}async loadFiles(t,e){const i=[];for(const n of t){const a=this.extractFileId(n);if(!a){this.log(`Skipping invalid file URL: ${n}`);continue}if(this.apiKey&&this.apiKey!=="YOUR_API_KEY_HERE")try{const r=`${this.apiEndpoint}/${a}?fields=name,mimeType&key=${this.apiKey}`,s=await fetch(r);if(s.ok){const h=await s.json();h.mimeType.startsWith("image/")&&e.isAllowed(h.name)?(i.push(`https://lh3.googleusercontent.com/d/${a}=s1600`),this.log(`Added file: ${h.name}`)):this.log(`Skipping non-image file: ${h.name} (${h.mimeType})`)}else this.log(`Failed to fetch metadata for file ${a}: ${s.status}`)}catch(r){this.log(`Error fetching metadata for file ${a}:`,r)}else i.push(`https://lh3.googleusercontent.com/d/${a}=s1600`)}return i}extractFileId(t){if(!/[/:.]/.test(t))return t;const e=[/\/file\/d\/([a-zA-Z0-9_-]+)/,/\/open\?id=([a-zA-Z0-9_-]+)/,/id=([a-zA-Z0-9_-]+)/];for(const i of e){const n=t.match(i);if(n&&n[1])return n[1]}return null}async loadImagesRecursively(t,e){const i=[],n=`'${t}' in parents and trashed=false`,r=`${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`,s=await fetch(r);if(!s.ok)throw new Error(`API request failed: ${s.status} ${s.statusText}`);const h=await s.json(),l=h.files.filter(c=>c.mimeType.startsWith("image/")&&e.isAllowed(c.name)),u=h.files.filter(c=>c.mimeType==="application/vnd.google-apps.folder");this.log(`Found ${h.files.length} total items in folder ${t}`),h.files.forEach(c=>this.log(` - File: ${c.name} (${c.mimeType})`)),this.log(`- ${l.length} valid files (images only)`),this.log(`- ${u.length} subfolders`),l.forEach(c=>{i.push(`https://lh3.googleusercontent.com/d/${c.id}=s1600`),this.log(`Added file: ${c.name}`)});for(const c of u){this.log(`Loading images from subfolder: ${c.name}`);const d=await this.loadImagesRecursively(c.id,e);i.push(...d)}return i}async loadImagesDirectly(t,e){try{const i=`https://drive.google.com/embeddedfolderview?id=${t}`,n=await fetch(i,{mode:"cors"});if(!n.ok)throw new Error("Cannot access folder directly (CORS or permissions issue)");const a=await n.text(),r=/\/file\/d\/([a-zA-Z0-9_-]+)/g,s=[...a.matchAll(r)];return[...new Set(s.map(u=>u[1]))].map(u=>`https://drive.google.com/uc?export=view&id=${u}`)}catch(i){throw console.error("Direct loading failed:",i),new Error(`Unable to load images. Please ensure:
|
|
1
|
+
(function(A,st){typeof exports=="object"&&typeof module<"u"?st(exports):typeof define=="function"&&define.amd?define(["exports"],st):(A=typeof globalThis<"u"?globalThis:A||self,st(A.ImageCloud={}))})(this,function(A){"use strict";const st=Object.freeze({none:"none",sm:"0 2px 4px rgba(0,0,0,0.1)",md:"0 4px 16px rgba(0,0,0,0.4)",lg:"0 8px 32px rgba(0,0,0,0.5)",glow:"0 0 30px rgba(255,255,255,0.6)"}),yt=Object.freeze({energetic:Object.freeze({overshoot:.25,bounces:2,decayRatio:.5}),playful:Object.freeze({overshoot:.15,bounces:1,decayRatio:.5}),subtle:Object.freeze({overshoot:.08,bounces:1,decayRatio:.5})}),vt=Object.freeze({gentle:Object.freeze({stiffness:150,damping:30,mass:1,oscillations:2}),bouncy:Object.freeze({stiffness:300,damping:15,mass:1,oscillations:4}),wobbly:Object.freeze({stiffness:180,damping:12,mass:1.5,oscillations:5}),snappy:Object.freeze({stiffness:400,damping:25,mass:.8,oscillations:2})}),wt=Object.freeze({gentle:Object.freeze({amplitude:30,frequency:1.5,decay:!0,decayRate:.9,phase:0}),playful:Object.freeze({amplitude:50,frequency:2.5,decay:!0,decayRate:.7,phase:0}),serpentine:Object.freeze({amplitude:60,frequency:3,decay:!1,decayRate:1,phase:0}),flutter:Object.freeze({amplitude:20,frequency:4,decay:!0,decayRate:.5,phase:0})}),Et=Object.freeze({type:"linear"}),St=Object.freeze({mode:"none"}),xt=Object.freeze({mode:"none"}),Ot=Object.freeze({default:Object.freeze({border:Object.freeze({width:0,color:"#000000",radius:0,style:"solid"}),shadow:"none",filter:Object.freeze({}),opacity:1,cursor:"pointer",outline:Object.freeze({width:0,color:"#000000",style:"solid",offset:0})}),hover:Object.freeze({shadow:"none"}),focused:Object.freeze({shadow:"none"})}),oe=Object.freeze({rows:1,amplitude:100,frequency:2,phaseShift:0,synchronization:"offset"}),se=Object.freeze({mobile:Object.freeze({maxWidth:767}),tablet:Object.freeze({maxWidth:1199})}),ae=Object.freeze({mode:"adaptive",minSize:50,maxSize:400,variance:Object.freeze({min:1,max:1})}),re=Object.freeze({mode:"none",range:Object.freeze({min:-15,max:15})}),$t=Object.freeze({sizing:ae,rotation:re}),It=Object.freeze({validateUrls:!0,validationTimeout:5e3,validationMethod:"head",failOnAllMissing:!0,allowedExtensions:["jpg","jpeg","png","gif","webp","bmp"],debugLogging:!1}),w=Object.freeze({loaders:[],config:Object.freeze({loaders:It}),image:$t,layout:Object.freeze({algorithm:"radial",scaleDecay:0,responsive:se,targetCoverage:.6,densityFactor:1,spacing:Object.freeze({padding:50,minGap:20}),debugRadials:!1,debugCenters:!1}),animation:Object.freeze({duration:600,easing:Object.freeze({default:"cubic-bezier(0.4, 0.0, 0.2, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)",focus:"cubic-bezier(0.4, 0.0, 0.2, 1)"}),queue:Object.freeze({enabled:!0,interval:150,maxConcurrent:void 0}),performance:Object.freeze({useGPU:void 0,reduceMotion:void 0}),entry:Object.freeze({start:Object.freeze({position:"nearest-edge",offset:100,circular:Object.freeze({radius:"120%",distribution:"even"})}),timing:Object.freeze({duration:600,stagger:150}),easing:"cubic-bezier(0.25, 1, 0.5, 1)",path:Et,rotation:St,scale:xt})}),interaction:Object.freeze({focus:Object.freeze({scalePercent:.8,zIndex:1e3,animationDuration:void 0}),navigation:Object.freeze({keyboard:void 0,swipe:void 0,mouseWheel:void 0}),gestures:Object.freeze({pinchToZoom:void 0,doubleTapToFocus:void 0})}),rendering:Object.freeze({responsive:Object.freeze({breakpoints:Object.freeze({mobile:768,tablet:void 0,desktop:void 0}),mobileDetection:()=>typeof window>"u"?!1:window.innerWidth<=768}),ui:Object.freeze({showLoadingSpinner:!1,showImageCounter:!1,showThumbnails:void 0,theme:void 0}),performance:Object.freeze({lazyLoad:void 0,preloadCount:void 0,imageQuality:void 0})}),styling:Ot,debug:!1});function lt(o,t){if(!o)return t||{};if(!t)return{...o};const e={...o};return t.border!==void 0&&(e.border={...o.border,...t.border}),t.borderTop!==void 0&&(e.borderTop={...o.borderTop,...t.borderTop}),t.borderRight!==void 0&&(e.borderRight={...o.borderRight,...t.borderRight}),t.borderBottom!==void 0&&(e.borderBottom={...o.borderBottom,...t.borderBottom}),t.borderLeft!==void 0&&(e.borderLeft={...o.borderLeft,...t.borderLeft}),t.filter!==void 0&&(e.filter={...o.filter,...t.filter}),t.outline!==void 0&&(e.outline={...o.outline,...t.outline}),t.shadow!==void 0&&(e.shadow=t.shadow),t.opacity!==void 0&&(e.opacity=t.opacity),t.cursor!==void 0&&(e.cursor=t.cursor),t.className!==void 0&&(e.className=t.className),t.objectFit!==void 0&&(e.objectFit=t.objectFit),t.aspectRatio!==void 0&&(e.aspectRatio=t.aspectRatio),t.borderRadiusTopLeft!==void 0&&(e.borderRadiusTopLeft=t.borderRadiusTopLeft),t.borderRadiusTopRight!==void 0&&(e.borderRadiusTopRight=t.borderRadiusTopRight),t.borderRadiusBottomRight!==void 0&&(e.borderRadiusBottomRight=t.borderRadiusBottomRight),t.borderRadiusBottomLeft!==void 0&&(e.borderRadiusBottomLeft=t.borderRadiusBottomLeft),e}function ce(o,t){if(!t)return{...o};const e=lt(o.default,t.default),i=lt(lt(e,o.hover),t.hover),n=lt(lt(e,o.focused),t.focused);return{default:e,hover:i,focused:n}}function le(o,t){var i,n,a,r,s,h,l,u;if(!t)return{...o};const e={...o};if(t.sizing!==void 0&&(e.sizing={...o.sizing,...t.sizing},t.sizing.variance)){const c=t.sizing.variance,d=c.min!==void 0&&c.min>=.25&&c.min<=1?c.min:((n=(i=o.sizing)==null?void 0:i.variance)==null?void 0:n.min)??1,m=c.max!==void 0&&c.max>=1&&c.max<=1.75?c.max:((r=(a=o.sizing)==null?void 0:a.variance)==null?void 0:r.max)??1;e.sizing.variance={min:d,max:m}}if(t.rotation!==void 0&&(e.rotation={...o.rotation,...t.rotation},t.rotation.range)){const c=t.rotation.range,d=c.min!==void 0&&c.min>=-180&&c.min<=0?c.min:((h=(s=o.rotation)==null?void 0:s.range)==null?void 0:h.min)??-15,m=c.max!==void 0&&c.max>=0&&c.max<=180?c.max:((u=(l=o.rotation)==null?void 0:l.range)==null?void 0:u.max)??15;e.rotation.range={min:d,max:m}}return e}function he(o){var e;const t=(e=o.layout)==null?void 0:e.rotation;if(t&&"enabled"in t)return{rotation:{mode:t.enabled?"random":"none",range:t.range}}}function de(o){var e,i;const t=(i=(e=o.layout)==null?void 0:e.sizing)==null?void 0:i.variance;if(t)return{sizing:{mode:"adaptive",variance:t}}}function ue(o={}){var h,l;const t=he(o),e=de(o);let i=o.image;(t||e)&&(i={...e||{},...t||{},...i},i.rotation&&(t!=null&&t.rotation)&&((h=o.image)!=null&&h.rotation)&&(i.rotation={...t.rotation,...o.image.rotation}));const n=[...o.loaders??[]];o.images&&o.images.length>0&&n.unshift({static:{sources:[{urls:o.images}]}});const r={loaders:{...It,...((l=o.config)==null?void 0:l.loaders)??{}}},s={loaders:n,config:r,image:le($t,i),layout:{...w.layout},animation:{...w.animation},interaction:{...w.interaction},rendering:{...w.rendering},styling:ce(Ot,o.styling),debug:w.debug};return o.layout&&(s.layout={...w.layout,...o.layout},o.layout.responsive&&(s.layout.responsive={...w.layout.responsive,mobile:o.layout.responsive.mobile?{...w.layout.responsive.mobile,...o.layout.responsive.mobile}:w.layout.responsive.mobile,tablet:o.layout.responsive.tablet?{...w.layout.responsive.tablet,...o.layout.responsive.tablet}:w.layout.responsive.tablet}),o.layout.spacing&&(s.layout.spacing={...w.layout.spacing,...o.layout.spacing})),o.animation&&(s.animation={...w.animation,...o.animation},o.animation.easing&&(s.animation.easing={...w.animation.easing,...o.animation.easing}),o.animation.queue&&(s.animation.queue={...w.animation.queue,...o.animation.queue}),o.animation.performance&&(s.animation.performance={...w.animation.performance,...o.animation.performance}),o.animation.entry&&(s.animation.entry={...w.animation.entry,...o.animation.entry,start:o.animation.entry.start?{...w.animation.entry.start,...o.animation.entry.start,circular:o.animation.entry.start.circular?{...w.animation.entry.start.circular,...o.animation.entry.start.circular}:w.animation.entry.start.circular}:w.animation.entry.start,timing:o.animation.entry.timing?{...w.animation.entry.timing,...o.animation.entry.timing}:w.animation.entry.timing,path:o.animation.entry.path?{...Et,...o.animation.entry.path}:w.animation.entry.path,rotation:o.animation.entry.rotation?{...St,...o.animation.entry.rotation}:w.animation.entry.rotation,scale:o.animation.entry.scale?{...xt,...o.animation.entry.scale}:w.animation.entry.scale})),o.interaction&&(s.interaction={...w.interaction,...o.interaction},o.interaction.focus&&(s.interaction.focus={...w.interaction.focus,...o.interaction.focus}),o.interaction.navigation&&(s.interaction.navigation={...w.interaction.navigation,...o.interaction.navigation}),o.interaction.gestures&&(s.interaction.gestures={...w.interaction.gestures,...o.interaction.gestures})),o.rendering&&(s.rendering={...w.rendering,...o.rendering},o.rendering.responsive&&(s.rendering.responsive={...w.rendering.responsive,...o.rendering.responsive,breakpoints:o.rendering.responsive.breakpoints?{...w.rendering.responsive.breakpoints,...o.rendering.responsive.breakpoints}:w.rendering.responsive.breakpoints,mobileDetection:o.rendering.responsive.mobileDetection?o.rendering.responsive.mobileDetection:w.rendering.responsive.mobileDetection}),o.rendering.ui&&(s.rendering.ui={...w.rendering.ui,...o.rendering.ui}),o.rendering.performance&&(s.rendering.performance={...w.rendering.performance,...o.rendering.performance})),o.debug!==void 0&&(s.debug=o.debug),s}function ge(o,t){return{...o?yt[o]:yt.playful,...t}}function fe(o,t){return{...o?vt[o]:vt.gentle,...t}}function me(o,t){return{...o?wt[o]:wt.gentle,...t}}class Dt{constructor(t){this.activeAnimations=new Map,this.animationIdCounter=0,this.config=t}buildTransformString(t){const e=["translate(-50%, -50%)"];if(t.x!==void 0||t.y!==void 0){const i=t.x??0,n=t.y??0;e.push(`translate(${i}px, ${n}px)`)}return t.rotation!==void 0&&e.push(`rotate(${t.rotation}deg)`),t.scale!==void 0&&e.push(`scale(${t.scale})`),e.join(" ")}animateTransformCancellable(t,e,i,n=null,a=null){this.cancelAllAnimations(t);const r=n??this.config.duration,s=a??this.config.easing.default,h=this.buildTransformString(e),l=this.buildTransformString(i);t.style.transition="none";const u=t.animate([{transform:h},{transform:l}],{duration:r,easing:s,fill:"forwards"}),c={id:`anim-${++this.animationIdCounter}`,element:t,animation:u,fromState:e,toState:i,startTime:performance.now(),duration:r};return this.activeAnimations.set(t,c),u.finished.then(()=>{t.style.transform=l,this.activeAnimations.delete(t)}).catch(()=>{this.activeAnimations.delete(t)}),c}cancelAnimation(t,e=!0){const i=this.getCurrentTransform(t.element);if(t.animation.cancel(),e){const n=this.buildTransformString({x:i.x,y:i.y,rotation:i.rotation,scale:i.scale});t.element.style.transform=n}return this.activeAnimations.delete(t.element),i}cancelAllAnimations(t){const e=this.activeAnimations.get(t);e&&this.cancelAnimation(e,!1);const i=t.getAnimations();for(const n of i)n.cancel()}getCurrentTransform(t){const i=getComputedStyle(t).transform;if(i==="none"||!i)return{x:0,y:0,rotation:0,scale:1};const n=new DOMMatrix(i),a=Math.sqrt(n.a*n.a+n.b*n.b),r=Math.atan2(n.b,n.a)*(180/Math.PI),s=n.e,h=n.f;return{x:s,y:h,rotation:r,scale:a}}hasActiveAnimation(t){return this.activeAnimations.has(t)}getAnimationHandle(t){return this.activeAnimations.get(t)}animateTransform(t,e,i=null,n=null){return new Promise(a=>{const r=i??this.config.duration,s=n??this.config.easing.default;t.style.transition=`transform ${r}ms ${s}, box-shadow ${r}ms ${s}`,t.style.transform=this.buildTransformString(e),setTimeout(()=>{a()},r)})}resetTransform(t,e){return this.animateTransform(t,e)}clearTransition(t){t.style.transition=""}wait(t){return new Promise(e=>setTimeout(e,t))}}function at(o,t,e){return o+(t-o)*e}function pe(o,t,e,i){const{overshoot:n,bounces:a,decayRatio:r}=i,s=e.x-t.x,h=e.y-t.y,l=be(a,r);let u=0,c=0,d=1,m=n,b=!1;for(let g=0;g<l.length;g++)if(o<=l[g].time){c=g===0?0:l[g-1].time,d=l[g].time,m=l[g].overshoot,b=l[g].isOvershoot;break}const p=(o-c)/(d-c);if(b)u=1+m*gt(p);else if(c===0)u=gt(p);else{const g=l.find((y,v)=>y.time>c&&v>0&&l[v-1].isOvershoot),f=1+((g==null?void 0:g.overshoot)||m);u=at(f,1,gt(p))}return{x:t.x+s*u,y:t.y+h*u}}function be(o,t){const e=[];let i=.6;e.push({time:i,overshoot:0,isOvershoot:!1});let n=.15;const r=.4/(o*2);for(let s=0;s<o;s++)i+=r,e.push({time:i,overshoot:n,isOvershoot:!0}),i+=r,e.push({time:i,overshoot:n*t,isOvershoot:!1}),n*=t;return e.push({time:1,overshoot:0,isOvershoot:!1}),e}function ye(o,t,e,i){const{stiffness:n,damping:a,mass:r,oscillations:s}=i,h=e.x-t.x,l=e.y-t.y,u=Math.sqrt(n/r),c=a/(2*Math.sqrt(n*r));let d;if(c<1){const m=u*Math.sqrt(1-c*c),b=Math.exp(-c*u*o*3),p=Math.cos(m*o*s*Math.PI);d=1-b*p}else d=1-Math.exp(-u*o*3);return d=Math.max(0,Math.min(d,1.3)),{x:t.x+h*d,y:t.y+l*d}}function ve(o,t,e,i){const{amplitude:n,frequency:a,decay:r,decayRate:s,phase:h}=i,l=e.x-t.x,u=e.y-t.y,c=Math.sqrt(l*l+u*u),d=c>0?-u/c:0,m=c>0?l/c:1,b=a*Math.PI*2*o+h,p=r?Math.pow(1-o,s):1,g=n*Math.sin(b)*p,f=we(o);return{x:at(t.x,e.x,f)+g*d,y:at(t.y,e.y,f)+g*m}}function gt(o){return 1-(1-o)*(1-o)}function we(o){return 1-Math.pow(1-o,3)}function Ee(o,t,e){const{amplitude:i,frequency:n,decay:a}=e,r=Math.sin(o*n*Math.PI*2),s=a?Math.pow(1-o,2):1,h=i*r*s;return t+h}function Se(o,t,e){const{overshoot:i,bounces:n}=e,a=[];a.push({time:.5,scale:i});let r=i;const s=.5,l=.5/(n*2);let u=.5;for(let d=0;d<n;d++){const m=1-(r-1)*s;u+=l,a.push({time:u,scale:m}),r=1+(r-1)*s*s,u+=l,d<n-1&&a.push({time:u,scale:r})}a.push({time:1,scale:1});let c=1;for(let d=0;d<a.length;d++)if(o<=a[d].time){const m=d===0?0:a[d-1].time,b=d===0?1:a[d-1].scale,p=(o-m)/(a[d].time-m),g=gt(p);c=b+(a[d].scale-b)*g;break}return c*t}function Pt(o){const{element:t,startPosition:e,endPosition:i,pathConfig:n,duration:a,imageWidth:r,imageHeight:s,rotation:h,scale:l,onComplete:u,rotationConfig:c,startRotation:d,scaleConfig:m,startScale:b}=o,p=n.type,g=d!==void 0&&d!==h,f=(c==null?void 0:c.mode)==="wobble",y=(c==null?void 0:c.wobble)||{amplitude:15,frequency:3,decay:!0},v=g||f,I=b!==void 0&&b!==l,R=(m==null?void 0:m.mode)==="pop",E=(m==null?void 0:m.pop)||{overshoot:1.2,bounces:1};if((p==="linear"||p==="arc")&&!v&&!(I||R)){u&&u();return}const j=performance.now(),_=-r/2,P=-s/2;function U(G){const F=G-j,S=Math.min(F/a,1);let C;switch(p){case"bounce":{const N=ge(n.bouncePreset,n.bounce);C=pe(S,e,i,N);break}case"elastic":{const N=fe(n.elasticPreset,n.elastic);C=ye(S,e,i,N);break}case"wave":{const N=me(n.wavePreset,n.wave);C=ve(S,e,i,N);break}default:C={x:at(e.x,i.x,S),y:at(e.y,i.y,S)}}const $=C.x-i.x,M=C.y-i.y;let T;f?T=Ee(S,h,y):g?T=at(d,h,S):T=h;let L;R?L=Se(S,l,E):I?L=at(b,l,S):L=l,t.style.transform=`translate(${_}px, ${P}px) translate(${$}px, ${M}px) rotate(${T}deg) scale(${L})`,S<1?requestAnimationFrame(U):(t.style.transform=`translate(${_}px, ${P}px) rotate(${h}deg) scale(${l})`,u&&u())}requestAnimationFrame(U)}function Ut(o){return o==="bounce"||o==="elastic"||o==="wave"}const xe={radial:"center",spiral:"center",grid:"top",cluster:"nearest-edge",random:"nearest-edge",wave:"left"};class _t{constructor(t,e){this.config=t,this.layoutAlgorithm=e,this.resolvedStartPosition=this.resolveStartPosition(),this.pathConfig=t.path||Et,this.rotationConfig=t.rotation||St,this.scaleConfig=t.scale||xt}resolveStartPosition(){return this.config.start.position?this.config.start.position:xe[this.layoutAlgorithm]||"nearest-edge"}calculateStartPosition(t,e,i,n,a){const r=this.resolvedStartPosition,s=this.config.start.offset??100;switch(r){case"nearest-edge":return this.calculateNearestEdge(t,e,i,s);case"top":return this.calculateEdgePosition("top",t,e,i,s);case"bottom":return this.calculateEdgePosition("bottom",t,e,i,s);case"left":return this.calculateEdgePosition("left",t,e,i,s);case"right":return this.calculateEdgePosition("right",t,e,i,s);case"center":return this.calculateCenterPosition(i,t,e);case"random-edge":return this.calculateRandomEdge(t,e,i,s);case"circular":return this.calculateCircularPosition(t,e,i,n,a);default:return this.calculateNearestEdge(t,e,i,s)}}calculateNearestEdge(t,e,i,n){const a=t.x,r=t.y,s=a,h=i.width-a,l=r,u=i.height-r,c=Math.min(s,h,l,u);let d=t.x,m=t.y;return c===s?d=-(e.width+n):c===h?d=i.width+n:c===l?m=-(e.height+n):m=i.height+n,{x:d,y:m}}calculateEdgePosition(t,e,i,n,a){let r=e.x,s=e.y;switch(t){case"top":s=-(i.height+a);break;case"bottom":s=n.height+a;break;case"left":r=-(i.width+a);break;case"right":r=n.width+a;break}return{x:r,y:s}}calculateCenterPosition(t,e,i){const n=t.width/2,a=t.height/2;return{x:n,y:a,useScale:!0}}calculateRandomEdge(t,e,i,n){const a=["top","bottom","left","right"],r=a[Math.floor(Math.random()*a.length)];return this.calculateEdgePosition(r,t,e,i,n)}calculateCircularPosition(t,e,i,n,a){const r=this.config.start.circular||{},s=r.distribution||"even";let h;const l=r.radius||"120%";if(typeof l=="string"&&l.endsWith("%")){const p=parseFloat(l)/100;h=Math.sqrt(i.width**2+i.height**2)*p/2}else h=typeof l=="number"?l:500;let u;s==="even"?u=n/a*2*Math.PI:u=Math.random()*2*Math.PI;const c=i.width/2,d=i.height/2,m=c+Math.cos(u)*h,b=d+Math.sin(u)*h;return{x:m,y:b}}getAnimationParams(t){const e=this.config.timing.duration,i=this.config.timing.stagger,n=this.config.easing;return{startTransform:"",duration:e,delay:t*i,easing:n}}buildStartTransform(t,e,i,n,a,r,s,h){const l=t.x-e.x,u=t.y-e.y,c=s!==void 0?s:i,d=h!==void 0?h:n,m=a!==void 0?-a/2:0,b=r!==void 0?-r/2:0,p=a!==void 0?`translate(${m}px, ${b}px)`:"translate(-50%, -50%)";return t.useScale?`${p} translate(${l}px, ${u}px) rotate(${c}deg) scale(0)`:`${p} translate(${l}px, ${u}px) rotate(${c}deg) scale(${d})`}buildFinalTransform(t,e,i,n){if(i!==void 0&&n!==void 0){const a=-i/2,r=-n/2;return`translate(${a}px, ${r}px) rotate(${t}deg) scale(${e})`}return`translate(-50%, -50%) rotate(${t}deg) scale(${e})`}getTransitionCSS(){const t=this.config.timing.duration,e=this.config.easing;return this.requiresJSAnimation()?`opacity ${t}ms ease-out`:`opacity ${t}ms ease-out, transform ${t}ms ${e}`}requiresJSAnimation(){return Ut(this.pathConfig.type)}getPathConfig(){return this.pathConfig}getPathType(){return this.pathConfig.type}getTiming(){return{duration:this.config.timing.duration,stagger:this.config.timing.stagger}}getRotationConfig(){return this.rotationConfig}getRotationMode(){return this.rotationConfig.mode}calculateStartRotation(t){switch(this.rotationConfig.mode){case"none":return t;case"settle":{const i=this.rotationConfig.startRotation;if(i===void 0)return t+(Math.random()-.5)*60;if(typeof i=="number")return i;const n=i.max-i.min;return i.min+Math.random()*n}case"spin":{const i=this.rotationConfig.spinCount??1,n=this.resolveSpinDirection(t);return t+i*360*n}case"random":return t+(Math.random()-.5)*60;case"wobble":return t;default:return t}}resolveSpinDirection(t){switch(this.rotationConfig.direction??"auto"){case"clockwise":return-1;case"counterclockwise":return 1;case"random":return Math.random()<.5?1:-1;case"auto":default:return t>=0?1:-1}}requiresJSRotation(){return this.rotationConfig.mode==="wobble"}calculateWobbleRotation(t,e){if(this.rotationConfig.mode!=="wobble")return e;const i=this.rotationConfig.wobble||{amplitude:15,frequency:3,decay:!0},{amplitude:n,frequency:a,decay:r}=i,s=Math.sin(t*a*Math.PI*2),h=r?Math.pow(1-t,2):1,l=n*s*h;return e+l}getScaleConfig(){return this.scaleConfig}getScaleMode(){return this.scaleConfig.mode}calculateStartScale(t){switch(this.scaleConfig.mode){case"none":return t;case"grow":return(this.scaleConfig.startScale??.3)*t;case"shrink":return(this.scaleConfig.startScale??1.5)*t;case"pop":return t;case"random":{const i=this.scaleConfig.range??{min:.5,max:1};return(i.min+Math.random()*(i.max-i.min))*t}default:return t}}requiresJSScale(){return this.scaleConfig.mode==="pop"}calculatePopScale(t,e){if(this.scaleConfig.mode!=="pop")return e;const i=this.scaleConfig.pop||{overshoot:1.2,bounces:1},{overshoot:n,bounces:a}=i,r=this.generateScaleBounceKeyframes(a,n);let s=e;for(let h=0;h<r.length;h++)if(t<=r[h].time){const l=h===0?0:r[h-1].time,u=h===0?e:r[h-1].scale,c=(t-l)/(r[h].time-l),d=this.easeOutQuad(c);s=u+(r[h].scale-u)*d;break}return s*e}generateScaleBounceKeyframes(t,e){const i=[];i.push({time:.5,scale:e});let n=e;const a=.5,s=.5/(t*2);let h=.5;for(let l=0;l<t;l++){const u=1-(n-1)*a;h+=s,i.push({time:h,scale:u}),n=1+(n-1)*a*a,h+=s,l<t-1&&i.push({time:h,scale:n})}return i.push({time:1,scale:1}),i}easeOutQuad(t){return 1-(1-t)*(1-t)}}class Ht{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var E,O,j,_,P,U,G,F,S;const n=[],{width:a,height:r}=e,s=this.config.spacing.padding,h=i.fixedHeight??200,l=((E=this.imageConfig.rotation)==null?void 0:E.mode)??"none",u=((j=(O=this.imageConfig.rotation)==null?void 0:O.range)==null?void 0:j.min)??-15,c=((P=(_=this.imageConfig.rotation)==null?void 0:_.range)==null?void 0:P.max)??15,d=((G=(U=this.imageConfig.sizing)==null?void 0:U.variance)==null?void 0:G.min)??1,m=((S=(F=this.imageConfig.sizing)==null?void 0:F.variance)==null?void 0:S.max)??1,b=d!==1||m!==1,g=h*1.5/2,f=h/2,y=a-s-g,v=r-s-f,I=s+g,R=s+f;for(let C=0;C<t;C++){const $=this.random(I,y),M=this.random(R,v),T=l==="random"?this.random(u,c):0,L=b?this.random(d,m):1,N=h*L,K={id:C,x:$,y:M,rotation:T,scale:L,baseSize:N};n.push(K)}return n}random(t,e){return Math.random()*(e-t)+t}}class Nt{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var O,j,_,P,U,G,F,S,C;const n=[],{width:a,height:r}=e,{debugRadials:s}=this.config,h=i.fixedHeight??200,l=((O=this.imageConfig.rotation)==null?void 0:O.mode)??"none",u=((_=(j=this.imageConfig.rotation)==null?void 0:j.range)==null?void 0:_.min)??-15,c=((U=(P=this.imageConfig.rotation)==null?void 0:P.range)==null?void 0:U.max)??15,d=((F=(G=this.imageConfig.sizing)==null?void 0:G.variance)==null?void 0:F.min)??1,m=((C=(S=this.imageConfig.sizing)==null?void 0:S.variance)==null?void 0:C.max)??1,b=d!==1||m!==1,p=this.config.scaleDecay??0,g=["green","blue","red","yellow","orange","purple"],f=i.fixedHeight??h,y=a/2,v=r/2,I=Math.ceil(Math.sqrt(t));if(t>0){const $=b?this.random(d,m):1,M=f*$;n.push({id:0,x:y,y:v,rotation:l==="random"?this.random(u*.33,c*.33):0,scale:$,baseSize:M,zIndex:100,borderColor:s?"cyan":void 0})}let R=1,E=1;for(;R<t;){const $=E/I,M=p>0?1-$*p*.5:1,T=E*(f*.8),L=T*1.5,N=Math.PI*(3*(L+T)-Math.sqrt((3*L+T)*(L+3*T))),K=this.estimateWidth(f),B=Math.floor(N/(K*.7));if(B===0){E++;continue}const J=2*Math.PI/B,Q=E*(20*Math.PI/180);for(let q=0;q<B&&R<t;q++){const tt=q*J+Q,et=b?this.random(d,m):1,Y=M*et,it=f*Y;let X=y+Math.cos(tt)*L,z=v+Math.sin(tt)*T;const D=this.config.spacing.padding??50,W=it*1.5/2,H=it/2;X-W<D?X=D+W:X+W>a-D&&(X=a-D-W),z-H<D?z=D+H:z+H>r-D&&(z=r-D-H);const nt=l==="random"?this.random(u,c):0;n.push({id:R,x:X,y:z,rotation:nt,scale:Y,baseSize:it,zIndex:Math.max(1,100-E),borderColor:s?g[(E-1)%g.length]:void 0}),R++}E++}return n}estimateWidth(t){return t*1.4}random(t,e){return Math.random()*(e-t)+t}}const Ie={columns:"auto",rows:"auto",stagger:"none",jitter:0,overlap:0,fillDirection:"row",alignment:"center",gap:10,overflowOffset:.25},jt=[{x:1,y:1},{x:-1,y:-1},{x:1,y:-1},{x:-1,y:1},{x:-1,y:0},{x:1,y:0},{x:0,y:-1},{x:0,y:1}];class Gt{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var B,J,Q,q,tt,et,Y,it,X;const n=[],{width:a,height:r}=e,s={...Ie,...this.config.grid},h=this.config.spacing.padding,l=i.fixedHeight??200,u=((B=this.imageConfig.rotation)==null?void 0:B.mode)??"none",c=((Q=(J=this.imageConfig.sizing)==null?void 0:J.variance)==null?void 0:Q.min)??1,d=((tt=(q=this.imageConfig.sizing)==null?void 0:q.variance)==null?void 0:tt.max)??1,m=c!==1||d!==1,b=a-2*h,p=r-2*h,{columns:g,rows:f}=this.calculateGridDimensions(t,b,p,l,s),y=s.stagger==="row",v=s.stagger==="column",I=y?g+.5:g,R=v?f+.5:f,E=(b-s.gap*(g-1))/I,O=(p-s.gap*(f-1))/R,j=y?E/2:0,_=v?O/2:0,P=1+s.overlap,U=Math.min(E,O)*P,G=i.fixedHeight?Math.min(i.fixedHeight,U):U,F=g*E+(g-1)*s.gap+j,S=f*O+(f-1)*s.gap+_,C=h+(b-F)/2,$=h+(p-S)/2,M=g*f,T=s.columns!=="auto"&&s.rows!=="auto",L=T&&t>M;typeof window<"u"&&(window.__gridOverflowDebug={gridConfigColumns:s.columns,gridConfigRows:s.rows,columns:g,rows:f,cellCount:M,hasFixedGrid:T,imageCount:t,isOverflowMode:L});const N=L?new Array(M).fill(0):[],K=Math.min(E,O)*s.overflowOffset;for(let z=0;z<t;z++){let D,k,W=0;if(L&&z>=M){const Z=z-M,V=Z%M;W=Math.floor(Z/M)+1,N[V]++,s.fillDirection==="row"?(D=V%g,k=Math.floor(V/g)):(k=V%f,D=Math.floor(V/f))}else s.fillDirection==="row"?(D=z%g,k=Math.floor(z/g)):(k=z%f,D=Math.floor(z/f));let H=C+D*(E+s.gap)+E/2,nt=$+k*(O+s.gap)+O/2;if(s.stagger==="row"&&k%2===1?H+=E/2:s.stagger==="column"&&D%2===1&&(nt+=O/2),W>0){const Z=(W-1)%jt.length,V=jt[Z];H+=V.x*K,nt+=V.y*K}if(s.jitter>0){const Z=E/2*s.jitter,V=O/2*s.jitter;H+=this.random(-Z,Z),nt+=this.random(-V,V)}let ot=H,rt=nt;if(!L&&s.fillDirection==="row"){const Z=t%g||g;if(k===Math.floor((t-1)/g)&&Z<g){const ne=Z*E+(Z-1)*s.gap;let zt=0;s.alignment==="center"?zt=(F-ne)/2:s.alignment==="end"&&(zt=F-ne),ot+=zt}}const At=m?this.random(c,d):1,ct=G*At,pt=ct*1.5/2,bt=ct/2,Ct=h+pt,Lt=a-h-pt,_e=h+bt,He=r-h-bt;ot=Math.max(Ct,Math.min(ot,Lt)),rt=Math.max(_e,Math.min(rt,He));let Mt=0;if(u==="random"){const Z=((Y=(et=this.imageConfig.rotation)==null?void 0:et.range)==null?void 0:Y.min)??-15,V=((X=(it=this.imageConfig.rotation)==null?void 0:it.range)==null?void 0:X.max)??15;s.jitter>0?Mt=this.random(Z*s.jitter,V*s.jitter):Mt=this.random(Z,V)}let Ft;L&&W>0?Ft=50-W:Ft=L?100+z:z+1,n.push({id:z,x:ot,y:rt,rotation:Mt,scale:At,baseSize:ct,zIndex:Ft})}return n}calculateGridDimensions(t,e,i,n,a){let r,s;if(a.columns!=="auto"&&a.rows!=="auto")r=a.columns,s=a.rows;else if(a.columns!=="auto")r=a.columns,s=Math.ceil(t/r);else if(a.rows!=="auto")s=a.rows,r=Math.ceil(t/s);else{const h=e/i;for(r=Math.max(1,Math.round(Math.sqrt(t*h/1.4))),s=Math.ceil(t/r);r>1&&(r-1)*s>=t;)r--}return{columns:Math.max(1,r),rows:Math.max(1,s)}}random(t,e){return Math.random()*(e-t)+t}}const Te=Math.PI*(3-Math.sqrt(5)),Ae={spiralType:"golden",direction:"counterclockwise",tightness:1,scaleDecay:0,startAngle:0};class kt{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var R,E,O,j,_,P,U,G,F;const n=[],{width:a,height:r}=e,s={...Ae,...this.config.spiral},h=this.config.spacing.padding,l=i.fixedHeight??200,u=((R=this.imageConfig.rotation)==null?void 0:R.mode)??"none",c=((O=(E=this.imageConfig.rotation)==null?void 0:E.range)==null?void 0:O.min)??-15,d=((_=(j=this.imageConfig.rotation)==null?void 0:j.range)==null?void 0:_.max)??15,m=((U=(P=this.imageConfig.sizing)==null?void 0:P.variance)==null?void 0:U.min)??1,b=((F=(G=this.imageConfig.sizing)==null?void 0:G.variance)==null?void 0:F.max)??1,p=m!==1||b!==1,g=this.config.scaleDecay??s.scaleDecay,f=a/2,y=r/2,v=Math.min(f-h-l/2,y-h-l/2),I=s.direction==="clockwise"?-1:1;for(let S=0;S<t;S++){let C,$;if(s.spiralType==="golden")C=S*Te*I+s.startAngle,$=this.calculateGoldenRadius(S,t,v,s.tightness);else if(s.spiralType==="archimedean"){const H=S*.5*s.tightness;C=H*I+s.startAngle,$=this.calculateArchimedeanRadius(H,t,v,s.tightness)}else{const H=S*.3*s.tightness;C=H*I+s.startAngle,$=this.calculateLogarithmicRadius(H,t,v,s.tightness)}const M=f+Math.cos(C)*$,T=y+Math.sin(C)*$,L=$/v,N=g>0?1-L*g*.5:1,K=p?this.random(m,b):1,B=N*K,J=l*B,q=J*1.5/2,tt=J/2,et=h+q,Y=a-h-q,it=h+tt,X=r-h-tt,z=Math.max(et,Math.min(M,Y)),D=Math.max(it,Math.min(T,X));let k=0;if(u==="random"){const H=C*180/Math.PI%360,nt=this.random(c,d);k=s.spiralType==="golden"?nt:H*.1+nt*.9}else u==="tangent"&&(k=this.calculateSpiralTangent(C,$,s));const W=t-S;n.push({id:S,x:z,y:D,rotation:k,scale:B,baseSize:J,zIndex:W})}return n}calculateSpiralTangent(t,e,i){let n;if(i.spiralType==="golden")n=t+Math.PI/2;else if(i.spiralType==="archimedean"){const r=1/i.tightness,s=Math.atan(e/r);n=t+s}else{const r=.15/i.tightness,s=Math.atan(1/r);n=t+s}return n*180/Math.PI%360-90}calculateGoldenRadius(t,e,i,n){const r=i/Math.sqrt(e)*Math.sqrt(t)/n;return Math.min(r,i)}calculateArchimedeanRadius(t,e,i,n){const a=e*.5*n;return t/a*i}calculateLogarithmicRadius(t,e,i,n){const a=i*.05,r=.15/n,s=a*Math.exp(r*t),h=e*.3*n,l=a*Math.exp(r*h);return s/l*i}random(t,e){return Math.random()*(e-t)+t}}const Re={clusterCount:"auto",clusterSpread:150,clusterSpacing:200,density:"uniform",overlap:.3,distribution:"gaussian"};class Wt{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var I,R,E,O,j,_,P,U,G;const n=[],{width:a,height:r}=e,s={...Re,...this.config.cluster},h=this.config.spacing.padding,l=i.fixedHeight??200,u=((I=this.imageConfig.rotation)==null?void 0:I.mode)??"none",c=((E=(R=this.imageConfig.rotation)==null?void 0:R.range)==null?void 0:E.min)??-15,d=((j=(O=this.imageConfig.rotation)==null?void 0:O.range)==null?void 0:j.max)??15,m=((P=(_=this.imageConfig.sizing)==null?void 0:_.variance)==null?void 0:P.min)??1,b=((G=(U=this.imageConfig.sizing)==null?void 0:U.variance)==null?void 0:G.max)??1,p=m!==1||b!==1,g=this.calculateClusterCount(t,s.clusterCount,a,r,s.clusterSpacing),f=this.generateClusterCenters(g,a,r,h,s),y=new Array(g).fill(0);for(let F=0;F<t;F++)y[F%g]++;let v=0;for(let F=0;F<g;F++){const S=f[F],C=y[F];for(let $=0;$<C;$++){let M,T;if(s.distribution==="gaussian")M=this.gaussianRandom()*S.spread,T=this.gaussianRandom()*S.spread;else{const k=this.random(0,Math.PI*2),W=this.random(0,S.spread);M=Math.cos(k)*W,T=Math.sin(k)*W}const L=1+s.overlap*.5,N=1+s.overlap*.3;M/=L,T/=L;const K=p?this.random(m,b):1,B=N*K,J=l*B;let Q=S.x+M,q=S.y+T;const et=J*1.5/2,Y=J/2;Q=Math.max(h+et,Math.min(Q,a-h-et)),q=Math.max(h+Y,Math.min(q,r-h-Y));const it=u==="random"?this.random(c,d):0,z=Math.sqrt(M*M+T*T)/S.spread,D=Math.round((1-z)*50)+1;n.push({id:v,x:Q,y:q,rotation:it,scale:B,baseSize:J,zIndex:D}),v++}}return n}calculateClusterCount(t,e,i,n,a){if(e!=="auto")return Math.max(1,Math.min(e,t));const s=Math.max(1,Math.ceil(t/8)),h=Math.floor(i/a*(n/a)*.6);return Math.max(1,Math.min(s,h,10))}generateClusterCenters(t,e,i,n,a){const r=[],h=n+a.clusterSpread,l=e-n-a.clusterSpread,u=n+a.clusterSpread,c=i-n-a.clusterSpread;for(let d=0;d<t;d++){let m=null,b=-1;for(let p=0;p<100;p++){const g={x:this.random(h,l),y:this.random(u,c),spread:this.calculateClusterSpread(a)};let f=1/0;for(const y of r){const v=g.x-y.x,I=g.y-y.y,R=Math.sqrt(v*v+I*I);f=Math.min(f,R)}if((r.length===0||f>b)&&(m=g,b=f),f>=a.clusterSpacing)break}m&&r.push(m)}return r}calculateClusterSpread(t){return t.density==="uniform"?t.clusterSpread:t.clusterSpread*this.random(.5,1.5)}gaussianRandom(){let t=0,e=0;for(;t===0;)t=Math.random();for(;e===0;)e=Math.random();const i=Math.sqrt(-2*Math.log(t))*Math.cos(2*Math.PI*e);return Math.max(-3,Math.min(3,i))/3}random(t,e){return Math.random()*(e-t)+t}}class Ce{constructor(t,e={}){this.config=t,this.imageConfig=e}generate(t,e,i={}){var L,N,K,B,J,Q,q,tt,et;const n=[],{width:a,height:r}=e,s=i.fixedHeight??200,h=this.config.spacing.padding??50,l=((L=this.imageConfig.rotation)==null?void 0:L.mode)??"none",u=((K=(N=this.imageConfig.rotation)==null?void 0:N.range)==null?void 0:K.min)??-15,c=((J=(B=this.imageConfig.rotation)==null?void 0:B.range)==null?void 0:J.max)??15,d=((q=(Q=this.imageConfig.sizing)==null?void 0:Q.variance)==null?void 0:q.min)??1,m=((et=(tt=this.imageConfig.sizing)==null?void 0:tt.variance)==null?void 0:et.max)??1,b=d!==1||m!==1,p=i.fixedHeight??s,g={...oe,...this.config.wave},{rows:f,amplitude:y,frequency:v,phaseShift:I,synchronization:R}=g,E=Math.ceil(t/f),_=p*1.5/2,P=h+_,U=a-h-_,G=U-P,F=E>1?G/(E-1):0,S=h+y+p/2,C=r-h-y-p/2,$=C-S,M=f>1?$/(f-1):0;let T=0;for(let Y=0;Y<f&&T<t;Y++){const it=f===1?(S+C)/2:S+Y*M;let X=0;R==="offset"?X=Y*I:R==="alternating"&&(X=Y*Math.PI);for(let z=0;z<E&&T<t;z++){const D=E===1?(P+U)/2:P+z*F,k=this.calculateWaveY(D,a,y,v,X),W=D,H=it+k,nt=b?this.random(d,m):1,ot=p*nt;let rt=0;l==="tangent"?rt=this.calculateRotation(D,a,y,v,X):l==="random"&&(rt=this.random(u,c));const ct=ot*1.5/2,Rt=ot/2,pt=h+ct,bt=a-h-ct,Ct=h+Rt,Lt=r-h-Rt;n.push({id:T,x:Math.max(pt,Math.min(W,bt)),y:Math.max(Ct,Math.min(H,Lt)),rotation:rt,scale:nt,baseSize:ot,zIndex:T+1}),T++}}return n}calculateWaveY(t,e,i,n,a){const r=t/e;return i*Math.sin(n*r*2*Math.PI+a)}calculateRotation(t,e,i,n,a){const r=t/e,s=i*n*2*Math.PI*Math.cos(n*r*2*Math.PI+a)/e;return Math.atan(s)*(180/Math.PI)}random(t,e){return Math.random()*(e-t)+t}}class qt{constructor(t){this.config=t.layout,this.imageConfig=t.image,this.layouts=new Map,this.generator=this.initGenerator()}initGenerator(){switch(this.config.algorithm){case"radial":return new Nt(this.config,this.imageConfig);case"grid":return new Gt(this.config,this.imageConfig);case"spiral":return new kt(this.config,this.imageConfig);case"cluster":return new Wt(this.config,this.imageConfig);case"wave":return new Ce(this.config,this.imageConfig);case"random":default:return new Ht(this.config,this.imageConfig)}}generateLayout(t,e,i={}){const n=this.generator.generate(t,e,i);return n.forEach(a=>{this.layouts.set(a.id,a)}),n}getOriginalState(t){return this.layouts.get(Number(t))}reset(){this.layouts.clear()}updateConfig(t){t.layout&&(Object.assign(this.config,t.layout),t.layout.algorithm&&t.layout.algorithm!==this.config.algorithm&&(this.generator=this.initGenerator())),t.image&&Object.assign(this.imageConfig,t.image)}getBreakpoints(){return this.config.responsive??{mobile:{maxWidth:767},tablet:{maxWidth:1199}}}resolveBreakpoint(t){const e=this.getBreakpoints();return t<=e.mobile.maxWidth?"mobile":t<=e.tablet.maxWidth?"tablet":"screen"}resolveBaseHeight(t){const e=this.imageConfig.sizing;if(!e||e.mode==="adaptive")return;const i=e.height;if(i===void 0)return;if(typeof i=="number")return i;const n=i,a=this.resolveBreakpoint(t);return a==="mobile"?n.mobile??n.tablet??n.screen:a==="tablet"?n.tablet??n.screen??n.mobile:n.screen??n.tablet??n.mobile}calculateAdaptiveSize(t,e,i,n){const a=this.imageConfig.sizing,r=this.resolveBaseHeight(n);if(r!==void 0)return{height:r};const s=(a==null?void 0:a.minSize)??50,h=(a==null?void 0:a.maxSize)??400,l=this.config.targetCoverage??.6,u=this.config.densityFactor??1,{width:c,height:d}=t,p=c*d*l/e;let f=Math.sqrt(p/1.4);f*=u,f=Math.min(f,i);let y=this.clamp(f,s,h);if(y===s&&f<s){const v=Math.max(s*.05,20);y=Math.max(v,f)}return{height:y}}clamp(t,e,i){return Math.max(e,Math.min(i,t))}}var x=(o=>(o.IDLE="idle",o.FOCUSING="focusing",o.FOCUSED="focused",o.UNFOCUSING="unfocusing",o.CROSS_ANIMATING="cross_animating",o))(x||{});function Le(o){return o in st}function Me(o){return o?Le(o)?st[o]:o:st.md}function Fe(o){if(!o)return"";const t=[];if(o.grayscale!==void 0&&t.push(`grayscale(${o.grayscale})`),o.blur!==void 0&&t.push(`blur(${o.blur}px)`),o.brightness!==void 0&&t.push(`brightness(${o.brightness})`),o.contrast!==void 0&&t.push(`contrast(${o.contrast})`),o.saturate!==void 0&&t.push(`saturate(${o.saturate})`),o.opacity!==void 0&&t.push(`opacity(${o.opacity})`),o.sepia!==void 0&&t.push(`sepia(${o.sepia})`),o.hueRotate!==void 0&&t.push(`hue-rotate(${o.hueRotate}deg)`),o.invert!==void 0&&t.push(`invert(${o.invert})`),o.dropShadow!==void 0)if(typeof o.dropShadow=="string")t.push(`drop-shadow(${o.dropShadow})`);else{const e=o.dropShadow;t.push(`drop-shadow(${e.x}px ${e.y}px ${e.blur}px ${e.color})`)}return t.join(" ")}function ht(o){if(!o||o.style==="none"||o.width===0)return"none";const t=o.width??0,e=o.style??"solid",i=o.color??"#000000";return`${t}px ${e} ${i}`}function ft(o){var a,r;if(!o)return{};const t={};if(o.borderRadiusTopLeft!==void 0||o.borderRadiusTopRight!==void 0||o.borderRadiusBottomRight!==void 0||o.borderRadiusBottomLeft!==void 0){const s=((a=o.border)==null?void 0:a.radius)??0;o.borderRadiusTopLeft!==void 0?t.borderTopLeftRadius=`${o.borderRadiusTopLeft}px`:s&&(t.borderTopLeftRadius=`${s}px`),o.borderRadiusTopRight!==void 0?t.borderTopRightRadius=`${o.borderRadiusTopRight}px`:s&&(t.borderTopRightRadius=`${s}px`),o.borderRadiusBottomRight!==void 0?t.borderBottomRightRadius=`${o.borderRadiusBottomRight}px`:s&&(t.borderBottomRightRadius=`${s}px`),o.borderRadiusBottomLeft!==void 0?t.borderBottomLeftRadius=`${o.borderRadiusBottomLeft}px`:s&&(t.borderBottomLeftRadius=`${s}px`)}else((r=o.border)==null?void 0:r.radius)!==void 0&&(t.borderRadius=`${o.border.radius}px`);if(o.borderTop||o.borderRight||o.borderBottom||o.borderLeft){const s=o.border||{},h={...s,...o.borderTop},l={...s,...o.borderRight},u={...s,...o.borderBottom},c={...s,...o.borderLeft};t.borderTop=ht(h),t.borderRight=ht(l),t.borderBottom=ht(u),t.borderLeft=ht(c)}else o.border&&(t.border=ht(o.border));o.shadow!==void 0&&(t.boxShadow=Me(o.shadow));const n=Fe(o.filter);if(t.filter=n||"none",o.opacity!==void 0&&(t.opacity=String(o.opacity)),o.cursor!==void 0&&(t.cursor=o.cursor),o.outline&&o.outline.style!=="none"&&(o.outline.width??0)>0){const s=o.outline.width??0,h=o.outline.style??"solid",l=o.outline.color??"#000000";t.outline=`${s}px ${h} ${l}`,o.outline.offset!==void 0&&(t.outlineOffset=`${o.outline.offset}px`)}return o.objectFit!==void 0&&(t.objectFit=o.objectFit),o.aspectRatio!==void 0&&(t.aspectRatio=o.aspectRatio),t}function dt(o,t){t.borderRadius!==void 0&&(o.style.borderRadius=t.borderRadius),t.borderTopLeftRadius!==void 0&&(o.style.borderTopLeftRadius=t.borderTopLeftRadius),t.borderTopRightRadius!==void 0&&(o.style.borderTopRightRadius=t.borderTopRightRadius),t.borderBottomRightRadius!==void 0&&(o.style.borderBottomRightRadius=t.borderBottomRightRadius),t.borderBottomLeftRadius!==void 0&&(o.style.borderBottomLeftRadius=t.borderBottomLeftRadius),t.border!==void 0&&(o.style.border=t.border),t.borderTop!==void 0&&(o.style.borderTop=t.borderTop),t.borderRight!==void 0&&(o.style.borderRight=t.borderRight),t.borderBottom!==void 0&&(o.style.borderBottom=t.borderBottom),t.borderLeft!==void 0&&(o.style.borderLeft=t.borderLeft),t.boxShadow!==void 0&&(o.style.boxShadow=t.boxShadow),t.filter!==void 0&&(o.style.filter=t.filter),t.opacity!==void 0&&(o.style.opacity=t.opacity),t.cursor!==void 0&&(o.style.cursor=t.cursor),t.outline!==void 0&&(o.style.outline=t.outline),t.outlineOffset!==void 0&&(o.style.outlineOffset=t.outlineOffset),t.objectFit!==void 0&&(o.style.objectFit=t.objectFit),t.aspectRatio!==void 0&&(o.style.aspectRatio=t.aspectRatio)}function Yt(o){return o?Array.isArray(o)?o.join(" "):o:""}function ut(o,t){const e=Yt(t);e&&e.split(" ").forEach(i=>{i.trim()&&o.classList.add(i.trim())})}function Xt(o,t){const e=Yt(t);e&&e.split(" ").forEach(i=>{i.trim()&&o.classList.remove(i.trim())})}const Bt={UNFOCUSING:999,FOCUSING:1e3};class Jt{constructor(t,e,i){var n,a;this.state=x.IDLE,this.currentFocus=null,this.focusData=null,this.outgoing=null,this.incoming=null,this.focusGeneration=0,this.config=t,this.animationEngine=e,this.defaultStyles=ft(i==null?void 0:i.default),this.focusedStyles=ft(i==null?void 0:i.focused),this.defaultClassName=(n=i==null?void 0:i.default)==null?void 0:n.className,this.focusedClassName=(a=i==null?void 0:i.focused)==null?void 0:a.className}getState(){return this.state}isAnimating(){return this.state!==x.IDLE&&this.state!==x.FOCUSED}normalizeScalePercent(t){return t>1?t/100:t}calculateFocusDimensions(t,e,i){const n=this.normalizeScalePercent(this.config.scalePercent),a=i.height*n,r=t/e;let s=a,h=s*r;const l=i.width*n;return h>l&&(h=l,s=h/r),{width:h,height:s}}calculateFocusTransform(t,e){const i=t.width/2,n=t.height/2,a=i-e.x,r=n-e.y;return{x:a,y:r,rotation:0,scale:1}}buildDimensionZoomTransform(t){const e=["translate(-50%, -50%)"];if(t.x!==void 0||t.y!==void 0){const i=t.x??0,n=t.y??0;e.push(`translate(${i}px, ${n}px)`)}return t.rotation!==void 0&&e.push(`rotate(${t.rotation}deg)`),e.join(" ")}animateWithDimensions(t,e,i,n,a,r,s,h){const l=this.buildDimensionZoomTransform(e),u=this.buildDimensionZoomTransform(i);return t.style.transition="none",t.animate([{transform:l,width:`${n}px`,height:`${a}px`},{transform:u,width:`${r}px`,height:`${s}px`}],{duration:h,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}applyFocusedStyling(t,e){t.style.zIndex=String(e),t.classList.add("fbn-ic-focused"),dt(t,this.focusedStyles),ut(t,this.focusedClassName)}removeFocusedStyling(t,e){t.style.zIndex=e,t.classList.remove("fbn-ic-focused"),Xt(t,this.focusedClassName),dt(t,this.defaultStyles),ut(t,this.defaultClassName)}startFocusAnimation(t,e,i,n,a){const r=t.style.zIndex||"",s=t.offsetWidth,h=t.offsetHeight,l=this.calculateFocusDimensions(s,h,e),u=this.calculateFocusTransform(e,i);this.applyFocusedStyling(t,Bt.FOCUSING),this.animationEngine.cancelAllAnimations(t);const c=n??{x:0,y:0,rotation:i.rotation,scale:1},d=(a==null?void 0:a.width)??s,m=(a==null?void 0:a.height)??h,b=this.config.animationDuration??600,p=this.animateWithDimensions(t,c,u,d,m,l.width,l.height,b),g={id:`focus-${Date.now()}`,element:t,animation:p,fromState:c,toState:u,startTime:performance.now(),duration:b};return this.focusData={element:t,originalState:i,focusTransform:u,originalZIndex:r,originalWidth:s,originalHeight:h,focusWidth:l.width,focusHeight:l.height},{element:t,originalState:i,animationHandle:g,direction:"in",originalWidth:s,originalHeight:h}}startUnfocusAnimation(t,e,i,n){var b,p,g,f,y;t.style.zIndex=String(Bt.UNFOCUSING),this.animationEngine.cancelAllAnimations(t);const a=i??((b=this.focusData)==null?void 0:b.focusTransform)??{x:0,y:0,rotation:0,scale:1},r=(n==null?void 0:n.width)??((p=this.focusData)==null?void 0:p.focusWidth)??t.offsetWidth,s=(n==null?void 0:n.height)??((g=this.focusData)==null?void 0:g.focusHeight)??t.offsetHeight,h={x:0,y:0,rotation:e.rotation,scale:1},l=((f=this.focusData)==null?void 0:f.originalWidth)??t.offsetWidth,u=((y=this.focusData)==null?void 0:y.originalHeight)??t.offsetHeight,c=this.config.animationDuration??600,d=this.animateWithDimensions(t,a,h,r,s,l,u,c),m={id:`unfocus-${Date.now()}`,element:t,animation:d,fromState:a,toState:h,startTime:performance.now(),duration:c};return{element:t,originalState:e,animationHandle:m,direction:"out",originalWidth:l,originalHeight:u}}async waitForAnimation(t){try{await t.animation.finished}catch{}}resetElementInstantly(t,e,i,n,a){this.animationEngine.cancelAllAnimations(t);const r=["translate(-50%, -50%)"];r.push("translate(0px, 0px)"),r.push(`rotate(${e.rotation}deg)`),t.style.transition="none",t.style.transform=r.join(" "),n!==void 0&&a!==void 0&&(t.style.width=`${n}px`,t.style.height=`${a}px`),this.removeFocusedStyling(t,i)}async focusImage(t,e,i){var a,r,s,h,l,u,c,d,m,b,p,g;if(this.currentFocus===t&&this.state===x.FOCUSED)return this.unfocusImage();if(((a=this.incoming)==null?void 0:a.element)===t&&this.state===x.FOCUSING){const f=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),y={x:f.x,y:f.y,rotation:f.rotation,scale:1},v={width:t.offsetWidth,height:t.offsetHeight};this.outgoing=this.startUnfocusAnimation(t,this.incoming.originalState,y,v),this.incoming=null,this.state=x.UNFOCUSING,await this.waitForAnimation(this.outgoing.animationHandle),this.removeFocusedStyling(this.outgoing.element,((r=this.focusData)==null?void 0:r.originalZIndex)||""),this.outgoing=null,this.currentFocus=null,this.focusData=null,this.state=x.IDLE;return}const n=++this.focusGeneration;switch(this.state){case x.IDLE:if(this.state=x.FOCUSING,this.incoming=this.startFocusAnimation(t,e,i),await this.waitForAnimation(this.incoming.animationHandle),this.focusGeneration!==n)return;this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break;case x.FOCUSED:if(this.state=x.CROSS_ANIMATING,this.currentFocus&&this.focusData&&(this.outgoing=this.startUnfocusAnimation(this.currentFocus,this.focusData.originalState)),this.incoming=this.startFocusAnimation(t,e,i),await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(this.incoming.animationHandle)]),this.focusGeneration!==n)return;this.outgoing&&(this.removeFocusedStyling(this.outgoing.element,((s=this.outgoing.originalState.zIndex)==null?void 0:s.toString())||""),this.outgoing=null),this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break;case x.FOCUSING:if(this.incoming&&(this.animationEngine.cancelAnimation(this.incoming.animationHandle,!1),this.resetElementInstantly(this.incoming.element,this.incoming.originalState,((h=this.focusData)==null?void 0:h.originalZIndex)||"",(l=this.focusData)==null?void 0:l.originalWidth,(u=this.focusData)==null?void 0:u.originalHeight),this.incoming=null),this.incoming=this.startFocusAnimation(t,e,i),await this.waitForAnimation(this.incoming.animationHandle),this.focusGeneration!==n)return;this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break;case x.UNFOCUSING:if(this.state=x.CROSS_ANIMATING,this.incoming=this.startFocusAnimation(t,e,i),await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(this.incoming.animationHandle)]),this.focusGeneration!==n)return;this.outgoing&&(this.removeFocusedStyling(this.outgoing.element,((c=this.outgoing.originalState.zIndex)==null?void 0:c.toString())||""),this.outgoing=null),this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break;case x.CROSS_ANIMATING:if(((d=this.incoming)==null?void 0:d.element)===t)return;if(((m=this.outgoing)==null?void 0:m.element)===t){const f=this.animationEngine.cancelAnimation(this.outgoing.animationHandle,!0),y={x:f.x,y:f.y,rotation:f.rotation,scale:1},v={width:t.offsetWidth,height:t.offsetHeight};if(this.incoming){const I=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),R={x:I.x,y:I.y,rotation:I.rotation,scale:1},E={width:this.incoming.element.offsetWidth,height:this.incoming.element.offsetHeight};this.outgoing=this.startUnfocusAnimation(this.incoming.element,this.incoming.originalState,R,E)}else this.outgoing=null;if(this.incoming=this.startFocusAnimation(t,e,i,y,v),await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(this.incoming.animationHandle)]),this.focusGeneration!==n)return;this.outgoing&&(this.removeFocusedStyling(this.outgoing.element,((b=this.outgoing.originalState.zIndex)==null?void 0:b.toString())||""),this.outgoing=null),this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;return}if(this.outgoing&&(this.animationEngine.cancelAnimation(this.outgoing.animationHandle,!1),this.resetElementInstantly(this.outgoing.element,this.outgoing.originalState,((p=this.outgoing.originalState.zIndex)==null?void 0:p.toString())||"",this.outgoing.originalWidth,this.outgoing.originalHeight),this.outgoing=null),this.incoming){const f=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),y={x:f.x,y:f.y,rotation:f.rotation,scale:1},v={width:this.incoming.element.offsetWidth,height:this.incoming.element.offsetHeight};this.outgoing=this.startUnfocusAnimation(this.incoming.element,this.incoming.originalState,y,v)}if(this.incoming=this.startFocusAnimation(t,e,i),await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(this.incoming.animationHandle)]),this.focusGeneration!==n)return;this.outgoing&&(this.removeFocusedStyling(this.outgoing.element,((g=this.outgoing.originalState.zIndex)==null?void 0:g.toString())||""),this.outgoing=null),this.currentFocus=t,this.incoming=null,this.state=x.FOCUSED;break}}async unfocusImage(){var a,r,s;const t=++this.focusGeneration;if(!this.currentFocus||!this.focusData){if(this.incoming&&this.state===x.FOCUSING){const h=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),l={x:h.x,y:h.y,rotation:h.rotation,scale:1},u={width:this.incoming.element.offsetWidth,height:this.incoming.element.offsetHeight};if(this.outgoing=this.startUnfocusAnimation(this.incoming.element,this.incoming.originalState,l,u),this.incoming=null,this.state=x.UNFOCUSING,await this.waitForAnimation(this.outgoing.animationHandle),this.focusGeneration!==t)return;this.removeFocusedStyling(this.outgoing.element,((a=this.focusData)==null?void 0:a.originalZIndex)||""),this.outgoing=null,this.focusData=null,this.state=x.IDLE}return}if(this.state===x.CROSS_ANIMATING&&this.incoming){const h=this.animationEngine.cancelAnimation(this.incoming.animationHandle,!0),l={x:h.x,y:h.y,rotation:h.rotation,scale:1},u={width:this.incoming.element.offsetWidth,height:this.incoming.element.offsetHeight},c=this.startUnfocusAnimation(this.incoming.element,this.incoming.originalState,l,u);if(await Promise.all([this.outgoing?this.waitForAnimation(this.outgoing.animationHandle):Promise.resolve(),this.waitForAnimation(c.animationHandle)]),this.focusGeneration!==t)return;this.outgoing&&this.removeFocusedStyling(this.outgoing.element,((r=this.outgoing.originalState.zIndex)==null?void 0:r.toString())||""),this.removeFocusedStyling(c.element,((s=this.incoming.originalState.zIndex)==null?void 0:s.toString())||""),this.outgoing=null,this.incoming=null,this.currentFocus=null,this.focusData=null,this.state=x.IDLE;return}this.state=x.UNFOCUSING;const e=this.currentFocus,i=this.focusData.originalState,n=this.focusData.originalZIndex;this.outgoing=this.startUnfocusAnimation(e,i),await this.waitForAnimation(this.outgoing.animationHandle),this.focusGeneration===t&&(this.removeFocusedStyling(e,n),this.outgoing=null,this.currentFocus=null,this.focusData=null,this.state=x.IDLE)}async swapFocus(t,e,i){return this.focusImage(t,e,i)}getCurrentFocus(){return this.currentFocus}isFocused(t){return this.currentFocus===t&&this.state===x.FOCUSED}isTargetingFocus(t){var e;return((e=this.incoming)==null?void 0:e.element)===t}isInvolved(t){var e,i;return this.currentFocus===t||((e=this.incoming)==null?void 0:e.element)===t||((i=this.outgoing)==null?void 0:i.element)===t}setDragOffset(t){if(!this.currentFocus||!this.focusData||this.state!==x.FOCUSED)return;const e=this.currentFocus,i=this.focusData.focusTransform,n=["translate(-50%, -50%)"],a=(i.x??0)+t,r=i.y??0;n.push(`translate(${a}px, ${r}px)`),i.rotation!==void 0&&n.push(`rotate(${i.rotation}deg)`),e.style.transition="none",e.style.transform=n.join(" ")}clearDragOffset(t,e=150){if(!this.currentFocus||!this.focusData||this.state!==x.FOCUSED)return;const i=this.currentFocus,n=this.focusData.focusTransform,a=["translate(-50%, -50%)"],r=n.x??0,s=n.y??0;a.push(`translate(${r}px, ${s}px)`),n.rotation!==void 0&&a.push(`rotate(${n.rotation}deg)`);const h=a.join(" ");t?(i.style.transition=`transform ${e}ms ease-out`,i.style.transform=h,setTimeout(()=>{this.currentFocus===i&&(i.style.transition="none")},e)):(i.style.transition="none",i.style.transform=h)}reset(){var t,e,i,n;this.outgoing&&(this.animationEngine.cancelAnimation(this.outgoing.animationHandle,!1),this.resetElementInstantly(this.outgoing.element,this.outgoing.originalState,((t=this.outgoing.originalState.zIndex)==null?void 0:t.toString())||"",this.outgoing.originalWidth,this.outgoing.originalHeight)),this.incoming&&(this.animationEngine.cancelAnimation(this.incoming.animationHandle,!1),this.resetElementInstantly(this.incoming.element,this.incoming.originalState,((e=this.focusData)==null?void 0:e.originalZIndex)||"",(i=this.focusData)==null?void 0:i.originalWidth,(n=this.focusData)==null?void 0:n.originalHeight)),this.currentFocus&&this.focusData&&this.resetElementInstantly(this.currentFocus,this.focusData.originalState,this.focusData.originalZIndex,this.focusData.originalWidth,this.focusData.originalHeight),this.state=x.IDLE,this.currentFocus=null,this.focusData=null,this.outgoing=null,this.incoming=null}}const ze=50,Oe=.5,$e=20,De=.3,Pe=150,Ue=30,mt=class mt{constructor(t,e){this.enabled=!1,this.touchState=null,this.recentTouchTimestamp=0,this.container=t,this.callbacks=e,this.boundTouchStart=this.handleTouchStart.bind(this),this.boundTouchMove=this.handleTouchMove.bind(this),this.boundTouchEnd=this.handleTouchEnd.bind(this),this.boundTouchCancel=this.handleTouchCancel.bind(this)}enable(){this.enabled||(this.enabled=!0,this.container.style.touchAction="pan-y",this.container.addEventListener("touchstart",this.boundTouchStart,{passive:!1}),this.container.addEventListener("touchmove",this.boundTouchMove,{passive:!1}),this.container.addEventListener("touchend",this.boundTouchEnd,{passive:!0}),this.container.addEventListener("touchcancel",this.boundTouchCancel,{passive:!0}))}disable(){var t;this.enabled&&(this.enabled=!1,this.container.style.touchAction="",this.container.removeEventListener("touchstart",this.boundTouchStart),this.container.removeEventListener("touchmove",this.boundTouchMove),this.container.removeEventListener("touchend",this.boundTouchEnd),this.container.removeEventListener("touchcancel",this.boundTouchCancel),(t=this.touchState)!=null&&t.isDragging&&this.callbacks.onDragEnd(!1),this.touchState=null)}destroy(){this.disable()}hadRecentTouch(){return Date.now()-this.recentTouchTimestamp<mt.TOUCH_CLICK_DELAY}handleTouchStart(t){if(t.touches.length!==1)return;this.recentTouchTimestamp=Date.now();const e=t.touches[0];this.touchState={startX:e.clientX,startY:e.clientY,startTime:performance.now(),currentX:e.clientX,isDragging:!1,isHorizontalSwipe:null}}handleTouchMove(t){if(!this.touchState||t.touches.length!==1)return;const e=t.touches[0],i=e.clientX-this.touchState.startX,n=e.clientY-this.touchState.startY;if(this.touchState.isHorizontalSwipe===null&&Math.sqrt(i*i+n*n)>10){const s=Math.atan2(Math.abs(n),Math.abs(i))*(180/Math.PI);this.touchState.isHorizontalSwipe=s<=Ue}if(this.touchState.isHorizontalSwipe!==!1&&this.touchState.isHorizontalSwipe===!0){t.preventDefault(),this.touchState.isDragging=!0,this.touchState.currentX=e.clientX;const a=i*De;this.callbacks.onDragOffset(a)}}handleTouchEnd(t){if(!this.touchState)return;this.recentTouchTimestamp=Date.now();const e=this.touchState.currentX-this.touchState.startX,i=performance.now()-this.touchState.startTime,n=Math.abs(e)/i,a=Math.abs(e);let r=!1;this.touchState.isHorizontalSwipe===!0&&this.touchState.isDragging&&(a>=ze||n>=Oe&&a>=$e)&&(r=!0,e<0?this.callbacks.onNext():this.callbacks.onPrev()),this.touchState.isDragging&&this.callbacks.onDragEnd(r),this.touchState=null}handleTouchCancel(t){var e;(e=this.touchState)!=null&&e.isDragging&&this.callbacks.onDragEnd(!1),this.touchState=null}};mt.TOUCH_CLICK_DELAY=300;let Tt=mt;class Vt{constructor(t){if(this._prepared=!1,this._discoveredUrls=[],this.apiKey=t.apiKey??"",this.apiEndpoint=t.apiEndpoint??"https://www.googleapis.com/drive/v3/files",this.debugLogging=t.debugLogging??!1,this.sources=t.sources??[],!this.sources||this.sources.length===0)throw new Error("GoogleDriveLoader requires at least one source to be configured")}async prepare(t){this._discoveredUrls=[];for(const e of this.sources)if("folders"in e)for(const i of e.folders){const n=e.recursive!==void 0?e.recursive:!0,a=await this.loadFromFolder(i,t,n);this._discoveredUrls.push(...a)}else if("files"in e){const i=await this.loadFiles(e.files,t);this._discoveredUrls.push(...i)}this._prepared=!0}imagesLength(){if(!this._prepared)throw new Error("GoogleDriveLoader.imagesLength() called before prepare()");return this._discoveredUrls.length}imageURLs(){if(!this._prepared)throw new Error("GoogleDriveLoader.imageURLs() called before prepare()");return[...this._discoveredUrls]}isPrepared(){return this._prepared}extractFolderId(t){const e=[/\/folders\/([a-zA-Z0-9_-]+)/,/id=([a-zA-Z0-9_-]+)/];for(const i of e){const n=t.match(i);if(n&&n[1])return n[1]}return null}async loadFromFolder(t,e,i=!0){const n=this.extractFolderId(t);if(!n)throw new Error("Invalid Google Drive folder URL. Please check the URL format.");if(!this.apiKey||this.apiKey==="YOUR_API_KEY_HERE")return this.loadImagesDirectly(n,e);try{return i?await this.loadImagesRecursively(n,e):await this.loadImagesFromSingleFolder(n,e)}catch(a){return console.error("Error loading from Google Drive API:",a),this.loadImagesDirectly(n,e)}}async loadImagesFromSingleFolder(t,e){const i=[],n=`'${t}' in parents and trashed=false`,r=`${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`,s=await fetch(r);if(!s.ok)throw new Error(`API request failed: ${s.status} ${s.statusText}`);const l=(await s.json()).files.filter(u=>u.mimeType.startsWith("image/")&&e.isAllowed(u.name));return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`),l.forEach(u=>{i.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`),this.log(`Added file: ${u.name}`)}),i}async loadFiles(t,e){const i=[];for(const n of t){const a=this.extractFileId(n);if(!a){this.log(`Skipping invalid file URL: ${n}`);continue}if(this.apiKey&&this.apiKey!=="YOUR_API_KEY_HERE")try{const r=`${this.apiEndpoint}/${a}?fields=name,mimeType&key=${this.apiKey}`,s=await fetch(r);if(s.ok){const h=await s.json();h.mimeType.startsWith("image/")&&e.isAllowed(h.name)?(i.push(`https://lh3.googleusercontent.com/d/${a}=s1600`),this.log(`Added file: ${h.name}`)):this.log(`Skipping non-image file: ${h.name} (${h.mimeType})`)}else this.log(`Failed to fetch metadata for file ${a}: ${s.status}`)}catch(r){this.log(`Error fetching metadata for file ${a}:`,r)}else i.push(`https://lh3.googleusercontent.com/d/${a}=s1600`)}return i}extractFileId(t){if(!/[/:.]/.test(t))return t;const e=[/\/file\/d\/([a-zA-Z0-9_-]+)/,/\/open\?id=([a-zA-Z0-9_-]+)/,/id=([a-zA-Z0-9_-]+)/];for(const i of e){const n=t.match(i);if(n&&n[1])return n[1]}return null}async loadImagesRecursively(t,e){const i=[],n=`'${t}' in parents and trashed=false`,r=`${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`,s=await fetch(r);if(!s.ok)throw new Error(`API request failed: ${s.status} ${s.statusText}`);const h=await s.json(),l=h.files.filter(c=>c.mimeType.startsWith("image/")&&e.isAllowed(c.name)),u=h.files.filter(c=>c.mimeType==="application/vnd.google-apps.folder");this.log(`Found ${h.files.length} total items in folder ${t}`),h.files.forEach(c=>this.log(` - File: ${c.name} (${c.mimeType})`)),this.log(`- ${l.length} valid files (images only)`),this.log(`- ${u.length} subfolders`),l.forEach(c=>{i.push(`https://lh3.googleusercontent.com/d/${c.id}=s1600`),this.log(`Added file: ${c.name}`)});for(const c of u){this.log(`Loading images from subfolder: ${c.name}`);const d=await this.loadImagesRecursively(c.id,e);i.push(...d)}return i}async loadImagesDirectly(t,e){try{const i=`https://drive.google.com/embeddedfolderview?id=${t}`,n=await fetch(i,{mode:"cors"});if(!n.ok)throw new Error("Cannot access folder directly (CORS or permissions issue)");const a=await n.text(),r=/\/file\/d\/([a-zA-Z0-9_-]+)/g,s=[...a.matchAll(r)];return[...new Set(s.map(u=>u[1]))].map(u=>`https://drive.google.com/uc?export=view&id=${u}`)}catch(i){throw console.error("Direct loading failed:",i),new Error(`Unable to load images. Please ensure:
|
|
2
2
|
1. The folder is shared publicly (Anyone with the link can view)
|
|
3
3
|
2. The folder contains image files
|
|
4
4
|
3. Consider adding a Google Drive API key in config.js for better reliability`)}}manualImageUrls(t){return t.map(e=>`https://drive.google.com/uc?export=view&id=${e}`)}log(...t){this.debugLogging&&typeof console<"u"&&console.log(...t)}}class Zt{constructor(t){if(this._prepared=!1,this._discoveredUrls=[],this.validateUrls=t.validateUrls!==!1,this.validationTimeout=t.validationTimeout??5e3,this.validationMethod=t.validationMethod??"head",this.debugLogging=t.debugLogging??!1,this.sources=t.sources??[],!this.sources||this.sources.length===0)throw new Error("StaticImageLoader requires at least one source to be configured");this.log("StaticImageLoader initialized with config:",t)}async prepare(t){this._discoveredUrls=[],this.log(`Processing ${this.sources.length} source(s)`);for(const e of this.sources)try{const i=await this.processSource(e,t);this._discoveredUrls.push(...i)}catch(i){console.warn("Failed to process source:",e,i)}this._prepared=!0,this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`)}imagesLength(){if(!this._prepared)throw new Error("StaticImageLoader.imagesLength() called before prepare()");return this._discoveredUrls.length}imageURLs(){if(!this._prepared)throw new Error("StaticImageLoader.imageURLs() called before prepare()");return[...this._discoveredUrls]}isPrepared(){return this._prepared}async processSource(t,e){return t?"urls"in t?await this.processUrls(t.urls,e):"path"in t?await this.processPath(t.path,t.files,e):"json"in t?await this.processJson(t.json,e):(console.warn("Unknown source shape:",t),[]):(console.warn("Invalid source object:",t),[])}async processUrls(t,e){if(!Array.isArray(t))return console.warn("URLs must be an array:",t),[];const i=[];for(const n of t){const a=n.split("/").pop()||n;if(!e.isAllowed(a)){this.log(`Skipping filtered URL: ${n}`);continue}this.validateUrls?await this.validateUrl(n)?i.push(n):console.warn(`Skipping invalid/missing URL: ${n}`):i.push(n)}return i}async processPath(t,e,i){if(!Array.isArray(e))return console.warn("files must be an array:",e),[];const n=[];for(const a of e){if(!i.isAllowed(a)){this.log(`Skipping filtered file: ${a}`);continue}const r=this.constructUrl(t,a);this.validateUrls?await this.validateUrl(r)?n.push(r):console.warn(`Skipping invalid/missing file: ${r}`):n.push(r)}return n}async processJson(t,e){this.log(`Fetching JSON endpoint: ${t}`);const i=new AbortController,n=setTimeout(()=>i.abort(),1e4);try{const a=await fetch(t,{signal:i.signal});if(clearTimeout(n),!a.ok)throw new Error(`HTTP ${a.status} fetching ${t}`);const r=await a.json();if(!r||!Array.isArray(r.images))throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');return this.log(`JSON endpoint returned ${r.images.length} image(s)`),await this.processUrls(r.images,e)}catch(a){throw clearTimeout(n),a instanceof Error&&a.name==="AbortError"?new Error(`Timeout fetching JSON endpoint: ${t}`):a}}async validateUrl(t){if(this.validationMethod==="none")return!0;if(this.validationMethod==="simple")try{return typeof window<"u"?new URL(t,window.location.origin):new URL(t),!0}catch{return!1}if(typeof window>"u")return!0;if(!(t.startsWith(window.location.origin)||t.startsWith("/")))return this.log(`Skipping validation for cross-origin URL: ${t}`),!0;try{const i=new AbortController,n=setTimeout(()=>i.abort(),this.validationTimeout),a=await fetch(t,{method:"HEAD",signal:i.signal});return clearTimeout(n),a.ok?!0:(this.log(`Validation failed for ${t}: HTTP ${a.status}`),!1)}catch(i){return i instanceof Error&&(i.name==="AbortError"?this.log(`Validation timeout for ${t}`):this.log(`Validation failed for ${t}:`,i.message)),!1}}constructUrl(t,e){const i=t.replace(/\/$/,"");if(this.isAbsoluteUrl(t))return`${i}/${e}`;if(typeof window>"u")return`${i}/${e}`;const n=window.location.origin,r=(t.startsWith("/")?t:"/"+t).replace(/\/$/,"");return`${n}${r}/${e}`}isAbsoluteUrl(t){try{return new URL(t),!0}catch{return!1}}log(...t){this.debugLogging&&typeof console<"u"&&console.log(...t)}}class Kt{constructor(t){if(this._prepared=!1,this._discoveredUrls=[],this.loaders=t.loaders,this.debugLogging=t.debugLogging??!1,!this.loaders||this.loaders.length===0)throw new Error("CompositeLoader requires at least one loader to be configured");this.log(`CompositeLoader initialized with ${this.loaders.length} loader(s)`)}async prepare(t){this._discoveredUrls=[],this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);const e=this.loaders.map((i,n)=>i.prepare(t).then(()=>{this.log(`Loader ${n} prepared with ${i.imagesLength()} images`)}).catch(a=>{console.warn(`Loader ${n} failed to prepare:`,a)}));await Promise.all(e);for(const i of this.loaders)if(i.isPrepared()){const n=i.imageURLs();this._discoveredUrls.push(...n)}this._prepared=!0,this.log(`CompositeLoader prepared with ${this._discoveredUrls.length} total images`)}imagesLength(){if(!this._prepared)throw new Error("CompositeLoader.imagesLength() called before prepare()");return this._discoveredUrls.length}imageURLs(){if(!this._prepared)throw new Error("CompositeLoader.imageURLs() called before prepare()");return[...this._discoveredUrls]}isPrepared(){return this._prepared}log(...t){this.debugLogging&&typeof console<"u"&&console.log("[CompositeLoader]",...t)}}class Qt{constructor(t){this.allowedExtensions=t||["jpg","jpeg","png","gif","webp","bmp"]}isAllowed(t){var n;const i=(n=t.split("?")[0].split(".").pop())==null?void 0:n.toLowerCase();return i?this.allowedExtensions.includes(i):!1}getAllowedExtensions(){return[...this.allowedExtensions]}}const te=`
|
|
@@ -38,8 +38,17 @@
|
|
|
38
38
|
will-change: auto;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
.fbn-ic-counter {
|
|
42
|
+
position: fixed;
|
|
43
|
+
bottom: 24px;
|
|
44
|
+
left: 50%;
|
|
45
|
+
transform: translateX(-50%);
|
|
46
|
+
z-index: 10001;
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
.fbn-ic-hidden {
|
|
42
51
|
display: none !important;
|
|
43
52
|
}
|
|
44
|
-
`;function ee(){if(typeof document>"u")return;const o="fbn-ic-functional-styles";if(document.getElementById(o))return;const t=document.createElement("style");t.id=o,t.textContent=te,document.head.appendChild(t)}class ie{constructor(t={}){var i,n,a,r,s,h;this.fullConfig=ue(t),t.container instanceof HTMLElement?(this.containerRef=t.container,this.containerId=null):(this.containerRef=null,this.containerId=t.container||"imageCloud"),this.imagesLoaded=!1,this.imageElements=[],this.imageLayouts=[],this.currentImageHeight=225,this.currentFocusIndex=null,this.hoveredImage=null,this.resizeTimeout=null,this.displayQueue=[],this.queueInterval=null,this.loadGeneration=0,this.loadingElAutoCreated=!1,this.errorElAutoCreated=!1,this.animationEngine=new Dt(this.fullConfig.animation),this.layoutEngine=new qt({layout:this.fullConfig.layout,image:this.fullConfig.image}),this.zoomEngine=new Jt(this.fullConfig.interaction.focus,this.animationEngine,this.fullConfig.styling),this.defaultStyles=mt((i=this.fullConfig.styling)==null?void 0:i.default),this.hoverStyles=mt((n=this.fullConfig.styling)==null?void 0:n.hover),this.defaultClassName=(r=(a=this.fullConfig.styling)==null?void 0:a.default)==null?void 0:r.className,this.hoverClassName=(h=(s=this.fullConfig.styling)==null?void 0:s.hover)==null?void 0:h.className;const e=this.fullConfig.animation.entry||w.animation.entry;this.entryAnimationEngine=new _t(e,this.fullConfig.layout.algorithm),this.swipeEngine=null,this.imageFilter=this.createImageFilter(),this.imageLoader=this.createLoader(),this.containerEl=null,this.loadingEl=null,this.errorEl=null}createImageFilter(){var e;const t=(e=this.fullConfig.config.loaders)==null?void 0:e.allowedExtensions;return new Qt(t)}createLoader(){const t=this.fullConfig.loaders,e=this.fullConfig.config.loaders??{};if(!t||t.length===0)throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");const i=t.map(n=>this.createLoaderFromEntry(n,e));return i.length===1?i[0]:new Kt({loaders:i,debugLogging:e.debugLogging})}createLoaderFromEntry(t,e){if("static"in t){const i=t.static,n={...i,validateUrls:i.validateUrls??e.validateUrls,validationTimeout:i.validationTimeout??e.validationTimeout,validationMethod:i.validationMethod??e.validationMethod,failOnAllMissing:i.failOnAllMissing??e.failOnAllMissing,allowedExtensions:i.allowedExtensions??e.allowedExtensions,debugLogging:i.debugLogging??e.debugLogging};return new Zt(n)}else if("googleDrive"in t){const i=t.googleDrive,n={...i,allowedExtensions:i.allowedExtensions??e.allowedExtensions,debugLogging:i.debugLogging??e.debugLogging};return new Vt(n)}else throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`)}async init(){try{if(ee(),this.containerRef)this.containerEl=this.containerRef;else if(this.containerEl=document.getElementById(this.containerId),!this.containerEl)throw new Error(`Container #${this.containerId} not found`);this.containerEl.classList.add("fbn-ic-gallery"),this.swipeEngine=new Tt(this.containerEl,{onNext:()=>this.navigateToNextImage(),onPrev:()=>this.navigateToPreviousImage(),onDragOffset:t=>this.zoomEngine.setDragOffset(t),onDragEnd:t=>{t?this.zoomEngine.clearDragOffset(!1):this.zoomEngine.clearDragOffset(!0,Pe)}}),this.setupUI(),this.setupEventListeners(),this.logDebug("ImageCloud initialized"),await this.loadImages()}catch(t){console.error("Gallery initialization failed:",t),this.errorEl&&t instanceof Error&&this.showError("Gallery failed to initialize: "+t.message)}}setupUI(){const t=this.fullConfig.rendering.ui;t.showLoadingSpinner&&(t.loadingElement?(this.loadingEl=this.resolveElement(t.loadingElement),this.loadingElAutoCreated=!1):(this.loadingEl=this.createDefaultLoadingElement(),this.loadingElAutoCreated=!0)),t.errorElement?(this.errorEl=this.resolveElement(t.errorElement),this.errorElAutoCreated=!1):(this.errorEl=this.createDefaultErrorElement(),this.errorElAutoCreated=!0)}resolveElement(t){return t instanceof HTMLElement?t:document.getElementById(t)}createDefaultLoadingElement(){const t=document.createElement("div");t.className="fbn-ic-loading fbn-ic-hidden";const e=document.createElement("div");e.className="fbn-ic-spinner",t.appendChild(e);const i=document.createElement("p");return i.textContent="Loading images...",t.appendChild(i),this.containerEl.appendChild(t),t}createDefaultErrorElement(){const t=document.createElement("div");return t.className="fbn-ic-error fbn-ic-hidden",this.containerEl.appendChild(t),t}setupEventListeners(){document.addEventListener("keydown",t=>{var e;t.key==="Escape"?(this.zoomEngine.unfocusImage(),this.currentFocusIndex=null,(e=this.swipeEngine)==null||e.disable()):t.key==="ArrowRight"?this.navigateToNextImage():t.key==="ArrowLeft"?this.navigateToPreviousImage():(t.key==="Enter"||t.key===" ")&&this.hoveredImage&&(this.handleImageClick(this.hoveredImage.element,this.hoveredImage.layout),t.preventDefault())}),document.addEventListener("click",t=>{var e,i;(e=this.swipeEngine)!=null&&e.hadRecentTouch()||t.target.closest(".fbn-ic-image")||(this.zoomEngine.unfocusImage(),this.currentFocusIndex=null,(i=this.swipeEngine)==null||i.disable())}),window.addEventListener("resize",()=>this.handleResize())}navigateToNextImage(){if(this.currentFocusIndex===null||this.imageElements.length===0)return;const t=(this.currentFocusIndex+1)%this.imageElements.length;this.navigateToImage(t)}navigateToPreviousImage(){if(this.currentFocusIndex===null||this.imageElements.length===0)return;const t=(this.currentFocusIndex-1+this.imageElements.length)%this.imageElements.length;this.navigateToImage(t)}async navigateToImage(t){if(t<0||t>=this.imageElements.length)return;const e=this.imageElements[t],i=this.imageLayouts[t];!e||!i||await this.handleImageClick(e,i)}handleResize(){this.imagesLoaded&&(this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{const t=this.getImageHeight();t!==this.currentImageHeight?(this.logDebug(`Window resized to new breakpoint (height: ${t}px). Reloading images...`),this.loadImages()):this.logDebug("Window resized (no breakpoint change)")},500))}getImageHeight(){const t=window.innerWidth,e=this.fullConfig.layout.responsive,i=this.fullConfig.image.sizing,n=(i==null?void 0:i.maxSize)??400;return e?t<=e.mobile.maxWidth?Math.min(100,n):t<=e.tablet.maxWidth?Math.min(180,n):Math.min(225,n):t<=767?Math.min(100,n):t<=1199?Math.min(180,n):Math.min(225,n)}getContainerBounds(){return this.containerEl?{width:this.containerEl.offsetWidth,height:this.containerEl.offsetHeight||window.innerHeight*.7}:{width:window.innerWidth,height:window.innerHeight*.7}}async loadImages(){try{this.showLoading(!0),this.hideError(),this.clearImageCloud(),await this.imageLoader.prepare(this.imageFilter);const t=this.imageLoader.imagesLength();let e=this.imageLoader.imageURLs();if(t===0){this.showError("No images found."),this.showLoading(!1);return}const i=this.getContainerBounds(),n=this.getImageHeight(),a=window.innerWidth;this.logDebug(`Adaptive sizing input: container=${i.width}x${i.height}px, images=${t}, responsiveMax=${n}px`);const r=this.layoutEngine.calculateAdaptiveSize(i,t,n,a);this.logDebug(`Adaptive sizing result: height=${r.height}px`),await this.createImageCloud(e,r.height),this.showLoading(!1),this.imagesLoaded=!0}catch(t){console.error("Error loading images:",t),t instanceof Error&&this.showError(t.message||"Failed to load images."),this.showLoading(!1)}}logDebug(...t){this.fullConfig.debug&&typeof console<"u"&&console.log(...t)}async createImageCloud(t,e){if(!this.containerEl)return;const i=this.getContainerBounds();this.currentImageHeight=e;const n=this.loadGeneration,a=this.layoutEngine.generateLayout(t.length,i,{fixedHeight:e});this.imageLayouts=a,this.displayQueue=[];let r=0;const s=l=>{this.containerEl&&(this.containerEl.appendChild(l),this.imageElements.push(l),requestAnimationFrame(()=>{if(l.offsetWidth,l.style.opacity=this.defaultStyles.opacity??"1",l.dataset.startX&&(this.entryAnimationEngine.requiresJSAnimation()||this.entryAnimationEngine.requiresJSRotation()||this.entryAnimationEngine.requiresJSScale()||l.dataset.startRotation!==l.dataset.rotation||l.dataset.startScale!==l.dataset.scale)){const d={x:parseFloat(l.dataset.startX),y:parseFloat(l.dataset.startY)},f={x:parseFloat(l.dataset.endX),y:parseFloat(l.dataset.endY)},b=parseFloat(l.dataset.imageWidth),p=parseFloat(l.dataset.imageHeight),g=parseFloat(l.dataset.rotation),m=parseFloat(l.dataset.scale),y=l.dataset.startRotation?parseFloat(l.dataset.startRotation):g,v=l.dataset.startScale?parseFloat(l.dataset.startScale):m,I=this.entryAnimationEngine.getTiming();Pt({element:l,startPosition:d,endPosition:f,pathConfig:this.entryAnimationEngine.getPathConfig(),duration:I.duration,imageWidth:b,imageHeight:p,rotation:g,scale:m,rotationConfig:this.entryAnimationEngine.getRotationConfig(),startRotation:y,scaleConfig:this.entryAnimationEngine.getScaleConfig(),startScale:v})}else{const d=l.dataset.finalTransform||"";l.style.transform=d}const c=parseInt(l.dataset.imageId||"0");if(this.fullConfig.debug&&c<3){const d=l.dataset.finalTransform||"";console.log(`Image ${c} final state:`,{left:l.style.left,top:l.style.top,width:l.style.width,height:l.style.height,computedWidth:l.offsetWidth,computedHeight:l.offsetHeight,transform:d,pathType:this.entryAnimationEngine.getPathType()})}}),r++)},h=()=>{if(this.logDebug("Starting queue processing, enabled:",this.fullConfig.animation.queue.enabled),!this.fullConfig.animation.queue.enabled){for(;this.displayQueue.length>0;){const l=this.displayQueue.shift();l&&s(l)}return}this.queueInterval!==null&&clearInterval(this.queueInterval),this.queueInterval=window.setInterval(()=>{if(n!==this.loadGeneration){this.queueInterval!==null&&(clearInterval(this.queueInterval),this.queueInterval=null);return}if(this.displayQueue.length>0){const l=this.displayQueue.shift();l&&s(l)}r>=t.length&&this.displayQueue.length===0&&this.queueInterval!==null&&(clearInterval(this.queueInterval),this.queueInterval=null)},this.fullConfig.animation.queue.interval)};if("IntersectionObserver"in window&&this.containerEl){const l=new IntersectionObserver(u=>{u.forEach(c=>{c.isIntersecting&&(h(),l.disconnect())})},{threshold:.1,rootMargin:"50px"});l.observe(this.containerEl)}else h();this.fullConfig.layout.debugCenters&&this.containerEl&&(this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach(l=>l.remove()),a.forEach((l,u)=>{const c=document.createElement("div");c.className="fbn-ic-debug-center",c.style.position="absolute",c.style.width="12px",c.style.height="12px",c.style.borderRadius="50%",c.style.backgroundColor="red",c.style.border="2px solid yellow",c.style.zIndex="9999",c.style.pointerEvents="none";const d=l.x,f=l.y;c.style.left=`${d-6}px`,c.style.top=`${f-6}px`,c.title=`Image ${u}: center (${Math.round(d)}, ${Math.round(f)})`,this.containerEl.appendChild(c)})),t.forEach((l,u)=>{var f,b;const c=document.createElement("img");c.referrerPolicy="no-referrer",c.classList.add("fbn-ic-image"),c.dataset.imageId=String(u);const d=a[u];c.style.position="absolute",c.style.width="auto",c.style.height=`${e}px`,c.style.left=`${d.x}px`,c.style.top=`${d.y}px`,d.borderColor&&!((b=(f=this.fullConfig.styling)==null?void 0:f.default)!=null&&b.border)&&(c.style.border=`5px solid ${d.borderColor}`,c.style.boxSizing="border-box"),d.zIndex&&(c.style.zIndex=String(d.zIndex)),dt(c,this.defaultStyles),ut(c,this.defaultClassName),c.addEventListener("mouseenter",()=>{this.hoveredImage={element:c,layout:d},this.zoomEngine.isInvolved(c)||(dt(c,this.hoverStyles),ut(c,this.hoverClassName))}),c.addEventListener("mouseleave",()=>{this.hoveredImage=null,this.zoomEngine.isInvolved(c)||(dt(c,this.defaultStyles),Xt(c,this.hoverClassName),ut(c,this.defaultClassName))}),c.addEventListener("click",p=>{p.stopPropagation(),this.handleImageClick(c,d)}),c.style.opacity="0",c.style.transition=this.entryAnimationEngine.getTransitionCSS(),c.onload=()=>{if(n!==this.loadGeneration)return;const p=c.naturalWidth/c.naturalHeight,g=e*p;c.style.width=`${g}px`;const m={x:d.x,y:d.y},y={width:g,height:e},v=this.entryAnimationEngine.calculateStartPosition(m,y,i,u,t.length),I=this.entryAnimationEngine.calculateStartRotation(d.rotation),R=this.entryAnimationEngine.calculateStartScale(d.scale),S=this.entryAnimationEngine.buildFinalTransform(d.rotation,d.scale,g,e),O=this.entryAnimationEngine.buildStartTransform(v,m,d.rotation,d.scale,g,e,I,R);this.fullConfig.debug&&u<3&&console.log(`Image ${u}:`,{finalPosition:m,imageSize:y,left:d.x,top:d.y,finalTransform:S,renderedWidth:g,renderedHeight:e}),c.style.transform=O,c.dataset.finalTransform=S,(this.entryAnimationEngine.requiresJSAnimation()||this.entryAnimationEngine.requiresJSRotation()||this.entryAnimationEngine.requiresJSScale()||I!==d.rotation||R!==d.scale)&&(c.dataset.startX=String(v.x),c.dataset.startY=String(v.y),c.dataset.endX=String(m.x),c.dataset.endY=String(m.y),c.dataset.imageWidth=String(g),c.dataset.imageHeight=String(e),c.dataset.rotation=String(d.rotation),c.dataset.scale=String(d.scale),c.dataset.startRotation=String(I),c.dataset.startScale=String(R)),this.displayQueue.push(c)},c.onerror=()=>r++,c.src=l})}async handleImageClick(t,e){var a,r;if(!this.containerEl)return;const i=this.zoomEngine.isFocused(t),n={width:this.containerEl.offsetWidth,height:this.containerEl.offsetHeight};if(i)await this.zoomEngine.unfocusImage(),this.currentFocusIndex=null,(a=this.swipeEngine)==null||a.disable();else{const s=t.dataset.imageId;this.currentFocusIndex=s!==void 0?parseInt(s,10):null,(r=this.swipeEngine)==null||r.enable(),await this.zoomEngine.focusImage(t,n,e)}}clearImageCloud(){this.queueInterval!==null&&(clearInterval(this.queueInterval),this.queueInterval=null),this.loadGeneration++,this.displayQueue=[],this.containerEl&&this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach(t=>t.remove()),this.imageElements=[],this.imageLayouts=[],this.currentFocusIndex=null,this.hoveredImage=null,this.layoutEngine.reset(),this.zoomEngine.reset(),this.imagesLoaded=!1}showLoading(t){!this.fullConfig.rendering.ui.showLoadingSpinner||!this.loadingEl||(t?this.loadingEl.classList.remove("fbn-ic-hidden"):this.loadingEl.classList.add("fbn-ic-hidden"))}showError(t){this.errorEl&&(this.errorEl.textContent=t,this.errorEl.classList.remove("fbn-ic-hidden"))}hideError(){this.errorEl&&this.errorEl.classList.add("fbn-ic-hidden")}destroy(){var t;this.clearImageCloud(),this.loadingElAutoCreated&&this.loadingEl&&(this.loadingEl.remove(),this.loadingEl=null),this.errorElAutoCreated&&this.errorEl&&(this.errorEl.remove(),this.errorEl=null),this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),(t=this.swipeEngine)==null||t.destroy()}}A.AnimationEngine=Dt,A.BOUNCE_PRESETS=yt,A.ClusterPlacementGenerator=Wt,A.CompositeLoader=Kt,A.DEFAULT_CONFIG=w,A.DEFAULT_SHARED_LOADER_CONFIG=It,A.ELASTIC_PRESETS=vt,A.EntryAnimationEngine=_t,A.FUNCTIONAL_CSS=te,A.GoogleDriveLoader=Vt,A.GridPlacementGenerator=Gt,A.ImageCloud=ie,A.ImageFilter=Qt,A.ImageGallery=ie,A.LayoutEngine=qt,A.RadialPlacementGenerator=Nt,A.RandomPlacementGenerator=Ht,A.SpiralPlacementGenerator=kt,A.StaticImageLoader=Zt,A.WAVE_PATH_PRESETS=wt,A.ZoomEngine=Jt,A.animatePath=Pt,A.injectFunctionalStyles=ee,A.requiresJSAnimation=Ut,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
53
|
+
`;function ee(){if(typeof document>"u")return;const o="fbn-ic-functional-styles";if(document.getElementById(o))return;const t=document.createElement("style");t.id=o,t.textContent=te,document.head.appendChild(t)}class ie{constructor(t={}){var i,n,a,r,s,h;this.fullConfig=ue(t),t.container instanceof HTMLElement?(this.containerRef=t.container,this.containerId=null):(this.containerRef=null,this.containerId=t.container||"imageCloud"),this.imagesLoaded=!1,this.imageElements=[],this.imageLayouts=[],this.currentImageHeight=225,this.currentFocusIndex=null,this.hoveredImage=null,this.resizeTimeout=null,this.displayQueue=[],this.queueInterval=null,this.loadGeneration=0,this.loadingElAutoCreated=!1,this.errorElAutoCreated=!1,this.counterEl=null,this.counterElAutoCreated=!1,this.animationEngine=new Dt(this.fullConfig.animation),this.layoutEngine=new qt({layout:this.fullConfig.layout,image:this.fullConfig.image}),this.zoomEngine=new Jt(this.fullConfig.interaction.focus,this.animationEngine,this.fullConfig.styling),this.defaultStyles=ft((i=this.fullConfig.styling)==null?void 0:i.default),this.hoverStyles=ft((n=this.fullConfig.styling)==null?void 0:n.hover),this.defaultClassName=(r=(a=this.fullConfig.styling)==null?void 0:a.default)==null?void 0:r.className,this.hoverClassName=(h=(s=this.fullConfig.styling)==null?void 0:s.hover)==null?void 0:h.className;const e=this.fullConfig.animation.entry||w.animation.entry;this.entryAnimationEngine=new _t(e,this.fullConfig.layout.algorithm),this.swipeEngine=null,this.imageFilter=this.createImageFilter(),this.imageLoader=this.createLoader(),this.containerEl=null,this.loadingEl=null,this.errorEl=null}createImageFilter(){var e;const t=(e=this.fullConfig.config.loaders)==null?void 0:e.allowedExtensions;return new Qt(t)}createLoader(){const t=this.fullConfig.loaders,e=this.fullConfig.config.loaders??{};if(!t||t.length===0)throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");const i=t.map(n=>this.createLoaderFromEntry(n,e));return i.length===1?i[0]:new Kt({loaders:i,debugLogging:e.debugLogging})}createLoaderFromEntry(t,e){if("static"in t){const i=t.static,n={...i,validateUrls:i.validateUrls??e.validateUrls,validationTimeout:i.validationTimeout??e.validationTimeout,validationMethod:i.validationMethod??e.validationMethod,failOnAllMissing:i.failOnAllMissing??e.failOnAllMissing,allowedExtensions:i.allowedExtensions??e.allowedExtensions,debugLogging:i.debugLogging??e.debugLogging};return new Zt(n)}else if("googleDrive"in t){const i=t.googleDrive,n={...i,allowedExtensions:i.allowedExtensions??e.allowedExtensions,debugLogging:i.debugLogging??e.debugLogging};return new Vt(n)}else throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`)}async init(){try{if(ee(),this.containerRef)this.containerEl=this.containerRef;else if(this.containerEl=document.getElementById(this.containerId),!this.containerEl)throw new Error(`Container #${this.containerId} not found`);this.containerEl.classList.add("fbn-ic-gallery"),this.swipeEngine=new Tt(this.containerEl,{onNext:()=>this.navigateToNextImage(),onPrev:()=>this.navigateToPreviousImage(),onDragOffset:t=>this.zoomEngine.setDragOffset(t),onDragEnd:t=>{t?this.zoomEngine.clearDragOffset(!1):this.zoomEngine.clearDragOffset(!0,Pe)}}),this.setupUI(),this.setupEventListeners(),this.logDebug("ImageCloud initialized"),await this.loadImages()}catch(t){console.error("Gallery initialization failed:",t),this.errorEl&&t instanceof Error&&this.showError("Gallery failed to initialize: "+t.message)}}setupUI(){const t=this.fullConfig.rendering.ui;t.showLoadingSpinner&&(t.loadingElement?(this.loadingEl=this.resolveElement(t.loadingElement),this.loadingElAutoCreated=!1):(this.loadingEl=this.createDefaultLoadingElement(),this.loadingElAutoCreated=!0)),t.errorElement?(this.errorEl=this.resolveElement(t.errorElement),this.errorElAutoCreated=!1):(this.errorEl=this.createDefaultErrorElement(),this.errorElAutoCreated=!0),t.showImageCounter&&(t.counterElement?(this.counterEl=this.resolveElement(t.counterElement),this.counterElAutoCreated=!1):(this.counterEl=this.createDefaultCounterElement(),this.counterElAutoCreated=!0))}resolveElement(t){return t instanceof HTMLElement?t:document.getElementById(t)}createDefaultLoadingElement(){const t=document.createElement("div");t.className="fbn-ic-loading fbn-ic-hidden";const e=document.createElement("div");e.className="fbn-ic-spinner",t.appendChild(e);const i=document.createElement("p");return i.textContent="Loading images...",t.appendChild(i),this.containerEl.appendChild(t),t}createDefaultErrorElement(){const t=document.createElement("div");return t.className="fbn-ic-error fbn-ic-hidden",this.containerEl.appendChild(t),t}createDefaultCounterElement(){const t=document.createElement("div");return t.className="fbn-ic-counter fbn-ic-hidden",this.containerEl.appendChild(t),t}setupEventListeners(){document.addEventListener("keydown",t=>{var e;t.key==="Escape"?(this.zoomEngine.unfocusImage(),this.currentFocusIndex=null,(e=this.swipeEngine)==null||e.disable(),this.hideCounter()):t.key==="ArrowRight"?this.navigateToNextImage():t.key==="ArrowLeft"?this.navigateToPreviousImage():(t.key==="Enter"||t.key===" ")&&this.hoveredImage&&(this.handleImageClick(this.hoveredImage.element,this.hoveredImage.layout),t.preventDefault())}),document.addEventListener("click",t=>{var e,i;(e=this.swipeEngine)!=null&&e.hadRecentTouch()||t.target.closest(".fbn-ic-image")||(this.zoomEngine.unfocusImage(),this.currentFocusIndex=null,(i=this.swipeEngine)==null||i.disable(),this.hideCounter())}),window.addEventListener("resize",()=>this.handleResize())}navigateToNextImage(){if(this.currentFocusIndex===null||this.imageElements.length===0)return;const t=(this.currentFocusIndex+1)%this.imageLayouts.length,e=this.imageElements.find(n=>n.dataset.imageId===String(t));if(!e)return;const i=this.imageLayouts[t];i&&(this.currentFocusIndex=t,this.handleImageClick(e,i),this.updateCounter(t))}navigateToPreviousImage(){if(this.currentFocusIndex===null||this.imageElements.length===0)return;const t=(this.currentFocusIndex-1+this.imageLayouts.length)%this.imageLayouts.length,e=this.imageElements.find(n=>n.dataset.imageId===String(t));if(!e)return;const i=this.imageLayouts[t];i&&(this.currentFocusIndex=t,this.handleImageClick(e,i),this.updateCounter(t))}handleResize(){this.imagesLoaded&&(this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{const t=this.getImageHeight();t!==this.currentImageHeight?(this.logDebug(`Window resized to new breakpoint (height: ${t}px). Reloading images...`),this.loadImages()):this.logDebug("Window resized (no breakpoint change)")},500))}getImageHeight(){const t=window.innerWidth,e=this.fullConfig.layout.responsive,i=this.fullConfig.image.sizing,n=(i==null?void 0:i.maxSize)??400;return e?t<=e.mobile.maxWidth?Math.min(100,n):t<=e.tablet.maxWidth?Math.min(180,n):Math.min(225,n):t<=767?Math.min(100,n):t<=1199?Math.min(180,n):Math.min(225,n)}getContainerBounds(){return this.containerEl?{width:this.containerEl.offsetWidth,height:this.containerEl.offsetHeight||window.innerHeight*.7}:{width:window.innerWidth,height:window.innerHeight*.7}}async loadImages(){try{this.showLoading(!0),this.hideError(),this.clearImageCloud(),await this.imageLoader.prepare(this.imageFilter);const t=this.imageLoader.imagesLength();let e=this.imageLoader.imageURLs();if(t===0){this.showError("No images found."),this.showLoading(!1);return}const i=this.getContainerBounds(),n=this.getImageHeight(),a=window.innerWidth;this.logDebug(`Adaptive sizing input: container=${i.width}x${i.height}px, images=${t}, responsiveMax=${n}px`);const r=this.layoutEngine.calculateAdaptiveSize(i,t,n,a);this.logDebug(`Adaptive sizing result: height=${r.height}px`),await this.createImageCloud(e,r.height),this.showLoading(!1),this.imagesLoaded=!0}catch(t){console.error("Error loading images:",t),t instanceof Error&&this.showError(t.message||"Failed to load images."),this.showLoading(!1)}}logDebug(...t){this.fullConfig.debug&&typeof console<"u"&&console.log(...t)}async createImageCloud(t,e){if(!this.containerEl)return;const i=this.getContainerBounds();this.currentImageHeight=e;const n=this.loadGeneration,a=this.layoutEngine.generateLayout(t.length,i,{fixedHeight:e});this.imageLayouts=a,this.displayQueue=[];let r=0;const s=l=>{this.containerEl&&(this.containerEl.appendChild(l),this.imageElements.push(l),requestAnimationFrame(()=>{if(l.offsetWidth,l.style.opacity=this.defaultStyles.opacity??"1",l.dataset.startX&&(this.entryAnimationEngine.requiresJSAnimation()||this.entryAnimationEngine.requiresJSRotation()||this.entryAnimationEngine.requiresJSScale()||l.dataset.startRotation!==l.dataset.rotation||l.dataset.startScale!==l.dataset.scale)){const d={x:parseFloat(l.dataset.startX),y:parseFloat(l.dataset.startY)},m={x:parseFloat(l.dataset.endX),y:parseFloat(l.dataset.endY)},b=parseFloat(l.dataset.imageWidth),p=parseFloat(l.dataset.imageHeight),g=parseFloat(l.dataset.rotation),f=parseFloat(l.dataset.scale),y=l.dataset.startRotation?parseFloat(l.dataset.startRotation):g,v=l.dataset.startScale?parseFloat(l.dataset.startScale):f,I=this.entryAnimationEngine.getTiming();Pt({element:l,startPosition:d,endPosition:m,pathConfig:this.entryAnimationEngine.getPathConfig(),duration:I.duration,imageWidth:b,imageHeight:p,rotation:g,scale:f,rotationConfig:this.entryAnimationEngine.getRotationConfig(),startRotation:y,scaleConfig:this.entryAnimationEngine.getScaleConfig(),startScale:v})}else{const d=l.dataset.finalTransform||"";l.style.transform=d}const c=parseInt(l.dataset.imageId||"0");if(this.fullConfig.debug&&c<3){const d=l.dataset.finalTransform||"";console.log(`Image ${c} final state:`,{left:l.style.left,top:l.style.top,width:l.style.width,height:l.style.height,computedWidth:l.offsetWidth,computedHeight:l.offsetHeight,transform:d,pathType:this.entryAnimationEngine.getPathType()})}}),r++)},h=()=>{if(this.logDebug("Starting queue processing, enabled:",this.fullConfig.animation.queue.enabled),!this.fullConfig.animation.queue.enabled){for(;this.displayQueue.length>0;){const l=this.displayQueue.shift();l&&s(l)}return}this.queueInterval!==null&&clearInterval(this.queueInterval),this.queueInterval=window.setInterval(()=>{if(n!==this.loadGeneration){this.queueInterval!==null&&(clearInterval(this.queueInterval),this.queueInterval=null);return}if(this.displayQueue.length>0){const l=this.displayQueue.shift();l&&s(l)}r>=t.length&&this.displayQueue.length===0&&this.queueInterval!==null&&(clearInterval(this.queueInterval),this.queueInterval=null)},this.fullConfig.animation.queue.interval)};if("IntersectionObserver"in window&&this.containerEl){const l=new IntersectionObserver(u=>{u.forEach(c=>{c.isIntersecting&&(h(),l.disconnect())})},{threshold:.1,rootMargin:"50px"});l.observe(this.containerEl)}else h();this.fullConfig.layout.debugCenters&&this.containerEl&&(this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach(l=>l.remove()),a.forEach((l,u)=>{const c=document.createElement("div");c.className="fbn-ic-debug-center",c.style.position="absolute",c.style.width="12px",c.style.height="12px",c.style.borderRadius="50%",c.style.backgroundColor="red",c.style.border="2px solid yellow",c.style.zIndex="9999",c.style.pointerEvents="none";const d=l.x,m=l.y;c.style.left=`${d-6}px`,c.style.top=`${m-6}px`,c.title=`Image ${u}: center (${Math.round(d)}, ${Math.round(m)})`,this.containerEl.appendChild(c)})),t.forEach((l,u)=>{var m,b;const c=document.createElement("img");c.referrerPolicy="no-referrer",c.classList.add("fbn-ic-image"),c.dataset.imageId=String(u);const d=a[u];c.style.position="absolute",c.style.width="auto",c.style.height=`${e}px`,c.style.left=`${d.x}px`,c.style.top=`${d.y}px`,d.borderColor&&!((b=(m=this.fullConfig.styling)==null?void 0:m.default)!=null&&b.border)&&(c.style.border=`5px solid ${d.borderColor}`,c.style.boxSizing="border-box"),d.zIndex&&(c.style.zIndex=String(d.zIndex)),dt(c,this.defaultStyles),ut(c,this.defaultClassName),c.addEventListener("mouseenter",()=>{this.hoveredImage={element:c,layout:d},this.zoomEngine.isInvolved(c)||(dt(c,this.hoverStyles),ut(c,this.hoverClassName))}),c.addEventListener("mouseleave",()=>{this.hoveredImage=null,this.zoomEngine.isInvolved(c)||(dt(c,this.defaultStyles),Xt(c,this.hoverClassName),ut(c,this.defaultClassName))}),c.addEventListener("click",p=>{p.stopPropagation(),this.handleImageClick(c,d)}),c.style.opacity="0",c.style.transition=this.entryAnimationEngine.getTransitionCSS(),c.onload=()=>{if(n!==this.loadGeneration)return;const p=c.naturalWidth/c.naturalHeight,g=e*p;c.style.width=`${g}px`;const f={x:d.x,y:d.y},y={width:g,height:e},v=this.entryAnimationEngine.calculateStartPosition(f,y,i,u,t.length),I=this.entryAnimationEngine.calculateStartRotation(d.rotation),R=this.entryAnimationEngine.calculateStartScale(d.scale),E=this.entryAnimationEngine.buildFinalTransform(d.rotation,d.scale,g,e),O=this.entryAnimationEngine.buildStartTransform(v,f,d.rotation,d.scale,g,e,I,R);this.fullConfig.debug&&u<3&&console.log(`Image ${u}:`,{finalPosition:f,imageSize:y,left:d.x,top:d.y,finalTransform:E,renderedWidth:g,renderedHeight:e}),c.style.transform=O,c.dataset.finalTransform=E,(this.entryAnimationEngine.requiresJSAnimation()||this.entryAnimationEngine.requiresJSRotation()||this.entryAnimationEngine.requiresJSScale()||I!==d.rotation||R!==d.scale)&&(c.dataset.startX=String(v.x),c.dataset.startY=String(v.y),c.dataset.endX=String(f.x),c.dataset.endY=String(f.y),c.dataset.imageWidth=String(g),c.dataset.imageHeight=String(e),c.dataset.rotation=String(d.rotation),c.dataset.scale=String(d.scale),c.dataset.startRotation=String(I),c.dataset.startScale=String(R)),this.displayQueue.push(c)},c.onerror=()=>r++,c.src=l})}async handleImageClick(t,e){var a,r;if(!this.containerEl)return;const i=this.zoomEngine.isFocused(t),n={width:this.containerEl.offsetWidth,height:this.containerEl.offsetHeight};if(i)await this.zoomEngine.unfocusImage(),this.currentFocusIndex=null,(a=this.swipeEngine)==null||a.disable(),this.hideCounter();else{const s=t.dataset.imageId;this.currentFocusIndex=s!==void 0?parseInt(s,10):null,(r=this.swipeEngine)==null||r.enable(),await this.zoomEngine.focusImage(t,n,e),this.currentFocusIndex!==null&&this.updateCounter(this.currentFocusIndex)}}clearImageCloud(){this.queueInterval!==null&&(clearInterval(this.queueInterval),this.queueInterval=null),this.loadGeneration++,this.displayQueue=[],this.containerEl&&this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach(t=>t.remove()),this.imageElements=[],this.imageLayouts=[],this.currentFocusIndex=null,this.hoveredImage=null,this.layoutEngine.reset(),this.zoomEngine.reset(),this.imagesLoaded=!1}showLoading(t){!this.fullConfig.rendering.ui.showLoadingSpinner||!this.loadingEl||(t?this.loadingEl.classList.remove("fbn-ic-hidden"):this.loadingEl.classList.add("fbn-ic-hidden"))}showError(t){this.errorEl&&(this.errorEl.textContent=t,this.errorEl.classList.remove("fbn-ic-hidden"))}hideError(){this.errorEl&&this.errorEl.classList.add("fbn-ic-hidden")}updateCounter(t){!this.fullConfig.rendering.ui.showImageCounter||!this.counterEl||(this.counterEl.textContent=`${t+1} of ${this.imageElements.length}`,this.counterEl.classList.remove("fbn-ic-hidden"))}hideCounter(){this.counterEl&&this.counterEl.classList.add("fbn-ic-hidden")}destroy(){var t;this.clearImageCloud(),this.loadingElAutoCreated&&this.loadingEl&&(this.loadingEl.remove(),this.loadingEl=null),this.errorElAutoCreated&&this.errorEl&&(this.errorEl.remove(),this.errorEl=null),this.counterElAutoCreated&&this.counterEl&&(this.counterEl.remove(),this.counterEl=null),this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),(t=this.swipeEngine)==null||t.destroy()}}A.AnimationEngine=Dt,A.BOUNCE_PRESETS=yt,A.ClusterPlacementGenerator=Wt,A.CompositeLoader=Kt,A.DEFAULT_CONFIG=w,A.DEFAULT_SHARED_LOADER_CONFIG=It,A.ELASTIC_PRESETS=vt,A.EntryAnimationEngine=_t,A.FUNCTIONAL_CSS=te,A.GoogleDriveLoader=Vt,A.GridPlacementGenerator=Gt,A.ImageCloud=ie,A.ImageFilter=Qt,A.ImageGallery=ie,A.LayoutEngine=qt,A.RadialPlacementGenerator=Nt,A.RandomPlacementGenerator=Ht,A.SpiralPlacementGenerator=kt,A.StaticImageLoader=Zt,A.WAVE_PATH_PRESETS=wt,A.ZoomEngine=Jt,A.animatePath=Pt,A.injectFunctionalStyles=ee,A.requiresJSAnimation=Ut,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
45
54
|
//# sourceMappingURL=image-cloud.umd.js.map
|