import"./_commonjsHelpers.DLRdUVbD.js";import{P as Je,v as lt,u as _t,O as Ht,m as Kt,w as Gt,N as ye,R as Jt,C as We,x as ft,k as ke}from"./_baseToString.BF64sBRd.js";import{b as Ce,E as Wt,a as qt,s as dt}from"./helpers.M5brrsJZ.js";import{D as E,H as le,A as P,F as qe,B as R,a as $t,b as zt,s as jt,c as Ie,f as Yt,h as Ne,g as Le,i as ht,j as gt,k as Xt,e as Qt,d as Zt}from"./scroll.D6z732Vi.js";import{g as vt}from"./device-id-helpers.B2Idniwd.js";import{A as u,c as _,J as p,L as $e,u as er,a as tr,b as rr}from"./localization.6UVxnx2i.js";import{v as nr,e as ir,s as sr}from"./v4.BUi6ZNk5.js";import{r as pt}from"./ui-kit.CdKkDd1h.js";import"./index.sJbE5A2F.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="45d8386a-89e4-45d8-90a5-ee428dba572f",r._sentryDebugIdIdentifier="sentry-dbid-45d8386a-89e4-45d8-90a5-ee428dba572f")}catch{}})();const or={FOOTER_SPACE:"footer-space-test",ARTICLE_MENU_ABC:"article_menu_abc_test",HOME_PAGE_ARTICLE_SNIPPET:"comments:article_snippet",MAIN_PAGE_ARTICLE_SNIPPET:"main_page:article_snippet",ONE_TAP:"auth:one_tap",AUTH_ONBOARDING:"onboarding:show_on_auth",BOOKMARKS_ARTICLES:"bookmarks:articles"},ar=r=>({[u.DIRECT_LINKS_CLICK]:({position:e,direct_link_url:t})=>{r("event","direct_links_click",{position:e,direct_link_url:t})},[u.DIRECT_LINKS_IMPRESSION]:({position:e,direct_link_url:t})=>{r("event","direct_links_impression",{position:e,direct_link_url:t})}}),W="user_authentication",cr=r=>({[u.SIGN_UP_WITH_GOOGLE_CLICK]:()=>r.trackEvent(_.TAP,{event_target:"sign_up_with_google_button",event_target_component:"sign_up_form",event_target_layout_section:"main_content",feature:W}),[u.SIGN_UP_WITH_GOOGLE_SUCCESS]:({isRegistration:e})=>r.trackEvent(_.RESOLVE,{event_target:"google_auth",event_target_value:"You have successfully logged in to your profile!",event_target_initiator:e?"sign_up":"log_in",event_target_layout_section:"popover",feature:W}),[u.SIGN_UP_WITH_ONE_TAP_SUCCESS]:()=>r.trackEvent(_.RESOLVE,{event_target:"google_auth",event_target_value:"You have successfully logged in to your profile!",event_target_initiator:"one_tap_auth",event_target_layout_section:"popover",feature:W}),[u.SIGN_UP_WITH_GOOGLE_BUTTON_OBSERVE]:()=>r.trackEvent(_.RESOLVE,{event_target:"sign_up_with_google_button",event_target_component:"sign_up_form",event_target_layout_section:"main_content",feature:W})}),ur=r=>({[u.INTERNAL_SERVER_ERROR]:e=>r.trackEvent(_.ERROR,e),[u.RATE_LIMIT_EXCEEDED_ERROR]:e=>r.trackEvent(_.ERROR,e)}),q="article_bookmarks",lr=r=>({[u.BOOKMARKS_ADD]:({layoutSelection:e})=>{r.trackEvent(_.CHANGE,{event_target:"bookmark_toggler",event_target_value:"add",event_target_component:"article_action_menu",event_target_layout_section:e,feature:q})},[u.BOOKMARKS_OPEN_LIST]:()=>{r.trackEvent(_.TAP,{event_target:"bookmarks_summary",event_target_component:"bookmarks_summary",event_target_layout_section:"left_drawer",feature:q})},[u.BOOKMARKS_CLICK_ARTICLE]:()=>{r.trackEvent(_.TAP,{event_target:"bookmarks_publication",event_target_component:"bookmarks_publication",event_target_layout_section:"right_drawer",feature:q})},[u.BOOKMARKS_REMOVE_ARTICLE]:()=>{r.trackEvent(_.TAP,{event_target:"delete_button",event_target_component:"bookmarks_publication",event_target_layout_section:"right_drawer",feature:q})}}),_r=r=>({[u.ADFOX_PLACEMENT_IMPRESSION]:({containerId:e})=>{r.trackEvent(_.OBSERVE,{event_target:e,event_target_component:e,event_target_value:100,feature:"advertisement"})},[u.ADFOX_CREATIVE_IMPRESSION]:({containerId:e})=>{r.trackEvent(_.OBSERVE,{event_target:"banner",event_target_component:e,event_target_value:100,feature:"advertisement"})},[u.ADFOX_TAP_ON_BANNER]:({containerId:e})=>{r.trackEvent(_.TAP,{event_target:"banner",event_target_component:e,feature:"advertisement"})},[u.ADFOX_STUB]:({containerId:e})=>{r.trackEvent(_.RESOLVE,{event_target:e,event_target_component:e,event_target_value:"No ad available for this placement",feature:"advertisement"})},[u.ADFOX_ERROR]:({containerId:e,message:t})=>{r.trackEvent(_.RESOLVE,{event_target:e,event_target_component:e,event_target_value:t,feature:"advertisement"})}}),ze="onboarding",fr=r=>({[u.ONBOARDING_OBSERVE_EVENT]:()=>r.trackEvent(_.OBSERVE,{event_target:"onboarding_invitation",event_target_component:"onboarding_invitation",event_target_layout_section:"modal_window",feature:ze}),[u.ONBOARDING_INITIAL_SCREEN_ACTION_EVENT]:()=>r.trackEvent(_.TAP,{event_target:"learn_more_button",event_target_component:"onboarding_invitation",event_target_layout_section:"modal_window",feature:ze})}),dr=r=>({[p.LOG_IN_HEADER_BUTTON_CLICK]:()=>r.trackEvent(_.TAP,{event_target:"log_in_button",event_target_component:"header",event_target_layout_section:"app_bar",feature:"user_authentication"}),[p.PROFILE_HEADER_BUTTON_CLICK]:()=>r.trackEvent(_.TAP,{event_target:"profile_button",event_target_component:"header",event_target_layout_section:"app_bar",feature:"user_profile"}),[p.CLICK_MENU_BUTTON]:()=>r.trackEvent("tap",{...E,event_target:"menu_toggler",event_target_text_content:"Меню",event_target_component:le,event_target_layout_section:P}),[p.CLICK_HEADER_LOGO]:()=>r.trackEvent("tap",{...E,event_target:"logo",event_target_component:le,event_target_layout_section:P}),[p.CLICK_FEATURE_MENU_ITEM]:({name:e,id:t})=>r.trackEvent("tap",{...E,event_target:"menu_item",event_target_text_content:e,event_target_component:qe,event_target_index:t,event_target_layout_section:P}),[p.CHANGE_LANG_IN_HEADER]:({newLang:e})=>r.trackEvent("change",{...E,event_target:"language_toggler",event_target_value:e,event_target_component:qe,event_target_layout_section:P}),[p.CHANGE_LANG_IN_BURGER]:({newLang:e,sectionId:t})=>r.trackEvent("change",{...E,event_target:"language_toggler",event_target_value:e,event_target_component:R[t],event_target_component_index:t}),[p.CLOSE_BURGER_WITH_BUTTON]:()=>r.trackEvent("tap",{...E,event_target:"close_button",event_target_text_content:"Закрыть"}),[p.CLOSE_BURGER_WITH_HEADER_BUTTON]:()=>r.trackEvent("tap",{...E,event_target:"close_button",event_target_component:le,event_target_layout_section:P}),[p.CLOSE_BURGER_BY_OVERLAY_CLICK]:()=>r.trackEvent("tap",{...E,event_target:"overlay"}),[p.CLOSE_BURGER_EVENT]:()=>r.trackEvent("resolve",{...E,event_target:"left_drawer",event_target_value:"close"}),[p.CLICK_ON_CATEGORY]:({name:e,index:t,sectionIndex:n})=>r.trackEvent("tap",{...E,event_target:"menu_item",event_target_text_content:e,event_target_index:t,event_target_component:R[n],event_target_component_index:n}),[p.CLICK_ON_SUB_CATEGORY]:({name:e,index:t,sectionIndex:n})=>{r.trackEvent("tap",{...E,event_target:"menu_subitem",event_target_text_content:e,event_target_index:t,event_target_component:R[n],event_target_component_index:n})},[p.CHANGE_CATEGORY_BEHAVIOR]:({isExpanded:e,index:t,sectionIndex:n})=>r.trackEvent("change",{...E,event_target:"menu_item_toggler",event_target_index:t,event_target_value:e?"expand":"collapse",event_target_component:R[n],event_target_component_index:n}),[p.CLICK_FEEDBACK_FORM_LINK]:({sectionIndex:e,text:t})=>r.trackEvent("tap",{...E,event_target:"feedback_form_link",event_target_text_content:t,event_target_component:"feedback_form_link",event_target_component_index:e}),[p.CLICK_CORPORATE_CLIENTS_LINK]:({sectionIndex:e,text:t})=>r.trackEvent("tap",{...E,event_target:"corporate_clients_link",event_target_text_content:t,event_target_component:"corporate_clients_link",event_target_component_index:e}),[p.CLICK_SOCIAL_MENU_ITEM]:({text:e,index:t,sectionIndex:n})=>r.trackEvent("tap",{...E,event_target:"social_networks_menu",event_target_index:t,event_target_alt_text:e,event_target_component:R[n],event_target_component_index:n}),[p.CLICK_DOWNLOAD_LINKS]:({text:e,index:t,sectionIndex:n})=>r.trackEvent("tap",{...E,event_target:"downloads_menu",event_target_index:t,event_target_alt_text:e,event_target_component:R[n],event_target_component_index:n}),[p.CLICK_EDITORIAL_TEAM_CONTACTS]:({name:e,index:t,sectionIndex:n})=>r.trackEvent("tap",{...E,event_target:"menu_item",event_target_text_content:e,event_target_index:t,event_target_component:R[n],event_target_component_index:n}),[p.CLICK_MAIN_OFFICE_CONTACTS]:({name:e,sectionIndex:t})=>r.trackEvent("tap",{...E,event_target:"main_office_contacts",event_target_text_content:e,event_target_component:R[t],event_target_component_index:t})}),hr=r=>{window.dispatchEvent(new CustomEvent($t,{detail:zt})),jt(!0,r),window.jitsuPlugin.jitsu.set({is_authenticated:!0})},gr=()=>{const r=navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(r)},mt=()=>gr()?Je.smartphone:Je.desktop;async function Et(r){try{const e=await window.navigator.permissions.query({name:"notifications"});return e.onchange=({target:t={}})=>{r.set({permission_notification:t?.state})},e.state==="prompt"?"default":e.state}catch{return window.Notification&&window.Notification.permission?window.Notification.permission:"Does not supported"}}const vr=async r=>{const e=Ie(),t=Yt(Ne()),n=Le("userTransitionDeviceId");return e?(r.set({registration_source:t?.provider||"No data provided",user_has_google_linked:t?.provider==="google",user_has_phone_linked:t?.role==="extended",user_has_nickname:!!t?.username}),await r.id({account_id:t?.id},!0)):(r.unset("registration_source",{}),r.unset("user_has_google_linked",{}),r.unset("user_has_phone_linked",{}),r.unset("user_has_nickname",{})),n&&await r.id({transition_device_id:n},!0),await r.id({id:ht(),device_id:vt()},!0)},je=r=>{const e={doc_host:""};return r&&e?{...e,doc_host:e.doc_host.replace(/^https?:\/\//,"")}:{}},T={JITSU:"jitsu",GTAG:"gtag",ON_THE:"onThe"};let N={};const xe=(r,e)=>{const t=N[r]||[];N={...N,[r]:[...t,e]}},Be=r=>N[r]||[],Me=r=>{const e={};return Object.keys(N).forEach(t=>{t!==r&&(e[t]=N[t])}),e},pr=()=>{const r=sessionStorage.getItem("browserTabId");if(!r){const e=nr();return sessionStorage.setItem("browserTabId",e),e}return r};function yt({articleId:r,page:e,category:t=[],subcategory:n=[],authorIds:i=[],contentType:s="",referer:o}){const a=Ne(),l={is_logged:gt(a)};o&&(l.referer=o);const c={...l,page_category:t.join()};switch(n.length&&(c.page_subcategory=n.join()),e){case"Article":return{...c,article_id:r?Number(r):"",article_authors_ids:i.join(),article_attr_content_type:s};case"Rubric":return c;default:return l}}class mr{isInitialized=!1;VERSION="0.2.0";onThe={};constructor(){lt("ontheScript","https://cdn.onthe.io/io.js?ghDf5sWW6gLM",()=>{let e=_t();const t={page_url:window.location.href,page_url_canonical:e.url_canonical,page_title:document.title,page_type:e.page_type,page_language:e.language.toLowerCase()};if(e.referer&&(t.referer=e.referer),(e.page_type==="article"||e.page_type==="recipe")&&(t.article_id=Number(e.articleId),t.article_type=e.article_type,t.article_authors=e.authors,t.article_authors_ids=e.authorIds,t.article_categories=e.category_title,t.article_publication_date=e.publication_date,e.subcategory&&(t.article_subcategories=e.subcategory)),this.onThe._io_config=this.onThe._io_config||{},this.onThe._io_config.version=this.VERSION,this.onThe._io_config[this.VERSION]=this.onThe._io_config[this.VERSION]||[],Array.isArray(this.onThe._io_config[this.VERSION])){const n=this.onThe._io_config[this.VERSION];n.every(i=>typeof i=="object")&&n.push(t)}window._io_config=window._io_config||{},window._io_config.version=this.VERSION,window._io_config[this.VERSION]=window._io_config[this.VERSION]||[],window._io_config[this.VERSION].push(t),this.isInitialized=!0,this.trackCallbacks()},e=>console.error(e))}trackCallbacks=()=>{const e=Be(T.ON_THE);e.length>0&&(e.forEach(t=>{Array.isArray(t)?this.trackEvent(...t):this.trackEvent(t)}),Me(T.ON_THE))};trackEvent=(...e)=>{if(this.isInitialized){window._io_config[this.VERSION].push(...e);return}xe(T.ON_THE,e)}}class Er{constructor(){lt("gtagScript","https://www.googletagmanager.com/gtag/js?id=G-L3EYGX7DJS",()=>{window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config","G-L3EYGX7DJS",{transport_type:"beacon",send_page_view:!1}),this.trackCallbacks()},e=>{console.error(e)})}trackCallbacks=()=>{const e=Be(T.GTAG);e.length>0&&(e.forEach(t=>{Array.isArray(t)?this.trackEvent(...t):this.trackEvent(t)}),Me(T.GTAG))};trackEvent=(...e)=>{if(window.gtag){window.gtag(...e);return}xe(T.GTAG,e)}}var v=function(){return v=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]0&&(t=n)}else r&&(t=r);var i={minLogLevel:t};return Object.values(V).forEach(function(s){var o=s.name,a=s.severity;i[o.toLowerCase()]=function(){for(var l=[],c=0;c=t.severity&&l.length>0){var f=l[0],d=l.splice(1),g="[J-".concat(o,"] ").concat(f);o==="DEBUG"||o==="INFO"?console.log.apply(console,_e([g],d,!1)):o==="WARN"?console.warn.apply(console,_e([g],d,!1)):console.error.apply(console,_e([g],d,!1))}}}),br("logger",i),i}function b(r=void 0){const e=!!globalThis.window&&!!globalThis.window.document&&!!globalThis.window.location;return!e&&r&&h().warn(r),e}function Pe(r=void 0){if(!b())throw new Error(r||"window' is not available. Seems like this code runs outside browser environment. It shouldn't happen");return window}function bt(r,e,t){var n;t===void 0&&(t={});var i=encodeURIComponent,s=i(e),o=r+"="+s;if(o+="; Path="+((n=t.path)!==null&&n!==void 0?n:"/"),t.maxAge&&(o+="; Max-Age="+Math.floor(t.maxAge)),t.domain&&(o+="; Domain="+t.domain),t.expires&&(o+="; Expires="+t.expires.toUTCString()),t.httpOnly&&(o+="; HttpOnly"),t.secure&&(o+="; Secure"),t.sameSite){var a=typeof t.sameSite=="string"?t.sameSite.toLowerCase():t.sameSite;switch(a){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o}var wr=function(){if(b())return window.location.hostname.replace("www.","")};function wt(r){if(!r)return{};for(var e={},t=r.split(";"),n=0;n0&&(e[i.substr(n>0?1:0,n>0?s-1:s)]=i.substr(s+1))}return e}function Sr(r,e){return Array.from(r.attributes).forEach(function(t){e.setAttribute(t.nodeName,t.nodeValue)})}function Ar(r,e){r.innerHTML=e;var t=r.getElementsByTagName("script"),n;for(n=t.length-1;n>=0;n--){var i=t[n],s=document.createElement("script");Sr(i,s),i.innerHTML&&(s.innerHTML=i.innerHTML),s.setAttribute("data-jitsu-tag-id",r.id),document.getElementsByTagName("head")[0].appendChild(s),t[n].parentNode.removeChild(t[n])}}var Tr=function(r){var e=wt(document.cookie);return e},St=function(r){return r&&decodeURIComponent(Pe().document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(r).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},At=function(r,e,t){t===void 0&&(t={}),Pe().document.cookie=bt(r,e,t)},Ue=function(r,e){e===void 0&&(e="/"),document.cookie=r+"= ; expires = Thu, 01 Jan 1970 00:00:00 GMT"+(e?"; path = "+e:"")},Tt=function(){return Math.random().toString(36).substring(2,12)},Ye=function(){return Math.random().toString(36).substring(2,7)},Rr=function(r){if(!r)return{};for(var e=r.length>0&&r.charAt(0)==="?"?r.substring(1):r,t={},n=(e[0]==="?"?e.substr(1):e).split("&"),i=0;i=7?r:r.slice(0,-1)+"0".repeat(7-e.length)+"Z"};function Lr(r,e){return r.indexOf(e,r.length-e.length)!==-1}var xr=function(r){for(;Lr(r,"/");)r=r.substr(0,r.length-1);return r.indexOf("https://")===0||r.indexOf("http://")===0?r:"https://"+r},Br=function(){function r(){this.queue=[]}return r.prototype.flush=function(){var e=this.queue;return this.queue=[],e},r.prototype.push=function(){for(var e,t=[],n=0;n0&&e.indexOf(r)!==0?r+e:e)}function Gr(r,e){for(var t=0,n=typeof r=="string"?[r]:r;t0&&e.charAt(e.length-1)===i;)e=e.substring(0,e.length-1);return e}function de(r,e,t){t===void 0&&(t={});var n=function(i,s){var o=i.headers[s.toLowerCase()];if(o){if(typeof o=="string")return o;if(o.length>0)return o.join(",")}};return{getAnonymousId:function(i){var s=i.name,o=i.domain;if(t?.disableCookies)return"";var a=wt(r.headers.cookie)[s];if(a)return a;var l={maxAge:316224e3,httpOnly:!1};o&&(l.domain=o);var c=Tt();return e.setHeader("Set-Cookie",bt(s,c,l)),c},getSourceIp:function(){var i=n(r,"x-forwarded-for")||n(r,"x-real-ip")||r.socket.remoteAddress;return i&&i.split(",")[0].trim()},describeClient:function(){var i=r.url?new URL(r.url,r.url.startsWith("http")?void 0:"http://localhost"):{},s=n(r,"x-forwarded-host")||n(r,"host")||i.hostname,o=Gr([":","/"],n(r,"x-forwarded-proto")||i.protocol),a=Qe("?",i.search),l=Qe("/",i.pathname);return{doc_encoding:"",doc_host:s,doc_path:r.url,doc_search:a,page_title:"",referer:n(r,"referrer"),screen_resolution:"",url:"".concat(o,"://").concat(s).concat(l||"").concat(a||""),user_agent:r.headers["user-agent"],user_language:r.headers["accept-language"]&&r.headers["accept-language"].split(",")[0],vp_size:""}}}}var Jr={getSourceIp:function(){},describeClient:function(){return{}},getAnonymousId:function(){return""}},Ze={httpApi:de,nextjsApi:de,browser:function(){return Kr},express:de,empty:function(){return Jr}},et=function(r,e,t,n){n===void 0&&(n=function(s,o){});var i=new window.XMLHttpRequest;return new Promise(function(s,o){i.onerror=function(a){h().error("Failed to send payload to ".concat(r,": ").concat(a?.message||"unknown error"),e,a),n(-1,{}),o(new Error("Failed to send JSON. See console logs"))},i.onload=function(){i.status!==200?(n(i.status,{}),h().warn("Failed to send data to ".concat(r," (#").concat(i.status," - ").concat(i.statusText,")"),e),o(new Error("Failed to send JSON. Error code: ".concat(i.status,". See logs for details")))):n(i.status,i.responseText),s()},i.open("POST",r),i.setRequestHeader("Content-Type","application/json"),Object.entries(t||{}).forEach(function(a){var l=a[0],c=a[1];return i.setRequestHeader(l,c)}),i.send(e),h().debug("sending json",e)})},Wr=function(r){return function(e,t,n,i){return i===void 0&&(i=function(s,o){}),be(void 0,void 0,void 0,function(){var s,o,a,l,c,f,d,g;return we(this,function(m){switch(m.label){case 0:return m.trys.push([0,2,,3]),[4,r(e,{method:"POST",headers:v({Accept:"application/json","Content-Type":"application/json"},n||{}),body:t})];case 1:return s=m.sent(),[3,3];case 2:return o=m.sent(),h().error("Failed to send data to ".concat(e,": ").concat(o?.message||"unknown error"),t,o),i(-1,{}),[2];case 3:if(s.status!==200)return h().warn("Failed to send data to ".concat(e," (#").concat(s.status," - ").concat(s.statusText,")"),t),i(s.status,{}),[2];a={},l="",c=(g=(d=s.headers)===null||d===void 0?void 0:d.get("Content-Type"))!==null&&g!==void 0?g:"",m.label=4;case 4:return m.trys.push([4,6,,7]),[4,s.text()];case 5:return l=m.sent(),a=JSON.parse(l),[3,7];case 6:return f=m.sent(),h().error("Failed to parse ".concat(e," response. Content-type: ").concat(c," text: ").concat(l),f),[3,7];case 7:try{i(s.status,a)}catch(y){h().error("Failed to handle ".concat(e," response. Content-type: ").concat(c," text: ").concat(l),y)}return[2]}})})}},qr=function(){function r(){this.userProperties={},this.permanentProperties={globalProps:{},propsPerEvent:{}},this.cookieDomain="",this.trackingHost="",this.idCookieName="",this.randomizeUrl=!1,this.apiKey="",this.initialized=!1,this._3pCookies={},this.cookiePolicy="keep",this.ipPolicy="keep",this.beaconApi=!1,this.transport=et,this.customHeaders=function(){return{}},this.queue=new Br,this.maxSendAttempts=4,this.retryTimeout=[500,1e12],this.flushing=!1,this.attempt=1}return r.prototype.id=function(e,t){return this.userProperties=v(v({},this.userProperties),e),h().debug("Jitsu user identified",e),this.userIdPersistence?this.userIdPersistence.save(e):h().warn("Id() is called before initialization"),t?Promise.resolve():this.track("user_identify",{})},r.prototype.rawTrack=function(e){return this.sendJson(e)},r.prototype.makeEvent=function(e,t,n){var i,s=n.env,o=yr(n,["env"]);s||(s=b()?Ze.browser():Ze.empty()),this.restoreId();var a=this.getCtx(s),l=v(v({},this.permanentProperties.globalProps),(i=this.permanentProperties.propsPerEvent[e])!==null&&i!==void 0?i:{}),c=v({api_key:this.apiKey,src:t,event_type:e},o),f=s.getSourceIp();return f&&(c.source_ip=f),this.compatMode?v(v(v({},l),{eventn_ctx:a}),c):v(v(v({},l),a),c)},r.prototype._send3p=function(e,t,n){var i="3rdparty";n&&n!==""&&(i=n);var s=this.makeEvent(i,e,{src_payload:t});return this.sendJson(s)},r.prototype.sendJson=function(e){return be(this,void 0,Promise,function(){return we(this,function(t){switch(t.label){case 0:return this.maxSendAttempts>1?(this.queue.push([e,0]),this.scheduleFlush(0),[3,3]):[3,1];case 1:return[4,this.doSendJson(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},r.prototype.doSendJson=function(e){var t=this,n=this.cookiePolicy!=="keep"?"&cookie_policy=".concat(this.cookiePolicy):"",i=this.ipPolicy!=="keep"?"&ip_policy=".concat(this.ipPolicy):"",s=b()?"/api/v1/event":"/api/v1/s2s/event",o="".concat(this.trackingHost).concat(s,"?token=").concat(this.apiKey).concat(n).concat(i);this.randomizeUrl&&(o="".concat(this.trackingHost,"/api.").concat(Ye(),"?p_").concat(Ye(),"=").concat(this.apiKey).concat(n).concat(i));var a=JSON.stringify(e);return h().debug("Sending payload to ".concat(o),a),this.transport(o,a,this.customHeaders(),function(l,c){return t.postHandle(l,c)})},r.prototype.scheduleFlush=function(e){var t=this;if(!this.flushing){if(this.flushing=!0,typeof e>"u"){var n=Math.random()+1,i=Math.pow(2,this.attempt++);e=Math.min(this.retryTimeout[0]*n*i,this.retryTimeout[1])}h().debug("Scheduling event queue flush in ".concat(e," ms.")),setTimeout(function(){return t.flush()},e)}},r.prototype.flush=function(){return be(this,void 0,Promise,function(){var e,t,n=this;return we(this,function(i){switch(i.label){case 0:if(b()&&!window.navigator.onLine&&(this.flushing=!1,this.scheduleFlush()),e=this.queue.flush(),this.flushing=!1,e.length===0)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.doSendJson(e.map(function(s){return s[0]}))];case 2:return i.sent(),this.attempt=1,h().debug("Successfully flushed ".concat(e.length," events from queue")),[3,4];case 3:return i.sent(),e=e.map(function(s){return[s[0],s[1]+1]}).filter(function(s){return s[1]>=n.maxSendAttempts?(h().error("Dropping queued event after ".concat(s[1]," attempts since max send attempts ").concat(n.maxSendAttempts," reached. See logs for details")),!1):!0}),e.length>0?((t=this.queue).push.apply(t,e),this.scheduleFlush()):this.attempt=1,[3,4];case 4:return[2]}})})},r.prototype.postHandle=function(e,t){if(this.cookiePolicy==="strict"||this.cookiePolicy==="comply"){if(e===200){var n=t;if(typeof t=="string"&&(n=JSON.parse(t)),!n.delete_cookie)return}this.userIdPersistence.delete(),this.propsPersistance.delete(),Ue(this.idCookieName)}if(e===200){var n=t;if(typeof t=="string"&&t.length>0){n=JSON.parse(t);var i=n.jitsu_sdk_extras;if(i&&i.length>0){var s=b();if(!s)h().error("Tags destination supported only in browser environment");else for(var o=0,a=i;o0&&document.body.appendChild(g)}}}}}},r.prototype.getCtx=function(e){var t=new Date,n=e.describeClient()||{};return v(v({event_id:"",user:v({anonymous_id:this.cookiePolicy!=="strict"?e.getAnonymousId({name:this.idCookieName,domain:this.cookieDomain}):""},this.userProperties),ids:this._getIds(),utc_time:Nr(t.toISOString()),local_tz_offset:t.getTimezoneOffset()},n),Ir(Rr(n.doc_search)))},r.prototype._getIds=function(){if(!b())return{};for(var e=Tr(),t={},n=0,i=Object.entries(e);n{this.isInitialized=e,e&&this.trackCallbacks()})}setupJitsu=async()=>{const e=localStorage.getItem(Ht)||null;if(this.jitsu){e&&this.jitsu.set({player_id:e});const t=await Et(this.jitsu);return this.jitsu.set({env:"prod",source_type:mt(),browser_tab_id:pr(),is_authenticated:gt(Ne()),permission_notification:t}),await vr(this.jitsu)}else return console.error("Jitsu client is not initialized"),null};init=async()=>(this.jitsu||(this.jitsu=Hr({key:"js.d27utqeoss6s0dkb04pz1b.ss60lhmn5bgevjhl6d5qsw",tracking_host:"https://stat.khanate.pro",log_level:"ERROR"}),await this.setupJitsu()),!0);trackCallbacks=()=>{const e=Be(T.JITSU);e.length>0&&(e.forEach(t=>{if(Array.isArray(t)){const n=t[0];this.trackEvent(n,t[1])}}),Me(T.JITSU))};updateClient=async()=>{await this.setupJitsu()};trackPageview=e=>{this.trackEvent(_.PAGEVIEW,yt({...e,contentType:e?.attr_content_type}))};trackEvent=(e,t)=>{if(this.isInitialized){this.jitsu?.track(e,t);return}xe(T.JITSU,[e,t])}}const jr=r=>new Ce({[u.PAGEVIEW_INFINITE]:e=>r(e)}),Yr=r=>new Ce({[u.PAGEVIEW]:e=>r.trackPageview(e),[u.RESIZE]:()=>r.trackEvent(_.PAGE_RESIZE),[u.COMMERCIAL_MENU_IMPRESSION]:({position:e})=>r.trackEvent(_.IMPRESSION,{place_on_site:"commercial menu",position_number:`position ${e}`}),[u.COMMERCIAL_MENU_CLICK]:({position:e})=>r.trackEvent(_.CLICK,{place_on_site:"commercial menu",position_number:`position ${e}`}),[u.SUBSCRIPTION_CHANGE]:({isSubscribed:e})=>r.trackEvent(e?_.USER_SUBSCRIBED:_.USER_UNSUBSCRIBED,{event_date:new Date().toJSON()}),[u.LOGIN]:e=>r.trackEvent(_.USER_LOGIN,e),[u.REGISTRATION]:e=>r.trackEvent(_.USER_REGISTRATION,e),[u.RECOVER]:e=>r.trackEvent(_.USER_RECOVERY,e),[u.COMMENTS]:e=>r.trackEvent(_.USER_COMMENTS,e),[u.REACTIONS]:e=>r.trackEvent(_.COMMENTS_REACTIONS,e),[u.LOGOUT_BY_USER]:()=>r.trackEvent(_.USER_LOGOUT,{target:$e.USER}),[u.LOGOUT_BY_SYSTEM]:()=>r.trackEvent(_.USER_LOGOUT,{target:$e.SYSTEM}),[u.REFRESH_TOKEN_SUCCESS]:()=>r.trackEvent(_.USER_REFRESH_TOKEN,{result:"success"}),[u.REFRESH_TOKEN_ERROR]:({errorMessage:e})=>r.trackEvent(_.USER_REFRESH_TOKEN,{result:"error",error_message:e}),[u.SHARE]:e=>r.trackEvent(_.SHARE,e),[u.PAGEVIEW_INFINITE]:e=>{if(e.article_id){const t={...je(e.article_id),page:"Article",authorIds:e.article_authors_ids||[],contentType:e.targeting_attributes?.content_type||"",referer:e.referer||""};e.article_parent_category_slug?(t.category=e.article_parent_category_slug,t.subcategory=e.article_categories_slugs||[]):t.category=e.article_categories_slugs||[],r.trackEvent(_.PAGEVIEW,yt(t))}},[u.RECOMMENDATION]:({eventType:e,articleId:t})=>r.trackEvent(e,je(t)),[u.ARTICLE_REACTIONS_CHANGE]:({newReaction:e,prevReaction:t,layoutSection:n="main_content_footer"})=>r.trackEvent(_.CHANGE,{event_target:"article_reaction",event_target_component:"article_reactions_catalog",event_target_layout_section:n,feature:"article_reactions",event_target_value:e,event_target_previous_value:t}),[u.ARTICLE_REACTIONS_OBSERVE]:()=>r.trackEvent(_.OBSERVE,{event_target:"article_reactions_auth_invitation",event_target_component:"article_reactions_auth_invitation",event_target_layout_section:"modal_window",feature:"article_reactions"}),[u.ARTICLE_REACTIONS_TAP_MODAL]:({target:e})=>r.trackEvent(_.TAP,{event_target_component:"article_reactions_auth_invitation",event_target_layout_section:"modal_window",feature:"article_reactions",event_target:e}),[u.ARTICLE_REACTIONS_TAP_MODAL_BUTTONS]:({target:e,text:t})=>r.trackEvent(_.TAP,{event_target:e,event_target_text_content:t,event_target_component:"article_reactions_auth_invitation",event_target_layout_section:"modal_window",feature:"article_reactions"}),[u.ARTICLES_REACTIONS_CHANGE_WIDGET]:({count:e,layoutSection:t,expand:n=!1})=>r.trackEvent(_.CHANGE,{event_target:"article_reactions_summary",event_target_value:n?"expand":"collapse",event_target_text_content:e,event_target_component:"article_action_menu",event_target_layout_section:t,feature:"article_reactions"}),[u.ARTICLES_REACTIONS_CATALOG_TAP]:({layoutSection:e})=>r.trackEvent(_.TAP,{event_target:"close_button",event_target_component:"article_reactions_catalog",event_target_layout_section:e,feature:"article_reactions"}),[u.ARTICLES_REACTIONS_CATALOG_OVERLAY_CLICK]:()=>r.trackEvent(_.TAP,{event_target:"overlay",feature:"article_reactions"}),[u.COMMENTS_COUNT_CLICK]:({layoutSection:e,commentsCount:t})=>r.trackEvent(_.TAP,{event_target:"comments_summary",event_target_text_content:t,event_target_component:"article_action_menu",event_target_layout_section:e,feature:"article_comments"}),[u.SHARE_BUTTON_CLICK]:({layoutSection:e})=>r.trackEvent(_.TAP,{event_target:"shares_summary",event_target_component:"article_action_menu",event_target_layout_section:e,feature:"article_shares"}),[u.SHARE_WINDOW_CLOSE_BY_ICON]:()=>r.trackEvent(_.TAP,{event_target:"close_button",event_target_component:"shares_catalog",event_target_layout_section:"modal_window",feature:"article_shares"}),[u.SHARE_WINDOW_CLOSE_BY_OVERLAY]:()=>r.trackEvent(_.TAP,{event_target:"overlay",feature:"article_shares"}),[u.SHARE_SOCIAL]:({socialName:e})=>r.trackEvent(_.TAP,{event_target:"shares_catalog_item",event_target_alt_text:e,event_target_component:"shares_catalog",event_target_layout_section:"modal_window",feature:"article_shares"}),[u.SHARE_ARTICLE_BUTTON_CLICK]:({layoutSection:e,text:t})=>r.trackEvent(_.TAP,{event_target:"shares_summary",event_target_component:"shares_summary",event_target_layout_section:e,feature:"article_shares",event_target_text_content:t}),[u.GROWTHBOOK_INIT]:e=>r.trackEvent(_.GROWTHBOOK_INIT,{grb:e}),[u.ARTICLE_COMMENTS_OBSERVE]:e=>r.trackEvent(_.OBSERVE,{...e,event_target:"comments_feed",event_target_component:"comments_feed",event_target_layout_section:"right_drawer",feature:"article_comments"}),[u.SHARE_TREND]:({text:e})=>r.trackEvent(_.TAP,{event_target:"shares_summary",event_target_text_content:e,event_target_component:"shares_summary",event_target_layout_section:"bottom_navigation_bar",feature:"article_shares"}),[u.FOOTER_FEEDBACK_BUTTON_CLICK]:({section:e,text:t})=>r.trackEvent(_.TAP,{event_target:"feedback_form_link",event_target_text_content:t,event_target_component:"feedback_form_link",event_target_layout_section:e,feature:"navigation"}),[u.FOOTER_ADVERT_BUTTON_CLICK]:({section:e,text:t})=>r.trackEvent(_.TAP,{event_target:"corporate_clients_link",event_target_text_content:t,event_target_component:"corporate_clients_link",event_target_layout_section:e,feature:"navigation"}),[u.GROWTHBOOK_INIT]:e=>r.trackEvent(_.GROWTHBOOK_INIT,{grb:e}),...dr(r),...cr(r),...ur(r),...lr(r),..._r(r),...fr(r)}),Xr=r=>new Ce({[u.SHARE]:e=>{const t=e;e.article_id&&(t.article_url=e.url),r("event","share_intent",t)},[u.COMMERCIAL_MENU_IMPRESSION]:({position:e})=>r("event","commercial_menu_impression",{position:e}),[u.COMMERCIAL_MENU_CLICK]:({position:e})=>r("event","commercial_menu_click",{position:e}),[u.UFC_WIDGET_CLICK]:()=>r("event","Widget Click (placeholder click)",{event_category:"Live streaming widget CTR"}),[u.UFC_WIDGET_IMPRESSION]:()=>r("event","Widget Impressions (user see 50% of widget)",{event_category:"Live streaming widget CTR"}),[u.SET_USER_TYPE]:({userType:e})=>r("set",{user_type:e}),[u.PAGEVIEW]:()=>r("event","page_view",{page_path:window.location.pathname}),[u.PAGEVIEW_INFINITE]:e=>{e?.referer&&r("set","referrer",e.referer),r("event","page_view",{page_path:window.location.pathname})},[u.SET_MATCH_LABEL]:({label:e})=>r("event",{label:e}),[u.ARTICLE_SCROLL]:({contentTypeIndex:e})=>r("event","counter_scrolled_article",{scroll_depth:`${e}`}),[u.PM_WIDGET_IMPRESSION]:()=>r("event","PM widget Impression",{event_name:"PM widget CTR",event_category:"PM widget CTR",event_action:"Click"}),[u.PM_WIDGET_CLICK]:()=>r("event","PM widget Click",{event_name:"PM widget CTR",event_category:"PM widget CTR",event_action:"Click"}),[u.ONEXBET_WIDGET_IMPRESSION]:()=>r("event","1xbet widget Impression",{event_name:"1xbet widget CTR",event_category:"1xbet widget CTR",event_action:"Click"}),[u.ONEXBET_WIDGET_CLICK]:()=>r("event","1xbet widget Click",{event_name:"1xbet widget CTR",event_category:"1xbet widget CTR",event_action:"Click"}),...ar(r)}),se=new Wt,Qr=()=>{const r=new qt(se);return window.publishEvent=r.publish,window.publishEvent},Zr=()=>{const r=new Er;se.subscribe(Xr(r.trackEvent).getEvents()),window.gaPlugin=r},en=()=>{const r=new zr;se.subscribe(Yr(r).getEvents()),window.jitsuPlugin=r},tn=()=>{const r=new mr;se.subscribe(jr(r.trackEvent).getEvents()),window.onThePlugin=r},rn=()=>{Qr(),en(),Zr(),tn(),window.addEventListener("DOMContentLoaded",()=>{let r=_t();window.publishEvent(u.PAGEVIEW,r)})};rn();const tt=document.querySelector(".js-footer"),he=document.querySelector(".js-footer-feedback-section"),rt=document.querySelector(".js-footer-corporate-section");tt&&tt.addEventListener("click",r=>{he&&r.target.contains(he)&&window.publishEvent(u.FOOTER_FEEDBACK_BUTTON_CLICK,{section:"footer",text:he.innerText}),advLinkElement&&r.target.contains(rt)&&window.publishEvent(u.FOOTER_ADVERT_BUTTON_CLICK,{section:"footer",text:rt.innerText})});let Se="";try{const r=Kt(window.location.host);Se=JSON.parse('[{"section":"www","appId":"8979fdd1-33b5-4884-b7c6-64b8f70d2ae5"},{"section":"kaz","appId":"b2216fc8-a866-4b43-8d88-b7307d74037a"}]').find(t=>r===t.section)?.appId||""}catch(r){console.error("Cannot parse OneSignal appId",r)}if(Se&&(window.OneSignal=window.OneSignal||[],window.OneSignal.push(()=>{window.OneSignal.init({appId:Se})}),window.OneSignal.push(()=>{window.OneSignal.sendTags({platform:mt()})}),window.OneSignal.push(()=>{window.OneSignal.on("subscriptionChange",async r=>{if(window.jitsuPlugin?.jitsu){const e=await Et(window.jitsuPlugin.jitsu);window.jitsuPlugin.jitsu.set({permission_notification:e})}window.OneSignal.getUserId(e=>{r&&(localStorage.setItem("oneSignalPlayerId",e||""),window.jitsuPlugin?.jitsu&&window.jitsuPlugin.jitsu.set({player_id:e})),window.publishEvent(u.SUBSCRIPTION_CHANGE,{isSubscribed:r})})})}),"serviceWorker"in window.navigator&&window.navigator.serviceWorker.register("/one-signal-service-worker.js"),navigator.serviceWorker?.controller!==null)){const r=document.createElement("script");r.src="https://cdn.onesignal.com/sdks/OneSignalSDK.js",document.body.appendChild(r)}const Ot={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function nn(){return Ot}function ge(r){let e=2166136261;const t=r.length;for(let n=0;n>>0}function te(r,e,t){return t===2?ge(ge(r+e)+"")%1e4/1e4:t===1?ge(e+r)%1e3/1e3:null}function sn(r){return r<=0?[]:new Array(r).fill(1/r)}function Ae(r,e){return r>=e[0]&&r=e[1]&&t{n.push([r.searchParams.get(s)||"",i,!1])}),!n.some(i=>!cn(i[0],i[1],i[2]))}catch{return!1}}function ln(r,e,t){try{const n=new URL(r,"https://_");if(e==="regex"){const i=Ct(t);return i?i.test(n.href)||i.test(n.href.substring(n.origin.length)):!1}else if(e==="simple")return un(n,t);return!1}catch{return!1}}function _n(r,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);const n=sn(r);t=t||n,t.length!==r&&(t=n);const i=t.reduce((o,a)=>a+o,0);(i<.99||i>1.01)&&(t=n);let s=0;return t.map(o=>{const a=s;return s+=o,[a,a+e*o]})}function fn(r,e,t){if(!e)return null;const n=e.split("?")[1];if(!n)return null;const i=n.replace(/#.*/,"").split("&").map(s=>s.split("=",2)).filter(s=>{let[o]=s;return o===r}).map(s=>{let[,o]=s;return parseInt(o)});return i.length>0&&i[0]>=0&&i[0]Uint8Array.from(atob(r),e=>e.charCodeAt(0));async function U(r,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||Ot.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{const n=await t.importKey("raw",ve(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=r.split("."),o=await t.decrypt({name:"AES-CBC",iv:ve(i)},n,ve(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function z(r){return typeof r=="string"?r:JSON.stringify(r)}function w(r){typeof r=="number"&&(r=r+""),(!r||typeof r!="string")&&(r="0");const e=r.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return e.length===3&&e.push("~"),e.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}function hn(){let r;try{r="1.2.0"}catch{r=""}return r}function gn(r,e){let t,n;try{t=new URL(r),n=new URL(e)}catch(i){return console.error("Unable to merge query strings: ".concat(i)),e}return t.searchParams.forEach((i,s)=>{n.searchParams.has(s)||n.searchParams.set(s,i)}),n.toString()}function it(r){return typeof r=="object"&&r!==null}function pe(r){return r.urlPatterns&&r.variations.some(e=>it(e)&&"urlRedirect"in e)?"redirect":r.variations.some(e=>it(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function It(r,e){return new Promise(t=>{let n=!1,i;const s=o=>{n||(n=!0,i&&clearTimeout(i),t(o||null))};e&&(i=setTimeout(()=>s(),e)),r.then(o=>s(o)).catch(()=>s())})}const k={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},S=nn(),L={fetchFeaturesCall:r=>{let{host:e,clientKey:t,headers:n}=r;return S.fetch("".concat(e,"/api/features/").concat(t),{headers:n})},fetchRemoteEvalCall:r=>{let{host:e,clientKey:t,payload:n,headers:i}=r;const s={method:"POST",headers:{"Content-Type":"application/json",...i},body:JSON.stringify(n)};return S.fetch("".concat(e,"/api/eval/").concat(t),s)},eventSourceCall:r=>{let{host:e,clientKey:t,headers:n}=r;return n?new S.EventSource("".concat(e,"/sub/").concat(t),{headers:n}):new S.EventSource("".concat(e,"/sub/").concat(t))},startIdleListener:()=>{let r;if(!(typeof window<"u"&&typeof document<"u"))return;const t=()=>{document.visibilityState==="visible"?(window.clearTimeout(r),yn()):document.visibilityState==="hidden"&&(r=window.setTimeout(En,k.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(S.localStorage=globalThis.localStorage)}catch{}const x=new Map;let st=!1;const A=new Map,j=new Map,B=new Map,M=new Set;function vn(r){Object.assign(k,r),k.backgroundSync||An()}async function pn(r){let{instance:e,timeout:t,skipCache:n,allowStale:i,backgroundSync:s}=r;return s||(k.backgroundSync=!1),kn({instance:e,allowStale:i,timeout:t,skipCache:n})}function Y(r){const e=G(r),t=x.get(e)||new Set;t.add(r),x.set(e,t)}function mn(r){x.forEach(e=>e.delete(r))}function En(){B.forEach(r=>{r&&(r.state="idle",Fe(r))})}function yn(){B.forEach(r=>{r&&r.state==="idle"&&He(r)})}async function ot(){try{if(!S.localStorage)return;await S.localStorage.setItem(k.cacheKey,JSON.stringify(Array.from(A.entries())))}catch{}}async function kn(r){let{instance:e,allowStale:t,timeout:n,skipCache:i}=r;const s=G(e),o=De(e),a=new Date,l=new Date(a.getTime()-k.maxAge+k.staleTTL);await bn();const c=!k.disableCache&&!i?A.get(o):void 0;return c&&(t||c.staleAt>a)&&c.staleAt>l?(c.sse&&M.add(s),c.staleAt{i[a]=t[a]});const s=r.getForcedVariations(),o=r.getUrl();return"".concat(e,"||").concat(JSON.stringify({ca:i,fv:s,url:o}))}async function bn(){if(!st){st=!0;try{if(S.localStorage){const r=await S.localStorage.getItem(k.cacheKey);if(!k.disableCache&&r){const e=JSON.parse(r);e&&Array.isArray(e)&&e.forEach(t=>{let[n,i]=t;A.set(n,{...i,staleAt:new Date(i.staleAt)})}),Nt()}}}catch{}if(!k.disableIdleStreams){const r=L.startIdleListener();r&&(L.stopIdleListener=r)}}}function Nt(){const r=Array.from(A.entries()).map(t=>{let[n,i]=t;return{key:n,staleAt:i.staleAt.getTime()}}).sort((t,n)=>t.staleAt-n.staleAt),e=Math.min(Math.max(0,A.size-k.maxEntries),A.size);for(let t=0;twn(a,t))}async function wn(r,e){await r.setPayload(e||r.getPayload())}async function Te(r){const{apiHost:e,apiRequestHeaders:t}=r.getApiHosts(),n=r.getClientKey(),i=r.isRemoteEval(),s=G(r),o=De(r);let a=j.get(o);return a||(a=(i?L.fetchRemoteEvalCall({host:e,clientKey:n,payload:{attributes:r.getAttributes(),forcedVariations:r.getForcedVariations(),forcedFeatures:Array.from(r.getForcedFeatures().entries()),url:r.getUrl()},headers:t}):L.fetchFeaturesCall({host:e,clientKey:n,headers:t})).then(c=>{if(!c.ok)throw new Error("HTTP error: ".concat(c.status));return c.headers.get("x-sse-support")==="enabled"&&M.add(s),c.json()}).then(c=>(Lt(s,o,c),ne(r),j.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(j.delete(o),{data:null,source:"error",success:!1,error:c})),j.set(o,a)),a}function ne(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const t=G(r),n=De(r),{streamingHost:i,streamingHostRequestHeaders:s}=r.getApiHosts(),o=r.getClientKey();if(e&&M.add(t),k.backgroundSync&&M.has(t)&&S.EventSource){if(B.has(t))return;const a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){const c=x.get(t);c&&c.forEach(f=>{Te(f)})}else if(l.type==="features"){const c=JSON.parse(l.data);Lt(t,n,c)}a.errors=0}catch{xt(a)}},errors:0,state:"active"};B.set(t,a),He(a)}}function xt(r){if(r.state!=="idle"&&(r.errors++,r.errors>3||r.src&&r.src.readyState===2)){const e=Math.pow(3,r.errors-3)*(1e3+Math.random()*1e3);Fe(r),setTimeout(()=>{["idle","active"].includes(r.state)||He(r)},Math.min(e,3e5))}}function Fe(r){r.src&&(r.src.onopen=null,r.src.onerror=null,r.src.close(),r.src=null,r.state==="active"&&(r.state="disabled"))}function He(r){r.src=L.eventSourceCall({host:r.host,clientKey:r.clientKey,headers:r.headers}),r.state="active",r.src.addEventListener("features",r.cb),r.src.addEventListener("features-updated",r.cb),r.src.onerror=()=>xt(r),r.src.onopen=()=>{r.errors=0}}function Sn(r,e){Fe(r),B.delete(e)}function An(){M.clear(),B.forEach(Sn),x.clear(),L.stopIdleListener()}var Tn=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,Ke={revert:function(){}},ie=new Map,Ge=new Set;function Rn(r){return r==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[r]}}function oe(r){var e=ie.get(r);return e||(e={element:r,attributes:{}},ie.set(r,e)),e}function ae(r,e,t,n,i){var s=t(r),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:r,_positionTimeout:null,observer:new MutationObserver(function(){if(!(e==="position"&&o._positionTimeout)){e==="position"&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var a=t(r);e==="position"&&a.parentNode===o.virtualValue.parentNode&&a.insertBeforeNode===o.virtualValue.insertBeforeNode||a!==o.virtualValue&&(o.originalValue=a,i(o))}}),mutationRunner:i,setValue:n,getCurrentValue:t};return e==="position"&&r.parentNode?o.observer.observe(r.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(r,Rn(e)),o}function ce(r,e){var t=e.getCurrentValue(e.el);e.virtualValue=r,r&&typeof r!="string"?(!t||r.parentNode!==t.parentNode||r.insertBeforeNode!==t.insertBeforeNode)&&(e.isDirty=!0,at()):r!==t&&(e.isDirty=!0,at())}function On(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),ce(Kn(e),r)}function Cn(r){var e=new Set(r.originalValue.split(/\s+/).filter(Boolean));r.mutations.forEach(function(t){return t.mutate(e)}),ce(Array.from(e).filter(Boolean).join(" "),r)}function In(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),ce(e,r)}function Nn(r){var e=r.parentSelector,t=r.insertBeforeSelector,n=document.querySelector(e);if(!n)return null;var i=t?document.querySelector(t):null;return t&&!i?null:{parentNode:n,insertBeforeNode:i}}function Ln(r){var e=r.originalValue;r.mutations.forEach(function(t){var n=t.mutate(),i=Nn(n);e=i||e}),ce(e,r)}var xn=function(e){return e.innerHTML},Bn=function(e,t){return e.innerHTML=t};function Bt(r){var e=oe(r);return e.html||(e.html=ae(r,"html",xn,Bn,On)),e.html}var Mn=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},Pn=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function Mt(r){var e=oe(r);return e.position||(e.position=ae(r,"position",Mn,Pn,Ln)),e.position}var Un=function(e,t){return t?e.className=t:e.removeAttribute("class")},Vn=function(e){return e.className};function Pt(r){var e=oe(r);return e.classes||(e.classes=ae(r,"class",Vn,Un,Cn)),e.classes}var Dn=function(e){return function(t){var n;return(n=t.getAttribute(e))!=null?n:null}},Fn=function(e){return function(t,n){return n!==null?t.setAttribute(e,n):t.removeAttribute(e)}};function Ut(r,e){var t=oe(r);return t.attributes[e]||(t.attributes[e]=ae(r,e,Dn(e),Fn(e),In)),t.attributes[e]}function Hn(r,e){var t=ie.get(r);if(t)if(e==="html"){var n,i;(n=t.html)==null||(i=n.observer)==null||i.disconnect(),delete t.html}else if(e==="class"){var s,o;(s=t.classes)==null||(o=s.observer)==null||o.disconnect(),delete t.classes}else if(e==="position"){var a,l;(a=t.position)==null||(l=a.observer)==null||l.disconnect(),delete t.position}else{var c,f,d;(c=t.attributes)==null||(f=c[e])==null||(d=f.observer)==null||d.disconnect(),delete t.attributes[e]}}var X;function Kn(r){return X||(X=document.createElement("div")),X.innerHTML=r,X.innerHTML}function Q(r,e,t){if(t.isDirty){t.isDirty=!1;var n=t.virtualValue;t.mutations.length||Hn(r,e),t.setValue(r,n)}}function Gn(r,e){r.html&&Q(e,"html",r.html),r.classes&&Q(e,"class",r.classes),r.position&&Q(e,"position",r.position),Object.keys(r.attributes).forEach(function(t){Q(e,t,r.attributes[t])})}function at(){ie.forEach(Gn)}function Jn(r,e){var t=null;r.kind==="html"?t=Bt(e):r.kind==="class"?t=Pt(e):r.kind==="attribute"?t=Ut(e,r.attribute):r.kind==="position"&&(t=Mt(e)),t&&(t.mutations.push(r),t.mutationRunner(t))}function Wn(r,e){var t=null;if(r.kind==="html"?t=Bt(e):r.kind==="class"?t=Pt(e):r.kind==="attribute"?t=Ut(e,r.attribute):r.kind==="position"&&(t=Mt(e)),!!t){var n=t.mutations.indexOf(r);n!==-1&&t.mutations.splice(n,1),t.mutationRunner(t)}}function Vt(r){if(!(r.kind==="position"&&r.elements.size===1)){var e=new Set(r.elements),t=document.querySelectorAll(r.selector);t.forEach(function(n){e.has(n)||(r.elements.add(n),Jn(r,n))})}}function qn(r){r.elements.forEach(function(e){return Wn(r,e)}),r.elements.clear(),Ge.delete(r)}function ct(){Ge.forEach(Vt)}var me;function $n(){typeof document>"u"||(me||(me=new MutationObserver(function(){ct()})),ct(),me.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}$n();function ue(r){return typeof document>"u"?Ke:(Ge.add(r),Vt(r),{revert:function(){qn(r)}})}function Re(r,e){return ue({kind:"html",elements:new Set,mutate:e,selector:r})}function Dt(r,e){return ue({kind:"position",elements:new Set,mutate:e,selector:r})}function F(r,e){return ue({kind:"class",elements:new Set,mutate:e,selector:r})}function re(r,e,t){return Tn.test(e)?e==="class"||e==="className"?F(r,function(n){var i=t(Array.from(n).join(" "));n.clear(),i&&i.split(/\s+/g).filter(Boolean).forEach(function(s){return n.add(s)})}):ue({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:r}):Ke}function zn(r){var e=r.selector,t=r.action,n=r.value,i=r.attribute,s=r.parentSelector,o=r.insertBeforeSelector;if(i==="html"){if(t==="append")return Re(e,function(a){return a+(n??"")});if(t==="set")return Re(e,function(){return n??""})}else if(i==="class"){if(t==="append")return F(e,function(a){n&&a.add(n)});if(t==="remove")return F(e,function(a){n&&a.delete(n)});if(t==="set")return F(e,function(a){a.clear(),n&&a.add(n)})}else if(i==="position"){if(t==="set"&&s)return Dt(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return re(e,i,function(a){return a!==null?a+(n??""):n??""});if(t==="set")return re(e,i,function(){return n??""});if(t==="remove")return re(e,i,function(){return null})}return Ke}var jn={html:Re,classes:F,attribute:re,position:Dt,declarative:zn};const Ee={};function C(r,e,t){t=t||{};for(const[n,i]of Object.entries(e))switch(n){case"$or":if(!ut(r,i,t))return!1;break;case"$nor":if(ut(r,i,t))return!1;break;case"$and":if(!ti(r,i,t))return!1;break;case"$not":if(C(r,i,t))return!1;break;default:if(!H(i,Yn(r,n),t))return!1}return!0}function Yn(r,e){const t=e.split(".");let n=r;for(let i=0;i0&&e.filter(t=>t[0]==="$").length===e.length}function Qn(r){if(r===null)return"null";if(Array.isArray(r))return"array";const e=typeof r;return["string","number","boolean","object","undefined"].includes(e)?e:"unknown"}function Zn(r,e,t){if(!Array.isArray(r))return!1;const n=Ft(e)?i=>H(e,i,t):i=>C(i,e,t);for(let i=0;ie.includes(t)):e.includes(r)}function ei(r,e,t,n){switch(r){case"$veq":return w(e)===w(t);case"$vne":return w(e)!==w(t);case"$vgt":return w(e)>w(t);case"$vgte":return w(e)>=w(t);case"$vlt":return w(e)t;case"$gte":return e>=t;case"$exists":return t?e!=null:e==null;case"$in":return Array.isArray(t)?Z(e,t):!1;case"$inGroup":return Z(e,n[t]||[]);case"$notInGroup":return!Z(e,n[t]||[]);case"$nin":return Array.isArray(t)?!Z(e,t):!1;case"$not":return!H(t,e,n);case"$size":return Array.isArray(e)?H(t,e.length,n):!1;case"$elemMatch":return Zn(e,t,n);case"$all":if(!Array.isArray(e))return!1;for(let i=0;i{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;const t=await this.decryptPayload(e);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._ctx.features=t.features),t.savedGroups&&(this._ctx.savedGroups=t.savedGroups),t.experiments&&(this._ctx.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;const t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");if(this._ctx.stickyBucketService&&!this._ctx.stickyBucketAssignmentDocs)throw new Error("initSync requires you to pass stickyBucketAssignmentDocs into the GrowthBook constructor");if(this._payload=t,this._decryptedPayload=t,t.features&&(this._ctx.features=t.features),t.experiments&&(this._ctx.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,e.streaming){if(!this._ctx.clientKey)throw new Error("Must specify clientKey to enable streaming");ne(this,!0),Y(this)}return this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&vn(e.cacheSettings),e.payload){if(await this.setPayload(e.payload),e.streaming){if(!this._ctx.clientKey)throw new Error("Must specify clientKey to enable streaming");ne(this,!0),Y(this)}return{success:!0,source:"init"}}else{const{data:t,...n}=await this._refresh({...e,allowStale:!0});return e.streaming&&Y(this),await this.setPayload(t||{}),n}}async loadFeatures(e){this._initialized=!0,e=e||{},e.autoRefresh&&(this._ctx.subscribeToChanges=!0);const{data:t}=await this._refresh({...e,allowStale:!0});await this.setPayload(t||{}),this._canSubscribe()&&Y(this)}async refreshFeatures(e){const t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){const e=this._ctx.apiHost||"https://cdn.growthbook.io";return{apiHost:e.replace(/\/*$/,""),streamingHost:(this._ctx.streamingHost||e).replace(/\/*$/,""),apiRequestHeaders:this._ctx.apiHostRequestHeaders,streamingHostRequestHeaders:this._ctx.streamingHostRequestHeaders}}getClientKey(){return this._ctx.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._ctx.remoteEval||!1}getCacheKeyAttributes(){return this._ctx.cacheKeyAttributes}async _refresh(e){var t;let{timeout:n,skipCache:i,allowStale:s,streaming:o}=e;if(!this._ctx.clientKey)throw new Error("Missing clientKey");return pn({instance:this,timeout:n,skipCache:i||this._ctx.disableCache,allowStale:s,backgroundSync:(t=o??this._ctx.backgroundSync)!==null&&t!==void 0?t:!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._ctx.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,n){const i=await U(e,t||this._ctx.decryptionKey,n);this.setFeatures(JSON.parse(i))}setExperiments(e){this._ctx.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,n){const i=await U(e,t||this._ctx.decryptionKey,n);this.setExperiments(JSON.parse(i))}async decryptPayload(e,t,n){if(e={...e},e.encryptedFeatures){try{e.features=JSON.parse(await U(e.encryptedFeatures,t||this._ctx.decryptionKey,n))}catch(i){console.error(i)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse(await U(e.encryptedExperiments,t||this._ctx.decryptionKey,n))}catch(i){console.error(i)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse(await U(e.encryptedSavedGroups,t||this._ctx.decryptionKey,n))}catch(i){console.error(i)}delete e.encryptedSavedGroups}return e}async setAttributes(e){if(this._ctx.attributes=e,this._ctx.stickyBucketService&&await this.refreshStickyBuckets(),this._ctx.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async updateAttributes(e){return this.setAttributes({...this._ctx.attributes,...e})}async setAttributeOverrides(e){if(this._attributeOverrides=e,this._ctx.stickyBucketService&&await this.refreshStickyBuckets(),this._ctx.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async setForcedVariations(e){if(this._ctx.forcedVariations=e||{},this._ctx.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}setForcedFeatures(e){this._forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._ctx.url){if(this._ctx.url=e,this._redirectedUrl="",this._ctx.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._ctx.attributes,...this._attributeOverrides}}getForcedVariations(){return this._ctx.forcedVariations||{}}getForcedFeatures(){return this._forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._ctx.stickyBucketAssignmentDocs||{}}getUrl(){return this._ctx.url||""}getFeatures(){return this._ctx.features||{}}getExperiments(){return this._ctx.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}_canSubscribe(){var e;return((e=this._ctx.backgroundSync)!==null&&e!==void 0?e:!0)&&this._ctx.subscribeToChanges}async _refreshForRemoteEval(){if(!this._ctx.remoteEval||!this._initialized)return;const e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}destroy(){this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._rtQueue=[],this._payload=void 0,this._rtTimer&&clearTimeout(this._rtTimer),mn(this),O&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(e=>{e.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){if(this._ctx.forcedVariations=this._ctx.forcedVariations||{},this._ctx.forcedVariations[e]=t,this._ctx.remoteEval){this._refreshForRemoteEval();return}this._updateAllAutoExperiments(),this._render()}run(e){const{result:t}=this._run(e,null);return this._fireSubscriptions(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._ctx.experiments?this._ctx.experiments.filter(n=>n.key===e).map(n=>this._runAutoExperiment(n)).filter(n=>n!==null):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_runAutoExperiment(e,t){const n=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!n)return null;const i=this._isAutoExperimentBlockedByContext(e);let s,o;i?s=this._getResult(e,-1,!1,""):({result:s,trackingCall:o}=this._run(e,null),this._fireSubscriptions(e,s));const a=JSON.stringify(s.value);if(!t&&s.inExperiment&&n&&n.valueHash===a)return s;if(n&&this._undoActiveAutoExperiment(e),s.inExperiment){const c=pe(e);if(c==="redirect"&&s.value.urlRedirect&&e.urlPatterns){const f=e.persistQueryString?gn(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(nt(f,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),s;this._redirectedUrl=f;const{navigate:d,delay:g}=this._getNavigateFunction();if(d)if(O){var l;Promise.all([...o?[It(o,(l=this._ctx.maxNavigateDelay)!==null&&l!==void 0?l:1e3)]:[],new Promise(m=>{var y;return window.setTimeout(m,(y=this._ctx.navigateDelay)!==null&&y!==void 0?y:g)})]).then(()=>{try{d(f)}catch(m){console.error(m)}})}else try{d(f)}catch(m){console.error(m)}}else if(c==="visual"){const f=this._ctx.applyDomChangesCallback?this._ctx.applyDomChangesCallback(s.value):this._applyDOMChanges(s.value);f&&this._activeAutoExperiments.set(e,{undo:f,valueHash:a})}}return s}_undoActiveAutoExperiment(e){const t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;const t=this._ctx.experiments||[],n=new Set(t);this._activeAutoExperiments.forEach((i,s)=>{n.has(s)||(i.undo(),this._activeAutoExperiments.delete(s))});for(const i of t){const s=this._runAutoExperiment(i,e);if(s!=null&&s.inExperiment&&pe(i)==="redirect")break}}_fireSubscriptions(e,t){const n=e.key,i=this._assigned.get(n);(!i||i.result.inExperiment!==t.inExperiment||i.result.variationId!==t.variationId)&&(this._assigned.set(n,{experiment:e,result:t}),this._subscriptions.forEach(s=>{try{s(e,t)}catch(o){console.error(o)}}))}_trackFeatureUsage(e,t){if(t.source==="override")return;const n=JSON.stringify(t.value);if(this._trackedFeatures[e]!==n){if(this._trackedFeatures[e]=n,this._ctx.onFeatureUsage)try{this._ctx.onFeatureUsage(e,t)}catch{}!O||!window.fetch||(this._rtQueue.push({key:e,on:t.on}),this._rtTimer||(this._rtTimer=window.setTimeout(()=>{this._rtTimer=0;const i=[...this._rtQueue];this._rtQueue=[],this._ctx.realtimeKey&&window.fetch("https://rt.growthbook.io/?key=".concat(this._ctx.realtimeKey,"&events=").concat(encodeURIComponent(JSON.stringify(i))),{cache:"no-cache",mode:"no-cors"}).catch(()=>{})},this._ctx.realtimeInterval||2e3)))}}_getFeatureResult(e,t,n,i,s,o){const a={value:t,on:!!t,off:!t,source:n,ruleId:i||""};return s&&(a.experiment=s),o&&(a.experimentResult=o),this._trackFeatureUsage(e,a),a}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){const n=this.evalFeature(e).value;return n===null?t:n}feature(e){return this.evalFeature(e)}evalFeature(e){return this._evalFeature(e)}_evalFeature(e,t){if(t=t||{evaluatedFeatures:new Set},t.evaluatedFeatures.has(e))return this._getFeatureResult(e,null,"cyclicPrerequisite");if(t.evaluatedFeatures.add(e),t.id=e,this._forcedFeatureValues.has(e))return this._getFeatureResult(e,this._forcedFeatureValues.get(e),"override");if(!this._ctx.features||!this._ctx.features[e])return this._getFeatureResult(e,null,"unknownFeature");const n=this._ctx.features[e];if(n.rules)e:for(const i of n.rules){if(i.parentConditions)for(const a of i.parentConditions){const l=this._evalFeature(a.id,t);if(l.source==="cyclicPrerequisite")return this._getFeatureResult(e,null,"cyclicPrerequisite");const c={value:l.value};if(!C(c,a.condition||{})){if(a.gate)return this._getFeatureResult(e,null,"prerequisite");continue e}}if(i.filters&&this._isFilteredOut(i.filters))continue;if("force"in i){if(i.condition&&!this._conditionPasses(i.condition)||!this._isIncludedInRollout(i.seed||e,i.hashAttribute,this._ctx.stickyBucketService&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach(a=>{this._track(a.experiment,a.result)}),this._getFeatureResult(e,i.force,"force",i.id)}if(!i.variations)continue;const s={variations:i.variations,key:i.key||e};"coverage"in i&&(s.coverage=i.coverage),i.weights&&(s.weights=i.weights),i.hashAttribute&&(s.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(s.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(s.disableStickyBucketing=i.disableStickyBucketing),i.bucketVersion!==void 0&&(s.bucketVersion=i.bucketVersion),i.minBucketVersion!==void 0&&(s.minBucketVersion=i.minBucketVersion),i.namespace&&(s.namespace=i.namespace),i.meta&&(s.meta=i.meta),i.ranges&&(s.ranges=i.ranges),i.name&&(s.name=i.name),i.phase&&(s.phase=i.phase),i.seed&&(s.seed=i.seed),i.hashVersion&&(s.hashVersion=i.hashVersion),i.filters&&(s.filters=i.filters),i.condition&&(s.condition=i.condition);const{result:o}=this._run(s,e);if(this._fireSubscriptions(s,o),o.inExperiment&&!o.passthrough)return this._getFeatureResult(e,o.value,"experiment",i.id,s,o)}return this._getFeatureResult(e,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}_isIncludedInRollout(e,t,n,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;const{hashValue:a}=this._getHashAttribute(t,n);if(!a)return!1;const l=te(e,a,o||1);return l===null?!1:i?Ae(l,i):s!==void 0?l<=s:!0}_conditionPasses(e){return C(this.getAttributes(),e,this._ctx.savedGroups||{})}_isFilteredOut(e){return e.some(t=>{const{hashValue:n}=this._getHashAttribute(t.attribute);if(!n)return!0;const i=te(t.seed,n,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>Ae(i,s))})}_run(e,t){const n=e.key,i=e.variations.length;if(i<2)return{result:this._getResult(e,-1,!1,t)};if(this._ctx.enabled===!1)return{result:this._getResult(e,-1,!1,t)};if(e=this._mergeOverrides(e),e.urlPatterns&&!nt(this._getContextUrl(),e.urlPatterns))return{result:this._getResult(e,-1,!1,t)};const s=fn(n,this._getContextUrl(),i);if(s!==null)return{result:this._getResult(e,s,!1,t)};if(this._ctx.forcedVariations&&n in this._ctx.forcedVariations){const y=this._ctx.forcedVariations[n];return{result:this._getResult(e,y,!1,t)}}if(e.status==="draft"||e.active===!1)return{result:this._getResult(e,-1,!1,t)};const{hashAttribute:o,hashValue:a}=this._getHashAttribute(e.hashAttribute,this._ctx.stickyBucketService&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!a)return{result:this._getResult(e,-1,!1,t)};let l=-1,c=!1,f=!1;if(this._ctx.stickyBucketService&&!e.disableStickyBucketing){const{variation:y,versionIsBlocked:I}=this._getStickyBucketVariation({expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});c=y>=0,l=y,f=!!I}if(!c){if(e.filters){if(this._isFilteredOut(e.filters))return{result:this._getResult(e,-1,!1,t)}}else if(e.namespace&&!on(a,e.namespace))return{result:this._getResult(e,-1,!1,t)};if(e.include&&!dn(e.include))return{result:this._getResult(e,-1,!1,t)};if(e.condition&&!this._conditionPasses(e.condition))return{result:this._getResult(e,-1,!1,t)};if(e.parentConditions)for(const y of e.parentConditions){const I=this._evalFeature(y.id);if(I.source==="cyclicPrerequisite")return{result:this._getResult(e,-1,!1,t)};const J={value:I.value};if(!C(J,y.condition||{}))return{result:this._getResult(e,-1,!1,t)}}if(e.groups&&!this._hasGroupOverlap(e.groups))return{result:this._getResult(e,-1,!1,t)}}if(e.url&&!this._urlIsValid(e.url))return{result:this._getResult(e,-1,!1,t)};const d=te(e.seed||n,a,e.hashVersion||1);if(d===null)return{result:this._getResult(e,-1,!1,t)};if(!c){const y=e.ranges||_n(i,e.coverage===void 0?1:e.coverage,e.weights);l=an(d,y)}if(f)return{result:this._getResult(e,-1,!1,t,void 0,!0)};if(l<0)return{result:this._getResult(e,-1,!1,t)};if("force"in e)return{result:this._getResult(e,e.force===void 0?-1:e.force,!1,t)};if(this._ctx.qaMode)return{result:this._getResult(e,-1,!1,t)};if(e.status==="stopped")return{result:this._getResult(e,-1,!1,t)};const g=this._getResult(e,l,!0,t,d,c);if(this._ctx.stickyBucketService&&!e.disableStickyBucketing){const{changed:y,key:I,doc:J}=this._generateStickyBucketAssignmentDoc(o,z(a),{[this._getStickyBucketExperimentKey(e.key,e.bucketVersion)]:g.key});y&&(this._ctx.stickyBucketAssignmentDocs=this._ctx.stickyBucketAssignmentDocs||{},this._ctx.stickyBucketAssignmentDocs[I]=J,this._ctx.stickyBucketService.saveAssignments(J))}const m=this._track(e,g);return"changeId"in e&&e.changeId&&this._completedChangeIds.add(e.changeId),{result:g,trackingCall:m}}log(e,t){this.debug&&(this._ctx.log?this._ctx.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(t=>t&&t.experiment&&t.result).map(t=>[this._getTrackKey(t.experiment,t.result),t]))}async fireDeferredTrackingCalls(){if(!this._ctx.trackingCallback)return;const e=[];this._deferredTrackingCalls.forEach(t=>{!t||!t.experiment||!t.result?console.error("Invalid deferred tracking call",{call:t}):e.push(this._track(t.experiment,t.result))}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._ctx.trackingCallback=e,this.fireDeferredTrackingCalls()}_getTrackKey(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}async _track(e,t){const n=this._getTrackKey(e,t);if(!this._ctx.trackingCallback){this._deferredTrackingCalls.has(n)||this._deferredTrackingCalls.set(n,{experiment:e,result:t});return}if(!this._trackedExperiments.has(n)){this._trackedExperiments.add(n);try{await this._ctx.trackingCallback(e,t)}catch(i){console.error(i)}}}_mergeOverrides(e){const t=e.key,n=this._ctx.overrides;return n&&n[t]&&(e=Object.assign({},e,n[t]),typeof e.url=="string"&&(e.url=Ct(e.url))),e}_getHashAttribute(e,t){let n=e||"id",i="";return this._attributeOverrides[n]?i=this._attributeOverrides[n]:this._ctx.attributes?i=this._ctx.attributes[n]||"":this._ctx.user&&(i=this._ctx.user[n]||""),!i&&t&&(this._attributeOverrides[t]?i=this._attributeOverrides[t]:this._ctx.attributes?i=this._ctx.attributes[t]||"":this._ctx.user&&(i=this._ctx.user[t]||""),i&&(n=t)),{hashAttribute:n,hashValue:i}}_getResult(e,t,n,i,s,o){let a=!0;(t<0||t>=e.variations.length)&&(t=0,a=!1);const{hashAttribute:l,hashValue:c}=this._getHashAttribute(e.hashAttribute,this._ctx.stickyBucketService&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),f=e.meta?e.meta[t]:{},d={key:f.key||""+t,featureId:i,inExperiment:a,hashUsed:n,variationId:t,value:e.variations[t],hashAttribute:l,hashValue:c,stickyBucketUsed:!!o};return f.name&&(d.name=f.name),s!==void 0&&(d.bucket=s),f.passthrough&&(d.passthrough=f.passthrough),d}_getContextUrl(){return this._ctx.url||(O?window.location.href:"")}_urlIsValid(e){const t=this._getContextUrl();if(!t)return!1;const n=t.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!(e.test(t)||e.test(n))}_hasGroupOverlap(e){const t=this._ctx.groups||{};for(let n=0;nn.js))return!0}else if(t==="redirect"){if(this._ctx.disableUrlRedirectExperiments)return!0;try{const n=new URL(this._getContextUrl());for(const i of e.variations){if(!i||!i.urlRedirect)continue;const s=new URL(i.urlRedirect);if(this._ctx.disableCrossOriginUrlRedirectExperiments&&(s.protocol!==n.protocol||s.host!==n.host))return!0}}catch(n){return this.log("Error parsing current or redirect URL",{id:e.key,error:n}),!0}}else return!0;return!!(e.changeId&&(this._ctx.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._ctx.navigate?{navigate:this._ctx.navigate,delay:0}:O?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!O)return;const t=[];if(e.css){const n=document.createElement("style");n.innerHTML=e.css,document.head.appendChild(n),t.push(()=>n.remove())}if(e.js){const n=document.createElement("script");n.innerHTML=e.js,this._ctx.jsInjectionNonce&&(n.nonce=this._ctx.jsInjectionNonce),document.head.appendChild(n),t.push(()=>n.remove())}return e.domMutations&&e.domMutations.forEach(n=>{t.push(jn.declarative(n).revert)}),()=>{t.forEach(n=>n())}}_deriveStickyBucketIdentifierAttributes(e){const t=new Set,n=e&&e.features?e.features:this.getFeatures(),i=e&&e.experiments?e.experiments:this.getExperiments();return Object.keys(n).forEach(s=>{const o=n[s];if(o.rules)for(const a of o.rules)a.variations&&(t.add(a.hashAttribute||"id"),a.fallbackAttribute&&t.add(a.fallbackAttribute))}),i.map(s=>{t.add(s.hashAttribute||"id"),s.fallbackAttribute&&t.add(s.fallbackAttribute)}),Array.from(t)}async refreshStickyBuckets(e){if(this._ctx.stickyBucketService){const t=this._getStickyBucketAttributes(e);this._ctx.stickyBucketAssignmentDocs=await this._ctx.stickyBucketService.getAllAssignments(t)}}_getStickyBucketAssignments(e,t){if(!this._ctx.stickyBucketAssignmentDocs)return{};const{hashAttribute:n,hashValue:i}=this._getHashAttribute(e),s="".concat(n,"||").concat(z(i)),{hashAttribute:o,hashValue:a}=this._getHashAttribute(t),l=a?"".concat(o,"||").concat(z(a)):null,c={};return l&&this._ctx.stickyBucketAssignmentDocs[l]&&Object.assign(c,this._ctx.stickyBucketAssignmentDocs[l].assignments||{}),this._ctx.stickyBucketAssignmentDocs[s]&&Object.assign(c,this._ctx.stickyBucketAssignmentDocs[s].assignments||{}),c}_getStickyBucketVariation(e){let{expKey:t,expBucketVersion:n,expHashAttribute:i,expFallbackAttribute:s,expMinBucketVersion:o,expMeta:a}=e;n=n||0,o=o||0,i=i||"id",a=a||[];const l=this._getStickyBucketExperimentKey(t,n),c=this._getStickyBucketAssignments(i,s);if(o>0)for(let g=0;g<=o;g++){const m=this._getStickyBucketExperimentKey(t,g);if(c[m]!==void 0)return{variation:-1,versionIsBlocked:!0}}const f=c[l];if(f===void 0)return{variation:-1};const d=a.findIndex(g=>g.key===f);return d<0?{variation:-1}:{variation:d}}_getStickyBucketExperimentKey(e,t){return t=t||0,"".concat(e,"__").concat(t)}_getStickyBucketAttributes(e){const t={};return this._ctx.stickyBucketIdentifierAttributes=this._deriveStickyBucketIdentifierAttributes(e),this._ctx.stickyBucketIdentifierAttributes.forEach(n=>{const{hashValue:i}=this._getHashAttribute(n);t[n]=z(i)}),t}_generateStickyBucketAssignmentDoc(e,t,n){const i="".concat(e,"||").concat(t),s=this._ctx.stickyBucketAssignmentDocs&&this._ctx.stickyBucketAssignmentDocs[i]?this._ctx.stickyBucketAssignmentDocs[i].assignments||{}:{},o={...s,...n},a=JSON.stringify(s)!==JSON.stringify(o);return{key:i,doc:{attributeName:e,attributeValue:t,assignments:o},changed:a}}}class ii extends HTMLElement{constructor(){super();let e={};try{e=JSON.parse(this.dataset.growthbookFeatures)}catch(l){console.error(l)}const t=new ni({enableDevMode:!0,subscribeToChanges:!0,features:e,attributes:{user_id:ht(),user_device_id:vt(),is_authenticated:Ie(),url:window.location.href}});window.growthBook=window.growthBook||t;const n=window.growthBook.getFeatures(),i=Object.keys(n),s=[],o=[],a=[];i.forEach(l=>{const c=window.growthBook.evalFeature(l);s.push(c.value),c.experiment&&(o.push(c.experiment.key),a.push(c.experimentResult.key))}),window.publishEvent(u.GROWTHBOOK_INIT,{feature_names:i,feature_values:s,experiment_ids:o,variation_ids:a})}}customElements.define("nur-growthbook",ii);const K={RATE_LIMIT_EXCEEDED:"RATE_LIMIT_EXCEEDED",INTERNAL_SERVER_ERROR:"INTERNAL_SERVER_ERROR"},Oe={[K.RATE_LIMIT_EXCEEDED]:u.RATE_LIMIT_EXCEEDED_ERROR,[K.INTERNAL_SERVER_ERROR]:u.INTERNAL_SERVER_ERROR},si={[K.RATE_LIMIT_EXCEEDED]:"Request limit exceeded, try again in a minute",[K.INTERNAL_SERVER_ERROR]:"Technical error, try again later"},oi=r=>Object.values(K).includes(r),ai=(r,e={})=>{if(!r||!Oe[r])return;const t=Oe[r];t&&window.publishEvent(t,{...e,event_target_value:si[r]})},ci=(r,e)=>{dt({variant:pt.ALERT,text:r(`common:profile.commonErrors.${e}`)}),Oe[e]&&ai(e,{event_target_layout_section:"popover",feature:"user_authentication"})},ui="GOOGLE_CLIENT_INIT",li=["user","fedcm","fedcm_auto","user_1tap","user_2tap"],_i=()=>Object.values(ye).some(e=>window.location.pathname.includes(e))?"/":window.location.href,fi=r=>{if(li.includes(r)){window.publishEvent(u.SIGN_UP_WITH_ONE_TAP_SUCCESS);return}if(location.pathname.includes(ye.REGISTRATION)){window.publishEvent(u.SIGN_UP_WITH_GOOGLE_SUCCESS,{isRegistration:!0});return}if(location.pathname.includes(ye.LOGIN)){window.publishEvent(u.SIGN_UP_WITH_GOOGLE_SUCCESS,{isRegistration:!1});return}},di=async(r,e)=>{const t=er(e);try{const n=await Gt.signUpGoogle({...r,state:Xt()});dt({variant:pt.SUCCESS,text:t("notifications.authSuccess")}),fi(r?.select_by),hr({id:n.id,accessToken:n.access_token,refreshToken:n.refresh_token});const i=Le("redirectURL");window.location.href=i||_i()}catch(n){oi(n.code)&&ci(t,n.code)}},hi=({successCallback:r=di,locale:e,shouldRenderOneTap:t=!0})=>{const n=window.growthBook?.evalFeature(or.ONE_TAP)?.value;window.onGoogleLibraryLoad=()=>{window.google.accounts.id.initialize({client_id:"785355180476-84n5ksb2vs5s1la5iph6otb34g8jrq2e.apps.googleusercontent.com",callback:i=>r(i,e),use_fedcm_for_prompt:!0,cancel_on_tap_outside:!1,itp_support:!0,context:"continue",ux_mode:"popup",auto_select:!1}),window.dispatchEvent(new CustomEvent(ui)),t&&n&&window.google.accounts.id.prompt()}},gi=document.querySelector("[data-locale]"),vi=gi?.dataset?.locale||Jt;window.addEventListener("DOMContentLoaded",()=>{Ie()||hi({locale:vi})});const pi=1e4,mi=30,Ei=24,yi=mi*Ei,ki=()=>{if(ir(We))return;const r=document.querySelector(".js-cookie-popup");r&&(r.classList.remove("hidden"),sr(We,"true",yi),setTimeout(()=>{r.classList.add("hidden")},pi),document.querySelector(".js-cookie-popup-button")?.addEventListener("click",()=>{r.classList.add("hidden")}))};ki();const ee=()=>{const r=document.querySelector(".js-bookmarks-modal");if(!r)return;const e=new URLSearchParams(window.location.search);r.classList.contains("bookmarks-modal--open")?(r.classList.remove("bookmarks-modal--open"),e.delete(ke),Qt()):(r.classList.add("bookmarks-modal--open"),e.set(ke,ft),Zt()),window.history.replaceState({},"",`${window.location.pathname}${e.toString()?`?${e.toString()}`:""}`)},bi=()=>{if(!document.querySelector(".js-bookmarks-modal"))return;document.addEventListener(tr,ee),document.addEventListener(rr,ee);const e=document.querySelector(".js-bookmarks-modal-overlay");e&&e.addEventListener("click",ee),Le(ke)===ft&&ee()};bi();export{or as F};
Уроки русского. Чтения. Сергей Гармаш. К. Паустовский. "Телеграмма"
Скачать ZOE: Interactive Story 3.0.2 (Мод, Премиум выборы) на Android
Работники ВГА Харьковской области попали под обстрел
Кому положены пенсионные надбавки за вредные условия труда в Казахстане
Скачать Kinky Cosplay: Gyarus Gone Wild (18+) Final на Андроид