3418 lines
363 KiB
JavaScript
3418 lines
363 KiB
JavaScript
|
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[2],{
|
||
|
|
||
|
/***/ "./settings/node_modules/dompurify/dist/purify.js":
|
||
|
/*!********************************************************!*\
|
||
|
!*** ./settings/node_modules/dompurify/dist/purify.js ***!
|
||
|
\********************************************************/
|
||
|
/*! no static exports found */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
(function (global, factory) {
|
||
|
true ? module.exports = factory() :
|
||
|
undefined;
|
||
|
}(this, (function () { 'use strict';
|
||
|
|
||
|
var freeze$1 = Object.freeze || function (x) {
|
||
|
return x;
|
||
|
};
|
||
|
|
||
|
var html = freeze$1(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
||
|
|
||
|
// SVG
|
||
|
var svg = freeze$1(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'audio', 'canvas', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'video', 'view', 'vkern']);
|
||
|
|
||
|
var svgFilters = freeze$1(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
|
||
|
|
||
|
var mathMl = freeze$1(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']);
|
||
|
|
||
|
var text = freeze$1(['#text']);
|
||
|
|
||
|
var freeze$2 = Object.freeze || function (x) {
|
||
|
return x;
|
||
|
};
|
||
|
|
||
|
var html$1 = freeze$2(['accept', 'action', 'align', 'alt', 'autocomplete', 'background', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'coords', 'crossorigin', 'datetime', 'default', 'dir', 'disabled', 'download', 'enctype', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'integrity', 'ismap', 'label', 'lang', 'list', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'multiple', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns']);
|
||
|
|
||
|
var svg$1 = freeze$2(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
||
|
|
||
|
var mathMl$1 = freeze$2(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
||
|
|
||
|
var xml = freeze$2(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
||
|
|
||
|
var hasOwnProperty = Object.hasOwnProperty;
|
||
|
var setPrototypeOf = Object.setPrototypeOf;
|
||
|
|
||
|
var _ref$1 = typeof Reflect !== 'undefined' && Reflect;
|
||
|
var apply$1 = _ref$1.apply;
|
||
|
|
||
|
if (!apply$1) {
|
||
|
apply$1 = function apply(fun, thisValue, args) {
|
||
|
return fun.apply(thisValue, args);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
/* Add properties to a lookup table */
|
||
|
function addToSet(set, array) {
|
||
|
if (setPrototypeOf) {
|
||
|
// Make 'in' and truthy checks like Boolean(set.constructor)
|
||
|
// independent of any properties defined on Object.prototype.
|
||
|
// Prevent prototype setters from intercepting set as a this value.
|
||
|
setPrototypeOf(set, null);
|
||
|
}
|
||
|
var l = array.length;
|
||
|
while (l--) {
|
||
|
var element = array[l];
|
||
|
if (typeof element === 'string') {
|
||
|
var lcElement = element.toLowerCase();
|
||
|
if (lcElement !== element) {
|
||
|
array[l] = lcElement;
|
||
|
element = lcElement;
|
||
|
}
|
||
|
}
|
||
|
set[element] = true;
|
||
|
}
|
||
|
return set;
|
||
|
}
|
||
|
|
||
|
/* Shallow clone an object */
|
||
|
function clone(object) {
|
||
|
var newObject = {};
|
||
|
var property = void 0;
|
||
|
for (property in object) {
|
||
|
if (apply$1(hasOwnProperty, object, [property])) {
|
||
|
newObject[property] = object[property];
|
||
|
}
|
||
|
}
|
||
|
return newObject;
|
||
|
}
|
||
|
|
||
|
var seal = Object.seal || function (x) {
|
||
|
return x;
|
||
|
};
|
||
|
|
||
|
var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
||
|
var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm);
|
||
|
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
|
||
|
var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
||
|
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
||
|
);
|
||
|
var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
||
|
var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g // eslint-disable-line no-control-regex
|
||
|
);
|
||
|
|
||
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||
|
|
||
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||
|
|
||
|
var _ref = typeof Reflect !== 'undefined' && Reflect;
|
||
|
var apply = _ref.apply;
|
||
|
|
||
|
var arraySlice = Array.prototype.slice;
|
||
|
var freeze = Object.freeze;
|
||
|
|
||
|
var getGlobal = function getGlobal() {
|
||
|
return typeof window === 'undefined' ? null : window;
|
||
|
};
|
||
|
|
||
|
if (!apply) {
|
||
|
apply = function apply(fun, thisValue, args) {
|
||
|
return fun.apply(thisValue, args);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Creates a no-op policy for internal use only.
|
||
|
* Don't export this function outside this module!
|
||
|
* @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
|
||
|
* @param {Document} document The document object (to determine policy name suffix)
|
||
|
* @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
|
||
|
* are not supported).
|
||
|
*/
|
||
|
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
|
||
|
if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
// Allow the callers to control the unique policy name
|
||
|
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
||
|
// Policy creation with duplicate names throws in Trusted Types.
|
||
|
var suffix = null;
|
||
|
var ATTR_NAME = 'data-tt-policy-suffix';
|
||
|
if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
|
||
|
suffix = document.currentScript.getAttribute(ATTR_NAME);
|
||
|
}
|
||
|
|
||
|
var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
|
||
|
|
||
|
try {
|
||
|
return trustedTypes.createPolicy(policyName, {
|
||
|
createHTML: function createHTML(html$$1) {
|
||
|
return html$$1;
|
||
|
}
|
||
|
});
|
||
|
} catch (e) {
|
||
|
// Policy creation failed (most likely another DOMPurify script has
|
||
|
// already run). Skip creating the policy, as this will only cause errors
|
||
|
// if TT are enforced.
|
||
|
console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
|
||
|
return null;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function createDOMPurify() {
|
||
|
var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
||
|
|
||
|
var DOMPurify = function DOMPurify(root) {
|
||
|
return createDOMPurify(root);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Version label, exposed for easier checks
|
||
|
* if DOMPurify is up to date or not
|
||
|
*/
|
||
|
DOMPurify.version = '1.0.9';
|
||
|
|
||
|
/**
|
||
|
* Array of elements that DOMPurify removed during sanitation.
|
||
|
* Empty if nothing was removed.
|
||
|
*/
|
||
|
DOMPurify.removed = [];
|
||
|
|
||
|
if (!window || !window.document || window.document.nodeType !== 9) {
|
||
|
// Not running in a browser, provide a factory function
|
||
|
// so that you can pass your own Window
|
||
|
DOMPurify.isSupported = false;
|
||
|
|
||
|
return DOMPurify;
|
||
|
}
|
||
|
|
||
|
var originalDocument = window.document;
|
||
|
var useDOMParser = false;
|
||
|
var removeTitle = false;
|
||
|
|
||
|
var document = window.document;
|
||
|
var DocumentFragment = window.DocumentFragment,
|
||
|
HTMLTemplateElement = window.HTMLTemplateElement,
|
||
|
Node = window.Node,
|
||
|
NodeFilter = window.NodeFilter,
|
||
|
_window$NamedNodeMap = window.NamedNodeMap,
|
||
|
NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
|
||
|
Text = window.Text,
|
||
|
Comment = window.Comment,
|
||
|
DOMParser = window.DOMParser,
|
||
|
TrustedTypes = window.TrustedTypes;
|
||
|
|
||
|
// As per issue #47, the web-components registry is inherited by a
|
||
|
// new document created via createHTMLDocument. As per the spec
|
||
|
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
||
|
// a new empty registry is used when creating a template contents owner
|
||
|
// document, so we use that as our parent document to ensure nothing
|
||
|
// is inherited.
|
||
|
|
||
|
if (typeof HTMLTemplateElement === 'function') {
|
||
|
var template = document.createElement('template');
|
||
|
if (template.content && template.content.ownerDocument) {
|
||
|
document = template.content.ownerDocument;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var trustedTypesPolicy = _createTrustedTypesPolicy(TrustedTypes, originalDocument);
|
||
|
var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
|
||
|
|
||
|
var _document = document,
|
||
|
implementation = _document.implementation,
|
||
|
createNodeIterator = _document.createNodeIterator,
|
||
|
getElementsByTagName = _document.getElementsByTagName,
|
||
|
createDocumentFragment = _document.createDocumentFragment;
|
||
|
var importNode = originalDocument.importNode;
|
||
|
|
||
|
|
||
|
var hooks = {};
|
||
|
|
||
|
/**
|
||
|
* Expose whether this browser supports running the full DOMPurify.
|
||
|
*/
|
||
|
DOMPurify.isSupported = implementation && typeof implementation.createHTMLDocument !== 'undefined' && document.documentMode !== 9;
|
||
|
|
||
|
var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR,
|
||
|
ERB_EXPR$$1 = ERB_EXPR,
|
||
|
DATA_ATTR$$1 = DATA_ATTR,
|
||
|
ARIA_ATTR$$1 = ARIA_ATTR,
|
||
|
IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA,
|
||
|
ATTR_WHITESPACE$$1 = ATTR_WHITESPACE;
|
||
|
var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI;
|
||
|
/**
|
||
|
* We consider the elements and attributes below to be safe. Ideally
|
||
|
* don't add any new ones but feel free to remove unwanted ones.
|
||
|
*/
|
||
|
|
||
|
/* allowed element names */
|
||
|
|
||
|
var ALLOWED_TAGS = null;
|
||
|
var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(svgFilters), _toConsumableArray(mathMl), _toConsumableArray(text)));
|
||
|
|
||
|
/* Allowed attribute names */
|
||
|
var ALLOWED_ATTR = null;
|
||
|
var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(mathMl$1), _toConsumableArray(xml)));
|
||
|
|
||
|
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
||
|
var FORBID_TAGS = null;
|
||
|
|
||
|
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
||
|
var FORBID_ATTR = null;
|
||
|
|
||
|
/* Decide if ARIA attributes are okay */
|
||
|
var ALLOW_ARIA_ATTR = true;
|
||
|
|
||
|
/* Decide if custom data attributes are okay */
|
||
|
var ALLOW_DATA_ATTR = true;
|
||
|
|
||
|
/* Decide if unknown protocols are okay */
|
||
|
var ALLOW_UNKNOWN_PROTOCOLS = false;
|
||
|
|
||
|
/* Output should be safe for jQuery's $() factory? */
|
||
|
var SAFE_FOR_JQUERY = false;
|
||
|
|
||
|
/* Output should be safe for common template engines.
|
||
|
* This means, DOMPurify removes data attributes, mustaches and ERB
|
||
|
*/
|
||
|
var SAFE_FOR_TEMPLATES = false;
|
||
|
|
||
|
/* Decide if document with <html>... should be returned */
|
||
|
var WHOLE_DOCUMENT = false;
|
||
|
|
||
|
/* Track whether config is already set on this instance of DOMPurify. */
|
||
|
var SET_CONFIG = false;
|
||
|
|
||
|
/* Decide if all elements (e.g. style, script) must be children of
|
||
|
* document.body. By default, browsers might move them to document.head */
|
||
|
var FORCE_BODY = false;
|
||
|
|
||
|
/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
|
||
|
* string (or a TrustedHTML object if Trusted Types are supported).
|
||
|
* If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
|
||
|
*/
|
||
|
var RETURN_DOM = false;
|
||
|
|
||
|
/* Decide if a DOM `DocumentFragment` should be returned, instead of a html
|
||
|
* string (or a TrustedHTML object if Trusted Types are supported) */
|
||
|
var RETURN_DOM_FRAGMENT = false;
|
||
|
|
||
|
/* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM
|
||
|
* `Node` is imported into the current `Document`. If this flag is not enabled the
|
||
|
* `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by
|
||
|
* DOMPurify. */
|
||
|
var RETURN_DOM_IMPORT = false;
|
||
|
|
||
|
/* Output should be free from DOM clobbering attacks? */
|
||
|
var SANITIZE_DOM = true;
|
||
|
|
||
|
/* Keep element content when removing element? */
|
||
|
var KEEP_CONTENT = true;
|
||
|
|
||
|
/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
|
||
|
* of importing it into a new Document and returning a sanitized copy */
|
||
|
var IN_PLACE = false;
|
||
|
|
||
|
/* Allow usage of profiles like html, svg and mathMl */
|
||
|
var USE_PROFILES = {};
|
||
|
|
||
|
/* Tags to ignore content of when KEEP_CONTENT is true */
|
||
|
var FORBID_CONTENTS = addToSet({}, ['audio', 'head', 'math', 'script', 'style', 'template', 'svg', 'video']);
|
||
|
|
||
|
/* Tags that are safe for data: URIs */
|
||
|
var DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image']);
|
||
|
|
||
|
/* Attributes safe for values like "javascript:" */
|
||
|
var URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'summary', 'title', 'value', 'style', 'xmlns']);
|
||
|
|
||
|
/* Keep a reference to config to pass to hooks */
|
||
|
var CONFIG = null;
|
||
|
|
||
|
/* Ideally, do not touch anything below this line */
|
||
|
/* ______________________________________________ */
|
||
|
|
||
|
var formElement = document.createElement('form');
|
||
|
|
||
|
/**
|
||
|
* _parseConfig
|
||
|
*
|
||
|
* @param {Object} cfg optional config literal
|
||
|
*/
|
||
|
// eslint-disable-next-line complexity
|
||
|
var _parseConfig = function _parseConfig(cfg) {
|
||
|
if (CONFIG && CONFIG === cfg) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
/* Shield configuration object from tampering */
|
||
|
if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') {
|
||
|
cfg = {};
|
||
|
}
|
||
|
/* Set configuration parameters */
|
||
|
ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
|
||
|
ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
|
||
|
FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};
|
||
|
FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};
|
||
|
USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
|
||
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
||
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
||
|
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
|
||
|
SAFE_FOR_JQUERY = cfg.SAFE_FOR_JQUERY || false; // Default false
|
||
|
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
|
||
|
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
|
||
|
RETURN_DOM = cfg.RETURN_DOM || false; // Default false
|
||
|
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
|
||
|
RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT || false; // Default false
|
||
|
FORCE_BODY = cfg.FORCE_BODY || false; // Default false
|
||
|
SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
|
||
|
KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
|
||
|
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
||
|
|
||
|
IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1;
|
||
|
|
||
|
if (SAFE_FOR_TEMPLATES) {
|
||
|
ALLOW_DATA_ATTR = false;
|
||
|
}
|
||
|
|
||
|
if (RETURN_DOM_FRAGMENT) {
|
||
|
RETURN_DOM = true;
|
||
|
}
|
||
|
|
||
|
/* Parse profile info */
|
||
|
if (USE_PROFILES) {
|
||
|
ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(text)));
|
||
|
ALLOWED_ATTR = [];
|
||
|
if (USE_PROFILES.html === true) {
|
||
|
addToSet(ALLOWED_TAGS, html);
|
||
|
addToSet(ALLOWED_ATTR, html$1);
|
||
|
}
|
||
|
if (USE_PROFILES.svg === true) {
|
||
|
addToSet(ALLOWED_TAGS, svg);
|
||
|
addToSet(ALLOWED_ATTR, svg$1);
|
||
|
addToSet(ALLOWED_ATTR, xml);
|
||
|
}
|
||
|
if (USE_PROFILES.svgFilters === true) {
|
||
|
addToSet(ALLOWED_TAGS, svgFilters);
|
||
|
addToSet(ALLOWED_ATTR, svg$1);
|
||
|
addToSet(ALLOWED_ATTR, xml);
|
||
|
}
|
||
|
if (USE_PROFILES.mathMl === true) {
|
||
|
addToSet(ALLOWED_TAGS, mathMl);
|
||
|
addToSet(ALLOWED_ATTR, mathMl$1);
|
||
|
addToSet(ALLOWED_ATTR, xml);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* Merge configuration parameters */
|
||
|
if (cfg.ADD_TAGS) {
|
||
|
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
||
|
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
||
|
}
|
||
|
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
|
||
|
}
|
||
|
if (cfg.ADD_ATTR) {
|
||
|
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
||
|
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
||
|
}
|
||
|
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
|
||
|
}
|
||
|
if (cfg.ADD_URI_SAFE_ATTR) {
|
||
|
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
|
||
|
}
|
||
|
|
||
|
/* Add #text in case KEEP_CONTENT is set to true */
|
||
|
if (KEEP_CONTENT) {
|
||
|
ALLOWED_TAGS['#text'] = true;
|
||
|
}
|
||
|
|
||
|
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
|
||
|
if (WHOLE_DOCUMENT) {
|
||
|
addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
|
||
|
}
|
||
|
|
||
|
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286 */
|
||
|
if (ALLOWED_TAGS.table) {
|
||
|
addToSet(ALLOWED_TAGS, ['tbody']);
|
||
|
}
|
||
|
|
||
|
// Prevent further manipulation of configuration.
|
||
|
// Not available in IE8, Safari 5, etc.
|
||
|
if (freeze) {
|
||
|
freeze(cfg);
|
||
|
}
|
||
|
|
||
|
CONFIG = cfg;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _forceRemove
|
||
|
*
|
||
|
* @param {Node} node a DOM node
|
||
|
*/
|
||
|
var _forceRemove = function _forceRemove(node) {
|
||
|
DOMPurify.removed.push({ element: node });
|
||
|
try {
|
||
|
node.parentNode.removeChild(node);
|
||
|
} catch (err) {
|
||
|
node.outerHTML = emptyHTML;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _removeAttribute
|
||
|
*
|
||
|
* @param {String} name an Attribute name
|
||
|
* @param {Node} node a DOM node
|
||
|
*/
|
||
|
var _removeAttribute = function _removeAttribute(name, node) {
|
||
|
try {
|
||
|
DOMPurify.removed.push({
|
||
|
attribute: node.getAttributeNode(name),
|
||
|
from: node
|
||
|
});
|
||
|
} catch (err) {
|
||
|
DOMPurify.removed.push({
|
||
|
attribute: null,
|
||
|
from: node
|
||
|
});
|
||
|
}
|
||
|
node.removeAttribute(name);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _initDocument
|
||
|
*
|
||
|
* @param {String} dirty a string of dirty markup
|
||
|
* @return {Document} a DOM, filled with the dirty markup
|
||
|
*/
|
||
|
var _initDocument = function _initDocument(dirty) {
|
||
|
/* Create a HTML document */
|
||
|
var doc = void 0;
|
||
|
var leadingWhitespace = void 0;
|
||
|
|
||
|
if (FORCE_BODY) {
|
||
|
dirty = '<remove></remove>' + dirty;
|
||
|
} else {
|
||
|
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
||
|
var matches = dirty.match(/^[\s]+/);
|
||
|
leadingWhitespace = matches && matches[0];
|
||
|
if (leadingWhitespace) {
|
||
|
dirty = dirty.slice(leadingWhitespace.length);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* Use DOMParser to workaround Firefox bug (see comment below) */
|
||
|
if (useDOMParser) {
|
||
|
try {
|
||
|
doc = new DOMParser().parseFromString(dirty, 'text/html');
|
||
|
} catch (err) {}
|
||
|
}
|
||
|
|
||
|
/* Remove title to fix a mXSS bug in older MS Edge */
|
||
|
if (removeTitle) {
|
||
|
addToSet(FORBID_TAGS, ['title']);
|
||
|
}
|
||
|
|
||
|
/* Otherwise use createHTMLDocument, because DOMParser is unsafe in
|
||
|
Safari (see comment below) */
|
||
|
if (!doc || !doc.documentElement) {
|
||
|
doc = implementation.createHTMLDocument('');
|
||
|
var _doc = doc,
|
||
|
body = _doc.body;
|
||
|
|
||
|
body.parentNode.removeChild(body.parentNode.firstElementChild);
|
||
|
body.outerHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
||
|
}
|
||
|
|
||
|
if (leadingWhitespace) {
|
||
|
doc.body.insertBefore(document.createTextNode(leadingWhitespace), doc.body.childNodes[0] || null);
|
||
|
}
|
||
|
|
||
|
/* Work on whole document or just its body */
|
||
|
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
|
||
|
};
|
||
|
|
||
|
// Firefox uses a different parser for innerHTML rather than
|
||
|
// DOMParser (see https://bugzilla.mozilla.org/show_bug.cgi?id=1205631)
|
||
|
// which means that you *must* use DOMParser, otherwise the output may
|
||
|
// not be safe if used in a document.write context later.
|
||
|
//
|
||
|
// So we feature detect the Firefox bug and use the DOMParser if necessary.
|
||
|
//
|
||
|
// MS Edge, in older versions, is affected by an mXSS behavior. The second
|
||
|
// check tests for the behavior and fixes it if necessary.
|
||
|
if (DOMPurify.isSupported) {
|
||
|
(function () {
|
||
|
try {
|
||
|
var doc = _initDocument('<svg><p><style><img src="</style><img src=x onerror=1//">');
|
||
|
if (doc.querySelector('svg img')) {
|
||
|
useDOMParser = true;
|
||
|
}
|
||
|
} catch (err) {}
|
||
|
})();
|
||
|
(function () {
|
||
|
try {
|
||
|
var doc = _initDocument('<x/><title></title><img>');
|
||
|
if (doc.querySelector('title').innerHTML.match(/<\/title/)) {
|
||
|
removeTitle = true;
|
||
|
}
|
||
|
} catch (err) {}
|
||
|
})();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* _createIterator
|
||
|
*
|
||
|
* @param {Document} root document/fragment to create iterator for
|
||
|
* @return {Iterator} iterator instance
|
||
|
*/
|
||
|
var _createIterator = function _createIterator(root) {
|
||
|
return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, function () {
|
||
|
return NodeFilter.FILTER_ACCEPT;
|
||
|
}, false);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _isClobbered
|
||
|
*
|
||
|
* @param {Node} elm element to check for clobbering attacks
|
||
|
* @return {Boolean} true if clobbered, false if safe
|
||
|
*/
|
||
|
var _isClobbered = function _isClobbered(elm) {
|
||
|
if (elm instanceof Text || elm instanceof Comment) {
|
||
|
return false;
|
||
|
}
|
||
|
if (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function') {
|
||
|
return true;
|
||
|
}
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _isNode
|
||
|
*
|
||
|
* @param {Node} obj object to check whether it's a DOM node
|
||
|
* @return {Boolean} true is object is a DOM node
|
||
|
*/
|
||
|
var _isNode = function _isNode(obj) {
|
||
|
return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? obj instanceof Node : obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string';
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _executeHook
|
||
|
* Execute user configurable hooks
|
||
|
*
|
||
|
* @param {String} entryPoint Name of the hook's entry point
|
||
|
* @param {Node} currentNode node to work on with the hook
|
||
|
* @param {Object} data additional hook parameters
|
||
|
*/
|
||
|
var _executeHook = function _executeHook(entryPoint, currentNode, data) {
|
||
|
if (!hooks[entryPoint]) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
hooks[entryPoint].forEach(function (hook) {
|
||
|
hook.call(DOMPurify, currentNode, data, CONFIG);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _sanitizeElements
|
||
|
*
|
||
|
* @protect nodeName
|
||
|
* @protect textContent
|
||
|
* @protect removeChild
|
||
|
*
|
||
|
* @param {Node} currentNode to check for permission to exist
|
||
|
* @return {Boolean} true if node was killed, false if left alive
|
||
|
*/
|
||
|
var _sanitizeElements = function _sanitizeElements(currentNode) {
|
||
|
var content = void 0;
|
||
|
|
||
|
/* Execute a hook if present */
|
||
|
_executeHook('beforeSanitizeElements', currentNode, null);
|
||
|
|
||
|
/* Check if element is clobbered or can clobber */
|
||
|
if (_isClobbered(currentNode)) {
|
||
|
_forceRemove(currentNode);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/* Now let's check the element's type and name */
|
||
|
var tagName = currentNode.nodeName.toLowerCase();
|
||
|
|
||
|
/* Execute a hook if present */
|
||
|
_executeHook('uponSanitizeElement', currentNode, {
|
||
|
tagName: tagName,
|
||
|
allowedTags: ALLOWED_TAGS
|
||
|
});
|
||
|
|
||
|
/* Remove element if anything forbids its presence */
|
||
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
||
|
/* Keep content except for black-listed elements */
|
||
|
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName] && typeof currentNode.insertAdjacentHTML === 'function') {
|
||
|
try {
|
||
|
var htmlToInsert = currentNode.innerHTML;
|
||
|
currentNode.insertAdjacentHTML('AfterEnd', trustedTypesPolicy ? trustedTypesPolicy.createHTML(htmlToInsert) : htmlToInsert);
|
||
|
} catch (err) {}
|
||
|
}
|
||
|
_forceRemove(currentNode);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/* Convert markup to cover jQuery behavior */
|
||
|
if (SAFE_FOR_JQUERY && !currentNode.firstElementChild && (!currentNode.content || !currentNode.content.firstElementChild) && /</g.test(currentNode.textContent)) {
|
||
|
DOMPurify.removed.push({ element: currentNode.cloneNode() });
|
||
|
if (currentNode.innerHTML) {
|
||
|
currentNode.innerHTML = currentNode.innerHTML.replace(/</g, '<');
|
||
|
} else {
|
||
|
currentNode.innerHTML = currentNode.textContent.replace(/</g, '<');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* Sanitize element content to be template-safe */
|
||
|
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
|
||
|
/* Get the element's text content */
|
||
|
content = currentNode.textContent;
|
||
|
content = content.replace(MUSTACHE_EXPR$$1, ' ');
|
||
|
content = content.replace(ERB_EXPR$$1, ' ');
|
||
|
if (currentNode.textContent !== content) {
|
||
|
DOMPurify.removed.push({ element: currentNode.cloneNode() });
|
||
|
currentNode.textContent = content;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* Execute a hook if present */
|
||
|
_executeHook('afterSanitizeElements', currentNode, null);
|
||
|
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _isValidAttribute
|
||
|
*
|
||
|
* @param {string} lcTag Lowercase tag name of containing element.
|
||
|
* @param {string} lcName Lowercase attribute name.
|
||
|
* @param {string} value Attribute value.
|
||
|
* @return {Boolean} Returns true if `value` is valid, otherwise false.
|
||
|
*/
|
||
|
var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
||
|
/* Make sure attribute cannot clobber */
|
||
|
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
/* Sanitize attribute content to be template-safe */
|
||
|
if (SAFE_FOR_TEMPLATES) {
|
||
|
value = value.replace(MUSTACHE_EXPR$$1, ' ');
|
||
|
value = value.replace(ERB_EXPR$$1, ' ');
|
||
|
}
|
||
|
|
||
|
/* Allow valid data-* attributes: At least one character after "-"
|
||
|
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
||
|
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
||
|
We don't need to check the value; it's always URI safe. */
|
||
|
if (ALLOW_DATA_ATTR && DATA_ATTR$$1.test(lcName)) {
|
||
|
// This attribute is safe
|
||
|
} else if (ALLOW_ARIA_ATTR && ARIA_ATTR$$1.test(lcName)) {
|
||
|
// This attribute is safe
|
||
|
/* Otherwise, check the name is permitted */
|
||
|
} else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
||
|
return false;
|
||
|
|
||
|
/* Check value is safe. First, is attr inert? If so, is safe */
|
||
|
} else if (URI_SAFE_ATTRIBUTES[lcName]) {
|
||
|
// This attribute is safe
|
||
|
/* Check no script, data or unknown possibly unsafe URI
|
||
|
unless we know URI values are safe for that attribute */
|
||
|
} else if (IS_ALLOWED_URI$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) {
|
||
|
// This attribute is safe
|
||
|
/* Keep image data URIs alive if src/xlink:href is allowed */
|
||
|
/* Further prevent gadget XSS for dynamically built script tags */
|
||
|
} else if ((lcName === 'src' || lcName === 'xlink:href') && lcTag !== 'script' && value.indexOf('data:') === 0 && DATA_URI_TAGS[lcTag]) {
|
||
|
// This attribute is safe
|
||
|
/* Allow unknown protocols: This provides support for links that
|
||
|
are handled by protocol handlers which may be unknown ahead of
|
||
|
time, e.g. fb:, spotify: */
|
||
|
} else if (ALLOW_UNKNOWN_PROTOCOLS && !IS_SCRIPT_OR_DATA$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) {
|
||
|
// This attribute is safe
|
||
|
/* Check for binary attributes */
|
||
|
// eslint-disable-next-line no-negated-condition
|
||
|
} else if (!value) {
|
||
|
// Binary attributes are safe at this point
|
||
|
/* Anything else, presume unsafe, do not add it back */
|
||
|
} else {
|
||
|
return false;
|
||
|
}
|
||
|
return true;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _sanitizeAttributes
|
||
|
*
|
||
|
* @protect attributes
|
||
|
* @protect nodeName
|
||
|
* @protect removeAttribute
|
||
|
* @protect setAttribute
|
||
|
*
|
||
|
* @param {Node} node to sanitize
|
||
|
*/
|
||
|
// eslint-disable-next-line complexity
|
||
|
var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
||
|
var attr = void 0;
|
||
|
var value = void 0;
|
||
|
var lcName = void 0;
|
||
|
var idAttr = void 0;
|
||
|
var l = void 0;
|
||
|
/* Execute a hook if present */
|
||
|
_executeHook('beforeSanitizeAttributes', currentNode, null);
|
||
|
|
||
|
var attributes = currentNode.attributes;
|
||
|
|
||
|
/* Check if we have attributes; if not we might have a text node */
|
||
|
|
||
|
if (!attributes) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var hookEvent = {
|
||
|
attrName: '',
|
||
|
attrValue: '',
|
||
|
keepAttr: true,
|
||
|
allowedAttributes: ALLOWED_ATTR
|
||
|
};
|
||
|
l = attributes.length;
|
||
|
|
||
|
/* Go backwards over all attributes; safely remove bad ones */
|
||
|
while (l--) {
|
||
|
attr = attributes[l];
|
||
|
var _attr = attr,
|
||
|
name = _attr.name,
|
||
|
namespaceURI = _attr.namespaceURI;
|
||
|
|
||
|
value = attr.value.trim();
|
||
|
lcName = name.toLowerCase();
|
||
|
|
||
|
/* Execute a hook if present */
|
||
|
hookEvent.attrName = lcName;
|
||
|
hookEvent.attrValue = value;
|
||
|
hookEvent.keepAttr = true;
|
||
|
_executeHook('uponSanitizeAttribute', currentNode, hookEvent);
|
||
|
value = hookEvent.attrValue;
|
||
|
|
||
|
/* Remove attribute */
|
||
|
// Safari (iOS + Mac), last tested v8.0.5, crashes if you try to
|
||
|
// remove a "name" attribute from an <img> tag that has an "id"
|
||
|
// attribute at the time.
|
||
|
if (lcName === 'name' && currentNode.nodeName === 'IMG' && attributes.id) {
|
||
|
idAttr = attributes.id;
|
||
|
attributes = apply(arraySlice, attributes, []);
|
||
|
_removeAttribute('id', currentNode);
|
||
|
_removeAttribute(name, currentNode);
|
||
|
if (attributes.indexOf(idAttr) > l) {
|
||
|
currentNode.setAttribute('id', idAttr.value);
|
||
|
}
|
||
|
} else if (
|
||
|
// This works around a bug in Safari, where input[type=file]
|
||
|
// cannot be dynamically set after type has been removed
|
||
|
currentNode.nodeName === 'INPUT' && lcName === 'type' && value === 'file' && (ALLOWED_ATTR[lcName] || !FORBID_ATTR[lcName])) {
|
||
|
continue;
|
||
|
} else {
|
||
|
// This avoids a crash in Safari v9.0 with double-ids.
|
||
|
// The trick is to first set the id to be empty and then to
|
||
|
// remove the attribute
|
||
|
if (name === 'id') {
|
||
|
currentNode.setAttribute(name, '');
|
||
|
}
|
||
|
_removeAttribute(name, currentNode);
|
||
|
}
|
||
|
|
||
|
/* Did the hooks approve of the attribute? */
|
||
|
if (!hookEvent.keepAttr) {
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
/* Is `value` valid for this attribute? */
|
||
|
var lcTag = currentNode.nodeName.toLowerCase();
|
||
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
/* Handle invalid data-* attribute set by try-catching it */
|
||
|
try {
|
||
|
if (namespaceURI) {
|
||
|
currentNode.setAttributeNS(namespaceURI, name, value);
|
||
|
} else {
|
||
|
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
||
|
currentNode.setAttribute(name, value);
|
||
|
}
|
||
|
DOMPurify.removed.pop();
|
||
|
} catch (err) {}
|
||
|
}
|
||
|
|
||
|
/* Execute a hook if present */
|
||
|
_executeHook('afterSanitizeAttributes', currentNode, null);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* _sanitizeShadowDOM
|
||
|
*
|
||
|
* @param {DocumentFragment} fragment to iterate over recursively
|
||
|
*/
|
||
|
var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
||
|
var shadowNode = void 0;
|
||
|
var shadowIterator = _createIterator(fragment);
|
||
|
|
||
|
/* Execute a hook if present */
|
||
|
_executeHook('beforeSanitizeShadowDOM', fragment, null);
|
||
|
|
||
|
while (shadowNode = shadowIterator.nextNode()) {
|
||
|
/* Execute a hook if present */
|
||
|
_executeHook('uponSanitizeShadowNode', shadowNode, null);
|
||
|
|
||
|
/* Sanitize tags and elements */
|
||
|
if (_sanitizeElements(shadowNode)) {
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
/* Deep shadow DOM detected */
|
||
|
if (shadowNode.content instanceof DocumentFragment) {
|
||
|
_sanitizeShadowDOM(shadowNode.content);
|
||
|
}
|
||
|
|
||
|
/* Check attributes, sanitize if necessary */
|
||
|
_sanitizeAttributes(shadowNode);
|
||
|
}
|
||
|
|
||
|
/* Execute a hook if present */
|
||
|
_executeHook('afterSanitizeShadowDOM', fragment, null);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Sanitize
|
||
|
* Public method providing core sanitation functionality
|
||
|
*
|
||
|
* @param {String|Node} dirty string or DOM node
|
||
|
* @param {Object} configuration object
|
||
|
*/
|
||
|
// eslint-disable-next-line complexity
|
||
|
DOMPurify.sanitize = function (dirty, cfg) {
|
||
|
var body = void 0;
|
||
|
var importedNode = void 0;
|
||
|
var currentNode = void 0;
|
||
|
var oldNode = void 0;
|
||
|
var returnNode = void 0;
|
||
|
/* Make sure we have a string to sanitize.
|
||
|
DO NOT return early, as this will return the wrong type if
|
||
|
the user has requested a DOM object rather than a string */
|
||
|
if (!dirty) {
|
||
|
dirty = '<!-->';
|
||
|
}
|
||
|
|
||
|
/* Stringify, in case dirty is an object */
|
||
|
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
||
|
// eslint-disable-next-line no-negated-condition
|
||
|
if (typeof dirty.toString !== 'function') {
|
||
|
throw new TypeError('toString is not a function');
|
||
|
} else {
|
||
|
dirty = dirty.toString();
|
||
|
if (typeof dirty !== 'string') {
|
||
|
throw new TypeError('dirty is not a string, aborting');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* Check we can run. Otherwise fall back or ignore */
|
||
|
if (!DOMPurify.isSupported) {
|
||
|
if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
|
||
|
if (typeof dirty === 'string') {
|
||
|
return window.toStaticHTML(dirty);
|
||
|
}
|
||
|
if (_isNode(dirty)) {
|
||
|
return window.toStaticHTML(dirty.outerHTML);
|
||
|
}
|
||
|
}
|
||
|
return dirty;
|
||
|
}
|
||
|
|
||
|
/* Assign config vars */
|
||
|
if (!SET_CONFIG) {
|
||
|
_parseConfig(cfg);
|
||
|
}
|
||
|
|
||
|
/* Clean up removed elements */
|
||
|
DOMPurify.removed = [];
|
||
|
|
||
|
if (IN_PLACE) {
|
||
|
/* No special handling necessary for in-place sanitization */
|
||
|
} else if (dirty instanceof Node) {
|
||
|
/* If dirty is a DOM element, append to an empty document to avoid
|
||
|
elements being stripped by the parser */
|
||
|
body = _initDocument('<!-->');
|
||
|
importedNode = body.ownerDocument.importNode(dirty, true);
|
||
|
if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
|
||
|
/* Node is already a body, use as is */
|
||
|
body = importedNode;
|
||
|
} else {
|
||
|
body.appendChild(importedNode);
|
||
|
}
|
||
|
} else {
|
||
|
/* Exit directly if we have nothing to do */
|
||
|
if (!RETURN_DOM && !WHOLE_DOCUMENT && dirty.indexOf('<') === -1) {
|
||
|
return trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
||
|
}
|
||
|
|
||
|
/* Initialize the document to work on */
|
||
|
body = _initDocument(dirty);
|
||
|
|
||
|
/* Check we have a DOM node from the data */
|
||
|
if (!body) {
|
||
|
return RETURN_DOM ? null : emptyHTML;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* Remove first element node (ours) if FORCE_BODY is set */
|
||
|
if (body && FORCE_BODY) {
|
||
|
_forceRemove(body.firstChild);
|
||
|
}
|
||
|
|
||
|
/* Get node iterator */
|
||
|
var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
|
||
|
|
||
|
/* Now start iterating over the created document */
|
||
|
while (currentNode = nodeIterator.nextNode()) {
|
||
|
/* Fix IE's strange behavior with manipulated textNodes #89 */
|
||
|
if (currentNode.nodeType === 3 && currentNode === oldNode) {
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
/* Sanitize tags and elements */
|
||
|
if (_sanitizeElements(currentNode)) {
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
/* Shadow DOM detected, sanitize it */
|
||
|
if (currentNode.content instanceof DocumentFragment) {
|
||
|
_sanitizeShadowDOM(currentNode.content);
|
||
|
}
|
||
|
|
||
|
/* Check attributes, sanitize if necessary */
|
||
|
_sanitizeAttributes(currentNode);
|
||
|
|
||
|
oldNode = currentNode;
|
||
|
}
|
||
|
|
||
|
oldNode = null;
|
||
|
|
||
|
/* If we sanitized `dirty` in-place, return it. */
|
||
|
if (IN_PLACE) {
|
||
|
return dirty;
|
||
|
}
|
||
|
|
||
|
/* Return sanitized string or DOM */
|
||
|
if (RETURN_DOM) {
|
||
|
if (RETURN_DOM_FRAGMENT) {
|
||
|
returnNode = createDocumentFragment.call(body.ownerDocument);
|
||
|
|
||
|
while (body.firstChild) {
|
||
|
returnNode.appendChild(body.firstChild);
|
||
|
}
|
||
|
} else {
|
||
|
returnNode = body;
|
||
|
}
|
||
|
|
||
|
if (RETURN_DOM_IMPORT) {
|
||
|
/* AdoptNode() is not used because internal state is not reset
|
||
|
(e.g. the past names map of a HTMLFormElement), this is safe
|
||
|
in theory but we would rather not risk another attack vector.
|
||
|
The state that is cloned by importNode() is explicitly defined
|
||
|
by the specs. */
|
||
|
returnNode = importNode.call(originalDocument, returnNode, true);
|
||
|
}
|
||
|
|
||
|
return returnNode;
|
||
|
}
|
||
|
|
||
|
var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
||
|
return trustedTypesPolicy ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Public method to set the configuration once
|
||
|
* setConfig
|
||
|
*
|
||
|
* @param {Object} cfg configuration object
|
||
|
*/
|
||
|
DOMPurify.setConfig = function (cfg) {
|
||
|
_parseConfig(cfg);
|
||
|
SET_CONFIG = true;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Public method to remove the configuration
|
||
|
* clearConfig
|
||
|
*
|
||
|
*/
|
||
|
DOMPurify.clearConfig = function () {
|
||
|
CONFIG = null;
|
||
|
SET_CONFIG = false;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Public method to check if an attribute value is valid.
|
||
|
* Uses last set config, if any. Otherwise, uses config defaults.
|
||
|
* isValidAttribute
|
||
|
*
|
||
|
* @param {string} tag Tag name of containing element.
|
||
|
* @param {string} attr Attribute name.
|
||
|
* @param {string} value Attribute value.
|
||
|
* @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
|
||
|
*/
|
||
|
DOMPurify.isValidAttribute = function (tag, attr, value) {
|
||
|
/* Initialize shared config vars if necessary. */
|
||
|
if (!CONFIG) {
|
||
|
_parseConfig({});
|
||
|
}
|
||
|
var lcTag = tag.toLowerCase();
|
||
|
var lcName = attr.toLowerCase();
|
||
|
return _isValidAttribute(lcTag, lcName, value);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* AddHook
|
||
|
* Public method to add DOMPurify hooks
|
||
|
*
|
||
|
* @param {String} entryPoint entry point for the hook to add
|
||
|
* @param {Function} hookFunction function to execute
|
||
|
*/
|
||
|
DOMPurify.addHook = function (entryPoint, hookFunction) {
|
||
|
if (typeof hookFunction !== 'function') {
|
||
|
return;
|
||
|
}
|
||
|
hooks[entryPoint] = hooks[entryPoint] || [];
|
||
|
hooks[entryPoint].push(hookFunction);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* RemoveHook
|
||
|
* Public method to remove a DOMPurify hook at a given entryPoint
|
||
|
* (pops it from the stack of hooks if more are present)
|
||
|
*
|
||
|
* @param {String} entryPoint entry point for the hook to remove
|
||
|
*/
|
||
|
DOMPurify.removeHook = function (entryPoint) {
|
||
|
if (hooks[entryPoint]) {
|
||
|
hooks[entryPoint].pop();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* RemoveHooks
|
||
|
* Public method to remove all DOMPurify hooks at a given entryPoint
|
||
|
*
|
||
|
* @param {String} entryPoint entry point for the hooks to remove
|
||
|
*/
|
||
|
DOMPurify.removeHooks = function (entryPoint) {
|
||
|
if (hooks[entryPoint]) {
|
||
|
hooks[entryPoint] = [];
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* RemoveAllHooks
|
||
|
* Public method to remove all DOMPurify hooks
|
||
|
*
|
||
|
*/
|
||
|
DOMPurify.removeAllHooks = function () {
|
||
|
hooks = {};
|
||
|
};
|
||
|
|
||
|
return DOMPurify;
|
||
|
}
|
||
|
|
||
|
var purify = createDOMPurify();
|
||
|
|
||
|
return purify;
|
||
|
|
||
|
})));
|
||
|
//# sourceMappingURL=purify.js.map
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./settings/node_modules/marked/lib/marked.js":
|
||
|
/*!****************************************************!*\
|
||
|
!*** ./settings/node_modules/marked/lib/marked.js ***!
|
||
|
\****************************************************/
|
||
|
/*! no static exports found */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
/* WEBPACK VAR INJECTION */(function(global) {/**
|
||
|
* marked - a markdown parser
|
||
|
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed)
|
||
|
* https://github.com/markedjs/marked
|
||
|
*/
|
||
|
|
||
|
;(function(root) {
|
||
|
'use strict';
|
||
|
|
||
|
/**
|
||
|
* Block-Level Grammar
|
||
|
*/
|
||
|
|
||
|
var block = {
|
||
|
newline: /^\n+/,
|
||
|
code: /^( {4}[^\n]+\n*)+/,
|
||
|
fences: noop,
|
||
|
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
|
||
|
heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,
|
||
|
nptable: noop,
|
||
|
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
|
||
|
list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
|
||
|
html: '^ {0,3}(?:' // optional indentation
|
||
|
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
||
|
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
||
|
+ '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
|
||
|
+ '|<![A-Z][\\s\\S]*?>\\n*' // (4)
|
||
|
+ '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
|
||
|
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
|
||
|
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
|
||
|
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
|
||
|
+ ')',
|
||
|
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
|
||
|
table: noop,
|
||
|
lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
|
||
|
paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,
|
||
|
text: /^[^\n]+/
|
||
|
};
|
||
|
|
||
|
block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
|
||
|
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
||
|
block.def = edit(block.def)
|
||
|
.replace('label', block._label)
|
||
|
.replace('title', block._title)
|
||
|
.getRegex();
|
||
|
|
||
|
block.bullet = /(?:[*+-]|\d{1,9}\.)/;
|
||
|
block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
|
||
|
block.item = edit(block.item, 'gm')
|
||
|
.replace(/bull/g, block.bullet)
|
||
|
.getRegex();
|
||
|
|
||
|
block.list = edit(block.list)
|
||
|
.replace(/bull/g, block.bullet)
|
||
|
.replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
|
||
|
.replace('def', '\\n+(?=' + block.def.source + ')')
|
||
|
.getRegex();
|
||
|
|
||
|
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
|
||
|
+ '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
|
||
|
+ '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
|
||
|
+ '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
|
||
|
+ '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
|
||
|
+ '|track|ul';
|
||
|
block._comment = /<!--(?!-?>)[\s\S]*?-->/;
|
||
|
block.html = edit(block.html, 'i')
|
||
|
.replace('comment', block._comment)
|
||
|
.replace('tag', block._tag)
|
||
|
.replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
|
||
|
.getRegex();
|
||
|
|
||
|
block.paragraph = edit(block.paragraph)
|
||
|
.replace('hr', block.hr)
|
||
|
.replace('heading', block.heading)
|
||
|
.replace('lheading', block.lheading)
|
||
|
.replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
|
||
|
.getRegex();
|
||
|
|
||
|
block.blockquote = edit(block.blockquote)
|
||
|
.replace('paragraph', block.paragraph)
|
||
|
.getRegex();
|
||
|
|
||
|
/**
|
||
|
* Normal Block Grammar
|
||
|
*/
|
||
|
|
||
|
block.normal = merge({}, block);
|
||
|
|
||
|
/**
|
||
|
* GFM Block Grammar
|
||
|
*/
|
||
|
|
||
|
block.gfm = merge({}, block.normal, {
|
||
|
fences: /^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
|
||
|
paragraph: /^/,
|
||
|
heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
|
||
|
});
|
||
|
|
||
|
block.gfm.paragraph = edit(block.paragraph)
|
||
|
.replace('(?!', '(?!'
|
||
|
+ block.gfm.fences.source.replace('\\1', '\\2') + '|'
|
||
|
+ block.list.source.replace('\\1', '\\3') + '|')
|
||
|
.getRegex();
|
||
|
|
||
|
/**
|
||
|
* GFM + Tables Block Grammar
|
||
|
*/
|
||
|
|
||
|
block.tables = merge({}, block.gfm, {
|
||
|
nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
|
||
|
table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/
|
||
|
});
|
||
|
|
||
|
/**
|
||
|
* Pedantic grammar
|
||
|
*/
|
||
|
|
||
|
block.pedantic = merge({}, block.normal, {
|
||
|
html: edit(
|
||
|
'^ *(?:comment *(?:\\n|\\s*$)'
|
||
|
+ '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
|
||
|
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
|
||
|
.replace('comment', block._comment)
|
||
|
.replace(/tag/g, '(?!(?:'
|
||
|
+ 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'
|
||
|
+ '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'
|
||
|
+ '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b')
|
||
|
.getRegex(),
|
||
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/
|
||
|
});
|
||
|
|
||
|
/**
|
||
|
* Block Lexer
|
||
|
*/
|
||
|
|
||
|
function Lexer(options) {
|
||
|
this.tokens = [];
|
||
|
this.tokens.links = Object.create(null);
|
||
|
this.options = options || marked.defaults;
|
||
|
this.rules = block.normal;
|
||
|
|
||
|
if (this.options.pedantic) {
|
||
|
this.rules = block.pedantic;
|
||
|
} else if (this.options.gfm) {
|
||
|
if (this.options.tables) {
|
||
|
this.rules = block.tables;
|
||
|
} else {
|
||
|
this.rules = block.gfm;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Expose Block Rules
|
||
|
*/
|
||
|
|
||
|
Lexer.rules = block;
|
||
|
|
||
|
/**
|
||
|
* Static Lex Method
|
||
|
*/
|
||
|
|
||
|
Lexer.lex = function(src, options) {
|
||
|
var lexer = new Lexer(options);
|
||
|
return lexer.lex(src);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Preprocessing
|
||
|
*/
|
||
|
|
||
|
Lexer.prototype.lex = function(src) {
|
||
|
src = src
|
||
|
.replace(/\r\n|\r/g, '\n')
|
||
|
.replace(/\t/g, ' ')
|
||
|
.replace(/\u00a0/g, ' ')
|
||
|
.replace(/\u2424/g, '\n');
|
||
|
|
||
|
return this.token(src, true);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Lexing
|
||
|
*/
|
||
|
|
||
|
Lexer.prototype.token = function(src, top) {
|
||
|
src = src.replace(/^ +$/gm, '');
|
||
|
var next,
|
||
|
loose,
|
||
|
cap,
|
||
|
bull,
|
||
|
b,
|
||
|
item,
|
||
|
listStart,
|
||
|
listItems,
|
||
|
t,
|
||
|
space,
|
||
|
i,
|
||
|
tag,
|
||
|
l,
|
||
|
isordered,
|
||
|
istask,
|
||
|
ischecked;
|
||
|
|
||
|
while (src) {
|
||
|
// newline
|
||
|
if (cap = this.rules.newline.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
if (cap[0].length > 1) {
|
||
|
this.tokens.push({
|
||
|
type: 'space'
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// code
|
||
|
if (cap = this.rules.code.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
cap = cap[0].replace(/^ {4}/gm, '');
|
||
|
this.tokens.push({
|
||
|
type: 'code',
|
||
|
text: !this.options.pedantic
|
||
|
? rtrim(cap, '\n')
|
||
|
: cap
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// fences (gfm)
|
||
|
if (cap = this.rules.fences.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
this.tokens.push({
|
||
|
type: 'code',
|
||
|
lang: cap[2] ? cap[2].trim() : cap[2],
|
||
|
text: cap[3] || ''
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// heading
|
||
|
if (cap = this.rules.heading.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
this.tokens.push({
|
||
|
type: 'heading',
|
||
|
depth: cap[1].length,
|
||
|
text: cap[2]
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// table no leading pipe (gfm)
|
||
|
if (top && (cap = this.rules.nptable.exec(src))) {
|
||
|
item = {
|
||
|
type: 'table',
|
||
|
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
||
|
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
||
|
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
|
||
|
};
|
||
|
|
||
|
if (item.header.length === item.align.length) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
|
||
|
for (i = 0; i < item.align.length; i++) {
|
||
|
if (/^ *-+: *$/.test(item.align[i])) {
|
||
|
item.align[i] = 'right';
|
||
|
} else if (/^ *:-+: *$/.test(item.align[i])) {
|
||
|
item.align[i] = 'center';
|
||
|
} else if (/^ *:-+ *$/.test(item.align[i])) {
|
||
|
item.align[i] = 'left';
|
||
|
} else {
|
||
|
item.align[i] = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
for (i = 0; i < item.cells.length; i++) {
|
||
|
item.cells[i] = splitCells(item.cells[i], item.header.length);
|
||
|
}
|
||
|
|
||
|
this.tokens.push(item);
|
||
|
|
||
|
continue;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// hr
|
||
|
if (cap = this.rules.hr.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
this.tokens.push({
|
||
|
type: 'hr'
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// blockquote
|
||
|
if (cap = this.rules.blockquote.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
|
||
|
this.tokens.push({
|
||
|
type: 'blockquote_start'
|
||
|
});
|
||
|
|
||
|
cap = cap[0].replace(/^ *> ?/gm, '');
|
||
|
|
||
|
// Pass `top` to keep the current
|
||
|
// "toplevel" state. This is exactly
|
||
|
// how markdown.pl works.
|
||
|
this.token(cap, top);
|
||
|
|
||
|
this.tokens.push({
|
||
|
type: 'blockquote_end'
|
||
|
});
|
||
|
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// list
|
||
|
if (cap = this.rules.list.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
bull = cap[2];
|
||
|
isordered = bull.length > 1;
|
||
|
|
||
|
listStart = {
|
||
|
type: 'list_start',
|
||
|
ordered: isordered,
|
||
|
start: isordered ? +bull : '',
|
||
|
loose: false
|
||
|
};
|
||
|
|
||
|
this.tokens.push(listStart);
|
||
|
|
||
|
// Get each top-level item.
|
||
|
cap = cap[0].match(this.rules.item);
|
||
|
|
||
|
listItems = [];
|
||
|
next = false;
|
||
|
l = cap.length;
|
||
|
i = 0;
|
||
|
|
||
|
for (; i < l; i++) {
|
||
|
item = cap[i];
|
||
|
|
||
|
// Remove the list item's bullet
|
||
|
// so it is seen as the next token.
|
||
|
space = item.length;
|
||
|
item = item.replace(/^ *([*+-]|\d+\.) */, '');
|
||
|
|
||
|
// Outdent whatever the
|
||
|
// list item contains. Hacky.
|
||
|
if (~item.indexOf('\n ')) {
|
||
|
space -= item.length;
|
||
|
item = !this.options.pedantic
|
||
|
? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
|
||
|
: item.replace(/^ {1,4}/gm, '');
|
||
|
}
|
||
|
|
||
|
// Determine whether the next list item belongs here.
|
||
|
// Backpedal if it does not belong in this list.
|
||
|
if (i !== l - 1) {
|
||
|
b = block.bullet.exec(cap[i + 1])[0];
|
||
|
if (bull.length > 1 ? b.length === 1
|
||
|
: (b.length > 1 || (this.options.smartLists && b !== bull))) {
|
||
|
src = cap.slice(i + 1).join('\n') + src;
|
||
|
i = l - 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Determine whether item is loose or not.
|
||
|
// Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
|
||
|
// for discount behavior.
|
||
|
loose = next || /\n\n(?!\s*$)/.test(item);
|
||
|
if (i !== l - 1) {
|
||
|
next = item.charAt(item.length - 1) === '\n';
|
||
|
if (!loose) loose = next;
|
||
|
}
|
||
|
|
||
|
if (loose) {
|
||
|
listStart.loose = true;
|
||
|
}
|
||
|
|
||
|
// Check for task list items
|
||
|
istask = /^\[[ xX]\] /.test(item);
|
||
|
ischecked = undefined;
|
||
|
if (istask) {
|
||
|
ischecked = item[1] !== ' ';
|
||
|
item = item.replace(/^\[[ xX]\] +/, '');
|
||
|
}
|
||
|
|
||
|
t = {
|
||
|
type: 'list_item_start',
|
||
|
task: istask,
|
||
|
checked: ischecked,
|
||
|
loose: loose
|
||
|
};
|
||
|
|
||
|
listItems.push(t);
|
||
|
this.tokens.push(t);
|
||
|
|
||
|
// Recurse.
|
||
|
this.token(item, false);
|
||
|
|
||
|
this.tokens.push({
|
||
|
type: 'list_item_end'
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (listStart.loose) {
|
||
|
l = listItems.length;
|
||
|
i = 0;
|
||
|
for (; i < l; i++) {
|
||
|
listItems[i].loose = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
this.tokens.push({
|
||
|
type: 'list_end'
|
||
|
});
|
||
|
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// html
|
||
|
if (cap = this.rules.html.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
this.tokens.push({
|
||
|
type: this.options.sanitize
|
||
|
? 'paragraph'
|
||
|
: 'html',
|
||
|
pre: !this.options.sanitizer
|
||
|
&& (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
||
|
text: cap[0]
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// def
|
||
|
if (top && (cap = this.rules.def.exec(src))) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
|
||
|
tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
|
||
|
if (!this.tokens.links[tag]) {
|
||
|
this.tokens.links[tag] = {
|
||
|
href: cap[2],
|
||
|
title: cap[3]
|
||
|
};
|
||
|
}
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// table (gfm)
|
||
|
if (top && (cap = this.rules.table.exec(src))) {
|
||
|
item = {
|
||
|
type: 'table',
|
||
|
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
||
|
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
||
|
cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : []
|
||
|
};
|
||
|
|
||
|
if (item.header.length === item.align.length) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
|
||
|
for (i = 0; i < item.align.length; i++) {
|
||
|
if (/^ *-+: *$/.test(item.align[i])) {
|
||
|
item.align[i] = 'right';
|
||
|
} else if (/^ *:-+: *$/.test(item.align[i])) {
|
||
|
item.align[i] = 'center';
|
||
|
} else if (/^ *:-+ *$/.test(item.align[i])) {
|
||
|
item.align[i] = 'left';
|
||
|
} else {
|
||
|
item.align[i] = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
for (i = 0; i < item.cells.length; i++) {
|
||
|
item.cells[i] = splitCells(
|
||
|
item.cells[i].replace(/^ *\| *| *\| *$/g, ''),
|
||
|
item.header.length);
|
||
|
}
|
||
|
|
||
|
this.tokens.push(item);
|
||
|
|
||
|
continue;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// lheading
|
||
|
if (cap = this.rules.lheading.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
this.tokens.push({
|
||
|
type: 'heading',
|
||
|
depth: cap[2] === '=' ? 1 : 2,
|
||
|
text: cap[1]
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// top-level paragraph
|
||
|
if (top && (cap = this.rules.paragraph.exec(src))) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
this.tokens.push({
|
||
|
type: 'paragraph',
|
||
|
text: cap[1].charAt(cap[1].length - 1) === '\n'
|
||
|
? cap[1].slice(0, -1)
|
||
|
: cap[1]
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// text
|
||
|
if (cap = this.rules.text.exec(src)) {
|
||
|
// Top-level should never reach here.
|
||
|
src = src.substring(cap[0].length);
|
||
|
this.tokens.push({
|
||
|
type: 'text',
|
||
|
text: cap[0]
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
if (src) {
|
||
|
throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return this.tokens;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Inline-Level Grammar
|
||
|
*/
|
||
|
|
||
|
var inline = {
|
||
|
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
||
|
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
|
||
|
url: noop,
|
||
|
tag: '^comment'
|
||
|
+ '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
|
||
|
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
|
||
|
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
|
||
|
+ '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
|
||
|
+ '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>', // CDATA section
|
||
|
link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,
|
||
|
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
|
||
|
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
|
||
|
strong: /^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
|
||
|
em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
|
||
|
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
||
|
br: /^( {2,}|\\)\n(?!\s*$)/,
|
||
|
del: noop,
|
||
|
text: /^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|\b_| {2,}\n|$)/
|
||
|
};
|
||
|
|
||
|
// list of punctuation marks from common mark spec
|
||
|
// without ` and ] to workaround Rule 17 (inline code blocks/links)
|
||
|
inline._punctuation = '!"#$%&\'()*+,\\-./:;<=>?@\\[^_{|}~';
|
||
|
inline.em = edit(inline.em).replace(/punctuation/g, inline._punctuation).getRegex();
|
||
|
|
||
|
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
||
|
|
||
|
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
||
|
inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
|
||
|
inline.autolink = edit(inline.autolink)
|
||
|
.replace('scheme', inline._scheme)
|
||
|
.replace('email', inline._email)
|
||
|
.getRegex();
|
||
|
|
||
|
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
||
|
|
||
|
inline.tag = edit(inline.tag)
|
||
|
.replace('comment', block._comment)
|
||
|
.replace('attribute', inline._attribute)
|
||
|
.getRegex();
|
||
|
|
||
|
inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/;
|
||
|
inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/;
|
||
|
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
||
|
|
||
|
inline.link = edit(inline.link)
|
||
|
.replace('label', inline._label)
|
||
|
.replace('href', inline._href)
|
||
|
.replace('title', inline._title)
|
||
|
.getRegex();
|
||
|
|
||
|
inline.reflink = edit(inline.reflink)
|
||
|
.replace('label', inline._label)
|
||
|
.getRegex();
|
||
|
|
||
|
/**
|
||
|
* Normal Inline Grammar
|
||
|
*/
|
||
|
|
||
|
inline.normal = merge({}, inline);
|
||
|
|
||
|
/**
|
||
|
* Pedantic Inline Grammar
|
||
|
*/
|
||
|
|
||
|
inline.pedantic = merge({}, inline.normal, {
|
||
|
strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
||
|
em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
|
||
|
link: edit(/^!?\[(label)\]\((.*?)\)/)
|
||
|
.replace('label', inline._label)
|
||
|
.getRegex(),
|
||
|
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
|
||
|
.replace('label', inline._label)
|
||
|
.getRegex()
|
||
|
});
|
||
|
|
||
|
/**
|
||
|
* GFM Inline Grammar
|
||
|
*/
|
||
|
|
||
|
inline.gfm = merge({}, inline.normal, {
|
||
|
escape: edit(inline.escape).replace('])', '~|])').getRegex(),
|
||
|
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
||
|
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
||
|
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
||
|
del: /^~+(?=\S)([\s\S]*?\S)~+/,
|
||
|
text: edit(inline.text)
|
||
|
.replace(']|', '~]|')
|
||
|
.replace('|$', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|$')
|
||
|
.getRegex()
|
||
|
});
|
||
|
|
||
|
inline.gfm.url = edit(inline.gfm.url, 'i')
|
||
|
.replace('email', inline.gfm._extended_email)
|
||
|
.getRegex();
|
||
|
/**
|
||
|
* GFM + Line Breaks Inline Grammar
|
||
|
*/
|
||
|
|
||
|
inline.breaks = merge({}, inline.gfm, {
|
||
|
br: edit(inline.br).replace('{2,}', '*').getRegex(),
|
||
|
text: edit(inline.gfm.text).replace('{2,}', '*').getRegex()
|
||
|
});
|
||
|
|
||
|
/**
|
||
|
* Inline Lexer & Compiler
|
||
|
*/
|
||
|
|
||
|
function InlineLexer(links, options) {
|
||
|
this.options = options || marked.defaults;
|
||
|
this.links = links;
|
||
|
this.rules = inline.normal;
|
||
|
this.renderer = this.options.renderer || new Renderer();
|
||
|
this.renderer.options = this.options;
|
||
|
|
||
|
if (!this.links) {
|
||
|
throw new Error('Tokens array requires a `links` property.');
|
||
|
}
|
||
|
|
||
|
if (this.options.pedantic) {
|
||
|
this.rules = inline.pedantic;
|
||
|
} else if (this.options.gfm) {
|
||
|
if (this.options.breaks) {
|
||
|
this.rules = inline.breaks;
|
||
|
} else {
|
||
|
this.rules = inline.gfm;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Expose Inline Rules
|
||
|
*/
|
||
|
|
||
|
InlineLexer.rules = inline;
|
||
|
|
||
|
/**
|
||
|
* Static Lexing/Compiling Method
|
||
|
*/
|
||
|
|
||
|
InlineLexer.output = function(src, links, options) {
|
||
|
var inline = new InlineLexer(links, options);
|
||
|
return inline.output(src);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Lexing/Compiling
|
||
|
*/
|
||
|
|
||
|
InlineLexer.prototype.output = function(src) {
|
||
|
var out = '',
|
||
|
link,
|
||
|
text,
|
||
|
href,
|
||
|
title,
|
||
|
cap,
|
||
|
prevCapZero;
|
||
|
|
||
|
while (src) {
|
||
|
// escape
|
||
|
if (cap = this.rules.escape.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
out += escape(cap[1]);
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// tag
|
||
|
if (cap = this.rules.tag.exec(src)) {
|
||
|
if (!this.inLink && /^<a /i.test(cap[0])) {
|
||
|
this.inLink = true;
|
||
|
} else if (this.inLink && /^<\/a>/i.test(cap[0])) {
|
||
|
this.inLink = false;
|
||
|
}
|
||
|
if (!this.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
||
|
this.inRawBlock = true;
|
||
|
} else if (this.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
||
|
this.inRawBlock = false;
|
||
|
}
|
||
|
|
||
|
src = src.substring(cap[0].length);
|
||
|
out += this.options.sanitize
|
||
|
? this.options.sanitizer
|
||
|
? this.options.sanitizer(cap[0])
|
||
|
: escape(cap[0])
|
||
|
: cap[0];
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// link
|
||
|
if (cap = this.rules.link.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
this.inLink = true;
|
||
|
href = cap[2];
|
||
|
if (this.options.pedantic) {
|
||
|
link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
|
||
|
|
||
|
if (link) {
|
||
|
href = link[1];
|
||
|
title = link[3];
|
||
|
} else {
|
||
|
title = '';
|
||
|
}
|
||
|
} else {
|
||
|
title = cap[3] ? cap[3].slice(1, -1) : '';
|
||
|
}
|
||
|
href = href.trim().replace(/^<([\s\S]*)>$/, '$1');
|
||
|
out += this.outputLink(cap, {
|
||
|
href: InlineLexer.escapes(href),
|
||
|
title: InlineLexer.escapes(title)
|
||
|
});
|
||
|
this.inLink = false;
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// reflink, nolink
|
||
|
if ((cap = this.rules.reflink.exec(src))
|
||
|
|| (cap = this.rules.nolink.exec(src))) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
|
||
|
link = this.links[link.toLowerCase()];
|
||
|
if (!link || !link.href) {
|
||
|
out += cap[0].charAt(0);
|
||
|
src = cap[0].substring(1) + src;
|
||
|
continue;
|
||
|
}
|
||
|
this.inLink = true;
|
||
|
out += this.outputLink(cap, link);
|
||
|
this.inLink = false;
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// strong
|
||
|
if (cap = this.rules.strong.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
out += this.renderer.strong(this.output(cap[4] || cap[3] || cap[2] || cap[1]));
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// em
|
||
|
if (cap = this.rules.em.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
out += this.renderer.em(this.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1]));
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// code
|
||
|
if (cap = this.rules.code.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
out += this.renderer.codespan(escape(cap[2].trim(), true));
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// br
|
||
|
if (cap = this.rules.br.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
out += this.renderer.br();
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// del (gfm)
|
||
|
if (cap = this.rules.del.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
out += this.renderer.del(this.output(cap[1]));
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// autolink
|
||
|
if (cap = this.rules.autolink.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
if (cap[2] === '@') {
|
||
|
text = escape(this.mangle(cap[1]));
|
||
|
href = 'mailto:' + text;
|
||
|
} else {
|
||
|
text = escape(cap[1]);
|
||
|
href = text;
|
||
|
}
|
||
|
out += this.renderer.link(href, null, text);
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// url (gfm)
|
||
|
if (!this.inLink && (cap = this.rules.url.exec(src))) {
|
||
|
if (cap[2] === '@') {
|
||
|
text = escape(cap[0]);
|
||
|
href = 'mailto:' + text;
|
||
|
} else {
|
||
|
// do extended autolink path validation
|
||
|
do {
|
||
|
prevCapZero = cap[0];
|
||
|
cap[0] = this.rules._backpedal.exec(cap[0])[0];
|
||
|
} while (prevCapZero !== cap[0]);
|
||
|
text = escape(cap[0]);
|
||
|
if (cap[1] === 'www.') {
|
||
|
href = 'http://' + text;
|
||
|
} else {
|
||
|
href = text;
|
||
|
}
|
||
|
}
|
||
|
src = src.substring(cap[0].length);
|
||
|
out += this.renderer.link(href, null, text);
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
// text
|
||
|
if (cap = this.rules.text.exec(src)) {
|
||
|
src = src.substring(cap[0].length);
|
||
|
if (this.inRawBlock) {
|
||
|
out += this.renderer.text(cap[0]);
|
||
|
} else {
|
||
|
out += this.renderer.text(escape(this.smartypants(cap[0])));
|
||
|
}
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
if (src) {
|
||
|
throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return out;
|
||
|
};
|
||
|
|
||
|
InlineLexer.escapes = function(text) {
|
||
|
return text ? text.replace(InlineLexer.rules._escapes, '$1') : text;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Compile Link
|
||
|
*/
|
||
|
|
||
|
InlineLexer.prototype.outputLink = function(cap, link) {
|
||
|
var href = link.href,
|
||
|
title = link.title ? escape(link.title) : null;
|
||
|
|
||
|
return cap[0].charAt(0) !== '!'
|
||
|
? this.renderer.link(href, title, this.output(cap[1]))
|
||
|
: this.renderer.image(href, title, escape(cap[1]));
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Smartypants Transformations
|
||
|
*/
|
||
|
|
||
|
InlineLexer.prototype.smartypants = function(text) {
|
||
|
if (!this.options.smartypants) return text;
|
||
|
return text
|
||
|
// em-dashes
|
||
|
.replace(/---/g, '\u2014')
|
||
|
// en-dashes
|
||
|
.replace(/--/g, '\u2013')
|
||
|
// opening singles
|
||
|
.replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
|
||
|
// closing singles & apostrophes
|
||
|
.replace(/'/g, '\u2019')
|
||
|
// opening doubles
|
||
|
.replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
|
||
|
// closing doubles
|
||
|
.replace(/"/g, '\u201d')
|
||
|
// ellipses
|
||
|
.replace(/\.{3}/g, '\u2026');
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Mangle Links
|
||
|
*/
|
||
|
|
||
|
InlineLexer.prototype.mangle = function(text) {
|
||
|
if (!this.options.mangle) return text;
|
||
|
var out = '',
|
||
|
l = text.length,
|
||
|
i = 0,
|
||
|
ch;
|
||
|
|
||
|
for (; i < l; i++) {
|
||
|
ch = text.charCodeAt(i);
|
||
|
if (Math.random() > 0.5) {
|
||
|
ch = 'x' + ch.toString(16);
|
||
|
}
|
||
|
out += '&#' + ch + ';';
|
||
|
}
|
||
|
|
||
|
return out;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Renderer
|
||
|
*/
|
||
|
|
||
|
function Renderer(options) {
|
||
|
this.options = options || marked.defaults;
|
||
|
}
|
||
|
|
||
|
Renderer.prototype.code = function(code, infostring, escaped) {
|
||
|
var lang = (infostring || '').match(/\S*/)[0];
|
||
|
if (this.options.highlight) {
|
||
|
var out = this.options.highlight(code, lang);
|
||
|
if (out != null && out !== code) {
|
||
|
escaped = true;
|
||
|
code = out;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (!lang) {
|
||
|
return '<pre><code>'
|
||
|
+ (escaped ? code : escape(code, true))
|
||
|
+ '</code></pre>';
|
||
|
}
|
||
|
|
||
|
return '<pre><code class="'
|
||
|
+ this.options.langPrefix
|
||
|
+ escape(lang, true)
|
||
|
+ '">'
|
||
|
+ (escaped ? code : escape(code, true))
|
||
|
+ '</code></pre>\n';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.blockquote = function(quote) {
|
||
|
return '<blockquote>\n' + quote + '</blockquote>\n';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.html = function(html) {
|
||
|
return html;
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.heading = function(text, level, raw, slugger) {
|
||
|
if (this.options.headerIds) {
|
||
|
return '<h'
|
||
|
+ level
|
||
|
+ ' id="'
|
||
|
+ this.options.headerPrefix
|
||
|
+ slugger.slug(raw)
|
||
|
+ '">'
|
||
|
+ text
|
||
|
+ '</h'
|
||
|
+ level
|
||
|
+ '>\n';
|
||
|
}
|
||
|
// ignore IDs
|
||
|
return '<h' + level + '>' + text + '</h' + level + '>\n';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.hr = function() {
|
||
|
return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.list = function(body, ordered, start) {
|
||
|
var type = ordered ? 'ol' : 'ul',
|
||
|
startatt = (ordered && start !== 1) ? (' start="' + start + '"') : '';
|
||
|
return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.listitem = function(text) {
|
||
|
return '<li>' + text + '</li>\n';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.checkbox = function(checked) {
|
||
|
return '<input '
|
||
|
+ (checked ? 'checked="" ' : '')
|
||
|
+ 'disabled="" type="checkbox"'
|
||
|
+ (this.options.xhtml ? ' /' : '')
|
||
|
+ '> ';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.paragraph = function(text) {
|
||
|
return '<p>' + text + '</p>\n';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.table = function(header, body) {
|
||
|
if (body) body = '<tbody>' + body + '</tbody>';
|
||
|
|
||
|
return '<table>\n'
|
||
|
+ '<thead>\n'
|
||
|
+ header
|
||
|
+ '</thead>\n'
|
||
|
+ body
|
||
|
+ '</table>\n';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.tablerow = function(content) {
|
||
|
return '<tr>\n' + content + '</tr>\n';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.tablecell = function(content, flags) {
|
||
|
var type = flags.header ? 'th' : 'td';
|
||
|
var tag = flags.align
|
||
|
? '<' + type + ' align="' + flags.align + '">'
|
||
|
: '<' + type + '>';
|
||
|
return tag + content + '</' + type + '>\n';
|
||
|
};
|
||
|
|
||
|
// span level renderer
|
||
|
Renderer.prototype.strong = function(text) {
|
||
|
return '<strong>' + text + '</strong>';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.em = function(text) {
|
||
|
return '<em>' + text + '</em>';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.codespan = function(text) {
|
||
|
return '<code>' + text + '</code>';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.br = function() {
|
||
|
return this.options.xhtml ? '<br/>' : '<br>';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.del = function(text) {
|
||
|
return '<del>' + text + '</del>';
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.link = function(href, title, text) {
|
||
|
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
||
|
if (href === null) {
|
||
|
return text;
|
||
|
}
|
||
|
var out = '<a href="' + escape(href) + '"';
|
||
|
if (title) {
|
||
|
out += ' title="' + title + '"';
|
||
|
}
|
||
|
out += '>' + text + '</a>';
|
||
|
return out;
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.image = function(href, title, text) {
|
||
|
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
||
|
if (href === null) {
|
||
|
return text;
|
||
|
}
|
||
|
|
||
|
var out = '<img src="' + href + '" alt="' + text + '"';
|
||
|
if (title) {
|
||
|
out += ' title="' + title + '"';
|
||
|
}
|
||
|
out += this.options.xhtml ? '/>' : '>';
|
||
|
return out;
|
||
|
};
|
||
|
|
||
|
Renderer.prototype.text = function(text) {
|
||
|
return text;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* TextRenderer
|
||
|
* returns only the textual part of the token
|
||
|
*/
|
||
|
|
||
|
function TextRenderer() {}
|
||
|
|
||
|
// no need for block level renderers
|
||
|
|
||
|
TextRenderer.prototype.strong =
|
||
|
TextRenderer.prototype.em =
|
||
|
TextRenderer.prototype.codespan =
|
||
|
TextRenderer.prototype.del =
|
||
|
TextRenderer.prototype.text = function (text) {
|
||
|
return text;
|
||
|
};
|
||
|
|
||
|
TextRenderer.prototype.link =
|
||
|
TextRenderer.prototype.image = function(href, title, text) {
|
||
|
return '' + text;
|
||
|
};
|
||
|
|
||
|
TextRenderer.prototype.br = function() {
|
||
|
return '';
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Parsing & Compiling
|
||
|
*/
|
||
|
|
||
|
function Parser(options) {
|
||
|
this.tokens = [];
|
||
|
this.token = null;
|
||
|
this.options = options || marked.defaults;
|
||
|
this.options.renderer = this.options.renderer || new Renderer();
|
||
|
this.renderer = this.options.renderer;
|
||
|
this.renderer.options = this.options;
|
||
|
this.slugger = new Slugger();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Static Parse Method
|
||
|
*/
|
||
|
|
||
|
Parser.parse = function(src, options) {
|
||
|
var parser = new Parser(options);
|
||
|
return parser.parse(src);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Parse Loop
|
||
|
*/
|
||
|
|
||
|
Parser.prototype.parse = function(src) {
|
||
|
this.inline = new InlineLexer(src.links, this.options);
|
||
|
// use an InlineLexer with a TextRenderer to extract pure text
|
||
|
this.inlineText = new InlineLexer(
|
||
|
src.links,
|
||
|
merge({}, this.options, {renderer: new TextRenderer()})
|
||
|
);
|
||
|
this.tokens = src.reverse();
|
||
|
|
||
|
var out = '';
|
||
|
while (this.next()) {
|
||
|
out += this.tok();
|
||
|
}
|
||
|
|
||
|
return out;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Next Token
|
||
|
*/
|
||
|
|
||
|
Parser.prototype.next = function() {
|
||
|
return this.token = this.tokens.pop();
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Preview Next Token
|
||
|
*/
|
||
|
|
||
|
Parser.prototype.peek = function() {
|
||
|
return this.tokens[this.tokens.length - 1] || 0;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Parse Text Tokens
|
||
|
*/
|
||
|
|
||
|
Parser.prototype.parseText = function() {
|
||
|
var body = this.token.text;
|
||
|
|
||
|
while (this.peek().type === 'text') {
|
||
|
body += '\n' + this.next().text;
|
||
|
}
|
||
|
|
||
|
return this.inline.output(body);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Parse Current Token
|
||
|
*/
|
||
|
|
||
|
Parser.prototype.tok = function() {
|
||
|
switch (this.token.type) {
|
||
|
case 'space': {
|
||
|
return '';
|
||
|
}
|
||
|
case 'hr': {
|
||
|
return this.renderer.hr();
|
||
|
}
|
||
|
case 'heading': {
|
||
|
return this.renderer.heading(
|
||
|
this.inline.output(this.token.text),
|
||
|
this.token.depth,
|
||
|
unescape(this.inlineText.output(this.token.text)),
|
||
|
this.slugger);
|
||
|
}
|
||
|
case 'code': {
|
||
|
return this.renderer.code(this.token.text,
|
||
|
this.token.lang,
|
||
|
this.token.escaped);
|
||
|
}
|
||
|
case 'table': {
|
||
|
var header = '',
|
||
|
body = '',
|
||
|
i,
|
||
|
row,
|
||
|
cell,
|
||
|
j;
|
||
|
|
||
|
// header
|
||
|
cell = '';
|
||
|
for (i = 0; i < this.token.header.length; i++) {
|
||
|
cell += this.renderer.tablecell(
|
||
|
this.inline.output(this.token.header[i]),
|
||
|
{ header: true, align: this.token.align[i] }
|
||
|
);
|
||
|
}
|
||
|
header += this.renderer.tablerow(cell);
|
||
|
|
||
|
for (i = 0; i < this.token.cells.length; i++) {
|
||
|
row = this.token.cells[i];
|
||
|
|
||
|
cell = '';
|
||
|
for (j = 0; j < row.length; j++) {
|
||
|
cell += this.renderer.tablecell(
|
||
|
this.inline.output(row[j]),
|
||
|
{ header: false, align: this.token.align[j] }
|
||
|
);
|
||
|
}
|
||
|
|
||
|
body += this.renderer.tablerow(cell);
|
||
|
}
|
||
|
return this.renderer.table(header, body);
|
||
|
}
|
||
|
case 'blockquote_start': {
|
||
|
body = '';
|
||
|
|
||
|
while (this.next().type !== 'blockquote_end') {
|
||
|
body += this.tok();
|
||
|
}
|
||
|
|
||
|
return this.renderer.blockquote(body);
|
||
|
}
|
||
|
case 'list_start': {
|
||
|
body = '';
|
||
|
var ordered = this.token.ordered,
|
||
|
start = this.token.start;
|
||
|
|
||
|
while (this.next().type !== 'list_end') {
|
||
|
body += this.tok();
|
||
|
}
|
||
|
|
||
|
return this.renderer.list(body, ordered, start);
|
||
|
}
|
||
|
case 'list_item_start': {
|
||
|
body = '';
|
||
|
var loose = this.token.loose;
|
||
|
|
||
|
if (this.token.task) {
|
||
|
body += this.renderer.checkbox(this.token.checked);
|
||
|
}
|
||
|
|
||
|
while (this.next().type !== 'list_item_end') {
|
||
|
body += !loose && this.token.type === 'text'
|
||
|
? this.parseText()
|
||
|
: this.tok();
|
||
|
}
|
||
|
|
||
|
return this.renderer.listitem(body);
|
||
|
}
|
||
|
case 'html': {
|
||
|
// TODO parse inline content if parameter markdown=1
|
||
|
return this.renderer.html(this.token.text);
|
||
|
}
|
||
|
case 'paragraph': {
|
||
|
return this.renderer.paragraph(this.inline.output(this.token.text));
|
||
|
}
|
||
|
case 'text': {
|
||
|
return this.renderer.paragraph(this.parseText());
|
||
|
}
|
||
|
default: {
|
||
|
var errMsg = 'Token with "' + this.token.type + '" type was not found.';
|
||
|
if (this.options.silent) {
|
||
|
console.log(errMsg);
|
||
|
} else {
|
||
|
throw new Error(errMsg);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Slugger generates header id
|
||
|
*/
|
||
|
|
||
|
function Slugger () {
|
||
|
this.seen = {};
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Convert string to unique id
|
||
|
*/
|
||
|
|
||
|
Slugger.prototype.slug = function (value) {
|
||
|
var slug = value
|
||
|
.toLowerCase()
|
||
|
.trim()
|
||
|
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
|
||
|
.replace(/\s/g, '-');
|
||
|
|
||
|
if (this.seen.hasOwnProperty(slug)) {
|
||
|
var originalSlug = slug;
|
||
|
do {
|
||
|
this.seen[originalSlug]++;
|
||
|
slug = originalSlug + '-' + this.seen[originalSlug];
|
||
|
} while (this.seen.hasOwnProperty(slug));
|
||
|
}
|
||
|
this.seen[slug] = 0;
|
||
|
|
||
|
return slug;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Helpers
|
||
|
*/
|
||
|
|
||
|
function escape(html, encode) {
|
||
|
if (encode) {
|
||
|
if (escape.escapeTest.test(html)) {
|
||
|
return html.replace(escape.escapeReplace, function (ch) { return escape.replacements[ch]; });
|
||
|
}
|
||
|
} else {
|
||
|
if (escape.escapeTestNoEncode.test(html)) {
|
||
|
return html.replace(escape.escapeReplaceNoEncode, function (ch) { return escape.replacements[ch]; });
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return html;
|
||
|
}
|
||
|
|
||
|
escape.escapeTest = /[&<>"']/;
|
||
|
escape.escapeReplace = /[&<>"']/g;
|
||
|
escape.replacements = {
|
||
|
'&': '&',
|
||
|
'<': '<',
|
||
|
'>': '>',
|
||
|
'"': '"',
|
||
|
"'": '''
|
||
|
};
|
||
|
|
||
|
escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
|
||
|
escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
|
||
|
|
||
|
function unescape(html) {
|
||
|
// explicitly match decimal, hex, and named HTML entities
|
||
|
return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) {
|
||
|
n = n.toLowerCase();
|
||
|
if (n === 'colon') return ':';
|
||
|
if (n.charAt(0) === '#') {
|
||
|
return n.charAt(1) === 'x'
|
||
|
? String.fromCharCode(parseInt(n.substring(2), 16))
|
||
|
: String.fromCharCode(+n.substring(1));
|
||
|
}
|
||
|
return '';
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function edit(regex, opt) {
|
||
|
regex = regex.source || regex;
|
||
|
opt = opt || '';
|
||
|
return {
|
||
|
replace: function(name, val) {
|
||
|
val = val.source || val;
|
||
|
val = val.replace(/(^|[^\[])\^/g, '$1');
|
||
|
regex = regex.replace(name, val);
|
||
|
return this;
|
||
|
},
|
||
|
getRegex: function() {
|
||
|
return new RegExp(regex, opt);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function cleanUrl(sanitize, base, href) {
|
||
|
if (sanitize) {
|
||
|
try {
|
||
|
var prot = decodeURIComponent(unescape(href))
|
||
|
.replace(/[^\w:]/g, '')
|
||
|
.toLowerCase();
|
||
|
} catch (e) {
|
||
|
return null;
|
||
|
}
|
||
|
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
if (base && !originIndependentUrl.test(href)) {
|
||
|
href = resolveUrl(base, href);
|
||
|
}
|
||
|
try {
|
||
|
href = encodeURI(href).replace(/%25/g, '%');
|
||
|
} catch (e) {
|
||
|
return null;
|
||
|
}
|
||
|
return href;
|
||
|
}
|
||
|
|
||
|
function resolveUrl(base, href) {
|
||
|
if (!baseUrls[' ' + base]) {
|
||
|
// we can ignore everything in base after the last slash of its path component,
|
||
|
// but we might need to add _that_
|
||
|
// https://tools.ietf.org/html/rfc3986#section-3
|
||
|
if (/^[^:]+:\/*[^/]*$/.test(base)) {
|
||
|
baseUrls[' ' + base] = base + '/';
|
||
|
} else {
|
||
|
baseUrls[' ' + base] = rtrim(base, '/', true);
|
||
|
}
|
||
|
}
|
||
|
base = baseUrls[' ' + base];
|
||
|
|
||
|
if (href.slice(0, 2) === '//') {
|
||
|
return base.replace(/:[\s\S]*/, ':') + href;
|
||
|
} else if (href.charAt(0) === '/') {
|
||
|
return base.replace(/(:\/*[^/]*)[\s\S]*/, '$1') + href;
|
||
|
} else {
|
||
|
return base + href;
|
||
|
}
|
||
|
}
|
||
|
var baseUrls = {};
|
||
|
var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
||
|
|
||
|
function noop() {}
|
||
|
noop.exec = noop;
|
||
|
|
||
|
function merge(obj) {
|
||
|
var i = 1,
|
||
|
target,
|
||
|
key;
|
||
|
|
||
|
for (; i < arguments.length; i++) {
|
||
|
target = arguments[i];
|
||
|
for (key in target) {
|
||
|
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
||
|
obj[key] = target[key];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return obj;
|
||
|
}
|
||
|
|
||
|
function splitCells(tableRow, count) {
|
||
|
// ensure that every cell-delimiting pipe has a space
|
||
|
// before it to distinguish it from an escaped pipe
|
||
|
var row = tableRow.replace(/\|/g, function (match, offset, str) {
|
||
|
var escaped = false,
|
||
|
curr = offset;
|
||
|
while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
|
||
|
if (escaped) {
|
||
|
// odd number of slashes means | is escaped
|
||
|
// so we leave it alone
|
||
|
return '|';
|
||
|
} else {
|
||
|
// add space before unescaped |
|
||
|
return ' |';
|
||
|
}
|
||
|
}),
|
||
|
cells = row.split(/ \|/),
|
||
|
i = 0;
|
||
|
|
||
|
if (cells.length > count) {
|
||
|
cells.splice(count);
|
||
|
} else {
|
||
|
while (cells.length < count) cells.push('');
|
||
|
}
|
||
|
|
||
|
for (; i < cells.length; i++) {
|
||
|
// leading or trailing whitespace is ignored per the gfm spec
|
||
|
cells[i] = cells[i].trim().replace(/\\\|/g, '|');
|
||
|
}
|
||
|
return cells;
|
||
|
}
|
||
|
|
||
|
// Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
|
||
|
// /c*$/ is vulnerable to REDOS.
|
||
|
// invert: Remove suffix of non-c chars instead. Default falsey.
|
||
|
function rtrim(str, c, invert) {
|
||
|
if (str.length === 0) {
|
||
|
return '';
|
||
|
}
|
||
|
|
||
|
// Length of suffix matching the invert condition.
|
||
|
var suffLen = 0;
|
||
|
|
||
|
// Step left until we fail to match the invert condition.
|
||
|
while (suffLen < str.length) {
|
||
|
var currChar = str.charAt(str.length - suffLen - 1);
|
||
|
if (currChar === c && !invert) {
|
||
|
suffLen++;
|
||
|
} else if (currChar !== c && invert) {
|
||
|
suffLen++;
|
||
|
} else {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return str.substr(0, str.length - suffLen);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Marked
|
||
|
*/
|
||
|
|
||
|
function marked(src, opt, callback) {
|
||
|
// throw error in case of non string input
|
||
|
if (typeof src === 'undefined' || src === null) {
|
||
|
throw new Error('marked(): input parameter is undefined or null');
|
||
|
}
|
||
|
if (typeof src !== 'string') {
|
||
|
throw new Error('marked(): input parameter is of type '
|
||
|
+ Object.prototype.toString.call(src) + ', string expected');
|
||
|
}
|
||
|
|
||
|
if (callback || typeof opt === 'function') {
|
||
|
if (!callback) {
|
||
|
callback = opt;
|
||
|
opt = null;
|
||
|
}
|
||
|
|
||
|
opt = merge({}, marked.defaults, opt || {});
|
||
|
|
||
|
var highlight = opt.highlight,
|
||
|
tokens,
|
||
|
pending,
|
||
|
i = 0;
|
||
|
|
||
|
try {
|
||
|
tokens = Lexer.lex(src, opt);
|
||
|
} catch (e) {
|
||
|
return callback(e);
|
||
|
}
|
||
|
|
||
|
pending = tokens.length;
|
||
|
|
||
|
var done = function(err) {
|
||
|
if (err) {
|
||
|
opt.highlight = highlight;
|
||
|
return callback(err);
|
||
|
}
|
||
|
|
||
|
var out;
|
||
|
|
||
|
try {
|
||
|
out = Parser.parse(tokens, opt);
|
||
|
} catch (e) {
|
||
|
err = e;
|
||
|
}
|
||
|
|
||
|
opt.highlight = highlight;
|
||
|
|
||
|
return err
|
||
|
? callback(err)
|
||
|
: callback(null, out);
|
||
|
};
|
||
|
|
||
|
if (!highlight || highlight.length < 3) {
|
||
|
return done();
|
||
|
}
|
||
|
|
||
|
delete opt.highlight;
|
||
|
|
||
|
if (!pending) return done();
|
||
|
|
||
|
for (; i < tokens.length; i++) {
|
||
|
(function(token) {
|
||
|
if (token.type !== 'code') {
|
||
|
return --pending || done();
|
||
|
}
|
||
|
return highlight(token.text, token.lang, function(err, code) {
|
||
|
if (err) return done(err);
|
||
|
if (code == null || code === token.text) {
|
||
|
return --pending || done();
|
||
|
}
|
||
|
token.text = code;
|
||
|
token.escaped = true;
|
||
|
--pending || done();
|
||
|
});
|
||
|
})(tokens[i]);
|
||
|
}
|
||
|
|
||
|
return;
|
||
|
}
|
||
|
try {
|
||
|
if (opt) opt = merge({}, marked.defaults, opt);
|
||
|
return Parser.parse(Lexer.lex(src, opt), opt);
|
||
|
} catch (e) {
|
||
|
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
||
|
if ((opt || marked.defaults).silent) {
|
||
|
return '<p>An error occurred:</p><pre>'
|
||
|
+ escape(e.message + '', true)
|
||
|
+ '</pre>';
|
||
|
}
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Options
|
||
|
*/
|
||
|
|
||
|
marked.options =
|
||
|
marked.setOptions = function(opt) {
|
||
|
merge(marked.defaults, opt);
|
||
|
return marked;
|
||
|
};
|
||
|
|
||
|
marked.getDefaults = function () {
|
||
|
return {
|
||
|
baseUrl: null,
|
||
|
breaks: false,
|
||
|
gfm: true,
|
||
|
headerIds: true,
|
||
|
headerPrefix: '',
|
||
|
highlight: null,
|
||
|
langPrefix: 'language-',
|
||
|
mangle: true,
|
||
|
pedantic: false,
|
||
|
renderer: new Renderer(),
|
||
|
sanitize: false,
|
||
|
sanitizer: null,
|
||
|
silent: false,
|
||
|
smartLists: false,
|
||
|
smartypants: false,
|
||
|
tables: true,
|
||
|
xhtml: false
|
||
|
};
|
||
|
};
|
||
|
|
||
|
marked.defaults = marked.getDefaults();
|
||
|
|
||
|
/**
|
||
|
* Expose
|
||
|
*/
|
||
|
|
||
|
marked.Parser = Parser;
|
||
|
marked.parser = Parser.parse;
|
||
|
|
||
|
marked.Renderer = Renderer;
|
||
|
marked.TextRenderer = TextRenderer;
|
||
|
|
||
|
marked.Lexer = Lexer;
|
||
|
marked.lexer = Lexer.lex;
|
||
|
|
||
|
marked.InlineLexer = InlineLexer;
|
||
|
marked.inlineLexer = InlineLexer.output;
|
||
|
|
||
|
marked.Slugger = Slugger;
|
||
|
|
||
|
marked.parse = marked;
|
||
|
|
||
|
if (true) {
|
||
|
module.exports = marked;
|
||
|
} else {}
|
||
|
})(this || (typeof window !== 'undefined' ? window : global));
|
||
|
|
||
|
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./settings/node_modules/nextcloud-vue/dist/ncvuecomponents.js":
|
||
|
/*!*********************************************************************!*\
|
||
|
!*** ./settings/node_modules/nextcloud-vue/dist/ncvuecomponents.js ***!
|
||
|
\*********************************************************************/
|
||
|
/*! no static exports found */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
!function(t,e){ true?module.exports=e():undefined}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=59)}([function(t,e,n){"use strict";var i=n(11),r=n(12),o=Object.prototype.toString;function a(t){return"[object Array]"===o.call(t)}function s(t){return null!==t&&"object"==typeof t}function l(t){return"[object Function]"===o.call(t)}function u(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),a(t))for(var n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.call(null,t[r],r,t)}t.exports={isArray:a,isArrayBuffer:function(t){return"[object ArrayBuffer]"===o.call(t)},isBuffer:r,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:s,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===o.call(t)},isFile:function(t){return"[object File]"===o.call(t)},isBlob:function(t){return"[object Blob]"===o.call(t)},isFunction:l,isStream:function(t){return s(t)&&l(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:u,merge:function t(){var e={};function n(n,i){"object"==typeof e[i]&&"object"==typeof n?e[i]=t(e[i],n):e[i]=n}for(var i=0,r=arguments.length;i<r;i++)u(arguments[i],n);return e},extend:function(t,e,n){return u(e,function(e,r){t[r]=n&&"function"==typeof e?i(e,n):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e){function n(t){return"function"==typeof t.value||(console.warn("[Vue-click-outside:] provided expression",t.expression,"is not a function."),!1)}function i(t){return void 0!==t.componentInstance&&t.componentInstance.$isServer}t.exports={bind:function(t,e,r){function o(e){if(r.context){var n=e.path||e.composedPath&&e.composedPath();n&&n.length>0&&n.unshift(e.target),t.contains(e.target)||function(t,e){if(!t||!e)return!1;for(var n=0,i=e.length;n<i;n++)try{if(t.contains(e[n]))return!0;if(e[n].contains(t))return!1}catch(t){return!1}return!1}(r.context.popupItem,n)||t.__vueClickOutside__.callback(e)}}n(e)&&(t.__vueClickOutside__={handler:o,callback:e.value},!i(r)&&document.addEventListener("click",o))},update:function(t,e){n(e)&&(t.__vueClickOutside__.callback=e.value)},unbind:function(t,e,n){!i(n)&&document.removeEventListener("click",t.__vueClickOutside__.handler),delete t.__vueClickOutside__}}},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var r=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),o=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[n].co
|
||
|
/**!
|
||
|
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
||
|
* @version 1.14.3
|
||
|
* @license
|
||
|
* Copyright (c) 2016 Federico Zivolo and contributors
|
||
|
*
|
||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
|
* of this software and associated documentation files (the "Software"), to deal
|
||
|
* in the Software without restriction, including without limitation the rights
|
||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
|
* copies of the Software, and to permit persons to whom the Software is
|
||
|
* furnished to do so, subject to the following conditions:
|
||
|
*
|
||
|
* The above copyright notice and this permission notice shall be included in all
|
||
|
* copies or substantial portions of the Software.
|
||
|
*
|
||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||
|
* SOFTWARE.
|
||
|
*/
|
||
|
var i="undefined"!=typeof window&&"undefined"!=typeof document,r=["Edge","Trident","Firefox"],o=0,a=0;a<r.length;a+=1)if(i&&navigator.userAgent.indexOf(r[a])>=0){o=1;break}var s=i&&window.Promise?function(t){var e=!1;return function(){e||(e=!0,window.Promise.resolve().then(function(){e=!1,t()}))}}:function(t){var e=!1;return function(){e||(e=!0,setTimeout(function(){e=!1,t()},o))}};function l(t){return t&&"[object Function]"==={}.toString.call(t)}function u(t,e){if(1!==t.nodeType)return[];var n=getComputedStyle(t,null);return e?n[e]:n}function c(t){return"HTML"===t.nodeName?t:t.parentNode||t.host}function p(t){if(!t)return document.body;switch(t.nodeName){case"HTML":case"BODY":return t.ownerDocument.body;case"#document":return t.body}var e=u(t),n=e.overflow,i=e.overflowX,r=e.overflowY;return/(auto|scroll|overlay)/.test(n+r+i)?t:p(c(t))}var d=i&&!(!window.MSInputMethodContext||!document.documentMode),A=i&&/MSIE 10/.test(navigator.userAgent);function f(t){return 11===t?d:10===t?A:d||A}function h(t){if(!t)return document.documentElement;for(var e=f(10)?document.body:null,n=t.offsetParent;n===e&&t.nextElementSibling;)n=(t=t.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&"BODY"!==i&&"HTML"!==i?-1!==["TD","TABLE"].indexOf(n.nodeName)&&"static"===u(n,"position")?h(n):n:t?t.ownerDocument.documentElement:document.documentElement}function m(t){return null!==t.parentNode?m(t.parentNode):t}function v(t,e){if(!(t&&t.nodeType&&e&&e.nodeType))return document.documentElement;var n=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,i=n?t:e,r=n?e:t,o=document.createRange();o.setStart(i,0),o.setEnd(r,0);var a,s,l=o.commonAncestorContainer;if(t!==l&&e!==l||i.contains(r))return"BODY"===(s=(a=l).nodeName)||"HTML"!==s&&h(a.firstElementChild)!==a?h(l):l;var u=m(t);return u.host?v(u.host,e):v(t,m(e).host)}function g(t){var e="top"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top")?"scrollTop":"scrollLeft",n=t.nodeName;if("BODY"===n||"HTML"===n){var i=t.ownerDocument.documentElement;return(t.ownerDocument.scrollingElement||i)[e]}return t[e]}function y(t,e){var n="x"===e?"Left":"Top",i="Left"===n?"Right":"Bottom";return parseFloat(t["border"+n+"Width"],10)+parseFloat(t["border"+i+"Width"],10)}function b(t,e,n,i){return Math.max(e["offset"+t],e["scroll"+t],n["client"+t],n["offset"+t],n["scroll"+t],f(10)?n["offset"+t]+i["margin"+("Height"===t?"Top":"Left")]+i["margin"+("Height"===t?"Bottom":"Right")]:0)}function w(){var t=document.body,e=document.documentElement,n=f(10)&&getComputedStyle(e);return{height:b("Height",t,e,n),width:b("Width",t,e,n)}}var _=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},x=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),D=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},C=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t};function E(t){return C({},t,{right:t.left+t.width,bottom:t.top+t.height})}function k(t){var e={};try{if(f(10)){e=t.getBoundingClientRect();var n=g(t,"top"),i=g(t,"left");e.top+=n,e.left+=i,e.bottom+=n,e.right+=i}else e=t.getBoundingClientRect()}catch(t){}var r={left:e.left,top:e.top,width:e.right-e.left,height:e.bottom-e.top},o="HTML"===t.nodeName?w():{},a=o.width||t.clientWidth||r.right-r.left,s=o.height||t.clientHeight||r.bottom-r.top,l=t.offsetWidth-a,c=t.offsetHeight-s;if(l||c){var p=u(t);l-=y(p,"x"),c-=y(p,"y"),r.width-=l,r.height-=c}return E(r)}function S(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=f(10),r="HTML"===e.nodeName,o=k(t),a=k(e),s=p(t),l=u(e),c=parseFloat(l.borderTopWidth,10),d=parseFloat(l.borderLeftWidth,10);n&&"HTML"===e.nodeName&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var A=E({top:o.top-a.top
|
||
|
/*!
|
||
|
* Determine if an object is a Buffer
|
||
|
*
|
||
|
* @author Feross Aboukhadijeh <https://feross.org>
|
||
|
* @license MIT
|
||
|
*/
|
||
|
t.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,n){"use strict";var i=n(0),r=n(36),o=n(38),a=n(39),s=n(40),l=n(14),u="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(41);t.exports=function(t){return new Promise(function(e,c){var p=t.data,d=t.headers;i.isFormData(p)&&delete d["Content-Type"];var A=new XMLHttpRequest,f="onreadystatechange",h=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in A||s(t.url)||(A=new window.XDomainRequest,f="onload",h=!0,A.onprogress=function(){},A.ontimeout=function(){}),t.auth){var m=t.auth.username||"",v=t.auth.password||"";d.Authorization="Basic "+u(m+":"+v)}if(A.open(t.method.toUpperCase(),o(t.url,t.params,t.paramsSerializer),!0),A.timeout=t.timeout,A[f]=function(){if(A&&(4===A.readyState||h)&&(0!==A.status||A.responseURL&&0===A.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in A?a(A.getAllResponseHeaders()):null,i={data:t.responseType&&"text"!==t.responseType?A.response:A.responseText,status:1223===A.status?204:A.status,statusText:1223===A.status?"No Content":A.statusText,headers:n,config:t,request:A};r(e,c,i),A=null}},A.onerror=function(){c(l("Network Error",t,null,A)),A=null},A.ontimeout=function(){c(l("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",A)),A=null},i.isStandardBrowserEnv()){var g=n(42),y=(t.withCredentials||s(t.url))&&t.xsrfCookieName?g.read(t.xsrfCookieName):void 0;y&&(d[t.xsrfHeaderName]=y)}if("setRequestHeader"in A&&i.forEach(d,function(t,e){void 0===p&&"content-type"===e.toLowerCase()?delete d[e]:A.setRequestHeader(e,t)}),t.withCredentials&&(A.withCredentials=!0),t.responseType)try{A.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&A.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&A.upload&&A.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){A&&(A.abort(),c(t),A=null)}),void 0===p&&(p=null),A.send(p)})}},function(t,e,n){"use strict";var i=n(37);t.exports=function(t,e,n,r,o){var a=new Error(t);return i(a,e,n,r,o)}},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";function i(t){this.message=t}i.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},i.prototype.__CANCEL__=!0,t.exports=i},function(t,e){var n={utf8:{stringToBytes:function(t){return n.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(n.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return e},bytesToString:function(t){for(var e=[],n=0;n<t.length;n++)e.push(String.fromCharCode(t[n]));return e.join("")}}};t.exports=n},function(t,e,n){t.exports=function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=60)}([function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){var i=n(49)("wks"),r=n(30),o=n(0).Symbol,a="function"==typeof o;(t.exports=function(t){return i[t]||(i[t]=a&&o[t]||(a?o:r)("Symbol."+t))}).store=i},function(t,e,n){var i=n(5);t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){var i=n(0),r=n(10),o=n(8),a=n(6),s=n(11),l=function(t,e,n){var u,c,p,d,A=t&l.F,f=t&l.G,h=t&l.S,m=t&l.P,v=t&l.B,g=f?i:h?i[e]||(i[e]={}):(i[e]||{}).prototyp
|
||
|
/*
|
||
|
* @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||
|
*
|
||
|
* @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/u._withStripped=!0;var c=function(){var t=this.$createElement,e=this._self._c||t;return e("ul",this._l(this.menu,function(t,n){return e("popover-menu-item",{key:n,attrs:{item:t}})}),1)};c._withStripped=!0;var p=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",[t.item.href?n("a",{attrs:{href:t.item.href?t.item.href:"#",target:t.item.target?t.item.target:"",rel:"noreferrer noopener"},on:{click:t.action}},[t.iconIsUrl?n("img",{attrs:{src:t.item.icon}}):n("span",{class:t.item.icon}),t._v(" "),t.item.text&&t.item.longtext?n("p",[n("strong",{staticClass:"menuitem-text"},[t._v("\n\t\t\t\t"+t._s(t.item.text)+"\n\t\t\t")]),n("br"),t._v(" "),n("span",{staticClass:"menuitem-text-detail"},[t._v("\n\t\t\t\t"+t._s(t.item.longtext)+"\n\t\t\t")])]):t.item.text?n("span",[t._v("\n\t\t\t"+t._s(t.item.text)+"\n\t\t")]):t.item.longtext?n("p",[t._v("\n\t\t\t"+t._s(t.item.longtext)+"\n\t\t")]):t._e()]):t.item.input?n("span",{staticClass:"menuitem",class:{active:t.item.active}},["checkbox"!==t.item.input?n("span",{class:t.item.icon}):t._e(),t._v(" "),"text"===t.item.input?n("form",{class:t.item.input,on:{submit:function(e){return e.preventDefault(),t.item.action(e)}}},[n("input",{attrs:{type:t.item.input,placeholder:t.item.text,required:""},domProps:{value:t.item.value}}),t._v(" "),n("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}})]):["checkbox"===t.item.input?n("input",{directives:[{name:"model",rawName:"v-model",value:t.item.model,expression:"item.model"}],class:t.item.input,attrs:{id:t.key,type:"checkbox"},domProps:{checked:Array.isArray(t.item.model)?t._i(t.item.model,null)>-1:t.item.model},on:{change:[function(e){var n=t.item.model,i=e.target,r=!!i.checked;if(Array.isArray(n)){var o=t._i(n,null);i.checked?o<0&&t.$set(t.item,"model",n.concat([null])):o>-1&&t.$set(t.item,"model",n.slice(0,o).concat(n.slice(o+1)))}else t.$set(t.item,"model",r)},t.item.action]}}):"radio"===t.item.input?n("input",{directives:[{name:"model",rawName:"v-model",value:t.item.model,expression:"item.model"}],class:t.item.input,attrs:{id:t.key,type:"radio"},domProps:{checked:t._q(t.item.model,null)},on:{change:[function(e){return t.$set(t.item,"model",null)},t.item.action]}}):n("input",{directives:[{name:"model",rawName:"v-model",value:t.item.model,expression:"item.model"}],class:t.item.input,attrs:{id:t.key,type:t.item.input},domProps:{value:t.item.model},on:{change:t.item.action,input:function(e){e.target.composing||t.$set(t.item,"model",e.target.value)}}}),t._v(" "),n("label",{attrs:{for:t.key},on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.item.action(e)}}},[t._v("\n\t\t\t\t"+t._s(t.item.text)+"\n\t\t\t")])]],2):t.item.action?n("button",{staticClass:"menuitem",class:{active:t.item.active},on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.item.action(e)}}},[n("span",{class:t.item.icon}),t._v(" "),t.item.text&&t.item.longtext?n("p",[n("strong",{staticClass:"menuitem-text"},[t._v("\n\t\t\t\t"+t._s(t.item.text)+"\n\t\t\t")]),n("br"),t._v(" "),n("span",{staticClass:"menuitem-text-detail"},[t._v("\n\t\t\t\t"+t._s(t.item.longtext)+"\n\t\t\t")])]):t.item.text?n("span",[t._v("\n\t\t\t"+t._s(t.item.text)+"\n\t\t")]):t.item.longtext?n("p",[t._v("\n\t\t\t"+t._s(t.item.longtext)+"\n\t\t")]):t._e()]):n("span",{staticClass:"menuitem",class:{active:t.item.active}},[n("span",{class:t.item.icon}),t._v(" "),t.item.text&&t.item.longtext?n("p",[n("strong",{staticClass:"menuitem-text"},[t._v("\n\t\t\t\t"+t._s(t.item.text)+"\n\t\t\t")]),n("br"),t._v(" "),n("span",{staticClass:"menuitem-text-detail"},[t._v("\n\t\t\t\t"+t._s(t.item.longtext)+"\n\t\t\t")])]):t.item.text?n("span",[t._v("\n\t\t\t"+t._s(t.item.text)+"\n\t\t")]):t.item.longtext?n("p",[t._v("\n\t\t\t"+t._s(t.item.longtext)+"\n\t\t")]):t._e()])])};p._withStripped=!0;var d={name:"PopoverMenuItem",props:{item:{type:Object,required:!0,default:function(){return{key:"nextcloud-link",href:"https://nextcloud.com",icon:"icon-links",text:"Nextcloud"}},validator:function(t){return!t.input||-1!==["text","checkbox"].indexOf(t.input)}}},computed:{key:func
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/y.options.__file="src/components/AppNavigationItem/AppNavigationItem.vue";var b=y.exports,w=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"app-navigation-new"},[n("button",{class:t.buttonClass,attrs:{id:t.buttonId,type:"button",disabled:t.disabled},on:{click:function(e){return t.$emit("click")}}},[t._v("\n\t\t"+t._s(t.text)+"\n\t")])])};
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/w._withStripped=!0;var _=a({props:{buttonId:{type:String,required:!1,default:""},buttonClass:{type:String,required:!1,default:""},disabled:{type:Boolean,required:!1,default:!1},text:{type:String,required:!0}}},w,[],!1,null,null,null);_.options.__file="src/components/AppNavigationNew/AppNavigationNew.vue";var x=_.exports,D=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.closeMenu,expression:"closeMenu"}],class:{open:t.open},attrs:{id:"app-settings"}},[n("div",{attrs:{id:"app-settings-header"}},[n("button",{staticClass:"settings-button",attrs:{"data-apps-slide-toggle":"#app-settings-content"},on:{click:t.toggleMenu}},[t._v("\n\t\t\t"+t._s(t.title)+"\n\t\t")])]),t._v(" "),n("div",{attrs:{id:"app-settings-content"}},[t._t("default")],2)])};
|
||
|
/*
|
||
|
* @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||
|
*
|
||
|
* @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/D._withStripped=!0;var C=a({directives:{ClickOutside:g.a},props:{title:{type:String,required:!1,default:t("core","Settings")}},data:function(){return{open:!1}},methods:{toggleMenu:function(){this.open=!this.open},closeMenu:function(){this.open=!1}}},D,[],!1,null,null,null);C.options.__file="src/components/AppNavigationSettings/AppNavigationSettings.vue";var E=C.exports,k=function(t){t.mounted?Array.isArray(t.mounted)||(t.mounted=[t.mounted]):t.mounted=[],t.mounted.push(function(){this.$el.setAttribute("data-v-".concat("97c9b20"),"")})},S=function(){var t=this,e=t.$createElement;return(t._self._c||e)("date-picker",t._g(t._b({attrs:{"minute-step":10,clearable:!1,value:t.value},on:{"update:value":function(e){return t.$emit("update:value",t.value)}}},"date-picker",t.$attrs,!1),t.$listeners))};
|
||
|
/*
|
||
|
* @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||
|
*
|
||
|
* @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/S._withStripped=!0;var O=i(9),T=i.n(O);T.a.components.CalendarPanel.components.PanelTime.methods.stringifyText=function(t){return t},T.a.methods.displayPopup=function(){var t=this.$el.querySelector(".mx-datepicker-popup");t&&!t.classList.contains("popovermenu")&&(t.className+=" popovermenu menu-center open")};var M=a({name:"DatetimePicker",components:{DatePicker:T.a},inheritAttrs:!1,props:{value:{default:function(){return new Date}}}},S,[],!1,null,null,null);M.options.__file="src/components/DatetimePicker/DatetimePicker.vue";var B=M.exports;i(23);
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
k(B);var N=B,I=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("vue-multiselect",t._g(t._b({class:{"icon-loading-small":t.loading,"multiselect--multiple":t.multiple,"multiselect--single":!t.multiple},attrs:{value:t.value,limit:t.maxOptions,"close-on-select":!t.multiple,multiple:t.multiple,label:t.label,"track-by":t.trackBy,"tag-placeholder":"create"},on:{"update:value":function(e){return t.$emit("update:value",t.value)}},scopedSlots:t._u([{key:"option",fn:function(e){return t.$scopedSlots.option||t.userSelect?[t.userSelect?n("avatar-select-option",{attrs:{option:e.option}}):t._t("option",null,null,e)]:void 0}},{key:"singleLabel",fn:function(e){return t.$scopedSlots.singleLabel?[t._t("singleLabel",null,null,e)]:void 0}}],!0)},"vue-multiselect",t.$attrs,!1),t.$listeners),[t._v(" "),t.multiple?n("span",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:t.formatLimitTitle(t.value),expression:"formatLimitTitle(value)",modifiers:{auto:!0}}],staticClass:"multiselect__limit",attrs:{slot:"limit"},slot:"limit"},[t._v("\n\t\t"+t._s(t.limitString)+"\n\t")]):t._e()])};I._withStripped=!0;var L=i(18),P=i.n(L),j=i(8),$=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("span",{staticClass:"option"},[n("avatar",{staticClass:"option__avatar",attrs:{"display-name":t.option.displayName,user:t.option.user,"disable-tooltip":!0,"is-no-user":t.option.isNoUser}}),t._v(" "),n("div",{staticClass:"option__desc"},[n("span",{staticClass:"option__desc--lineone"},[t._v("\n\t\t\t"+t._s(t.option.displayName)+"\n\t\t")]),t._v(" "),t.option.desc?n("span",{staticClass:"option__desc--linetwo"},[t._v("\n\t\t\t"+t._s(t.option.desc)+"\n\t\t")]):t._e()]),t._v(" "),t.option.icon?n("span",{staticClass:"icon option__icon",class:t.option.icon}):t._e()],1)};$._withStripped=!0;var Y=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.tooltip,expression:"tooltip"},{name:"click-outside",rawName:"v-click-outside",value:t.closeMenu,expression:"closeMenu"}],staticClass:"avatardiv popovermenu-wrapper",class:{"icon-loading":t.loadingState,unknown:t.userDoesNotExist},style:t.avatarStyle,on:{click:t.toggleMenu}},[t.loadingState||t.userDoesNotExist?t._e():n("img",{attrs:{src:t.avatarUrlLoaded,srcset:t.avatarSrcSetLoaded}}),t._v(" "),t.userDoesNotExist?n("div",{staticClass:"unknown"},[t._v("\n\t\t"+t._s(t.initials)+"\n\t")]):t._e(),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.contactsMenuOpenState,expression:"contactsMenuOpenState"}],staticClass:"popovermenu"},[n("popover-menu",{attrs:{"is-open":t.contactsMenuOpenState,menu:t.menu}})],1)])};Y._withStripped=!0;var V=i(19),Q=i.n(V),F=i(20),R=i.n(F),G=function(t){var e=t.toLowerCase();function n(t,e,n){this.r=t,this.g=e,this.b=n}function i(t,e,i){var r=[];r.push(e);for(var o=function(t,e){var n=new Array(3);return n[0]=(e[1].r-e[0].r)/t,n[1]=(e[1].g-e[0].g)/t,n[2]=(e[1].b-e[0].b)/t,n}(t,[e,i]),a=1;a<t;a++){var s=parseInt(e.r+o[0]*a),l=parseInt(e.g+o[1]*a),u=parseInt(e.b+o[2]*a);r.push(new n(s,l,u))}return r}null===e.match(/^([0-9a-f]{4}-?){8}$/)&&(e=R()(e)),e=e.replace(/[^0-9a-f]/g,"");var r=new n(182,70,157),o=new n(221,203,85),a=new n(0,130,201),s=i(6,r,o),l=i(6,o,a),u=i(6,a,r);return s.concat(l).concat(u)[function(t,e){for(var n=0,i=[],r=0;r<t.length;r++)i.push(parseInt(t.charAt(r),16)%16);for(var o in i)n+=i[o];return parseInt(parseInt(n)%e)}(e,18)]},H={name:"Avatar",directives:{tooltip:j.a,ClickOutside:g.a},components:{PopoverMenu:h},props:{url:{type:String,default:void 0},user:{type:String,default:void 0},displayName:{type:String,default:void 0},size:{type:Number,default:32},allowPlaceholder:{type:Boolean,default:!0},disableTooltip:{type:Boolean,default:!1},tooltipMessage:{type:String,default:null},isNoUser:{type:Boolean,default:!1}},data:function(){return{avatarUrlLoaded:null,avatarSrcSetLoaded:null,userDoesNotExist:!1,loadingState:!0,contactsMenuActions:[],contactsMenuOpenState:!1}},computed:{getUserIdentifier:function(){return this.isDisplayNameDefined?this.displayName:this.isUserD
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
|
||
|
*
|
||
|
* @author Julius Härtl <jus@bitgrid.net>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/Z.options.__file="src/components/Multiselect/AvatarSelectOption.vue";var J=Z.exports;function q(t){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var X=a({name:"Multiselect",components:{VueMultiselect:P.a,AvatarSelectOption:J},directives:{tooltip:j.a},inheritAttrs:!1,props:{value:{default:function(){return[]}},multiple:{type:Boolean,default:!1},limit:{type:Number,default:99999},label:{type:String},trackBy:{type:String},userSelect:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},autoLimit:{type:Boolean,default:!0},tagWidth:{type:Number,default:150,validator:function(t){return t>0}}},data:function(){return{elWidth:0}},computed:{maxOptions:function(){if(this.autoLimit&&this.elWidth>0&&0!==this.tagWidth){var t=Math.floor(this.elWidth/this.tagWidth);return t>0?t:1}return this.limit?this.limit:9999},limitString:function(){return"+".concat(this.value.length-this.maxOptions)}},watch:{value:function(){this.updateWidth()}},mounted:function(){this.updateWidth(),window.addEventListener("resize",this.updateWidth)},beforeDestroy:function(){window.removeEventListener("resize",this.updateWidth)},methods:{formatLimitTitle:function(t){var e=this;if(Array.isArray(t)&&t.length>0){var n=t;return"object"===q(t[0])&&(n=t.map(function(t){return t[e.label]})),n.slice(this.maxOptions).join(", ")}return""},updateWidth:function(){this.elWidth=this.$el.querySelector(".multiselect__tags-wrap").offsetWidth-10}}},I,[],!1,null,null,null);X.options.__file="src/components/Multiselect/Multiselect.vue";var K=X.exports;i(55);
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
k(K);var tt=K,et=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("action",t._g(t._b({staticClass:"action-item",class:[t.isSingleAction?t.firstAction.icon+" action-item--single":"action-item--multiple"],attrs:{href:t.isSingleAction&&t.firstAction.href?t.firstAction.href:"#"}},"action",t.mainActionElement(),!1),t.isSingleAction&&t.firstAction.action?{click:t.firstAction.action}:{}),[t.isSingleAction?t._e():[n("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.closeMenu,expression:"closeMenu"}],staticClass:"action-item__menutoggle icon-more",attrs:{tabindex:"0"},on:{click:function(e){return e.preventDefault(),t.toggleMenu(e)}}}),t._v(" "),n("div",{staticClass:"action-item__menu popovermenu",class:{open:t.opened}},[n("popover-menu",{attrs:{menu:t.actions}})],1)]],2)};et._withStripped=!0;var nt={name:"Action",components:{PopoverMenu:h},directives:{ClickOutside:g.a},props:{actions:{type:Array,required:!0,default:function(){return[{href:"https://nextcloud.com",icon:"icon-links",text:"Nextcloud"},{action:function(){alert("Deleted !")},icon:"icon-delete",text:"Delete"}]}}},data:function(){return{opened:!1}},computed:{isSingleAction:function(){return 1===this.actions.length},firstAction:function(){return this.actions[0]}},mounted:function(){this.popupItem=this.$el},methods:{toggleMenu:function(){this.opened=!this.opened},closeMenu:function(){this.opened=!1},mainActionElement:function(){return{is:this.isSingleAction?"a":"div"}}}},it=(i(57),a(nt,et,[],!1,null,"886e6e62",null));it.options.__file="src/components/Action/Action.vue";var rt=it.exports;
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/function ot(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/function at(t){Object.values(r).forEach(function(e){t.component(e.name,e)})}
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/i.d(n,"AppContent",function(){return l}),i.d(n,"AppNavigationItem",function(){return b}),i.d(n,"AppNavigationNew",function(){return x}),i.d(n,"AppNavigationSettings",function(){return E}),i.d(n,"PopoverMenu",function(){return m}),i.d(n,"DatetimePicker",function(){return N}),i.d(n,"Multiselect",function(){return tt}),i.d(n,"Avatar",function(){return W}),i.d(n,"Action",function(){return rt}),"undefined"!=typeof window&&window.Vue&&at(window.Vue);n.default=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){ot(t,e,n[e])})}return t}({install:at},r)}])});
|
||
|
//# sourceMappingURL=ncvuecomponents.js.map
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./settings/node_modules/vue-localstorage/dist/vue-local-storage.js":
|
||
|
/*!**************************************************************************!*\
|
||
|
!*** ./settings/node_modules/vue-localstorage/dist/vue-local-storage.js ***!
|
||
|
\**************************************************************************/
|
||
|
/*! no static exports found */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
/* WEBPACK VAR INJECTION */(function(process) {/**
|
||
|
* vue-local-storage v0.6.0
|
||
|
* (c) 2017 Alexander Avakov
|
||
|
* @license MIT
|
||
|
*/
|
||
|
(function (global, factory) {
|
||
|
true ? module.exports = factory() :
|
||
|
undefined;
|
||
|
}(this, (function () { 'use strict';
|
||
|
|
||
|
var VueLocalStorage = function VueLocalStorage () {
|
||
|
this._properties = {};
|
||
|
this._namespace = '';
|
||
|
this._isSupported = true;
|
||
|
};
|
||
|
|
||
|
var prototypeAccessors = { namespace: {} };
|
||
|
|
||
|
/**
|
||
|
* Namespace getter.
|
||
|
*
|
||
|
* @returns {string}
|
||
|
*/
|
||
|
prototypeAccessors.namespace.get = function () {
|
||
|
return this._namespace
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Namespace setter.
|
||
|
*
|
||
|
* @param {string} value
|
||
|
*/
|
||
|
prototypeAccessors.namespace.set = function (value) {
|
||
|
this._namespace = value ? (value + ".") : '';
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Concatenates localStorage key with namespace prefix.
|
||
|
*
|
||
|
* @param {string} lsKey
|
||
|
* @returns {string}
|
||
|
* @private
|
||
|
*/
|
||
|
VueLocalStorage.prototype._getLsKey = function _getLsKey (lsKey) {
|
||
|
return ("" + (this._namespace) + lsKey)
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Set a value to localStorage giving respect to the namespace.
|
||
|
*
|
||
|
* @param {string} lsKey
|
||
|
* @param {*} rawValue
|
||
|
* @param {*} type
|
||
|
* @private
|
||
|
*/
|
||
|
VueLocalStorage.prototype._lsSet = function _lsSet (lsKey, rawValue, type) {
|
||
|
var key = this._getLsKey(lsKey);
|
||
|
var value = type && [Array, Object].includes(type)
|
||
|
? JSON.stringify(rawValue)
|
||
|
: rawValue;
|
||
|
|
||
|
window.localStorage.setItem(key, value);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Get value from localStorage giving respect to the namespace.
|
||
|
*
|
||
|
* @param {string} lsKey
|
||
|
* @returns {any}
|
||
|
* @private
|
||
|
*/
|
||
|
VueLocalStorage.prototype._lsGet = function _lsGet (lsKey) {
|
||
|
var key = this._getLsKey(lsKey);
|
||
|
|
||
|
return window.localStorage[key]
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Get value from localStorage
|
||
|
*
|
||
|
* @param {String} lsKey
|
||
|
* @param {*} defaultValue
|
||
|
* @param {*} defaultType
|
||
|
* @returns {*}
|
||
|
*/
|
||
|
VueLocalStorage.prototype.get = function get (lsKey, defaultValue, defaultType) {
|
||
|
var this$1 = this;
|
||
|
if ( defaultValue === void 0 ) defaultValue = null;
|
||
|
if ( defaultType === void 0 ) defaultType = String;
|
||
|
|
||
|
if (!this._isSupported) {
|
||
|
return null
|
||
|
}
|
||
|
|
||
|
if (this._lsGet(lsKey)) {
|
||
|
var type = defaultType;
|
||
|
|
||
|
for (var key in this$1._properties) {
|
||
|
if (key === lsKey) {
|
||
|
type = this$1._properties[key].type;
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return this._process(type, this._lsGet(lsKey))
|
||
|
}
|
||
|
|
||
|
return defaultValue !== null ? defaultValue : null
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Set localStorage value
|
||
|
*
|
||
|
* @param {String} lsKey
|
||
|
* @param {*} value
|
||
|
* @returns {*}
|
||
|
*/
|
||
|
VueLocalStorage.prototype.set = function set (lsKey, value) {
|
||
|
var this$1 = this;
|
||
|
|
||
|
if (!this._isSupported) {
|
||
|
return null
|
||
|
}
|
||
|
|
||
|
for (var key in this$1._properties) {
|
||
|
var type = this$1._properties[key].type;
|
||
|
|
||
|
if ((key === lsKey)) {
|
||
|
this$1._lsSet(lsKey, value, type);
|
||
|
|
||
|
return value
|
||
|
}
|
||
|
}
|
||
|
|
||
|
this._lsSet(lsKey, value);
|
||
|
|
||
|
return value
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Remove value from localStorage
|
||
|
*
|
||
|
* @param {String} lsKey
|
||
|
*/
|
||
|
VueLocalStorage.prototype.remove = function remove (lsKey) {
|
||
|
if (!this._isSupported) {
|
||
|
return null
|
||
|
}
|
||
|
|
||
|
return window.localStorage.removeItem(lsKey)
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Add new property to localStorage
|
||
|
*
|
||
|
* @param {String} key
|
||
|
* @param {function} type
|
||
|
* @param {*} defaultValue
|
||
|
*/
|
||
|
VueLocalStorage.prototype.addProperty = function addProperty (key, type, defaultValue) {
|
||
|
if ( defaultValue === void 0 ) defaultValue = undefined;
|
||
|
|
||
|
type = type || String;
|
||
|
|
||
|
this._properties[key] = { type: type };
|
||
|
|
||
|
if (!this._lsGet(key) && defaultValue !== null) {
|
||
|
this._lsSet(key, defaultValue, type);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Process the value before return it from localStorage
|
||
|
*
|
||
|
* @param {String} type
|
||
|
* @param {*} value
|
||
|
* @returns {*}
|
||
|
* @private
|
||
|
*/
|
||
|
VueLocalStorage.prototype._process = function _process (type, value) {
|
||
|
switch (type) {
|
||
|
case Boolean:
|
||
|
return value === 'true'
|
||
|
case Number:
|
||
|
return parseFloat(value)
|
||
|
case Array:
|
||
|
try {
|
||
|
var array = JSON.parse(value);
|
||
|
|
||
|
return Array.isArray(array) ? array : []
|
||
|
} catch (e) {
|
||
|
return []
|
||
|
}
|
||
|
case Object:
|
||
|
try {
|
||
|
return JSON.parse(value)
|
||
|
} catch (e) {
|
||
|
return {}
|
||
|
}
|
||
|
default:
|
||
|
return value
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Object.defineProperties( VueLocalStorage.prototype, prototypeAccessors );
|
||
|
|
||
|
var vueLocalStorage = new VueLocalStorage();
|
||
|
|
||
|
var index = {
|
||
|
/**
|
||
|
* Install vue-local-storage plugin
|
||
|
*
|
||
|
* @param {Vue} Vue
|
||
|
* @param {Object} options
|
||
|
*/
|
||
|
install: function (Vue, options) {
|
||
|
if ( options === void 0 ) options = {};
|
||
|
|
||
|
if (typeof process !== 'undefined' &&
|
||
|
(
|
||
|
process.server ||
|
||
|
process.SERVER_BUILD ||
|
||
|
(process.env && process.env.VUE_ENV === 'server')
|
||
|
)
|
||
|
) {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
var isSupported = true;
|
||
|
|
||
|
try {
|
||
|
var test = '__vue-localstorage-test__';
|
||
|
|
||
|
window.localStorage.setItem(test, test);
|
||
|
window.localStorage.removeItem(test);
|
||
|
} catch (e) {
|
||
|
isSupported = false;
|
||
|
vueLocalStorage._isSupported = false;
|
||
|
|
||
|
console.error('Local storage is not supported');
|
||
|
}
|
||
|
|
||
|
var name = options.name || 'localStorage';
|
||
|
var bind = options.bind;
|
||
|
|
||
|
if (options.namespace) {
|
||
|
vueLocalStorage.namespace = options.namespace;
|
||
|
}
|
||
|
|
||
|
Vue.mixin({
|
||
|
beforeCreate: function beforeCreate () {
|
||
|
var this$1 = this;
|
||
|
|
||
|
if (!isSupported) {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
if (this.$options[name]) {
|
||
|
Object.keys(this.$options[name]).forEach(function (key) {
|
||
|
var config = this$1.$options[name][key];
|
||
|
var ref = [config.type, config.default];
|
||
|
var type = ref[0];
|
||
|
var defaultValue = ref[1];
|
||
|
|
||
|
vueLocalStorage.addProperty(key, type, defaultValue);
|
||
|
|
||
|
var existingProp = Object.getOwnPropertyDescriptor(vueLocalStorage, key);
|
||
|
|
||
|
if (!existingProp) {
|
||
|
var prop = {
|
||
|
get: function () { return Vue.localStorage.get(key, defaultValue); },
|
||
|
set: function (val) { return Vue.localStorage.set(key, val); },
|
||
|
configurable: true
|
||
|
};
|
||
|
|
||
|
Object.defineProperty(vueLocalStorage, key, prop);
|
||
|
Vue.util.defineReactive(vueLocalStorage, key, defaultValue);
|
||
|
} else if (!Vue.config.silent) {
|
||
|
console.log((key + ": is already defined and will be reused"));
|
||
|
}
|
||
|
|
||
|
if ((bind || config.bind) && config.bind !== false) {
|
||
|
this$1.$options.computed = this$1.$options.computed || {};
|
||
|
|
||
|
if (!this$1.$options.computed[key]) {
|
||
|
this$1.$options.computed[key] = {
|
||
|
get: function () { return Vue.localStorage[key]; },
|
||
|
set: function (val) { Vue.localStorage[key] = val; }
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Vue[name] = vueLocalStorage;
|
||
|
Vue.prototype[("$" + name)] = vueLocalStorage;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
return index;
|
||
|
|
||
|
})));
|
||
|
|
||
|
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js")))
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./settings/node_modules/vue-multiselect/dist/vue-multiselect.min.js":
|
||
|
/*!***************************************************************************!*\
|
||
|
!*** ./settings/node_modules/vue-multiselect/dist/vue-multiselect.min.js ***!
|
||
|
\***************************************************************************/
|
||
|
/*! no static exports found */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
!function(t,e){ true?module.exports=e():undefined}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=60)}([function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){var i=n(49)("wks"),r=n(30),o=n(0).Symbol,s="function"==typeof o;(t.exports=function(t){return i[t]||(i[t]=s&&o[t]||(s?o:r)("Symbol."+t))}).store=i},function(t,e,n){var i=n(5);t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){var i=n(0),r=n(10),o=n(8),s=n(6),u=n(11),a=function(t,e,n){var l,c,f,p,h=t&a.F,d=t&a.G,v=t&a.S,g=t&a.P,m=t&a.B,y=d?i:v?i[e]||(i[e]={}):(i[e]||{}).prototype,b=d?r:r[e]||(r[e]={}),_=b.prototype||(b.prototype={});d&&(n=e);for(l in n)c=!h&&y&&void 0!==y[l],f=(c?y:n)[l],p=m&&c?u(f,i):g&&"function"==typeof f?u(Function.call,f):f,y&&s(y,l,f,t&a.U),b[l]!=f&&o(b,l,p),g&&_[l]!=f&&(_[l]=f)};i.core=r,a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e,n){t.exports=!n(7)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var i=n(0),r=n(8),o=n(12),s=n(30)("src"),u=Function.toString,a=(""+u).split("toString");n(10).inspectSource=function(t){return u.call(t)},(t.exports=function(t,e,n,u){var l="function"==typeof n;l&&(o(n,"name")||r(n,"name",e)),t[e]!==n&&(l&&(o(n,s)||r(n,s,t[e]?""+t[e]:a.join(String(e)))),t===i?t[e]=n:u?t[e]?t[e]=n:r(t,e,n):(delete t[e],r(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[s]||u.call(this)})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var i=n(13),r=n(25);t.exports=n(4)?function(t,e,n){return i.f(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(t,e,n){var i=n(14);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var i=n(2),r=n(41),o=n(29),s=Object.defineProperty;e.f=n(4)?Object.defineProperty:function(t,e,n){if(i(t),e=o(e,!0),i(n),r)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e){t.exports={}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";var i=n(7);t.exports=function(t,e){return!!t&&i(function(){e?t.call(null,function(){},1):t.call(null)})}},function(t,e,n){var i=n(23),r=n(16);t.exports=function(t){return i(r(t))}},function(t,e,n){var i=n(53),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},function(t,e,n){var i=n(11),r=n(23),o=n(28),s=n(19),u=n(64);t.exports=function(t,e){var n=1==t,a=2==t,l=3==t,c=4==t,f=6==t,p=5==t||f,h=e||u;return function(e,u,d){for(var v,g,m=o(e),y=r(m),b=i(u,d,3),_=s(y.length),x=0,w=n?h(e,_):a?h(e,0):void 0;_>x;x++)if((p||x in y)&&(v=y[x],g=b(v,x,m),t))if(n)w[x]=g;else if(g)switch(t){case 3:return!0;case 5:return v;
|
||
|
|
||
|
/***/ })
|
||
|
|
||
|
}]);
|
||
|
//# sourceMappingURL=vue-2.js.map
|