\n `;const s=document.getElementById("slpht-mobile-photo");if(s){s.innerHTML=n;const e=s.getElementsByClassName("slpht-modal-content");for(const n of e)n.addEventListener("click",function(){i(t,o)})}const l=document.getElementById("slpht-tablet-photo");if(l){l.innerHTML=n;const e=l.getElementsByClassName("slpht-modal-content");for(const n of e)n.addEventListener("click",function(){i(t,o)})}const a=document.getElementById("slpht-desktop-modal-photo");if(a){a.innerHTML=n;const s=a.getElementsByClassName("slpht-modal-content");for(const e of s)e.addEventListener("click",function(){i(t,o)});e()&&console.log("safari")}}function f(t,e){let o="";o=t.show_caption&&e.caption&&e.caption.length>0?`${e.caption}`:"";const n=document.getElementById("slpht-mobile-caption");n&&(n.innerHTML=o);const s=document.getElementById("slpht-tablet-caption");s&&(s.innerHTML=o);const l=document.getElementById("slpht-desktop-caption");l&&(l.innerHTML=o)}function g(t,e){const o=document.getElementById("slpht-mobile-products");o&&(o.innerHTML=r(t,e));const n=document.getElementById("slpht-tablet-products");n&&(n.innerHTML=h(t,e));const s=document.getElementById("slpht-desktop-products");s&&(s.innerHTML=m(t,e));const i=document.getElementsByClassName("slpht-mobile-product");for(const o of i)o.addEventListener("click",function(o){l(o,t,e)},!1);const a=document.getElementsByClassName("slpht-tablet-product");for(const o of a)o.addEventListener("click",function(o){l(o,t,e)},!1);const d=document.getElementsByClassName("slpht-product");for(const o of d)o.addEventListener("click",function(o){l(o,t,e)},!1)}function y(t,e){const o=parseInt(e),l=t.empty_photos[o],i=t.empty_photos.length;n(t,l),b(t),s(t,l),u(t,l),f(t,l);let a=o-1;a<0&&(a=i-1);let d=o+1;d>=i&&(d=0);const c=document.getElementById("slpht-mobile-modal-prev"),p=document.getElementById("slpht-mobile-modal-next");c&&c.setAttribute("data-id",a.toString()),p&&p.setAttribute("data-id",d.toString());const r=document.getElementById("slpht-tablet-modal-prev"),h=document.getElementById("slpht-tablet-modal-next");r&&r.setAttribute("data-id",a.toString()),h&&h.setAttribute("data-id",d.toString());const m=document.getElementById("slpht-desktop-modal-prev"),g=document.getElementById("slpht-desktop-modal-next");m&&m.setAttribute("data-id",a.toString()),g&&g.setAttribute("data-id",d.toString())}function b(t){if(t.show_modal_submit_button);else{const t=document.getElementById("slpht-mobile-modal-upload");t&&(t.style.display="none");const e=document.getElementById("slpht-tablet-modal-upload");e&&(e.style.display="none");const o=document.getElementById("slpht-desktop-modal-upload");o&&(o.style.display="none")}}function _(t,e){const o=parseInt(e),l=t.pics[o],i=t.pics.length;n(t,l),b(t),s(t,l),u(t,l),f(t,l),g(t,l);let d=o-1;d<0&&(d=i-1);let c=o+1;c>=i&&(c=0);const p=document.getElementById("slpht-mobile-modal-prev"),r=document.getElementById("slpht-mobile-modal-next");p&&p.setAttribute("data-id",d.toString()),r&&r.setAttribute("data-id",c.toString());const h=document.getElementById("slpht-tablet-modal-prev"),m=document.getElementById("slpht-tablet-modal-next");h&&h.setAttribute("data-id",d.toString()),m&&m.setAttribute("data-id",c.toString());const y=document.getElementById("slpht-desktop-modal-prev"),_=document.getElementById("slpht-desktop-modal-next");y&&y.setAttribute("data-id",d.toString()),_&&_.setAttribute("data-id",c.toString()),a(t,l)}function v(){document.body.classList.remove("slpht-modal-open");const t=document.getElementById("slpht-mobile-modal");t&&t.remove();const e=document.getElementById("slpht-tablet-modal");e&&e.remove();const o=document.getElementById("slpht-desktop-modal");o&&o.remove()}function k(t){const e=document.getElementById("socialphotos-root"),o=Q(t);e.insertAdjacentHTML("afterbegin",o),v(),document.body.classList.add("slpht-modal-open"),document.getElementById("socialphotos-upload-modal").classList.add("in"),document.getElementById("slpht-close").addEventListener("click",function(){w()}),window.addEventListener?window.addEventListener("message",function(t){"queuecomplete"==t.data.status&&w()},!1):window.attachEvent("onmessage",function(t){"queuecomplete"==t.data.status&&w()});const n=document.getElementById("upload-iframe").contentWindow;setInterval(function(){n.postMessage("messageFromSocialphotos","https://socialphotosapp.com")},1e3)}function w(){document.body.classList.remove("slpht-modal-open");const t=document.getElementById("socialphotos-upload-modal");t&&t.remove()}function E(t,e){fetch("/cart.json",{keepalive:!0}).then(t=>t.json()).then(o=>{if(null!=o.token){const n=o.token;return t.cart_token=n,I(t,e)}})}function I(t,e){let o;switch(e){case 1:o="https://socialphotosapp.com/widget/track_product_views";break;case 2:case 3:o="https://socialphotosapp.com/widget/track_gallery_views";break;case"instagram-post-gallery":case"instagram-hashtag-gallery":return}fetch(o,{method:"POST",mode:"cors",credentials:"omit",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>t.json()).then(()=>{})["catch"](t=>console.error("error:",t))}function $(t,e){let o=X[t];if(o.use_empty_state&&o.pics.lengtho.mobile_offset_total)return;const s=o.mobile_offset*o.mobile_limit-o.mobile_limit,l=o.mobile_offset*o.mobile_limit-1,i=o.pics.slice(s,+l+1||undefined);let a="";const c="https://media-prod.slpht.net/image-loading-gif.gif";for(const e of i){a+=`\n
\n \n
\n `}const p=document.getElementById(`slpht-mobile-thumbnails-${t}`);p.insertAdjacentHTML("beforeend",a);const r=p.querySelectorAll(".slpht-thumbnail");for(const t of r){const e=t.querySelector(".socialphotos-view").dataset.id,n=o.pics.findIndex(t=>t.id==e),s=o.pics[n];!0!==s.clickMobileBounded&&(t.addEventListener("click",function(){d(o),_(o,n)},!1),s.clickMobileBounded=!0)}}function B(t,e){let o=X[t];if(o.use_empty_state&&o.pics.lengtho.tablet_offset_total)return;const s=o.tablet_offset*o.tablet_limit-o.tablet_limit,l=o.tablet_offset*o.tablet_limit-1,i=o.pics.slice(s,+l+1||undefined);let a="";const c="https://media-prod.slpht.net/image-loading-gif.gif";for(const e of i){a+=`\n
\n \n
\n `}const p=document.getElementById(`slpht-tablet-thumbnails-${t}`);p.insertAdjacentHTML("beforeend",a);const r=p.querySelectorAll(".slpht-thumbnail");for(const t of r){const e=t.querySelector(".socialphotos-view").dataset.id,n=o.pics.findIndex(t=>t.id==e),s=o.pics[n];0==s.clickTabletBounded&&(t.addEventListener("click",function(){d(o),_(o,n)},!1),s.clickTabletBounded=!0)}}function L(t,e){const o=t.empty_photos.slice(0,t.photos_per_row_mobile);let n="";const s=document.getElementById(`slpht-mobile-load-more-${e}`);s&&(s.style.display="none");const l=document.getElementById(`slpht-mobile-prev-${e}`);l&&(l.style.display="none");const i=document.getElementById(`slpht-mobile-next-${e}`);i&&(i.style.display="none");for(const t of o){n+=`\n
\n \n \n
\n `}const a=document.getElementById(`slpht-mobile-thumbnails-${e}`);a.innerHTML=n;const d=a.querySelectorAll(".slpht-thumbnail");for(const e of d){const o=e.querySelector(".socialphotos-view").dataset.id,n=t.empty_photos.findIndex(t=>t.id==o);e.addEventListener("click",function(){c(t),y(t,n)},!1)}}function S(t,e){const o=t.empty_photos.slice(0,t.photos_per_row_tablet);let n="";const s=document.getElementById(`slpht-tablet-load-more-${e}`);s&&(s.style.display="none");const l=document.getElementById(`slpht-tablet-prev-${e}`);l&&(l.style.display="none");const i=document.getElementById(`slpht-tablet-next-${e}`);i&&(i.style.display="none");for(const t of o){n+=`\n
\n \n \n
\n `}const a=document.getElementById(`slpht-tablet-thumbnails-${e}`);a.innerHTML=n;const d=a.querySelectorAll(".slpht-thumbnail");for(const e of d){const o=e.querySelector(".socialphotos-view").dataset.id,n=t.empty_photos.findIndex(t=>t.id==o);e.addEventListener("click",function(){c(t),y(t,n)},!1)}}function x(t,e){const o=t.empty_photos.slice(0,t.photos_per_row_desktop);let n="";const s=document.getElementById(`slpht-desktop-load-more-${e}`);s&&(s.style.display="none");const l=document.getElementById(`slpht-desktop-prev-${e}`);l&&(l.style.display="none");const i=document.getElementById(`slpht-desktop-next-${e}`);i&&(i.style.display="none");for(const t of o){n+=`\n
\n \n \n
\n `}const a=document.getElementById(`slpht-desktop-thumbnails-${e}`);a.innerHTML=n;const d=a.querySelectorAll(".slpht-thumbnail");for(const e of d){const o=e.querySelector(".socialphotos-view").dataset.id,n=t.empty_photos.findIndex(t=>t.id==o);e.addEventListener("click",function(){c(t),y(t,n)},!1)}}function T(t,e){const o=X[t];if(o.use_empty_state&&o.pics.lengtho.desktop_offset_total)return;const s=o.desktop_offset*o.desktop_limit-o.desktop_limit,l=o.desktop_offset*o.desktop_limit-1,i=o.pics.slice(s,+l+1||undefined);let a="";for(const e of i){a+=`\n
\n \n
\n `}const c=document.getElementById(`slpht-desktop-thumbnails-${t}`);if(null==c)return;c.insertAdjacentHTML("beforeend",a);const p=c.querySelectorAll(".slpht-thumbnail");for(const t of p){const e=t.querySelector(".socialphotos-view").dataset.id,n=o.pics.findIndex(t=>t.id==e),s=o.pics[n];if(0==s.clickDesktopBounded&&(t.addEventListener("click",function(){d(o),_(o,n)},!1),s.clickDesktopBounded=!0),t.querySelector(".spw-thumbnail-overlay"));else{const e='';t.insertAdjacentHTML("afterbegin",e);const n=`\n
\n ${o.action}\n
\n `;null!=o.products[s.permalink]&&o.action.length>0&&t.insertAdjacentHTML("afterbegin",n)}}}function j(t,e){let o=X[t];const n=o.pics.length,s=o.mobile_limit;if(o.use_empty_state&&n1&&(o.mobile_offset-=1),"timer"===e&&(o.mobile_offset+1<=o.mobile_offset_total?o.mobile_offset+=1:o.mobile_offset=1);const l=document.getElementById(`slpht-mobile-prev-${t}`),i=document.getElementById(`slpht-mobile-next-${t}`);if(0==(0|o.mobile_offset_total)?(l.style.display="none",i.style.display="none"):(1==(0|o.mobile_offset)?l.style.display="none":l.style.display="block",(0|o.mobile_offset)==(0|o.mobile_offset_total)?i.style.display="none":i.style.display="block"),o.mobile_offset>o.mobile_offset_total)return;const a=o.mobile_offset*s-s,c=o.mobile_offset*s;let p=o.pics.slice(a,c);p.length\n \n \n `}const h=document.getElementById(`slpht-mobile-thumbnails-${t}`);h.innerHTML=r;const m=h.querySelectorAll(".slpht-thumbnail");for(const t of m){const e=t.querySelector(".socialphotos-view").dataset.id,n=o.pics.findIndex(t=>t.id==e);t.addEventListener("click",function(){clearInterval(o.mobileTimer),d(o),_(o,n)},!1)}}function C(t,e){let o=X[t];const n=o.pics.length,s=o.tablet_limit;if(o.use_empty_state&&n1&&(o.tablet_offset-=1),"timer"===e&&(o.tablet_offset+1<=o.tablet_offset_total?o.tablet_offset+=1:o.tablet_offset=1);const l=document.getElementById(`slpht-tablet-prev-${t}`),i=document.getElementById(`slpht-tablet-next-${t}`);if(0==(0|o.tablet_offset_total)?(l.style.display="none",i.style.display="none"):(1==(0|o.tablet_offset)?l.style.display="none":l.style.display="block",(0|o.tablet_offset)==(0|o.tablet_offset_total)?i.style.display="none":i.style.display="block"),o.tablet_offset>o.tablet_offset_total)return;const a=o.tablet_offset*s-s,c=o.tablet_offset*s;let p=o.pics.slice(a,c);p.length\n \n \n `}const h=document.getElementById(`slpht-tablet-thumbnails-${t}`);h.innerHTML=r;const m=h.querySelectorAll(".slpht-thumbnail");for(const t of m){const e=t.querySelector(".socialphotos-view").dataset.id,n=o.pics.findIndex(t=>t.id==e);t.addEventListener("click",function(){clearInterval(o.tabletTimer),d(o),_(o,n)},!1)}}function A(t,e){let o=X[t];const n=o.pics.length,s=o.desktop_limit;if(o.use_empty_state&&n1&&(o.desktop_offset-=1),"timer"===e&&(o.desktop_offset+1<=o.desktop_offset_total?o.desktop_offset+=1:o.desktop_offset=1);const l=document.getElementById(`slpht-desktop-prev-${t}`),i=document.getElementById(`slpht-desktop-next-${t}`);if(0==(0|o.desktop_offset_total)?(l.style.display="none",i.style.display="none"):(1==(0|o.desktop_offset)?l.style.display="none":l.style.display="block",(0|o.desktop_offset)==(0|o.desktop_offset_total)?i.style.display="none":i.style.display="block"),o.desktop_offset>o.desktop_offset_total)return;const a=o.desktop_offset*s-s,c=o.desktop_offset*s;let p=o.pics.slice(a,c);p.length\n \n \n `}const h=document.getElementById(`slpht-desktop-thumbnails-${t}`);h.innerHTML=r;const m=h.querySelectorAll(".slpht-thumbnail");for(const t of m){const e=t.querySelector(".socialphotos-view").dataset.id,n=o.pics.findIndex(t=>t.id==e),s=o.pics[n];if(t.addEventListener("click",function(){clearInterval(o.desktopTimer),d(o),_(o,n)},!1),t.querySelector(".spw-thumbnail-overlay"));else{const e='';t.insertAdjacentHTML("afterbegin",e);const n=`\n
\n `}console.log("Create Social Proof from UGC (User-generated Content)! Get Socialphotos app at https://apps.shopify.com/social-photos");const V=function(t,e,o,n,s){const l=document.createElement(e);return l.setAttribute("type",o),l.setAttribute("id",t),l.setAttribute("rel",s),l.setAttribute("href",n),document.getElementsByTagName("head")[0].appendChild(l),l};const X={};let Y=0;const Z="https://media-prod.slpht.net/image-loading-gif.gif",tt=function(t,e,o){let n=null;return function(){return clearTimeout(n),n=setTimeout(()=>t(o),e)}};(function(){"loading"!==document.readyState?F():document.addEventListener("DOMContentLoaded",function(){F()})})()}();