Viewing File: /home/ubuntu/fansforx_landing_ui/blog/wp-content/plugins/web-stories/assets/js/83.js
"use strict";(globalThis.webpackChunkweb_stories_wp=globalThis.webpackChunkweb_stories_wp||[]).push([[83],{90083:(t,n,o)=>{o.d(n,{default:()=>PhotoAlbum});var e=o(67294);function r({width:t,height:n}){return t/n}function i(t,n=0){const o=10**n;return Math.round((t+Number.EPSILON)*o)/o}class MinHeap{constructor(t){this.comparator=t,this.heap=[],this.n=0}greater(t,n){return this.comparator(this.heap[t],this.heap[n])<0}swap(t,n){const o=this.heap[t];this.heap[t]=this.heap[n],this.heap[n]=o}swim(t){let n=t,o=Math.floor(n/2);for(;n>1&&this.greater(o,n);)this.swap(o,n),n=o,o=Math.floor(n/2)}sink(t){let n=t,o=2*n;for(;o<=this.n&&(o<this.n&&this.greater(o,o+1)&&(o+=1),this.greater(n,o));)this.swap(n,o),n=o,o=2*n}push(t){this.n+=1,this.heap[this.n]=t,this.swim(this.n)}pop(){if(0===this.n)return;this.swap(1,this.n),this.n-=1;const t=this.heap.pop();return this.sink(1),t}size(){return this.n}}function s(t,n,o){const e=function(t,n,o){const e=new Map,r=new Set,i=new Map;i.set(n,0);const s=new MinHeap((a=t=>t.weight,(t,n)=>a(n)-a(t)));var a;for(s.push({id:n,weight:0});s.size()>0;){const{id:n,weight:o}=s.pop();if(!r.has(n)){const a=t(n);r.add(n),a.forEach(((t,r)=>{const a=o+t,l=e.get(r),u=i.get(r);(void 0===u||u>a&&(u/a>1.005||void 0!==l&&l<n))&&(i.set(r,a),s.push({id:r,weight:a}),e.set(r,n))}))}}return i.has(o)?e:void 0}(t,n,o);return e?function(t,n){const o=[];for(let e=n;void 0!==e;e=t.get(e))o.push(e);return o.reverse()}(e,o):void 0}function a(t,n,o,e){return(n-(t.length-1)*o-2*e*t.length)/t.reduce(((t,n)=>t+r(n)),0)}function l(t,n,o,e,r,i,s){const l=t.slice(n,o),u=a(l,e,i,s);return u>0?(u-r)**2*l.length:void 0}function u({photos:t,layoutOptions:n}){const{spacing:o,padding:e,containerWidth:u,targetRowHeight:c,rowConstraints:h}=n,p=function({photos:t,targetRowHeight:n,containerWidth:o}){return i(o/n/t.reduce(((t,n)=>Math.min(r(n),t)),Number.MAX_VALUE))+2}({photos:t,containerWidth:u,targetRowHeight:c}),d=function({photos:t,layoutOptions:n,targetRowHeight:o,limitNodeSearch:e,rowConstraints:r}){return i=>{var s,a;const{containerWidth:u,spacing:c,padding:h}=n,p=new Map;p.set(i,0);const d=null!==(s=null==r?void 0:r.minPhotos)&&void 0!==s?s:1,m=Math.min(e,null!==(a=null==r?void 0:r.maxPhotos)&&void 0!==a?a:1/0);for(let n=i+d;n<t.length+1&&!(n-i>m);n+=1){const e=l(t,i,n,u,o,c,h);if(void 0===e)break;p.set(n,e)}return p}}({photos:t,layoutOptions:n,targetRowHeight:c,limitNodeSearch:p,rowConstraints:h}),m=s(d,0,t.length);if(void 0===m)return;const g=[];for(let n=1;n<m.length;n+=1){const i=t.map(((t,n)=>({photo:t,index:n}))).slice(m[n-1],m[n]),s=a(i.map((({photo:t})=>t)),u,o,e);g.push(i.map((({photo:t,index:n},o)=>({photo:t,layout:{height:s,width:s*r(t),index:n,photoIndex:o,photosCount:i.length}}))))}return g}function c(t,{width:n,photosCount:o},{spacing:e,padding:r,containerWidth:s}){const a=e*(o-1)+2*r*o;return`calc((${t} - ${a}px) / ${i((s-a)/n,5)})`}function h(t,n){return"rows"!==n.layout?`calc(100% - ${2*n.padding}px)`:c("100%",t,n)}function p(t,n,o){var e,r;return c(null!==(r=null===(e=t.match(/calc\((.*)\)/))||void 0===e?void 0:e[1])&&void 0!==r?r:t,n,o)}function d(t,n,o){let e,r;return t.images&&t.images.length>0&&(e=t.images.concat(t.images.find((({width:n})=>n===t.width))?[]:[{src:t.src,width:t.width,height:t.height}]).sort(((t,n)=>t.width-n.width)).map((t=>`${t.src} ${t.width}w`)).join(", "),r=o.sizes?(o.sizes.sizes||[]).map((({viewport:t,size:e})=>`${t} ${p(e,n,o)}`)).concat(p(o.sizes.size,n,o)).join(", "):`${Math.ceil(n.width/o.containerWidth*100)}vw`),{srcSet:e,sizes:r}}function PhotoRenderer(t){var n,o;const{photo:r,layout:i,layoutOptions:s,imageProps:{style:a,...l}={},renderPhoto:u}=t,{onClick:c}=s,p={display:"block",boxSizing:"content-box",width:h(i,s),height:"auto",aspectRatio:`${r.width} / ${r.height}`,...s.padding?{padding:`${s.padding}px`}:null,...("columns"===s.layout||"masonry"===s.layout)&&i.photoIndex<i.photosCount-1?{marginBottom:`${s.spacing}px`}:null,...c?{cursor:"pointer"}:null,...a},m=c?t=>{c({event:t,photo:r,index:i.index})}:void 0,g={src:r.src,alt:null!==(n=r.alt)&&void 0!==n?n:"",title:r.title,onClick:m,style:p,className:"react-photo-album--photo",loading:"lazy",decoding:"async",...d(r,i,s),...l},f=t=>{const{src:n,alt:o,srcSet:r,sizes:i,style:s,...a}=g;return e.createElement("img",{alt:o,...r?{srcSet:r,sizes:i}:null,src:n,style:(null==t?void 0:t.wrapped)?{display:"block",width:"100%",height:"100%"}:s,...a})},y=(({display:t,boxSizing:n,width:o,aspectRatio:e,padding:r,marginBottom:i,cursor:s})=>({display:t,boxSizing:n,width:o,aspectRatio:e,padding:r,marginBottom:i,cursor:s}))(p);return e.createElement(e.Fragment,null,null!==(o=null==u?void 0:u({photo:r,layout:i,layoutOptions:s,imageProps:g,renderDefaultPhoto:f,wrapperStyle:y}))&&void 0!==o?o:f())}function m({rowContainerProps:t,children:n}){return e.createElement("div",{...t},n)}function RowContainerRenderer(t){const{layoutOptions:n,rowIndex:o,rowsCount:r,renderRowContainer:i,rowContainerProps:{style:s,...a}={},children:l}=t,u={className:"react-photo-album--row",style:{display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"flex-start",justifyContent:"space-between",...o<r-1?{marginBottom:`${n.spacing}px`}:null,...s},...a};return e.createElement(e.Fragment,null,(null!=i?i:m)({layoutOptions:n,rowIndex:o,rowsCount:r,rowContainerProps:u,children:l}))}function RowsLayout(t){const{photos:n,layoutOptions:o,renderPhoto:r,renderRowContainer:i,componentsProps:s}=t,a=u({photos:n,layoutOptions:o});return a?e.createElement(e.Fragment,null,a.map(((t,n)=>e.createElement(RowContainerRenderer,{key:`row-${n}`,layoutOptions:o,rowIndex:n,rowsCount:a.length,renderRowContainer:i,rowContainerProps:null==s?void 0:s.rowContainerProps},t.map((({photo:t,layout:n})=>e.createElement(PhotoRenderer,{key:t.key||t.src,photo:t,layout:n,layoutOptions:o,renderPhoto:r,imageProps:null==s?void 0:s.imageProps}))))))):null}function g(t,n,o,e){return function(t,n,o){const e=[o];for(let r=o,i=n;i>0;i-=1)r=t.get(r)[i].node,e.push(r);return e.reverse()}(function(t,n,o,e){const r=new Map,i=new Set;i.add(o);for(let o=0;o<n;o+=1){const s=[...i.keys()];i.clear(),s.forEach((s=>{const a=o>0?r.get(s)[o].weight:0;t(s).forEach((({neighbor:t,weight:l})=>{let u=r.get(t);u||(u=[],r.set(t,u));const c=a+l,h=u[o+1];(!h||h.weight>c&&(h.weight/c>1.0001||s<h.node))&&(u[o+1]={node:s,weight:c}),o<n-1&&t!==e&&i.add(t)}))}))}return r}(t,n,o,e),n,e)}function f({path:t,photos:n,containerWidth:o,columnsGaps:e,columnsRatios:i,spacing:s,padding:a}){const l=[],u=i.reduce(((t,n)=>t+n),0);for(let c=0;c<t.length-1;c+=1){const h=n.map(((t,n)=>({photo:t,index:n}))).slice(t[c],t[c+1]),p=i.reduce(((t,n,o)=>t+(e[c]-e[o])*n),0),d=(o-(t.length-2)*s-2*(t.length-1)*a-p)*i[c]/u;l.push(h.map((({photo:t,index:n},o)=>({photo:t,layout:{width:d,height:d/r(t),index:n,photoIndex:o,photosCount:h.length}}))))}return l}function y({photos:t,layoutOptions:n,targetColumnWidth:o}){const{columns:e,spacing:i,padding:s,containerWidth:a}=n,l=[],u=[];if(t.length<=e){const n=t.length>0?t.reduce(((t,n)=>t+r(n)),0)/t.length:1;for(let o=0;o<e;o+=1)l[o]=2*s,u[o]=o<t.length?r(t[o]):n;return{columnsGaps:l,columnsRatios:u,columnsModel:f({path:Array.from({length:e+1}).map(((n,o)=>Math.min(o,t.length))),photos:t,columnsRatios:u,columnsGaps:l,containerWidth:a,spacing:i,padding:s})}}const c=(t.reduce(((t,n)=>t+o/r(n)),0)+i*(t.length-e)+2*s*t.length)/e,h=function({photos:t,spacing:n,padding:o,targetColumnWidth:e,targetColumnHeight:i}){return s=>{const a=[],l=1.5*i;let u=e/r(t[s])+2*o;for(let c=s+1;c<t.length+1&&(a.push({neighbor:c,weight:(i-u)**2}),!(u>l||c===t.length));c+=1)u+=e/r(t[c])+n+2*o;return a}}({photos:t,targetColumnWidth:o,targetColumnHeight:c,spacing:i,padding:s}),p=g(h,e,0,t.length);for(let n=0;n<p.length-1;n+=1){const o=t.slice(p[n],p[n+1]);l[n]=i*(o.length-1)+2*s*o.length,u[n]=1/o.reduce(((t,n)=>t+1/r(n)),0)}return{columnsGaps:l,columnsRatios:u,columnsModel:f({path:p,photos:t,columnsRatios:u,columnsGaps:l,containerWidth:a,spacing:i,padding:s})}}function w(t){const{photos:n,layoutOptions:o}=t,{columns:e,spacing:r,padding:i,containerWidth:s}=o,a=(s-r*(e-1)-2*i*e)/e,{columnsGaps:l,columnsRatios:u,columnsModel:c}=y({photos:n,layoutOptions:o,targetColumnWidth:a});return c.findIndex((t=>t.findIndex((({layout:{width:t,height:n}})=>t<0||n<0))>=0))>=0?e>1?w({photos:n,layoutOptions:{...o,columns:e-1}}):void 0:{columnsModel:c,columnsGaps:l,columnsRatios:u}}function C({photos:t,layoutOptions:n}){return w({photos:t,layoutOptions:n})}function v({columnContainerProps:t,children:n}){return e.createElement("div",{...t},n)}function R(t){const{layoutOptions:n,columnIndex:o,columnsCount:e,columnsGaps:r,columnsRatios:s}=t,{layout:a,spacing:l,padding:u}=n;if("masonry"===a||!r||!s)return`calc((100% - ${l*(e-1)}px) / ${e})`;const c=s.reduce(((t,n)=>t+n),0),h=s.reduce(((t,n,e)=>t+(r[o]-r[e])*n),0);return`calc((100% - ${i((e-1)*l+2*e*u+h,3)}px) * ${i(s[o]/c,5)} + ${2*u}px)`}function ColumnContainerRenderer(t){const{layoutOptions:n,renderColumnContainer:o,children:r,columnContainerProps:{style:i,...s}={},...a}=t,l={className:"react-photo-album--column",style:{display:"flex",flexDirection:"column",flexWrap:"nowrap",alignItems:"flex-start",width:R(t),justifyContent:"columns"===n.layout?"space-between":"flex-start",...i},...s};return e.createElement(e.Fragment,null,(null!=o?o:v)({layoutOptions:n,columnContainerProps:l,children:r,...a}))}function ColumnsLayout(t){const{photos:n,layoutOptions:o,renderPhoto:r,renderColumnContainer:i,componentsProps:s}=t,a=C({photos:n,layoutOptions:o});if(!a)return null;const{columnsModel:l,columnsRatios:u,columnsGaps:c}=a;return e.createElement(e.Fragment,null,l.map(((t,n)=>e.createElement(ColumnContainerRenderer,{key:`column-${n}`,layoutOptions:o,columnIndex:n,columnsCount:l.length,columnsGaps:c,columnsRatios:u,renderColumnContainer:i,columnContainerProps:null==s?void 0:s.columnContainerProps},t.map((({photo:t,layout:n})=>e.createElement(PhotoRenderer,{key:t.key||t.src,photo:t,layout:n,layoutOptions:o,renderPhoto:r,imageProps:null==s?void 0:s.imageProps})))))))}function x(t){const{photos:n,layoutOptions:o}=t,{columns:e,spacing:i,padding:s,containerWidth:a}=o,l=(a-i*(e-1)-2*s*e)/e;if(l<=0)return e>1?x({...t,layoutOptions:{...o,columns:e-1}}):void 0;const u=[];for(let t=0;t<e;t+=1)u[t]=0;return n.reduce(((t,n,o)=>{const e=u.reduce(((t,n,o)=>n<u[t]-1?o:t),0);return u[e]=u[e]+l/r(n)+i+2*s,t[e].push({photo:n,index:o}),t}),Array.from({length:e}).map((()=>[]))).map((t=>t.map((({photo:n,index:o},e)=>({photo:n,layout:{width:l,height:l/r(n),index:o,photoIndex:e,photosCount:t.length}})))))}function MasonryLayout(t){const{photos:n,layoutOptions:o,renderPhoto:r,renderColumnContainer:i,componentsProps:s}=t,a=x({photos:n,layoutOptions:o});return a?e.createElement(e.Fragment,null,a.map(((t,n)=>e.createElement(ColumnContainerRenderer,{key:`masonry-column-${n}`,layoutOptions:o,columnsCount:a.length,columnIndex:n,renderColumnContainer:i,columnContainerProps:null==s?void 0:s.columnContainerProps},t.map((({photo:t,layout:n})=>e.createElement(PhotoRenderer,{key:t.key||t.src,photo:t,layout:n,layoutOptions:o,renderPhoto:r,imageProps:null==s?void 0:s.imageProps}))))))):null}function P({containerProps:t,children:n,containerRef:o}){return e.createElement("div",{ref:o,...t},n)}function ContainerRenderer(t){const{layout:n,renderContainer:o,children:r,containerRef:i,containerProps:{style:s,...a}={}}=t,l={className:`react-photo-album react-photo-album--${n}`,style:{display:"flex",flexWrap:"nowrap",justifyContent:"space-between",flexDirection:"rows"===n?"column":"row",...s},...a};return e.createElement(e.Fragment,null,(null!=o?o:P)({containerProps:l,containerRef:i,layout:n,children:r}))}function W(t,{newContainerWidth:n,newScrollbarWidth:o}){const{containerWidth:e,scrollbarWidth:r}=t;return void 0!==e&&void 0!==r&&void 0!==n&&void 0!==o&&n>e&&n-e<=20&&o<r?{containerWidth:e,scrollbarWidth:o}:e!==n||r!==o?{containerWidth:n,scrollbarWidth:o}:t}function b(t,n){let o=null==t?void 0:t.clientWidth;if(void 0!==o&&n&&n.length>0){const t=[...n.filter((t=>t>0))].sort(((t,n)=>n-t));t.push(Math.floor(t[t.length-1]/2));const e=o;o=t.find(((n,o)=>n<=e||o===t.length-1))}return o}const O=Object.freeze([1200,600,300,0]);function E(t,n){return"function"==typeof t?t(n):t}function k(t,n){return void 0!==t?E(t,n):void 0}function M(t,n,o,e=0){const r=k(t,n);return Math.round(Math.max(void 0===r?function(t,n){const o=O.findIndex((t=>t<=n));return E(t[o>=0?o:0],n)}(o,n):r,e))}function $(t,n,o){const{photos:r,layout:i,renderPhoto:s,renderRowContainer:a,renderColumnContainer:l}=t,u=function({layout:t,onClick:n,containerWidth:o,targetRowHeight:e,rowConstraints:r,columns:i,spacing:s,padding:a,sizes:l}){return{layout:t,onClick:n,containerWidth:o,columns:M(i,o,[5,4,3,2],1),spacing:M(s,o,[20,15,10,5]),padding:M(a,o,[0,0,0,0,0]),targetRowHeight:M(e,o,[t=>t/5,t=>t/4,t=>t/3,t=>t/2]),rowConstraints:k(r,o),sizes:l}}({containerWidth:n,...t}),c={photos:r,renderPhoto:s,componentsProps:o};return"rows"===i?e.createElement(RowsLayout,{layoutOptions:u,renderRowContainer:a,...c}):"columns"===i?e.createElement(ColumnsLayout,{layoutOptions:u,renderColumnContainer:l,...c}):e.createElement(MasonryLayout,{layoutOptions:u,renderColumnContainer:l,...c})}function PhotoAlbum(t){const{photos:n,layout:o,renderContainer:r,defaultContainerWidth:i,breakpoints:s}=t,{containerRef:a,containerWidth:l}=function(t,n){const[{containerWidth:o},r]=e.useReducer(W,{containerWidth:n}),i=e.useRef(null),s=e.useRef();return{containerRef:e.useCallback((n=>{var o;null===(o=s.current)||void 0===o||o.disconnect(),s.current=void 0,i.current=n;const e=()=>r({newContainerWidth:b(i.current,t),newScrollbarWidth:window.innerWidth-document.documentElement.clientWidth});e(),n&&"undefined"!=typeof ResizeObserver&&(s.current=new ResizeObserver(e),s.current.observe(n))}),[t]),containerWidth:o}}(function(t){const n=e.useRef(t);return t&&n.current&&t.join()===n.current.join()||(n.current=t),n.current}(s),i);if(!o||!["rows","columns","masonry"].includes(o)||!Array.isArray(n))return null;const u=function(t,n){return"function"==typeof t?t(n):t}(t.componentsProps,l);return e.createElement(ContainerRenderer,{layout:o,containerRef:a,renderContainer:r,containerProps:null==u?void 0:u.containerProps},l?$(t,l,u):null)}}}]);
Back to Directory
File Manager