Build 552118stable
Module 380610
2,062 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{DI:()=>p,bD:()=>_,h4:()=>A,hl:()=>c,i_:()=>d,k9:()=>h,kK:()=>f,qU:()=>S,vS:()=>m}),n(508300);var i=n(664294),r=n(567243),s=n(636537),a=n(723702),o=n(998218),l=n(986238);n(652215);let u,c=(0,a.isAndroid)()?u.Version.split(" - ")[0]:(0,a.isIOS)()?u.Version:void 0;function d(e){return`${location.protocol}//${location.host}${e}`}function _(){let e=o.A.safeParseWithQuery(d("/__development/build_overrides"));return null==e?Promise.resolve(null):(e.search=null,c&&(e.query.version=c),s.Bo.get({url:r.format(e),oldFormErrors:!0,rejectWithError:!1}).then(e=>e.body||null,()=>null))}function h(e){if(A(e))return Promise.resolve(function(e){let t=e.match(g);if(null==t||2!==t.length)return null;let n=(0,a.getNativePlatform)();return{targetBuildOverride:{[`discord_${n}`]:{type:"branch",id:t[1]}},validForUserIds:[],expiresAt:"Mon, 1 Jan 2038 00:00:00 GMT"}}(e));let t=o.A.safeParseWithQuery(e);return null==t?Promise.resolve(null):(t.search=null,t.query.meta="true",c&&(t.query.version=c),t.host=window.location.host,s.Bo.get({url:r.format(t),oldFormErrors:!0,rejectWithError:!1}).then(e=>e.body||null,()=>null))}function f(){return -1!==window.document.cookie.indexOf(`${l.ZR}=`)}function p(){try{let e=i.parse(window.document.cookie)[l.ZR];if(null==e)return{};return JSON.parse(atob(e.substring(e.indexOf(".")+1))).$meta.experiments??{}}catch(e){return{}}}let E=RegExp("^https://(?:ptb\\.|canary\\.)?(discordapp|discord)\\.com/__development/link?[\\S]+$","i");function m(e){return null!=e&&E.test(e)}let g=RegExp("^dev://branch/([\\w-./]+)$","i");function A(e){return null!=e&&g.test(e)}let I=new Set(["canary.discord.com","ptb.discord.com","discord.com","canary.discordapp.com","ptb.discordapp.com","discordapp.com"]),T=new Set(["/__development/link","/__development/link/"]);function S(e){if(A(e))return{payload:null,url:e};let t=o.A.safeParseWithQuery(e);if(null==t||!I.has(t.hostname)||!("s"in t.query)||!T.has(t.pathname))return null;for(let e in t.query)"s"!==e&&delete t.query[e];return{payload:t.query.s,url:r.format(t)}}}