Module 568004

2,926 characters · in no known chunk
Dependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>K}),n(321073);var r=n(735438),i=n.n(r),s=n(311907),a=n(451988),o=n(73153),l=n(781763),u=n(356645),c=n(92077),d=n(587895),_=n(253932),f=n(617617),p=n(189081),h=n(194871),m=n(775228),E=n(927813),g=n(674378),A=n(144914);let I=new Set,T={},S=new Set,y={},v=new Set,N={},C=10*E.A.Millis.MINUTE,R=6*E.A.Millis.HOUR,O=10*E.A.Millis.MINUTE,b=new a.Ep;function D(e){b.start(e+Math.random()*C,l.r)}function L(){return!_.l_.getSetting()&&(D(R),w())}function w(){if(!(0,A.S)()||_.l_.getSetting())return!1;let e=p.A.entitledBranchIds,t=[];for(let n of e)N.hasOwnProperty(n)||(N[n]=null,t.push(n));if(0===t.length)return!1;o.h.wait(()=>l.r(t))}function M(){if(!(0,A.S)())return!1;for(let e of v){let{applicationId:t,branchId:n}=(0,g.r0)(e);null!=d.A.getApplication(t)&&(v.delete(e),P(t,n))}}function P(e,t){if(null!=T[t]&&m.A.shouldBeInstalled(e,t)){let n=T[t],r=n.manifestIds,s=h.A.getState(e,t);null!=s&&s.shouldPatch&&(s.buildId!==n.id||!i().isEqual(s.manifestIds,r))&&o.h.wait(()=>{let i=d.A.getApplication(e);null!=i?(v.delete((0,g.gW)(e,t)),(0,c.K3)(i,t,n.id,r,!0)):v.add((0,g.gW)(e,t))})}}function x(e){let{branchId:t}=e;I.add(t)}function k(e){let{applicationId:t,branchId:n,locale:r,build:i}=e;I.delete(n);let s=i.manifests.map(e=>{let{id:t}=e;return t}),a=i.id;S.delete(n),T[n]={id:a,applicationId:t,branchId:n,locale:r,manifestIds:s},P(t,n)}function U(e){let{branchId:t}=e;I.delete(t),S.add(t)}function G(e){let{buildId:t}=e;y.hasOwnProperty(t)||(y[t]=null)}function F(e){let{buildId:t,sizeKB:n}=e;y[t]=n}function V(e){let{buildId:t}=e;null==y[t]&&delete y[t]}function B(e){let{branches:t}=e,n={};for(let e in p.A.libraryApplications){let t=p.A.libraryApplications[e];n[t.branchId]=t}for(let e of t){let{id:t,liveBuildId:r}=e;if(r!==N[t]){let e=n[t];null!=e&&o.h.wait(()=>u.n(e.id,e.branchId,!0))}N[t]=r}D(R)}function H(){D(O)}function j(){b.stop()}function Y(e){let{entitlements:t}=e;if(!(0,A.S)())return!1;let n=new Set;for(let e of t)n.add(e.application_id);for(let e in p.A.libraryApplications){let t=p.A.libraryApplications[e];n.has(t.id)&&(0,g.XZ)(t)&&o.h.wait(()=>u.n(t.id,t.branchId))}}class W extends s.Ay.Store{static displayName="ApplicationBuildStore";initialize(){this.syncWith([p.A],w),this.waitFor(d.A,h.A,m.A,p.A,f.A)}getTargetBuildId(e,t){return null==T[t]?null:T[t].id}getTargetManifests(e,t){return null==T[t]?null:T[t].manifestIds}hasNoBuild(e,t){return S.has(t)}isFetching(e,t){return I.has(t)}needsToFetchBuildSize(e){return!y.hasOwnProperty(e)}getBuildSize(e){return y[e]}}let K=new W(o.h,{CONNECTION_OPEN:L,GAMES_DATABASE_UPDATE:M,APPLICATION_BUILD_FETCH_START:x,APPLICATION_BUILD_FETCH_SUCCESS:k,APPLICATION_BUILD_NOT_FOUND:U,APPLICATION_BUILD_SIZE_FETCH_START:G,APPLICATION_BUILD_SIZE_FETCH_SUCCESS:F,APPLICATION_BUILD_SIZE_FETCH_FAIL:V,APPLICATION_BRANCHES_FETCH_SUCCESS:B,APPLICATION_BRANCHES_FETCH_FAIL:H,CONNECTION_CLOSED:j,LOGOUT:j,SKU_PURCHASE_SUCCESS:Y})}