@digipair/skill-web-jsoneditor 0.63.1 → 0.64.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs.js +471 -221
  2. package/index.esm.js +471 -221
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -445,7 +445,7 @@ var _Symbol, _a$2, _a1;
445
445
  * @license
446
446
  * Copyright 2017 Google LLC
447
447
  * SPDX-License-Identifier: BSD-3-Clause
448
- */ var i$5 = Object.is, e$2 = Object.defineProperty, r$5 = Object.getOwnPropertyDescriptor, h$2 = Object.getOwnPropertyNames, o$3 = Object.getOwnPropertySymbols, n$3 = Object.getPrototypeOf, a$2 = globalThis, c$2 = a$2.trustedTypes, l$3 = c$2 ? c$2.emptyScript : "", p$3 = a$2.reactiveElementPolyfillSupport, d$2 = function(t, s) {
448
+ */ var i$4 = Object.is, e$2 = Object.defineProperty, r$5 = Object.getOwnPropertyDescriptor, h$2 = Object.getOwnPropertyNames, o$3 = Object.getOwnPropertySymbols, n$3 = Object.getPrototypeOf, a$2 = globalThis, c$2 = a$2.trustedTypes, l$3 = c$2 ? c$2.emptyScript : "", p$3 = a$2.reactiveElementPolyfillSupport, d$2 = function(t, s) {
449
449
  return t;
450
450
  }, u$2 = {
451
451
  toAttribute: function toAttribute(t, s) {
@@ -479,7 +479,7 @@ var _Symbol, _a$2, _a1;
479
479
  return i;
480
480
  }
481
481
  }, f$2 = function(t, s) {
482
- return !i$5(t, s);
482
+ return !i$4(t, s);
483
483
  }, y$2 = {
484
484
  attribute: !0,
485
485
  type: String,
@@ -1154,7 +1154,7 @@ function _create_super$c(Derived) {
1154
1154
  };
1155
1155
  }
1156
1156
  var _t$1;
1157
- var t$3 = globalThis, i$4 = t$3.trustedTypes, s$1 = i$4 ? i$4.createPolicy("lit-html", {
1157
+ var t$3 = globalThis, i$3 = t$3.trustedTypes, s$1 = i$3 ? i$3.createPolicy("lit-html", {
1158
1158
  createHTML: function(t) {
1159
1159
  return t;
1160
1160
  }
@@ -1245,7 +1245,7 @@ var N = /*#__PURE__*/ function() {
1245
1245
  if ($$1.test(r.tagName)) {
1246
1246
  var t3 = r.textContent.split(h$1), s2 = t3.length - 1;
1247
1247
  if (s2 > 0) {
1248
- r.textContent = i$4 ? i$4.emptyScript : "";
1248
+ r.textContent = i$3 ? i$3.emptyScript : "";
1249
1249
  for(var i2 = 0; i2 < s2; i2++)r.append(t3[i2], l$2()), C$2.nextNode(), d.push({
1250
1250
  type: 2,
1251
1251
  index: ++c
@@ -1802,8 +1802,8 @@ var _globalThis1;
1802
1802
  r$3._$litElement$ = !0, r$3["finalized"] = !0, (_globalThis_litElementHydrateSupport = (_globalThis = globalThis).litElementHydrateSupport) === null || _globalThis_litElementHydrateSupport === void 0 ? void 0 : _globalThis_litElementHydrateSupport.call(_globalThis, {
1803
1803
  LitElement: r$3
1804
1804
  });
1805
- var i$3 = globalThis.litElementPolyfillSupport;
1806
- i$3 === null || i$3 === void 0 ? void 0 : i$3({
1805
+ var i$2 = globalThis.litElementPolyfillSupport;
1806
+ i$2 === null || i$2 === void 0 ? void 0 : i$2({
1807
1807
  LitElement: r$3
1808
1808
  });
1809
1809
  var _litElementVersions;
@@ -3217,6 +3217,12 @@ function isControlCharacter(code) {
3217
3217
  */ function isWhitespace(code) {
3218
3218
  return code === codeSpace || code === codeNewline || code === codeTab || code === codeReturn;
3219
3219
  }
3220
+ /**
3221
+ * Check if the given character is a whitespace character like space or tab,
3222
+ * but NOT a newline
3223
+ */ function isWhitespaceExceptNewline(code) {
3224
+ return code === codeSpace || code === codeTab || code === codeReturn;
3225
+ }
3220
3226
  /**
3221
3227
  * Check if the given character is a special whitespace character, some
3222
3228
  * unicode variant
@@ -3355,28 +3361,32 @@ var escapeCharacters = {
3355
3361
  return processed;
3356
3362
  }
3357
3363
  function parseWhitespaceAndSkipComments() {
3364
+ var skipNewline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3358
3365
  var start = i;
3359
- var changed = parseWhitespace();
3366
+ var changed = parseWhitespace(skipNewline);
3360
3367
  do {
3361
3368
  changed = parseComment();
3362
3369
  if (changed) {
3363
- changed = parseWhitespace();
3370
+ changed = parseWhitespace(skipNewline);
3364
3371
  }
3365
3372
  }while (changed);
3366
3373
  return i > start;
3367
3374
  }
3368
- function parseWhitespace() {
3375
+ function parseWhitespace(skipNewline) {
3376
+ var _isWhiteSpace = skipNewline ? isWhitespace : isWhitespaceExceptNewline;
3369
3377
  var whitespace = "";
3370
- var normal;
3371
- // biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
3372
- while((normal = isWhitespace(text.charCodeAt(i))) || isSpecialWhitespace(text.charCodeAt(i))){
3373
- if (normal) {
3378
+ while(true){
3379
+ var c = text.charCodeAt(i);
3380
+ if (_isWhiteSpace(c)) {
3374
3381
  whitespace += text[i];
3375
- } else {
3382
+ i++;
3383
+ } else if (isSpecialWhitespace(c)) {
3376
3384
  // repair special whitespace
3377
3385
  whitespace += " ";
3386
+ i++;
3387
+ } else {
3388
+ break;
3378
3389
  }
3379
- i++;
3380
3390
  }
3381
3391
  if (whitespace.length > 0) {
3382
3392
  output += whitespace;
@@ -3582,9 +3592,11 @@ var escapeCharacters = {
3582
3592
  * - If it turns out that the string does not have a valid end quote followed
3583
3593
  * by a delimiter (which should be the case), the function runs again in a
3584
3594
  * more conservative way, stopping the string at the first next delimiter
3585
- * and fixing the string by inserting a quote there.
3595
+ * and fixing the string by inserting a quote there, or stopping at a
3596
+ * stop index detected in the first iteration.
3586
3597
  */ function parseString() {
3587
3598
  var stopAtDelimiter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3599
+ var stopAtIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
3588
3600
  var skipEscapeChars = text.charCodeAt(i) === codeBackslash;
3589
3601
  if (skipEscapeChars) {
3590
3602
  // repair: remove the first escape character
@@ -3618,6 +3630,12 @@ var escapeCharacters = {
3618
3630
  output += str;
3619
3631
  return true;
3620
3632
  // biome-ignore lint/style/noUselessElse: <explanation>
3633
+ } else if (i === stopAtIndex) {
3634
+ // use the stop index detected in the first iteration, and repair end quote
3635
+ str = insertBeforeLastWhitespace(str, '"');
3636
+ output += str;
3637
+ return true;
3638
+ // biome-ignore lint/style/noUselessElse: <explanation>
3621
3639
  } else if (isEndQuote(text.charCodeAt(i))) {
3622
3640
  // end quote
3623
3641
  // let us check what is before and after the quote to verify whether this is a legit end quote
@@ -3626,14 +3644,24 @@ var escapeCharacters = {
3626
3644
  str += '"';
3627
3645
  i++;
3628
3646
  output += str;
3629
- parseWhitespaceAndSkipComments();
3647
+ parseWhitespaceAndSkipComments(false);
3630
3648
  if (stopAtDelimiter || i >= text.length || isDelimiter(text.charAt(i)) || isQuote(text.charCodeAt(i)) || isDigit(text.charCodeAt(i))) {
3631
- // The quote is followed by the end of the text, a delimiter, or a next value
3632
- // so the quote is indeed the end of the string
3649
+ // The quote is followed by the end of the text, a delimiter,
3650
+ // or a next value. So the quote is indeed the end of the string.
3633
3651
  parseConcatenatedString();
3634
3652
  return true;
3635
3653
  }
3636
- if (isDelimiter(text.charAt(prevNonWhitespaceIndex(iQuote - 1)))) {
3654
+ var iPrevChar = prevNonWhitespaceIndex(iQuote - 1);
3655
+ var prevChar = text.charAt(iPrevChar);
3656
+ if (prevChar === ",") {
3657
+ // A comma followed by a quote, like '{"a":"b,c,"d":"e"}'.
3658
+ // We assume that the quote is a start quote, and that the end quote
3659
+ // should have been located right before the comma but is missing.
3660
+ i = iBefore;
3661
+ output = output.substring(0, oBefore);
3662
+ return parseString(false, iPrevChar);
3663
+ }
3664
+ if (isDelimiter(prevChar)) {
3637
3665
  // This is not the right end quote: it is preceded by a delimiter,
3638
3666
  // and NOT followed by a delimiter. So, there is an end quote missing
3639
3667
  // parse the string again and then stop at the first next delimiter
@@ -8893,9 +8921,90 @@ function memoizeOne(resultFn, isEqual) {
8893
8921
  return memoized;
8894
8922
  }
8895
8923
 
8896
- /**
8897
- The data structure for documents. @nonabstract
8898
- */ function _array_like_to_array$f(arr, len) {
8924
+ // These are filled with ranges (rangeFrom[i] up to but not including
8925
+ // rangeTo[i]) of code points that count as extending characters.
8926
+ var rangeFrom = [], rangeTo = [];
8927
+ (function() {
8928
+ // Compressed representation of the Grapheme_Cluster_Break=Extend
8929
+ // information from
8930
+ // http://www.unicode.org/Public/16.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.
8931
+ // Each pair of elements represents a range, as an offet from the
8932
+ // previous range and a length. Numbers are in base-36, with the empty
8933
+ // string being a shorthand for 1.
8934
+ var numbers = "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(s) {
8935
+ return s ? parseInt(s, 36) : 1;
8936
+ });
8937
+ for(var i = 0, n = 0; i < numbers.length; i++)(i % 2 ? rangeTo : rangeFrom).push(n = n + numbers[i]);
8938
+ })();
8939
+ function isExtendingChar(code) {
8940
+ if (code < 768) return false;
8941
+ for(var from = 0, to = rangeFrom.length;;){
8942
+ var mid = from + to >> 1;
8943
+ if (code < rangeFrom[mid]) to = mid;
8944
+ else if (code >= rangeTo[mid]) from = mid + 1;
8945
+ else return true;
8946
+ if (from == to) return false;
8947
+ }
8948
+ }
8949
+ function isRegionalIndicator(code) {
8950
+ return code >= 0x1F1E6 && code <= 0x1F1FF;
8951
+ }
8952
+ var ZWJ = 0x200d;
8953
+ function findClusterBreak$1(str, pos) {
8954
+ var forward = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true, includeExtending = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
8955
+ return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);
8956
+ }
8957
+ function nextClusterBreak(str, pos, includeExtending) {
8958
+ if (pos == str.length) return pos;
8959
+ // If pos is in the middle of a surrogate pair, move to its start
8960
+ if (pos && surrogateLow$1(str.charCodeAt(pos)) && surrogateHigh$1(str.charCodeAt(pos - 1))) pos--;
8961
+ var prev = codePointAt$1(str, pos);
8962
+ pos += codePointSize$1(prev);
8963
+ while(pos < str.length){
8964
+ var next = codePointAt$1(str, pos);
8965
+ if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {
8966
+ pos += codePointSize$1(next);
8967
+ prev = next;
8968
+ } else if (isRegionalIndicator(next)) {
8969
+ var countBefore = 0, i = pos - 2;
8970
+ while(i >= 0 && isRegionalIndicator(codePointAt$1(str, i))){
8971
+ countBefore++;
8972
+ i -= 2;
8973
+ }
8974
+ if (countBefore % 2 == 0) break;
8975
+ else pos += 2;
8976
+ } else {
8977
+ break;
8978
+ }
8979
+ }
8980
+ return pos;
8981
+ }
8982
+ function prevClusterBreak(str, pos, includeExtending) {
8983
+ while(pos > 0){
8984
+ var found = nextClusterBreak(str, pos - 2, includeExtending);
8985
+ if (found < pos) return found;
8986
+ pos--;
8987
+ }
8988
+ return 0;
8989
+ }
8990
+ function codePointAt$1(str, pos) {
8991
+ var code0 = str.charCodeAt(pos);
8992
+ if (!surrogateHigh$1(code0) || pos + 1 == str.length) return code0;
8993
+ var code1 = str.charCodeAt(pos + 1);
8994
+ if (!surrogateLow$1(code1)) return code0;
8995
+ return (code0 - 0xd800 << 10) + (code1 - 0xdc00) + 0x10000;
8996
+ }
8997
+ function surrogateLow$1(ch) {
8998
+ return ch >= 0xDC00 && ch < 0xE000;
8999
+ }
9000
+ function surrogateHigh$1(ch) {
9001
+ return ch >= 0xD800 && ch < 0xDC00;
9002
+ }
9003
+ function codePointSize$1(code) {
9004
+ return code < 0x10000 ? 1 : 2;
9005
+ }
9006
+
9007
+ function _array_like_to_array$f(arr, len) {
8899
9008
  if (len == null || len > arr.length) len = arr.length;
8900
9009
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8901
9010
  return arr2;
@@ -9102,7 +9211,9 @@ function _create_super$9(Derived) {
9102
9211
  return _possible_constructor_return$9(this, result);
9103
9212
  };
9104
9213
  }
9105
- var Text = /*#__PURE__*/ function() {
9214
+ /**
9215
+ The data structure for documents. @nonabstract
9216
+ */ var Text = /*#__PURE__*/ function() {
9106
9217
  function Text() {
9107
9218
  _class_call_check$g(this, Text);
9108
9219
  }
@@ -9948,25 +10059,6 @@ function clip(text, from, to) {
9948
10059
  Math.max(from, Math.min(text.length, to))
9949
10060
  ];
9950
10061
  }
9951
- // Compressed representation of the Grapheme_Cluster_Break=Extend
9952
- // information from
9953
- // http://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.
9954
- // Each pair of elements represents a range, as an offet from the
9955
- // previous range and a length. Numbers are in base-36, with the empty
9956
- // string being a shorthand for 1.
9957
- var extend = /*@__PURE__*/ "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(s) {
9958
- return s ? parseInt(s, 36) : 1;
9959
- });
9960
- // Convert offsets into absolute values
9961
- for(var i$2 = 1; i$2 < extend.length; i$2++)extend[i$2] += extend[i$2 - 1];
9962
- function isExtendingChar(code) {
9963
- for(var i = 1; i < extend.length; i += 2)if (extend[i] > code) return extend[i - 1] <= code;
9964
- return false;
9965
- }
9966
- function isRegionalIndicator(code) {
9967
- return code >= 0x1F1E6 && code <= 0x1F1FF;
9968
- }
9969
- var ZWJ = 0x200d;
9970
10062
  /**
9971
10063
  Returns a next grapheme cluster break _after_ (not equal to)
9972
10064
  `pos`, if `forward` is true, or before otherwise. Returns `pos`
@@ -9976,40 +10068,7 @@ Moves across surrogate pairs, extending characters (when
9976
10068
  joiners, and flag emoji.
9977
10069
  */ function findClusterBreak(str, pos) {
9978
10070
  var forward = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true, includeExtending = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
9979
- return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);
9980
- }
9981
- function nextClusterBreak(str, pos, includeExtending) {
9982
- if (pos == str.length) return pos;
9983
- // If pos is in the middle of a surrogate pair, move to its start
9984
- if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) pos--;
9985
- var prev = codePointAt(str, pos);
9986
- pos += codePointSize(prev);
9987
- while(pos < str.length){
9988
- var next = codePointAt(str, pos);
9989
- if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {
9990
- pos += codePointSize(next);
9991
- prev = next;
9992
- } else if (isRegionalIndicator(next)) {
9993
- var countBefore = 0, i = pos - 2;
9994
- while(i >= 0 && isRegionalIndicator(codePointAt(str, i))){
9995
- countBefore++;
9996
- i -= 2;
9997
- }
9998
- if (countBefore % 2 == 0) break;
9999
- else pos += 2;
10000
- } else {
10001
- break;
10002
- }
10003
- }
10004
- return pos;
10005
- }
10006
- function prevClusterBreak(str, pos, includeExtending) {
10007
- while(pos > 0){
10008
- var found = nextClusterBreak(str, pos - 2, includeExtending);
10009
- if (found < pos) return found;
10010
- pos--;
10011
- }
10012
- return 0;
10071
+ return findClusterBreak$1(str, pos, forward, includeExtending);
10013
10072
  }
10014
10073
  function surrogateLow(ch) {
10015
10074
  return ch >= 0xDC00 && ch < 0xE000;
@@ -10038,7 +10097,7 @@ respresents it (like
10038
10097
  return String.fromCharCode((code >> 10) + 0xd800, (code & 1023) + 0xdc00);
10039
10098
  }
10040
10099
  /**
10041
- The amount of positions a character takes up a JavaScript string.
10100
+ The amount of positions a character takes up in a JavaScript string.
10042
10101
  */ function codePointSize(code) {
10043
10102
  return code < 0x10000 ? 1 : 2;
10044
10103
  }
@@ -10170,7 +10229,7 @@ applied, but is cheaper to store and manipulate.
10170
10229
  Map this description, which should start with the same document
10171
10230
  as `other`, over another set of changes, so that it can be
10172
10231
  applied after it. When `before` is true, map as if the changes
10173
- in `other` happened before the ones in `this`.
10232
+ in `this` happened before the ones in `other`.
10174
10233
  */ key: "mapDesc",
10175
10234
  value: function mapDesc(other) {
10176
10235
  var before = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
@@ -10545,7 +10604,7 @@ function addSection(sections, len, ins) {
10545
10604
  if (len == 0 && ins <= 0) return;
10546
10605
  var last = sections.length - 2;
10547
10606
  if (last >= 0 && ins <= 0 && ins == sections[last + 1]) sections[last] += len;
10548
- else if (len == 0 && sections[last] == 0) sections[last + 1] += ins;
10607
+ else if (last >= 0 && len == 0 && sections[last] == 0) sections[last + 1] += ins;
10549
10608
  else if (forceJoin) {
10550
10609
  sections[last] += len;
10551
10610
  sections[last + 1] += ins;
@@ -10595,7 +10654,9 @@ function mapSet(setA, setB, before) {
10595
10654
  // content has been inserted already, and refers to the section
10596
10655
  // index.
10597
10656
  for(var inserted = -1;;){
10598
- if (a.ins == -1 && b.ins == -1) {
10657
+ if (a.done && b.len || b.done && a.len) {
10658
+ throw new Error("Mismatched change set lengths");
10659
+ } else if (a.ins == -1 && b.ins == -1) {
10599
10660
  // Move across ranges skipped by both sets.
10600
10661
  var len = Math.min(a.len, b.len);
10601
10662
  addSection(sections, len, -1);
@@ -14002,7 +14063,7 @@ function compare(a, startA, b, startB, length, comparator) {
14002
14063
  var endB = startB + length;
14003
14064
  var pos = startB, dPos = startB - startA;
14004
14065
  for(;;){
14005
- var diff = a.to + dPos - b.to || a.endSide - b.endSide;
14066
+ var dEnd = a.to + dPos - b.to, diff = dEnd || a.endSide - b.endSide;
14006
14067
  var end = diff < 0 ? a.to + dPos : b.to, clipEnd = Math.min(end, endB);
14007
14068
  if (a.point || b.point) {
14008
14069
  if (!(a.point && b.point && (a.point == b.point || a.point.eq(b.point)) && sameValues(a.activeForPoint(a.to), b.activeForPoint(b.to)))) comparator.comparePoint(pos, clipEnd, a.point, b.point);
@@ -14010,6 +14071,7 @@ function compare(a, startA, b, startB, length, comparator) {
14010
14071
  if (clipEnd > pos && !sameValues(a.active, b.active)) comparator.compareRange(pos, clipEnd, a.active, b.active);
14011
14072
  }
14012
14073
  if (end > endB) break;
14074
+ if ((dEnd || a.openEnd != b.openEnd) && comparator.boundChange) comparator.boundChange(end);
14013
14075
  pos = end;
14014
14076
  if (diff <= 0) a.next();
14015
14077
  if (diff >= 0) b.next();
@@ -14042,7 +14104,7 @@ taking extending characters and tab size into account.
14042
14104
  */ function countColumn(string, tabSize) {
14043
14105
  var to = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : string.length;
14044
14106
  var n = 0;
14045
- for(var i = 0; i < to;){
14107
+ for(var i = 0; i < to && i < string.length;){
14046
14108
  if (string.charCodeAt(i) == 9) {
14047
14109
  n += tabSize - n % tabSize;
14048
14110
  i++;
@@ -17964,6 +18026,17 @@ class, which describe what happened, whenever the view is updated.
17964
18026
  return (this.flags & 4 /* UpdateFlag.Viewport */ ) > 0;
17965
18027
  }
17966
18028
  },
18029
+ {
18030
+ key: "viewportMoved",
18031
+ get: /**
18032
+ Returns true when
18033
+ [`viewportChanged`](https://codemirror.net/6/docs/ref/#view.ViewUpdate.viewportChanged) is true
18034
+ and the viewport change is not just the result of mapping it in
18035
+ response to document changes.
18036
+ */ function get() {
18037
+ return (this.flags & 8 /* UpdateFlag.ViewportMoved */ ) > 0;
18038
+ }
18039
+ },
17967
18040
  {
17968
18041
  key: "heightChanged",
17969
18042
  get: /**
@@ -17979,7 +18052,7 @@ class, which describe what happened, whenever the view is updated.
17979
18052
  Returns true when the document was modified or the size of the
17980
18053
  editor, or elements within the editor, changed.
17981
18054
  */ function get() {
17982
- return this.docChanged || (this.flags & (8 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */ )) > 0;
18055
+ return this.docChanged || (this.flags & (16 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */ )) > 0;
17983
18056
  }
17984
18057
  },
17985
18058
  {
@@ -18338,7 +18411,7 @@ var DocView = /*#__PURE__*/ function(ContentView1) {
18338
18411
  var mustRead = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false, fromPointer = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
18339
18412
  if (mustRead || !this.view.observer.selectionRange.focusNode) this.view.observer.readSelectionRange();
18340
18413
  var activeElt = this.view.root.activeElement, focused = activeElt == this.dom;
18341
- var selectionNotFocus = !focused && hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));
18414
+ var selectionNotFocus = !focused && !(this.view.state.facet(editable) || this.dom.tabIndex > -1) && hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));
18342
18415
  if (!(focused || fromPointer || selectionNotFocus)) return;
18343
18416
  var force = this.forceSelection;
18344
18417
  this.forceSelection = false;
@@ -18832,6 +18905,12 @@ var DecorationComparator$1 = /*#__PURE__*/ function() {
18832
18905
  value: function comparePoint(from, to) {
18833
18906
  addRange(from, to, this.changes);
18834
18907
  }
18908
+ },
18909
+ {
18910
+ key: "boundChange",
18911
+ value: function boundChange(pos) {
18912
+ addRange(pos, pos, this.changes);
18913
+ }
18835
18914
  }
18836
18915
  ]);
18837
18916
  return DecorationComparator;
@@ -19496,6 +19575,17 @@ function applyDOMChange(view, domChange) {
19496
19575
  to: sel.to,
19497
19576
  insert: view.state.doc.slice(sel.from, sel.to)
19498
19577
  };
19578
+ } else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
19579
+ // Detect insert-period-on-double-space Mac and Android behavior,
19580
+ // and transform it into a regular space insert.
19581
+ if (newSel && change.insert.length == 2) newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
19582
+ change = {
19583
+ from: change.from,
19584
+ to: change.to,
19585
+ insert: Text.of([
19586
+ change.insert.toString().replace(".", " ")
19587
+ ])
19588
+ };
19499
19589
  } else if (change && change.from >= sel.from && change.to <= sel.to && (change.from != sel.from || change.to != sel.to) && sel.to - sel.from - (change.to - change.from) <= 4) {
19500
19590
  // If the change is inside the selection and covers most of it,
19501
19591
  // assume it is a selection replace (with identical characters at
@@ -19505,17 +19595,6 @@ function applyDOMChange(view, domChange) {
19505
19595
  to: sel.to,
19506
19596
  insert: view.state.doc.slice(sel.from, change.from).append(change.insert).append(view.state.doc.slice(change.to, sel.to))
19507
19597
  };
19508
- } else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
19509
- // Detect insert-period-on-double-space Mac and Android behavior,
19510
- // and transform it into a regular space insert.
19511
- if (newSel && change.insert.length == 2) newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
19512
- change = {
19513
- from: sel.from,
19514
- to: sel.to,
19515
- insert: Text.of([
19516
- " "
19517
- ])
19518
- };
19519
19598
  } else if (browser.chrome && change && change.from == change.to && change.from == sel.head && change.insert.toString() == "\n " && view.lineWrapping) {
19520
19599
  // In Chrome, if you insert a space at the start of a wrapped
19521
19600
  // line, it will actually insert a newline and a space, causing a
@@ -21737,6 +21816,10 @@ function visiblePixelRange(dom, paddingTop) {
21737
21816
  bottom: Math.max(top, bottom) - (rect.top + paddingTop)
21738
21817
  };
21739
21818
  }
21819
+ function inWindow(elt) {
21820
+ var rect = elt.getBoundingClientRect(), win = elt.ownerDocument.defaultView || window;
21821
+ return rect.left < win.innerWidth && rect.right > 0 && rect.top < win.innerHeight && rect.bottom > 0;
21822
+ }
21740
21823
  function fullPixelRange(dom, paddingTop) {
21741
21824
  var rect = dom.getBoundingClientRect();
21742
21825
  return {
@@ -21965,7 +22048,7 @@ var ViewState = /*#__PURE__*/ function() {
21965
22048
  update.flags |= this.updateForViewport();
21966
22049
  if (viewportChange || !update.changes.empty || update.flags & 2 /* UpdateFlag.Height */ ) this.updateViewportLines();
21967
22050
  if (this.lineGaps.length || this.viewport.to - this.viewport.from > 2000 /* LG.Margin */ << 1) this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps, update.changes)));
21968
- update.flags |= this.computeVisibleRanges();
22051
+ update.flags |= this.computeVisibleRanges(update.changes);
21969
22052
  if (scrollTarget) this.scrollTarget = scrollTarget;
21970
22053
  if (!this.mustEnforceCursorAssoc && update.selectionSet && update.view.lineWrapping && update.state.selection.main.empty && update.state.selection.main.assoc && !update.state.facet(nativeSelectionHidden)) this.mustEnforceCursorAssoc = true;
21971
22054
  }
@@ -21988,7 +22071,7 @@ var ViewState = /*#__PURE__*/ function() {
21988
22071
  if (scaleX > .005 && Math.abs(this.scaleX - scaleX) > .005 || scaleY > .005 && Math.abs(this.scaleY - scaleY) > .005) {
21989
22072
  this.scaleX = scaleX;
21990
22073
  this.scaleY = scaleY;
21991
- result |= 8 /* UpdateFlag.Geometry */ ;
22074
+ result |= 16 /* UpdateFlag.Geometry */ ;
21992
22075
  refresh = measureContent = true;
21993
22076
  }
21994
22077
  }
@@ -21998,12 +22081,12 @@ var ViewState = /*#__PURE__*/ function() {
21998
22081
  if (this.paddingTop != paddingTop || this.paddingBottom != paddingBottom) {
21999
22082
  this.paddingTop = paddingTop;
22000
22083
  this.paddingBottom = paddingBottom;
22001
- result |= 8 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */ ;
22084
+ result |= 16 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */ ;
22002
22085
  }
22003
22086
  if (this.editorWidth != view.scrollDOM.clientWidth) {
22004
22087
  if (oracle.lineWrapping) measureContent = true;
22005
22088
  this.editorWidth = view.scrollDOM.clientWidth;
22006
- result |= 8 /* UpdateFlag.Geometry */ ;
22089
+ result |= 16 /* UpdateFlag.Geometry */ ;
22007
22090
  }
22008
22091
  var scrollTop = view.scrollDOM.scrollTop * this.scaleY;
22009
22092
  if (this.scrollTop != scrollTop) {
@@ -22020,12 +22103,12 @@ var ViewState = /*#__PURE__*/ function() {
22020
22103
  this.inView = inView;
22021
22104
  if (inView) measureContent = true;
22022
22105
  }
22023
- if (!this.inView && !this.scrollTarget) return 0;
22106
+ if (!this.inView && !this.scrollTarget && !inWindow(view.dom)) return 0;
22024
22107
  var contentWidth = domRect.width;
22025
22108
  if (this.contentDOMWidth != contentWidth || this.editorHeight != view.scrollDOM.clientHeight) {
22026
22109
  this.contentDOMWidth = domRect.width;
22027
22110
  this.editorHeight = view.scrollDOM.clientHeight;
22028
- result |= 8 /* UpdateFlag.Geometry */ ;
22111
+ result |= 16 /* UpdateFlag.Geometry */ ;
22029
22112
  }
22030
22113
  if (measureContent) {
22031
22114
  var lineHeights = view.docView.measureVisibleLineHeights(this.viewport);
@@ -22035,7 +22118,7 @@ var ViewState = /*#__PURE__*/ function() {
22035
22118
  refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, textHeight, contentWidth / charWidth, lineHeights);
22036
22119
  if (refresh) {
22037
22120
  view.docView.minWidth = 0;
22038
- result |= 8 /* UpdateFlag.Geometry */ ;
22121
+ result |= 16 /* UpdateFlag.Geometry */ ;
22039
22122
  }
22040
22123
  }
22041
22124
  if (dTop > 0 && dBottom > 0) bias = Math.max(dTop, dBottom);
@@ -22346,7 +22429,7 @@ var ViewState = /*#__PURE__*/ function() {
22346
22429
  },
22347
22430
  {
22348
22431
  key: "computeVisibleRanges",
22349
- value: function computeVisibleRanges() {
22432
+ value: function computeVisibleRanges(changes) {
22350
22433
  var deco = this.stateDeco;
22351
22434
  if (this.lineGaps.length) deco = deco.concat(this.lineGapDeco);
22352
22435
  var ranges = [];
@@ -22359,11 +22442,20 @@ var ViewState = /*#__PURE__*/ function() {
22359
22442
  },
22360
22443
  point: function point() {}
22361
22444
  }, 20);
22362
- var changed = ranges.length != this.visibleRanges.length || this.visibleRanges.some(function(r, i) {
22363
- return r.from != ranges[i].from || r.to != ranges[i].to;
22364
- });
22445
+ var changed = 0;
22446
+ if (ranges.length != this.visibleRanges.length) {
22447
+ changed = 8 /* UpdateFlag.ViewportMoved */ | 4 /* UpdateFlag.Viewport */ ;
22448
+ } else {
22449
+ for(var i = 0; i < ranges.length && !(changed & 8 /* UpdateFlag.ViewportMoved */ ); i++){
22450
+ var old = this.visibleRanges[i], nw = ranges[i];
22451
+ if (old.from != nw.from || old.to != nw.to) {
22452
+ changed |= 4 /* UpdateFlag.Viewport */ ;
22453
+ if (!(changes && changes.mapPos(old.from, -1) == nw.from && changes.mapPos(old.to, 1) == nw.to)) changed |= 8 /* UpdateFlag.ViewportMoved */ ;
22454
+ }
22455
+ }
22456
+ }
22365
22457
  this.visibleRanges = ranges;
22366
- return changed ? 4 /* UpdateFlag.Viewport */ : 0;
22458
+ return changed;
22367
22459
  }
22368
22460
  },
22369
22461
  {
@@ -23613,6 +23705,9 @@ var EditContextManager = /*#__PURE__*/ function() {
23613
23705
  // user action on some Android keyboards)
23614
23706
  this.pendingContextChange = null;
23615
23707
  this.handlers = Object.create(null);
23708
+ // Kludge to work around the fact that EditContext does not respond
23709
+ // well to having its content updated during a composition (see #1472)
23710
+ this.composing = null;
23616
23711
  this.resetRange(view.state);
23617
23712
  var context = this.editContext = new window.EditContext({
23618
23713
  text: view.state.doc.sliceString(this.from, this.to),
@@ -23620,10 +23715,16 @@ var EditContextManager = /*#__PURE__*/ function() {
23620
23715
  selectionEnd: this.toContextPos(view.state.selection.main.head)
23621
23716
  });
23622
23717
  this.handlers.textupdate = function(e) {
23623
- var anchor = view.state.selection.main.anchor;
23718
+ var main = view.state.selection.main, anchor = main.anchor, head = main.head;
23719
+ var from = _this.toEditorPos(e.updateRangeStart), to = _this.toEditorPos(e.updateRangeEnd);
23720
+ if (view.inputState.composing >= 0 && !_this.composing) _this.composing = {
23721
+ contextBase: e.updateRangeStart,
23722
+ editorBase: from,
23723
+ drifted: false
23724
+ };
23624
23725
  var change = {
23625
- from: _this.toEditorPos(e.updateRangeStart),
23626
- to: _this.toEditorPos(e.updateRangeEnd),
23726
+ from: from,
23727
+ to: to,
23627
23728
  insert: Text.of(e.text.split("\n"))
23628
23729
  };
23629
23730
  // If the window doesn't include the anchor, assume changes
@@ -23631,9 +23732,26 @@ var EditContextManager = /*#__PURE__*/ function() {
23631
23732
  if (change.from == _this.from && anchor < _this.from) change.from = anchor;
23632
23733
  else if (change.to == _this.to && anchor > _this.to) change.to = anchor;
23633
23734
  // Edit contexts sometimes fire empty changes
23634
- if (change.from == change.to && !change.insert.length) return;
23735
+ if (change.from == change.to && !change.insert.length) {
23736
+ var newSel = EditorSelection.single(_this.toEditorPos(e.selectionStart), _this.toEditorPos(e.selectionEnd));
23737
+ if (!newSel.main.eq(main)) view.dispatch({
23738
+ selection: newSel,
23739
+ userEvent: "select"
23740
+ });
23741
+ return;
23742
+ }
23743
+ if ((browser.mac || browser.android) && change.from == head - 1 && /^\. ?$/.test(e.text) && view.contentDOM.getAttribute("autocorrect") == "off") change = {
23744
+ from: from,
23745
+ to: to,
23746
+ insert: Text.of([
23747
+ e.text.replace(".", " ")
23748
+ ])
23749
+ };
23635
23750
  _this.pendingContextChange = change;
23636
- if (!view.state.readOnly) applyDOMChangeInner(view, change, EditorSelection.single(_this.toEditorPos(e.selectionStart), _this.toEditorPos(e.selectionEnd)));
23751
+ if (!view.state.readOnly) {
23752
+ var newLen = _this.to - _this.from + (change.to - change.from + change.insert.length);
23753
+ applyDOMChangeInner(view, change, EditorSelection.single(_this.toEditorPos(e.selectionStart, newLen), _this.toEditorPos(e.selectionEnd, newLen)));
23754
+ }
23637
23755
  // If the transaction didn't flush our change, revert it so
23638
23756
  // that the context is in sync with the editor state again.
23639
23757
  if (_this.pendingContextChange) {
@@ -23658,12 +23776,15 @@ var EditContextManager = /*#__PURE__*/ function() {
23658
23776
  var format = _step.value;
23659
23777
  var lineStyle = format.underlineStyle, thickness = format.underlineThickness;
23660
23778
  if (lineStyle != "None" && thickness != "None") {
23661
- var style = "text-decoration: underline ".concat(lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : "").concat(thickness == "Thin" ? 1 : 2, "px");
23662
- deco.push(Decoration.mark({
23663
- attributes: {
23664
- style: style
23665
- }
23666
- }).range(_this.toEditorPos(format.rangeStart), _this.toEditorPos(format.rangeEnd)));
23779
+ var from = _this.toEditorPos(format.rangeStart), to = _this.toEditorPos(format.rangeEnd);
23780
+ if (from < to) {
23781
+ var style = "text-decoration: underline ".concat(lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : "").concat(thickness == "Thin" ? 1 : 2, "px");
23782
+ deco.push(Decoration.mark({
23783
+ attributes: {
23784
+ style: style
23785
+ }
23786
+ }).range(from, to));
23787
+ }
23667
23788
  }
23668
23789
  }
23669
23790
  } catch (err) {
@@ -23693,6 +23814,11 @@ var EditContextManager = /*#__PURE__*/ function() {
23693
23814
  this.handlers.compositionend = function() {
23694
23815
  view.inputState.composing = -1;
23695
23816
  view.inputState.compositionFirstChange = null;
23817
+ if (_this.composing) {
23818
+ var drifted = _this.composing.drifted;
23819
+ _this.composing = null;
23820
+ if (drifted) _this.reset(view.state);
23821
+ }
23696
23822
  };
23697
23823
  for(var event in this.handlers)context.addEventListener(event, this.handlers[event]);
23698
23824
  this.measureReq = {
@@ -23745,12 +23871,16 @@ var EditContextManager = /*#__PURE__*/ function() {
23745
23871
  {
23746
23872
  key: "update",
23747
23873
  value: function update(update) {
23874
+ var _this = this;
23748
23875
  var reverted = this.pendingContextChange;
23749
- if (!this.applyEdits(update) || !this.rangeIsValid(update.state)) {
23876
+ if (this.composing && (this.composing.drifted || update.transactions.some(function(tr) {
23877
+ return !tr.isUserEvent("input.type") && tr.changes.touchesRange(_this.from, _this.to);
23878
+ }))) {
23879
+ this.composing.drifted = true;
23880
+ this.composing.editorBase = update.changes.mapPos(this.composing.editorBase);
23881
+ } else if (!this.applyEdits(update) || !this.rangeIsValid(update.state)) {
23750
23882
  this.pendingContextChange = null;
23751
- this.resetRange(update.state);
23752
- this.editContext.updateText(0, this.editContext.text.length, update.state.doc.sliceString(this.from, this.to));
23753
- this.setSelection(update.state);
23883
+ this.reset(update.state);
23754
23884
  } else if (update.docChanged || update.selectionSet || reverted) {
23755
23885
  this.setSelection(update.state);
23756
23886
  }
@@ -23765,6 +23895,14 @@ var EditContextManager = /*#__PURE__*/ function() {
23765
23895
  this.to = Math.min(state.doc.length, head + 10000 /* CxVp.Margin */ );
23766
23896
  }
23767
23897
  },
23898
+ {
23899
+ key: "reset",
23900
+ value: function reset(state) {
23901
+ this.resetRange(state);
23902
+ this.editContext.updateText(0, this.editContext.text.length, state.doc.sliceString(this.from, this.to));
23903
+ this.setSelection(state);
23904
+ }
23905
+ },
23768
23906
  {
23769
23907
  key: "revertPending",
23770
23908
  value: function revertPending(state) {
@@ -23792,13 +23930,17 @@ var EditContextManager = /*#__PURE__*/ function() {
23792
23930
  {
23793
23931
  key: "toEditorPos",
23794
23932
  value: function toEditorPos(contextPos) {
23795
- return contextPos + this.from;
23933
+ var clipLen = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.to - this.from;
23934
+ contextPos = Math.min(contextPos, clipLen);
23935
+ var c = this.composing;
23936
+ return c && c.drifted ? c.editorBase + (contextPos - c.contextBase) : contextPos + this.from;
23796
23937
  }
23797
23938
  },
23798
23939
  {
23799
23940
  key: "toContextPos",
23800
23941
  value: function toContextPos(editorPos) {
23801
- return editorPos - this.from;
23942
+ var c = this.composing;
23943
+ return c && c.drifted ? c.contextBase + (editorPos - c.editorBase) : editorPos - this.from;
23802
23944
  }
23803
23945
  },
23804
23946
  {
@@ -24502,6 +24644,7 @@ transactions for editing actions.
24502
24644
  spellcheck: "false",
24503
24645
  autocorrect: "off",
24504
24646
  autocapitalize: "off",
24647
+ writingsuggestions: "false",
24505
24648
  translate: "no",
24506
24649
  contenteditable: !this.state.facet(editable) ? "false" : "true",
24507
24650
  class: "cm-content",
@@ -25772,7 +25915,7 @@ function rectanglesForRange(view, className, range) {
25772
25915
  return pieces(top).concat(between).concat(pieces(bottom));
25773
25916
  }
25774
25917
  function piece(left, top, right, bottom) {
25775
- return new RectangleMarker(className, left - base.left, top - base.top - 0.01 /* C.Epsilon */ , right - left, bottom - top + 0.01 /* C.Epsilon */ );
25918
+ return new RectangleMarker(className, left - base.left, top - base.top, right - left, bottom - top);
25776
25919
  }
25777
25920
  function pieces(param) {
25778
25921
  var top = param.top, bottom = param.bottom, horizontal = param.horizontal;
@@ -25992,7 +26135,7 @@ Define a layer.
25992
26135
  layerOrder.of(config)
25993
26136
  ];
25994
26137
  }
25995
- var CanHidePrimary = !browser.ios; // FIXME test IE
26138
+ var CanHidePrimary = !(browser.ios && browser.webkit && browser.webkit_version < 534);
25996
26139
  var selectionConfig = /*@__PURE__*/ Facet.define({
25997
26140
  combine: function combine(configs) {
25998
26141
  return combineConfig(configs, {
@@ -26368,12 +26511,12 @@ represent a matching configuration.
26368
26511
  value: function updateDeco(update, deco) {
26369
26512
  var changeFrom = 1e9, changeTo = -1;
26370
26513
  if (update.docChanged) update.changes.iterChanges(function(_f, _t, from, to) {
26371
- if (to > update.view.viewport.from && from < update.view.viewport.to) {
26514
+ if (to >= update.view.viewport.from && from <= update.view.viewport.to) {
26372
26515
  changeFrom = Math.min(from, changeFrom);
26373
26516
  changeTo = Math.max(to, changeTo);
26374
26517
  }
26375
26518
  });
26376
- if (update.viewportChanged || changeTo - changeFrom > 1000) return this.createDeco(update.view);
26519
+ if (update.viewportMoved || changeTo - changeFrom > 1000) return this.createDeco(update.view);
26377
26520
  if (changeTo > -1) return this.updateRange(update.view, deco.map(update.changes), changeFrom, changeTo);
26378
26521
  return deco;
26379
26522
  }
@@ -27206,7 +27349,6 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27206
27349
  key: "readMeasure",
27207
27350
  value: function readMeasure() {
27208
27351
  var _this = this;
27209
- var editor = this.view.dom.getBoundingClientRect();
27210
27352
  var scaleX = 1, scaleY = 1, makeAbsolute = false;
27211
27353
  if (this.position == "fixed" && this.manager.tooltipViews.length) {
27212
27354
  var dom = this.manager.tooltipViews[0].dom;
@@ -27234,9 +27376,15 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27234
27376
  ref = this.view.viewState, scaleX = ref.scaleX, scaleY = ref.scaleY;
27235
27377
  }
27236
27378
  }
27379
+ var visible = this.view.scrollDOM.getBoundingClientRect(), margins = getScrollMargins(this.view);
27237
27380
  return {
27238
- editor: editor,
27239
- parent: this.parent ? this.container.getBoundingClientRect() : editor,
27381
+ visible: {
27382
+ left: visible.left + margins.left,
27383
+ top: visible.top + margins.top,
27384
+ right: visible.right - margins.right,
27385
+ bottom: visible.bottom - margins.bottom
27386
+ },
27387
+ parent: this.parent ? this.container.getBoundingClientRect() : this.view.dom.getBoundingClientRect(),
27240
27388
  pos: this.manager.tooltips.map(function(t, i) {
27241
27389
  var tv = _this.manager.tooltipViews[i];
27242
27390
  return tv.getCoords ? tv.getCoords(t.pos) : _this.view.coordsAtPos(t.pos);
@@ -27280,13 +27428,13 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27280
27428
  }
27281
27429
  }
27282
27430
  }
27283
- var editor = measured.editor, space = measured.space, scaleX = measured.scaleX, scaleY = measured.scaleY;
27431
+ var visible = measured.visible, space = measured.space, scaleX = measured.scaleX, scaleY = measured.scaleY;
27284
27432
  var others = [];
27285
27433
  for(var i = 0; i < this.manager.tooltips.length; i++){
27286
27434
  var tooltip = this.manager.tooltips[i], tView = this.manager.tooltipViews[i], dom = tView.dom;
27287
27435
  var pos = measured.pos[i], size = measured.size[i];
27288
27436
  // Hide tooltips that are outside of the editor.
27289
- if (!pos || pos.bottom <= Math.max(editor.top, space.top) || pos.top >= Math.min(editor.bottom, space.bottom) || pos.right < Math.max(editor.left, space.left) - .1 || pos.left > Math.min(editor.right, space.right) + .1) {
27437
+ if (!pos || tooltip.clip !== false && (pos.bottom <= Math.max(visible.top, space.top) || pos.top >= Math.min(visible.bottom, space.bottom) || pos.right < Math.max(visible.left, space.left) - .1 || pos.left > Math.min(visible.right, space.right) + .1)) {
27290
27438
  dom.style.top = Outside;
27291
27439
  continue;
27292
27440
  }
@@ -27296,7 +27444,7 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27296
27444
  var offset = tView.offset || noOffset, ltr = this.view.textDirection == Direction.LTR;
27297
27445
  var left = size.width > space.right - space.left ? ltr ? space.left : space.right - size.width : ltr ? Math.max(space.left, Math.min(pos.left - (arrow ? 14 /* Arrow.Offset */ : 0) + offset.x, space.right - width)) : Math.min(Math.max(space.left, pos.left - width + (arrow ? 14 /* Arrow.Offset */ : 0) - offset.x), space.right - width);
27298
27446
  var above = this.above[i];
27299
- if (!tooltip.strictSide && (above ? pos.top - (size.bottom - size.top) - offset.y < space.top : pos.bottom + (size.bottom - size.top) + offset.y > space.bottom) && above == space.bottom - pos.bottom > pos.top - space.top) above = this.above[i] = !above;
27447
+ if (!tooltip.strictSide && (above ? pos.top - height - arrowHeight - offset.y < space.top : pos.bottom + height + arrowHeight + offset.y > space.bottom) && above == space.bottom - pos.bottom > pos.top - space.top) above = this.above[i] = !above;
27300
27448
  var spaceVert = (above ? pos.top - space.top : space.bottom - pos.bottom) - arrowHeight;
27301
27449
  if (spaceVert < height && tView.resize !== false) {
27302
27450
  if (spaceVert < this.view.defaultLineHeight) {
@@ -27334,10 +27482,10 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27334
27482
  }
27335
27483
  if (this.position == "absolute") {
27336
27484
  dom.style.top = (top - measured.parent.top) / scaleY + "px";
27337
- dom.style.left = (left - measured.parent.left) / scaleX + "px";
27485
+ setLeftStyle(dom, (left - measured.parent.left) / scaleX);
27338
27486
  } else {
27339
27487
  dom.style.top = top / scaleY + "px";
27340
- dom.style.left = left / scaleX + "px";
27488
+ setLeftStyle(dom, left / scaleX);
27341
27489
  }
27342
27490
  if (arrow) {
27343
27491
  var arrowLeft = pos.left + (ltr ? offset.x : -offset.x) - (left + 14 /* Arrow.Offset */ - 7 /* Arrow.Size */ );
@@ -27395,9 +27543,13 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27395
27543
  }
27396
27544
  }
27397
27545
  });
27546
+ function setLeftStyle(elt, value) {
27547
+ var current = parseInt(elt.style.left, 10);
27548
+ if (isNaN(current) || Math.abs(value - current) > 1) elt.style.left = value + "px";
27549
+ }
27398
27550
  var baseTheme$5 = /*@__PURE__*/ EditorView.baseTheme({
27399
27551
  ".cm-tooltip": {
27400
- zIndex: 100,
27552
+ zIndex: 500,
27401
27553
  boxSizing: "border-box"
27402
27554
  },
27403
27555
  "&light .cm-tooltip": {
@@ -33858,10 +34010,10 @@ indicates that no definitive indentation can be determined.
33858
34010
  // Compute the indentation for a given position from the syntax tree.
33859
34011
  function syntaxIndentation(cx, ast, pos) {
33860
34012
  var stack = ast.resolveStack(pos);
33861
- var inner = stack.node.enterUnfinishedNodesBefore(pos);
34013
+ var inner = ast.resolveInner(pos, -1).resolve(pos, 0).enterUnfinishedNodesBefore(pos);
33862
34014
  if (inner != stack.node) {
33863
34015
  var add = [];
33864
- for(var cur = inner; cur != stack.node; cur = cur.parent)add.push(cur);
34016
+ for(var cur = inner; cur && !(cur.from == stack.node.from && cur.type == stack.node.type); cur = cur.parent)add.push(cur);
33865
34017
  for(var i = add.length - 1; i >= 0; i--)stack = {
33866
34018
  node: add[i],
33867
34019
  next: stack
@@ -37670,23 +37822,70 @@ var LintState = /*#__PURE__*/ function() {
37670
37822
  {
37671
37823
  key: "init",
37672
37824
  value: function init(diagnostics, panel, state) {
37825
+ var _loop = function(i1) {
37826
+ var next = i1 == sorted.length ? null : sorted[i1];
37827
+ if (!next && !active.length) return i = i1, "break";
37828
+ var from = void 0, to = void 0;
37829
+ if (active.length) {
37830
+ from = pos;
37831
+ to = active.reduce(function(p, d) {
37832
+ return Math.min(p, d.to);
37833
+ }, next && next.from > from ? next.from : 1e8);
37834
+ } else {
37835
+ from = next.from;
37836
+ to = next.to;
37837
+ active.push(next);
37838
+ i1++;
37839
+ }
37840
+ while(i1 < sorted.length){
37841
+ var next1 = sorted[i1];
37842
+ if (next1.from == from && (next1.to > next1.from || next1.to == from)) {
37843
+ active.push(next1);
37844
+ i1++;
37845
+ to = Math.min(next1.to, to);
37846
+ } else {
37847
+ to = Math.min(next1.from, to);
37848
+ break;
37849
+ }
37850
+ }
37851
+ var sev = maxSeverity(active);
37852
+ if (active.some(function(d) {
37853
+ return d.from == d.to || d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from;
37854
+ })) {
37855
+ deco.add(from, from, Decoration.widget({
37856
+ widget: new DiagnosticWidget(sev),
37857
+ diagnostics: active.slice()
37858
+ }));
37859
+ } else {
37860
+ var markClass = active.reduce(function(c, d) {
37861
+ return d.markClass ? c + " " + d.markClass : c;
37862
+ }, "");
37863
+ deco.add(from, to, Decoration.mark({
37864
+ class: "cm-lintRange cm-lintRange-" + sev + markClass,
37865
+ diagnostics: active.slice(),
37866
+ inclusiveEnd: active.some(function(a) {
37867
+ return a.to > to;
37868
+ })
37869
+ }));
37870
+ }
37871
+ pos = to;
37872
+ for(var i2 = 0; i2 < active.length; i2++)if (active[i2].to <= pos) active.splice(i2--, 1);
37873
+ i = i1;
37874
+ };
37673
37875
  // Filter the list of diagnostics for which to create markers
37674
37876
  var markedDiagnostics = diagnostics;
37675
37877
  var diagnosticFilter = state.facet(lintConfig).markerFilter;
37676
37878
  if (diagnosticFilter) markedDiagnostics = diagnosticFilter(markedDiagnostics, state);
37677
- var ranges = Decoration.set(markedDiagnostics.map(function(d) {
37678
- // For zero-length ranges or ranges covering only a line break, create a widget
37679
- return d.from == d.to || d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from ? Decoration.widget({
37680
- widget: new DiagnosticWidget(d),
37681
- diagnostic: d
37682
- }).range(d.from) : Decoration.mark({
37683
- attributes: {
37684
- class: "cm-lintRange cm-lintRange-" + d.severity + (d.markClass ? " " + d.markClass : "")
37685
- },
37686
- diagnostic: d
37687
- }).range(d.from, d.to);
37688
- }), true);
37689
- return new LintState(ranges, panel, findDiagnostic(ranges));
37879
+ var sorted = diagnostics.slice().sort(function(a, b) {
37880
+ return a.from - b.from || a.to - b.to;
37881
+ });
37882
+ var deco = new RangeSetBuilder(), active = [], pos = 0;
37883
+ for(var i = 0;;){
37884
+ var _ret = _loop(i);
37885
+ if (_ret === "break") break;
37886
+ }
37887
+ var set = deco.finish();
37888
+ return new LintState(set, panel, findDiagnostic(set));
37690
37889
  }
37691
37890
  }
37692
37891
  ]);
@@ -37697,9 +37896,10 @@ function findDiagnostic(diagnostics) {
37697
37896
  var found = null;
37698
37897
  diagnostics.between(after, 1e9, function(from, to, param) {
37699
37898
  var spec = param.spec;
37700
- if (diagnostic && spec.diagnostic != diagnostic) return;
37701
- found = new SelectedDiagnostic(from, to, spec.diagnostic);
37702
- return false;
37899
+ if (diagnostic && spec.diagnostics.indexOf(diagnostic) < 0) return;
37900
+ if (!found) found = new SelectedDiagnostic(from, to, diagnostic || spec.diagnostics[0]);
37901
+ else if (spec.diagnostics.indexOf(found.diagnostic) < 0) return false;
37902
+ else found = new SelectedDiagnostic(found.from, to, found.diagnostic);
37703
37903
  });
37704
37904
  return found;
37705
37905
  }
@@ -37791,22 +37991,23 @@ var activeMark = /*@__PURE__*/ Decoration.mark({
37791
37991
  });
37792
37992
  function lintTooltip(view, pos, side) {
37793
37993
  var diagnostics = view.state.field(lintState).diagnostics;
37794
- var found = [], stackStart = 2e8, stackEnd = 0;
37994
+ var found, start = -1, end = -1;
37795
37995
  diagnostics.between(pos - (side < 0 ? 1 : 0), pos + (side > 0 ? 1 : 0), function(from, to, param) {
37796
37996
  var spec = param.spec;
37797
37997
  if (pos >= from && pos <= to && (from == to || (pos > from || side > 0) && (pos < to || side < 0))) {
37798
- found.push(spec.diagnostic);
37799
- stackStart = Math.min(from, stackStart);
37800
- stackEnd = Math.max(to, stackEnd);
37998
+ found = spec.diagnostics;
37999
+ start = from;
38000
+ end = to;
38001
+ return false;
37801
38002
  }
37802
38003
  });
37803
38004
  var diagnosticFilter = view.state.facet(lintConfig).tooltipFilter;
37804
- if (diagnosticFilter) found = diagnosticFilter(found, view.state);
37805
- if (!found.length) return null;
38005
+ if (found && diagnosticFilter) found = diagnosticFilter(found, view.state);
38006
+ if (!found) return null;
37806
38007
  return {
37807
- pos: stackStart,
37808
- end: stackEnd,
37809
- above: view.state.doc.lineAt(stackStart).to < stackEnd,
38008
+ pos: start,
38009
+ end: end,
38010
+ above: view.state.doc.lineAt(start).to < end,
37810
38011
  create: function create() {
37811
38012
  return {
37812
38013
  dom: diagnosticsTooltip(view, found)
@@ -37955,7 +38156,7 @@ function batchResults(promises, sink, error) {
37955
38156
  collected.push(value);
37956
38157
  clearTimeout(timeout);
37957
38158
  if (collected.length == promises.length) sink(collected);
37958
- else setTimeout(function() {
38159
+ else timeout = setTimeout(function() {
37959
38160
  return sink(collected);
37960
38161
  }, 200);
37961
38162
  }, error);
@@ -38100,25 +38301,25 @@ function renderDiagnostic(view, diagnostic, inPanel) {
38100
38301
  var DiagnosticWidget = /*#__PURE__*/ function(WidgetType) {
38101
38302
  _inherits$5(DiagnosticWidget, WidgetType);
38102
38303
  var _super = _create_super$5(DiagnosticWidget);
38103
- function DiagnosticWidget(diagnostic) {
38304
+ function DiagnosticWidget(sev) {
38104
38305
  _class_call_check$9(this, DiagnosticWidget);
38105
38306
  var _this;
38106
38307
  _this = _super.call(this);
38107
- _this.diagnostic = diagnostic;
38308
+ _this.sev = sev;
38108
38309
  return _this;
38109
38310
  }
38110
38311
  _create_class$6(DiagnosticWidget, [
38111
38312
  {
38112
38313
  key: "eq",
38113
38314
  value: function eq(other) {
38114
- return other.diagnostic == this.diagnostic;
38315
+ return other.sev == this.sev;
38115
38316
  }
38116
38317
  },
38117
38318
  {
38118
38319
  key: "toDOM",
38119
38320
  value: function toDOM() {
38120
38321
  return crelt("span", {
38121
- class: "cm-lintPoint cm-lintPoint-" + this.diagnostic.severity
38322
+ class: "cm-lintPoint cm-lintPoint-" + this.sev
38122
38323
  });
38123
38324
  }
38124
38325
  }
@@ -38204,33 +38405,55 @@ var LintPanel = /*#__PURE__*/ function() {
38204
38405
  var _this = this;
38205
38406
  var _this_view_state_field = this.view.state.field(lintState), diagnostics = _this_view_state_field.diagnostics, selected = _this_view_state_field.selected;
38206
38407
  var i = 0, needsSync = false, newSelectedItem = null;
38408
+ var seen = new Set();
38207
38409
  diagnostics.between(0, this.view.state.doc.length, function(_start, _end, param) {
38208
38410
  var spec = param.spec;
38209
- var found = -1, item;
38210
- for(var j = i; j < _this.items.length; j++)if (_this.items[j].diagnostic == spec.diagnostic) {
38211
- found = j;
38212
- break;
38213
- }
38214
- if (found < 0) {
38215
- item = new PanelItem(_this.view, spec.diagnostic);
38216
- _this.items.splice(i, 0, item);
38217
- needsSync = true;
38218
- } else {
38219
- item = _this.items[found];
38220
- if (found > i) {
38221
- _this.items.splice(i, found - i);
38222
- needsSync = true;
38411
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
38412
+ try {
38413
+ for(var _iterator = spec.diagnostics[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
38414
+ var diagnostic = _step.value;
38415
+ if (seen.has(diagnostic)) continue;
38416
+ seen.add(diagnostic);
38417
+ var found = -1, item = void 0;
38418
+ for(var j = i; j < _this.items.length; j++)if (_this.items[j].diagnostic == diagnostic) {
38419
+ found = j;
38420
+ break;
38421
+ }
38422
+ if (found < 0) {
38423
+ item = new PanelItem(_this.view, diagnostic);
38424
+ _this.items.splice(i, 0, item);
38425
+ needsSync = true;
38426
+ } else {
38427
+ item = _this.items[found];
38428
+ if (found > i) {
38429
+ _this.items.splice(i, found - i);
38430
+ needsSync = true;
38431
+ }
38432
+ }
38433
+ if (selected && item.diagnostic == selected.diagnostic) {
38434
+ if (!item.dom.hasAttribute("aria-selected")) {
38435
+ item.dom.setAttribute("aria-selected", "true");
38436
+ newSelectedItem = item;
38437
+ }
38438
+ } else if (item.dom.hasAttribute("aria-selected")) {
38439
+ item.dom.removeAttribute("aria-selected");
38440
+ }
38441
+ i++;
38223
38442
  }
38224
- }
38225
- if (selected && item.diagnostic == selected.diagnostic) {
38226
- if (!item.dom.hasAttribute("aria-selected")) {
38227
- item.dom.setAttribute("aria-selected", "true");
38228
- newSelectedItem = item;
38443
+ } catch (err) {
38444
+ _didIteratorError = true;
38445
+ _iteratorError = err;
38446
+ } finally{
38447
+ try {
38448
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
38449
+ _iterator.return();
38450
+ }
38451
+ } finally{
38452
+ if (_didIteratorError) {
38453
+ throw _iteratorError;
38454
+ }
38229
38455
  }
38230
- } else if (item.dom.hasAttribute("aria-selected")) {
38231
- item.dom.removeAttribute("aria-selected");
38232
38456
  }
38233
- i++;
38234
38457
  });
38235
38458
  while(i < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0)){
38236
38459
  needsSync = true;
@@ -38461,6 +38684,34 @@ var baseTheme$3 = /*@__PURE__*/ EditorView.baseTheme({
38461
38684
  function severityWeight(sev) {
38462
38685
  return sev == "error" ? 4 : sev == "warning" ? 3 : sev == "info" ? 2 : 1;
38463
38686
  }
38687
+ function maxSeverity(diagnostics) {
38688
+ var sev = "hint", weight = 1;
38689
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
38690
+ try {
38691
+ for(var _iterator = diagnostics[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
38692
+ var d = _step.value;
38693
+ var w = severityWeight(d.severity);
38694
+ if (w > weight) {
38695
+ weight = w;
38696
+ sev = d.severity;
38697
+ }
38698
+ }
38699
+ } catch (err) {
38700
+ _didIteratorError = true;
38701
+ _iteratorError = err;
38702
+ } finally{
38703
+ try {
38704
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
38705
+ _iterator.return();
38706
+ }
38707
+ } finally{
38708
+ if (_didIteratorError) {
38709
+ throw _iteratorError;
38710
+ }
38711
+ }
38712
+ }
38713
+ return sev;
38714
+ }
38464
38715
  var LintGutterMarker = /*#__PURE__*/ function(GutterMarker) {
38465
38716
  _inherits$5(LintGutterMarker, GutterMarker);
38466
38717
  var _super = _create_super$5(LintGutterMarker);
@@ -38469,9 +38720,7 @@ var LintGutterMarker = /*#__PURE__*/ function(GutterMarker) {
38469
38720
  var _this;
38470
38721
  _this = _super.call(this);
38471
38722
  _this.diagnostics = diagnostics;
38472
- _this.severity = diagnostics.reduce(function(max, d) {
38473
- return severityWeight(max) < severityWeight(d.severity) ? d.severity : max;
38474
- }, "hint");
38723
+ _this.severity = maxSeverity(diagnostics);
38475
38724
  return _this;
38476
38725
  }
38477
38726
  _create_class$6(LintGutterMarker, [
@@ -38515,6 +38764,7 @@ function gutterMarkerMouseOver(view, marker, diagnostics) {
38515
38764
  effects: setLintGutterTooltip.of({
38516
38765
  pos: line.from,
38517
38766
  above: false,
38767
+ clip: false,
38518
38768
  create: function create() {
38519
38769
  return {
38520
38770
  dom: diagnosticsTooltip(view, diagnostics),
@@ -38578,7 +38828,7 @@ var lintGutterExtension = /*@__PURE__*/ gutter({
38578
38828
  var diagnostics = [];
38579
38829
  view.state.field(lintGutterMarkers).between(block.from, block.to, function(from, to, value) {
38580
38830
  var _diagnostics;
38581
- (_diagnostics = diagnostics).push.apply(_diagnostics, _to_consumable_array$7(value.diagnostics));
38831
+ if (from > block.from && from < block.to) (_diagnostics = diagnostics).push.apply(_diagnostics, _to_consumable_array$7(value.diagnostics));
38582
38832
  });
38583
38833
  return diagnostics.length ? new LintGutterMarker(diagnostics) : null;
38584
38834
  }
@@ -40843,17 +41093,17 @@ var jsonHighlighting = styleTags({
40843
41093
  "True False": tags.bool,
40844
41094
  PropertyName: tags.propertyName,
40845
41095
  Null: tags.null,
40846
- ",": tags.separator,
41096
+ ", :": tags.separator,
40847
41097
  "[ ]": tags.squareBracket,
40848
41098
  "{ }": tags.brace
40849
41099
  });
40850
41100
  // This file was generated by lezer-generator. You probably shouldn't edit it.
40851
41101
  var parser = LRParser.deserialize({
40852
41102
  version: 14,
40853
- states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",
40854
- stateData: "#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",
40855
- goto: "!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
40856
- nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",
41103
+ states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",
41104
+ stateData: "#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",
41105
+ goto: "!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
41106
+ nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",
40857
41107
  maxTerm: 25,
40858
41108
  nodeProps: [
40859
41109
  [
@@ -40867,14 +41117,14 @@ var parser = LRParser.deserialize({
40867
41117
  "openedBy",
40868
41118
  7,
40869
41119
  "{",
40870
- 12,
41120
+ 14,
40871
41121
  "["
40872
41122
  ],
40873
41123
  [
40874
41124
  "closedBy",
40875
41125
  8,
40876
41126
  "}",
40877
- 13,
41127
+ 15,
40878
41128
  "]"
40879
41129
  ]
40880
41130
  ],
@@ -40885,7 +41135,7 @@ var parser = LRParser.deserialize({
40885
41135
  0
40886
41136
  ],
40887
41137
  repeatNodeCount: 2,
40888
- tokenData: "(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",
41138
+ tokenData: "(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",
40889
41139
  tokenizers: [
40890
41140
  0
40891
41141
  ],
@@ -41687,7 +41937,7 @@ function findNextOccurrence(state, query) {
41687
41937
  var _loop = function(cycled1, cursor1) {
41688
41938
  cursor1.next();
41689
41939
  if (cursor1.done) {
41690
- if (cycled1) return cursor = cursor1, cycled = cycled1, {
41940
+ if (cycled1) return cycled = cycled1, cursor = cursor1, {
41691
41941
  v: null
41692
41942
  };
41693
41943
  cursor1 = new SearchCursor(state.doc, query, 0, Math.max(0, ranges[ranges.length - 1].from - 1));
@@ -41695,16 +41945,16 @@ function findNextOccurrence(state, query) {
41695
41945
  } else {
41696
41946
  if (cycled1 && ranges.some(function(r) {
41697
41947
  return r.from == cursor1.value.from;
41698
- })) return cursor = cursor1, cycled = cycled1, "continue";
41948
+ })) return cycled = cycled1, cursor = cursor1, "continue";
41699
41949
  if (fullWord) {
41700
41950
  var word = state.wordAt(cursor1.value.from);
41701
- if (!word || word.from != cursor1.value.from || word.to != cursor1.value.to) return cursor = cursor1, cycled = cycled1, "continue";
41951
+ if (!word || word.from != cursor1.value.from || word.to != cursor1.value.to) return cycled = cycled1, cursor = cursor1, "continue";
41702
41952
  }
41703
- return cursor = cursor1, cycled = cycled1, {
41953
+ return cycled = cycled1, cursor = cursor1, {
41704
41954
  v: cursor1.value
41705
41955
  };
41706
41956
  }
41707
- cursor = cursor1, cycled = cycled1;
41957
+ cycled = cycled1, cursor = cursor1;
41708
41958
  };
41709
41959
  var _state_selection = state.selection, main = _state_selection.main, ranges = _state_selection.ranges;
41710
41960
  var word = state.wordAt(main.head), fullWord = word && word.from == main.from && word.to == main.to;
@@ -42175,8 +42425,9 @@ Replace the current match of the search query.
42175
42425
  var query = param.query;
42176
42426
  var state = view.state, _state_selection_main = state.selection.main, from = _state_selection_main.from, to = _state_selection_main.to;
42177
42427
  if (state.readOnly) return false;
42178
- var next = query.nextMatch(state, from, from);
42179
- if (!next) return false;
42428
+ var match = query.nextMatch(state, from, from);
42429
+ if (!match) return false;
42430
+ var next = match;
42180
42431
  var changes = [], selection, replacement;
42181
42432
  var effects = [];
42182
42433
  if (next.from == from && next.to == to) {
@@ -42190,7 +42441,7 @@ Replace the current match of the search query.
42190
42441
  effects.push(EditorView.announce.of(state.phrase("replaced match on line $", state.doc.lineAt(from).number) + "."));
42191
42442
  }
42192
42443
  if (next) {
42193
- var off = changes.length == 0 || changes[0].from >= next.to ? 0 : next.to - next.from - replacement.length;
42444
+ var off = changes.length == 0 || changes[0].from >= match.to ? 0 : match.to - match.from - replacement.length;
42194
42445
  selection = EditorSelection.single(next.from - off, next.to - off);
42195
42446
  effects.push(announceMatch(view, next));
42196
42447
  effects.push(state.facet(searchConfigFacet).scrollToMatch(selection.main, view));
@@ -52991,6 +53242,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
52991
53242
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
52992
53243
  }
52993
53244
  var HEX = scopedChars.HEX;
53245
+ var IPV4_REG = RegExp("^(?:(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)$", "u");
52994
53246
  function normalizeIPv4$1(host) {
52995
53247
  if (findToken(host, ".") < 3) {
52996
53248
  return {
@@ -52998,7 +53250,7 @@ function normalizeIPv4$1(host) {
52998
53250
  isIPV4: false
52999
53251
  };
53000
53252
  }
53001
- var matches = host.match(RegExp("^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$", "u")) || [];
53253
+ var matches = host.match(IPV4_REG) || [];
53002
53254
  var _matches = _sliced_to_array$2(matches, 1), address = _matches[0];
53003
53255
  if (address) {
53004
53256
  return {
@@ -53225,7 +53477,7 @@ function normalizeComponentEncoding$1(components, esc) {
53225
53477
  }
53226
53478
  return components;
53227
53479
  }
53228
- function recomposeAuthority$1(components, options) {
53480
+ function recomposeAuthority$1(components) {
53229
53481
  var uriTokens = [];
53230
53482
  if (components.userinfo !== undefined) {
53231
53483
  uriTokens.push(components.userinfo);
@@ -53647,7 +53899,7 @@ function serialize(cmpts, opts) {
53647
53899
  if (options.reference !== "suffix" && components.scheme) {
53648
53900
  uriTokens.push(components.scheme, ":");
53649
53901
  }
53650
- var authority = recomposeAuthority(components, options);
53902
+ var authority = recomposeAuthority(components);
53651
53903
  if (authority !== undefined) {
53652
53904
  if (options.reference !== "suffix") {
53653
53905
  uriTokens.push("//");
@@ -53678,7 +53930,7 @@ function serialize(cmpts, opts) {
53678
53930
  }
53679
53931
  var hexLookUp = Array.from({
53680
53932
  length: 127
53681
- }, function(v, k) {
53933
+ }, function(_v, k) {
53682
53934
  return RegExp("[^!\"$&'()*+,\\-.;=_`a-z{}~]", "u").test(String.fromCharCode(k));
53683
53935
  });
53684
53936
  function nonSimpleDomain(value) {
@@ -53723,9 +53975,7 @@ function parse(uri, opts) {
53723
53975
  if (parsed.host) {
53724
53976
  var ipv4result = normalizeIPv4(parsed.host);
53725
53977
  if (ipv4result.isIPV4 === false) {
53726
- var ipv6result = normalizeIPv6(ipv4result.host, {
53727
- isIPV4: false
53728
- });
53978
+ var ipv6result = normalizeIPv6(ipv4result.host);
53729
53979
  parsed.host = ipv6result.host.toLowerCase();
53730
53980
  isIP = ipv6result.isIPV6;
53731
53981
  } else {
@@ -53768,10 +54018,10 @@ function parse(uri, opts) {
53768
54018
  if (gotEncoding && parsed.host !== undefined) {
53769
54019
  parsed.host = unescape(parsed.host);
53770
54020
  }
53771
- if (parsed.path !== undefined && parsed.path.length) {
54021
+ if (parsed.path && parsed.path.length) {
53772
54022
  parsed.path = escape(unescape(parsed.path));
53773
54023
  }
53774
- if (parsed.fragment !== undefined && parsed.fragment.length) {
54024
+ if (parsed.fragment && parsed.fragment.length) {
53775
54025
  parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
53776
54026
  }
53777
54027
  }