w Set(); function check() { try { for (const e of document.querySelectorAll(sel)) { if (observed.has(e)) { continue; } observed.add(e); try { fn(e); } catch (_) {} if (opts.once) { clearInterval(interval); } } } catch (_) {} } interval = setInterval(check, 250); const timeout = { opts }; if (timeout) { setTimeout(() => { clearInterval(interval); }, timeout); } }; const utils = { Promise: window.Promise, observeSelector, poll, waitForElement, waitUntil, }; const visitorId = { randomId: "", }; let browserVersion = ""; try { browserVersion = navigator.userAgent.match(/rv:(.*)\)/)[1]; } catch (_) {} const visitor = { browserId: "ff", browserVersion, currentTimestamp: Date.now(), custom: {}, customBehavior: {}, device: "desktop", device_type: "desktop_laptop", events: [], first_session: true, offset: 240, referrer: null, source_type: "direct", visitorId, }; window.optimizely = { data: { note: "Obsolete, use optimizely.get('data') instead", }, get(e) { switch (e) { case "behavior": return behavior; case "data": return data; case "dcp": return dcp; case "jquery": throw new Error("jQuery not implemented"); case "session": return undefined; case "state": return state; case "utils": return utils; case "visitor": return visitor; case "visitor_id": return visitorId; } return undefined; }, initialized: true, push() {}, state: {}, }; } PK