/home/silvwabw/public_html/wp-content/plugins/gutenverse/assets/js/frontend/chunk-shufflejs.js
"use strict";(self.webpackChunkgutenverse=self.webpackChunkgutenverse||[]).push([[511],{5217(t,e,i){function s(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}i.r(e),i.d(e,{default:()=>x});var n,o,r,h={exports:{}},l=function(){if(n)return h.exports;function t(){}return n=1,t.prototype={on:function(t,e,i){var s=this.e||(this.e={});return(s[t]||(s[t]=[])).push({fn:e,ctx:i}),this},once:function(t,e,i){var s=this;function n(){s.off(t,n),e.apply(i,arguments)}return n._=e,this.on(t,n,i)},emit:function(t){for(var e=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),s=0,n=i.length;s<n;s++)i[s].fn.apply(i[s].ctx,e);return this},off:function(t,e){var i=this.e||(this.e={}),s=i[t],n=[];if(s&&e)for(var o=0,r=s.length;o<r;o++)s[o].fn!==e&&s[o].fn._!==e&&n.push(s[o]);return n.length?i[t]=n:delete i[t],this}},h.exports=t,h.exports.TinyEmitter=t,h.exports}(),a=s(l),u=s(function(){if(r)return o;function t(){}return r=1,o=function(e,i,s){s||("function"==typeof i?(s=i,i=null):s=t);var n=e&&e.length;if(!n)return s(null,[]);var o=!1,r=new Array(n);function h(t){return function(e,i){if(!o){if(e)return s(e,r),void(o=!0);r[t]=i,--n||s(null,r)}}}e.forEach(i?function(t,e){t.call(i,h(e))}:function(t,e){t(h(e))})}}());function d(t){return parseFloat(t)||0}class c{constructor(t,e){this.x=d(t),this.y=d(e)}static equals(t,e){return t.x===e.x&&t.y===e.y}}class m{constructor(t,e,i,s,n){this.id=n,this.left=t,this.top=e,this.width=i,this.height=s}static intersects(t,e){return t.left<e.left+e.width&&e.left<t.left+t.width&&t.top<e.top+e.height&&e.top<t.top+t.height}}var p={BASE:"shuffle",SHUFFLE_ITEM:"shuffle-item",VISIBLE:"shuffle-item--visible",HIDDEN:"shuffle-item--hidden"};let f=0;class g{constructor(t,e){f+=1,this.id=f,this.element=t,this.isRTL=e,this.isVisible=!0,this.isHidden=!1}show(){this.isVisible=!0,this.element.classList.remove(p.HIDDEN),this.element.classList.add(p.VISIBLE),this.element.removeAttribute("aria-hidden")}hide(){this.isVisible=!1,this.element.classList.remove(p.VISIBLE),this.element.classList.add(p.HIDDEN),this.element.setAttribute("aria-hidden",!0)}init(){this.addClasses([p.SHUFFLE_ITEM,p.VISIBLE]),this.applyCss(g.Css.INITIAL),this.applyCss(this.isRTL?g.Css.DIRECTION.rtl:g.Css.DIRECTION.ltr),this.scale=g.Scale.VISIBLE,this.point=new c}addClasses(t){t.forEach(t=>{this.element.classList.add(t)})}removeClasses(t){t.forEach(t=>{this.element.classList.remove(t)})}applyCss(t){Object.keys(t).forEach(e=>{this.element.style[e]=t[e]})}dispose(){this.removeClasses([p.HIDDEN,p.VISIBLE,p.SHUFFLE_ITEM]),this.element.removeAttribute("style"),this.element=null}}g.Css={INITIAL:{position:"absolute",top:0,visibility:"visible",willChange:"transform"},DIRECTION:{ltr:{left:0},rtl:{right:0}},VISIBLE:{before:{opacity:1,visibility:"visible"},after:{transitionDelay:""}},HIDDEN:{before:{opacity:0},after:{visibility:"hidden",transitionDelay:""}}},g.Scale={VISIBLE:1,HIDDEN:.001};let _=null;var y=()=>{if(null!==_)return _;const t=document.body||document.documentElement,e=document.createElement("div");e.style.cssText="width:10px;padding:2px;box-sizing:border-box;",t.appendChild(e);const{width:i}=window.getComputedStyle(e,null);return _=10===Math.round(d(i)),t.removeChild(e),_};function I(t,e,i=window.getComputedStyle(t,null)){let s=d(i[e]);return y()||"width"!==e?y()||"height"!==e||(s+=d(i.paddingTop)+d(i.paddingBottom)+d(i.borderTopWidth)+d(i.borderBottomWidth)):s+=d(i.paddingLeft)+d(i.paddingRight)+d(i.borderLeftWidth)+d(i.borderRightWidth),s}const E={reverse:!1,by:null,compare:null,randomize:!1,key:"element"};function b(t,e){const i={...E,...e},s=Array.from(t);let n=!1;return t.length?i.randomize?function(t){let e=t.length;for(;e;){e-=1;const i=Math.floor(Math.random()*(e+1)),s=t[i];t[i]=t[e],t[e]=s}return t}(t):("function"==typeof i.by?t.sort((t,e)=>{if(n)return 0;const s=i.by(t[i.key]),o=i.by(e[i.key]);return void 0===s&&void 0===o?(n=!0,0):s<o||"sortFirst"===s||"sortLast"===o?-1:s>o||"sortLast"===s||"sortFirst"===o?1:0}):"function"==typeof i.compare&&t.sort(i.compare),n?s:(i.reverse&&t.reverse(),t)):[]}const T={},v="transitionend";let S=0;function C(t){return!!T[t]&&(T[t].element.removeEventListener(v,T[t].listener),T[t]=null,!0)}function L(t){return Math.max(...t)}function w(t,e,i,s){let n=t/e;return Math.abs(Math.round(n)-n)<s&&(n=Math.round(n)),Math.min(Math.ceil(n),i)}function D(t,e,i){if(1===e)return t;const s=[];for(let n=0;n<=i-e;n++)s.push(L(t.slice(n,n+e)));return s}function z(t,e){const i=(s=t,Math.min(...s));var s;for(let s=0,n=t.length;s<n;s++)if(t[s]>=i-e&&t[s]<=i+e)return s;return 0}function A(t,e){const i={};t.forEach(t=>{i[t.top]?i[t.top].push(t):i[t.top]=[t]});let s=[];const n=[],o=[];return Object.keys(i).forEach(t=>{const r=i[t];n.push(r);const h=r[r.length-1],l=h.left+h.width,a=Math.round((e-l)/2);let u=r,d=!1;if(a>0){const t=[];d=r.every(e=>{const i=new m(e.left+a,e.top,e.width,e.height,e.id),n=!s.some(t=>m.intersects(i,t));return t.push(i),n}),d&&(u=t)}if(!d){let t;if(r.some(e=>s.some(i=>{const s=m.intersects(e,i);return s&&(t=i),s}))){const e=o.findIndex(e=>e.includes(t));o.splice(e,1,n[e])}}s=s.concat(u),o.push(u)}),o.flat().sort((t,e)=>t.id-e.id).map(t=>new c(t.left,t.top))}function M(t){return Array.from(new Set(t))}let F=0;class x extends a{constructor(t,e={}){super(),this.options={...x.options,...e},this.lastSort={},this.group=x.ALL_ITEMS,this.lastFilter=x.ALL_ITEMS,this.isEnabled=!0,this.isDestroyed=!1,this.isInitialized=!1,this._transitions=[],this.isTransitioning=!1,this._queue=[];const i=this._getElementOption(t);if(!i)throw new TypeError("Shuffle needs to be initialized with an element.");this.element=i,this.id=`shuffle_${F}`,F+=1,this._init(),this.isInitialized=!0}_init(){if(this.items=this._getItems(),this.sortedItems=this.items,this.options.sizer=this._getElementOption(this.options.sizer),this.element.classList.add(x.Classes.BASE),this._initItems(this.items),"complete"!==document.readyState){const t=this.layout.bind(this);window.addEventListener("load",function e(){window.removeEventListener("load",e),t()})}const t=window.getComputedStyle(this.element,null),e=x.getSize(this.element).width;this._validateStyles(t),this._setColumns(e),this.filter(this.options.group,this.options.initialSort),this._rafId=null,"ResizeObserver"in window&&(this._resizeObserver=new ResizeObserver(this._handleResizeCallback.bind(this)),this._resizeObserver.observe(this.element)),this.element.offsetWidth,this.setItemTransitions(this.items),this.element.style.transition=`height ${this.options.speed}ms ${this.options.easing}`}_getElementOption(t){return"string"==typeof t?this.element.querySelector(t):t&&t.nodeType&&1===t.nodeType?t:t&&t.jquery?t[0]:null}_validateStyles(t){"static"===t.position&&(this.element.style.position="relative"),"hidden"!==t.overflow&&(this.element.style.overflow="hidden")}_filter(t=this.lastFilter,e=this.items){const i=this._getFilteredSets(t,e);return this._toggleFilterClasses(i),this.lastFilter=t,"string"==typeof t&&(this.group=t),i}_getFilteredSets(t,e){let i=[];const s=[];return t===x.ALL_ITEMS?i=e:e.forEach(e=>{this._doesPassFilter(t,e.element)?i.push(e):s.push(e)}),{visible:i,hidden:s}}_doesPassFilter(t,e){if("function"==typeof t)return t.call(e,e,this);const i=e.dataset[x.FILTER_ATTRIBUTE_KEY],s=this.options.delimiter?i.split(this.options.delimiter):JSON.parse(i);function n(t){return s.includes(t)}return Array.isArray(t)?this.options.filterMode===x.FilterMode.ANY?t.some(n):t.every(n):s.includes(t)}_toggleFilterClasses({visible:t,hidden:e}){t.forEach(t=>{t.show()}),e.forEach(t=>{t.hide()})}_initItems(t){t.forEach(t=>{t.init()})}_disposeItems(t){t.forEach(t=>{t.dispose()})}_updateItemCount(){this.visibleItems=this._getFilteredItems().length}setItemTransitions(t){const{speed:e,easing:i}=this.options,s=this.options.useTransforms?["transform"]:["top","left"],n=Object.keys(g.Css.HIDDEN.before).map(t=>t.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)),o=s.concat(n).join();t.forEach(t=>{t.element.style.transitionDuration=`${e}ms`,t.element.style.transitionTimingFunction=i,t.element.style.transitionProperty=o})}_getItems(){return Array.from(this.element.children).filter(t=>t.matches(this.options.itemSelector)).map(t=>new g(t,this.options.isRTL))}_mergeNewItems(t){const e=Array.from(this.element.children);return b(this.items.concat(t),{by:t=>e.indexOf(t)})}_getFilteredItems(){return this.items.filter(t=>t.isVisible)}_getConcealedItems(){return this.items.filter(t=>!t.isVisible)}_getColumnSize(t,e){let i;return i="function"==typeof this.options.columnWidth?this.options.columnWidth(t):this.options.sizer?x.getSize(this.options.sizer).width:this.options.columnWidth?this.options.columnWidth:this.items.length>0?x.getSize(this.items[0].element,!0).width:t,0===i&&(i=t),i+e}_getGutterSize(t){let e;return e="function"==typeof this.options.gutterWidth?this.options.gutterWidth(t):this.options.sizer?I(this.options.sizer,"marginLeft"):this.options.gutterWidth,e}_setColumns(t=x.getSize(this.element).width){const e=this._getGutterSize(t),i=this._getColumnSize(t,e);let s=(t+e)/i;Math.abs(Math.round(s)-s)<this.options.columnThreshold&&(s=Math.round(s)),this.cols=Math.max(Math.floor(s||0),1),this.containerWidth=t,this.colWidth=i}_setContainerSize(){this.element.style.height=`${this._getContainerSize()}px`}_getContainerSize(){return L(this.positions)}_getStaggerAmount(t){return Math.min(t*this.options.staggerAmount,this.options.staggerAmountMax)}_dispatch(t,e={}){this.isDestroyed||(e.shuffle=this,this.emit(t,e))}_resetCols(){let t=this.cols;for(this.positions=[];t;)t-=1,this.positions.push(0)}_layout(t){const e=this._getNextPositions(t);let i=0;t.forEach((t,s)=>{function n(){t.applyCss(g.Css.VISIBLE.after)}if(c.equals(t.point,e[s])&&!t.isHidden)return t.applyCss(g.Css.VISIBLE.before),void n();t.point=e[s],t.scale=g.Scale.VISIBLE,t.isHidden=!1;const o=this.getStylesForTransition(t,g.Css.VISIBLE.before);o.transitionDelay=`${this._getStaggerAmount(i)}ms`,this._queue.push({item:t,styles:o,callback:n}),i+=1})}_getNextPositions(t){if(this.options.isCentered){const e=t.map((t,e)=>{const i=x.getSize(t.element,!0),s=this._getItemPosition(i);return new m(s.x,s.y,i.width,i.height,e)});return this.getTransformedPositions(e,this.containerWidth)}return t.map(t=>this._getItemPosition(x.getSize(t.element,!0)))}_getItemPosition(t){return function({itemSize:t,positions:e,gridSize:i,total:s,threshold:n,buffer:o}){const r=w(t.width,i,s,n),h=D(e,r,s),l=z(h,o),a=new c(i*l,h[l]),u=h[l]+t.height;for(let t=0;t<r;t++)e[l+t]=u;return a}({itemSize:t,positions:this.positions,gridSize:this.colWidth,total:this.cols,threshold:this.options.columnThreshold,buffer:this.options.buffer})}getTransformedPositions(t,e){return A(t,e)}_shrink(t=this._getConcealedItems()){let e=0;t.forEach(t=>{function i(){t.applyCss(g.Css.HIDDEN.after)}if(t.isHidden)return t.applyCss(g.Css.HIDDEN.before),void i();t.scale=g.Scale.HIDDEN,t.isHidden=!0;const s=this.getStylesForTransition(t,g.Css.HIDDEN.before);s.transitionDelay=`${this._getStaggerAmount(e)}ms`,this._queue.push({item:t,styles:s,callback:i}),e+=1})}_handleResizeCallback(t){if(this.isEnabled&&!this.isDestroyed)for(const e of t)Math.round(e.contentRect.width)!==Math.round(this.containerWidth)&&(cancelAnimationFrame(this._rafId),this._rafId=requestAnimationFrame(this.update.bind(this)))}getStylesForTransition(t,e){const i={...e};if(this.options.useTransforms){const e=this.options.isRTL?"-":"",s=this.options.roundTransforms?Math.round(t.point.x):t.point.x,n=this.options.roundTransforms?Math.round(t.point.y):t.point.y;i.transform=`translate(${e}${s}px, ${n}px) scale(${t.scale})`}else this.options.isRTL?i.right=`${t.point.x}px`:i.left=`${t.point.x}px`,i.top=`${t.point.y}px`;return i}_whenTransitionDone(t,e,i){const s=function(t,e){const i=(S+=1,v+S),s=t=>{t.currentTarget===t.target&&(C(i),e(t))};return t.addEventListener(v,s),T[i]={element:t,listener:s},i}(t,t=>{e(),i(null,t)});this._transitions.push(s)}_getTransitionFunction(t){return e=>{t.item.applyCss(t.styles),this._whenTransitionDone(t.item.element,t.callback,e)}}_processQueue(){this.isTransitioning&&this._cancelMovement();const t=this.options.speed>0,e=this._queue.length>0;e&&t&&this.isInitialized?this._startTransitions(this._queue):e?(this._styleImmediately(this._queue),this._dispatch(x.EventType.LAYOUT)):this._dispatch(x.EventType.LAYOUT),this._queue.length=0}_startTransitions(t){this.isTransitioning=!0;const e=t.map(t=>this._getTransitionFunction(t));u(e,this._movementFinished.bind(this))}_cancelMovement(){this._transitions.forEach(C),this._transitions.length=0,this.isTransitioning=!1}_styleImmediately(t){if(t.length){const e=t.map(t=>t.item.element);x._skipTransitions(e,()=>{t.forEach(t=>{t.item.applyCss(t.styles),t.callback()})})}}_movementFinished(){this._transitions.length=0,this.isTransitioning=!1,this._dispatch(x.EventType.LAYOUT)}filter(t,e){this.isEnabled&&((!t||t&&0===t.length)&&(t=x.ALL_ITEMS),this._filter(t),this._shrink(),this._updateItemCount(),this.sort(e))}sort(t=this.lastSort){if(!this.isEnabled)return;this._resetCols();const e=b(this._getFilteredItems(),t);this.sortedItems=e,this._layout(e),this._processQueue(),this._setContainerSize(),this.lastSort=t}update({recalculateSizes:t=!0,force:e=!1}={}){(this.isEnabled||e)&&(t&&this._setColumns(),this.sort())}layout(){this.update({recalculateSizes:!0})}add(t){const e=M(t).map(t=>new g(t,this.options.isRTL));this._initItems(e),this._resetCols();const i=b(this._mergeNewItems(e),this.lastSort),s=this._filter(this.lastFilter,i),n=t=>e.includes(t),o=t=>{t.scale=g.Scale.HIDDEN,t.isHidden=!0,t.applyCss(g.Css.HIDDEN.before),t.applyCss(g.Css.HIDDEN.after)},r=this._getNextPositions(s.visible);s.visible.forEach((t,e)=>{n(t)&&(t.point=r[e],o(t),t.applyCss(this.getStylesForTransition(t,{})))}),s.hidden.forEach(t=>{n(t)&&o(t)}),this.element.offsetWidth,this.setItemTransitions(e),this.items=this._mergeNewItems(e),this.filter(this.lastFilter)}disable(){this.isEnabled=!1}enable(t=!0){this.isEnabled=!0,t&&this.update()}remove(t){if(!t.length)return;const e=M(t),i=e.map(t=>this.getItemByElement(t)).filter(t=>!!t);this._toggleFilterClasses({visible:[],hidden:i}),this._shrink(i),this.sort(),this.items=this.items.filter(t=>!i.includes(t)),this._updateItemCount(),this.once(x.EventType.LAYOUT,()=>{this._disposeItems(i),e.forEach(t=>{t.parentNode.removeChild(t)}),this._dispatch(x.EventType.REMOVED,{collection:e})})}getItemByElement(t){return this.items.find(e=>e.element===t)}resetItems(){this._disposeItems(this.items),this.isInitialized=!1,this.items=this._getItems(),this._initItems(this.items),this.once(x.EventType.LAYOUT,()=>{this.setItemTransitions(this.items),this.isInitialized=!0}),this.filter(this.lastFilter)}destroy(){this._cancelMovement(),this._resizeObserver&&(this._resizeObserver.unobserve(this.element),this._resizeObserver=null),this.element.classList.remove("shuffle"),this.element.removeAttribute("style"),this._disposeItems(this.items),this.items.length=0,this.sortedItems.length=0,this._transitions.length=0,this.options.sizer=null,this.element=null,this.isDestroyed=!0,this.isEnabled=!1}static getSize(t,e=!1){const i=window.getComputedStyle(t,null);let s=I(t,"width",i),n=I(t,"height",i);return e&&(s+=I(t,"marginLeft",i)+I(t,"marginRight",i),n+=I(t,"marginTop",i)+I(t,"marginBottom",i)),{width:s,height:n}}static _skipTransitions(t,e){const i=t.map(t=>{const{style:e}=t,i=e.transitionDuration,s=e.transitionDelay;return e.transitionDuration="0ms",e.transitionDelay="0ms",{duration:i,delay:s}});e(),t[0].offsetWidth,t.forEach((t,e)=>{t.style.transitionDuration=i[e].duration,t.style.transitionDelay=i[e].delay})}}x.ShuffleItem=g,x.ALL_ITEMS="all",x.FILTER_ATTRIBUTE_KEY="groups",x.EventType={LAYOUT:"shuffle:layout",REMOVED:"shuffle:removed"},x.Classes=p,x.FilterMode={ANY:"any",ALL:"all"},x.options={group:x.ALL_ITEMS,speed:250,easing:"cubic-bezier(0.4, 0.0, 0.2, 1)",itemSelector:"*",sizer:null,gutterWidth:0,columnWidth:0,delimiter:null,buffer:0,columnThreshold:.01,initialSort:null,staggerAmount:15,staggerAmountMax:150,useTransforms:!0,filterMode:x.FilterMode.ANY,isCentered:!1,isRTL:!1,roundTransforms:!0},x.Point=c,x.Rect=m,x.__sorter=b,x.__getColumnSpan=w,x.__getAvailablePositions=D,x.__getShortColumn=z,x.__getCenteredPositions=A}}]);