/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 476: /***/ ((module) => { "use strict"; /* # ----------------------------------------------------------------------------- # ~/js/adapter/adapter.js # Provides an empty object for later loaded adapter objects # # Product/Info: # https://jekyll.one # # Copyright (C) 2022 Juergen Adams # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ // ----------------------------------------------------------------------------- module.exports = function (j1, window) { return { // ------------------------------------------------------------------------- // _init_ // Global initializer for the adapter object // ------------------------------------------------------------------------- _init_: function _init_() { return; } // END _init_ }; // END return }(j1, window); /***/ }), /***/ 253: /***/ (() => { /* # ----------------------------------------------------------------------------- # ~/js/adoc_result_viewer/view_results.js # Provides JavaScript functions displaying results for Asciidoctor # example block # # Product/Info: # https://jekyll.one # # Copyright (C) 2022 Juergen Adams # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- # TODO: Improve lanuage settings # TODO: Improve auto-hide functionality for the results block # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* global $ */ // ----------------------------------------------------------------------------- var timeoutHandle; // var language = 'de'; var language = document.documentElement.lang; function toggle_result_block(result_block) { window.clearTimeout(timeoutHandle); // Clear the timeout object result_block.prev().toggleClass('stacked'); result_block.toggle(); // jadams: Improve auto-hide functionality for the results block // // timeoutHandle = window.setTimeout(function () { // result_block.hide(); // }, 5000); } function insert_result_links() { $('.result').each(function (idx, node) { var view_result_link; var result_block = $(node); var title_div = result_block.prev().find('.title'); if (language == 'en') { view_result_link = $('
View
'); } else if (language == 'de') { view_result_link = $('
Anzeige
'); } else { view_result_link = $('
View
'); } title_div.append(view_result_link); $('.btn-viewer').tooltip(); view_result_link.on('click', function (event) { event.preventDefault(); toggle_result_block(result_block); }); }); } $(insert_result_links); /***/ }), /***/ 921: /***/ ((module) => { "use strict"; /* * anime.js v3.2.0 * (c) 2020 Julian Garnier * Released under the MIT license * animejs.com */ // Defaults var defaultInstanceSettings = { update: null, begin: null, loopBegin: null, changeBegin: null, change: null, changeComplete: null, loopComplete: null, complete: null, loop: 1, direction: 'normal', autoplay: true, timelineOffset: 0 }; var defaultTweenSettings = { duration: 1000, delay: 0, endDelay: 0, easing: 'easeOutElastic(1, .5)', round: 0 }; var validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'perspective', 'matrix', 'matrix3d']; // Caching var cache = { CSS: {}, springs: {} }; // Utils function minMax(val, min, max) { return Math.min(Math.max(val, min), max); } function stringContains(str, text) { return str.indexOf(text) > -1; } function applyArguments(func, args) { return func.apply(null, args); } var is = { arr: function arr(a) { return Array.isArray(a); }, obj: function obj(a) { return stringContains(Object.prototype.toString.call(a), 'Object'); }, pth: function pth(a) { return is.obj(a) && a.hasOwnProperty('totalLength'); }, svg: function svg(a) { return a instanceof SVGElement; }, inp: function inp(a) { return a instanceof HTMLInputElement; }, dom: function dom(a) { return a.nodeType || is.svg(a); }, str: function str(a) { return typeof a === 'string'; }, fnc: function fnc(a) { return typeof a === 'function'; }, und: function und(a) { return typeof a === 'undefined'; }, hex: function hex(a) { return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a); }, rgb: function rgb(a) { return /^rgb/.test(a); }, hsl: function hsl(a) { return /^hsl/.test(a); }, col: function col(a) { return is.hex(a) || is.rgb(a) || is.hsl(a); }, key: function key(a) { return !defaultInstanceSettings.hasOwnProperty(a) && !defaultTweenSettings.hasOwnProperty(a) && a !== 'targets' && a !== 'keyframes'; } }; // Easings function parseEasingParameters(string) { var match = /\(([^)]+)\)/.exec(string); return match ? match[1].split(',').map(function (p) { return parseFloat(p); }) : []; } // Spring solver inspired by Webkit Copyright © 2016 Apple Inc. All rights reserved. https://webkit.org/demos/spring/spring.js function spring(string, duration) { var params = parseEasingParameters(string); var mass = minMax(is.und(params[0]) ? 1 : params[0], .1, 100); var stiffness = minMax(is.und(params[1]) ? 100 : params[1], .1, 100); var damping = minMax(is.und(params[2]) ? 10 : params[2], .1, 100); var velocity = minMax(is.und(params[3]) ? 0 : params[3], .1, 100); var w0 = Math.sqrt(stiffness / mass); var zeta = damping / (2 * Math.sqrt(stiffness * mass)); var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0; var a = 1; var b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0; function solver(t) { var progress = duration ? duration * t / 1000 : t; if (zeta < 1) { progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress)); } else { progress = (a + b * progress) * Math.exp(-progress * w0); } if (t === 0 || t === 1) { return t; } return 1 - progress; } function getDuration() { var cached = cache.springs[string]; if (cached) { return cached; } var frame = 1 / 6; var elapsed = 0; var rest = 0; while (true) { elapsed += frame; if (solver(elapsed) === 1) { rest++; if (rest >= 16) { break; } } else { rest = 0; } } var duration = elapsed * frame * 1000; cache.springs[string] = duration; return duration; } return duration ? solver : getDuration; } // Basic steps easing implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function function steps(steps) { if (steps === void 0) steps = 10; return function (t) { return Math.ceil(minMax(t, 0.000001, 1) * steps) * (1 / steps); }; } // BezierEasing https://github.com/gre/bezier-easing var bezier = function () { var kSplineTableSize = 11; var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0); function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } function C(aA1) { return 3.0 * aA1; } function calcBezier(aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; } function getSlope(aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); } function binarySubdivide(aX, aA, aB, mX1, mX2) { var currentX, currentT, i = 0; do { currentT = aA + (aB - aA) / 2.0; currentX = calcBezier(currentT, mX1, mX2) - aX; if (currentX > 0.0) { aB = currentT; } else { aA = currentT; } } while (Math.abs(currentX) > 0.0000001 && ++i < 10); return currentT; } function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) { for (var i = 0; i < 4; ++i) { var currentSlope = getSlope(aGuessT, mX1, mX2); if (currentSlope === 0.0) { return aGuessT; } var currentX = calcBezier(aGuessT, mX1, mX2) - aX; aGuessT -= currentX / currentSlope; } return aGuessT; } function bezier(mX1, mY1, mX2, mY2) { if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) { return; } var sampleValues = new Float32Array(kSplineTableSize); if (mX1 !== mY1 || mX2 !== mY2) { for (var i = 0; i < kSplineTableSize; ++i) { sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); } } function getTForX(aX) { var intervalStart = 0; var currentSample = 1; var lastSample = kSplineTableSize - 1; for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) { intervalStart += kSampleStepSize; } --currentSample; var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]); var guessForT = intervalStart + dist * kSampleStepSize; var initialSlope = getSlope(guessForT, mX1, mX2); if (initialSlope >= 0.001) { return newtonRaphsonIterate(aX, guessForT, mX1, mX2); } else if (initialSlope === 0.0) { return guessForT; } else { return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2); } } return function (x) { if (mX1 === mY1 && mX2 === mY2) { return x; } if (x === 0 || x === 1) { return x; } return calcBezier(getTForX(x), mY1, mY2); }; } return bezier; }(); var penner = function () { // Based on jQuery UI's implemenation of easing equations from Robert Penner (http://www.robertpenner.com/easing) var eases = { linear: function linear() { return function (t) { return t; }; } }; var functionEasings = { Sine: function Sine() { return function (t) { return 1 - Math.cos(t * Math.PI / 2); }; }, Circ: function Circ() { return function (t) { return 1 - Math.sqrt(1 - t * t); }; }, Back: function Back() { return function (t) { return t * t * (3 * t - 2); }; }, Bounce: function Bounce() { return function (t) { var pow2, b = 4; while (t < ((pow2 = Math.pow(2, --b)) - 1) / 11) {} return 1 / Math.pow(4, 3 - b) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - t, 2); }; }, Elastic: function Elastic(amplitude, period) { if (amplitude === void 0) amplitude = 1; if (period === void 0) period = .5; var a = minMax(amplitude, 1, 10); var p = minMax(period, .1, 2); return function (t) { return t === 0 || t === 1 ? t : -a * Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1 - p / (Math.PI * 2) * Math.asin(1 / a)) * (Math.PI * 2) / p); }; } }; var baseEasings = ['Quad', 'Cubic', 'Quart', 'Quint', 'Expo']; baseEasings.forEach(function (name, i) { functionEasings[name] = function () { return function (t) { return Math.pow(t, i + 2); }; }; }); Object.keys(functionEasings).forEach(function (name) { var easeIn = functionEasings[name]; eases['easeIn' + name] = easeIn; eases['easeOut' + name] = function (a, b) { return function (t) { return 1 - easeIn(a, b)(1 - t); }; }; eases['easeInOut' + name] = function (a, b) { return function (t) { return t < 0.5 ? easeIn(a, b)(t * 2) / 2 : 1 - easeIn(a, b)(t * -2 + 2) / 2; }; }; }); return eases; }(); function parseEasings(easing, duration) { if (is.fnc(easing)) { return easing; } var name = easing.split('(')[0]; var ease = penner[name]; var args = parseEasingParameters(easing); switch (name) { case 'spring': return spring(easing, duration); case 'cubicBezier': return applyArguments(bezier, args); case 'steps': return applyArguments(steps, args); default: return applyArguments(ease, args); } } // Strings function selectString(str) { try { var nodes = document.querySelectorAll(str); return nodes; } catch (e) { return; } } // Arrays function filterArray(arr, callback) { var len = arr.length; var thisArg = arguments.length >= 2 ? arguments[1] : void 0; var result = []; for (var i = 0; i < len; i++) { if (i in arr) { var val = arr[i]; if (callback.call(thisArg, val, i, arr)) { result.push(val); } } } return result; } function flattenArray(arr) { return arr.reduce(function (a, b) { return a.concat(is.arr(b) ? flattenArray(b) : b); }, []); } function toArray(o) { if (is.arr(o)) { return o; } if (is.str(o)) { o = selectString(o) || o; } if (o instanceof NodeList || o instanceof HTMLCollection) { return [].slice.call(o); } return [o]; } function arrayContains(arr, val) { return arr.some(function (a) { return a === val; }); } // Objects function cloneObject(o) { var clone = {}; for (var p in o) { clone[p] = o[p]; } return clone; } function replaceObjectProps(o1, o2) { var o = cloneObject(o1); for (var p in o1) { o[p] = o2.hasOwnProperty(p) ? o2[p] : o1[p]; } return o; } function mergeObjects(o1, o2) { var o = cloneObject(o1); for (var p in o2) { o[p] = is.und(o1[p]) ? o2[p] : o1[p]; } return o; } // Colors function rgbToRgba(rgbValue) { var rgb = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(rgbValue); return rgb ? "rgba(" + rgb[1] + ",1)" : rgbValue; } function hexToRgba(hexValue) { var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; var hex = hexValue.replace(rgx, function (m, r, g, b) { return r + r + g + g + b + b; }); var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); var r = parseInt(rgb[1], 16); var g = parseInt(rgb[2], 16); var b = parseInt(rgb[3], 16); return "rgba(" + r + "," + g + "," + b + ",1)"; } function hslToRgba(hslValue) { var hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue); var h = parseInt(hsl[1], 10) / 360; var s = parseInt(hsl[2], 10) / 100; var l = parseInt(hsl[3], 10) / 100; var a = hsl[4] || 1; function hue2rgb(p, q, t) { if (t < 0) { t += 1; } if (t > 1) { t -= 1; } if (t < 1 / 6) { return p + (q - p) * 6 * t; } if (t < 1 / 2) { return q; } if (t < 2 / 3) { return p + (q - p) * (2 / 3 - t) * 6; } return p; } var r, g, b; if (s == 0) { r = g = b = l; } else { var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1 / 3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1 / 3); } return "rgba(" + r * 255 + "," + g * 255 + "," + b * 255 + "," + a + ")"; } function colorToRgb(val) { if (is.rgb(val)) { return rgbToRgba(val); } if (is.hex(val)) { return hexToRgba(val); } if (is.hsl(val)) { return hslToRgba(val); } } // Units function getUnit(val) { var split = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(val); if (split) { return split[1]; } } function getTransformUnit(propName) { if (stringContains(propName, 'translate') || propName === 'perspective') { return 'px'; } if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) { return 'deg'; } } // Values function getFunctionValue(val, animatable) { if (!is.fnc(val)) { return val; } return val(animatable.target, animatable.id, animatable.total); } function getAttribute(el, prop) { return el.getAttribute(prop); } function convertPxToUnit(el, value, unit) { var valueUnit = getUnit(value); if (arrayContains([unit, 'deg', 'rad', 'turn'], valueUnit)) { return value; } var cached = cache.CSS[value + unit]; if (!is.und(cached)) { return cached; } var baseline = 100; var tempEl = document.createElement(el.tagName); var parentEl = el.parentNode && el.parentNode !== document ? el.parentNode : document.body; parentEl.appendChild(tempEl); tempEl.style.position = 'absolute'; tempEl.style.width = baseline + unit; var factor = baseline / tempEl.offsetWidth; parentEl.removeChild(tempEl); var convertedUnit = factor * parseFloat(value); cache.CSS[value + unit] = convertedUnit; return convertedUnit; } function getCSSValue(el, prop, unit) { if (prop in el.style) { var uppercasePropName = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); var value = el.style[prop] || getComputedStyle(el).getPropertyValue(uppercasePropName) || '0'; return unit ? convertPxToUnit(el, value, unit) : value; } } function getAnimationType(el, prop) { if (is.dom(el) && !is.inp(el) && (getAttribute(el, prop) || is.svg(el) && el[prop])) { return 'attribute'; } if (is.dom(el) && arrayContains(validTransforms, prop)) { return 'transform'; } if (is.dom(el) && prop !== 'transform' && getCSSValue(el, prop)) { return 'css'; } if (el[prop] != null) { return 'object'; } } function getElementTransforms(el) { if (!is.dom(el)) { return; } var str = el.style.transform || ''; var reg = /(\w+)\(([^)]*)\)/g; var transforms = new Map(); var m; while (m = reg.exec(str)) { transforms.set(m[1], m[2]); } return transforms; } function getTransformValue(el, propName, animatable, unit) { var defaultVal = stringContains(propName, 'scale') ? 1 : 0 + getTransformUnit(propName); var value = getElementTransforms(el).get(propName) || defaultVal; if (animatable) { animatable.transforms.list.set(propName, value); animatable.transforms['last'] = propName; } return unit ? convertPxToUnit(el, value, unit) : value; } function getOriginalTargetValue(target, propName, unit, animatable) { switch (getAnimationType(target, propName)) { case 'transform': return getTransformValue(target, propName, animatable, unit); case 'css': return getCSSValue(target, propName, unit); case 'attribute': return getAttribute(target, propName); default: return target[propName] || 0; } } function getRelativeValue(to, from) { var operator = /^(\*=|\+=|-=)/.exec(to); if (!operator) { return to; } var u = getUnit(to) || 0; var x = parseFloat(from); var y = parseFloat(to.replace(operator[0], '')); switch (operator[0][0]) { case '+': return x + y + u; case '-': return x - y + u; case '*': return x * y + u; } } function validateValue(val, unit) { if (is.col(val)) { return colorToRgb(val); } if (/\s/g.test(val)) { return val; } var originalUnit = getUnit(val); var unitLess = originalUnit ? val.substr(0, val.length - originalUnit.length) : val; if (unit) { return unitLess + unit; } return unitLess; } // getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes // adapted from https://gist.github.com/SebLambla/3e0550c496c236709744 function getDistance(p1, p2) { return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); } function getCircleLength(el) { return Math.PI * 2 * getAttribute(el, 'r'); } function getRectLength(el) { return getAttribute(el, 'width') * 2 + getAttribute(el, 'height') * 2; } function getLineLength(el) { return getDistance({ x: getAttribute(el, 'x1'), y: getAttribute(el, 'y1') }, { x: getAttribute(el, 'x2'), y: getAttribute(el, 'y2') }); } function getPolylineLength(el) { var points = el.points; var totalLength = 0; var previousPos; for (var i = 0; i < points.numberOfItems; i++) { var currentPos = points.getItem(i); if (i > 0) { totalLength += getDistance(previousPos, currentPos); } previousPos = currentPos; } return totalLength; } function getPolygonLength(el) { var points = el.points; return getPolylineLength(el) + getDistance(points.getItem(points.numberOfItems - 1), points.getItem(0)); } // Path animation function getTotalLength(el) { if (el.getTotalLength) { return el.getTotalLength(); } switch (el.tagName.toLowerCase()) { case 'circle': return getCircleLength(el); case 'rect': return getRectLength(el); case 'line': return getLineLength(el); case 'polyline': return getPolylineLength(el); case 'polygon': return getPolygonLength(el); } } function setDashoffset(el) { var pathLength = getTotalLength(el); el.setAttribute('stroke-dasharray', pathLength); return pathLength; } // Motion path function getParentSvgEl(el) { var parentEl = el.parentNode; while (is.svg(parentEl)) { if (!is.svg(parentEl.parentNode)) { break; } parentEl = parentEl.parentNode; } return parentEl; } function getParentSvg(pathEl, svgData) { var svg = svgData || {}; var parentSvgEl = svg.el || getParentSvgEl(pathEl); var rect = parentSvgEl.getBoundingClientRect(); var viewBoxAttr = getAttribute(parentSvgEl, 'viewBox'); var width = rect.width; var height = rect.height; var viewBox = svg.viewBox || (viewBoxAttr ? viewBoxAttr.split(' ') : [0, 0, width, height]); return { el: parentSvgEl, viewBox: viewBox, x: viewBox[0] / 1, y: viewBox[1] / 1, w: width / viewBox[2], h: height / viewBox[3] }; } function getPath(path, percent) { var pathEl = is.str(path) ? selectString(path)[0] : path; var p = percent || 100; return function (property) { return { property: property, el: pathEl, svg: getParentSvg(pathEl), totalLength: getTotalLength(pathEl) * (p / 100) }; }; } function getPathProgress(path, progress) { function point(offset) { if (offset === void 0) offset = 0; var l = progress + offset >= 1 ? progress + offset : 0; return path.el.getPointAtLength(l); } var svg = getParentSvg(path.el, path.svg); var p = point(); var p0 = point(-1); var p1 = point(+1); switch (path.property) { case 'x': return (p.x - svg.x) * svg.w; case 'y': return (p.y - svg.y) * svg.h; case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI; } } // Decompose value function decomposeValue(val, unit) { // const rgx = /-?\d*\.?\d+/g; // handles basic numbers // const rgx = /[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation var rgx = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation var value = validateValue(is.pth(val) ? val.totalLength : val, unit) + ''; return { original: value, numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0], strings: is.str(val) || unit ? value.split(rgx) : [] }; } // Animatables function parseTargets(targets) { var targetsArray = targets ? flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets)) : []; return filterArray(targetsArray, function (item, pos, self) { return self.indexOf(item) === pos; }); } function getAnimatables(targets) { var parsed = parseTargets(targets); return parsed.map(function (t, i) { return { target: t, id: i, total: parsed.length, transforms: { list: getElementTransforms(t) } }; }); } // Properties function normalizePropertyTweens(prop, tweenSettings) { var settings = cloneObject(tweenSettings); // Override duration if easing is a spring if (/^spring/.test(settings.easing)) { settings.duration = spring(settings.easing); } if (is.arr(prop)) { var l = prop.length; var isFromTo = l === 2 && !is.obj(prop[0]); if (!isFromTo) { // Duration divided by the number of tweens if (!is.fnc(tweenSettings.duration)) { settings.duration = tweenSettings.duration / l; } } else { // Transform [from, to] values shorthand to a valid tween value prop = { value: prop }; } } var propArray = is.arr(prop) ? prop : [prop]; return propArray.map(function (v, i) { var obj = is.obj(v) && !is.pth(v) ? v : { value: v }; // Default delay value should only be applied to the first tween if (is.und(obj.delay)) { obj.delay = !i ? tweenSettings.delay : 0; } // Default endDelay value should only be applied to the last tween if (is.und(obj.endDelay)) { obj.endDelay = i === propArray.length - 1 ? tweenSettings.endDelay : 0; } return obj; }).map(function (k) { return mergeObjects(k, settings); }); } function flattenKeyframes(keyframes) { var propertyNames = filterArray(flattenArray(keyframes.map(function (key) { return Object.keys(key); })), function (p) { return is.key(p); }).reduce(function (a, b) { if (a.indexOf(b) < 0) { a.push(b); } return a; }, []); var properties = {}; var loop = function loop(i) { var propName = propertyNames[i]; properties[propName] = keyframes.map(function (key) { var newKey = {}; for (var p in key) { if (is.key(p)) { if (p == propName) { newKey.value = key[p]; } } else { newKey[p] = key[p]; } } return newKey; }); }; for (var i = 0; i < propertyNames.length; i++) { loop(i); } return properties; } function getProperties(tweenSettings, params) { var properties = []; var keyframes = params.keyframes; if (keyframes) { params = mergeObjects(flattenKeyframes(keyframes), params); } for (var p in params) { if (is.key(p)) { properties.push({ name: p, tweens: normalizePropertyTweens(params[p], tweenSettings) }); } } return properties; } // Tweens function normalizeTweenValues(tween, animatable) { var t = {}; for (var p in tween) { var value = getFunctionValue(tween[p], animatable); if (is.arr(value)) { value = value.map(function (v) { return getFunctionValue(v, animatable); }); if (value.length === 1) { value = value[0]; } } t[p] = value; } t.duration = parseFloat(t.duration); t.delay = parseFloat(t.delay); return t; } function normalizeTweens(prop, animatable) { var previousTween; return prop.tweens.map(function (t) { var tween = normalizeTweenValues(t, animatable); var tweenValue = tween.value; var to = is.arr(tweenValue) ? tweenValue[1] : tweenValue; var toUnit = getUnit(to); var originalValue = getOriginalTargetValue(animatable.target, prop.name, toUnit, animatable); var previousValue = previousTween ? previousTween.to.original : originalValue; var from = is.arr(tweenValue) ? tweenValue[0] : previousValue; var fromUnit = getUnit(from) || getUnit(originalValue); var unit = toUnit || fromUnit; if (is.und(to)) { to = previousValue; } tween.from = decomposeValue(from, unit); tween.to = decomposeValue(getRelativeValue(to, from), unit); tween.start = previousTween ? previousTween.end : 0; tween.end = tween.start + tween.delay + tween.duration + tween.endDelay; tween.easing = parseEasings(tween.easing, tween.duration); tween.isPath = is.pth(tweenValue); tween.isColor = is.col(tween.from.original); if (tween.isColor) { tween.round = 1; } previousTween = tween; return tween; }); } // Tween progress var setProgressValue = { css: function css(t, p, v) { return t.style[p] = v; }, attribute: function attribute(t, p, v) { return t.setAttribute(p, v); }, object: function object(t, p, v) { return t[p] = v; }, transform: function transform(t, p, v, transforms, manual) { transforms.list.set(p, v); if (p === transforms.last || manual) { var str = ''; transforms.list.forEach(function (value, prop) { str += prop + "(" + value + ") "; }); t.style.transform = str; } } }; // Set Value helper function setTargetsValue(targets, properties) { var animatables = getAnimatables(targets); animatables.forEach(function (animatable) { for (var property in properties) { var value = getFunctionValue(properties[property], animatable); var target = animatable.target; var valueUnit = getUnit(value); var originalValue = getOriginalTargetValue(target, property, valueUnit, animatable); var unit = valueUnit || getUnit(originalValue); var to = getRelativeValue(validateValue(value, unit), originalValue); var animType = getAnimationType(target, property); setProgressValue[animType](target, property, to, animatable.transforms, true); } }); } // Animations function createAnimation(animatable, prop) { var animType = getAnimationType(animatable.target, prop.name); if (animType) { var tweens = normalizeTweens(prop, animatable); var lastTween = tweens[tweens.length - 1]; return { type: animType, property: prop.name, animatable: animatable, tweens: tweens, duration: lastTween.end, delay: tweens[0].delay, endDelay: lastTween.endDelay }; } } function getAnimations(animatables, properties) { return filterArray(flattenArray(animatables.map(function (animatable) { return properties.map(function (prop) { return createAnimation(animatable, prop); }); })), function (a) { return !is.und(a); }); } // Create Instance function getInstanceTimings(animations, tweenSettings) { var animLength = animations.length; var getTlOffset = function getTlOffset(anim) { return anim.timelineOffset ? anim.timelineOffset : 0; }; var timings = {}; timings.duration = animLength ? Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration; })) : tweenSettings.duration; timings.delay = animLength ? Math.min.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.delay; })) : tweenSettings.delay; timings.endDelay = animLength ? timings.duration - Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration - anim.endDelay; })) : tweenSettings.endDelay; return timings; } var instanceID = 0; function createNewInstance(params) { var instanceSettings = replaceObjectProps(defaultInstanceSettings, params); var tweenSettings = replaceObjectProps(defaultTweenSettings, params); var properties = getProperties(tweenSettings, params); var animatables = getAnimatables(params.targets); var animations = getAnimations(animatables, properties); var timings = getInstanceTimings(animations, tweenSettings); var id = instanceID; instanceID++; return mergeObjects(instanceSettings, { id: id, children: [], animatables: animatables, animations: animations, duration: timings.duration, delay: timings.delay, endDelay: timings.endDelay }); } // Core var activeInstances = []; var pausedInstances = []; var raf; var engine = function () { function play() { raf = requestAnimationFrame(step); } function step(t) { var activeInstancesLength = activeInstances.length; if (activeInstancesLength) { var i = 0; while (i < activeInstancesLength) { var activeInstance = activeInstances[i]; if (!activeInstance.paused) { activeInstance.tick(t); } else { var instanceIndex = activeInstances.indexOf(activeInstance); if (instanceIndex > -1) { activeInstances.splice(instanceIndex, 1); activeInstancesLength = activeInstances.length; } } i++; } play(); } else { raf = cancelAnimationFrame(raf); } } return play; }(); function handleVisibilityChange() { if (document.hidden) { activeInstances.forEach(function (ins) { return ins.pause(); }); pausedInstances = activeInstances.slice(0); anime.running = activeInstances = []; } else { pausedInstances.forEach(function (ins) { return ins.play(); }); } } if (typeof document !== 'undefined') { document.addEventListener('visibilitychange', handleVisibilityChange); } // Public Instance function anime(params) { if (params === void 0) params = {}; var startTime = 0, lastTime = 0, now = 0; var children, childrenLength = 0; var resolve = null; function makePromise(instance) { var promise = window.Promise && new Promise(function (_resolve) { return resolve = _resolve; }); instance.finished = promise; return promise; } var instance = createNewInstance(params); var promise = makePromise(instance); function toggleInstanceDirection() { var direction = instance.direction; if (direction !== 'alternate') { instance.direction = direction !== 'normal' ? 'normal' : 'reverse'; } instance.reversed = !instance.reversed; children.forEach(function (child) { return child.reversed = instance.reversed; }); } function adjustTime(time) { return instance.reversed ? instance.duration - time : time; } function resetTime() { startTime = 0; lastTime = adjustTime(instance.currentTime) * (1 / anime.speed); } function seekChild(time, child) { if (child) { child.seek(time - child.timelineOffset); } } function syncInstanceChildren(time) { if (!instance.reversePlayback) { for (var i = 0; i < childrenLength; i++) { seekChild(time, children[i]); } } else { for (var i$1 = childrenLength; i$1--;) { seekChild(time, children[i$1]); } } } function setAnimationsProgress(insTime) { var i = 0; var animations = instance.animations; var animationsLength = animations.length; while (i < animationsLength) { var anim = animations[i]; var animatable = anim.animatable; var tweens = anim.tweens; var tweenLength = tweens.length - 1; var tween = tweens[tweenLength]; // Only check for keyframes if there is more than one tween if (tweenLength) { tween = filterArray(tweens, function (t) { return insTime < t.end; })[0] || tween; } var elapsed = minMax(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration; var eased = isNaN(elapsed) ? 1 : tween.easing(elapsed); var strings = tween.to.strings; var round = tween.round; var numbers = []; var toNumbersLength = tween.to.numbers.length; var progress = void 0; for (var n = 0; n < toNumbersLength; n++) { var value = void 0; var toNumber = tween.to.numbers[n]; var fromNumber = tween.from.numbers[n] || 0; if (!tween.isPath) { value = fromNumber + eased * (toNumber - fromNumber); } else { value = getPathProgress(tween.value, eased * toNumber); } if (round) { if (!(tween.isColor && n > 2)) { value = Math.round(value * round) / round; } } numbers.push(value); } // Manual Array.reduce for better performances var stringsLength = strings.length; if (!stringsLength) { progress = numbers[0]; } else { progress = strings[0]; for (var s = 0; s < stringsLength; s++) { var a = strings[s]; var b = strings[s + 1]; var n$1 = numbers[s]; if (!isNaN(n$1)) { if (!b) { progress += n$1 + ' '; } else { progress += n$1 + b; } } } } setProgressValue[anim.type](animatable.target, anim.property, progress, animatable.transforms); anim.currentValue = progress; i++; } } function setCallback(cb) { if (instance[cb] && !instance.passThrough) { instance[cb](instance); } } function countIteration() { if (instance.remaining && instance.remaining !== true) { instance.remaining--; } } function setInstanceProgress(engineTime) { var insDuration = instance.duration; var insDelay = instance.delay; var insEndDelay = insDuration - instance.endDelay; var insTime = adjustTime(engineTime); instance.progress = minMax(insTime / insDuration * 100, 0, 100); instance.reversePlayback = insTime < instance.currentTime; if (children) { syncInstanceChildren(insTime); } if (!instance.began && instance.currentTime > 0) { instance.began = true; setCallback('begin'); } if (!instance.loopBegan && instance.currentTime > 0) { instance.loopBegan = true; setCallback('loopBegin'); } if (insTime <= insDelay && instance.currentTime !== 0) { setAnimationsProgress(0); } if (insTime >= insEndDelay && instance.currentTime !== insDuration || !insDuration) { setAnimationsProgress(insDuration); } if (insTime > insDelay && insTime < insEndDelay) { if (!instance.changeBegan) { instance.changeBegan = true; instance.changeCompleted = false; setCallback('changeBegin'); } setCallback('change'); setAnimationsProgress(insTime); } else { if (instance.changeBegan) { instance.changeCompleted = true; instance.changeBegan = false; setCallback('changeComplete'); } } instance.currentTime = minMax(insTime, 0, insDuration); if (instance.began) { setCallback('update'); } if (engineTime >= insDuration) { lastTime = 0; countIteration(); if (!instance.remaining) { instance.paused = true; if (!instance.completed) { instance.completed = true; setCallback('loopComplete'); setCallback('complete'); if (!instance.passThrough && 'Promise' in window) { resolve(); promise = makePromise(instance); } } } else { startTime = now; setCallback('loopComplete'); instance.loopBegan = false; if (instance.direction === 'alternate') { toggleInstanceDirection(); } } } } instance.reset = function () { var direction = instance.direction; instance.passThrough = false; instance.currentTime = 0; instance.progress = 0; instance.paused = true; instance.began = false; instance.loopBegan = false; instance.changeBegan = false; instance.completed = false; instance.changeCompleted = false; instance.reversePlayback = false; instance.reversed = direction === 'reverse'; instance.remaining = instance.loop; children = instance.children; childrenLength = children.length; for (var i = childrenLength; i--;) { instance.children[i].reset(); } if (instance.reversed && instance.loop !== true || direction === 'alternate' && instance.loop === 1) { instance.remaining++; } setAnimationsProgress(instance.reversed ? instance.duration : 0); }; // Set Value helper instance.set = function (targets, properties) { setTargetsValue(targets, properties); return instance; }; instance.tick = function (t) { now = t; if (!startTime) { startTime = now; } setInstanceProgress((now + (lastTime - startTime)) * anime.speed); }; instance.seek = function (time) { setInstanceProgress(adjustTime(time)); }; instance.pause = function () { instance.paused = true; resetTime(); }; instance.play = function () { if (!instance.paused) { return; } if (instance.completed) { instance.reset(); } instance.paused = false; activeInstances.push(instance); resetTime(); if (!raf) { engine(); } }; instance.reverse = function () { toggleInstanceDirection(); instance.completed = instance.reversed ? false : true; resetTime(); }; instance.restart = function () { instance.reset(); instance.play(); }; instance.reset(); if (instance.autoplay) { instance.play(); } return instance; } // Remove targets from animation function removeTargetsFromAnimations(targetsArray, animations) { for (var a = animations.length; a--;) { if (arrayContains(targetsArray, animations[a].animatable.target)) { animations.splice(a, 1); } } } function removeTargets(targets) { var targetsArray = parseTargets(targets); for (var i = activeInstances.length; i--;) { var instance = activeInstances[i]; var animations = instance.animations; var children = instance.children; removeTargetsFromAnimations(targetsArray, animations); for (var c = children.length; c--;) { var child = children[c]; var childAnimations = child.animations; removeTargetsFromAnimations(targetsArray, childAnimations); if (!childAnimations.length && !child.children.length) { children.splice(c, 1); } } if (!animations.length && !children.length) { instance.pause(); } } } // Stagger helpers function stagger(val, params) { if (params === void 0) params = {}; var direction = params.direction || 'normal'; var easing = params.easing ? parseEasings(params.easing) : null; var grid = params.grid; var axis = params.axis; var fromIndex = params.from || 0; var fromFirst = fromIndex === 'first'; var fromCenter = fromIndex === 'center'; var fromLast = fromIndex === 'last'; var isRange = is.arr(val); var val1 = isRange ? parseFloat(val[0]) : parseFloat(val); var val2 = isRange ? parseFloat(val[1]) : 0; var unit = getUnit(isRange ? val[1] : val) || 0; var start = params.start || 0 + (isRange ? val1 : 0); var values = []; var maxValue = 0; return function (el, i, t) { if (fromFirst) { fromIndex = 0; } if (fromCenter) { fromIndex = (t - 1) / 2; } if (fromLast) { fromIndex = t - 1; } if (!values.length) { for (var index = 0; index < t; index++) { if (!grid) { values.push(Math.abs(fromIndex - index)); } else { var fromX = !fromCenter ? fromIndex % grid[0] : (grid[0] - 1) / 2; var fromY = !fromCenter ? Math.floor(fromIndex / grid[0]) : (grid[1] - 1) / 2; var toX = index % grid[0]; var toY = Math.floor(index / grid[0]); var distanceX = fromX - toX; var distanceY = fromY - toY; var value = Math.sqrt(distanceX * distanceX + distanceY * distanceY); if (axis === 'x') { value = -distanceX; } if (axis === 'y') { value = -distanceY; } values.push(value); } maxValue = Math.max.apply(Math, values); } if (easing) { values = values.map(function (val) { return easing(val / maxValue) * maxValue; }); } if (direction === 'reverse') { values = values.map(function (val) { return axis ? val < 0 ? val * -1 : -val : Math.abs(maxValue - val); }); } } var spacing = isRange ? (val2 - val1) / maxValue : val1; return start + spacing * (Math.round(values[i] * 100) / 100) + unit; }; } // Timeline function timeline(params) { if (params === void 0) params = {}; var tl = anime(params); tl.duration = 0; tl.add = function (instanceParams, timelineOffset) { var tlIndex = activeInstances.indexOf(tl); var children = tl.children; if (tlIndex > -1) { activeInstances.splice(tlIndex, 1); } function passThrough(ins) { ins.passThrough = true; } for (var i = 0; i < children.length; i++) { passThrough(children[i]); } var insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params)); insParams.targets = insParams.targets || params.targets; var tlDuration = tl.duration; insParams.autoplay = false; insParams.direction = tl.direction; insParams.timelineOffset = is.und(timelineOffset) ? tlDuration : getRelativeValue(timelineOffset, tlDuration); passThrough(tl); tl.seek(insParams.timelineOffset); var ins = anime(insParams); passThrough(ins); children.push(ins); var timings = getInstanceTimings(children, params); tl.delay = timings.delay; tl.endDelay = timings.endDelay; tl.duration = timings.duration; tl.seek(0); tl.reset(); if (tl.autoplay) { tl.play(); } return tl; }; return tl; } anime.version = '3.2.0'; anime.speed = 1; anime.running = activeInstances; anime.remove = removeTargets; anime.get = getOriginalTargetValue; anime.set = setTargetsValue; anime.convertPx = convertPxToUnit; anime.path = getPath; anime.setDashoffset = setDashoffset; anime.stagger = stagger; anime.timeline = timeline; anime.easing = parseEasings; anime.penner = penner; anime.random = function (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }; module.exports = anime; /***/ }), /***/ 977: /***/ ((module) => { /* # ----------------------------------------------------------------------------- # ~200_template_js/js/asciidoctor/asciidoctor.js # Provides JS functions to (dynamically) modify Asciidoctor HTML elements # # Product/Info: # http://jekyll.one # # Copyright (C) 2022 Juergen Adams # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- # NOTE: # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ /* eslint no-redeclare: "off" */ /* global window */ // TODO: // ----------------------------------------------------------------------------- // J1 Asciidoctor registered as "asciidoctor" // ----------------------------------------------------------------------------- /*! * J1 Asciidoctor * Copyright (C) 2022 Juergen Adams * Licensed under MIT License. */ module.exports = function asciidoctor(options) { return { // ------------------------------------------------------------------------- // module initializer // ------------------------------------------------------------------------- init: function init(options) { var moduleOptions = options; var logger = log4javascript.getLogger('j1.core.asciidoctor'); var moduleDefaults = { dummyOption: false // placeholder }; var options = $.extend(moduleDefaults, moduleOptions); logText = 'J1 Asciidoctor is being initialized'; logger.info(logText); this.callouts(); }, // end initializer // ------------------------------------------------------------------------- // manage callouts (HTML) // ------------------------------------------------------------------------- // see: https://stackoverflow.com/questions/19393493/add-colgroup-for-each-table-column callouts: function callouts(options) { var colgroupList = ''; // If the colist does not have a structure // if ($('.colist > table > colgroup').length == 0) { colgroupList += '' + '\n'; colgroupList += ' '; $(".colist > table").prepend(colgroupList); } }, // end callouts // ------------------------------------------------------------------------- // manage callouts (HTML) // ------------------------------------------------------------------------- conums: function conums(options) { var dependencies_met_page_finished = setInterval(function () { if (j1.getState() == 'finished') { // If the colist does not have a structure if ($('.colist > table > colgroup').length == 0) { var colgroupList = ''; colgroupList += ' '; $(".colist > table").prepend(colgroupList); clearInterval(dependencies_met_page_finished); } } }); } // end conums }; // END return }(jQuery); /***/ }), /***/ 602: /***/ ((module) => { "use strict"; /* # ----------------------------------------------------------------------------- # ~/js/j1_template/core.js # Provides an empty object for later loaded core objects # # Product/Info: # https://jekyll.one # http://getbootstrap.com/ # # Copyright (C) 2022 Juergen Adams # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ // ----------------------------------------------------------------------------- // module.exports = function core ( options ) { /*! * J1 Core * Copyright (C) 2022 Juergen Adams * Licensed under MIT License. */ module.exports = function (options) { // --------------------------------------------------------------------------- // Global variables // --------------------------------------------------------------------------- // var messageCatalog = {}; // var state; // var logger; // var logText; // --------------------------------------------------------------------------- // Default settings // --------------------------------------------------------------------------- var settings = $.extend({ foo: 'foo_option', bar: 'bar_option' }, options); var state = 'loaded'; return { // ------------------------------------------------------------------------- // _init_ // Global initializer for the core object // ------------------------------------------------------------------------- _init_: function _init_(options) { // // Place handling of options here // return; }, // END _init_ // ------------------------------------------------------------------------- // Returns the current (processing) state of the module // ------------------------------------------------------------------------- getState: function getState() { return state; }, // END state // ------------------------------------------------------------------------- // isMobile // Return true if the current platform is a mobile device // ------------------------------------------------------------------------- isMobile: function isMobile(ua_name) { var mobile = false; (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i.test(a.substr(0, 4))) mobile = true; })(navigator.userAgent || navigator.vendor || window.opera); return mobile; }, // END isMobile // ------------------------------------------------------------------------- // Clear button for input fields (forms) // ------------------------------------------------------------------------- bsFormClearButton: function bsFormClearButton() { // $('.position-relative :input').on('keydown focus', function() { $(':input').on('keydown focus change mouseover', function () { if ($(this).val().length > 0) { $(this).nextAll('.form-clear').removeClass('d-none'); } }).on('keydown keyup blur', function () { if ($(this).val().length === 0) { $(this).nextAll('.form-clear').addClass('d-none'); } }); // $('.form-clear').on('click', function() { // $(this).addClass('d-none').prevAll(':input').val(''); // // hide|clear results from top search // $('#search-results').hide(); // $('#search-results').html(''); // }); }, // END bsFormClearButton // ------------------------------------------------------------------------- // Initialize Backdrops on all

elements of class "dropcap" // ------------------------------------------------------------------------- createDropCap: function createDropCap() { // add class dropcap $('.paragraph.dropcap').children('p').addClass('dropcap'); // if ($('p.dropcap').length) { $('p.dropcap').each(function () { var $p = $(this); var text = $.trim($p.text()); var firstLetter = text[0]; var marginalDropCap = '' + firstLetter + ''; $p.html(text.replace(firstLetter, marginalDropCap)); }); } } // END createDropCap }; // end return (object) //})( jQuery, window ); }(); // END IFFE /***/ }), /***/ 610: /***/ (() => { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } /* A simple jQuery function that can add listeners on attribute change. http://meetselva.github.io/attrchange/ About License: Copyright (C) 2013-2014 Selvakumar Arumugam You may use attrchange plugin under the terms of the MIT Licese. https://github.com/meetselva/attrchange/blob/master/MIT-License.txt */ ; (function ($) { function isDOMAttrModifiedSupported() { var p = document.createElement('p'); var flag = false; if (p.addEventListener) { p.addEventListener('DOMAttrModified', function () { flag = true; }, false); } else if (p.attachEvent) { p.attachEvent('onDOMAttrModified', function () { flag = true; }); } else { return false; } p.setAttribute('id', 'target'); return flag; } function checkAttributes(chkAttr, e) { if (chkAttr) { var attributes = this.data('attr-old-value'); if (e.attributeName.indexOf('style') >= 0) { if (!attributes['style']) attributes['style'] = {}; //initialize var keys = e.attributeName.split('.'); e.attributeName = keys[0]; e.oldValue = attributes['style'][keys[1]]; //old value e.newValue = keys[1] + ':' + this.prop("style")[$.camelCase(keys[1])]; //new value attributes['style'][keys[1]] = e.newValue; } else { e.oldValue = attributes[e.attributeName]; e.newValue = this.attr(e.attributeName); attributes[e.attributeName] = e.newValue; } this.data('attr-old-value', attributes); //update the old value object } } //initialize Mutation Observer var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; $.fn.attrchange = function (a, b) { if (_typeof(a) == 'object') { //core var cfg = { trackValues: false, callback: $.noop }; //backward compatibility if (typeof a === "function") { cfg.callback = a; } else { $.extend(cfg, a); } if (cfg.trackValues) { //get attributes old value this.each(function (i, el) { var attributes = {}; for (var attr, i = 0, attrs = el.attributes, l = attrs.length; i < l; i++) { attr = attrs.item(i); attributes[attr.nodeName] = attr.value; } $(this).data('attr-old-value', attributes); }); } if (MutationObserver) { //Modern Browsers supporting MutationObserver var mOptions = { subtree: false, attributes: true, attributeOldValue: cfg.trackValues }; var observer = new MutationObserver(function (mutations) { mutations.forEach(function (e) { var _this = e.target; //get new value if trackValues is true if (cfg.trackValues) { e.newValue = $(_this).attr(e.attributeName); } if ($(_this).data('attrchange-status') === 'connected') { //execute if connected cfg.callback.call(_this, e); } }); }); return this.data('attrchange-method', 'Mutation Observer').data('attrchange-status', 'connected').data('attrchange-obs', observer).each(function () { observer.observe(this, mOptions); }); } else if (isDOMAttrModifiedSupported()) { //Opera //Good old Mutation Events return this.data('attrchange-method', 'DOMAttrModified').data('attrchange-status', 'connected').on('DOMAttrModified', function (event) { if (event.originalEvent) { event = event.originalEvent; } //jQuery normalization is not required event.attributeName = event.attrName; //property names to be consistent with MutationObserver event.oldValue = event.prevValue; //property names to be consistent with MutationObserver if ($(this).data('attrchange-status') === 'connected') { //disconnected logically cfg.callback.call(this, event); } }); } else if ('onpropertychange' in document.body) { //works only in IE return this.data('attrchange-method', 'propertychange').data('attrchange-status', 'connected').on('propertychange', function (e) { e.attributeName = window.event.propertyName; //to set the attr old value checkAttributes.call($(this), cfg.trackValues, e); if ($(this).data('attrchange-status') === 'connected') { //disconnected logically cfg.callback.call(this, e); } }); } return this; } else if (typeof a == 'string' && $.fn.attrchange.hasOwnProperty('extensions') && $.fn.attrchange['extensions'].hasOwnProperty(a)) { //extensions/options return $.fn.attrchange['extensions'][a].call(this, b); } }; $.fn.attrchange.extensions = { /*attrchange option/extension*/ disconnect: function disconnect(o) { if (typeof o !== 'undefined' && o.isPhysicalDisconnect) { return this.each(function () { var attrchangeMethod = $(this).data('attrchange-method'); if (attrchangeMethod == 'propertychange' || attrchangeMethod == 'DOMAttrModified') { $(this).off(attrchangeMethod); } else if (attrchangeMethod == 'Mutation Observer') { $(this).data('attrchange-obs').disconnect(); } else if (attrchangeMethod == 'polling') { clearInterval($(this).data('attrchange-polling-timer')); } }).removeData(['attrchange-method', 'attrchange-status']); } else { //logical disconnect return this.data('attrchange-status', 'disconnected'); //set a flag that prevents triggering callback onattrchange } }, remove: function remove(o) { return $.fn.attrchange.extensions['disconnect'].call(this, { isPhysicalDisconnect: true }); }, getProperties: function getProperties(o) { var attrchangeMethod = $(this).data('attrchange-method'); var pollInterval = $(this).data('attrchange-pollInterval'); return { method: attrchangeMethod, isPolling: attrchangeMethod == 'polling', pollingInterval: typeof pollInterval === 'undefined' ? 0 : parseInt(pollInterval, 10), status: typeof attrchangeMethod === 'undefined' ? 'removed' : $(this).data('attrchange-status') }; }, reconnect: function reconnect(o) { //reconnect possible only when there is a logical disconnect return this.data('attrchange-status', 'connected'); }, polling: function polling(o) { if (o.hasOwnProperty('isComputedStyle') && o.isComputedStyle == 'true') { /* extensive and slow - polling to check on computed style properties */ return this.each(function (i, _this) { if (!o.hasOwnProperty('properties') || Object.prototype.toString.call(o.properties) !== '[object Array]' || o.properties.length == 0) { return false; } //return if no properties found var attributes = {}; //store computed properties for (var i = 0; i < o.properties.length; i++) { attributes[o.properties[i]] = $(this).css(o.properties[i]); } var _this = this; $(this).data('attrchange-polling-timer', setInterval(function () { var changes = {}, hasChanges = false; // attrName: { oldValue: xxx, newValue: yyy} for (var comuptedVal, i = 0; i < o.properties.length; i++) { comuptedVal = $(_this).css(o.properties[i]); if (attributes[o.properties[i]] !== comuptedVal) { hasChanges = true; changes[o.properties[i]] = { oldValue: attributes[o.properties[i]], newValue: comuptedVal }; attributes[o.properties[i]] = comuptedVal; //add the attribute to the orig } } if (hasChanges && $(_this).data('attrchange-status') === 'connected') { //disconnected logically o.callback.call(_this, changes); } }, o.pollInterval ? o.pollInterval : 1000)).data('attrchange-method', 'polling').data('attrchange-pollInterval', o.pollInterval).data('attrchange-status', 'connected'); }); } else { return this.each(function (i, _this) { /* this one is programmatic polling */ var attributes = {}; for (var attr, i = 0, attrs = _this.attributes, l = attrs.length; i < l; i++) { attr = attrs.item(i); attributes[attr.nodeName] = attr.nodeValue; } $(_this).data('attrchange-polling-timer', setInterval(function () { var changes = {}, hasChanges = false; // attrName: { oldValue: xxx, newValue: yyy} for (var attr, i = 0, attrs = _this.attributes, l = attrs.length; i < l; i++) { attr = attrs.item(i); if (attributes.hasOwnProperty(attr.nodeName) && attributes[attr.nodeName] != attr.nodeValue) { //check the values changes[attr.nodeName] = { oldValue: attributes[attr.nodeName], newValue: attr.nodeValue }; hasChanges = true; } else if (!attributes.hasOwnProperty(attr.nodeName)) { //new attribute changes[attr.nodeName] = { oldValue: '', newValue: attr.nodeValue }; hasChanges = true; } attributes[attr.nodeName] = attr.nodeValue; //add the attribute to the orig } if (hasChanges && $(_this).data('attrchange-status') === 'connected') { //disconnected logically o.callback.call(_this, changes); } }, o.pollInterval ? o.pollInterval : 1000)).data('attrchange-method', 'polling').data('attrchange-pollInterval', o.pollInterval).data('attrchange-status', 'connected'); }); } } }; })(jQuery); /***/ }), /***/ 490: /***/ ((module) => { /* # ----------------------------------------------------------------------------- # ~/js/navigator/navigator.js # Provides all JavaScript core functions for J1 Navigator # # Product/Info: # https://jekyll.one # https://github.com/adamnurdin01/bootsnav # http://corenav.anurdin.net/ # # Copyright (C) 2022 Juergen Adams # Copyright (C) 2016 adamnurdin01 # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # Bootsnav is licensed under MIT License. # See: https://github.com/adamnurdin01/navigator # # ----------------------------------------------------------------------------- # NOTE: # jadams, 2020-06-21: # J1 Navigator needs a general revision on BS4 code and functionalities # Current, only base function are tested with BS4 (was coded for BS3) # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // TODO: Height of dropdowns are to be limited in general // ----------------------------------------------------------------------------- // Navigator core registered as 'j1.core.navigator' // ----------------------------------------------------------------------------- module.exports = function navigator(options) { // --------------------------------------------------------------------------- // global vars // --------------------------------------------------------------------------- var message = {}; var state; var logger; var logText; // ----------------------------------------------------------------------- // default settings // ----------------------------------------------------------------------- var settings = $.extend({ foo: 'bar', bar: 'foo' }, options); // --------------------------------------------------------------------------- // main object // --------------------------------------------------------------------------- return { // ------------------------------------------------------------------------- // module initializer // ------------------------------------------------------------------------- init: function init(defaultOptions, menuOptions) { logger = log4javascript.getLogger('j1.core.navigator'); logText = 'core is being initialized'; logger.info(logText); // ----------------------------------------------------------------------- // Create a Wrapper for the nav system // ----------------------------------------------------------------------- $('body').wrapInner('

'); this.manageDropdownMenu(defaultOptions, menuOptions); this.navbarSticky(); this.eventHandler(defaultOptions); // jadams, 2021-07-03: initialize events early message.type = 'command'; message.action = 'core_initialized'; message.text = 'navigator core initialized'; j1.sendMessage('j1.core.navigator', 'j1.adapter.navigator', message); return true; }, // ------------------------------------------------------------------------- // event handler // ------------------------------------------------------------------------- eventHandler: function eventHandler(options) { var defaultOptions = options; var logger = log4javascript.getLogger('j1.core.navigator.eventHandler'); var $getNav = $('nav.navbar.navigator'); var scrollDuration = 300; var page_link; var img_link; var classname; var nav_link; var anchor_id; var scrollOffset; var json_data; // jadams: unused code (for now).: manages HTML5 server side events // for incoming messages from Git Server send e.g. on a 'pull request' // NOTE: used for ControlCenter (cc) functionality only !!! // ----------------------------------------------------------------------- // const seeMe = 'https://smee.io/wlNIFNiJN0GClm2'; // const middleware = 'localhost:5000/state'; // const web_server_dev = 'http://localhost:41000/status'; // const utility_server = 'http://localhost:41001/git?request=pull'; // var sender = seeMe; // var payload; // if (j1.checkUserAgent('IE') || j1.checkUserAgent('Edge')) { // logger.warn('HTML5 server side events (SSE) not supported for: ' + userAgent); // logger.warn('Middleware messages disabled'); // } else { // const middleware_status = new EventSource(sender); // // // ----------------------------------------------------------------------- // // middleware event handler ( SSE currently NOT used) // // ----------------------------------------------------------------------- // middleware_status.onmessage = (event) => { // const payload = JSON.parse(event.data); // // logger.debug('middleware: event received'); // // json_data = JSON.stringify(payload, undefined, 2); // logText = 'payload: ' + json_data; // logger.debug(logText); // // message.type = 'command'; // message.action = 'status'; // message.text = payload; // j1.sendMessage( 'j1.core.navigator', 'j1.adapter.navigator', message ); // // return true; // }; // END event onMessage // } // bind click event to all plain '#' links to prevent default action // 'scroll-to-top' // See: // https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault // https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation // https://stackoverflow.com/questions/134845/which-href-value-should-i-use-for-javascript-links-or-javascriptvoid0 // $('a[href="#"]').click(function (e) { page_link = document.querySelector('[id="' + decodeURI(anchor_id).split('#').join('') + '"]') ? true : false; anchor_id = e.target.hash ? e.target.hash : false; classname = e.target.className ? e.target.className : ''; nav_link = classname.includes('nav-'); if (nav_link || !page_link) { logger.debug('\n' + 'click event on href "#" detected: prevent default action'); e.preventDefault ? e.preventDefault() : e.returnValue = false; } }); // ----------------------------------------------------------------------- // In-page smooth scroll // ----------------------------------------------------------------------- // bind click event to all headlines generated by AsciiDoctor // for smooth-scroll (in-page) // jadams,2022-06-10: unused code - smooth scrolling managed by // (page height) observer // ----------------------------------------------------------------------- // $('.sect1, .sect2 .sect3, .sect4, .sect5, .sect6').on('click', function (e) { // img_link = (e.target.localName == 'img') ? true : false; // page_link = document.querySelector('[id="' + decodeURI(anchor_id).split('#').join('') + '"]') ? true : false; // anchor_id = e.target.hash ? e.target.hash : false; // classname = e.target.className ? e.target.className : ''; // nav_link = typeof classname == 'string' ? classname.includes('nav-link') : false; // skip BS nav links // scrollOffset = j1.getScrollOffset(); // anchorTop = $(anchor_id).offset().top ? true : false; // // if (anchor_id && anchor_id.includes('void')) anchor_id = false; // // // skip scrolling if a click on an image detected // if (img_link) { // return true; // } // // if (anchor_id && !nav_link || page_link) { // logger.debug('\n' + 'click event on headline detected: ' + anchor_id); // // $('html, body').animate({ // scrollTop: + scrollOffset // }, scrollDuration); // e.preventDefault ? e.preventDefault() : e.returnValue = false; // } // }); // bind click event to all HTML elements of class '.badge' (Bootstrap) // for smooth-scroll (in-page) to a '
' element // ----------------------------------------------------------------------- $('.badge').on('click', function (e) { anchor_id = e.target.hash ? e.target.hash : false; scrollOffset = 100; if (anchor_id) { logger.debug('\n' + 'click event on badge detected: ' + anchor_id); $('html, body').animate({ scrollTop: $(anchor_id).offset().top - scrollOffset // NOTE: diffeent scrollOffset }, scrollDuration); event.stopPropagation(); } }); // bind click event to all HTML elements of class '.badge-tag' (j1) // for smooth-scroll (in-page) $('.badge-tag').on('click', function (e) { anchor_id = e.target.hash ? e.target.hash : false; scrollOffset = j1.getScrollOffset(); if (anchor_id) { logger.debug('\n' + 'click event on badge-tag detected: ' + anchor_id); $('html, body').animate({ scrollTop: $(anchor_id).offset().top + scrollOffset }, scrollDuration); event.stopPropagation(); } }); // jadams: test code for jQuery plugin 'regex' // ----------------------------------------------------------------------- // $('a:contains("?#")').click(function(e) { // e.preventDefault ? e.preventDefault() : e.returnValue = false; // logger.info('bound click event to "?#*", suppress default action'); // }); // ----------------------------------------------------------------------- // Navbar Sticky // ----------------------------------------------------------------------- var navSticky = $getNav.hasClass('navbar-sticky'); if (navSticky) { // Wraped navigation $getNav.wrap('
'); } // ----------------------------------------------------------------------- // Navbar Center // ----------------------------------------------------------------------- if ($getNav.hasClass('brand-center')) { var postsArr = new Array(); var index = $('nav.brand-center'); var $postsList = index.find('ul.navbar-nav'); //Create array of all posts in lists index.find('ul.navbar-nav > li').each(function () { postsArr.push($(this).html()); }); // Split the array at this point. The original array is altered. var firstList = postsArr.splice(0, Math.round(postsArr.length / 2)); var secondList = postsArr; var ListHTML = ''; var createHTML = function createHTML(list) { ListHTML = ''; for (var i = 0; i < list.length; i++) { ListHTML += '
  • ' + list[i] + '
  • '; } }; // Generate HTML for first list createHTML(firstList); $postsList.html(ListHTML); index.find('ul.nav').first().addClass('navbar-left'); // Generate HTML for second list createHTML(secondList); //Create new list after original one $postsList.after('').next().html(ListHTML); index.find('ul.nav').last().addClass('navbar-right'); // Wrap navigation menu index.find('ul.nav.navbar-left').wrap('
    '); index.find('ul.nav.navbar-right').wrap('
    '); // Selection Class index.find('ul.navbar-nav > li').each(function () { var dropDown = $('ul.dropdown-menu', this), megaMenu = $('ul.megamenu-content', this); dropDown.closest('li').addClass('dropdown'); megaMenu.closest('li').addClass('megamenu-fw'); }); } // ----------------------------------------------------------------------- // Menu Center // ----------------------------------------------------------------------- if ($getNav.find('ul.nav').hasClass('navbar-center')) { $getNav.addClass('menu-center'); } // ----------------------------------------------------------------------- // Navbar Full // ----------------------------------------------------------------------- if ($getNav.hasClass('navbar-full')) { // Add Class to body $('nav.navbar.navigator').find('ul.nav').wrap('
    '); $('.wrap-full-menu').wrap('
    '); $('ul.nav.navbar-nav').prepend('
  • '); } else if ($getNav.hasClass('navbar-mobile')) { $getNav.removeClass('no-full'); } else { $getNav.addClass('no-full'); } // ----------------------------------------------------------------------- // Navbar Fixed // ----------------------------------------------------------------------- if ($getNav.hasClass('no-background')) { $(window).on('scroll', function () { var navbarHeighth = $('nav.navbar').outerHeight(); var scrollPos = $(window).scrollTop(); if (scrollPos > navbarHeighth) { $('.navbar-fixed').removeClass('no-background'); } else { $('.navbar-fixed').addClass('no-background'); } }); } if ($getNav.hasClass('navbar-transparent')) { $(window).on('scroll', function () { var navbarHeighth = $('nav.navbar').outerHeight(); var scrollPos = $(window).scrollTop(); if (scrollPos > navbarHeighth) { $('.navbar-fixed').removeClass('navbar-transparent'); $('.navbar-fixed').addClass('navbar-scrolled'); } else { $('.navbar-fixed').removeClass('navbar-scrolled'); $('.navbar-fixed').addClass('navbar-transparent'); } }); } // ----------------------------------------------------------------------- // Manage events for all quicklinks // https://stackoverflow.com/questions/178325/how-do-i-check-if-an-element-is-hidden-in-jquery // https://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily // https://stackoverflow.com/questions/5963669/whats-the-difference-between-event-stoppropagation-and-event-preventdefault // ----------------------------------------------------------------------- $('.quicklink-nav').each(function () { // --------------------------------------------------------------------- // QuickSearch // if ($('li.quicksearch')) { logger.debug('register OPEN event for QuickSearch'); $('li.quicksearch > a', this).on('click', function (e) { e.preventDefault(); // don't do the default browser action logger.debug('manage search action OPEN'); $('html,body').animate({ scrollTop: 0 }, 0); $('.top-search').slideToggle('slow', 'swing', function () { if ($('.top-search').is(':visible')) { // disable scrolling (desktop) $('body').addClass('stop-scrolling'); // disable scrolling (mobile) $('body').bind('touchmove', function (e) { e.preventDefault(); }); // disable navbar $('#' + defaultOptions.nav_bar.container_id).hide(); } else { // enable scrolling (desktop) $('body').removeClass('stop-scrolling'); // enable scrolling (mobile) $('body').unbind('touchmove'); // enable navbar $('#' + defaultOptions.nav_bar.container_id).show(); } }); e.stopPropagation(); // don't bubble up the event }); logger.debug('register CLOSE event for QuickSearch'); $('.input-group-addon.close-search').on('click', function (e) { e.preventDefault(); // don't do the default browser action logger.debug('manage search action CLOSE'); $('.top-search').slideUp('slow', 'swing'); $('html,body').animate({ scrollTop: 0 }, 0); // enable scrolling (desktop) $('body').removeClass('stop-scrolling'); // enable scrolling (mobile) $('body').unbind('touchmove'); // enable navbar $('#' + defaultOptions.nav_bar.container_id).show(); e.stopPropagation(); // don't bubble up the event }); } // END QuickSearch // --------------------------------------------------------------------- // Translator dialog // if ($('li.translate')) { logger.debug('register SHOW event for J1 Translator'); $('li.translate > a', this).on('click', function (e) { j1.translator.showDialog(); }); } // END Translator // --------------------------------------------------------------------- // NBI Notebooks dialog // if ($('li.nbi-notebooks')) { logger.debug('register SHOW event for J1 NBI'); $('li.nbi-notebooks > a', this).on('click', function (e) { j1.adapter.nbinteract.showDialog(); }); } // END NBI Notebooks // --------------------------------------------------------------------- // CookieConsent dialog // if ($('li.cookie-consent')) { logger.debug('register SHOW event for J1 CookieConsent'); $('li.cookie-consent > a', this).on('click', function (e) { j1.cookieConsent.showDialog(); }); } // END CookieConsent }); // End manage events for all quicklinks }, // END eventHandler // ------------------------------------------------------------------------- // Manage the Menu Dropdowns for Desktop|Mobile // ------------------------------------------------------------------------- manageDropdownMenu: function manageDropdownMenu(defaultOptions, menuOptions) { var navDefaultOptions = defaultOptions; var navMenuOptions = menuOptions; var $getNav = $('nav.navbar.navigator'); var $windowOrientation = window.matchMedia('(orientation: landscape)').matches ? 'landscape' : 'portrait'; var $getWindow = $(window).width(); var $getNavWidth = $('nav').width(); var $getIn = $getNav.find('ul.nav').data('in'); var $getOut = $getNav.find('ul.nav').data('out'); var menuSelector = '#' + navMenuOptions.xhr_container_id + '.collapse'; var quicklinksSelector = '#navigator_nav_quicklinks'; var delayMenuOpen = navMenuOptions.delay_menu_open; var breakPoint; var $menu; var $dropDown; var timeoutHandle; // BS4 @media MAX breakpoints // NOTE: a media query is always a range // ----------------------------------------------------------------------- var gridBreakpoint_lg = 992; // bs-breakpoint-lg var gridBreakpoint_md = 768; // bs-breakpoint-md var gridBreakpoint_sm = 576; // bs-breakpoint-sm // BS4 @media MIN breakpoints // ----------------------------------------------------------------------- // NOTE: a media query is always a range // var gridBreakpoint_lg = 991; // var gridBreakpoint_md = 767; // var gridBreakpoint_sm = 575; // @media ranges // ----------------------------------------------------------------------- var small_range = { min: '0em', max: '40em' }; /* 0, 640px */ var medium_range = { min: '40.063em', max: '64em' }; /* 641px, 1024px */ var large_range = { min: '64.063em', max: '90em' }; /* 1025px, 1440px */ var xlarge_range = { min: '90.063em', max: '120em' }; /* 1441px, 1920px */ var xxlarge_range = { min: '120.063em' }; /* 1921px */ // jadams, 2019-05-01: Set Media Breakpoint for Desktop|Mobile Navigation if (navDefaultOptions.nav_bar.media_breakpoint === 'lg') { breakPoint = gridBreakpoint_lg; } else if (navDefaultOptions.nav_bar.media_breakpoint === 'md') { breakPoint = gridBreakpoint_md; } else if (navDefaultOptions.nav_bar.media_breakpoint === 'sm') { breakPoint = gridBreakpoint_sm; } else { breakPoint = gridBreakpoint_lg; } // ----------------------------------------------------------------------- // Tablet or Mobile // NOTE: // Managing the mobile menu is moved to MMenu Plugin // Only base functions like QuickLinks are managed by // J1 Navigator // ----------------------------------------------------------------------- // MIN media breakpoint if ($getWindow <= breakPoint) { // Collapse Navbar (Desktop Navigation) $(menuSelector).addClass('navbar-collapse'); $(menuSelector).removeClass('show'); // Show QuicklinksBar $(quicklinksSelector).addClass('show'); // ----------------------------------------------------------------------- // Desktop Navigation does NOT work on physical devices like iPad|Pro // Config DISABLED // // } else if ( $getWindow > breakPoint || $getWindow <= 1024 && $windowOrientation == 'portrait' ) { } else if ($getWindow > breakPoint) { // ----------------------------------------------------------------------- // Desktop // ----------------------------------------------------------------------- $('#navigator_nav_quicklinks').removeClass('show'); $('#desktop_menu').show(); // jadams, 2021-03-05: manage dropdown menus // --------------------------------------------------------------------- $('.dropdown-menu > li').on('mouseenter', function () { if ($('body').hasClass('stop-scrolling')) { return false; } else { $('body').addClass('stop-scrolling'); } }); $('.dropdown-menu > li').on('mouseleave', function () { // stop scrolling if top search or any (mmenu) drawer is opened if ($('body').hasClass('stop-scrolling')) { $('body').removeClass('stop-scrolling'); } }); // limit the dropdown menu lenght if needed $('.dropdown-menu > li').hover(function () { var $container = $(this); var $list = $container.find('ul'); // limit LAST menu ONLY if ($list.length == 1) { $list.addClass('scrollable-menu'); } }); // jadams, 2021-03-06: Enable|Show Desktop Menu|s // $(menuSelector).removeClass('navbar-collapse'); $(menuSelector).addClass('show'); // Open Desktop Menu|s on hover $('nav.navbar.navigator ul.nav').each(function () { $('a.dropdown-toggle', this).off('click'); // $('a.dropdown-toggle', this).on('click', function (e) { // // e.stopPropagation(); // don't bubble up the event // }); $('.megamenu-fw', this).each(function () { $('.title', this).off('click'); $('a.dropdown-toggle', this).off('click'); $('.content').removeClass('animate__animated '); }); $('.dropdown-menu', this).addClass('animate__animated '); $('li.dropdown', this).on('mouseenter', function (e) { $menu = $('.dropdown-menu', this).eq(0); $dropDown = $(this); $menu.removeClass($getOut); $menu.removeClass('open'); $dropDown.addClass('open'); // Create a timeout object to delay the dropdown menus to open timeoutHandle = window.setTimeout(function () { if ($dropDown.hasClass('open')) { $menu.stop().fadeIn().addClass($getIn); $menu.addClass('open'); $dropDown.addClass('open'); } }, delayMenuOpen); return true; }); $('li.dropdown', this).on('mouseleave', function (e) { $menu = $('.dropdown-menu', this).eq(0); $dropDown = $(this); // Clear the timeout object for dropdown menus 'open' window.clearTimeout(timeoutHandle); $menu.removeClass($getIn); $menu.addClass($getOut); $menu.fadeOut('slow'); $dropDown.removeClass('open'); return true; }); }); // END Desktop Menu } // end Desktop // ----------------------------------------------------------------------- // Fullscreen Menu // ----------------------------------------------------------------------- if ($getNav.hasClass('navbar-full')) { var windowHeight = $(window).height(), windowWidth = $(window).width(); $('.nav-full').css('height', windowHeight + 'px'); $('.wrap-full-menu').css('height', windowHeight + 'px'); $('.wrap-full-menu').css('width', windowWidth + 'px'); $('.navbar-collapse').addClass('animate__animated '); $('.navbar-toggle').each(function () { var getId = $(this).data('target'); $(this).off('click'); $(this).on('click', function (e) { e.preventDefault(); $(getId).removeClass($getOut); $(getId).addClass('in'); $(getId).addClass($getIn); // e.stopPropagation(); // don't bubble up the event // return false; }); $('li.close-full-menu').on('click', function (e) { e.preventDefault(); $(getId).addClass($getOut); setTimeout(function () { $(getId).removeClass('in'); $(getId).removeClass($getIn); }, 500); //e.stopPropagation(); // don't bubble up the event // return false; }); }); } }, // end manageDropdownMenu // ------------------------------------------------------------------------- // Sticky Navbar // ------------------------------------------------------------------------- navbarSticky: function navbarSticky() { var $getNav = $('nav.navbar.navigator'), navSticky = $getNav.hasClass('navbar-sticky'); if (navSticky) { // Set Height Navigation var $getHeight = $getNav.height(); $('.wrap-sticky').height($getHeight); // Windown on scroll var getOffset = $('.wrap-sticky').offset().top; $(window).on('scroll', function () { var scrollTop = $(window).scrollTop(); if (scrollTop > getOffset) { $getNav.addClass('sticked'); } else { $getNav.removeClass('sticked'); } }); } }, // end navbarSticky // ------------------------------------------------------------------------- // updateSidebar // Note: // ------------------------------------------------------------------------- updateSidebar: function updateSidebar(user_data) { var logger = log4javascript.getLogger('j1.core.navigator.updateSidebar'); var json_message; // json_message = JSON.stringify(user_data, undefined, 2); // multiline json_message = JSON.stringify(user_data); logText = 'user state data: ' + json_message; logger.debug(logText); // Replace Macro placeholders to values j1.resolveMacros(user_data); // Replace Macro values only j1.updateMacros(user_data); return true; } // END updateSidebar }; // end return (object) }(jQuery); /***/ }), /***/ 814: /***/ ((module) => { "use strict"; /* # ----------------------------------------------------------------------------- # ~/js/scroll-smooth/scroll-smooth.js # Provides Javascript functions for smooth scrolling # # Product/Info: # http://jekyll.one # # # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ /* eslint no-redeclare: "off" */ /* eslint indent: "off" */ // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // scrollSmooth core registered as "scrollSmooth" // ----------------------------------------------------------------------------- module.exports = function scrollSmooth(options) { // Default settings var settings = $.extend({ foo: 'foo_option', bar: 'bar_option' }, options); // ----------------------------------------------------------------------- // Helper functions // ----------------------------------------------------------------------- function stripHash(url) { return url.slice(0, url.lastIndexOf('#')); } function isCssSmoothScrollSupported() { return 'scrollBehavior' in document.documentElement.style; } return { // ------------------------------------------------------------------------- // Initialize scrollSmooth // ------------------------------------------------------------------------- scroll: function scroll(target, options) { var logger; var logText; logger = log4javascript.getLogger('j1.core.scrollSmooth'); // indicator|check currently NOT used // if (isCssSmoothScrollSupported()) { } logText = '\n' + 'run module scrollSmooth'; logger.debug(logText); var duration = options.duration; var offset = options.offset; // var pageUrl = options.location.hash // ? stripHash(options.location.href) // : options.location.href; this.scrollTo(target, { duration: duration, offset: offset, callback: false }); }, // ------------------------------------------------------------------------- // scrollTo // NOTE: Calculate the tgt (HTML heading element including the hash) // This makes ids that start with a number to work: // '[id="' + decodeURI(target).split('#').join('') + '"]' // DecodeURI is usded for nonASCII hashes, they was encoded, // but id was not encoded, it lead to not finding the tgt element by id. // ------------------------------------------------------------------------- scrollTo: function scrollTo(target, options) { var start = window.pageYOffset; var opt = { duration: options.duration, offset: options.offset || 0, callback: options.callback, easing: options.easing || easeInOutQuad }; // calculate the tgt (HTML heading element including the hash) var tgt = document.querySelector('[id="' + decodeURI(target).split('#').join('') + '"]'); var distance = typeof target === 'string' ? opt.offset + (target ? tgt && tgt.getBoundingClientRect().top || 0 // handle non-existent links better. : -(document.documentElement.scrollTop || document.body.scrollTop)) : target; var duration = typeof opt.duration === 'function' ? opt.duration(distance) : opt.duration; var timeStart; var timeElapsed; requestAnimationFrame(function (time) { timeStart = time; loop(time); }); function loop(time) { timeElapsed = time - timeStart; window.scrollTo(0, opt.easing(timeElapsed, start, distance, duration)); if (timeElapsed < duration) { requestAnimationFrame(loop); } else { postPositioning(); } } function postPositioning() { // if configured if (typeof opt.callback === 'function') { opt.callback(); } } // Robert Penner's easeInOutQuad - http://robertpenner.com/easing/ function easeInOutQuad(t, b, c, d) { t /= d / 2; if (t < 1) return c / 2 * t * t + b; t--; return -c / 2 * (t * (t - 2) - 1) + b; } } // END scrollTo }; // END return }(jQuery); /***/ }), /***/ 525: /***/ ((module) => { /** * This file is responsible for building the DOM and updating DOM state. * * @author Tim Scanlin */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- module.exports = function (options) { var forEach = [].forEach; var some = [].some; var body = document.body; var currentlyHighlighting = true; var SPACE_CHAR = ' '; /** * Create link and list elements. * @param {Object} d * @param {HTMLElement} container * @return {HTMLElement} */ function createEl(d, container) { var link = container.appendChild(createLink(d)); if (d.children.length) { var list = createList(d.isCollapsed); d.children.forEach(function (child) { createEl(child, list); }); link.appendChild(list); } } /** * Render nested heading array data into a given selector. * @param {String} selector * @param {Array} data * @return {HTMLElement} */ function render(selector, data) { var collapsed = false; var container = createList(collapsed); data.forEach(function (d) { createEl(d, container); }); var parent = document.querySelector(selector); // Return if no parent is found. if (parent === null) { return; } // Remove existing child if it exists. if (parent.firstChild) { parent.removeChild(parent.firstChild); } // Just return the parent and don't append the list if no links are found. if (data.length === 0) { return parent; } // Append the Elements that have been created return parent.appendChild(container); } /** * Create link element. * @param {Object} data * @return {HTMLElement} */ function createLink(data) { var item = document.createElement('li'); var a = document.createElement('a'); if (options.listItemClass) { item.setAttribute('class', options.listItemClass); } if (options.onClick) { a.onclick = options.onClick; } if (options.includeHtml && data.childNodes.length) { forEach.call(data.childNodes, function (node) { a.appendChild(node.cloneNode(true)); }); } else { // Default behavior. a.textContent = data.textContent; } a.setAttribute('href', options.basePath + '#' + data.id); a.setAttribute('class', options.linkClass + SPACE_CHAR + 'node-name--' + data.nodeName + SPACE_CHAR + options.extraLinkClasses); item.appendChild(a); return item; } /** * Create list element. * @param {Boolean} isCollapsed * @return {HTMLElement} */ function createList(isCollapsed) { var listElement = options.orderedList ? 'ol' : 'ul'; var list = document.createElement(listElement); var classes = options.listClass + SPACE_CHAR + options.extraListClasses; if (isCollapsed) { classes += SPACE_CHAR + options.collapsibleClass; classes += SPACE_CHAR + options.isCollapsedClass; } list.setAttribute('class', classes); return list; } /** * Update fixed sidebar class. * @return {HTMLElement} */ function updateFixedSidebarClass() { if (options.scrollContainer && document.querySelector(options.scrollContainer)) { var top; top = document.querySelector(options.scrollContainer).scrollTop; } else { top = document.documentElement.scrollTop || body.scrollTop; } var posFixedEl = document.querySelector(options.positionFixedSelector); if (options.fixedSidebarOffset === 'auto') { options.fixedSidebarOffset = document.querySelector(options.tocSelector).offsetTop; } if (top > options.fixedSidebarOffset) { if (posFixedEl.className.indexOf(options.positionFixedClass) === -1) { posFixedEl.className += SPACE_CHAR + options.positionFixedClass; } } else { posFixedEl.className = posFixedEl.className.split(SPACE_CHAR + options.positionFixedClass).join(''); } } /** * Get top position of heading * @param {HTMLElement} * @return {integer} position */ function getHeadingTopPos(obj) { var position = 0; if (obj !== document.querySelector(options.contentSelector && obj != null)) { position = obj.offsetTop; if (options.hasInnerContainers) { position += getHeadingTopPos(obj.offsetParent); } } return position; } /** * Update TOC highlighting and collapsed groups */ function updateToc(headingsArray) { // If a fixed content container was set if (options.scrollContainer && document.querySelector(options.scrollContainer)) { var top; top = document.querySelector(options.scrollContainer).scrollTop; } else { top = document.documentElement.scrollTop || body.scrollTop; } // Add fixed class at offset if (options.positionFixedSelector) { updateFixedSidebarClass(); } // Get the most TOP heading currently visible on the page to // identify what element to be highlighted var headings = headingsArray; var topHeader; var headingTopPos; // Using some instead of each so that we can escape early if (currentlyHighlighting && document.querySelector(options.tocSelector) !== null && headings.length > 0) { some.call(headings, function (heading, i) { headingTopPos = getHeadingTopPos(heading); if (headingTopPos > top + options.headingsOffset + 10) { // Don't allow negative index value // var index = (i === 0) ? i : i - 1; // topHeader = headings[index]; // jadams, index correction seems NOT needed topHeader = headings[i]; return true; } else if (i === headings.length - 1) { // This allows scrolling for the last heading on the page topHeader = headings[headings.length - 1]; return true; } }); // Remove the active class from the other tocLinks. var tocLinks = document.querySelector(options.tocSelector).querySelectorAll('.' + options.linkClass); forEach.call(tocLinks, function (tocLink) { tocLink.className = tocLink.className.split(SPACE_CHAR + options.activeLinkClass).join(''); }); var tocLis = document.querySelector(options.tocSelector).querySelectorAll('.' + options.listItemClass); forEach.call(tocLis, function (tocLi) { tocLi.className = tocLi.className.split(SPACE_CHAR + options.activeListItemClass).join(''); }); // Add the active class to the active tocLink. var activeTocLink = document.querySelector(options.tocSelector).querySelector('.' + options.linkClass + '.node-name--' + topHeader.nodeName + '[href="' + options.basePath + '#' + topHeader.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/@])/g, '\\$1') + '"]'); if (activeTocLink.className.indexOf(options.activeLinkClass) === -1) { activeTocLink.className += SPACE_CHAR + options.activeLinkClass; } var li = activeTocLink.parentNode; if (li && li.className.indexOf(options.activeListItemClass) === -1) { li.className += SPACE_CHAR + options.activeListItemClass; } var tocLists = document.querySelector(options.tocSelector).querySelectorAll('.' + options.listClass + '.' + options.collapsibleClass); // Collapse the other collapsible lists. forEach.call(tocLists, function (list) { if (list.className.indexOf(options.isCollapsedClass) === -1) { list.className += SPACE_CHAR + options.isCollapsedClass; } }); // Expand the active link's collapsible list and its sibling if applicable. if (activeTocLink.nextSibling && activeTocLink.nextSibling.className.indexOf(options.isCollapsedClass) !== -1) { activeTocLink.nextSibling.className = activeTocLink.nextSibling.className.split(SPACE_CHAR + options.isCollapsedClass).join(''); } removeCollapsedFromParents(activeTocLink.parentNode.parentNode); } } /** * Remove collpased class from parent elements. * @param {HTMLElement} element * @return {HTMLElement} */ function removeCollapsedFromParents(element) { if (element.className.indexOf(options.collapsibleClass) !== -1 && element.className.indexOf(options.isCollapsedClass) !== -1) { element.className = element.className.split(SPACE_CHAR + options.isCollapsedClass).join(''); return removeCollapsedFromParents(element.parentNode.parentNode); } return element; } /** * Disable TOC Animation when a link is clicked. * @param {Event} event */ function disableTocAnimation(event) { var target = event.target || event.srcElement; if (typeof target.className !== 'string' || target.className.indexOf(options.linkClass) === -1) { return; } // Bind to tocLink clicks to temporarily disable highlighting // while smoothScroll is animating. currentlyHighlighting = false; } /** * Enable TOC Animation. */ function enableTocAnimation() { currentlyHighlighting = true; } return { enableTocAnimation: enableTocAnimation, disableTocAnimation: disableTocAnimation, render: render, updateToc: updateToc }; }; /***/ }), /***/ 923: /***/ ((module) => { // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint no-unused-vars: "off" */ // ----------------------------------------------------------------------------- module.exports = { // Where to render the table of contents. tocSelector: '.js-toc', // Where to grab the headings to build the table of contents. contentSelector: '.js-toc-content', // Which headings to grab inside of the contentSelector element. headingSelector: 'h1, h2, h3', // Headings that match the ignoreSelector will be skipped. ignoreSelector: '.js-toc-ignore', // For headings inside relative or absolute positioned containers within content hasInnerContainers: false, // Main class to add to links. linkClass: 'toc-link', // Extra classes to add to links. extraLinkClasses: '', // Class to add to active links, // the link corresponding to the top most heading on the page. activeLinkClass: 'is-active-link', // Main class to add to lists. listClass: 'toc-list', // Extra classes to add to lists. extraListClasses: '', // Class that gets added when a list should be collapsed. isCollapsedClass: 'is-collapsed', // Class that gets added when a list should be able // to be collapsed but isn't necessarily collapsed. collapsibleClass: 'is-collapsible', // Class to add to list items. listItemClass: 'toc-list-item', // Class to add to active list items. activeListItemClass: 'is-active-li', // How many heading levels should not be collapsed. // For example, number 6 will show everything since // there are only 6 heading levels and number 0 will collapse them all. // The sections that are hidden will open // and close as you scroll to headings within them. collapseDepth: 0, // Smooth scrolling enabled. scrollSmooth: true, // Smooth scroll duration. scrollSmoothDuration: 420, // Smooth scroll offset. scrollSmoothOffset: 0, // Callback for scroll end. scrollEndCallback: function scrollEndCallback(e) {}, // Headings offset between the headings and the top of the document (this is meant for minor adjustments). headingsOffset: 1, // Timeout between events firing to make sure it's // not too rapid (for performance reasons). throttleTimeout: 50, // Element to add the positionFixedClass to. positionFixedSelector: null, // Fixed position class to add to make sidebar fixed after scrolling // down past the fixedSidebarOffset. positionFixedClass: 'is-position-fixed', // fixedSidebarOffset can be any number but by default is set // to auto which sets the fixedSidebarOffset to the sidebar // element's offsetTop from the top of the document on init. fixedSidebarOffset: 'auto', // includeHtml can be set to true to include the HTML markup from the // heading node instead of just including the textContent. includeHtml: false, // onclick function to apply to all links in toc. will be called with // the event as the first parameter, and this can be used to stop, // propagation, prevent default or perform action onClick: function onClick(e) {}, // orderedList can be set to false to generate unordered lists (ul) // instead of ordered lists (ol) orderedList: true, // If there is a fixed article scroll container, set to calculate titles' offset scrollContainer: null, // prevent ToC DOM rendering if it's already rendered by an external system skipRendering: false, // Optional callback to change heading labels. // For example it can be used to cut down and put ellipses on multiline headings you deem too long. // Called each time a heading is parsed. Expects a string in return, the modified label to display. // function (string) => string headingLabelCallback: false, // ignore headings that are hidden in DOM ignoreHiddenElements: false, // Optional callback to modify properties of parsed headings. // The heading element is passed in node parameter and information parsed by default parser is provided in obj parameter. // Function has to return the same or modified obj. // The heading will be excluded from TOC if nothing is returned. // function (object, HTMLElement) => object | void headingObjectCallback: null, // Set the base path, useful if you use a `base` tag in `head`. basePath: '', // Only takes affect when `tocSelector` is scrolling, // keep the toc scroll position in sync with the content. disableTocScrollSync: false }; /***/ }), /***/ 407: /***/ ((module) => { /** * This file is responsible for parsing the content from the DOM and making * sure data is nested properly. * * @author Tim Scanlin */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- module.exports = function parseContent(options) { var reduce = [].reduce; /** * Get the last item in an array and return a reference to it. * @param {Array} array * @return {Object} */ function getLastItem(array) { return array[array.length - 1]; } /** * Get heading level for a heading dom node. * @param {HTMLElement} heading * @return {Number} */ function getHeadingLevel(heading) { return +heading.nodeName.split('H').join(''); } /** * Get important properties from a heading element and store in a plain object. * @param {HTMLElement} heading * @return {Object} */ function getHeadingObject(heading) { // each node is processed twice by this method because nestHeadingsArray() and addNode() calls it // first time heading is real DOM node element, second time it is obj // that is causing problem so I am processing only original DOM node if (!(heading instanceof window.HTMLElement)) return heading; if (options.ignoreHiddenElements && (!heading.offsetHeight || !heading.offsetParent)) { return null; } var obj = { id: heading.id, children: [], nodeName: heading.nodeName, headingLevel: getHeadingLevel(heading), textContent: options.headingLabelCallback ? String(options.headingLabelCallback(heading.textContent)) : heading.textContent.trim() }; if (options.includeHtml) { obj.childNodes = heading.childNodes; } if (options.headingObjectCallback) { return options.headingObjectCallback(obj, heading); } return obj; } /** * Add a node to the nested array. * @param {Object} node * @param {Array} nest * @return {Array} */ function addNode(node, nest) { var obj = getHeadingObject(node); var level = obj.headingLevel; var array = nest; var lastItem = getLastItem(array); var lastItemLevel = lastItem ? lastItem.headingLevel : 0; var counter = level - lastItemLevel; while (counter > 0) { lastItem = getLastItem(array); if (lastItem && lastItem.children !== undefined) { array = lastItem.children; } counter--; } if (level >= options.collapseDepth) { obj.isCollapsed = true; } array.push(obj); return array; } /** * Select headings in content area, exclude any selector in options.ignoreSelector * @param {String} contentSelector * @param {Array} headingSelector * @return {Array} */ function selectHeadings(contentSelector, headingSelector) { var selectors = headingSelector; if (options.ignoreSelector) { selectors = headingSelector.split(',').map(function mapSelectors(selector) { return selector.trim() + ':not(' + options.ignoreSelector + ')'; }); } try { return document.querySelector(contentSelector).querySelectorAll(selectors); } catch (e) { console.warn('Element not found: ' + contentSelector); // eslint-disable-line return null; } } /** * Nest headings array into nested arrays with 'children' property. * @param {Array} headingsArray * @return {Object} */ function nestHeadingsArray(headingsArray) { return reduce.call(headingsArray, function reducer(prev, curr) { var currentHeading = getHeadingObject(curr); if (currentHeading) { addNode(currentHeading, prev.nest); } return prev; }, { nest: [] }); } return { nestHeadingsArray: nestHeadingsArray, selectHeadings: selectHeadings }; }; /***/ }), /***/ 968: /***/ ((__unused_webpack_module, exports) => { /* # ----------------------------------------------------------------------------- # ~/js/tocbot/scroll-smooth/index.js # Scroll-Smooth (Tocbot v4.12.0) implementation for J1 template # # Product/Info: # https://jekyll.one # https://tscanlin.github.io/tocbot # https://github.com/tscanlin/tocbot # # Copyright (C) 2022 Juergen Adams # Copyright (C) 2016 Tim Scanlin # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # Tocbot is licensed under the MIT License. # For details, https://github.com/tscanlin/tocbot/blob/master/LICENSE # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint no-redeclare: "off" */ /* eslint no-undef: "off" */ /* eslint no-empty: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- /* globals location, requestAnimationFrame */ exports.initSmoothScrolling = initSmoothScrolling; function initSmoothScrolling(options) { if (isCssSmoothSCrollSupported()) {} var duration = options.duration; var offset = options.offset; var pageUrl = location.hash ? stripHash(location.href) : location.href; delegatedLinkHijacking(); function delegatedLinkHijacking() { document.body.addEventListener('click', onClick, false); function onClick(e) { if (!isInPageLink(e.target) || e.target.className.indexOf('no-smooth-scroll') > -1 || e.target.href.charAt(e.target.href.length - 2) === '#' && e.target.href.charAt(e.target.href.length - 1) === '!' || e.target.className.indexOf(options.linkClass) === -1) { return; } // Don't prevent default or hash doesn't change. // e.preventDefault() // fixing-skip-to-content-links // jump(e.target.hash, { // duration: duration, // offset: offset, // callback: function () { // setFocus(e.target.hash) // } // }) // jadams, 2021-11-13 // fixing-skip-to-content-links, done by callback to focus(), seems // NOT longer required for current browsers jump(e.target.hash, { duration: duration, offset: offset, callback: false }); } } function isInPageLink(n) { return n.tagName.toLowerCase() === 'a' && (n.hash.length > 0 || n.href.charAt(n.href.length - 1) === '#') && (stripHash(n.href) === pageUrl || stripHash(n.href) + '#' === pageUrl); } function stripHash(url) { return url.slice(0, url.lastIndexOf('#')); } function isCssSmoothSCrollSupported() { return 'scrollBehavior' in document.documentElement.style; } // Adapted from: // https://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ function setFocus(hash) { var element = document.getElementById(hash.substring(1)); if (element) { if (!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)) { element.tabIndex = -1; } element.focus(); } } } function jump(target, options) { var start = window.pageYOffset; var opt = { duration: options.duration, offset: options.offset || 0, callback: options.callback, easing: options.easing || easeInOutQuad }; // This makes ids that start with a number work: ('[id="' + decodeURI(target).split('#').join('') + '"]') // DecodeURI for nonASCII hashes, they was encoded, but id was not encoded, it lead to not finding the tgt element by id. // And this is for IE: document.body.scrollTop var tgt = document.querySelector('[id="' + decodeURI(target).split('#').join('') + '"]'); var distance = typeof target === 'string' ? opt.offset + (target ? tgt && tgt.getBoundingClientRect().top || 0 // handle non-existent links better. : -(document.documentElement.scrollTop || document.body.scrollTop)) : target; var duration = typeof opt.duration === 'function' ? opt.duration(distance) : opt.duration; var timeStart; var timeElapsed; requestAnimationFrame(function (time) { timeStart = time; loop(time); }); function loop(time) { timeElapsed = time - timeStart; window.scrollTo(0, opt.easing(timeElapsed, start, distance, duration)); if (timeElapsed < duration) { requestAnimationFrame(loop); } else { end(); } } function end() { // window.scrollTo(0, start + distance) // jadams, 2020-07-04: on (some?) mobile devices, the navbar // background is NOT switched (always?) correctly on a // page RELOAD. // // Solution: scroll the page one pixel back and forth (trigger) // to get the right position for the Toccer and adjust the // Navigator to display the (tranparent) navbar correctly based // on their onscroll events registered. // // $(window).scrollTop($(window).scrollTop()+1); // $(window).scrollTop($(window).scrollTop()-1); if (typeof opt.callback === 'function') { opt.callback(); } } // Robert Penner's easeInOutQuad - http://robertpenner.com/easing/ function easeInOutQuad(t, b, c, d) { t /= d / 2; if (t < 1) return c / 2 * t * t + b; t--; return -c / 2 * (t * (t - 2) - 1) + b; } } /***/ }), /***/ 799: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } /* # ----------------------------------------------------------------------------- # ~/js/tocbot/tocbot.js # Tocbot v4.12.0 implementation for J1 template # # Product/Info: # https://jekyll.one # https://tscanlin.github.io/tocbot # https://github.com/tscanlin/tocbot # # Copyright (C) 2022 Juergen Adams # Copyright (C) 2016 Tim Scanlin # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # Tocbot is licensed under the MIT License. # For details, https://github.com/tscanlin/tocbot/blob/master/LICENSE # ----------------------------------------------------------------------------- # rules: # "eslint:tocbot": "eslint --ignore-path .eslintignore src/tocbot/js" # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- /** * Tocbot * Tocbot creates a toble of contents based on HTML headings on a page, * this allows users to easily jump to different sections of the document. * Tocbot was inspired by tocify (http://gregfranko.com/jquery.tocify.js/). * The main differences are that it works natively without any need for jquery or jquery UI). * * @author Tim Scanlin */ /* globals define */ (function (root, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory(root)), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} })(typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : this.window || this.global, function (root) { 'use strict'; // Default options. var defaultOptions = __webpack_require__(923); // Object to store current options. var options = {}; // Object for public APIs. var tocbot = {}; var BuildHtml = __webpack_require__(525); var ParseContent = __webpack_require__(407); var updateTocScroll = __webpack_require__(172); // Keep these variables at top scope once options are passed in. var buildHtml; var parseContent; // Just return if its not a browser. var supports = !!root && !!root.document && !!root.document.querySelector && !!root.addEventListener; // Feature test if (typeof window === 'undefined' && !supports) { return; } var headingsArray; // From: https://github.com/Raynos/xtend var hasOwnProperty = Object.prototype.hasOwnProperty; function extend() { var target = {}; for (var i = 0; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; } // From: https://remysharp.com/2010/07/21/throttling-function-calls function throttle(fn, threshold, scope) { threshold || (threshold = 250); var last; var deferTimer; return function () { var context = scope || this; var now = +new Date(); var args = arguments; if (last && now < last + threshold) { // hold on to it clearTimeout(deferTimer); deferTimer = setTimeout(function () { last = now; fn.apply(context, args); }, threshold); } else { last = now; fn.apply(context, args); } }; } /** * Destroy tocbot. */ tocbot.destroy = function () { if (!options.skipRendering) { // Clear HTML. try { document.querySelector(options.tocSelector).innerHTML = ''; } catch (e) { console.warn('Element not found: ' + options.tocSelector); // eslint-disable-line } } // Remove event listeners. if (options.scrollContainer && document.querySelector(options.scrollContainer)) { document.querySelector(options.scrollContainer).removeEventListener('scroll', this._scrollListener, false); document.querySelector(options.scrollContainer).removeEventListener('resize', this._scrollListener, false); if (buildHtml) { document.querySelector(options.scrollContainer).removeEventListener('click', this._clickListener, false); } } else { document.removeEventListener('scroll', this._scrollListener, false); document.removeEventListener('resize', this._scrollListener, false); if (buildHtml) { document.removeEventListener('click', this._clickListener, false); } } }; /** * Initialize tocbot. * @param {object} customOptions */ tocbot.init = function (customOptions) { // feature test if (!supports) { return; } // Merge defaults with user options. // Set to options variable at the top. options = extend(defaultOptions, customOptions || {}); this.options = options; this.state = {}; // Init smooth scroll if enabled (default). if (options.scrollSmooth) { options.duration = options.scrollSmoothDuration; options.offset = options.scrollSmoothOffset; tocbot.scrollSmooth = (__webpack_require__(968).initSmoothScrolling)(options); } // Pass options to these modules. buildHtml = BuildHtml(options); parseContent = ParseContent(options); // For testing purposes. this._buildHtml = buildHtml; this._parseContent = parseContent; // Destroy it if it exists first. tocbot.destroy(); // Get headings array. headingsArray = parseContent.selectHeadings(options.contentSelector, options.headingSelector); // Return if no headings are found. if (headingsArray === null) { return; } // Build nested headings array. var nestedHeadingsObj = parseContent.nestHeadingsArray(headingsArray); var nestedHeadings = nestedHeadingsObj.nest; // Render. if (!options.skipRendering) { buildHtml.render(options.tocSelector, nestedHeadings); } // Update Sidebar and bind listeners. this._scrollListener = throttle(function (e) { buildHtml.updateToc(headingsArray); !options.disableTocScrollSync && updateTocScroll(options); var isTop = e && e.target && e.target.scrollingElement && e.target.scrollingElement.scrollTop === 0; if (e && (e.eventPhase === 0 || e.currentTarget === null) || isTop) { buildHtml.updateToc(headingsArray); if (options.scrollEndCallback) { options.scrollEndCallback(e); } } }, options.throttleTimeout); this._scrollListener(); if (options.scrollContainer && document.querySelector(options.scrollContainer)) { document.querySelector(options.scrollContainer).addEventListener('scroll', this._scrollListener, false); document.querySelector(options.scrollContainer).addEventListener('resize', this._scrollListener, false); } else { document.addEventListener('scroll', this._scrollListener, false); document.addEventListener('resize', this._scrollListener, false); } // Bind click listeners to disable animation. var timeout = null; this._clickListener = throttle(function (event) { if (options.scrollSmooth) { buildHtml.disableTocAnimation(event); } buildHtml.updateToc(headingsArray); // Timeout to re-enable the animation. timeout && clearTimeout(timeout); timeout = setTimeout(function () { buildHtml.enableTocAnimation(); }, options.scrollSmoothDuration); }, options.throttleTimeout); if (options.scrollContainer && document.querySelector(options.scrollContainer)) { document.querySelector(options.scrollContainer).addEventListener('click', this._clickListener, false); } else { document.addEventListener('click', this._clickListener, false); } return this; }; /** * Refresh tocbot. */ tocbot.refresh = function (customOptions) { tocbot.destroy(); tocbot.init(customOptions || this.options); }; // Make tocbot available globally. root.tocbot = tocbot; return tocbot; }); /***/ }), /***/ 172: /***/ ((module) => { // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- module.exports = function updateTocScroll(options) { var toc = document.querySelector(options.tocSelector); if (toc && toc.scrollHeight > toc.clientHeight) { var activeItem = toc.querySelector('.' + options.activeListItemClass); if (activeItem) { toc.scrollTop = activeItem.offsetTop; } } }; /***/ }), /***/ 808: /***/ ((module, exports, __webpack_require__) => { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! * JavaScript Cookie v2.2.1 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license */ ;(function (factory) { var registeredInModuleLoader; if (true) { !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); registeredInModuleLoader = true; } if (true) { module.exports = factory(); registeredInModuleLoader = true; } if (!registeredInModuleLoader) { var OldCookies = window.Cookies; var api = window.Cookies = factory(); api.noConflict = function () { window.Cookies = OldCookies; return api; }; } }(function () { function extend () { var i = 0; var result = {}; for (; i < arguments.length; i++) { var attributes = arguments[ i ]; for (var key in attributes) { result[key] = attributes[key]; } } return result; } function decode (s) { return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); } function init (converter) { function api() {} function set (key, value, attributes) { if (typeof document === 'undefined') { return; } attributes = extend({ path: '/' }, api.defaults, attributes); if (typeof attributes.expires === 'number') { attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5); } // We're using "expires" because "max-age" is not supported by IE attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; try { var result = JSON.stringify(value); if (/^[\{\[]/.test(result)) { value = result; } } catch (e) {} value = converter.write ? converter.write(value, key) : encodeURIComponent(String(value)) .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); key = encodeURIComponent(String(key)) .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent) .replace(/[\(\)]/g, escape); var stringifiedAttributes = ''; for (var attributeName in attributes) { if (!attributes[attributeName]) { continue; } stringifiedAttributes += '; ' + attributeName; if (attributes[attributeName] === true) { continue; } // Considers RFC 6265 section 5.2: // ... // 3. If the remaining unparsed-attributes contains a %x3B (";") // character: // Consume the characters of the unparsed-attributes up to, // not including, the first %x3B (";") character. // ... stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; } return (document.cookie = key + '=' + value + stringifiedAttributes); } function get (key, json) { if (typeof document === 'undefined') { return; } var jar = {}; // To prevent the for loop in the first place assign an empty array // in case there are no cookies at all. var cookies = document.cookie ? document.cookie.split('; ') : []; var i = 0; for (; i < cookies.length; i++) { var parts = cookies[i].split('='); var cookie = parts.slice(1).join('='); if (!json && cookie.charAt(0) === '"') { cookie = cookie.slice(1, -1); } try { var name = decode(parts[0]); cookie = (converter.read || converter)(cookie, name) || decode(cookie); if (json) { try { cookie = JSON.parse(cookie); } catch (e) {} } jar[name] = cookie; if (key === name) { break; } } catch (e) {} } return key ? jar[key] : jar; } api.set = set; api.get = function (key) { return get(key, false /* read as raw */); }; api.getJSON = function (key) { return get(key, true /* read as json */); }; api.remove = function (key, attributes) { set(key, '', extend(attributes, { expires: -1 })); }; api.defaults = {}; api.withConverter = init; return api; } return init(function () {}); })); /***/ }), /***/ 320: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var loader = __webpack_require__(990); var dumper = __webpack_require__(150); function renamed(from, to) { return function () { throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + 'Use yaml.' + to + ' instead, which is now safe by default.'); }; } module.exports.Type = __webpack_require__(364); module.exports.Schema = __webpack_require__(657); module.exports.FAILSAFE_SCHEMA = __webpack_require__(795); module.exports.JSON_SCHEMA = __webpack_require__(966); module.exports.CORE_SCHEMA = __webpack_require__(471); module.exports.DEFAULT_SCHEMA = __webpack_require__(601); module.exports.load = loader.load; module.exports.loadAll = loader.loadAll; module.exports.dump = dumper.dump; module.exports.YAMLException = __webpack_require__(425); // Re-export all types in case user wants to create custom schema module.exports.types = { binary: __webpack_require__(531), float: __webpack_require__(215), map: __webpack_require__(945), null: __webpack_require__(151), pairs: __webpack_require__(879), set: __webpack_require__(982), timestamp: __webpack_require__(156), bool: __webpack_require__(771), int: __webpack_require__(518), merge: __webpack_require__(452), omap: __webpack_require__(605), seq: __webpack_require__(451), str: __webpack_require__(48) }; // Removed functions from JS-YAML 3.0.x module.exports.safeLoad = renamed('safeLoad', 'load'); module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll'); module.exports.safeDump = renamed('safeDump', 'dump'); /***/ }), /***/ 347: /***/ ((module) => { "use strict"; function isNothing(subject) { return (typeof subject === 'undefined') || (subject === null); } function isObject(subject) { return (typeof subject === 'object') && (subject !== null); } function toArray(sequence) { if (Array.isArray(sequence)) return sequence; else if (isNothing(sequence)) return []; return [ sequence ]; } function extend(target, source) { var index, length, key, sourceKeys; if (source) { sourceKeys = Object.keys(source); for (index = 0, length = sourceKeys.length; index < length; index += 1) { key = sourceKeys[index]; target[key] = source[key]; } } return target; } function repeat(string, count) { var result = '', cycle; for (cycle = 0; cycle < count; cycle += 1) { result += string; } return result; } function isNegativeZero(number) { return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); } module.exports.isNothing = isNothing; module.exports.isObject = isObject; module.exports.toArray = toArray; module.exports.repeat = repeat; module.exports.isNegativeZero = isNegativeZero; module.exports.extend = extend; /***/ }), /***/ 150: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /*eslint-disable no-use-before-define*/ var common = __webpack_require__(347); var YAMLException = __webpack_require__(425); var DEFAULT_SCHEMA = __webpack_require__(601); var _toString = Object.prototype.toString; var _hasOwnProperty = Object.prototype.hasOwnProperty; var CHAR_BOM = 0xFEFF; var CHAR_TAB = 0x09; /* Tab */ var CHAR_LINE_FEED = 0x0A; /* LF */ var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ var CHAR_SPACE = 0x20; /* Space */ var CHAR_EXCLAMATION = 0x21; /* ! */ var CHAR_DOUBLE_QUOTE = 0x22; /* " */ var CHAR_SHARP = 0x23; /* # */ var CHAR_PERCENT = 0x25; /* % */ var CHAR_AMPERSAND = 0x26; /* & */ var CHAR_SINGLE_QUOTE = 0x27; /* ' */ var CHAR_ASTERISK = 0x2A; /* * */ var CHAR_COMMA = 0x2C; /* , */ var CHAR_MINUS = 0x2D; /* - */ var CHAR_COLON = 0x3A; /* : */ var CHAR_EQUALS = 0x3D; /* = */ var CHAR_GREATER_THAN = 0x3E; /* > */ var CHAR_QUESTION = 0x3F; /* ? */ var CHAR_COMMERCIAL_AT = 0x40; /* @ */ var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ var CHAR_GRAVE_ACCENT = 0x60; /* ` */ var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ var CHAR_VERTICAL_LINE = 0x7C; /* | */ var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ var ESCAPE_SEQUENCES = {}; ESCAPE_SEQUENCES[0x00] = '\\0'; ESCAPE_SEQUENCES[0x07] = '\\a'; ESCAPE_SEQUENCES[0x08] = '\\b'; ESCAPE_SEQUENCES[0x09] = '\\t'; ESCAPE_SEQUENCES[0x0A] = '\\n'; ESCAPE_SEQUENCES[0x0B] = '\\v'; ESCAPE_SEQUENCES[0x0C] = '\\f'; ESCAPE_SEQUENCES[0x0D] = '\\r'; ESCAPE_SEQUENCES[0x1B] = '\\e'; ESCAPE_SEQUENCES[0x22] = '\\"'; ESCAPE_SEQUENCES[0x5C] = '\\\\'; ESCAPE_SEQUENCES[0x85] = '\\N'; ESCAPE_SEQUENCES[0xA0] = '\\_'; ESCAPE_SEQUENCES[0x2028] = '\\L'; ESCAPE_SEQUENCES[0x2029] = '\\P'; var DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' ]; var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; function compileStyleMap(schema, map) { var result, keys, index, length, tag, style, type; if (map === null) return {}; result = {}; keys = Object.keys(map); for (index = 0, length = keys.length; index < length; index += 1) { tag = keys[index]; style = String(map[tag]); if (tag.slice(0, 2) === '!!') { tag = 'tag:yaml.org,2002:' + tag.slice(2); } type = schema.compiledTypeMap['fallback'][tag]; if (type && _hasOwnProperty.call(type.styleAliases, style)) { style = type.styleAliases[style]; } result[tag] = style; } return result; } function encodeHex(character) { var string, handle, length; string = character.toString(16).toUpperCase(); if (character <= 0xFF) { handle = 'x'; length = 2; } else if (character <= 0xFFFF) { handle = 'u'; length = 4; } else if (character <= 0xFFFFFFFF) { handle = 'U'; length = 8; } else { throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); } return '\\' + handle + common.repeat('0', length - string.length) + string; } var QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2; function State(options) { this.schema = options['schema'] || DEFAULT_SCHEMA; this.indent = Math.max(1, (options['indent'] || 2)); this.noArrayIndent = options['noArrayIndent'] || false; this.skipInvalid = options['skipInvalid'] || false; this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); this.styleMap = compileStyleMap(this.schema, options['styles'] || null); this.sortKeys = options['sortKeys'] || false; this.lineWidth = options['lineWidth'] || 80; this.noRefs = options['noRefs'] || false; this.noCompatMode = options['noCompatMode'] || false; this.condenseFlow = options['condenseFlow'] || false; this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; this.forceQuotes = options['forceQuotes'] || false; this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; this.implicitTypes = this.schema.compiledImplicit; this.explicitTypes = this.schema.compiledExplicit; this.tag = null; this.result = ''; this.duplicates = []; this.usedDuplicates = null; } // Indents every line in a string. Empty lines (\n only) are not indented. function indentString(string, spaces) { var ind = common.repeat(' ', spaces), position = 0, next = -1, result = '', line, length = string.length; while (position < length) { next = string.indexOf('\n', position); if (next === -1) { line = string.slice(position); position = length; } else { line = string.slice(position, next + 1); position = next + 1; } if (line.length && line !== '\n') result += ind; result += line; } return result; } function generateNextLine(state, level) { return '\n' + common.repeat(' ', state.indent * level); } function testImplicitResolving(state, str) { var index, length, type; for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { type = state.implicitTypes[index]; if (type.resolve(str)) { return true; } } return false; } // [33] s-white ::= s-space | s-tab function isWhitespace(c) { return c === CHAR_SPACE || c === CHAR_TAB; } // Returns true if the character can be printed without escaping. // From YAML 1.2: "any allowed characters known to be non-printable // should also be escaped. [However,] This isn’t mandatory" // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. function isPrintable(c) { return (0x00020 <= c && c <= 0x00007E) || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) || (0x10000 <= c && c <= 0x10FFFF); } // [34] ns-char ::= nb-char - s-white // [27] nb-char ::= c-printable - b-char - c-byte-order-mark // [26] b-char ::= b-line-feed | b-carriage-return // Including s-white (for some reason, examples doesn't match specs in this aspect) // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark function isNsCharOrWhitespace(c) { return isPrintable(c) && c !== CHAR_BOM // - b-char && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED; } // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out // c = flow-in ⇒ ns-plain-safe-in // c = block-key ⇒ ns-plain-safe-out // c = flow-key ⇒ ns-plain-safe-in // [128] ns-plain-safe-out ::= ns-char // [129] ns-plain-safe-in ::= ns-char - c-flow-indicator // [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) // | ( /* An ns-char preceding */ “#” ) // | ( “:” /* Followed by an ns-plain-safe(c) */ ) function isPlainSafe(c, prev, inblock) { var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); return ( // ns-plain-safe inblock ? // c = flow-in cIsNsCharOrWhitespace : cIsNsCharOrWhitespace // - c-flow-indicator && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET ) // ns-plain-char && c !== CHAR_SHARP // false on '#' && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' } // Simplified test for values allowed as the first character in plain style. function isPlainSafeFirst(c) { // Uses a subset of ns-char - c-indicator // where ns-char = nb-char - s-white. // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) // - s-white // - (c-indicator ::= // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE // | “%” | “@” | “`”) && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT; } // Simplified test for values allowed as the last character in plain style. function isPlainSafeLast(c) { // just not whitespace or colon, it will be checked to be plain character later return !isWhitespace(c) && c !== CHAR_COLON; } // Same as 'string'.codePointAt(pos), but works in older browsers. function codePointAt(string, pos) { var first = string.charCodeAt(pos), second; if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { second = string.charCodeAt(pos + 1); if (second >= 0xDC00 && second <= 0xDFFF) { // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; } } return first; } // Determines whether block indentation indicator is required. function needIndentIndicator(string) { var leadingSpaceRe = /^\n* /; return leadingSpaceRe.test(string); } var STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5; // Determines which scalar styles are possible and returns the preferred style. // lineWidth = -1 => no limit. // Pre-conditions: str.length > 0. // Post-conditions: // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) { var i; var char = 0; var prevChar = null; var hasLineBreak = false; var hasFoldableLine = false; // only checked if shouldTrackWidth var shouldTrackWidth = lineWidth !== -1; var previousLineBreak = -1; // count the first line correctly var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1)); if (singleLineOnly || forceQuotes) { // Case: no block styles. // Check for disallowed characters to rule out plain and single. for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { char = codePointAt(string, i); if (!isPrintable(char)) { return STYLE_DOUBLE; } plain = plain && isPlainSafe(char, prevChar, inblock); prevChar = char; } } else { // Case: block styles permitted. for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { char = codePointAt(string, i); if (char === CHAR_LINE_FEED) { hasLineBreak = true; // Check if any line can be folded. if (shouldTrackWidth) { hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented. (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' '); previousLineBreak = i; } } else if (!isPrintable(char)) { return STYLE_DOUBLE; } plain = plain && isPlainSafe(char, prevChar, inblock); prevChar = char; } // in case the end is missing a \n hasFoldableLine = hasFoldableLine || (shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' ')); } // Although every style can represent \n without escaping, prefer block styles // for multiline, since they're more readable and they don't add empty lines. // Also prefer folding a super-long line. if (!hasLineBreak && !hasFoldableLine) { // Strings interpretable as another type have to be quoted; // e.g. the string 'true' vs. the boolean true. if (plain && !forceQuotes && !testAmbiguousType(string)) { return STYLE_PLAIN; } return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; } // Edge case: block indentation indicator can only have one digit. if (indentPerLevel > 9 && needIndentIndicator(string)) { return STYLE_DOUBLE; } // At this point we know block styles are valid. // Prefer literal style unless we want to fold. if (!forceQuotes) { return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; } return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; } // Note: line breaking/folding is implemented for only the folded style. // NB. We drop the last trailing newline (if any) of a returned block scalar // since the dumper adds its own newline. This always works: // • No ending newline => unaffected; already using strip "-" chomping. // • Ending newline => removed then restored. // Importantly, this keeps the "+" chomp indicator from gaining an extra line. function writeScalar(state, string, level, iskey, inblock) { state.dump = (function () { if (string.length === 0) { return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; } if (!state.noCompatMode) { if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); } } var indent = state.indent * Math.max(1, level); // no 0-indent scalars // As indentation gets deeper, let the width decrease monotonically // to the lower bound min(state.lineWidth, 40). // Note that this implies // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. // state.lineWidth > 40 + state.indent: width decreases until the lower bound. // This behaves better than a constant minimum width which disallows narrower options, // or an indent threshold which causes the width to suddenly increase. var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); // Without knowing if keys are implicit/explicit, assume implicit for safety. var singleLineOnly = iskey // No block styles in flow mode. || (state.flowLevel > -1 && level >= state.flowLevel); function testAmbiguity(string) { return testImplicitResolving(state, string); } switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { case STYLE_PLAIN: return string; case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'"; case STYLE_LITERAL: return '|' + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent)); case STYLE_FOLDED: return '>' + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); case STYLE_DOUBLE: return '"' + escapeString(string, lineWidth) + '"'; default: throw new YAMLException('impossible error: invalid scalar style'); } }()); } // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. function blockHeader(string, indentPerLevel) { var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; // note the special case: the string '\n' counts as a "trailing" empty line. var clip = string[string.length - 1] === '\n'; var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); var chomp = keep ? '+' : (clip ? '' : '-'); return indentIndicator + chomp + '\n'; } // (See the note for writeScalar.) function dropEndingNewline(string) { return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; } // Note: a long line without a suitable break point will exceed the width limit. // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. function foldString(string, width) { // In folded style, $k$ consecutive newlines output as $k+1$ newlines— // unless they're before or after a more-indented line, or at the very // beginning or end, in which case $k$ maps to $k$. // Therefore, parse each chunk as newline(s) followed by a content line. var lineRe = /(\n+)([^\n]*)/g; // first line (possibly an empty line) var result = (function () { var nextLF = string.indexOf('\n'); nextLF = nextLF !== -1 ? nextLF : string.length; lineRe.lastIndex = nextLF; return foldLine(string.slice(0, nextLF), width); }()); // If we haven't reached the first content line yet, don't add an extra \n. var prevMoreIndented = string[0] === '\n' || string[0] === ' '; var moreIndented; // rest of the lines var match; while ((match = lineRe.exec(string))) { var prefix = match[1], line = match[2]; moreIndented = (line[0] === ' '); result += prefix + (!prevMoreIndented && !moreIndented && line !== '' ? '\n' : '') + foldLine(line, width); prevMoreIndented = moreIndented; } return result; } // Greedy line breaking. // Picks the longest line under the limit each time, // otherwise settles for the shortest line over the limit. // NB. More-indented lines *cannot* be folded, as that would add an extra \n. function foldLine(line, width) { if (line === '' || line[0] === ' ') return line; // Since a more-indented line adds a \n, breaks can't be followed by a space. var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. var match; // start is an inclusive index. end, curr, and next are exclusive. var start = 0, end, curr = 0, next = 0; var result = ''; // Invariants: 0 <= start <= length-1. // 0 <= curr <= next <= max(0, length-2). curr - start <= width. // Inside the loop: // A match implies length >= 2, so curr and next are <= length-2. while ((match = breakRe.exec(line))) { next = match.index; // maintain invariant: curr - start <= width if (next - start > width) { end = (curr > start) ? curr : next; // derive end <= length-2 result += '\n' + line.slice(start, end); // skip the space that was output as \n start = end + 1; // derive start <= length-1 } curr = next; } // By the invariants, start <= length-1, so there is something left over. // It is either the whole string or a part starting from non-whitespace. result += '\n'; // Insert a break if the remainder is too long and there is a break available. if (line.length - start > width && curr > start) { result += line.slice(start, curr) + '\n' + line.slice(curr + 1); } else { result += line.slice(start); } return result.slice(1); // drop extra \n joiner } // Escapes a double-quoted string. function escapeString(string) { var result = ''; var char = 0; var escapeSeq; for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { char = codePointAt(string, i); escapeSeq = ESCAPE_SEQUENCES[char]; if (!escapeSeq && isPrintable(char)) { result += string[i]; if (char >= 0x10000) result += string[i + 1]; } else { result += escapeSeq || encodeHex(char); } } return result; } function writeFlowSequence(state, level, object) { var _result = '', _tag = state.tag, index, length, value; for (index = 0, length = object.length; index < length; index += 1) { value = object[index]; if (state.replacer) { value = state.replacer.call(object, String(index), value); } // Write only valid elements, put null instead of invalid elements. if (writeNode(state, level, value, false, false) || (typeof value === 'undefined' && writeNode(state, level, null, false, false))) { if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); _result += state.dump; } } state.tag = _tag; state.dump = '[' + _result + ']'; } function writeBlockSequence(state, level, object, compact) { var _result = '', _tag = state.tag, index, length, value; for (index = 0, length = object.length; index < length; index += 1) { value = object[index]; if (state.replacer) { value = state.replacer.call(object, String(index), value); } // Write only valid elements, put null instead of invalid elements. if (writeNode(state, level + 1, value, true, true, false, true) || (typeof value === 'undefined' && writeNode(state, level + 1, null, true, true, false, true))) { if (!compact || _result !== '') { _result += generateNextLine(state, level); } if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { _result += '-'; } else { _result += '- '; } _result += state.dump; } } state.tag = _tag; state.dump = _result || '[]'; // Empty sequence if no valid values. } function writeFlowMapping(state, level, object) { var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer; for (index = 0, length = objectKeyList.length; index < length; index += 1) { pairBuffer = ''; if (_result !== '') pairBuffer += ', '; if (state.condenseFlow) pairBuffer += '"'; objectKey = objectKeyList[index]; objectValue = object[objectKey]; if (state.replacer) { objectValue = state.replacer.call(object, objectKey, objectValue); } if (!writeNode(state, level, objectKey, false, false)) { continue; // Skip this pair because of invalid key; } if (state.dump.length > 1024) pairBuffer += '? '; pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); if (!writeNode(state, level, objectValue, false, false)) { continue; // Skip this pair because of invalid value. } pairBuffer += state.dump; // Both key and value are valid. _result += pairBuffer; } state.tag = _tag; state.dump = '{' + _result + '}'; } function writeBlockMapping(state, level, object, compact) { var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer; // Allow sorting keys so that the output file is deterministic if (state.sortKeys === true) { // Default sorting objectKeyList.sort(); } else if (typeof state.sortKeys === 'function') { // Custom sort function objectKeyList.sort(state.sortKeys); } else if (state.sortKeys) { // Something is wrong throw new YAMLException('sortKeys must be a boolean or a function'); } for (index = 0, length = objectKeyList.length; index < length; index += 1) { pairBuffer = ''; if (!compact || _result !== '') { pairBuffer += generateNextLine(state, level); } objectKey = objectKeyList[index]; objectValue = object[objectKey]; if (state.replacer) { objectValue = state.replacer.call(object, objectKey, objectValue); } if (!writeNode(state, level + 1, objectKey, true, true, true)) { continue; // Skip this pair because of invalid key. } explicitPair = (state.tag !== null && state.tag !== '?') || (state.dump && state.dump.length > 1024); if (explicitPair) { if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { pairBuffer += '?'; } else { pairBuffer += '? '; } } pairBuffer += state.dump; if (explicitPair) { pairBuffer += generateNextLine(state, level); } if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { continue; // Skip this pair because of invalid value. } if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { pairBuffer += ':'; } else { pairBuffer += ': '; } pairBuffer += state.dump; // Both key and value are valid. _result += pairBuffer; } state.tag = _tag; state.dump = _result || '{}'; // Empty mapping if no valid pairs. } function detectType(state, object, explicit) { var _result, typeList, index, length, type, style; typeList = explicit ? state.explicitTypes : state.implicitTypes; for (index = 0, length = typeList.length; index < length; index += 1) { type = typeList[index]; if ((type.instanceOf || type.predicate) && (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && (!type.predicate || type.predicate(object))) { if (explicit) { if (type.multi && type.representName) { state.tag = type.representName(object); } else { state.tag = type.tag; } } else { state.tag = '?'; } if (type.represent) { style = state.styleMap[type.tag] || type.defaultStyle; if (_toString.call(type.represent) === '[object Function]') { _result = type.represent(object, style); } else if (_hasOwnProperty.call(type.represent, style)) { _result = type.represent[style](object, style); } else { throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); } state.dump = _result; } return true; } } return false; } // Serializes `object` and writes it to global `result`. // Returns true on success, or false on invalid object. // function writeNode(state, level, object, block, compact, iskey, isblockseq) { state.tag = null; state.dump = object; if (!detectType(state, object, false)) { detectType(state, object, true); } var type = _toString.call(state.dump); var inblock = block; var tagStr; if (block) { block = (state.flowLevel < 0 || state.flowLevel > level); } var objectOrArray = type === '[object Object]' || type === '[object Array]', duplicateIndex, duplicate; if (objectOrArray) { duplicateIndex = state.duplicates.indexOf(object); duplicate = duplicateIndex !== -1; } if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { compact = false; } if (duplicate && state.usedDuplicates[duplicateIndex]) { state.dump = '*ref_' + duplicateIndex; } else { if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { state.usedDuplicates[duplicateIndex] = true; } if (type === '[object Object]') { if (block && (Object.keys(state.dump).length !== 0)) { writeBlockMapping(state, level, state.dump, compact); if (duplicate) { state.dump = '&ref_' + duplicateIndex + state.dump; } } else { writeFlowMapping(state, level, state.dump); if (duplicate) { state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; } } } else if (type === '[object Array]') { if (block && (state.dump.length !== 0)) { if (state.noArrayIndent && !isblockseq && level > 0) { writeBlockSequence(state, level - 1, state.dump, compact); } else { writeBlockSequence(state, level, state.dump, compact); } if (duplicate) { state.dump = '&ref_' + duplicateIndex + state.dump; } } else { writeFlowSequence(state, level, state.dump); if (duplicate) { state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; } } } else if (type === '[object String]') { if (state.tag !== '?') { writeScalar(state, state.dump, level, iskey, inblock); } } else if (type === '[object Undefined]') { return false; } else { if (state.skipInvalid) return false; throw new YAMLException('unacceptable kind of an object to dump ' + type); } if (state.tag !== null && state.tag !== '?') { // Need to encode all characters except those allowed by the spec: // // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ // [36] ns-hex-digit ::= ns-dec-digit // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” // // Also need to encode '!' because it has special meaning (end of tag prefix). // tagStr = encodeURI( state.tag[0] === '!' ? state.tag.slice(1) : state.tag ).replace(/!/g, '%21'); if (state.tag[0] === '!') { tagStr = '!' + tagStr; } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { tagStr = '!!' + tagStr.slice(18); } else { tagStr = '!<' + tagStr + '>'; } state.dump = tagStr + ' ' + state.dump; } } return true; } function getDuplicateReferences(object, state) { var objects = [], duplicatesIndexes = [], index, length; inspectNode(object, objects, duplicatesIndexes); for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { state.duplicates.push(objects[duplicatesIndexes[index]]); } state.usedDuplicates = new Array(length); } function inspectNode(object, objects, duplicatesIndexes) { var objectKeyList, index, length; if (object !== null && typeof object === 'object') { index = objects.indexOf(object); if (index !== -1) { if (duplicatesIndexes.indexOf(index) === -1) { duplicatesIndexes.push(index); } } else { objects.push(object); if (Array.isArray(object)) { for (index = 0, length = object.length; index < length; index += 1) { inspectNode(object[index], objects, duplicatesIndexes); } } else { objectKeyList = Object.keys(object); for (index = 0, length = objectKeyList.length; index < length; index += 1) { inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); } } } } } function dump(input, options) { options = options || {}; var state = new State(options); if (!state.noRefs) getDuplicateReferences(input, state); var value = input; if (state.replacer) { value = state.replacer.call({ '': value }, '', value); } if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; return ''; } module.exports.dump = dump; /***/ }), /***/ 425: /***/ ((module) => { "use strict"; // YAML error class. http://stackoverflow.com/questions/8458984 // function formatError(exception, compact) { var where = '', message = exception.reason || '(unknown reason)'; if (!exception.mark) return message; if (exception.mark.name) { where += 'in "' + exception.mark.name + '" '; } where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; if (!compact && exception.mark.snippet) { where += '\n\n' + exception.mark.snippet; } return message + ' ' + where; } function YAMLException(reason, mark) { // Super constructor Error.call(this); this.name = 'YAMLException'; this.reason = reason; this.mark = mark; this.message = formatError(this, false); // Include stack trace in error object if (Error.captureStackTrace) { // Chrome and NodeJS Error.captureStackTrace(this, this.constructor); } else { // FF, IE 10+ and Safari 6+. Fallback for others this.stack = (new Error()).stack || ''; } } // Inherit from Error YAMLException.prototype = Object.create(Error.prototype); YAMLException.prototype.constructor = YAMLException; YAMLException.prototype.toString = function toString(compact) { return this.name + ': ' + formatError(this, compact); }; module.exports = YAMLException; /***/ }), /***/ 990: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /*eslint-disable max-len,no-use-before-define*/ var common = __webpack_require__(347); var YAMLException = __webpack_require__(425); var makeSnippet = __webpack_require__(192); var DEFAULT_SCHEMA = __webpack_require__(601); var _hasOwnProperty = Object.prototype.hasOwnProperty; var CONTEXT_FLOW_IN = 1; var CONTEXT_FLOW_OUT = 2; var CONTEXT_BLOCK_IN = 3; var CONTEXT_BLOCK_OUT = 4; var CHOMPING_CLIP = 1; var CHOMPING_STRIP = 2; var CHOMPING_KEEP = 3; var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; function _class(obj) { return Object.prototype.toString.call(obj); } function is_EOL(c) { return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); } function is_WHITE_SPACE(c) { return (c === 0x09/* Tab */) || (c === 0x20/* Space */); } function is_WS_OR_EOL(c) { return (c === 0x09/* Tab */) || (c === 0x20/* Space */) || (c === 0x0A/* LF */) || (c === 0x0D/* CR */); } function is_FLOW_INDICATOR(c) { return c === 0x2C/* , */ || c === 0x5B/* [ */ || c === 0x5D/* ] */ || c === 0x7B/* { */ || c === 0x7D/* } */; } function fromHexCode(c) { var lc; if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { return c - 0x30; } /*eslint-disable no-bitwise*/ lc = c | 0x20; if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { return lc - 0x61 + 10; } return -1; } function escapedHexLen(c) { if (c === 0x78/* x */) { return 2; } if (c === 0x75/* u */) { return 4; } if (c === 0x55/* U */) { return 8; } return 0; } function fromDecimalCode(c) { if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { return c - 0x30; } return -1; } function simpleEscapeSequence(c) { /* eslint-disable indent */ return (c === 0x30/* 0 */) ? '\x00' : (c === 0x61/* a */) ? '\x07' : (c === 0x62/* b */) ? '\x08' : (c === 0x74/* t */) ? '\x09' : (c === 0x09/* Tab */) ? '\x09' : (c === 0x6E/* n */) ? '\x0A' : (c === 0x76/* v */) ? '\x0B' : (c === 0x66/* f */) ? '\x0C' : (c === 0x72/* r */) ? '\x0D' : (c === 0x65/* e */) ? '\x1B' : (c === 0x20/* Space */) ? ' ' : (c === 0x22/* " */) ? '\x22' : (c === 0x2F/* / */) ? '/' : (c === 0x5C/* \ */) ? '\x5C' : (c === 0x4E/* N */) ? '\x85' : (c === 0x5F/* _ */) ? '\xA0' : (c === 0x4C/* L */) ? '\u2028' : (c === 0x50/* P */) ? '\u2029' : ''; } function charFromCodepoint(c) { if (c <= 0xFFFF) { return String.fromCharCode(c); } // Encode UTF-16 surrogate pair // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF return String.fromCharCode( ((c - 0x010000) >> 10) + 0xD800, ((c - 0x010000) & 0x03FF) + 0xDC00 ); } var simpleEscapeCheck = new Array(256); // integer, for fast access var simpleEscapeMap = new Array(256); for (var i = 0; i < 256; i++) { simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; simpleEscapeMap[i] = simpleEscapeSequence(i); } function State(input, options) { this.input = input; this.filename = options['filename'] || null; this.schema = options['schema'] || DEFAULT_SCHEMA; this.onWarning = options['onWarning'] || null; // (Hidden) Remove? makes the loader to expect YAML 1.1 documents // if such documents have no explicit %YAML directive this.legacy = options['legacy'] || false; this.json = options['json'] || false; this.listener = options['listener'] || null; this.implicitTypes = this.schema.compiledImplicit; this.typeMap = this.schema.compiledTypeMap; this.length = input.length; this.position = 0; this.line = 0; this.lineStart = 0; this.lineIndent = 0; // position of first leading tab in the current line, // used to make sure there are no tabs in the indentation this.firstTabInLine = -1; this.documents = []; /* this.version; this.checkLineBreaks; this.tagMap; this.anchorMap; this.tag; this.anchor; this.kind; this.result;*/ } function generateError(state, message) { var mark = { name: state.filename, buffer: state.input.slice(0, -1), // omit trailing \0 position: state.position, line: state.line, column: state.position - state.lineStart }; mark.snippet = makeSnippet(mark); return new YAMLException(message, mark); } function throwError(state, message) { throw generateError(state, message); } function throwWarning(state, message) { if (state.onWarning) { state.onWarning.call(null, generateError(state, message)); } } var directiveHandlers = { YAML: function handleYamlDirective(state, name, args) { var match, major, minor; if (state.version !== null) { throwError(state, 'duplication of %YAML directive'); } if (args.length !== 1) { throwError(state, 'YAML directive accepts exactly one argument'); } match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); if (match === null) { throwError(state, 'ill-formed argument of the YAML directive'); } major = parseInt(match[1], 10); minor = parseInt(match[2], 10); if (major !== 1) { throwError(state, 'unacceptable YAML version of the document'); } state.version = args[0]; state.checkLineBreaks = (minor < 2); if (minor !== 1 && minor !== 2) { throwWarning(state, 'unsupported YAML version of the document'); } }, TAG: function handleTagDirective(state, name, args) { var handle, prefix; if (args.length !== 2) { throwError(state, 'TAG directive accepts exactly two arguments'); } handle = args[0]; prefix = args[1]; if (!PATTERN_TAG_HANDLE.test(handle)) { throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); } if (_hasOwnProperty.call(state.tagMap, handle)) { throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); } if (!PATTERN_TAG_URI.test(prefix)) { throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); } try { prefix = decodeURIComponent(prefix); } catch (err) { throwError(state, 'tag prefix is malformed: ' + prefix); } state.tagMap[handle] = prefix; } }; function captureSegment(state, start, end, checkJson) { var _position, _length, _character, _result; if (start < end) { _result = state.input.slice(start, end); if (checkJson) { for (_position = 0, _length = _result.length; _position < _length; _position += 1) { _character = _result.charCodeAt(_position); if (!(_character === 0x09 || (0x20 <= _character && _character <= 0x10FFFF))) { throwError(state, 'expected valid JSON character'); } } } else if (PATTERN_NON_PRINTABLE.test(_result)) { throwError(state, 'the stream contains non-printable characters'); } state.result += _result; } } function mergeMappings(state, destination, source, overridableKeys) { var sourceKeys, key, index, quantity; if (!common.isObject(source)) { throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); } sourceKeys = Object.keys(source); for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { key = sourceKeys[index]; if (!_hasOwnProperty.call(destination, key)) { destination[key] = source[key]; overridableKeys[key] = true; } } } function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) { var index, quantity; // The output is a plain object here, so keys can only be strings. // We need to convert keyNode to a string, but doing so can hang the process // (deeply nested arrays that explode exponentially using aliases). if (Array.isArray(keyNode)) { keyNode = Array.prototype.slice.call(keyNode); for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { if (Array.isArray(keyNode[index])) { throwError(state, 'nested arrays are not supported inside keys'); } if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { keyNode[index] = '[object Object]'; } } } // Avoid code execution in load() via toString property // (still use its own toString for arrays, timestamps, // and whatever user schema extensions happen to have @@toStringTag) if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { keyNode = '[object Object]'; } keyNode = String(keyNode); if (_result === null) { _result = {}; } if (keyTag === 'tag:yaml.org,2002:merge') { if (Array.isArray(valueNode)) { for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { mergeMappings(state, _result, valueNode[index], overridableKeys); } } else { mergeMappings(state, _result, valueNode, overridableKeys); } } else { if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) { state.line = startLine || state.line; state.lineStart = startLineStart || state.lineStart; state.position = startPos || state.position; throwError(state, 'duplicated mapping key'); } // used for this specific key only because Object.defineProperty is slow if (keyNode === '__proto__') { Object.defineProperty(_result, keyNode, { configurable: true, enumerable: true, writable: true, value: valueNode }); } else { _result[keyNode] = valueNode; } delete overridableKeys[keyNode]; } return _result; } function readLineBreak(state) { var ch; ch = state.input.charCodeAt(state.position); if (ch === 0x0A/* LF */) { state.position++; } else if (ch === 0x0D/* CR */) { state.position++; if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { state.position++; } } else { throwError(state, 'a line break is expected'); } state.line += 1; state.lineStart = state.position; state.firstTabInLine = -1; } function skipSeparationSpace(state, allowComments, checkIndent) { var lineBreaks = 0, ch = state.input.charCodeAt(state.position); while (ch !== 0) { while (is_WHITE_SPACE(ch)) { if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { state.firstTabInLine = state.position; } ch = state.input.charCodeAt(++state.position); } if (allowComments && ch === 0x23/* # */) { do { ch = state.input.charCodeAt(++state.position); } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); } if (is_EOL(ch)) { readLineBreak(state); ch = state.input.charCodeAt(state.position); lineBreaks++; state.lineIndent = 0; while (ch === 0x20/* Space */) { state.lineIndent++; ch = state.input.charCodeAt(++state.position); } } else { break; } } if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { throwWarning(state, 'deficient indentation'); } return lineBreaks; } function testDocumentSeparator(state) { var _position = state.position, ch; ch = state.input.charCodeAt(_position); // Condition state.position === state.lineStart is tested // in parent on each call, for efficiency. No needs to test here again. if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) { _position += 3; ch = state.input.charCodeAt(_position); if (ch === 0 || is_WS_OR_EOL(ch)) { return true; } } return false; } function writeFoldedLines(state, count) { if (count === 1) { state.result += ' '; } else if (count > 1) { state.result += common.repeat('\n', count - 1); } } function readPlainScalar(state, nodeIndent, withinFlowCollection) { var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch; ch = state.input.charCodeAt(state.position); if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 0x23/* # */ || ch === 0x26/* & */ || ch === 0x2A/* * */ || ch === 0x21/* ! */ || ch === 0x7C/* | */ || ch === 0x3E/* > */ || ch === 0x27/* ' */ || ch === 0x22/* " */ || ch === 0x25/* % */ || ch === 0x40/* @ */ || ch === 0x60/* ` */) { return false; } if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { following = state.input.charCodeAt(state.position + 1); if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { return false; } } state.kind = 'scalar'; state.result = ''; captureStart = captureEnd = state.position; hasPendingContent = false; while (ch !== 0) { if (ch === 0x3A/* : */) { following = state.input.charCodeAt(state.position + 1); if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { break; } } else if (ch === 0x23/* # */) { preceding = state.input.charCodeAt(state.position - 1); if (is_WS_OR_EOL(preceding)) { break; } } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || withinFlowCollection && is_FLOW_INDICATOR(ch)) { break; } else if (is_EOL(ch)) { _line = state.line; _lineStart = state.lineStart; _lineIndent = state.lineIndent; skipSeparationSpace(state, false, -1); if (state.lineIndent >= nodeIndent) { hasPendingContent = true; ch = state.input.charCodeAt(state.position); continue; } else { state.position = captureEnd; state.line = _line; state.lineStart = _lineStart; state.lineIndent = _lineIndent; break; } } if (hasPendingContent) { captureSegment(state, captureStart, captureEnd, false); writeFoldedLines(state, state.line - _line); captureStart = captureEnd = state.position; hasPendingContent = false; } if (!is_WHITE_SPACE(ch)) { captureEnd = state.position + 1; } ch = state.input.charCodeAt(++state.position); } captureSegment(state, captureStart, captureEnd, false); if (state.result) { return true; } state.kind = _kind; state.result = _result; return false; } function readSingleQuotedScalar(state, nodeIndent) { var ch, captureStart, captureEnd; ch = state.input.charCodeAt(state.position); if (ch !== 0x27/* ' */) { return false; } state.kind = 'scalar'; state.result = ''; state.position++; captureStart = captureEnd = state.position; while ((ch = state.input.charCodeAt(state.position)) !== 0) { if (ch === 0x27/* ' */) { captureSegment(state, captureStart, state.position, true); ch = state.input.charCodeAt(++state.position); if (ch === 0x27/* ' */) { captureStart = state.position; state.position++; captureEnd = state.position; } else { return true; } } else if (is_EOL(ch)) { captureSegment(state, captureStart, captureEnd, true); writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); captureStart = captureEnd = state.position; } else if (state.position === state.lineStart && testDocumentSeparator(state)) { throwError(state, 'unexpected end of the document within a single quoted scalar'); } else { state.position++; captureEnd = state.position; } } throwError(state, 'unexpected end of the stream within a single quoted scalar'); } function readDoubleQuotedScalar(state, nodeIndent) { var captureStart, captureEnd, hexLength, hexResult, tmp, ch; ch = state.input.charCodeAt(state.position); if (ch !== 0x22/* " */) { return false; } state.kind = 'scalar'; state.result = ''; state.position++; captureStart = captureEnd = state.position; while ((ch = state.input.charCodeAt(state.position)) !== 0) { if (ch === 0x22/* " */) { captureSegment(state, captureStart, state.position, true); state.position++; return true; } else if (ch === 0x5C/* \ */) { captureSegment(state, captureStart, state.position, true); ch = state.input.charCodeAt(++state.position); if (is_EOL(ch)) { skipSeparationSpace(state, false, nodeIndent); // TODO: rework to inline fn with no type cast? } else if (ch < 256 && simpleEscapeCheck[ch]) { state.result += simpleEscapeMap[ch]; state.position++; } else if ((tmp = escapedHexLen(ch)) > 0) { hexLength = tmp; hexResult = 0; for (; hexLength > 0; hexLength--) { ch = state.input.charCodeAt(++state.position); if ((tmp = fromHexCode(ch)) >= 0) { hexResult = (hexResult << 4) + tmp; } else { throwError(state, 'expected hexadecimal character'); } } state.result += charFromCodepoint(hexResult); state.position++; } else { throwError(state, 'unknown escape sequence'); } captureStart = captureEnd = state.position; } else if (is_EOL(ch)) { captureSegment(state, captureStart, captureEnd, true); writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); captureStart = captureEnd = state.position; } else if (state.position === state.lineStart && testDocumentSeparator(state)) { throwError(state, 'unexpected end of the document within a double quoted scalar'); } else { state.position++; captureEnd = state.position; } } throwError(state, 'unexpected end of the stream within a double quoted scalar'); } function readFlowCollection(state, nodeIndent) { var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch; ch = state.input.charCodeAt(state.position); if (ch === 0x5B/* [ */) { terminator = 0x5D;/* ] */ isMapping = false; _result = []; } else if (ch === 0x7B/* { */) { terminator = 0x7D;/* } */ isMapping = true; _result = {}; } else { return false; } if (state.anchor !== null) { state.anchorMap[state.anchor] = _result; } ch = state.input.charCodeAt(++state.position); while (ch !== 0) { skipSeparationSpace(state, true, nodeIndent); ch = state.input.charCodeAt(state.position); if (ch === terminator) { state.position++; state.tag = _tag; state.anchor = _anchor; state.kind = isMapping ? 'mapping' : 'sequence'; state.result = _result; return true; } else if (!readNext) { throwError(state, 'missed comma between flow collection entries'); } else if (ch === 0x2C/* , */) { // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 throwError(state, "expected the node content, but found ','"); } keyTag = keyNode = valueNode = null; isPair = isExplicitPair = false; if (ch === 0x3F/* ? */) { following = state.input.charCodeAt(state.position + 1); if (is_WS_OR_EOL(following)) { isPair = isExplicitPair = true; state.position++; skipSeparationSpace(state, true, nodeIndent); } } _line = state.line; // Save the current line. _lineStart = state.lineStart; _pos = state.position; composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); keyTag = state.tag; keyNode = state.result; skipSeparationSpace(state, true, nodeIndent); ch = state.input.charCodeAt(state.position); if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { isPair = true; ch = state.input.charCodeAt(++state.position); skipSeparationSpace(state, true, nodeIndent); composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); valueNode = state.result; } if (isMapping) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); } else if (isPair) { _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); } else { _result.push(keyNode); } skipSeparationSpace(state, true, nodeIndent); ch = state.input.charCodeAt(state.position); if (ch === 0x2C/* , */) { readNext = true; ch = state.input.charCodeAt(++state.position); } else { readNext = false; } } throwError(state, 'unexpected end of the stream within a flow collection'); } function readBlockScalar(state, nodeIndent) { var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch; ch = state.input.charCodeAt(state.position); if (ch === 0x7C/* | */) { folding = false; } else if (ch === 0x3E/* > */) { folding = true; } else { return false; } state.kind = 'scalar'; state.result = ''; while (ch !== 0) { ch = state.input.charCodeAt(++state.position); if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { if (CHOMPING_CLIP === chomping) { chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; } else { throwError(state, 'repeat of a chomping mode identifier'); } } else if ((tmp = fromDecimalCode(ch)) >= 0) { if (tmp === 0) { throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); } else if (!detectedIndent) { textIndent = nodeIndent + tmp - 1; detectedIndent = true; } else { throwError(state, 'repeat of an indentation width identifier'); } } else { break; } } if (is_WHITE_SPACE(ch)) { do { ch = state.input.charCodeAt(++state.position); } while (is_WHITE_SPACE(ch)); if (ch === 0x23/* # */) { do { ch = state.input.charCodeAt(++state.position); } while (!is_EOL(ch) && (ch !== 0)); } } while (ch !== 0) { readLineBreak(state); state.lineIndent = 0; ch = state.input.charCodeAt(state.position); while ((!detectedIndent || state.lineIndent < textIndent) && (ch === 0x20/* Space */)) { state.lineIndent++; ch = state.input.charCodeAt(++state.position); } if (!detectedIndent && state.lineIndent > textIndent) { textIndent = state.lineIndent; } if (is_EOL(ch)) { emptyLines++; continue; } // End of the scalar. if (state.lineIndent < textIndent) { // Perform the chomping. if (chomping === CHOMPING_KEEP) { state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); } else if (chomping === CHOMPING_CLIP) { if (didReadContent) { // i.e. only if the scalar is not empty. state.result += '\n'; } } // Break this `while` cycle and go to the funciton's epilogue. break; } // Folded style: use fancy rules to handle line breaks. if (folding) { // Lines starting with white space characters (more-indented lines) are not folded. if (is_WHITE_SPACE(ch)) { atMoreIndented = true; // except for the first content line (cf. Example 8.1) state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); // End of more-indented block. } else if (atMoreIndented) { atMoreIndented = false; state.result += common.repeat('\n', emptyLines + 1); // Just one line break - perceive as the same line. } else if (emptyLines === 0) { if (didReadContent) { // i.e. only if we have already read some scalar content. state.result += ' '; } // Several line breaks - perceive as different lines. } else { state.result += common.repeat('\n', emptyLines); } // Literal style: just add exact number of line breaks between content lines. } else { // Keep all line breaks except the header line break. state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); } didReadContent = true; detectedIndent = true; emptyLines = 0; captureStart = state.position; while (!is_EOL(ch) && (ch !== 0)) { ch = state.input.charCodeAt(++state.position); } captureSegment(state, captureStart, state.position, false); } return true; } function readBlockSequence(state, nodeIndent) { var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch; // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar if (state.firstTabInLine !== -1) return false; if (state.anchor !== null) { state.anchorMap[state.anchor] = _result; } ch = state.input.charCodeAt(state.position); while (ch !== 0) { if (state.firstTabInLine !== -1) { state.position = state.firstTabInLine; throwError(state, 'tab characters must not be used in indentation'); } if (ch !== 0x2D/* - */) { break; } following = state.input.charCodeAt(state.position + 1); if (!is_WS_OR_EOL(following)) { break; } detected = true; state.position++; if (skipSeparationSpace(state, true, -1)) { if (state.lineIndent <= nodeIndent) { _result.push(null); ch = state.input.charCodeAt(state.position); continue; } } _line = state.line; composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); _result.push(state.result); skipSeparationSpace(state, true, -1); ch = state.input.charCodeAt(state.position); if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { throwError(state, 'bad indentation of a sequence entry'); } else if (state.lineIndent < nodeIndent) { break; } } if (detected) { state.tag = _tag; state.anchor = _anchor; state.kind = 'sequence'; state.result = _result; return true; } return false; } function readBlockMapping(state, nodeIndent, flowIndent) { var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch; // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar if (state.firstTabInLine !== -1) return false; if (state.anchor !== null) { state.anchorMap[state.anchor] = _result; } ch = state.input.charCodeAt(state.position); while (ch !== 0) { if (!atExplicitKey && state.firstTabInLine !== -1) { state.position = state.firstTabInLine; throwError(state, 'tab characters must not be used in indentation'); } following = state.input.charCodeAt(state.position + 1); _line = state.line; // Save the current line. // // Explicit notation case. There are two separate blocks: // first for the key (denoted by "?") and second for the value (denoted by ":") // if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { if (ch === 0x3F/* ? */) { if (atExplicitKey) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); keyTag = keyNode = valueNode = null; } detected = true; atExplicitKey = true; allowCompact = true; } else if (atExplicitKey) { // i.e. 0x3A/* : */ === character after the explicit key. atExplicitKey = false; allowCompact = true; } else { throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); } state.position += 1; ch = following; // // Implicit notation case. Flow-style node as the key first, then ":", and the value. // } else { _keyLine = state.line; _keyLineStart = state.lineStart; _keyPos = state.position; if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { // Neither implicit nor explicit notation. // Reading is done. Go to the epilogue. break; } if (state.line === _line) { ch = state.input.charCodeAt(state.position); while (is_WHITE_SPACE(ch)) { ch = state.input.charCodeAt(++state.position); } if (ch === 0x3A/* : */) { ch = state.input.charCodeAt(++state.position); if (!is_WS_OR_EOL(ch)) { throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); } if (atExplicitKey) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); keyTag = keyNode = valueNode = null; } detected = true; atExplicitKey = false; allowCompact = false; keyTag = state.tag; keyNode = state.result; } else if (detected) { throwError(state, 'can not read an implicit mapping pair; a colon is missed'); } else { state.tag = _tag; state.anchor = _anchor; return true; // Keep the result of `composeNode`. } } else if (detected) { throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); } else { state.tag = _tag; state.anchor = _anchor; return true; // Keep the result of `composeNode`. } } // // Common reading code for both explicit and implicit notations. // if (state.line === _line || state.lineIndent > nodeIndent) { if (atExplicitKey) { _keyLine = state.line; _keyLineStart = state.lineStart; _keyPos = state.position; } if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { if (atExplicitKey) { keyNode = state.result; } else { valueNode = state.result; } } if (!atExplicitKey) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); keyTag = keyNode = valueNode = null; } skipSeparationSpace(state, true, -1); ch = state.input.charCodeAt(state.position); } if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { throwError(state, 'bad indentation of a mapping entry'); } else if (state.lineIndent < nodeIndent) { break; } } // // Epilogue. // // Special case: last mapping's node contains only the key in explicit notation. if (atExplicitKey) { storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); } // Expose the resulting mapping. if (detected) { state.tag = _tag; state.anchor = _anchor; state.kind = 'mapping'; state.result = _result; } return detected; } function readTagProperty(state) { var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch; ch = state.input.charCodeAt(state.position); if (ch !== 0x21/* ! */) return false; if (state.tag !== null) { throwError(state, 'duplication of a tag property'); } ch = state.input.charCodeAt(++state.position); if (ch === 0x3C/* < */) { isVerbatim = true; ch = state.input.charCodeAt(++state.position); } else if (ch === 0x21/* ! */) { isNamed = true; tagHandle = '!!'; ch = state.input.charCodeAt(++state.position); } else { tagHandle = '!'; } _position = state.position; if (isVerbatim) { do { ch = state.input.charCodeAt(++state.position); } while (ch !== 0 && ch !== 0x3E/* > */); if (state.position < state.length) { tagName = state.input.slice(_position, state.position); ch = state.input.charCodeAt(++state.position); } else { throwError(state, 'unexpected end of the stream within a verbatim tag'); } } else { while (ch !== 0 && !is_WS_OR_EOL(ch)) { if (ch === 0x21/* ! */) { if (!isNamed) { tagHandle = state.input.slice(_position - 1, state.position + 1); if (!PATTERN_TAG_HANDLE.test(tagHandle)) { throwError(state, 'named tag handle cannot contain such characters'); } isNamed = true; _position = state.position + 1; } else { throwError(state, 'tag suffix cannot contain exclamation marks'); } } ch = state.input.charCodeAt(++state.position); } tagName = state.input.slice(_position, state.position); if (PATTERN_FLOW_INDICATORS.test(tagName)) { throwError(state, 'tag suffix cannot contain flow indicator characters'); } } if (tagName && !PATTERN_TAG_URI.test(tagName)) { throwError(state, 'tag name cannot contain such characters: ' + tagName); } try { tagName = decodeURIComponent(tagName); } catch (err) { throwError(state, 'tag name is malformed: ' + tagName); } if (isVerbatim) { state.tag = tagName; } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { state.tag = state.tagMap[tagHandle] + tagName; } else if (tagHandle === '!') { state.tag = '!' + tagName; } else if (tagHandle === '!!') { state.tag = 'tag:yaml.org,2002:' + tagName; } else { throwError(state, 'undeclared tag handle "' + tagHandle + '"'); } return true; } function readAnchorProperty(state) { var _position, ch; ch = state.input.charCodeAt(state.position); if (ch !== 0x26/* & */) return false; if (state.anchor !== null) { throwError(state, 'duplication of an anchor property'); } ch = state.input.charCodeAt(++state.position); _position = state.position; while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state.input.charCodeAt(++state.position); } if (state.position === _position) { throwError(state, 'name of an anchor node must contain at least one character'); } state.anchor = state.input.slice(_position, state.position); return true; } function readAlias(state) { var _position, alias, ch; ch = state.input.charCodeAt(state.position); if (ch !== 0x2A/* * */) return false; ch = state.input.charCodeAt(++state.position); _position = state.position; while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state.input.charCodeAt(++state.position); } if (state.position === _position) { throwError(state, 'name of an alias node must contain at least one character'); } alias = state.input.slice(_position, state.position); if (!_hasOwnProperty.call(state.anchorMap, alias)) { throwError(state, 'unidentified alias "' + alias + '"'); } state.result = state.anchorMap[alias]; skipSeparationSpace(state, true, -1); return true; } function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { indentStatus = 1; } else if (state.lineIndent === parentIndent) { indentStatus = 0; } else if (state.lineIndent < parentIndent) { indentStatus = -1; } } } if (indentStatus === 1) { while (readTagProperty(state) || readAnchorProperty(state)) { if (skipSeparationSpace(state, true, -1)) { atNewLine = true; allowBlockCollections = allowBlockStyles; if (state.lineIndent > parentIndent) { indentStatus = 1; } else if (state.lineIndent === parentIndent) { indentStatus = 0; } else if (state.lineIndent < parentIndent) { indentStatus = -1; } } else { allowBlockCollections = false; } } } if (allowBlockCollections) { allowBlockCollections = atNewLine || allowCompact; } if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { flowIndent = parentIndent; } else { flowIndent = parentIndent + 1; } blockIndent = state.position - state.lineStart; if (indentStatus === 1) { if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) { hasContent = true; } else { if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) { hasContent = true; } else if (readAlias(state)) { hasContent = true; if (state.tag !== null || state.anchor !== null) { throwError(state, 'alias node should not have any properties'); } } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { hasContent = true; if (state.tag === null) { state.tag = '?'; } } if (state.anchor !== null) { state.anchorMap[state.anchor] = state.result; } } } else if (indentStatus === 0) { // Special case: block sequences are allowed to have same indentation level as the parent. // http://www.yaml.org/spec/1.2/spec.html#id2799784 hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); } } if (state.tag === null) { if (state.anchor !== null) { state.anchorMap[state.anchor] = state.result; } } else if (state.tag === '?') { // Implicit resolving is not allowed for non-scalar types, and '?' // non-specific tag is only automatically assigned to plain scalars. // // We only need to check kind conformity in case user explicitly assigns '?' // tag, for example like this: "! [0]" // if (state.result !== null && state.kind !== 'scalar') { throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); } for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { type = state.implicitTypes[typeIndex]; if (type.resolve(state.result)) { // `state.result` updated in resolver if matched state.result = type.construct(state.result); state.tag = type.tag; if (state.anchor !== null) { state.anchorMap[state.anchor] = state.result; } break; } } } else if (state.tag !== '!') { if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { type = state.typeMap[state.kind || 'fallback'][state.tag]; } else { // looking for multi type type = null; typeList = state.typeMap.multi[state.kind || 'fallback']; for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { type = typeList[typeIndex]; break; } } } if (!type) { throwError(state, 'unknown tag !<' + state.tag + '>'); } if (state.result !== null && type.kind !== state.kind) { throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); } if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); } else { state.result = type.construct(state.result, state.tag); if (state.anchor !== null) { state.anchorMap[state.anchor] = state.result; } } } if (state.listener !== null) { state.listener('close', state); } return state.tag !== null || state.anchor !== null || hasContent; } function readDocument(state) { var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch; state.version = null; state.checkLineBreaks = state.legacy; state.tagMap = Object.create(null); state.anchorMap = Object.create(null); while ((ch = state.input.charCodeAt(state.position)) !== 0) { skipSeparationSpace(state, true, -1); ch = state.input.charCodeAt(state.position); if (state.lineIndent > 0 || ch !== 0x25/* % */) { break; } hasDirectives = true; ch = state.input.charCodeAt(++state.position); _position = state.position; while (ch !== 0 && !is_WS_OR_EOL(ch)) { ch = state.input.charCodeAt(++state.position); } directiveName = state.input.slice(_position, state.position); directiveArgs = []; if (directiveName.length < 1) { throwError(state, 'directive name must not be less than one character in length'); } while (ch !== 0) { while (is_WHITE_SPACE(ch)) { ch = state.input.charCodeAt(++state.position); } if (ch === 0x23/* # */) { do { ch = state.input.charCodeAt(++state.position); } while (ch !== 0 && !is_EOL(ch)); break; } if (is_EOL(ch)) break; _position = state.position; while (ch !== 0 && !is_WS_OR_EOL(ch)) { ch = state.input.charCodeAt(++state.position); } directiveArgs.push(state.input.slice(_position, state.position)); } if (ch !== 0) readLineBreak(state); if (_hasOwnProperty.call(directiveHandlers, directiveName)) { directiveHandlers[directiveName](state, directiveName, directiveArgs); } else { throwWarning(state, 'unknown document directive "' + directiveName + '"'); } } skipSeparationSpace(state, true, -1); if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 0x2D/* - */ && state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { state.position += 3; skipSeparationSpace(state, true, -1); } else if (hasDirectives) { throwError(state, 'directives end mark is expected'); } composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); skipSeparationSpace(state, true, -1); if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { throwWarning(state, 'non-ASCII line breaks are interpreted as content'); } state.documents.push(state.result); if (state.position === state.lineStart && testDocumentSeparator(state)) { if (state.input.charCodeAt(state.position) === 0x2E/* . */) { state.position += 3; skipSeparationSpace(state, true, -1); } return; } if (state.position < (state.length - 1)) { throwError(state, 'end of the stream or a document separator is expected'); } else { return; } } function loadDocuments(input, options) { input = String(input); options = options || {}; if (input.length !== 0) { // Add tailing `\n` if not exists if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { input += '\n'; } // Strip BOM if (input.charCodeAt(0) === 0xFEFF) { input = input.slice(1); } } var state = new State(input, options); var nullpos = input.indexOf('\0'); if (nullpos !== -1) { state.position = nullpos; throwError(state, 'null byte is not allowed in input'); } // Use 0 as string terminator. That significantly simplifies bounds check. state.input += '\0'; while (state.input.charCodeAt(state.position) === 0x20/* Space */) { state.lineIndent += 1; state.position += 1; } while (state.position < (state.length - 1)) { readDocument(state); } return state.documents; } function loadAll(input, iterator, options) { if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { options = iterator; iterator = null; } var documents = loadDocuments(input, options); if (typeof iterator !== 'function') { return documents; } for (var index = 0, length = documents.length; index < length; index += 1) { iterator(documents[index]); } } function load(input, options) { var documents = loadDocuments(input, options); if (documents.length === 0) { /*eslint-disable no-undefined*/ return undefined; } else if (documents.length === 1) { return documents[0]; } throw new YAMLException('expected a single document in the stream, but found more'); } module.exports.loadAll = loadAll; module.exports.load = load; /***/ }), /***/ 657: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /*eslint-disable max-len*/ var YAMLException = __webpack_require__(425); var Type = __webpack_require__(364); function compileList(schema, name) { var result = []; schema[name].forEach(function (currentType) { var newIndex = result.length; result.forEach(function (previousType, previousIndex) { if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) { newIndex = previousIndex; } }); result[newIndex] = currentType; }); return result; } function compileMap(/* lists... */) { var result = { scalar: {}, sequence: {}, mapping: {}, fallback: {}, multi: { scalar: [], sequence: [], mapping: [], fallback: [] } }, index, length; function collectType(type) { if (type.multi) { result.multi[type.kind].push(type); result.multi['fallback'].push(type); } else { result[type.kind][type.tag] = result['fallback'][type.tag] = type; } } for (index = 0, length = arguments.length; index < length; index += 1) { arguments[index].forEach(collectType); } return result; } function Schema(definition) { return this.extend(definition); } Schema.prototype.extend = function extend(definition) { var implicit = []; var explicit = []; if (definition instanceof Type) { // Schema.extend(type) explicit.push(definition); } else if (Array.isArray(definition)) { // Schema.extend([ type1, type2, ... ]) explicit = explicit.concat(definition); } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) if (definition.implicit) implicit = implicit.concat(definition.implicit); if (definition.explicit) explicit = explicit.concat(definition.explicit); } else { throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' + 'or a schema definition ({ implicit: [...], explicit: [...] })'); } implicit.forEach(function (type) { if (!(type instanceof Type)) { throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); } if (type.loadKind && type.loadKind !== 'scalar') { throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); } if (type.multi) { throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); } }); explicit.forEach(function (type) { if (!(type instanceof Type)) { throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); } }); var result = Object.create(Schema.prototype); result.implicit = (this.implicit || []).concat(implicit); result.explicit = (this.explicit || []).concat(explicit); result.compiledImplicit = compileList(result, 'implicit'); result.compiledExplicit = compileList(result, 'explicit'); result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); return result; }; module.exports = Schema; /***/ }), /***/ 471: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // Standard YAML's Core schema. // http://www.yaml.org/spec/1.2/spec.html#id2804923 // // NOTE: JS-YAML does not support schema-specific tag resolution restrictions. // So, Core schema has no distinctions from JSON schema is JS-YAML. module.exports = __webpack_require__(966); /***/ }), /***/ 601: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // JS-YAML's default schema for `safeLoad` function. // It is not described in the YAML specification. // // This schema is based on standard YAML's Core schema and includes most of // extra types described at YAML tag repository. (http://yaml.org/type/) module.exports = (__webpack_require__(471).extend)({ implicit: [ __webpack_require__(156), __webpack_require__(452) ], explicit: [ __webpack_require__(531), __webpack_require__(605), __webpack_require__(879), __webpack_require__(982) ] }); /***/ }), /***/ 795: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // Standard YAML's Failsafe schema. // http://www.yaml.org/spec/1.2/spec.html#id2802346 var Schema = __webpack_require__(657); module.exports = new Schema({ explicit: [ __webpack_require__(48), __webpack_require__(451), __webpack_require__(945) ] }); /***/ }), /***/ 966: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // Standard YAML's JSON schema. // http://www.yaml.org/spec/1.2/spec.html#id2803231 // // NOTE: JS-YAML does not support schema-specific tag resolution restrictions. // So, this schema is not such strict as defined in the YAML specification. // It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. module.exports = (__webpack_require__(795).extend)({ implicit: [ __webpack_require__(151), __webpack_require__(771), __webpack_require__(518), __webpack_require__(215) ] }); /***/ }), /***/ 192: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var common = __webpack_require__(347); // get snippet for a single line, respecting maxLength function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { var head = ''; var tail = ''; var maxHalfLength = Math.floor(maxLineLength / 2) - 1; if (position - lineStart > maxHalfLength) { head = ' ... '; lineStart = position - maxHalfLength + head.length; } if (lineEnd - position > maxHalfLength) { tail = ' ...'; lineEnd = position + maxHalfLength - tail.length; } return { str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, pos: position - lineStart + head.length // relative position }; } function padStart(string, max) { return common.repeat(' ', max - string.length) + string; } function makeSnippet(mark, options) { options = Object.create(options || null); if (!mark.buffer) return null; if (!options.maxLength) options.maxLength = 79; if (typeof options.indent !== 'number') options.indent = 1; if (typeof options.linesBefore !== 'number') options.linesBefore = 3; if (typeof options.linesAfter !== 'number') options.linesAfter = 2; var re = /\r?\n|\r|\0/g; var lineStarts = [ 0 ]; var lineEnds = []; var match; var foundLineNo = -1; while ((match = re.exec(mark.buffer))) { lineEnds.push(match.index); lineStarts.push(match.index + match[0].length); if (mark.position <= match.index && foundLineNo < 0) { foundLineNo = lineStarts.length - 2; } } if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; var result = '', i, line; var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); for (i = 1; i <= options.linesBefore; i++) { if (foundLineNo - i < 0) break; line = getLine( mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength ); result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + ' | ' + line.str + '\n' + result; } line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + ' | ' + line.str + '\n'; result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; for (i = 1; i <= options.linesAfter; i++) { if (foundLineNo + i >= lineEnds.length) break; line = getLine( mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength ); result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + ' | ' + line.str + '\n'; } return result.replace(/\n$/, ''); } module.exports = makeSnippet; /***/ }), /***/ 364: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var YAMLException = __webpack_require__(425); var TYPE_CONSTRUCTOR_OPTIONS = [ 'kind', 'multi', 'resolve', 'construct', 'instanceOf', 'predicate', 'represent', 'representName', 'defaultStyle', 'styleAliases' ]; var YAML_NODE_KINDS = [ 'scalar', 'sequence', 'mapping' ]; function compileStyleAliases(map) { var result = {}; if (map !== null) { Object.keys(map).forEach(function (style) { map[style].forEach(function (alias) { result[String(alias)] = style; }); }); } return result; } function Type(tag, options) { options = options || {}; Object.keys(options).forEach(function (name) { if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); } }); // TODO: Add tag format check. this.options = options; // keep original options in case user wants to extend this type later this.tag = tag; this.kind = options['kind'] || null; this.resolve = options['resolve'] || function () { return true; }; this.construct = options['construct'] || function (data) { return data; }; this.instanceOf = options['instanceOf'] || null; this.predicate = options['predicate'] || null; this.represent = options['represent'] || null; this.representName = options['representName'] || null; this.defaultStyle = options['defaultStyle'] || null; this.multi = options['multi'] || false; this.styleAliases = compileStyleAliases(options['styleAliases'] || null); if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); } } module.exports = Type; /***/ }), /***/ 531: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /*eslint-disable no-bitwise*/ var Type = __webpack_require__(364); // [ 64, 65, 66 ] -> [ padding, CR, LF ] var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; function resolveYamlBinary(data) { if (data === null) return false; var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; // Convert one by one. for (idx = 0; idx < max; idx++) { code = map.indexOf(data.charAt(idx)); // Skip CR/LF if (code > 64) continue; // Fail on illegal characters if (code < 0) return false; bitlen += 6; } // If there are any bits left, source was corrupted return (bitlen % 8) === 0; } function constructYamlBinary(data) { var idx, tailbits, input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan max = input.length, map = BASE64_MAP, bits = 0, result = []; // Collect by 6*4 bits (3 bytes) for (idx = 0; idx < max; idx++) { if ((idx % 4 === 0) && idx) { result.push((bits >> 16) & 0xFF); result.push((bits >> 8) & 0xFF); result.push(bits & 0xFF); } bits = (bits << 6) | map.indexOf(input.charAt(idx)); } // Dump tail tailbits = (max % 4) * 6; if (tailbits === 0) { result.push((bits >> 16) & 0xFF); result.push((bits >> 8) & 0xFF); result.push(bits & 0xFF); } else if (tailbits === 18) { result.push((bits >> 10) & 0xFF); result.push((bits >> 2) & 0xFF); } else if (tailbits === 12) { result.push((bits >> 4) & 0xFF); } return new Uint8Array(result); } function representYamlBinary(object /*, style*/) { var result = '', bits = 0, idx, tail, max = object.length, map = BASE64_MAP; // Convert every three bytes to 4 ASCII characters. for (idx = 0; idx < max; idx++) { if ((idx % 3 === 0) && idx) { result += map[(bits >> 18) & 0x3F]; result += map[(bits >> 12) & 0x3F]; result += map[(bits >> 6) & 0x3F]; result += map[bits & 0x3F]; } bits = (bits << 8) + object[idx]; } // Dump tail tail = max % 3; if (tail === 0) { result += map[(bits >> 18) & 0x3F]; result += map[(bits >> 12) & 0x3F]; result += map[(bits >> 6) & 0x3F]; result += map[bits & 0x3F]; } else if (tail === 2) { result += map[(bits >> 10) & 0x3F]; result += map[(bits >> 4) & 0x3F]; result += map[(bits << 2) & 0x3F]; result += map[64]; } else if (tail === 1) { result += map[(bits >> 2) & 0x3F]; result += map[(bits << 4) & 0x3F]; result += map[64]; result += map[64]; } return result; } function isBinary(obj) { return Object.prototype.toString.call(obj) === '[object Uint8Array]'; } module.exports = new Type('tag:yaml.org,2002:binary', { kind: 'scalar', resolve: resolveYamlBinary, construct: constructYamlBinary, predicate: isBinary, represent: representYamlBinary }); /***/ }), /***/ 771: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); function resolveYamlBoolean(data) { if (data === null) return false; var max = data.length; return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); } function constructYamlBoolean(data) { return data === 'true' || data === 'True' || data === 'TRUE'; } function isBoolean(object) { return Object.prototype.toString.call(object) === '[object Boolean]'; } module.exports = new Type('tag:yaml.org,2002:bool', { kind: 'scalar', resolve: resolveYamlBoolean, construct: constructYamlBoolean, predicate: isBoolean, represent: { lowercase: function (object) { return object ? 'true' : 'false'; }, uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, camelcase: function (object) { return object ? 'True' : 'False'; } }, defaultStyle: 'lowercase' }); /***/ }), /***/ 215: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var common = __webpack_require__(347); var Type = __webpack_require__(364); var YAML_FLOAT_PATTERN = new RegExp( // 2.5e4, 2.5 and integers '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + // .2e4, .2 // special case, seems not from spec '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + // .inf '|[-+]?\\.(?:inf|Inf|INF)' + // .nan '|\\.(?:nan|NaN|NAN))$'); function resolveYamlFloat(data) { if (data === null) return false; if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_` // Probably should update regexp & check speed data[data.length - 1] === '_') { return false; } return true; } function constructYamlFloat(data) { var value, sign; value = data.replace(/_/g, '').toLowerCase(); sign = value[0] === '-' ? -1 : 1; if ('+-'.indexOf(value[0]) >= 0) { value = value.slice(1); } if (value === '.inf') { return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; } else if (value === '.nan') { return NaN; } return sign * parseFloat(value, 10); } var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; function representYamlFloat(object, style) { var res; if (isNaN(object)) { switch (style) { case 'lowercase': return '.nan'; case 'uppercase': return '.NAN'; case 'camelcase': return '.NaN'; } } else if (Number.POSITIVE_INFINITY === object) { switch (style) { case 'lowercase': return '.inf'; case 'uppercase': return '.INF'; case 'camelcase': return '.Inf'; } } else if (Number.NEGATIVE_INFINITY === object) { switch (style) { case 'lowercase': return '-.inf'; case 'uppercase': return '-.INF'; case 'camelcase': return '-.Inf'; } } else if (common.isNegativeZero(object)) { return '-0.0'; } res = object.toString(10); // JS stringifier can build scientific format without dots: 5e-100, // while YAML requres dot: 5.e-100. Fix it with simple hack return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; } function isFloat(object) { return (Object.prototype.toString.call(object) === '[object Number]') && (object % 1 !== 0 || common.isNegativeZero(object)); } module.exports = new Type('tag:yaml.org,2002:float', { kind: 'scalar', resolve: resolveYamlFloat, construct: constructYamlFloat, predicate: isFloat, represent: representYamlFloat, defaultStyle: 'lowercase' }); /***/ }), /***/ 518: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var common = __webpack_require__(347); var Type = __webpack_require__(364); function isHexCode(c) { return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || ((0x61/* a */ <= c) && (c <= 0x66/* f */)); } function isOctCode(c) { return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); } function isDecCode(c) { return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); } function resolveYamlInteger(data) { if (data === null) return false; var max = data.length, index = 0, hasDigits = false, ch; if (!max) return false; ch = data[index]; // sign if (ch === '-' || ch === '+') { ch = data[++index]; } if (ch === '0') { // 0 if (index + 1 === max) return true; ch = data[++index]; // base 2, base 8, base 16 if (ch === 'b') { // base 2 index++; for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; if (ch !== '0' && ch !== '1') return false; hasDigits = true; } return hasDigits && ch !== '_'; } if (ch === 'x') { // base 16 index++; for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; if (!isHexCode(data.charCodeAt(index))) return false; hasDigits = true; } return hasDigits && ch !== '_'; } if (ch === 'o') { // base 8 index++; for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; if (!isOctCode(data.charCodeAt(index))) return false; hasDigits = true; } return hasDigits && ch !== '_'; } } // base 10 (except 0) // value should not start with `_`; if (ch === '_') return false; for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; if (!isDecCode(data.charCodeAt(index))) { return false; } hasDigits = true; } // Should have digits and should not end with `_` if (!hasDigits || ch === '_') return false; return true; } function constructYamlInteger(data) { var value = data, sign = 1, ch; if (value.indexOf('_') !== -1) { value = value.replace(/_/g, ''); } ch = value[0]; if (ch === '-' || ch === '+') { if (ch === '-') sign = -1; value = value.slice(1); ch = value[0]; } if (value === '0') return 0; if (ch === '0') { if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); } return sign * parseInt(value, 10); } function isInteger(object) { return (Object.prototype.toString.call(object)) === '[object Number]' && (object % 1 === 0 && !common.isNegativeZero(object)); } module.exports = new Type('tag:yaml.org,2002:int', { kind: 'scalar', resolve: resolveYamlInteger, construct: constructYamlInteger, predicate: isInteger, represent: { binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, decimal: function (obj) { return obj.toString(10); }, /* eslint-disable max-len */ hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } }, defaultStyle: 'decimal', styleAliases: { binary: [ 2, 'bin' ], octal: [ 8, 'oct' ], decimal: [ 10, 'dec' ], hexadecimal: [ 16, 'hex' ] } }); /***/ }), /***/ 945: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); module.exports = new Type('tag:yaml.org,2002:map', { kind: 'mapping', construct: function (data) { return data !== null ? data : {}; } }); /***/ }), /***/ 452: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); function resolveYamlMerge(data) { return data === '<<' || data === null; } module.exports = new Type('tag:yaml.org,2002:merge', { kind: 'scalar', resolve: resolveYamlMerge }); /***/ }), /***/ 151: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); function resolveYamlNull(data) { if (data === null) return true; var max = data.length; return (max === 1 && data === '~') || (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); } function constructYamlNull() { return null; } function isNull(object) { return object === null; } module.exports = new Type('tag:yaml.org,2002:null', { kind: 'scalar', resolve: resolveYamlNull, construct: constructYamlNull, predicate: isNull, represent: { canonical: function () { return '~'; }, lowercase: function () { return 'null'; }, uppercase: function () { return 'NULL'; }, camelcase: function () { return 'Null'; }, empty: function () { return ''; } }, defaultStyle: 'lowercase' }); /***/ }), /***/ 605: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); var _hasOwnProperty = Object.prototype.hasOwnProperty; var _toString = Object.prototype.toString; function resolveYamlOmap(data) { if (data === null) return true; var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data; for (index = 0, length = object.length; index < length; index += 1) { pair = object[index]; pairHasKey = false; if (_toString.call(pair) !== '[object Object]') return false; for (pairKey in pair) { if (_hasOwnProperty.call(pair, pairKey)) { if (!pairHasKey) pairHasKey = true; else return false; } } if (!pairHasKey) return false; if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); else return false; } return true; } function constructYamlOmap(data) { return data !== null ? data : []; } module.exports = new Type('tag:yaml.org,2002:omap', { kind: 'sequence', resolve: resolveYamlOmap, construct: constructYamlOmap }); /***/ }), /***/ 879: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); var _toString = Object.prototype.toString; function resolveYamlPairs(data) { if (data === null) return true; var index, length, pair, keys, result, object = data; result = new Array(object.length); for (index = 0, length = object.length; index < length; index += 1) { pair = object[index]; if (_toString.call(pair) !== '[object Object]') return false; keys = Object.keys(pair); if (keys.length !== 1) return false; result[index] = [ keys[0], pair[keys[0]] ]; } return true; } function constructYamlPairs(data) { if (data === null) return []; var index, length, pair, keys, result, object = data; result = new Array(object.length); for (index = 0, length = object.length; index < length; index += 1) { pair = object[index]; keys = Object.keys(pair); result[index] = [ keys[0], pair[keys[0]] ]; } return result; } module.exports = new Type('tag:yaml.org,2002:pairs', { kind: 'sequence', resolve: resolveYamlPairs, construct: constructYamlPairs }); /***/ }), /***/ 451: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); module.exports = new Type('tag:yaml.org,2002:seq', { kind: 'sequence', construct: function (data) { return data !== null ? data : []; } }); /***/ }), /***/ 982: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); var _hasOwnProperty = Object.prototype.hasOwnProperty; function resolveYamlSet(data) { if (data === null) return true; var key, object = data; for (key in object) { if (_hasOwnProperty.call(object, key)) { if (object[key] !== null) return false; } } return true; } function constructYamlSet(data) { return data !== null ? data : {}; } module.exports = new Type('tag:yaml.org,2002:set', { kind: 'mapping', resolve: resolveYamlSet, construct: constructYamlSet }); /***/ }), /***/ 48: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); module.exports = new Type('tag:yaml.org,2002:str', { kind: 'scalar', construct: function (data) { return data !== null ? data : ''; } }); /***/ }), /***/ 156: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Type = __webpack_require__(364); var YAML_DATE_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9])' + // [2] month '-([0-9][0-9])$'); // [3] day var YAML_TIMESTAMP_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9]?)' + // [2] month '-([0-9][0-9]?)' + // [3] day '(?:[Tt]|[ \\t]+)' + // ... '([0-9][0-9]?)' + // [4] hour ':([0-9][0-9])' + // [5] minute ':([0-9][0-9])' + // [6] second '(?:\\.([0-9]*))?' + // [7] fraction '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour '(?::([0-9][0-9]))?))?$'); // [11] tz_minute function resolveYamlTimestamp(data) { if (data === null) return false; if (YAML_DATE_REGEXP.exec(data) !== null) return true; if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; return false; } function constructYamlTimestamp(data) { var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date; match = YAML_DATE_REGEXP.exec(data); if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); if (match === null) throw new Error('Date resolve error'); // match: [1] year [2] month [3] day year = +(match[1]); month = +(match[2]) - 1; // JS month starts with 0 day = +(match[3]); if (!match[4]) { // no hour return new Date(Date.UTC(year, month, day)); } // match: [4] hour [5] minute [6] second [7] fraction hour = +(match[4]); minute = +(match[5]); second = +(match[6]); if (match[7]) { fraction = match[7].slice(0, 3); while (fraction.length < 3) { // milli-seconds fraction += '0'; } fraction = +fraction; } // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute if (match[9]) { tz_hour = +(match[10]); tz_minute = +(match[11] || 0); delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds if (match[9] === '-') delta = -delta; } date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); if (delta) date.setTime(date.getTime() - delta); return date; } function representYamlTimestamp(object /*, style*/) { return object.toISOString(); } module.exports = new Type('tag:yaml.org,2002:timestamp', { kind: 'scalar', resolve: resolveYamlTimestamp, construct: constructYamlTimestamp, instanceOf: Date, represent: representYamlTimestamp }); /***/ }), /***/ 578: /***/ (function(module, exports) { /** * lite-url - Small, JS lib that uses regex for parsing a URL into it's component parts. * @version v1.0.5 * @link https://github.com/sadams/lite-url * @license BSD-3-Clause */ (function(){"use strict";function r(r,n,t){var e=r.split(n),o=e.shift();return t(o,e.join(n))}function n(n){var t={hash:"",host:"",hostname:"",origin:"",pathname:"",protocol:"",search:"",password:"",username:"",port:""};return r(n,"#",function(n,e){e&&(t.hash=e?"#"+e:""),r(n,"?",function(n,e){e&&(t.search="?"+e),n&&r(n,"//",function(n,e){t.protocol=n,r(e,"/",function(n,e){t.pathname="/"+(e||""),(t.protocol||n)&&(t.origin=t.protocol+"//"+n),r(n,"@",function(n,e){if(e){var o=n.split(":");t.username=o[0],t.password=o[1]}else e=n;t.host=e,r(e,":",function(r,n){t.hostname=r,n&&(t.port=n)})})})})})}),t.href=t.origin+t.pathname+t.search+t.hash,t}function t(r){var n={},t=r.search;if(t){t=t.replace(new RegExp("\\?"),"");var e=t.split("&");for(var o in e)if(e.hasOwnProperty(o)&&e[o]){var i=e[o].split("=");n[i[0]]=i[1]}}return n}function e(r){var e=i[r];return"undefined"!=typeof e?e:(e=n(r),e.params=t(e),i[r]=e,e)}var o=this,i={};return e.changeQueryParser=function(r){t=r}, true?( true&&module.exports&&(exports=module.exports=e),exports.liteURL=e):0,e}).call(this); /***/ }), /***/ 979: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/** * Copyright 2015 Tim Down. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ (function(factory,root){if(true){!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));}else {}})(function(){if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0,len=arguments.length;i0){var firstItem=this[0];for(var i=0,len=this.length-1;i2)?itemsAfterDeleted=argumentsArray.slice(2).concat(itemsAfterDeleted):itemsAfterDeleted;for(i=0,len=itemsToAppend.length;i=0){arr.splice(index,1);return true;}else{return false;}} function array_contains(arr,val){for(var i=0,len=arr.length;i=level.level;}};Level.ALL=new Level(Number.MIN_VALUE,"ALL");Level.TRACE=new Level(10000,"TRACE");Level.DEBUG=new Level(20000,"DEBUG");Level.INFO=new Level(30000,"INFO");Level.WARN=new Level(40000,"WARN");Level.ERROR=new Level(50000,"ERROR");Level.FATAL=new Level(60000,"FATAL");Level.OFF=new Level(Number.MAX_VALUE,"OFF");log4javascript.Level=Level;function Timer(name,level){this.name=name;this.level=isUndefined(level)?Level.INFO:level;this.start=new Date();} Timer.prototype.getElapsedTime=function(){return new Date().getTime()-this.start.getTime();};var anonymousLoggerName="[anonymous]";var defaultLoggerName="[default]";var nullLoggerName="[null]";var rootLoggerName="root";function Logger(name){this.name=name;this.parent=null;this.children=[];var appenders=[];var loggerLevel=null;var isRoot=(this.name===rootLoggerName);var isNull=(this.name===nullLoggerName);var appenderCache=null;var appenderCacheInvalidated=false;this.addChild=function(childLogger){this.children.push(childLogger);childLogger.parent=this;childLogger.invalidateAppenderCache();};var additive=true;this.getAdditivity=function(){return additive;};this.setAdditivity=function(additivity){var valueChanged=(additive!=additivity);additive=additivity;if(valueChanged){this.invalidateAppenderCache();}};this.addAppender=function(appender){if(isNull){handleError("Logger.addAppender: you may not add an appender to the null logger");}else{if(appender instanceof log4javascript.Appender){if(!array_contains(appenders,appender)){appenders.push(appender);appender.setAddedToLogger(this);this.invalidateAppenderCache();}}else{handleError("Logger.addAppender: appender supplied ('"+ toStr(appender)+"') is not a subclass of Appender");}}};this.removeAppender=function(appender){array_remove(appenders,appender);appender.setRemovedFromLogger(this);this.invalidateAppenderCache();};this.removeAllAppenders=function(){var appenderCount=appenders.length;if(appenderCount>0){for(var i=0;i1&&isError(lastParam)){exception=lastParam;finalParamIndex--;} var messages=[];for(var i=0;i<=finalParamIndex;i++){messages[i]=params[i];} var loggingEvent=new LoggingEvent(this,new Date(),level,messages,exception);this.callAppenders(loggingEvent);}};this.callAppenders=function(loggingEvent){var effectiveAppenders=this.getEffectiveAppenders();for(var i=0,len=effectiveAppenders.length;i0)?args:["Assertion Failure"];args.push(newLine);args.push(expr);this.log(Level.ERROR,args);}};this.toString=function(){return"Logger["+this.name+"]";};} Logger.prototype={trace:function(){this.log(Level.TRACE,arguments);},debug:function(){this.log(Level.DEBUG,arguments);},info:function(){this.log(Level.INFO,arguments);},warn:function(){this.log(Level.WARN,arguments);},error:function(){this.log(Level.ERROR,arguments);},fatal:function(){this.log(Level.FATAL,arguments);},isEnabledFor:function(level){return level.isGreaterOrEqual(this.getEffectiveLevel());},isTraceEnabled:function(){return this.isEnabledFor(Level.TRACE);},isDebugEnabled:function(){return this.isEnabledFor(Level.DEBUG);},isInfoEnabled:function(){return this.isEnabledFor(Level.INFO);},isWarnEnabled:function(){return this.isEnabledFor(Level.WARN);},isErrorEnabled:function(){return this.isEnabledFor(Level.ERROR);},isFatalEnabled:function(){return this.isEnabledFor(Level.FATAL);}};Logger.prototype.trace.isEntryPoint=true;Logger.prototype.debug.isEntryPoint=true;Logger.prototype.info.isEntryPoint=true;Logger.prototype.warn.isEntryPoint=true;Logger.prototype.error.isEntryPoint=true;Logger.prototype.fatal.isEntryPoint=true;var loggers={};var loggerNames=[];var ROOT_LOGGER_DEFAULT_LEVEL=Level.DEBUG;var rootLogger=new Logger(rootLoggerName);rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL);log4javascript.getRootLogger=function(){return rootLogger;};log4javascript.getLogger=function(loggerName){if(typeof loggerName!="string"){loggerName=anonymousLoggerName;logLog.warn("log4javascript.getLogger: non-string logger name "+ toStr(loggerName)+" supplied, returning anonymous logger");} if(loggerName==rootLoggerName){handleError("log4javascript.getLogger: root logger may not be obtained by name");} if(!loggers[loggerName]){var logger=new Logger(loggerName);loggers[loggerName]=logger;loggerNames.push(loggerName);var lastDotIndex=loggerName.lastIndexOf(".");var parentLogger;if(lastDotIndex>-1){var parentLoggerName=loggerName.substring(0,lastDotIndex);parentLogger=log4javascript.getLogger(parentLoggerName);}else{parentLogger=rootLogger;} parentLogger.addChild(logger);} return loggers[loggerName];};var defaultLogger=null;log4javascript.getDefaultLogger=function(){if(!defaultLogger){defaultLogger=createDefaultLogger();} return defaultLogger;};var nullLogger=null;log4javascript.getNullLogger=function(){if(!nullLogger){nullLogger=new Logger(nullLoggerName);nullLogger.setLevel(Level.OFF);} return nullLogger;};log4javascript.resetConfiguration=function(){rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL);loggers={};};var LoggingEvent=function(logger,timeStamp,level,messages,exception){this.logger=logger;this.timeStamp=timeStamp;this.timeStampInMilliseconds=timeStamp.getTime();this.timeStampInSeconds=Math.floor(this.timeStampInMilliseconds/1000);this.milliseconds=this.timeStamp.getMilliseconds();this.level=level;this.messages=messages;this.exception=exception;};LoggingEvent.prototype={getThrowableStrRep:function(){return this.exception?getExceptionStringRep(this.exception):"";},getCombinedMessages:function(){return(this.messages.length==1)?this.messages[0]:this.messages.join(newLine);},toString:function(){return"LoggingEvent["+this.level+"]";}};log4javascript.LoggingEvent=LoggingEvent;var Layout=function(){};Layout.prototype={defaults:{loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url"},loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url",batchHeader:"",batchFooter:"",batchSeparator:"",returnsPostData:false,overrideTimeStampsSetting:false,useTimeStampsInMilliseconds:null,format:function(){handleError("Layout.format: layout supplied has no format() method");},ignoresThrowable:function(){handleError("Layout.ignoresThrowable: layout supplied has no ignoresThrowable() method");},getContentType:function(){return"text/plain";},allowBatching:function(){return true;},setTimeStampsInMilliseconds:function(timeStampsInMilliseconds){this.overrideTimeStampsSetting=true;this.useTimeStampsInMilliseconds=bool(timeStampsInMilliseconds);},isTimeStampsInMilliseconds:function(){return this.overrideTimeStampsSetting?this.useTimeStampsInMilliseconds:useTimeStampsInMilliseconds;},getTimeStampValue:function(loggingEvent){return this.isTimeStampsInMilliseconds()?loggingEvent.timeStampInMilliseconds:loggingEvent.timeStampInSeconds;},getDataValues:function(loggingEvent,combineMessages){var dataValues=[[this.loggerKey,loggingEvent.logger.name],[this.timeStampKey,this.getTimeStampValue(loggingEvent)],[this.levelKey,loggingEvent.level.name],[this.urlKey,window.location.href],[this.messageKey,combineMessages?loggingEvent.getCombinedMessages():loggingEvent.messages]];if(!this.isTimeStampsInMilliseconds()){dataValues.push([this.millisecondsKey,loggingEvent.milliseconds]);} if(loggingEvent.exception){dataValues.push([this.exceptionKey,getExceptionStringRep(loggingEvent.exception)]);} if(this.hasCustomFields()){for(var i=0,len=this.customFields.length;i0);},formatWithException:function(loggingEvent){var formatted=this.format(loggingEvent);if(loggingEvent.exception&&this.ignoresThrowable()){formatted+=loggingEvent.getThrowableStrRep();} return formatted;},toString:function(){handleError("Layout.toString: all layouts must override this method");}};log4javascript.Layout=Layout;var Appender=function(){};Appender.prototype=new EventSupport();Appender.prototype.layout=new PatternLayout();Appender.prototype.threshold=Level.ALL;Appender.prototype.loggers=[];Appender.prototype.doAppend=function(loggingEvent){if(enabled&&loggingEvent.level.level>=this.threshold.level){this.append(loggingEvent);}};Appender.prototype.append=function(loggingEvent){};Appender.prototype.setLayout=function(layout){if(layout instanceof Layout){this.layout=layout;}else{handleError("Appender.setLayout: layout supplied to "+ this.toString()+" is not a subclass of Layout");}};Appender.prototype.getLayout=function(){return this.layout;};Appender.prototype.setThreshold=function(threshold){if(threshold instanceof Level){this.threshold=threshold;}else{handleError("Appender.setThreshold: threshold supplied to "+ this.toString()+" is not a subclass of Level");}};Appender.prototype.getThreshold=function(){return this.threshold;};Appender.prototype.setAddedToLogger=function(logger){this.loggers.push(logger);};Appender.prototype.setRemovedFromLogger=function(logger){array_remove(this.loggers,logger);};Appender.prototype.group=emptyFunction;Appender.prototype.groupEnd=emptyFunction;Appender.prototype.toString=function(){handleError("Appender.toString: all appenders must override this method");};log4javascript.Appender=Appender;function SimpleLayout(){this.customFields=[];} SimpleLayout.prototype=new Layout();SimpleLayout.prototype.format=function(loggingEvent){return loggingEvent.level.name+" - "+loggingEvent.getCombinedMessages();};SimpleLayout.prototype.ignoresThrowable=function(){return true;};SimpleLayout.prototype.toString=function(){return"SimpleLayout";};log4javascript.SimpleLayout=SimpleLayout;function NullLayout(){this.customFields=[];} NullLayout.prototype=new Layout();NullLayout.prototype.format=function(loggingEvent){return loggingEvent.messages;};NullLayout.prototype.ignoresThrowable=function(){return true;};NullLayout.prototype.formatWithException=function(loggingEvent){var messages=loggingEvent.messages,ex=loggingEvent.exception;return ex?messages.concat([ex]):messages;};NullLayout.prototype.toString=function(){return"NullLayout";};log4javascript.NullLayout=NullLayout;function XmlLayout(combineMessages){this.combineMessages=extractBooleanFromParam(combineMessages,true);this.customFields=[];} XmlLayout.prototype=new Layout();XmlLayout.prototype.isCombinedMessages=function(){return this.combineMessages;};XmlLayout.prototype.getContentType=function(){return"text/xml";};XmlLayout.prototype.escapeCdata=function(str){return str.replace(/\]\]>/,"]]>]]>";} var str=""+newLine;if(this.combineMessages){str+=formatMessage(loggingEvent.getCombinedMessages());}else{str+=""+newLine;for(i=0,len=loggingEvent.messages.length;i"+newLine;}} if(loggingEvent.exception){str+=""+newLine;} str+=""+newLine+newLine;return str;};XmlLayout.prototype.ignoresThrowable=function(){return false;};XmlLayout.prototype.toString=function(){return"XmlLayout";};log4javascript.XmlLayout=XmlLayout;function escapeNewLines(str){return str.replace(/\r\n|\r|\n/g,"\\r\\n");} function JsonLayout(readable,combineMessages){this.readable=extractBooleanFromParam(readable,false);this.combineMessages=extractBooleanFromParam(combineMessages,true);this.batchHeader=this.readable?"["+newLine:"[";this.batchFooter=this.readable?"]"+newLine:"]";this.batchSeparator=this.readable?","+newLine:",";this.setKeys();this.colon=this.readable?": ":":";this.tab=this.readable?"\t":"";this.lineBreak=this.readable?newLine:"";this.customFields=[];} JsonLayout.prototype=new Layout();JsonLayout.prototype.isReadable=function(){return this.readable;};JsonLayout.prototype.isCombinedMessages=function(){return this.combineMessages;};JsonLayout.prototype.format=function(loggingEvent){var layout=this;var dataValues=this.getDataValues(loggingEvent,this.combineMessages);var str="{"+this.lineBreak;var i,len;function formatValue(val,prefix,expand){var formattedValue;var valType=typeof val;if(val instanceof Date){formattedValue=String(val.getTime());}else if(expand&&(val instanceof Array)){formattedValue="["+layout.lineBreak;for(var i=0,len=val.length;i0){objectsExpanded.push(obj);expansion="["+newLine;childDepth=depth-1;childIndentation=indentation+" ";childLines=[];for(i=0,len=obj.length;i0){objectsExpanded.push(obj);expansion="{"+newLine;childDepth=depth-1;childIndentation=indentation+" ";childLines=[];for(i in obj){try{childExpansion=doFormat(obj[i],childDepth,childIndentation);childLines.push(childIndentation+i+": "+childExpansion);}catch(ex){childLines.push(childIndentation+i+": Error formatting property. Details: "+ getExceptionStringRep(ex));}} expansion+=childLines.join(","+newLine)+newLine+indentation+"}";return expansion;}else{return formatString(toStr(obj));}} return doFormat(obj,depth,indentation);} var SimpleDateFormat;(function(){var regex=/('[^']*')|(G+|y+|M+|w+|W+|D+|d+|F+|E+|a+|H+|k+|K+|h+|m+|s+|S+|Z+)|([a-zA-Z]+)|([^a-zA-Z']+)/;var monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];var dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var TEXT2=0,TEXT3=1,NUMBER=2,YEAR=3,MONTH=4,TIMEZONE=5;var types={G:TEXT2,y:YEAR,M:MONTH,w:NUMBER,W:NUMBER,D:NUMBER,d:NUMBER,F:NUMBER,E:TEXT3,a:TEXT2,H:NUMBER,k:NUMBER,K:NUMBER,h:NUMBER,m:NUMBER,s:NUMBER,S:NUMBER,Z:TIMEZONE};var ONE_DAY=24*60*60*1000;var ONE_WEEK=7*ONE_DAY;var DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK=1;var newDateAtMidnight=function(year,month,day){var d=new Date(year,month,day,0,0,0);d.setMilliseconds(0);return d;};Date.prototype.getDifference=function(date){return this.getTime()-date.getTime();};Date.prototype.isBefore=function(d){return this.getTime()=minimalDaysInFirstWeek){weekInMonth++;} return weekInMonth;};Date.prototype.getDayInYear=function(){var startOfYear=newDateAtMidnight(this.getFullYear(),0,1);return 1+Math.floor(this.getTimeSince(startOfYear)/ONE_DAY);};SimpleDateFormat=function(formatString){this.formatString=formatString;};SimpleDateFormat.prototype.setMinimalDaysInFirstWeek=function(days){this.minimalDaysInFirstWeek=days;};SimpleDateFormat.prototype.getMinimalDaysInFirstWeek=function(){return isUndefined(this.minimalDaysInFirstWeek)?DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK:this.minimalDaysInFirstWeek;};var padWithZeroes=function(str,len){while(str.length=4)?data:data.substr(0,Math.max(minLength,numberOfLetters));};var formatNumber=function(data,numberOfLetters){var dataString=""+data;return padWithZeroes(dataString,numberOfLetters);};SimpleDateFormat.prototype.format=function(date){var formattedString="";var result;var searchString=this.formatString;while((result=regex.exec(searchString))){var quotedString=result[1];var patternLetters=result[2];var otherLetters=result[3];var otherCharacters=result[4];if(quotedString){if(quotedString=="''"){formattedString+="'";}else{formattedString+=quotedString.substring(1,quotedString.length-1);}}else if(otherLetters){}else if(otherCharacters){formattedString+=otherCharacters;}else if(patternLetters){var patternLetter=patternLetters.charAt(0);var numberOfLetters=patternLetters.length;var rawData="";switch(patternLetter){case"G":rawData="AD";break;case"y":rawData=date.getFullYear();break;case"M":rawData=date.getMonth();break;case"w":rawData=date.getWeekInYear(this.getMinimalDaysInFirstWeek());break;case"W":rawData=date.getWeekInMonth(this.getMinimalDaysInFirstWeek());break;case"D":rawData=date.getDayInYear();break;case"d":rawData=date.getDate();break;case"F":rawData=1+Math.floor((date.getDate()-1)/7);break;case"E":rawData=dayNames[date.getDay()];break;case"a":rawData=(date.getHours()>=12)?"PM":"AM";break;case"H":rawData=date.getHours();break;case"k":rawData=date.getHours()||24;break;case"K":rawData=date.getHours()%12;break;case"h":rawData=(date.getHours()%12)||12;break;case"m":rawData=date.getMinutes();break;case"s":rawData=date.getSeconds();break;case"S":rawData=date.getMilliseconds();break;case"Z":rawData=date.getTimezoneOffset();break;} switch(types[patternLetter]){case TEXT2:formattedString+=formatText(rawData,numberOfLetters,2);break;case TEXT3:formattedString+=formatText(rawData,numberOfLetters,3);break;case NUMBER:formattedString+=formatNumber(rawData,numberOfLetters);break;case YEAR:if(numberOfLetters<=3){var dataString=""+rawData;formattedString+=dataString.substr(2,2);}else{formattedString+=formatNumber(rawData,numberOfLetters);} break;case MONTH:if(numberOfLetters>=3){formattedString+=formatText(monthNames[rawData],numberOfLetters,numberOfLetters);}else{formattedString+=formatNumber(rawData+1,numberOfLetters);} break;case TIMEZONE:var isPositive=(rawData>0);var prefix=isPositive?"-":"+";var absData=Math.abs(rawData);var hours=""+Math.floor(absData/60);hours=padWithZeroes(hours,2);var minutes=""+(absData%60);minutes=padWithZeroes(minutes,2);formattedString+=prefix+hours+minutes;break;}} searchString=searchString.substr(result.index+result[0].length);} return formattedString;};})();log4javascript.SimpleDateFormat=SimpleDateFormat;function PatternLayout(pattern){if(pattern){this.pattern=pattern;}else{this.pattern=PatternLayout.DEFAULT_CONVERSION_PATTERN;} this.customFields=[];} PatternLayout.TTCC_CONVERSION_PATTERN="%r %p %c - %m%n";PatternLayout.DEFAULT_CONVERSION_PATTERN="%m%n";PatternLayout.ISO8601_DATEFORMAT="yyyy-MM-dd HH:mm:ss,SSS";PatternLayout.DATETIME_DATEFORMAT="dd MMM yyyy HH:mm:ss,SSS";PatternLayout.ABSOLUTETIME_DATEFORMAT="HH:mm:ss,SSS";PatternLayout.prototype=new Layout();PatternLayout.prototype.format=function(loggingEvent){var regex=/%(-?[0-9]+)?(\.?[0-9]+)?([acdfmMnpr%])(\{([^\}]+)\})?|([^%]+)/;var formattedString="";var result;var searchString=this.pattern;while((result=regex.exec(searchString))){var matchedString=result[0];var padding=result[1];var truncation=result[2];var conversionCharacter=result[3];var specifier=result[5];var text=result[6];if(text){formattedString+=""+text;}else{var replacement="";switch(conversionCharacter){case"a":case"m":var depth=0;if(specifier){depth=parseInt(specifier,10);if(isNaN(depth)){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character '"+conversionCharacter+"' - should be a number");depth=0;}} var messages=(conversionCharacter==="a")?loggingEvent.messages[0]:loggingEvent.messages;for(var i=0,len=messages.length;i0&&(replacement.charAt(replacement.length-1)!==" ")){replacement+=" ";} if(depth===0){replacement+=messages[i];}else{replacement+=formatObjectExpansion(messages[i],depth);}} break;case"c":var loggerName=loggingEvent.logger.name;if(specifier){var precision=parseInt(specifier,10);var loggerNameBits=loggingEvent.logger.name.split(".");if(precision>=loggerNameBits.length){replacement=loggerName;}else{replacement=loggerNameBits.slice(loggerNameBits.length-precision).join(".");}}else{replacement=loggerName;} break;case"d":var dateFormat=PatternLayout.ISO8601_DATEFORMAT;if(specifier){dateFormat=specifier;if(dateFormat=="ISO8601"){dateFormat=PatternLayout.ISO8601_DATEFORMAT;}else if(dateFormat=="ABSOLUTE"){dateFormat=PatternLayout.ABSOLUTETIME_DATEFORMAT;}else if(dateFormat=="DATE"){dateFormat=PatternLayout.DATETIME_DATEFORMAT;}} replacement=(new SimpleDateFormat(dateFormat)).format(loggingEvent.timeStamp);break;case"f":if(this.hasCustomFields()){var fieldIndex=0;if(specifier){fieldIndex=parseInt(specifier,10);if(isNaN(fieldIndex)){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character 'f' - should be a number");}else if(fieldIndex===0){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character 'f' - must be greater than zero");}else if(fieldIndex>this.customFields.length){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character 'f' - there aren't that many custom fields");}else{fieldIndex=fieldIndex-1;}} var val=this.customFields[fieldIndex].value;if(typeof val=="function"){val=val(this,loggingEvent);} replacement=val;} break;case"n":replacement=newLine;break;case"p":replacement=loggingEvent.level.name;break;case"r":replacement=""+loggingEvent.timeStamp.getDifference(applicationStartDate);break;case"%":replacement="%";break;default:replacement=matchedString;break;} var l;if(truncation){l=parseInt(truncation.substr(1),10);var strLen=replacement.length;if(l=200&&xmlHttp.status<300)||xmlHttp.status==1223;} function AjaxAppender(url,withCredentials){var appender=this;var isSupported=true;if(!url){handleError("AjaxAppender: URL must be specified in constructor");isSupported=false;} var timed=this.defaults.timed;var waitForResponse=this.defaults.waitForResponse;var batchSize=this.defaults.batchSize;var timerInterval=this.defaults.timerInterval;var requestSuccessCallback=this.defaults.requestSuccessCallback;var failCallback=this.defaults.failCallback;var postVarName=this.defaults.postVarName;var sendAllOnUnload=this.defaults.sendAllOnUnload;var contentType=this.defaults.contentType;var sessionId=null;var queuedLoggingEvents=[];var queuedRequests=[];var headers=[];var sending=false;var initialized=false;function checkCanConfigure(configOptionName){if(initialized){handleError("AjaxAppender: configuration option '"+ configOptionName+"' may not be set after the appender has been initialized");return false;} return true;} this.getSessionId=function(){return sessionId;};this.setSessionId=function(sessionIdParam){sessionId=extractStringFromParam(sessionIdParam,null);this.layout.setCustomField("sessionid",sessionId);};this.setLayout=function(layoutParam){if(checkCanConfigure("layout")){this.layout=layoutParam;if(sessionId!==null){this.setSessionId(sessionId);}}};this.isTimed=function(){return timed;};this.setTimed=function(timedParam){if(checkCanConfigure("timed")){timed=bool(timedParam);}};this.getTimerInterval=function(){return timerInterval;};this.setTimerInterval=function(timerIntervalParam){if(checkCanConfigure("timerInterval")){timerInterval=extractIntFromParam(timerIntervalParam,timerInterval);}};this.isWaitForResponse=function(){return waitForResponse;};this.setWaitForResponse=function(waitForResponseParam){if(checkCanConfigure("waitForResponse")){waitForResponse=bool(waitForResponseParam);}};this.getBatchSize=function(){return batchSize;};this.setBatchSize=function(batchSizeParam){if(checkCanConfigure("batchSize")){batchSize=extractIntFromParam(batchSizeParam,batchSize);}};this.isSendAllOnUnload=function(){return sendAllOnUnload;};this.setSendAllOnUnload=function(sendAllOnUnloadParam){if(checkCanConfigure("sendAllOnUnload")){sendAllOnUnload=extractBooleanFromParam(sendAllOnUnloadParam,sendAllOnUnload);}};this.setRequestSuccessCallback=function(requestSuccessCallbackParam){requestSuccessCallback=extractFunctionFromParam(requestSuccessCallbackParam,requestSuccessCallback);};this.setFailCallback=function(failCallbackParam){failCallback=extractFunctionFromParam(failCallbackParam,failCallback);};this.getPostVarName=function(){return postVarName;};this.setPostVarName=function(postVarNameParam){if(checkCanConfigure("postVarName")){postVarName=extractStringFromParam(postVarNameParam,postVarName);}};this.getHeaders=function(){return headers;};this.addHeader=function(name,value){if(name.toLowerCase()=="content-type"){contentType=value;}else{headers.push({name:name,value:value});}};function sendAll(){if(isSupported&&enabled){sending=true;var currentRequestBatch;if(waitForResponse){if(queuedRequests.length>0){currentRequestBatch=queuedRequests.shift();sendRequest(preparePostData(currentRequestBatch),sendAll);}else{sending=false;if(timed){scheduleSending();}}}else{while((currentRequestBatch=queuedRequests.shift())){sendRequest(preparePostData(currentRequestBatch));} sending=false;if(timed){scheduleSending();}}}} this.sendAll=sendAll;function sendAllRemaining(){var sendingAnything=false;if(isSupported&&enabled){var actualBatchSize=appender.getLayout().allowBatching()?batchSize:1;var currentLoggingEvent;var batchedLoggingEvents=[];while((currentLoggingEvent=queuedLoggingEvents.shift())){batchedLoggingEvents.push(currentLoggingEvent);if(queuedLoggingEvents.length>=actualBatchSize){queuedRequests.push(batchedLoggingEvents);batchedLoggingEvents=[];}} if(batchedLoggingEvents.length>0){queuedRequests.push(batchedLoggingEvents);} sendingAnything=(queuedRequests.length>0);waitForResponse=false;timed=false;sendAll();} return sendingAnything;} this.sendAllRemaining=sendAllRemaining;function preparePostData(batchedLoggingEvents){var formattedMessages=[];var currentLoggingEvent;var postData="";while((currentLoggingEvent=batchedLoggingEvents.shift())){formattedMessages.push(appender.getLayout().formatWithException(currentLoggingEvent));} if(batchedLoggingEvents.length==1){postData=formattedMessages.join("");}else{postData=appender.getLayout().batchHeader+ formattedMessages.join(appender.getLayout().batchSeparator)+ appender.getLayout().batchFooter;} if(contentType==appender.defaults.contentType){postData=appender.getLayout().returnsPostData?postData:urlEncode(postVarName)+"="+urlEncode(postData);if(postData.length>0){postData+="&";} postData+="layout="+urlEncode(appender.getLayout().toString());} return postData;} function scheduleSending(){window.setTimeout(sendAll,timerInterval);} function xmlHttpErrorHandler(){var msg="AjaxAppender: could not create XMLHttpRequest object. AjaxAppender disabled";handleError(msg);isSupported=false;if(failCallback){failCallback(msg);}} function sendRequest(postData,successCallback){try{var xmlHttp=getXmlHttp(xmlHttpErrorHandler);if(isSupported){xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(isHttpRequestSuccessful(xmlHttp)){if(requestSuccessCallback){requestSuccessCallback(xmlHttp);} if(successCallback){successCallback(xmlHttp);}}else{var msg="AjaxAppender.append: XMLHttpRequest request to URL "+ url+" returned status code "+xmlHttp.status;handleError(msg);if(failCallback){failCallback(msg);}} xmlHttp.onreadystatechange=emptyFunction;xmlHttp=null;}};xmlHttp.open("POST",url,true);if(withCredentials&&withCredentialsSupported){xmlHttp.withCredentials=true;} try{for(var i=0,header;header=headers[i++];){xmlHttp.setRequestHeader(header.name,header.value);} xmlHttp.setRequestHeader("Content-Type",contentType);}catch(headerEx){var msg="AjaxAppender.append: your browser's XMLHttpRequest implementation"+" does not support setRequestHeader, therefore cannot post data. AjaxAppender disabled";handleError(msg);isSupported=false;if(failCallback){failCallback(msg);} return;} xmlHttp.send(postData);}}catch(ex){var errMsg="AjaxAppender.append: error sending log message to "+url;handleError(errMsg,ex);isSupported=false;if(failCallback){failCallback(errMsg+". Details: "+getExceptionStringRep(ex));}}} this.append=function(loggingEvent){if(isSupported){if(!initialized){init();} queuedLoggingEvents.push(loggingEvent);var actualBatchSize=this.getLayout().allowBatching()?batchSize:1;if(queuedLoggingEvents.length>=actualBatchSize){var currentLoggingEvent;var batchedLoggingEvents=[];while((currentLoggingEvent=queuedLoggingEvents.shift())){batchedLoggingEvents.push(currentLoggingEvent);} queuedRequests.push(batchedLoggingEvents);if(!timed&&(!waitForResponse||(waitForResponse&&!sending))){sendAll();}}}};function init(){initialized=true;if(sendAllOnUnload){var oldBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){if(oldBeforeUnload){oldBeforeUnload();} sendAllRemaining();};} if(timed){scheduleSending();}}} AjaxAppender.prototype=new Appender();AjaxAppender.prototype.defaults={waitForResponse:false,timed:false,timerInterval:1000,batchSize:1,sendAllOnUnload:false,requestSuccessCallback:null,failCallback:null,postVarName:"data",contentType:"application/x-www-form-urlencoded"};AjaxAppender.prototype.layout=new HttpPostDataLayout();AjaxAppender.prototype.toString=function(){return"AjaxAppender";};log4javascript.AjaxAppender=AjaxAppender;function setCookie(name,value,days,path){var expires;path=path?"; path="+path:"";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}else{expires="";} document.cookie=escape(name)+"="+escape(value)+expires+path;} function getCookie(name){var nameEquals=escape(name)+"=";var ca=document.cookie.split(";");for(var i=0,len=ca.length;i','','','log4javascript','','','','','','','','','','','
    ','
    ','
    ','Filters:','','','','','','','','
    ','','
    ','Options:','','','','','','','','
    ','
    ','
    ','
    ','
    ','
    ','','','
    ','
    ','','',''];};var defaultCommandLineFunctions=[];ConsoleAppender=function(){};var consoleAppenderIdCounter=1;ConsoleAppender.prototype=new Appender();ConsoleAppender.prototype.create=function(inPage,container,lazyInit,initiallyMinimized,useDocumentWrite,width,height,focusConsoleWindow){var appender=this;var initialized=false;var consoleWindowCreated=false;var consoleWindowLoaded=false;var consoleClosed=false;var queuedLoggingEvents=[];var isSupported=true;var consoleAppenderId=consoleAppenderIdCounter++;initiallyMinimized=extractBooleanFromParam(initiallyMinimized,this.defaults.initiallyMinimized);lazyInit=extractBooleanFromParam(lazyInit,this.defaults.lazyInit);useDocumentWrite=extractBooleanFromParam(useDocumentWrite,this.defaults.useDocumentWrite);var newestMessageAtTop=this.defaults.newestMessageAtTop;var scrollToLatestMessage=this.defaults.scrollToLatestMessage;width=width?width:this.defaults.width;height=height?height:this.defaults.height;var maxMessages=this.defaults.maxMessages;var showCommandLine=this.defaults.showCommandLine;var commandLineObjectExpansionDepth=this.defaults.commandLineObjectExpansionDepth;var showHideButton=this.defaults.showHideButton;var showCloseButton=this.defaults.showCloseButton;this.setLayout(this.defaults.layout);var init,createWindow,safeToAppend,getConsoleWindow,open;var appenderName=inPage?"InPageAppender":"PopUpAppender";var checkCanConfigure=function(configOptionName){if(consoleWindowCreated){handleError(appenderName+": configuration option '"+configOptionName+"' may not be set after the appender has been initialized");return false;} return true;};var consoleWindowExists=function(){return(consoleWindowLoaded&&isSupported&&!consoleClosed);};this.isNewestMessageAtTop=function(){return newestMessageAtTop;};this.setNewestMessageAtTop=function(newestMessageAtTopParam){newestMessageAtTop=bool(newestMessageAtTopParam);if(consoleWindowExists()){getConsoleWindow().setNewestAtTop(newestMessageAtTop);}};this.isScrollToLatestMessage=function(){return scrollToLatestMessage;};this.setScrollToLatestMessage=function(scrollToLatestMessageParam){scrollToLatestMessage=bool(scrollToLatestMessageParam);if(consoleWindowExists()){getConsoleWindow().setScrollToLatest(scrollToLatestMessage);}};this.getWidth=function(){return width;};this.setWidth=function(widthParam){if(checkCanConfigure("width")){width=extractStringFromParam(widthParam,width);}};this.getHeight=function(){return height;};this.setHeight=function(heightParam){if(checkCanConfigure("height")){height=extractStringFromParam(heightParam,height);}};this.getMaxMessages=function(){return maxMessages;};this.setMaxMessages=function(maxMessagesParam){maxMessages=extractIntFromParam(maxMessagesParam,maxMessages);if(consoleWindowExists()){getConsoleWindow().setMaxMessages(maxMessages);}};this.isShowCommandLine=function(){return showCommandLine;};this.setShowCommandLine=function(showCommandLineParam){showCommandLine=bool(showCommandLineParam);if(consoleWindowExists()){getConsoleWindow().setShowCommandLine(showCommandLine);}};this.isShowHideButton=function(){return showHideButton;};this.setShowHideButton=function(showHideButtonParam){showHideButton=bool(showHideButtonParam);if(consoleWindowExists()){getConsoleWindow().setShowHideButton(showHideButton);}};this.isShowCloseButton=function(){return showCloseButton;};this.setShowCloseButton=function(showCloseButtonParam){showCloseButton=bool(showCloseButtonParam);if(consoleWindowExists()){getConsoleWindow().setShowCloseButton(showCloseButton);}};this.getCommandLineObjectExpansionDepth=function(){return commandLineObjectExpansionDepth;};this.setCommandLineObjectExpansionDepth=function(commandLineObjectExpansionDepthParam){commandLineObjectExpansionDepth=extractIntFromParam(commandLineObjectExpansionDepthParam,commandLineObjectExpansionDepth);};var minimized=initiallyMinimized;this.isInitiallyMinimized=function(){return initiallyMinimized;};this.setInitiallyMinimized=function(initiallyMinimizedParam){if(checkCanConfigure("initiallyMinimized")){initiallyMinimized=bool(initiallyMinimizedParam);minimized=initiallyMinimized;}};this.isUseDocumentWrite=function(){return useDocumentWrite;};this.setUseDocumentWrite=function(useDocumentWriteParam){if(checkCanConfigure("useDocumentWrite")){useDocumentWrite=bool(useDocumentWriteParam);}};function QueuedLoggingEvent(loggingEvent,formattedMessage){this.loggingEvent=loggingEvent;this.levelName=loggingEvent.level.name;this.formattedMessage=formattedMessage;} QueuedLoggingEvent.prototype.append=function(){getConsoleWindow().log(this.levelName,this.formattedMessage);};function QueuedGroup(name,initiallyExpanded){this.name=name;this.initiallyExpanded=initiallyExpanded;} QueuedGroup.prototype.append=function(){getConsoleWindow().group(this.name,this.initiallyExpanded);};function QueuedGroupEnd(){} QueuedGroupEnd.prototype.append=function(){getConsoleWindow().groupEnd();};var checkAndAppend=function(){safeToAppend();if(!initialized){init();}else if(consoleClosed&&reopenWhenClosed){createWindow();} if(safeToAppend()){appendQueuedLoggingEvents();}};this.append=function(loggingEvent){if(isSupported){var formattedMessage=appender.getLayout().formatWithException(loggingEvent);queuedLoggingEvents.push(new QueuedLoggingEvent(loggingEvent,formattedMessage));checkAndAppend();}};this.group=function(name,initiallyExpanded){if(isSupported){queuedLoggingEvents.push(new QueuedGroup(name,initiallyExpanded));checkAndAppend();}};this.groupEnd=function(){if(isSupported){queuedLoggingEvents.push(new QueuedGroupEnd());checkAndAppend();}};var appendQueuedLoggingEvents=function(){while(queuedLoggingEvents.length>0){queuedLoggingEvents.shift().append();} if(focusConsoleWindow){getConsoleWindow().focus();}};this.setAddedToLogger=function(logger){this.loggers.push(logger);if(enabled&&!lazyInit){init();}};this.clear=function(){if(consoleWindowExists()){getConsoleWindow().clearLog();} queuedLoggingEvents.length=0;};this.focus=function(){if(consoleWindowExists()){getConsoleWindow().focus();}};this.focusCommandLine=function(){if(consoleWindowExists()){getConsoleWindow().focusCommandLine();}};this.focusSearch=function(){if(consoleWindowExists()){getConsoleWindow().focusSearch();}};var commandWindow=window;this.getCommandWindow=function(){return commandWindow;};this.setCommandWindow=function(commandWindowParam){commandWindow=commandWindowParam;};this.executeLastCommand=function(){if(consoleWindowExists()){getConsoleWindow().evalLastCommand();}};var commandLayout=new PatternLayout("%m");this.getCommandLayout=function(){return commandLayout;};this.setCommandLayout=function(commandLayoutParam){commandLayout=commandLayoutParam;};this.evalCommandAndAppend=function(expr){var commandReturnValue={appendResult:true,isError:false};var commandOutput="";try{var result,i;if(!commandWindow.eval&&commandWindow.execScript){commandWindow.execScript("null");} var commandLineFunctionsHash={};for(i=0,len=commandLineFunctions.length;i";consoleClosed=false;var iframeDocumentExistsTest=function(win){try{return bool(win)&&bool(win.document);}catch(ex){return false;}};if(iframeDocumentExistsTest(getConsoleWindow())){writeToDocument();}else{pollConsoleWindow(iframeDocumentExistsTest,100,writeToDocument,initErrorMessage);} consoleWindowCreated=true;};createWindow=function(show){if(show||!initiallyMinimized){var pageLoadHandler=function(){if(!container){containerElement=document.createElement("div");containerElement.style.position="fixed";containerElement.style.left="0";containerElement.style.right="0";containerElement.style.bottom="0";document.body.appendChild(containerElement);appender.addCssProperty("borderWidth","1px 0 0 0");appender.addCssProperty("zIndex",1000000);open();}else{try{var el=document.getElementById(container);if(el.nodeType==1){containerElement=el;} open();}catch(ex){handleError("InPageAppender.init: invalid container element '"+container+"' supplied",ex);}}};if(pageLoaded&&container&&container.appendChild){containerElement=container;open();}else if(pageLoaded){pageLoadHandler();}else{log4javascript.addEventListener("load",pageLoadHandler);} windowCreationStarted=true;}};init=function(){createWindow();initialized=true;};getConsoleWindow=function(){var iframe=window.frames[iframeId];if(iframe){return iframe;}};safeToAppend=function(){if(isSupported&&!consoleClosed){if(consoleWindowCreated&&!consoleWindowLoaded&&getConsoleWindow()&&isLoaded(getConsoleWindow())){consoleWindowLoaded=true;} return consoleWindowLoaded;} return false;};}else{var useOldPopUp=appender.defaults.useOldPopUp;var complainAboutPopUpBlocking=appender.defaults.complainAboutPopUpBlocking;var reopenWhenClosed=this.defaults.reopenWhenClosed;this.isUseOldPopUp=function(){return useOldPopUp;};this.setUseOldPopUp=function(useOldPopUpParam){if(checkCanConfigure("useOldPopUp")){useOldPopUp=bool(useOldPopUpParam);}};this.isComplainAboutPopUpBlocking=function(){return complainAboutPopUpBlocking;};this.setComplainAboutPopUpBlocking=function(complainAboutPopUpBlockingParam){if(checkCanConfigure("complainAboutPopUpBlocking")){complainAboutPopUpBlocking=bool(complainAboutPopUpBlockingParam);}};this.isFocusPopUp=function(){return focusConsoleWindow;};this.setFocusPopUp=function(focusPopUpParam){focusConsoleWindow=bool(focusPopUpParam);};this.isReopenWhenClosed=function(){return reopenWhenClosed;};this.setReopenWhenClosed=function(reopenWhenClosedParam){reopenWhenClosed=bool(reopenWhenClosedParam);};this.close=function(){logLog.debug("close "+this);try{popUp.close();this.unload();}catch(ex){}};this.hide=function(){logLog.debug("hide "+this);if(consoleWindowExists()){this.close();}};this.show=function(){logLog.debug("show "+this);if(!consoleWindowCreated){open();}};this.isVisible=function(){return safeToAppend();};var popUp;open=function(){var windowProperties="width="+width+",height="+height+",status,resizable";var frameInfo="";try{var frameEl=window.frameElement;if(frameEl){frameInfo="_"+frameEl.tagName+"_"+(frameEl.name||frameEl.id||"");}}catch(e){frameInfo="_inaccessibleParentFrame";} var windowName="PopUp_"+location.host.replace(/[^a-z0-9]/gi,"_")+"_"+consoleAppenderId+frameInfo;if(!useOldPopUp||!useDocumentWrite){windowName=windowName+"_"+uniqueId;} var checkPopUpClosed=function(win){if(consoleClosed){return true;}else{try{return bool(win)&&win.closed;}catch(ex){}} return false;};var popUpClosedCallback=function(){if(!consoleClosed){appender.unload();}};function finalInit(){getConsoleWindow().setCloseIfOpenerCloses(!useOldPopUp||!useDocumentWrite);consoleWindowLoadHandler();consoleWindowLoaded=true;appendQueuedLoggingEvents();pollConsoleWindow(checkPopUpClosed,500,popUpClosedCallback,"PopUpAppender.checkPopUpClosed: error checking pop-up window");} try{popUp=window.open(getConsoleUrl(),windowName,windowProperties);consoleClosed=false;consoleWindowCreated=true;if(popUp&&popUp.document){if(useDocumentWrite&&useOldPopUp&&isLoaded(popUp)){popUp.mainPageReloaded();finalInit();}else{if(useDocumentWrite){writeHtml(popUp.document);} var popUpLoadedTest=function(win){return bool(win)&&isLoaded(win);};if(isLoaded(popUp)){finalInit();}else{pollConsoleWindow(popUpLoadedTest,100,finalInit,"PopUpAppender.init: unable to create console window");}}}else{isSupported=false;logLog.warn("PopUpAppender.init: pop-ups blocked, please unblock to use PopUpAppender");if(complainAboutPopUpBlocking){handleError("log4javascript: pop-up windows appear to be blocked. Please unblock them to use pop-up logging.");}}}catch(ex){handleError("PopUpAppender.init: error creating pop-up",ex);}};createWindow=function(){if(!initiallyMinimized){open();}};init=function(){createWindow();initialized=true;};getConsoleWindow=function(){return popUp;};safeToAppend=function(){if(isSupported&&!isUndefined(popUp)&&!consoleClosed){if(popUp.closed||(consoleWindowLoaded&&isUndefined(popUp.closed))){appender.unload();logLog.debug("PopUpAppender: pop-up closed");return false;} if(!consoleWindowLoaded&&isLoaded(popUp)){consoleWindowLoaded=true;}} return isSupported&&consoleWindowLoaded&&!consoleClosed;};} this.getConsoleWindow=getConsoleWindow;};ConsoleAppender.addGlobalCommandLineFunction=function(functionName,commandLineFunction){defaultCommandLineFunctions.push([functionName,commandLineFunction]);};function PopUpAppender(lazyInit,initiallyMinimized,useDocumentWrite,width,height){this.create(false,null,lazyInit,initiallyMinimized,useDocumentWrite,width,height,this.defaults.focusPopUp);} PopUpAppender.prototype=new ConsoleAppender();PopUpAppender.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),initiallyMinimized:false,focusPopUp:false,lazyInit:true,useOldPopUp:true,complainAboutPopUpBlocking:true,newestMessageAtTop:false,scrollToLatestMessage:true,width:"600",height:"400",reopenWhenClosed:false,maxMessages:null,showCommandLine:true,commandLineObjectExpansionDepth:1,showHideButton:false,showCloseButton:true,useDocumentWrite:true};PopUpAppender.prototype.toString=function(){return"PopUpAppender";};log4javascript.PopUpAppender=PopUpAppender;function InPageAppender(container,lazyInit,initiallyMinimized,useDocumentWrite,width,height){this.create(true,container,lazyInit,initiallyMinimized,useDocumentWrite,width,height,false);} InPageAppender.prototype=new ConsoleAppender();InPageAppender.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),initiallyMinimized:false,lazyInit:true,newestMessageAtTop:false,scrollToLatestMessage:true,width:"100%",height:"220px",maxMessages:null,showCommandLine:true,commandLineObjectExpansionDepth:1,showHideButton:false,showCloseButton:false,showLogEntryDeleteButtons:true,useDocumentWrite:true};InPageAppender.prototype.toString=function(){return"InPageAppender";};log4javascript.InPageAppender=InPageAppender;log4javascript.InlineAppender=InPageAppender;})();function padWithSpaces(str,len){if(str.length]*>","i");if(regex.test(el.outerHTML)){return RegExp.$1.toLowerCase();}} return"";} var lt="<";var gt=">";var i,len;if(includeRootNode&&rootNode.nodeType!=nodeTypes.DOCUMENT_FRAGMENT_NODE){switch(rootNode.nodeType){case nodeTypes.ELEMENT_NODE:var tagName=rootNode.tagName.toLowerCase();xhtml=startNewLine?newLine+indentation:"";xhtml+=lt;var prefix=getNamespace(rootNode);var hasPrefix=!!prefix;if(hasPrefix){xhtml+=prefix+":";} xhtml+=tagName;for(i=0,len=rootNode.attributes.length;i"+newLine;case nodeTypes.DOCUMENT_NODE:xhtml="";for(i=0,len=rootNode.childNodes.length;i -1 && length <= maxSafeInteger) { while (++index < length) { callback(object[index], index, object); } } else { forOwn(object, callback); } } /** * Trim and conditionally capitalize string values. * * @private * @param {string} string The string to format. * @returns {string} The formatted string. */ function format(string) { string = trim(string); return /^(?:webOS|i(?:OS|P))/.test(string) ? string : capitalize(string); } /** * Iterates over an object's own properties, executing the `callback` for each. * * @private * @param {Object} object The object to iterate over. * @param {Function} callback The function executed per own property. */ function forOwn(object, callback) { for (var key in object) { if (hasOwnProperty.call(object, key)) { callback(object[key], key, object); } } } /** * Gets the internal `[[Class]]` of a value. * * @private * @param {*} value The value. * @returns {string} The `[[Class]]`. */ function getClassOf(value) { return value == null ? capitalize(value) : toString.call(value).slice(8, -1); } /** * Host objects can return type values that are different from their actual * data type. The objects we are concerned with usually return non-primitive * types of "object", "function", or "unknown". * * @private * @param {*} object The owner of the property. * @param {string} property The property to check. * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`. */ function isHostType(object, property) { var type = object != null ? typeof object[property] : 'number'; return !/^(?:boolean|number|string|undefined)$/.test(type) && (type == 'object' ? !!object[property] : true); } /** * Prepares a string for use in a `RegExp` by making hyphens and spaces optional. * * @private * @param {string} string The string to qualify. * @returns {string} The qualified string. */ function qualify(string) { return String(string).replace(/([ -])(?!$)/g, '$1?'); } /** * A bare-bones `Array#reduce` like utility function. * * @private * @param {Array} array The array to iterate over. * @param {Function} callback The function called per iteration. * @returns {*} The accumulated result. */ function reduce(array, callback) { var accumulator = null; each(array, function(value, index) { accumulator = callback(accumulator, value, index, array); }); return accumulator; } /** * Removes leading and trailing whitespace from a string. * * @private * @param {string} string The string to trim. * @returns {string} The trimmed string. */ function trim(string) { return String(string).replace(/^ +| +$/g, ''); } /*--------------------------------------------------------------------------*/ /** * Creates a new platform object. * * @memberOf platform * @param {Object|string} [ua=navigator.userAgent] The user agent string or * context object. * @returns {Object} A platform object. */ function parse(ua) { /** The environment context object. */ var context = root; /** Used to flag when a custom context is provided. */ var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String'; // Juggle arguments. if (isCustomContext) { context = ua; ua = null; } /** Browser navigator object. */ var nav = context.navigator || {}; /** Browser user agent string. */ var userAgent = nav.userAgent || ''; ua || (ua = userAgent); /** Used to flag when `thisBinding` is the [ModuleScope]. */ var isModuleScope = isCustomContext || thisBinding == oldRoot; /** Used to detect if browser is like Chrome. */ var likeChrome = isCustomContext ? !!nav.likeChrome : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString()); /** Internal `[[Class]]` value shortcuts. */ var objectClass = 'Object', airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject', enviroClass = isCustomContext ? objectClass : 'Environment', javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java), phantomClass = isCustomContext ? objectClass : 'RuntimeObject'; /** Detect Java environments. */ var java = /\bJava/.test(javaClass) && context.java; /** Detect Rhino. */ var rhino = java && getClassOf(context.environment) == enviroClass; /** A character to represent alpha. */ var alpha = java ? 'a' : '\u03b1'; /** A character to represent beta. */ var beta = java ? 'b' : '\u03b2'; /** Browser document object. */ var doc = context.document || {}; /** * Detect Opera browser (Presto-based). * http://www.howtocreate.co.uk/operaStuff/operaObject.html * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini */ var opera = context.operamini || context.opera; /** Opera `[[Class]]`. */ var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera)) ? operaClass : (opera = null); /*------------------------------------------------------------------------*/ /** Temporary variable used over the script's lifetime. */ var data; /** The CPU architecture. */ var arch = ua; /** Platform description array. */ var description = []; /** Platform alpha/beta indicator. */ var prerelease = null; /** A flag to indicate that environment features should be used to resolve the platform. */ var useFeatures = ua == userAgent; /** The browser/environment version. */ var version = useFeatures && opera && typeof opera.version == 'function' && opera.version(); /** A flag to indicate if the OS ends with "/ Version" */ var isSpecialCasedOS; /* Detectable layout engines (order is important). */ var layout = getLayout([ { 'label': 'EdgeHTML', 'pattern': 'Edge' }, 'Trident', { 'label': 'WebKit', 'pattern': 'AppleWebKit' }, 'iCab', 'Presto', 'NetFront', 'Tasman', 'KHTML', 'Gecko' ]); /* Detectable browser names (order is important). */ var name = getName([ 'Adobe AIR', 'Arora', 'Avant Browser', 'Breach', 'Camino', 'Electron', 'Epiphany', 'Fennec', 'Flock', 'Galeon', 'GreenBrowser', 'iCab', 'Iceweasel', 'K-Meleon', 'Konqueror', 'Lunascape', 'Maxthon', { 'label': 'Microsoft Edge', 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)' }, 'Midori', 'Nook Browser', 'PaleMoon', 'PhantomJS', 'Raven', 'Rekonq', 'RockMelt', { 'label': 'Samsung Internet', 'pattern': 'SamsungBrowser' }, 'SeaMonkey', { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' }, 'Sleipnir', 'SlimBrowser', { 'label': 'SRWare Iron', 'pattern': 'Iron' }, 'Sunrise', 'Swiftfox', 'Vivaldi', 'Waterfox', 'WebPositive', { 'label': 'Yandex Browser', 'pattern': 'YaBrowser' }, { 'label': 'UC Browser', 'pattern': 'UCBrowser' }, 'Opera Mini', { 'label': 'Opera Mini', 'pattern': 'OPiOS' }, 'Opera', { 'label': 'Opera', 'pattern': 'OPR' }, 'Chromium', 'Chrome', { 'label': 'Chrome', 'pattern': '(?:HeadlessChrome)' }, { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' }, { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' }, { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' }, { 'label': 'IE', 'pattern': 'IEMobile' }, { 'label': 'IE', 'pattern': 'MSIE' }, 'Safari' ]); /* Detectable products (order is important). */ var product = getProduct([ { 'label': 'BlackBerry', 'pattern': 'BB10' }, 'BlackBerry', { 'label': 'Galaxy S', 'pattern': 'GT-I9000' }, { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' }, { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' }, { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' }, { 'label': 'Galaxy S5', 'pattern': 'SM-G900' }, { 'label': 'Galaxy S6', 'pattern': 'SM-G920' }, { 'label': 'Galaxy S6 Edge', 'pattern': 'SM-G925' }, { 'label': 'Galaxy S7', 'pattern': 'SM-G930' }, { 'label': 'Galaxy S7 Edge', 'pattern': 'SM-G935' }, 'Google TV', 'Lumia', 'iPad', 'iPod', 'iPhone', 'Kindle', { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' }, 'Nexus', 'Nook', 'PlayBook', 'PlayStation Vita', 'PlayStation', 'TouchPad', 'Transformer', { 'label': 'Wii U', 'pattern': 'WiiU' }, 'Wii', 'Xbox One', { 'label': 'Xbox 360', 'pattern': 'Xbox' }, 'Xoom' ]); /* Detectable manufacturers. */ var manufacturer = getManufacturer({ 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 }, 'Alcatel': {}, 'Archos': {}, 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 }, 'Asus': { 'Transformer': 1 }, 'Barnes & Noble': { 'Nook': 1 }, 'BlackBerry': { 'PlayBook': 1 }, 'Google': { 'Google TV': 1, 'Nexus': 1 }, 'HP': { 'TouchPad': 1 }, 'HTC': {}, 'Huawei': {}, 'Lenovo': {}, 'LG': {}, 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 }, 'Motorola': { 'Xoom': 1 }, 'Nintendo': { 'Wii U': 1, 'Wii': 1 }, 'Nokia': { 'Lumia': 1 }, 'Oppo': {}, 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 }, 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 }, 'Xiaomi': { 'Mi': 1, 'Redmi': 1 } }); /* Detectable operating systems (order is important). */ var os = getOS([ 'Windows Phone', 'KaiOS', 'Android', 'CentOS', { 'label': 'Chrome OS', 'pattern': 'CrOS' }, 'Debian', { 'label': 'DragonFly BSD', 'pattern': 'DragonFly' }, 'Fedora', 'FreeBSD', 'Gentoo', 'Haiku', 'Kubuntu', 'Linux Mint', 'OpenBSD', 'Red Hat', 'SuSE', 'Ubuntu', 'Xubuntu', 'Cygwin', 'Symbian OS', 'hpwOS', 'webOS ', 'webOS', 'Tablet OS', 'Tizen', 'Linux', 'Mac OS X', 'Macintosh', 'Mac', 'Windows 98;', 'Windows ' ]); /*------------------------------------------------------------------------*/ /** * Picks the layout engine from an array of guesses. * * @private * @param {Array} guesses An array of guesses. * @returns {null|string} The detected layout engine. */ function getLayout(guesses) { return reduce(guesses, function(result, guess) { return result || RegExp('\\b' + ( guess.pattern || qualify(guess) ) + '\\b', 'i').exec(ua) && (guess.label || guess); }); } /** * Picks the manufacturer from an array of guesses. * * @private * @param {Array} guesses An object of guesses. * @returns {null|string} The detected manufacturer. */ function getManufacturer(guesses) { return reduce(guesses, function(result, value, key) { // Lookup the manufacturer by product or scan the UA for the manufacturer. return result || ( value[product] || value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] || RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua) ) && key; }); } /** * Picks the browser name from an array of guesses. * * @private * @param {Array} guesses An array of guesses. * @returns {null|string} The detected browser name. */ function getName(guesses) { return reduce(guesses, function(result, guess) { return result || RegExp('\\b' + ( guess.pattern || qualify(guess) ) + '\\b', 'i').exec(ua) && (guess.label || guess); }); } /** * Picks the OS name from an array of guesses. * * @private * @param {Array} guesses An array of guesses. * @returns {null|string} The detected OS name. */ function getOS(guesses) { return reduce(guesses, function(result, guess) { var pattern = guess.pattern || qualify(guess); if (!result && (result = RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua) )) { result = cleanupOS(result, pattern, guess.label || guess); } return result; }); } /** * Picks the product name from an array of guesses. * * @private * @param {Array} guesses An array of guesses. * @returns {null|string} The detected product name. */ function getProduct(guesses) { return reduce(guesses, function(result, guess) { var pattern = guess.pattern || qualify(guess); if (!result && (result = RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) || RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) || RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua) )) { // Split by forward slash and append product version if needed. if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) { result[0] += ' ' + result[1]; } // Correct character case and cleanup string. guess = guess.label || guess; result = format(result[0] .replace(RegExp(pattern, 'i'), guess) .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ') .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2')); } return result; }); } /** * Resolves the version using an array of UA patterns. * * @private * @param {Array} patterns An array of UA patterns. * @returns {null|string} The detected version. */ function getVersion(patterns) { return reduce(patterns, function(result, pattern) { return result || (RegExp(pattern + '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null; }); } /** * Returns `platform.description` when the platform object is coerced to a string. * * @name toString * @memberOf platform * @returns {string} Returns `platform.description` if available, else an empty string. */ function toStringPlatform() { return this.description || ''; } /*------------------------------------------------------------------------*/ // Convert layout to an array so we can add extra details. layout && (layout = [layout]); // Detect Android products. // Browsers on Android devices typically provide their product IDS after "Android;" // up to "Build" or ") AppleWebKit". // Example: // "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36 // (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36" if (/\bAndroid\b/.test(os) && !product && (data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) { product = trim(data[1]) // Replace any language codes (eg. "en-US"). .replace(/^[a-z]{2}-[a-z]{2};\s*/i, '') || null; } // Detect product names that contain their manufacturer's name. if (manufacturer && !product) { product = getProduct([manufacturer]); } else if (manufacturer && product) { product = product .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ') .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2'); } // Clean up Google TV. if ((data = /\bGoogle TV\b/.exec(product))) { product = data[0]; } // Detect simulators. if (/\bSimulator\b/i.test(ua)) { product = (product ? product + ' ' : '') + 'Simulator'; } // Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS. if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) { description.push('running in Turbo/Uncompressed mode'); } // Detect IE Mobile 11. if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) { data = parse(ua.replace(/like iPhone OS/, '')); manufacturer = data.manufacturer; product = data.product; } // Detect iOS. else if (/^iP/.test(product)) { name || (name = 'Safari'); os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua)) ? ' ' + data[1].replace(/_/g, '.') : ''); } // Detect Kubuntu. else if (name == 'Konqueror' && /^Linux\b/i.test(os)) { os = 'Kubuntu'; } // Detect Android browsers. else if ((manufacturer && manufacturer != 'Google' && ((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) || (/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) { name = 'Android Browser'; os = /\bAndroid\b/.test(os) ? os : 'Android'; } // Detect Silk desktop/accelerated modes. else if (name == 'Silk') { if (!/\bMobi/i.test(ua)) { os = 'Android'; description.unshift('desktop mode'); } if (/Accelerated *= *true/i.test(ua)) { description.unshift('accelerated'); } } // Detect UC Browser speed mode. else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) { description.push('speed mode'); } // Detect PaleMoon identifying as Firefox. else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) { description.push('identifying as Firefox ' + data[1]); } // Detect Firefox OS and products running Firefox. else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) { os || (os = 'Firefox OS'); product || (product = data[1]); } // Detect false positives for Firefox/Safari. else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) { // Escape the `/` for Firefox 1. if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) { // Clear name of false positives. name = null; } // Reassign a generic name. if ((data = product || manufacturer || os) && (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) { name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser'; } } // Add Chrome version to description for Electron. else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) { description.push('Chromium ' + data); } // Detect non-Opera (Presto-based) versions (order is important). if (!version) { version = getVersion([ '(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)', 'Version', qualify(name), '(?:Firefox|Minefield|NetFront)' ]); } // Detect stubborn layout engines. if ((data = layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' || /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') || /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' || !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') || layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront' )) { layout = [data]; } // Detect Windows Phone 7 desktop mode. if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) { name += ' Mobile'; os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x'); description.unshift('desktop mode'); } // Detect Windows Phone 8.x desktop mode. else if (/\bWPDesktop\b/i.test(ua)) { name = 'IE Mobile'; os = 'Windows Phone 8.x'; description.unshift('desktop mode'); version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]); } // Detect IE 11 identifying as other browsers. else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) { if (name) { description.push('identifying as ' + name + (version ? ' ' + version : '')); } name = 'IE'; version = data[1]; } // Leverage environment features. if (useFeatures) { // Detect server-side environments. // Rhino has a global function while others have a global object. if (isHostType(context, 'global')) { if (java) { data = java.lang.System; arch = data.getProperty('os.arch'); os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version'); } if (rhino) { try { version = context.require('ringo/engine').version.join('.'); name = 'RingoJS'; } catch(e) { if ((data = context.system) && data.global.system == context.system) { name = 'Narwhal'; os || (os = data[0].os || null); } } if (!name) { name = 'Rhino'; } } else if ( typeof context.process == 'object' && !context.process.browser && (data = context.process) ) { if (typeof data.versions == 'object') { if (typeof data.versions.electron == 'string') { description.push('Node ' + data.versions.node); name = 'Electron'; version = data.versions.electron; } else if (typeof data.versions.nw == 'string') { description.push('Chromium ' + version, 'Node ' + data.versions.node); name = 'NW.js'; version = data.versions.nw; } } if (!name) { name = 'Node.js'; arch = data.arch; os = data.platform; version = /[\d.]+/.exec(data.version); version = version ? version[0] : null; } } } // Detect Adobe AIR. else if (getClassOf((data = context.runtime)) == airRuntimeClass) { name = 'Adobe AIR'; os = data.flash.system.Capabilities.os; } // Detect PhantomJS. else if (getClassOf((data = context.phantom)) == phantomClass) { name = 'PhantomJS'; version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch); } // Detect IE compatibility modes. else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) { // We're in compatibility mode when the Trident version + 4 doesn't // equal the document mode. version = [version, doc.documentMode]; if ((data = +data[1] + 4) != version[1]) { description.push('IE ' + version[1] + ' mode'); layout && (layout[1] = ''); version[1] = data; } version = name == 'IE' ? String(version[1].toFixed(1)) : version[0]; } // Detect IE 11 masking as other browsers. else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) { description.push('masking as ' + name + ' ' + version); name = 'IE'; version = '11.0'; layout = ['Trident']; os = 'Windows'; } os = os && format(os); } // Detect prerelease phases. if (version && (data = /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) || /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) || /\bMinefield\b/i.test(ua) && 'a' )) { prerelease = /b/i.test(data) ? 'beta' : 'alpha'; version = version.replace(RegExp(data + '\\+?$'), '') + (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || ''); } // Detect Firefox Mobile. if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) { name = 'Firefox Mobile'; } // Obscure Maxthon's unreliable version. else if (name == 'Maxthon' && version) { version = version.replace(/\.[\d.]+/, '.x'); } // Detect Xbox 360 and Xbox One. else if (/\bXbox\b/i.test(product)) { if (product == 'Xbox 360') { os = null; } if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) { description.unshift('mobile mode'); } } // Add mobile postfix. else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) && (os == 'Windows CE' || /Mobi/i.test(ua))) { name += ' Mobile'; } // Detect IE platform preview. else if (name == 'IE' && useFeatures) { try { if (context.external === null) { description.unshift('platform preview'); } } catch(e) { description.unshift('embedded'); } } // Detect BlackBerry OS version. // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data = (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] || version )) { data = [data, /BB10/.test(ua)]; os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0]; version = null; } // Detect Opera identifying/masking itself as another browser. // http://www.opera.com/support/kb/view/843/ else if (this != forOwn && product != 'Wii' && ( (useFeatures && opera) || (/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) || (name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) || (name == 'IE' && ( (os && !/^Win/.test(os) && version > 5.5) || /\bWindows XP\b/.test(os) && version > 8 || version == 8 && !/\bTrident\b/.test(ua) )) ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) { // When "identifying", the UA contains both Opera and the other browser's name. data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : ''); if (reOpera.test(name)) { if (/\bIE\b/.test(data) && os == 'Mac OS') { os = null; } data = 'identify' + data; } // When "masking", the UA contains only the other browser's name. else { data = 'mask' + data; if (operaClass) { name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2')); } else { name = 'Opera'; } if (/\bIE\b/.test(data)) { os = null; } if (!useFeatures) { version = null; } } layout = ['Presto']; description.push(data); } // Detect WebKit Nightly and approximate Chrome/Safari versions. if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) { // Correct build number for numeric comparison. // (e.g. "532.5" becomes "532.05") data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data]; // Nightly builds are postfixed with a "+". if (name == 'Safari' && data[1].slice(-1) == '+') { name = 'WebKit Nightly'; prerelease = 'alpha'; version = data[1].slice(0, -1); } // Clear incorrect browser versions. else if (version == data[1] || version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) { version = null; } // Use the full Chrome version when available. data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1]; // Detect Blink layout engine. if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') { layout = ['Blink']; } // Detect JavaScriptCore. // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi if (!useFeatures || (!likeChrome && !data[1])) { layout && (layout[1] = 'like Safari'); data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : data < 602 ? 9 : data < 604 ? 10 : data < 606 ? 11 : data < 608 ? 12 : '12'); } else { layout && (layout[1] = 'like Chrome'); data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28'); } // Add the postfix of ".x" or "+" for approximate versions. layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+')); // Obscure version for some Safari 1-2 releases. if (name == 'Safari' && (!version || parseInt(version) > 45)) { version = data; } else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) { description.unshift('headless'); } } // Detect Opera desktop modes. if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) { name += ' '; description.unshift('desktop mode'); if (data == 'zvav') { name += 'Mini'; version = null; } else { name += 'Mobile'; } os = os.replace(RegExp(' *' + data + '$'), ''); } // Detect Chrome desktop mode. else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) { description.unshift('desktop mode'); name = 'Chrome Mobile'; version = null; if (/\bOS X\b/.test(os)) { manufacturer = 'Apple'; os = 'iOS 4.3+'; } else { os = null; } } // Newer versions of SRWare Iron uses the Chrome tag to indicate its version number. else if (/\bSRWare Iron\b/.test(name) && !version) { version = getVersion('Chrome'); } // Strip incorrect OS versions. if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 && ua.indexOf('/' + data + '-') > -1) { os = trim(os.replace(data, '')); } // Ensure OS does not include the browser name. if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) { os = os.replace(RegExp(' *' + qualify(name) + ' *'), ''); } // Add layout engine. if (layout && !/\b(?:Avant|Nook)\b/.test(name) && ( /Browser|Lunascape|Maxthon/.test(name) || name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) || /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) { // Don't add layout details to description if they are falsey. (data = layout[layout.length - 1]) && description.push(data); } // Combine contextual information. if (description.length) { description = ['(' + description.join('; ') + ')']; } // Append manufacturer to description. if (manufacturer && product && product.indexOf(manufacturer) < 0) { description.push('on ' + manufacturer); } // Append product to description. if (product) { description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product); } // Parse the OS into an object. if (os) { data = / ([\d.+]+)$/.exec(os); isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/'; os = { 'architecture': 32, 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os, 'version': data ? data[1] : null, 'toString': function() { var version = this.version; return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : ''); } }; } // Add browser/OS architecture. if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) { if (os) { os.architecture = 64; os.family = os.family.replace(RegExp(' *' + data), ''); } if ( name && (/\bWOW64\b/i.test(ua) || (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua))) ) { description.unshift('32-bit'); } } // Chrome 39 and above on OS X is always 64-bit. else if ( os && /^OS X/.test(os.family) && name == 'Chrome' && parseFloat(version) >= 39 ) { os.architecture = 64; } ua || (ua = null); /*------------------------------------------------------------------------*/ /** * The platform object. * * @name platform * @type Object */ var platform = {}; /** * The platform description. * * @memberOf platform * @type string|null */ platform.description = ua; /** * The name of the browser's layout engine. * * The list of common layout engines include: * "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit" * * @memberOf platform * @type string|null */ platform.layout = layout && layout[0]; /** * The name of the product's manufacturer. * * The list of manufacturers include: * "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry", * "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo", * "Nokia", "Samsung" and "Sony" * * @memberOf platform * @type string|null */ platform.manufacturer = manufacturer; /** * The name of the browser/environment. * * The list of common browser names include: * "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE", * "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk", * "Opera Mini" and "Opera" * * Mobile versions of some browsers have "Mobile" appended to their name: * eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile" * * @memberOf platform * @type string|null */ platform.name = name; /** * The alpha/beta release indicator. * * @memberOf platform * @type string|null */ platform.prerelease = prerelease; /** * The name of the product hosting the browser. * * The list of common products include: * * "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle", * "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer" * * @memberOf platform * @type string|null */ platform.product = product; /** * The browser's user agent string. * * @memberOf platform * @type string|null */ platform.ua = ua; /** * The browser/environment version. * * @memberOf platform * @type string|null */ platform.version = name && version; /** * The name of the operating system. * * @memberOf platform * @type Object */ platform.os = os || { /** * The CPU architecture the OS is built for. * * @memberOf platform.os * @type number|null */ 'architecture': null, /** * The family of the OS. * * Common values include: * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista", * "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat", * "SuSE", "Android", "iOS" and "Windows Phone" * * @memberOf platform.os * @type string|null */ 'family': null, /** * The version of the OS. * * @memberOf platform.os * @type string|null */ 'version': null, /** * Returns the OS string. * * @memberOf platform.os * @returns {string} The OS string. */ 'toString': function() { return 'null'; } }; platform.parse = parse; platform.toString = toStringPlatform; if (platform.version) { description.unshift(version); } if (platform.name) { description.unshift(name); } if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) { description.push(product ? '(' + os + ')' : 'on ' + os); } if (description.length) { platform.description = description.join(' '); } return platform; } /*--------------------------------------------------------------------------*/ // Export platform. var platform = parse(); // Some AMD build optimizers, like r.js, check for condition patterns like the following: if (true) { // Expose platform on the global object to prevent errors when platform is // loaded by a script tag in the presence of an AMD loader. // See http://requirejs.org/docs/errors.html#mismatch for more details. root.platform = platform; // Define as an anonymous module so platform can be aliased through path mapping. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return platform; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } // Check for `exports` after `define` in case a build optimizer adds an `exports` object. else {} }.call(this)); /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ id: moduleId, /******/ loaded: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/global */ /******/ (() => { /******/ __webpack_require__.g = (function() { /******/ if (typeof globalThis === 'object') return globalThis; /******/ try { /******/ return this || new Function('return this')(); /******/ } catch (e) { /******/ if (typeof window === 'object') return window; /******/ } /******/ })(); /******/ })(); /******/ /******/ /* webpack/runtime/node module decorator */ /******/ (() => { /******/ __webpack_require__.nmd = (module) => { /******/ module.paths = []; /******/ if (!module.children) module.children = []; /******/ return module; /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /* # ----------------------------------------------------------------------------- # ~/src/template.js # J1 Template Javascript Core library # # Product/Info: # https://jekyll.one # # Copyright (C) 2022 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint-disable no-unused-vars */ /* global window */ // ----------------------------------------------------------------------------- // Import SASS sources for HMR // ----------------------------------------------------------------------------- // import '../100_template_css/scss/theme_uno/components/_footer.scss'; // import '../100_template_css/theme_uno.css'; // <-- yes, also require (s)css. This is a Webpack thing // Core Libraries - imported|required from NODE|NPM modules // ----------------------------------------------------------------------------- // // Following objects (framework modules) are *conditionaly* forced to be // exposed for run-time to the global namespace (window) by WP config // file (expose-loader): // jQuery // Popper ('popper.js/dist/umd/popper', https://github.com/twbs/bootstrap/issues/23381) // ----------------------------------------------------------------------------- // Core Utilities (moved to modules) // ----------------------------------------------------------------------------- // Following objects (native node modules) are *explicitely* forced to be // exposed for run-time to the global namespace (window). // ----------------------------------------------------------------------------- window.Cookies = __webpack_require__(808); window.yaml = __webpack_require__(320); window.log4javascript = __webpack_require__(979); window.liteURL = __webpack_require__(578); window.platform = __webpack_require__(727); // Core Libraries - build|required from SOURCE // ----------------------------------------------------------------------------- // Following source objects|modules are *explicitely* forced to be // exposed for run-time to the global namespace (window). // ----------------------------------------------------------------------------- window.j1.adapter = __webpack_require__(476); window.j1.anime = __webpack_require__(921); // added for fam window.j1.core = __webpack_require__(602); window.j1.core.navigator = __webpack_require__(490); window.j1.core.asciidoctor = __webpack_require__(977); window.j1.core.scrollSmooth = __webpack_require__(814); // window.deeplTranslator = require('./js/deepl-translator'); // J1 Module deeplAPI used instead // window.j1.fam = require('./js/fam/fam.js'); // cannot used until NOT rewritten to jQuery // Following source objects|modules are *implicetly* forced to be // exposed for run-time to the global namespace (window). // ----------------------------------------------------------------------------- //const Bootstrap = require('./js/bootstrap/bootstrap.js'); //const J1JekyllSearch = require('./js/jekyll_search/jekyll_search.js'); //const J1Yaml = require('js-yaml'); var J1Tocbot = __webpack_require__(799); var J1AttrChangeListener = __webpack_require__(610); //const J1ThemeSwitcher = require('./js/bs_theme_switcher/switcher.js'); // const J1MmenuLight = require('./js/mmenu-light/mmenu.js'); // Passing log data over Internet|SeeMe (currently NOT used) // ----------------------------------------------------------------------------- // window.j1.core.log4javascript = require('./js/logger/client/webhook.js'); // BMD Libraries (moved to modules) // ----------------------------------------------------------------------------- // window.bootstrapMaterialDesign = require('./js/bmd/js/bmd.js'); // Github Webhooks (currently NOT used) // ----------------------------------------------------------------------------- // window.j1.core.webhooks = require('./js/webhooks/octokit/client.js'); // Test|Custom modules (currently NOT used) // ----------------------------------------------------------------------------- // window.j1promiseTest = require('./js/custom/test_promises.js'); // window.j1Example = require('./js/custom/example_module.js'); // BS Libraries (moved to modules) // ----------------------------------------------------------------------------- // Following source objects|modules are *implicetly* forced to be // exposed for run-time to the global namespace (window). // ----------------------------------------------------------------------------- // const Bootstrap = require('./js/bootstrap/bootstrap.js'); // const J1JekyllSearch = require('./js/jekyll_search/jekyll_search.js'); // Buffer Kack // const J1Tocbot = require('./js/tocbot/tocbot.js'); // Backstretch (moved to modules) // ----------------------------------------------------------------------------- // Following source objects|modules are *implicetly* forced to be // exposed for run-time to the namespace of jQuery ($). // ----------------------------------------------------------------------------- // const J1Attics = require('./js/backstretch/backstretch.js'); // Additional Vanilla JS helpers // ----------------------------------------------------------------------------- var J1AdocResultViewer = __webpack_require__(253); // const MSIEPolyfills = require('./js/polyfills/ms-ie.js'); // HMR messages (currently NOT used) // ----------------------------------------------------------------------------- // if (module.hot) { // var logtext; // var stat; // var stat=module.hot.status(); // // logtext='[INFO ] [HMR ] [Hot Module Replacement enabled]'; // console.log(logtext); // logtext='[INFO ] [HMR ] [Status: ' + stat + ']'; // console.log(logtext); // // module.hot.accept('./template.js', function() { // console.log('[HMR] Accepting the updated template.js module!'); // }); // // module.hot.accept('../100_template_css/theme_uno.scss', function () { // console.log('[HMR] Accepting the updated style.css module!'); // require('../100_template_css/theme_uno.scss') // }) // // React to the current status... // module.hot.addStatusHandler(status => { // stat=module.hot.status(); // logtext='[INFO ] [HMR ] [Status: ' + stat + ']'; // console.log(logtext); // }); //} // ----------------------------------------------------------------------------- // END })(); /******/ })() ;