define("metaserver/static/js/modules/clean/privacy_consent/privacy_consent_cookies",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentCookieStore=t.createCookieStr=t.getAllowedCategories=t.getCookieStr=t.EVIDON_SUPPRESS_COOKIE_NAME=t.EVIDON_CONSENT_COOKIE_NAME=t.DNS_COOKIE_NAME=t.CCPA_TOKEN_COOKIE_NAME=t.SHADOW_COOKIE_NAME=void 0,t.SHADOW_COOKIE_NAME="__Secure-dbx_consent",t.CCPA_TOKEN_COOKIE_NAME="__Secure-dbx_ccpa_token",t.DNS_COOKIE_NAME="__Secure-dbx_do_not_sell",t.EVIDON_CONSENT_COOKIE_NAME="_evidon_consent_cookie",t.EVIDON_SUPPRESS_COOKIE_NAME="_evidon_suppress_notification_cookie";function o(e){try{return String(document.cookie||"").split(";").map(e=>e.split("=")).map(e=>[e[0],e.slice(1).join(";")].map(e=>e.replace(/^[ \t]+|[ \t]+$/g,""))).reduce((e,[t,o])=>Object.assign(Object.assign({},e),{[t]:o}),Object.create({}))[e]||""}catch(e){return""}}var n,i;function r(e,t,o,n,i){const r={[t]:JSON.stringify(o).replace(/[;]|[^ -~]/g,e=>"\\u"+(65536+e.charCodeAt(0)).toString(16).substr(1)),domain:e,path:"/",expires:n,samesite:i||"lax",secure:""};return Object.keys(r).map(e=>r[e]?`${e}=${r[e]}`:`${e}`).join(";")}function s(e,t,o,n){document.cookie=r(e,t,o,n)}t.getCookieStr=o,(function(e){e[e.OptIn=1]="OptIn"})(n||(n={})),(function(e){e.StrictlyNecessary="strictly necessary",e.MarketingAdvertising="general marketing and advertising",e.Analytics="analytics",e.PerformanceFunctionality="performance and functionality",e.SocialMediaAdvertising="social media advertising",e.AllCookies="all"})(i||(i={})),t.getAllowedCategories=function(e){const t=Object.keys(i);let o=[];return e&&(e[i.AllCookies]?o=[...t]:t.forEach(t=>{e[i[t]]&&o.push(t)})),o},t.createCookieStr=r;const c={cookieDomain:"dropbox.com",consentDurationMonths:6};t.ConsentCookieStore=class{constructor(e,t){const o=Object.assign(Object.assign({},c),e);this.cookieDomain=o.cookieDomain,this.consentDurationMonths=o.consentDurationMonths,this.numDots=o.cookieDomain.split(".").length-1,this.log=t}hasUserInteracted(){var e;return!!(null===(e=this.getCurrentCookieObj(t.SHADOW_COOKIE_NAME))||void 0===e?void 0:e.userInteracted)}bakeShadowCookie(e){const o=new Date(e.expireDate).toUTCString();s(this.cookieDomain,t.SHADOW_COOKIE_NAME,e,o)}bakeDNSCookie(e){const o=new Date(e.expireDate).toUTCString();s(this.cookieDomain,t.DNS_COOKIE_NAME,e,o)}bakeCCPATokenCookie(e){const o=new Date(e.expireDate).toUTCString();s(this.cookieDomain,t.CCPA_TOKEN_COOKIE_NAME,e,o)}createShadowCookieValue(e,o){const i=this.getCurrentCookieObj(t.SHADOW_COOKIE_NAME),r=!!i.userInteracted,s=!(!r&&o)&&i.consentDate?new Date(i.consentDate):new Date,c=new Date(s);return c.setMonth(s.getMonth()+this.consentDurationMonths),{consentType:n.OptIn,consentDate:s.toISOString(),expireDate:c.toISOString(),consentMonths:this.consentDurationMonths,categories:e,userInteracted:r||o,numDots:this.numDots}}mapCookies(e){var t;const o={};for(const n in e)if(e.hasOwnProperty(n)){const r=n.toLowerCase();Object.values(i).includes(r)?o[r]=e[n]:null===(t=this.log)||void 0===t||t.logInvalidCookieCategoryException(r)}return o}havePreferencesChanged(e){var n;const i=this.getCurrentCookieObj(t.SHADOW_COOKIE_NAME);if(i)try{const t=JSON.stringify(i.categories);return JSON.stringify(e)!==t}catch(e){return null===(n=this.log)||void 0===n||n.logCookieParseException(t.SHADOW_COOKIE_NAME,o(t.SHADOW_COOKIE_NAME)),!1}return!0}getAllowedCategories(){const e=this.getCurrentCookieObj(t.SHADOW_COOKIE_NAME),o=null==e?void 0:e.categories,n=Object.keys(i);let r=[];return o&&(o[i.AllCookies]?r=[...n]:n.forEach(e=>{o[i[e]]&&r.push(e)})),r}clearDNSCookie(){const e=new Date,o={[t.DNS_COOKIE_NAME]:"",domain:this.cookieDomain,path:"/",expires:e.toUTCString(),samesite:"lax",secure:""},n=Object.keys(o).map(e=>void 0!==o[e]?`${e}=${o[e]}`:`${e}`);document.cookie=n.join(";")}getCurrentCookieObj(e){var t;const n=o(e);if(n)try{return JSON.parse(n)}catch(o){return null===(t=this.log)||void 0===t||t.logCookieParseException(e,n),null}return{}}bakeEvidonCookie(e){const t=/[Dd]omain=[\w\d\.-]+/;null!==e.match(t)?e=e.replace(t,`domain=${this.cookieDomain}`):e+=`;domain=${this.cookieDomain}`,document.cookie=e}}})); //# sourceMappingURL=pkg-privacy-consent-pre-tti.min.js-vflSp5xKh.map