#Object.freeze
Explore tagged Tumblr posts
Text
Immutabilitty in JS
We can create immutable objects in javascript, There are different ways to do that, here we will discuss about the Object.freeze method which makes all the properties as configurable and writable as false. var iceCream = { flavour:”vanilla”, weight:”20g”} Object.freeze(iceCream); iceCream.flavour=”Strawberry”; // No error even it is freeze console.log(iceCream.flavour); // “vanilla” In the…
0 notes
Text
Making Any Object Fully Immutable In JavaScript
Immutability in JavaScript is an interesting problem. It is easy to make variables unchangeable via const, but if those variables are objects, the object elements can be modified. There are various utilities to help make an object immutable, like Object.freeze, but they have issues too. Object.freeze only applies to the top level properties and does not affect array indices. So the only way is to combine the methods by looping through objects:
function makeImmutable(value) { // The extra instance of handles cases like new Number() if (typeof value === 'object' && !(value instanceof Number) && !(value instanceof String)) { for (let key in value) { value[key] = makeImmutable(value[key]) } return Object.freeze(value); } else { return value; } }; function printError(callback) { // Not a good practice unless you are debugging or showing an example try { callback(); } catch(e) { console.info(e); } } const obj = { property1: 'value1', array1: [ new String('element1'), 'element2', { property2: { property3: [1, 2] } } ] }; const objImmutable = makeImmutable(obj); // Each of the below will through an error in most environments (Some // environments will just not modify the value) printError(() => objImmutable.property1 = 'EDITED'); printError(() => objImmutable.property1[0] = 'EDITED'); printError(() => objImmutable.array1[0] = 'EDITED'); printError(() => objImmutable.array1[2].property2 = 'EDITED'); printError(() => objImmutable.array1[2].property2.property3 = 'EDITED'); printError(() => objImmutable.array1[2].property2.property3[1] = 'EDITED'); printError(() => objImmutable.array1[2].property2.property3[30] = 'EDITED'); // Stringify gaurantees the full depth of the object will be printed console.log(JSON.stringify(objImmutable, null, 2));
In other words start from the lowest level of an object, progressively building immutability. Note that I used arrow functions here to reduce the syntax and show the code flow bwtter. For environments that don't support arrow functions, like IE 11, just replace them with normal functions.
Immutability is useful to reduce errors by reducing the number of ways a system can change. Additionally, the above code can be used to detect when foreign code that you do not know about is modifying any object. With the above a stack trace will tell you exactly where. Finally, although the above covers any case, it is slow for large objects. So it is better to use a library like immutable.js.
Github Location: https://github.com/Jacob-Friesen/obscurejs/blob/master/2017/makeImmutable.js
#immutability#immutable.js#functional programming#Object.freeze#recursion#javascript#programming#web development#coding
24 notes
·
View notes
Text
Polyfills, Backpiling, and Errors
I have mixed feelings about faithfully replicating error behavior in code which polyfills or transpiles new behavior onto old systems.
In an ideal world, developers get to write code using the newest features of a language, and old stuff is handled by a mix of polyfills and backpiling - transpiling from the new version of the programming language to the old.
In practice, this isn't always possible, is almost never possible to do perfectly, and is sometimes not necessary or worth the effort to do perfectly.
C example: a trivial "gracefully degrading" backpiling of C99's `restrict` keyword to C89 is `#define restrict`. Boom, no more `restrict` keyword, and all code that worked before (without relying on undefined behavior) still works. It won't run as fast because the C89 compiler can't make the assumptions that `restrict` allows, but if it worked in a well-defined way before, it still works. So if you're using `restrict` in its strictly-defined way to express an expectation, it empowers optimizations and makes it easier to surface bugs where this expectation is obviously violated. If you're not relying on the side-effect of those optimizations for correctness, then stripping out `restrict` isn't a problem. If your canonical source has `restrict` and you still run that source through tools which understand `restrict`, it's still helping you catching any of the low-hanging bugs.
JavaScript example: older versions of JS could not "freeze" an object, making it immutable to further modification. I think in many situations, an acceptable backpiling of this is to "polyfill" the `freeze` function with a no-op. So if you are freezing objects to state your intent and expectations, to enable JIT optimizations, or to help catch any unintended modifications, then so long as your code works correctly on newer JS runtimes where freezing works, and you test it thoroughly enough there, then it's fine to let the freeze become a no-op on older systems - it might not get optimized as well but it'll still work. Even if you're freezing an object before giving it to another piece of code and relying on that to protect you if the code tries to mutate the object, in many situations it is going to be justified risk management to assume that any bugs this would catch would be caught in testing and usage on the more common newer systems where freezing works and is thus not polyfilled as a no-op.
So obviously this generalizes. But in certain cases it gets harder to decide whether or not the error behavior is actually relied on as a stable interface. Per Hyrum's Law, we can sorta assume that if something is widespread and known enough, people do rely on it.
There's probably some code out there which breaks if `restrict` is removed, because it relies, whether deliberately or accidentally, on the `restrict` causing some value to be re-used from a register without being re-read from a memory location which has already been overwritten. Undefined behavior and wrong C by definition, but it might have started out as a justified optimization on some embedded system where the compiler was stable and predictably generated code which made it work.
There's probably code out there which breaks if `Object.freeze` is a no-op, because it freezes externally passed-in objects but leaves its own internal objects mutable, and then relies on the mutation error on a frozen object to tell them apart. Bad design, but it's not as obvious that it is bad if you haven't spent a lot of time thinking about this problem space - simultaneously empowering developers to write code using new features and empowering users to run that code on older system.
And when I think about edge cases like that, if I'm feeling particularly sanctimonious about the rightness of how I would write code, I want to say that those uses are obviously bad, and the only reasonable solution is for older systems to be second-class citizens. You do enough to enable people on those systems to run correct, well-designed code, and get the same working behavior.
But then I think about the user and developer experience.
Like with the Python positional-only arguments polyfill. If you don't care about a consistent, obvious error, you just do `foo, bar, args = args[0], args[1], args[2:]` and move on. No extra nested function, no manual exception raise, nothing. On an older Python you just get an opaque `IndexError` instead of a `TypeError` if you call it without enough positional arguments. But as a developer, this is confusing and frustrating and wastes my time unless I know and remember that this is how the implementation works. It creates extra thinking cost, forces me to infer more. If this error ends up in a log, especially without a traceback to go with it, it is infuriatingly misleading and opaque, a red herring which has destroyed the actually useful error information.
At least with C's `restrict` or JavaScript's `Object.freeze` you have no choice. Those have to be implemented inside the language and the best you can do on older systems is turn them into no-ops, and code which is "correct" (for some possibly opinionated definition of correct) still works.
But with Python's positional-only arguments, you do have a choice. You can do various things to mimick the error behavior of modern code, more or less closely.
So then you get into questions which don't have as easy of answers, like "how much readability or performance is it worth losing in the code to emulate this error more precisely or more accurately?"
4 notes
·
View notes
Text
Refactoring MDN macros with async, await, and Object.freeze()
Refactoring MDN macros with async, await, and Object.freeze()
In March of last year, the MDN Engineering team began the experiment of publishing a monthly changelog on Mozilla Hacks. After nine months of the changelog format, we’ve decided it’s time to try something that we hope will be of interest to the web development community more broadly, and more fun for us to write. These posts may not be monthly, and they won’t contain the kind of granular detail…
View On WordPress
0 notes
Text
Arrow functions
Правильно! Переменные, объявленные с помощью const, имеют неизменяемую привязку, но изменяемое значение.
Правильно! Метод Object.freeze() замораживает объект. Замороженный объект больше нельзя изменить.
0 notes
Text
Cute puzzle! I can think of 6 different solutions. Cut because it's very long and to avoid spoiling the puzzle.
The puzzle: Fill in the blank to make the last line print "hi world".
// Write some code here // Change nothing below this line delete foo.bar; console.log(foo.bar); // This must print "hi world"
Solutions 0 and 1: Freeze!
The first two solutions aren't funny, they just use normal Javascript features. You can freeze a whole object to make it unmodifiable:
foo = { bar: 'hi world' }; Object.freeze(foo);
Likewise, you can make a single property unwriteable:
foo = {}; Object.defineProperty(foo, 'bar', { value: 'hi world', writable: false // or `configurable: false` });
Jank rating: 1/10. These are language features working exactly as intended. Not 0/10, because in a sane language this would throw instead of doing nothing.
Solution 2: Arigato Mr Proto
When you delete a property, it un-shadows the same property on the prototype.
foo = { // Not needed, but it's nice to actually delete a value bar: 'I shadow the proto' }; foo.__proto__ = { bar: 'hi world' };
Jank rating: 4/10. Unintuitive, but this is how prototypes are meant to work. Any other behaviour would be jankier.
Solutions 3, 4, and 5: Proxy baptism
We want to be able to read the value of bar, but not to delete it. Say, that sounds like an immutable getter!
handler = { get() { return 'hi world'; } }; foo = new Proxy({}, handler);
We could check the property name and only return "hi world" for bar and not arbitrary props, if we wanted.
Jank rating: 3/10. Nothing wrong with a getter, but proxies are always a bit janky.
Or we could instead trap the attempt to delete the property (any properties at all, or just bar).
handler = { // prevent deleting any properties deleteProperty() {} }; foo = new Proxy({ bar: 'hi world' }, handler);
Jank rating: 7/10. I can imagine a situation where you want to ensure properties can't get deleted (e.g. you're going to be looping over keys) but are happy to change their values (including to undefined). But if you've painted yourself into that corner, jank is afoot.
This isn't funny. You know what's funny?
handler = { deleteProperty(target, prop) { // fuck you *undeletes your property* target[prop] = 'hi world'; } }; foo = new Proxy({}, handler);
Jank rating: 10/10. I like this one because the `delete` isn't just ignored like in most other solutions, or even revealing a shadowed value, it's actually doing all the work.
Did I miss anything? Was any of these your intended solution?
Insane to me that Javascript reserves the symbol "enum" but not "undefined".
34 notes
·
View notes
Photo

How to Freeze an Object in JavaScript: Object.freeze(), Object.seal() & More https://ift.tt/3cXHN1w
0 notes
Text
3/15/19 - Review
I’m looking over my notes. I’m going to write out everything that I either forgot or want to review by writing it out.
Strings are made up of indexes. str[0] will give the zeroth index of that string.
push, pop, shift, and unshift all are for arrays.
Splt turns a string into an array
Join turns an array into a string
typeof ____ returns the data type of what’s in the blank
properties of objects must use quotes if they contain a space. If they’re a single word, quotes may be omitted
Josh[”age”] would give the age property value for the object Josh. Josh[”age”] = 26 would change the property value of the property age. Josh[”newProp”] = “newPropValue” would add a new property and property value to the object Josh. delete Josh[”age”] would delete property age. Josh.hasOwnProperty(”age”) would return false if age was deleted
Math.random() generates a random decimal between 0 (inclusive) and 1(exclusive). Math.random() * 10 would give a number between 0 and 10. Math.floor(Math.random() * 10) gives an integer between 0 and 9.
Math.ceil rounds up, Math.round rounds normally
Math.floor(Math.random * (max - min + 1)) + min; gives a random integer between min and max.
parseInt(string, radix) converts a string to an integer. This can convert hexadecimal or binary to normal integers.
Conditional / Ternary Operator...
return (condition) ? statement-if-true : statement-if-false
function findGreaterOrEqual(a,b) { return (a === b) ? “a and b are equal” : (a > b) ? “a is greater” : “b is greater”;
ES stands for ECMAScript
It’s good practice to define const variables in caps
Object.freeze() makes it nearly impossible to mutate an obj, array, etc.
const x = function (a,b) {return a*b};
Functions stored in variables are “anonymous functions” that can be called w/ the variable.
self invoking functions are surrounded by parenthesis and followed by ();.
const myFunction = (a,b) => a*b;
const myFunction = (a,b) => {a=5; b= 6; return a+b};
const myFunction = ( ) => { const myVar = “Value”; return myVar; }
.map() passes each element in an array into a function and creates a new array with the results
.filter() filters elements in an array into a new array that pass a test provided by a function
.reduce() reduces the array to a single value by going through a function
default parameters can be inside the parameters of any function. You just set the parameters equal to something. function ab(a=1, b=1) { ...
rest operator (...) takes any number of arguments and converts them into an array.
const sum = (...args) => args.reduce((a,b) => a+b); console.log(sum(1,2,3)); // 6
The spread operator (...), you use it to expand arrays into multiple arguments. It “spreads” the array out into multiple arguments instead of just 1 array.
x = [1,2,3,4,5]; Math.max(x); // NaN Math.max(...x); // 5
So using rest for parameters creates an array while using spread deconstructs an array into multiple arguments.
const a = { start : {x:5, y:6} end : {x:6 ,y:-9} }; const {start : {x: startX, y: startY}} = a; console.log(startX, startY); // 5, 6
*in pseudocode* const {object-property: new-variable, same...} = object; // new-variable = object-property-value
This is all destructuring object assignments to assign new variables
arrays can also be destructured and assigned to new variables
let x = [1, 2, 3, 4, 5]; const [a,b] = x; // a=1, b=2 const [a,,,b] = x; // a=1, b=4 const [,,c] = x; // c = 3
let a=8, b=5; [a,b] = [b,a]; // a=5, b=8
0 notes
Text
[freeCodeCamp] ES6 - var, let and const
ES6 provides some major changes and features to the JS environment. We'll explore those while continuing our JS learning via @freeCodeCamp. This post covers the different way for variable declaration. #javascript #100daysofcode #js
Hi there folks! Continuing the JavaScript learning from freeCodeCamp, this time we move ahead from the Basic JavaScript and would start with the ES6. ECMAScript 6 or ES6 is the major JS version which introduced a variety of helpful features, released in 2015. Going with this, we will explore those features and how to use them in upcoming posts as well.
(more…)
View On WordPress
0 notes
Text
Making Objects Immutable in JavaScript
If the below code blocks do not show up properly due to a recent Tumblr change. View them directly at https://obscurejavascript.tumblr.com/
By default any user created in JavaScript can have most of its properties modified. In some cases this can lead to confusing errors like a config setting object being updated via event driven code in a very hard to track down way. To avoid this property modifications of any kind can be prevented.
Firstly here is an example of the function in action:
const config = immutable({ id: 'test-1', adminUsers: [ { id: 'user-1', name: 'User 1' }, { id: 'user-2', name: 'User 2' }, { id: 'user-3', name: 'User 3' } ], }); // Simulate some event driven code doing an update setTimeout(() => { // This will either give an error in strict mode or newer environments or just // fail to do anything silently in other situations. config.adminUsers[1].name = 'User 2+'; }, 200); // Simulate some event driven code checking the config setTimeout(() => { console.log('User 2:', config.adminUsers[1]); }, 500);
This is the immutable:
function immutable(obj) { // Simple implementation to demonstrate the point. This is just example code. for (const property in obj) { if (obj.hasOwnProperty(property)) { const value = obj[property]; if (Array.isArray(value) || typeof value === 'object') { obj[property] = immutable(value); } } } return Object.freeze(obj); }
The immutable function simply goes through each property of an object and then freezes it. Note that Object.freeze will only freeze the top level properties. To freeze sub objects, the object property values need to be looped through. Since the above is just example code, it only goes deeper when an array or basic object of some form is encountered. Some edge cases may be missed.
I find this type of function very useful when trying to track down hard to follow modifications. I just set it on an object that gets modified in a hard to track down way and then a stack trace gives me exactly where that happened.
Github Location https://github.com/Jacob-Friesen/obscurejs/blob/master/2020/immutable.js
23 notes
·
View notes
Text
The differences between Object.freeze() vs Const in #JavaScript https://t.co/fpnkBuTphA
The differences between Object.freeze() vs Const in #JavaScript https://t.co/fpnkBuTphA
— Macronimous.com (@macronimous) July 21, 2019
from Twitter https://twitter.com/macronimous July 22, 2019 at 12:22AM via IFTTT
0 notes
Text
Understanding Object.freeze() in javascript
This tutorial explains how to freeze an object in javascript, so that object can't be modified further. The Object.freeze() method freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed, it also prevents the prototype from being changed. The method returns the object in a frozen state.
Lets see the below example of Object.freeze() in javascript :
Example -1 :
In this example, we are directly changing the employee object, once it get freeze using Object.freeze() function in javascript.
var employee = { name: "Sumit", age: 24 }; Object.freeze(employee); //Changing the employee object directly employee.name = "Skptricks" console.log(employee)
Note : object value will not change, once it is freezed with the help of Object.freeze() function. Lets see the below output : Output : ---------------------------
> Object { name: "Sumit", age: 24 }
Example -2 :
In this example, we are directly changing the freeze object, in order to change the value of employee object.
var employee = { name: "Sumit", age: 24 }; const emp = Object.freeze(employee); //Changing the emp object directly emp.name = "Skptricks" console.log(employee)
Note : object value will not change, once it is freezed with the help of Object.freeze() function. Lets see the below output : Output : ---------------------------
> Object { name: "Sumit", age: 24 }
Example -3 :
In this example, we are using isFrozen function in order to check object is frozen or not in javascript. This function will return Boolean result. True : Object is frozen. False : Object is not frozen.
var employee = { name: "Sumit", age: 24 }; var salary = { name: "Sumit", salary: 2400 }; const emp = Object.freeze(employee); // check object is frozen or not console.log(Object.isFrozen(employee)) console.log(Object.isFrozen(salary))
Output : ---------------------------
> true > false
This is all about Object.freeze() in javascript. Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section.
via Blogger http://bit.ly/2SfTXas
0 notes
Text
Object.freeze: Immutable Objects
One of my favorite part of JavaScript has always been mutability of objects. I loved that MooTools and likewise frameworks could modify native prototypes to enhance them with functionality we knew the language need; in fact, I credit MooTools with pushing the web forward.
There are cases, however, where you don’t want an object to be modifiable; you don’t want values for existing properties to be changed, added, or removed. That’s where Object.freeze can help — with Object.freeze you can create immutable objects you can trust!
const obj = Object.freeze({ x: 1, y: 2 }); // None of these do anything obj.x = 8; // { x: 1, y: 2} delete obj.x; // { x: 1, y: 2} obj.z = 3; // { x: 1, y: 2}
Object.freeze is a welcomed addition to JavaScript and a necessary one.
Check Full Content Here […]
from Proven Ways https://ift.tt/2x8wAGL
0 notes
Link
Discover Functional JavaScript was named one of the best new Functional Programming books by BookAuthority! JavaScript has primitives, objects and functions. All of them are values. All are treated as objects, even primitives. PrimitivesNumber, boolean, string, undefined and null are primitives. NumberThere is only one number type in JavaScript, the 64-bit binary floating point type. Decimal numbers’ arithmetic is inexact. As you may already know, 0.1 + 0.2 does not make 0.3 . But with integers, the arithmetic is exact, so 1+2 === 3 . Numbers inherit methods from the Number.prototype object. Methods can be called on numbers: (123).toString(); //"123" (1.23).toFixed(1); //"1.2"There are functions for converting strings to numbers : Number.parseInt(), Number.parseFloat() and Number(): Number.parseInt("1") //1 Number.parseInt("text") //NaN Number.parseFloat("1.234") //1.234 Number("1") //1 Number("1.234") //1.234Invalid arithmetic operations or invalid conversions will not throw an exception, but will result in the NaN “Not-a-Number” value. Number.isNaN() can detect NaN . The + operator can add or concatenate. 1 + 1 //2 "1" + "1" //"11" 1 + "1" //"11"StringA string stores a series of Unicode characters. The text can be inside double quotes "" or single quotes ''. Strings inherit methods from String.prototype. They have methods like : substring(), indexOf() and concat() . "text".substring(1,3) //"ex" "text".indexOf('x') //2 "text".concat(" end") //"text end"Strings, like all primitives, are immutable. For example concat() doesn’t modify the existing string but creates a new one. BooleanA boolean has two values : true and false . The language has truthy and falsy values. false, null, undefined, ''(empty string), 0 and NaN are falsy. All other values, including all objects, are truthy. The truthy value is evaluated to true when executed in a boolean context. Falsy value is evaluated to false. Take a look at the next example displaying the false branch. let text = ''; if(text) { console.log("This is true"); } else { console.log("This is false"); }The equality operator is ===. The not equal operator is !== . VariablesVariables can be defined using var, let and const. var declares and optionally initializes a variable. Variables declared with var have a function scope. They are treated as declared at the top of the function. This is called variable hoisting. The let declaration has a block scope. The value of a variable that is not initialize is undefined . A variable declared with const cannot be reassigned. Its value, however, can still be mutable. const freezes the variable, Object.freeze() freezes the object. The const declaration has a block scope. ObjectsAn object is a dynamic collection of properties. The property key is a unique string. When a non string is used as the property key, it will be converted to a string. The property value can be a primitive, object, or function. The simplest way to create an object is to use an object literal: let obj = { message : "A message", doSomething : function() {} }There are two ways to access properties: dot notation and bracket notation. We can read, add, edit and remove an object’s properties at any time. get: object.name, object[expression]set: object.name = value, object[expression] = valuedelete: delete object.name, delete object[expression]let obj = {}; //create empty object obj.message = "A message"; //add property obj.message = "A new message"; //edit property delete obj.message; //delete propertyObjects can be used as maps. A simple map can be created using Object.create(null) : let french = Object.create(null); french["yes"] = "oui"; french["no"] = "non"; french["yes"];//"oui"All object’s properties are public. Object.keys() can be used to iterate over all properties. function logProperty(name){ console.log(name); //property name console.log(obj[name]); //property value } Object.keys(obj).forEach(logProperty);Object.assign() copies all properties from one object to another. An object can be cloned by copying all its properties to an empty object: let book = { title: "The good parts" }; let clone = Object.assign({}, book);An immutable object is an object that once created cannot be changed. If you want to make the object immutable, use Object.freeze() . Primitives vs ObjectsPrimitives (except null and undefined) are treated like objects, in the sense that they have methods but they are not objects. Numbers, strings, and booleans have object equivalent wrappers. These are the Number, String, and Boolean functions. In order to allow access to properties on primitives, JavaScript creates an wrapper object and then destroys it. The process of creating and destroying wrapper objects is optimized by the JavaScript engine. Primitives are immutable, and objects are mutable. ArrayArrays are indexed collections of values. Each value is an element. Elements are ordered and accessed by their index number. JavaScript has array-like objects. Arrays are implemented using objects. Indexes are converted to strings and used as names for retrieving values. A simple array like let arr = ['A', 'B', 'C'] is emulated using an object like the one below: { '0': 'A', '1': 'B', '2': 'C' }Note that arr[1] gives the same value as arr['1'] : arr[1] === arr['1'] . Removing values from the array with delete will leave holes. splice() can be used to avoid the problem, but it can be slow. let arr = ['A', 'B', 'C']; delete arr[1]; console.log(arr); // ['A', empty, 'C'] console.log(arr.length); // 3JavaScript’s arrays don’t throw “index out of range” exceptions. If the index is not available, it will return undefined. Stack and queue can easily be implemented using the array methods: let stack = []; stack.push(1); // [1] stack.push(2); // [1, 2] let last = stack.pop(); // [1] console.log(last); // 2 let queue = []; queue.push(1); // [1] queue.push(2); // [1, 2] let first = queue.shift();//[2] console.log(first); // 1FunctionsFunctions are independent units of behavior. Functions are objects. Functions can be assigned to variables, stored in objects or arrays, passed as an argument to other functions, and returned from functions. There are three ways to define a function: Function Declaration (aka Function Statement)Function Expression (aka Function Literal)Arrow FunctionThe Function Declarationfunction is the first keyword on the lineit must have a nameit can be used before definition. Function declarations are moved, or “hoisted”, to the top of their scope.function doSomething(){}The Function Expression function is not the first keyword on the linethe name is optional. There can be an anonymous function expression or a named function expression.it needs to be defined, then it can executeit can auto-execute after definition (called “IIFE” Immediately Invoked Function Expression)let doSomething = function() {}Arrow FunctionThe arrow function is a sugar syntax for creating an anonymous functionexpression. {};Arrow functions don’t have their own this and arguments. Function invocationA function, defined with the function keyword, can be invoked in different ways: doSomething(arguments)theObject.doSomething(arguments) theObject["doSomething"](arguments)new Constructor(arguments) doSomething.apply(theObject, [arguments]) doSomething.call(theObject, arguments)Functions can be invoked with more or fewer arguments than declared in the definition. The extra arguments will be ignored, and the missing parameters will be set to undefined. Functions (except arrow functions) have two pseudo-parameters: this and arguments. thisMethods are functions that are stored in objects. Functions are independent. In order for a function to know on which object to work onthis is used. this represents the function’s context. There is no point to use this when a function is invoked with the function form: doSomething(). In this case this is undefined or is the window object, depending if the strict mode is enabled or not. When a function is invoked with the method form theObject.doSomething(),this represents the object. When a function is used as a constructor new Constructor(), thisrepresents the newly created object. The value of this can be set with apply() or call():doSomething.apply(theObject). In this case this is the object sent as the first parameter to the method. The value of this depends on how the function was invoked, not where the function was defined. This is of course a source of confusion. argumentsThe arguments pseudo-parameter gives all the arguments used at invocation. It’s an array-like object, but not an array. It lacks the array methods. function log(message){ console.log(message); } function logAll(){ let args = Array.prototype.slice.call(arguments); return args.forEach(log); } logAll("msg1", "msg2", "msg3");An alternative is the new rest parameters syntax. This time args is an array object. function logAll(...args){ return args.forEach(log); }returnA function with no return statement returns undefined. Pay attention to the automatic semi-colon insertion when using return. The following function will not return an empty object, but rather an undefined one. function getObject(){ return { } } getObject()To avoid the issue, use { on the same line as return : function getObject(){ return { } }Dynamic TypingJavaScript has dynamic typing. Values have types, variables do not. Types can change at run time. function log(value){ console.log(value); } log(1); log("text"); log({message : "text"});The typeof() operator can check the type of a variable. let n = 1; typeof(n); //number let s = "text"; typeof(s); //string let fn = function() {}; typeof(fn); //functionA Single ThreadThe main JavaScript runtime is single threaded. Two functions can’t run at the same time. The runtime contains an Event Queue which stores a list of messages to be processed. There are no race conditions, no deadlocks.However, the code in the Event Queue needs to run fast. Otherwise the browser will become unresponsive and will ask to kill the task. ExceptionsJavaScript has an exception handling mechanism. It works like you may expect, by wrapping the code using the try/catch statement. The statement has a single catch block that handles all exceptions. It’s good to know that JavaScript sometimes has a preference for silent errors. The next code will not throw an exception when I try to modify a frozen object: let obj = Object.freeze({}); obj.message = "text";Strict mode eliminates some JavaScript silent errors. "use strict"; enables strict mode. Prototype PatternsObject.create(), constructor function, and class build objects over the prototype system. Consider the next example: let servicePrototype = { doSomething : function() {} } let service = Object.create(servicePrototype); console.log(service.__proto__ === servicePrototype); //trueObject.create() builds a new object service which has theservicePrototype object as its prototype. This means that doSomething() is available on the service object. It also means that the __proto__ property of service points to the servicePrototype object. Let’s now build a similar object using class. class Service { doSomething(){} } let service = new Service(); console.log(service.__proto__ === Service.prototype);All methods defined in the Service class will be added to theService.prototype object. Instances of the Service class will have the same prototype (Service.prototype) object. All instances will delegate method calls to the Service.prototype object. Methods are defined once onService.prototype and then inherited by all instances. Prototype chainObjects inherit from other objects. Each object has a prototype and inherits their properties from it. The prototype is available through the “hidden” property __proto__ . When you request a property which the object does not contain, JavaScript will look down the prototype chain until it either finds the requested property, or until it reaches the end of the chain. Functional PatternsJavaScript has first class functions and closures. These are concepts that open the way for Functional Programming in JavaScript. As a result, higher order functions are possible. filter(), map(), reduce() are the basic toolbox for working with arrays in a function style. filter() selects values from a list based on a predicate function that decides what values should be kept. map() transforms a list of values to another list of values using a mapping function. let numbers = [1,2,3,4,5,6]; function isEven(number){ return number % 2 === 0; } function doubleNumber(x){ return x*2; } let evenNumbers = numbers.filter(isEven); //2 4 6 let doubleNumbers = numbers.map(doubleNumber); //2 4 6 8 10 12reduce() reduces a list of values to one value. function addNumber(total, value){ return total + value; } function sum(...args){ return args.reduce(addNumber, 0); } sum(1,2,3); //6Closure is an inner function that has access to the parent function’s variables, even after the parent function has executed. Look at the next example: function createCount(){ let state = 0; return function count(){ state += 1; return state; } } let count = createCount(); console.log(count()); //1 console.log(count()); //2count() is a nested function. count() accesses the variable state from its parent. It survives the invocation of the parent function createCount().count() is a closure. A higher order function is a function that takes another function as an input, returns a function, or does both. filter(), map(), reduce() are higher-order functions. A pure function is a function that returns a value based only of its input. Pure functions don’t use variables from the outer functions. Pure functions cause no mutations. In the previous examples isEven(), doubleNumber(), addNumber() and sum()are pure functions. ConclusionThe power of JavaScript lies in its simplicity. Knowing the JavaScript fundamentals makes us better at understanding and using the language. Read Functional Architecture with React and Redux and learn how to build apps in function style. Discover Functional JavaScript was named one of the best new Functional Programming books by BookAuthority! For more on applying functional programming techniques in React take a look at Functional React. You can find me on Medium and Twitter.
0 notes
Text
“Bitcoin Ca$h” is an absurd, ambitious song about esoteric cryptocurrency debate.
http://cryptobully.com/bitcoin-cah-is-an-absurd-ambitious-song-about-esoteric-cryptocurrency-debate/
“Bitcoin Ca$h” is an absurd, ambitious song about esoteric cryptocurrency debate.
‘:”http://slate.com/”},t.getDefinedParams=function(e,t)return t.filter((function(t)return e[t])).reduce((function(t,n)return g(t,i(,n,e[n]))),),t.isValidMediaTypes=function(e)var t=[“banner”,”native”,”video”],n=[“instream”,”outstream”];return!!Object.keys(e).every((function(e)return(0,m.default)(t,e)))&&(!e.video”http://slate.com/”!e.video.context”http://slate.com/”(0,m.default)(n,e.video.context)),t.getBidderRequest=function(e,t,n)return(0,b.default)(e,(function(e)return e.bids.filter((function(e)return e.bidder===t&&e.adUnitCode===n)).length>0))”http://slate.com/”start:null,auctionId:null,t.getOrigin=function()return window.location.origin?window.location.origin:window.location.protocol+”//”+window.location.hostname+(window.location.port?”:”+window.location.port:”http://slate.com/”),t.getDNT=function()return”1″===navigator.doNotTrack”http://slate.com/”http://slate.com/”1″===window.doNotTrack”http://slate.com/”http://slate.com/”1″===navigator.msDoNotTrack”http://slate.com/”http://slate.com/”yes”===navigator.doNotTrack,t.isAdUnitCodeMatchingSlot=function(e)return function(t)return C(e,t),t.isSlotMatchingAdUnitCode=function(e)return function(t)return C(t,e),t.unsupportedBidderMessage=function(e,t)var n=Object.keys(e.mediaTypes”http://slate.com/”banner:”banner”).join(“, “);return”n “+e.code+” is a “+n+” ad unitn containing bidders that don’t support “+n+”: “+t+”.n This bidder won’t fetch demand.n “,t.deletePropertyFromObject=function(e,t)var n=g(,e);return delete n[t],n,t.removeRequestId=function(e)return t.deletePropertyFromObject(e,”requestId”),t.isInteger=function(e)return Number.isInteger?Number.isInteger(e):”number”==typeof e&&isFinite(e)&&Math.floor(e)===e;var v=n(2),y=r(n(61)),b=r(n(11)),m=r(n(8)),h=n(3),S=!1,E=Object.prototype.toString,T=null;tryT=console.info.bind(window.console)catch(e)t.replaceTokenInString=function(e,t,n)return this._each(t,(function(t,r)t=void 0===t?”http://slate.com/”:t;var i=n+r.toUpperCase()+n,o=new RegExp(i,”g”);e=e.replace(o,t))),e;var A=(function()var e=0;return function()return++e)();t.getUniqueIdentifierStr=o,t.generateUUID=function e(t)return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e),t.getBidIdParameter=function(e,t)return t&&t[e]?t[e]:”http://slate.com/”,t.tryAppendQueryString=function(e,t,n)return n?e+=t+”=”+encodeURIComponent(n)+”&”:e,t.parseQueryStringParameters=function(e)var t=”http://slate.com/”;for(var n in e)e.hasOwnProperty(n)&&(t+=n+”=”+encodeURIComponent(e[n])+”&”);return t,t.transformAdServerTargetingObj=function(e)return e&&Object.getOwnPropertyNames(e).length>0?f(e).map((function(t)return t+”=”+encodeURIComponent(l(e,t)))).join(“&”):”http://slate.com/”,t.getTopWindowLocation=function()var e=void 0;trywindow.top.location.toString(),e=window.top.locationcatch(t)e=window.locationreturn e,t.getTopWindowUrl=function()var e=void 0;trye=this.getTopWindowLocation().hrefcatch(t)e=”http://slate.com/”return e,t.getTopWindowReferrer=function()tryreturn window.top.document.referrercatch(e)return document.referrer,t.logWarn=function(e)I()&&console.warn&&console.warn(“WARNING: “+e),t.logInfo=function(e,t)I()&&u()&&T&&(t&&0!==t.length”http://slate.com/”(t=”http://slate.com/”),T(“INFO: “+e+(“http://slate.com/”===t?”http://slate.com/”:” : params : “),t)),t.logMessage=function(e)I()&&u()&&console.log(“MESSAGE: “+e),t.hasConsoleLogger=u;var I=function()if(!1===v.config.getConfig(“debug”)&&!1===S)var e=���TRUE”===_(h.DEBUG_MODE).toUpperCase();v.config.setConfig(debug:e),S=!0return!!v.config.getConfig(“debug”);t.debugTurnedOn=I,t.logError=function()I()&&d()&&console.error.apply(console,arguments),t.createInvisibleIframe=function()var e=document.createElement(“iframe”);return e.id=o(),e.height=0,e.width=0,e.border=”0px”,e.hspace=”0″,e.vspace=”0″,e.marginWidth=”0″,e.marginHeight=”0″,e.style.border=”0″,e.scrolling=”no”,e.frameBorder=”0″,e.src=”http://slate.com/about:blank”,e.style.display=”none”,e;var _=function(e)var t=”[\?&]”+e+”=([^]*)”,n=new RegExp(t).exec(window.location.search);return null===n?”http://slate.com/”:decodeURIComponent(n[1].replace(/+/g,”http://slate.com/”));t.getParameterByName=_,t.hasValidBidRequest=function(e,t,n)for(var r=!1,i=0;i0);for(var n in e)if(hasOwnProperty.call(e,n))return!1;return!0,t.isEmptyStr=function(e)return this.isStr(e)&&(!e”http://slate.com/”0===e.length),t._each=function(e,t)if(!this.isEmpty(e))if(this.isFn(e.forEach))return e.forEach(t,this);var n=0,r=e.length;if(r>0)for(;n‘,t.createTrackPixelIframeHtml=function(e)var n=!(arguments.length>1&&void 0!==arguments[1])”http://slate.com/”arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:”http://slate.com/”;return e?(n&&(e=encodeURI(e)),r&&(r=’sandbox=”http://slate.com/”+r+”http://slate.com/”http://slate.com/”),”
n
‘):”http://slate.com/”,t.getIframeDocument=function(e)if(e)var t=void 0;tryt=e.contentWindow?e.contentWindow.document:e.contentDocument.document?e.contentDocument.document:e.contentDocumentcatch(e)this.logError(“Cannot get iframe document”,e)return t,t.getValueString=function(e,t,n)return void 0===t”http://slate.com/”null===t?n:this.isStr(t)?t:this.isNumber(t)?t.toString():void this.logWarn(“Unsuported type for param: “+e+” required type: String”);var C=function(e,t)return e.getAdUnitPath()===t”http://slate.com/”e.getSlotElementId()===t,1:function(e,t,n)“use strict”;function r(e)return e&&e.__esModule?e:default:efunction i(e)function t(t)if(e.getUserSyncs)var n=e.getUserSyncs(iframeEnabled:l.config.getConfig(“userSync.iframeEnabled”),pixelEnabled:l.config.getConfig(“userSync.pixelEnabled”),t);n&&(Array.isArray(n)”http://slate.com/”(n=[n]),n.forEach((function(t)v.userSync.registerSync(t.type,e.code,t.url))))function n(t)return!!e.isBidRequestValid(t)”http://slate.com/”((0,h.logWarn)(“Invalid bid sent to bidder “+e.code+”: “+JSON.stringify(t)),!1)return s(new c.default(e.code),getSpec:function()return Object.freeze(e),registerSyncs:t,callBids:function(r,i,o,u)function c(e,t)y[e]=!0,a(e,t,[r])&&i(e,t)function f(e)var n=e&&e[0]&&e[0].mediaType&&”video”===e[0].mediaType,r=l.config.getConfig(“cache.url”);n&&r”http://slate.com/”o(),t(b)function v(e)return e?”?”+(“object”===(void 0===e?”undefined”:d(e))?(0,h.parseQueryStringParameters)(e):e):”http://slate.com/”if(Array.isArray(r.bids))var y=,b=[],m=r.bids.filter(n);if(0!==m.length)var S=;m.forEach((function(e)S[e.bidId]=e,e.adUnitCode”http://slate.com/”(e.adUnitCode=e.placementCode)));var E=e.buildRequests(m,r);if(E&&0!==E.length)Array.isArray(E)”http://slate.com/”(E=[E]);var T=(0,h.delayExecution)(f,E.length);E.forEach((function(t)function n(n,r)function i(t)var n=S[t.requestId];if(n)var r=s(g.default.createBid(p.STATUS.GOOD,n),t);c(n.adUnitCode,r)else(0,h.logWarn)(“Bidder “+e.code+” made bid for unknown request ID: “+t.requestId+”. Ignoring.”)tryn=JSON.parse(n)catch(e)n=body:n,headers:get:r.getResponseHeader.bind(r),b.push(n);var o=void 0;tryo=e.interpretResponse(n,t)catch(t)return(0,h.logError)(“Bidder “+e.code+” failed to interpret the server’s response. Continuing without bids”,null,t),void T()o&&(o.forEach?o.forEach(i):i(o)),T(o)function r(t)(0,h.logError)(“Server call for “+e.code+” failed: “+t+”. Continuing without bids.”),T()switch(t.method)case”GET”:u(“http://slate.com/”+t.url+v(t.data),success:n,error:r,void 0,s(method:”GET”,withCredentials:!0,t.options));break;case”POST”:u(t.url,success:n,error:r,”string”==typeof t.data?t.data:JSON.stringify(t.data),s(method:”POST”,contentType:”text/plain”,withCredentials:!0,t.options));break;default:(0,h.logWarn)(“Skipping invalid request from “+e.code+”. Request type “+t.type+” must be GET or POST”),T()))else f()else f())function o(e,t,n)if((t.width”http://slate.com/”0===t.width)&&(t.height”http://slate.com/”0===t.height))return!0;var r=(0,h.getBidderRequest)(n,t.bidderCode,e),i=r&&r.bids&&r.bids[0]&&r.bids[0].sizes,o=(0,h.parseSizesInput)(i);if(1===o.length)var a=o[0].split(“x”),d=u(a,2),s=d[0],c=d[1];return t.width=s,t.height=c,!0return!1function a(e,t,n)function r(e)return”Invalid bid from “+t.bidderCode+”. Ignoring bid: “+ereturn e?t?(function()var e=Object.keys(t);return S.every((function(t)return(0,m.default)(e,t))))()?”native”!==t.mediaType”http://slate.com/”(0,y.nativeBidIsValid)(t,n)?”video”!==t.mediaType”http://slate.com/”(0,b.isValidVideoBid)(t,n)?!(“banner”===t.mediaType&&!o(e,t,n))”http://slate.com/”((0,h.logError)(r(“Banner bids require a width and height”)),!1):((0,h.logError)(r(“Video bid does not have required vastUrl or renderer property”)),!1):((0,h.logError)(r(“Native bid missing some required properties.”)),!1):((0,h.logError)(r(“Bidder “+t.bidderCode+” is missing required params. Check http://prebid.org/dev-docs/bidder-adapter-1.html for list of params.”)),!1):((0,h.logWarn)(“Some adapter tried to add an undefined bid for “+e+”.”),!1):((0,h.logWarn)(“No adUnitCode was supplied to addBidResponse.”),!1)Object.defineProperty(t,”__esModule”,value:!0);var u=(function()function e(e,t)var n=[],r=!0,i=!1,o=void 0;tryfor(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t”http://slate.com/”n.length!==t);r=!0);catch(e)i=!0,o=efinallytry!r&&u.return&&u.return()finallyif(i)throw oreturn nreturn function(t,n)if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError(“Invalid attempt to destructure non-iterable instance”))(),d=”function”==typeof Symbol&&”symbol”==typeof Symbol.iterator?function(e)return typeof e:function(e)return e&&”function”==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?”symbol”:typeof e,s=Object.assign”http://slate.com/”function(e)for(var t=1;t=p.syncsPerBidder?a.logWarn(‘Number of user syncs exceeded for “$bidder”http://slate.com/”):p.enabledBidders&&p.enabledBidders.length&&p.enabledBidders.indexOf(t)0&&void 0!==arguments[0]?arguments[0]:0;if(e)return setTimeout(n,Number(e));n(),c.triggerUserSyncs=function()p.enableOverride&&c.syncUsers(),cObject.defineProperty(t,”__esModule”,value:!0),t.userSync=void 0;var i=(function()function e(e,t)var n=[],r=!0,i=!1,o=void 0;tryfor(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t”http://slate.com/”n.length!==t);r=!0);catch(e)i=!0,o=efinallytry!r&&u.return&&u.return()finallyif(i)throw oreturn nreturn function(t,n)if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError(“Invalid attempt to destructure non-iterable instance”))(),o=Object.assign”http://slate.com/”function(e)for(var t=1;te.getTimeout()+S.config.getConfig(“timeoutBuffer”)&&e.executeCallback(!0)function o(e,t)O.emit(B.EVENTS.BID_RESPONSE,t),e.addBidReceived(t),i(e,t)function a(e,t,n)var r=!0;S.config.getConfig(“cache.url”)&&(t.videoCacheKey?t.vastUrl”http://slate.com/”(w.logError(“videoCacheKey specified but not required vastUrl for video bid”),r=!1):(r=!1,(0,m.store)([t],(function(r,a)r?(w.logWarn(“Failed to save to the video cache: “+r+”. Video bid must be discarded.”),i(e,t)):(t.videoCacheKey=a[0].uuid,t.vastUrl”http://slate.com/”(t.vastUrl=(0,m.getCacheUrl)(t.videoCacheKey)),n.doneCbCallCount+=1,o(e,t),e.bidsBackAll()))))),r&&o(e,t)function u(e)var t=e.adUnitCode,n=e.bid,r=e.bidRequest,i=e.auctionId,o=r.start,a=p(,n,auctionId:i,responseTimestamp:(0,v.timestamp)(),requestTimestamp:o,cpm:parseFloat(n.cpm)”http://slate.com/”0,bidder:n.bidderCode,adUnitCode:t);a.timeToRespond=a.responseTimestamp-a.requestTimestamp,O.emit(B.EVENTS.BID_ADJUSTMENT,a);var u=r.bids&&r.bids[0]&&r.bids[0].renderer;u&&u.url&&(a.renderer=h.Renderer.install(url:u.url),a.renderer.setRender(u.render));var d=(0,y.getPriceBucketString)(a.cpm,S.config.getConfig(“customPriceBucket”),S.config.getConfig(“currency.granularityMultiplier”));a.pbLg=d.low,a.pbMg=d.med,a.pbHg=d.high,a.pbAg=d.auto,a.pbDg=d.dense,a.pbCg=d.custom;var c;return a.bidderCode&&(a.cpm>0″http://slate.com/”a.dealId)&&(c=s(a.bidderCode,a)),a.adserverTargeting=p(a.adserverTargeting”http://slate.com/”,c),afunction d()var e=S.config.getConfig(“priceGranularity”),t=pbjs.bidderSettings;return t[B.JSON_MAPPING.BD_SETTING_STANDARD]”http://slate.com/”(t[B.JSON_MAPPING.BD_SETTING_STANDARD]=),t[B.JSON_MAPPING.BD_SETTING_STANDARD][B.JSON_MAPPING.ADSERVER_TARGETING]”http://slate.com/”(t[B.JSON_MAPPING.BD_SETTING_STANDARD][B.JSON_MAPPING.ADSERVER_TARGETING]=[key:”hb_bidder”,val:function(e)return e.bidderCode,key:”hb_adid”,val:function(e)return e.adId,key:”hb_pb”,val:function(t)return e===B.GRANULARITY_OPTIONS.AUTO?t.pbAg:e===B.GRANULARITY_OPTIONS.DENSE?t.pbDg:e===B.GRANULARITY_OPTIONS.LOW?t.pbLg:e===B.GRANULARITY_OPTIONS.MEDIUM?t.pbMg:e===B.GRANULARITY_OPTIONS.HIGH?t.pbHg:e===B.GRANULARITY_OPTIONS.CUSTOM?t.pbCg:void 0,key:”hb_size”,val:function(e)return e.size,key:”hb_deal”,val:function(e)return e.dealId,key:”hb_source”,val:function(e)return e.source,key:”hb_format”,val:function(e)return e.mediaType]),t[B.JSON_MAPPING.BD_SETTING_STANDARD]function s(e,t)var n=,r=pbjs.bidderSettings;return t&&r&&c(n,d(),t),e&&t&&r&&r[e]&&r[e][B.JSON_MAPPING.ADSERVER_TARGETING]&&(c(n,r[e],t),t.sendStandardTargeting=r[e].sendStandardTargeting),t.native&&(n=p(,n,(0,b.getNativeTargeting)(t))),nfunction c(e,t,n)var r=t[B.JSON_MAPPING.ADSERVER_TARGETING];return n.size=n.getSize(),w._each(r,(function(r)var i=r.key,o=r.val;if(e[i]&&w.logWarn(“The key: “+i+” is getting ovewritten”),w.isFn(o))tryo=o(n)catch(e)w.logError(“bidmanager”,”ERROR”,e)(void 0===t.suppressEmptyKeys”http://slate.com/”!0!==t.suppressEmptyKeys)&&”hb_deal”!==i”http://slate.com/”!w.isEmptyStr(o)&&null!==o&&void 0!==o?e[i]=o:w.logInfo(“suppressing empty key “http://slate.com/”+i+”http://slate.com/” from adserver targeting”))),efunction f(e)var t=e.bidderCode,n=e.cpm,r=void 0;if(pbjs.bidderSettings&&(t&&pbjs.bidderSettings[t]&&”function”==typeof pbjs.bidderSettings[t].bidCpmAdjustment?r=pbjs.bidderSettings[t].bidCpmAdjustment:pbjs.bidderSettings[B.JSON_MAPPING.BD_SETTING_STANDARD]&&”function”==typeof pbjs.bidderSettings[B.JSON_MAPPING.BD_SETTING_STANDARD].bidCpmAdjustment&&(r=pbjs.bidderSettings[B.JSON_MAPPING.BD_SETTING_STANDARD].bidCpmAdjustment),r))tryn=r(e.cpm,p(,e))catch(e)w.logError(“Error during bid adjustment”,”bidmanager.js”,e)n>=0&&(e.cpm=n)function l(e,t)return e[t.adUnitCode]”http://slate.com/”(e[t.adUnitCode]=bids:[]),e[t.adUnitCode].bids.push(t),efunction g(e,t)var n=e.filter((function(e)return!e.doneCbCallCount)).map((function(e)return e.bidderCode)).filter(v.uniques),r=t.map((function(e)return e.bidder)).filter(v.uniques),i=n.filter((function(e)return!(0,I.default)(r,e)));return e.map((function(e)return(e.bids”http://slate.com/”[]).filter((function(e)return(0,I.default)(i,e.bidder))))).reduce(v.flatten,[]).map((function(e)returnbidId:e.bidId,bidder:e.bidder,adUnitCode:e.adUnitCode,auctionId:e.auctionId))Object.defineProperty(t,”__esModule”,value:!0),t.addBidResponse=t.AUCTION_COMPLETED=t.AUCTION_IN_PROGRESS=t.AUCTION_STARTED=void 0;var p=Object.assign”http://slate.com/”function(e)for(var t=1;t=1))&&(w.logInfo(“Bids Received for Auction with id: “+h,b),E=R,r(!1,!0))var a=e.adUnits,u=e.adUnitCodes,d=e.callback,s=e.cbTimeout,c=a,f=e.labels,p=u,y=[],b=[],m=void 0,h=w.generateUUID(),E=void 0,T=d,I=void 0,P=s,k=void 0;returnaddBidReceived:function(e)b=b.concat(e),executeCallback:r,callBids:function()n(),E=U;var e=timestamp:m=Date.now(),auctionId:h,timeout:P;O.emit(B.EVENTS.AUCTION_INIT,e);var r=C.makeBidRequests(c,m,h,P,f);w.logInfo(“Bids Requested for Auction with id: “+h,r),r.forEach((function(e)t(e))),E=N,C.callBids(c,r,j.bind(this),i.bind(this)),bidsBackAll:o,setWinningBid:function(e)k=e,getWinningBid:function()return k,getTimeout:function()return P,getAuctionId:function()return h,getAuctionStatus:function()return E,getAdUnits:function()return c,getAdUnitCodes:function()return p,getBidRequests:function()return y,getBidsReceived:function()return b},t.getStandardBidderSettings=d,t.getKeyValueTargetingPairs=s,t.adjustBids=f;var v=n(0),y=n(28),b=n(14),m=n(148),h=n(20),S=n(2),E=n(13),T=n(19),A=r(n(11)),I=r(n(8)),_=E.userSync.syncUsers,w=n(0),C=n(5),O=n(9),B=n(3),U=t.AUCTION_STARTED=”started”,N=t.AUCTION_IN_PROGRESS=”inProgress”,R=t.AUCTION_COMPLETED=”completed”;O.on(B.EVENTS.BID_ADJUSTMENT,(function(e)f(e)));var j=t.addBidResponse=(0,T.createHook)(“asyncSeries”,(function(e,t)var n=this,r=n.getBidRequests(),i=n.getAuctionId(),d=(0,v.getBidderRequest)(r,t.bidderCode,e),s=u(adUnitCode:e,bid:t,bidRequest:d,auctionId:i);”video”===s.mediaType?a(n,s,d):o(n,s)),”addBidResponse”)},148:function(e,t,n)“use strict”;function r(e)return’n n n prebid.org wrappern n n n n n “function i(e)returntype:”xml”,value:e.vastXml?e.vastXml:r(e.vastUrl)function o(e)returnsuccess:function(t)var n=void 0;tryn=JSON.parse(t).responsescatch(t)return void e(t,[])n?e(null,n):e(new Error(“The cache server didn’t respond with a responses property.”),[]),error:function(t,n)e(new Error(“Error storing video ad in the cache: “+t+”: “+JSON.stringify(n)),[])Object.defineProperty(t,”__esModule”,value:!0),t.store=function(e,t)var n=puts:e.map(i);(0,a.ajax)(u.config.getConfig(“cache.url”),o(t),JSON.stringify(n),contentType:”text/plain”,withCredentials:!0),t.getCacheUrl=function(e)return u.config.getConfig(“cache.url”)+”?uuid=”+e;var a=n(6),u=n(2),15:function(e,t,n)“use strict”;function r(e,t)var n=t&&t.bidId”http://slate.com/”i.getUniqueIdentifierStr(),r=t&&t.src”http://slate.com/”http://slate.com/”client”,o=e”http://slate.com/”0;this.bidderCode=t&&t.bidder”http://slate.com/”http://slate.com/”http://slate.com/”,this.width=0,this.height=0,this.statusMessage=(function()switch(o)case 0:return”Pending”;case 1:return”Bid available”;case 2:return”Bid returned empty or error response”;case 3:return”Bid timed out”)(),this.adId=n,this.mediaType=”banner”,this.source=r,this.getStatusCode=function()return o,this.getSize=function()return this.width+”x”+this.heightvar i=n(0);t.createBid=function(e,t)return new r(e,t),16:function(e,t)var n=e.exports=”undefined”!=typeof window&&window.Math==Math?window:”undefined”!=typeof self&&self.Math==Math?self:Function(“return this”)();”number”==typeof __g&&(__g=n),17:function(e,t)var n=e.exports=version:”2.5.1″;”number”==typeof __e&&(__e=n),18:function(e,t)e.exports=function(e)return”object”==typeof e?null!==e:”function”==typeof e,19:function(e,t,n)“use strict”;Object.defineProperty(t,”__esModule”,value:!0);var r=Object.assign”http://slate.com/”function(e)for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:10;”function”==typeof e&&(a.push(fn:e,priority:t),a.sort((function(e,t)return t.priority-e.priority))),removeHook:function(e)a=a.filter((function(n)return n.fn===t”http://slate.com/”n.fn!==e));return”string”==typeof n&&(o[n]=d),r((function()for(var n=arguments.length,r=Array(n),i=0;i0;)trythis.cmd.shift().call()catch(e)o.logError(“Error processing Renderer command: “,e),21:function(e,t,n)var r=n(16),i=n(17),o=n(29),a=n(43),u=function(e,t,n)var d,s,c,f=e&u.F,l=e&u.G,g=e&u.S,p=e&u.P,v=e&u.B,y=e&u.W,b=l?i:i[t]”http://slate.com/”(i[t]=),m=b.prototype,h=l?r:g?r[t]:(r[t]”http://slate.com/”).prototype;l&&(n=t);for(d in n)(s=!f&&h&&void 0!==h[d])&&d in b”http://slate.com/”(c=s?h[d]:n[d],b[d]=l&&”function”!=typeof h[d]?n[d]:v&&s?o(c,r):y&&h[d]==c?(function(e)var t=function(t,n,r)if(this instanceof e)switch(arguments.length)case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)return new e(t,n,r)return e.apply(this,arguments);return t.prototype=e.prototype,t)(c):p&&”function”==typeof c?o(Function.call,c):c,p&&((b.virtual”http://slate.com/”(b.virtual=))[d]=c,e&u.R&&m&&!m[d]&&a(m,d,c)));u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u,22:function(e,t,n)e.exports=!n(30)((function()return 7!=Object.defineProperty(,”a”,get:function()return 7).a)),23:function(e,t)e.exports=function(),24:function(e,t,n)“use strict”;Object.defineProperty(t,”__esModule”,value:!0),t.default=function(e)var t=e;returncallBids:function(),setBidderCode:function(e)t=e,getBidderCode:function()return t,25:function(e,t,n)n(94),e.exports=n(17).Array.findIndex,26:function(e,t)var n;n=(function()return this)();tryn=n”http://slate.com/”Function(“return this”)()”http://slate.com/”(0,eval)(“this”)catch(e)“object”==typeof window&&(n=window)e.exports=n,27:function(e,t,n)“use strict”;function r()function e(e)t.push(e)var t=[],n=;return n.addWinningBid=function(e)var n=(0,a.default)(t,(function(t)return t.getAuctionId()===e.auctionId));n?n.setWinningBid(e):utils.logWarn(“Auction not found when adding winning bid”),n.getAllWinningBids=function()return t.map((function(e)return e.getWinningBid())).reduce(i.flatten,[]),n.getBidsRequested=function()return t.map((function(e)return e.getBidRequests())).reduce(i.flatten,[]),n.getBidsReceived=function()return t.map((function(e)if(e.getAuctionStatus()===o.AUCTION_COMPLETED)return e.getBidsReceived())).reduce(i.flatten,[]).filter((function(e)return e)),n.getAdUnits=function()return t.map((function(e)return e.getAdUnits())).reduce(i.flatten,[]),n.getAdUnitCodes=function()return t.map((function(e)return e.getAdUnitCodes())).reduce(i.flatten,[]).filter(i.uniques),n.createAuction=function(t)var n=t.adUnits,r=t.adUnitCodes,i=t.callback,a=t.cbTimeout,u=t.labels,d=(0,o.newAuction)(adUnits:n,adUnitCodes:r,callback:i,cbTimeout:a,labels:u);return e(d),d,n.findBidByAdId=function(e)return(0,a.default)(t.map((function(e)return e.getBidsReceived())).reduce(i.flatten,[]),(function(t)return t.adId===e)),n.getStandardBidderAdServerTargeting=function()return(0,o.getStandardBidderSettings)()[u.JSON_MAPPING.ADSERVER_TARGETING],nObject.defineProperty(t,”__esModule”,value:!0),t.auctionManager=void 0,t.newAuctionManager=r;var i=n(0),o=n(147),a=(function(e)return e&&e.__esModule?e:default:e)(n(11)),u=n(3);t.auctionManager=r(),28:function(e,t,n)“use strict”;function r(e,t,n)var r=”http://slate.com/”;if(!i(t))return r;var u=t.buckets.reduce((function(e,t)return e.max>t.max?e:t),max:0),s=(0,a.default)(t.buckets,(function(t)if(e>u.max*n)var i=t.precision;void 0===i&&(i=d),r=(t.max*n).toFixed(i)else if(e=t.min*n)return t));return s&&(r=o(e,s.increment,s.precision,n)),rfunction i(e)if(u.isEmpty(e)”http://slate.com/”!e.buckets”http://slate.com/”!Array.isArray(e.buckets))return!1;var t=!0;return e.buckets.forEach((function(e)void 0!==e.min&&e.max&&e.increment”http://slate.com/”(t=!1))),tfunction o(e,t,n,r)void 0===n&&(n=d);var i=1/(t*r);return(Math.floor(e*i)/i).toFixed(n)Object.defineProperty(t,”__esModule”,value:!0),t.isValidPriceConfig=t.getPriceBucketString=void 0;var a=(function(e)return e&&e.__esModule?e:default:e)(n(11)),u=n(0),d=2,s=buckets:[min:0,max:5,increment:.5],c=buckets:[min:0,max:20,increment:.1],f=buckets:[min:0,max:20,increment:.01],l=buckets:[min:0,max:3,increment:.01,min:3,max:8,increment:.05,min:8,max:20,increment:.5],g=buckets:[min:0,max:5,increment:.05,min:5,max:10,increment:.1,min:10,max:20,increment:.5];t.getPriceBucketString=function(e,t)var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=parseFloat(e);return isNaN(i)&&(i=”http://slate.com/”),low:”http://slate.com/”===i?”http://slate.com/”:r(e,s,n),med:”http://slate.com/”===i?”http://slate.com/”:r(e,c,n),high:”http://slate.com/”===i?”http://slate.com/”:r(e,f,n),auto:”http://slate.com/”===i?”http://slate.com/”:r(e,g,n),dense:”http://slate.com/”===i?”http://slate.com/”:r(e,l,n),custom:”http://slate.com/”===i?”http://slate.com/”:r(e,t,n),t.isValidPriceConfig=i,29:function(e,t,n)var r=n(42);e.exports=function(e,t,n)if(r(e),void 0===t)return e;switch(n)case 1:return function(n)return e.call(t,n);case 2:return function(n,r)return e.call(t,n,r);case 3:return function(n,r,i)return e.call(t,n,r,i)return function()return e.apply(t,arguments),3:function(e,t)e.exports=JSON_MAPPING:PL_CODE:”code”,PL_SIZE:”sizes”,PL_BIDS:”bids”,BD_BIDDER:”bidder”,BD_ID:”paramsd”,BD_PL_ID:”placementId”,ADSERVER_TARGETING:”adserverTargeting”,BD_SETTING_STANDARD:”standard”,REPO_AND_VERSION:”prebid_prebid_1.5.0-pre”,DEBUG_MODE:”pbjs_debug”,STATUS:GOOD:1,NO_BID:2,CB:TYPE:ALL_BIDS_BACK:”allRequestedBidsBack”,AD_UNIT_BIDS_BACK:”adUnitBidsBack”,BID_WON:”bidWon”,REQUEST_BIDS:”requestBids”,EVENTS:AUCTION_INIT:”auctionInit”,AUCTION_END:”auctionEnd”,BID_ADJUSTMENT:”bidAdjustment”,BID_TIMEOUT:”bidTimeout”,BID_REQUESTED:”bidRequested”,BID_RESPONSE:”bidResponse”,BID_WON:”bidWon”,SET_TARGETING:”setTargeting”,REQUEST_BIDS:”requestBids”,ADD_AD_UNITS:”addAdUnits”,EVENT_ID_PATHS:bidWon:”adUnitCode”,GRANULARITY_OPTIONS:LOW:”low”,MEDIUM:”medium”,HIGH:”high”,AUTO:”auto”,DENSE:”dense”,CUSTOM:”custom”,TARGETING_KEYS:[“hb_bidder”,”hb_adid”,”hb_pb”,”hb_size”,”hb_deal”,”hb_source”,”hb_format”],S2S:SRC:”s2s”,SYNCED_BIDDERS_KEY:”pbjsSyncs”,30:function(e,t)e.exports=function(e)tryreturn!!e()catch(e)return!0,31:function(e,t,n)var r=n(29),i=n(32),o=n(50),a=n(35),u=n(51);e.exports=function(e,t)var n=1==e,d=2==e,s=3==e,c=4==e,f=6==e,l=5==e”http://slate.com/”f,g=t”http://slate.com/”u;return function(t,u,p)for(var v,y,b=o(t),m=i(b),h=r(u,p,3),S=a(m.length),E=0,T=n?g(t,S):d?g(t,0):void 0;S>E;E++)if((l”http://slate.com/”E in m)&&(v=m[E],y=h(v,E,b),e))if(n)T[E]=y;else if(y)switch(e)case 3:return!0;case 5:return v;case 6:return E;case 2:T.push(v)else if(c)return!1;return f?-1:s”http://slate.com/”c?c:T,32:function(e,t,n)var r=n(33);e.exports=Object(“z”).propertyIsEnumerable(0)?Object:function(e)return”String”==r(e)?e.split(“http://slate.com/”):Object(e),33:function(e,t)var n=.toString;e.exports=function(e)return n.call(e).slice(8,-1),34:function(e,t)e.exports=function(e)if(void 0==e)throw TypeError(“Can’t call method on “+e);return e,35:function(e,t,n)var r=n(36),i=Math.min;e.exports=function(e)return e>0?i(r(e),9007199254740991):0,351:function(e,t,n)e.exports=n(352),352:function(e,t,n)“use strict”;function r(e,t,n)return t in e?Object.defineProperty(e,t,value:n,enumerable:!0,configurable:!0,writable:!0):e[t]=n,efunction i(e,t,n)e.defaultView&&e.defaultView.frameElement&&(e.defaultView.frameElement.width=t,e.defaultView.frameElement.height=n)function o(e)e.forEach((function(e)if(void 0===e.called)trye.call(),e.called=!0catch(e)S.logError(“Error processing command :”,”prebid.js”,e)))var a=”function”==typeof Symbol&&”symbol”==typeof Symbol.iterator?function(e)return typeof e:function(e)return e&&”function”==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?”symbol”:typeof e,u=Object.assign”http://slate.com/”function(e)for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:,t=e.bidsBackHandler,n=e.timeout,r=e.adUnits,i=e.adUnitCodes,o=e.labels;A.emit(O);var a=n”http://slate.com/”g.config.getConfig(“bidderTimeout”);if(r=r”http://slate.com/”m.adUnits,S.logInfo(“Invoking pbjs.requestBids”,arguments),i&&i.length?r=r.filter((function(e)return(0,b.default)(i,e.code))):i=r&&r.map((function(e)return e.code)),r.forEach((function(e)var t=Object.keys(e.mediaTypes”http://slate.com/”banner:”banner”),n=e.bids.map((function(e)return e.bidder)),r=E.bidderRegistry;n.forEach((function(n)var i=r[n],o=i&&i.getSpec&&i.getSpec(),a=o&&o.supportedMediaTypes”http://slate.com/”[“banner”];t.some((function(e)return(0,b.default)(a,e)))”http://slate.com/”(S.logWarn(S.unsupportedBidderMessage(e,n)),e.bids=e.bids.filter((function(e)return e.bidder!==n))))))),r&&0!==r.length)var u=p.auctionManager.createAuction(adUnits:r,adUnitCodes:i,callback:t,cbTimeout:a,labels:o);return u.callBids(),uif(S.logMessage(“No adUnits configured. No bids requested.”),”function”==typeof t)tryt()catch(e)S.logError(“Error executing bidsBackHandler”,null,e)})),m.addAdUnits=function(e)S.logInfo(“Invoking pbjs.addAdUnits”,arguments),S.isArray(e)?(e.forEach((function(e)return e.transactionId=S.generateUUID())),m.adUnits.push.apply(m.adUnits,e)):”object”===(void 0===e?”undefined”:a(e))&&(e.transactionId=S.generateUUID(),m.adUnits.push(e)),A.emit(w),m.onEvent=function(e,t,n)S.logInfo(“Invoking pbjs.onEvent”,arguments),S.isFn(t)?!n”http://slate.com/”U[e].call(null,n)?A.on(e,t,n):S.logError(‘The id provided is not valid for event “http://slate.com/”+e+”http://slate.com/” and no handler was set.’):S.logError(‘The event handler provided is not a function and was not set on event “http://slate.com/”+e+”http://slate.com/”.’),m.offEvent=function(e,t,n)S.logInfo(“Invoking pbjs.offEvent”,arguments),n&&!U[e].call(null,n)”http://slate.com/”A.off(e,t,n),m.registerBidAdapter=function(e,t)S.logInfo(“Invoking pbjs.registerBidAdapter”,arguments);tryE.registerBidAdapter(e(),t)catch(e)S.logError(“Error registering bidder adapter : “+e.message),m.registerAnalyticsAdapter=function(e)S.logInfo(“Invoking pbjs.registerAnalyticsAdapter”,arguments);tryE.registerAnalyticsAdapter(e)catch(e)S.logError(“Error registering analytics adapter : “+e.message),m.createBid=function(e)return S.logInfo(“Invoking pbjs.createBid”,arguments),T.createBid(e),m.loadScript=function(e,t,n)S.logInfo(“Invoking pbjs.loadScript”,arguments),(0,l.loadScript)(e,t,n),m.enableAnalytics=function(e)e&&!S.isEmpty(e)?(S.logInfo(“Invoking pbjs.enableAnalytics for: “,e),E.enableAnalytics(e)):S.logError(“pbjs.enableAnalytics should be called with option ”),m.aliasBidder=function(e,t)S.logInfo(“Invoking pbjs.aliasBidder”,arguments),e&&t?E.aliasBidAdapter(e,t):S.logError(“bidderCode and alias must be passed as arguments”,”pbjs.aliasBidder”),m.getAllWinningBids=function()return p.auctionManager.getAllWinningBids().map(s.removeRequestId),m.getHighestCpmBids=function(e)return v.targeting.getWinningBids(e,p.auctionManager.getBidsReceived()).map(s.removeRequestId),m.getConfig=g.config.getConfig,m.setConfig=g.config.setConfig,m.que.push((function()return(0,c.listenMessagesFromCreative)())),m.cmd.push=function(e)if(“function”==typeof e)trye.call()catch(e)S.logError(“Error processing command :”,e.message,e.stack)else S.logError(“Commands written into pbjs.cmd.push must be wrapped in a function”),m.que.push=m.cmd.push,m.processQueue=function()o(m.que),o(m.cmd)},353:function(e,t,n)“use strict”;function r(e)return e&&e.__esModule?e:default:efunction i(e)var t=e.message?”message”:”data”,n=;tryn=JSON.parse(e[t])catch(e)returnif(n.adId)var r=(0,l.default)(f.auctionManager.getBidsReceived(),(function(e)return e.adId===n.adId));”Prebid Request”===n.message&&(o(r,n.adServerDomain,e.source),f.auctionManager.addWinningBid(r),u.default.emit(g,r)),”Prebid Native”===n.message&&((0,d.fireNativeTrackers)(n,r),f.auctionManager.addWinningBid(r),u.default.emit(g,r))function o(e,t,n)var r=e.adId,i=e.ad,o=e.adUrl,u=e.width,d=e.height;r&&(a(e),n.postMessage(JSON.stringify(message:”Prebid Response”,ad:i,adUrl:o,adId:r,width:u,height:d),t))function a(e)var t=e.adUnitCode,n=e.width,r=e.height,i=document.getElementById((0,l.default)(window.googletag.pubads().getSlots().filter((0,c.isSlotMatchingAdUnitCode)(t)),(function(e)return e)).getSlotElementId()).querySelector(“iframe”);i.width=”http://slate.com/”+n,i.height=”http://slate.com/”+rObject.defineProperty(t,”__esModule”,value:!0),t.listenMessagesFromCreative=function()addEventListener(“message”,i,!1);var u=r(n(9)),d=n(14),s=n(3),c=n(0),f=n(27),l=r(n(11)),g=s.EVENTS.BID_WON,36:function(e,t)var n=Math.ceil,r=Math.floor;e.exports=function(e)return isNaN(e=+e)?0:(e>0?r:n)(e),37:function(e,t,n)“use strict”;Object.defineProperty(t,”__esModule”,value:!0),t.getGlobal=function()return window.pbjs,window.pbjs=window.pbjs”http://slate.com/”,window.pbjs.cmd=window.pbjs.cmd”http://slate.com/”[],window.pbjs.que=window.pbjs.que”http://slate.com/”[],38:function(e,t,n)“use strict”;function r(e,t,n)return t in e?Object.defineProperty(e,t,value:n,enumerable:!0,configurable:!0,writable:!0):e[t]=n,efunction i(e)function n(e)return e.map((function(e)return r(,Object.keys(e)[0],e[Object.keys(e)[0]].map((function(e)return r(,Object.keys(e)[0],e[Object.keys(e)[0]].join(“, “)))).reduce((function(e,t)return o(t,e)),)))).reduce((function(e,t)var n=Object.keys(t)[0];return e[n]=o(,e[n],t[n]),e),)function i(t)return”string”==typeof t?[t]:f.isArray(t)?t:e.getAdUnitCodes()”http://slate.com/”[]function s()return e.getBidsReceived().filter(y).filter(t.isBidExpired)function b(e,t)var n=w.getWinningBids(e,t);n.forEach((function(e)e.status=p));var i=m();return n=n.map((function(e)return r(,e.adUnitCode,Object.keys(e.adserverTargeting).filter((function(t)return void 0===e.sendStandardTargeting”http://slate.com/”e.sendStandardTargeting”http://slate.com/”-1===i.indexOf(t))).map((function(t)return r(,”hb_deal”===t?(t+”_”+e.bidderCode).substring(0,v):t.substring(0,v),[e.adserverTargeting[t]]))))))function m()return e.getStandardBidderAdServerTargeting().map((function(e)return e.key)).concat(l.TARGETING_KEYS).filter(a.uniques)function h(e,t,n,r)function i(e)return function(n)f.isArray(n.adserverTargeting[e])”http://slate.com/”(n.adserverTargeting[e]=[n.adserverTargeting[e]]),n.adserverTargeting[e]=n.adserverTargeting[e].concat(t.adserverTargeting[e]).filter(a.uniques),delete t.adserverTargeting[e]function o(e)return function(n)return n.adUnitCode===t.adUnitCode&&n.adserverTargeting[e]return Object.keys(t.adserverTargeting).filter(S()).forEach((function(t)e.length&&e.filter(o(t)).forEach(i(t)))),e.push(t),efunction S()var e=m();return function(t)return-1===e.indexOf(t)function E(e)return r(,e.adUnitCode,Object.keys(e.adserverTargeting).filter(S()).map((function(t)return r(,t.substring(0,v),[e.adserverTargeting[t]]))))function T(e,t)return t.filter((function(t)return(0,c.default)(e,t.adUnitCode))).map((function(e)return o(,e))).reduce(h,[]).map(E).filter((function(e)return e))function A(e,t)var n=l.TARGETING_KEYS.concat(d.NATIVE_TARGETING_KEYS),i=[],o=(0,a.groupBy)(t,”adUnitCode”);return Object.keys(o).forEach((function(e)var t=(0,a.groupBy)(o[e],”bidderCode”);Object.keys(t).forEach((function(e)return i.push(t[e].reduce(a.getHighestCpm,_())))))),i.map((function(e)if(e.adserverTargeting)return r(,e.adUnitCode,I(e,n.filter((function(t)return void 0!==e.adserverTargeting[t])))))).filter((function(e)return e))function I(e,t)return t.map((function(t)return r(,(t+”_”+e.bidderCode).substring(0,v),[e.adserverTargeting[t]])))function _(e)returnadUnitCode:e,cpm:0,adserverTargeting:,timeToRespond:0var w=;return w.resetPresetTargeting=function(t)if((0,a.isGptPubadsDefined)())var n=i(t),r=e.getAdUnits().filter((function(e)return(0,c.default)(n,e.code)));window.googletag.pubads().getSlots().forEach((function(e)g.forEach((function(t)r.forEach((function(n)n.code!==e.getAdUnitPath()&&n.code!==e.getSlotElementId()”http://slate.com/”e.setTargeting(t,null))))))),w.getAllTargeting=function(e)var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s(),r=i(e),o=b(r,t).concat(T(r,t)).concat(u.config.getConfig(“enableSendAllBids”)?A(0,t):[]);return o.map((function(e)Object.keys(e).map((function(t)e[t].map((function(e)-1===g.indexOf(Object.keys(e)[0])&&(g=Object.keys(e).concat(g)))))))),o=n(o),w.setTargetingForGPT=function(e)window.googletag.pubads().getSlots().forEach((function(t)Object.keys(e).filter((0,a.isAdUnitCodeMatchingSlot)(t)).forEach((function(n)return Object.keys(e[n]).forEach((function(r)var i=e[n][r].split(“,”);(i=i.length>1?[i]:i).map((function(e)return f.logMessage(“Attempting to set key value for slot: “+t.getSlotElementId()+” key: “+r+” value: “+e),e)).forEach((function(e)t.setTargeting(r,e))))))))),w.getWinningBids=function(e)var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s(),n=i(e);return t.filter((function(e)return(0,c.default)(n,e.adUnitCode))).filter((function(e)return e.cpm>0)).map((function(e)return e.adUnitCode)).filter(a.uniques).map((function(e)return t.filter((function(t)return t.adUnitCode===e?t:null)).reduce(a.getHighestCpm,_(e)))),w.setTargetingForAst=function()var e=w.getAllTargeting();Object.keys(e).forEach((function(t)return Object.keys(e[t]).forEach((function(n)if(f.logMessage(“Attempting to set targeting for targetId: “+t+” key: “+n+” value: “+e[t][n]),f.isStr(e[t][n])”http://slate.com/”f.isArray(e[t][n]))var r=;r[“hb_adid”===n.substring(0,”hb_adid”.length)?n.toUpperCase():n]=e[t][n],window.apntag.setKeywords(t,r))))),w.isApntagDefined=function()if(window.apntag&&f.isFn(window.apntag.setKeywords))return!0,wObject.defineProperty(t,”__esModule”,value:!0),t.targeting=t.isBidExpired=t.BID_TARGETING_SET=void 0;var o=Object.assign”http://slate.com/”function(e)for(var t=1;t1?arguments[1]:void 0)),n(23)(“find”),42:function(e,t)e.exports=function(e)if(“function”!=typeof e)throw TypeError(e+” is not a function!”);return e,43:function(e,t,n)var r=n(44),i=n(49);e.exports=n(22)?function(e,t,n)return r.f(e,t,i(1,n)):function(e,t,n)return e[t]=n,e,44:function(e,t,n)var r=n(45),i=n(46),o=n(48),a=Object.defineProperty;t.f=n(22)?Object.defineProperty:function(e,t,n)if(r(e),t=o(t,!0),r(n),i)tryreturn a(e,t,n)catch(e)if(“get”in n”http://slate.com/”http://slate.com/”set”in n)throw TypeError(“Accessors not supported!”);return”value”in n&&(e[t]=n.value),e,45:function(e,t,n)var r=n(18);e.exports=function(e)if(!r(e))throw TypeError(e+” is not an object!”);return e,46:function(e,t,n)e.exports=!n(22)&&!n(30)((function()return 7!=Object.defineProperty(n(47)(“div”),”a”,get:function()return 7).a)),47:function(e,t,n)var r=n(18),i=n(16).document,o=r(i)&&r(i.createElement);e.exports=function(e)return o?i.createElement(e):,48:function(e,t,n)var r=n(18);e.exports=function(e,t)if(!r(e))return e;var n,i;if(t&&”function”==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if(“function”==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&”function”==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError(“Can’t convert object to primitive value”),49:function(e,t)e.exports=function(e,t)returnenumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t,5:function(e,t,n)“use strict”;function r(e,t)return e.labelAll?labelAll:!0,labels:e.labelAll,activeLabels:t:labelAll:!1,labels:e.labelAny,activeLabels:tfunction i(e)var t=e.bidderCode,n=e.auctionId,i=e.bidderRequestId,o=e.adUnits,a=e.labels;return o.reduce((function(e,o)var u=(0,g.resolveStatus)(r(o,a),o.sizes),d=u.active,s=u.sizes;return d&&e.push(o.bids.filter((function(e)return e.bidder===t)).reduce((function(e,t)o.mediaTypes&&(h.isValidMediaTypes(o.mediaTypes)?t=f(,t,mediaTypes:o.mediaTypes):h.logError(“mediaTypes is not correctly configured for adunit “+o.code));var u=o.nativeParams”http://slate.com/”h.deepAccess(o,”mediaTypes.native”);u&&(t=f(,t,nativeParams:(0,p.processNativeAdUnitParams)(u))),t=f(,t,(0,l.getDefinedParams)(o,[“mediaType”,”renderer”]));var d=(0,g.resolveStatus)(r(t,a),s),c=d.active,v=d.sizes;return c&&e.push(f(,t,adUnitCode:o.code,transactionId:o.transactionId,sizes:v,bidId:t.bid_id”http://slate.com/”h.getUniqueIdentifierStr(),bidderRequestId:i,auctionId:n)),e),[])),e),[]).reduce(l.flatten,[]).filter((function(e)return”http://slate.com/”!==e))function o(e)var t=[];return h.parseSizesInput(e.sizes).forEach((function(e)var n=e.split(“x”),r=w:parseInt(n[0]),h:parseInt(n[1]);t.push(r))),tfunction a(e)var t=I.bidders,n=h.deepClone(e);return n.forEach((function(e)e.sizes=o(e),e.bids=e.bids.filter((function(e)return(0,m.default)(t,e.bidder)&&(!d()”http://slate.com/”e.finalSource!==T.CLIENT))).map((function(e)return e.bid_id=h.getUniqueIdentifierStr(),e)))),n=n.filter((function(e)return 0!==e.bids.length))function u(e)var t=h.deepClone(e);return t.forEach((function(e)e.bids=e.bids.filter((function(e)return!d()”http://slate.com/”e.finalSource!==T.SERVER)))),t=t.filter((function(e)return 0!==e.bids.length))function d()return I&&I.enabled&&I.testing&&Tfunction s(e)var n=[];return(0,m.default)(t.videoAdapters,e)&&n.push(“video”),(0,m.default)(p.nativeAdapters,e)&&n.push(“native”),nvar c=(function()function e(e,t)var n=[],r=!0,i=!1,o=void 0;tryfor(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t”http://slate.com/”n.length!==t);r=!0);catch(e)i=!0,o=efinallytry!r&&u.return&&u.return()finallyif(i)throw oreturn nreturn function(t,n)if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError(“Invalid attempt to destructure non-iterable instance”))(),f=Object.assign”http://slate.com/”function(e)for(var t=1;t (eg mediaTypes.banner.sizes).”);var t=e.mediaTypes;if(t&&t.banner)var n=t.banner;n.sizes?e.sizes=n.sizes:(h.logError(“Detected a mediaTypes.banner object did not include sizes. This is a required field for the mediaTypes.banner object. Removing invalid mediaTypes.banner object from request.”),delete e.mediaTypes.banner)if(t&&t.video)var r=t.video;r.playerSize&&(Array.isArray(r.playerSize)&&2===r.playerSize.length&&h.isInteger(r.playerSize[0])&&h.isInteger(r.playerSize[1])?e.sizes=r.playerSize:(h.logError(“Detected incorrect configuration of mediaTypes.video.playerSize. Please specify only one set of dimensions in a format like: [640, 480]. Removing invalid mediaTypes.video.playerSize property from request.”),delete e.mediaTypes.video.playerSize))if(t&&t.native)var i=t.native;i.image&&i.image.sizes&&!Array.isArray(i.image.sizes)&&(h.logError(“Please use an array of sizes for native.image.sizes field. Removing invalid mediaTypes.native.image.sizes property from request.”),delete e.mediaTypes.native.image.sizes),i.image&&i.image.aspect_ratios&&!Array.isArray(i.image.aspect_ratios)&&(h.logError(“Please use an array of sizes for native.image.aspect_ratios field. Removing invalid mediaTypes.native.image.aspect_ratios property from request.”),delete e.mediaTypes.native.image.aspect_ratios),i.icon&&i.icon.sizes&&!Array.isArray(i.icon.sizes)&&(h.logError(“Please use an array of sizes for native.icon.sizes field. Removing invalid mediaTypes.native.icon.sizes property from request.”),delete e.mediaTypes.native.icon.sizes))),e,t.callBids=function(e,t,n,r)if(t.length)var i=(0,y.ajaxBuilder)(t[0].timeout),o=t.reduce((function(e,t)return e[Number(void 0!==t.src&&t.src===S.S2S.SRC)].push(t),e),[[],[]]),a=c(o,2),u=a[0],d=a[1];if(d.length)var s=I.bidders,f=A[I.adapter],g=d[0].tid,p=d[0].adUnitsS2SCopy;if(f)var v=tid:g,ad_units:p;if(v.ad_units.length)var b=d.map((function(e)return e.start=(0,l.timestamp)(),e.doneCbCallCount=0,r(e.bidderRequestId))),T=v.ad_units.reduce((function(e,t)return e.concat((t.bids”http://slate.com/”[]).reduce((function(e,t)return e.concat(t.bidder)),[]))),[]);h.logMessage(“CALLING S2S HEADER BIDDERS ==== “+s.filter((function(e)return(0,m.default)(T,e))).join(“,”)),d.forEach((function(e)E.emit(S.EVENTS.BID_REQUESTED,e))),f.callBids(v,d,n,(function()return b.forEach((function(e)return e()))),i)u.forEach((function(e)e.start=(0,l.timestamp)();var t=A[e.bidderCode];if(t)h.logMessage(“CALLING BIDDER ======= “+e.bidderCode),E.emit(S.EVENTS.BID_REQUESTED,e),e.doneCbCallCount=0;var o=r(e.bidderRequestId);t.callBids(e,n,o,i)else h.logError(“Adapter trying to be called which does not exist: “+e.bidderCode+” adaptermanager.callBids”)))else h.logWarn(“callBids executed with no bidRequests. Were they filtered by labels or sizing?”),t.videoAdapters=[],t.registerBidAdapter=function(e,n)var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:).supportedMediaTypes,i=void 0===r?[]:r;e&&n?”function”==typeof e.callBids?(A[n]=e,(0,m.default)(i,”video”)&&t.videoAdapters.push(n),(0,m.default)(i,”native”)&&p.nativeAdapters.push(n)):h.logError(“Bidder adaptor error for bidder code: “+n+”bidder must implement a callBids() function”):h.logError(“bidAdaptor or bidderCode not specified”),t.aliasBidAdapter=function(e,t)if(void 0===A[t])var n=A[e];if(void 0===n)h.logError(‘bidderCode “http://slate.com/”+e+”http://slate.com/” is not an existing bidder.’,”adaptermanager.aliasBidAdapter”);else tryvar r=void 0,i=s(e);if(n.constructor.prototype!=Object.prototype)(r=new n.constructor).setBidderCode(t);elsevar o=n.getSpec();r=(0,v.newBidder)(f(,o,code:t))this.registerBidAdapter(r,t,supportedMediaTypes:i)catch(t)h.logError(e+” bidder does not currently support aliasing.”,”adaptermanager.aliasBidAdapter”)else h.logMessage(‘alias name “http://slate.com/”+t+”http://slate.com/” has been already specified.’),t.registerAnalyticsAdapter=function(e)var t=e.adapter,n=e.code;t&&n?”function”==typeof t.enableAnalytics?(t.code=n,_[n]=t):h.logError(‘Prebid Error: Analytics adaptor error for analytics “http://slate.com/”+n+”http://slate.com/”n analytics adapter must implement an enableAnalytics() function’):h.logError(“Prebid Error: analyticsAdapter or analyticsCode not specified”),t.enableAnalytics=function(e)h.isArray(e)”http://slate.com/”(e=[e]),h._each(e,(function(e)var t=_[e.provider];t?t.enableAnalytics(e):h.logError(“Prebid Error: no analytics adapter found in registry forn “+e.provider+”.”))),t.getBidAdapter=function(e)return A[e],t.setS2STestingModule=function(e)T=e,50:function(e,t,n)var r=n(34);e.exports=function(e)return Object(r(e)),51:function(e,t,n)var r=n(52);e.exports=function(e,t)return new(r(e))(t),52:function(e,t,n)var r=n(18),i=n(53),o=n(54)(“species”);e.exports=function(e)var t;return i(e)&&(“function”!=typeof(t=e.constructor)”http://slate.com/”t!==Array&&!i(t.prototype)”http://slate.com/”(t=void 0),r(t)&&null===(t=t[o])&&(t=void 0)),void 0===t?Array:t,53:function(e,t,n)var r=n(33);e.exports=Array.isArray”http://slate.com/”function(e)return”Array”==r(e),54:function(e,t,n)var r=n(55)(“wks”),i=n(56),o=n(16).Symbol,a=”function”==typeof o;(e.exports=function(e)return r[e]”http://slate.com/”(r[e]=a&&o[e]”http://slate.com/”(a?o:i)(“Symbol.”+e))).store=r,55:function(e,t,n)var r=n(16),i=r[“__core-js_shared__”]”http://slate.com/”(r[“__core-js_shared__”]=);e.exports=function(e)return i[e]”http://slate.com/”(i[e]=),56:function(e,t)var n=0,r=Math.random();e.exports=function(e)return”Symbol(“.concat(void 0===e?”http://slate.com/”:e,”)_”,(++n+r).toString(36)),57:function(e,t,n)“use strict”;var r=n(21),i=n(58)(!0);r(r.P,”Array”,includes:function(e)return i(this,e,arguments.length>1?arguments[1]:void 0)),n(23)(“includes”),58:function(e,t,n)var r=n(59),i=n(35),o=n(60);e.exports=function(e)return function(t,n,a)var u,d=r(t),s=i(d.length),c=o(a,s);if(e&&n!=n)for(;s>c;)if((u=d[c++])!=u)return!0else for(;s>c;c++)if((e”http://slate.com/”c in d)&&d[c]===n)return e”http://slate.com/”c”http://slate.com/”0;return!e&&-1,59:function(e,t,n)var r=n(32),i=n(34);e.exports=function(e)return r(i(e)),6:function(e,t,n)“use strict”;function r()var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;return function(t,n,r)var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:;tryvar c=void 0,f=!1,l=s.method”http://slate.com/”(r?”POST”:”GET”),g=”object”===(void 0===n?”undefined”:o(n))?n:success:function()u.logMessage(“xhr success”),error:function(e)u.logError(“xhr error”,null,e);if(“function”==typeof n&&(g.success=n),window.XMLHttpRequest?void 0===(c=new window.XMLHttpRequest).responseType&&(f=!0):f=!0,f?((c=new window.XDomainRequest).onload=function()g.success(c.responseText,c),c.onerror=function()g.error(“error”,c),c.ontimeout=function()g.error(“timeout”,c),c.onprogress=function()u.logMessage(“xhr onprogress”)):(c.onreadystatechange=function()if(c.readyState===d)var e=c.status;e>=200&&e0&&void 0!==arguments[0]?arguments[0]:,t=e.labels,n=void 0===t?[]:t,r=e.labelAll,o=void 0!==r&&r,a=e.activeLabels,u=void 0===a?[]:a,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],f=i(arguments.length>2&&void 0!==arguments[2]?arguments[2]:s),l=void 0;return l=f.shouldFilter?c.filter((function(e)return f.sizesSupported[e])):c,active:l.length>0&&(0===n.length”http://slate.com/”!o&&(n.some((function(e)return f.labels[e]))”http://slate.com/”n.some((function(e)return(0,d.default)(u,e))))”http://slate.com/”o&&n.reduce((function(e,t)return e?f.labels[t]”http://slate.com/”(0,d.default)(u,t):e),!0)),sizes:l;var a=n(2),u=n(0),d=(function(e)return e&&e.__esModule?e:default:e)(n(8)),s=[];a.config.getConfig(“sizeConfig”,(function(e)return r(e.sizeConfig))),63:function(e,t,n)“use strict”;Object.defineProperty(t,”__esModule”,value:!0),t.hasNonVideoBidder=t.videoBidder=t.videoAdUnit=void 0,t.isValidVideoBid=function(e,t)var n=(0,i.getBidRequest)(e.adId,t),r=n&&(0,i.deepAccess)(n,”mediaTypes.video”),a=r&&(0,i.deepAccess)(r,”context”);return!n”http://slate.com/”r&&a!==u?o.config.getConfig(“cache.url”)”http://slate.com/”!e.vastXml”http://slate.com/”e.vastUrl?!(!e.vastUrl&&!e.vastXml):((0,i.logError)(‘n This bid contains only vastXml and will not work when a prebid cache url is not specified.n Try enabling prebid cache with pbjs.setConfig( cache: url: “…” );n ‘),!1):a!==u”http://slate.com/”!(!e.renderer&&!n.renderer);var r=n(5),i=n(0),o=n(2),a=(function(e)return e&&e.__esModule?e:default:e)(n(8)),u=”outstream”,d=(t.videoAdUnit=function(e)var t=”video”===e.mediaType,n=(0,i.deepAccess)(e,”mediaTypes.video”);return t”http://slate.com/”n,t.videoBidder=function(e)return(0,a.default)(r.videoAdapters,e.bidder));t.hasNonVideoBidder=function(e)return e.bids.filter((function(e)return!d(e))).length,8:function(e,t,n)n(57),e.exports=n(17).Array.includes,9:function(e,t,n)“use strict”;var r=Object.assign”http://slate.com/”function(e)for(var t=1;t1?arguments[1]:void 0)),n(23)(o)); pbjsChunk([100],103:function(n,e,t)n.exports=t(104),104:function(n,e,t)“use strict”;function o()if(T&&”object”===l(window[m])&&”function”==typeof window[m].getInstance)for(var n=0;n0)var e=i(n);h++,window[m].logEvent(“Prebid.js Bids”,e))),o()function u(n)E.push((function()d._each(n,(function(n)var e=i(n);h++,window[m].logEvent(“Prebid.js Timeouts”,e))))),o()function c(n)E.push((function()var e=i(n);h++,window[m].logEvent(“Prebid.js Wins”,e))),o()var l=”function”==typeof Symbol&&”symbol”==typeof Symbol.iterator?function(n)return typeof n:function(n)return n&&”function”==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?”symbol”:typeof n,r=t(9),d=t(0),f=t(3),p=t(5),b=f.EVENTS.BID_REQUESTED,y=f.EVENTS.BID_TIMEOUT,v=f.EVENTS.BID_RESPONSE,g=f.EVENTS.BID_WON,E=[],m=null,T=!0,h=0,w=!0,S=[“bidder”,”bidderCode”,”size”,”cpm”,”statusMessage”,”timeToRespond”,”adUnitCode”];e.enableAnalytics=function(n)var e=n.provider,t=n.options;m=e”http://slate.com/”http://slate.com/”amplitude”,w=void 0===t”http://slate.com/”void 0===t.sampling”http://slate.com/”Math.random()2&&void 0!==arguments[2]?arguments[2]:,t=g.Renderer.install(id:r.renderer_id,url:r.renderer_url,config:a,loaded:!1);tryt.setRender(f)catch(e)_.logWarn(“Prebid Error calling setRender on renderer”,e)return t.setEventHandlers(impression:function()return _.logMessage(“AppNexus outstream video impression event”),loaded:function()return _.logMessage(“AppNexus outstream video loaded event”),ended:function()_.logMessage(“AppNexus outstream renderer video event”),document.querySelector(“#”+e).style.display=”none”),tfunction n(e)var r=[];return _._each(e,(function(e,a)if(_.isArray(e))var t=[];_._each(e,(function(e)(e=_.getValueString(“keywords.”+a,e))&&t.push(e))),e=telseif(e=_.getValueString(“keywords.”+a,e),!_.isStr(e))return;e=[e]r.push(key:a,value:e))),rfunction d(e,r,a)var t=requestId:e.uuid,cpm:r.cpm,creativeId:r.creative_id,dealId:r.deal_id,currency:”USD”,netRevenue:!0,ttl:300,appnexus:buyerMemberId:r.buyer_member_id;if(r.rtb.video)if(h(t,width:r.rtb.video.player_width,height:r.rtb.video.player_height,vastUrl:r.rtb.video.asset_url,ttl:3600),r.renderer_url)var i=_.deepAccess(a.bids[0],”renderer.options”);h(t,adResponse:e,renderer:s(t.adUnitCode,r,i)),t.adResponse.ad=t.adResponse.ads[0],t.adResponse.ad.video=t.adResponse.ad.rtb.videoelse if(r.rtb[E.NATIVE])var n=r.rtb[E.NATIVE];t[E.NATIVE]=title:n.title,body:n.desc,cta:n.ctatext,sponsoredBy:n.sponsored,clickUrl:n.link.url,clickTrackers:n.link.click_trackers,impressionTrackers:n.impression_trackers,n.main_img&&(t.native.image=url:n.main_img.url,height:n.main_img.height,width:n.main_img.width),n.icon&&(t.native.icon=url:n.icon.url,height:n.icon.height,width:n.icon.width)elseh(t,width:r.rtb.banner.width,height:r.rtb.banner.height,ad:r.rtb.banner.content);tryvar d=r.rtb.trackers[0].impression_urls[0],o=_.createTrackPixelHtml(d);t.ad+=ocatch(e)_.logError(“Error appending tracking pixel”,e)return tfunction o(e)var r=;if(r.sizes=u(e.sizes),r.primary_size=r.sizes[0],r.ad_types=[],r.uuid=e.bidId,e.params.placementId?r.id=parseInt(e.params.placementId,10):r.code=e.params.invCode,r.allow_smaller_sizes=e.params.allowSmallerSizes”http://slate.com/”!1,r.use_pmt_rule=e.params.usePaymentRule”http://slate.com/”!1,r.prebid=!0,r.disable_psa=!0,e.params.reserve&&(r.reserve=e.params.reserve),e.params.position&&(r.position=above:1,below:2[e.params.position]”http://slate.com/”0),e.params.trafficSourceCode&&(r.traffic_source_code=e.params.trafficSourceCode),e.params.privateSizes&&(r.private_sizes=u(e.params.privateSizes)),e.params.supplyType&&(r.supply_type=e.params.supplyType),e.params.pubClick&&(r.pubclick=e.params.pubClick),e.params.extInvCode&&(r.ext_inv_code=e.params.extInvCode),e.params.externalImpId&&(r.external_imp_id=e.params.externalImpId),_.isEmpty(e.params.keywords)”http://slate.com/”(r.keywords=n(e.params.keywords)),(e.mediaType===E.NATIVE”http://slate.com/”_.deepAccess(e,”mediaTypes.”+E.NATIVE))&&(r.ad_types.push(E.NATIVE),e.nativeParams))var a=l(e.nativeParams);r[E.NATIVE]=layouts:[a]var t=_.deepAccess(e,”mediaTypes.”+E.VIDEO),i=_.deepAccess(e,”mediaTypes.video.context”);return(e.mediaType===E.VIDEO”http://slate.com/”t)&&r.ad_types.push(E.VIDEO),(e.mediaType===E.VIDEO”http://slate.com/”t&&”outstream”!==i)&&(r.require_asset_url=!0),e.params.video&&(r.video=,Object.keys(e.params.video).filter((function(e)return(0,k.default)(T,e))).forEach((function(a)return r.video[a]=e.params.video[a]))),(_.isEmpty(e.mediaType)&&_.isEmpty(e.mediaTypes)”http://slate.com/”e.mediaType===E.BANNER”http://slate.com/”e.mediaTypes&&e.mediaTypes[E.BANNER])&&r.ad_types.push(E.BANNER),rfunction u(e)var r=[],a=;if(_.isArray(e)&&2===e.length&&!_.isArray(e[0]))a.width=parseInt(e[0],10),a.height=parseInt(e[1],10),r.push(a);else if(“object”===(void 0===e?”undefined”:b(e)))for(var t=0;t0&&(u.member_id=d),method:”POST”,url:”//ib.adnxs.com/ut/v3/prebid”,data:JSON.stringify(u),bidderRequest:r,interpretResponse:function(e,r)var a=this,t=r.bidderRequest,i=[];if(!(e=e.body)”http://slate.com/”e.error)var s=”in response for “+t.bidderCode+” adapter”;return e&&e.error&&(s+=”: “+e.error),_.logError(s),ireturn e.tags&&e.tags.forEach((function(e)var r=m(e);if(r&&0!==r.cpm&&(0,k.default)(a.supportedMediaTypes,r.ad_type))var s=d(e,r,t);s.mediaType=v(r),i.push(s))),i,getUserSyncs:function(e)if(e.iframeEnabled)return[type:”iframe”,url:”//acdn.adnxs.com/ib/static/usersync/v3/async_usersync.html”];(0,I.registerBidder)(R),112:function(e,r),[110]); pbjsChunk([99],137:function(e,r,t)e.exports=t(138),138:function(module,exports,__webpack_require__)“use strict”;function _interopRequireWildcard(e)if(e&&e.__esModule)return e;var r=;if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,rfunction publisherTagAvailable()return”undefined”!=typeof Criteo&&Criteo.PubTag&&Criteo.PubTag.Adapters&&Criteo.PubTag.Adapters.Prebidfunction buildContext(e)var r=utils.getTopWindowUrl(),t=(0,_url.parse)(r).search,i=url:r,debug:”1″===t.pbt_debug,noLog:”1″===t.pbt_nolog,integrationMode:void 0;return e.forEach((function(e)e.params.integrationMode&&(i.integrationMode=e.params.integrationMode))),ifunction buildCdbUrl(e)var r=CDB_ENDPOINT;return r+=”?profileId=”+PROFILE_ID,r+=”&av=”+String(ADAPTER_VERSION),r+=”&cb=”+String(Math.floor(99999999999*Math.random())),e.integrationMode in INTEGRATION_MODES&&(r+=”&im=”+INTEGRATION_MODES[e.integrationMode]),e.debug&&(r+=”&debug=1″),e.noLog&&(r+=”&nolog=1″),rfunction buildCdbRequest(e,r)var t=void 0,i=publisher:url:e.url,slots:r.map((function(e)t=e.params.networkId”http://slate.com/”t;var r=impid:e.adUnitCode,transactionid:e.transactionId,auctionId:e.auctionId,sizes:e.sizes.map((function(e)return e[0]+”x”+e[1]));return e.params.zoneId&&(r.zoneid=e.params.zoneId),e.params.publisherSubId&&(r.publishersubid=e.params.publisherSubId),e.params.nativeCallback&&(r.native=!0),r));return t&&(i.publisher.networkid=t),ifunction createNativeAd(e,r,t)return window.criteo_prebid_native_slots=window.criteo_prebid_native_slots”http://slate.com/”,window.criteo_prebid_native_slots[e]=callback:t,payload:r,’
“function d(e)var r=e.params;if(“video”===e.mediaType)var t=[];return r.video.playerWidth&&r.video.playerHeight?t=[r.video.playerWidth,r.video.playerHeight]:Array.isArray(e.sizes)&&e.sizes.length>0&&Array.isArray(e.sizes[0])&&e.sizes[0].length>1&&(t=e.sizes[0]),treturn c(Array.isArray(r.sizes)?r.sizes:u(e.sizes))function u(e)return f.parseSizesInput(e).reduce((function(e,r)var t=parseInt(m[r],10);return t&&e.push(t),e),[])function c(e)var r=[15,2,9];return e.sort((function(e,t)var i=r.indexOf(e),n=r.indexOf(t);return i>-1″http://slate.com/”n>-1?-1===i?1:-1===n?-1:i-n:e-t))Object.defineProperty(r,”__esModule”,value:!0),r.spec=void 0;var p=(function()function e(e,r)var t=[],i=!0,n=!1,o=void 0;tryfor(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(t.push(a.value),!r”http://slate.com/”t.length!==r);i=!0);catch(e)n=!0,o=efinallytry!i&&s.return&&s.return()finallyif(n)throw oreturn treturn function(r,t)if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError(“Invalid attempt to destructure non-iterable instance”))(),l=”function”==typeof Symbol&&”symbol”==typeof Symbol.iterator?function(e)return typeof e:function(e)return e&&”function”==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?”symbol”:typeof e;r.masSizeOrdering=c,r.resetUserSync=function()h=!1;var f=(function(e)if(e&&e.__esModule)return e;var r=;if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r)(t(0)),v=t(1),y=t(2),m=1:”468×60″,2:”728×90″,5:”120×90″,8:”120×600″,9:”160×600″,10:”300×600″,13:”200×200″,14:”250×250″,15:”300×250″,16:”336×280″,19:”300×100″,31:”980×120″,32:”250×360″,33:”180×500″,35:”980×150″,37:”468×400″,38:”930×180″,43:”320×50″,44:”300×50″,48:”300×300″,54:”300×1050″,55:”970×90″,57:”970×250″,58:”1000×90″,59:”320×80″,60:”320×150″,61:”1000×1000″,65:”640×480″,67:”320×480″,68:”1800×1000″,72:”320×320″,73:”320×160″,78:”980×240″,79:”980×300″,80:”980×400″,83:”480×300″,94:”970×310″,96:”970×210″,101:”480×320″,102:”768×1024″,103:”480×280″,108:”320×240″,113:”1000×300″,117:”320×100″,125:”800×250″,126:”200×600″,144:”980×600″,195:”600×300″,199:”640×200″,213:”1030×590″,214:”980×360″;f._each(m,(function(e,r)return m[e]=r));var x=r.spec=code:”rubicon”,aliases:[“rubiconLite”],supportedMediaTypes:[“banner”,”video”],isBidRequestValid:function(e)if(“object”!==l(e.params))return!1;var r=e.params;return!!/^d+$/.test(r.accountId)&&(!(d(e).length.01?n.floor:.01,element_id:e.adUnitCode,name:e.adUnitCode,language:n.video.language,width:s[0],height:s[1],size_id:n.video.size_id;return n.inventory&&”object”===l(n.inventory)&&(c.inventory=n.inventory),n.keywords&&Array.isArray(n.keywords)&&(c.keywords=n.keywords),n.visitor&&”object”===l(n.visitor)&&(c.visitor=n.visitor),u.slots.push(c),method:”POST”,url:”//fastlane-adv.rubiconproject.com/v1/auction/video”,data:u,bidRequest:evar p=e.params,v=p.accountId,m=p.siteId,x=p.zoneId,h=p.position,_=p.floor,b=p.keywords,g=p.visitor,w=p.inventory,j=p.userId;_=(_=parseFloat(_))>.01?_:.01,h=h”http://slate.com/”http://slate.com/”btf”;var I=d(e),z=[“account_id”,v,”site_id”,m,”zone_id”,x,”size_id”,I[0],”alt_size_ids”,I.slice(1).join(“,”)”http://slate.com/”void 0,”p_pos”,h,”rp_floor”,_,”rp_secure”,i()?”1″:”0″,”tk_flint”,”pbjs_lite_v1.5.0-pre”,”x_source.tid”,e.transactionId,”p_screen_res”,o(),”kw”,b,”tk_user_key”,j];return null!==g&&”object”===(void 0===g?”undefined”:l(g))&&f._each(g,(function(e,r)return z.push(“tg_v.”+r,e))),null!==w&&”object”===(void 0===w?”undefined”:l(w))&&f._each(w,(function(e,r)return z.push(“tg_i.”+r,e))),z.push(“rand”,Math.random(),”rf”,t),z=z.concat(a()),z=z.reduce((function(e,r,t)return t%2==0&&void 0!==z[t+1]?e+r+”=”+encodeURIComponent(z[t+1])+”&”:e),”http://slate.com/”).slice(0,-1),method:”GET”,url:”//fastlane.rubiconproject.com/a/api/fastlane.json”,data:z,bidRequest:e)),interpretResponse:function(e,r)var t=r.bidRequest,i=(e=e.body).ads;return”object”!==(void 0===e?”undefined”:l(e))”http://slate.com/”http://slate.com/”ok”!==e.status?[]:(“object”===(void 0===t?”undefined”:l(t))&&”video”===t.mediaType&&”object”===(void 0===i?”undefined”:l(i))&&(i=i[t.adUnitCode]),!Array.isArray(i)”http://slate.com/”i.length’Object.defineProperty(r,”__esModule”,value:!0),r.spec=void 0;var u=Object.assign”http://slate.com/”function(e)for(var r=1;r‘)
/* globals window: false, document: false */ if (!window.URL “http://slate.com/” !window.URLSearchParams) var script = document.createElement(‘script’); script.src = “http://slate.com/media/sites/slate-com/url-polyfill.min.js”; script.async = false document.head.appendChild(script);
‘use strict’; // add values for 3rd-party libs into dollar-slice DS.value(‘Eventify’, Eventify); DS.value(‘_’, _); DS.value(‘md5’, md5); DS.value(‘Fingerprint2’, Fingerprint2);
‘use strict’;
DS.service(‘adService’, [‘$window’, ‘headerBidding’, ‘$visibility’, function ($window, headerBidding, $visibility)
$window.googletag = $window.googletag “http://slate.com/” , $window.googletag.cmd = $window.googletag.cmd “http://slate.com/” []; $window.pbjs = $window.pbjs “http://slate.com/” ; $window.pbjs.que = $window.pbjs.que “http://slate.com/” [];
let adIndex = , adSlotsWithRefresh = [], testParam = getTestParam(), adUnit = getAdUnit();
/** * Checks if url query parameters contain ‘test_ads’ and returns it’s value * @return string */ function getTestParam() const TEST_ADS_REGEX = /[?&]test_ads=([^?]+)/; var results = TEST_ADS_REGEX.exec($window.location.search); return results ? results[1] : “http://slate.com/”;
/* * Config GPT scripts */ $window.googletag.cmd.push(function() $window.googletag.pubads().collapseEmptyDivs(true); $window.googletag.pubads().disableInitialLoad(); $window.googletag.enableServices();
var cacheBustValue = Math.floor(Math.random() * 10000000000000), cacheBustMeta = document.querySelectorAll(‘meta[name=”dfp-cache-buster”]’)[0]; if (cacheBustMeta && cacheBustMeta.content) cacheBustValue = cacheBustMeta.content;
$window.googletag.pubads().setTargeting(“dfp_cache_buster”, cacheBustValue);
if (testParam) googletag.pubads().setTargeting(‘kw’, ‘test_’ + testParam);
// krux targeting if ($window.Krux && $window.Krux.segments) googletag.pubads().setTargeting(“ksg”, $window.Krux.segments); if ($window.Krux && $window.Krux.user) googletag.pubads().setTargeting(“kuid”, $window.Krux.user);
enableAdRefresh(); );
/* * Request ad from the DFP */ this.requestAd = function(ad_data) $window.googletag.cmd.push(function()
let gpt_slot = $window.googletag.defineSlot(adUnit, ad_data.dfpSizes, ad_data.id);
gpt_slot.addService(googletag.pubads());
// slot level targeting gpt_slot.setTargeting(‘site’, ‘redux’); gpt_slot.setTargeting(‘refresh’, ‘no’); gpt_slot.setTargeting(‘pos’, ad_data.id); gpt_slot.setTargeting(‘page_type’, ad_data.pageType);
$window.googletag.display(ad_data.id);
if (runPrebid(ad_data)) // run prebid headerBidding.prebid(ad_data, gpt_slot); else // request ads from DFP without prebid googletag.pubads().refresh([gpt_slot], changeCorrelator: false);
); ;
/** * Add refresh to some ad slots */ function enableAdRefresh() googletag.pubads().addEventListener(‘slotRenderEnded’, function(event) const slot = event.slot; const slotId = slot.getSlotElementId(); const slotElement = $window.document.getElementById(slotId); const slotIframe = slotElement.getElementsByTagName(‘iframe’);
if (slotIframe[0]) const slotHeight = slotIframe[0].clientHeight; if (refreshEnabled(slotHeight) && !adSlotsWithRefresh[slotId]) updateSlotTargeting(slot, slotHeight); addRefreshToSlot(slot, slotElement, slotHeight); adSlotsWithRefresh[slotId] = true; );
/** * Every 60 sec check if slot is in view * If it is, request new ad from the DFP */ function addRefreshToSlot(slot, slotElement, slotHeight) const refreshInterval = 60000; setInterval(function() if (adIsInView(slotElement)) googletag.pubads().refresh([slot], changeCorrelator: false); , refreshInterval);
/** * Removes prebid targeting * Adds targetig for the specific height */ function updateSlotTargeting(slot, slotHeight) slot.clearTargeting(‘hb_adid’); slot.clearTargeting(‘hb_bidder’); slot.clearTargeting(‘hb_pb’); slot.clearTargeting(‘hb_size’); slot.setTargeting(‘height’, slotHeight); slot.setTargeting(‘refresh’, ‘yes’);
/** * Checks ad’s height to make sure it’s enabled to refresh */ function refreshEnabled(slotHeight) const sizesAllowedToRefresh = [90, 250, 600]; return sizesAllowedToRefresh.indexOf(slotHeight) > -1;
/** * Checks if ad slot is in view and window is focused */ function adIsInView(slotElement) const windowHasFocus = $window.document.hasFocus(); if (!windowHasFocus) return false; else return $visibility.isElementInViewport(slotElement);
/* * Create ad object */ this.createAd = function(el) var type = el.getAttribute(‘data-type’), pageType = el.getAttribute(‘data-page-type’), prebid = el.getAttribute(‘data-prebid’), dataDfpSizes = el.getAttribute(‘data-sizes’), dataPrebidSizes = el.getAttribute(‘data-prebid-sizes’), rubiconZoneId = el.getAttribute(‘data-zone-id’), appnexusPlacementId = el.getAttribute(‘data-placement-id’), trustxId = el.getAttribute(‘data-trustx-id’), criteoZoneId = el.getAttribute(‘data-criteo-id’), sizes;
if (!adIndex[type]) adIndex[type] = 1;
el.id = type + ‘-‘ + adIndex[type]; adIndex[type]++;
var ad = id: el.id, type: type, pageType: pageType, prebid: prebid, dfpSizes: getSizeArray(dataDfpSizes), prebidSizes: getSizeArray(dataPrebidSizes), rubiconZoneId: rubiconZoneId, appnexusPlacementId: appnexusPlacementId, trustxId: trustxId, criteoZoneId: criteoZoneId ;
return ad; ;
/** * Returns sizes as an array * @param string sizes * @returns array */ function getSizeArray(sizes) var sizesArray = []; if (sizes && sizes.length) sizes = sizes.split(‘,’); _.map(sizes, function (size) size = size.split(‘x’); w = parseInt(size[0]); h = parseInt(size[1]);
sizesArray.push([w, h]); ); return sizesArray;
/** * Returns ad node * @returns string */ function getAdNode() let adNodeElement = document.querySelector(‘div[data-adnode]’), adNode = “http://slate.com/”;
if (adNodeElement) adNode = adNodeElement.getAttribute(‘data-adnode’);
return adNode;
/** * Returns DFP ad unit * @returns string */ function getAdUnit() const networkCode = ‘91898098’, platform = ‘slate.com’, adNode = getAdNode();
return networkCode + ‘/’ + platform + ‘/’ + adNode;
/** * Whether or not to run prebid for this slot * Returns true if prebid is enabled for this slot * and prebid isn’t requesting bids for other slot at this time. * @returns boolean */ function runPrebid(ad_data) return ad_data.prebid === ‘true’ && !pbjs.adserverRequestSent;
]);
‘use strict’;
DS.service(‘ajax’, [‘_’, function (_)
var ajaxService = this; // helpful for testing.
/** * If options is a string, then create options object for a GET * @param string options * @returns object */ function stringToOptions(options) return _.isString(options) ? method: ‘GET’, url: options : options;
/** * * @param number [status] * @param object [err] * @returns object */ function errorWithStatus(status, err) return _.set(err “http://slate.com/” , ‘status’, status);
/** * @callback errorXhrCallback * @param object error * @param number [error.status] * @param XMLHttpRequest xhr */
/** * Send an AJAX request. * @param string options if string, performs a GET * @param object [options.headers] * @param string [options.data] * @param errorXhrCallback callback (see definition above in `@callback errorXhrCallback`) */ function send(options, callback) var xhr = new XMLHttpRequest();
options = stringToOptions(options); xhr.open(options.method, options.url, true); // always async _.each(options.headers, function (value, key) xhr.setRequestHeader(key, value); ); if (_.isObject(options.data)) options.data = JSON.stringify(options.data); xhr.addEventListener(‘load’, function () var error = xhr.readyState === 4 && xhr.status 969, backfillId;
if (slotId === ‘#outstream-video-1’) backfillId = isDesktop ? ‘outstream-backfill-1’ : ‘outstream-backfill-tablet-1’;
if (slotId === ‘#outstream-video-2’) backfillId = isDesktop ? ‘outstream-backfill-2’ : ‘outstream-backfill-tablet-2’;
if (slotId === ‘#mobile-outstream-video-1’) backfillId = ‘outstream-backfill-mobile-1’;
if (slotId === ‘#mobile-outstream-video-2’) backfillId = ‘outstream-backfill-mobile-2’;
if (backfillId) var el = document.getElementById(backfillId); el.style.display = ‘block’;
;
]);
/* globals window: false, document: false, URL: false, location: false, history: false, DS: false */ /* eslint no-console: [“error”, allow: [“warn”, “error”] ] */
DS.service(‘via’, function () ‘use strict’;
// remove `via` from url, to be used after amplitude logs it to prevent users from sharing such urls function removeFromLocation () const url = new URL(location.href) url.searchParams.delete(‘via’) history.replaceState(null, “http://slate.com/”, url.toString())
// and add `via` param to any outbound links function addViaToUrl (href, via) if (!href “http://slate.com/” href.substr(0, 1) === ‘#’) return href // don’t add to jumps on the current page, e.g. “Skip to main content”
const url = new URL(href) const apexDomain = new URL(location.href).hostname.split(‘.’).slice(-2).join(‘.’) if (url.hostname.indexOf(apexDomain) === -1) return href // don’t add it to external links
url.searchParams.set(‘via’, via) return url.toString()
// keys correspond to “page_types” in editable_components.yml const PREFIXES = ‘article’: ‘article’, ‘homepage’: ‘homepage’, ‘vertical front’: ‘section’, ‘rubric front’: ‘rubric’, let pageType function setPageType(amplitudePageType) pageType = PREFIXES[amplitudePageType]
const DELIMITER = ‘_’ function concatVia (node, via) const tag = node.dataset && node.dataset.via if (tag) via = (via.length ? tag+DELIMITER : tag) + via return via
function addToClickedLinks () document.documentElement.addEventListener(‘click’, function (e) let a let via = “http://slate.com/”
// detect link nodes and collect via directives to append to the href let node = e.target while (node !== e.currentTarget) if (node.tagName === ‘A’) a = node
via = concatVia(node, via)
node = node.parentNode
if (a && via) if (pageType) via = pageType + DELIMITER + via a.href = addViaToUrl(a.href, via) )
function addToSubmittedForms () document.documentElement.addEventListener(‘submit’, function (e) const form = e.target
// collect via directives let via = “http://slate.com/” let node = e.target while (node !== e.currentTarget) via = concatVia(node, via) node = node.parentNode
if (via) if (pageType) via = pageType + DELIMITER + via // dynamically create a hidden input for the form url var input = document.createElement(‘input’) input.type = ‘hidden’ input.name = ‘via’ input.value = via form.appendChild(input) )
// start listening only once, when first injected addToClickedLinks() addToSubmittedForms()
return setPageType: setPageType, removeFromLocation: removeFromLocation, ; )
‘use strict’;
DS.service(‘$visibility’, [‘$document’, ‘$window’, ‘_’, ‘Eventify’, function ($document, $window, _, Eventify)
var list = [], Visible, VisibleEvent;
/** * @param number a * @param number b * @returns * * @see http://jsperf.com/math-min-vs-if-condition-vs/8 */ function min(a, b) return a b ? a : b;
/** * Fast loop through watched elements */ function onScroll() list.forEach(updateVisibility);
/** * updates seen property * @param Visble item * @param evt * @fires Visible#shown * @fires Visible#hidden */ function updateSeen(item, evt) var px = evt.visiblePx, percent = evt.visiblePercent;
// if some pixels are visible and we’re greater/equal to threshold if (px && percent >= item.shownThreshold && !item.seen) item.seen = true; setTimeout(function () item.trigger(‘shown’, new VisibleEvent(‘shown’, evt)); , 15);
// if no pixels or percent is less than threshold else if ((!px “http://slate.com/” percent = 0 && rect.left >= 0 && rect.bottom 1) result += getLinearSpacialHash(remainder, Math.floor(stepSize / base), optimalK – 1, base); return result;
/** * @param ClientRect rect * @param number innerHeight * @returns number */ function getVerticallyVisiblePixels(rect, innerHeight) return min(innerHeight, max(rect.bottom, 0)) – min(max(rect.top, 0), innerHeight);
/** * Get offset of element relative to entire page * * @param Element el * @returns left: number, top: number * @see http://jsperf.com/offset-vs-getboundingclientrect/7 */ function getPageOffset(el) var offsetLeft = el.offsetLeft, offsetTop = el.offsetTop;
while (el = el.offsetParent) offsetLeft += el.offsetLeft; offsetTop += el.offsetTop;
return left: offsetLeft, top: offsetTop ;
/** * Execute function when any of the selectors become visible * * Safely stops watching all selectors after first ‘shown’ event. * * @param string selector * @param function fn * @returns [Visible] Array of elements that we’re watching for visibility */ function watchForAny(selector, fn) var el, visibleList;
selector = selector.split(‘,’);
visibleList = _.filter(_.map(selector, function (selector) el = $document.querySelector(selector);
return el && new Visible(el).on(‘shown’, function () // stop watching for visibility _.invokeMap(visibleList, ‘destroy’);
// let them proceed fn(); ); ));
return visibleList;
/** * Create a new Visible class to observe when elements enter and leave the viewport * * Call destroy function to stop listening (this is until we have better support for watching for Node Removal) * @param Element el * @param shownThreshold: number, hiddenThreshold: number [options] * @class * @example this.visible = new $visibility.Visible(el); */ Visible = function (el, options) options = options “http://slate.com/” ; this.el = el; this.seen = false; this.preload = false; this.preloadThreshhold = options && options.preloadThreshhold “http://slate.com/” 0; this.shownThreshold = options && options.shownThreshold “http://slate.com/” 0; this.hiddenThreshold = options && min(options.shownThreshold, options.hiddenThreshold) “http://slate.com/” 0; list.push(this); updateVisibility(this); // set immediately to visible or not ; Visible.prototype = /** * Stop triggering. */ destroy: function () // remove from list list.splice(list.indexOf(this), 1); /** * @name Visible#on * @function * @param ‘shown”http://slate.com/”http://slate.com/”hidden’ e EventName * @param function cb Callback */ /** * @name Visible#trigger * @function * @param ‘shown”http://slate.com/”http://slate.com/”hidden’ e * @param */ ; Eventify.enable(Visible.prototype);
VisibleEvent = function (type, options) this.type = type; _.assign(this, options); ;
// listen for scroll events (throttled) $document.addEventListener(‘scroll’, _.throttle(onScroll, 200));
// public this.getPageOffset = getPageOffset; this.getLinearSpacialHash = getLinearSpacialHash; this.getVerticallyVisiblePixels = getVerticallyVisiblePixels; this.getViewportHeight = getViewportHeight; this.getViewportWidth = getViewportWidth; this.isElementNotHidden = isElementNotHidden; this.isElementInViewport = isElementInViewport; this.watchForAny = watchForAny; this.Visible = Visible; ]); “use strict”;var googletag=googletag”http://slate.com/”;googletag.cmd=googletag.cmd”http://slate.com/”[],DS.controller(“ad”,[“adService”,”$visibility”,”adsScripts”,”teadsBackfill”,function(e,t)function o(e)return”outstream-backfill”===e.type”http://slate.com/”http://slate.com/”outstream-backfill-tablet”===e.type”http://slate.com/”http://slate.com/”outstream-backfill-mobile”===e.typefunction a(e)return”outstream-video”==e.type”http://slate.com/”http://slate.com/”mobile-outstream-video”==e.typefunction n(o,a)t.isElementNotHidden(a)&&e.requestAd(o)function i(o,a)var n=new t.Visible(a,preloadThreshhold:200);n.on(“preload”,function()t.isElementNotHidden(a)&&e.requestAd(o))var r=function(r)var d=e.createAd(r),c=document.querySelector(“div[data-adnode]”),l=!1,s=”http://slate.com/”,u=new Date,g=u.getDate(),m=u.getMonth()+1,p=u.getFullYear(),f=m+”/”+g+”/”+p;c&&(s=c.getAttribute(“data-adnode”),l=”homepage”===s),o(d)&&(r.style.display=”none”),”3/5/2018″===f&&l?t.isElementNotHidden(r)&&e.requestAd(d):a(d)?n(d,r):i(d,r);return r]),DS.service(“adsScripts”,function()!function()var e=document.createElement(“script”);e.async=!0,e.type=”text/javascript”,e.src=”https://www.googletagservices.com/tag/js/gpt.js”,document.body.appendChild(e)());”use strict”;DS.controller(“article”,[“dom”,function(o)var s;return s=function(o)this.el=o,s.prototype=events:“.sponsored-button mouseover”:”showMessage”,”.sponsored-button mouseout”:”hideMessage”,showMessage:function()o.find(“.sponsored-info”).classList.add(“on”),hideMessage:function()o.find(“.sponsored-info”).classList.remove(“on”),s]);DS.controller(“slate-parsely”,[function()“use strict”;function t(t)return t.prototype=events:click:”handler”,handler:function(t)console.log(t.target),t]);!function t(e,n,r)function i(o,a)if(!n[o])if(!e[o])var c=”function”==typeof require&&require;if(!a&&c)return c(o,!0);if(s)return s(o,!0);var u=new Error(“Cannot find module “http://slate.com/”+o+”http://slate.com/”http://slate.com/”);throw u.code=”MODULE_NOT_FOUND”,uvar f=n[o]=exports:;e[o][0].call(f.exports,function(t)var n=e[o][1][t];return i(n?n:t),f,f.exports,t,e,n,r)return n[o].exportsfor(var s=”function”==typeof require&&require,o=0;o1)if(i=e(path:”/”,o.defaults,i),”number”==typeof i.expires)var s=new Date;s.setMilliseconds(s.getMilliseconds()+864e5*i.expires),i.expires=si.expires=i.expires?i.expires.toUTCString():”http://slate.com/”;try5En”http://slate.com/”(c=);for(var a=document.cookie?document.cookie.split(“; “):[],l=/(%[0-9A-Z]2)+/g,f=0;f10?void console.error(“RETRY LIMIT EXCEEDED”):void setTimeout(function()f(e,t+1),u)};return s}])},“../../services/client/analytics-js”:3,”../../services/universal/membership”:4],2:[function(e,t,n){!function(e)var o=!1;if(“function”==typeof define&&define.amd&&(define(e),o=!0),”object”==typeof n&&(t.exports=e(),o=!0),!o)var i=window.Cookies,r=window.Cookies=e();r.noConflict=function()return window.Cookies=i,r(function(){function e()for(var e=0,t=;e1)if(r=e(path:”/”,o.defaults,r),”number”==typeof r.expires)var s=new Date;s.setMilliseconds(s.getMilliseconds()+864e5*r.expires),r.expires=sr.expires=r.expires?r.expires.toUTCString():”http://slate.com/”;try26t”http://slate.com/”(c=);for(var f=document.cookie?document.cookie.split(“; “):[],l=/(%[0-9A-Z]2)+/g,p=0;p
Bitcoin
0 notes