(function () { 'use strict'; var v = window.SOON_APP_VERSION || ''; window.soonWithVersion = function (url) { if (!url || /^https?:\/\//i.test(url) || /^data:/i.test(url)) return url; if (!v) return url; var s = String(url); var hashIdx = s.indexOf('#'); var hash = hashIdx >= 0 ? s.slice(hashIdx) : ''; var noHash = hashIdx >= 0 ? s.slice(0, hashIdx) : s; return noHash.split('?')[0] + '?v=' + encodeURIComponent(v) + hash; }; window.soonPatchForward = function (fromEl) { var fn = window.soonWithVersion; if (typeof fn !== 'function') return; var el = fromEl && fromEl.nextElementSibling; while (el) { if (el.tagName === 'SCRIPT') { var src = el.getAttribute('src'); if (src && src.indexOf('version.js') < 0 && src.indexOf('soon-cache.js') < 0) { el.src = fn(src); } } else if (el.tagName === 'LINK' && el.rel === 'stylesheet') { var href = el.getAttribute('href'); if (href) el.href = fn(href); } el = el.nextElementSibling; } }; if (v) { var KEY = 'soondesign_app_version'; try { var prev = localStorage.getItem(KEY); if (prev && prev !== v) { localStorage.setItem(KEY, v); var url = new URL(window.location.href); if (url.searchParams.get('_sv') !== v) { url.searchParams.set('_sv', v); window.location.replace(url.toString()); return; } } localStorage.setItem(KEY, v); } catch (e) { /* ignore */ } } if (document.currentScript) { window.soonPatchForward(document.currentScript); } })();