(()=>{class t{constructor(t){this.apiHost="https://d3ejra0xbg20rg.cloudfront.net",this.section=t,this.settings=JSON.parse(this.section.getAttribute("data-section-settings")),this.initSection()}onUnload(){}async initSection(){let t=this.section.querySelector("[data-media-template]");if(!t)return void console.warn('No template has been provided. Make sure that you have added the "data-media-template" attribute to the "template" element');this.injectThemeStyles();let e=[];try{e=await this.loadMedia()}catch(t){return void(Shopify.designMode?this.section.querySelector(".ooo-instagram-feed__list").outerHTML=`\n
${t}
\n `:(this.section.parentElement.style.display="none",console.warn("An error occurred while retrieving images from Instagram. The section has been hidden.")))}this.removePlaceholders(),this.buildTemplateFromMedia(t,e)}async loadMedia(){let t=await fetch(`${this.apiHost}/instagram/media?shop=${Shopify.shop}&resource=default`);if(!t.ok){throw(await t.json()).message||"An unexpected error occurred."}let e=(await t.json()).slice(0,this.settings.imageCount||12);if(0===e.length)throw"No images could be retrieved from Instagram. Make sure your Instagram account contains at least 1 image.";if("sliding_carousel"===this.settings.layout){do{e.push(...e)}while(e.length<30);e=e.slice(0,30)}return e}removePlaceholders(){let t=this.section.querySelectorAll("[data-media-placeholder]");for(let e=0;e{let s=document.importNode(t.content,!0),r=e.timestamp.split("T")[0],n=i.format(new Date(r)),a="VIDEO"===e.media_type?e.thumbnail_url:e.media_url;this.setValueForField(s.querySelector('[data-instagram-field="media_url"]'),a,"src"),this.setValueForField(s.querySelector('[data-instagram-field="username"]'),e.username,"text"),this.setValueForField(s.querySelector('[data-instagram-field="caption"]'),e.caption,"text"),this.setValueForField(s.querySelector('[data-instagram-field="permalink"]'),e.permalink,"href"),this.setValueForField(s.querySelector('[data-instagram-field="timestamp"]'),n,"text"),o.appendChild(s)})),t.parentElement.appendChild(o),t.remove()}setValueForField(t,e,o){if(t)switch(void 0===e&&t.remove(),o){case"src":case"href":t.setAttribute(o,e);break;case"text":t.textContent=e}}async injectThemeStyles(){let t={};if(t=void 0!==window.BOOMR?{name:window.BOOMR.themeName,version:window.BOOMR.themeVersion}:await this.detectTheme(),!t||window.AppSectionFeed&&!window.AppSectionFeed.injectThemeStyles)return;const e=(t.name||"").toLowerCase(),o=t.version||"";let i=this.section.querySelector(".ooo-instagram-header"),s=this.section.querySelector(".ooo-instagram-header__title"),r=this.section.querySelector(".ooo-instagram-header__subheading"),n=this.section.querySelector(".ooo-instagram-footer__button"),a="",c="",l="";switch(e){case"warehouse":a="heading h3",c="rte",l="button button--primary";break;case"prestige":this.section.parentElement.classList.add("shopify-section--bordered"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",0),this.section.style.setProperty("--ooo-instagram-section-vertical-padding",window.innerWidth<=768?"50px":"80px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"24px":"80px"),this.section.style.setProperty("--ooo-instagram-header-margin-bottom","30px"),this.section.style.setProperty("--ooo-instagram-footer-margin-top","40px"),a="Heading u-h1",c="Rte",l="Button Button--primary";break;case"focal":o>="8.0.0"&&(this.section.style.setProperty("--ooo-instagram-section-vertical-margin","var(--vertical-breather)"),this.section.style.setProperty("--ooo-instagram-header-margin-bottom","28px"),a="heading h2",c="rte",l="button button--primary");break;case"impact":this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-header-margin-bottom","var(--section-stack-spacing-block, 0px)"),i.classList.add("prose"),a="h2",c="",l="button button--xl";break;case"impulse":this.section.style.setProperty("--ooo-instagram-container-max-width","1500px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",window.innerWidth<=768?"40px":"75px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"17px":"40px"),a="h2",c="rte",l="btn";break;case"streamline":this.section.style.setProperty("--ooo-instagram-container-max-width","1300px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",window.innerWidth<=768?"60px":"120px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"30px":"40px"),a="section-header__title",c="rte section-header__description",l="btn";break;case"motion":this.section.style.setProperty("--ooo-instagram-container-max-width","1300px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",window.innerWidth<=768?"34px":"100px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"20px":"40px"),a="h1",c="rte",l="btn";break;case"flow":this.section.style.setProperty("--ooo-instagram-section-vertical-margin",0),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","50px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"15px":"30px"),a="page--title",c="rte",l="btn";break;case"envy":this.section.style.setProperty("--ooo-instagram-container-max-width","1170px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",0),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","30px"),this.section.style.setProperty("--ooo-instagram-external-gutter","15px"),this.section.style.setProperty("--ooo-instagram-footer-margin-top",0),a="",c="rte",l="btn btn-custom";break;case"capital":this.section.style.setProperty("--ooo-instagram-container-max-width","1140px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","20px"),a="featured-content--header",c="featured-content--rich-content",l="button";break;case"district":this.section.parentElement.classList.add("section-standard"),this.section.style.setProperty("--ooo-instagram-container-max-width","1180px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",0),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","20px"),a="h2",c="rte",l="button large outline";break;case"blockshop":this.section.parentElement.classList.add("section-standard"),this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",0),this.section.style.setProperty("--ooo-instagram-section-vertical-padding",window.innerWidth<=768?"32px":"72px"),this.section.style.setProperty("--ooo-instagram-external-gutter","16px"),a="font--section-heading",c="rte-content",l="font--button";break;case"icon":a="",c="rte",l="button";break;case"venue":this.section.style.setProperty("--ooo-instagram-container-max-width","1600px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",window.innerWidth<=768?"30px":"42px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=980?"18px":"30px"),a="section__title-text",c="rte",l="c-btn c-btn--primary";break;case"galleria":this.section.style.setProperty("--ooo-instagram-container-max-width","1170px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",0),this.section.style.setProperty("--ooo-instagram-section-vertical-padding",window.innerWidth<=768?"60px":"80px"),this.section.style.setProperty("--ooo-instagram-external-gutter","15px"),a="section-header-title",c="section-header-subtitle rte-page",l="btn btn-primary btn-lg";break;case"showtime":this.section.style.setProperty("--ooo-instagram-container-max-width","1170px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",window.innerWidth<=768?"30px":"42px"),this.section.style.setProperty("--ooo-instagram-external-gutter","15px"),a="section__title-text",c="rte",l="btn_c";break;case"expression":this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",window.innerWidth<=768?"45px":"60px"),this.section.style.setProperty("--ooo-instagram-external-gutter",0),a="standard-title",c="rte",l="btn btn--primary";break;case"masonry":this.section.style.setProperty("--ooo-instagram-container-max-width","none"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","80px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"20px":"50px"),a="h1",c="rte",l="button";break;case"symmetry":this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","80px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"20px":"50px"),a="h1",c="rte",l="button";break;case"alchemy":this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","80px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"15px":"20px"),a="h2",c="rte align-center",l="button button--alt";break;case"showcase":this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","80px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"20px":"50px"),a="feature-header",c="rte align-center",l="button";break;case"canopy":this.section.style.setProperty("--ooo-instagram-container-max-width","90%"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","3.5em"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"15px":"20px"),a="section-heading",c="rte",l="btn";break;case"boost":this.section.style.setProperty("--ooo-instagram-container-max-width","1400px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","30px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"20px":"30px"),a="small-title",c="rte",l="btn btn--small btn--primary";break;case"avenue":this.section.style.setProperty("--ooo-instagram-container-max-width","1220px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",window.innerWidth<=768?"40px":"60px"),this.section.style.setProperty("--ooo-instagram-external-gutter","20px"),a="",c="",l="btn";break;case"colors":this.section.style.setProperty("--ooo-instagram-container-max-width","none"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","30px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"15px":"30px"),a="small-title",c="rte",l="btn border",i&&(i.setAttribute("id","rte"),i.classList.add("center"));break;case"california":this.section.style.setProperty("--ooo-instagram-container-max-width","none"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","30px"),this.section.style.setProperty("--ooo-instagram-external-gutter","0px"),a="",c="rte",l="btn action small";break;case"atlantic":this.section.style.setProperty("--ooo-instagram-container-max-width","1430px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin",window.innerWidth<=768?"40px":"65px"),this.section.style.setProperty("--ooo-instagram-external-gutter","15px"),a="section-title",c="rte",l="action-button submit";break;case"editions":this.section.style.setProperty("--ooo-instagram-container-max-width","1400px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","30px"),this.section.style.setProperty("--ooo-instagram-external-gutter","0px"),a="accent-text",c="rte",l="action-btn accent-text";break;case"empire":this.section.parentElement.classList.add("section-standard"),this.section.style.setProperty("--ooo-instagram-container-max-width","1400px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"10px":"25px"),a="home-section--title",c="rte-content",l="button-primary";break;case"grid":this.section.style.setProperty("--ooo-instagram-container-max-width","1400px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","30px"),a="home-section--title",c="rte",l="button";break;case"handy":this.section.style.setProperty("--ooo-instagram-container-max-width","none"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-external-gutter","0px"),a="section-twitter-title",c="rte",l="pxs-image-with-text-button";break;case"launch":this.section.style.setProperty("--ooo-instagram-container-max-width","1215px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding",window.innerWidth<=768?"30px":"60px"),this.section.style.setProperty("--ooo-instagram-external-gutter","30px"),a="module-title",c="module-subtitle",l="button outline";break;case"pacific":a="section-title",c="rte",l="button";break;case"superstore":this.section.style.setProperty("--ooo-instagram-container-max-width","1600px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding",window.innerWidth<=768?"30px":"50px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"10px":"40px"),this.section.style.setProperty("--ooo-instagram-header-margin-bottom",window.innerWidth<=768?"1.64rem":"2.625rem"),a="home-section--title",c="home-section--subheading",l="blogposts--footer-button button-primary";break;case"reach":this.section.style.setProperty("--ooo-instagram-container-max-width","80rem"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding",window.innerWidth<=768?"3rem":"6rem"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"1rem":"2rem"),a="text-block-heading",c="text-block-text rte",l="blog-posts-footer-link";break;case"startup":this.section.style.setProperty("--ooo-instagram-container-max-width","1020px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","50px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"1rem":"30px"),a="section-title",c="rte",l="button";break;case"vogue":this.section.style.setProperty("--ooo-instagram-container-max-width","none"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","50px"),this.section.style.setProperty("--ooo-instagram-external-gutter","0px"),a="section-title",c="rte",l="button";break;case"palo alto":this.section.style.setProperty("--ooo-instagram-container-max-width","none"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","50px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"25px":"50px"),a="h2",c="rte",l="btn btn--primary";break;case"broadcast":this.section.style.setProperty("--ooo-instagram-container-max-width","none"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","50px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"25px":"50px"),a="h3",c="rte",l="btn btn--large btn--secondary btn--neutral caps";break;case"modular":this.section.style.setProperty("--ooo-instagram-container-max-width","none"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","50px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"25px":"50px"),a="h1",c="rte",l="button button--primary";break;case"kingdom":this.section.parentElement.classList.add("with-gutter"),this.section.style.setProperty("--ooo-instagram-container-max-width","none"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"25px":"50px"),this.section.style.setProperty("--ooo-instagram-header-text-alignment","left"),a="h1",c="rte",l="button button--solid";break;case"artisan":this.section.style.setProperty("--ooo-instagram-container-max-width","1220px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding",window.innerWidth<=768?"30px":"40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","10px"),a="h2",c="rte",l="button";break;case"flex":this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","10px"),a="title",c="content",l="button button--primary";break;case"mobilia":this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","10px"),a="title",c="rte",l="action_button btn";break;case"parallax":this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","10px"),a="title",c="rte",l="button";break;case"responsive":this.section.style.setProperty("--ooo-instagram-container-max-width","1180px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","10px"),a="section-header home",c="featured_text",l="button",n&&(n.style.width="auto");break;case"retina":this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","10px"),this.section.style.setProperty("--ooo-instagram-header-text-alignment","left"),a="title",c="rte",l="button";break;case"turbo":this.section.style.setProperty("--ooo-instagram-container-max-width","1200px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","0px"),this.section.style.setProperty("--ooo-instagram-section-vertical-padding","40px"),this.section.style.setProperty("--ooo-instagram-external-gutter","10px"),a="h2",c="",l="action_button";break;case"providence":this.section.style.setProperty("--ooo-instagram-container-max-width","1280px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","30px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"10px":"20px"),a="lhxt",c="",l="button";break;case"lorenza":this.section.style.setProperty("--ooo-instagram-container-max-width","1280px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","30px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"20px":"30px"),a="indexText-text",c="indexText-subtext",l="button";break;case"ira":this.section.style.setProperty("--ooo-instagram-section-vertical-margin","30px"),a="indexText-text",c="indexText-subtext",l="btn";break;case"context":this.section.style.setProperty("--ooo-instagram-container-max-width","1260px"),this.section.style.setProperty("--ooo-instagram-section-vertical-margin","30px"),this.section.style.setProperty("--ooo-instagram-external-gutter",window.innerWidth<=768?"20px":"40px"),a="type-heading-1",c="type-body-large rte",l="bttn",n&&(n.style.display="inline-flex")}s&&""!==a&&(s.className=a),r&&""!==c&&(r.className=c),n&&""!==l&&(n.className=l)}async detectTheme(){let t=await fetch(`${this.apiHost}/theme?shop=${Shopify.shop}&theme_id=${Shopify.theme.id}`);if(t.ok)return t.json()}}let e=new class{constructor(){this.constructors=[],this.instances=[],this._attachListeners()}_attachListeners(){document.addEventListener("shopify:section:load",this._onSectionLoad.bind(this)),document.addEventListener("shopify:section:unload",this._onSectionUnload.bind(this))}register(t,e){this.constructors[t]=e;let o=document.querySelectorAll(`[data-section-type=${t}]`);for(let t=0;t{e.register("app-section-feed",t)})):e.register("app-section-feed",t)})();
//# sourceMappingURL=section-feed.js.map