Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postscribe

Package Overview
Dependencies
Maintainers
6
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postscribe - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

dist/postscribe.js.map

842

dist/postscribe.js
/**
* @file postscribe
* @description Asynchronously write javascript, even with document.write.
* @version v2.0.4
* @version v2.0.5
* @see {@link https://krux.github.io/postscribe}

@@ -23,10 +23,10 @@ * @license MIT

/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)

@@ -38,23 +38,23 @@ /******/ var module = installedModules[moduleId] = {

/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports

@@ -69,9 +69,9 @@ /******/ return __webpack_require__(0);

'use strict';
var _postscribe = __webpack_require__(1);
var _postscribe2 = _interopRequireDefault(_postscribe);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
module.exports = _postscribe2['default'];

@@ -84,21 +84,21 @@

'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports['default'] = postscribe;
var _writeStream = __webpack_require__(2);
var _writeStream2 = _interopRequireDefault(_writeStream);
var _utils = __webpack_require__(4);
var utils = _interopRequireWildcard(_utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**

@@ -108,3 +108,3 @@ * A function that intentionally does nothing.

function doNothing() {}
/**

@@ -120,3 +120,3 @@ * Available options and defaults.

afterAsync: doNothing,
/**

@@ -126,3 +126,3 @@ * Called immediately before removing from the write queue.

afterDequeue: doNothing,
/**

@@ -132,3 +132,3 @@ * Called sync after a stream's first thread release.

afterStreamStart: doNothing,
/**

@@ -138,3 +138,3 @@ * Called after writing buffered document.write calls.

afterWrite: doNothing,
/**

@@ -144,3 +144,3 @@ * Allows disabling the autoFix feature of prescribe

autoFix: true,
/**

@@ -150,3 +150,3 @@ * Called immediately before adding to the write queue.

beforeEnqueue: doNothing,
/**

@@ -160,3 +160,3 @@ * Called before writing a token.

},
/**

@@ -170,3 +170,3 @@ * Called before writing buffered document.write calls.

},
/**

@@ -176,3 +176,3 @@ * Called when evaluation is finished.

done: doNothing,
/**

@@ -186,4 +186,4 @@ * Called when a write results in an error.

},
/**

@@ -194,7 +194,7 @@ * Whether to let scripts w/ async attribute set fall out of the queue.

};
var nextId = 0;
var queue = [];
var active = null;
function nextStream() {

@@ -204,3 +204,3 @@ var args = queue.shift();

var options = utils.last(args);
options.afterDequeue();

@@ -211,3 +211,3 @@ args.stream = runStream.apply(undefined, args);

}
function runStream(el, html, options) {

@@ -217,3 +217,3 @@ active = new

_writeStream2['default'](el, options);
// Identify this stream.

@@ -223,6 +223,6 @@ active.id = nextId++;

postscribe.streams[active.name] = active;
// Override document.write.
var doc = el.ownerDocument;
var stash = {

@@ -234,3 +234,3 @@ close: doc.close,

};
function _write(str) {

@@ -241,3 +241,3 @@ str = options.beforeWrite(str);

}
_extends(doc, {

@@ -250,3 +250,3 @@ close: doNothing,

}
return _write(str.join(''));

@@ -258,10 +258,10 @@ },

}
return _write(str.join('') + '\n');
}
});
// Override window.onerror
var oldOnError = active.win.onerror || doNothing;
// This works together with the try/catch around WriteStream::insertScript

@@ -273,3 +273,3 @@ // In modern browsers, exceptions in tag scripts go directly to top level

};
// Write to the stream

@@ -279,6 +279,6 @@ active.write(html, function () {

_extends(doc, stash);
// restore window.onerror
active.win.onerror = oldOnError;
options.done();

@@ -288,6 +288,6 @@ active = null;

});
return active;
}
function postscribe(el, html, options) {

@@ -302,5 +302,5 @@ if (utils.isFunction(options)) {

}
options = utils.defaults(options, OPTIONS);
// id selector

@@ -312,5 +312,5 @@ if (/^#/.test(el)) {

}
var args = [el, html, options];
el.postscribe = {

@@ -325,13 +325,13 @@ cancel: function cancel() {

};
options.beforeEnqueue(args);
queue.push(args);
if (!active) {
nextStream();
}
return el.postscribe;
}
_extends(postscribe, {

@@ -349,21 +349,21 @@ // Streams by name.

'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _prescribe = __webpack_require__(3);
var _prescribe2 = _interopRequireDefault(_prescribe);
var _utils = __webpack_require__(4);
var utils = _interopRequireWildcard(_utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**

@@ -374,3 +374,3 @@ * Turn on to debug how each chunk affected the DOM.

var DEBUG_CHUNK = false;
/**

@@ -381,3 +381,3 @@ * Prefix for data attributes on DOM elements.

var BASEATTR = 'data-ps-';
/**

@@ -388,3 +388,3 @@ * ID for the style proxy

var PROXY_STYLE = 'ps-style';
/**

@@ -395,3 +395,3 @@ * ID for the script proxy

var PROXY_SCRIPT = 'ps-script';
/**

@@ -406,9 +406,9 @@ * Get data attributes

var attr = BASEATTR + name;
var val = el.getAttribute(attr);
// IE 8 returns a number if it's a number
return !utils.existy(val) ? val : String(val);
}
/**

@@ -423,5 +423,5 @@ * Set data attributes

var value = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var attr = BASEATTR + name;
if (utils.existy(value) && value !== '') {

@@ -433,3 +433,3 @@ el.setAttribute(attr, value);

}
/**

@@ -458,3 +458,3 @@ * Stream static html to an element, where "static html" denotes "html

*/
var WriteStream = function () {

@@ -467,8 +467,8 @@ /**

*/
function WriteStream(root) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, WriteStream);
this.root = root;

@@ -479,19 +479,19 @@ this.options = options;

this.parser = new _prescribe2['default']('', { autoFix: options.autoFix });
// Actual elements by id.
this.actuals = [root];
// Embodies the "structure" of what's been written so far,
// devoid of attributes.
this.proxyHistory = '';
// Create a proxy of the root element.
this.proxyRoot = this.doc.createElement(root.nodeName);
this.scriptStack = [];
this.writeQueue = [];
setData(this.proxyRoot, 'proxyof', 0);
}
/**

@@ -502,9 +502,9 @@ * Writes the given strings.

*/
WriteStream.prototype.write = function write() {
var _writeQueue;
(_writeQueue = this.writeQueue).push.apply(_writeQueue, arguments);
// Process writes

@@ -515,3 +515,3 @@ // When new script gets pushed or pending this will stop

var arg = this.writeQueue.shift();
if (utils.isFunction(arg)) {

@@ -524,3 +524,3 @@ this._callFunction(arg);

};
/**

@@ -532,4 +532,4 @@ * Calls the given function.

*/
WriteStream.prototype._callFunction = function _callFunction(fn) {

@@ -541,3 +541,3 @@ var tok = { type: 'function', value: fn.name || fn.toString() };

};
/**

@@ -549,7 +549,7 @@ * The write implementation

*/
WriteStream.prototype._writeImpl = function _writeImpl(html) {
this.parser.append(html);
var tok = void 0;

@@ -559,7 +559,7 @@ var script = void 0;

var tokens = [];
// stop if we see a script token
while ((tok = this.parser.readToken()) && !(script = utils.isScript(tok)) && !(style = utils.isStyle(tok))) {
tok = this.options.beforeWriteToken(tok);
if (tok) {

@@ -569,11 +569,11 @@ tokens.push(tok);

}
if (tokens.length > 0) {
this._writeStaticTokens(tokens);
}
if (script) {
this._handleScriptToken(tok);
}
if (style) {

@@ -583,3 +583,3 @@ this._handleStyleToken(tok);

};
/**

@@ -592,7 +592,7 @@ * Write a contiguous non-script tokens (a chunk)

*/
WriteStream.prototype._writeStaticTokens = function _writeStaticTokens(tokens) {
var chunk = this._buildChunk(tokens);
if (!chunk.actual) {

@@ -602,20 +602,20 @@ // e.g., no tokens, or a noscript that got ignored

}
chunk.html = this.proxyHistory + chunk.actual;
this.proxyHistory += chunk.proxy;
this.proxyRoot.innerHTML = chunk.html;
if (DEBUG_CHUNK) {
chunk.proxyInnerHTML = this.proxyRoot.innerHTML;
}
this._walkChunk();
if (DEBUG_CHUNK) {
chunk.actualInnerHTML = this.root.innerHTML;
}
return chunk;
};
/**

@@ -628,16 +628,16 @@ * Build a chunk.

*/
WriteStream.prototype._buildChunk = function _buildChunk(tokens) {
var nextId = this.actuals.length;
// The raw html of this chunk.
var raw = [];
// The html to create the nodes in the tokens (with id's injected).
var actual = [];
// Html that can later be used to proxy the nodes in the tokens.
var proxy = [];
var len = tokens.length;

@@ -647,5 +647,5 @@ for (var i = 0; i < len; i++) {

var tokenRaw = tok.toString();
raw.push(tokenRaw);
if (tok.attrs) {

@@ -656,6 +656,6 @@ // tok.attrs <==> startTag or atomicTag or cursor

var id = nextId++;
// Actual: inject id attribute: replace '>' at end of start tag with id attribute + '>'
actual.push(tokenRaw.replace(/(\/?>)/, ' ' + BASEATTR + 'id=' + id + ' $1'));
// Don't proxy scripts: they have no bearing on DOM structure.

@@ -673,3 +673,3 @@ if (tok.attrs.id !== PROXY_SCRIPT && tok.attrs.id !== PROXY_STYLE) {

actual.push(tokenRaw);
// Proxy: append endTags. Ignore everything else.

@@ -679,3 +679,3 @@ proxy.push(tok.type === 'endTag' ? tokenRaw : '');

}
return {

@@ -688,3 +688,3 @@ tokens: tokens,

};
/**

@@ -695,14 +695,14 @@ * Walk the chunks.

*/
WriteStream.prototype._walkChunk = function _walkChunk() {
var node = void 0;
var stack = [this.proxyRoot];
// use shift/unshift so that children are walked in document order
while (utils.existy(node = stack.shift())) {
var isElement = node.nodeType === 1;
var isProxy = isElement && getData(node, 'proxyof');
// Ignore proxies

@@ -715,3 +715,3 @@ if (!isProxy) {

}
// Is node's parent a proxy?

@@ -724,3 +724,3 @@ var parentIsProxyOf = node.parentNode && getData(node.parentNode, 'proxyof');

}
// prepend childNodes to stack

@@ -730,3 +730,3 @@ stack.unshift.apply(stack, utils.toArray(node.childNodes));

};
/**

@@ -737,9 +737,9 @@ * Handles Script tokens

*/
WriteStream.prototype._handleScriptToken = function _handleScriptToken(tok) {
var _this = this;
var remainder = this.parser.clear();
if (remainder) {

@@ -749,5 +749,5 @@ // Write remainder immediately behind this script.

}
tok.src = tok.attrs.src || tok.attrs.SRC;
tok = this.options.beforeWriteToken(tok);

@@ -758,3 +758,3 @@ if (!tok) {

}
if (tok.src && this.scriptStack.length) {

@@ -768,3 +768,3 @@ // Defer this script until scriptStack is empty.

}
// Put the script node in the DOM.

@@ -775,3 +775,3 @@ this._writeScriptToken(tok, function () {

};
/**

@@ -782,7 +782,7 @@ * Handles style tokens

*/
WriteStream.prototype._handleStyleToken = function _handleStyleToken(tok) {
var remainder = this.parser.clear();
if (remainder) {

@@ -792,7 +792,7 @@ // Write remainder immediately behind this style.

}
tok.type = tok.attrs.type || tok.attrs.TYPE || 'text/css';
tok = this.options.beforeWriteToken(tok);
if (tok) {

@@ -802,3 +802,3 @@ // Put the style node in the DOM.

}
if (remainder) {

@@ -808,3 +808,3 @@ this.write();

};
/**

@@ -815,9 +815,9 @@ * Build a style and insert it into the DOM.

*/
WriteStream.prototype._writeStyleToken = function _writeStyleToken(tok) {
var el = this._buildStyle(tok);
this._insertStyle(el);
this._insertCursor(el, PROXY_STYLE);
// Set content

@@ -832,3 +832,3 @@ if (tok.content) {

};
/**

@@ -840,9 +840,9 @@ * Build a style element from an atomic style token.

*/
WriteStream.prototype._buildStyle = function _buildStyle(tok) {
var el = this.doc.createElement(tok.tagName);
el.setAttribute('type', tok.type);
// Set attributes

@@ -852,33 +852,20 @@ utils.eachKey(tok.attrs, function (name, value) {

});
return el;
};
/**
* Append a span to the stream. That span will act as a cursor
* (i.e. insertion point) for the style.
* (i.e. insertion point) for the element.
*
* @param {String} id The ID of the span.
* @private
*/
WriteStream.prototype._insertSpan = function _insertSpan(id) {
this._writeImpl('<span id="' + id + '"/>');
// Grab that span from the DOM.
return this.doc.getElementById(id);
};
/**
* Insert style into DOM where it would naturally be written.
*
* @param {Object} el The element
* @param {string} which The type of proxy element
*/
WriteStream.prototype._insertStyle = function _insertStyle(el) {
var cursor = this._insertSpan(PROXY_STYLE);
// Replace cursor with style.
WriteStream.prototype._insertCursor = function _insertCursor(el, which) {
this._writeImpl('<span id="' + which + '"/>');
var cursor = this.doc.getElementById(which);
if (cursor) {

@@ -888,20 +875,4 @@ cursor.parentNode.replaceChild(el, cursor);

};
/**
* Insert script into DOM where it would naturally be written.
*
* @param {Object} el The element
*/
WriteStream.prototype._insertScript = function _insertScript(el) {
var cursor = this._insertSpan(PROXY_SCRIPT);
// Replace cursor with script.
if (cursor) {
cursor.parentNode.replaceChild(el, cursor);
}
};
/**
* Called when a script is started.

@@ -912,4 +883,4 @@ *

*/
WriteStream.prototype._onScriptStart = function _onScriptStart(tok) {

@@ -920,3 +891,3 @@ tok.outerWrites = this.writeQueue;

};
/**

@@ -928,4 +899,4 @@ * Called when a script is done.

*/
WriteStream.prototype._onScriptDone = function _onScriptDone(tok) {

@@ -937,10 +908,10 @@ // Pop script and check nesting.

}
this.scriptStack.shift();
// Append outer writes to queue and process them.
this.write.apply(this, tok.outerWrites);
// Check for pending remote
// Assumption 2: if remote_script1 writes remote_script2 then

@@ -954,3 +925,3 @@ // the we notice remote_script1 finishes before remote_script2 starts.

};
/**

@@ -963,4 +934,4 @@ * Build a script and insert it into the DOM.

*/
WriteStream.prototype._writeScriptToken = function _writeScriptToken(tok, done) {

@@ -970,3 +941,3 @@ var el = this._buildScript(tok);

var afterAsync = this.options.afterAsync;
if (tok.src) {

@@ -980,5 +951,5 @@ // Fix for attribute "SRC" (capitalized). IE does not recognize it.

}
try {
this._insertScript(el);
this._insertCursor(el, PROXY_SCRIPT);
if (!el.src || asyncRelease) {

@@ -992,3 +963,3 @@ done();

};
/**

@@ -1000,7 +971,7 @@ * Build a script element from an atomic script token.

*/
WriteStream.prototype._buildScript = function _buildScript(tok) {
var el = this.doc.createElement(tok.tagName);
// Set attributes

@@ -1010,3 +981,3 @@ utils.eachKey(tok.attrs, function (name, value) {

});
// Set content

@@ -1016,6 +987,6 @@ if (tok.content) {

}
return el;
};
/**

@@ -1028,4 +999,4 @@ * Setup the script load handler on an element.

*/
WriteStream.prototype._scriptLoadHandler = function _scriptLoadHandler(el, done) {

@@ -1035,5 +1006,5 @@ function cleanup() {

}
var error = this.options.error;
function success() {

@@ -1043,3 +1014,3 @@ cleanup();

}
function failure(err) {

@@ -1050,3 +1021,3 @@ cleanup();

}
// Set handlers

@@ -1057,3 +1028,3 @@ _extends(el, {

},
onreadystatechange: function onreadystatechange() {

@@ -1064,3 +1035,3 @@ if (/^(loaded|complete)$/.test(el.readyState)) {

},
onerror: function onerror() {

@@ -1071,3 +1042,3 @@ return failure({ message: 'remote script failed ' + el.src });

};
/**

@@ -1080,4 +1051,4 @@ * Determines whether to release.

*/
WriteStream.prototype._shouldRelease = function _shouldRelease(el) {

@@ -1087,6 +1058,6 @@ var isScript = /^script$/i.test(el.nodeName);

};
return WriteStream;
}();
exports['default'] = WriteStream;

@@ -1120,10 +1091,10 @@

/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)

@@ -1135,23 +1106,23 @@ /******/ var module = installedModules[moduleId] = {

/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports

@@ -1164,41 +1135,41 @@ /******/ return __webpack_require__(0);

/***/ function(module, exports, __webpack_require__) {
'use strict';
var _HtmlParser = __webpack_require__(1);
var _HtmlParser2 = _interopRequireDefault(_HtmlParser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
module.exports = _HtmlParser2['default'];
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _supports = __webpack_require__(2);
var supports = _interopRequireWildcard(_supports);
var _streamReaders = __webpack_require__(3);
var streamReaders = _interopRequireWildcard(_streamReaders);
var _fixedReadTokenFactory = __webpack_require__(6);
var _fixedReadTokenFactory2 = _interopRequireDefault(_fixedReadTokenFactory);
var _utils = __webpack_require__(5);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**

@@ -1209,3 +1180,3 @@ * Detection regular expressions.

* succeed if detection of previous didn't
* @type {Object}

@@ -1220,3 +1191,3 @@ */

};
/**

@@ -1226,3 +1197,3 @@ * HtmlParser provides the capability to parse HTML and return tokens

*/
var HtmlParser = function () {

@@ -1236,16 +1207,16 @@ /**

*/
function HtmlParser() {
var _this = this;
var stream = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, HtmlParser);
this.stream = stream;
var fix = false;
var fixedTokenOptions = {};
for (var key in supports) {

@@ -1259,3 +1230,3 @@ if (supports.hasOwnProperty(key)) {

}
if (fix) {

@@ -1267,3 +1238,3 @@ this._fixedReadToken = (0, _fixedReadTokenFactory2['default'])(this, fixedTokenOptions, function () {

}
/**

@@ -1274,8 +1245,8 @@ * Appends the given string to the parse stream.

*/
HtmlParser.prototype.append = function append(str) {
this.stream += str;
};
/**

@@ -1286,8 +1257,8 @@ * Prepends the given string to the parse stream.

*/
HtmlParser.prototype.prepend = function prepend(str) {
this.stream = str + this.stream;
};
/**

@@ -1299,4 +1270,4 @@ * The implementation of the token reading.

*/
HtmlParser.prototype._readTokenImpl = function _readTokenImpl() {

@@ -1317,3 +1288,3 @@ // Enumerate detects in order

};
/**

@@ -1326,4 +1297,4 @@ * The public token reading interface. Delegates to the basic token reading

*/
HtmlParser.prototype.readToken = function readToken() {

@@ -1336,3 +1307,3 @@ if (this._fixedReadToken) {

};
/**

@@ -1343,4 +1314,4 @@ * Read tokens and hand to the given handlers.

*/
HtmlParser.prototype.readTokens = function readTokens(handlers) {

@@ -1355,3 +1326,3 @@ var tok = void 0;

};
/**

@@ -1362,4 +1333,4 @@ * Clears the parse stream.

*/
HtmlParser.prototype.clear = function clear() {

@@ -1370,3 +1341,3 @@ var rest = this.stream;

};
/**

@@ -1377,21 +1348,21 @@ * Returns the rest of the parse stream.

*/
HtmlParser.prototype.rest = function rest() {
return this.stream;
};
return HtmlParser;
}();
exports['default'] = HtmlParser;
HtmlParser.tokenToString = function (tok) {
return tok.toString();
};
HtmlParser.escapeAttributes = function (attrs) {
var escapedAttrs = {};
for (var name in attrs) {

@@ -1402,8 +1373,8 @@ if (attrs.hasOwnProperty(name)) {

}
return escapedAttrs;
};
HtmlParser.supports = supports;
for (var key in supports) {

@@ -1414,15 +1385,15 @@ if (supports.hasOwnProperty(key)) {

}
/***/ },
/* 2 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var tagSoup = false;
var selfClose = false;
var work = window.document.createElement('div');
try {

@@ -1435,3 +1406,3 @@ var html = '<P><I></P></I>';

}
try {

@@ -1443,18 +1414,18 @@ work.innerHTML = '<P><i><P></P></i></P>';

}
work = null;
exports.tagSoup = tagSoup;
exports.selfClose = selfClose;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
exports.comment = comment;

@@ -1465,5 +1436,5 @@ exports.chars = chars;

exports.endTag = endTag;
var _tokens = __webpack_require__(4);
/**

@@ -1480,3 +1451,3 @@ * Regular Expressions for parsing tags and attributes

};
/**

@@ -1494,3 +1465,3 @@ * Reads a comment token

}
/**

@@ -1506,3 +1477,3 @@ * Reads non-tag characters.

}
/**

@@ -1523,3 +1494,3 @@ * Reads start tag token.

var rest = match[2];
match[2].replace(REGEXES.attr, function (match, name) {

@@ -1534,6 +1505,6 @@ if (!(arguments[2] || arguments[3] || arguments[4] || arguments[5])) {

}
rest = rest.replace(match, '');
});
return {

@@ -1543,3 +1514,3 @@ v: new _tokens.StartTagToken(match[1], match[0].length, attrs, booleanAttrs, !!match[3], rest.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''))

}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;

@@ -1549,3 +1520,3 @@ }

}
/**

@@ -1571,3 +1542,3 @@ * Reads atomic tag token.

}
/**

@@ -1585,16 +1556,16 @@ * Reads an end tag token.

}
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.EndTagToken = exports.AtomicTagToken = exports.StartTagToken = exports.TagToken = exports.CharsToken = exports.CommentToken = exports.Token = undefined;
var _utils = __webpack_require__(5);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**

@@ -1604,3 +1575,3 @@ * Token is a base class for all token types parsed. Note we don't actually

*/
var Token =

@@ -1615,3 +1586,3 @@ /**

_classCallCheck(this, Token);
this.type = type;

@@ -1621,8 +1592,8 @@ this.length = length;

};
/**
* CommentToken represents comment tags.
*/
var CommentToken = exports.CommentToken = function () {

@@ -1635,6 +1606,6 @@ /**

*/
function CommentToken(content, length) {
_classCallCheck(this, CommentToken);
this.type = 'comment';

@@ -1645,15 +1616,15 @@ this.length = length || (content ? content.length : 0);

}
CommentToken.prototype.toString = function toString() {
return '<!--' + this.content;
};
return CommentToken;
}();
/**
* CharsToken represents non-tag characters.
*/
var CharsToken = exports.CharsToken = function () {

@@ -1665,6 +1636,6 @@ /**

*/
function CharsToken(length) {
_classCallCheck(this, CharsToken);
this.type = 'chars';

@@ -1674,15 +1645,15 @@ this.length = length;

}
CharsToken.prototype.toString = function toString() {
return this.text;
};
return CharsToken;
}();
/**
* TagToken is a base class for all tag-based Tokens.
*/
var TagToken = exports.TagToken = function () {

@@ -1699,6 +1670,6 @@ /**

*/
function TagToken(type, tagName, length, attrs, booleanAttrs) {
_classCallCheck(this, TagToken);
this.type = type;

@@ -1713,3 +1684,3 @@ this.length = length;

}
/**

@@ -1722,7 +1693,7 @@ * Formats the given token tag.

*/
TagToken.formatTag = function formatTag(tok) {
var content = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var str = '<' + tok.tagName;

@@ -1732,3 +1703,3 @@ for (var key in tok.attrs) {

str += ' ' + key;
var val = tok.attrs[key];

@@ -1740,7 +1711,7 @@ if (typeof tok.booleanAttrs === 'undefined' || typeof tok.booleanAttrs[key] === 'undefined') {

}
if (tok.rest) {
str += ' ' + tok.rest;
}
if (tok.unary && !tok.html5Unary) {

@@ -1751,18 +1722,18 @@ str += '/>';

}
if (content !== undefined && content !== null) {
str += content + '</' + tok.tagName + '>';
}
return str;
};
return TagToken;
}();
/**
* StartTagToken represents a start token.
*/
var StartTagToken = exports.StartTagToken = function () {

@@ -1780,6 +1751,6 @@ /**

*/
function StartTagToken(tagName, length, attrs, booleanAttrs, unary, rest) {
_classCallCheck(this, StartTagToken);
this.type = 'startTag';

@@ -1795,15 +1766,15 @@ this.length = length;

}
StartTagToken.prototype.toString = function toString() {
return TagToken.formatTag(this);
};
return StartTagToken;
}();
/**
* AtomicTagToken represents an atomic tag.
*/
var AtomicTagToken = exports.AtomicTagToken = function () {

@@ -1820,6 +1791,6 @@ /**

*/
function AtomicTagToken(tagName, length, attrs, booleanAttrs, content) {
_classCallCheck(this, AtomicTagToken);
this.type = 'atomicTag';

@@ -1835,15 +1806,15 @@ this.length = length;

}
AtomicTagToken.prototype.toString = function toString() {
return TagToken.formatTag(this, this.content);
};
return AtomicTagToken;
}();
/**
* EndTagToken represents an end tag.
*/
var EndTagToken = exports.EndTagToken = function () {

@@ -1856,6 +1827,6 @@ /**

*/
function EndTagToken(tagName, length) {
_classCallCheck(this, EndTagToken);
this.type = 'endTag';

@@ -1866,19 +1837,19 @@ this.length = length;

}
EndTagToken.prototype.toString = function toString() {
return '</' + this.tagName + '>';
};
return EndTagToken;
}();
/***/ },
/* 5 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.escapeQuotes = escapeQuotes;
/**

@@ -1893,3 +1864,3 @@ * Escape quotes in the given value.

var defaultValue = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];
// There's no lookback in JS, so /(^|[^\\])"/ only matches the first of two `"`s.

@@ -1902,9 +1873,9 @@ // Instead, just match anything before a double-quote and escape if it's not already escaped.

}
/***/ },
/* 6 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;

@@ -1918,3 +1889,3 @@ exports['default'] = fixedReadTokenFactory;

var EMPTY = /^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i;
/**

@@ -1926,3 +1897,3 @@ * Elements that you can intentionally leave open (and which close themselves)

var CLOSESELF = /^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i;
/**

@@ -1941,3 +1912,3 @@ * Corrects a token.

}
/**

@@ -1956,3 +1927,3 @@ * Peeks at the next token in the parser.

}
/**

@@ -1966,7 +1937,7 @@ * Closes the last token.

var tok = stack.pop();
// prepend close tag to stream.
parser.prepend('</' + tok.tagName + '>');
}
/**

@@ -1979,7 +1950,7 @@ * Create a new token stack.

var stack = [];
stack.last = function () {
return this[this.length - 1];
};
stack.lastTagNameEq = function (tagName) {

@@ -1989,3 +1960,3 @@ var last = this.last();

};
stack.containsTagName = function (tagName) {

@@ -1999,6 +1970,6 @@ for (var i = 0, tok; tok = this[i]; i++) {

};
return stack;
}
/**

@@ -2016,7 +1987,7 @@ * Return a readToken implementation that fixes input.

var stack = newStack();
var handlers = {
startTag: function startTag(tok) {
var tagName = tok.tagName;
if (tagName.toUpperCase() === 'TR' && stack.lastTagNameEq('TABLE')) {

@@ -2052,3 +2023,3 @@ parser.prepend('<TBODY>');

};
function prepareNextToken() {

@@ -2060,3 +2031,3 @@ var tok = peekToken(parser, readTokenImpl);

}
return function fixedReadToken() {

@@ -2067,3 +2038,3 @@ prepareNextToken();

}
/***/ }

@@ -2079,7 +2050,7 @@ /******/ ])

'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
exports.existy = existy;

@@ -2104,3 +2075,3 @@ exports.isFunction = isFunction;

}
/**

@@ -2115,3 +2086,3 @@ * Is this a function?

}
/**

@@ -2131,3 +2102,3 @@ * Loop over each item in an array-like value.

}
/**

@@ -2147,3 +2118,3 @@ * Loop over each key/value pair in a hash.

}
/**

@@ -2165,3 +2136,3 @@ * Set default options where some option was not specified.

}
/**

@@ -2186,7 +2157,7 @@ * Convert value (e.g., a NodeList) to an array.

}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
}
/**

@@ -2201,3 +2172,3 @@ * Get the last item in an array

}
/**

@@ -2213,3 +2184,3 @@ * Test if token is a script tag.

}
/**

@@ -2224,3 +2195,3 @@ * Test if token is a script tag.

}
/**

@@ -2239,2 +2210,3 @@ * Test if token is a style tag.

});
;
;
//# sourceMappingURL=postscribe.js.map
/**
* @file postscribe
* @description Asynchronously write javascript, even with document.write.
* @version v2.0.4
* @version v2.0.5
* @see {@link https://krux.github.io/postscribe}

@@ -23,10 +23,10 @@ * @license MIT

/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)

@@ -38,23 +38,23 @@ /******/ var module = installedModules[moduleId] = {

/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports

@@ -69,9 +69,9 @@ /******/ return __webpack_require__(0);

'use strict';
var _postscribe = __webpack_require__(1);
var _postscribe2 = _interopRequireDefault(_postscribe);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
module.exports = _postscribe2['default'];

@@ -84,21 +84,21 @@

'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports['default'] = postscribe;
var _writeStream = __webpack_require__(2);
var _writeStream2 = _interopRequireDefault(_writeStream);
var _utils = __webpack_require__(4);
var utils = _interopRequireWildcard(_utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**

@@ -108,3 +108,3 @@ * A function that intentionally does nothing.

function doNothing() {}
/**

@@ -120,3 +120,3 @@ * Available options and defaults.

afterAsync: doNothing,
/**

@@ -126,3 +126,3 @@ * Called immediately before removing from the write queue.

afterDequeue: doNothing,
/**

@@ -132,3 +132,3 @@ * Called sync after a stream's first thread release.

afterStreamStart: doNothing,
/**

@@ -138,3 +138,3 @@ * Called after writing buffered document.write calls.

afterWrite: doNothing,
/**

@@ -144,3 +144,3 @@ * Allows disabling the autoFix feature of prescribe

autoFix: true,
/**

@@ -150,3 +150,3 @@ * Called immediately before adding to the write queue.

beforeEnqueue: doNothing,
/**

@@ -160,3 +160,3 @@ * Called before writing a token.

},
/**

@@ -170,3 +170,3 @@ * Called before writing buffered document.write calls.

},
/**

@@ -176,3 +176,3 @@ * Called when evaluation is finished.

done: doNothing,
/**

@@ -186,4 +186,4 @@ * Called when a write results in an error.

},
/**

@@ -194,7 +194,7 @@ * Whether to let scripts w/ async attribute set fall out of the queue.

};
var nextId = 0;
var queue = [];
var active = null;
function nextStream() {

@@ -204,3 +204,3 @@ var args = queue.shift();

var options = utils.last(args);
options.afterDequeue();

@@ -211,3 +211,3 @@ args.stream = runStream.apply(undefined, args);

}
function runStream(el, html, options) {

@@ -217,3 +217,3 @@ active = new

_writeStream2['default'](el, options);
// Identify this stream.

@@ -223,6 +223,6 @@ active.id = nextId++;

postscribe.streams[active.name] = active;
// Override document.write.
var doc = el.ownerDocument;
var stash = {

@@ -234,3 +234,3 @@ close: doc.close,

};
function _write(str) {

@@ -241,3 +241,3 @@ str = options.beforeWrite(str);

}
_extends(doc, {

@@ -250,3 +250,3 @@ close: doNothing,

}
return _write(str.join(''));

@@ -258,10 +258,10 @@ },

}
return _write(str.join('') + '\n');
}
});
// Override window.onerror
var oldOnError = active.win.onerror || doNothing;
// This works together with the try/catch around WriteStream::insertScript

@@ -273,3 +273,3 @@ // In modern browsers, exceptions in tag scripts go directly to top level

};
// Write to the stream

@@ -279,6 +279,6 @@ active.write(html, function () {

_extends(doc, stash);
// restore window.onerror
active.win.onerror = oldOnError;
options.done();

@@ -288,6 +288,6 @@ active = null;

});
return active;
}
function postscribe(el, html, options) {

@@ -302,5 +302,5 @@ if (utils.isFunction(options)) {

}
options = utils.defaults(options, OPTIONS);
// id selector

@@ -312,5 +312,5 @@ if (/^#/.test(el)) {

}
var args = [el, html, options];
el.postscribe = {

@@ -325,13 +325,13 @@ cancel: function cancel() {

};
options.beforeEnqueue(args);
queue.push(args);
if (!active) {
nextStream();
}
return el.postscribe;
}
_extends(postscribe, {

@@ -349,21 +349,21 @@ // Streams by name.

'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _prescribe = __webpack_require__(3);
var _prescribe2 = _interopRequireDefault(_prescribe);
var _utils = __webpack_require__(4);
var utils = _interopRequireWildcard(_utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**

@@ -374,3 +374,3 @@ * Turn on to debug how each chunk affected the DOM.

var DEBUG_CHUNK = false;
/**

@@ -381,3 +381,3 @@ * Prefix for data attributes on DOM elements.

var BASEATTR = 'data-ps-';
/**

@@ -388,3 +388,3 @@ * ID for the style proxy

var PROXY_STYLE = 'ps-style';
/**

@@ -395,3 +395,3 @@ * ID for the script proxy

var PROXY_SCRIPT = 'ps-script';
/**

@@ -406,9 +406,9 @@ * Get data attributes

var attr = BASEATTR + name;
var val = el.getAttribute(attr);
// IE 8 returns a number if it's a number
return !utils.existy(val) ? val : String(val);
}
/**

@@ -423,5 +423,5 @@ * Set data attributes

var value = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var attr = BASEATTR + name;
if (utils.existy(value) && value !== '') {

@@ -433,3 +433,3 @@ el.setAttribute(attr, value);

}
/**

@@ -458,3 +458,3 @@ * Stream static html to an element, where "static html" denotes "html

*/
var WriteStream = function () {

@@ -467,8 +467,8 @@ /**

*/
function WriteStream(root) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, WriteStream);
this.root = root;

@@ -479,19 +479,19 @@ this.options = options;

this.parser = new _prescribe2['default']('', { autoFix: options.autoFix });
// Actual elements by id.
this.actuals = [root];
// Embodies the "structure" of what's been written so far,
// devoid of attributes.
this.proxyHistory = '';
// Create a proxy of the root element.
this.proxyRoot = this.doc.createElement(root.nodeName);
this.scriptStack = [];
this.writeQueue = [];
setData(this.proxyRoot, 'proxyof', 0);
}
/**

@@ -502,9 +502,9 @@ * Writes the given strings.

*/
WriteStream.prototype.write = function write() {
var _writeQueue;
(_writeQueue = this.writeQueue).push.apply(_writeQueue, arguments);
// Process writes

@@ -515,3 +515,3 @@ // When new script gets pushed or pending this will stop

var arg = this.writeQueue.shift();
if (utils.isFunction(arg)) {

@@ -524,3 +524,3 @@ this._callFunction(arg);

};
/**

@@ -532,4 +532,4 @@ * Calls the given function.

*/
WriteStream.prototype._callFunction = function _callFunction(fn) {

@@ -541,3 +541,3 @@ var tok = { type: 'function', value: fn.name || fn.toString() };

};
/**

@@ -549,7 +549,7 @@ * The write implementation

*/
WriteStream.prototype._writeImpl = function _writeImpl(html) {
this.parser.append(html);
var tok = void 0;

@@ -559,7 +559,7 @@ var script = void 0;

var tokens = [];
// stop if we see a script token
while ((tok = this.parser.readToken()) && !(script = utils.isScript(tok)) && !(style = utils.isStyle(tok))) {
tok = this.options.beforeWriteToken(tok);
if (tok) {

@@ -569,11 +569,11 @@ tokens.push(tok);

}
if (tokens.length > 0) {
this._writeStaticTokens(tokens);
}
if (script) {
this._handleScriptToken(tok);
}
if (style) {

@@ -583,3 +583,3 @@ this._handleStyleToken(tok);

};
/**

@@ -592,7 +592,7 @@ * Write a contiguous non-script tokens (a chunk)

*/
WriteStream.prototype._writeStaticTokens = function _writeStaticTokens(tokens) {
var chunk = this._buildChunk(tokens);
if (!chunk.actual) {

@@ -602,20 +602,20 @@ // e.g., no tokens, or a noscript that got ignored

}
chunk.html = this.proxyHistory + chunk.actual;
this.proxyHistory += chunk.proxy;
this.proxyRoot.innerHTML = chunk.html;
if (DEBUG_CHUNK) {
chunk.proxyInnerHTML = this.proxyRoot.innerHTML;
}
this._walkChunk();
if (DEBUG_CHUNK) {
chunk.actualInnerHTML = this.root.innerHTML;
}
return chunk;
};
/**

@@ -628,16 +628,16 @@ * Build a chunk.

*/
WriteStream.prototype._buildChunk = function _buildChunk(tokens) {
var nextId = this.actuals.length;
// The raw html of this chunk.
var raw = [];
// The html to create the nodes in the tokens (with id's injected).
var actual = [];
// Html that can later be used to proxy the nodes in the tokens.
var proxy = [];
var len = tokens.length;

@@ -647,5 +647,5 @@ for (var i = 0; i < len; i++) {

var tokenRaw = tok.toString();
raw.push(tokenRaw);
if (tok.attrs) {

@@ -656,6 +656,6 @@ // tok.attrs <==> startTag or atomicTag or cursor

var id = nextId++;
// Actual: inject id attribute: replace '>' at end of start tag with id attribute + '>'
actual.push(tokenRaw.replace(/(\/?>)/, ' ' + BASEATTR + 'id=' + id + ' $1'));
// Don't proxy scripts: they have no bearing on DOM structure.

@@ -673,3 +673,3 @@ if (tok.attrs.id !== PROXY_SCRIPT && tok.attrs.id !== PROXY_STYLE) {

actual.push(tokenRaw);
// Proxy: append endTags. Ignore everything else.

@@ -679,3 +679,3 @@ proxy.push(tok.type === 'endTag' ? tokenRaw : '');

}
return {

@@ -688,3 +688,3 @@ tokens: tokens,

};
/**

@@ -695,14 +695,14 @@ * Walk the chunks.

*/
WriteStream.prototype._walkChunk = function _walkChunk() {
var node = void 0;
var stack = [this.proxyRoot];
// use shift/unshift so that children are walked in document order
while (utils.existy(node = stack.shift())) {
var isElement = node.nodeType === 1;
var isProxy = isElement && getData(node, 'proxyof');
// Ignore proxies

@@ -715,3 +715,3 @@ if (!isProxy) {

}
// Is node's parent a proxy?

@@ -724,3 +724,3 @@ var parentIsProxyOf = node.parentNode && getData(node.parentNode, 'proxyof');

}
// prepend childNodes to stack

@@ -730,3 +730,3 @@ stack.unshift.apply(stack, utils.toArray(node.childNodes));

};
/**

@@ -737,9 +737,9 @@ * Handles Script tokens

*/
WriteStream.prototype._handleScriptToken = function _handleScriptToken(tok) {
var _this = this;
var remainder = this.parser.clear();
if (remainder) {

@@ -749,5 +749,5 @@ // Write remainder immediately behind this script.

}
tok.src = tok.attrs.src || tok.attrs.SRC;
tok = this.options.beforeWriteToken(tok);

@@ -758,3 +758,3 @@ if (!tok) {

}
if (tok.src && this.scriptStack.length) {

@@ -768,3 +768,3 @@ // Defer this script until scriptStack is empty.

}
// Put the script node in the DOM.

@@ -775,3 +775,3 @@ this._writeScriptToken(tok, function () {

};
/**

@@ -782,7 +782,7 @@ * Handles style tokens

*/
WriteStream.prototype._handleStyleToken = function _handleStyleToken(tok) {
var remainder = this.parser.clear();
if (remainder) {

@@ -792,7 +792,7 @@ // Write remainder immediately behind this style.

}
tok.type = tok.attrs.type || tok.attrs.TYPE || 'text/css';
tok = this.options.beforeWriteToken(tok);
if (tok) {

@@ -802,3 +802,3 @@ // Put the style node in the DOM.

}
if (remainder) {

@@ -808,3 +808,3 @@ this.write();

};
/**

@@ -815,9 +815,9 @@ * Build a style and insert it into the DOM.

*/
WriteStream.prototype._writeStyleToken = function _writeStyleToken(tok) {
var el = this._buildStyle(tok);
this._insertStyle(el);
this._insertCursor(el, PROXY_STYLE);
// Set content

@@ -832,3 +832,3 @@ if (tok.content) {

};
/**

@@ -840,9 +840,9 @@ * Build a style element from an atomic style token.

*/
WriteStream.prototype._buildStyle = function _buildStyle(tok) {
var el = this.doc.createElement(tok.tagName);
el.setAttribute('type', tok.type);
// Set attributes

@@ -852,33 +852,20 @@ utils.eachKey(tok.attrs, function (name, value) {

});
return el;
};
/**
* Append a span to the stream. That span will act as a cursor
* (i.e. insertion point) for the style.
* (i.e. insertion point) for the element.
*
* @param {String} id The ID of the span.
* @private
*/
WriteStream.prototype._insertSpan = function _insertSpan(id) {
this._writeImpl('<span id="' + id + '"/>');
// Grab that span from the DOM.
return this.doc.getElementById(id);
};
/**
* Insert style into DOM where it would naturally be written.
*
* @param {Object} el The element
* @param {string} which The type of proxy element
*/
WriteStream.prototype._insertStyle = function _insertStyle(el) {
var cursor = this._insertSpan(PROXY_STYLE);
// Replace cursor with style.
WriteStream.prototype._insertCursor = function _insertCursor(el, which) {
this._writeImpl('<span id="' + which + '"/>');
var cursor = this.doc.getElementById(which);
if (cursor) {

@@ -888,20 +875,4 @@ cursor.parentNode.replaceChild(el, cursor);

};
/**
* Insert script into DOM where it would naturally be written.
*
* @param {Object} el The element
*/
WriteStream.prototype._insertScript = function _insertScript(el) {
var cursor = this._insertSpan(PROXY_SCRIPT);
// Replace cursor with script.
if (cursor) {
cursor.parentNode.replaceChild(el, cursor);
}
};
/**
* Called when a script is started.

@@ -912,4 +883,4 @@ *

*/
WriteStream.prototype._onScriptStart = function _onScriptStart(tok) {

@@ -920,3 +891,3 @@ tok.outerWrites = this.writeQueue;

};
/**

@@ -928,4 +899,4 @@ * Called when a script is done.

*/
WriteStream.prototype._onScriptDone = function _onScriptDone(tok) {

@@ -937,10 +908,10 @@ // Pop script and check nesting.

}
this.scriptStack.shift();
// Append outer writes to queue and process them.
this.write.apply(this, tok.outerWrites);
// Check for pending remote
// Assumption 2: if remote_script1 writes remote_script2 then

@@ -954,3 +925,3 @@ // the we notice remote_script1 finishes before remote_script2 starts.

};
/**

@@ -963,4 +934,4 @@ * Build a script and insert it into the DOM.

*/
WriteStream.prototype._writeScriptToken = function _writeScriptToken(tok, done) {

@@ -970,3 +941,3 @@ var el = this._buildScript(tok);

var afterAsync = this.options.afterAsync;
if (tok.src) {

@@ -980,5 +951,5 @@ // Fix for attribute "SRC" (capitalized). IE does not recognize it.

}
try {
this._insertScript(el);
this._insertCursor(el, PROXY_SCRIPT);
if (!el.src || asyncRelease) {

@@ -992,3 +963,3 @@ done();

};
/**

@@ -1000,7 +971,7 @@ * Build a script element from an atomic script token.

*/
WriteStream.prototype._buildScript = function _buildScript(tok) {
var el = this.doc.createElement(tok.tagName);
// Set attributes

@@ -1010,3 +981,3 @@ utils.eachKey(tok.attrs, function (name, value) {

});
// Set content

@@ -1016,6 +987,6 @@ if (tok.content) {

}
return el;
};
/**

@@ -1028,4 +999,4 @@ * Setup the script load handler on an element.

*/
WriteStream.prototype._scriptLoadHandler = function _scriptLoadHandler(el, done) {

@@ -1035,5 +1006,5 @@ function cleanup() {

}
var error = this.options.error;
function success() {

@@ -1043,3 +1014,3 @@ cleanup();

}
function failure(err) {

@@ -1050,3 +1021,3 @@ cleanup();

}
// Set handlers

@@ -1057,3 +1028,3 @@ _extends(el, {

},
onreadystatechange: function onreadystatechange() {

@@ -1064,3 +1035,3 @@ if (/^(loaded|complete)$/.test(el.readyState)) {

},
onerror: function onerror() {

@@ -1071,3 +1042,3 @@ return failure({ message: 'remote script failed ' + el.src });

};
/**

@@ -1080,4 +1051,4 @@ * Determines whether to release.

*/
WriteStream.prototype._shouldRelease = function _shouldRelease(el) {

@@ -1087,6 +1058,6 @@ var isScript = /^script$/i.test(el.nodeName);

};
return WriteStream;
}();
exports['default'] = WriteStream;

@@ -1120,10 +1091,10 @@

/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)

@@ -1135,23 +1106,23 @@ /******/ var module = installedModules[moduleId] = {

/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports

@@ -1164,41 +1135,41 @@ /******/ return __webpack_require__(0);

/***/ function(module, exports, __webpack_require__) {
'use strict';
var _HtmlParser = __webpack_require__(1);
var _HtmlParser2 = _interopRequireDefault(_HtmlParser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
module.exports = _HtmlParser2['default'];
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _supports = __webpack_require__(2);
var supports = _interopRequireWildcard(_supports);
var _streamReaders = __webpack_require__(3);
var streamReaders = _interopRequireWildcard(_streamReaders);
var _fixedReadTokenFactory = __webpack_require__(6);
var _fixedReadTokenFactory2 = _interopRequireDefault(_fixedReadTokenFactory);
var _utils = __webpack_require__(5);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**

@@ -1209,3 +1180,3 @@ * Detection regular expressions.

* succeed if detection of previous didn't
* @type {Object}

@@ -1220,3 +1191,3 @@ */

};
/**

@@ -1226,3 +1197,3 @@ * HtmlParser provides the capability to parse HTML and return tokens

*/
var HtmlParser = function () {

@@ -1236,16 +1207,16 @@ /**

*/
function HtmlParser() {
var _this = this;
var stream = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, HtmlParser);
this.stream = stream;
var fix = false;
var fixedTokenOptions = {};
for (var key in supports) {

@@ -1259,3 +1230,3 @@ if (supports.hasOwnProperty(key)) {

}
if (fix) {

@@ -1267,3 +1238,3 @@ this._fixedReadToken = (0, _fixedReadTokenFactory2['default'])(this, fixedTokenOptions, function () {

}
/**

@@ -1274,8 +1245,8 @@ * Appends the given string to the parse stream.

*/
HtmlParser.prototype.append = function append(str) {
this.stream += str;
};
/**

@@ -1286,8 +1257,8 @@ * Prepends the given string to the parse stream.

*/
HtmlParser.prototype.prepend = function prepend(str) {
this.stream = str + this.stream;
};
/**

@@ -1299,4 +1270,4 @@ * The implementation of the token reading.

*/
HtmlParser.prototype._readTokenImpl = function _readTokenImpl() {

@@ -1317,3 +1288,3 @@ // Enumerate detects in order

};
/**

@@ -1326,4 +1297,4 @@ * The public token reading interface. Delegates to the basic token reading

*/
HtmlParser.prototype.readToken = function readToken() {

@@ -1336,3 +1307,3 @@ if (this._fixedReadToken) {

};
/**

@@ -1343,4 +1314,4 @@ * Read tokens and hand to the given handlers.

*/
HtmlParser.prototype.readTokens = function readTokens(handlers) {

@@ -1355,3 +1326,3 @@ var tok = void 0;

};
/**

@@ -1362,4 +1333,4 @@ * Clears the parse stream.

*/
HtmlParser.prototype.clear = function clear() {

@@ -1370,3 +1341,3 @@ var rest = this.stream;

};
/**

@@ -1377,21 +1348,21 @@ * Returns the rest of the parse stream.

*/
HtmlParser.prototype.rest = function rest() {
return this.stream;
};
return HtmlParser;
}();
exports['default'] = HtmlParser;
HtmlParser.tokenToString = function (tok) {
return tok.toString();
};
HtmlParser.escapeAttributes = function (attrs) {
var escapedAttrs = {};
for (var name in attrs) {

@@ -1402,8 +1373,8 @@ if (attrs.hasOwnProperty(name)) {

}
return escapedAttrs;
};
HtmlParser.supports = supports;
for (var key in supports) {

@@ -1414,15 +1385,15 @@ if (supports.hasOwnProperty(key)) {

}
/***/ },
/* 2 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var tagSoup = false;
var selfClose = false;
var work = window.document.createElement('div');
try {

@@ -1435,3 +1406,3 @@ var html = '<P><I></P></I>';

}
try {

@@ -1443,18 +1414,18 @@ work.innerHTML = '<P><i><P></P></i></P>';

}
work = null;
exports.tagSoup = tagSoup;
exports.selfClose = selfClose;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
exports.comment = comment;

@@ -1465,5 +1436,5 @@ exports.chars = chars;

exports.endTag = endTag;
var _tokens = __webpack_require__(4);
/**

@@ -1480,3 +1451,3 @@ * Regular Expressions for parsing tags and attributes

};
/**

@@ -1494,3 +1465,3 @@ * Reads a comment token

}
/**

@@ -1506,3 +1477,3 @@ * Reads non-tag characters.

}
/**

@@ -1523,3 +1494,3 @@ * Reads start tag token.

var rest = match[2];
match[2].replace(REGEXES.attr, function (match, name) {

@@ -1534,6 +1505,6 @@ if (!(arguments[2] || arguments[3] || arguments[4] || arguments[5])) {

}
rest = rest.replace(match, '');
});
return {

@@ -1543,3 +1514,3 @@ v: new _tokens.StartTagToken(match[1], match[0].length, attrs, booleanAttrs, !!match[3], rest.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''))

}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;

@@ -1549,3 +1520,3 @@ }

}
/**

@@ -1571,3 +1542,3 @@ * Reads atomic tag token.

}
/**

@@ -1585,16 +1556,16 @@ * Reads an end tag token.

}
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.EndTagToken = exports.AtomicTagToken = exports.StartTagToken = exports.TagToken = exports.CharsToken = exports.CommentToken = exports.Token = undefined;
var _utils = __webpack_require__(5);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**

@@ -1604,3 +1575,3 @@ * Token is a base class for all token types parsed. Note we don't actually

*/
var Token =

@@ -1615,3 +1586,3 @@ /**

_classCallCheck(this, Token);
this.type = type;

@@ -1621,8 +1592,8 @@ this.length = length;

};
/**
* CommentToken represents comment tags.
*/
var CommentToken = exports.CommentToken = function () {

@@ -1635,6 +1606,6 @@ /**

*/
function CommentToken(content, length) {
_classCallCheck(this, CommentToken);
this.type = 'comment';

@@ -1645,15 +1616,15 @@ this.length = length || (content ? content.length : 0);

}
CommentToken.prototype.toString = function toString() {
return '<!--' + this.content;
};
return CommentToken;
}();
/**
* CharsToken represents non-tag characters.
*/
var CharsToken = exports.CharsToken = function () {

@@ -1665,6 +1636,6 @@ /**

*/
function CharsToken(length) {
_classCallCheck(this, CharsToken);
this.type = 'chars';

@@ -1674,15 +1645,15 @@ this.length = length;

}
CharsToken.prototype.toString = function toString() {
return this.text;
};
return CharsToken;
}();
/**
* TagToken is a base class for all tag-based Tokens.
*/
var TagToken = exports.TagToken = function () {

@@ -1699,6 +1670,6 @@ /**

*/
function TagToken(type, tagName, length, attrs, booleanAttrs) {
_classCallCheck(this, TagToken);
this.type = type;

@@ -1713,3 +1684,3 @@ this.length = length;

}
/**

@@ -1722,7 +1693,7 @@ * Formats the given token tag.

*/
TagToken.formatTag = function formatTag(tok) {
var content = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var str = '<' + tok.tagName;

@@ -1732,3 +1703,3 @@ for (var key in tok.attrs) {

str += ' ' + key;
var val = tok.attrs[key];

@@ -1740,7 +1711,7 @@ if (typeof tok.booleanAttrs === 'undefined' || typeof tok.booleanAttrs[key] === 'undefined') {

}
if (tok.rest) {
str += ' ' + tok.rest;
}
if (tok.unary && !tok.html5Unary) {

@@ -1751,18 +1722,18 @@ str += '/>';

}
if (content !== undefined && content !== null) {
str += content + '</' + tok.tagName + '>';
}
return str;
};
return TagToken;
}();
/**
* StartTagToken represents a start token.
*/
var StartTagToken = exports.StartTagToken = function () {

@@ -1780,6 +1751,6 @@ /**

*/
function StartTagToken(tagName, length, attrs, booleanAttrs, unary, rest) {
_classCallCheck(this, StartTagToken);
this.type = 'startTag';

@@ -1795,15 +1766,15 @@ this.length = length;

}
StartTagToken.prototype.toString = function toString() {
return TagToken.formatTag(this);
};
return StartTagToken;
}();
/**
* AtomicTagToken represents an atomic tag.
*/
var AtomicTagToken = exports.AtomicTagToken = function () {

@@ -1820,6 +1791,6 @@ /**

*/
function AtomicTagToken(tagName, length, attrs, booleanAttrs, content) {
_classCallCheck(this, AtomicTagToken);
this.type = 'atomicTag';

@@ -1835,15 +1806,15 @@ this.length = length;

}
AtomicTagToken.prototype.toString = function toString() {
return TagToken.formatTag(this, this.content);
};
return AtomicTagToken;
}();
/**
* EndTagToken represents an end tag.
*/
var EndTagToken = exports.EndTagToken = function () {

@@ -1856,6 +1827,6 @@ /**

*/
function EndTagToken(tagName, length) {
_classCallCheck(this, EndTagToken);
this.type = 'endTag';

@@ -1866,19 +1837,19 @@ this.length = length;

}
EndTagToken.prototype.toString = function toString() {
return '</' + this.tagName + '>';
};
return EndTagToken;
}();
/***/ },
/* 5 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.escapeQuotes = escapeQuotes;
/**

@@ -1893,3 +1864,3 @@ * Escape quotes in the given value.

var defaultValue = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];
// There's no lookback in JS, so /(^|[^\\])"/ only matches the first of two `"`s.

@@ -1902,9 +1873,9 @@ // Instead, just match anything before a double-quote and escape if it's not already escaped.

}
/***/ },
/* 6 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;

@@ -1918,3 +1889,3 @@ exports['default'] = fixedReadTokenFactory;

var EMPTY = /^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i;
/**

@@ -1926,3 +1897,3 @@ * Elements that you can intentionally leave open (and which close themselves)

var CLOSESELF = /^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i;
/**

@@ -1941,3 +1912,3 @@ * Corrects a token.

}
/**

@@ -1956,3 +1927,3 @@ * Peeks at the next token in the parser.

}
/**

@@ -1966,7 +1937,7 @@ * Closes the last token.

var tok = stack.pop();
// prepend close tag to stream.
parser.prepend('</' + tok.tagName + '>');
}
/**

@@ -1979,7 +1950,7 @@ * Create a new token stack.

var stack = [];
stack.last = function () {
return this[this.length - 1];
};
stack.lastTagNameEq = function (tagName) {

@@ -1989,3 +1960,3 @@ var last = this.last();

};
stack.containsTagName = function (tagName) {

@@ -1999,6 +1970,6 @@ for (var i = 0, tok; tok = this[i]; i++) {

};
return stack;
}
/**

@@ -2016,7 +1987,7 @@ * Return a readToken implementation that fixes input.

var stack = newStack();
var handlers = {
startTag: function startTag(tok) {
var tagName = tok.tagName;
if (tagName.toUpperCase() === 'TR' && stack.lastTagNameEq('TABLE')) {

@@ -2052,3 +2023,3 @@ parser.prepend('<TBODY>');

};
function prepareNextToken() {

@@ -2060,3 +2031,3 @@ var tok = peekToken(parser, readTokenImpl);

}
return function fixedReadToken() {

@@ -2067,3 +2038,3 @@ prepareNextToken();

}
/***/ }

@@ -2079,7 +2050,7 @@ /******/ ])

'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
exports.existy = existy;

@@ -2104,3 +2075,3 @@ exports.isFunction = isFunction;

}
/**

@@ -2115,3 +2086,3 @@ * Is this a function?

}
/**

@@ -2131,3 +2102,3 @@ * Loop over each item in an array-like value.

}
/**

@@ -2147,3 +2118,3 @@ * Loop over each key/value pair in a hash.

}
/**

@@ -2165,3 +2136,3 @@ * Set default options where some option was not specified.

}
/**

@@ -2186,7 +2157,7 @@ * Convert value (e.g., a NodeList) to an array.

}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
}
/**

@@ -2201,3 +2172,3 @@ * Get the last item in an array

}
/**

@@ -2213,3 +2184,3 @@ * Test if token is a script tag.

}
/**

@@ -2224,3 +2195,3 @@ * Test if token is a script tag.

}
/**

@@ -2239,2 +2210,3 @@ * Test if token is a style tag.

});
;
;
//# sourceMappingURL=postscribe.js.map
/**
* @file postscribe
* @description Asynchronously write javascript, even with document.write.
* @version v2.0.4
* @version v2.0.5
* @see {@link https://krux.github.io/postscribe}

@@ -10,2 +10,2 @@ * @license MIT

*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.postscribe=e():t.postscribe=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var o=n(1),i=r(o);t.exports=i["default"]},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}function i(){}function a(){var t=m.shift();if(t){var e=h.last(t);e.afterDequeue(),t.stream=s.apply(void 0,t),e.afterStreamStart()}}function s(t,e,n){function r(t){t=n.beforeWrite(t),g.write(t),n.afterWrite(t)}g=new p["default"](t,n),g.id=y++,g.name=n.name||g.id,u.streams[g.name]=g;var o=t.ownerDocument,s={close:o.close,open:o.open,write:o.write,writeln:o.writeln};c(o,{close:i,open:i,write:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return r(e.join(""))},writeln:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return r(e.join("")+"\n")}});var f=g.win.onerror||i;return g.win.onerror=function(t,e,r){n.error({msg:t+" - "+e+": "+r}),f.apply(g.win,[t,e,r])},g.write(e,function(){c(o,s),g.win.onerror=f,n.done(),g=null,a()}),g}function u(t,e,n){if(h.isFunction(n))n={done:n};else if("clear"===n)return m=[],g=null,void(y=0);n=h.defaults(n,d),t=/^#/.test(t)?window.document.getElementById(t.substr(1)):t.jquery?t[0]:t;var r=[t,e,n];return t.postscribe={cancel:function(){r.stream?r.stream.abort():r[1]=i}},n.beforeEnqueue(r),m.push(r),g||a(),t.postscribe}e.__esModule=!0;var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e["default"]=u;var f=n(2),p=o(f),l=n(4),h=r(l),d={afterAsync:i,afterDequeue:i,afterStreamStart:i,afterWrite:i,autoFix:!0,beforeEnqueue:i,beforeWriteToken:function(t){return t},beforeWrite:function(t){return t},done:i,error:function(t){throw t},releaseAsync:!1},y=0,m=[],g=null;c(u,{streams:{},queue:m,WriteStream:p["default"]})},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){var n=d+e,r=t.getAttribute(n);return l.existy(r)?String(r):r}function s(t,e){var n=arguments.length<=2||void 0===arguments[2]?null:arguments[2],r=d+e;l.existy(n)&&""!==n?t.setAttribute(r,n):t.removeAttribute(r)}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=n(3),f=o(c),p=n(4),l=r(p),h=!1,d="data-ps-",y="ps-style",m="ps-script",g=function(){function t(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];i(this,t),this.root=e,this.options=n,this.doc=e.ownerDocument,this.win=this.doc.defaultView||this.doc.parentWindow,this.parser=new f["default"]("",{autoFix:n.autoFix}),this.actuals=[e],this.proxyHistory="",this.proxyRoot=this.doc.createElement(e.nodeName),this.scriptStack=[],this.writeQueue=[],s(this.proxyRoot,"proxyof",0)}return t.prototype.write=function(){var t;for((t=this.writeQueue).push.apply(t,arguments);!this.deferredRemote&&this.writeQueue.length;){var e=this.writeQueue.shift();l.isFunction(e)?this._callFunction(e):this._writeImpl(e)}},t.prototype._callFunction=function(t){var e={type:"function",value:t.name||t.toString()};this._onScriptStart(e),t.call(this.win,this.doc),this._onScriptDone(e)},t.prototype._writeImpl=function(t){this.parser.append(t);for(var e=void 0,n=void 0,r=void 0,o=[];(e=this.parser.readToken())&&!(n=l.isScript(e))&&!(r=l.isStyle(e));)e=this.options.beforeWriteToken(e),e&&o.push(e);o.length>0&&this._writeStaticTokens(o),n&&this._handleScriptToken(e),r&&this._handleStyleToken(e)},t.prototype._writeStaticTokens=function(t){var e=this._buildChunk(t);return e.actual?(e.html=this.proxyHistory+e.actual,this.proxyHistory+=e.proxy,this.proxyRoot.innerHTML=e.html,h&&(e.proxyInnerHTML=this.proxyRoot.innerHTML),this._walkChunk(),h&&(e.actualInnerHTML=this.root.innerHTML),e):null},t.prototype._buildChunk=function(t){for(var e=this.actuals.length,n=[],r=[],o=[],i=t.length,a=0;i>a;a++){var s=t[a],u=s.toString();if(n.push(u),s.attrs){if(!/^noscript$/i.test(s.tagName)){var c=e++;r.push(u.replace(/(\/?>)/," "+d+"id="+c+" $1")),s.attrs.id!==m&&s.attrs.id!==y&&o.push("atomicTag"===s.type?"":"<"+s.tagName+" "+d+"proxyof="+c+(s.unary?" />":">"))}}else r.push(u),o.push("endTag"===s.type?u:"")}return{tokens:t,raw:n.join(""),actual:r.join(""),proxy:o.join("")}},t.prototype._walkChunk=function(){for(var t=void 0,e=[this.proxyRoot];l.existy(t=e.shift());){var n=1===t.nodeType,r=n&&a(t,"proxyof");if(!r){n&&(this.actuals[a(t,"id")]=t,s(t,"id"));var o=t.parentNode&&a(t.parentNode,"proxyof");o&&this.actuals[o].appendChild(t)}e.unshift.apply(e,l.toArray(t.childNodes))}},t.prototype._handleScriptToken=function(t){var e=this,n=this.parser.clear();n&&this.writeQueue.unshift(n),t.src=t.attrs.src||t.attrs.SRC,t=this.options.beforeWriteToken(t),t&&(t.src&&this.scriptStack.length?this.deferredRemote=t:this._onScriptStart(t),this._writeScriptToken(t,function(){e._onScriptDone(t)}))},t.prototype._handleStyleToken=function(t){var e=this.parser.clear();e&&this.writeQueue.unshift(e),t.type=t.attrs.type||t.attrs.TYPE||"text/css",t=this.options.beforeWriteToken(t),t&&this._writeStyleToken(t),e&&this.write()},t.prototype._writeStyleToken=function(t){var e=this._buildStyle(t);this._insertStyle(e),t.content&&(e.styleSheet&&!e.sheet?e.styleSheet.cssText=t.content:e.appendChild(this.doc.createTextNode(t.content)))},t.prototype._buildStyle=function(t){var e=this.doc.createElement(t.tagName);return e.setAttribute("type",t.type),l.eachKey(t.attrs,function(t,n){e.setAttribute(t,n)}),e},t.prototype._insertSpan=function(t){return this._writeImpl('<span id="'+t+'"/>'),this.doc.getElementById(t)},t.prototype._insertStyle=function(t){var e=this._insertSpan(y);e&&e.parentNode.replaceChild(t,e)},t.prototype._insertScript=function(t){var e=this._insertSpan(m);e&&e.parentNode.replaceChild(t,e)},t.prototype._onScriptStart=function(t){t.outerWrites=this.writeQueue,this.writeQueue=[],this.scriptStack.unshift(t)},t.prototype._onScriptDone=function(t){return t!==this.scriptStack[0]?void this.options.error({message:"Bad script nesting or script finished twice"}):(this.scriptStack.shift(),this.write.apply(this,t.outerWrites),void(!this.scriptStack.length&&this.deferredRemote&&(this._onScriptStart(this.deferredRemote),this.deferredRemote=null)))},t.prototype._writeScriptToken=function(t,e){var n=this._buildScript(t),r=this._shouldRelease(n),o=this.options.afterAsync;t.src&&(n.src=t.src,this._scriptLoadHandler(n,r?o:function(){e(),o()}));try{this._insertScript(n),n.src&&!r||e()}catch(i){this.options.error(i),e()}},t.prototype._buildScript=function(t){var e=this.doc.createElement(t.tagName);return l.eachKey(t.attrs,function(t,n){e.setAttribute(t,n)}),t.content&&(e.text=t.content),e},t.prototype._scriptLoadHandler=function(t,e){function n(){t=t.onload=t.onreadystatechange=t.onerror=null}function r(){n(),e()}function o(t){n(),i(t),e()}var i=this.options.error;u(t,{onload:function(){return r()},onreadystatechange:function(){/^(loaded|complete)$/.test(t.readyState)&&r()},onerror:function(){return o({message:"remote script failed "+t.src})}})},t.prototype._shouldRelease=function(t){var e=/^script$/i.test(t.nodeName);return!e||!!(this.options.releaseAsync&&t.src&&t.hasAttribute("async"))},t}();e["default"]=g},function(t,e,n){!function(e,n){t.exports=n()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var o=n(1),i=r(o);t.exports=i["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var a=n(2),s=o(a),u=n(3),c=o(u),f=n(6),p=r(f),l=n(5),h={comment:/^<!--/,endTag:/^<\//,atomicTag:/^<\s*(script|style|noscript|iframe|textarea)[\s\/>]/i,startTag:/^</,chars:/^[^<]/},d=function(){function t(){var e=this,n=arguments.length<=0||void 0===arguments[0]?"":arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];i(this,t),this.stream=n;var o=!1,a={};for(var u in s)s.hasOwnProperty(u)&&(r.autoFix&&(a[u+"Fix"]=!0),o=o||a[u+"Fix"]);o&&(this._fixedReadToken=(0,p["default"])(this,a,function(){return e._readTokenImpl()}))}return t.prototype.append=function(t){this.stream+=t},t.prototype.prepend=function(t){this.stream=t+this.stream},t.prototype._readTokenImpl=function(){for(var t in h)if(h.hasOwnProperty(t)&&h[t].test(this.stream)){var e=c[t](this.stream);if(e)return e.text=this.stream.substr(0,e.length),this.stream=this.stream.slice(e.length),e}},t.prototype.readToken=function(){return this._fixedReadToken?this._fixedReadToken():this._readTokenImpl()},t.prototype.readTokens=function(t){for(var e=void 0;e=this.readToken();)if(t[e.type]&&t[e.type](e)===!1)return},t.prototype.clear=function(){var t=this.stream;return this.stream="",t},t.prototype.rest=function(){return this.stream},t}();e["default"]=d,d.tokenToString=function(t){return t.toString()},d.escapeAttributes=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=(0,l.escapeQuotes)(t[n],null));return e},d.supports=s;for(var y in s)s.hasOwnProperty(y)&&(d.browserHasFlaw=d.browserHasFlaw||!s[y]&&y)},function(t,e){"use strict";e.__esModule=!0;var n=!1,r=!1,o=window.document.createElement("div");try{var i="<P><I></P></I>";o.innerHTML=i,e.tagSoup=n=o.innerHTML!==i}catch(a){e.tagSoup=n=!1}try{o.innerHTML="<P><i><P></P></i></P>",e.selfClose=r=2===o.childNodes.length}catch(a){e.selfClose=r=!1}o=null,e.tagSoup=n,e.selfClose=r},function(t,e,n){"use strict";function r(t){var e=t.indexOf("-->");return e>=0?new c.CommentToken(t.substr(4,e-1),e+3):void 0}function o(t){var e=t.indexOf("<");return new c.CharsToken(e>=0?e:t.length)}function i(t){var e=t.indexOf(">");if(-1!==e){var n=t.match(f.startTag);if(n){var r=function(){var t={},e={},r=n[2];return n[2].replace(f.attr,function(n,o){arguments[2]||arguments[3]||arguments[4]||arguments[5]?arguments[5]?(t[arguments[5]]="",e[arguments[5]]=!0):t[o]=arguments[2]||arguments[3]||arguments[4]||f.fillAttr.test(o)&&o||"":t[o]="",r=r.replace(n,"")}),{v:new c.StartTagToken(n[1],n[0].length,t,e,!!n[3],r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))}}();if("object"===("undefined"==typeof r?"undefined":u(r)))return r.v}}}function a(t){var e=i(t);if(e){var n=t.slice(e.length);if(n.match(new RegExp("</\\s*"+e.tagName+"\\s*>","i"))){var r=n.match(new RegExp("([\\s\\S]*?)</\\s*"+e.tagName+"\\s*>","i"));if(r)return new c.AtomicTagToken(e.tagName,r[0].length+e.length,e.attrs,e.booleanAttrs,r[1])}}}function s(t){var e=t.match(f.endTag);return e?new c.EndTagToken(e[1],e[0].length):void 0}e.__esModule=!0;var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};e.comment=r,e.chars=o,e.startTag=i,e.atomicTag=a,e.endTag=s;var c=n(4),f={startTag:/^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,endTag:/^<\/([\-A-Za-z0-9_]+)[^>]*>/,attr:/(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g,fillAttr:/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0,e.EndTagToken=e.AtomicTagToken=e.StartTagToken=e.TagToken=e.CharsToken=e.CommentToken=e.Token=void 0;var o=n(5),i=(e.Token=function a(t,e){r(this,a),this.type=t,this.length=e,this.text=""},e.CommentToken=function(){function t(e,n){r(this,t),this.type="comment",this.length=n||(e?e.length:0),this.text="",this.content=e}return t.prototype.toString=function(){return"<!--"+this.content},t}(),e.CharsToken=function(){function t(e){r(this,t),this.type="chars",this.length=e,this.text=""}return t.prototype.toString=function(){return this.text},t}(),e.TagToken=function(){function t(e,n,o,i,a){r(this,t),this.type=e,this.length=o,this.text="",this.tagName=n,this.attrs=i,this.booleanAttrs=a,this.unary=!1,this.html5Unary=!1}return t.formatTag=function(t){var e=arguments.length<=1||void 0===arguments[1]?null:arguments[1],n="<"+t.tagName;for(var r in t.attrs)if(t.attrs.hasOwnProperty(r)){n+=" "+r;var i=t.attrs[r];"undefined"!=typeof t.booleanAttrs&&"undefined"!=typeof t.booleanAttrs[r]||(n+='="'+(0,o.escapeQuotes)(i)+'"')}return t.rest&&(n+=" "+t.rest),n+=t.unary&&!t.html5Unary?"/>":">",void 0!==e&&null!==e&&(n+=e+"</"+t.tagName+">"),n},t}());e.StartTagToken=function(){function t(e,n,o,i,a,s){r(this,t),this.type="startTag",this.length=n,this.text="",this.tagName=e,this.attrs=o,this.booleanAttrs=i,this.html5Unary=!1,this.unary=a,this.rest=s}return t.prototype.toString=function(){return i.formatTag(this)},t}(),e.AtomicTagToken=function(){function t(e,n,o,i,a){r(this,t),this.type="atomicTag",this.length=n,this.text="",this.tagName=e,this.attrs=o,this.booleanAttrs=i,this.unary=!1,this.html5Unary=!1,this.content=a}return t.prototype.toString=function(){return i.formatTag(this,this.content)},t}(),e.EndTagToken=function(){function t(e,n){r(this,t),this.type="endTag",this.length=n,this.text="",this.tagName=e}return t.prototype.toString=function(){return"</"+this.tagName+">"},t}()},function(t,e){"use strict";function n(t){var e=arguments.length<=1||void 0===arguments[1]?"":arguments[1];return t?t.replace(/([^"]*)"/g,function(t,e){return/\\/.test(e)?e+'"':e+'\\"'}):e}e.__esModule=!0,e.escapeQuotes=n},function(t,e){"use strict";function n(t){return t&&"startTag"===t.type&&(t.unary=s.test(t.tagName)||t.unary,t.html5Unary=!/\/>$/.test(t.text)),t}function r(t,e){var r=t.stream,o=n(e());return t.stream=r,o}function o(t,e){var n=e.pop();t.prepend("</"+n.tagName+">")}function i(){var t=[];return t.last=function(){return this[this.length-1]},t.lastTagNameEq=function(t){var e=this.last();return e&&e.tagName&&e.tagName.toUpperCase()===t.toUpperCase()},t.containsTagName=function(t){for(var e,n=0;e=this[n];n++)if(e.tagName===t)return!0;return!1},t}function a(t,e,a){function s(){var e=r(t,a);e&&f[e.type]&&f[e.type](e)}var c=i(),f={startTag:function(n){var r=n.tagName;"TR"===r.toUpperCase()&&c.lastTagNameEq("TABLE")?(t.prepend("<TBODY>"),s()):e.selfCloseFix&&u.test(r)&&c.containsTagName(r)?c.lastTagNameEq(r)?o(t,c):(t.prepend("</"+n.tagName+">"),s()):n.unary||c.push(n)},endTag:function(n){var r=c.last();r?e.tagSoupFix&&!c.lastTagNameEq(n.tagName)?o(t,c):c.pop():e.tagSoupFix&&(a(),s())}};return function(){return s(),n(a())}}e.__esModule=!0,e["default"]=a;var s=/^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i,u=/^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i}])})},function(t,e){"use strict";function n(t){return void 0!==t&&null!==t}function r(t){return"function"==typeof t}function o(t,e,n){var r=void 0,o=t&&t.length||0;for(r=0;o>r;r++)e.call(n,t[r],r)}function i(t,e,n){for(var r in t)t.hasOwnProperty(r)&&e.call(n,r,t[r])}function a(t,e){return t=t||{},i(e,function(e,r){n(t[e])||(t[e]=r)}),t}function s(t){try{return Array.prototype.slice.call(t)}catch(e){var n=function(){var e=[];return o(t,function(t){e.push(t)}),{v:e}}();if("object"===("undefined"==typeof n?"undefined":l(n)))return n.v}}function u(t){return t[t.length-1]}function c(t,e){return t&&("startTag"===t.type||"atomicTag"===t.type)&&"tagName"in t?!!~t.tagName.toLowerCase().indexOf(e):!1}function f(t){return c(t,"script")}function p(t){return c(t,"style")}e.__esModule=!0;var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};e.existy=n,e.isFunction=r,e.each=o,e.eachKey=i,e.defaults=a,e.toArray=s,e.last=u,e.isTag=c,e.isScript=f,e.isStyle=p}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.postscribe=e():t.postscribe=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var o=n(1),i=r(o);t.exports=i["default"]},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}function i(){}function a(){var t=m.shift();if(t){var e=h.last(t);e.afterDequeue(),t.stream=s.apply(void 0,t),e.afterStreamStart()}}function s(t,e,n){function r(t){t=n.beforeWrite(t),g.write(t),n.afterWrite(t)}g=new p["default"](t,n),g.id=y++,g.name=n.name||g.id,u.streams[g.name]=g;var o=t.ownerDocument,s={close:o.close,open:o.open,write:o.write,writeln:o.writeln};c(o,{close:i,open:i,write:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return r(e.join(""))},writeln:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return r(e.join("")+"\n")}});var f=g.win.onerror||i;return g.win.onerror=function(t,e,r){n.error({msg:t+" - "+e+": "+r}),f.apply(g.win,[t,e,r])},g.write(e,function(){c(o,s),g.win.onerror=f,n.done(),g=null,a()}),g}function u(t,e,n){if(h.isFunction(n))n={done:n};else if("clear"===n)return m=[],g=null,void(y=0);n=h.defaults(n,d),t=/^#/.test(t)?window.document.getElementById(t.substr(1)):t.jquery?t[0]:t;var r=[t,e,n];return t.postscribe={cancel:function(){r.stream?r.stream.abort():r[1]=i}},n.beforeEnqueue(r),m.push(r),g||a(),t.postscribe}e.__esModule=!0;var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e["default"]=u;var f=n(2),p=o(f),l=n(4),h=r(l),d={afterAsync:i,afterDequeue:i,afterStreamStart:i,afterWrite:i,autoFix:!0,beforeEnqueue:i,beforeWriteToken:function(t){return t},beforeWrite:function(t){return t},done:i,error:function(t){throw t},releaseAsync:!1},y=0,m=[],g=null;c(u,{streams:{},queue:m,WriteStream:p["default"]})},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){var n=d+e,r=t.getAttribute(n);return l.existy(r)?String(r):r}function s(t,e){var n=arguments.length<=2||void 0===arguments[2]?null:arguments[2],r=d+e;l.existy(n)&&""!==n?t.setAttribute(r,n):t.removeAttribute(r)}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=n(3),f=o(c),p=n(4),l=r(p),h=!1,d="data-ps-",y="ps-style",m="ps-script",g=function(){function t(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];i(this,t),this.root=e,this.options=n,this.doc=e.ownerDocument,this.win=this.doc.defaultView||this.doc.parentWindow,this.parser=new f["default"]("",{autoFix:n.autoFix}),this.actuals=[e],this.proxyHistory="",this.proxyRoot=this.doc.createElement(e.nodeName),this.scriptStack=[],this.writeQueue=[],s(this.proxyRoot,"proxyof",0)}return t.prototype.write=function(){var t;for((t=this.writeQueue).push.apply(t,arguments);!this.deferredRemote&&this.writeQueue.length;){var e=this.writeQueue.shift();l.isFunction(e)?this._callFunction(e):this._writeImpl(e)}},t.prototype._callFunction=function(t){var e={type:"function",value:t.name||t.toString()};this._onScriptStart(e),t.call(this.win,this.doc),this._onScriptDone(e)},t.prototype._writeImpl=function(t){this.parser.append(t);for(var e=void 0,n=void 0,r=void 0,o=[];(e=this.parser.readToken())&&!(n=l.isScript(e))&&!(r=l.isStyle(e));)e=this.options.beforeWriteToken(e),e&&o.push(e);o.length>0&&this._writeStaticTokens(o),n&&this._handleScriptToken(e),r&&this._handleStyleToken(e)},t.prototype._writeStaticTokens=function(t){var e=this._buildChunk(t);return e.actual?(e.html=this.proxyHistory+e.actual,this.proxyHistory+=e.proxy,this.proxyRoot.innerHTML=e.html,h&&(e.proxyInnerHTML=this.proxyRoot.innerHTML),this._walkChunk(),h&&(e.actualInnerHTML=this.root.innerHTML),e):null},t.prototype._buildChunk=function(t){for(var e=this.actuals.length,n=[],r=[],o=[],i=t.length,a=0;i>a;a++){var s=t[a],u=s.toString();if(n.push(u),s.attrs){if(!/^noscript$/i.test(s.tagName)){var c=e++;r.push(u.replace(/(\/?>)/," "+d+"id="+c+" $1")),s.attrs.id!==m&&s.attrs.id!==y&&o.push("atomicTag"===s.type?"":"<"+s.tagName+" "+d+"proxyof="+c+(s.unary?" />":">"))}}else r.push(u),o.push("endTag"===s.type?u:"")}return{tokens:t,raw:n.join(""),actual:r.join(""),proxy:o.join("")}},t.prototype._walkChunk=function(){for(var t=void 0,e=[this.proxyRoot];l.existy(t=e.shift());){var n=1===t.nodeType,r=n&&a(t,"proxyof");if(!r){n&&(this.actuals[a(t,"id")]=t,s(t,"id"));var o=t.parentNode&&a(t.parentNode,"proxyof");o&&this.actuals[o].appendChild(t)}e.unshift.apply(e,l.toArray(t.childNodes))}},t.prototype._handleScriptToken=function(t){var e=this,n=this.parser.clear();n&&this.writeQueue.unshift(n),t.src=t.attrs.src||t.attrs.SRC,t=this.options.beforeWriteToken(t),t&&(t.src&&this.scriptStack.length?this.deferredRemote=t:this._onScriptStart(t),this._writeScriptToken(t,function(){e._onScriptDone(t)}))},t.prototype._handleStyleToken=function(t){var e=this.parser.clear();e&&this.writeQueue.unshift(e),t.type=t.attrs.type||t.attrs.TYPE||"text/css",t=this.options.beforeWriteToken(t),t&&this._writeStyleToken(t),e&&this.write()},t.prototype._writeStyleToken=function(t){var e=this._buildStyle(t);this._insertCursor(e,y),t.content&&(e.styleSheet&&!e.sheet?e.styleSheet.cssText=t.content:e.appendChild(this.doc.createTextNode(t.content)))},t.prototype._buildStyle=function(t){var e=this.doc.createElement(t.tagName);return e.setAttribute("type",t.type),l.eachKey(t.attrs,function(t,n){e.setAttribute(t,n)}),e},t.prototype._insertCursor=function(t,e){this._writeImpl('<span id="'+e+'"/>');var n=this.doc.getElementById(e);n&&n.parentNode.replaceChild(t,n)},t.prototype._onScriptStart=function(t){t.outerWrites=this.writeQueue,this.writeQueue=[],this.scriptStack.unshift(t)},t.prototype._onScriptDone=function(t){return t!==this.scriptStack[0]?void this.options.error({message:"Bad script nesting or script finished twice"}):(this.scriptStack.shift(),this.write.apply(this,t.outerWrites),void(!this.scriptStack.length&&this.deferredRemote&&(this._onScriptStart(this.deferredRemote),this.deferredRemote=null)))},t.prototype._writeScriptToken=function(t,e){var n=this._buildScript(t),r=this._shouldRelease(n),o=this.options.afterAsync;t.src&&(n.src=t.src,this._scriptLoadHandler(n,r?o:function(){e(),o()}));try{this._insertCursor(n,m),n.src&&!r||e()}catch(i){this.options.error(i),e()}},t.prototype._buildScript=function(t){var e=this.doc.createElement(t.tagName);return l.eachKey(t.attrs,function(t,n){e.setAttribute(t,n)}),t.content&&(e.text=t.content),e},t.prototype._scriptLoadHandler=function(t,e){function n(){t=t.onload=t.onreadystatechange=t.onerror=null}function r(){n(),e()}function o(t){n(),i(t),e()}var i=this.options.error;u(t,{onload:function(){return r()},onreadystatechange:function(){/^(loaded|complete)$/.test(t.readyState)&&r()},onerror:function(){return o({message:"remote script failed "+t.src})}})},t.prototype._shouldRelease=function(t){var e=/^script$/i.test(t.nodeName);return!e||!!(this.options.releaseAsync&&t.src&&t.hasAttribute("async"))},t}();e["default"]=g},function(t,e,n){!function(e,n){t.exports=n()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var o=n(1),i=r(o);t.exports=i["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var a=n(2),s=o(a),u=n(3),c=o(u),f=n(6),p=r(f),l=n(5),h={comment:/^<!--/,endTag:/^<\//,atomicTag:/^<\s*(script|style|noscript|iframe|textarea)[\s\/>]/i,startTag:/^</,chars:/^[^<]/},d=function(){function t(){var e=this,n=arguments.length<=0||void 0===arguments[0]?"":arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];i(this,t),this.stream=n;var o=!1,a={};for(var u in s)s.hasOwnProperty(u)&&(r.autoFix&&(a[u+"Fix"]=!0),o=o||a[u+"Fix"]);o&&(this._fixedReadToken=(0,p["default"])(this,a,function(){return e._readTokenImpl()}))}return t.prototype.append=function(t){this.stream+=t},t.prototype.prepend=function(t){this.stream=t+this.stream},t.prototype._readTokenImpl=function(){for(var t in h)if(h.hasOwnProperty(t)&&h[t].test(this.stream)){var e=c[t](this.stream);if(e)return e.text=this.stream.substr(0,e.length),this.stream=this.stream.slice(e.length),e}},t.prototype.readToken=function(){return this._fixedReadToken?this._fixedReadToken():this._readTokenImpl()},t.prototype.readTokens=function(t){for(var e=void 0;e=this.readToken();)if(t[e.type]&&t[e.type](e)===!1)return},t.prototype.clear=function(){var t=this.stream;return this.stream="",t},t.prototype.rest=function(){return this.stream},t}();e["default"]=d,d.tokenToString=function(t){return t.toString()},d.escapeAttributes=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=(0,l.escapeQuotes)(t[n],null));return e},d.supports=s;for(var y in s)s.hasOwnProperty(y)&&(d.browserHasFlaw=d.browserHasFlaw||!s[y]&&y)},function(t,e){"use strict";e.__esModule=!0;var n=!1,r=!1,o=window.document.createElement("div");try{var i="<P><I></P></I>";o.innerHTML=i,e.tagSoup=n=o.innerHTML!==i}catch(a){e.tagSoup=n=!1}try{o.innerHTML="<P><i><P></P></i></P>",e.selfClose=r=2===o.childNodes.length}catch(a){e.selfClose=r=!1}o=null,e.tagSoup=n,e.selfClose=r},function(t,e,n){"use strict";function r(t){var e=t.indexOf("-->");return e>=0?new c.CommentToken(t.substr(4,e-1),e+3):void 0}function o(t){var e=t.indexOf("<");return new c.CharsToken(e>=0?e:t.length)}function i(t){var e=t.indexOf(">");if(-1!==e){var n=t.match(f.startTag);if(n){var r=function(){var t={},e={},r=n[2];return n[2].replace(f.attr,function(n,o){arguments[2]||arguments[3]||arguments[4]||arguments[5]?arguments[5]?(t[arguments[5]]="",e[arguments[5]]=!0):t[o]=arguments[2]||arguments[3]||arguments[4]||f.fillAttr.test(o)&&o||"":t[o]="",r=r.replace(n,"")}),{v:new c.StartTagToken(n[1],n[0].length,t,e,!!n[3],r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))}}();if("object"===("undefined"==typeof r?"undefined":u(r)))return r.v}}}function a(t){var e=i(t);if(e){var n=t.slice(e.length);if(n.match(new RegExp("</\\s*"+e.tagName+"\\s*>","i"))){var r=n.match(new RegExp("([\\s\\S]*?)</\\s*"+e.tagName+"\\s*>","i"));if(r)return new c.AtomicTagToken(e.tagName,r[0].length+e.length,e.attrs,e.booleanAttrs,r[1])}}}function s(t){var e=t.match(f.endTag);return e?new c.EndTagToken(e[1],e[0].length):void 0}e.__esModule=!0;var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};e.comment=r,e.chars=o,e.startTag=i,e.atomicTag=a,e.endTag=s;var c=n(4),f={startTag:/^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,endTag:/^<\/([\-A-Za-z0-9_]+)[^>]*>/,attr:/(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g,fillAttr:/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0,e.EndTagToken=e.AtomicTagToken=e.StartTagToken=e.TagToken=e.CharsToken=e.CommentToken=e.Token=void 0;var o=n(5),i=(e.Token=function a(t,e){r(this,a),this.type=t,this.length=e,this.text=""},e.CommentToken=function(){function t(e,n){r(this,t),this.type="comment",this.length=n||(e?e.length:0),this.text="",this.content=e}return t.prototype.toString=function(){return"<!--"+this.content},t}(),e.CharsToken=function(){function t(e){r(this,t),this.type="chars",this.length=e,this.text=""}return t.prototype.toString=function(){return this.text},t}(),e.TagToken=function(){function t(e,n,o,i,a){r(this,t),this.type=e,this.length=o,this.text="",this.tagName=n,this.attrs=i,this.booleanAttrs=a,this.unary=!1,this.html5Unary=!1}return t.formatTag=function(t){var e=arguments.length<=1||void 0===arguments[1]?null:arguments[1],n="<"+t.tagName;for(var r in t.attrs)if(t.attrs.hasOwnProperty(r)){n+=" "+r;var i=t.attrs[r];"undefined"!=typeof t.booleanAttrs&&"undefined"!=typeof t.booleanAttrs[r]||(n+='="'+(0,o.escapeQuotes)(i)+'"')}return t.rest&&(n+=" "+t.rest),n+=t.unary&&!t.html5Unary?"/>":">",void 0!==e&&null!==e&&(n+=e+"</"+t.tagName+">"),n},t}());e.StartTagToken=function(){function t(e,n,o,i,a,s){r(this,t),this.type="startTag",this.length=n,this.text="",this.tagName=e,this.attrs=o,this.booleanAttrs=i,this.html5Unary=!1,this.unary=a,this.rest=s}return t.prototype.toString=function(){return i.formatTag(this)},t}(),e.AtomicTagToken=function(){function t(e,n,o,i,a){r(this,t),this.type="atomicTag",this.length=n,this.text="",this.tagName=e,this.attrs=o,this.booleanAttrs=i,this.unary=!1,this.html5Unary=!1,this.content=a}return t.prototype.toString=function(){return i.formatTag(this,this.content)},t}(),e.EndTagToken=function(){function t(e,n){r(this,t),this.type="endTag",this.length=n,this.text="",this.tagName=e}return t.prototype.toString=function(){return"</"+this.tagName+">"},t}()},function(t,e){"use strict";function n(t){var e=arguments.length<=1||void 0===arguments[1]?"":arguments[1];return t?t.replace(/([^"]*)"/g,function(t,e){return/\\/.test(e)?e+'"':e+'\\"'}):e}e.__esModule=!0,e.escapeQuotes=n},function(t,e){"use strict";function n(t){return t&&"startTag"===t.type&&(t.unary=s.test(t.tagName)||t.unary,t.html5Unary=!/\/>$/.test(t.text)),t}function r(t,e){var r=t.stream,o=n(e());return t.stream=r,o}function o(t,e){var n=e.pop();t.prepend("</"+n.tagName+">")}function i(){var t=[];return t.last=function(){return this[this.length-1]},t.lastTagNameEq=function(t){var e=this.last();return e&&e.tagName&&e.tagName.toUpperCase()===t.toUpperCase()},t.containsTagName=function(t){for(var e,n=0;e=this[n];n++)if(e.tagName===t)return!0;return!1},t}function a(t,e,a){function s(){var e=r(t,a);e&&f[e.type]&&f[e.type](e)}var c=i(),f={startTag:function(n){var r=n.tagName;"TR"===r.toUpperCase()&&c.lastTagNameEq("TABLE")?(t.prepend("<TBODY>"),s()):e.selfCloseFix&&u.test(r)&&c.containsTagName(r)?c.lastTagNameEq(r)?o(t,c):(t.prepend("</"+n.tagName+">"),s()):n.unary||c.push(n)},endTag:function(n){var r=c.last();r?e.tagSoupFix&&!c.lastTagNameEq(n.tagName)?o(t,c):c.pop():e.tagSoupFix&&(a(),s())}};return function(){return s(),n(a())}}e.__esModule=!0,e["default"]=a;var s=/^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i,u=/^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i}])})},function(t,e){"use strict";function n(t){return void 0!==t&&null!==t}function r(t){return"function"==typeof t}function o(t,e,n){var r=void 0,o=t&&t.length||0;for(r=0;o>r;r++)e.call(n,t[r],r)}function i(t,e,n){for(var r in t)t.hasOwnProperty(r)&&e.call(n,r,t[r])}function a(t,e){return t=t||{},i(e,function(e,r){n(t[e])||(t[e]=r)}),t}function s(t){try{return Array.prototype.slice.call(t)}catch(e){var n=function(){var e=[];return o(t,function(t){e.push(t)}),{v:e}}();if("object"===("undefined"==typeof n?"undefined":l(n)))return n.v}}function u(t){return t[t.length-1]}function c(t,e){return t&&("startTag"===t.type||"atomicTag"===t.type)&&"tagName"in t?!!~t.tagName.toLowerCase().indexOf(e):!1}function f(t){return c(t,"script")}function p(t){return c(t,"style")}e.__esModule=!0;var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};e.existy=n,e.isFunction=r,e.each=o,e.eachKey=i,e.defaults=a,e.toArray=s,e.last=u,e.isTag=c,e.isScript=f,e.isStyle=p}])});

@@ -43,3 +43,3 @@ {

"babel-register": "6.7.2",
"babelify": "7.2.0",
"babelify": "7.3.0",
"cz-conventional-changelog": "1.1.5",

@@ -84,3 +84,3 @@ "del": "2.2.0",

"watchify": "3.7.0",
"webpack": "1.12.14",
"webpack": "1.13.0",
"webpack-dev-server": "1.14.1",

@@ -124,3 +124,3 @@ "webpack-stream": "3.2.0"

},
"version": "2.0.4"
"version": "2.0.5"
}

@@ -11,2 +11,3 @@ # Overview

[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Gitter](https://badges.gitter.im/krux/postscribe.svg)](https://gitter.im/krux/postscribe)

@@ -43,3 +44,3 @@ Remote scripts, especially ads, block the page from doing anything else while they load. They contribute a large % to load times which

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/postscribe/2.0.0/postscribe.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/postscribe/2.0.5/postscribe.min.js"></script>
```

@@ -46,0 +47,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc