1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9829],{69829:function(t,r,e){e.r(r),e.d(r,{default:function(){return b},refreshFeatureFlags:function(){return y}});var i=e(87538),s=e(38844),n=e(67825),o=e(89380),h=e(82401),l=e(87681),u=e(26879),a=e(61131);class f{constructor(t){this.properties=t,this.properties=t||{}}tp(t,r,e){let i=this.properties[t];return null==i?(this.rp(t),null):r(i)?i.value:(this.ep(e),null)}getStringProperty(t){return this.tp(t,this.op,"string")}getNumberProperty(t){return this.tp(t,this.sp,"number")}getBooleanProperty(t){return this.tp(t,this.ip,"boolean")}getImageProperty(t){return this.tp(t,this.np,"image")}getJsonProperty(t){return this.tp(t,this.pp,"jsonobject")}getTimestampProperty(t){return this.tp(t,this.up,"datetime")}ep(t){s.Z.info(`Property is not of type ${t}.`)}rp(t){s.Z.info(`${t} not found in properties.`)}op(t){return"string"===t.type&&"string"==typeof t.value}sp(t){return"number"===t.type&&"number"==typeof t.value}ip(t){return"boolean"===t.type&&"boolean"==typeof t.value}np(t){return"image"===t.type&&"string"==typeof t.value}pp(t){return"jsonobject"===t.type&&"object"==typeof t.value&&t.value.constructor==Object}up(t){return"datetime"===t.type&&"number"==typeof t.value}}class p extends f{constructor(t,r=!1,e={},i){super(e),this.id=t,this.enabled=r,this.trackingString=i,this.id=t,this.enabled=r,this.trackingString=i}gt(){let t={};return t[p.ss.rs]=this.id,t[p.ss.Jr]=this.enabled,t[p.ss.Nr]=this.properties,t[p.ss.Or]=this.trackingString,t}}p.ss={rs:"id",Jr:"e",Nr:"pr",Or:"fts"},p.ui={rs:"id",Jr:"enabled",Nr:"properties",Or:"fts"};var d=e(14548);class v extends n.Z{constructor(t,r,e,s){super(),this.h=t,this.j=r,this.B=e,this.C=s,this.Xr=[],this.Gr=0,this.h=t,this.j=r,this.B=e,this.C=s,this.Kr=null,this.Qr=new h.Z,this.S=10,this.T=null,this.I=null,i.ZP.q(this.Qr)}N(t){var r;if((null===(r=this.h)||void 0===r?void 0:r.Yr())&&null!=t&&t.feature_flags){for(let r of(this.Xr=[],t.feature_flags)){let t=function(t){if(t[p.ui.rs]&&"boolean"==typeof t[p.ui.Jr])return new p(t[p.ui.rs],t[p.ui.Jr],t[p.ui.Nr],t[p.ui.Or]);s.Z.info(`Unable to create feature flag from ${JSON.stringify(t,null,2)}`)}(r);t&&this.Xr.push(t)}this.Gr=new Date().getTime(),this.Zr(),this.Qr.L(this.Xr)}}ho(){let t={};this.B&&(t=this.B.dt(o.I.ft.lo));let r={};for(let e in t){let i=function(t){if(t[p.ss.rs]&&"boolean"==typeof t[p.ss.Jr])return new p(t[p.ss.rs],t[p.ss.Jr],t[p.ss.Nr],t[p.ss.Or]);s.Z.info(`Unable to deserialize feature flag from ${JSON.stringify(t,null,2)}`)}(t[e]);i&&(r[i.id]=i)}return r}do(){var t;return(null===(t=this.B)||void 0===t?void 0:t.dt(o.I.ft.vo))||{}}Fo(t){this.B&&this.B.bt(o.I.ft.vo,t)}It(t){return this.Qr.Rt(t)}refreshFeatureFlags(t,r,e=!1,i=!0){let s=()=>{"function"==typeof r&&r(),this.Qr.L(this.Xr)};if(!this.po(e))return!this.Kr&&this.h&&(this.Kr=this.h.jo(()=>{this.refreshFeatureFlags(t,r)})),void s();let n=this.j;if(!n)return void s();i&&this.X();let o=n.$({},!0),h=n.A(o,d.Z.H.wo),f=!1;n.J(o,(i=-1)=>{let n=this.j;if(!n)return void s();let p=new Date().valueOf();d.Z.K(this.B,d.Z.H.wo,p),-1!==i&&h.push(["X-Braze-Req-Tokens-Remaining",i.toString()]),a.Z.O({url:`${n.V()}/feature_flags/sync`,headers:h,data:o,W:r=>{if(!n.Y(o,r,h))return f=!0,void s();n.Z(),this.N(r),f=!1,"function"==typeof t&&t()},error:t=>{n._(t,"retrieving feature flags"),f=!0,s()},tt:(i,s)=>{var o,h,a;let p;if(f){let t=(null===(o=this.h)||void 0===o?void 0:o.st())||u.Ek,r=(null===(h=this.h)||void 0===h?void 0:h.it())||u.xY,e=(null===(a=this.h)||void 0===a?void 0:a.nt())||u.rK,i=this.T;(null==i||i<t)&&(i=t),p=Math.min(e,(0,l.R)(t,i*r))}n.et(s,()=>{this.refreshFeatureFlags(t,r,e,!0)},d.Z.H.wo,t=>this.rt(t),()=>this.X(),p)}})},d.Z.H.wo,r)}X(){null!=this.I&&(clearTimeout(this.I),this.I=null)}rt(t){this.X(),this.I=t}po(t){if(!this.h)return!1;if(!t){let t=this.h.yo();if(null==t)return!1;let r=!1;if(!isNaN(t)){if(-1===t)return s.Z.info("Feature flag refreshes not allowed"),!1;r=new Date().getTime()>=(this.Gr||0)+1e3*t}if(!r)return s.Z.info(`Feature flag refreshes were rate limited to ${t} seconds`),!1}return this.h.Yr()}bo(){var t;return(null===(t=this.B)||void 0===t?void 0:t.dt(o.I.ft.Co))||null}Ro(){var t,r;null===(t=this.B)||void 0===t||t.bt(o.I.ft.Co,null===(r=this.C)||void 0===r?void 0:r.yt())}To(){var t;let r=null===(t=this.C)||void 0===t?void 0:t.yt(),e=this.bo();return null==e||r===e}Zr(){if(!this.B)return;let t={};for(let r of this.Xr){let e=r.gt();t[r.id]=e}this.B.bt(o.I.ft.lo,t),this.B.bt(o.I.ft.Do,this.Gr),this.Ro()}changeUser(){this.X()}clearData(){this.X()}}let g={i:!1,provider:null,o:()=>(g.t(),g.provider||(g.provider=new v(i.ZP.l(),i.ZP.m(),i.ZP.p(),i.ZP.u()),i.ZP.v(g.provider)),g.provider),t:()=>{g.i||(i.ZP.g(g),g.i=!0)},destroy:()=>{g.provider=null,g.i=!1}};function c(t,r,e=!1){if(i.ZP.rr())return g.o().refreshFeatureFlags(t,r,e)}function y(t,r){c(t,r)}var b=c}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.