shoesize.me
Open in
urlscan Pro
3.123.199.16
Public Scan
URL:
https://shoesize.me/assets/plugin/loader.js
Submission: On July 04 via manual from DE — Scanned from DE
Submission: On July 04 via manual from DE — Scanned from DE
Form analysis
0 forms found in the DOMText Content
var _paq=window._paq=window._paq||[];ShoeSizeMe_loader=function(){"use strict";let e={allowedLocales:{ar:["ar"],da:["da"],de:["de-AT","de-BE","de-DE","de-LI","de-LU","de-CH","de","at","ch"],el:["el"],en:["en-AS","en-AU","en-BE","en-BZ","en-BW","en-CA","en-GU","en-HK","en-IN","en-IE","en-JM","en-MT","en-MH","en-MU","en-NA","en-NZ","en-MP","en-PK","en-PH","en-SG","en-ZA","em-TT","en-UM","en-VI","en-GB","en-US","en-ZW","en","us","ca","gr","ir","pt","au","se"],es:["es-AR","es-BO","es-CL","es-CO","es-CR","es-DO","es-EC","es-SV","es-GQ","es-GT","es-HN","es-419","es-MX","es-NI","es-PA","es-PY","es-PE","es-PR","es-ES","es-US","es-UY","es-VE","es"],fi:["fi"],fr:["fr-BE","fr-BJ","fr-BF","fr-BI","fr-CM","fr-CA","fr-CF","fr-TD","fr-KM","fr-CG","fr-CD","fr-CI","fr-DJ","fr-GQ","fr-FR","fr-GA","fr-GP","fr-GN","fr-LU","fr-MG","fr-ML","fr-MQ","fr-MC","fr-NE","fr-RW","fr-RE","fr-BL","fr-MF","fr-SN","fr-CH","fr-TG","fr","be"],it:["it-IT","it-CH","it"],nl:["nl-NL","nl"],sk:["sk","sk-sk"],sv:["sv","sv-Se"],tr:["tr","tr-TR"],zh:["zh","zh-TW"]},validSizes:{eu:[10,60],fr:[10,60],de:[10,60],it:[10,60],us:[1,25],uk:[1,25],jp:[10,40],cl:[25,60],bra:[20,60],col:[20,60],arg:[10,60],rus:[10,60],rmw:[1,60],mx:[1,40],aus:[1,25],tw:[10,60],chn:[10,60],kr:[10,40]},hasShoes:!1,shoes:[],buttonsList:[],buttonDesign:"",stackMessages:[],rules:{},button:{html:null,containerClass:".ShoeSizeMe",containerClassName:"ShoeSizeMe",domNode:".ShoeSizeMe[data-shoeid]",buttonIndex:"ShoeSizeMe_button_0",buttonIndexPrefix:"ShoeSizeMe_button_",withoutSize:".without-size",withoutSizeClassName:"without-size",withSize:".with-size",withSizeClassName:"with-size"},endpoints:{loading:"/api/plugin_loadings",opening:"/api/plugin_openings"},cookiesOptions:{cookiesAllowed:!1,version:"4",expiration:1e4},cookies:{cookiesAllowed:!0,profile:"ssm_profile",kids:"ssm_kidsshoe",auth:"ssm_auth_token",sid:"ssm_sid"},query:{shoeID:"shoeids[]"},host:"https://shoesize.me",plugin_host:{advisor:"https://advisor.shoesize.me",shoeai:"https://shoeai.shoesize.me"},supported_scales:["eu","uk","us_m","us_w","jp","rus","col","arg","cl","mx","bra","aus_m","aus_w","tw","chn","kr","it","fr","de","mp","rmw_m","rmw_w","us","aus","rmw"]};e.production=-1===e.host.indexOf("staging"),e.contentPolicy="default-src 'self' *.shoesize.me "+window.location.origin+" 'unsafe-inline'; frame-src 'self' *.shoesize.me *.google.com 'unsafe-inline' 'unsafe-hashes' 'unsafe-inline'; font-src 'self' fonts.gstatic.com *.shoesize.me "+window.location.origin+"; connect-src 'self' *.shoesize.me *.google.com *.facebook.com shoesize.me advisor.shoesize.me "+window.location.origin+" 'unsafe-inline' *.google-analytics.com *.doubleclick.net 'unsafe-inline'; script-src 'self' *.shoesize.me 'unsafe-inline' apis.google.com *.google-analytics.com connect.facebook.net *.googletagmanager.com 'unsafe-inline' 'unsafe-eval'; script-src-elem 'self' *.shoesize.me 'unsafe-inline' apis.google.com *.google-analytics.com connect.facebook.net *.googletagmanager.com 'unsafe-inline' 'unsafe-eval'; style-src-elem 'self' *.shoesize.me *.googleapis.com 'unsafe-inline';img-src 'self' data: https://* *.shoesize.me";let t={advisorLoaded:!1,loaderContent:null,user:{}},i={},o={},s={},a=null,n=null;Object.size=function(e){let t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i};const r={console:{log:(t,i)=>{!0!==o.logs&&"true"!==o.logs&&e.production||console.log(t,i)}},errors:{stack:[],log:(t,i)=>{!0!==o.logs&&"true"!==o.logs&&e.production||console.log(t,i)}}},l={allowStorage:t=>{if(e.cookiesOptions.cookiesAllowed=!0===t,e.cookiesOptions.cookiesAllowed)for(const[t,i]of Object.entries(sessionStorage))if(-1!==t.indexOf("ssm")){if(_.noData(i))continue;const o=t.replace(`_${e.cookiesOptions.version}`,"").replace(" ","");if("ssm_config"===o)continue;l.setData(o,i)}},removeData:e=>{l.removeStorage(e),k.deleteCookie(e)},getData:t=>{let i=o.tokens[e.cookies[t]];return _.hasData(i)?i:(i=l.getStorage(t),_.hasData(i)?i:(i=k.readCookie(t),_.hasData(i)?i:null))},setData:(e,t,i)=>{void 0!==t&&(l.setStorage(e,t,i),k.setCookie(e,t,null,i),i&&(o.tokens[e]=t))},setStorage:(t,i,o)=>{if(_.noData(i))return!1;let s="string"==typeof i?i:JSON.stringify(i);const a=`${t}_${e.cookiesOptions.version}`;o||e.cookiesOptions.cookiesAllowed?(sessionStorage.setItem(a,s),localStorage.setItem(a,s)):(sessionStorage.setItem(a,s),f.user.update())},getStorage:t=>{const i=`${t}_${e.cookiesOptions.version}`;let o=localStorage.getItem(i);return _.hasData(o)?o:(o=sessionStorage.getItem(i),_.hasData(o)?o:null)},removeStorage:t=>{const i=`${t}_${e.cookiesOptions.version}`;localStorage.removeItem(i),sessionStorage.removeItem(i)},setProfile:t=>{let i=t[`${e.cookies.profile}_${e.cookiesOptions.version}`];if(_.hasData(i))return void l.setStorage(e.cookies.profile,i,!1);let o=l.getStorage(e.cookies.profile);_.hasData(o)&&l.setData(e.cookies.profile,i,!1)},addProfileItem:(t,i,o)=>{if(_.noData(i))return;const s=l.getProfilePayload(t,i);v.set(s),l.setData(e.cookies.profile,JSON.stringify(s),!1),!1!==o&&h.updateProfile()},getProfilePayload:(t,i)=>{let o=l.getData(e.cookies.profile),s=_.noData(o)?{}:JSON.parse(o);return t!==e.cookies.kids?i.constructor==Object?s={...s,...i}:s[t]=i:(!1===s.hasOwnProperty("kid")&&(s.kid={}),i.constructor==Object?s.kid={...s.kid,...i}:s.kid[t]=i),s},deleteProfile:()=>{g.deleteTokens(),v.reset(),b.reset()},deleteProfileItem:t=>{let i=l.getData(e.cookies.profile);const o=JSON.parse(i);null!=o&&t in o&&(delete o[t],l.setStorage(e.cookies.profile,JSON.stringify(o)))},retrieveUserProfile:async()=>{let t=l.getData(e.cookies.profile);if(_.hasData(t)){r.console.log("retrieveUserProfile local",t);const e=JSON.parse(t);l.addProfileItem(null,e)}else{const e=await f.user.get();if(r.console.log("retrieveUserProfile remote",e),!1===e)return!1;l.addProfileItem(null,e),"last_session_date"in e&&l.addProfileItem("last_session_click",e.last_session_date,!1)}},getCookiesExpiration:t=>{let i=new Date;const o=null!=t?t:e.cookiesOptions.expiration;i.setTime(i.getTime()+24*o*60*60*1e3);return`expires=${i.toUTCString()};`},updateSid:t=>{o.tokens[e.cookies.sid]!==t&&l.setData(e.cookies.sid,t,!0)},setTokens:t=>{const i=Object.fromEntries(Object.entries(t).filter((t=>!1===t.includes(e.cookies.profile))));o.tokens=i;for(const[e,t]of Object.entries(i))l.setStorage(e,t,!0);if(void 0===o.tokens[e.cookies.sid]||""==o.tokens[e.cookies.sid]){let t=l.getStorage(e.cookies.sid);_.hasData(t)&&l.setData(e.cookies.sid,t,!0)}if(void 0===o.tokens[e.cookies.auth]){let t=null,i=l.getStorage(e.cookies.auth);if(_.hasData(i))t=i;else{let i=l.getStorage(e.cookies.profile);if(null!==i){const e=JSON.parse(i);"auth_token"in e&&(t=e.auth_token)}}if(_.noData(i))return;l.setData(e.cookies.auth,t,!0)}}},d={send:i=>{if(!1===t.advisorLoaded)return void e.stackMessages.push(i);let o=document.getElementById("ssm_frame").querySelector("iframe");"string"!=typeof i&&(i=JSON.stringify(i)),o.contentWindow.postMessage(i,"*")},sendClient:e=>{"string"!=typeof e&&(e=JSON.stringify(e)),window.postMessage(e,"*")},dataLayer:e=>{window.dataLayer=window.dataLayer||[],window.dataLayer.push(e)}},c={loadGTM:()=>{if(!_.hasData(o.gtm_container))return;let e=document.body,t=document.createElement("script");t.type="text/javascript",t.id="ssm_container",t.innerHTML="(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','"+o.gtm_container+"');",e.appendChild(t)}},u={init:async()=>{_.shoeSizeEvent({event:"intialized"}),u.resetData();let i=document.querySelector('script[src*="/assets/plugin/loader.js"]');if(null===i&&(i=document.querySelector('script[src*="shoesize.me"]')),""==i.innerHTML)return;let s=new Function("return "+i.innerHTML.replace(/^\s*/,""));if(t.loaderContent=s(),void 0===t.loaderContent.shopID||"undefined"===t.loaderContent.scale)return!1;if(-1==e.supported_scales.indexOf(t.loaderContent.scale.toLowerCase()))return!1;const a=_.cookiesToObject();l.setTokens(a),l.setProfile(a);let n,r=await f.config();if(r.error||!r.hasOwnProperty("config"))return;if(l.updateSid(r.sid),g.setDefaults(r.config),"zeroCookie"in t.loaderContent&&""!==t.loaderContent.zeroCookie?n=S.getQueryParams(t.loaderContent.zeroCookie,!0,null,null):"zeroHash"in t.loaderContent&&""!==t.loaderContent.zeroHash&&(n=S.getQueryParams(null,null,t.loaderContent.zeroHash,null)),void 0===n)await l.retrieveUserProfile(),h.initializeSession();else{let e=await f.zeroInteraction(n);!e.error&&e.success?await S.set(e):(await l.retrieveUserProfile(),h.initializeSession())}d.dataLayer({event:"ssm_init",ssm_sid:l.getData(e.cookies.sid)}),l.allowStorage(!r.config.restricted_cookie_policy),g.parsingFunction(),g.scriptConfig(),g.setLocale();const[p,v]=await Promise.all([f.buttons.design(),f.langpack()]);p.error||v.error||v[0].error||(e.buttonDesign=p,b.injectStyle(e.buttonDesign),o.langpack=v[0],o.langpackDefault=v[1],m.iframe.load(),u.bindEvents(),A.init(r.sid),c.loadGTM(),m.exposeVariables(),w.listeners(),u.start())},start:async()=>{p.set(),e.hasShoes&&m.product.start()},open:e=>{let t=e||"questionnaire";document.querySelector("#ssm_frame").setAttribute("data-current",t),e?z.open(e):w.open()},resetData:()=>{e.shoes=[],e.hasShoes=!1,e.buttonsList=[],e.buttonDesign=""},bindEvents:()=>{_.bindEvent(window,"message",(async function(s){try{const n=JSON.parse(s.data);if("matomo"===n.source)return void A.event(n);const c=n.message,u=n.data;if(r.console.log("Window Message",c,u),"css"===c){const e='{"message":"ssm_css","style":"'+o.css+'"}';return void d.send(e)}if("undefined"!==c){let e=`ssm_${c}`;const t={event:e};void 0!==u&&(t.data={},t.data[e]=u),d.dataLayer(t)}if("config"===c)return void h.config();if("langpack"===c)return void d.send(`{"message":"langpack","data":${JSON.stringify(o.langpack)},"langpackDefault":${JSON.stringify(o.langpackDefault)}}`);if("initializeEarlyConfig"===c)return void d.send(`{"message":"initializeEarlyConfig", "items":{"skip_landing_page":${o.skip_landing_page},"show_pictures":${o.show_pictures},"show_logo":${o.show_logo}}}`);if("ssm_loaded_plugin"===c){if(!0===t.advisorLoaded)return;t.advisorLoaded=!0,e.stackMessages.forEach((e=>{d.send(e)})),e.stackMessages=[];var a=document.getElementById("ssm_frame").children[0];return a.classList.remove("ssm_loading"),void a.classList.remove("ssm_loader")}if("calcRecom"===c)try{const e=u;let t=e.recommended_sizes;const i=e.hasOwnProperty("user");let o=i?e.user.gender:e.gender,s=i?e.user.footWidth:e.footWidth;const a=Object.keys(t)[0],n=t[a],r=D.calc(n,o,s,a);return void d.send(`{"message":"calcRecom", "data":${JSON.stringify(r)}}`)}catch(s){}if("recommendation"===c)return D.set(u.recommendation,u.userStatus,!1),void D.updateOthers(u.recommendation);if("close_window"===c){let e=document.getElementById("ssm_frame").children[0];return e.classList.add("sidenav"),e.classList.remove("sidenavactive"),void document.documentElement.classList.remove("ssm_ui_block")}if("addProfileItem"===c){const e=u.item.key,t=u.item.value;l.addProfileItem(e,t,!1),k.setCookie(e,t,null,!1)}if("deleteProfileItem"===c){const e=u.key;l.deleteProfileItem(e)}if("addCookieItem"===c){const t=l.getData(e.cookies.auth);_.hasData(t)&&u.item.key===e.cookies.auth&&l.addProfileItem("status","recognised",!1);const i=u.item.key,o=u.item.value,s="ssm_sid"===i||"ssm_auth_token"===i;return void l.setData(i,o,s)}if("deleteCookieItem"===c){const e=u.key;return void l.removeData(e)}if("initializeCookie"===c){let e={message:"initializeCookie",items:o.tokens};return void d.send(e)}if("reset_button"===c||"resetRecommendation"===c)return void l.deleteProfile();if("button_recommendation"===c){let e=u.recommended_sizes;return void Object.keys(e).forEach((function(t){let o=i[t];o.size=e[u.scale],o.scale=u.scale}))}if("updateAdvisor"===c||"updateQuestionnaire"===c)return e.shoes.length>0&&await D.query(e.shoes),void d.send(s.data);if("initializeRounding"===c){let e={message:"initializeRounding",items:{avab_specials:o.avab_specials,round_function:o.round_function}};return void d.send(JSON.stringify(e))}if("loaderShoe"===c){let t={image:"",brand:"",model:""};try{t=e.rules.shoeInfo(null)}catch(s){r.errors.log("The Shoe info function is incorrect")}let i={message:"updateShoeInfo",brand:t.brand,model:t.model,image:t.image_url};return void d.send(JSON.stringify(i))}if("avabArrays"===c)return void z.updateAvab();if("addToCart"===c)return void(o.hasOwnProperty("inCart")&&o.inCart(u.shoe));if("checkAddToCart"===c){let e={message:"checkAddToCart"};return e.value=o.hasOwnProperty("inCart"),void d.send(JSON.stringify(e))}if("addSessionItem"===c){const e="string"==typeof u.item.value?u.item.value:JSON.stringify(u.item.value);return void sessionStorage.setItem(u.item.key,e)}if("initializeSession"===c&&h.initializeSession(),"zeroInt"===c){let e={message:"zeroInt",value:v.zeroInt};return void d.send(JSON.stringify(e))}}catch(s){r.errors.log(s.message)}}))}},h={config:()=>{const e={message:"config",data:{config:o,user:t.user}};d.send(JSON.stringify(e))},updateProfile:()=>{const e={message:"updateProfile",data:{user:t.user}};d.send(JSON.stringify(e))},initializeSession:()=>{let e={message:"initializeSession",items:{}};for(const[t,i]of Object.entries(sessionStorage))-1!==t.indexOf("ssm")&&(e.items[t]=i);d.send(JSON.stringify(e))}},m={iframe:{load:()=>{_.injectCss(!1,o.css),m.iframe.build()},build:()=>{let i=document.querySelector("#ssm_frame");if(i){let e=i.parentNode.parentNode;e.parentNode.removeChild(e)}let s=`${e.plugin_host[o.plugin_version]}?shopid=${t.loaderContent.shopID}&locale=${o.locale}`;const a=`${e.cookies.auth}_${e.cookiesOptions.version}`;let n="";a in o.tokens?n=`${n}${o.tokens[a]}`:e.cookies.auth in o.tokens&&(n=`${n}${o.tokens[e.cookies.auth]}`),""!==n&&(s+=`&auth_token=${n}`),t.user.status=""!==n?"recognised":"new";const r=`${e.cookies.sid}_${e.cookiesOptions.version}`;if(r in o.tokens?s+=`&sid=${o.tokens[r]}`:e.cookies.sid in o.tokens&&(s+=`&sid=${o.tokens[e.cookies.sid]}`),void 0!==t.loaderContent.kids){s+=`&showKid=${"string"==typeof t.loaderContent.kids?-1!==t.loaderContent.kids.indexOf("true"):t.loaderContent.kids}`}s=encodeURI(s.replace(/undefined/g,"''").replace(/'/g,"qTqTTq").replace(/"/g,"'")),m.iframe.inject(s)},inject:t=>{let i=e.production?`csp="${e.contentPolicy}"`:"",s=document.body||document.getElementsByTagName("body")[0],a=document.createElement("div"),n="advisor"===o.plugin_version?"ssm_v4":`ssm_${o.plugin_version}`;document.documentElement.classList.add(n,"ssm_css"),a.innerHTML=`\n <div class="container">\n <div class="row row-offcanvas row-offcanvas-right" id="ssm_frame">\n <div id="sidePanel" class="sidenav ssm_loader">\n <div class="tempContentPanel">\n <div class="tempOverlay" onclick="ShoeSizeMe_loader.closeWindow()"></div>\n </div>\n <iframe\n ${i}\n sandbox="allow-forms allow-scripts allow-top-navigation allow-same-origin allow-popups"\n id="ShoeSizeMe_advisor-wrapper"\n referrerpolicy="origin"\n src="${t}"\n style="width:100%; height:100%;">\n </iframe>\n </div>\n </div>\n </div>`,s.appendChild(a)}},product:{start:async()=>{let t=await f.isAdult(e.shoes);if(t.error)return;s=t,b.bulkInit(),b.inject(s);const i=await D.init();await D.query(i)}},exposeVariables:()=>{ShoeSizeMe_loader.config=g.get.data(),ShoeSizeMe_loader.buttonHtml=b.get.html(),ShoeSizeMe_loader.buttonsList=b.get.list()}},g={get:{data:()=>o,version:()=>n},set:(e,t)=>{try{o[e]=t,r.console.log("Config attribute set",e)}catch(e){r.errors.log("SetConfig attribute failed",e)}},setDefaults:t=>{for(let e in t)o[e]=t[e];_.extractDomain(location),o.cookieVersion=e.cookiesOptions.version},deleteTokens:()=>{Object.values(e.cookies).forEach((function(e){l.removeData(e)}))},parsingFunction:()=>{e.rules={shoeInfo:new Function("shoeID",o.shoe_info),parsingFunction:new Function("shoeID",o.avab_parsing),specialRules:new Function("availability","size","sizeRun","scale",o.avab_specials),roundRule:""!==o.round_function?new Function("availability","size",o.round_function):""}},scriptConfig:()=>{for(var e in o.callbacks={},t.loaderContent)o[e]=t.loaderContent[e],"function"==typeof t.loaderContent[e]&&(o.callbacks[e]=!0);o.plugin_version="shoeai"===o.plugin_version?"shoeai":"advisor",o.scale=o.scale.toLowerCase()},setLocale:()=>{o.locale=o.locale.toLowerCase().replace("ch_","de-").replace("_","-"),o.legacy_locale=o.locale;for(let t in e.allowedLocales)e.allowedLocales[t].indexOf(o.locale)>-1&&(o.locale=t.toLowerCase())},langpack:{get:()=>o.langpack}},f={params:{shop:()=>`shopid=${t.loaderContent.shopID}`,shoes:t=>{let i=e.query.shoeID,o="";return o=t instanceof Array?t.join(`&${i}=`):t,`&${i}=${o}`},sid:t=>{let i=l.getData(e.cookies.sid);return null!==i&&(t+="&sid="+i),t}},config:async()=>{let e=`/api/config?${f.params.shop()}`;return e=f.params.sid(e),await k.getData(e)},langpack:async()=>{let t=o.locale in o.langpacks?o.locale:`${o.locale}-${o.locale}`;if(t=t in o.langpacks?t:o.legacy_locale,void 0===o.langpacks[t]&&o.locale in e.allowedLocales)for(let i of e.allowedLocales[o.locale]){const e=i.toLowerCase();if(e in o.langpacks){t=e;break}}t=t in o.langpacks?t:"en";let i=o.langpacks[t],s=o.langpacks.en;const a=[k.getData(i),k.getData(s)];return await Promise.all(a)},buttons:{design:async()=>{let e=`/${o.locale}/plugin/button/${o.shopID}`;return k.getData(e,!0)}},user:{get:async()=>{if(void 0===o.tokens||!1===o.tokens.hasOwnProperty(e.cookies.auth))return!1;var t=`/api/user/profile?authtoken=${o.tokens[e.cookies.auth]}`;let i=await k.getData(t);return!i.error&&i},update:async()=>{if(!1===o.tokens.hasOwnProperty(e.cookies.auth))return!1;const t=v.get(),i={};_.hasData(t.gender)&&(i.gender=t.gender),_.hasData(t.birthYear)&&(i.birthyear=t.birthyear),_.hasData(t.footwidth)&&(i.footwidth=t.footwidth),_.hasData(t.foottype)&&(i.foottype=t.foottype),_.hasData(t.firstname)&&(i.firstname=t.firstname);var s=`/api/user?authtoken=${o.tokens[e.cookies.auth]}&${k.serialize(i)}`;let a=await k.postData(s,null,!1,"PUT");return!a.error&&a}},recommend:async e=>{const t=k.session.getLastClick();!1!==t&&(e.last_session_click=t),e.hasOwnProperty("target_scale")||(e.target_scale=o.scale);var i=`/api/recommendation?${k.serialize(e)}`;let s=await k.getData(i);return!s.error&&s},availability:async e=>{let t=`/api/others/availability?${k.serialize(e)}`;k.postData(t)},error:e=>{let t=`/api/error?${k.serialize(e)}`;k.postData(t)},isAdult:async e=>{let t=`/api/shoes/isadult?${f.params.shop()}${f.params.shoes(e)}`;return await k.getData(t)},zeroInteraction:async e=>{let t="/api/auth/zero_interaction?"+k.serialize(e);return await k.postData(t)},trackUse:async(i,s,a)=>{if(void 0===i)return!1;let n={shop_id:t.loaderContent.shopID};n.sid=o.tokens[e.cookies.sid];let r=l.getData(e.cookies.auth);""!==r&&(n.auth_token=r),null!=s&&(n.shoe_id=s),null!=a&&(n.source=a),k.postData(i,n,!0)}},p={getAgeVisibility:async e=>{let t=await f.isAdult(e);if(!_.noData(t)){for(let e in t)s[e]=t[e];return t}},getWidth:e=>{if(_.noData(e))return;const t=i[e];return _.noData(t)||_.noData(t.availability)||_.noData(t.availability.size)?void 0:{width:t.availability.size.width}},getSize:e=>{if(_.noData(e))return;const t=i[e];return _.noData(t)||_.noData(t.availability)||_.noData(t.availability.size)?void 0:D.getSizeString(t.availability.size,t.availability.gender)},set:()=>{let i=[],o=[];const s=document.querySelectorAll(e.button.containerClass);let a=!1;for(let n=0;n<s.length;n++){let r=void 0!==s[n].attributes["data-shoeid"]?s[n].attributes["data-shoeid"].value:null;if(_.hasData(r)){if(-1!==e.shoes.indexOf(r)){o.push(r);continue}e.shoes.push(r),i.push(r),e.buttonsList.push(s[n])}else if(!a&&t.loaderContent.shoeID){if(-1!==e.shoes.indexOf(t.loaderContent.shoeID))continue;e.shoes.push(t.loaderContent.shoeID),i.push(t.loaderContent.shoeID),s[n].setAttribute("data-shoeid",t.loaderContent.shoeID),s[n].setAttribute("data-ssmstatus","default"),e.buttonsList.push(s[n]),a=!0}}return e.hasShoes=e.shoes&&e.shoes.length>0,{newShoes:i,currentShoes:o}}},v={set:e=>{void 0!==e&&(t.user={...t.user,...e})},get:()=>t.user,getWidth:()=>t.user.footWidth||"width_normal",reset:()=>{t.user={}}},b={getTarget:e=>{let t,i=e.classList;if("undefined"!==i){t=Array.from(i).join(",")}let o={button:"default"};if(void 0===t)return o;if(-1!==t.indexOf("ssm_core"))return o.domElem=e,o.button="core",o;let s=e.closest(".ssm_core");if(null!==s)return o.domElem=s,o.button="core",o;if(-1!==t.indexOf("ssm_support_top"))return o.domElem=e,o.button="support_top",o;let a=e.closest(".ssm_support_top");return null!==a?(o.domElem=a,o.button="support_top",o):-1!==t.indexOf("ssm_support_bottom")?(o.domElem=e,o.button="support_bottom",o):(a=e.closest(".ssm_support_bottom"),null!==a?(o.domElem=a,o.button="support_bottom",o):-1!==t.indexOf("ssm_support")?(o.domElem=e,o.button="support",o):(a=e.closest(".ssm_support"),null!==a?(o.domElem=a,o.button="support",o):-1!==t.indexOf("ssm_divider")?(o.domElem=e,o.button="divider",o):(null!==e.closest(".ssm_divider")&&(o.domElem,o.button="divider"),o)))},getActiveButton:e=>{if(void 0===e||void 0===e.domElem)return;const t=e.domElem;return Array.from(t.children).filter((e=>"none"!==window.getComputedStyle(e).getPropertyValue("display")))[0]},getAction:(e,t)=>{if(void 0===t||void 0===e)return;return t.getAttribute("data-status")},action:(e,t,i)=>{try{let s=i.getAttribute("data-ssmstatus"),a=i.getAttribute("data-avab"),n="none"!==a&&!1!==a&&"false"!==a;const l=b.getTarget(t.target),c=b.getActiveButton(l),h=b.getAction(l,c);if("divider"===l.button)return;const m={event:"ssm_multitouch",multitouch:{shoeID:e,status:s,avab:n,buttonStatus:h,button:l.button,action:"openSA"}};if(o.hasOwnProperty("action")&&void 0===l.domElem&&void 0!==o.action&&!0!==o.action)return"function"==typeof o.action?(o.action({shoeID:e,isAvab:n,event:t,container:i}),m.multitouch.action="callback"):m.multitouch.action="visual feedback",void d.dataLayer(m);if("default"===s)return u.open(e),void d.dataLayer(m);if("core"===l.button){if("recommendation"===s&&n){if(o.hasOwnProperty("inCart")){const t=D.get(e);o.inCart(t),r.console.log("Callback - inCart",t),m.multitouch.action="inCart"}else u.open(e);return void d.dataLayer(m)}if("recommendation"===s&&!n){if(o.hasOwnProperty("alternatives")){const t=D.get(e);o.alternatives(t),r.console.log("Callback - Alternatives",t),m.multitouch.action="alternatives"}else u.open(e);return void d.dataLayer(m)}return}if("support"===l.button||"support_top"===l.button||"support_bottom"===l.button){if("recommendation"===s&&n)return u.open(e),void d.dataLayer(m);if("recommendation"===s&&!n)return u.open(e),void d.dataLayer(m)}u.open(e),d.dataLayer(m)}catch(e){r.errors.log("action",e)}},get:{shoeGate:()=>s,data:e=>i[e],html:()=>e.button.html,list:()=>i},ajax:{loadMany:async o=>{if(_.noData(o)){const e=p.set();o=e.newShoes;for(let t of e.currentShoes)b.rebuild(t)}if(o.length>0){let s=await p.getAgeVisibility(o);for(let t of o){if(void 0!==i[t]||!0!==s[t].is_visible){let e={message:"ssm-button-status",data:{shoeID:t,is_visible:s[t].is_visible}};d.sendClient(e);continue}let o=document.querySelector(".ShoeSizeMe[data-shoeid='"+t+"']");_.noData(o)||(e.shoes.push(t),e.buttonsList.push(o),b.init(t,o),b.updateAvab(t),b.inject(s))}return t.loaderContent.shoeID=e.shoes.join(","),await D.query(o)}return!1},loadOne:async(o,s)=>{if(void 0!==i[o])return!1;let a=_.noData(s)?document.querySelector(".ShoeSizeMe[data-shoeid='"+o+"']"):s;if(_.noData(o)||_.noData(a))return!1;let n=await p.getAgeVisibility(o);if(!0!==n[o].is_visible){a.innerHTML="";let e={message:"ssm-button-status",data:{shoeID:o,is_visible:n[o].is_visible}};return d.sendClient(e),!1}return e.buttonsList.push(a),e.shoes.push(o),t.loaderContent.shoeID=_.hasData(t.loaderContent.shoeID)?`${t.loaderContent.shoeID},${+o}`:o,b.init(o,a),b.updateAvab(o),b.inject(n),await D.query(o),!0}},updateAvab:e=>{e in i&&(i[e].availability=C.init(e),i[e].availability.scale=o.scale,i[e].availability.validateParsing(e))},bulkUpdateAvab:()=>{for(let e in i)b.updateAvab(e)},selectDOM:e=>{let t=document.querySelectorAll(`.ShoeSizeMe_button_${e.id}`);return t.length>0?t:[]},splitByAgeType:e=>{for(var t={kids:[],adults:[]},i=b.get.list(),o=0;o<e.length;o++)void 0!==i[e[o]]&&(i[e[o]].isAdultShoe?t.adults.push(e[o]):t.kids.push(e[o]));return t},injectStyle:t=>{_.noData(t)&&_.noData(e.button.html)?_.shoeSizeEvent({event:"plugin_not_loaded",description:"Shoe not found in database"}):_.noData(e.button.html)&&(t=t.replace("</style>","</style>;;").split(";;"),e.button.html=t[1],_.injectCss(t[0]))},init:(e,t,a)=>{let n=_.hasData(a)?a:Object.size(i);t.className&&-1==t.className.indexOf(" ShoeSizeMe_button_"+n)&&(t.className+=" ShoeSizeMe_button_"+n),t.setAttribute("data-ssmstatus","default"),t.setAttribute("data-ssmcart",o.hasOwnProperty("inCart")),t.setAttribute("data-shoeid",e),_.noData(s[e])&&(s[e]={isAdult:!0}),i[e]=new b.SSMButton(n,s[e].is_visible,t,null,null,e,s[e].isAdult,s[e].gender),b.updateAvab(e)},bulkInit:()=>{const i=e.buttonsList;for(let e=0;e<i.length;e++){let t=i[e],o=t.attributes["data-shoeid"].value;if(!0===s[o].is_visible)b.init(o,t,e);else{let e={message:"ssm-button-status",data:{shoeID:o,is_visible:s[o].is_visible}};d.sendClient(e)}}t.loaderContent.shoeID=e.shoes.join(",")},setAttributes:(t,i,o)=>{try{t.setAttribute("onclick",i)}catch(e){(t=t[0]).setAttribute("onclick",i)}if(t.innerHTML=e.button.html,o){let i=t.querySelectorAll(e.button.withSize);for(let e=0;e<i.length;e++)i[e].style.display="none"}},setStatus:(e,t)=>{document.querySelector(".ShoeSizeMe[data-shoeid='"+e+"']").setAttribute("data-ssmstatus",t)},setScale:(e,t)=>{i[e].scale=t},displayRecom:(e,t)=>!1!==t&&(void 0!==e.isAvab&&"none"!==e.isAvab&&!1!==e.isAvab),setActiveClasses:(e,t)=>{let i=t?".with-size":".without-size",o=t?".without-size":".with-size";if(void 0!==e)for(var s=0;s<e.length;s++){let t=e[s].querySelectorAll(i),a=e[s].querySelectorAll(o);for(const e of t)e.style.display="inherit";for(const e of a)e.style.display="none"}},setText:(e,t,i,o)=>{r.console.log("setText",{button:e,avab:t,gender:i,displayRecommendedSize:o});let s=b.selectDOM(e);if(0===s.length)return;let a=D.getSizeString(e,t.size,i);if(b.displayRecom(t,o)&&!1!==a){b.setActiveClasses(s,!0);for(var n=0;n<s.length;n++){s[n].setAttribute("data-avab",t.isAvab);let e=s[n].querySelectorAll(".shoeSizeDisplay");for(const t of e)t.innerHTML=a}e.size=a}else{let i=b.selectDOM(e);b.setActiveClasses(i,!1);for(n=0;n<i.length;n++){i[n].setAttribute("data-avab",t.isAvab);let e=i[n].querySelectorAll(".shoeSizeDisplay");for(const t of e)t.innerHTML=a}e.size=null}return a},setRecom:(e,t)=>{i[e].recommendation=t},inject:t=>{for(const[o,s]of Object.entries(t)){let t=i[o];void 0!==t&&("selector"in t!=!1&&(b.setAttributes(t.selector,`ShoeSizeMe_loader.action('${o}',event,this)`,!0),f.trackUse(e.endpoints.loading,o,"advisor")))}},rebuild:async e=>{if(void 0===e||null==e||""==e)return;let t=document.querySelectorAll('.ShoeSizeMe[data-shoeid="'+e+'"]');if(0===t.length&&"shoeID"in o&&void 0!==o.shoeID&&""!==o.shoeID&&(t=document.querySelectorAll(".ShoeSizeMe")),0===t.length)return!1;let i=b.get.list()[e];if(r.console.log("rebuild button: ",i),void 0===i){if(!await b.ajax.loadOne(e))return;if(i=b.get.list(e),"availability"in i&&null!=i.availability.size){var s=i.availability.isAvab(i.availability.size,i.availability.gender,i.availability.footWidth);b.setText(i,s,i.availability.gender,o.display_recommended_size)}return!0}let a=!1;for(var n=0;n<t.length;n++){if(!0!==i.visible){t[n].innerHTML="";continue}if(t[n].children.length>0&&t[n].dataset.shoeid===e){a=!0;continue}let o=`ShoeSizeMe_button_${i.id}`;-1===t[n].className.indexOf(o)&&(t[n].classList+=" ShoeSizeMe_button_"+i.id),b.SSMBuildButton(t[n],e,i),a=!0}if(a&&"availability"in i&&null!=i.availability.size){s=i.availability.isAvab(i.availability.size,i.availability.gender,i.availability.footWidth);b.setText(i,s,i.availability.gender,o.display_recommended_size)}return!0},reset:()=>{for(var e in i)i[e].reset()},SSMButton:function(t,i,o,s,a,n,r,l){let d={};return d.id=t,d.visible=i,d.selector=o,d.size=s,d.scale=a,d.shoeID=n,d.isAdultShoe=r,d.targetGender=l,window.ssm_button||(window.ssm_button={}),window.ssm_button[t]=d,window.ssm_button[t].reset=function(){let t=window.ssm_button[d.id],i=t.selector;!1===document.body.contains(i)&&(i=document.querySelector(".ShoeSizeMe[data-shoeid='"+t.shoeID+"']"));let o=i.getElementsByClassName(e.button.withSizeClassName),s=i.getElementsByClassName(e.button.withoutSizeClassName);i.setAttribute("data-ssmstatus","default");for(let e=0;e<o.length;e++)o[0].style.display="none";for(let e=0;e<s.length;e++)s[0].style.display="inherit"},window.ssm_button[t]},SSMBuildButton:function(t,i,o){t.setAttribute("onclick",`ShoeSizeMe_loader.action('${i}',event,this)`),o&&void 0!==o.recommendation&&void 0!==o.availability?t.setAttribute("data-ssmstatus","recommendation"):t.setAttribute("data-ssmstatus","default"),t.setAttribute("data-shoeid",i),t.innerHTML=e.button.html;let s=t.querySelectorAll(".with-size")[0];void 0!==s&&(s.style.display="none")}},y={open:()=>{let e=document.querySelector("#ssm_frame"),t=e.children[0];null!==document.getElementById("ShoeSizeMe_advisor-wrapper")&&e&&(t=e.firstElementChild,document.documentElement.classList.add("ssm_ui_block"),t.classList.add("sidenavactive"),t.classList.remove("sidenav"))},close:()=>{let e=document.querySelector("#ssm_frame"),t=e.children[0];null!==document.getElementById("ShoeSizeMe_advisor-wrapper")&&e&&(document.documentElement.classList.remove("ssm_ui_block"),t.classList.add("sidenav"),t.classList.remove("sidenavactive"))}},S={getQueryParams:(i,s,a,n)=>{let r=null!=a?a:n;return o.zeroInt={},o.zeroInt.uid=i?_.readCookieStandard(i):r,{shopid:t.loaderContent.shopID,uid:o.zeroInt.uid,sid:o.tokens[e.cookies.sid]}},query:async(t,i,o,s,a)=>{null==t&&(t=e.shoes);const n=S.getQueryParams(i,o,s,a);let l=await f.zeroInteraction(n);if(r.console.log("zeroInteraction - response",l),l.error||!1===l.success)return!1;await S.set(l),await D.query(t)},set:async t=>{l.setData(e.cookies.auth,t.authentication_token,!0),await l.retrieveUserProfile(),l.addProfileItem("zeroInt",!0,!1),l.addProfileItem("status","recognised"),h.initializeSession();let i={message:"initializeCookie",items:{...o.tokens,zeroInt:!0}};d.send(JSON.stringify(i))}},_={cookiesToObject:()=>document.cookie.split(";").filter((e=>-1!==e.indexOf("ssm"))).reduce(((t,i)=>{let o=i.split("="),s=o[0].replace(`_${e.cookiesOptions.version}`,"").replace(" ",""),a=o[1].replace(" ","");try{const e=JSON.parse(a);t[s]=e}catch(e){t[s]=a}return t}),{}),noData:e=>null==e||"undefined"===e||""===e,hasData:e=>void 0!==e&&"undefined"!==e&&null!==e&&""!==e&&"[object Object]"!==e,shoeSizeEvent:e=>{let t=new CustomEvent("ShoeSizeEvent",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(t)},readCookieStandard:function(e){let t=e+"=",i=document.cookie.split(";");for(let e=0;e<i.length;e++){let o=i[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""},extractDomain:function(e){if(-1!==e.hostname.indexOf("localhost"))return o.domain="localhost","localhost";if(void 0!==o.domain&&null!==o.domain&&""!==o.domain)return;let t=e.hostname,i=t;if(null!=t){let e=t.split(".").reverse();null!=e&&e.length>1&&(i=e[1]+"."+e[0],-1!=t.toLowerCase().indexOf(".co.uk")&&e.length>2&&(i=e[2]+"."+i),-1!=t.toLowerCase().indexOf(".com.au")&&e.length>2&&(i=e[2]+"."+i))}o.domain=i},injectCss:(e,t)=>{let i,o=document.head||document.getElementsByTagName("head")[0];e?(i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),o.appendChild(i)):(i=document.createElement("link"),i.setAttribute("href",t),i.setAttribute("rel","stylesheet"),i.setAttribute("media","all")),o.appendChild(i)},bindEvent:(e,t,i)=>{e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent&&e.attachEvent("on"+t,i)}},k={getData:async(t,i)=>{let o={headers:{Accept:i?"*/*":"application/vnd.ssm.v4"}};try{if(void 0===t)throw new Error("empty URL");let s=t.startsWith("https")?t:`${e.host}${t}`,a=await fetch(s,o);if(!a.ok)throw new Error(a.status);return i?a.text():a.json()}catch(e){return r.errors.stack.push(`Error loading ${t}: ${e.message}`),r.errors.log(`SSM GET ${t}`),{error:!0}}},serialize:e=>{var t=[] ;for(var i in e)if("[object Array]"===Object.prototype.toString.call(e[i]))for(var o=0;o<e[i].length;o++)t.push(encodeURIComponent(i)+"[]="+encodeURIComponent(e[i][o]));else"[object Object]"===Object.prototype.toString.call(e[i])?t.push(encodeURIComponent(i)+"="+JSON.stringify(e[i])):t.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t.join("&")},postData:async(t,i,o,s)=>{let a={method:s=void 0===s?"POST":s,headers:{}};null!=i&&(a.body=JSON.stringify(i)),a.headers["Content-Type"]=!0===o?"application/json":"application/x-www-form-urlencoded",!0!==o&&(a.headers.Accept="application/vnd.ssm.v4");let n=t.startsWith("https")?t:`${e.host}${t}`;r.console.log("reqUrl",n,a);let l=await fetch(n,a);return l.ok?l.json():(r.errors.stack.push("Error loading "+t+": HTTP "+l.status+" status code"),r.errors.log(`SSM ${s} ${t}`),{error:!0})},session:{getLastClick:()=>"last_session_click"in t.user&&t.user.last_session_click},deleteCookie:t=>{let i=`${t}_${e.cookiesOptions.version}`;const s=l.getCookiesExpiration(-1),a=`${i}=''; domain=${o.domain}; ${s}path=/`;document.cookie=a},setCookie:(t,i,s,a)=>{let n="string"==typeof i?i:JSON.stringify(i),r=`${t}_${e.cookiesOptions.version}`;if(a||e.cookiesOptions.cookiesAllowed){const e=l.getCookiesExpiration(s),t=`${r}=${n}; domain=${o.domain}; ${e}path=/`;document.cookie=t}return{cname:t,name:r,value:n}},readCookie:t=>{let i=`${t}_${e.cookiesOptions.version}=`,o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];for(;" "==t.charAt(0);)t=t.substring(1);if(0==t.indexOf(i))return t.substring(i.length,t.length)}return""}},z={open:t=>{if(ShoeSizeMe_loader.currentShoe=t,void 0!==i[t]&&!0===i[t].visible){if(a!=t){if(null!==a&&f.trackUse(e.endpoints.loading,t,"advisor"),b.bulkUpdateAvab(),z.updateShoe(t),a=t,!t in i)return;let s=i[t].isAdultShoe,n=i[t].targetGender,r=JSON.parse("{"+z.buildAvabMessage()+"}");var o=s?"adult":"kid";l.addProfileItem("last_opened",o);let c={message:"ssm_update",shoeLoaded:!0,shoeid:t,isAdultShoe:s,targetGender:n,avabArrays:r.avabArrays};void 0!==i[t].recommendation&&(c.recommendation={},c.recommendation.recommended_sizes={},c.recommendation.recommended_sizes[t]=i[t].recommendation,c.recommendation.sample_sizes=i[t].sample_sizes,c.recommendation.user=v.get()),d.send(JSON.stringify(c))}else d.send('{"message":"plugin_opened"}');d.dataLayer({event:"ssm_plugin_opened"}),f.trackUse(e.endpoints.opening,t,"advisor"),y.open()}},updateShoeGender:e=>{const t=["male","female","kids"];if(-1===t.indexOf(e))return void r.errors.log("wrong gender, please use on of",t);let i={message:"updateShoeGender",targetGender:e};d.send(JSON.stringify(i))},updateShoe:(t,i,o,s,a)=>{let n=e.rules.shoeInfo(t),r={message:"updateShoeInfo"};i&&(r.brand=i),o&&(r.model=o),s&&(r.image=s),a&&(r.gender=a),r.hasOwnProperty("brand")||(n.hasOwnProperty("brand")&&void 0!==n.brand||(n.brand=""),r.brand=n.brand.replace(/&/g,"aDnNAd")),r.hasOwnProperty("gender")||(n.hasOwnProperty("gender")&&void 0!==n.gender||(n.gender=""),r.gender=n.gender.replace(/&/g,"aDnNAd")),r.hasOwnProperty("model")||(n.hasOwnProperty("model")&&void 0!==n.model||(n.model=""),r.model=n.model.replace(/&/g,"aDnNAd")),r.hasOwnProperty("image")||(n.hasOwnProperty("model")&&void 0!==n.image_url||(n.image_url=""),r.image=n.image_url),"brand"in r&&"model"in r&&"image"in r&&d.send(JSON.stringify(r))},updateAvab:()=>{let e='{"message":"avabArrays",'+z.buildAvabMessage()+"}";d.send(e)},buildAvabMessage:()=>{let e=Object.keys(i),t='"avabArrays":{';for(let o=0;o<e.length;o++){let s=void 0!==i[e[o]].availability.avabWidth?`"avabWidth": ${JSON.stringify(i[e[o]].availability.avabWidth)},`:"",a=void 0!==i[e[o]].availability.hideWidth?`"hideWidth": ${JSON.stringify(i[e[o]].availability.hideWidth)},`:"false";t+=`"${e[o]}":{"sizeRun":${JSON.stringify(i[e[o]].availability.sizeRun)},${a}${s}"avabList": ${JSON.stringify(i[e[o]].availability.avabList)}}`,o<e.length-1&&(t+=",")}return t+="}",t}},w={open:()=>{a=null;const e='{"message":"ssm_update","shoeLoaded":false}';d.send(e),d.dataLayer({event:"ssm_touchpoint_opening"}),y.open()},listeners:()=>{let e=[];const t=document.querySelectorAll("*[data-touchpoint]"),i=document.querySelectorAll("*[href='#ssm_open']"),o=document.querySelectorAll(".ssm_open");t.length>0&&e.push(...t),i.length>0&&e.push(...i),o.length>0&&e.push(...o),e.forEach((e=>{w.add(e)}))},add:t=>{if("string"==typeof t){const e=document.getElementsByClassName("point");if(1!==e.length)return;t=e[0]}let i=t.getAttribute("data-touchpoint");if(null==i){let e=t.innerText,o=t.className;i=""!==e?e:o}f.trackUse(e.endpoints.loading,null,`touchpoint ${i}`),t.addEventListener("click",(()=>{f.trackUse(e.endpoints.opening,null,`touchpoint ${i}`)}))}},D={init:async e=>{e=e&&e.length>0?e:[];for(let t in i){let o=i[t];void 0===o.availability&&(o.availability=C.init(t)),e.push(t)}return e},initQuery:async e=>{const t=await D.init(e);return await D.query(t)},get:e=>{let o=i[e];try{let e={shoeId:o.shoeID,size:o.recommendation,recom_size:o.recommendation,scale:o.scale,available:o.availability.avab,gender:t.user.gender};return o.isAdultShoe?(e.user=t.user||null,e.footType=t.user.footType||null,e.footWidth=t.user.footWidth||null,e.birthYear=t.user.birthYear||null):e.kidsshoe=!0,e}catch(e){return r.errors.stack.push(e),!1}},getChunks:e=>{const t=10;if(!1===Array.isArray(e))return[[e]];return e.reduce(((e,i,o)=>{const s=Math.floor(o/t);return e[s]=[].concat(e[s]||[],i),e}),[])},query:async i=>{const s=D.getChunks(i);let a=t.user.status,n=[];for await(let i of s){if(void 0===i||null==i)return!1;C.bulkInit(i);let s=b.splitByAgeType(i);if(0===s.adults.length&&0==s.kids.length)return!1;const r=l.getData(e.cookies.auth);if(_.noData(r)&&0==t.user.hasOwnProperty("kid"))return!1;let d=[];if(s.adults.length>0){let i={method:"user",authtoken:r,targetids:s.adults,shopid:o.shopID,locale:o.locale,sid:o.tokens[e.cookies.sid],target_scale:o.scale};"ref_scale"in t.user&&(i.scale=t.user.ref_scale),"ref_size_id"in t.user&&null!==t.user.ref_size_id&&(i.sizeid=t.user.ref_size_id),"zeroInt"in t.user&&!0===t.user.zeroInt&&(a="recognised"),!1!==r&&d.push(f.recommend(i))}if(s.kids.length>0){let i={method:"kidsshoe",targetids:s.kids,shopid:o.shopID,locale:o.locale,sid:o.tokens[e.cookies.sid],scale:o.scale,target_scale:o.scale};"kid"in t.user&&"size"in t.user.kid&&(i.sizelength=t.user.kid.size),d.push(f.recommend(i,D.set))}if(0===d.length)return!1;let c=await Promise.all(d);n=n.concat(c);for(const e of c)D.set(e,a)}return n},updateOthers:async e=>{const t=Object.keys(e.recommended_sizes).reduce(((e,t)=>(e.push(t),e)),[]);let o=[];for(const[e,s]of Object.entries(i))-1===t.indexOf(e)&&o.push(e);await D.query(o)},set:(e,i,s)=>{void 0!==(e="string"==typeof e?JSON.parse(e):e).last_session_click&&null!==e.last_session_click&&l.addProfileItem("last_session_click",e.last_session_click,s),e.hasOwnProperty("user")&&l.addProfileItem(null,e.user,s);let a=e;const n=a.hasOwnProperty("user");let c=a.recommended_sizes,u=n?a.user.gender:a.gender,h=n?a.user.footWidth:a.footWidth,m=!1;for(let e in c){let i=c[e],s=b.get.data(e);const a=D.calc(i,u,h,e);b.setStatus(e,"recommendation"),b.setScale(e,a.scale),b.setRecom(e,i),b.setText(s,a.avalability,u,o.display_recommended_size),_.shoeSizeEvent({event:"recommendation",shoe_id:s.shoeID});try{let e={shoeId:s.shoeID,size:a.avalability.size,recom_size:a.avalability.size,scale:a.scale,available:a.avalability.isAvab,gender:u};s.isAdultShoe?(e.user=t.user||null,e.footType=t.user.footType||null,e.footWidth=t.user.footWidth||null,e.birthYear=t.user.birthYear||null):e.kidsshoe=!0,m=!0,o.hasOwnProperty("newRecommendation")&&o.newRecommendation(e)}catch(e){r.errors.stack.push(e)}}if(m){void 0===i&&(i="recognised");const e={event:"ssm_recommendation",data:{userType:i}};d.dataLayer(e)}},calc:(e,t,i,s)=>{let a=b.get.data(s).availability.isAvab(e,t,i);if(null===a.size)return!1;let n=D.getScale(o.scale,a.size,a.size.target_gender,t,o.outputGender);return n||(n={scale:o.scale,styled_scale:!1}),{scale:n.scale,style_scale:n.style_scale,avalability:a}},getWidth:(e,t,i)=>{if("string"==typeof e)return e;let o="string"==typeof e.default?e.default:"";return void 0===e[t]?o:"string"==typeof e[t]?e[t]:"string"==typeof e[t][i]?e[t][i]||"":o},getSizeString:(e,t,i)=>{if(r.console.log("getSizeString",{button:e,size:t,gender:i}),null===t)return!1;var s=D.getScale(o.scale,t,t.target_gender,i,o.outputGender);if(!s||!t.hasOwnProperty(s.scale))return!1;var a=g.langpack.get(),n=a.recommendation[t.width];r.console.log("getSizeString scales",s);var l=void 0!==s.style_scale&&""!==s.style_scale&&null!==t[s.style_scale]?s.style_scale:s.scale;if(null===t[l])return!1;var d=t[l].replace(".0","").replace(".33"," \u2153").replace(".66"," \u2154"),c=a.scales[s.scale];o.showScale&&(d=d+" "+c);let u=void 0!==e.availability&&e.availability.hideWidth;if(o.width_output&&!0!==u){const e="undefined"==n||""==t.width?a.recommendation[`shoe_${v.getWidth()}`]:n;let s=void 0!==o.outputGender?o.outputGender:i;d=d+" "+D.getWidth(e,o.shopID,s)}return d},getScale:(e,t,i,o,s)=>{const a=D.getGenderScale(e,t,i,o,s);if(!a)return!1;return{style_scale:D.getStyledScale(t,a),scale:a}},getGenderScale:(e,t,i,o,s)=>{let a=i;"unisex"===i&&(a=void 0!==s?s:o);let n="male"===a?"m":"w",r=`${e}_${n}`;if(void 0===t)return!1;if(void 0!==t[r]&&"none"!==t[r]&&""!==t[r])return r.toLowerCase();if(void 0!==t[e]&&"NaN"!==t[e])return e.toLowerCase();let l=`${e}_${"m"==n?"w":"m"}`;return void 0!==t[l]&&"none"!=t[l]&&""!==t[l]&&l.toLowerCase()},getStyledScale:(e,t)=>{const i=`style_${t}`;return void 0!==e[i]&&"none"!==e[i]&&""!==e[i]?i.toLowerCase():t}},C={init:e=>{let t=new C.Availability;return t.setShoe(e),t},get:e=>{var t=i[e];return{avab:t.availability.avab,size:t.availability.size,scale:t.availability.scale}},bulkInit:e=>{for(let t of e)void 0!==i[t]&&void 0===i[t].availability&&(i[t].availability=C.init(t))},Availability:function(){return{avabList:[],avabWidth:null,hideWidth:!1,sizeRun:[],avab:"none",shoeID:null,size:null,rawSize:null,parsingError:null,oldSize:null,scale:null,lastRecom:null,gender:null,isAvab:function(e,t,i){const o=C.validation.isAvab(e,t,i,this.shoeID);return this.lastRecom=e,this.gender=o.gender,this.footWidth=o.footWidth,this.scale=o.scale,this.avab=o.avab,this.oldSize=o.oldSize,this.size=o.size,{isAvab:o.avab,size:o.size,rawSize:o.rawSize,scale:this.scale}},isInStock:function(){return C.validation.inStock(this.size,this.scale,this.footWidth,this.avabList,this.avabWidth)},validateParsing:function(e){const t=C.validation.parsing(e,this.scale);return"error"in t?(this.parsingError=t,!1):(this.avabList=t.avabList,this.sizeRun=t.sizeRun,"hideWidth"in t&&(this.hideWidth=t.hideWidth),"avabWidth"in t&&(this.avabWidth=t.avabWidth),t)},setShoe:function(e){this.shoeID=e}}},validation:{availabilityScale:(e,t,i,o,s)=>{let a=i;"unisex"===i&&(a=void 0!==s?s:o);let n=`${e}_${"male"===a?"m":"w"}`;return void 0===t&&n.toLowerCase(),void 0!==t[n]?n.toLowerCase():void 0!==t[e]&&e.toLowerCase()},inStock:(e,t,i,o,s)=>{let a=e[t],n=i||"width_normal",r=String(a).replace(".0",""),l=parseFloat(r),d=o.indexOf(l)>-1;if(!d)return!1;if(null==s||0===Object.keys(s).length)return d;if(void 0===s[r])return!1;let c=-1!==s[r].indexOf(n);return d&&c},roundSizes:(t,i,o,s)=>{var a=parseFloat(o[s]);if(t.indexOf(a)>-1||""==e.rules.roundRule)return{round:{avab:!1,rounded:!1},size:o};var n=e.rules.roundRule(this,{...o}),r=i.indexOf(parseFloat(n[s]))>-1,l=!1;if(r)l=n[s]!==o[s];return{round:{avab:r,rounded:l},size:n}},parsing:(t,i)=>{try{let o={},s=e.rules.parsingFunction(t);if(!1===s||void 0===s||!1===s.hasOwnProperty("availableSizes")||!1===s.hasOwnProperty("sizeRun")||0===s.sizeRun.length||0===s.availableSizes.length||!1===s.availableSizes&&0!==s.availableSizes)throw new Error("Cannot parse Avab");let a=C.validation.buildSizesArray(s.availableSizes,i),n=C.validation.buildSizesArray(s.sizeRun,i);if(a.error||n.error)throw new Error(`Avab: ${a.error}, SizeRun: ${n.error}`);return o.avabList=a,o.sizeRun=n,"hideWidth"in s&&(o.hideWidth=s.hideWidth),"availableSizes"in s&&(o.avabWidth=s.availableWidth),o}catch(e){return r.errors.log(e),r.errors.stack.push(e),{error:!0,errorMessage:e.message,parsingCode:0}}},buildSizesArray:(e,t)=>{for(var i=[],o=0;o<e.length;o++){var s=e[o];if(isNaN(s))return{error:`buildSizesArray - Not a number ${s}`,errorCode:1};if(!C.validation.isSize(s,t))return{error:`buildSizesArray - Not a Size ${s}`,errorCode:2};i.push(parseFloat(s))}return i},isSize:(t,i)=>(i=i.replace("_m","").replace("_w",""),void 0!==e.validSizes[i]&&(t>=e.validSizes[i][0]&&t<=e.validSizes[i][1])),isAvab:(t,i,s,a)=>{let n={lastRecom:t,gender:i,footWidth:s},r=!1;const l=D.getScale(o.scale,t,t.target_gender,i,o.outputGender);n.scale=l.scale;let d=C.validation.availabilityScale(o.scale,t,t.target_gender,i,o.outputGender),c={shopid:o.shopID,shoeid:a,sid:o.tokens[e.cookies.sid],scale:d,recommendedsize:"none",outputsize:null,rounded:!1};if(0==n.scale||"none"==t[n.scale]||""==t[n.scale]||null==t[n.scale])r="none",n.size=n.rawSize=t;else{const i=C.validation.parsing(a,n.scale);if("error"in i){r=!1,n.size=n.rawSize=t;let e={shop_id:c.shopid,shoe_id:c.shoeid,error_code:i.errorCode};f.error(e)}else{let o={sizeRun:i.sizeRun,avabList:i.avabList};if(n.size=n.rawSize=e.rules.specialRules(o,t,i.sizeRun,n.scale),c.recommendedsize=t[n.scale],c.outputsize=null!==n.rawSize?n.rawSize[n.scale]:null,C.validation.inStock(n.size,n.scale,s,i.avabList,i.avabWidth))r=!0;else{let e=C.validation.roundSizes(i.sizeRun,i.avabList,n.size,n.scale);r=e.round.avab,c.rounded=e.round.rounded,n.size=e.size}}}return f.availability(c),n.oldSize=t[n.scale],n.avab=r,n}}};u.init();const A=(()=>{const i={trackEvent:e=>{_paq.push(["trackEvent",e.category,e.action,e.name,e.value])},pageView:e=>{_paq.push(["setCustomUrl",`/${e.path}`]),_paq.push(["setDocumentTitle",e.title]),_paq.push(["trackPageView"])},setCustomDimension:(e,t)=>{let i=0;switch(e){case"host":i=1;break;case"shopID":i=2;break;case"sid":i=3}_paq.push(["setCustomDimension",i,t])}},s=e=>{const t=e.action,o=e.data;i[t](o)};return{init:async()=>{_paq.push(["setCustomDimension",1,o.domain]),_paq.push(["setCustomDimension",2,t.loaderContent.shopID]),_paq.push(["setCustomDimension",3,o.tokens[e.cookies.sid]]),_paq.push(["setDocumentTitle",document.domain+"/"+document.title]),_paq.push(["enableLinkTracking"]);var i="//analytics.shoesize.me/";_paq.push(["setTrackerUrl",i+"matomo.php"]),_paq.push(["setSiteId","3"]);var s=document,a=s.createElement("script"),n=s.getElementsByTagName("script")[0];a.type="text/javascript",a.async=!0,a.src=i+"matomo.js",n.parentNode.insertBefore(a,n)},tracking:i,event:s}})();return{matomo:A,closeWindow:y.close,errors:r.errors.stack,loaderContent:t.loaderContent,util:k,openPlugin:u.open,startPlugin:u.start,setConfigParam:g.set,getConfig:g.get.data,getVersion:g.get.version,updateShoeInfo:z.updateShoe,updateShoeGender:z.updateShoeGender,getIsAdultButtonList:b.get.shoeGate,getButtonsList:b.get.list,getButtonHtml:b.get.html,loadAjaxButton:b.ajax.loadOne,loadSingleButton:b.ajax.loadOne,loadMultipleButtons:b.ajax.loadMany,updateShoeAvab:b.updateAvab,SSMButton:b.SSMButton,resetButtons:b.reset,rebuildButton:b.rebuild,buildButton:b.setAttributes,action:b.action,initAvailability:C.init,getAvabFor:C.get,initRecommendation:D.initQuery,getRecommendation:D.query,setRecommendation:D.set,calculateRecommendation:D.calc,getRecomData:D.get,zeroInteraction:S.query,setStatus:b.setStatus,trackUse:f.trackUse,getShoeWidth:p.getWidth,getSizeStringFor:p.getSize,getUserData:v.get,store:l,touchpoints:{add:w.add}}}();const ShoeSizeMeQ_loader={openPlugin:()=>{ShoeSizeMe_loader.openPlugin()}},ShoeSizeMe={init:e=>{ShoeSizeMe_loader.initRecommendation(e)},ssmMin:e=>{ShoeSizeMe_loader.initRecommendation(e)},resetButtons:()=>{ShoeSizeMe_loader.resetButtons()},setStatus:(e,t)=>{ShoeSizeMe_loader.setStatus(e,t)},getRecommendation:e=>{ShoeSizeMe_loader.getRecommendation(e)},setRecommendation:e=>{ShoeSizeMe_loader.setRecommendation(e)},calculateRecommendation:(e,t,i,o)=>{ShoeSizeMe_loader.calculateRecommendation(e,t,i,o)},getRecomData:e=>{ShoeSizeMe_loader.getRecomData(e)},getShoeWidth:e=>{ShoeSizeMe_loader.getShoeWidth(e)},initAvailability:e=>{ShoeSizeMe_loader.initAvailability(e)},rebuildButton:e=>{ShoeSizeMe_loader.rebuildButton(e)},getAvabFor:e=>{ShoeSizeMe_loader.getAvabFor(e)},getSizeStringFor:e=>{ShoeSizeMe_loader.getSizeStringFor(e)},close:()=>{ShoeSizeMe_loader.closeWindow()},getUserData:()=>{ShoeSizeMe_loader.getUserData()}};