' +
- * hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +
- * '
';
- * } catch (__) {}
- * }
- *
- * return '' + md.utils.escapeHtml(str) + '
';
- * }
- * });
- * ```
- *
- **/
-function MarkdownIt(presetName, options) {
- if (!(this instanceof MarkdownIt)) {
- return new MarkdownIt(presetName, options);
+const pointFromVector = (origin, angle, distance) => {
+ angle = degreesToRadians(angle);
+ return {
+ x: distance * Math.cos(angle) + origin.x,
+ y: distance * Math.sin(angle) + origin.y
+ };
+};
+const toDecimal = function (num) {
+ let precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
+ precision = Math.pow(10, precision);
+ return Math.round(num * precision) / precision;
+};
+const smoothFrame = function (prevValue, nextValue, duration) {
+ let smoothing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
+ return toDecimal(prevValue + duration * (nextValue - prevValue) / Math.max(smoothing, duration));
+};
+const smooth = function () {
+ let strength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 50;
+ let previousValue = 0;
+ let lastUpdated = 0;
+ return v => {
+ const currentFramestamp = sync.getFrameData().timestamp;
+ const timeDelta = currentFramestamp !== lastUpdated ? currentFramestamp - lastUpdated : 0;
+ const newValue = timeDelta ? smoothFrame(previousValue, v, timeDelta, strength) : previousValue;
+ lastUpdated = currentFramestamp;
+ previousValue = newValue;
+ return newValue;
+ };
+};
+const snap = points => {
+ if (typeof points === 'number') {
+ return v => Math.round(v / points) * points;
+ } else {
+ let i = 0;
+ const numPoints = points.length;
+ return v => {
+ let lastDistance = Math.abs(points[0] - v);
+ for (i = 1; i < numPoints; i++) {
+ const point = points[i];
+ const distance = Math.abs(point - v);
+ if (distance === 0) return point;
+ if (distance > lastDistance) return points[i - 1];
+ if (i === numPoints - 1) return point;
+ lastDistance = distance;
+ }
+ };
}
- if (!options) {
- if (!utils.isString(presetName)) {
- options = presetName || {};
- presetName = 'default';
+};
+function velocityPerFrame(xps, frameDuration) {
+ return xps / (1000 / frameDuration);
+}
+const wrap = (min, max, v) => {
+ const rangeSize = max - min;
+ return ((v - min) % rangeSize + rangeSize) % rangeSize + min;
+};
+const a = (a1, a2) => 1.0 - 3.0 * a2 + 3.0 * a1;
+const b = (a1, a2) => 3.0 * a2 - 6.0 * a1;
+const c = a1 => 3.0 * a1;
+const calcBezier = (t, a1, a2) => ((a(a1, a2) * t + b(a1, a2)) * t + c(a1)) * t;
+const getSlope = (t, a1, a2) => 3.0 * a(a1, a2) * t * t + 2.0 * b(a1, a2) * t + c(a1);
+const subdivisionPrecision = 0.0000001;
+const subdivisionMaxIterations = 10;
+function binarySubdivide(aX, aA, aB, mX1, mX2) {
+ let currentX;
+ let currentT;
+ let 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) > subdivisionPrecision && ++i < subdivisionMaxIterations);
+ return currentT;
+}
+const newtonIterations = 8;
+const newtonMinSlope = 0.001;
+function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
+ for (let i = 0; i < newtonIterations; ++i) {
+ const currentSlope = getSlope(aGuessT, mX1, mX2);
+ if (currentSlope === 0.0) {
+ return aGuessT;
+ }
+ const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
+ aGuessT -= currentX / currentSlope;
+ }
+ return aGuessT;
+}
+const kSplineTableSize = 11;
+const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
+function cubicBezier(mX1, mY1, mX2, mY2) {
+ if (mX1 === mY1 && mX2 === mY2) return linear;
+ const sampleValues = new Float32Array(kSplineTableSize);
+ for (let i = 0; i < kSplineTableSize; ++i) {
+ sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
+ }
+ function getTForX(aX) {
+ let intervalStart = 0.0;
+ let currentSample = 1;
+ const lastSample = kSplineTableSize - 1;
+ for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
+ intervalStart += kSampleStepSize;
+ }
+ --currentSample;
+ const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
+ const guessForT = intervalStart + dist * kSampleStepSize;
+ const initialSlope = getSlope(guessForT, mX1, mX2);
+ if (initialSlope >= newtonMinSlope) {
+ return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
+ } else if (initialSlope === 0.0) {
+ return guessForT;
+ } else {
+ return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
}
}
+ return t => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
+}
+const steps = function (steps) {
+ let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'end';
+ return progress => {
+ progress = direction === 'end' ? Math.min(progress, 0.999) : Math.max(progress, 0.001);
+ const expanded = progress * steps;
+ const rounded = direction === 'end' ? Math.floor(expanded) : Math.ceil(expanded);
+ return clamp(0, 1, rounded / steps);
+ };
+};
+exports.angle = angle;
+exports.animate = animate;
+exports.anticipate = anticipate;
+exports.applyOffset = applyOffset;
+exports.attract = attract;
+exports.attractExpo = attractExpo;
+exports.backIn = backIn;
+exports.backInOut = backInOut;
+exports.backOut = backOut;
+exports.bounceIn = bounceIn;
+exports.bounceInOut = bounceInOut;
+exports.bounceOut = bounceOut;
+exports.circIn = circIn;
+exports.circInOut = circInOut;
+exports.circOut = circOut;
+exports.clamp = clamp;
+exports.createAnticipate = createAnticipate;
+exports.createAttractor = createAttractor;
+exports.createBackIn = createBackIn;
+exports.createExpoIn = createExpoIn;
+exports.cubicBezier = cubicBezier;
+exports.decay = decay;
+exports.degreesToRadians = degreesToRadians;
+exports.distance = distance;
+exports.easeIn = easeIn;
+exports.easeInOut = easeInOut;
+exports.easeOut = easeOut;
+exports.inertia = inertia;
+exports.interpolate = interpolate;
+exports.isPoint = isPoint;
+exports.isPoint3D = isPoint3D;
+exports.keyframes = keyframes;
+exports.linear = linear;
+exports.mirrorEasing = mirrorEasing;
+exports.mix = mix;
+exports.mixColor = mixColor;
+exports.mixComplex = mixComplex;
+exports.pipe = pipe;
+exports.pointFromVector = pointFromVector;
+exports.progress = progress;
+exports.radiansToDegrees = radiansToDegrees;
+exports.reverseEasing = reverseEasing;
+exports.smooth = smooth;
+exports.smoothFrame = smoothFrame;
+exports.snap = snap;
+exports.spring = spring;
+exports.steps = steps;
+exports.toDecimal = toDecimal;
+exports.velocityPerFrame = velocityPerFrame;
+exports.velocityPerSecond = velocityPerSecond;
+exports.wrap = wrap;
- /**
- * MarkdownIt#inline -> ParserInline
- *
- * Instance of [[ParserInline]]. You may need it to add new rules when
- * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
- * [[MarkdownIt.enable]].
- **/
- this.inline = new ParserInline();
+/***/ }),
- /**
- * MarkdownIt#block -> ParserBlock
- *
- * Instance of [[ParserBlock]]. You may need it to add new rules when
- * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
- * [[MarkdownIt.enable]].
- **/
- this.block = new ParserBlock();
+/***/ "../../../node_modules/punycode.js/punycode.es6.js":
+/*!*********************************************************!*\
+ !*** ../../../node_modules/punycode.js/punycode.es6.js ***!
+ \*********************************************************/
+/***/ (function(__unused_webpack_module, exports) {
- /**
- * MarkdownIt#core -> Core
- *
- * Instance of [[Core]] chain executor. You may need it to add new rules when
- * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
- * [[MarkdownIt.enable]].
- **/
- this.core = new ParserCore();
- /**
- * MarkdownIt#renderer -> Renderer
- *
- * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
- * rules for new token types, generated by plugins.
- *
- * ##### Example
- *
- * ```javascript
- * var md = require('markdown-it')();
- *
- * function myToken(tokens, idx, options, env, self) {
- * //...
- * return result;
- * };
- *
- * md.renderer.rules['my_token'] = myToken
- * ```
- *
- * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
- **/
- this.renderer = new Renderer();
- /**
- * MarkdownIt#linkify -> LinkifyIt
- *
- * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
- * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)
- * rule.
- **/
- this.linkify = new LinkifyIt();
+/** Highest positive signed 32-bit float value */
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.toUnicode = exports.toASCII = exports.encode = exports["default"] = exports.decode = void 0;
+exports.ucs2decode = ucs2decode;
+exports.ucs2encode = void 0;
+const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
- /**
- * MarkdownIt#validateLink(url) -> Boolean
- *
- * Link validation function. CommonMark allows too much in links. By default
- * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
- * except some embedded image types.
- *
- * You can change this behaviour:
- *
- * ```javascript
- * var md = require('markdown-it')();
- * // enable everything
- * md.validateLink = function () { return true; }
- * ```
- **/
- this.validateLink = validateLink;
+/** Bootstring parameters */
+const base = 36;
+const tMin = 1;
+const tMax = 26;
+const skew = 38;
+const damp = 700;
+const initialBias = 72;
+const initialN = 128; // 0x80
+const delimiter = '-'; // '\x2D'
- /**
- * MarkdownIt#normalizeLink(url) -> String
- *
- * Function used to encode link url to a machine-readable format,
- * which includes url-encoding, punycode, etc.
- **/
- this.normalizeLink = normalizeLink;
+/** Regular expressions */
+const regexPunycode = /^xn--/;
+const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too.
+const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
- /**
- * MarkdownIt#normalizeLinkText(url) -> String
- *
- * Function used to decode link url to a human-readable format`
- **/
- this.normalizeLinkText = normalizeLinkText;
+/** Error messages */
+const errors = {
+ 'overflow': 'Overflow: input needs wider integers to process',
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
+ 'invalid-input': 'Invalid input'
+};
- // Expose utils & helpers for easy acces from plugins
+/** Convenience shortcuts */
+const baseMinusTMin = base - tMin;
+const floor = Math.floor;
+const stringFromCharCode = String.fromCharCode;
- /**
- * MarkdownIt#utils -> utils
- *
- * Assorted utility functions, useful to write plugins. See details
- * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).
- **/
- this.utils = utils;
+/*--------------------------------------------------------------------------*/
- /**
- * MarkdownIt#helpers -> helpers
- *
- * Link components parser functions, useful to write plugins. See details
- * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).
- **/
- this.helpers = utils.assign({}, helpers);
- this.options = {};
- this.configure(presetName);
- if (options) {
- this.set(options);
- }
+/**
+ * A generic error utility function.
+ * @private
+ * @param {String} type The error type.
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
+ */
+function error(type) {
+ throw new RangeError(errors[type]);
}
-/** chainable
- * MarkdownIt.set(options)
- *
- * Set parser options (in the same format as in constructor). Probably, you
- * will never need it, but you can change options after constructor call.
- *
- * ##### Example
- *
- * ```javascript
- * var md = require('markdown-it')()
- * .set({ html: true, breaks: true })
- * .set({ typographer, true });
- * ```
- *
- * __Note:__ To achieve the best possible performance, don't modify a
- * `markdown-it` instance options on the fly. If you need multiple configurations
- * it's best to create multiple instances and initialize each with separate
- * config.
- **/
-MarkdownIt.prototype.set = function (options) {
- utils.assign(this.options, options);
- return this;
-};
+/**
+ * A generic `Array#map` utility function.
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} callback The function that gets called for every array
+ * item.
+ * @returns {Array} A new array of values returned by the callback function.
+ */
+function map(array, callback) {
+ const result = [];
+ let length = array.length;
+ while (length--) {
+ result[length] = callback(array[length]);
+ }
+ return result;
+}
-/** chainable, internal
- * MarkdownIt.configure(presets)
- *
- * Batch load of all options and compenent settings. This is internal method,
- * and you probably will not need it. But if you will - see available presets
- * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
- *
- * We strongly recommend to use presets instead of direct config loads. That
- * will give better compatibility with next versions.
- **/
-MarkdownIt.prototype.configure = function (presets) {
- var self = this,
- presetName;
- if (utils.isString(presets)) {
- presetName = presets;
- presets = config[presetName];
- if (!presets) {
- throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name');
- }
+/**
+ * A simple `Array#map`-like wrapper to work with domain name strings or email
+ * addresses.
+ * @private
+ * @param {String} domain The domain name or email address.
+ * @param {Function} callback The function that gets called for every
+ * character.
+ * @returns {String} A new string of characters returned by the callback
+ * function.
+ */
+function mapDomain(domain, callback) {
+ const parts = domain.split('@');
+ let result = '';
+ if (parts.length > 1) {
+ // In email addresses, only the domain name should be punycoded. Leave
+ // the local part (i.e. everything up to `@`) intact.
+ result = parts[0] + '@';
+ domain = parts[1];
}
- if (!presets) {
- throw new Error('Wrong `markdown-it` preset, can\'t be empty');
- }
- if (presets.options) {
- self.set(presets.options);
- }
- if (presets.components) {
- Object.keys(presets.components).forEach(function (name) {
- if (presets.components[name].rules) {
- self[name].ruler.enableOnly(presets.components[name].rules);
- }
- if (presets.components[name].rules2) {
- self[name].ruler2.enableOnly(presets.components[name].rules2);
+ // Avoid `split(regex)` for IE8 compatibility. See #17.
+ domain = domain.replace(regexSeparators, '\x2E');
+ const labels = domain.split('.');
+ const encoded = map(labels, callback).join('.');
+ return result + encoded;
+}
+
+/**
+ * Creates an array containing the numeric code points of each Unicode
+ * character in the string. While JavaScript uses UCS-2 internally,
+ * this function will convert a pair of surrogate halves (each of which
+ * UCS-2 exposes as separate characters) into a single code point,
+ * matching UTF-16.
+ * @see `punycode.ucs2.encode`
+ * @see ` tags.
- **/
-MarkdownIt.prototype.renderInline = function (src, env) {
- env = env || {};
- return this.renderer.render(this.parseInline(src, env), this.options, env);
+ * Bias adaptation function as per section 3.4 of RFC 3492.
+ * https://tools.ietf.org/html/rfc3492#section-3.4
+ * @private
+ */
+const adapt = function (delta, numPoints, firstTime) {
+ let k = 0;
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
+ delta += floor(delta / numPoints);
+ for /* no initialization */
+ (; delta > baseMinusTMin * tMax >> 1; k += base) {
+ delta = floor(delta / baseMinusTMin);
+ }
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
};
-module.exports = MarkdownIt;
-
-/***/ }),
-
-/***/ "../../../node_modules/markdown-it/lib/parser_block.js":
-/*!*************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/parser_block.js ***!
- \*************************************************************/
-/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
-
-/** internal
- * class ParserBlock
- *
- * Block-level tokenizer.
- **/
-
-
-var Ruler = __webpack_require__(/*! ./ruler */ "../../../node_modules/markdown-it/lib/ruler.js");
-var _rules = [
-// First 2 params - rule name & source. Secondary array - list of rules,
-// which can be terminated by this one.
-['table', __webpack_require__(/*! ./rules_block/table */ "../../../node_modules/markdown-it/lib/rules_block/table.js"), ['paragraph', 'reference']], ['code', __webpack_require__(/*! ./rules_block/code */ "../../../node_modules/markdown-it/lib/rules_block/code.js")], ['fence', __webpack_require__(/*! ./rules_block/fence */ "../../../node_modules/markdown-it/lib/rules_block/fence.js"), ['paragraph', 'reference', 'blockquote', 'list']], ['blockquote', __webpack_require__(/*! ./rules_block/blockquote */ "../../../node_modules/markdown-it/lib/rules_block/blockquote.js"), ['paragraph', 'reference', 'blockquote', 'list']], ['hr', __webpack_require__(/*! ./rules_block/hr */ "../../../node_modules/markdown-it/lib/rules_block/hr.js"), ['paragraph', 'reference', 'blockquote', 'list']], ['list', __webpack_require__(/*! ./rules_block/list */ "../../../node_modules/markdown-it/lib/rules_block/list.js"), ['paragraph', 'reference', 'blockquote']], ['reference', __webpack_require__(/*! ./rules_block/reference */ "../../../node_modules/markdown-it/lib/rules_block/reference.js")], ['html_block', __webpack_require__(/*! ./rules_block/html_block */ "../../../node_modules/markdown-it/lib/rules_block/html_block.js"), ['paragraph', 'reference', 'blockquote']], ['heading', __webpack_require__(/*! ./rules_block/heading */ "../../../node_modules/markdown-it/lib/rules_block/heading.js"), ['paragraph', 'reference', 'blockquote']], ['lheading', __webpack_require__(/*! ./rules_block/lheading */ "../../../node_modules/markdown-it/lib/rules_block/lheading.js")], ['paragraph', __webpack_require__(/*! ./rules_block/paragraph */ "../../../node_modules/markdown-it/lib/rules_block/paragraph.js")]];
/**
- * new ParserBlock()
- **/
-function ParserBlock() {
- /**
- * ParserBlock#ruler -> Ruler
- *
- * [[Ruler]] instance. Keep configuration of block rules.
- **/
- this.ruler = new Ruler();
- for (var i = 0; i < _rules.length; i++) {
- this.ruler.push(_rules[i][0], _rules[i][1], {
- alt: (_rules[i][2] || []).slice()
- });
- }
-}
-
-// Generate tokens for input range
-//
-ParserBlock.prototype.tokenize = function (state, startLine, endLine) {
- var ok,
- i,
- rules = this.ruler.getRules(''),
- len = rules.length,
- line = startLine,
- hasEmptyLines = false,
- maxNesting = state.md.options.maxNesting;
- while (line < endLine) {
- state.line = line = state.skipEmptyLines(line);
- if (line >= endLine) {
- break;
- }
+ * Converts a Punycode string of ASCII-only symbols to a string of Unicode
+ * symbols.
+ * @memberOf punycode
+ * @param {String} input The Punycode string of ASCII-only symbols.
+ * @returns {String} The resulting string of Unicode symbols.
+ */
+const decode = function (input) {
+ // Don't use UCS-2.
+ const output = [];
+ const inputLength = input.length;
+ let i = 0;
+ let n = initialN;
+ let bias = initialBias;
- // Termination condition for nested calls.
- // Nested calls currently used for blockquotes & lists
- if (state.sCount[line] < state.blkIndent) {
- break;
- }
+ // Handle the basic code points: let `basic` be the number of input code
+ // points before the last delimiter, or `0` if there is none, then copy
+ // the first basic code points to the output.
- // If nesting level exceeded - skip tail to the end. That's not ordinary
- // situation and we should not care about content.
- if (state.level >= maxNesting) {
- state.line = endLine;
- break;
+ let basic = input.lastIndexOf(delimiter);
+ if (basic < 0) {
+ basic = 0;
+ }
+ for (let j = 0; j < basic; ++j) {
+ // if it's not a basic code point
+ if (input.charCodeAt(j) >= 0x80) {
+ error('not-basic');
}
+ output.push(input.charCodeAt(j));
+ }
- // Try all possible rules.
- // On success, rule should:
- //
- // - update `state.line`
- // - update `state.tokens`
- // - return true
+ // Main decoding loop: start just after the last delimiter if any basic code
+ // points were copied; start at the beginning otherwise.
- for (i = 0; i < len; i++) {
- ok = rules[i](state, line, endLine, false);
- if (ok) {
+ for /* no final expression */
+ (let index = basic > 0 ? basic + 1 : 0; index < inputLength;) {
+ // `index` is the index of the next character to be consumed.
+ // Decode a generalized variable-length integer into `delta`,
+ // which gets added to `i`. The overflow checking is easier
+ // if we increase `i` as we go, then subtract off its starting
+ // value at the end to obtain `delta`.
+ const oldi = i;
+ for /* no condition */
+ (let w = 1, k = base;; k += base) {
+ if (index >= inputLength) {
+ error('invalid-input');
+ }
+ const digit = basicToDigit(input.charCodeAt(index++));
+ if (digit >= base) {
+ error('invalid-input');
+ }
+ if (digit > floor((maxInt - i) / w)) {
+ error('overflow');
+ }
+ i += digit * w;
+ const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
+ if (digit < t) {
break;
}
+ const baseMinusT = base - t;
+ if (w > floor(maxInt / baseMinusT)) {
+ error('overflow');
+ }
+ w *= baseMinusT;
}
+ const out = output.length + 1;
+ bias = adapt(i - oldi, out, oldi == 0);
- // set state.tight if we had an empty line before current tag
- // i.e. latest empty line should not count
- state.tight = !hasEmptyLines;
-
- // paragraph might "eat" one newline after it in nested lists
- if (state.isEmpty(state.line - 1)) {
- hasEmptyLines = true;
- }
- line = state.line;
- if (line < endLine && state.isEmpty(line)) {
- hasEmptyLines = true;
- line++;
- state.line = line;
+ // `i` was supposed to wrap around from `out` to `0`,
+ // incrementing `n` each time, so we'll fix that now:
+ if (floor(i / out) > maxInt - n) {
+ error('overflow');
}
+ n += floor(i / out);
+ i %= out;
+
+ // Insert `n` at position `i` of the output.
+ output.splice(i++, 0, n);
}
+ return String.fromCodePoint(...output);
};
/**
- * ParserBlock.parse(str, md, env, outTokens)
- *
- * Process input string and push block tokens into `outTokens`
- **/
-ParserBlock.prototype.parse = function (src, md, env, outTokens) {
- var state;
- if (!src) {
- return;
- }
- state = new this.State(src, md, env, outTokens);
- this.tokenize(state, state.line, state.lineMax);
-};
-ParserBlock.prototype.State = __webpack_require__(/*! ./rules_block/state_block */ "../../../node_modules/markdown-it/lib/rules_block/state_block.js");
-module.exports = ParserBlock;
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
+ * Punycode string of ASCII-only symbols.
+ * @memberOf punycode
+ * @param {String} input The string of Unicode symbols.
+ * @returns {String} The resulting Punycode string of ASCII-only symbols.
+ */
+exports.decode = decode;
+const encode = function (input) {
+ const output = [];
-/***/ }),
+ // Convert the input in UCS-2 to an array of Unicode code points.
+ input = ucs2decode(input);
-/***/ "../../../node_modules/markdown-it/lib/parser_core.js":
-/*!************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/parser_core.js ***!
- \************************************************************/
-/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+ // Cache the length.
+ const inputLength = input.length;
-/** internal
- * class Core
- *
- * Top-level rules executor. Glues block/inline parsers and does intermediate
- * transformations.
- **/
+ // Initialize the state.
+ let n = initialN;
+ let delta = 0;
+ let bias = initialBias;
+ // Handle the basic code points.
+ for (const currentValue of input) {
+ if (currentValue < 0x80) {
+ output.push(stringFromCharCode(currentValue));
+ }
+ }
+ const basicLength = output.length;
+ let handledCPCount = basicLength;
-var Ruler = __webpack_require__(/*! ./ruler */ "../../../node_modules/markdown-it/lib/ruler.js");
-var _rules = [['normalize', __webpack_require__(/*! ./rules_core/normalize */ "../../../node_modules/markdown-it/lib/rules_core/normalize.js")], ['block', __webpack_require__(/*! ./rules_core/block */ "../../../node_modules/markdown-it/lib/rules_core/block.js")], ['inline', __webpack_require__(/*! ./rules_core/inline */ "../../../node_modules/markdown-it/lib/rules_core/inline.js")], ['linkify', __webpack_require__(/*! ./rules_core/linkify */ "../../../node_modules/markdown-it/lib/rules_core/linkify.js")], ['replacements', __webpack_require__(/*! ./rules_core/replacements */ "../../../node_modules/markdown-it/lib/rules_core/replacements.js")], ['smartquotes', __webpack_require__(/*! ./rules_core/smartquotes */ "../../../node_modules/markdown-it/lib/rules_core/smartquotes.js")]];
+ // `handledCPCount` is the number of code points that have been handled;
+ // `basicLength` is the number of basic code points.
-/**
- * new Core()
- **/
-function Core() {
- /**
- * Core#ruler -> Ruler
- *
- * [[Ruler]] instance. Keep configuration of core rules.
- **/
- this.ruler = new Ruler();
- for (var i = 0; i < _rules.length; i++) {
- this.ruler.push(_rules[i][0], _rules[i][1]);
+ // Finish the basic string with a delimiter unless it's empty.
+ if (basicLength) {
+ output.push(delimiter);
}
-}
-/**
- * Core.process(state)
- *
- * Executes core chain rules.
- **/
-Core.prototype.process = function (state) {
- var i, l, rules;
- rules = this.ruler.getRules('');
- for (i = 0, l = rules.length; i < l; i++) {
- rules[i](state);
+ // Main encoding loop:
+ while (handledCPCount < inputLength) {
+ // All non-basic code points < n have been handled already. Find the next
+ // larger one:
+ let m = maxInt;
+ for (const currentValue of input) {
+ if (currentValue >= n && currentValue < m) {
+ m = currentValue;
+ }
+ }
+
+ // Increase `delta` enough to advance the decoder's ` tags.
+ **/
+MarkdownIt.prototype.renderInline = function (src, env) {
+ env = env || {};
+ return this.renderer.render(this.parseInline(src, env), this.options, env);
+};
+module.exports = MarkdownIt;
/***/ }),
-/***/ "../../graphiql-toolkit/esm/storage/base.js":
-/*!**************************************************!*\
- !*** ../../graphiql-toolkit/esm/storage/base.js ***!
- \**************************************************/
+/***/ "../node_modules/mdurl/build/index.cjs.js":
+/*!************************************************!*\
+ !*** ../node_modules/mdurl/build/index.cjs.js ***!
+ \************************************************/
/***/ (function(__unused_webpack_module, exports) {
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.StorageAPI = void 0;
-function isQuotaError(storage, e) {
- return e instanceof DOMException && (e.code === 22 || e.code === 1014 || e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') && storage.length !== 0;
-}
-class StorageAPI {
- constructor(storage) {
- if (storage) {
- this.storage = storage;
- } else if (storage === null) {
- this.storage = null;
- } else if (typeof window === 'undefined') {
- this.storage = null;
- } else {
- this.storage = {
- getItem: window.localStorage.getItem.bind(window.localStorage),
- setItem: window.localStorage.setItem.bind(window.localStorage),
- removeItem: window.localStorage.removeItem.bind(window.localStorage),
- get length() {
- let keys = 0;
- for (const key in window.localStorage) {
- if (key.indexOf(`${STORAGE_NAMESPACE}:`) === 0) {
- keys += 1;
- }
- }
- return keys;
- },
- clear() {
- for (const key in window.localStorage) {
- if (key.indexOf(`${STORAGE_NAMESPACE}:`) === 0) {
- window.localStorage.removeItem(key);
- }
- }
- }
- };
- }
- }
- get(name) {
- if (!this.storage) {
- return null;
- }
- const key = `${STORAGE_NAMESPACE}:${name}`;
- const value = this.storage.getItem(key);
- if (value === 'null' || value === 'undefined') {
- this.storage.removeItem(key);
- return null;
- }
- return value || null;
+/* eslint-disable no-bitwise */
+const decodeCache = {};
+function getDecodeCache(exclude) {
+ let cache = decodeCache[exclude];
+ if (cache) {
+ return cache;
}
- set(name, value) {
- let quotaError = false;
- let error = null;
- if (this.storage) {
- const key = `${STORAGE_NAMESPACE}:${name}`;
- if (value) {
- try {
- this.storage.setItem(key, value);
- } catch (e) {
- error = e instanceof Error ? e : new Error(`${e}`);
- quotaError = isQuotaError(this.storage, e);
- }
- } else {
- this.storage.removeItem(key);
- }
- }
- return {
- isQuotaError: quotaError,
- error
- };
+ cache = decodeCache[exclude] = [];
+ for (let i = 0; i < 128; i++) {
+ const ch = String.fromCharCode(i);
+ cache.push(ch);
}
- clear() {
- if (this.storage) {
- this.storage.clear();
- }
+ for (let i = 0; i < exclude.length; i++) {
+ const ch = exclude.charCodeAt(i);
+ cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);
}
+ return cache;
}
-exports.StorageAPI = StorageAPI;
-const STORAGE_NAMESPACE = 'graphiql';
-
-/***/ }),
-/***/ "../../graphiql-toolkit/esm/storage/custom.js":
-/*!****************************************************!*\
- !*** ../../graphiql-toolkit/esm/storage/custom.js ***!
- \****************************************************/
-/***/ (function(__unused_webpack_module, exports) {
-
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.createLocalStorage = createLocalStorage;
-function createLocalStorage(_ref) {
- let {
- namespace
- } = _ref;
- const storageKeyPrefix = `${namespace}:`;
- const getStorageKey = key => `${storageKeyPrefix}${key}`;
- const storage = {
- setItem: (key, value) => localStorage.setItem(getStorageKey(key), value),
- getItem: key => localStorage.getItem(getStorageKey(key)),
- removeItem: key => localStorage.removeItem(getStorageKey(key)),
- get length() {
- let keys = 0;
- for (const key in window.localStorage) {
- if (key.indexOf(storageKeyPrefix) === 0) {
- keys += 1;
+// Decode percent-encoded string.
+//
+function decode(string, exclude) {
+ if (typeof exclude !== 'string') {
+ exclude = decode.defaultChars;
+ }
+ const cache = getDecodeCache(exclude);
+ return string.replace(/(%[a-f0-9]{2})+/gi, function (seq) {
+ let result = '';
+ for (let i = 0, l = seq.length; i < l; i += 3) {
+ const b1 = parseInt(seq.slice(i + 1, i + 3), 16);
+ if (b1 < 0x80) {
+ result += cache[b1];
+ continue;
+ }
+ if ((b1 & 0xE0) === 0xC0 && i + 3 < l) {
+ // 110xxxxx 10xxxxxx
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
+ if ((b2 & 0xC0) === 0x80) {
+ const chr = b1 << 6 & 0x7C0 | b2 & 0x3F;
+ if (chr < 0x80) {
+ result += '\ufffd\ufffd';
+ } else {
+ result += String.fromCharCode(chr);
+ }
+ i += 3;
+ continue;
}
}
- return keys;
- },
- clear() {
- for (const key in window.localStorage) {
- if (key.indexOf(storageKeyPrefix) === 0) {
- window.localStorage.removeItem(key);
+ if ((b1 & 0xF0) === 0xE0 && i + 6 < l) {
+ // 1110xxxx 10xxxxxx 10xxxxxx
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
+ if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
+ const chr = b1 << 12 & 0xF000 | b2 << 6 & 0xFC0 | b3 & 0x3F;
+ if (chr < 0x800 || chr >= 0xD800 && chr <= 0xDFFF) {
+ result += '\ufffd\ufffd\ufffd';
+ } else {
+ result += String.fromCharCode(chr);
+ }
+ i += 6;
+ continue;
}
}
+ if ((b1 & 0xF8) === 0xF0 && i + 9 < l) {
+ // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
+ const b4 = parseInt(seq.slice(i + 10, i + 12), 16);
+ if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {
+ let chr = b1 << 18 & 0x1C0000 | b2 << 12 & 0x3F000 | b3 << 6 & 0xFC0 | b4 & 0x3F;
+ if (chr < 0x10000 || chr > 0x10FFFF) {
+ result += '\ufffd\ufffd\ufffd\ufffd';
+ } else {
+ chr -= 0x10000;
+ result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));
+ }
+ i += 9;
+ continue;
+ }
+ }
+ result += '\ufffd';
}
- };
- return storage;
+ return result;
+ });
}
+decode.defaultChars = ';/?:@&=+$,#';
+decode.componentChars = '';
+const encodeCache = {};
-/***/ }),
-
-/***/ "../../graphiql-toolkit/esm/storage/history.js":
-/*!*****************************************************!*\
- !*** ../../graphiql-toolkit/esm/storage/history.js ***!
- \*****************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.HistoryStore = void 0;
-var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
-var _query = __webpack_require__(/*! ./query */ "../../graphiql-toolkit/esm/storage/query.js");
-const MAX_QUERY_SIZE = 100000;
-class HistoryStore {
- constructor(storage, maxHistoryLength) {
- var _this = this;
- this.storage = storage;
- this.maxHistoryLength = maxHistoryLength;
- this.updateHistory = _ref => {
- let {
- query,
- variables,
- headers,
- operationName
- } = _ref;
- if (!this.shouldSaveQuery(query, variables, headers, this.history.fetchRecent())) {
- return;
- }
- this.history.push({
- query,
- variables,
- headers,
- operationName
- });
- const historyQueries = this.history.items;
- const favoriteQueries = this.favorite.items;
- this.queries = historyQueries.concat(favoriteQueries);
- };
- this.deleteHistory = function (_ref2) {
- let {
- query,
- variables,
- headers,
- operationName,
- favorite
- } = _ref2;
- let clearFavorites = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- function deleteFromStore(store) {
- const found = store.items.find(x => x.query === query && x.variables === variables && x.headers === headers && x.operationName === operationName);
- if (found) {
- store.delete(found);
- }
- }
- if (favorite || clearFavorites) {
- deleteFromStore(_this.favorite);
- }
- if (!favorite || clearFavorites) {
- deleteFromStore(_this.history);
- }
- _this.queries = [..._this.history.items, ..._this.favorite.items];
- };
- this.history = new _query.QueryStore('queries', this.storage, this.maxHistoryLength);
- this.favorite = new _query.QueryStore('favorites', this.storage, null);
- this.queries = [...this.history.fetchAll(), ...this.favorite.fetchAll()];
+// Create a lookup array where anything but characters in `chars` string
+// and alphanumeric chars is percent-encoded.
+//
+function getEncodeCache(exclude) {
+ let cache = encodeCache[exclude];
+ if (cache) {
+ return cache;
}
- shouldSaveQuery(query, variables, headers, lastQuerySaved) {
- if (!query) {
- return false;
- }
- try {
- (0, _graphql.parse)(query);
- } catch (_a) {
- return false;
+ cache = encodeCache[exclude] = [];
+ for (let i = 0; i < 128; i++) {
+ const ch = String.fromCharCode(i);
+ if (/^[0-9a-z]$/i.test(ch)) {
+ // always allow unencoded alphanumeric characters
+ cache.push(ch);
+ } else {
+ cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));
}
- if (query.length > MAX_QUERY_SIZE) {
- return false;
+ }
+ for (let i = 0; i < exclude.length; i++) {
+ cache[exclude.charCodeAt(i)] = exclude[i];
+ }
+ return cache;
+}
+
+// Encode unsafe characters with percent-encoding, skipping already
+// encoded sequences.
+//
+// - string - string to encode
+// - exclude - list of characters to ignore (in addition to a-zA-Z0-9)
+// - keepEscaped - don't encode '%' in a correct escape sequence (default: true)
+//
+function encode(string, exclude, keepEscaped) {
+ if (typeof exclude !== 'string') {
+ // encode(string, keepEscaped)
+ keepEscaped = exclude;
+ exclude = encode.defaultChars;
+ }
+ if (typeof keepEscaped === 'undefined') {
+ keepEscaped = true;
+ }
+ const cache = getEncodeCache(exclude);
+ let result = '';
+ for (let i = 0, l = string.length; i < l; i++) {
+ const code = string.charCodeAt(i);
+ if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {
+ if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
+ result += string.slice(i, i + 3);
+ i += 2;
+ continue;
+ }
}
- if (!lastQuerySaved) {
- return true;
+ if (code < 128) {
+ result += cache[code];
+ continue;
}
- if (JSON.stringify(query) === JSON.stringify(lastQuerySaved.query)) {
- if (JSON.stringify(variables) === JSON.stringify(lastQuerySaved.variables)) {
- if (JSON.stringify(headers) === JSON.stringify(lastQuerySaved.headers)) {
- return false;
- }
- if (headers && !lastQuerySaved.headers) {
- return false;
+ if (code >= 0xD800 && code <= 0xDFFF) {
+ if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {
+ const nextCode = string.charCodeAt(i + 1);
+ if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
+ result += encodeURIComponent(string[i] + string[i + 1]);
+ i++;
+ continue;
}
}
- if (variables && !lastQuerySaved.variables) {
- return false;
- }
- }
- return true;
- }
- toggleFavorite(_ref3) {
- let {
- query,
- variables,
- headers,
- operationName,
- label,
- favorite
- } = _ref3;
- const item = {
- query,
- variables,
- headers,
- operationName,
- label
- };
- if (favorite) {
- item.favorite = false;
- this.favorite.delete(item);
- this.history.push(item);
- } else {
- item.favorite = true;
- this.favorite.push(item);
- this.history.delete(item);
+ result += '%EF%BF%BD';
+ continue;
}
- this.queries = [...this.history.items, ...this.favorite.items];
+ result += encodeURIComponent(string[i]);
}
- editLabel(_ref4, index) {
- let {
- query,
- variables,
- headers,
- operationName,
- label,
- favorite
- } = _ref4;
- const item = {
- query,
- variables,
- headers,
- operationName,
- label
- };
- if (favorite) {
- this.favorite.edit(Object.assign(Object.assign({}, item), {
- favorite
- }), index);
- } else {
- this.history.edit(item, index);
- }
- this.queries = [...this.history.items, ...this.favorite.items];
+ return result;
+}
+encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";
+encode.componentChars = "-_.!~*'()";
+function format(url) {
+ let result = '';
+ result += url.protocol || '';
+ result += url.slashes ? '//' : '';
+ result += url.auth ? url.auth + '@' : '';
+ if (url.hostname && url.hostname.indexOf(':') !== -1) {
+ // ipv6 address
+ result += '[' + url.hostname + ']';
+ } else {
+ result += url.hostname || '';
}
+ result += url.port ? ':' + url.port : '';
+ result += url.pathname || '';
+ result += url.search || '';
+ result += url.hash || '';
+ return result;
}
-exports.HistoryStore = HistoryStore;
-/***/ }),
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
-/***/ "../../graphiql-toolkit/esm/storage/index.js":
-/*!***************************************************!*\
- !*** ../../graphiql-toolkit/esm/storage/index.js ***!
- \***************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+//
+// Changes from joyent/node:
+//
+// 1. No leading slash in paths,
+// e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`
+//
+// 2. Backslashes are not replaced with slashes,
+// so `http:\\example.org\` is treated like a relative path
+//
+// 3. Trailing colon is treated like a part of the path,
+// i.e. in `http://example.org:foo` pathname is `:foo`
+//
+// 4. Nothing is URL-encoded in the resulting object,
+// (in joyent/node some chars in auth and paths are encoded)
+//
+// 5. `url.parse()` does not have `parseQueryString` argument
+//
+// 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,
+// which can be constructed using other parts of the url.
+//
+
+function Url() {
+ this.protocol = null;
+ this.slashes = null;
+ this.auth = null;
+ this.port = null;
+ this.hostname = null;
+ this.hash = null;
+ this.search = null;
+ this.pathname = null;
+}
+// Reference: RFC 3986, RFC 1808, RFC 2396
+// define these here so at least they only have to be
+// compiled once on the first module load.
+const protocolPattern = /^([a-z0-9.+-]+:)/i;
+const portPattern = /:[0-9]*$/;
+
+// Special case for a simple path URL
+/* eslint-disable-next-line no-useless-escape */
+const simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/;
+
+// RFC 2396: characters reserved for delimiting URLs.
+// We actually just auto-escape these.
+const delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'];
+
+// RFC 2396: characters not allowed for various reasons.
+const unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims);
+
+// Allowed by RFCs, but cause of XSS attacks. Always escape these.
+const autoEscape = ['\''].concat(unwise);
+// Characters that are never ever allowed in a hostname.
+// Note that any invalid chars are also handled, but these
+// are the ones that are *expected* to be seen, so we fast-path
+// them.
+const nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape);
+const hostEndingChars = ['/', '?', '#'];
+const hostnameMaxLen = 255;
+const hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/;
+const hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/;
+// protocols that can allow "unsafe" and "unwise" chars.
+// protocols that never have a hostname.
+const hostlessProtocol = {
+ javascript: true,
+ 'javascript:': true
+};
+// protocols that always contain a // bit.
+const slashedProtocol = {
+ http: true,
+ https: true,
+ ftp: true,
+ gopher: true,
+ file: true,
+ 'http:': true,
+ 'https:': true,
+ 'ftp:': true,
+ 'gopher:': true,
+ 'file:': true
+};
+function urlParse(url, slashesDenoteHost) {
+ if (url && url instanceof Url) return url;
+ const u = new Url();
+ u.parse(url, slashesDenoteHost);
+ return u;
+}
+Url.prototype.parse = function (url, slashesDenoteHost) {
+ let lowerProto, hec, slashes;
+ let rest = url;
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-var _base = __webpack_require__(/*! ./base */ "../../graphiql-toolkit/esm/storage/base.js");
-Object.keys(_base).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _base[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _base[key];
+ // trim before proceeding.
+ // This is to support parse stuff like " http://foo.com \n"
+ rest = rest.trim();
+ if (!slashesDenoteHost && url.split('#').length === 1) {
+ // Try fast path regexp
+ const simplePath = simplePathPattern.exec(rest);
+ if (simplePath) {
+ this.pathname = simplePath[1];
+ if (simplePath[2]) {
+ this.search = simplePath[2];
+ }
+ return this;
}
- });
-});
-var _history = __webpack_require__(/*! ./history */ "../../graphiql-toolkit/esm/storage/history.js");
-Object.keys(_history).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _history[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _history[key];
+ }
+ let proto = protocolPattern.exec(rest);
+ if (proto) {
+ proto = proto[0];
+ lowerProto = proto.toLowerCase();
+ this.protocol = proto;
+ rest = rest.substr(proto.length);
+ }
+
+ // figure out if it's got a host
+ // user@server is *always* interpreted as a hostname, and url
+ // resolution will treat //foo/bar as host=foo,path=bar because that's
+ // how the browser resolves relative URLs.
+ /* eslint-disable-next-line no-useless-escape */
+ if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
+ slashes = rest.substr(0, 2) === '//';
+ if (slashes && !(proto && hostlessProtocol[proto])) {
+ rest = rest.substr(2);
+ this.slashes = true;
}
- });
-});
-var _query = __webpack_require__(/*! ./query */ "../../graphiql-toolkit/esm/storage/query.js");
-Object.keys(_query).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _query[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _query[key];
+ }
+ if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
+ // there's a hostname.
+ // the first instance of /, ?, ;, or # ends the host.
+ //
+ // If there is an @ in the hostname, then non-host chars *are* allowed
+ // to the left of the last @ sign, unless some host-ending character
+ // comes *before* the @-sign.
+ // URLs are obnoxious.
+ //
+ // ex:
+ // http://a@b@c/ => user:a@b host:c
+ // http://a@b?@c => user:a host:c path:/?@c
+
+ // v0.12 TODO(isaacs): This is not quite how Chrome does things.
+ // Review our test case against browsers more comprehensively.
+
+ // find the first instance of any hostEndingChars
+ let hostEnd = -1;
+ for (let i = 0; i < hostEndingChars.length; i++) {
+ hec = rest.indexOf(hostEndingChars[i]);
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
+ hostEnd = hec;
+ }
}
- });
-});
-var _custom = __webpack_require__(/*! ./custom */ "../../graphiql-toolkit/esm/storage/custom.js");
-Object.keys(_custom).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _custom[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _custom[key];
+
+ // at this point, either we have an explicit point where the
+ // auth portion cannot go past, or the last @ char is the decider.
+ let auth, atSign;
+ if (hostEnd === -1) {
+ // atSign can be anywhere.
+ atSign = rest.lastIndexOf('@');
+ } else {
+ // atSign must be in auth portion.
+ // http://a@b/c@d => host:b auth:a path:/c@d
+ atSign = rest.lastIndexOf('@', hostEnd);
}
- });
-});
-/***/ }),
+ // Now we have a portion which is definitely the auth.
+ // Pull that off.
+ if (atSign !== -1) {
+ auth = rest.slice(0, atSign);
+ rest = rest.slice(atSign + 1);
+ this.auth = auth;
+ }
-/***/ "../../graphiql-toolkit/esm/storage/query.js":
-/*!***************************************************!*\
- !*** ../../graphiql-toolkit/esm/storage/query.js ***!
- \***************************************************/
-/***/ (function(__unused_webpack_module, exports) {
+ // the host is the remaining to the left of the first non-host char
+ hostEnd = -1;
+ for (let i = 0; i < nonHostChars.length; i++) {
+ hec = rest.indexOf(nonHostChars[i]);
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
+ hostEnd = hec;
+ }
+ }
+ // if we still have not hit it, then the entire thing is a host.
+ if (hostEnd === -1) {
+ hostEnd = rest.length;
+ }
+ if (rest[hostEnd - 1] === ':') {
+ hostEnd--;
+ }
+ const host = rest.slice(0, hostEnd);
+ rest = rest.slice(hostEnd);
+ // pull out port.
+ this.parseHost(host);
+ // we've indicated that there is a hostname,
+ // so even if it's empty, it has to be present.
+ this.hostname = this.hostname || '';
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.QueryStore = void 0;
-class QueryStore {
- constructor(key, storage) {
- let maxSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
- this.key = key;
- this.storage = storage;
- this.maxSize = maxSize;
- this.items = this.fetchAll();
- }
- get length() {
- return this.items.length;
- }
- contains(item) {
- return this.items.some(x => x.query === item.query && x.variables === item.variables && x.headers === item.headers && x.operationName === item.operationName);
- }
- edit(item, index) {
- if (typeof index === 'number' && this.items[index]) {
- const found = this.items[index];
- if (found.query === item.query && found.variables === item.variables && found.headers === item.headers && found.operationName === item.operationName) {
- this.items.splice(index, 1, item);
- this.save();
- return;
+ // if hostname begins with [ and ends with ]
+ // assume that it's an IPv6 address.
+ const ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']';
+
+ // validate a little.
+ if (!ipv6Hostname) {
+ const hostparts = this.hostname.split(/\./);
+ for (let i = 0, l = hostparts.length; i < l; i++) {
+ const part = hostparts[i];
+ if (!part) {
+ continue;
+ }
+ if (!part.match(hostnamePartPattern)) {
+ let newpart = '';
+ for (let j = 0, k = part.length; j < k; j++) {
+ if (part.charCodeAt(j) > 127) {
+ // we replace non-ASCII char with a temporary placeholder
+ // we need this to make sure size of hostname is not
+ // broken by replacing non-ASCII by nothing
+ newpart += 'x';
+ } else {
+ newpart += part[j];
+ }
+ }
+ // we test again with ASCII char only
+ if (!newpart.match(hostnamePartPattern)) {
+ const validParts = hostparts.slice(0, i);
+ const notHost = hostparts.slice(i + 1);
+ const bit = part.match(hostnamePartStart);
+ if (bit) {
+ validParts.push(bit[1]);
+ notHost.unshift(bit[2]);
+ }
+ if (notHost.length) {
+ rest = notHost.join('.') + rest;
+ }
+ this.hostname = validParts.join('.');
+ break;
+ }
+ }
}
}
- const itemIndex = this.items.findIndex(x => x.query === item.query && x.variables === item.variables && x.headers === item.headers && x.operationName === item.operationName);
- if (itemIndex !== -1) {
- this.items.splice(itemIndex, 1, item);
- this.save();
+ if (this.hostname.length > hostnameMaxLen) {
+ this.hostname = '';
}
- }
- delete(item) {
- const itemIndex = this.items.findIndex(x => x.query === item.query && x.variables === item.variables && x.headers === item.headers && x.operationName === item.operationName);
- if (itemIndex !== -1) {
- this.items.splice(itemIndex, 1);
- this.save();
+
+ // strip [ and ] from the hostname
+ // the host field still retains them, though
+ if (ipv6Hostname) {
+ this.hostname = this.hostname.substr(1, this.hostname.length - 2);
}
}
- fetchRecent() {
- return this.items.at(-1);
+
+ // chop off from the tail first.
+ const hash = rest.indexOf('#');
+ if (hash !== -1) {
+ // got a fragment string.
+ this.hash = rest.substr(hash);
+ rest = rest.slice(0, hash);
}
- fetchAll() {
- const raw = this.storage.get(this.key);
- if (raw) {
- return JSON.parse(raw)[this.key];
- }
- return [];
+ const qm = rest.indexOf('?');
+ if (qm !== -1) {
+ this.search = rest.substr(qm);
+ rest = rest.slice(0, qm);
}
- push(item) {
- const items = [...this.items, item];
- if (this.maxSize && items.length > this.maxSize) {
- items.shift();
- }
- for (let attempts = 0; attempts < 5; attempts++) {
- const response = this.storage.set(this.key, JSON.stringify({
- [this.key]: items
- }));
- if (!(response === null || response === void 0 ? void 0 : response.error)) {
- this.items = items;
- } else if (response.isQuotaError && this.maxSize) {
- items.shift();
- } else {
- return;
- }
+ if (rest) {
+ this.pathname = rest;
+ }
+ if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
+ this.pathname = '';
+ }
+ return this;
+};
+Url.prototype.parseHost = function (host) {
+ let port = portPattern.exec(host);
+ if (port) {
+ port = port[0];
+ if (port !== ':') {
+ this.port = port.substr(1);
}
+ host = host.substr(0, host.length - port.length);
}
- save() {
- this.storage.set(this.key, JSON.stringify({
- [this.key]: this.items
- }));
+ if (host) {
+ this.hostname = host;
}
-}
-exports.QueryStore = QueryStore;
+};
+exports.decode = decode;
+exports.encode = encode;
+exports.format = format;
+exports.parse = urlParse;
+
+/***/ }),
+
+/***/ "../node_modules/uc.micro/build/index.cjs.js":
+/*!***************************************************!*\
+ !*** ../node_modules/uc.micro/build/index.cjs.js ***!
+ \***************************************************/
+/***/ (function(__unused_webpack_module, exports) {
+
+
+
+var regex$5 = /[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
+var regex$4 = /[\0-\x1F\x7F-\x9F]/;
+var regex$3 = /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/;
+var regex$2 = /[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/;
+var regex$1 = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;
+var regex = /[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
+exports.Any = regex$5;
+exports.Cc = regex$4;
+exports.Cf = regex$3;
+exports.P = regex$2;
+exports.S = regex$1;
+exports.Z = regex;
/***/ }),
@@ -72243,11 +72901,23 @@ var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
var _react2 = __webpack_require__(/*! @graphiql/react */ "../../graphiql-react/dist/index.js");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
-function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
+function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
+ * Copyright (c) 2020 GraphQL Contributors.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
const majorVersion = parseInt(_react.default.version.slice(0, 2), 10);
if (majorVersion < 16) {
throw new Error(['GraphiQL 0.18.0 and after is not compatible with React 15 or below.', 'If you are using a CDN source (jsdelivr, unpkg, etc), follow this example:', 'https://github.com/graphql/graphiql/blob/master/examples/graphiql-cdn/index.html#L49'].join('\n'));
}
+
+/**
+ * API docs for this live here:
+ *
+ * https://graphiql-test.netlify.app/typedoc/modules/graphiql.html#graphiqlprops
+ */
+
/**
* The top-level React component for GraphiQL, intended to encompass the entire
* browser viewport.
@@ -72256,6 +72926,7 @@ if (majorVersion < 16) {
*/
function GraphiQL(_ref) {
+ var _props$disableTabs;
let {
dangerouslyAssumeSchemaIsValid,
defaultQuery,
@@ -72317,7 +72988,8 @@ function GraphiQL(_ref) {
validationRules: validationRules,
variables: variables
}, /*#__PURE__*/_react.default.createElement(GraphiQLInterface, _extends({
- showPersistHeadersSettings: shouldPersistHeaders !== false
+ showPersistHeadersSettings: shouldPersistHeaders !== false,
+ disableTabs: (_props$disableTabs = props.disableTabs) !== null && _props$disableTabs !== void 0 ? _props$disableTabs : false
}, props)));
}
@@ -72326,7 +72998,7 @@ GraphiQL.Logo = GraphiQLLogo;
GraphiQL.Toolbar = GraphiQLToolbar;
GraphiQL.Footer = GraphiQLFooter;
function GraphiQLInterface(props) {
- var _props$isHeadersEdito, _pluginContext$visibl, _props$toolbar;
+ var _props$isHeadersEdito, _pluginContext$visibl, _props$toolbar, _props$toolbar2;
const isHeadersEditorEnabled = (_props$isHeadersEdito = props.isHeadersEditorEnabled) !== null && _props$isHeadersEdito !== void 0 ? _props$isHeadersEdito : true;
const editorContext = (0, _react2.useEditorContext)({
nonNull: true
@@ -72408,7 +73080,7 @@ function GraphiQLInterface(props) {
}, /*#__PURE__*/_react.default.createElement(_react2.CopyIcon, {
className: "graphiql-toolbar-icon",
"aria-hidden": "true"
- })), (_props$toolbar = props.toolbar) === null || _props$toolbar === void 0 ? void 0 : _props$toolbar.additionalContent);
+ })), ((_props$toolbar = props.toolbar) === null || _props$toolbar === void 0 ? void 0 : _props$toolbar.additionalContent) && props.toolbar.additionalContent, ((_props$toolbar2 = props.toolbar) === null || _props$toolbar2 === void 0 ? void 0 : _props$toolbar2.additionalComponent) && /*#__PURE__*/_react.default.createElement(props.toolbar.additionalComponent, null));
const footer = children.find(child => isChildComponentType(child, GraphiQL.Footer));
const onClickReference = (0, _react.useCallback)(() => {
if (pluginResize.hiddenElement === 'first') {
@@ -72551,7 +73223,7 @@ function GraphiQLInterface(props) {
className: "graphiql-sessions"
}, /*#__PURE__*/_react.default.createElement("div", {
className: "graphiql-session-header"
- }, /*#__PURE__*/_react.default.createElement(_react2.Tabs, {
+ }, props.disableTabs ? null : /*#__PURE__*/_react.default.createElement(_react2.Tabs, {
values: editorContext.tabs,
onReorder: handleReorder,
"aria-label": "Select active operation"
@@ -75908,6 +76580,26 @@ function renderType(into, t) {
text(into, t.name);
}
}
+function renderDefinitionDescription(t, useMarkdown, description) {
+ const into = [];
+ const type = 'type' in t ? t.type : t;
+ if ('type' in t && t.description) {
+ text(into, t.description);
+ text(into, '\n\n');
+ }
+ text(into, renderTypeToString(type, useMarkdown));
+ if (description) {
+ text(into, '\n');
+ text(into, description);
+ } else if (!(0, _graphql.isScalarType)(type) && 'description' in type && type.description) {
+ text(into, '\n');
+ text(into, type.description);
+ } else if ('ofType' in type && !(0, _graphql.isScalarType)(type.ofType) && 'description' in type.ofType && type.ofType.description) {
+ text(into, '\n');
+ text(into, type.ofType.description);
+ }
+ return into.join('');
+}
function renderTypeToString(t, useMarkdown) {
const into = [];
if (useMarkdown) {
@@ -75919,13 +76611,25 @@ function renderTypeToString(t, useMarkdown) {
}
return into.join('');
}
-const scalarTypesMap = {
- Int: 'integer',
- String: 'string',
- Float: 'number',
- ID: 'string',
- Boolean: 'boolean',
- DateTime: 'string'
+const defaultScalarTypesMap = {
+ Int: {
+ type: 'integer'
+ },
+ String: {
+ type: 'string'
+ },
+ Float: {
+ type: 'number'
+ },
+ ID: {
+ type: 'string'
+ },
+ Boolean: {
+ type: 'boolean'
+ },
+ DateTime: {
+ type: 'string'
+ }
};
class Marker {
constructor() {
@@ -75939,89 +76643,89 @@ class Marker {
return true;
}
}
-function getJSONSchemaFromGraphQLType(type, options) {
- let required = false;
+function getJSONSchemaFromGraphQLType(fieldOrType, options) {
+ var _a, _b;
let definition = Object.create(null);
const definitions = Object.create(null);
- if ('defaultValue' in type && type.defaultValue !== undefined) {
- definition.default = type.defaultValue;
- }
- if ((0, _graphql.isEnumType)(type)) {
- definition.type = 'string';
- definition.enum = type.getValues().map(val => val.name);
- }
- if ((0, _graphql.isScalarType)(type) && scalarTypesMap[type.name]) {
- definition.type = scalarTypesMap[type.name];
- }
- if ((0, _graphql.isListType)(type)) {
- definition.type = 'array';
- const {
- definition: def,
- definitions: defs
- } = getJSONSchemaFromGraphQLType(type.ofType, options);
- if (def.$ref) {
- definition.items = {
- $ref: def.$ref
- };
+ const isField = ('type' in fieldOrType);
+ const type = isField ? fieldOrType.type : fieldOrType;
+ const baseType = (0, _graphql.isNonNullType)(type) ? type.ofType : type;
+ const required = (0, _graphql.isNonNullType)(type);
+ if ((0, _graphql.isScalarType)(baseType)) {
+ if ((_a = options === null || options === void 0 ? void 0 : options.scalarSchemas) === null || _a === void 0 ? void 0 : _a[baseType.name]) {
+ definition = JSON.parse(JSON.stringify(options.scalarSchemas[baseType.name]));
} else {
- definition.items = def;
- }
- if (defs) {
- for (const defName of Object.keys(defs)) {
- definitions[defName] = defs[defName];
+ definition.type = ['string', 'number', 'boolean', 'integer'];
+ }
+ if (!required) {
+ if (Array.isArray(definition.type)) {
+ definition.type.push('null');
+ } else if (definition.type) {
+ definition.type = [definition.type, 'null'];
+ } else if (definition.enum) {
+ definition.enum.push(null);
+ } else if (definition.oneOf) {
+ definition.oneOf.push({
+ type: 'null'
+ });
+ } else {
+ definition = {
+ oneOf: [definition, {
+ type: 'null'
+ }]
+ };
}
}
- }
- if ((0, _graphql.isNonNullType)(type)) {
- required = true;
+ } else if ((0, _graphql.isEnumType)(baseType)) {
+ definition.enum = baseType.getValues().map(val => val.name);
+ if (!required) {
+ definition.enum.push(null);
+ }
+ } else if ((0, _graphql.isListType)(baseType)) {
+ if (required) {
+ definition.type = 'array';
+ } else {
+ definition.type = ['array', 'null'];
+ }
const {
definition: def,
definitions: defs
- } = getJSONSchemaFromGraphQLType(type.ofType, options);
- definition = def;
+ } = getJSONSchemaFromGraphQLType(baseType.ofType, options);
+ definition.items = def;
if (defs) {
for (const defName of Object.keys(defs)) {
definitions[defName] = defs[defName];
}
}
- }
- if ((0, _graphql.isInputObjectType)(type)) {
- definition.$ref = `#/definitions/${type.name}`;
- if (options === null || options === void 0 ? void 0 : options.definitionMarker.mark(type.name)) {
- const fields = type.getFields();
+ } else if ((0, _graphql.isInputObjectType)(baseType)) {
+ if (required) {
+ definition.$ref = `#/definitions/${baseType.name}`;
+ } else {
+ definition.oneOf = [{
+ $ref: `#/definitions/${baseType.name}`
+ }, {
+ type: 'null'
+ }];
+ }
+ if ((_b = options === null || options === void 0 ? void 0 : options.definitionMarker) === null || _b === void 0 ? void 0 : _b.mark(baseType.name)) {
+ const fields = baseType.getFields();
const fieldDef = {
type: 'object',
properties: {},
required: []
};
- if (type.description) {
- fieldDef.description = type.description + '\n' + renderTypeToString(type);
- if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) {
- fieldDef.markdownDescription = type.description + '\n' + renderTypeToString(type, true);
- }
- } else {
- fieldDef.description = renderTypeToString(type);
- if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) {
- fieldDef.markdownDescription = renderTypeToString(type, true);
- }
+ fieldDef.description = renderDefinitionDescription(baseType);
+ if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) {
+ fieldDef.markdownDescription = renderDefinitionDescription(baseType, true);
}
for (const fieldName of Object.keys(fields)) {
const field = fields[fieldName];
const {
required: fieldRequired,
- definition: typeDefinition,
+ definition: fieldDefinition,
definitions: typeDefinitions
- } = getJSONSchemaFromGraphQLType(field.type, options);
- const {
- definition: fieldDefinition
} = getJSONSchemaFromGraphQLType(field, options);
- fieldDef.properties[fieldName] = Object.assign(Object.assign({}, typeDefinition), fieldDefinition);
- const renderedField = renderTypeToString(field.type);
- fieldDef.properties[fieldName].description = field.description ? field.description + '\n' + renderedField : renderedField;
- if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) {
- const renderedFieldMarkdown = renderTypeToString(field.type, true);
- fieldDef.properties[fieldName].markdownDescription = field.description ? field.description + '\n' + renderedFieldMarkdown : renderedFieldMarkdown;
- }
+ fieldDef.properties[fieldName] = fieldDefinition;
if (fieldRequired) {
fieldDef.required.push(fieldName);
}
@@ -76031,19 +76735,18 @@ function getJSONSchemaFromGraphQLType(type, options) {
}
}
}
- definitions[type.name] = fieldDef;
+ definitions[baseType.name] = fieldDef;
}
}
- if ('description' in type && !(0, _graphql.isScalarType)(type) && type.description && !definition.description) {
- definition.description = type.description + '\n' + renderTypeToString(type);
- if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) {
- definition.markdownDescription = type.description + '\n' + renderTypeToString(type, true);
- }
- } else {
- definition.description = renderTypeToString(type);
- if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) {
- definition.markdownDescription = renderTypeToString(type, true);
- }
+ if ('defaultValue' in fieldOrType && fieldOrType.defaultValue !== undefined) {
+ definition.default = fieldOrType.defaultValue;
+ }
+ const {
+ description
+ } = definition;
+ definition.description = renderDefinitionDescription(fieldOrType, false, description);
+ if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) {
+ definition.markdownDescription = renderDefinitionDescription(fieldOrType, true, description);
}
return {
required,
@@ -76054,13 +76757,14 @@ function getJSONSchemaFromGraphQLType(type, options) {
function getVariablesJSONSchema(variableToType, options) {
var _a;
const jsonSchema = {
- $schema: 'https://json-schema.org/draft/2020-12/schema',
+ $schema: 'http://json-schema.org/draft-04/schema',
type: 'object',
properties: {},
required: []
};
const runtimeOptions = Object.assign(Object.assign({}, options), {
- definitionMarker: new Marker()
+ definitionMarker: new Marker(),
+ scalarSchemas: Object.assign(Object.assign({}, defaultScalarTypesMap), options === null || options === void 0 ? void 0 : options.scalarSchemas)
});
if (variableToType) {
for (const [variableName, type] of Object.entries(variableToType)) {
@@ -83505,16 +84209,6 @@ function _extends() {
}
module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
-/***/ }),
-
-/***/ "../../../node_modules/entities/lib/maps/entities.json":
-/*!*************************************************************!*\
- !*** ../../../node_modules/entities/lib/maps/entities.json ***!
- \*************************************************************/
-/***/ (function(module) {
-
-module.exports = JSON.parse('{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"","InvisibleTimes":"","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"","NegativeThickSpace":"","NegativeThinSpace":"","NegativeVeryThinSpace":"","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":" ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"","zwnj":""}');
-
/***/ })
/******/ });
diff --git a/src/Symfony/Bundle/Resources/public/react/react-dom.production.min.js b/src/Symfony/Bundle/Resources/public/react/react-dom.production.min.js
index e8a0213d7e1..fb4e099c056 100644
--- a/src/Symfony/Bundle/Resources/public/react/react-dom.production.min.js
+++ b/src/Symfony/Bundle/Resources/public/react/react-dom.production.min.js
@@ -10,258 +10,258 @@
(function(){/*
Modernizr 3.0.0pre (Custom Build) | MIT
*/
-'use strict';(function(Q,mb){"object"===typeof exports&&"undefined"!==typeof module?mb(exports,require("react")):"function"===typeof define&&define.amd?define(["exports","react"],mb):(Q=Q||self,mb(Q.ReactDOM={},Q.React))})(this,function(Q,mb){function n(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c
)
- breaks: false,
- // Convert '\n' in paragraphs into
- langPrefix: 'language-',
- // CSS language prefix for fenced blocks
- linkify: false,
- // autoconvert URL-like texts to links
+/***/ "../../../node_modules/react-remove-scroll-bar/dist/es2015/component.js":
+/*!******************************************************************************!*\
+ !*** ../../../node_modules/react-remove-scroll-bar/dist/es2015/component.js ***!
+ \******************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- // Enable some language-neutral replacements + quotes beautification
- typographer: false,
- // Double + single quotes replacement pairs, when typographer enabled,
- // and smartquotes on. Could be either a String or an Array.
- //
- // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
- // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
- quotes: '\u201c\u201d\u2018\u2019',
- /* “”‘’ */
- // Highlighter function. Should return escaped HTML,
- // or '' if the source string is not changed and should be escaped externaly.
- // If result starts with
- langPrefix: 'language-',
- // CSS language prefix for fenced blocks
- linkify: false,
- // autoconvert URL-like texts to links
+/***/ "../../../node_modules/react-remove-scroll-bar/dist/es2015/index.js":
+/*!**************************************************************************!*\
+ !*** ../../../node_modules/react-remove-scroll-bar/dist/es2015/index.js ***!
+ \**************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- // Enable some language-neutral replacements + quotes beautification
- typographer: false,
- // Double + single quotes replacement pairs, when typographer enabled,
- // and smartquotes on. Could be either a String or an Array.
- //
- // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
- // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
- quotes: '\u201c\u201d\u2018\u2019',
- /* “”‘’ */
- // Highlighter function. Should return escaped HTML,
- // or '' if the source string is not changed and should be escaped externaly.
- // If result starts with
- langPrefix: 'language-',
- // CSS language prefix for fenced blocks
- linkify: false,
- // autoconvert URL-like texts to links
+/***/ "../../../node_modules/react-remove-scroll-bar/dist/es2015/utils.js":
+/*!**************************************************************************!*\
+ !*** ../../../node_modules/react-remove-scroll-bar/dist/es2015/utils.js ***!
+ \**************************************************************************/
+/***/ (function(__unused_webpack_module, exports) {
- // Enable some language-neutral replacements + quotes beautification
- typographer: false,
- // Double + single quotes replacement pairs, when typographer enabled,
- // and smartquotes on. Could be either a String or an Array.
- //
- // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
- // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
- quotes: '\u201c\u201d\u2018\u2019',
- /* “”‘’ */
- // Highlighter function. Should return escaped HTML,
- // or '' if the source string is not changed and should be escaped externaly.
- // If result starts with
\n';
-};
-default_rules.fence = function (tokens, idx, options, env, slf) {
- var token = tokens[idx],
- info = token.info ? unescapeAll(token.info).trim() : '',
- langName = '',
- langAttrs = '',
- highlighted,
- i,
- arr,
- tmpAttrs,
- tmpToken;
- if (info) {
- arr = info.split(/(\s+)/g);
- langName = arr[0];
- langAttrs = arr.slice(2).join('');
- }
- if (options.highlight) {
- highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
- } else {
- highlighted = escapeHtml(token.content);
- }
- if (highlighted.indexOf('' + escapeHtml(tokens[idx].content) + '
\n';
- }
- return '' + highlighted + '
\n';
-};
-default_rules.image = function (tokens, idx, options, env, slf) {
- var token = tokens[idx];
- // "alt" attr MUST be set, even if empty. Because it's mandatory and
- // should be placed on proper position for tests.
- //
- // Replace content with actual value
-
- token.attrs[token.attrIndex('alt')][1] = slf.renderInlineAsText(token.children, options, env);
- return slf.renderToken(tokens, idx, options);
-};
-default_rules.hardbreak = function (tokens, idx, options /*, env */) {
- return options.xhtmlOut ? '' + highlighted + '
\n' : '
\n';
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.RemoveScrollSideCar = RemoveScrollSideCar;
+exports.getTouchXY = exports.getDeltaXY = void 0;
+var _tslib = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
+var React = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
+var _reactRemoveScrollBar = __webpack_require__(/*! react-remove-scroll-bar */ "../../../node_modules/react-remove-scroll-bar/dist/es2015/index.js");
+var _reactStyleSingleton = __webpack_require__(/*! react-style-singleton */ "../../../node_modules/react-style-singleton/dist/es2015/index.js");
+var _aggresiveCapture = __webpack_require__(/*! ./aggresiveCapture */ "../../../node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js");
+var _handleScroll = __webpack_require__(/*! ./handleScroll */ "../../../node_modules/react-remove-scroll/dist/es2015/handleScroll.js");
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+var getTouchXY = function (event) {
+ return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
};
-default_rules.softbreak = function (tokens, idx, options /*, env */) {
- return options.breaks ? options.xhtmlOut ? '
\n' : '
\n' : '\n';
+exports.getTouchXY = getTouchXY;
+var getDeltaXY = function (event) {
+ return [event.deltaX, event.deltaY];
};
-default_rules.text = function (tokens, idx /*, options, env */) {
- return escapeHtml(tokens[idx].content);
+exports.getDeltaXY = getDeltaXY;
+var extractRef = function (ref) {
+ return ref && 'current' in ref ? ref.current : ref;
};
-default_rules.html_block = function (tokens, idx /*, options, env */) {
- return tokens[idx].content;
+var deltaCompare = function (x, y) {
+ return x[0] === y[0] && x[1] === y[1];
};
-default_rules.html_inline = function (tokens, idx /*, options, env */) {
- return tokens[idx].content;
+var generateStyle = function (id) {
+ return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
};
+var idCounter = 0;
+var lockStack = [];
+function RemoveScrollSideCar(props) {
+ var shouldPreventQueue = React.useRef([]);
+ var touchStartRef = React.useRef([0, 0]);
+ var activeAxis = React.useRef();
+ var id = React.useState(idCounter++)[0];
+ var Style = React.useState(function () {
+ return (0, _reactStyleSingleton.styleSingleton)();
+ })[0];
+ var lastProps = React.useRef(props);
+ React.useEffect(function () {
+ lastProps.current = props;
+ }, [props]);
+ React.useEffect(function () {
+ if (props.inert) {
+ document.body.classList.add("block-interactivity-".concat(id));
+ var allow_1 = (0, _tslib.__spreadArray)([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
+ allow_1.forEach(function (el) {
+ return el.classList.add("allow-interactivity-".concat(id));
+ });
+ return function () {
+ document.body.classList.remove("block-interactivity-".concat(id));
+ allow_1.forEach(function (el) {
+ return el.classList.remove("allow-interactivity-".concat(id));
+ });
+ };
+ }
+ return;
+ }, [props.inert, props.lockRef.current, props.shards]);
+ var shouldCancelEvent = React.useCallback(function (event, parent) {
+ if ('touches' in event && event.touches.length === 2) {
+ return !lastProps.current.allowPinchZoom;
+ }
+ var touch = getTouchXY(event);
+ var touchStart = touchStartRef.current;
+ var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
+ var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
+ var currentAxis;
+ var target = event.target;
+ var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
+ // allow horizontal touch move on Range inputs. They will not cause any scroll
+ if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
+ return false;
+ }
+ var canBeScrolledInMainDirection = (0, _handleScroll.locationCouldBeScrolled)(moveDirection, target);
+ if (!canBeScrolledInMainDirection) {
+ return true;
+ }
+ if (canBeScrolledInMainDirection) {
+ currentAxis = moveDirection;
+ } else {
+ currentAxis = moveDirection === 'v' ? 'h' : 'v';
+ canBeScrolledInMainDirection = (0, _handleScroll.locationCouldBeScrolled)(moveDirection, target);
+ // other axis might be not scrollable
+ }
-/**
- * new Renderer()
- *
- * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.
- **/
-function Renderer() {
- /**
- * Renderer#rules -> Object
- *
- * Contains render rules for tokens. Can be updated and extended.
- *
- * ##### Example
- *
- * ```javascript
- * var md = require('markdown-it')();
- *
- * md.renderer.rules.strong_open = function () { return ''; };
- * md.renderer.rules.strong_close = function () { return ''; };
- *
- * var result = md.renderInline(...);
- * ```
- *
- * Each rule is called as independent static function with fixed signature:
- *
- * ```javascript
- * function my_token_render(tokens, idx, options, env, renderer) {
- * // ...
- * return renderedHTML;
- * }
- * ```
- *
- * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
- * for more details and examples.
- **/
- this.rules = assign({}, default_rules);
+ if (!canBeScrolledInMainDirection) {
+ return false;
+ }
+ if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
+ activeAxis.current = currentAxis;
+ }
+ if (!currentAxis) {
+ return true;
+ }
+ var cancelingAxis = activeAxis.current || currentAxis;
+ return (0, _handleScroll.handleScroll)(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
+ }, []);
+ var shouldPrevent = React.useCallback(function (_event) {
+ var event = _event;
+ if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
+ // not the last active
+ return;
+ }
+ var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
+ var sourceEvent = shouldPreventQueue.current.filter(function (e) {
+ return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta);
+ })[0];
+ // self event, and should be canceled
+ if (sourceEvent && sourceEvent.should) {
+ if (event.cancelable) {
+ event.preventDefault();
+ }
+ return;
+ }
+ // outside or shard event
+ if (!sourceEvent) {
+ var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function (node) {
+ return node.contains(event.target);
+ });
+ var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
+ if (shouldStop) {
+ if (event.cancelable) {
+ event.preventDefault();
+ }
+ }
+ }
+ }, []);
+ var shouldCancel = React.useCallback(function (name, delta, target, should) {
+ var event = {
+ name: name,
+ delta: delta,
+ target: target,
+ should: should
+ };
+ shouldPreventQueue.current.push(event);
+ setTimeout(function () {
+ shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) {
+ return e !== event;
+ });
+ }, 1);
+ }, []);
+ var scrollTouchStart = React.useCallback(function (event) {
+ touchStartRef.current = getTouchXY(event);
+ activeAxis.current = undefined;
+ }, []);
+ var scrollWheel = React.useCallback(function (event) {
+ shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
+ }, []);
+ var scrollTouchMove = React.useCallback(function (event) {
+ shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
+ }, []);
+ React.useEffect(function () {
+ lockStack.push(Style);
+ props.setCallbacks({
+ onScrollCapture: scrollWheel,
+ onWheelCapture: scrollWheel,
+ onTouchMoveCapture: scrollTouchMove
+ });
+ document.addEventListener('wheel', shouldPrevent, _aggresiveCapture.nonPassive);
+ document.addEventListener('touchmove', shouldPrevent, _aggresiveCapture.nonPassive);
+ document.addEventListener('touchstart', scrollTouchStart, _aggresiveCapture.nonPassive);
+ return function () {
+ lockStack = lockStack.filter(function (inst) {
+ return inst !== Style;
+ });
+ document.removeEventListener('wheel', shouldPrevent, _aggresiveCapture.nonPassive);
+ document.removeEventListener('touchmove', shouldPrevent, _aggresiveCapture.nonPassive);
+ document.removeEventListener('touchstart', scrollTouchStart, _aggresiveCapture.nonPassive);
+ };
+ }, []);
+ var removeScrollBar = props.removeScrollBar,
+ inert = props.inert;
+ return /*#__PURE__*/React.createElement(React.Fragment, null, inert ? /*#__PURE__*/React.createElement(Style, {
+ styles: generateStyle(id)
+ }) : null, removeScrollBar ? /*#__PURE__*/React.createElement(_reactRemoveScrollBar.RemoveScrollBar, {
+ gapMode: "margin"
+ }) : null);
}
-/**
- * Renderer.renderAttrs(token) -> String
- *
- * Render token attributes to string.
- **/
-Renderer.prototype.renderAttrs = function renderAttrs(token) {
- var i, l, result;
- if (!token.attrs) {
- return '';
- }
- result = '';
- for (i = 0, l = token.attrs.length; i < l; i++) {
- result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
- }
- return result;
-};
-
-/**
- * Renderer.renderToken(tokens, idx, options) -> String
- * - tokens (Array): list of tokens
- * - idx (Numbed): token index to render
- * - options (Object): params of parser instance
- *
- * Default token renderer. Can be overriden by custom function
- * in [[Renderer#rules]].
- **/
-Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
- var nextToken,
- result = '',
- needLf = false,
- token = tokens[idx];
-
- // Tight list paragraphs
- if (token.hidden) {
- return '';
- }
-
- // Insert a newline between hidden paragraph and subsequent opening
- // block-level tag.
- //
- // For example, here we should insert a newline before blockquote:
- // - a
- // >
- //
- if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {
- result += '\n';
- }
+/***/ }),
- // Add token name, e.g. ``.
- //
- needLf = false;
- }
- }
- }
- }
- result += needLf ? '>\n' : '>';
- return result;
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.RemoveScroll = void 0;
+var _tslib = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
+var React = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
+var _constants = __webpack_require__(/*! react-remove-scroll-bar/constants */ "../../../node_modules/react-remove-scroll-bar/dist/es2015/constants.js");
+var _useCallbackRef = __webpack_require__(/*! use-callback-ref */ "../../../node_modules/use-callback-ref/dist/es2015/index.js");
+var _medium = __webpack_require__(/*! ./medium */ "../../../node_modules/react-remove-scroll/dist/es2015/medium.js");
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+var nothing = function () {
+ return;
};
-
/**
- * Renderer.renderInline(tokens, options, env) -> String
- * - tokens (Array): list on block tokens to renter
- * - options (Object): params of parser instance
- * - env (Object): additional data from parsed input (references, for example)
- *
- * The same as [[Renderer.render]], but for single token of `inline` type.
- **/
-Renderer.prototype.renderInline = function (tokens, options, env) {
- var type,
- result = '',
- rules = this.rules;
- for (var i = 0, len = tokens.length; i < len; i++) {
- type = tokens[i].type;
- if (typeof rules[type] !== 'undefined') {
- result += rules[type](tokens, i, options, env, this);
- } else {
- result += this.renderToken(tokens, i, options);
- }
- }
- return result;
-};
-
-/** internal
- * Renderer.renderInlineAsText(tokens, options, env) -> String
- * - tokens (Array): list on block tokens to renter
- * - options (Object): params of parser instance
- * - env (Object): additional data from parsed input (references, for example)
- *
- * Special kludge for image `alt` attributes to conform CommonMark spec.
- * Don't try to use it! Spec requires to show `alt` content with stripped markup,
- * instead of simple escaping.
- **/
-Renderer.prototype.renderInlineAsText = function (tokens, options, env) {
- var result = '';
- for (var i = 0, len = tokens.length; i < len; i++) {
- if (tokens[i].type === 'text') {
- result += tokens[i].content;
- } else if (tokens[i].type === 'image') {
- result += this.renderInlineAsText(tokens[i].children, options, env);
- } else if (tokens[i].type === 'softbreak') {
- result += '\n';
- }
- }
- return result;
+ * Removes scrollbar from the page and contain the scroll within the Lock
+ */
+var RemoveScroll = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
+ var ref = React.useRef(null);
+ var _a = React.useState({
+ onScrollCapture: nothing,
+ onWheelCapture: nothing,
+ onTouchMoveCapture: nothing
+ }),
+ callbacks = _a[0],
+ setCallbacks = _a[1];
+ var forwardProps = props.forwardProps,
+ children = props.children,
+ className = props.className,
+ removeScrollBar = props.removeScrollBar,
+ enabled = props.enabled,
+ shards = props.shards,
+ sideCar = props.sideCar,
+ noIsolation = props.noIsolation,
+ inert = props.inert,
+ allowPinchZoom = props.allowPinchZoom,
+ _b = props.as,
+ Container = _b === void 0 ? 'div' : _b,
+ rest = (0, _tslib.__rest)(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]);
+ var SideCar = sideCar;
+ var containerRef = (0, _useCallbackRef.useMergeRefs)([ref, parentRef]);
+ var containerProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, rest), callbacks);
+ return /*#__PURE__*/React.createElement(React.Fragment, null, enabled && /*#__PURE__*/React.createElement(SideCar, {
+ sideCar: _medium.effectCar,
+ removeScrollBar: removeScrollBar,
+ shards: shards,
+ noIsolation: noIsolation,
+ inert: inert,
+ setCallbacks: setCallbacks,
+ allowPinchZoom: !!allowPinchZoom,
+ lockRef: ref
+ }), forwardProps ? /*#__PURE__*/React.cloneElement(React.Children.only(children), (0, _tslib.__assign)((0, _tslib.__assign)({}, containerProps), {
+ ref: containerRef
+ })) : /*#__PURE__*/React.createElement(Container, (0, _tslib.__assign)({}, containerProps, {
+ className: className,
+ ref: containerRef
+ }), children));
+});
+exports.RemoveScroll = RemoveScroll;
+RemoveScroll.defaultProps = {
+ enabled: true,
+ removeScrollBar: true,
+ inert: false
};
-
-/**
- * Renderer.render(tokens, options, env) -> String
- * - tokens (Array): list on block tokens to renter
- * - options (Object): params of parser instance
- * - env (Object): additional data from parsed input (references, for example)
- *
- * Takes token stream and generates HTML. Probably, you will never need to call
- * this method directly.
- **/
-Renderer.prototype.render = function (tokens, options, env) {
- var i,
- len,
- type,
- result = '',
- rules = this.rules;
- for (i = 0, len = tokens.length; i < len; i++) {
- type = tokens[i].type;
- if (type === 'inline') {
- result += this.renderInline(tokens[i].children, options, env);
- } else if (typeof rules[type] !== 'undefined') {
- result += rules[tokens[i].type](tokens, i, options, env, this);
- } else {
- result += this.renderToken(tokens, i, options, env);
- }
- }
- return result;
+RemoveScroll.classNames = {
+ fullWidth: _constants.fullWidthClassName,
+ zeroRight: _constants.zeroRightClassName
};
-module.exports = Renderer;
/***/ }),
-/***/ "../../../node_modules/markdown-it/lib/ruler.js":
-/*!******************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/ruler.js ***!
- \******************************************************/
-/***/ (function(module) {
-
-/**
- * class Ruler
- *
- * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and
- * [[MarkdownIt#inline]] to manage sequences of functions (rules):
- *
- * - keep rules in defined order
- * - assign the name to each rule
- * - enable/disable rules
- * - add/replace rules
- * - allow assign rules to additional named chains (in the same)
- * - cacheing lists of active rules
- *
- * You will not need use this class directly until write plugins. For simple
- * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
- * [[MarkdownIt.use]].
- **/
+/***/ "../../../node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js":
+/*!*********************************************************************************!*\
+ !*** ../../../node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js ***!
+ \*********************************************************************************/
+/***/ (function(__unused_webpack_module, exports) {
-/**
- * new Ruler()
- **/
-function Ruler() {
- // List of added rules. Each element is:
- //
- // {
- // name: XXX,
- // enabled: Boolean,
- // fn: Function(),
- // alt: [ name2, name3 ]
- // }
- //
- this.__rules__ = [];
- // Cached rule chains.
- //
- // First level - chain name, '' for default.
- // Second level - diginal anchor for fast filtering by charcodes.
- //
- this.__cache__ = null;
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.nonPassive = void 0;
+var passiveSupported = false;
+if (typeof window !== 'undefined') {
+ try {
+ var options = Object.defineProperty({}, 'passive', {
+ get: function () {
+ passiveSupported = true;
+ return true;
+ }
+ });
+ // @ts-ignore
+ window.addEventListener('test', options, options);
+ // @ts-ignore
+ window.removeEventListener('test', options, options);
+ } catch (err) {
+ passiveSupported = false;
+ }
}
+var nonPassive = passiveSupported ? {
+ passive: false
+} : false;
+exports.nonPassive = nonPassive;
-////////////////////////////////////////////////////////////////////////////////
-// Helper methods, should not be used directly
+/***/ }),
-// Find rule index by name
-//
-Ruler.prototype.__find__ = function (name) {
- for (var i = 0; i < this.__rules__.length; i++) {
- if (this.__rules__[i].name === name) {
- return i;
- }
- }
- return -1;
-};
+/***/ "../../../node_modules/react-remove-scroll/dist/es2015/handleScroll.js":
+/*!*****************************************************************************!*\
+ !*** ../../../node_modules/react-remove-scroll/dist/es2015/handleScroll.js ***!
+ \*****************************************************************************/
+/***/ (function(__unused_webpack_module, exports) {
-// Build rules lookup cache
-//
-Ruler.prototype.__compile__ = function () {
- var self = this;
- var chains = [''];
- // collect unique names
- self.__rules__.forEach(function (rule) {
- if (!rule.enabled) {
- return;
- }
- rule.alt.forEach(function (altName) {
- if (chains.indexOf(altName) < 0) {
- chains.push(altName);
- }
- });
- });
- self.__cache__ = {};
- chains.forEach(function (chain) {
- self.__cache__[chain] = [];
- self.__rules__.forEach(function (rule) {
- if (!rule.enabled) {
- return;
- }
- if (chain && rule.alt.indexOf(chain) < 0) {
- return;
- }
- self.__cache__[chain].push(rule.fn);
- });
- });
-};
-/**
- * Ruler.at(name, fn [, options])
- * - name (String): rule name to replace.
- * - fn (Function): new rule function.
- * - options (Object): new rule options (not mandatory).
- *
- * Replace rule by name with new function & options. Throws error if name not
- * found.
- *
- * ##### Options:
- *
- * - __alt__ - array with names of "alternate" chains.
- *
- * ##### Example
- *
- * Replace existing typographer replacement rule with new one:
- *
- * ```javascript
- * var md = require('markdown-it')();
- *
- * md.core.ruler.at('replacements', function replace(state) {
- * //...
- * });
- * ```
- **/
-Ruler.prototype.at = function (name, fn, options) {
- var index = this.__find__(name);
- var opt = options || {};
- if (index === -1) {
- throw new Error('Parser rule not found: ' + name);
- }
- this.__rules__[index].fn = fn;
- this.__rules__[index].alt = opt.alt || [];
- this.__cache__ = null;
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.locationCouldBeScrolled = exports.handleScroll = void 0;
+var alwaysContainsScroll = function (node) {
+ // textarea will always _contain_ scroll inside self. It only can be hidden
+ return node.tagName === 'TEXTAREA';
};
-
-/**
- * Ruler.before(beforeName, ruleName, fn [, options])
- * - beforeName (String): new rule will be added before this one.
- * - ruleName (String): name of added rule.
- * - fn (Function): rule function.
- * - options (Object): rule options (not mandatory).
- *
- * Add new rule to chain before one with given name. See also
- * [[Ruler.after]], [[Ruler.push]].
- *
- * ##### Options:
- *
- * - __alt__ - array with names of "alternate" chains.
- *
- * ##### Example
- *
- * ```javascript
- * var md = require('markdown-it')();
- *
- * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {
- * //...
- * });
- * ```
- **/
-Ruler.prototype.before = function (beforeName, ruleName, fn, options) {
- var index = this.__find__(beforeName);
- var opt = options || {};
- if (index === -1) {
- throw new Error('Parser rule not found: ' + beforeName);
- }
- this.__rules__.splice(index, 0, {
- name: ruleName,
- enabled: true,
- fn: fn,
- alt: opt.alt || []
- });
- this.__cache__ = null;
+var elementCanBeScrolled = function (node, overflow) {
+ var styles = window.getComputedStyle(node);
+ return (
+ // not-not-scrollable
+ styles[overflow] !== 'hidden' &&
+ // contains scroll inside self
+ !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible')
+ );
};
-
-/**
- * Ruler.after(afterName, ruleName, fn [, options])
- * - afterName (String): new rule will be added after this one.
- * - ruleName (String): name of added rule.
- * - fn (Function): rule function.
- * - options (Object): rule options (not mandatory).
- *
- * Add new rule to chain after one with given name. See also
- * [[Ruler.before]], [[Ruler.push]].
- *
- * ##### Options:
- *
- * - __alt__ - array with names of "alternate" chains.
- *
- * ##### Example
- *
- * ```javascript
- * var md = require('markdown-it')();
- *
- * md.inline.ruler.after('text', 'my_rule', function replace(state) {
- * //...
- * });
- * ```
- **/
-Ruler.prototype.after = function (afterName, ruleName, fn, options) {
- var index = this.__find__(afterName);
- var opt = options || {};
- if (index === -1) {
- throw new Error('Parser rule not found: ' + afterName);
- }
- this.__rules__.splice(index + 1, 0, {
- name: ruleName,
- enabled: true,
- fn: fn,
- alt: opt.alt || []
- });
- this.__cache__ = null;
+var elementCouldBeVScrolled = function (node) {
+ return elementCanBeScrolled(node, 'overflowY');
};
-
-/**
- * Ruler.push(ruleName, fn [, options])
- * - ruleName (String): name of added rule.
- * - fn (Function): rule function.
- * - options (Object): rule options (not mandatory).
- *
- * Push new rule to the end of chain. See also
- * [[Ruler.before]], [[Ruler.after]].
- *
- * ##### Options:
- *
- * - __alt__ - array with names of "alternate" chains.
- *
- * ##### Example
- *
- * ```javascript
- * var md = require('markdown-it')();
- *
- * md.core.ruler.push('my_rule', function replace(state) {
- * //...
- * });
- * ```
- **/
-Ruler.prototype.push = function (ruleName, fn, options) {
- var opt = options || {};
- this.__rules__.push({
- name: ruleName,
- enabled: true,
- fn: fn,
- alt: opt.alt || []
- });
- this.__cache__ = null;
+var elementCouldBeHScrolled = function (node) {
+ return elementCanBeScrolled(node, 'overflowX');
};
-
-/**
- * Ruler.enable(list [, ignoreInvalid]) -> Array
- * - list (String|Array): list of rule names to enable.
- * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
- *
- * Enable rules with given names. If any rule name not found - throw Error.
- * Errors can be disabled by second param.
- *
- * Returns list of found rule names (if no exception happened).
- *
- * See also [[Ruler.disable]], [[Ruler.enableOnly]].
- **/
-Ruler.prototype.enable = function (list, ignoreInvalid) {
- if (!Array.isArray(list)) {
- list = [list];
- }
- var result = [];
-
- // Search by name and enable
- list.forEach(function (name) {
- var idx = this.__find__(name);
- if (idx < 0) {
- if (ignoreInvalid) {
- return;
+var locationCouldBeScrolled = function (axis, node) {
+ var current = node;
+ do {
+ // Skip over shadow root
+ if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
+ current = current.host;
+ }
+ var isScrollable = elementCouldBeScrolled(axis, current);
+ if (isScrollable) {
+ var _a = getScrollVariables(axis, current),
+ s = _a[1],
+ d = _a[2];
+ if (s > d) {
+ return true;
}
- throw new Error('Rules manager: invalid rule name ' + name);
}
- this.__rules__[idx].enabled = true;
- result.push(name);
- }, this);
- this.__cache__ = null;
- return result;
+ current = current.parentNode;
+ } while (current && current !== document.body);
+ return false;
};
-
-/**
- * Ruler.enableOnly(list [, ignoreInvalid])
- * - list (String|Array): list of rule names to enable (whitelist).
- * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
- *
- * Enable rules with given names, and disable everything else. If any rule name
- * not found - throw Error. Errors can be disabled by second param.
- *
- * See also [[Ruler.disable]], [[Ruler.enable]].
- **/
-Ruler.prototype.enableOnly = function (list, ignoreInvalid) {
- if (!Array.isArray(list)) {
- list = [list];
- }
- this.__rules__.forEach(function (rule) {
- rule.enabled = false;
- });
- this.enable(list, ignoreInvalid);
+exports.locationCouldBeScrolled = locationCouldBeScrolled;
+var getVScrollVariables = function (_a) {
+ var scrollTop = _a.scrollTop,
+ scrollHeight = _a.scrollHeight,
+ clientHeight = _a.clientHeight;
+ return [scrollTop, scrollHeight, clientHeight];
};
-
-/**
- * Ruler.disable(list [, ignoreInvalid]) -> Array
- * - list (String|Array): list of rule names to disable.
- * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
- *
- * Disable rules with given names. If any rule name not found - throw Error.
- * Errors can be disabled by second param.
- *
- * Returns list of found rule names (if no exception happened).
- *
- * See also [[Ruler.enable]], [[Ruler.enableOnly]].
- **/
-Ruler.prototype.disable = function (list, ignoreInvalid) {
- if (!Array.isArray(list)) {
- list = [list];
- }
- var result = [];
-
- // Search by name and disable
- list.forEach(function (name) {
- var idx = this.__find__(name);
- if (idx < 0) {
- if (ignoreInvalid) {
- return;
+var getHScrollVariables = function (_a) {
+ var scrollLeft = _a.scrollLeft,
+ scrollWidth = _a.scrollWidth,
+ clientWidth = _a.clientWidth;
+ return [scrollLeft, scrollWidth, clientWidth];
+};
+var elementCouldBeScrolled = function (axis, node) {
+ return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
+};
+var getScrollVariables = function (axis, node) {
+ return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
+};
+var getDirectionFactor = function (axis, direction) {
+ /**
+ * If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
+ * and then increasingly negative as you scroll towards the end of the content.
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
+ */
+ return axis === 'h' && direction === 'rtl' ? -1 : 1;
+};
+var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
+ var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
+ var delta = directionFactor * sourceDelta;
+ // find scrollable target
+ var target = event.target;
+ var targetInLock = endTarget.contains(target);
+ var shouldCancelScroll = false;
+ var isDeltaPositive = delta > 0;
+ var availableScroll = 0;
+ var availableScrollTop = 0;
+ do {
+ var _a = getScrollVariables(axis, target),
+ position = _a[0],
+ scroll_1 = _a[1],
+ capacity = _a[2];
+ var elementScroll = scroll_1 - capacity - directionFactor * position;
+ if (position || elementScroll) {
+ if (elementCouldBeScrolled(axis, target)) {
+ availableScroll += elementScroll;
+ availableScrollTop += position;
}
- throw new Error('Rules manager: invalid rule name ' + name);
}
- this.__rules__[idx].enabled = false;
- result.push(name);
- }, this);
- this.__cache__ = null;
- return result;
+ target = target.parentNode;
+ } while (
+ // portaled content
+ !targetInLock && target !== document.body ||
+ // self content
+ targetInLock && (endTarget.contains(target) || endTarget === target));
+ if (isDeltaPositive && (noOverscroll && availableScroll === 0 || !noOverscroll && delta > availableScroll)) {
+ shouldCancelScroll = true;
+ } else if (!isDeltaPositive && (noOverscroll && availableScrollTop === 0 || !noOverscroll && -delta > availableScrollTop)) {
+ shouldCancelScroll = true;
+ }
+ return shouldCancelScroll;
};
+exports.handleScroll = handleScroll;
-/**
- * Ruler.getRules(chainName) -> Array
- *
- * Return array of active functions (rules) for given chain name. It analyzes
- * rules configuration, compiles caches if not exists and returns result.
- *
- * Default chain name is `''` (empty string). It can't be skipped. That's
- * done intentionally, to keep signature monomorphic for high speed.
- **/
-Ruler.prototype.getRules = function (chainName) {
- if (this.__cache__ === null) {
- this.__compile__();
- }
+/***/ }),
- // Chain can be empty, if rules disabled. But we still have to return Array.
- return this.__cache__[chainName] || [];
-};
-module.exports = Ruler;
+/***/ "../../../node_modules/react-remove-scroll/dist/es2015/index.js":
+/*!**********************************************************************!*\
+ !*** ../../../node_modules/react-remove-scroll/dist/es2015/index.js ***!
+ \**********************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+Object.defineProperty(exports, "RemoveScroll", ({
+ enumerable: true,
+ get: function () {
+ return _Combination.default;
+ }
+}));
+var _Combination = _interopRequireDefault(__webpack_require__(/*! ./Combination */ "../../../node_modules/react-remove-scroll/dist/es2015/Combination.js"));
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ }),
-/***/ "../../../node_modules/markdown-it/lib/rules_block/blockquote.js":
+/***/ "../../../node_modules/react-remove-scroll/dist/es2015/medium.js":
/*!***********************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/rules_block/blockquote.js ***!
+ !*** ../../../node_modules/react-remove-scroll/dist/es2015/medium.js ***!
\***********************************************************************/
-/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
-
-// Block quotes
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-var isSpace = (__webpack_require__(/*! ../common/utils */ "../../../node_modules/markdown-it/lib/common/utils.js").isSpace);
-module.exports = function blockquote(state, startLine, endLine, silent) {
- var adjustTab,
- ch,
- i,
- initial,
- l,
- lastLineEmpty,
- lines,
- nextLine,
- offset,
- oldBMarks,
- oldBSCount,
- oldIndent,
- oldParentType,
- oldSCount,
- oldTShift,
- spaceAfterMarker,
- terminate,
- terminatorRules,
- token,
- isOutdented,
- oldLineMax = state.lineMax,
- pos = state.bMarks[startLine] + state.tShift[startLine],
- max = state.eMarks[startLine];
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.effectCar = void 0;
+var _useSidecar = __webpack_require__(/*! use-sidecar */ "../../../node_modules/use-sidecar/dist/es2015/index.js");
+var effectCar = (0, _useSidecar.createSidecarMedium)();
+exports.effectCar = effectCar;
- // if it's indented more than 3 spaces, it should be a code block
- if (state.sCount[startLine] - state.blkIndent >= 4) {
- return false;
- }
+/***/ }),
- // check the block quote marker
- if (state.src.charCodeAt(pos++) !== 0x3E /* > */) {
- return false;
- }
+/***/ "../../../node_modules/react-remove-scroll/dist/es2015/sidecar.js":
+/*!************************************************************************!*\
+ !*** ../../../node_modules/react-remove-scroll/dist/es2015/sidecar.js ***!
+ \************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- // we know that it's going to be a valid blockquote,
- // so no point trying to find the end of it in silent mode
- if (silent) {
- return true;
- }
- // set offset past spaces and ">"
- initial = offset = state.sCount[startLine] + 1;
- // skip one optional space after '>'
- if (state.src.charCodeAt(pos) === 0x20 /* space */) {
- // ' > test '
- // ^ -- position start of line here:
- pos++;
- initial++;
- offset++;
- adjustTab = false;
- spaceAfterMarker = true;
- } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
- spaceAfterMarker = true;
- if ((state.bsCount[startLine] + offset) % 4 === 3) {
- // ' >\t test '
- // ^ -- position start of line here (tab has width===1)
- pos++;
- initial++;
- offset++;
- adjustTab = false;
- } else {
- // ' >\t test '
- // ^ -- position start of line here + shift bsCount slightly
- // to make extra space appear
- adjustTab = true;
- }
- } else {
- spaceAfterMarker = false;
- }
- oldBMarks = [state.bMarks[startLine]];
- state.bMarks[startLine] = pos;
- while (pos < max) {
- ch = state.src.charCodeAt(pos);
- if (isSpace(ch)) {
- if (ch === 0x09) {
- offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;
- } else {
- offset++;
- }
- } else {
- break;
- }
- pos++;
- }
- oldBSCount = [state.bsCount[startLine]];
- state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);
- lastLineEmpty = pos >= max;
- oldSCount = [state.sCount[startLine]];
- state.sCount[startLine] = offset - initial;
- oldTShift = [state.tShift[startLine]];
- state.tShift[startLine] = pos - state.bMarks[startLine];
- terminatorRules = state.md.block.ruler.getRules('blockquote');
- oldParentType = state.parentType;
- state.parentType = 'blockquote';
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = void 0;
+var _useSidecar = __webpack_require__(/*! use-sidecar */ "../../../node_modules/use-sidecar/dist/es2015/index.js");
+var _SideEffect = __webpack_require__(/*! ./SideEffect */ "../../../node_modules/react-remove-scroll/dist/es2015/SideEffect.js");
+var _medium = __webpack_require__(/*! ./medium */ "../../../node_modules/react-remove-scroll/dist/es2015/medium.js");
+var _default = (0, _useSidecar.exportSidecar)(_medium.effectCar, _SideEffect.RemoveScrollSideCar);
+exports["default"] = _default;
- // Search the end of the block
- //
- // Block ends with either:
- // 1. an empty line outside:
- // ```
- // > test
- //
- // ```
- // 2. an empty line inside:
- // ```
- // >
- // test
- // ```
- // 3. another tag:
- // ```
- // > test
- // - - -
- // ```
- for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {
- // check if it's outdented, i.e. it's inside list item and indented
- // less than said list item:
- //
- // ```
- // 1. anything
- // > current blockquote
- // 2. checking this line
- // ```
- isOutdented = state.sCount[nextLine] < state.blkIndent;
- pos = state.bMarks[nextLine] + state.tShift[nextLine];
- max = state.eMarks[nextLine];
- if (pos >= max) {
- // Case 1: line is not inside the blockquote, and this line is empty.
- break;
- }
- if (state.src.charCodeAt(pos++) === 0x3E /* > */ && !isOutdented) {
- // This line is inside the blockquote.
+/***/ }),
- // set offset past spaces and ">"
- initial = offset = state.sCount[nextLine] + 1;
+/***/ "../../../node_modules/react-style-singleton/dist/es2015/component.js":
+/*!****************************************************************************!*\
+ !*** ../../../node_modules/react-style-singleton/dist/es2015/component.js ***!
+ \****************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- // skip one optional space after '>'
- if (state.src.charCodeAt(pos) === 0x20 /* space */) {
- // ' > test '
- // ^ -- position start of line here:
- pos++;
- initial++;
- offset++;
- adjustTab = false;
- spaceAfterMarker = true;
- } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
- spaceAfterMarker = true;
- if ((state.bsCount[nextLine] + offset) % 4 === 3) {
- // ' >\t test '
- // ^ -- position start of line here (tab has width===1)
- pos++;
- initial++;
- offset++;
- adjustTab = false;
- } else {
- // ' >\t test '
- // ^ -- position start of line here + shift bsCount slightly
- // to make extra space appear
- adjustTab = true;
- }
- } else {
- spaceAfterMarker = false;
- }
- oldBMarks.push(state.bMarks[nextLine]);
- state.bMarks[nextLine] = pos;
- while (pos < max) {
- ch = state.src.charCodeAt(pos);
- if (isSpace(ch)) {
- if (ch === 0x09) {
- offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
- } else {
- offset++;
- }
- } else {
- break;
- }
- pos++;
- }
- lastLineEmpty = pos >= max;
- oldBSCount.push(state.bsCount[nextLine]);
- state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
- oldSCount.push(state.sCount[nextLine]);
- state.sCount[nextLine] = offset - initial;
- oldTShift.push(state.tShift[nextLine]);
- state.tShift[nextLine] = pos - state.bMarks[nextLine];
- continue;
- }
- // Case 2: line is not inside the blockquote, and the last line was empty.
- if (lastLineEmpty) {
- break;
- }
- // Case 3: another tag found.
- terminate = false;
- for (i = 0, l = terminatorRules.length; i < l; i++) {
- if (terminatorRules[i](state, nextLine, endLine, true)) {
- terminate = true;
- break;
- }
- }
- if (terminate) {
- // Quirk to enforce "hard termination mode" for paragraphs;
- // normally if you call `tokenize(state, startLine, nextLine)`,
- // paragraphs will look below nextLine for paragraph continuation,
- // but if blockquote is terminated by another tag, they shouldn't
- state.lineMax = nextLine;
- if (state.blkIndent !== 0) {
- // state.blkIndent was non-zero, we now set it to zero,
- // so we need to re-calculate all offsets to appear as
- // if indent wasn't changed
- oldBMarks.push(state.bMarks[nextLine]);
- oldBSCount.push(state.bsCount[nextLine]);
- oldTShift.push(state.tShift[nextLine]);
- oldSCount.push(state.sCount[nextLine]);
- state.sCount[nextLine] -= state.blkIndent;
- }
- break;
- }
- oldBMarks.push(state.bMarks[nextLine]);
- oldBSCount.push(state.bsCount[nextLine]);
- oldTShift.push(state.tShift[nextLine]);
- oldSCount.push(state.sCount[nextLine]);
-
- // A negative indentation means that this is a paragraph continuation
- //
- state.sCount[nextLine] = -1;
- }
- oldIndent = state.blkIndent;
- state.blkIndent = 0;
- token = state.push('blockquote_open', 'blockquote', 1);
- token.markup = '>';
- token.map = lines = [startLine, 0];
- state.md.block.tokenize(state, startLine, nextLine);
- token = state.push('blockquote_close', 'blockquote', -1);
- token.markup = '>';
- state.lineMax = oldLineMax;
- state.parentType = oldParentType;
- lines[1] = state.line;
-
- // Restore original tShift; this might not be necessary since the parser
- // has already been here, but just to make sure we can do that.
- for (i = 0; i < oldTShift.length; i++) {
- state.bMarks[i + startLine] = oldBMarks[i];
- state.tShift[i + startLine] = oldTShift[i];
- state.sCount[i + startLine] = oldSCount[i];
- state.bsCount[i + startLine] = oldBSCount[i];
- }
- state.blkIndent = oldIndent;
- return true;
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.styleSingleton = void 0;
+var _hook = __webpack_require__(/*! ./hook */ "../../../node_modules/react-style-singleton/dist/es2015/hook.js");
+/**
+ * create a Component to add styles on demand
+ * - styles are added when first instance is mounted
+ * - styles are removed when the last instance is unmounted
+ * - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior
+ */
+var styleSingleton = function () {
+ var useStyle = (0, _hook.styleHookSingleton)();
+ var Sheet = function (_a) {
+ var styles = _a.styles,
+ dynamic = _a.dynamic;
+ useStyle(styles, dynamic);
+ return null;
+ };
+ return Sheet;
};
+exports.styleSingleton = styleSingleton;
/***/ }),
-/***/ "../../../node_modules/markdown-it/lib/rules_block/code.js":
-/*!*****************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/rules_block/code.js ***!
- \*****************************************************************/
-/***/ (function(module) {
-
-// Code block (4 spaces padded)
+/***/ "../../../node_modules/react-style-singleton/dist/es2015/hook.js":
+/*!***********************************************************************!*\
+ !*** ../../../node_modules/react-style-singleton/dist/es2015/hook.js ***!
+ \***********************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-module.exports = function code(state, startLine, endLine /*, silent*/) {
- var nextLine, last, token;
- if (state.sCount[startLine] - state.blkIndent < 4) {
- return false;
- }
- last = nextLine = startLine + 1;
- while (nextLine < endLine) {
- if (state.isEmpty(nextLine)) {
- nextLine++;
- continue;
- }
- if (state.sCount[nextLine] - state.blkIndent >= 4) {
- nextLine++;
- last = nextLine;
- continue;
- }
- break;
- }
- state.line = last;
- token = state.push('code_block', 'code', 0);
- token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\n';
- token.map = [startLine, state.line];
- return true;
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.styleHookSingleton = void 0;
+var React = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
+var _singleton = __webpack_require__(/*! ./singleton */ "../../../node_modules/react-style-singleton/dist/es2015/singleton.js");
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+/**
+ * creates a hook to control style singleton
+ * @see {@link styleSingleton} for a safer component version
+ * @example
+ * ```tsx
+ * const useStyle = styleHookSingleton();
+ * ///
+ * useStyle('body { overflow: hidden}');
+ */
+var styleHookSingleton = function () {
+ var sheet = (0, _singleton.stylesheetSingleton)();
+ return function (styles, isDynamic) {
+ React.useEffect(function () {
+ sheet.add(styles);
+ return function () {
+ sheet.remove();
+ };
+ }, [styles && isDynamic]);
+ };
};
+exports.styleHookSingleton = styleHookSingleton;
/***/ }),
-/***/ "../../../node_modules/markdown-it/lib/rules_block/fence.js":
-/*!******************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/rules_block/fence.js ***!
- \******************************************************************/
-/***/ (function(module) {
-
-// fences (``` lang, ~~~ lang)
-
-
+/***/ "../../../node_modules/react-style-singleton/dist/es2015/index.js":
+/*!************************************************************************!*\
+ !*** ../../../node_modules/react-style-singleton/dist/es2015/index.js ***!
+ \************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-module.exports = function fence(state, startLine, endLine, silent) {
- var marker,
- len,
- params,
- nextLine,
- mem,
- token,
- markup,
- haveEndMarker = false,
- pos = state.bMarks[startLine] + state.tShift[startLine],
- max = state.eMarks[startLine];
- // if it's indented more than 3 spaces, it should be a code block
- if (state.sCount[startLine] - state.blkIndent >= 4) {
- return false;
- }
- if (pos + 3 > max) {
- return false;
- }
- marker = state.src.charCodeAt(pos);
- if (marker !== 0x7E /* ~ */ && marker !== 0x60 /* ` */) {
- return false;
- }
- // scan marker length
- mem = pos;
- pos = state.skipChars(pos, marker);
- len = pos - mem;
- if (len < 3) {
- return false;
- }
- markup = state.src.slice(mem, pos);
- params = state.src.slice(pos, max);
- if (marker === 0x60 /* ` */) {
- if (params.indexOf(String.fromCharCode(marker)) >= 0) {
- return false;
- }
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+Object.defineProperty(exports, "styleHookSingleton", ({
+ enumerable: true,
+ get: function () {
+ return _hook.styleHookSingleton;
}
-
- // Since start is found, we can report success here in validation mode
- if (silent) {
- return true;
+}));
+Object.defineProperty(exports, "styleSingleton", ({
+ enumerable: true,
+ get: function () {
+ return _component.styleSingleton;
}
-
- // search end of block
- nextLine = startLine;
- for (;;) {
- nextLine++;
- if (nextLine >= endLine) {
- // unclosed block should be autoclosed by end of document.
- // also block seems to be autoclosed by end of parent
- break;
- }
- pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
- max = state.eMarks[nextLine];
- if (pos < max && state.sCount[nextLine] < state.blkIndent) {
- // non-empty line with negative indent should stop the list:
- // - ```
- // test
- break;
- }
- if (state.src.charCodeAt(pos) !== marker) {
- continue;
- }
- if (state.sCount[nextLine] - state.blkIndent >= 4) {
- // closing fence should be indented less than 4 spaces
- continue;
- }
- pos = state.skipChars(pos, marker);
-
- // closing code fence must be at least as long as the opening one
- if (pos - mem < len) {
- continue;
- }
-
- // make sure tail has spaces only
- pos = state.skipSpaces(pos);
- if (pos < max) {
- continue;
- }
- haveEndMarker = true;
- // found!
- break;
+}));
+Object.defineProperty(exports, "stylesheetSingleton", ({
+ enumerable: true,
+ get: function () {
+ return _singleton.stylesheetSingleton;
}
-
- // If a fence has heading spaces, they should be removed from its inner block
- len = state.sCount[startLine];
- state.line = nextLine + (haveEndMarker ? 1 : 0);
- token = state.push('fence', 'code', 0);
- token.info = params;
- token.content = state.getLines(startLine + 1, nextLine, len, true);
- token.markup = markup;
- token.map = [startLine, state.line];
- return true;
-};
+}));
+var _component = __webpack_require__(/*! ./component */ "../../../node_modules/react-style-singleton/dist/es2015/component.js");
+var _singleton = __webpack_require__(/*! ./singleton */ "../../../node_modules/react-style-singleton/dist/es2015/singleton.js");
+var _hook = __webpack_require__(/*! ./hook */ "../../../node_modules/react-style-singleton/dist/es2015/hook.js");
/***/ }),
-/***/ "../../../node_modules/markdown-it/lib/rules_block/heading.js":
-/*!********************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/rules_block/heading.js ***!
- \********************************************************************/
-/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
-
-// heading (#, ##, ...)
-
-
+/***/ "../../../node_modules/react-style-singleton/dist/es2015/singleton.js":
+/*!****************************************************************************!*\
+ !*** ../../../node_modules/react-style-singleton/dist/es2015/singleton.js ***!
+ \****************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-var isSpace = (__webpack_require__(/*! ../common/utils */ "../../../node_modules/markdown-it/lib/common/utils.js").isSpace);
-module.exports = function heading(state, startLine, endLine, silent) {
- var ch,
- level,
- tmp,
- token,
- pos = state.bMarks[startLine] + state.tShift[startLine],
- max = state.eMarks[startLine];
- // if it's indented more than 3 spaces, it should be a code block
- if (state.sCount[startLine] - state.blkIndent >= 4) {
- return false;
- }
- ch = state.src.charCodeAt(pos);
- if (ch !== 0x23 /* # */ || pos >= max) {
- return false;
- }
- // count heading level
- level = 1;
- ch = state.src.charCodeAt(++pos);
- while (ch === 0x23 /* # */ && pos < max && level <= 6) {
- level++;
- ch = state.src.charCodeAt(++pos);
- }
- if (level > 6 || pos < max && !isSpace(ch)) {
- return false;
- }
- if (silent) {
- return true;
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.stylesheetSingleton = void 0;
+var _getNonce = __webpack_require__(/*! get-nonce */ "../../../node_modules/get-nonce/dist/es2015/index.js");
+function makeStyleTag() {
+ if (!document) return null;
+ var tag = document.createElement('style');
+ tag.type = 'text/css';
+ var nonce = (0, _getNonce.getNonce)();
+ if (nonce) {
+ tag.setAttribute('nonce', nonce);
}
-
- // Let's cut tails like ' ### ' from the end of string
-
- max = state.skipSpacesBack(max, pos);
- tmp = state.skipCharsBack(max, 0x23, pos); // #
- if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {
- max = tmp;
+ return tag;
+}
+function injectStyles(tag, css) {
+ // @ts-ignore
+ if (tag.styleSheet) {
+ // @ts-ignore
+ tag.styleSheet.cssText = css;
+ } else {
+ tag.appendChild(document.createTextNode(css));
}
- state.line = startLine + 1;
- token = state.push('heading_open', 'h' + String(level), 1);
- token.markup = '########'.slice(0, level);
- token.map = [startLine, state.line];
- token = state.push('inline', '', 0);
- token.content = state.src.slice(pos, max).trim();
- token.map = [startLine, state.line];
- token.children = [];
- token = state.push('heading_close', 'h' + String(level), -1);
- token.markup = '########'.slice(0, level);
- return true;
+}
+function insertStyleTag(tag) {
+ var head = document.head || document.getElementsByTagName('head')[0];
+ head.appendChild(tag);
+}
+var stylesheetSingleton = function () {
+ var counter = 0;
+ var stylesheet = null;
+ return {
+ add: function (style) {
+ if (counter == 0) {
+ if (stylesheet = makeStyleTag()) {
+ injectStyles(stylesheet, style);
+ insertStyleTag(stylesheet);
+ }
+ }
+ counter++;
+ },
+ remove: function () {
+ counter--;
+ if (!counter && stylesheet) {
+ stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
+ stylesheet = null;
+ }
+ }
+ };
};
+exports.stylesheetSingleton = stylesheetSingleton;
/***/ }),
-/***/ "../../../node_modules/markdown-it/lib/rules_block/hr.js":
-/*!***************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/rules_block/hr.js ***!
- \***************************************************************/
-/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
-
-// Horizontal rule
-
+/***/ "../../../node_modules/react/cjs/react-jsx-runtime.development.js":
+/*!************************************************************************!*\
+ !*** ../../../node_modules/react/cjs/react-jsx-runtime.development.js ***!
+ \************************************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+/**
+ * @license React
+ * react-jsx-runtime.development.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
-var isSpace = (__webpack_require__(/*! ../common/utils */ "../../../node_modules/markdown-it/lib/common/utils.js").isSpace);
-module.exports = function hr(state, startLine, endLine, silent) {
- var marker,
- cnt,
- ch,
- token,
- pos = state.bMarks[startLine] + state.tShift[startLine],
- max = state.eMarks[startLine];
- // if it's indented more than 3 spaces, it should be a code block
- if (state.sCount[startLine] - state.blkIndent >= 4) {
- return false;
- }
- marker = state.src.charCodeAt(pos++);
- // Check hr marker
- if (marker !== 0x2A /* * */ && marker !== 0x2D /* - */ && marker !== 0x5F /* _ */) {
- return false;
- }
+if (true) {
+ (function () {
+ 'use strict';
- // markers can be mixed with spaces, but there should be at least 3 of them
+ var React = __webpack_require__(/*! react */ "react");
- cnt = 1;
- while (pos < max) {
- ch = state.src.charCodeAt(pos++);
- if (ch !== marker && !isSpace(ch)) {
- return false;
+ // ATTENTION
+ // When adding new symbols to this file,
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
+ // The Symbol used to tag the ReactElement-like types.
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal');
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context');
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
+ function getIteratorFn(maybeIterable) {
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
+ return null;
+ }
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
+ if (typeof maybeIterator === 'function') {
+ return maybeIterator;
+ }
+ return null;
}
- if (ch === marker) {
- cnt++;
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+ function error(format) {
+ {
+ {
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
+ args[_key2 - 1] = arguments[_key2];
+ }
+ printWarning('error', format, args);
+ }
+ }
}
- }
- if (cnt < 3) {
- return false;
- }
- if (silent) {
- return true;
- }
- state.line = startLine + 1;
- token = state.push('hr', 'hr', 0);
- token.map = [startLine, state.line];
- token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
- return true;
-};
+ function printWarning(level, format, args) {
+ // When changing this logic, you might want to also
+ // update consoleWithStackDev.www.js as well.
+ {
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
+ if (stack !== '') {
+ format += '%s';
+ args = args.concat([stack]);
+ } // eslint-disable-next-line react-internal/safe-string-coercion
-/***/ }),
+ var argsWithFormat = args.map(function (item) {
+ return String(item);
+ }); // Careful: RN currently depends on this prefix
-/***/ "../../../node_modules/markdown-it/lib/rules_block/html_block.js":
-/*!***********************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/rules_block/html_block.js ***!
- \***********************************************************************/
-/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
+ // breaks IE9: https://github.com/facebook/react/issues/13610
+ // eslint-disable-next-line react-internal/no-production-logging
-// HTML block
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
+ }
+ }
+ // -----------------------------------------------------------------------------
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
+ var enableCacheElement = false;
+ var enableTransitionTracing = false; // No known bugs, but needs performance testing
-var block_names = __webpack_require__(/*! ../common/html_blocks */ "../../../node_modules/markdown-it/lib/common/html_blocks.js");
-var HTML_OPEN_CLOSE_TAG_RE = (__webpack_require__(/*! ../common/html_re */ "../../../node_modules/markdown-it/lib/common/html_re.js").HTML_OPEN_CLOSE_TAG_RE);
+ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
+ // stuff. Intended to enable React core members to more easily debug scheduling
+ // issues in DEV builds.
-// An array of opening and corresponding closing sequences for html tags,
-// last argument defines whether it can terminate a paragraph or not
-//
-var HTML_SEQUENCES = [[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, true], [/^/, true], [/^<\?/, /\?>/, true], [/^/, true], [/^/, true], [new RegExp('^?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true], [new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false]];
-module.exports = function html_block(state, startLine, endLine, silent) {
- var i,
- nextLine,
- token,
- lineText,
- pos = state.bMarks[startLine] + state.tShift[startLine],
- max = state.eMarks[startLine];
+ var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
- // if it's indented more than 3 spaces, it should be a code block
- if (state.sCount[startLine] - state.blkIndent >= 4) {
- return false;
- }
- if (!state.md.options.html) {
- return false;
- }
- if (state.src.charCodeAt(pos) !== 0x3C /* < */) {
- return false;
- }
- lineText = state.src.slice(pos, max);
- for (i = 0; i < HTML_SEQUENCES.length; i++) {
- if (HTML_SEQUENCES[i][0].test(lineText)) {
- break;
+ var REACT_MODULE_REFERENCE;
+ {
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
}
- }
- if (i === HTML_SEQUENCES.length) {
- return false;
- }
- if (silent) {
- // true if this sequence can be a terminator, false otherwise
- return HTML_SEQUENCES[i][2];
- }
- nextLine = startLine + 1;
+ function isValidElementType(type) {
+ if (typeof type === 'string' || typeof type === 'function') {
+ return true;
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
- // If we are here - we detected HTML block.
- // Let's roll down till block end.
- if (!HTML_SEQUENCES[i][1].test(lineText)) {
- for (; nextLine < endLine; nextLine++) {
- if (state.sCount[nextLine] < state.blkIndent) {
- break;
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
+ return true;
}
- pos = state.bMarks[nextLine] + state.tShift[nextLine];
- max = state.eMarks[nextLine];
- lineText = state.src.slice(pos, max);
- if (HTML_SEQUENCES[i][1].test(lineText)) {
- if (lineText.length !== 0) {
- nextLine++;
+ if (typeof type === 'object' && type !== null) {
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE ||
+ // This needs to include all possible module reference object
+ // types supported by any Flight configuration anywhere since
+ // we don't know which Flight build this will end up being used
+ // with.
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
+ return true;
}
- break;
}
+ return false;
}
- }
- state.line = nextLine;
- token = state.push('html_block', '', 0);
- token.map = [startLine, nextLine];
- token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
- return true;
-};
-
-/***/ }),
+ function getWrappedName(outerType, innerType, wrapperName) {
+ var displayName = outerType.displayName;
+ if (displayName) {
+ return displayName;
+ }
+ var functionName = innerType.displayName || innerType.name || '';
+ return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
+ } // Keep in sync with react-reconciler/getComponentNameFromFiber
-/***/ "../../../node_modules/markdown-it/lib/rules_block/lheading.js":
-/*!*********************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/rules_block/lheading.js ***!
- \*********************************************************************/
-/***/ (function(module) {
-
-// lheading (---, ===)
+ function getContextName(type) {
+ return type.displayName || 'Context';
+ } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
+ function getComponentNameFromType(type) {
+ if (type == null) {
+ // Host root, text node or just invalid type.
+ return null;
+ }
+ {
+ if (typeof type.tag === 'number') {
+ error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
+ }
+ }
+ if (typeof type === 'function') {
+ return type.displayName || type.name || null;
+ }
+ if (typeof type === 'string') {
+ return type;
+ }
+ switch (type) {
+ case REACT_FRAGMENT_TYPE:
+ return 'Fragment';
+ case REACT_PORTAL_TYPE:
+ return 'Portal';
+ case REACT_PROFILER_TYPE:
+ return 'Profiler';
+ case REACT_STRICT_MODE_TYPE:
+ return 'StrictMode';
+ case REACT_SUSPENSE_TYPE:
+ return 'Suspense';
+ case REACT_SUSPENSE_LIST_TYPE:
+ return 'SuspenseList';
+ }
+ if (typeof type === 'object') {
+ switch (type.$$typeof) {
+ case REACT_CONTEXT_TYPE:
+ var context = type;
+ return getContextName(context) + '.Consumer';
+ case REACT_PROVIDER_TYPE:
+ var provider = type;
+ return getContextName(provider._context) + '.Provider';
+ case REACT_FORWARD_REF_TYPE:
+ return getWrappedName(type, type.render, 'ForwardRef');
+ case REACT_MEMO_TYPE:
+ var outerName = type.displayName || null;
+ if (outerName !== null) {
+ return outerName;
+ }
+ return getComponentNameFromType(type.type) || 'Memo';
+ case REACT_LAZY_TYPE:
+ {
+ var lazyComponent = type;
+ var payload = lazyComponent._payload;
+ var init = lazyComponent._init;
+ try {
+ return getComponentNameFromType(init(payload));
+ } catch (x) {
+ return null;
+ }
+ }
+ // eslint-disable-next-line no-fallthrough
+ }
+ }
-module.exports = function lheading(state, startLine, endLine /*, silent*/) {
- var content,
- terminate,
- i,
- l,
- token,
- pos,
- max,
- level,
- marker,
- nextLine = startLine + 1,
- oldParentType,
- terminatorRules = state.md.block.ruler.getRules('paragraph');
+ return null;
+ }
+ var assign = Object.assign;
- // if it's indented more than 3 spaces, it should be a code block
- if (state.sCount[startLine] - state.blkIndent >= 4) {
- return false;
- }
- oldParentType = state.parentType;
- state.parentType = 'paragraph'; // use paragraph to match terminatorRules
+ // Helpers to patch console.logs to avoid logging during side-effect free
+ // replaying on render function. This currently only patches the object
+ // lazily which won't cover if the log function was extracted eagerly.
+ // We could also eagerly patch the method.
+ var disabledDepth = 0;
+ var prevLog;
+ var prevInfo;
+ var prevWarn;
+ var prevError;
+ var prevGroup;
+ var prevGroupCollapsed;
+ var prevGroupEnd;
+ function disabledLog() {}
+ disabledLog.__reactDisabledLog = true;
+ function disableLogs() {
+ {
+ if (disabledDepth === 0) {
+ /* eslint-disable react-internal/no-production-logging */
+ prevLog = console.log;
+ prevInfo = console.info;
+ prevWarn = console.warn;
+ prevError = console.error;
+ prevGroup = console.group;
+ prevGroupCollapsed = console.groupCollapsed;
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
- // jump line-by-line until empty one or EOF
- for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
- // this would be a code block normally, but after paragraph
- // it's considered a lazy continuation regardless of what's there
- if (state.sCount[nextLine] - state.blkIndent > 3) {
- continue;
- }
+ var props = {
+ configurable: true,
+ enumerable: true,
+ value: disabledLog,
+ writable: true
+ }; // $FlowFixMe Flow thinks console is immutable.
- //
- // Check for underline in setext header
- //
- if (state.sCount[nextLine] >= state.blkIndent) {
- pos = state.bMarks[nextLine] + state.tShift[nextLine];
- max = state.eMarks[nextLine];
- if (pos < max) {
- marker = state.src.charCodeAt(pos);
- if (marker === 0x2D /* - */ || marker === 0x3D /* = */) {
- pos = state.skipChars(pos, marker);
- pos = state.skipSpaces(pos);
- if (pos >= max) {
- level = marker === 0x3D /* = */ ? 1 : 2;
- break;
- }
+ Object.defineProperties(console, {
+ info: props,
+ log: props,
+ warn: props,
+ error: props,
+ group: props,
+ groupCollapsed: props,
+ groupEnd: props
+ });
+ /* eslint-enable react-internal/no-production-logging */
}
+
+ disabledDepth++;
}
}
+ function reenableLogs() {
+ {
+ disabledDepth--;
+ if (disabledDepth === 0) {
+ /* eslint-disable react-internal/no-production-logging */
+ var props = {
+ configurable: true,
+ enumerable: true,
+ writable: true
+ }; // $FlowFixMe Flow thinks console is immutable.
- // quirk for blockquotes, this line should already be checked by that rule
- if (state.sCount[nextLine] < 0) {
- continue;
+ Object.defineProperties(console, {
+ log: assign({}, props, {
+ value: prevLog
+ }),
+ info: assign({}, props, {
+ value: prevInfo
+ }),
+ warn: assign({}, props, {
+ value: prevWarn
+ }),
+ error: assign({}, props, {
+ value: prevError
+ }),
+ group: assign({}, props, {
+ value: prevGroup
+ }),
+ groupCollapsed: assign({}, props, {
+ value: prevGroupCollapsed
+ }),
+ groupEnd: assign({}, props, {
+ value: prevGroupEnd
+ })
+ });
+ /* eslint-enable react-internal/no-production-logging */
+ }
+
+ if (disabledDepth < 0) {
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
+ }
+ }
}
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
+ var prefix;
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
+ {
+ if (prefix === undefined) {
+ // Extract the VM specific prefix used by each line.
+ try {
+ throw Error();
+ } catch (x) {
+ var match = x.stack.trim().match(/\n( *(at )?)/);
+ prefix = match && match[1] || '';
+ }
+ } // We use the prefix to ensure our stacks line up with native stack frames.
- // Some tags can terminate paragraph without empty line.
- terminate = false;
- for (i = 0, l = terminatorRules.length; i < l; i++) {
- if (terminatorRules[i](state, nextLine, endLine, true)) {
- terminate = true;
- break;
+ return '\n' + prefix + name;
}
}
- if (terminate) {
- break;
+ var reentry = false;
+ var componentFrameCache;
+ {
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
+ componentFrameCache = new PossiblyWeakMap();
}
- }
- if (!level) {
- // Didn't find valid underline
- return false;
- }
- content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
- state.line = nextLine + 1;
- token = state.push('heading_open', 'h' + String(level), 1);
- token.markup = String.fromCharCode(marker);
- token.map = [startLine, state.line];
- token = state.push('inline', '', 0);
- token.content = content;
- token.map = [startLine, state.line - 1];
- token.children = [];
- token = state.push('heading_close', 'h' + String(level), -1);
- token.markup = String.fromCharCode(marker);
- state.parentType = oldParentType;
- return true;
-};
+ function describeNativeComponentFrame(fn, construct) {
+ // If something asked for a stack inside a fake render, it should get ignored.
+ if (!fn || reentry) {
+ return '';
+ }
+ {
+ var frame = componentFrameCache.get(fn);
+ if (frame !== undefined) {
+ return frame;
+ }
+ }
+ var control;
+ reentry = true;
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
-/***/ }),
+ Error.prepareStackTrace = undefined;
+ var previousDispatcher;
+ {
+ previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
+ // for warnings.
-/***/ "../../../node_modules/markdown-it/lib/rules_block/list.js":
-/*!*****************************************************************!*\
- !*** ../../../node_modules/markdown-it/lib/rules_block/list.js ***!
- \*****************************************************************/
-/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+ ReactCurrentDispatcher.current = null;
+ disableLogs();
+ }
+ try {
+ // This should throw.
+ if (construct) {
+ // Something should be setting the props in the constructor.
+ var Fake = function () {
+ throw Error();
+ }; // $FlowFixMe
-// Lists
+ Object.defineProperty(Fake.prototype, 'props', {
+ set: function () {
+ // We use a throwing setter instead of frozen or non-writable props
+ // because that won't throw in a non-strict mode function.
+ throw Error();
+ }
+ });
+ if (typeof Reflect === 'object' && Reflect.construct) {
+ // We construct a different control for this case to include any extra
+ // frames added by the construct call.
+ try {
+ Reflect.construct(Fake, []);
+ } catch (x) {
+ control = x;
+ }
+ Reflect.construct(fn, [], Fake);
+ } else {
+ try {
+ Fake.call();
+ } catch (x) {
+ control = x;
+ }
+ fn.call(Fake.prototype);
+ }
+ } else {
+ try {
+ throw Error();
+ } catch (x) {
+ control = x;
+ }
+ fn();
+ }
+ } catch (sample) {
+ // This is inlined manually because closure doesn't do it for us.
+ if (sample && control && typeof sample.stack === 'string') {
+ // This extracts the first frame from the sample that isn't also in the control.
+ // Skipping one frame that we assume is the frame that calls the two.
+ var sampleLines = sample.stack.split('\n');
+ var controlLines = control.stack.split('\n');
+ var s = sampleLines.length - 1;
+ var c = controlLines.length - 1;
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
+ // We expect at least one stack frame to be shared.
+ // Typically this will be the root most one. However, stack frames may be
+ // cut off due to maximum stack limits. In this case, one maybe cut off
+ // earlier than the other. We assume that the sample is longer or the same
+ // and there for cut off earlier. So we should find the root most frame in
+ // the sample somewhere in the control.
+ c--;
+ }
+ for (; s >= 1 && c >= 0; s--, c--) {
+ // Next we find the first one that isn't the same which should be the
+ // frame that called our sample function and the control.
+ if (sampleLines[s] !== controlLines[c]) {
+ // In V8, the first line is describing the message but other VMs don't.
+ // If we're about to return the first line, and the control is also on the same
+ // line, that's a pretty good indicator that our sample threw at same line as
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
+ // This can happen if you passed a class to function component, or non-function.
+ if (s !== 1 || c !== 1) {
+ do {
+ s--;
+ c--; // We may still have similar intermediate frames from the construct call.
+ // The next one that isn't the same should be our match though.
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "' + escapeHtml(token.content) + '
';
+};
+default_rules.code_block = function (tokens, idx, options, env, slf) {
+ const token = tokens[idx];
+ return '
\n';
+};
+default_rules.fence = function (tokens, idx, options, env, slf) {
+ const token = tokens[idx];
+ const info = token.info ? unescapeAll(token.info).trim() : '';
+ let langName = '';
+ let langAttrs = '';
+ if (info) {
+ const arr = info.split(/(\s+)/g);
+ langName = arr[0];
+ langAttrs = arr.slice(2).join('');
+ }
+ let highlighted;
+ if (options.highlight) {
+ highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
+ } else {
+ highlighted = escapeHtml(token.content);
+ }
+ if (highlighted.indexOf('' + escapeHtml(tokens[idx].content) + '
\n`;
+ }
+ return `${highlighted}
\n`;
+};
+default_rules.image = function (tokens, idx, options, env, slf) {
+ const token = tokens[idx];
+
+ // "alt" attr MUST be set, even if empty. Because it's mandatory and
+ // should be placed on proper position for tests.
+ //
+ // Replace content with actual value
+
+ token.attrs[token.attrIndex('alt')][1] = slf.renderInlineAsText(token.children, options, env);
+ return slf.renderToken(tokens, idx, options);
+};
+default_rules.hardbreak = function (tokens, idx, options /*, env */) {
+ return options.xhtmlOut ? '${highlighted}
\n' : '
\n';
+};
+default_rules.softbreak = function (tokens, idx, options /*, env */) {
+ return options.breaks ? options.xhtmlOut ? '
\n' : '
\n' : '\n';
+};
+default_rules.text = function (tokens, idx /*, options, env */) {
+ return escapeHtml(tokens[idx].content);
+};
+default_rules.html_block = function (tokens, idx /*, options, env */) {
+ return tokens[idx].content;
+};
+default_rules.html_inline = function (tokens, idx /*, options, env */) {
+ return tokens[idx].content;
+};
+
+/**
+ * new Renderer()
+ *
+ * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.
+ **/
+function Renderer() {
+ /**
+ * Renderer#rules -> Object
+ *
+ * Contains render rules for tokens. Can be updated and extended.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.renderer.rules.strong_open = function () { return ''; };
+ * md.renderer.rules.strong_close = function () { return ''; };
+ *
+ * var result = md.renderInline(...);
+ * ```
+ *
+ * Each rule is called as independent static function with fixed signature:
+ *
+ * ```javascript
+ * function my_token_render(tokens, idx, options, env, renderer) {
+ * // ...
+ * return renderedHTML;
+ * }
+ * ```
+ *
+ * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.mjs)
+ * for more details and examples.
+ **/
+ this.rules = assign({}, default_rules);
+}
+
+/**
+ * Renderer.renderAttrs(token) -> String
+ *
+ * Render token attributes to string.
+ **/
+Renderer.prototype.renderAttrs = function renderAttrs(token) {
+ let i, l, result;
+ if (!token.attrs) {
+ return '';
+ }
+ result = '';
+ for (i = 0, l = token.attrs.length; i < l; i++) {
+ result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
+ }
+ return result;
+};
+
+/**
+ * Renderer.renderToken(tokens, idx, options) -> String
+ * - tokens (Array): list of tokens
+ * - idx (Numbed): token index to render
+ * - options (Object): params of parser instance
+ *
+ * Default token renderer. Can be overriden by custom function
+ * in [[Renderer#rules]].
+ **/
+Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
+ const token = tokens[idx];
+ let result = '';
+
+ // Tight list paragraphs
+ if (token.hidden) {
+ return '';
+ }
+
+ // Insert a newline between hidden paragraph and subsequent opening
+ // block-level tag.
+ //
+ // For example, here we should insert a newline before blockquote:
+ // - a
+ // >
+ //
+ if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {
+ result += '\n';
+ }
+
+ // Add token name, e.g. ``.
+ //
+ needLf = false;
}
- };
- }), w.registerHelper("wordChars", "javascript", /[\w$]/), w.defineMIME("text/javascript", "javascript"), w.defineMIME("text/ecmascript", "javascript"), w.defineMIME("application/javascript", "javascript"), w.defineMIME("application/x-javascript", "javascript"), w.defineMIME("application/ecmascript", "javascript"), w.defineMIME("application/json", {
- name: "javascript",
- json: !0
- }), w.defineMIME("application/x-json", {
- name: "javascript",
- json: !0
- }), w.defineMIME("application/manifest+json", {
- name: "javascript",
- json: !0
- }), w.defineMIME("application/ld+json", {
- name: "javascript",
- jsonld: !0
- }), w.defineMIME("text/typescript", {
- name: "javascript",
- typescript: !0
- }), w.defineMIME("application/typescript", {
- name: "javascript",
- typescript: !0
- });
- });
-})();
-var Jr = ye.exports;
-const je = Dr.getDefaultExportFromCjs(Jr),
- Ee = ge({
- __proto__: null,
- default: je
- }, [Jr]);
-exports.javascript = Ee;
+ }
+ }
+ }
+ result += needLf ? '>\n' : '>';
+ return result;
+};
+
+/**
+ * Renderer.renderInline(tokens, options, env) -> String
+ * - tokens (Array): list on block tokens to render
+ * - options (Object): params of parser instance
+ * - env (Object): additional data from parsed input (references, for example)
+ *
+ * The same as [[Renderer.render]], but for single token of `inline` type.
+ **/
+Renderer.prototype.renderInline = function (tokens, options, env) {
+ let result = '';
+ const rules = this.rules;
+ for (let i = 0, len = tokens.length; i < len; i++) {
+ const type = tokens[i].type;
+ if (typeof rules[type] !== 'undefined') {
+ result += rules[type](tokens, i, options, env, this);
+ } else {
+ result += this.renderToken(tokens, i, options);
+ }
+ }
+ return result;
+};
-/***/ }),
+/** internal
+ * Renderer.renderInlineAsText(tokens, options, env) -> String
+ * - tokens (Array): list on block tokens to render
+ * - options (Object): params of parser instance
+ * - env (Object): additional data from parsed input (references, for example)
+ *
+ * Special kludge for image `alt` attributes to conform CommonMark spec.
+ * Don't try to use it! Spec requires to show `alt` content with stripped markup,
+ * instead of simple escaping.
+ **/
+Renderer.prototype.renderInlineAsText = function (tokens, options, env) {
+ let result = '';
+ for (let i = 0, len = tokens.length; i < len; i++) {
+ switch (tokens[i].type) {
+ case 'text':
+ result += tokens[i].content;
+ break;
+ case 'image':
+ result += this.renderInlineAsText(tokens[i].children, options, env);
+ break;
+ case 'html_inline':
+ case 'html_block':
+ result += tokens[i].content;
+ break;
+ case 'softbreak':
+ case 'hardbreak':
+ result += '\n';
+ break;
+ // all other tokens are skipped
+ }
+ }
-/***/ "../../graphiql-react/dist/jump-to-line.cjs.js":
-/*!*****************************************************!*\
- !*** ../../graphiql-react/dist/jump-to-line.cjs.js ***!
- \*****************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+ return result;
+};
+
+/**
+ * Renderer.render(tokens, options, env) -> String
+ * - tokens (Array): list on block tokens to render
+ * - options (Object): params of parser instance
+ * - env (Object): additional data from parsed input (references, for example)
+ *
+ * Takes token stream and generates HTML. Probably, you will never need to call
+ * this method directly.
+ **/
+Renderer.prototype.render = function (tokens, options, env) {
+ let result = '';
+ const rules = this.rules;
+ for (let i = 0, len = tokens.length; i < len; i++) {
+ const type = tokens[i].type;
+ if (type === 'inline') {
+ result += this.renderInline(tokens[i].children, options, env);
+ } else if (typeof rules[type] !== 'undefined') {
+ result += rules[type](tokens, i, options, env, this);
+ } else {
+ result += this.renderToken(tokens, i, options, env);
+ }
+ }
+ return result;
+};
+
+/**
+ * class Ruler
+ *
+ * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and
+ * [[MarkdownIt#inline]] to manage sequences of functions (rules):
+ *
+ * - keep rules in defined order
+ * - assign the name to each rule
+ * - enable/disable rules
+ * - add/replace rules
+ * - allow assign rules to additional named chains (in the same)
+ * - cacheing lists of active rules
+ *
+ * You will not need use this class directly until write plugins. For simple
+ * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
+ * [[MarkdownIt.use]].
+ **/
+/**
+ * new Ruler()
+ **/
+function Ruler() {
+ // List of added rules. Each element is:
+ //
+ // {
+ // name: XXX,
+ // enabled: Boolean,
+ // fn: Function(),
+ // alt: [ name2, name3 ]
+ // }
+ //
+ this.__rules__ = [];
+ // Cached rule chains.
+ //
+ // First level - chain name, '' for default.
+ // Second level - diginal anchor for fast filtering by charcodes.
+ //
+ this.__cache__ = null;
+}
-var m = Object.defineProperty;
-var c = (u, p) => m(u, "name", {
- value: p,
- configurable: !0
-});
-const f = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"),
- g = __webpack_require__(/*! ./dialog.cjs2.js */ "../../graphiql-react/dist/dialog.cjs2.js");
-function h(u, p) {
- for (var o = 0; o < p.length; o++) {
- const s = p[o];
- if (typeof s != "string" && !Array.isArray(s)) {
- for (const i in s) if (i !== "default" && !(i in u)) {
- const a = Object.getOwnPropertyDescriptor(s, i);
- a && Object.defineProperty(u, i, a.get ? a : {
- enumerable: !0,
- get: () => s[i]
- });
- }
+// Helper methods, should not be used directly
+
+// Find rule index by name
+//
+Ruler.prototype.__find__ = function (name) {
+ for (let i = 0; i < this.__rules__.length; i++) {
+ if (this.__rules__[i].name === name) {
+ return i;
}
}
- return Object.freeze(Object.defineProperty(u, Symbol.toStringTag, {
- value: "Module"
- }));
-}
-c(h, "_mergeNamespaces");
-var b = {
- exports: {}
+ return -1;
};
-(function (u, p) {
- (function (o) {
- o(f.requireCodemirror(), g.requireDialog());
- })(function (o) {
- o.defineOption("search", {
- bottom: !1
- });
- function s(e, t, n, r, l) {
- e.openDialog ? e.openDialog(t, l, {
- value: r,
- selectValueOnOpen: !0,
- bottom: e.options.search.bottom
- }) : l(prompt(n, r));
- }
- c(s, "dialog");
- function i(e) {
- return e.phrase("Jump to line:") + ' ' + e.phrase("(Use line:column or scroll% syntax)") + "";
- }
- c(i, "getJumpDialog");
- function a(e, t) {
- var n = Number(t);
- return /^[-+]/.test(t) ? e.getCursor().line + n : n - 1;
+
+// Build rules lookup cache
+//
+Ruler.prototype.__compile__ = function () {
+ const self = this;
+ const chains = [''];
+
+ // collect unique names
+ self.__rules__.forEach(function (rule) {
+ if (!rule.enabled) {
+ return;
}
- c(a, "interpretLine"), o.commands.jumpToLine = function (e) {
- var t = e.getCursor();
- s(e, i(e), e.phrase("Jump to line:"), t.line + 1 + ":" + t.ch, function (n) {
- if (n) {
- var r;
- if (r = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(n)) e.setCursor(a(e, r[1]), Number(r[2]));else if (r = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(n)) {
- var l = Math.round(e.lineCount() * Number(r[1]) / 100);
- /^[-+]/.test(r[1]) && (l = t.line + l + 1), e.setCursor(l - 1, t.ch);
- } else (r = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(n)) && e.setCursor(a(e, r[1]), t.ch);
- }
- });
- }, o.keyMap.default["Alt-G"] = "jumpToLine";
+ rule.alt.forEach(function (altName) {
+ if (chains.indexOf(altName) < 0) {
+ chains.push(altName);
+ }
+ });
});
-})();
-var d = b.exports;
-const j = f.getDefaultExportFromCjs(d),
- y = h({
- __proto__: null,
- default: j
- }, [d]);
-exports.jumpToLine = y;
+ self.__cache__ = {};
+ chains.forEach(function (chain) {
+ self.__cache__[chain] = [];
+ self.__rules__.forEach(function (rule) {
+ if (!rule.enabled) {
+ return;
+ }
+ if (chain && rule.alt.indexOf(chain) < 0) {
+ return;
+ }
+ self.__cache__[chain].push(rule.fn);
+ });
+ });
+};
-/***/ }),
+/**
+ * Ruler.at(name, fn [, options])
+ * - name (String): rule name to replace.
+ * - fn (Function): new rule function.
+ * - options (Object): new rule options (not mandatory).
+ *
+ * Replace rule by name with new function & options. Throws error if name not
+ * found.
+ *
+ * ##### Options:
+ *
+ * - __alt__ - array with names of "alternate" chains.
+ *
+ * ##### Example
+ *
+ * Replace existing typographer replacement rule with new one:
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.core.ruler.at('replacements', function replace(state) {
+ * //...
+ * });
+ * ```
+ **/
+Ruler.prototype.at = function (name, fn, options) {
+ const index = this.__find__(name);
+ const opt = options || {};
+ if (index === -1) {
+ throw new Error('Parser rule not found: ' + name);
+ }
+ this.__rules__[index].fn = fn;
+ this.__rules__[index].alt = opt.alt || [];
+ this.__cache__ = null;
+};
-/***/ "../../graphiql-react/dist/jump.cjs.js":
-/*!*********************************************!*\
- !*** ../../graphiql-react/dist/jump.cjs.js ***!
- \*********************************************/
-/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+/**
+ * Ruler.before(beforeName, ruleName, fn [, options])
+ * - beforeName (String): new rule will be added before this one.
+ * - ruleName (String): name of added rule.
+ * - fn (Function): rule function.
+ * - options (Object): rule options (not mandatory).
+ *
+ * Add new rule to chain before one with given name. See also
+ * [[Ruler.after]], [[Ruler.push]].
+ *
+ * ##### Options:
+ *
+ * - __alt__ - array with names of "alternate" chains.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {
+ * //...
+ * });
+ * ```
+ **/
+Ruler.prototype.before = function (beforeName, ruleName, fn, options) {
+ const index = this.__find__(beforeName);
+ const opt = options || {};
+ if (index === -1) {
+ throw new Error('Parser rule not found: ' + beforeName);
+ }
+ this.__rules__.splice(index, 0, {
+ name: ruleName,
+ enabled: true,
+ fn,
+ alt: opt.alt || []
+ });
+ this.__cache__ = null;
+};
+/**
+ * Ruler.after(afterName, ruleName, fn [, options])
+ * - afterName (String): new rule will be added after this one.
+ * - ruleName (String): name of added rule.
+ * - fn (Function): rule function.
+ * - options (Object): rule options (not mandatory).
+ *
+ * Add new rule to chain after one with given name. See also
+ * [[Ruler.before]], [[Ruler.push]].
+ *
+ * ##### Options:
+ *
+ * - __alt__ - array with names of "alternate" chains.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.inline.ruler.after('text', 'my_rule', function replace(state) {
+ * //...
+ * });
+ * ```
+ **/
+Ruler.prototype.after = function (afterName, ruleName, fn, options) {
+ const index = this.__find__(afterName);
+ const opt = options || {};
+ if (index === -1) {
+ throw new Error('Parser rule not found: ' + afterName);
+ }
+ this.__rules__.splice(index + 1, 0, {
+ name: ruleName,
+ enabled: true,
+ fn,
+ alt: opt.alt || []
+ });
+ this.__cache__ = null;
+};
+/**
+ * Ruler.push(ruleName, fn [, options])
+ * - ruleName (String): name of added rule.
+ * - fn (Function): rule function.
+ * - options (Object): rule options (not mandatory).
+ *
+ * Push new rule to the end of chain. See also
+ * [[Ruler.before]], [[Ruler.after]].
+ *
+ * ##### Options:
+ *
+ * - __alt__ - array with names of "alternate" chains.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.core.ruler.push('my_rule', function replace(state) {
+ * //...
+ * });
+ * ```
+ **/
+Ruler.prototype.push = function (ruleName, fn, options) {
+ const opt = options || {};
+ this.__rules__.push({
+ name: ruleName,
+ enabled: true,
+ fn,
+ alt: opt.alt || []
+ });
+ this.__cache__ = null;
+};
-var c = Object.defineProperty;
-var s = (e, r) => c(e, "name", {
- value: r,
- configurable: !0
-});
-const u = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"),
- d = __webpack_require__(/*! ./SchemaReference.cjs.js */ "../../graphiql-react/dist/SchemaReference.cjs.js");
-__webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-__webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
-__webpack_require__(/*! ./forEachState.cjs.js */ "../../graphiql-react/dist/forEachState.cjs.js");
-u.CodeMirror.defineOption("jump", !1, (e, r, n) => {
- if (n && n !== u.CodeMirror.Init) {
- const t = e.state.jump.onMouseOver;
- u.CodeMirror.off(e.getWrapperElement(), "mouseover", t);
- const i = e.state.jump.onMouseOut;
- u.CodeMirror.off(e.getWrapperElement(), "mouseout", i), u.CodeMirror.off(document, "keydown", e.state.jump.onKeyDown), delete e.state.jump;
+/**
+ * Ruler.enable(list [, ignoreInvalid]) -> Array
+ * - list (String|Array): list of rule names to enable.
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * Enable rules with given names. If any rule name not found - throw Error.
+ * Errors can be disabled by second param.
+ *
+ * Returns list of found rule names (if no exception happened).
+ *
+ * See also [[Ruler.disable]], [[Ruler.enableOnly]].
+ **/
+Ruler.prototype.enable = function (list, ignoreInvalid) {
+ if (!Array.isArray(list)) {
+ list = [list];
}
- if (r) {
- const t = e.state.jump = {
- options: r,
- onMouseOver: M.bind(null, e),
- onMouseOut: m.bind(null, e),
- onKeyDown: g.bind(null, e)
- };
- u.CodeMirror.on(e.getWrapperElement(), "mouseover", t.onMouseOver), u.CodeMirror.on(e.getWrapperElement(), "mouseout", t.onMouseOut), u.CodeMirror.on(document, "keydown", t.onKeyDown);
+ const result = [];
+
+ // Search by name and enable
+ list.forEach(function (name) {
+ const idx = this.__find__(name);
+ if (idx < 0) {
+ if (ignoreInvalid) {
+ return;
+ }
+ throw new Error('Rules manager: invalid rule name ' + name);
+ }
+ this.__rules__[idx].enabled = true;
+ result.push(name);
+ }, this);
+ this.__cache__ = null;
+ return result;
+};
+
+/**
+ * Ruler.enableOnly(list [, ignoreInvalid])
+ * - list (String|Array): list of rule names to enable (whitelist).
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * Enable rules with given names, and disable everything else. If any rule name
+ * not found - throw Error. Errors can be disabled by second param.
+ *
+ * See also [[Ruler.disable]], [[Ruler.enable]].
+ **/
+Ruler.prototype.enableOnly = function (list, ignoreInvalid) {
+ if (!Array.isArray(list)) {
+ list = [list];
}
-});
-function M(e, r) {
- const n = r.target || r.srcElement;
- if (!(n instanceof HTMLElement) || (n == null ? void 0 : n.nodeName) !== "SPAN") return;
- const t = n.getBoundingClientRect(),
- i = {
- left: (t.left + t.right) / 2,
- top: (t.top + t.bottom) / 2
- };
- e.state.jump.cursor = i, e.state.jump.isHoldingModifier && l(e);
-}
-s(M, "onMouseOver");
-function m(e) {
- if (!e.state.jump.isHoldingModifier && e.state.jump.cursor) {
- e.state.jump.cursor = null;
- return;
+ this.__rules__.forEach(function (rule) {
+ rule.enabled = false;
+ });
+ this.enable(list, ignoreInvalid);
+};
+
+/**
+ * Ruler.disable(list [, ignoreInvalid]) -> Array
+ * - list (String|Array): list of rule names to disable.
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * Disable rules with given names. If any rule name not found - throw Error.
+ * Errors can be disabled by second param.
+ *
+ * Returns list of found rule names (if no exception happened).
+ *
+ * See also [[Ruler.enable]], [[Ruler.enableOnly]].
+ **/
+Ruler.prototype.disable = function (list, ignoreInvalid) {
+ if (!Array.isArray(list)) {
+ list = [list];
}
- e.state.jump.isHoldingModifier && e.state.jump.marker && p(e);
-}
-s(m, "onMouseOut");
-function g(e, r) {
- if (e.state.jump.isHoldingModifier || !k(r.key)) return;
- e.state.jump.isHoldingModifier = !0, e.state.jump.cursor && l(e);
- const n = s(o => {
- o.code === r.code && (e.state.jump.isHoldingModifier = !1, e.state.jump.marker && p(e), u.CodeMirror.off(document, "keyup", n), u.CodeMirror.off(document, "click", t), e.off("mousedown", i));
- }, "onKeyUp"),
- t = s(o => {
- const {
- destination: a,
- options: f
- } = e.state.jump;
- a && f.onClick(a, o);
- }, "onClick"),
- i = s((o, a) => {
- e.state.jump.destination && (a.codemirrorIgnore = !0);
- }, "onMouseDown");
- u.CodeMirror.on(document, "keyup", n), u.CodeMirror.on(document, "click", t), e.on("mousedown", i);
-}
-s(g, "onKeyDown");
-const j = typeof navigator < "u" && navigator && navigator.appVersion.includes("Mac");
-function k(e) {
- return e === (j ? "Meta" : "Control");
-}
-s(k, "isJumpModifier");
-function l(e) {
- if (e.state.jump.marker) return;
- const {
- cursor: r,
- options: n
- } = e.state.jump,
- t = e.coordsChar(r),
- i = e.getTokenAt(t, !0),
- o = n.getDestination || e.getHelper(t, "jump");
- if (o) {
- const a = o(i, n, e);
- if (a) {
- const f = e.markText({
- line: t.line,
- ch: i.start
- }, {
- line: t.line,
- ch: i.end
- }, {
- className: "CodeMirror-jump-token"
- });
- e.state.jump.marker = f, e.state.jump.destination = a;
+ const result = [];
+
+ // Search by name and disable
+ list.forEach(function (name) {
+ const idx = this.__find__(name);
+ if (idx < 0) {
+ if (ignoreInvalid) {
+ return;
+ }
+ throw new Error('Rules manager: invalid rule name ' + name);
}
- }
-}
-s(l, "enableJumpMode");
-function p(e) {
- const {
- marker: r
- } = e.state.jump;
- e.state.jump.marker = null, e.state.jump.destination = null, r.clear();
-}
-s(p, "disableJumpMode");
-u.CodeMirror.registerHelper("jump", "graphql", (e, r) => {
- if (!r.schema || !r.onClick || !e.state) return;
- const {
- state: n
- } = e,
- {
- kind: t,
- step: i
- } = n,
- o = d.getTypeInfo(r.schema, n);
- if (t === "Field" && i === 0 && o.fieldDef || t === "AliasedField" && i === 2 && o.fieldDef) return d.getFieldReference(o);
- if (t === "Directive" && i === 1 && o.directiveDef) return d.getDirectiveReference(o);
- if (t === "Argument" && i === 0 && o.argDef) return d.getArgumentReference(o);
- if (t === "EnumValue" && o.enumValue) return d.getEnumValueReference(o);
- if (t === "NamedType" && o.type) return d.getTypeReference(o);
-});
+ this.__rules__[idx].enabled = false;
+ result.push(name);
+ }, this);
+ this.__cache__ = null;
+ return result;
+};
-/***/ }),
+/**
+ * Ruler.getRules(chainName) -> Array
+ *
+ * Return array of active functions (rules) for given chain name. It analyzes
+ * rules configuration, compiles caches if not exists and returns result.
+ *
+ * Default chain name is `''` (empty string). It can't be skipped. That's
+ * done intentionally, to keep signature monomorphic for high speed.
+ **/
+Ruler.prototype.getRules = function (chainName) {
+ if (this.__cache__ === null) {
+ this.__compile__();
+ }
-/***/ "../../graphiql-react/dist/lint.cjs.js":
-/*!*********************************************!*\
- !*** ../../graphiql-react/dist/lint.cjs.js ***!
- \*********************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+ // Chain can be empty, if rules disabled. But we still have to return Array.
+ return this.__cache__[chainName] || [];
+};
+// Token class
+/**
+ * class Token
+ **/
-var W = Object.defineProperty;
-var s = (h, v) => W(h, "name", {
- value: v,
- configurable: !0
-});
-const x = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-function q(h, v) {
- for (var l = 0; l < v.length; l++) {
- const u = v[l];
- if (typeof u != "string" && !Array.isArray(u)) {
- for (const g in u) if (g !== "default" && !(g in h)) {
- const c = Object.getOwnPropertyDescriptor(u, g);
- c && Object.defineProperty(h, g, c.get ? c : {
- enumerable: !0,
- get: () => u[g]
- });
- }
- }
- }
- return Object.freeze(Object.defineProperty(h, Symbol.toStringTag, {
- value: "Module"
- }));
-}
-s(q, "_mergeNamespaces");
-var B = {
- exports: {}
-};
-(function (h, v) {
- (function (l) {
- l(x.requireCodemirror());
- })(function (l) {
- var u = "CodeMirror-lint-markers",
- g = "CodeMirror-lint-line-";
- function c(t, e, r) {
- var n = document.createElement("div");
- n.className = "CodeMirror-lint-tooltip cm-s-" + t.options.theme, n.appendChild(r.cloneNode(!0)), t.state.lint.options.selfContain ? t.getWrapperElement().appendChild(n) : document.body.appendChild(n);
- function i(o) {
- if (!n.parentNode) return l.off(document, "mousemove", i);
- n.style.top = Math.max(0, o.clientY - n.offsetHeight - 5) + "px", n.style.left = o.clientX + 5 + "px";
- }
- return s(i, "position"), l.on(document, "mousemove", i), i(e), n.style.opacity != null && (n.style.opacity = 1), n;
- }
- s(c, "showTooltip");
- function L(t) {
- t.parentNode && t.parentNode.removeChild(t);
- }
- s(L, "rm");
- function A(t) {
- t.parentNode && (t.style.opacity == null && L(t), t.style.opacity = 0, setTimeout(function () {
- L(t);
- }, 600));
- }
- s(A, "hideTooltip");
- function M(t, e, r, n) {
- var i = c(t, e, r);
- function o() {
- l.off(n, "mouseout", o), i && (A(i), i = null);
- }
- s(o, "hide");
- var a = setInterval(function () {
- if (i) for (var f = n;; f = f.parentNode) {
- if (f && f.nodeType == 11 && (f = f.host), f == document.body) return;
- if (!f) {
- o();
- break;
- }
- }
- if (!i) return clearInterval(a);
- }, 400);
- l.on(n, "mouseout", o);
- }
- s(M, "showTooltipFor");
- function F(t, e, r) {
- this.marked = [], e instanceof Function && (e = {
- getAnnotations: e
- }), (!e || e === !0) && (e = {}), this.options = {}, this.linterOptions = e.options || {};
- for (var n in C) this.options[n] = C[n];
- for (var n in e) C.hasOwnProperty(n) ? e[n] != null && (this.options[n] = e[n]) : e.options || (this.linterOptions[n] = e[n]);
- this.timeout = null, this.hasGutter = r, this.onMouseOver = function (i) {
- U(t, i);
- }, this.waitingFor = 0;
- }
- s(F, "LintState");
- var C = {
- highlightLines: !1,
- tooltips: !0,
- delay: 500,
- lintOnChange: !0,
- getAnnotations: null,
- async: !1,
- selfContain: null,
- formatAnnotation: null,
- onUpdateLinting: null
- };
- function E(t) {
- var e = t.state.lint;
- e.hasGutter && t.clearGutter(u), e.options.highlightLines && G(t);
- for (var r = 0; r < e.marked.length; ++r) e.marked[r].clear();
- e.marked.length = 0;
- }
- s(E, "clearMarks");
- function G(t) {
- t.eachLine(function (e) {
- var r = e.wrapClass && /\bCodeMirror-lint-line-\w+\b/.exec(e.wrapClass);
- r && t.removeLineClass(e, "wrap", r[0]);
- });
- }
- s(G, "clearErrorLines");
- function I(t, e, r, n, i) {
- var o = document.createElement("div"),
- a = o;
- return o.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + r, n && (a = o.appendChild(document.createElement("div")), a.className = "CodeMirror-lint-marker CodeMirror-lint-marker-multiple"), i != !1 && l.on(a, "mouseover", function (f) {
- M(t, f, e, a);
- }), o;
- }
- s(I, "makeMarker");
- function D(t, e) {
- return t == "error" ? t : e;
- }
- s(D, "getMaxSeverity");
- function j(t) {
- for (var e = [], r = 0; r < t.length; ++r) {
- var n = t[r],
- i = n.from.line;
- (e[i] || (e[i] = [])).push(n);
- }
- return e;
- }
- s(j, "groupByLine");
- function N(t) {
- var e = t.severity;
- e || (e = "error");
- var r = document.createElement("div");
- return r.className = "CodeMirror-lint-message CodeMirror-lint-message-" + e, typeof t.messageHTML < "u" ? r.innerHTML = t.messageHTML : r.appendChild(document.createTextNode(t.message)), r;
- }
- s(N, "annotationTooltip");
- function H(t, e) {
- var r = t.state.lint,
- n = ++r.waitingFor;
- function i() {
- n = -1, t.off("change", i);
- }
- s(i, "abort"), t.on("change", i), e(t.getValue(), function (o, a) {
- t.off("change", i), r.waitingFor == n && (a && o instanceof l && (o = a), t.operation(function () {
- O(t, o);
- }));
- }, r.linterOptions, t);
- }
- s(H, "lintAsync");
- function k(t) {
- var e = t.state.lint;
- if (e) {
- var r = e.options,
- n = r.getAnnotations || t.getHelper(l.Pos(0, 0), "lint");
- if (n) if (r.async || n.async) H(t, n);else {
- var i = n(t.getValue(), e.linterOptions, t);
- if (!i) return;
- i.then ? i.then(function (o) {
- t.operation(function () {
- O(t, o);
- });
- }) : t.operation(function () {
- O(t, i);
- });
- }
- }
- }
- s(k, "startLinting");
- function O(t, e) {
- var r = t.state.lint;
- if (r) {
- var n = r.options;
- E(t);
- for (var i = j(e), o = 0; o < i.length; ++o) {
- var a = i[o];
- if (a) {
- var f = [];
- a = a.filter(function (w) {
- return f.indexOf(w.message) > -1 ? !1 : f.push(w.message);
- });
- for (var p = null, m = r.hasGutter && document.createDocumentFragment(), T = 0; T < a.length; ++T) {
- var d = a[T],
- y = d.severity;
- y || (y = "error"), p = D(p, y), n.formatAnnotation && (d = n.formatAnnotation(d)), r.hasGutter && m.appendChild(N(d)), d.to && r.marked.push(t.markText(d.from, d.to, {
- className: "CodeMirror-lint-mark CodeMirror-lint-mark-" + y,
- __annotation: d
- }));
- }
- r.hasGutter && t.setGutterMarker(o, u, I(t, m, p, i[o].length > 1, n.tooltips)), n.highlightLines && t.addLineClass(o, "wrap", g + p);
- }
- }
- n.onUpdateLinting && n.onUpdateLinting(e, i, t);
- }
- }
- s(O, "updateLinting");
- function b(t) {
- var e = t.state.lint;
- e && (clearTimeout(e.timeout), e.timeout = setTimeout(function () {
- k(t);
- }, e.options.delay));
- }
- s(b, "onChange");
- function P(t, e, r) {
- for (var n = r.target || r.srcElement, i = document.createDocumentFragment(), o = 0; o < e.length; o++) {
- var a = e[o];
- i.appendChild(N(a));
- }
- M(t, r, i, n);
- }
- s(P, "popupTooltips");
- function U(t, e) {
- var r = e.target || e.srcElement;
- if (/\bCodeMirror-lint-mark-/.test(r.className)) {
- for (var n = r.getBoundingClientRect(), i = (n.left + n.right) / 2, o = (n.top + n.bottom) / 2, a = t.findMarksAt(t.coordsChar({
- left: i,
- top: o
- }, "client")), f = [], p = 0; p < a.length; ++p) {
- var m = a[p].__annotation;
- m && f.push(m);
- }
- f.length && P(t, f, e);
- }
- }
- s(U, "onMouseOver"), l.defineOption("lint", !1, function (t, e, r) {
- if (r && r != l.Init && (E(t), t.state.lint.options.lintOnChange !== !1 && t.off("change", b), l.off(t.getWrapperElement(), "mouseover", t.state.lint.onMouseOver), clearTimeout(t.state.lint.timeout), delete t.state.lint), e) {
- for (var n = t.getOption("gutters"), i = !1, o = 0; o < n.length; ++o) n[o] == u && (i = !0);
- var a = t.state.lint = new F(t, e, i);
- a.options.lintOnChange && t.on("change", b), a.options.tooltips != !1 && a.options.tooltips != "gutter" && l.on(t.getWrapperElement(), "mouseover", a.onMouseOver), k(t);
- }
- }), l.defineExtension("performLint", function () {
- k(this);
- });
- });
-})();
-var _ = B.exports;
-const R = x.getDefaultExportFromCjs(_),
- V = q({
- __proto__: null,
- default: R
- }, [_]);
-exports.lint = V;
+/**
+ * new Token(type, tag, nesting)
+ *
+ * Create new token and fill passed properties.
+ **/
+function Token(type, tag, nesting) {
+ /**
+ * Token#type -> String
+ *
+ * Type of the token (string, e.g. "paragraph_open")
+ **/
+ this.type = type;
-/***/ }),
+ /**
+ * Token#tag -> String
+ *
+ * html tag name, e.g. "p"
+ **/
+ this.tag = tag;
-/***/ "../../graphiql-react/dist/lint.cjs2.js":
-/*!**********************************************!*\
- !*** ../../graphiql-react/dist/lint.cjs2.js ***!
- \**********************************************/
-/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+ /**
+ * Token#attrs -> Array
+ *
+ * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
+ **/
+ this.attrs = null;
+ /**
+ * Token#map -> Array
+ *
+ * Source map info. Format: `[ line_begin, line_end ]`
+ **/
+ this.map = null;
+ /**
+ * Token#nesting -> Number
+ *
+ * Level change (number in {-1, 0, 1} set), where:
+ *
+ * - `1` means the tag is opening
+ * - `0` means the tag is self-closing
+ * - `-1` means the tag is closing
+ **/
+ this.nesting = nesting;
-const t = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"),
- c = __webpack_require__(/*! graphql-language-service */ "../../graphql-language-service/esm/index.js");
-__webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-const a = ["error", "warning", "information", "hint"],
- g = {
- "GraphQL: Validation": "validation",
- "GraphQL: Deprecation": "deprecation",
- "GraphQL: Syntax": "syntax"
- };
-t.CodeMirror.registerHelper("lint", "graphql", (n, s) => {
- const {
- schema: r,
- validationRules: i,
- externalFragments: o
- } = s;
- return c.getDiagnostics(n, r, i, void 0, o).map(e => ({
- message: e.message,
- severity: e.severity ? a[e.severity - 1] : a[0],
- type: e.source ? g[e.source] : void 0,
- from: t.CodeMirror.Pos(e.range.start.line, e.range.start.character),
- to: t.CodeMirror.Pos(e.range.end.line, e.range.end.character)
- }));
-});
+ /**
+ * Token#level -> Number
+ *
+ * nesting level, the same as `state.level`
+ **/
+ this.level = 0;
-/***/ }),
+ /**
+ * Token#children -> Array
+ *
+ * An array of child nodes (inline and img tokens)
+ **/
+ this.children = null;
-/***/ "../../graphiql-react/dist/lint.cjs3.js":
-/*!**********************************************!*\
- !*** ../../graphiql-react/dist/lint.cjs3.js ***!
- \**********************************************/
-/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+ /**
+ * Token#content -> String
+ *
+ * In a case of self-closing tag (code, html, fence, etc.),
+ * it has contents of this tag.
+ **/
+ this.content = '';
+ /**
+ * Token#markup -> String
+ *
+ * '*' or '_' for emphasis, fence string for fence, etc.
+ **/
+ this.markup = '';
+ /**
+ * Token#info -> String
+ *
+ * Additional information:
+ *
+ * - Info string for "fence" tokens
+ * - The value "auto" for autolink "link_open" and "link_close" tokens
+ * - The string value of the item marker for ordered-list "list_item_open" tokens
+ **/
+ this.info = '';
-var V = Object.defineProperty;
-var t = (e, n) => V(e, "name", {
- value: n,
- configurable: !0
-});
-const I = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"),
- b = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
-__webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-function C(e) {
- d = e, E = e.length, s = u = N = -1, o(), y();
- const n = q();
- return p("EOF"), n;
+ /**
+ * Token#meta -> Object
+ *
+ * A place for plugins to store an arbitrary data
+ **/
+ this.meta = null;
+
+ /**
+ * Token#block -> Boolean
+ *
+ * True for block-level tokens, false for inline tokens.
+ * Used in renderer to calculate line breaks
+ **/
+ this.block = false;
+
+ /**
+ * Token#hidden -> Boolean
+ *
+ * If it's true, ignore this element when rendering. Used for tight lists
+ * to hide paragraphs.
+ **/
+ this.hidden = false;
}
-t(C, "jsonParse");
-let d, E, s, u, N, r, l;
-function q() {
- const e = s,
- n = [];
- if (p("{"), !x("}")) {
- do n.push(M()); while (x(","));
- p("}");
+
+/**
+ * Token.attrIndex(name) -> Number
+ *
+ * Search attribute index by name.
+ **/
+Token.prototype.attrIndex = function attrIndex(name) {
+ if (!this.attrs) {
+ return -1;
}
- return {
- kind: "Object",
- start: e,
- end: N,
- members: n
- };
-}
-t(q, "parseObj");
-function M() {
- const e = s,
- n = l === "String" ? G() : null;
- p("String"), p(":");
- const i = B();
- return {
- kind: "Member",
- start: e,
- end: N,
- key: n,
- value: i
- };
-}
-t(M, "parseMember");
-function v() {
- const e = s,
- n = [];
- if (p("["), !x("]")) {
- do n.push(B()); while (x(","));
- p("]");
+ const attrs = this.attrs;
+ for (let i = 0, len = attrs.length; i < len; i++) {
+ if (attrs[i][0] === name) {
+ return i;
+ }
}
- return {
- kind: "Array",
- start: e,
- end: N,
- values: n
- };
-}
-t(v, "parseArr");
-function B() {
- switch (l) {
- case "[":
- return v();
- case "{":
- return q();
- case "String":
- case "Number":
- case "Boolean":
- case "Null":
- const e = G();
- return y(), e;
+ return -1;
+};
+
+/**
+ * Token.attrPush(attrData)
+ *
+ * Add `[ name, value ]` attribute to list. Init attrs if necessary
+ **/
+Token.prototype.attrPush = function attrPush(attrData) {
+ if (this.attrs) {
+ this.attrs.push(attrData);
+ } else {
+ this.attrs = [attrData];
+ }
+};
+
+/**
+ * Token.attrSet(name, value)
+ *
+ * Set `name` attribute to `value`. Override old value if exists.
+ **/
+Token.prototype.attrSet = function attrSet(name, value) {
+ const idx = this.attrIndex(name);
+ const attrData = [name, value];
+ if (idx < 0) {
+ this.attrPush(attrData);
+ } else {
+ this.attrs[idx] = attrData;
+ }
+};
+
+/**
+ * Token.attrGet(name)
+ *
+ * Get the value of attribute `name`, or null if it does not exist.
+ **/
+Token.prototype.attrGet = function attrGet(name) {
+ const idx = this.attrIndex(name);
+ let value = null;
+ if (idx >= 0) {
+ value = this.attrs[idx][1];
}
- p("Value");
+ return value;
+};
+
+/**
+ * Token.attrJoin(name, value)
+ *
+ * Join value to existing attribute via space. Or create new attribute if not
+ * exists. Useful to operate with token classes.
+ **/
+Token.prototype.attrJoin = function attrJoin(name, value) {
+ const idx = this.attrIndex(name);
+ if (idx < 0) {
+ this.attrPush([name, value]);
+ } else {
+ this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;
+ }
+};
+
+// Core state object
+//
+
+function StateCore(src, md, env) {
+ this.src = src;
+ this.env = env;
+ this.tokens = [];
+ this.inlineMode = false;
+ this.md = md; // link to parser instance
}
-t(B, "parseVal");
-function G() {
- return {
- kind: l,
- start: s,
- end: u,
- value: JSON.parse(d.slice(s, u))
- };
+
+// re-export Token class to use in core rules
+StateCore.prototype.Token = Token;
+
+// Normalize input string
+
+// https://spec.commonmark.org/0.29/#line-ending
+const NEWLINES_RE = /\r\n?|\n/g;
+const NULL_RE = /\0/g;
+function normalize(state) {
+ let str;
+
+ // Normalize newlines
+ str = state.src.replace(NEWLINES_RE, '\n');
+
+ // Replace NULL characters
+ str = str.replace(NULL_RE, '\uFFFD');
+ state.src = str;
}
-t(G, "curToken");
-function p(e) {
- if (l === e) {
- y();
- return;
- }
- let n;
- if (l === "EOF") n = "[end of file]";else if (u - s > 1) n = "`" + d.slice(s, u) + "`";else {
- const i = d.slice(s).match(/^.+?\b/);
- n = "`" + (i ? i[0] : d[s]) + "`";
+function block(state) {
+ let token;
+ if (state.inlineMode) {
+ token = new state.Token('inline', '', 0);
+ token.content = state.src;
+ token.map = [0, 1];
+ token.children = [];
+ state.tokens.push(token);
+ } else {
+ state.md.block.parse(state.src, state.md, state.env, state.tokens);
}
- throw k(`Expected ${e} but found ${n}.`);
}
-t(p, "expect");
-class j extends Error {
- constructor(n, i) {
- super(n), this.position = i;
+function inline(state) {
+ const tokens = state.tokens;
+
+ // Parse inlines
+ for (let i = 0, l = tokens.length; i < l; i++) {
+ const tok = tokens[i];
+ if (tok.type === 'inline') {
+ state.md.inline.parse(tok.content, state.md, state.env, tok.children);
+ }
}
}
-t(j, "JSONSyntaxError");
-function k(e) {
- return new j(e, {
- start: s,
- end: u
- });
-}
-t(k, "syntaxError");
-function x(e) {
- if (l === e) return y(), !0;
+
+// Replace link-like texts with link nodes.
+//
+// Currently restricted by `md.validateLink()` to http/https/ftp
+//
+
+function isLinkOpen$1(str) {
+ return /^\s]/i.test(str);
}
-t(x, "skip");
-function o() {
- return u < E && (u++, r = u === E ? 0 : d.charCodeAt(u)), r;
+function isLinkClose$1(str) {
+ return /^<\/a\s*>/i.test(str);
}
-t(o, "ch");
-function y() {
- for (N = u; r === 9 || r === 10 || r === 13 || r === 32;) o();
- if (r === 0) {
- l = "EOF";
+function linkify$1(state) {
+ const blockTokens = state.tokens;
+ if (!state.md.options.linkify) {
return;
}
- switch (s = u, r) {
- case 34:
- return l = "String", D();
- case 45:
- case 48:
- case 49:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- return l = "Number", H();
- case 102:
- if (d.slice(s, s + 5) !== "false") break;
- u += 4, o(), l = "Boolean";
- return;
- case 110:
- if (d.slice(s, s + 4) !== "null") break;
- u += 3, o(), l = "Null";
- return;
- case 116:
- if (d.slice(s, s + 4) !== "true") break;
- u += 3, o(), l = "Boolean";
- return;
- }
- l = d[s], o();
-}
-t(y, "lex");
-function D() {
- for (o(); r !== 34 && r > 31;) if (r === 92) switch (r = o(), r) {
- case 34:
- case 47:
- case 92:
- case 98:
- case 102:
- case 110:
- case 114:
- case 116:
- o();
- break;
- case 117:
- o(), w(), w(), w(), w();
- break;
- default:
- throw k("Bad character escape sequence.");
- } else {
- if (u === E) throw k("Unterminated string.");
- o();
- }
- if (r === 34) {
- o();
- return;
+ for (let j = 0, l = blockTokens.length; j < l; j++) {
+ if (blockTokens[j].type !== 'inline' || !state.md.linkify.pretest(blockTokens[j].content)) {
+ continue;
+ }
+ let tokens = blockTokens[j].children;
+ let htmlLinkLevel = 0;
+
+ // We scan from the end, to keep position when new tags added.
+ // Use reversed logic in links start/end match
+ for (let i = tokens.length - 1; i >= 0; i--) {
+ const currentToken = tokens[i];
+
+ // Skip content of markdown links
+ if (currentToken.type === 'link_close') {
+ i--;
+ while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {
+ i--;
+ }
+ continue;
+ }
+
+ // Skip content of html tag links
+ if (currentToken.type === 'html_inline') {
+ if (isLinkOpen$1(currentToken.content) && htmlLinkLevel > 0) {
+ htmlLinkLevel--;
+ }
+ if (isLinkClose$1(currentToken.content)) {
+ htmlLinkLevel++;
+ }
+ }
+ if (htmlLinkLevel > 0) {
+ continue;
+ }
+ if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {
+ const text = currentToken.content;
+ let links = state.md.linkify.match(text);
+
+ // Now split string to nodes
+ const nodes = [];
+ let level = currentToken.level;
+ let lastPos = 0;
+
+ // forbid escape sequence at the start of the string,
+ // this avoids http\://example.com/ from being linkified as
+ // http://example.com/
+ if (links.length > 0 && links[0].index === 0 && i > 0 && tokens[i - 1].type === 'text_special') {
+ links = links.slice(1);
+ }
+ for (let ln = 0; ln < links.length; ln++) {
+ const url = links[ln].url;
+ const fullUrl = state.md.normalizeLink(url);
+ if (!state.md.validateLink(fullUrl)) {
+ continue;
+ }
+ let urlText = links[ln].text;
+
+ // Linkifier might send raw hostnames like "example.com", where url
+ // starts with domain name. So we prepend http:// in those cases,
+ // and remove it afterwards.
+ //
+ if (!links[ln].schema) {
+ urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');
+ } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {
+ urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');
+ } else {
+ urlText = state.md.normalizeLinkText(urlText);
+ }
+ const pos = links[ln].index;
+ if (pos > lastPos) {
+ const token = new state.Token('text', '', 0);
+ token.content = text.slice(lastPos, pos);
+ token.level = level;
+ nodes.push(token);
+ }
+ const token_o = new state.Token('link_open', 'a', 1);
+ token_o.attrs = [['href', fullUrl]];
+ token_o.level = level++;
+ token_o.markup = 'linkify';
+ token_o.info = 'auto';
+ nodes.push(token_o);
+ const token_t = new state.Token('text', '', 0);
+ token_t.content = urlText;
+ token_t.level = level;
+ nodes.push(token_t);
+ const token_c = new state.Token('link_close', 'a', -1);
+ token_c.level = --level;
+ token_c.markup = 'linkify';
+ token_c.info = 'auto';
+ nodes.push(token_c);
+ lastPos = links[ln].lastIndex;
+ }
+ if (lastPos < text.length) {
+ const token = new state.Token('text', '', 0);
+ token.content = text.slice(lastPos);
+ token.level = level;
+ nodes.push(token);
+ }
+
+ // replace current node
+ blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
+ }
+ }
}
- throw k("Unterminated string.");
-}
-t(D, "readString");
-function w() {
- if (r >= 48 && r <= 57 || r >= 65 && r <= 70 || r >= 97 && r <= 102) return o();
- throw k("Expected hexadecimal digit.");
-}
-t(w, "readHex");
-function H() {
- r === 45 && o(), r === 48 ? o() : $(), r === 46 && (o(), $()), (r === 69 || r === 101) && (r = o(), (r === 43 || r === 45) && o(), $());
}
-t(H, "readNumber");
-function $() {
- if (r < 48 || r > 57) throw k("Expected decimal digit.");
- do o(); while (r >= 48 && r <= 57);
+
+// Simple typographic replacements
+//
+// (c) (C) → ©
+// (tm) (TM) → ™
+// (r) (R) → ®
+// +- → ±
+// ... → … (also ?.... → ?.., !.... → !..)
+// ???????? → ???, !!!!! → !!!, `,,` → `,`
+// -- → –, --- → —
+//
+
+// TODO:
+// - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾
+// - multiplications 2 x 4 -> 2 × 4
+
+const RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
+
+// Workaround for phantomjs - need regex without /g flag,
+// or root check will fail every second time
+const SCOPED_ABBR_TEST_RE = /\((c|tm|r)\)/i;
+const SCOPED_ABBR_RE = /\((c|tm|r)\)/ig;
+const SCOPED_ABBR = {
+ c: '©',
+ r: '®',
+ tm: '™'
+};
+function replaceFn(match, name) {
+ return SCOPED_ABBR[name.toLowerCase()];
}
-t($, "readDigits");
-I.CodeMirror.registerHelper("lint", "graphql-variables", (e, n, i) => {
- if (!e) return [];
- let f;
- try {
- f = C(e);
- } catch (c) {
- if (c instanceof j) return [F(i, c.position, c.message)];
- throw c;
- }
- const {
- variableToType: a
- } = n;
- return a ? U(i, a, f) : [];
-});
-function U(e, n, i) {
- var f;
- const a = [];
- for (const c of i.members) if (c) {
- const h = (f = c.key) === null || f === void 0 ? void 0 : f.value,
- m = n[h];
- if (m) for (const [O, Q] of g(m, c.value)) a.push(F(e, O, Q));else a.push(F(e, c.key, `Variable "$${h}" does not appear in any GraphQL query.`));
+function replace_scoped(inlineTokens) {
+ let inside_autolink = 0;
+ for (let i = inlineTokens.length - 1; i >= 0; i--) {
+ const token = inlineTokens[i];
+ if (token.type === 'text' && !inside_autolink) {
+ token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
+ }
+ if (token.type === 'link_open' && token.info === 'auto') {
+ inside_autolink--;
+ }
+ if (token.type === 'link_close' && token.info === 'auto') {
+ inside_autolink++;
+ }
}
- return a;
}
-t(U, "validateVariables");
-function g(e, n) {
- if (!e || !n) return [];
- if (e instanceof b.GraphQLNonNull) return n.kind === "Null" ? [[n, `Type "${e}" is non-nullable and cannot be null.`]] : g(e.ofType, n);
- if (n.kind === "Null") return [];
- if (e instanceof b.GraphQLList) {
- const i = e.ofType;
- if (n.kind === "Array") {
- const f = n.values || [];
- return L(f, a => g(i, a));
+function replace_rare(inlineTokens) {
+ let inside_autolink = 0;
+ for (let i = inlineTokens.length - 1; i >= 0; i--) {
+ const token = inlineTokens[i];
+ if (token.type === 'text' && !inside_autolink) {
+ if (RARE_RE.test(token.content)) {
+ token.content = token.content.replace(/\+-/g, '±')
+ // .., ..., ....... -> …
+ // but ?..... & !..... -> ?.. & !..
+ .replace(/\.{2,}/g, '…').replace(/([?!])…/g, '$1..').replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')
+ // em-dash
+ .replace(/(^|[^-])---(?=[^-]|$)/mg, '$1\u2014')
+ // en-dash
+ .replace(/(^|\s)--(?=\s|$)/mg, '$1\u2013').replace(/(^|[^-\s])--(?=[^-\s]|$)/mg, '$1\u2013');
+ }
}
- return g(i, n);
- }
- if (e instanceof b.GraphQLInputObjectType) {
- if (n.kind !== "Object") return [[n, `Type "${e}" must be an Object.`]];
- const i = Object.create(null),
- f = L(n.members, a => {
- var c;
- const h = (c = a == null ? void 0 : a.key) === null || c === void 0 ? void 0 : c.value;
- i[h] = !0;
- const m = e.getFields()[h];
- if (!m) return [[a.key, `Type "${e}" does not have a field "${h}".`]];
- const O = m ? m.type : void 0;
- return g(O, a.value);
- });
- for (const a of Object.keys(e.getFields())) {
- const c = e.getFields()[a];
- !i[a] && c.type instanceof b.GraphQLNonNull && !c.defaultValue && f.push([n, `Object of type "${e}" is missing required field "${a}".`]);
+ if (token.type === 'link_open' && token.info === 'auto') {
+ inside_autolink--;
+ }
+ if (token.type === 'link_close' && token.info === 'auto') {
+ inside_autolink++;
}
- return f;
}
- return e.name === "Boolean" && n.kind !== "Boolean" || e.name === "String" && n.kind !== "String" || e.name === "ID" && n.kind !== "Number" && n.kind !== "String" || e.name === "Float" && n.kind !== "Number" || e.name === "Int" && (n.kind !== "Number" || (n.value | 0) !== n.value) ? [[n, `Expected value of type "${e}".`]] : (e instanceof b.GraphQLEnumType || e instanceof b.GraphQLScalarType) && (n.kind !== "String" && n.kind !== "Number" && n.kind !== "Boolean" && n.kind !== "Null" || _(e.parseValue(n.value))) ? [[n, `Expected value of type "${e}".`]] : [];
-}
-t(g, "validateValue");
-function F(e, n, i) {
- return {
- message: i,
- severity: "error",
- type: "validation",
- from: e.posFromIndex(n.start),
- to: e.posFromIndex(n.end)
- };
-}
-t(F, "lintError");
-function _(e) {
- return e == null || e !== e;
}
-t(_, "isNullish");
-function L(e, n) {
- return Array.prototype.concat.apply([], e.map(n));
+function replace(state) {
+ let blkIdx;
+ if (!state.md.options.typographer) {
+ return;
+ }
+ for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
+ if (state.tokens[blkIdx].type !== 'inline') {
+ continue;
+ }
+ if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {
+ replace_scoped(state.tokens[blkIdx].children);
+ }
+ if (RARE_RE.test(state.tokens[blkIdx].content)) {
+ replace_rare(state.tokens[blkIdx].children);
+ }
+ }
}
-t(L, "mapCat");
-
-/***/ }),
-
-/***/ "../../graphiql-react/dist/matchbrackets.cjs.js":
-/*!******************************************************!*\
- !*** ../../graphiql-react/dist/matchbrackets.cjs.js ***!
- \******************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Convert straight quotation marks to typographic ones
+//
+const QUOTE_TEST_RE = /['"]/;
+const QUOTE_RE = /['"]/g;
+const APOSTROPHE = '\u2019'; /* ’ */
-var i = Object.defineProperty;
-var s = (e, c) => i(e, "name", {
- value: c,
- configurable: !0
-});
-const u = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"),
- f = __webpack_require__(/*! ./matchbrackets.cjs2.js */ "../../graphiql-react/dist/matchbrackets.cjs2.js");
-function b(e, c) {
- for (var o = 0; o < c.length; o++) {
- const t = c[o];
- if (typeof t != "string" && !Array.isArray(t)) {
- for (const r in t) if (r !== "default" && !(r in e)) {
- const a = Object.getOwnPropertyDescriptor(t, r);
- a && Object.defineProperty(e, r, a.get ? a : {
- enumerable: !0,
- get: () => t[r]
- });
+function replaceAt(str, index, ch) {
+ return str.slice(0, index) + ch + str.slice(index + 1);
+}
+function process_inlines(tokens, state) {
+ let j;
+ const stack = [];
+ for (let i = 0; i < tokens.length; i++) {
+ const token = tokens[i];
+ const thisLevel = tokens[i].level;
+ for (j = stack.length - 1; j >= 0; j--) {
+ if (stack[j].level <= thisLevel) {
+ break;
}
}
- }
- return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, {
- value: "Module"
- }));
-}
-s(b, "_mergeNamespaces");
-var n = f.requireMatchbrackets();
-const l = u.getDefaultExportFromCjs(n),
- m = b({
- __proto__: null,
- default: l
- }, [n]);
-exports.matchbrackets = m;
+ stack.length = j + 1;
+ if (token.type !== 'text') {
+ continue;
+ }
+ let text = token.content;
+ let pos = 0;
+ let max = text.length;
-/***/ }),
+ /* eslint no-labels:0,block-scoped-var:0 */
+ OUTER: while (pos < max) {
+ QUOTE_RE.lastIndex = pos;
+ const t = QUOTE_RE.exec(text);
+ if (!t) {
+ break;
+ }
+ let canOpen = true;
+ let canClose = true;
+ pos = t.index + 1;
+ const isSingle = t[0] === "'";
-/***/ "../../graphiql-react/dist/matchbrackets.cjs2.js":
-/*!*******************************************************!*\
- !*** ../../graphiql-react/dist/matchbrackets.cjs2.js ***!
- \*******************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+ // Find previous character,
+ // default to space if it's the beginning of the line
+ //
+ let lastChar = 0x20;
+ if (t.index - 1 >= 0) {
+ lastChar = text.charCodeAt(t.index - 1);
+ } else {
+ for (j = i - 1; j >= 0; j--) {
+ if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // lastChar defaults to 0x20
+ if (!tokens[j].content) continue; // should skip all tokens except 'text', 'html_inline' or 'code_inline'
+ lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
+ break;
+ }
+ }
+ // Find next character,
+ // default to space if it's the end of the line
+ //
+ let nextChar = 0x20;
+ if (pos < max) {
+ nextChar = text.charCodeAt(pos);
+ } else {
+ for (j = i + 1; j < tokens.length; j++) {
+ if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // nextChar defaults to 0x20
+ if (!tokens[j].content) continue; // should skip all tokens except 'text', 'html_inline' or 'code_inline'
-var R = Object.defineProperty;
-var f = (L, y) => R(L, "name", {
- value: y,
- configurable: !0
-});
-const F = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-var T = {
- exports: {}
- },
- E;
-function I() {
- return E || (E = 1, function (L, y) {
- (function (o) {
- o(F.requireCodemirror());
- })(function (o) {
- var S = /MSIE \d/.test(navigator.userAgent) && (document.documentMode == null || document.documentMode < 8),
- g = o.Pos,
- B = {
- "(": ")>",
- ")": "(<",
- "[": "]>",
- "]": "[<",
- "{": "}>",
- "}": "{<",
- "<": ">>",
- ">": "<<"
- };
- function A(t) {
- return t && t.bracketRegex || /[(){}[\]]/;
+ nextChar = tokens[j].content.charCodeAt(0);
+ break;
+ }
+ }
+ const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
+ const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
+ const isLastWhiteSpace = isWhiteSpace(lastChar);
+ const isNextWhiteSpace = isWhiteSpace(nextChar);
+ if (isNextWhiteSpace) {
+ canOpen = false;
+ } else if (isNextPunctChar) {
+ if (!(isLastWhiteSpace || isLastPunctChar)) {
+ canOpen = false;
+ }
+ }
+ if (isLastWhiteSpace) {
+ canClose = false;
+ } else if (isLastPunctChar) {
+ if (!(isNextWhiteSpace || isNextPunctChar)) {
+ canClose = false;
+ }
+ }
+ if (nextChar === 0x22 /* " */ && t[0] === '"') {
+ if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {
+ // special case: 1"" - count first quote as an inch
+ canClose = canOpen = false;
+ }
}
- f(A, "bracketRegex");
- function b(t, r, e) {
- var s = t.getLineHandle(r.line),
- n = r.ch - 1,
- h = e && e.afterCursor;
- h == null && (h = /(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));
- var l = A(e),
- u = !h && n >= 0 && l.test(s.text.charAt(n)) && B[s.text.charAt(n)] || l.test(s.text.charAt(n + 1)) && B[s.text.charAt(++n)];
- if (!u) return null;
- var a = u.charAt(1) == ">" ? 1 : -1;
- if (e && e.strict && a > 0 != (n == r.ch)) return null;
- var k = t.getTokenTypeAt(g(r.line, n + 1)),
- i = H(t, g(r.line, n + (a > 0 ? 1 : 0)), a, k, e);
- return i == null ? null : {
- from: g(r.line, n),
- to: i && i.pos,
- match: i && i.ch == u.charAt(0),
- forward: a > 0
- };
+ if (canOpen && canClose) {
+ // Replace quotes in the middle of punctuation sequence, but not
+ // in the middle of the words, i.e.:
+ //
+ // 1. foo " bar " baz - not replaced
+ // 2. foo-"-bar-"-baz - replaced
+ // 3. foo"bar"baz - not replaced
+ //
+ canOpen = isLastPunctChar;
+ canClose = isNextPunctChar;
}
- f(b, "findMatchingBracket");
- function H(t, r, e, s, n) {
- for (var h = n && n.maxScanLineLength || 1e4, l = n && n.maxScanLines || 1e3, u = [], a = A(n), k = e > 0 ? Math.min(r.line + l, t.lastLine() + 1) : Math.max(t.firstLine() - 1, r.line - l), i = r.line; i != k; i += e) {
- var c = t.getLine(i);
- if (c) {
- var v = e > 0 ? 0 : c.length - 1,
- q = e > 0 ? c.length : -1;
- if (!(c.length > h)) for (i == r.line && (v = r.ch - (e < 0 ? 1 : 0)); v != q; v += e) {
- var d = c.charAt(v);
- if (a.test(d) && (s === void 0 || (t.getTokenTypeAt(g(i, v + 1)) || "") == (s || ""))) {
- var m = B[d];
- if (m && m.charAt(1) == ">" == e > 0) u.push(d);else if (u.length) u.pop();else return {
- pos: g(i, v),
- ch: d
- };
- }
- }
- }
+ if (!canOpen && !canClose) {
+ // middle of word
+ if (isSingle) {
+ token.content = replaceAt(token.content, t.index, APOSTROPHE);
}
- return i - e == (e > 0 ? t.lastLine() : t.firstLine()) ? !1 : null;
+ continue;
}
- f(H, "scanForBracket");
- function M(t, r, e) {
- for (var s = t.state.matchBrackets.maxHighlightLineLength || 1e3, n = e && e.highlightNonMatching, h = [], l = t.listSelections(), u = 0; u < l.length; u++) {
- var a = l[u].empty() && b(t, l[u].head, e);
- if (a && (a.match || n !== !1) && t.getLine(a.from.line).length <= s) {
- var k = a.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
- h.push(t.markText(a.from, g(a.from.line, a.from.ch + 1), {
- className: k
- })), a.to && t.getLine(a.to.line).length <= s && h.push(t.markText(a.to, g(a.to.line, a.to.ch + 1), {
- className: k
- }));
+ if (canClose) {
+ // this could be a closing quote, rewind the stack to get a match
+ for (j = stack.length - 1; j >= 0; j--) {
+ let item = stack[j];
+ if (stack[j].level < thisLevel) {
+ break;
+ }
+ if (item.single === isSingle && stack[j].level === thisLevel) {
+ item = stack[j];
+ let openQuote;
+ let closeQuote;
+ if (isSingle) {
+ openQuote = state.md.options.quotes[2];
+ closeQuote = state.md.options.quotes[3];
+ } else {
+ openQuote = state.md.options.quotes[0];
+ closeQuote = state.md.options.quotes[1];
+ }
+
+ // replace token.content *before* tokens[item.token].content,
+ // because, if they are pointing at the same token, replaceAt
+ // could mess up indices when quote length != 1
+ token.content = replaceAt(token.content, t.index, closeQuote);
+ tokens[item.token].content = replaceAt(tokens[item.token].content, item.pos, openQuote);
+ pos += closeQuote.length - 1;
+ if (item.token === i) {
+ pos += openQuote.length - 1;
+ }
+ text = token.content;
+ max = text.length;
+ stack.length = j;
+ continue OUTER;
}
- }
- if (h.length) {
- S && t.state.focused && t.focus();
- var i = f(function () {
- t.operation(function () {
- for (var c = 0; c < h.length; c++) h[c].clear();
- });
- }, "clear");
- if (r) setTimeout(i, 800);else return i;
}
}
- f(M, "matchBrackets");
- function x(t) {
- t.operation(function () {
- t.state.matchBrackets.currentlyHighlighted && (t.state.matchBrackets.currentlyHighlighted(), t.state.matchBrackets.currentlyHighlighted = null), t.state.matchBrackets.currentlyHighlighted = M(t, !1, t.state.matchBrackets);
+ if (canOpen) {
+ stack.push({
+ token: i,
+ pos: t.index,
+ single: isSingle,
+ level: thisLevel
});
+ } else if (canClose && isSingle) {
+ token.content = replaceAt(token.content, t.index, APOSTROPHE);
}
- f(x, "doMatchBrackets");
- function p(t) {
- t.state.matchBrackets && t.state.matchBrackets.currentlyHighlighted && (t.state.matchBrackets.currentlyHighlighted(), t.state.matchBrackets.currentlyHighlighted = null);
- }
- f(p, "clearHighlighted"), o.defineOption("matchBrackets", !1, function (t, r, e) {
- e && e != o.Init && (t.off("cursorActivity", x), t.off("focus", x), t.off("blur", p), p(t)), r && (t.state.matchBrackets = typeof r == "object" ? r : {}, t.on("cursorActivity", x), t.on("focus", x), t.on("blur", p));
- }), o.defineExtension("matchBrackets", function () {
- M(this, !0);
- }), o.defineExtension("findMatchingBracket", function (t, r, e) {
- return (e || typeof r == "boolean") && (e ? (e.strict = r, r = e) : r = r ? {
- strict: !0
- } : null), b(this, t, r);
- }), o.defineExtension("scanForBracket", function (t, r, e, s) {
- return H(this, t, r, e, s);
- });
- });
- }()), T.exports;
+ }
+ }
+}
+function smartquotes(state) {
+ /* eslint max-depth:0 */
+ if (!state.md.options.typographer) {
+ return;
+ }
+ for (let blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
+ if (state.tokens[blkIdx].type !== 'inline' || !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {
+ continue;
+ }
+ process_inlines(state.tokens[blkIdx].children, state);
+ }
}
-f(I, "requireMatchbrackets");
-exports.requireMatchbrackets = I;
-
-/***/ }),
-
-/***/ "../../graphiql-react/dist/mode-indent.cjs.js":
-/*!****************************************************!*\
- !*** ../../graphiql-react/dist/mode-indent.cjs.js ***!
- \****************************************************/
-/***/ (function(__unused_webpack_module, exports) {
-
+// Join raw text tokens with the rest of the text
+//
+// This is set as a separate rule to provide an opportunity for plugins
+// to run text replacements after text join, but before escape join.
+//
+// For example, `\:)` shouldn't be replaced with an emoji.
+//
-var o = Object.defineProperty;
-var v = (n, t) => o(n, "name", {
- value: t,
- configurable: !0
-});
-function s(n, t) {
- var e, i;
- const {
- levels: l,
- indentLevel: d
- } = n;
- return ((!l || l.length === 0 ? d : l.at(-1) - (!((e = this.electricInput) === null || e === void 0) && e.test(t) ? 1 : 0)) || 0) * (((i = this.config) === null || i === void 0 ? void 0 : i.indentUnit) || 0);
+function text_join(state) {
+ let curr, last;
+ const blockTokens = state.tokens;
+ const l = blockTokens.length;
+ for (let j = 0; j < l; j++) {
+ if (blockTokens[j].type !== 'inline') continue;
+ const tokens = blockTokens[j].children;
+ const max = tokens.length;
+ for (curr = 0; curr < max; curr++) {
+ if (tokens[curr].type === 'text_special') {
+ tokens[curr].type = 'text';
+ }
+ }
+ for (curr = last = 0; curr < max; curr++) {
+ if (tokens[curr].type === 'text' && curr + 1 < max && tokens[curr + 1].type === 'text') {
+ // collapse two adjacent text nodes
+ tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
+ } else {
+ if (curr !== last) {
+ tokens[last] = tokens[curr];
+ }
+ last++;
+ }
+ }
+ if (curr !== last) {
+ tokens.length = last;
+ }
+ }
}
-v(s, "indent");
-exports.indent = s;
-
-/***/ }),
-/***/ "../../graphiql-react/dist/mode.cjs.js":
-/*!*********************************************!*\
- !*** ../../graphiql-react/dist/mode.cjs.js ***!
- \*********************************************/
-/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+/** internal
+ * class Core
+ *
+ * Top-level rules executor. Glues block/inline parsers and does intermediate
+ * transformations.
+ **/
+const _rules$2 = [['normalize', normalize], ['block', block], ['inline', inline], ['linkify', linkify$1], ['replacements', replace], ['smartquotes', smartquotes],
+// `text_join` finds `text_special` tokens (for escape sequences)
+// and joins them with the rest of the text
+['text_join', text_join]];
+/**
+ * new Core()
+ **/
+function Core() {
+ /**
+ * Core#ruler -> Ruler
+ *
+ * [[Ruler]] instance. Keep configuration of core rules.
+ **/
+ this.ruler = new Ruler();
+ for (let i = 0; i < _rules$2.length; i++) {
+ this.ruler.push(_rules$2[i][0], _rules$2[i][1]);
+ }
+}
-var n = Object.defineProperty;
-var s = (e, r) => n(e, "name", {
- value: r,
- configurable: !0
-});
-const o = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"),
- t = __webpack_require__(/*! graphql-language-service */ "../../graphql-language-service/esm/index.js"),
- i = __webpack_require__(/*! ./mode-indent.cjs.js */ "../../graphiql-react/dist/mode-indent.cjs.js");
-__webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-const l = s(e => {
- const r = t.onlineParser({
- eatWhitespace: a => a.eatWhile(t.isIgnored),
- lexRules: t.LexRules,
- parseRules: t.ParseRules,
- editorConfig: {
- tabSize: e.tabSize
- }
- });
- return {
- config: e,
- startState: r.startState,
- token: r.token,
- indent: i.indent,
- electricInput: /^\s*[})\]]/,
- fold: "brace",
- lineComment: "#",
- closeBrackets: {
- pairs: '()[]{}""',
- explode: "()[]{}"
- }
- };
-}, "graphqlModeFactory");
-o.CodeMirror.defineMode("graphql", l);
+/**
+ * Core.process(state)
+ *
+ * Executes core chain rules.
+ **/
+Core.prototype.process = function (state) {
+ const rules = this.ruler.getRules('');
+ for (let i = 0, l = rules.length; i < l; i++) {
+ rules[i](state);
+ }
+};
+Core.prototype.State = StateCore;
-/***/ }),
+// Parser state class
-/***/ "../../graphiql-react/dist/mode.cjs2.js":
-/*!**********************************************!*\
- !*** ../../graphiql-react/dist/mode.cjs2.js ***!
- \**********************************************/
-/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+function StateBlock(src, md, env, tokens) {
+ this.src = src;
+ // link to parser instance
+ this.md = md;
+ this.env = env;
+ //
+ // Internal state vartiables
+ //
-var n = Object.defineProperty;
-var u = (t, r) => n(t, "name", {
- value: r,
- configurable: !0
-});
-const i = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"),
- e = __webpack_require__(/*! graphql-language-service */ "../../graphql-language-service/esm/index.js"),
- s = __webpack_require__(/*! ./mode-indent.cjs.js */ "../../graphiql-react/dist/mode-indent.cjs.js");
-__webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-i.CodeMirror.defineMode("graphql-variables", t => {
- const r = e.onlineParser({
- eatWhitespace: a => a.eatSpace(),
- lexRules: c,
- parseRules: o,
- editorConfig: {
- tabSize: t.tabSize
- }
- });
- return {
- config: t,
- startState: r.startState,
- token: r.token,
- indent: s.indent,
- electricInput: /^\s*[}\]]/,
- fold: "brace",
- closeBrackets: {
- pairs: '[]{}""',
- explode: "[]{}"
- }
- };
-});
-const c = {
- Punctuation: /^\[|]|\{|\}|:|,/,
- Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,
- String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/,
- Keyword: /^true|false|null/
- },
- o = {
- Document: [e.p("{"), e.list("Variable", e.opt(e.p(","))), e.p("}")],
- Variable: [l("variable"), e.p(":"), "Value"],
- Value(t) {
- switch (t.kind) {
- case "Number":
- return "NumberValue";
- case "String":
- return "StringValue";
- case "Punctuation":
- switch (t.value) {
- case "[":
- return "ListValue";
- case "{":
- return "ObjectValue";
- }
- return null;
- case "Keyword":
- switch (t.value) {
- case "true":
- case "false":
- return "BooleanValue";
- case "null":
- return "NullValue";
- }
- return null;
- }
- },
- NumberValue: [e.t("Number", "number")],
- StringValue: [e.t("String", "string")],
- BooleanValue: [e.t("Keyword", "builtin")],
- NullValue: [e.t("Keyword", "keyword")],
- ListValue: [e.p("["), e.list("Value", e.opt(e.p(","))), e.p("]")],
- ObjectValue: [e.p("{"), e.list("ObjectField", e.opt(e.p(","))), e.p("}")],
- ObjectField: [l("attribute"), e.p(":"), "Value"]
- };
-function l(t) {
- return {
- style: t,
- match: r => r.kind === "String",
- update(r, a) {
- r.name = a.value.slice(1, -1);
- }
- };
-}
-u(l, "namedKey");
+ this.tokens = tokens;
+ this.bMarks = []; // line begin offsets for fast jumps
+ this.eMarks = []; // line end offsets for fast jumps
+ this.tShift = []; // offsets of the first non-space characters (tabs not expanded)
+ this.sCount = []; // indents for each line (tabs expanded)
-/***/ }),
+ // An amount of virtual spaces (tabs expanded) between beginning
+ // of each line (bMarks) and real beginning of that line.
+ //
+ // It exists only as a hack because blockquotes override bMarks
+ // losing information in the process.
+ //
+ // It's used only when expanding tabs, you can think about it as
+ // an initial tab length, e.g. bsCount=21 applied to string `\t123`
+ // means first tab should be expanded to 4-21%4 === 3 spaces.
+ //
+ this.bsCount = [];
-/***/ "../../graphiql-react/dist/mode.cjs3.js":
-/*!**********************************************!*\
- !*** ../../graphiql-react/dist/mode.cjs3.js ***!
- \**********************************************/
-/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+ // block parser variables
+ // required block content indent (for example, if we are
+ // inside a list, it would be positioned after list marker)
+ this.blkIndent = 0;
+ this.line = 0; // line index in src
+ this.lineMax = 0; // lines count
+ this.tight = false; // loose/tight mode for lists
+ this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)
+ this.listIndent = -1; // indent of the current list block (-1 if there isn't any)
+ // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
+ // used in lists to determine if they interrupt a paragraph
+ this.parentType = 'root';
+ this.level = 0;
-const a = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"),
- e = __webpack_require__(/*! graphql-language-service */ "../../graphql-language-service/esm/index.js"),
- l = __webpack_require__(/*! ./mode-indent.cjs.js */ "../../graphiql-react/dist/mode-indent.cjs.js");
-__webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-a.CodeMirror.defineMode("graphql-results", r => {
- const t = e.onlineParser({
- eatWhitespace: u => u.eatSpace(),
- lexRules: n,
- parseRules: s,
- editorConfig: {
- tabSize: r.tabSize
- }
- });
- return {
- config: r,
- startState: t.startState,
- token: t.token,
- indent: l.indent,
- electricInput: /^\s*[}\]]/,
- fold: "brace",
- closeBrackets: {
- pairs: '[]{}""',
- explode: "[]{}"
+ // Create caches
+ // Generate markers.
+ const s = this.src;
+ for (let start = 0, pos = 0, indent = 0, offset = 0, len = s.length, indent_found = false; pos < len; pos++) {
+ const ch = s.charCodeAt(pos);
+ if (!indent_found) {
+ if (isSpace(ch)) {
+ indent++;
+ if (ch === 0x09) {
+ offset += 4 - offset % 4;
+ } else {
+ offset++;
+ }
+ continue;
+ } else {
+ indent_found = true;
+ }
}
- };
-});
-const n = {
- Punctuation: /^\[|]|\{|\}|:|,/,
- Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,
- String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/,
- Keyword: /^true|false|null/
- },
- s = {
- Document: [e.p("{"), e.list("Entry", e.p(",")), e.p("}")],
- Entry: [e.t("String", "def"), e.p(":"), "Value"],
- Value(r) {
- switch (r.kind) {
- case "Number":
- return "NumberValue";
- case "String":
- return "StringValue";
- case "Punctuation":
- switch (r.value) {
- case "[":
- return "ListValue";
- case "{":
- return "ObjectValue";
- }
- return null;
- case "Keyword":
- switch (r.value) {
- case "true":
- case "false":
- return "BooleanValue";
- case "null":
- return "NullValue";
- }
- return null;
+ if (ch === 0x0A || pos === len - 1) {
+ if (ch !== 0x0A) {
+ pos++;
}
- },
- NumberValue: [e.t("Number", "number")],
- StringValue: [e.t("String", "string")],
- BooleanValue: [e.t("Keyword", "builtin")],
- NullValue: [e.t("Keyword", "keyword")],
- ListValue: [e.p("["), e.list("Value", e.p(",")), e.p("]")],
- ObjectValue: [e.p("{"), e.list("ObjectField", e.p(",")), e.p("}")],
- ObjectField: [e.t("String", "property"), e.p(":"), "Value"]
- };
-
-/***/ }),
-
-/***/ "../../graphiql-react/dist/search.cjs.js":
-/*!***********************************************!*\
- !*** ../../graphiql-react/dist/search.cjs.js ***!
- \***********************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-
+ this.bMarks.push(start);
+ this.eMarks.push(pos);
+ this.tShift.push(indent);
+ this.sCount.push(offset);
+ this.bsCount.push(0);
+ indent_found = false;
+ indent = 0;
+ offset = 0;
+ start = pos + 1;
+ }
+ }
+ // Push fake entry to simplify cache bounds checks
+ this.bMarks.push(s.length);
+ this.eMarks.push(s.length);
+ this.tShift.push(0);
+ this.sCount.push(0);
+ this.bsCount.push(0);
+ this.lineMax = this.bMarks.length - 1; // don't count last fake line
+}
-var K = Object.defineProperty;
-var a = (S, O) => K(S, "name", {
- value: O,
- configurable: !0
-});
-const Q = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"),
- L = __webpack_require__(/*! ./searchcursor.cjs2.js */ "../../graphiql-react/dist/searchcursor.cjs2.js"),
- z = __webpack_require__(/*! ./dialog.cjs2.js */ "../../graphiql-react/dist/dialog.cjs2.js");
-function U(S, O) {
- for (var i = 0; i < O.length; i++) {
- const y = O[i];
- if (typeof y != "string" && !Array.isArray(y)) {
- for (const v in y) if (v !== "default" && !(v in S)) {
- const h = Object.getOwnPropertyDescriptor(y, v);
- h && Object.defineProperty(S, v, h.get ? h : {
- enumerable: !0,
- get: () => y[v]
- });
- }
+// Push new token to "stream".
+//
+StateBlock.prototype.push = function (type, tag, nesting) {
+ const token = new Token(type, tag, nesting);
+ token.block = true;
+ if (nesting < 0) this.level--; // closing tag
+ token.level = this.level;
+ if (nesting > 0) this.level++; // opening tag
+
+ this.tokens.push(token);
+ return token;
+};
+StateBlock.prototype.isEmpty = function isEmpty(line) {
+ return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
+};
+StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
+ for (let max = this.lineMax; from < max; from++) {
+ if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
+ break;
}
}
- return Object.freeze(Object.defineProperty(S, Symbol.toStringTag, {
- value: "Module"
- }));
-}
-a(U, "_mergeNamespaces");
-var B = {
- exports: {}
+ return from;
};
-(function (S, O) {
- (function (i) {
- i(Q.requireCodemirror(), L.requireSearchcursor(), z.requireDialog());
- })(function (i) {
- i.defineOption("search", {
- bottom: !1
- });
- function y(e, n) {
- return typeof e == "string" ? e = new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), n ? "gi" : "g") : e.global || (e = new RegExp(e.source, e.ignoreCase ? "gi" : "g")), {
- token: function (t) {
- e.lastIndex = t.pos;
- var o = e.exec(t.string);
- if (o && o.index == t.pos) return t.pos += o[0].length || 1, "searching";
- o ? t.pos = o.index : t.skipToEnd();
- }
- };
+
+// Skip spaces from given position.
+StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
+ for (let max = this.src.length; pos < max; pos++) {
+ const ch = this.src.charCodeAt(pos);
+ if (!isSpace(ch)) {
+ break;
}
- a(y, "searchOverlay");
- function v() {
- this.posFrom = this.posTo = this.lastQuery = this.query = null, this.overlay = null;
+ }
+ return pos;
+};
+
+// Skip spaces from given position in reverse.
+StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
+ if (pos <= min) {
+ return pos;
+ }
+ while (pos > min) {
+ if (!isSpace(this.src.charCodeAt(--pos))) {
+ return pos + 1;
}
- a(v, "SearchState");
- function h(e) {
- return e.state.search || (e.state.search = new v());
+ }
+ return pos;
+};
+
+// Skip char codes from given position
+StateBlock.prototype.skipChars = function skipChars(pos, code) {
+ for (let max = this.src.length; pos < max; pos++) {
+ if (this.src.charCodeAt(pos) !== code) {
+ break;
}
- a(h, "getSearchState");
- function m(e) {
- return typeof e == "string" && e == e.toLowerCase();
+ }
+ return pos;
+};
+
+// Skip char codes reverse from given position - 1
+StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {
+ if (pos <= min) {
+ return pos;
+ }
+ while (pos > min) {
+ if (code !== this.src.charCodeAt(--pos)) {
+ return pos + 1;
}
- a(m, "queryCaseInsensitive");
- function N(e, n, t) {
- return e.getSearchCursor(n, t, {
- caseFold: m(n),
- multiline: !0
- });
+ }
+ return pos;
+};
+
+// cut lines range from source.
+StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
+ if (begin >= end) {
+ return '';
+ }
+ const queue = new Array(end - begin);
+ for (let i = 0, line = begin; line < end; line++, i++) {
+ let lineIndent = 0;
+ const lineStart = this.bMarks[line];
+ let first = lineStart;
+ let last;
+ if (line + 1 < end || keepLastLF) {
+ // No need for bounds check because we have fake entry on tail.
+ last = this.eMarks[line] + 1;
+ } else {
+ last = this.eMarks[line];
}
- a(N, "getSearchCursor");
- function j(e, n, t, o, r) {
- e.openDialog(n, o, {
- value: t,
- selectValueOnOpen: !0,
- closeOnEnter: !1,
- onClose: function () {
- w(e);
- },
- onKeyDown: r,
- bottom: e.options.search.bottom
- });
+ while (first < last && lineIndent < indent) {
+ const ch = this.src.charCodeAt(first);
+ if (isSpace(ch)) {
+ if (ch === 0x09) {
+ lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
+ } else {
+ lineIndent++;
+ }
+ } else if (first - lineStart < this.tShift[line]) {
+ // patched tShift masked characters to look like spaces (blockquotes, list markers)
+ lineIndent++;
+ } else {
+ break;
+ }
+ first++;
}
- a(j, "persistentDialog");
- function R(e, n, t, o, r) {
- e.openDialog ? e.openDialog(n, r, {
- value: o,
- selectValueOnOpen: !0,
- bottom: e.options.search.bottom
- }) : r(prompt(t, o));
+ if (lineIndent > indent) {
+ // partially expanding tabs in code blocks, e.g '\t\tfoobar'
+ // with indent=2 becomes ' \tfoobar'
+ queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last);
+ } else {
+ queue[i] = this.src.slice(first, last);
}
- a(R, "dialog");
- function k(e, n, t, o) {
- e.openConfirm ? e.openConfirm(n, o) : confirm(t) && o[0]();
+ }
+ return queue.join('');
+};
+
+// re-export Token class to use in block rules
+StateBlock.prototype.Token = Token;
+
+// GFM table, https://github.github.com/gfm/#tables-extension-
+
+// Limit the amount of empty autocompleted cells in a table,
+// see https://github.com/markdown-it/markdown-it/issues/1000,
+//
+// Both pulldown-cmark and commonmark-hs limit the number of cells this way to ~200k.
+// We set it to 65k, which can expand user input by a factor of x370
+// (256x256 square is 1.8kB expanded into 650kB).
+const MAX_AUTOCOMPLETED_CELLS = 0x10000;
+function getLine(state, line) {
+ const pos = state.bMarks[line] + state.tShift[line];
+ const max = state.eMarks[line];
+ return state.src.slice(pos, max);
+}
+function escapedSplit(str) {
+ const result = [];
+ const max = str.length;
+ let pos = 0;
+ let ch = str.charCodeAt(pos);
+ let isEscaped = false;
+ let lastPos = 0;
+ let current = '';
+ while (pos < max) {
+ if (ch === 0x7c /* | */) {
+ if (!isEscaped) {
+ // pipe separating cells, '|'
+ result.push(current + str.substring(lastPos, pos));
+ current = '';
+ lastPos = pos + 1;
+ } else {
+ // escaped pipe, '\|'
+ current += str.substring(lastPos, pos - 1);
+ lastPos = pos;
+ }
}
- a(k, "confirmDialog");
- function C(e) {
- return e.replace(/\\([nrt\\])/g, function (n, t) {
- return t == "n" ? `
-` : t == "r" ? "\r" : t == "t" ? " " : t == "\\" ? "\\" : n;
- });
+ isEscaped = ch === 0x5c /* \ */;
+ pos++;
+ ch = str.charCodeAt(pos);
+ }
+ result.push(current + str.substring(lastPos));
+ return result;
+}
+function table(state, startLine, endLine, silent) {
+ // should have at least two lines
+ if (startLine + 2 > endLine) {
+ return false;
+ }
+ let nextLine = startLine + 1;
+ if (state.sCount[nextLine] < state.blkIndent) {
+ return false;
+ }
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
+ return false;
+ }
+
+ // first character of the second line should be '|', '-', ':',
+ // and no other characters are allowed but spaces;
+ // basically, this is the equivalent of /^[-:|][-:|\s]*$/ regexp
+
+ let pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ if (pos >= state.eMarks[nextLine]) {
+ return false;
+ }
+ const firstCh = state.src.charCodeAt(pos++);
+ if (firstCh !== 0x7C /* | */ && firstCh !== 0x2D /* - */ && firstCh !== 0x3A /* : */) {
+ return false;
+ }
+ if (pos >= state.eMarks[nextLine]) {
+ return false;
+ }
+ const secondCh = state.src.charCodeAt(pos++);
+ if (secondCh !== 0x7C /* | */ && secondCh !== 0x2D /* - */ && secondCh !== 0x3A /* : */ && !isSpace(secondCh)) {
+ return false;
+ }
+
+ // if first character is '-', then second character must not be a space
+ // (due to parsing ambiguity with list)
+ if (firstCh === 0x2D /* - */ && isSpace(secondCh)) {
+ return false;
+ }
+ while (pos < state.eMarks[nextLine]) {
+ const ch = state.src.charCodeAt(pos);
+ if (ch !== 0x7C /* | */ && ch !== 0x2D /* - */ && ch !== 0x3A /* : */ && !isSpace(ch)) {
+ return false;
}
- a(C, "parseString");
- function T(e) {
- var n = e.match(/^\/(.*)\/([a-z]*)$/);
- if (n) try {
- e = new RegExp(n[1], n[2].indexOf("i") == -1 ? "" : "i");
- } catch {} else e = C(e);
- return (typeof e == "string" ? e == "" : e.test("")) && (e = /x^/), e;
+ pos++;
+ }
+ let lineText = getLine(state, startLine + 1);
+ let columns = lineText.split('|');
+ const aligns = [];
+ for (let i = 0; i < columns.length; i++) {
+ const t = columns[i].trim();
+ if (!t) {
+ // allow empty columns before and after table, but not in between columns;
+ // e.g. allow ` |---| `, disallow ` ---||--- `
+ if (i === 0 || i === columns.length - 1) {
+ continue;
+ } else {
+ return false;
+ }
}
- a(T, "parseQuery");
- function D(e, n, t) {
- n.queryText = t, n.query = T(t), e.removeOverlay(n.overlay, m(n.query)), n.overlay = y(n.query, m(n.query)), e.addOverlay(n.overlay), e.showMatchesOnScrollbar && (n.annotate && (n.annotate.clear(), n.annotate = null), n.annotate = e.showMatchesOnScrollbar(n.query, m(n.query)));
+ if (!/^:?-+:?$/.test(t)) {
+ return false;
}
- a(D, "startSearch");
- function b(e, n, t, o) {
- var r = h(e);
- if (r.query) return P(e, n);
- var s = e.getSelection() || r.lastQuery;
- if (s instanceof RegExp && s.source == "x^" && (s = null), t && e.openDialog) {
- var c = null,
- u = a(function (f, x) {
- i.e_stop(x), f && (f != r.queryText && (D(e, r, f), r.posFrom = r.posTo = e.getCursor()), c && (c.style.opacity = 1), P(e, x.shiftKey, function (d, g) {
- var p;
- g.line < 3 && document.querySelector && (p = e.display.wrapper.querySelector(".CodeMirror-dialog")) && p.getBoundingClientRect().bottom - 4 > e.cursorCoords(g, "window").top && ((c = p).style.opacity = .4);
- }));
- }, "searchNext");
- j(e, _(e), s, u, function (f, x) {
- var d = i.keyName(f),
- g = e.getOption("extraKeys"),
- p = g && g[d] || i.keyMap[e.getOption("keyMap")][d];
- p == "findNext" || p == "findPrev" || p == "findPersistentNext" || p == "findPersistentPrev" ? (i.e_stop(f), D(e, h(e), x), e.execCommand(p)) : (p == "find" || p == "findPersistent") && (i.e_stop(f), u(x, f));
- }), o && s && (D(e, r, s), P(e, n));
- } else R(e, _(e), "Search for:", s, function (f) {
- f && !r.query && e.operation(function () {
- D(e, r, f), r.posFrom = r.posTo = e.getCursor(), P(e, n);
- });
- });
+ if (t.charCodeAt(t.length - 1) === 0x3A /* : */) {
+ aligns.push(t.charCodeAt(0) === 0x3A /* : */ ? 'center' : 'right');
+ } else if (t.charCodeAt(0) === 0x3A /* : */) {
+ aligns.push('left');
+ } else {
+ aligns.push('');
}
- a(b, "doSearch");
- function P(e, n, t) {
- e.operation(function () {
- var o = h(e),
- r = N(e, o.query, n ? o.posFrom : o.posTo);
- !r.find(n) && (r = N(e, o.query, n ? i.Pos(e.lastLine()) : i.Pos(e.firstLine(), 0)), !r.find(n)) || (e.setSelection(r.from(), r.to()), e.scrollIntoView({
- from: r.from(),
- to: r.to()
- }, 20), o.posFrom = r.from(), o.posTo = r.to(), t && t(r.from(), r.to()));
- });
+ }
+ lineText = getLine(state, startLine).trim();
+ if (lineText.indexOf('|') === -1) {
+ return false;
+ }
+ if (state.sCount[startLine] - state.blkIndent >= 4) {
+ return false;
+ }
+ columns = escapedSplit(lineText);
+ if (columns.length && columns[0] === '') columns.shift();
+ if (columns.length && columns[columns.length - 1] === '') columns.pop();
+
+ // header row will define an amount of columns in the entire table,
+ // and align row should be exactly the same (the rest of the rows can differ)
+ const columnCount = columns.length;
+ if (columnCount === 0 || columnCount !== aligns.length) {
+ return false;
+ }
+ if (silent) {
+ return true;
+ }
+ const oldParentType = state.parentType;
+ state.parentType = 'table';
+
+ // use 'blockquote' lists for termination because it's
+ // the most similar to tables
+ const terminatorRules = state.md.block.ruler.getRules('blockquote');
+ const token_to = state.push('table_open', 'table', 1);
+ const tableLines = [startLine, 0];
+ token_to.map = tableLines;
+ const token_tho = state.push('thead_open', 'thead', 1);
+ token_tho.map = [startLine, startLine + 1];
+ const token_htro = state.push('tr_open', 'tr', 1);
+ token_htro.map = [startLine, startLine + 1];
+ for (let i = 0; i < columns.length; i++) {
+ const token_ho = state.push('th_open', 'th', 1);
+ if (aligns[i]) {
+ token_ho.attrs = [['style', 'text-align:' + aligns[i]]];
}
- a(P, "findNext");
- function w(e) {
- e.operation(function () {
- var n = h(e);
- n.lastQuery = n.query, n.query && (n.query = n.queryText = null, e.removeOverlay(n.overlay), n.annotate && (n.annotate.clear(), n.annotate = null));
- });
+ const token_il = state.push('inline', '', 0);
+ token_il.content = columns[i].trim();
+ token_il.children = [];
+ state.push('th_close', 'th', -1);
+ }
+ state.push('tr_close', 'tr', -1);
+ state.push('thead_close', 'thead', -1);
+ let tbodyLines;
+ let autocompletedCells = 0;
+ for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
+ if (state.sCount[nextLine] < state.blkIndent) {
+ break;
}
- a(w, "clearSearch");
- function l(e, n) {
- var t = e ? document.createElement(e) : document.createDocumentFragment();
- for (var o in n) t[o] = n[o];
- for (var r = 2; r < arguments.length; r++) {
- var s = arguments[r];
- t.appendChild(typeof s == "string" ? document.createTextNode(s) : s);
+ let terminate = false;
+ for (let i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
}
- return t;
}
- a(l, "el");
- function _(e) {
- return l("", null, l("span", {
- className: "CodeMirror-search-label"
- }, e.phrase("Search:")), " ", l("input", {
- type: "text",
- style: "width: 10em",
- className: "CodeMirror-search-field"
- }), " ", l("span", {
- style: "color: #888",
- className: "CodeMirror-search-hint"
- }, e.phrase("(Use /re/ syntax for regexp search)")));
+ if (terminate) {
+ break;
}
- a(_, "getQueryDialog");
- function A(e) {
- return l("", null, " ", l("input", {
- type: "text",
- style: "width: 10em",
- className: "CodeMirror-search-field"
- }), " ", l("span", {
- style: "color: #888",
- className: "CodeMirror-search-hint"
- }, e.phrase("(Use /re/ syntax for regexp search)")));
+ lineText = getLine(state, nextLine).trim();
+ if (!lineText) {
+ break;
}
- a(A, "getReplaceQueryDialog");
- function I(e) {
- return l("", null, l("span", {
- className: "CodeMirror-search-label"
- }, e.phrase("With:")), " ", l("input", {
- type: "text",
- style: "width: 10em",
- className: "CodeMirror-search-field"
- }));
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
+ break;
}
- a(I, "getReplacementQueryDialog");
- function V(e) {
- return l("", null, l("span", {
- className: "CodeMirror-search-label"
- }, e.phrase("Replace?")), " ", l("button", {}, e.phrase("Yes")), " ", l("button", {}, e.phrase("No")), " ", l("button", {}, e.phrase("All")), " ", l("button", {}, e.phrase("Stop")));
+ columns = escapedSplit(lineText);
+ if (columns.length && columns[0] === '') columns.shift();
+ if (columns.length && columns[columns.length - 1] === '') columns.pop();
+
+ // note: autocomplete count can be negative if user specifies more columns than header,
+ // but that does not affect intended use (which is limiting expansion)
+ autocompletedCells += columnCount - columns.length;
+ if (autocompletedCells > MAX_AUTOCOMPLETED_CELLS) {
+ break;
}
- a(V, "getDoReplaceConfirm");
- function E(e, n, t) {
- e.operation(function () {
- for (var o = N(e, n); o.findNext();) if (typeof n != "string") {
- var r = e.getRange(o.from(), o.to()).match(n);
- o.replace(t.replace(/\$(\d)/g, function (s, c) {
- return r[c];
- }));
- } else o.replace(t);
- });
+ if (nextLine === startLine + 2) {
+ const token_tbo = state.push('tbody_open', 'tbody', 1);
+ token_tbo.map = tbodyLines = [startLine + 2, 0];
}
- a(E, "replaceAll");
- function F(e, n) {
- if (!e.getOption("readOnly")) {
- var t = e.getSelection() || h(e).lastQuery,
- o = n ? e.phrase("Replace all:") : e.phrase("Replace:"),
- r = l("", null, l("span", {
- className: "CodeMirror-search-label"
- }, o), A(e));
- R(e, r, o, t, function (s) {
- s && (s = T(s), R(e, I(e), e.phrase("Replace with:"), "", function (c) {
- if (c = C(c), n) E(e, s, c);else {
- w(e);
- var u = N(e, s, e.getCursor("from")),
- f = a(function () {
- var d = u.from(),
- g;
- !(g = u.findNext()) && (u = N(e, s), !(g = u.findNext()) || d && u.from().line == d.line && u.from().ch == d.ch) || (e.setSelection(u.from(), u.to()), e.scrollIntoView({
- from: u.from(),
- to: u.to()
- }), k(e, V(e), e.phrase("Replace?"), [function () {
- x(g);
- }, f, function () {
- E(e, s, c);
- }]));
- }, "advance"),
- x = a(function (d) {
- u.replace(typeof s == "string" ? c : c.replace(/\$(\d)/g, function (g, p) {
- return d[p];
- })), f();
- }, "doReplace");
- f();
- }
- }));
- });
+ const token_tro = state.push('tr_open', 'tr', 1);
+ token_tro.map = [nextLine, nextLine + 1];
+ for (let i = 0; i < columnCount; i++) {
+ const token_tdo = state.push('td_open', 'td', 1);
+ if (aligns[i]) {
+ token_tdo.attrs = [['style', 'text-align:' + aligns[i]]];
}
+ const token_il = state.push('inline', '', 0);
+ token_il.content = columns[i] ? columns[i].trim() : '';
+ token_il.children = [];
+ state.push('td_close', 'td', -1);
}
- a(F, "replace"), i.commands.find = function (e) {
- w(e), b(e);
- }, i.commands.findPersistent = function (e) {
- w(e), b(e, !1, !0);
- }, i.commands.findPersistentNext = function (e) {
- b(e, !1, !0, !0);
- }, i.commands.findPersistentPrev = function (e) {
- b(e, !0, !0, !0);
- }, i.commands.findNext = b, i.commands.findPrev = function (e) {
- b(e, !0);
- }, i.commands.clearSearch = w, i.commands.replace = F, i.commands.replaceAll = function (e) {
- F(e, !0);
- };
- });
-})();
-var $ = B.exports;
-const W = Q.getDefaultExportFromCjs($),
- Y = U({
- __proto__: null,
- default: W
- }, [$]);
-exports.search = Y;
+ state.push('tr_close', 'tr', -1);
+ }
+ if (tbodyLines) {
+ state.push('tbody_close', 'tbody', -1);
+ tbodyLines[1] = nextLine;
+ }
+ state.push('table_close', 'table', -1);
+ tableLines[1] = nextLine;
+ state.parentType = oldParentType;
+ state.line = nextLine;
+ return true;
+}
-/***/ }),
+// Code block (4 spaces padded)
-/***/ "../../graphiql-react/dist/searchcursor.cjs.js":
-/*!*****************************************************!*\
- !*** ../../graphiql-react/dist/searchcursor.cjs.js ***!
- \*****************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+function code(state, startLine, endLine /*, silent */) {
+ if (state.sCount[startLine] - state.blkIndent < 4) {
+ return false;
+ }
+ let nextLine = startLine + 1;
+ let last = nextLine;
+ while (nextLine < endLine) {
+ if (state.isEmpty(nextLine)) {
+ nextLine++;
+ continue;
+ }
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
+ nextLine++;
+ last = nextLine;
+ continue;
+ }
+ break;
+ }
+ state.line = last;
+ const token = state.push('code_block', 'code', 0);
+ token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\n';
+ token.map = [startLine, state.line];
+ return true;
+}
+
+// fences (``` lang, ~~~ lang)
+
+function fence(state, startLine, endLine, silent) {
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
+ let max = state.eMarks[startLine];
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) {
+ return false;
+ }
+ if (pos + 3 > max) {
+ return false;
+ }
+ const marker = state.src.charCodeAt(pos);
+ if (marker !== 0x7E /* ~ */ && marker !== 0x60 /* ` */) {
+ return false;
+ }
+
+ // scan marker length
+ let mem = pos;
+ pos = state.skipChars(pos, marker);
+ let len = pos - mem;
+ if (len < 3) {
+ return false;
+ }
+ const markup = state.src.slice(mem, pos);
+ const params = state.src.slice(pos, max);
+ if (marker === 0x60 /* ` */) {
+ if (params.indexOf(String.fromCharCode(marker)) >= 0) {
+ return false;
+ }
+ }
+
+ // Since start is found, we can report success here in validation mode
+ if (silent) {
+ return true;
+ }
+ // search end of block
+ let nextLine = startLine;
+ let haveEndMarker = false;
+ for (;;) {
+ nextLine++;
+ if (nextLine >= endLine) {
+ // unclosed block should be autoclosed by end of document.
+ // also block seems to be autoclosed by end of parent
+ break;
+ }
+ pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
+ max = state.eMarks[nextLine];
+ if (pos < max && state.sCount[nextLine] < state.blkIndent) {
+ // non-empty line with negative indent should stop the list:
+ // - ```
+ // test
+ break;
+ }
+ if (state.src.charCodeAt(pos) !== marker) {
+ continue;
+ }
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
+ // closing fence should be indented less than 4 spaces
+ continue;
+ }
+ pos = state.skipChars(pos, marker);
+ // closing code fence must be at least as long as the opening one
+ if (pos - mem < len) {
+ continue;
+ }
-var n = Object.defineProperty;
-var u = (r, o) => n(r, "name", {
- value: o,
- configurable: !0
-});
-const i = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"),
- f = __webpack_require__(/*! ./searchcursor.cjs2.js */ "../../graphiql-react/dist/searchcursor.cjs2.js");
-function l(r, o) {
- for (var c = 0; c < o.length; c++) {
- const e = o[c];
- if (typeof e != "string" && !Array.isArray(e)) {
- for (const t in e) if (t !== "default" && !(t in r)) {
- const s = Object.getOwnPropertyDescriptor(e, t);
- s && Object.defineProperty(r, t, s.get ? s : {
- enumerable: !0,
- get: () => e[t]
- });
- }
+ // make sure tail has spaces only
+ pos = state.skipSpaces(pos);
+ if (pos < max) {
+ continue;
}
+ haveEndMarker = true;
+ // found!
+ break;
}
- return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, {
- value: "Module"
- }));
-}
-u(l, "_mergeNamespaces");
-var a = f.requireSearchcursor();
-const g = i.getDefaultExportFromCjs(a),
- p = l({
- __proto__: null,
- default: g
- }, [a]);
-exports.searchcursor = p;
-
-/***/ }),
-/***/ "../../graphiql-react/dist/searchcursor.cjs2.js":
-/*!******************************************************!*\
- !*** ../../graphiql-react/dist/searchcursor.cjs2.js ***!
- \******************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+ // If a fence has heading spaces, they should be removed from its inner block
+ len = state.sCount[startLine];
+ state.line = nextLine + (haveEndMarker ? 1 : 0);
+ const token = state.push('fence', 'code', 0);
+ token.info = params;
+ token.content = state.getLines(startLine + 1, nextLine, len, true);
+ token.markup = markup;
+ token.map = [startLine, state.line];
+ return true;
+}
+// Block quotes
+function blockquote(state, startLine, endLine, silent) {
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
+ let max = state.eMarks[startLine];
+ const oldLineMax = state.lineMax;
-var W = Object.defineProperty;
-var o = (d, E) => W(d, "name", {
- value: E,
- configurable: !0
-});
-const G = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-var N = {
- exports: {}
- },
- b;
-function H() {
- return b || (b = 1, function (d, E) {
- (function (m) {
- m(G.requireCodemirror());
- })(function (m) {
- var a = m.Pos;
- function B(e) {
- var t = e.flags;
- return t !== null && t !== void 0 ? t : (e.ignoreCase ? "i" : "") + (e.global ? "g" : "") + (e.multiline ? "m" : "");
- }
- o(B, "regexpFlags");
- function F(e, t) {
- for (var n = B(e), r = n, l = 0; l < t.length; l++) r.indexOf(t.charAt(l)) == -1 && (r += t.charAt(l));
- return n == r ? e : new RegExp(e.source, r);
- }
- o(F, "ensureFlags");
- function R(e) {
- return /\\s|\\n|\n|\\W|\\D|\[\^/.test(e.source);
- }
- o(R, "maybeMultiline");
- function I(e, t, n) {
- t = F(t, "g");
- for (var r = n.line, l = n.ch, i = e.lastLine(); r <= i; r++, l = 0) {
- t.lastIndex = l;
- var h = e.getLine(r),
- f = t.exec(h);
- if (f) return {
- from: a(r, f.index),
- to: a(r, f.index + f[0].length),
- match: f
- };
- }
- }
- o(I, "searchRegexpForward");
- function j(e, t, n) {
- if (!R(t)) return I(e, t, n);
- t = F(t, "gm");
- for (var r, l = 1, i = n.line, h = e.lastLine(); i <= h;) {
- for (var f = 0; f < l && !(i > h); f++) {
- var p = e.getLine(i++);
- r = r == null ? p : r + `
-` + p;
- }
- l = l * 2, t.lastIndex = n.ch;
- var u = t.exec(r);
- if (u) {
- var s = r.slice(0, u.index).split(`
-`),
- c = u[0].split(`
-`),
- g = n.line + s.length - 1,
- v = s[s.length - 1].length;
- return {
- from: a(g, v),
- to: a(g + c.length - 1, c.length == 1 ? v + c[0].length : c[c.length - 1].length),
- match: u
- };
- }
- }
- }
- o(j, "searchRegexpForwardMultiline");
- function z(e, t, n) {
- for (var r, l = 0; l <= e.length;) {
- t.lastIndex = l;
- var i = t.exec(e);
- if (!i) break;
- var h = i.index + i[0].length;
- if (h > e.length - n) break;
- (!r || h > r.index + r[0].length) && (r = i), l = i.index + 1;
- }
- return r;
- }
- o(z, "lastMatchIn");
- function D(e, t, n) {
- t = F(t, "g");
- for (var r = n.line, l = n.ch, i = e.firstLine(); r >= i; r--, l = -1) {
- var h = e.getLine(r),
- f = z(h, t, l < 0 ? 0 : h.length - l);
- if (f) return {
- from: a(r, f.index),
- to: a(r, f.index + f[0].length),
- match: f
- };
- }
- }
- o(D, "searchRegexpBackward");
- function A(e, t, n) {
- if (!R(t)) return D(e, t, n);
- t = F(t, "gm");
- for (var r, l = 1, i = e.getLine(n.line).length - n.ch, h = n.line, f = e.firstLine(); h >= f;) {
- for (var p = 0; p < l && h >= f; p++) {
- var u = e.getLine(h--);
- r = r == null ? u : u + `
-` + r;
- }
- l *= 2;
- var s = z(r, t, i);
- if (s) {
- var c = r.slice(0, s.index).split(`
-`),
- g = s[0].split(`
-`),
- v = h + c.length,
- x = c[c.length - 1].length;
- return {
- from: a(v, x),
- to: a(v + g.length - 1, g.length == 1 ? x + g[0].length : g[g.length - 1].length),
- match: s
- };
- }
- }
- }
- o(A, "searchRegexpBackwardMultiline");
- var P, k;
- String.prototype.normalize ? (P = o(function (e) {
- return e.normalize("NFD").toLowerCase();
- }, "doFold"), k = o(function (e) {
- return e.normalize("NFD");
- }, "noFold")) : (P = o(function (e) {
- return e.toLowerCase();
- }, "doFold"), k = o(function (e) {
- return e;
- }, "noFold"));
- function L(e, t, n, r) {
- if (e.length == t.length) return n;
- for (var l = 0, i = n + Math.max(0, e.length - t.length);;) {
- if (l == i) return l;
- var h = l + i >> 1,
- f = r(e.slice(0, h)).length;
- if (f == n) return h;
- f > n ? i = h : l = h + 1;
- }
- }
- o(L, "adjustPos");
- function y(e, t, n, r) {
- if (!t.length) return null;
- var l = r ? P : k,
- i = l(t).split(/\r|\n\r?/);
- t: for (var h = n.line, f = n.ch, p = e.lastLine() + 1 - i.length; h <= p; h++, f = 0) {
- var u = e.getLine(h).slice(f),
- s = l(u);
- if (i.length == 1) {
- var c = s.indexOf(i[0]);
- if (c == -1) continue t;
- var n = L(u, s, c, l) + f;
- return {
- from: a(h, L(u, s, c, l) + f),
- to: a(h, L(u, s, c + i[0].length, l) + f)
- };
- } else {
- var g = s.length - i[0].length;
- if (s.slice(g) != i[0]) continue t;
- for (var v = 1; v < i.length - 1; v++) if (l(e.getLine(h + v)) != i[v]) continue t;
- var x = e.getLine(h + i.length - 1),
- O = l(x),
- S = i[i.length - 1];
- if (O.slice(0, S.length) != S) continue t;
- return {
- from: a(h, L(u, s, g, l) + f),
- to: a(h + i.length - 1, L(x, O, S.length, l))
- };
- }
- }
- }
- o(y, "searchStringForward");
- function C(e, t, n, r) {
- if (!t.length) return null;
- var l = r ? P : k,
- i = l(t).split(/\r|\n\r?/);
- t: for (var h = n.line, f = n.ch, p = e.firstLine() - 1 + i.length; h >= p; h--, f = -1) {
- var u = e.getLine(h);
- f > -1 && (u = u.slice(0, f));
- var s = l(u);
- if (i.length == 1) {
- var c = s.lastIndexOf(i[0]);
- if (c == -1) continue t;
- return {
- from: a(h, L(u, s, c, l)),
- to: a(h, L(u, s, c + i[0].length, l))
- };
- } else {
- var g = i[i.length - 1];
- if (s.slice(0, g.length) != g) continue t;
- for (var v = 1, n = h - i.length + 1; v < i.length - 1; v++) if (l(e.getLine(n + v)) != i[v]) continue t;
- var x = e.getLine(h + 1 - i.length),
- O = l(x);
- if (O.slice(O.length - i[0].length) != i[0]) continue t;
- return {
- from: a(h + 1 - i.length, L(x, O, x.length - i[0].length, l)),
- to: a(h, L(u, s, g.length, l))
- };
- }
- }
- }
- o(C, "searchStringBackward");
- function w(e, t, n, r) {
- this.atOccurrence = !1, this.afterEmptyMatch = !1, this.doc = e, n = n ? e.clipPos(n) : a(0, 0), this.pos = {
- from: n,
- to: n
- };
- var l;
- typeof r == "object" ? l = r.caseFold : (l = r, r = null), typeof t == "string" ? (l == null && (l = !1), this.matches = function (i, h) {
- return (i ? C : y)(e, t, h, l);
- }) : (t = F(t, "gm"), !r || r.multiline !== !1 ? this.matches = function (i, h) {
- return (i ? A : j)(e, t, h);
- } : this.matches = function (i, h) {
- return (i ? D : I)(e, t, h);
- });
- }
- o(w, "SearchCursor"), w.prototype = {
- findNext: function () {
- return this.find(!1);
- },
- findPrevious: function () {
- return this.find(!0);
- },
- find: function (e) {
- var t = this.doc.clipPos(e ? this.pos.from : this.pos.to);
- if (this.afterEmptyMatch && this.atOccurrence && (t = a(t.line, t.ch), e ? (t.ch--, t.ch < 0 && (t.line--, t.ch = (this.doc.getLine(t.line) || "").length)) : (t.ch++, t.ch > (this.doc.getLine(t.line) || "").length && (t.ch = 0, t.line++)), m.cmpPos(t, this.doc.clipPos(t)) != 0)) return this.atOccurrence = !1;
- var n = this.matches(e, t);
- if (this.afterEmptyMatch = n && m.cmpPos(n.from, n.to) == 0, n) return this.pos = n, this.atOccurrence = !0, this.pos.match || !0;
- var r = a(e ? this.doc.firstLine() : this.doc.lastLine() + 1, 0);
- return this.pos = {
- from: r,
- to: r
- }, this.atOccurrence = !1;
- },
- from: function () {
- if (this.atOccurrence) return this.pos.from;
- },
- to: function () {
- if (this.atOccurrence) return this.pos.to;
- },
- replace: function (e, t) {
- if (this.atOccurrence) {
- var n = m.splitLines(e);
- this.doc.replaceRange(n, this.pos.from, this.pos.to, t), this.pos.to = a(this.pos.from.line + n.length - 1, n[n.length - 1].length + (n.length == 1 ? this.pos.from.ch : 0));
- }
- }
- }, m.defineExtension("getSearchCursor", function (e, t, n) {
- return new w(this.doc, e, t, n);
- }), m.defineDocExtension("getSearchCursor", function (e, t, n) {
- return new w(this, e, t, n);
- }), m.defineExtension("selectMatches", function (e, t) {
- for (var n = [], r = this.getSearchCursor(e, this.getCursor("from"), t); r.findNext() && !(m.cmpPos(r.to(), this.getCursor("to")) > 0);) n.push({
- anchor: r.from(),
- head: r.to()
- });
- n.length && this.setSelections(n, 0);
- });
- });
- }()), N.exports;
-}
-o(H, "requireSearchcursor");
-exports.requireSearchcursor = H;
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) {
+ return false;
+ }
-/***/ }),
+ // check the block quote marker
+ if (state.src.charCodeAt(pos) !== 0x3E /* > */) {
+ return false;
+ }
-/***/ "../../graphiql-react/dist/show-hint.cjs.js":
-/*!**************************************************!*\
- !*** ../../graphiql-react/dist/show-hint.cjs.js ***!
- \**************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+ // we know that it's going to be a valid blockquote,
+ // so no point trying to find the end of it in silent mode
+ if (silent) {
+ return true;
+ }
+ const oldBMarks = [];
+ const oldBSCount = [];
+ const oldSCount = [];
+ const oldTShift = [];
+ const terminatorRules = state.md.block.ruler.getRules('blockquote');
+ const oldParentType = state.parentType;
+ state.parentType = 'blockquote';
+ let lastLineEmpty = false;
+ let nextLine;
+ // Search the end of the block
+ //
+ // Block ends with either:
+ // 1. an empty line outside:
+ // ```
+ // > test
+ //
+ // ```
+ // 2. an empty line inside:
+ // ```
+ // >
+ // test
+ // ```
+ // 3. another tag:
+ // ```
+ // > test
+ // - - -
+ // ```
+ for (nextLine = startLine; nextLine < endLine; nextLine++) {
+ // check if it's outdented, i.e. it's inside list item and indented
+ // less than said list item:
+ //
+ // ```
+ // 1. anything
+ // > current blockquote
+ // 2. checking this line
+ // ```
+ const isOutdented = state.sCount[nextLine] < state.blkIndent;
+ pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ max = state.eMarks[nextLine];
+ if (pos >= max) {
+ // Case 1: line is not inside the blockquote, and this line is empty.
+ break;
+ }
+ if (state.src.charCodeAt(pos++) === 0x3E /* > */ && !isOutdented) {
+ // This line is inside the blockquote.
+ // set offset past spaces and ">"
+ let initial = state.sCount[nextLine] + 1;
+ let spaceAfterMarker;
+ let adjustTab;
-var ct = Object.defineProperty;
-var p = (H, A) => ct(H, "name", {
- value: A,
- configurable: !0
-});
-const G = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js");
-function lt(H, A) {
- for (var r = 0; r < A.length; r++) {
- const w = A[r];
- if (typeof w != "string" && !Array.isArray(w)) {
- for (const v in w) if (v !== "default" && !(v in H)) {
- const b = Object.getOwnPropertyDescriptor(w, v);
- b && Object.defineProperty(H, v, b.get ? b : {
- enumerable: !0,
- get: () => w[v]
- });
- }
- }
- }
- return Object.freeze(Object.defineProperty(H, Symbol.toStringTag, {
- value: "Module"
- }));
-}
-p(lt, "_mergeNamespaces");
-var ht = {
- exports: {}
-};
-(function (H, A) {
- (function (r) {
- r(G.requireCodemirror());
- })(function (r) {
- var w = "CodeMirror-hint",
- v = "CodeMirror-hint-active";
- r.showHint = function (t, e, i) {
- if (!e) return t.showHint(i);
- i && i.async && (e.async = !0);
- var n = {
- hint: e
- };
- if (i) for (var s in i) n[s] = i[s];
- return t.showHint(n);
- }, r.defineExtension("showHint", function (t) {
- t = tt(this, this.getCursor("start"), t);
- var e = this.listSelections();
- if (!(e.length > 1)) {
- if (this.somethingSelected()) {
- if (!t.hint.supportsSelection) return;
- for (var i = 0; i < e.length; i++) if (e[i].head.line != e[i].anchor.line) return;
+ // skip one optional space after '>'
+ if (state.src.charCodeAt(pos) === 0x20 /* space */) {
+ // ' > test '
+ // ^ -- position start of line here:
+ pos++;
+ initial++;
+ adjustTab = false;
+ spaceAfterMarker = true;
+ } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
+ spaceAfterMarker = true;
+ if ((state.bsCount[nextLine] + initial) % 4 === 3) {
+ // ' >\t test '
+ // ^ -- position start of line here (tab has width===1)
+ pos++;
+ initial++;
+ adjustTab = false;
+ } else {
+ // ' >\t test '
+ // ^ -- position start of line here + shift bsCount slightly
+ // to make extra space appear
+ adjustTab = true;
}
- this.state.completionActive && this.state.completionActive.close();
- var n = this.state.completionActive = new b(this, t);
- n.options.hint && (r.signal(this, "startCompletion", this), n.update(!0));
- }
- }), r.defineExtension("closeHint", function () {
- this.state.completionActive && this.state.completionActive.close();
- });
- function b(t, e) {
- if (this.cm = t, this.options = e, this.widget = null, this.debounce = 0, this.tick = 0, this.startPos = this.cm.getCursor("start"), this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length, this.options.updateOnCursorActivity) {
- var i = this;
- t.on("cursorActivity", this.activityFunc = function () {
- i.cursorActivity();
- });
+ } else {
+ spaceAfterMarker = false;
}
- }
- p(b, "Completion");
- var Q = window.requestAnimationFrame || function (t) {
- return setTimeout(t, 1e3 / 60);
- },
- Z = window.cancelAnimationFrame || clearTimeout;
- b.prototype = {
- close: function () {
- this.active() && (this.cm.state.completionActive = null, this.tick = null, this.options.updateOnCursorActivity && this.cm.off("cursorActivity", this.activityFunc), this.widget && this.data && r.signal(this.data, "close"), this.widget && this.widget.close(), r.signal(this.cm, "endCompletion", this.cm));
- },
- active: function () {
- return this.cm.state.completionActive == this;
- },
- pick: function (t, e) {
- var i = t.list[e],
- n = this;
- this.cm.operation(function () {
- i.hint ? i.hint(n.cm, t, i) : n.cm.replaceRange(_(i), i.from || t.from, i.to || t.to, "complete"), r.signal(t, "pick", i), n.cm.scrollIntoView();
- }), this.options.closeOnPick && this.close();
- },
- cursorActivity: function () {
- this.debounce && (Z(this.debounce), this.debounce = 0);
- var t = this.startPos;
- this.data && (t = this.data.from);
- var e = this.cm.getCursor(),
- i = this.cm.getLine(e.line);
- if (e.line != this.startPos.line || i.length - e.ch != this.startLen - this.startPos.ch || e.ch < t.ch || this.cm.somethingSelected() || !e.ch || this.options.closeCharacters.test(i.charAt(e.ch - 1))) this.close();else {
- var n = this;
- this.debounce = Q(function () {
- n.update();
- }), this.widget && this.widget.disable();
- }
- },
- update: function (t) {
- if (this.tick != null) {
- var e = this,
- i = ++this.tick;
- U(this.options.hint, this.cm, this.options, function (n) {
- e.tick == i && e.finishUpdate(n, t);
- });
+ let offset = initial;
+ oldBMarks.push(state.bMarks[nextLine]);
+ state.bMarks[nextLine] = pos;
+ while (pos < max) {
+ const ch = state.src.charCodeAt(pos);
+ if (isSpace(ch)) {
+ if (ch === 0x09) {
+ offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
+ } else {
+ offset++;
+ }
+ } else {
+ break;
}
- },
- finishUpdate: function (t, e) {
- this.data && r.signal(this.data, "update");
- var i = this.widget && this.widget.picked || e && this.options.completeSingle;
- this.widget && this.widget.close(), this.data = t, t && t.list.length && (i && t.list.length == 1 ? this.pick(t, 0) : (this.widget = new K(this, t), r.signal(t, "shown")));
+ pos++;
}
- };
- function tt(t, e, i) {
- var n = t.options.hintOptions,
- s = {};
- for (var c in D) s[c] = D[c];
- if (n) for (var c in n) n[c] !== void 0 && (s[c] = n[c]);
- if (i) for (var c in i) i[c] !== void 0 && (s[c] = i[c]);
- return s.hint.resolve && (s.hint = s.hint.resolve(t, e)), s;
+ lastLineEmpty = pos >= max;
+ oldBSCount.push(state.bsCount[nextLine]);
+ state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
+ oldSCount.push(state.sCount[nextLine]);
+ state.sCount[nextLine] = offset - initial;
+ oldTShift.push(state.tShift[nextLine]);
+ state.tShift[nextLine] = pos - state.bMarks[nextLine];
+ continue;
}
- p(tt, "parseOptions");
- function _(t) {
- return typeof t == "string" ? t : t.text;
+
+ // Case 2: line is not inside the blockquote, and the last line was empty.
+ if (lastLineEmpty) {
+ break;
}
- p(_, "getText");
- function et(t, e) {
- var i = {
- Up: function () {
- e.moveFocus(-1);
- },
- Down: function () {
- e.moveFocus(1);
- },
- PageUp: function () {
- e.moveFocus(-e.menuSize() + 1, !0);
- },
- PageDown: function () {
- e.moveFocus(e.menuSize() - 1, !0);
- },
- Home: function () {
- e.setFocus(0);
- },
- End: function () {
- e.setFocus(e.length - 1);
- },
- Enter: e.pick,
- Tab: e.pick,
- Esc: e.close
- },
- n = /Mac/.test(navigator.platform);
- n && (i["Ctrl-P"] = function () {
- e.moveFocus(-1);
- }, i["Ctrl-N"] = function () {
- e.moveFocus(1);
- });
- var s = t.options.customKeys,
- c = s ? {} : i;
- function o(u, l) {
- var a;
- typeof l != "string" ? a = p(function (S) {
- return l(S, e);
- }, "bound") : i.hasOwnProperty(l) ? a = i[l] : a = l, c[u] = a;
+
+ // Case 3: another tag found.
+ let terminate = false;
+ for (let i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
}
- if (p(o, "addBinding"), s) for (var f in s) s.hasOwnProperty(f) && o(f, s[f]);
- var h = t.options.extraKeys;
- if (h) for (var f in h) h.hasOwnProperty(f) && o(f, h[f]);
- return c;
}
- p(et, "buildKeyMap");
- function B(t, e) {
- for (; e && e != t;) {
- if (e.nodeName.toUpperCase() === "LI" && e.parentNode == t) return e;
- e = e.parentNode;
+ if (terminate) {
+ // Quirk to enforce "hard termination mode" for paragraphs;
+ // normally if you call `tokenize(state, startLine, nextLine)`,
+ // paragraphs will look below nextLine for paragraph continuation,
+ // but if blockquote is terminated by another tag, they shouldn't
+ state.lineMax = nextLine;
+ if (state.blkIndent !== 0) {
+ // state.blkIndent was non-zero, we now set it to zero,
+ // so we need to re-calculate all offsets to appear as
+ // if indent wasn't changed
+ oldBMarks.push(state.bMarks[nextLine]);
+ oldBSCount.push(state.bsCount[nextLine]);
+ oldTShift.push(state.tShift[nextLine]);
+ oldSCount.push(state.sCount[nextLine]);
+ state.sCount[nextLine] -= state.blkIndent;
}
+ break;
}
- p(B, "getHintElement");
- function K(t, e) {
- this.id = "cm-complete-" + Math.floor(Math.random(1e6)), this.completion = t, this.data = e, this.picked = !1;
- var i = this,
- n = t.cm,
- s = n.getInputField().ownerDocument,
- c = s.defaultView || s.parentWindow,
- o = this.hints = s.createElement("ul");
- o.setAttribute("role", "listbox"), o.setAttribute("aria-expanded", "true"), o.id = this.id;
- var f = t.cm.options.theme;
- o.className = "CodeMirror-hints " + f, this.selectedHint = e.selectedHint || 0;
- for (var h = e.list, u = 0; u < h.length; ++u) {
- var l = o.appendChild(s.createElement("li")),
- a = h[u],
- S = w + (u != this.selectedHint ? "" : " " + v);
- a.className != null && (S = a.className + " " + S), l.className = S, u == this.selectedHint && l.setAttribute("aria-selected", "true"), l.id = this.id + "-" + u, l.setAttribute("role", "option"), a.render ? a.render(l, e, a) : l.appendChild(s.createTextNode(a.displayText || _(a))), l.hintId = u;
- }
- var T = t.options.container || s.body,
- y = n.cursorCoords(t.options.alignWithWord ? e.from : null),
- k = y.left,
- O = y.bottom,
- j = !0,
- F = 0,
- E = 0;
- if (T !== s.body) {
- var st = ["absolute", "relative", "fixed"].indexOf(c.getComputedStyle(T).position) !== -1,
- W = st ? T : T.offsetParent,
- M = W.getBoundingClientRect(),
- q = s.body.getBoundingClientRect();
- F = M.left - q.left - W.scrollLeft, E = M.top - q.top - W.scrollTop;
- }
- o.style.left = k - F + "px", o.style.top = O - E + "px";
- var N = c.innerWidth || Math.max(s.body.offsetWidth, s.documentElement.offsetWidth),
- L = c.innerHeight || Math.max(s.body.offsetHeight, s.documentElement.offsetHeight);
- T.appendChild(o), n.getInputField().setAttribute("aria-autocomplete", "list"), n.getInputField().setAttribute("aria-owns", this.id), n.getInputField().setAttribute("aria-activedescendant", this.id + "-" + this.selectedHint);
- var m = t.options.moveOnOverlap ? o.getBoundingClientRect() : new DOMRect(),
- z = t.options.paddingForScrollbar ? o.scrollHeight > o.clientHeight + 1 : !1,
- x;
- setTimeout(function () {
- x = n.getScrollInfo();
- });
- var ot = m.bottom - L;
- if (ot > 0) {
- var P = m.bottom - m.top,
- rt = y.top - (y.bottom - m.top);
- if (rt - P > 0) o.style.top = (O = y.top - P - E) + "px", j = !1;else if (P > L) {
- o.style.height = L - 5 + "px", o.style.top = (O = y.bottom - m.top - E) + "px";
- var V = n.getCursor();
- e.from.ch != V.ch && (y = n.cursorCoords(V), o.style.left = (k = y.left - F) + "px", m = o.getBoundingClientRect());
- }
- }
- var C = m.right - N;
- if (z && (C += n.display.nativeBarWidth), C > 0 && (m.right - m.left > N && (o.style.width = N - 5 + "px", C -= m.right - m.left - N), o.style.left = (k = y.left - C - F) + "px"), z) for (var I = o.firstChild; I; I = I.nextSibling) I.style.paddingRight = n.display.nativeBarWidth + "px";
- if (n.addKeyMap(this.keyMap = et(t, {
- moveFocus: function (d, g) {
- i.changeActive(i.selectedHint + d, g);
- },
- setFocus: function (d) {
- i.changeActive(d);
- },
- menuSize: function () {
- return i.screenAmount();
- },
- length: h.length,
- close: function () {
- t.close();
- },
- pick: function () {
- i.pick();
- },
- data: e
- })), t.options.closeOnUnfocus) {
- var Y;
- n.on("blur", this.onBlur = function () {
- Y = setTimeout(function () {
- t.close();
- }, 100);
- }), n.on("focus", this.onFocus = function () {
- clearTimeout(Y);
- });
- }
- n.on("scroll", this.onScroll = function () {
- var d = n.getScrollInfo(),
- g = n.getWrapperElement().getBoundingClientRect();
- x || (x = n.getScrollInfo());
- var X = O + x.top - d.top,
- R = X - (c.pageYOffset || (s.documentElement || s.body).scrollTop);
- if (j || (R += o.offsetHeight), R <= g.top || R >= g.bottom) return t.close();
- o.style.top = X + "px", o.style.left = k + x.left - d.left + "px";
- }), r.on(o, "dblclick", function (d) {
- var g = B(o, d.target || d.srcElement);
- g && g.hintId != null && (i.changeActive(g.hintId), i.pick());
- }), r.on(o, "click", function (d) {
- var g = B(o, d.target || d.srcElement);
- g && g.hintId != null && (i.changeActive(g.hintId), t.options.completeOnSingleClick && i.pick());
- }), r.on(o, "mousedown", function () {
- setTimeout(function () {
- n.focus();
- }, 20);
- });
- var $ = this.getSelectedHintRange();
- return ($.from !== 0 || $.to !== 0) && this.scrollToActive(), r.signal(e, "select", h[this.selectedHint], o.childNodes[this.selectedHint]), !0;
+ oldBMarks.push(state.bMarks[nextLine]);
+ oldBSCount.push(state.bsCount[nextLine]);
+ oldTShift.push(state.tShift[nextLine]);
+ oldSCount.push(state.sCount[nextLine]);
+
+ // A negative indentation means that this is a paragraph continuation
+ //
+ state.sCount[nextLine] = -1;
+ }
+ const oldIndent = state.blkIndent;
+ state.blkIndent = 0;
+ const token_o = state.push('blockquote_open', 'blockquote', 1);
+ token_o.markup = '>';
+ const lines = [startLine, 0];
+ token_o.map = lines;
+ state.md.block.tokenize(state, startLine, nextLine);
+ const token_c = state.push('blockquote_close', 'blockquote', -1);
+ token_c.markup = '>';
+ state.lineMax = oldLineMax;
+ state.parentType = oldParentType;
+ lines[1] = state.line;
+
+ // Restore original tShift; this might not be necessary since the parser
+ // has already been here, but just to make sure we can do that.
+ for (let i = 0; i < oldTShift.length; i++) {
+ state.bMarks[i + startLine] = oldBMarks[i];
+ state.tShift[i + startLine] = oldTShift[i];
+ state.sCount[i + startLine] = oldSCount[i];
+ state.bsCount[i + startLine] = oldBSCount[i];
+ }
+ state.blkIndent = oldIndent;
+ return true;
+}
+
+// Horizontal rule
+
+function hr(state, startLine, endLine, silent) {
+ const max = state.eMarks[startLine];
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) {
+ return false;
+ }
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
+ const marker = state.src.charCodeAt(pos++);
+
+ // Check hr marker
+ if (marker !== 0x2A /* * */ && marker !== 0x2D /* - */ && marker !== 0x5F /* _ */) {
+ return false;
+ }
+
+ // markers can be mixed with spaces, but there should be at least 3 of them
+
+ let cnt = 1;
+ while (pos < max) {
+ const ch = state.src.charCodeAt(pos++);
+ if (ch !== marker && !isSpace(ch)) {
+ return false;
}
- p(K, "Widget"), K.prototype = {
- close: function () {
- if (this.completion.widget == this) {
- this.completion.widget = null, this.hints.parentNode && this.hints.parentNode.removeChild(this.hints), this.completion.cm.removeKeyMap(this.keyMap);
- var t = this.completion.cm.getInputField();
- t.removeAttribute("aria-activedescendant"), t.removeAttribute("aria-owns");
- var e = this.completion.cm;
- this.completion.options.closeOnUnfocus && (e.off("blur", this.onBlur), e.off("focus", this.onFocus)), e.off("scroll", this.onScroll);
- }
- },
- disable: function () {
- this.completion.cm.removeKeyMap(this.keyMap);
- var t = this;
- this.keyMap = {
- Enter: function () {
- t.picked = !0;
- }
- }, this.completion.cm.addKeyMap(this.keyMap);
- },
- pick: function () {
- this.completion.pick(this.data, this.selectedHint);
- },
- changeActive: function (t, e) {
- if (t >= this.data.list.length ? t = e ? this.data.list.length - 1 : 0 : t < 0 && (t = e ? 0 : this.data.list.length - 1), this.selectedHint != t) {
- var i = this.hints.childNodes[this.selectedHint];
- i && (i.className = i.className.replace(" " + v, ""), i.removeAttribute("aria-selected")), i = this.hints.childNodes[this.selectedHint = t], i.className += " " + v, i.setAttribute("aria-selected", "true"), this.completion.cm.getInputField().setAttribute("aria-activedescendant", i.id), this.scrollToActive(), r.signal(this.data, "select", this.data.list[this.selectedHint], i);
- }
- },
- scrollToActive: function () {
- var t = this.getSelectedHintRange(),
- e = this.hints.childNodes[t.from],
- i = this.hints.childNodes[t.to],
- n = this.hints.firstChild;
- e.offsetTop < this.hints.scrollTop ? this.hints.scrollTop = e.offsetTop - n.offsetTop : i.offsetTop + i.offsetHeight > this.hints.scrollTop + this.hints.clientHeight && (this.hints.scrollTop = i.offsetTop + i.offsetHeight - this.hints.clientHeight + n.offsetTop);
- },
- screenAmount: function () {
- return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
- },
- getSelectedHintRange: function () {
- var t = this.completion.options.scrollMargin || 0;
- return {
- from: Math.max(0, this.selectedHint - t),
- to: Math.min(this.data.list.length - 1, this.selectedHint + t)
- };
- }
- };
- function it(t, e) {
- if (!t.somethingSelected()) return e;
- for (var i = [], n = 0; n < e.length; n++) e[n].supportsSelection && i.push(e[n]);
- return i;
+ if (ch === marker) {
+ cnt++;
}
- p(it, "applicableHelpers");
- function U(t, e, i, n) {
- if (t.async) t(e, n, i);else {
- var s = t(e, i);
- s && s.then ? s.then(n) : n(s);
- }
+ }
+ if (cnt < 3) {
+ return false;
+ }
+ if (silent) {
+ return true;
+ }
+ state.line = startLine + 1;
+ const token = state.push('hr', 'hr', 0);
+ token.map = [startLine, state.line];
+ token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
+ return true;
+}
+
+// Lists
+
+// Search `[-+*][\n ]`, returns next pos after marker on success
+// or -1 on fail.
+function skipBulletListMarker(state, startLine) {
+ const max = state.eMarks[startLine];
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
+ const marker = state.src.charCodeAt(pos++);
+ // Check bullet
+ if (marker !== 0x2A /* * */ && marker !== 0x2D /* - */ && marker !== 0x2B /* + */) {
+ return -1;
+ }
+ if (pos < max) {
+ const ch = state.src.charCodeAt(pos);
+ if (!isSpace(ch)) {
+ // " -test " - is not a list item
+ return -1;
}
- p(U, "fetchHints");
- function nt(t, e) {
- var i = t.getHelpers(e, "hint"),
- n;
- if (i.length) {
- var s = p(function (c, o, f) {
- var h = it(c, i);
- function u(l) {
- if (l == h.length) return o(null);
- U(h[l], c, f, function (a) {
- a && a.list.length > 0 ? o(a) : u(l + 1);
- });
- }
- p(u, "run"), u(0);
- }, "resolved");
- return s.async = !0, s.supportsSelection = !0, s;
- } else return (n = t.getHelper(t.getCursor(), "hintWords")) ? function (c) {
- return r.hint.fromList(c, {
- words: n
- });
- } : r.hint.anyword ? function (c, o) {
- return r.hint.anyword(c, o);
- } : function () {};
+ }
+ return pos;
+}
+
+// Search `\d+[.)][\n ]`, returns next pos after marker on success
+// or -1 on fail.
+function skipOrderedListMarker(state, startLine) {
+ const start = state.bMarks[startLine] + state.tShift[startLine];
+ const max = state.eMarks[startLine];
+ let pos = start;
+
+ // List marker should have at least 2 chars (digit + dot)
+ if (pos + 1 >= max) {
+ return -1;
+ }
+ let ch = state.src.charCodeAt(pos++);
+ if (ch < 0x30 /* 0 */ || ch > 0x39 /* 9 */) {
+ return -1;
+ }
+ for (;;) {
+ // EOL -> fail
+ if (pos >= max) {
+ return -1;
}
- p(nt, "resolveAutoHints"), r.registerHelper("hint", "auto", {
- resolve: nt
- }), r.registerHelper("hint", "fromList", function (t, e) {
- var i = t.getCursor(),
- n = t.getTokenAt(i),
- s,
- c = r.Pos(i.line, n.start),
- o = i;
- n.start < i.ch && /\w/.test(n.string.charAt(i.ch - n.start - 1)) ? s = n.string.substr(0, i.ch - n.start) : (s = "", c = i);
- for (var f = [], h = 0; h < e.words.length; h++) {
- var u = e.words[h];
- u.slice(0, s.length) == s && f.push(u);
+ ch = state.src.charCodeAt(pos++);
+ if (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) {
+ // List marker should have no more than 9 digits
+ // (prevents integer overflow in browsers)
+ if (pos - start >= 10) {
+ return -1;
}
- if (f.length) return {
- list: f,
- from: c,
- to: o
- };
- }), r.commands.autocomplete = r.showHint;
- var D = {
- hint: r.hint.auto,
- completeSingle: !0,
- alignWithWord: !0,
- closeCharacters: /[\s()\[\]{};:>,]/,
- closeOnPick: !0,
- closeOnUnfocus: !0,
- updateOnCursorActivity: !0,
- completeOnSingleClick: !0,
- container: null,
- customKeys: null,
- extraKeys: null,
- paddingForScrollbar: !0,
- moveOnOverlap: !0
- };
- r.defineOption("hintOptions", null);
- });
-})();
-var J = ht.exports;
-const at = G.getDefaultExportFromCjs(J),
- ft = lt({
- __proto__: null,
- default: at
- }, [J]);
-exports.showHint = ft;
+ continue;
+ }
+
+ // found valid marker
+ if (ch === 0x29 /* ) */ || ch === 0x2e /* . */) {
+ break;
+ }
+ return -1;
+ }
+ if (pos < max) {
+ ch = state.src.charCodeAt(pos);
+ if (!isSpace(ch)) {
+ // " 1.test " - is not a list item
+ return -1;
+ }
+ }
+ return pos;
+}
+function markTightParagraphs(state, idx) {
+ const level = state.level + 2;
+ for (let i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
+ if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {
+ state.tokens[i + 2].hidden = true;
+ state.tokens[i].hidden = true;
+ i += 2;
+ }
+ }
+}
+function list(state, startLine, endLine, silent) {
+ let max, pos, start, token;
+ let nextLine = startLine;
+ let tight = true;
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
+ return false;
+ }
+
+ // Special case:
+ // - item 1
+ // - item 2
+ // - item 3
+ // - item 4
+ // - this one is a paragraph continuation
+ if (state.listIndent >= 0 && state.sCount[nextLine] - state.listIndent >= 4 && state.sCount[nextLine] < state.blkIndent) {
+ return false;
+ }
+ let isTerminatingParagraph = false;
+
+ // limit conditions when list can interrupt
+ // a paragraph (validation mode only)
+ if (silent && state.parentType === 'paragraph') {
+ // Next list item should still terminate previous list item;
+ //
+ // This code can fail if plugins use blkIndent as well as lists,
+ // but I hope the spec gets fixed long before that happens.
+ //
+ if (state.sCount[nextLine] >= state.blkIndent) {
+ isTerminatingParagraph = true;
+ }
+ }
+
+ // Detect list type and position after marker
+ let isOrdered;
+ let markerValue;
+ let posAfterMarker;
+ if ((posAfterMarker = skipOrderedListMarker(state, nextLine)) >= 0) {
+ isOrdered = true;
+ start = state.bMarks[nextLine] + state.tShift[nextLine];
+ markerValue = Number(state.src.slice(start, posAfterMarker - 1));
+
+ // If we're starting a new ordered list right after
+ // a paragraph, it should start with 1.
+ if (isTerminatingParagraph && markerValue !== 1) return false;
+ } else if ((posAfterMarker = skipBulletListMarker(state, nextLine)) >= 0) {
+ isOrdered = false;
+ } else {
+ return false;
+ }
+
+ // If we're starting a new unordered list right after
+ // a paragraph, first line should not be empty.
+ if (isTerminatingParagraph) {
+ if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine]) return false;
+ }
+
+ // For validation mode we can terminate immediately
+ if (silent) {
+ return true;
+ }
+
+ // We should terminate list on style change. Remember first one to compare.
+ const markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
+
+ // Start list
+ const listTokIdx = state.tokens.length;
+ if (isOrdered) {
+ token = state.push('ordered_list_open', 'ol', 1);
+ if (markerValue !== 1) {
+ token.attrs = [['start', markerValue]];
+ }
+ } else {
+ token = state.push('bullet_list_open', 'ul', 1);
+ }
+ const listLines = [nextLine, 0];
+ token.map = listLines;
+ token.markup = String.fromCharCode(markerCharCode);
+
+ //
+ // Iterate list items
+ //
+
+ let prevEmptyEnd = false;
+ const terminatorRules = state.md.block.ruler.getRules('list');
+ const oldParentType = state.parentType;
+ state.parentType = 'list';
+ while (nextLine < endLine) {
+ pos = posAfterMarker;
+ max = state.eMarks[nextLine];
+ const initial = state.sCount[nextLine] + posAfterMarker - (state.bMarks[nextLine] + state.tShift[nextLine]);
+ let offset = initial;
+ while (pos < max) {
+ const ch = state.src.charCodeAt(pos);
+ if (ch === 0x09) {
+ offset += 4 - (offset + state.bsCount[nextLine]) % 4;
+ } else if (ch === 0x20) {
+ offset++;
+ } else {
+ break;
+ }
+ pos++;
+ }
+ const contentStart = pos;
+ let indentAfterMarker;
+ if (contentStart >= max) {
+ // trimming space in "- \n 3" case, indent is 1 here
+ indentAfterMarker = 1;
+ } else {
+ indentAfterMarker = offset - initial;
+ }
-/***/ }),
+ // If we have more than 4 spaces, the indent is 1
+ // (the rest is just indented code block)
+ if (indentAfterMarker > 4) {
+ indentAfterMarker = 1;
+ }
-/***/ "../../graphiql-react/dist/sublime.cjs.js":
-/*!************************************************!*\
- !*** ../../graphiql-react/dist/sublime.cjs.js ***!
- \************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+ // " - test"
+ // ^^^^^ - calculating total length of this thing
+ const indent = initial + indentAfterMarker;
+ // Run subparser & write tokens
+ token = state.push('list_item_open', 'li', 1);
+ token.markup = String.fromCharCode(markerCharCode);
+ const itemLines = [nextLine, 0];
+ token.map = itemLines;
+ if (isOrdered) {
+ token.info = state.src.slice(start, posAfterMarker - 1);
+ }
+ // change current state, then restore it after parser subcall
+ const oldTight = state.tight;
+ const oldTShift = state.tShift[nextLine];
+ const oldSCount = state.sCount[nextLine];
-var _ = Object.defineProperty;
-var v = (m, B) => _(m, "name", {
- value: B,
- configurable: !0
-});
-const E = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"),
- Y = __webpack_require__(/*! ./searchcursor.cjs2.js */ "../../graphiql-react/dist/searchcursor.cjs2.js"),
- z = __webpack_require__(/*! ./matchbrackets.cjs2.js */ "../../graphiql-react/dist/matchbrackets.cjs2.js");
-function J(m, B) {
- for (var h = 0; h < B.length; h++) {
- const a = B[h];
- if (typeof a != "string" && !Array.isArray(a)) {
- for (const f in a) if (f !== "default" && !(f in m)) {
- const A = Object.getOwnPropertyDescriptor(a, f);
- A && Object.defineProperty(m, f, A.get ? A : {
- enumerable: !0,
- get: () => a[f]
- });
- }
+ // - example list
+ // ^ listIndent position will be here
+ // ^ blkIndent position will be here
+ //
+ const oldListIndent = state.listIndent;
+ state.listIndent = state.blkIndent;
+ state.blkIndent = indent;
+ state.tight = true;
+ state.tShift[nextLine] = contentStart - state.bMarks[nextLine];
+ state.sCount[nextLine] = offset;
+ if (contentStart >= max && state.isEmpty(nextLine + 1)) {
+ // workaround for this case
+ // (list item is empty, list terminates before "foo"):
+ // ~~~~~~~~
+ // -
+ //
+ // foo
+ // ~~~~~~~~
+ state.line = Math.min(state.line + 2, endLine);
+ } else {
+ state.md.block.tokenize(state, nextLine, endLine, true);
}
- }
- return Object.freeze(Object.defineProperty(m, Symbol.toStringTag, {
- value: "Module"
- }));
-}
-v(J, "_mergeNamespaces");
-var G = {
- exports: {}
-};
-(function (m, B) {
- (function (h) {
- h(E.requireCodemirror(), Y.requireSearchcursor(), z.requireMatchbrackets());
- })(function (h) {
- var a = h.commands,
- f = h.Pos;
- function A(e, t, n) {
- if (n < 0 && t.ch == 0) return e.clipPos(f(t.line - 1));
- var r = e.getLine(t.line);
- if (n > 0 && t.ch >= r.length) return e.clipPos(f(t.line + 1, 0));
- for (var l = "start", i, o = t.ch, s = o, u = n < 0 ? 0 : r.length, d = 0; s != u; s += n, d++) {
- var p = r.charAt(n < 0 ? s - 1 : s),
- c = p != "_" && h.isWordChar(p) ? "w" : "o";
- if (c == "w" && p.toUpperCase() == p && (c = "W"), l == "start") c != "o" ? (l = "in", i = c) : o = s + n;else if (l == "in" && i != c) {
- if (i == "w" && c == "W" && n < 0 && s--, i == "W" && c == "w" && n > 0) if (s == o + 1) {
- i = "w";
- continue;
- } else s--;
- break;
- }
- }
- return f(t.line, s);
+
+ // If any of list item is tight, mark list as tight
+ if (!state.tight || prevEmptyEnd) {
+ tight = false;
}
- v(A, "findPosSubword");
- function T(e, t) {
- e.extendSelectionsBy(function (n) {
- return e.display.shift || e.doc.extend || n.empty() ? A(e.doc, n.head, t) : t < 0 ? n.from() : n.to();
- });
+ // Item become loose if finish with empty line,
+ // but we should filter last element, because it means list finish
+ prevEmptyEnd = state.line - nextLine > 1 && state.isEmpty(state.line - 1);
+ state.blkIndent = state.listIndent;
+ state.listIndent = oldListIndent;
+ state.tShift[nextLine] = oldTShift;
+ state.sCount[nextLine] = oldSCount;
+ state.tight = oldTight;
+ token = state.push('list_item_close', 'li', -1);
+ token.markup = String.fromCharCode(markerCharCode);
+ nextLine = state.line;
+ itemLines[1] = nextLine;
+ if (nextLine >= endLine) {
+ break;
}
- v(T, "moveSubword"), a.goSubwordLeft = function (e) {
- T(e, -1);
- }, a.goSubwordRight = function (e) {
- T(e, 1);
- }, a.scrollLineUp = function (e) {
- var t = e.getScrollInfo();
- if (!e.somethingSelected()) {
- var n = e.lineAtHeight(t.top + t.clientHeight, "local");
- e.getCursor().line >= n && e.execCommand("goLineUp");
- }
- e.scrollTo(null, t.top - e.defaultTextHeight());
- }, a.scrollLineDown = function (e) {
- var t = e.getScrollInfo();
- if (!e.somethingSelected()) {
- var n = e.lineAtHeight(t.top, "local") + 1;
- e.getCursor().line <= n && e.execCommand("goLineDown");
- }
- e.scrollTo(null, t.top + e.defaultTextHeight());
- }, a.splitSelectionByLine = function (e) {
- for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) for (var l = t[r].from(), i = t[r].to(), o = l.line; o <= i.line; ++o) i.line > l.line && o == i.line && i.ch == 0 || n.push({
- anchor: o == l.line ? l : f(o, 0),
- head: o == i.line ? i : f(o)
- });
- e.setSelections(n, 0);
- }, a.singleSelectionTop = function (e) {
- var t = e.listSelections()[0];
- e.setSelection(t.anchor, t.head, {
- scroll: !1
- });
- }, a.selectLine = function (e) {
- for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) {
- var l = t[r];
- n.push({
- anchor: f(l.from().line, 0),
- head: f(l.to().line + 1, 0)
- });
+
+ //
+ // Try to check if list is terminated or continued.
+ //
+ if (state.sCount[nextLine] < state.blkIndent) {
+ break;
+ }
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
+ break;
+ }
+
+ // fail if terminating block found
+ let terminate = false;
+ for (let i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
}
- e.setSelections(n);
- };
- function x(e, t) {
- if (e.isReadOnly()) return h.Pass;
- e.operation(function () {
- for (var n = e.listSelections().length, r = [], l = -1, i = 0; i < n; i++) {
- var o = e.listSelections()[i].head;
- if (!(o.line <= l)) {
- var s = f(o.line + (t ? 0 : 1), 0);
- e.replaceRange(`
-`, s, null, "+insertLine"), e.indentLine(s.line, null, !0), r.push({
- head: s,
- anchor: s
- }), l = o.line + 1;
- }
- }
- e.setSelections(r);
- }), e.execCommand("indentAuto");
}
- v(x, "insertLine"), a.insertLineAfter = function (e) {
- return x(e, !1);
- }, a.insertLineBefore = function (e) {
- return x(e, !0);
- };
- function K(e, t) {
- for (var n = t.ch, r = n, l = e.getLine(t.line); n && h.isWordChar(l.charAt(n - 1));) --n;
- for (; r < l.length && h.isWordChar(l.charAt(r));) ++r;
- return {
- from: f(t.line, n),
- to: f(t.line, r),
- word: l.slice(n, r)
- };
+ if (terminate) {
+ break;
}
- v(K, "wordAt"), a.selectNextOccurrence = function (e) {
- var t = e.getCursor("from"),
- n = e.getCursor("to"),
- r = e.state.sublimeFindFullWord == e.doc.sel;
- if (h.cmpPos(t, n) == 0) {
- var l = K(e, t);
- if (!l.word) return;
- e.setSelection(l.from, l.to), r = !0;
- } else {
- var i = e.getRange(t, n),
- o = r ? new RegExp("\\b" + i + "\\b") : i,
- s = e.getSearchCursor(o, n),
- u = s.findNext();
- if (u || (s = e.getSearchCursor(o, f(e.firstLine(), 0)), u = s.findNext()), !u || H(e.listSelections(), s.from(), s.to())) return;
- e.addSelection(s.from(), s.to());
+
+ // fail if list has another type
+ if (isOrdered) {
+ posAfterMarker = skipOrderedListMarker(state, nextLine);
+ if (posAfterMarker < 0) {
+ break;
}
- r && (e.state.sublimeFindFullWord = e.doc.sel);
- }, a.skipAndSelectNextOccurrence = function (e) {
- var t = e.getCursor("anchor"),
- n = e.getCursor("head");
- a.selectNextOccurrence(e), h.cmpPos(t, n) != 0 && e.doc.setSelections(e.doc.listSelections().filter(function (r) {
- return r.anchor != t || r.head != n;
- }));
- };
- function y(e, t) {
- for (var n = e.listSelections(), r = [], l = 0; l < n.length; l++) {
- var i = n[l],
- o = e.findPosV(i.anchor, t, "line", i.anchor.goalColumn),
- s = e.findPosV(i.head, t, "line", i.head.goalColumn);
- o.goalColumn = i.anchor.goalColumn != null ? i.anchor.goalColumn : e.cursorCoords(i.anchor, "div").left, s.goalColumn = i.head.goalColumn != null ? i.head.goalColumn : e.cursorCoords(i.head, "div").left;
- var u = {
- anchor: o,
- head: s
- };
- r.push(i), r.push(u);
+ start = state.bMarks[nextLine] + state.tShift[nextLine];
+ } else {
+ posAfterMarker = skipBulletListMarker(state, nextLine);
+ if (posAfterMarker < 0) {
+ break;
}
- e.setSelections(r);
}
- v(y, "addCursorToSelection"), a.addCursorToPrevLine = function (e) {
- y(e, -1);
- }, a.addCursorToNextLine = function (e) {
- y(e, 1);
- };
- function H(e, t, n) {
- for (var r = 0; r < e.length; r++) if (h.cmpPos(e[r].from(), t) == 0 && h.cmpPos(e[r].to(), n) == 0) return !0;
- return !1;
+ if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) {
+ break;
}
- v(H, "isSelectedRange");
- var P = "(){}[]";
- function U(e) {
- for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) {
- var l = t[r],
- i = l.head,
- o = e.scanForBracket(i, -1);
- if (!o) return !1;
- for (;;) {
- var s = e.scanForBracket(i, 1);
- if (!s) return !1;
- if (s.ch == P.charAt(P.indexOf(o.ch) + 1)) {
- var u = f(o.pos.line, o.pos.ch + 1);
- if (h.cmpPos(u, l.from()) == 0 && h.cmpPos(s.pos, l.to()) == 0) {
- if (o = e.scanForBracket(o.pos, -1), !o) return !1;
- } else {
- n.push({
- anchor: u,
- head: s.pos
- });
- break;
- }
- }
- i = f(s.pos.line, s.pos.ch + 1);
- }
- }
- return e.setSelections(n), !0;
+ }
+
+ // Finalize list
+ if (isOrdered) {
+ token = state.push('ordered_list_close', 'ol', -1);
+ } else {
+ token = state.push('bullet_list_close', 'ul', -1);
+ }
+ token.markup = String.fromCharCode(markerCharCode);
+ listLines[1] = nextLine;
+ state.line = nextLine;
+ state.parentType = oldParentType;
+
+ // mark paragraphs tight if needed
+ if (tight) {
+ markTightParagraphs(state, listTokIdx);
+ }
+ return true;
+}
+function reference(state, startLine, _endLine, silent) {
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
+ let max = state.eMarks[startLine];
+ let nextLine = startLine + 1;
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) {
+ return false;
+ }
+ if (state.src.charCodeAt(pos) !== 0x5B /* [ */) {
+ return false;
+ }
+ function getNextLine(nextLine) {
+ const endLine = state.lineMax;
+ if (nextLine >= endLine || state.isEmpty(nextLine)) {
+ // empty line or end of input
+ return null;
}
- v(U, "selectBetweenBrackets"), a.selectScope = function (e) {
- U(e) || e.execCommand("selectAll");
- }, a.selectBetweenBrackets = function (e) {
- if (!U(e)) return h.Pass;
- };
- function I(e) {
- return e ? /\bpunctuation\b/.test(e) ? e : void 0 : null;
+ let isContinuation = false;
+
+ // this would be a code block normally, but after paragraph
+ // it's considered a lazy continuation regardless of what's there
+ if (state.sCount[nextLine] - state.blkIndent > 3) {
+ isContinuation = true;
}
- v(I, "puncType"), a.goToBracket = function (e) {
- e.extendSelectionsBy(function (t) {
- var n = e.scanForBracket(t.head, 1, I(e.getTokenTypeAt(t.head)));
- if (n && h.cmpPos(n.pos, t.head) != 0) return n.pos;
- var r = e.scanForBracket(t.head, -1, I(e.getTokenTypeAt(f(t.head.line, t.head.ch + 1))));
- return r && f(r.pos.line, r.pos.ch + 1) || t.head;
- });
- }, a.swapLineUp = function (e) {
- if (e.isReadOnly()) return h.Pass;
- for (var t = e.listSelections(), n = [], r = e.firstLine() - 1, l = [], i = 0; i < t.length; i++) {
- var o = t[i],
- s = o.from().line - 1,
- u = o.to().line;
- l.push({
- anchor: f(o.anchor.line - 1, o.anchor.ch),
- head: f(o.head.line - 1, o.head.ch)
- }), o.to().ch == 0 && !o.empty() && --u, s > r ? n.push(s, u) : n.length && (n[n.length - 1] = u), r = u;
- }
- e.operation(function () {
- for (var d = 0; d < n.length; d += 2) {
- var p = n[d],
- c = n[d + 1],
- b = e.getLine(p);
- e.replaceRange("", f(p, 0), f(p + 1, 0), "+swapLine"), c > e.lastLine() ? e.replaceRange(`
-` + b, f(e.lastLine()), null, "+swapLine") : e.replaceRange(b + `
-`, f(c, 0), null, "+swapLine");
+
+ // quirk for blockquotes, this line should already be checked by that rule
+ if (state.sCount[nextLine] < 0) {
+ isContinuation = true;
+ }
+ if (!isContinuation) {
+ const terminatorRules = state.md.block.ruler.getRules('reference');
+ const oldParentType = state.parentType;
+ state.parentType = 'reference';
+
+ // Some tags can terminate paragraph without empty line.
+ let terminate = false;
+ for (let i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
}
- e.setSelections(l), e.scrollIntoView();
- });
- }, a.swapLineDown = function (e) {
- if (e.isReadOnly()) return h.Pass;
- for (var t = e.listSelections(), n = [], r = e.lastLine() + 1, l = t.length - 1; l >= 0; l--) {
- var i = t[l],
- o = i.to().line + 1,
- s = i.from().line;
- i.to().ch == 0 && !i.empty() && o--, o < r ? n.push(o, s) : n.length && (n[n.length - 1] = s), r = s;
}
- e.operation(function () {
- for (var u = n.length - 2; u >= 0; u -= 2) {
- var d = n[u],
- p = n[u + 1],
- c = e.getLine(d);
- d == e.lastLine() ? e.replaceRange("", f(d - 1), f(d), "+swapLine") : e.replaceRange("", f(d, 0), f(d + 1, 0), "+swapLine"), e.replaceRange(c + `
-`, f(p, 0), null, "+swapLine");
- }
- e.scrollIntoView();
- });
- }, a.toggleCommentIndented = function (e) {
- e.toggleComment({
- indent: !0
- });
- }, a.joinLines = function (e) {
- for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) {
- for (var l = t[r], i = l.from(), o = i.line, s = l.to().line; r < t.length - 1 && t[r + 1].from().line == s;) s = t[++r].to().line;
- n.push({
- start: o,
- end: s,
- anchor: !l.empty() && i
- });
+ state.parentType = oldParentType;
+ if (terminate) {
+ // terminated by another block
+ return null;
}
- e.operation(function () {
- for (var u = 0, d = [], p = 0; p < n.length; p++) {
- for (var c = n[p], b = c.anchor && f(c.anchor.line - u, c.anchor.ch), w, g = c.start; g <= c.end; g++) {
- var S = g - u;
- g == c.end && (w = f(S, e.getLine(S).length + 1)), S < e.lastLine() && (e.replaceRange(" ", f(S), f(S + 1, /^\s*/.exec(e.getLine(S + 1))[0].length)), ++u);
- }
- d.push({
- anchor: b || w,
- head: w
- });
- }
- e.setSelections(d, 0);
- });
- }, a.duplicateLine = function (e) {
- e.operation(function () {
- for (var t = e.listSelections().length, n = 0; n < t; n++) {
- var r = e.listSelections()[n];
- r.empty() ? e.replaceRange(e.getLine(r.head.line) + `
-`, f(r.head.line, 0)) : e.replaceRange(e.getRange(r.from(), r.to()), r.from());
- }
- e.scrollIntoView();
- });
- };
- function R(e, t, n) {
- if (e.isReadOnly()) return h.Pass;
- for (var r = e.listSelections(), l = [], i, o = 0; o < r.length; o++) {
- var s = r[o];
- if (!s.empty()) {
- for (var u = s.from().line, d = s.to().line; o < r.length - 1 && r[o + 1].from().line == d;) d = r[++o].to().line;
- r[o].to().ch || d--, l.push(u, d);
- }
+ }
+ const pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ const max = state.eMarks[nextLine];
+
+ // max + 1 explicitly includes the newline
+ return state.src.slice(pos, max + 1);
+ }
+ let str = state.src.slice(pos, max + 1);
+ max = str.length;
+ let labelEnd = -1;
+ for (pos = 1; pos < max; pos++) {
+ const ch = str.charCodeAt(pos);
+ if (ch === 0x5B /* [ */) {
+ return false;
+ } else if (ch === 0x5D /* ] */) {
+ labelEnd = pos;
+ break;
+ } else if (ch === 0x0A /* \n */) {
+ const lineContent = getNextLine(nextLine);
+ if (lineContent !== null) {
+ str += lineContent;
+ max = str.length;
+ nextLine++;
}
- l.length ? i = !0 : l.push(e.firstLine(), e.lastLine()), e.operation(function () {
- for (var p = [], c = 0; c < l.length; c += 2) {
- var b = l[c],
- w = l[c + 1],
- g = f(b, 0),
- S = f(w),
- F = e.getRange(g, S, !1);
- t ? F.sort(function (k, L) {
- return k < L ? -n : k == L ? 0 : n;
- }) : F.sort(function (k, L) {
- var W = k.toUpperCase(),
- M = L.toUpperCase();
- return W != M && (k = W, L = M), k < L ? -n : k == L ? 0 : n;
- }), e.replaceRange(F, g, S), i && p.push({
- anchor: g,
- head: f(w + 1, 0)
- });
+ } else if (ch === 0x5C /* \ */) {
+ pos++;
+ if (pos < max && str.charCodeAt(pos) === 0x0A) {
+ const lineContent = getNextLine(nextLine);
+ if (lineContent !== null) {
+ str += lineContent;
+ max = str.length;
+ nextLine++;
}
- i && e.setSelections(p, 0);
- });
+ }
}
- v(R, "sortLines"), a.sortLines = function (e) {
- R(e, !0, 1);
- }, a.reverseSortLines = function (e) {
- R(e, !0, -1);
- }, a.sortLinesInsensitive = function (e) {
- R(e, !1, 1);
- }, a.reverseSortLinesInsensitive = function (e) {
- R(e, !1, -1);
- }, a.nextBookmark = function (e) {
- var t = e.state.sublimeBookmarks;
- if (t) for (; t.length;) {
- var n = t.shift(),
- r = n.find();
- if (r) return t.push(n), e.setSelection(r.from, r.to);
+ }
+ if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A /* : */) {
+ return false;
+ }
+
+ // [label]: destination 'title'
+ // ^^^ skip optional whitespace here
+ for (pos = labelEnd + 2; pos < max; pos++) {
+ const ch = str.charCodeAt(pos);
+ if (ch === 0x0A) {
+ const lineContent = getNextLine(nextLine);
+ if (lineContent !== null) {
+ str += lineContent;
+ max = str.length;
+ nextLine++;
}
- }, a.prevBookmark = function (e) {
- var t = e.state.sublimeBookmarks;
- if (t) for (; t.length;) {
- t.unshift(t.pop());
- var n = t[t.length - 1].find();
- if (!n) t.pop();else return e.setSelection(n.from, n.to);
+ } else if (isSpace(ch)) ;else {
+ break;
+ }
+ }
+
+ // [label]: destination 'title'
+ // ^^^^^^^^^^^ parse this
+ const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
+ if (!destRes.ok) {
+ return false;
+ }
+ const href = state.md.normalizeLink(destRes.str);
+ if (!state.md.validateLink(href)) {
+ return false;
+ }
+ pos = destRes.pos;
+
+ // save cursor state, we could require to rollback later
+ const destEndPos = pos;
+ const destEndLineNo = nextLine;
+
+ // [label]: destination 'title'
+ // ^^^ skipping those spaces
+ const start = pos;
+ for (; pos < max; pos++) {
+ const ch = str.charCodeAt(pos);
+ if (ch === 0x0A) {
+ const lineContent = getNextLine(nextLine);
+ if (lineContent !== null) {
+ str += lineContent;
+ max = str.length;
+ nextLine++;
}
- }, a.toggleBookmark = function (e) {
- for (var t = e.listSelections(), n = e.state.sublimeBookmarks || (e.state.sublimeBookmarks = []), r = 0; r < t.length; r++) {
- for (var l = t[r].from(), i = t[r].to(), o = t[r].empty() ? e.findMarksAt(l) : e.findMarks(l, i), s = 0; s < o.length; s++) if (o[s].sublimeBookmark) {
- o[s].clear();
- for (var u = 0; u < n.length; u++) n[u] == o[s] && n.splice(u--, 1);
+ } else if (isSpace(ch)) ;else {
+ break;
+ }
+ }
+
+ // [label]: destination 'title'
+ // ^^^^^^^ parse this
+ let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
+ while (titleRes.can_continue) {
+ const lineContent = getNextLine(nextLine);
+ if (lineContent === null) break;
+ str += lineContent;
+ pos = max;
+ max = str.length;
+ nextLine++;
+ titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
+ }
+ let title;
+ if (pos < max && start !== pos && titleRes.ok) {
+ title = titleRes.str;
+ pos = titleRes.pos;
+ } else {
+ title = '';
+ pos = destEndPos;
+ nextLine = destEndLineNo;
+ }
+
+ // skip trailing spaces until the rest of the line
+ while (pos < max) {
+ const ch = str.charCodeAt(pos);
+ if (!isSpace(ch)) {
+ break;
+ }
+ pos++;
+ }
+ if (pos < max && str.charCodeAt(pos) !== 0x0A) {
+ if (title) {
+ // garbage at the end of the line after title,
+ // but it could still be a valid reference if we roll back
+ title = '';
+ pos = destEndPos;
+ nextLine = destEndLineNo;
+ while (pos < max) {
+ const ch = str.charCodeAt(pos);
+ if (!isSpace(ch)) {
break;
}
- s == o.length && n.push(e.markText(l, i, {
- sublimeBookmark: !0,
- clearWhenEmpty: !1
- }));
- }
- }, a.clearBookmarks = function (e) {
- var t = e.state.sublimeBookmarks;
- if (t) for (var n = 0; n < t.length; n++) t[n].clear();
- t.length = 0;
- }, a.selectBookmarks = function (e) {
- var t = e.state.sublimeBookmarks,
- n = [];
- if (t) for (var r = 0; r < t.length; r++) {
- var l = t[r].find();
- l ? n.push({
- anchor: l.from,
- head: l.to
- }) : t.splice(r--, 0);
+ pos++;
}
- n.length && e.setSelections(n, 0);
+ }
+ }
+ if (pos < max && str.charCodeAt(pos) !== 0x0A) {
+ // garbage at the end of the line
+ return false;
+ }
+ const label = normalizeReference(str.slice(1, labelEnd));
+ if (!label) {
+ // CommonMark 0.20 disallows empty labels
+ return false;
+ }
+
+ // Reference can not terminate anything. This check is for safety only.
+ /* istanbul ignore if */
+ if (silent) {
+ return true;
+ }
+ if (typeof state.env.references === 'undefined') {
+ state.env.references = {};
+ }
+ if (typeof state.env.references[label] === 'undefined') {
+ state.env.references[label] = {
+ title,
+ href
};
- function D(e, t) {
- e.operation(function () {
- for (var n = e.listSelections(), r = [], l = [], i = 0; i < n.length; i++) {
- var o = n[i];
- o.empty() ? (r.push(i), l.push("")) : l.push(t(e.getRange(o.from(), o.to())));
- }
- e.replaceSelections(l, "around", "case");
- for (var i = r.length - 1, s; i >= 0; i--) {
- var o = n[r[i]];
- if (!(s && h.cmpPos(o.head, s) > 0)) {
- var u = K(e, o.head);
- s = u.from, e.replaceRange(t(u.word), u.from, u.to);
- }
+ }
+ state.line = nextLine;
+ return true;
+}
+
+// List of valid html blocks names, according to commonmark spec
+// https://spec.commonmark.org/0.30/#html-blocks
+
+var block_names = ['address', 'article', 'aside', 'base', 'basefont', 'blockquote', 'body', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dialog', 'dir', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'iframe', 'legend', 'li', 'link', 'main', 'menu', 'menuitem', 'nav', 'noframes', 'ol', 'optgroup', 'option', 'p', 'param', 'search', 'section', 'summary', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul'];
+
+// Regexps to match html elements
+
+const attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
+const unquoted = '[^"\'=<>`\\x00-\\x20]+';
+const single_quoted = "'[^']*'";
+const double_quoted = '"[^"]*"';
+const attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
+const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
+const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
+const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
+const comment = '';
+const processing = '<[?][\\s\\S]*?[?]>';
+const declaration = ']*>';
+const cdata = '';
+const HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment + '|' + processing + '|' + declaration + '|' + cdata + ')');
+const HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');
+
+// HTML block
+
+// An array of opening and corresponding closing sequences for html tags,
+// last argument defines whether it can terminate a paragraph or not
+//
+const HTML_SEQUENCES = [[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, true], [/^/, true], [/^<\?/, /\?>/, true], [/^/, true], [/^/, true], [new RegExp('^?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true], [new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false]];
+function html_block(state, startLine, endLine, silent) {
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
+ let max = state.eMarks[startLine];
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) {
+ return false;
+ }
+ if (!state.md.options.html) {
+ return false;
+ }
+ if (state.src.charCodeAt(pos) !== 0x3C /* < */) {
+ return false;
+ }
+ let lineText = state.src.slice(pos, max);
+ let i = 0;
+ for (; i < HTML_SEQUENCES.length; i++) {
+ if (HTML_SEQUENCES[i][0].test(lineText)) {
+ break;
+ }
+ }
+ if (i === HTML_SEQUENCES.length) {
+ return false;
+ }
+ if (silent) {
+ // true if this sequence can be a terminator, false otherwise
+ return HTML_SEQUENCES[i][2];
+ }
+ let nextLine = startLine + 1;
+
+ // If we are here - we detected HTML block.
+ // Let's roll down till block end.
+ if (!HTML_SEQUENCES[i][1].test(lineText)) {
+ for (; nextLine < endLine; nextLine++) {
+ if (state.sCount[nextLine] < state.blkIndent) {
+ break;
+ }
+ pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ max = state.eMarks[nextLine];
+ lineText = state.src.slice(pos, max);
+ if (HTML_SEQUENCES[i][1].test(lineText)) {
+ if (lineText.length !== 0) {
+ nextLine++;
}
- });
+ break;
+ }
}
- v(D, "modifyWordOrSelection"), a.smartBackspace = function (e) {
- if (e.somethingSelected()) return h.Pass;
- e.operation(function () {
- for (var t = e.listSelections(), n = e.getOption("indentUnit"), r = t.length - 1; r >= 0; r--) {
- var l = t[r].head,
- i = e.getRange({
- line: l.line,
- ch: 0
- }, l),
- o = h.countColumn(i, null, e.getOption("tabSize")),
- s = e.findPosH(l, -1, "char", !1);
- if (i && !/\S/.test(i) && o % n == 0) {
- var u = new f(l.line, h.findColumn(i, o - n, n));
- u.ch != l.ch && (s = u);
+ }
+ state.line = nextLine;
+ const token = state.push('html_block', '', 0);
+ token.map = [startLine, nextLine];
+ token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
+ return true;
+}
+
+// heading (#, ##, ...)
+
+function heading(state, startLine, endLine, silent) {
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
+ let max = state.eMarks[startLine];
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) {
+ return false;
+ }
+ let ch = state.src.charCodeAt(pos);
+ if (ch !== 0x23 /* # */ || pos >= max) {
+ return false;
+ }
+
+ // count heading level
+ let level = 1;
+ ch = state.src.charCodeAt(++pos);
+ while (ch === 0x23 /* # */ && pos < max && level <= 6) {
+ level++;
+ ch = state.src.charCodeAt(++pos);
+ }
+ if (level > 6 || pos < max && !isSpace(ch)) {
+ return false;
+ }
+ if (silent) {
+ return true;
+ }
+
+ // Let's cut tails like ' ### ' from the end of string
+
+ max = state.skipSpacesBack(max, pos);
+ const tmp = state.skipCharsBack(max, 0x23, pos); // #
+ if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {
+ max = tmp;
+ }
+ state.line = startLine + 1;
+ const token_o = state.push('heading_open', 'h' + String(level), 1);
+ token_o.markup = '########'.slice(0, level);
+ token_o.map = [startLine, state.line];
+ const token_i = state.push('inline', '', 0);
+ token_i.content = state.src.slice(pos, max).trim();
+ token_i.map = [startLine, state.line];
+ token_i.children = [];
+ const token_c = state.push('heading_close', 'h' + String(level), -1);
+ token_c.markup = '########'.slice(0, level);
+ return true;
+}
+
+// lheading (---, ===)
+
+function lheading(state, startLine, endLine /*, silent */) {
+ const terminatorRules = state.md.block.ruler.getRules('paragraph');
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) {
+ return false;
+ }
+ const oldParentType = state.parentType;
+ state.parentType = 'paragraph'; // use paragraph to match terminatorRules
+
+ // jump line-by-line until empty one or EOF
+ let level = 0;
+ let marker;
+ let nextLine = startLine + 1;
+ for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
+ // this would be a code block normally, but after paragraph
+ // it's considered a lazy continuation regardless of what's there
+ if (state.sCount[nextLine] - state.blkIndent > 3) {
+ continue;
+ }
+
+ //
+ // Check for underline in setext header
+ //
+ if (state.sCount[nextLine] >= state.blkIndent) {
+ let pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ const max = state.eMarks[nextLine];
+ if (pos < max) {
+ marker = state.src.charCodeAt(pos);
+ if (marker === 0x2D /* - */ || marker === 0x3D /* = */) {
+ pos = state.skipChars(pos, marker);
+ pos = state.skipSpaces(pos);
+ if (pos >= max) {
+ level = marker === 0x3D /* = */ ? 1 : 2;
+ break;
}
- e.replaceRange("", s, l, "+delete");
- }
- });
- }, a.delLineRight = function (e) {
- e.operation(function () {
- for (var t = e.listSelections(), n = t.length - 1; n >= 0; n--) e.replaceRange("", t[n].anchor, f(t[n].to().line), "+delete");
- e.scrollIntoView();
- });
- }, a.upcaseAtCursor = function (e) {
- D(e, function (t) {
- return t.toUpperCase();
- });
- }, a.downcaseAtCursor = function (e) {
- D(e, function (t) {
- return t.toLowerCase();
- });
- }, a.setSublimeMark = function (e) {
- e.state.sublimeMark && e.state.sublimeMark.clear(), e.state.sublimeMark = e.setBookmark(e.getCursor());
- }, a.selectToSublimeMark = function (e) {
- var t = e.state.sublimeMark && e.state.sublimeMark.find();
- t && e.setSelection(e.getCursor(), t);
- }, a.deleteToSublimeMark = function (e) {
- var t = e.state.sublimeMark && e.state.sublimeMark.find();
- if (t) {
- var n = e.getCursor(),
- r = t;
- if (h.cmpPos(n, r) > 0) {
- var l = r;
- r = n, n = l;
}
- e.state.sublimeKilled = e.getRange(n, r), e.replaceRange("", n, r);
- }
- }, a.swapWithSublimeMark = function (e) {
- var t = e.state.sublimeMark && e.state.sublimeMark.find();
- t && (e.state.sublimeMark.clear(), e.state.sublimeMark = e.setBookmark(e.getCursor()), e.setCursor(t));
- }, a.sublimeYank = function (e) {
- e.state.sublimeKilled != null && e.replaceSelection(e.state.sublimeKilled, null, "paste");
- }, a.showInCenter = function (e) {
- var t = e.cursorCoords(null, "local");
- e.scrollTo(null, (t.top + t.bottom) / 2 - e.getScrollInfo().clientHeight / 2);
- };
- function N(e) {
- var t = e.getCursor("from"),
- n = e.getCursor("to");
- if (h.cmpPos(t, n) == 0) {
- var r = K(e, t);
- if (!r.word) return;
- t = r.from, n = r.to;
}
- return {
- from: t,
- to: n,
- query: e.getRange(t, n),
- word: r
- };
}
- v(N, "getTarget");
- function O(e, t) {
- var n = N(e);
- if (n) {
- var r = n.query,
- l = e.getSearchCursor(r, t ? n.to : n.from);
- (t ? l.findNext() : l.findPrevious()) ? e.setSelection(l.from(), l.to()) : (l = e.getSearchCursor(r, t ? f(e.firstLine(), 0) : e.clipPos(f(e.lastLine()))), (t ? l.findNext() : l.findPrevious()) ? e.setSelection(l.from(), l.to()) : n.word && e.setSelection(n.from, n.to));
+
+ // quirk for blockquotes, this line should already be checked by that rule
+ if (state.sCount[nextLine] < 0) {
+ continue;
+ }
+
+ // Some tags can terminate paragraph without empty line.
+ let terminate = false;
+ for (let i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
}
}
- v(O, "findAndGoTo"), a.findUnder = function (e) {
- O(e, !0);
- }, a.findUnderPrevious = function (e) {
- O(e, !1);
- }, a.findAllUnder = function (e) {
- var t = N(e);
- if (t) {
- for (var n = e.getSearchCursor(t.query), r = [], l = -1; n.findNext();) r.push({
- anchor: n.from(),
- head: n.to()
- }), n.from().line <= t.from.line && n.from().ch <= t.from.ch && l++;
- e.setSelections(r, l);
+ if (terminate) {
+ break;
+ }
+ }
+ if (!level) {
+ // Didn't find valid underline
+ return false;
+ }
+ const content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
+ state.line = nextLine + 1;
+ const token_o = state.push('heading_open', 'h' + String(level), 1);
+ token_o.markup = String.fromCharCode(marker);
+ token_o.map = [startLine, state.line];
+ const token_i = state.push('inline', '', 0);
+ token_i.content = content;
+ token_i.map = [startLine, state.line - 1];
+ token_i.children = [];
+ const token_c = state.push('heading_close', 'h' + String(level), -1);
+ token_c.markup = String.fromCharCode(marker);
+ state.parentType = oldParentType;
+ return true;
+}
+
+// Paragraph
+
+function paragraph(state, startLine, endLine) {
+ const terminatorRules = state.md.block.ruler.getRules('paragraph');
+ const oldParentType = state.parentType;
+ let nextLine = startLine + 1;
+ state.parentType = 'paragraph';
+
+ // jump line-by-line until empty one or EOF
+ for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
+ // this would be a code block normally, but after paragraph
+ // it's considered a lazy continuation regardless of what's there
+ if (state.sCount[nextLine] - state.blkIndent > 3) {
+ continue;
+ }
+
+ // quirk for blockquotes, this line should already be checked by that rule
+ if (state.sCount[nextLine] < 0) {
+ continue;
+ }
+
+ // Some tags can terminate paragraph without empty line.
+ let terminate = false;
+ for (let i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
}
- };
- var C = h.keyMap;
- C.macSublime = {
- "Cmd-Left": "goLineStartSmart",
- "Shift-Tab": "indentLess",
- "Shift-Ctrl-K": "deleteLine",
- "Alt-Q": "wrapLines",
- "Ctrl-Left": "goSubwordLeft",
- "Ctrl-Right": "goSubwordRight",
- "Ctrl-Alt-Up": "scrollLineUp",
- "Ctrl-Alt-Down": "scrollLineDown",
- "Cmd-L": "selectLine",
- "Shift-Cmd-L": "splitSelectionByLine",
- Esc: "singleSelectionTop",
- "Cmd-Enter": "insertLineAfter",
- "Shift-Cmd-Enter": "insertLineBefore",
- "Cmd-D": "selectNextOccurrence",
- "Shift-Cmd-Space": "selectScope",
- "Shift-Cmd-M": "selectBetweenBrackets",
- "Cmd-M": "goToBracket",
- "Cmd-Ctrl-Up": "swapLineUp",
- "Cmd-Ctrl-Down": "swapLineDown",
- "Cmd-/": "toggleCommentIndented",
- "Cmd-J": "joinLines",
- "Shift-Cmd-D": "duplicateLine",
- F5: "sortLines",
- "Shift-F5": "reverseSortLines",
- "Cmd-F5": "sortLinesInsensitive",
- "Shift-Cmd-F5": "reverseSortLinesInsensitive",
- F2: "nextBookmark",
- "Shift-F2": "prevBookmark",
- "Cmd-F2": "toggleBookmark",
- "Shift-Cmd-F2": "clearBookmarks",
- "Alt-F2": "selectBookmarks",
- Backspace: "smartBackspace",
- "Cmd-K Cmd-D": "skipAndSelectNextOccurrence",
- "Cmd-K Cmd-K": "delLineRight",
- "Cmd-K Cmd-U": "upcaseAtCursor",
- "Cmd-K Cmd-L": "downcaseAtCursor",
- "Cmd-K Cmd-Space": "setSublimeMark",
- "Cmd-K Cmd-A": "selectToSublimeMark",
- "Cmd-K Cmd-W": "deleteToSublimeMark",
- "Cmd-K Cmd-X": "swapWithSublimeMark",
- "Cmd-K Cmd-Y": "sublimeYank",
- "Cmd-K Cmd-C": "showInCenter",
- "Cmd-K Cmd-G": "clearBookmarks",
- "Cmd-K Cmd-Backspace": "delLineLeft",
- "Cmd-K Cmd-1": "foldAll",
- "Cmd-K Cmd-0": "unfoldAll",
- "Cmd-K Cmd-J": "unfoldAll",
- "Ctrl-Shift-Up": "addCursorToPrevLine",
- "Ctrl-Shift-Down": "addCursorToNextLine",
- "Cmd-F3": "findUnder",
- "Shift-Cmd-F3": "findUnderPrevious",
- "Alt-F3": "findAllUnder",
- "Shift-Cmd-[": "fold",
- "Shift-Cmd-]": "unfold",
- "Cmd-I": "findIncremental",
- "Shift-Cmd-I": "findIncrementalReverse",
- "Cmd-H": "replace",
- F3: "findNext",
- "Shift-F3": "findPrev",
- fallthrough: "macDefault"
- }, h.normalizeKeyMap(C.macSublime), C.pcSublime = {
- "Shift-Tab": "indentLess",
- "Shift-Ctrl-K": "deleteLine",
- "Alt-Q": "wrapLines",
- "Ctrl-T": "transposeChars",
- "Alt-Left": "goSubwordLeft",
- "Alt-Right": "goSubwordRight",
- "Ctrl-Up": "scrollLineUp",
- "Ctrl-Down": "scrollLineDown",
- "Ctrl-L": "selectLine",
- "Shift-Ctrl-L": "splitSelectionByLine",
- Esc: "singleSelectionTop",
- "Ctrl-Enter": "insertLineAfter",
- "Shift-Ctrl-Enter": "insertLineBefore",
- "Ctrl-D": "selectNextOccurrence",
- "Shift-Ctrl-Space": "selectScope",
- "Shift-Ctrl-M": "selectBetweenBrackets",
- "Ctrl-M": "goToBracket",
- "Shift-Ctrl-Up": "swapLineUp",
- "Shift-Ctrl-Down": "swapLineDown",
- "Ctrl-/": "toggleCommentIndented",
- "Ctrl-J": "joinLines",
- "Shift-Ctrl-D": "duplicateLine",
- F9: "sortLines",
- "Shift-F9": "reverseSortLines",
- "Ctrl-F9": "sortLinesInsensitive",
- "Shift-Ctrl-F9": "reverseSortLinesInsensitive",
- F2: "nextBookmark",
- "Shift-F2": "prevBookmark",
- "Ctrl-F2": "toggleBookmark",
- "Shift-Ctrl-F2": "clearBookmarks",
- "Alt-F2": "selectBookmarks",
- Backspace: "smartBackspace",
- "Ctrl-K Ctrl-D": "skipAndSelectNextOccurrence",
- "Ctrl-K Ctrl-K": "delLineRight",
- "Ctrl-K Ctrl-U": "upcaseAtCursor",
- "Ctrl-K Ctrl-L": "downcaseAtCursor",
- "Ctrl-K Ctrl-Space": "setSublimeMark",
- "Ctrl-K Ctrl-A": "selectToSublimeMark",
- "Ctrl-K Ctrl-W": "deleteToSublimeMark",
- "Ctrl-K Ctrl-X": "swapWithSublimeMark",
- "Ctrl-K Ctrl-Y": "sublimeYank",
- "Ctrl-K Ctrl-C": "showInCenter",
- "Ctrl-K Ctrl-G": "clearBookmarks",
- "Ctrl-K Ctrl-Backspace": "delLineLeft",
- "Ctrl-K Ctrl-1": "foldAll",
- "Ctrl-K Ctrl-0": "unfoldAll",
- "Ctrl-K Ctrl-J": "unfoldAll",
- "Ctrl-Alt-Up": "addCursorToPrevLine",
- "Ctrl-Alt-Down": "addCursorToNextLine",
- "Ctrl-F3": "findUnder",
- "Shift-Ctrl-F3": "findUnderPrevious",
- "Alt-F3": "findAllUnder",
- "Shift-Ctrl-[": "fold",
- "Shift-Ctrl-]": "unfold",
- "Ctrl-I": "findIncremental",
- "Shift-Ctrl-I": "findIncrementalReverse",
- "Ctrl-H": "replace",
- F3: "findNext",
- "Shift-F3": "findPrev",
- fallthrough: "pcDefault"
- }, h.normalizeKeyMap(C.pcSublime);
- var V = C.default == C.macDefault;
- C.sublime = V ? C.macSublime : C.pcSublime;
- });
-})();
-var q = G.exports;
-const Q = E.getDefaultExportFromCjs(q),
- X = J({
- __proto__: null,
- default: Q
- }, [q]);
-exports.sublime = X;
+ }
+ if (terminate) {
+ break;
+ }
+ }
+ const content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
+ state.line = nextLine;
+ const token_o = state.push('paragraph_open', 'p', 1);
+ token_o.map = [startLine, state.line];
+ const token_i = state.push('inline', '', 0);
+ token_i.content = content;
+ token_i.map = [startLine, state.line];
+ token_i.children = [];
+ state.push('paragraph_close', 'p', -1);
+ state.parentType = oldParentType;
+ return true;
+}
-/***/ }),
+/** internal
+ * class ParserBlock
+ *
+ * Block-level tokenizer.
+ **/
-/***/ "../../graphiql-toolkit/esm/async-helpers/index.js":
-/*!*********************************************************!*\
- !*** ../../graphiql-toolkit/esm/async-helpers/index.js ***!
- \*********************************************************/
-/***/ (function(__unused_webpack_module, exports) {
+const _rules$1 = [
+// First 2 params - rule name & source. Secondary array - list of rules,
+// which can be terminated by this one.
+['table', table, ['paragraph', 'reference']], ['code', code], ['fence', fence, ['paragraph', 'reference', 'blockquote', 'list']], ['blockquote', blockquote, ['paragraph', 'reference', 'blockquote', 'list']], ['hr', hr, ['paragraph', 'reference', 'blockquote', 'list']], ['list', list, ['paragraph', 'reference', 'blockquote']], ['reference', reference], ['html_block', html_block, ['paragraph', 'reference', 'blockquote']], ['heading', heading, ['paragraph', 'reference', 'blockquote']], ['lheading', lheading], ['paragraph', paragraph]];
+
+/**
+ * new ParserBlock()
+ **/
+function ParserBlock() {
+ /**
+ * ParserBlock#ruler -> Ruler
+ *
+ * [[Ruler]] instance. Keep configuration of block rules.
+ **/
+ this.ruler = new Ruler();
+ for (let i = 0; i < _rules$1.length; i++) {
+ this.ruler.push(_rules$1[i][0], _rules$1[i][1], {
+ alt: (_rules$1[i][2] || []).slice()
+ });
+ }
+}
+
+// Generate tokens for input range
+//
+ParserBlock.prototype.tokenize = function (state, startLine, endLine) {
+ const rules = this.ruler.getRules('');
+ const len = rules.length;
+ const maxNesting = state.md.options.maxNesting;
+ let line = startLine;
+ let hasEmptyLines = false;
+ while (line < endLine) {
+ state.line = line = state.skipEmptyLines(line);
+ if (line >= endLine) {
+ break;
+ }
+ // Termination condition for nested calls.
+ // Nested calls currently used for blockquotes & lists
+ if (state.sCount[line] < state.blkIndent) {
+ break;
+ }
+ // If nesting level exceeded - skip tail to the end. That's not ordinary
+ // situation and we should not care about content.
+ if (state.level >= maxNesting) {
+ state.line = endLine;
+ break;
+ }
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.fetcherReturnToPromise = fetcherReturnToPromise;
-exports.isAsyncIterable = isAsyncIterable;
-exports.isObservable = isObservable;
-exports.isPromise = isPromise;
-var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
- function adopt(value) {
- return value instanceof P ? value : new P(function (resolve) {
- resolve(value);
- });
- }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
+ // Try all possible rules.
+ // On success, rule should:
+ //
+ // - update `state.line`
+ // - update `state.tokens`
+ // - return true
+ const prevLine = state.line;
+ let ok = false;
+ for (let i = 0; i < len; i++) {
+ ok = rules[i](state, line, endLine, false);
+ if (ok) {
+ if (prevLine >= state.line) {
+ throw new Error("block rule didn't increment state.line");
+ }
+ break;
}
}
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e) {
- reject(e);
- }
+
+ // this can only happen if user disables paragraph rule
+ if (!ok) throw new Error('none of the block rules matched');
+
+ // set state.tight if we had an empty line before current tag
+ // i.e. latest empty line should not count
+ state.tight = !hasEmptyLines;
+
+ // paragraph might "eat" one newline after it in nested lists
+ if (state.isEmpty(state.line - 1)) {
+ hasEmptyLines = true;
}
- function step(result) {
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
+ line = state.line;
+ if (line < endLine && state.isEmpty(line)) {
+ hasEmptyLines = true;
+ line++;
+ state.line = line;
}
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
+ }
};
-function isPromise(value) {
- return typeof value === 'object' && value !== null && typeof value.then === 'function';
+
+/**
+ * ParserBlock.parse(str, md, env, outTokens)
+ *
+ * Process input string and push block tokens into `outTokens`
+ **/
+ParserBlock.prototype.parse = function (src, md, env, outTokens) {
+ if (!src) {
+ return;
+ }
+ const state = new this.State(src, md, env, outTokens);
+ this.tokenize(state, state.line, state.lineMax);
+};
+ParserBlock.prototype.State = StateBlock;
+
+// Inline parser state
+
+function StateInline(src, md, env, outTokens) {
+ this.src = src;
+ this.env = env;
+ this.md = md;
+ this.tokens = outTokens;
+ this.tokens_meta = Array(outTokens.length);
+ this.pos = 0;
+ this.posMax = this.src.length;
+ this.level = 0;
+ this.pending = '';
+ this.pendingLevel = 0;
+
+ // Stores { start: end } pairs. Useful for backtrack
+ // optimization of pairs parse (emphasis, strikes).
+ this.cache = {};
+
+ // List of emphasis-like delimiters for current tag
+ this.delimiters = [];
+
+ // Stack of delimiter lists for upper level tags
+ this._prev_delimiters = [];
+
+ // backtick length => last seen position
+ this.backticks = {};
+ this.backticksScanned = false;
+
+ // Counter used to disable inline linkify-it execution
+ // inside and markdown links
+ this.linkLevel = 0;
}
-function observableToPromise(observable) {
- return new Promise((resolve, reject) => {
- const subscription = observable.subscribe({
- next(v) {
- resolve(v);
- subscription.unsubscribe();
- },
- error: reject,
- complete() {
- reject(new Error('no value resolved'));
- }
- });
- });
+
+// Flush pending text
+//
+StateInline.prototype.pushPending = function () {
+ const token = new Token('text', '', 0);
+ token.content = this.pending;
+ token.level = this.pendingLevel;
+ this.tokens.push(token);
+ this.pending = '';
+ return token;
+};
+
+// Push new token to "stream".
+// If pending text exists - flush it as text token
+//
+StateInline.prototype.push = function (type, tag, nesting) {
+ if (this.pending) {
+ this.pushPending();
+ }
+ const token = new Token(type, tag, nesting);
+ let token_meta = null;
+ if (nesting < 0) {
+ // closing tag
+ this.level--;
+ this.delimiters = this._prev_delimiters.pop();
+ }
+ token.level = this.level;
+ if (nesting > 0) {
+ // opening tag
+ this.level++;
+ this._prev_delimiters.push(this.delimiters);
+ this.delimiters = [];
+ token_meta = {
+ delimiters: this.delimiters
+ };
+ }
+ this.pendingLevel = this.level;
+ this.tokens.push(token);
+ this.tokens_meta.push(token_meta);
+ return token;
+};
+
+// Scan a sequence of emphasis-like markers, and determine whether
+// it can start an emphasis sequence or end an emphasis sequence.
+//
+// - start - position to scan from (it should point at a valid marker);
+// - canSplitWord - determine if these markers can be found inside a word
+//
+StateInline.prototype.scanDelims = function (start, canSplitWord) {
+ const max = this.posMax;
+ const marker = this.src.charCodeAt(start);
+
+ // treat beginning of the line as a whitespace
+ const lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;
+ let pos = start;
+ while (pos < max && this.src.charCodeAt(pos) === marker) {
+ pos++;
+ }
+ const count = pos - start;
+
+ // treat end of the line as a whitespace
+ const nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
+ const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
+ const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
+ const isLastWhiteSpace = isWhiteSpace(lastChar);
+ const isNextWhiteSpace = isWhiteSpace(nextChar);
+ const left_flanking = !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
+ const right_flanking = !isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
+ const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar);
+ const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar);
+ return {
+ can_open,
+ can_close,
+ length: count
+ };
+};
+
+// re-export Token class to use in block rules
+StateInline.prototype.Token = Token;
+
+// Skip text characters for text token, place those to pending buffer
+// and increment current pos
+
+// Rule to skip pure text
+// '{}$%@~+=:' reserved for extentions
+
+// !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
+
+// !!!! Don't confuse with "Markdown ASCII Punctuation" chars
+// http://spec.commonmark.org/0.15/#ascii-punctuation-character
+function isTerminatorChar(ch) {
+ switch (ch) {
+ case 0x0A /* \n */:
+ case 0x21 /* ! */:
+ case 0x23 /* # */:
+ case 0x24 /* $ */:
+ case 0x25 /* % */:
+ case 0x26 /* & */:
+ case 0x2A /* * */:
+ case 0x2B /* + */:
+ case 0x2D /* - */:
+ case 0x3A /* : */:
+ case 0x3C /* < */:
+ case 0x3D /* = */:
+ case 0x3E /* > */:
+ case 0x40 /* @ */:
+ case 0x5B /* [ */:
+ case 0x5C /* \ */:
+ case 0x5D /* ] */:
+ case 0x5E /* ^ */:
+ case 0x5F /* _ */:
+ case 0x60 /* ` */:
+ case 0x7B /* { */:
+ case 0x7D /* } */:
+ case 0x7E /* ~ */:
+ return true;
+ default:
+ return false;
+ }
}
-function isObservable(value) {
- return typeof value === 'object' && value !== null && 'subscribe' in value && typeof value.subscribe === 'function';
+function text(state, silent) {
+ let pos = state.pos;
+ while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
+ pos++;
+ }
+ if (pos === state.pos) {
+ return false;
+ }
+ if (!silent) {
+ state.pending += state.src.slice(state.pos, pos);
+ }
+ state.pos = pos;
+ return true;
}
-function isAsyncIterable(input) {
- return typeof input === 'object' && input !== null && (input[Symbol.toStringTag] === 'AsyncGenerator' || Symbol.asyncIterator in input);
+
+// Alternative implementation, for memory.
+//
+// It costs 10% of performance, but allows extend terminators list, if place it
+// to `ParserInline` property. Probably, will switch to it sometime, such
+// flexibility required.
+
+/*
+var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/;
+
+module.exports = function text(state, silent) {
+ var pos = state.pos,
+ idx = state.src.slice(pos).search(TERMINATOR_RE);
+
+ // first char is terminator -> empty text
+ if (idx === 0) { return false; }
+
+ // no terminator -> text till end of string
+ if (idx < 0) {
+ if (!silent) { state.pending += state.src.slice(pos); }
+ state.pos = state.src.length;
+ return true;
+ }
+
+ if (!silent) { state.pending += state.src.slice(pos, pos + idx); }
+
+ state.pos += idx;
+
+ return true;
+}; */
+
+// Process links like https://example.org/
+
+// RFC3986: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+const SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
+function linkify(state, silent) {
+ if (!state.md.options.linkify) return false;
+ if (state.linkLevel > 0) return false;
+ const pos = state.pos;
+ const max = state.posMax;
+ if (pos + 3 > max) return false;
+ if (state.src.charCodeAt(pos) !== 0x3A /* : */) return false;
+ if (state.src.charCodeAt(pos + 1) !== 0x2F /* / */) return false;
+ if (state.src.charCodeAt(pos + 2) !== 0x2F /* / */) return false;
+ const match = state.pending.match(SCHEME_RE);
+ if (!match) return false;
+ const proto = match[1];
+ const link = state.md.linkify.matchAtStart(state.src.slice(pos - proto.length));
+ if (!link) return false;
+ let url = link.url;
+
+ // invalid link, but still detected by linkify somehow;
+ // need to check to prevent infinite loop below
+ if (url.length <= proto.length) return false;
+
+ // disallow '*' at the end of the link (conflicts with emphasis)
+ url = url.replace(/\*+$/, '');
+ const fullUrl = state.md.normalizeLink(url);
+ if (!state.md.validateLink(fullUrl)) return false;
+ if (!silent) {
+ state.pending = state.pending.slice(0, -proto.length);
+ const token_o = state.push('link_open', 'a', 1);
+ token_o.attrs = [['href', fullUrl]];
+ token_o.markup = 'linkify';
+ token_o.info = 'auto';
+ const token_t = state.push('text', '', 0);
+ token_t.content = state.md.normalizeLinkText(url);
+ const token_c = state.push('link_close', 'a', -1);
+ token_c.markup = 'linkify';
+ token_c.info = 'auto';
+ }
+ state.pos += url.length - proto.length;
+ return true;
}
-function asyncIterableToPromise(input) {
- var _a;
- return __awaiter(this, void 0, void 0, function* () {
- const iteratorReturn = (_a = ('return' in input ? input : input[Symbol.asyncIterator]()).return) === null || _a === void 0 ? void 0 : _a.bind(input);
- const iteratorNext = ('next' in input ? input : input[Symbol.asyncIterator]()).next.bind(input);
- const result = yield iteratorNext();
- void (iteratorReturn === null || iteratorReturn === void 0 ? void 0 : iteratorReturn());
- return result.value;
- });
+
+// Proceess '\n'
+
+function newline(state, silent) {
+ let pos = state.pos;
+ if (state.src.charCodeAt(pos) !== 0x0A /* \n */) {
+ return false;
+ }
+ const pmax = state.pending.length - 1;
+ const max = state.posMax;
+
+ // ' \n' -> hardbreak
+ // Lookup in pending chars is bad practice! Don't copy to other rules!
+ // Pending string is stored in concat mode, indexed lookups will cause
+ // convertion to flat mode.
+ if (!silent) {
+ if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
+ if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
+ // Find whitespaces tail of pending chars.
+ let ws = pmax - 1;
+ while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 0x20) ws--;
+ state.pending = state.pending.slice(0, ws);
+ state.push('hardbreak', 'br', 0);
+ } else {
+ state.pending = state.pending.slice(0, -1);
+ state.push('softbreak', 'br', 0);
+ }
+ } else {
+ state.push('softbreak', 'br', 0);
+ }
+ }
+ pos++;
+
+ // skip heading spaces for next line
+ while (pos < max && isSpace(state.src.charCodeAt(pos))) {
+ pos++;
+ }
+ state.pos = pos;
+ return true;
}
-function fetcherReturnToPromise(fetcherResult) {
- return __awaiter(this, void 0, void 0, function* () {
- const result = yield fetcherResult;
- if (isAsyncIterable(result)) {
- return asyncIterableToPromise(result);
+
+// Process escaped chars and hardbreaks
+
+const ESCAPED = [];
+for (let i = 0; i < 256; i++) {
+ ESCAPED.push(0);
+}
+'\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'.split('').forEach(function (ch) {
+ ESCAPED[ch.charCodeAt(0)] = 1;
+});
+function escape(state, silent) {
+ let pos = state.pos;
+ const max = state.posMax;
+ if (state.src.charCodeAt(pos) !== 0x5C /* \ */) return false;
+ pos++;
+
+ // '\' at the end of the inline block
+ if (pos >= max) return false;
+ let ch1 = state.src.charCodeAt(pos);
+ if (ch1 === 0x0A) {
+ if (!silent) {
+ state.push('hardbreak', 'br', 0);
}
- if (isObservable(result)) {
- return observableToPromise(result);
+ pos++;
+ // skip leading whitespaces from next line
+ while (pos < max) {
+ ch1 = state.src.charCodeAt(pos);
+ if (!isSpace(ch1)) break;
+ pos++;
}
- return result;
- });
+ state.pos = pos;
+ return true;
+ }
+ let escapedStr = state.src[pos];
+ if (ch1 >= 0xD800 && ch1 <= 0xDBFF && pos + 1 < max) {
+ const ch2 = state.src.charCodeAt(pos + 1);
+ if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
+ escapedStr += state.src[pos + 1];
+ pos++;
+ }
+ }
+ const origStr = '\\' + escapedStr;
+ if (!silent) {
+ const token = state.push('text_special', '', 0);
+ if (ch1 < 256 && ESCAPED[ch1] !== 0) {
+ token.content = escapedStr;
+ } else {
+ token.content = origStr;
+ }
+ token.markup = origStr;
+ token.info = 'escape';
+ }
+ state.pos = pos + 1;
+ return true;
}
-/***/ }),
+// Parse backticks
-/***/ "../../graphiql-toolkit/esm/create-fetcher/createFetcher.js":
-/*!******************************************************************!*\
- !*** ../../graphiql-toolkit/esm/create-fetcher/createFetcher.js ***!
- \******************************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+function backtick(state, silent) {
+ let pos = state.pos;
+ const ch = state.src.charCodeAt(pos);
+ if (ch !== 0x60 /* ` */) {
+ return false;
+ }
+ const start = pos;
+ pos++;
+ const max = state.posMax;
+ // scan marker length
+ while (pos < max && state.src.charCodeAt(pos) === 0x60 /* ` */) {
+ pos++;
+ }
+ const marker = state.src.slice(start, pos);
+ const openerLength = marker.length;
+ if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
+ if (!silent) state.pending += marker;
+ state.pos += openerLength;
+ return true;
+ }
+ let matchEnd = pos;
+ let matchStart;
+ // Nothing found in the cache, scan until the end of the line (or until marker is found)
+ while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {
+ matchEnd = matchStart + 1;
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.createGraphiQLFetcher = createGraphiQLFetcher;
-var _lib = __webpack_require__(/*! ./lib */ "../../graphiql-toolkit/esm/create-fetcher/lib.js");
-function createGraphiQLFetcher(options) {
- let httpFetch;
- if (typeof window !== 'undefined' && window.fetch) {
- httpFetch = window.fetch;
+ // scan marker length
+ while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60 /* ` */) {
+ matchEnd++;
+ }
+ const closerLength = matchEnd - matchStart;
+ if (closerLength === openerLength) {
+ // Found matching closer length.
+ if (!silent) {
+ const token = state.push('code_inline', 'code', 0);
+ token.markup = marker;
+ token.content = state.src.slice(pos, matchStart).replace(/\n/g, ' ').replace(/^ (.+) $/, '$1');
+ }
+ state.pos = matchEnd;
+ return true;
+ }
+
+ // Some different length found, put it in cache as upper limit of where closer can be found
+ state.backticks[closerLength] = matchStart;
}
- if ((options === null || options === void 0 ? void 0 : options.enableIncrementalDelivery) === null || options.enableIncrementalDelivery !== false) {
- options.enableIncrementalDelivery = true;
+
+ // Scanned through the end, didn't find anything
+ state.backticksScanned = true;
+ if (!silent) state.pending += marker;
+ state.pos += openerLength;
+ return true;
+}
+
+// ~~strike through~~
+//
+
+// Insert each marker as a separate text token, and add it to delimiter list
+//
+function strikethrough_tokenize(state, silent) {
+ const start = state.pos;
+ const marker = state.src.charCodeAt(start);
+ if (silent) {
+ return false;
}
- if (options.fetch) {
- httpFetch = options.fetch;
+ if (marker !== 0x7E /* ~ */) {
+ return false;
}
- if (!httpFetch) {
- throw new Error('No valid fetcher implementation available');
+ const scanned = state.scanDelims(state.pos, true);
+ let len = scanned.length;
+ const ch = String.fromCharCode(marker);
+ if (len < 2) {
+ return false;
+ }
+ let token;
+ if (len % 2) {
+ token = state.push('text', '', 0);
+ token.content = ch;
+ len--;
+ }
+ for (let i = 0; i < len; i += 2) {
+ token = state.push('text', '', 0);
+ token.content = ch + ch;
+ state.delimiters.push({
+ marker,
+ length: 0,
+ // disable "rule of 3" length checks meant for emphasis
+ token: state.tokens.length - 1,
+ end: -1,
+ open: scanned.can_open,
+ close: scanned.can_close
+ });
+ }
+ state.pos += scanned.length;
+ return true;
+}
+function postProcess$1(state, delimiters) {
+ let token;
+ const loneMarkers = [];
+ const max = delimiters.length;
+ for (let i = 0; i < max; i++) {
+ const startDelim = delimiters[i];
+ if (startDelim.marker !== 0x7E /* ~ */) {
+ continue;
+ }
+ if (startDelim.end === -1) {
+ continue;
+ }
+ const endDelim = delimiters[startDelim.end];
+ token = state.tokens[startDelim.token];
+ token.type = 's_open';
+ token.tag = 's';
+ token.nesting = 1;
+ token.markup = '~~';
+ token.content = '';
+ token = state.tokens[endDelim.token];
+ token.type = 's_close';
+ token.tag = 's';
+ token.nesting = -1;
+ token.markup = '~~';
+ token.content = '';
+ if (state.tokens[endDelim.token - 1].type === 'text' && state.tokens[endDelim.token - 1].content === '~') {
+ loneMarkers.push(endDelim.token - 1);
+ }
+ }
+
+ // If a marker sequence has an odd number of characters, it's splitted
+ // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the
+ // start of the sequence.
+ //
+ // So, we have to move all those markers after subsequent s_close tags.
+ //
+ while (loneMarkers.length) {
+ const i = loneMarkers.pop();
+ let j = i + 1;
+ while (j < state.tokens.length && state.tokens[j].type === 's_close') {
+ j++;
+ }
+ j--;
+ if (i !== j) {
+ token = state.tokens[j];
+ state.tokens[j] = state.tokens[i];
+ state.tokens[i] = token;
+ }
+ }
+}
+
+// Walk through delimiter list and replace text tokens with tags
+//
+function strikethrough_postProcess(state) {
+ const tokens_meta = state.tokens_meta;
+ const max = state.tokens_meta.length;
+ postProcess$1(state, state.delimiters);
+ for (let curr = 0; curr < max; curr++) {
+ if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
+ postProcess$1(state, tokens_meta[curr].delimiters);
+ }
+ }
+}
+var r_strikethrough = {
+ tokenize: strikethrough_tokenize,
+ postProcess: strikethrough_postProcess
+};
+
+// Process *this* and _that_
+//
+
+// Insert each marker as a separate text token, and add it to delimiter list
+//
+function emphasis_tokenize(state, silent) {
+ const start = state.pos;
+ const marker = state.src.charCodeAt(start);
+ if (silent) {
+ return false;
+ }
+ if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) {
+ return false;
+ }
+ const scanned = state.scanDelims(state.pos, marker === 0x2A);
+ for (let i = 0; i < scanned.length; i++) {
+ const token = state.push('text', '', 0);
+ token.content = String.fromCharCode(marker);
+ state.delimiters.push({
+ // Char code of the starting marker (number).
+ //
+ marker,
+ // Total length of these series of delimiters.
+ //
+ length: scanned.length,
+ // A position of the token this delimiter corresponds to.
+ //
+ token: state.tokens.length - 1,
+ // If this delimiter is matched as a valid opener, `end` will be
+ // equal to its position, otherwise it's `-1`.
+ //
+ end: -1,
+ // Boolean flags that determine if this delimiter could open or close
+ // an emphasis.
+ //
+ open: scanned.can_open,
+ close: scanned.can_close
+ });
}
- const simpleFetcher = (0, _lib.createSimpleFetcher)(options, httpFetch);
- const httpFetcher = options.enableIncrementalDelivery ? (0, _lib.createMultipartFetcher)(options, httpFetch) : simpleFetcher;
- return (graphQLParams, fetcherOpts) => {
- if (graphQLParams.operationName === 'IntrospectionQuery') {
- return (options.schemaFetcher || simpleFetcher)(graphQLParams, fetcherOpts);
+ state.pos += scanned.length;
+ return true;
+}
+function postProcess(state, delimiters) {
+ const max = delimiters.length;
+ for (let i = max - 1; i >= 0; i--) {
+ const startDelim = delimiters[i];
+ if (startDelim.marker !== 0x5F /* _ */ && startDelim.marker !== 0x2A /* * */) {
+ continue;
}
- const isSubscription = (fetcherOpts === null || fetcherOpts === void 0 ? void 0 : fetcherOpts.documentAST) ? (0, _lib.isSubscriptionWithName)(fetcherOpts.documentAST, graphQLParams.operationName || undefined) : false;
- if (isSubscription) {
- const wsFetcher = (0, _lib.getWsFetcher)(options, fetcherOpts);
- if (!wsFetcher) {
- throw new Error(`Your GraphiQL createFetcher is not properly configured for websocket subscriptions yet. ${options.subscriptionUrl ? `Provided URL ${options.subscriptionUrl} failed` : 'Please provide subscriptionUrl, wsClient or legacyClient option first.'}`);
- }
- return wsFetcher(graphQLParams);
+
+ // Process only opening markers
+ if (startDelim.end === -1) {
+ continue;
}
- return httpFetcher(graphQLParams, fetcherOpts);
- };
-}
+ const endDelim = delimiters[startDelim.end];
-/***/ }),
+ // If the previous delimiter has the same marker and is adjacent to this one,
+ // merge those into one strong delimiter.
+ //
+ // `whatever` -> `whatever`
+ //
+ const isStrong = i > 0 && delimiters[i - 1].end === startDelim.end + 1 &&
+ // check that first two markers match and adjacent
+ delimiters[i - 1].marker === startDelim.marker && delimiters[i - 1].token === startDelim.token - 1 &&
+ // check that last two markers are adjacent (we can safely assume they match)
+ delimiters[startDelim.end + 1].token === endDelim.token + 1;
+ const ch = String.fromCharCode(startDelim.marker);
+ const token_o = state.tokens[startDelim.token];
+ token_o.type = isStrong ? 'strong_open' : 'em_open';
+ token_o.tag = isStrong ? 'strong' : 'em';
+ token_o.nesting = 1;
+ token_o.markup = isStrong ? ch + ch : ch;
+ token_o.content = '';
+ const token_c = state.tokens[endDelim.token];
+ token_c.type = isStrong ? 'strong_close' : 'em_close';
+ token_c.tag = isStrong ? 'strong' : 'em';
+ token_c.nesting = -1;
+ token_c.markup = isStrong ? ch + ch : ch;
+ token_c.content = '';
+ if (isStrong) {
+ state.tokens[delimiters[i - 1].token].content = '';
+ state.tokens[delimiters[startDelim.end + 1].token].content = '';
+ i--;
+ }
+ }
+}
-/***/ "../../graphiql-toolkit/esm/create-fetcher/index.js":
-/*!**********************************************************!*\
- !*** ../../graphiql-toolkit/esm/create-fetcher/index.js ***!
- \**********************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Walk through delimiter list and replace text tokens with tags
+//
+function emphasis_post_process(state) {
+ const tokens_meta = state.tokens_meta;
+ const max = state.tokens_meta.length;
+ postProcess(state, state.delimiters);
+ for (let curr = 0; curr < max; curr++) {
+ if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
+ postProcess(state, tokens_meta[curr].delimiters);
+ }
+ }
+}
+var r_emphasis = {
+ tokenize: emphasis_tokenize,
+ postProcess: emphasis_post_process
+};
+// Process [link](
)
+ xhtmlOut: false,
+ // Convert '\n' in paragraphs into
+ breaks: false,
+ // CSS language prefix for fenced blocks
+ langPrefix: 'language-',
+ // autoconvert URL-like texts to links
+ linkify: false,
+ // Enable some language-neutral replacements + quotes beautification
+ typographer: false,
+ // Double + single quotes replacement pairs, when typographer enabled,
+ // and smartquotes on. Could be either a String or an Array.
+ //
+ // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
+ // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
+ quotes: '\u201c\u201d\u2018\u2019',
+ /* “”‘’ */
+
+ // Highlighter function. Should return escaped HTML,
+ // or '' if the source string is not changed and should be escaped externaly.
+ // If result starts with
+ breaks: false,
+ // CSS language prefix for fenced blocks
+ langPrefix: 'language-',
+ // autoconvert URL-like texts to links
+ linkify: false,
+ // Enable some language-neutral replacements + quotes beautification
+ typographer: false,
+ // Double + single quotes replacement pairs, when typographer enabled,
+ // and smartquotes on. Could be either a String or an Array.
+ //
+ // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
+ // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
+ quotes: '\u201c\u201d\u2018\u2019',
+ /* “”‘’ */
+
+ // Highlighter function. Should return escaped HTML,
+ // or '' if the source string is not changed and should be escaped externaly.
+ // If result starts with
+ breaks: false,
+ // CSS language prefix for fenced blocks
+ langPrefix: 'language-',
+ // autoconvert URL-like texts to links
+ linkify: false,
+ // Enable some language-neutral replacements + quotes beautification
+ typographer: false,
+ // Double + single quotes replacement pairs, when typographer enabled,
+ // and smartquotes on. Could be either a String or an Array.
+ //
+ // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
+ // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
+ quotes: '\u201c\u201d\u2018\u2019',
+ /* “”‘’ */
+
+ // Highlighter function. Should return escaped HTML,
+ // or '' if the source string is not changed and should be escaped externaly.
+ // If result starts with
`). This is needed only for full CommonMark compatibility. In real
+ * world you will need HTML output.
+ * - __breaks__ - `false`. Set `true` to convert `\n` in paragraphs into `
`.
+ * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.
+ * Can be useful for external highlighters.
+ * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.
+ * - __typographer__ - `false`. Set `true` to enable [some language-neutral
+ * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.mjs) +
+ * quotes beautification (smartquotes).
+ * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement
+ * pairs, when typographer enabled and smartquotes on. For example, you can
+ * use `'«»„“'` for Russian, `'„“‚‘'` for German, and
+ * `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).
+ * - __highlight__ - `null`. Highlighter function for fenced code blocks.
+ * Highlighter `function (str, lang)` should return escaped HTML. It can also
+ * return empty string if the source was not changed and should be escaped
+ * externaly. If result starts with `):
+ *
+ * ```javascript
+ * var hljs = require('highlight.js') // https://highlightjs.org/
+ *
+ * // Actual default values
+ * var md = require('markdown-it')({
+ * highlight: function (str, lang) {
+ * if (lang && hljs.getLanguage(lang)) {
+ * try {
+ * return '
';
+ * } catch (__) {}
+ * }
+ *
+ * return '' +
+ * hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +
+ * '
';
+ * }
+ * });
+ * ```
+ *
+ **/
+function MarkdownIt(presetName, options) {
+ if (!(this instanceof MarkdownIt)) {
+ return new MarkdownIt(presetName, options);
+ }
+ if (!options) {
+ if (!isString(presetName)) {
+ options = presetName || {};
+ presetName = 'default';
+ }
+ }
+ /**
+ * MarkdownIt#inline -> ParserInline
+ *
+ * Instance of [[ParserInline]]. You may need it to add new rules when
+ * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
+ * [[MarkdownIt.enable]].
+ **/
+ this.inline = new ParserInline();
+ /**
+ * MarkdownIt#block -> ParserBlock
+ *
+ * Instance of [[ParserBlock]]. You may need it to add new rules when
+ * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
+ * [[MarkdownIt.enable]].
+ **/
+ this.block = new ParserBlock();
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-var _autoComplete = __webpack_require__(/*! ./auto-complete */ "../../graphiql-toolkit/esm/graphql-helpers/auto-complete.js");
-Object.keys(_autoComplete).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _autoComplete[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _autoComplete[key];
- }
- });
-});
-var _mergeAst = __webpack_require__(/*! ./merge-ast */ "../../graphiql-toolkit/esm/graphql-helpers/merge-ast.js");
-Object.keys(_mergeAst).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _mergeAst[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _mergeAst[key];
- }
- });
-});
-var _operationName = __webpack_require__(/*! ./operation-name */ "../../graphiql-toolkit/esm/graphql-helpers/operation-name.js");
-Object.keys(_operationName).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _operationName[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _operationName[key];
- }
- });
-});
+ /**
+ * MarkdownIt#core -> Core
+ *
+ * Instance of [[Core]] chain executor. You may need it to add new rules when
+ * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
+ * [[MarkdownIt.enable]].
+ **/
+ this.core = new Core();
-/***/ }),
+ /**
+ * MarkdownIt#renderer -> Renderer
+ *
+ * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
+ * rules for new token types, generated by plugins.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * function myToken(tokens, idx, options, env, self) {
+ * //...
+ * return result;
+ * };
+ *
+ * md.renderer.rules['my_token'] = myToken
+ * ```
+ *
+ * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.mjs).
+ **/
+ this.renderer = new Renderer();
-/***/ "../../graphiql-toolkit/esm/graphql-helpers/merge-ast.js":
-/*!***************************************************************!*\
- !*** ../../graphiql-toolkit/esm/graphql-helpers/merge-ast.js ***!
- \***************************************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+ /**
+ * MarkdownIt#linkify -> LinkifyIt
+ *
+ * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
+ * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.mjs)
+ * rule.
+ **/
+ this.linkify = new LinkifyIt();
+
+ /**
+ * MarkdownIt#validateLink(url) -> Boolean
+ *
+ * Link validation function. CommonMark allows too much in links. By default
+ * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
+ * except some embedded image types.
+ *
+ * You can change this behaviour:
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ * // enable everything
+ * md.validateLink = function () { return true; }
+ * ```
+ **/
+ this.validateLink = validateLink;
+
+ /**
+ * MarkdownIt#normalizeLink(url) -> String
+ *
+ * Function used to encode link url to a machine-readable format,
+ * which includes url-encoding, punycode, etc.
+ **/
+ this.normalizeLink = normalizeLink;
+ /**
+ * MarkdownIt#normalizeLinkText(url) -> String
+ *
+ * Function used to decode link url to a human-readable format`
+ **/
+ this.normalizeLinkText = normalizeLinkText;
+ // Expose utils & helpers for easy acces from plugins
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.mergeAst = mergeAst;
-var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs");
-function uniqueBy(array, iteratee) {
- var _a;
- const FilteredMap = new Map();
- const result = [];
- for (const item of array) {
- if (item.kind === 'Field') {
- const uniqueValue = iteratee(item);
- const existing = FilteredMap.get(uniqueValue);
- if ((_a = item.directives) === null || _a === void 0 ? void 0 : _a.length) {
- const itemClone = Object.assign({}, item);
- result.push(itemClone);
- } else if ((existing === null || existing === void 0 ? void 0 : existing.selectionSet) && item.selectionSet) {
- existing.selectionSet.selections = [...existing.selectionSet.selections, ...item.selectionSet.selections];
- } else if (!existing) {
- const itemClone = Object.assign({}, item);
- FilteredMap.set(uniqueValue, itemClone);
- result.push(itemClone);
- }
- } else {
- result.push(item);
- }
+ /**
+ * MarkdownIt#utils -> utils
+ *
+ * Assorted utility functions, useful to write plugins. See details
+ * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.mjs).
+ **/
+ this.utils = utils;
+
+ /**
+ * MarkdownIt#helpers -> helpers
+ *
+ * Link components parser functions, useful to write plugins. See details
+ * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).
+ **/
+ this.helpers = assign({}, helpers);
+ this.options = {};
+ this.configure(presetName);
+ if (options) {
+ this.set(options);
}
- return result;
}
-function inlineRelevantFragmentSpreads(fragmentDefinitions, selections, selectionSetType) {
- var _a;
- const selectionSetTypeName = selectionSetType ? (0, _graphql.getNamedType)(selectionSetType).name : null;
- const outputSelections = [];
- const seenSpreads = [];
- for (let selection of selections) {
- if (selection.kind === 'FragmentSpread') {
- const fragmentName = selection.name.value;
- if (!selection.directives || selection.directives.length === 0) {
- if (seenSpreads.includes(fragmentName)) {
- continue;
- } else {
- seenSpreads.push(fragmentName);
- }
- }
- const fragmentDefinition = fragmentDefinitions[selection.name.value];
- if (fragmentDefinition) {
- const {
- typeCondition,
- directives,
- selectionSet
- } = fragmentDefinition;
- selection = {
- kind: _graphql.Kind.INLINE_FRAGMENT,
- typeCondition,
- directives,
- selectionSet
- };
- }
- }
- if (selection.kind === _graphql.Kind.INLINE_FRAGMENT && (!selection.directives || ((_a = selection.directives) === null || _a === void 0 ? void 0 : _a.length) === 0)) {
- const fragmentTypeName = selection.typeCondition ? selection.typeCondition.name.value : null;
- if (!fragmentTypeName || fragmentTypeName === selectionSetTypeName) {
- outputSelections.push(...inlineRelevantFragmentSpreads(fragmentDefinitions, selection.selectionSet.selections, selectionSetType));
- continue;
- }
+
+/** chainable
+ * MarkdownIt.set(options)
+ *
+ * Set parser options (in the same format as in constructor). Probably, you
+ * will never need it, but you can change options after constructor call.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')()
+ * .set({ html: true, breaks: true })
+ * .set({ typographer, true });
+ * ```
+ *
+ * __Note:__ To achieve the best possible performance, don't modify a
+ * `markdown-it` instance options on the fly. If you need multiple configurations
+ * it's best to create multiple instances and initialize each with separate
+ * config.
+ **/
+MarkdownIt.prototype.set = function (options) {
+ assign(this.options, options);
+ return this;
+};
+
+/** chainable, internal
+ * MarkdownIt.configure(presets)
+ *
+ * Batch load of all options and compenent settings. This is internal method,
+ * and you probably will not need it. But if you will - see available presets
+ * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
+ *
+ * We strongly recommend to use presets instead of direct config loads. That
+ * will give better compatibility with next versions.
+ **/
+MarkdownIt.prototype.configure = function (presets) {
+ const self = this;
+ if (isString(presets)) {
+ const presetName = presets;
+ presets = config[presetName];
+ if (!presets) {
+ throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name');
}
- outputSelections.push(selection);
}
- return outputSelections;
-}
-function mergeAst(documentAST, schema) {
- const typeInfo = schema ? new _graphql.TypeInfo(schema) : null;
- const fragmentDefinitions = Object.create(null);
- for (const definition of documentAST.definitions) {
- if (definition.kind === _graphql.Kind.FRAGMENT_DEFINITION) {
- fragmentDefinitions[definition.name.value] = definition;
- }
+ if (!presets) {
+ throw new Error('Wrong `markdown-it` preset, can\'t be empty');
}
- const flattenVisitors = {
- SelectionSet(node) {
- const selectionSetType = typeInfo ? typeInfo.getParentType() : null;
- let {
- selections
- } = node;
- selections = inlineRelevantFragmentSpreads(fragmentDefinitions, selections, selectionSetType);
- return Object.assign(Object.assign({}, node), {
- selections
- });
- },
- FragmentDefinition() {
- return null;
- }
- };
- const flattenedAST = (0, _graphql.visit)(documentAST, typeInfo ? (0, _graphql.visitWithTypeInfo)(typeInfo, flattenVisitors) : flattenVisitors);
- const deduplicateVisitors = {
- SelectionSet(node) {
- let {
- selections
- } = node;
- selections = uniqueBy(selections, selection => selection.alias ? selection.alias.value : selection.name.value);
- return Object.assign(Object.assign({}, node), {
- selections
- });
- },
- FragmentDefinition() {
- return null;
- }
- };
- return (0, _graphql.visit)(flattenedAST, deduplicateVisitors);
-}
-
-/***/ }),
-
-/***/ "../../graphiql-toolkit/esm/graphql-helpers/operation-name.js":
-/*!********************************************************************!*\
- !*** ../../graphiql-toolkit/esm/graphql-helpers/operation-name.js ***!
- \********************************************************************/
-/***/ (function(__unused_webpack_module, exports) {
-
-
+ if (presets.options) {
+ self.set(presets.options);
+ }
+ if (presets.components) {
+ Object.keys(presets.components).forEach(function (name) {
+ if (presets.components[name].rules) {
+ self[name].ruler.enableOnly(presets.components[name].rules);
+ }
+ if (presets.components[name].rules2) {
+ self[name].ruler2.enableOnly(presets.components[name].rules2);
+ }
+ });
+ }
+ return this;
+};
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.getSelectedOperationName = getSelectedOperationName;
-function getSelectedOperationName(prevOperations, prevSelectedOperationName, operations) {
- if (!operations || operations.length < 1) {
- return;
+/** chainable
+ * MarkdownIt.enable(list, ignoreInvalid)
+ * - list (String|Array): rule name or list of rule names to enable
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * Enable list or rules. It will automatically find appropriate components,
+ * containing rules with given names. If rule not found, and `ignoreInvalid`
+ * not set - throws exception.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')()
+ * .enable(['sub', 'sup'])
+ * .disable('smartquotes');
+ * ```
+ **/
+MarkdownIt.prototype.enable = function (list, ignoreInvalid) {
+ let result = [];
+ if (!Array.isArray(list)) {
+ list = [list];
}
- const names = operations.map(op => {
- var _a;
- return (_a = op.name) === null || _a === void 0 ? void 0 : _a.value;
+ ['core', 'block', 'inline'].forEach(function (chain) {
+ result = result.concat(this[chain].ruler.enable(list, true));
+ }, this);
+ result = result.concat(this.inline.ruler2.enable(list, true));
+ const missed = list.filter(function (name) {
+ return result.indexOf(name) < 0;
});
- if (prevSelectedOperationName && names.includes(prevSelectedOperationName)) {
- return prevSelectedOperationName;
+ if (missed.length && !ignoreInvalid) {
+ throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);
}
- if (prevSelectedOperationName && prevOperations) {
- const prevNames = prevOperations.map(op => {
- var _a;
- return (_a = op.name) === null || _a === void 0 ? void 0 : _a.value;
- });
- const prevIndex = prevNames.indexOf(prevSelectedOperationName);
- if (prevIndex !== -1 && prevIndex < names.length) {
- return names[prevIndex];
- }
+ return this;
+};
+
+/** chainable
+ * MarkdownIt.disable(list, ignoreInvalid)
+ * - list (String|Array): rule name or list of rule names to disable.
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * The same as [[MarkdownIt.enable]], but turn specified rules off.
+ **/
+MarkdownIt.prototype.disable = function (list, ignoreInvalid) {
+ let result = [];
+ if (!Array.isArray(list)) {
+ list = [list];
}
- return names[0];
-}
+ ['core', 'block', 'inline'].forEach(function (chain) {
+ result = result.concat(this[chain].ruler.disable(list, true));
+ }, this);
+ result = result.concat(this.inline.ruler2.disable(list, true));
+ const missed = list.filter(function (name) {
+ return result.indexOf(name) < 0;
+ });
+ if (missed.length && !ignoreInvalid) {
+ throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);
+ }
+ return this;
+};
-/***/ }),
+/** chainable
+ * MarkdownIt.use(plugin, params)
+ *
+ * Load specified plugin with given params into current parser instance.
+ * It's just a sugar to call `plugin(md, params)` with curring.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var iterator = require('markdown-it-for-inline');
+ * var md = require('markdown-it')()
+ * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
+ * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');
+ * });
+ * ```
+ **/
+MarkdownIt.prototype.use = function (plugin /*, params, ... */) {
+ const args = [this].concat(Array.prototype.slice.call(arguments, 1));
+ plugin.apply(plugin, args);
+ return this;
+};
-/***/ "../../graphiql-toolkit/esm/index.js":
-/*!*******************************************!*\
- !*** ../../graphiql-toolkit/esm/index.js ***!
- \*******************************************/
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+/** internal
+ * MarkdownIt.parse(src, env) -> Array
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * Parse input string and return list of block tokens (special token type
+ * "inline" will contain list of inline tokens). You should not call this
+ * method directly, until you write custom renderer (for example, to produce
+ * AST).
+ *
+ * `env` is used to pass data between "distributed" rules and return additional
+ * metadata like reference info, needed for the renderer. It also can be used to
+ * inject data in specific cases. Usually, you will be ok to pass `{}`,
+ * and then pass updated object to renderer.
+ **/
+MarkdownIt.prototype.parse = function (src, env) {
+ if (typeof src !== 'string') {
+ throw new Error('Input data should be a String');
+ }
+ const state = new this.core.State(src, this, env);
+ this.core.process(state);
+ return state.tokens;
+};
+/**
+ * MarkdownIt.render(src [, env]) -> String
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * Render markdown string into html. It does all magic for you :).
+ *
+ * `env` can be used to inject additional metadata (`{}` by default).
+ * But you will not need it with high probability. See also comment
+ * in [[MarkdownIt.parse]].
+ **/
+MarkdownIt.prototype.render = function (src, env) {
+ env = env || {};
+ return this.renderer.render(this.parse(src, env), this.options, env);
+};
+/** internal
+ * MarkdownIt.parseInline(src, env) -> Array
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the
+ * block tokens list with the single `inline` element, containing parsed inline
+ * tokens in `children` property. Also updates `env` object.
+ **/
+MarkdownIt.prototype.parseInline = function (src, env) {
+ const state = new this.core.State(src, this, env);
+ state.inlineMode = true;
+ this.core.process(state);
+ return state.tokens;
+};
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-var _asyncHelpers = __webpack_require__(/*! ./async-helpers */ "../../graphiql-toolkit/esm/async-helpers/index.js");
-Object.keys(_asyncHelpers).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _asyncHelpers[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _asyncHelpers[key];
- }
- });
-});
-var _createFetcher = __webpack_require__(/*! ./create-fetcher */ "../../graphiql-toolkit/esm/create-fetcher/index.js");
-Object.keys(_createFetcher).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _createFetcher[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _createFetcher[key];
- }
- });
-});
-var _format = __webpack_require__(/*! ./format */ "../../graphiql-toolkit/esm/format/index.js");
-Object.keys(_format).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _format[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _format[key];
- }
- });
-});
-var _graphqlHelpers = __webpack_require__(/*! ./graphql-helpers */ "../../graphiql-toolkit/esm/graphql-helpers/index.js");
-Object.keys(_graphqlHelpers).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _graphqlHelpers[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _graphqlHelpers[key];
- }
- });
-});
-var _storage = __webpack_require__(/*! ./storage */ "../../graphiql-toolkit/esm/storage/index.js");
-Object.keys(_storage).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _storage[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _storage[key];
- }
- });
-});
+/**
+ * MarkdownIt.renderInline(src [, env]) -> String
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * Similar to [[MarkdownIt.render]] but for single paragraph content. Result
+ * will NOT be wrapped into `' + md.utils.escapeHtml(str) + '