dsh-spec-collab 0.3.1 → 0.4.1

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.
package/lib/client.js CHANGED
@@ -987,7 +987,7 @@ window.__ModuleLoader__.load({
987
987
  return htmlDecoder(str, DecodingMode.Strict);
988
988
  }
989
989
  //#endregion
990
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/common/utils.mjs
990
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/common/utils.mjs
991
991
  var utils_exports = /* @__PURE__ */ __exportAll({
992
992
  arrayReplaceAt: () => arrayReplaceAt,
993
993
  asciiTrim: () => asciiTrim,
@@ -1183,7 +1183,7 @@ window.__ModuleLoader__.load({
1183
1183
  ucmicro: uc_micro_exports
1184
1184
  };
1185
1185
  //#endregion
1186
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/helpers/parse_link_label.mjs
1186
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/helpers/parse_link_label.mjs
1187
1187
  function parseLinkLabel(state, start, disableNested) {
1188
1188
  let level, found, marker, prevPos;
1189
1189
  const max = state.posMax;
@@ -1215,7 +1215,7 @@ window.__ModuleLoader__.load({
1215
1215
  return labelEnd;
1216
1216
  }
1217
1217
  //#endregion
1218
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs
1218
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs
1219
1219
  function parseLinkDestination(str, start, max) {
1220
1220
  let code;
1221
1221
  let pos = start;
@@ -1250,7 +1250,10 @@ window.__ModuleLoader__.load({
1250
1250
  if (code === 32) break;
1251
1251
  if (code < 32 || code === 127) break;
1252
1252
  if (code === 92 && pos + 1 < max) {
1253
- if (str.charCodeAt(pos + 1) === 32) break;
1253
+ if (str.charCodeAt(pos + 1) === 32) {
1254
+ pos++;
1255
+ continue;
1256
+ }
1254
1257
  pos += 2;
1255
1258
  continue;
1256
1259
  }
@@ -1272,7 +1275,7 @@ window.__ModuleLoader__.load({
1272
1275
  return result;
1273
1276
  }
1274
1277
  //#endregion
1275
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/helpers/parse_link_title.mjs
1278
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/helpers/parse_link_title.mjs
1276
1279
  function parseLinkTitle(str, start, max, prev_state) {
1277
1280
  let code;
1278
1281
  let pos = start;
@@ -1311,14 +1314,14 @@ window.__ModuleLoader__.load({
1311
1314
  return state;
1312
1315
  }
1313
1316
  //#endregion
1314
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/helpers/index.mjs
1317
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/helpers/index.mjs
1315
1318
  var helpers_exports = /* @__PURE__ */ __exportAll({
1316
1319
  parseLinkDestination: () => parseLinkDestination,
1317
1320
  parseLinkLabel: () => parseLinkLabel,
1318
1321
  parseLinkTitle: () => parseLinkTitle
1319
1322
  });
1320
1323
  //#endregion
1321
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/renderer.mjs
1324
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/renderer.mjs
1322
1325
  /**
1323
1326
  * class Renderer
1324
1327
  *
@@ -1531,7 +1534,7 @@ window.__ModuleLoader__.load({
1531
1534
  return result;
1532
1535
  };
1533
1536
  //#endregion
1534
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/ruler.mjs
1537
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/ruler.mjs
1535
1538
  /**
1536
1539
  * class Ruler
1537
1540
  *
@@ -1802,7 +1805,7 @@ window.__ModuleLoader__.load({
1802
1805
  return this.__cache__[chainName] || [];
1803
1806
  };
1804
1807
  //#endregion
1805
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/token.mjs
1808
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/token.mjs
1806
1809
  /**
1807
1810
  * class Token
1808
1811
  **/
@@ -1956,7 +1959,7 @@ window.__ModuleLoader__.load({
1956
1959
  else this.attrs[idx][1] = this.attrs[idx][1] + " " + value;
1957
1960
  };
1958
1961
  //#endregion
1959
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_core/state_core.mjs
1962
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_core/state_core.mjs
1960
1963
  function StateCore(src, md, env) {
1961
1964
  this.src = src;
1962
1965
  this.env = env;
@@ -1966,7 +1969,7 @@ window.__ModuleLoader__.load({
1966
1969
  }
1967
1970
  StateCore.prototype.Token = Token;
1968
1971
  //#endregion
1969
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_core/normalize.mjs
1972
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_core/normalize.mjs
1970
1973
  const NEWLINES_RE = /\r\n?|\n/g;
1971
1974
  const NULL_RE = /\0/g;
1972
1975
  function normalize$1(state) {
@@ -1976,7 +1979,7 @@ window.__ModuleLoader__.load({
1976
1979
  state.src = str;
1977
1980
  }
1978
1981
  //#endregion
1979
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_core/block.mjs
1982
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_core/block.mjs
1980
1983
  function block(state) {
1981
1984
  let token;
1982
1985
  if (state.inlineMode) {
@@ -1988,7 +1991,7 @@ window.__ModuleLoader__.load({
1988
1991
  } else state.md.block.parse(state.src, state.md, state.env, state.tokens);
1989
1992
  }
1990
1993
  //#endregion
1991
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_core/inline.mjs
1994
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_core/inline.mjs
1992
1995
  function inline(state) {
1993
1996
  const tokens = state.tokens;
1994
1997
  for (let i = 0, l = tokens.length; i < l; i++) {
@@ -1997,7 +2000,7 @@ window.__ModuleLoader__.load({
1997
2000
  }
1998
2001
  }
1999
2002
  //#endregion
2000
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_core/linkify.mjs
2003
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_core/linkify.mjs
2001
2004
  function isLinkOpen$1(str) {
2002
2005
  return /^<a[>\s]/i.test(str);
2003
2006
  }
@@ -2009,7 +2012,8 @@ window.__ModuleLoader__.load({
2009
2012
  if (!state.md.options.linkify) return;
2010
2013
  for (let j = 0, l = blockTokens.length; j < l; j++) {
2011
2014
  if (blockTokens[j].type !== "inline" || !state.md.linkify.pretest(blockTokens[j].content)) continue;
2012
- let tokens = blockTokens[j].children;
2015
+ const tokens = blockTokens[j].children;
2016
+ const replacements = [];
2013
2017
  let htmlLinkLevel = 0;
2014
2018
  for (let i = tokens.length - 1; i >= 0; i--) {
2015
2019
  const currentToken = tokens[i];
@@ -2068,13 +2072,32 @@ window.__ModuleLoader__.load({
2068
2072
  token.level = level;
2069
2073
  nodes.push(token);
2070
2074
  }
2071
- blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
2075
+ replacements.push({
2076
+ index: i,
2077
+ nodes
2078
+ });
2072
2079
  }
2073
2080
  }
2081
+ if (replacements.length > 0) {
2082
+ let newTokensLength = tokens.length;
2083
+ for (const replacement of replacements) newTokensLength += replacement.nodes.length - 1;
2084
+ const newTokens = new Array(newTokensLength);
2085
+ let replacementIndex = 0;
2086
+ let newTokenIndex = 0;
2087
+ replacements.reverse();
2088
+ for (let i = 0; i < tokens.length; i++) {
2089
+ const replacement = replacements[replacementIndex];
2090
+ if (replacement?.index === i) {
2091
+ for (const node of replacement.nodes) newTokens[newTokenIndex++] = node;
2092
+ replacementIndex++;
2093
+ } else newTokens[newTokenIndex++] = tokens[i];
2094
+ }
2095
+ blockTokens[j].children = newTokens;
2096
+ }
2074
2097
  }
2075
2098
  }
2076
2099
  //#endregion
2077
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_core/replacements.mjs
2100
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_core/replacements.mjs
2078
2101
  const RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
2079
2102
  const SCOPED_ABBR_TEST_RE = /\((c|tm|r)\)/i;
2080
2103
  const SCOPED_ABBR_RE = /\((c|tm|r)\)/gi;
@@ -2116,10 +2139,18 @@ window.__ModuleLoader__.load({
2116
2139
  }
2117
2140
  }
2118
2141
  //#endregion
2119
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_core/smartquotes.mjs
2142
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_core/smartquotes.mjs
2120
2143
  const QUOTE_TEST_RE = /['"]/;
2121
2144
  const QUOTE_RE = /['"]/g;
2122
2145
  const APOSTROPHE = "’";
2146
+ const MAX_OPENERS = 1e3;
2147
+ function truncateStack(stack, heads, length) {
2148
+ while (stack.length > length) {
2149
+ const item = stack.pop();
2150
+ if (item.isSingleQuote) heads.single = item.prevSameQuoteIdx;
2151
+ else heads.double = item.prevSameQuoteIdx;
2152
+ }
2153
+ }
2123
2154
  function addReplacement(replacements, tokenIdx, pos, ch) {
2124
2155
  if (!replacements[tokenIdx]) replacements[tokenIdx] = [];
2125
2156
  replacements[tokenIdx].push({
@@ -2141,12 +2172,16 @@ window.__ModuleLoader__.load({
2141
2172
  function process_inlines(tokens, state) {
2142
2173
  let j;
2143
2174
  const stack = [];
2175
+ const heads = {
2176
+ single: -1,
2177
+ double: -1
2178
+ };
2144
2179
  const replacements = {};
2145
2180
  for (let i = 0; i < tokens.length; i++) {
2146
2181
  const token = tokens[i];
2147
2182
  const thisLevel = tokens[i].level;
2148
2183
  for (j = stack.length - 1; j >= 0; j--) if (stack[j].level <= thisLevel) break;
2149
- stack.length = j + 1;
2184
+ truncateStack(stack, heads, j + 1);
2150
2185
  if (token.type !== "text") continue;
2151
2186
  const text = token.content;
2152
2187
  let pos = 0;
@@ -2198,11 +2233,10 @@ window.__ModuleLoader__.load({
2198
2233
  if (isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
2199
2234
  continue;
2200
2235
  }
2201
- if (canClose) for (j = stack.length - 1; j >= 0; j--) {
2202
- let item = stack[j];
2203
- if (stack[j].level < thisLevel) break;
2204
- if (item.single === isSingle && stack[j].level === thisLevel) {
2205
- item = stack[j];
2236
+ if (canClose) {
2237
+ j = isSingle ? heads.single : heads.double;
2238
+ if (j >= 0 && stack[j].level === thisLevel) {
2239
+ const item = stack[j];
2206
2240
  let openQuote;
2207
2241
  let closeQuote;
2208
2242
  if (isSingle) {
@@ -2213,18 +2247,23 @@ window.__ModuleLoader__.load({
2213
2247
  closeQuote = state.md.options.quotes[1];
2214
2248
  }
2215
2249
  addReplacement(replacements, i, t.index, closeQuote);
2216
- addReplacement(replacements, item.token, item.pos, openQuote);
2217
- stack.length = j;
2250
+ addReplacement(replacements, item.tokenIdx, item.contentPos, openQuote);
2251
+ truncateStack(stack, heads, j);
2218
2252
  continue OUTER;
2219
2253
  }
2220
2254
  }
2221
- if (canOpen) stack.push({
2222
- token: i,
2223
- pos: t.index,
2224
- single: isSingle,
2225
- level: thisLevel
2226
- });
2227
- else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
2255
+ if (canOpen) {
2256
+ if (stack.length >= MAX_OPENERS) return;
2257
+ stack.push({
2258
+ tokenIdx: i,
2259
+ contentPos: t.index,
2260
+ isSingleQuote: isSingle,
2261
+ level: thisLevel,
2262
+ prevSameQuoteIdx: isSingle ? heads.single : heads.double
2263
+ });
2264
+ if (isSingle) heads.single = stack.length - 1;
2265
+ else heads.double = stack.length - 1;
2266
+ } else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
2228
2267
  }
2229
2268
  }
2230
2269
  Object.keys(replacements).forEach(function(tokenIdx) {
@@ -2239,7 +2278,7 @@ window.__ModuleLoader__.load({
2239
2278
  }
2240
2279
  }
2241
2280
  //#endregion
2242
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_core/text_join.mjs
2281
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_core/text_join.mjs
2243
2282
  function text_join(state) {
2244
2283
  let curr, last;
2245
2284
  const blockTokens = state.tokens;
@@ -2258,7 +2297,7 @@ window.__ModuleLoader__.load({
2258
2297
  }
2259
2298
  }
2260
2299
  //#endregion
2261
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/parser_core.mjs
2300
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/parser_core.mjs
2262
2301
  /** internal
2263
2302
  * class Core
2264
2303
  *
@@ -2297,7 +2336,7 @@ window.__ModuleLoader__.load({
2297
2336
  };
2298
2337
  Core.prototype.State = StateCore;
2299
2338
  //#endregion
2300
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/state_block.mjs
2339
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/state_block.mjs
2301
2340
  function StateBlock(src, md, env, tokens) {
2302
2341
  this.src = src;
2303
2342
  this.md = md;
@@ -2404,7 +2443,7 @@ window.__ModuleLoader__.load({
2404
2443
  };
2405
2444
  StateBlock.prototype.Token = Token;
2406
2445
  //#endregion
2407
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/table.mjs
2446
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/table.mjs
2408
2447
  const MAX_AUTOCOMPLETED_CELLS = 65536;
2409
2448
  function getLine(state, line) {
2410
2449
  const pos = state.bMarks[line] + state.tShift[line];
@@ -2539,7 +2578,7 @@ window.__ModuleLoader__.load({
2539
2578
  return true;
2540
2579
  }
2541
2580
  //#endregion
2542
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/code.mjs
2581
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/code.mjs
2543
2582
  function code$2(state, startLine, endLine) {
2544
2583
  if (state.sCount[startLine] - state.blkIndent < 4) return false;
2545
2584
  let nextLine = startLine + 1;
@@ -2563,7 +2602,7 @@ window.__ModuleLoader__.load({
2563
2602
  return true;
2564
2603
  }
2565
2604
  //#endregion
2566
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/fence.mjs
2605
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/fence.mjs
2567
2606
  function fence(state, startLine, endLine, silent) {
2568
2607
  let pos = state.bMarks[startLine] + state.tShift[startLine];
2569
2608
  let max = state.eMarks[startLine];
@@ -2608,7 +2647,7 @@ window.__ModuleLoader__.load({
2608
2647
  return true;
2609
2648
  }
2610
2649
  //#endregion
2611
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/blockquote.mjs
2650
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/blockquote.mjs
2612
2651
  function blockquote(state, startLine, endLine, silent) {
2613
2652
  let pos = state.bMarks[startLine] + state.tShift[startLine];
2614
2653
  let max = state.eMarks[startLine];
@@ -2711,7 +2750,7 @@ window.__ModuleLoader__.load({
2711
2750
  return true;
2712
2751
  }
2713
2752
  //#endregion
2714
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/hr.mjs
2753
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/hr.mjs
2715
2754
  function hr(state, startLine, endLine, silent) {
2716
2755
  const max = state.eMarks[startLine];
2717
2756
  if (state.sCount[startLine] - state.blkIndent >= 4) return false;
@@ -2733,7 +2772,7 @@ window.__ModuleLoader__.load({
2733
2772
  return true;
2734
2773
  }
2735
2774
  //#endregion
2736
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/list.mjs
2775
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/list.mjs
2737
2776
  function skipBulletListMarker(state, startLine) {
2738
2777
  const max = state.eMarks[startLine];
2739
2778
  let pos = state.bMarks[startLine] + state.tShift[startLine];
@@ -2886,130 +2925,142 @@ window.__ModuleLoader__.load({
2886
2925
  return true;
2887
2926
  }
2888
2927
  //#endregion
2889
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/reference.mjs
2928
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/reference.mjs
2929
+ const MAX_LABEL_LENGTH = 999;
2930
+ function countCodePoints(str) {
2931
+ let length = str.length;
2932
+ for (let i = 0; i < str.length - 1; i++) {
2933
+ const high = str.charCodeAt(i);
2934
+ if (high < 55296 || high > 56319) continue;
2935
+ const low = str.charCodeAt(i + 1);
2936
+ if (low >= 56320 && low <= 57343) {
2937
+ length--;
2938
+ i++;
2939
+ }
2940
+ }
2941
+ return length;
2942
+ }
2943
+ function lineEnd(state, line) {
2944
+ return Math.min(state.eMarks[line] + 1, state.src.length);
2945
+ }
2946
+ function getNextLinePos(state, nextLine) {
2947
+ const endLine = state.lineMax;
2948
+ if (nextLine >= endLine || state.isEmpty(nextLine)) return -1;
2949
+ let isContinuation = false;
2950
+ if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
2951
+ if (state.sCount[nextLine] < 0) isContinuation = true;
2952
+ if (!isContinuation) {
2953
+ const terminatorRules = state.md.block.ruler.getRules("reference");
2954
+ const oldParentType = state.parentType;
2955
+ state.parentType = "reference";
2956
+ let terminate = false;
2957
+ for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
2958
+ terminate = true;
2959
+ break;
2960
+ }
2961
+ state.parentType = oldParentType;
2962
+ if (terminate) return -1;
2963
+ }
2964
+ return state.bMarks[nextLine] + state.tShift[nextLine];
2965
+ }
2890
2966
  function reference(state, startLine, _endLine, silent) {
2967
+ const src = state.src;
2891
2968
  let pos = state.bMarks[startLine] + state.tShift[startLine];
2892
- let max = state.eMarks[startLine];
2893
2969
  let nextLine = startLine + 1;
2894
2970
  if (state.sCount[startLine] - state.blkIndent >= 4) return false;
2895
- if (state.src.charCodeAt(pos) !== 91) return false;
2896
- function getNextLine(nextLine) {
2897
- const endLine = state.lineMax;
2898
- if (nextLine >= endLine || state.isEmpty(nextLine)) return null;
2899
- let isContinuation = false;
2900
- if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
2901
- if (state.sCount[nextLine] < 0) isContinuation = true;
2902
- if (!isContinuation) {
2903
- const terminatorRules = state.md.block.ruler.getRules("reference");
2904
- const oldParentType = state.parentType;
2905
- state.parentType = "reference";
2906
- let terminate = false;
2907
- for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
2908
- terminate = true;
2909
- break;
2910
- }
2911
- state.parentType = oldParentType;
2912
- if (terminate) return null;
2913
- }
2914
- const pos = state.bMarks[nextLine] + state.tShift[nextLine];
2915
- const max = state.eMarks[nextLine];
2916
- return state.src.slice(pos, max + 1);
2917
- }
2918
- let str = state.src.slice(pos, max + 1);
2919
- max = str.length;
2971
+ if (src.charCodeAt(pos) !== 91) return false;
2972
+ let max = lineEnd(state, startLine);
2973
+ let rawLabel = "";
2920
2974
  let labelEnd = -1;
2921
- for (pos = 1; pos < max; pos++) {
2922
- const ch = str.charCodeAt(pos);
2975
+ let segmentStart = ++pos;
2976
+ while (pos < max) {
2977
+ if (rawLabel.length + pos - segmentStart > MAX_LABEL_LENGTH * 2) return false;
2978
+ let ch = src.charCodeAt(pos);
2923
2979
  if (ch === 91) return false;
2924
- else if (ch === 93) {
2980
+ if (ch === 93) {
2925
2981
  labelEnd = pos;
2926
2982
  break;
2927
- } else if (ch === 10) {
2928
- const lineContent = getNextLine(nextLine);
2929
- if (lineContent !== null) {
2930
- str += lineContent;
2931
- max = str.length;
2932
- nextLine++;
2933
- }
2934
- } else if (ch === 92) {
2935
- pos++;
2936
- if (pos < max && str.charCodeAt(pos) === 10) {
2937
- const lineContent = getNextLine(nextLine);
2938
- if (lineContent !== null) {
2939
- str += lineContent;
2940
- max = str.length;
2941
- nextLine++;
2942
- }
2943
- }
2944
2983
  }
2984
+ if (ch === 92) ch = src.charCodeAt(++pos);
2985
+ if (ch === 10 && pos < max) {
2986
+ const nextPos = getNextLinePos(state, nextLine);
2987
+ if (nextPos < 0) return false;
2988
+ rawLabel += src.slice(segmentStart, max);
2989
+ pos = segmentStart = nextPos;
2990
+ max = lineEnd(state, nextLine++);
2991
+ continue;
2992
+ }
2993
+ pos++;
2945
2994
  }
2946
- if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 58) return false;
2947
- for (pos = labelEnd + 2; pos < max; pos++) {
2948
- const ch = str.charCodeAt(pos);
2995
+ if (labelEnd < 0 || src.charCodeAt(labelEnd + 1) !== 58) return false;
2996
+ rawLabel += src.slice(segmentStart, labelEnd);
2997
+ if (rawLabel.length > MAX_LABEL_LENGTH && countCodePoints(rawLabel) > MAX_LABEL_LENGTH) return false;
2998
+ pos = labelEnd + 2;
2999
+ while (pos < max) {
3000
+ const ch = src.charCodeAt(pos);
2949
3001
  if (ch === 10) {
2950
- const lineContent = getNextLine(nextLine);
2951
- if (lineContent !== null) {
2952
- str += lineContent;
2953
- max = str.length;
2954
- nextLine++;
2955
- }
2956
- } else if (isSpace(ch)) {} else break;
2957
- }
2958
- const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
3002
+ const nextPos = getNextLinePos(state, nextLine);
3003
+ if (nextPos < 0) break;
3004
+ pos = nextPos;
3005
+ max = lineEnd(state, nextLine++);
3006
+ } else if (isSpace(ch)) pos++;
3007
+ else break;
3008
+ }
3009
+ const destRes = state.md.helpers.parseLinkDestination(src, pos, max);
2959
3010
  if (!destRes.ok) return false;
2960
3011
  const href = state.md.normalizeLink(destRes.str);
2961
3012
  if (!state.md.validateLink(href)) return false;
2962
3013
  pos = destRes.pos;
2963
3014
  const destEndPos = pos;
3015
+ const destEndMax = max;
2964
3016
  const destEndLineNo = nextLine;
2965
- const start = pos;
2966
- for (; pos < max; pos++) {
2967
- const ch = str.charCodeAt(pos);
3017
+ while (pos < max) {
3018
+ const ch = src.charCodeAt(pos);
2968
3019
  if (ch === 10) {
2969
- const lineContent = getNextLine(nextLine);
2970
- if (lineContent !== null) {
2971
- str += lineContent;
2972
- max = str.length;
2973
- nextLine++;
2974
- }
2975
- } else if (isSpace(ch)) {} else break;
2976
- }
2977
- let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
3020
+ const nextPos = getNextLinePos(state, nextLine);
3021
+ if (nextPos < 0) break;
3022
+ pos = nextPos;
3023
+ max = lineEnd(state, nextLine++);
3024
+ } else if (isSpace(ch)) pos++;
3025
+ else break;
3026
+ }
3027
+ const titleStart = pos;
3028
+ let titleRes = state.md.helpers.parseLinkTitle(src, pos, max);
2978
3029
  while (titleRes.can_continue) {
2979
- const lineContent = getNextLine(nextLine);
2980
- if (lineContent === null) break;
2981
- str += lineContent;
2982
- pos = max;
2983
- max = str.length;
2984
- nextLine++;
2985
- titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
3030
+ const nextPos = getNextLinePos(state, nextLine);
3031
+ if (nextPos < 0) break;
3032
+ pos = nextPos;
3033
+ max = lineEnd(state, nextLine++);
3034
+ titleRes = state.md.helpers.parseLinkTitle(src, pos, max, titleRes);
2986
3035
  }
2987
3036
  let title;
2988
- if (pos < max && start !== pos && titleRes.ok) {
3037
+ if (titleStart !== destEndPos && titleRes.ok) {
2989
3038
  title = titleRes.str;
2990
3039
  pos = titleRes.pos;
2991
3040
  } else {
2992
3041
  title = "";
2993
3042
  pos = destEndPos;
3043
+ max = destEndMax;
2994
3044
  nextLine = destEndLineNo;
2995
3045
  }
2996
3046
  while (pos < max) {
2997
- if (!isSpace(str.charCodeAt(pos))) break;
3047
+ if (!isSpace(src.charCodeAt(pos))) break;
2998
3048
  pos++;
2999
3049
  }
3000
- if (pos < max && str.charCodeAt(pos) !== 10) {
3050
+ if (pos < max && src.charCodeAt(pos) !== 10) {
3001
3051
  if (title) {
3002
3052
  title = "";
3003
3053
  pos = destEndPos;
3054
+ max = destEndMax;
3004
3055
  nextLine = destEndLineNo;
3005
3056
  while (pos < max) {
3006
- if (!isSpace(str.charCodeAt(pos))) break;
3057
+ if (!isSpace(src.charCodeAt(pos))) break;
3007
3058
  pos++;
3008
3059
  }
3009
3060
  }
3010
3061
  }
3011
- if (pos < max && str.charCodeAt(pos) !== 10) return false;
3012
- const label = normalizeReference$1(str.slice(1, labelEnd));
3062
+ if (pos < max && src.charCodeAt(pos) !== 10) return false;
3063
+ const label = normalizeReference$1(rawLabel);
3013
3064
  if (!label) return false;
3014
3065
  /* istanbul ignore if */
3015
3066
  if (silent) return true;
@@ -3022,7 +3073,7 @@ window.__ModuleLoader__.load({
3022
3073
  return true;
3023
3074
  }
3024
3075
  //#endregion
3025
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/common/html_blocks.mjs
3076
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/common/html_blocks.mjs
3026
3077
  var html_blocks_default = [
3027
3078
  "address",
3028
3079
  "article",
@@ -3088,11 +3139,10 @@ window.__ModuleLoader__.load({
3088
3139
  "ul"
3089
3140
  ];
3090
3141
  //#endregion
3091
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/common/html_re.mjs
3092
- const HTML_TAG_RE = /* @__PURE__ */ new RegExp("^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)");
3142
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/common/html_re.mjs
3093
3143
  const HTML_OPEN_CLOSE_TAG_RE = /* @__PURE__ */ new RegExp("^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)");
3094
3144
  //#endregion
3095
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/html_block.mjs
3145
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/html_block.mjs
3096
3146
  const HTML_SEQUENCES = [
3097
3147
  [
3098
3148
  /^<(script|pre|style|textarea)(?=(\s|>|$))/i,
@@ -3110,7 +3160,7 @@ window.__ModuleLoader__.load({
3110
3160
  true
3111
3161
  ],
3112
3162
  [
3113
- /^<![A-Z]/,
3163
+ /^<![A-Za-z]/,
3114
3164
  />/,
3115
3165
  true
3116
3166
  ],
@@ -3162,7 +3212,7 @@ window.__ModuleLoader__.load({
3162
3212
  return true;
3163
3213
  }
3164
3214
  //#endregion
3165
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/heading.mjs
3215
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/heading.mjs
3166
3216
  function heading(state, startLine, endLine, silent) {
3167
3217
  let pos = state.bMarks[startLine] + state.tShift[startLine];
3168
3218
  let max = state.eMarks[startLine];
@@ -3193,7 +3243,7 @@ window.__ModuleLoader__.load({
3193
3243
  return true;
3194
3244
  }
3195
3245
  //#endregion
3196
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/lheading.mjs
3246
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/lheading.mjs
3197
3247
  function lheading(state, startLine, endLine) {
3198
3248
  const terminatorRules = state.md.block.ruler.getRules("paragraph");
3199
3249
  if (state.sCount[startLine] - state.blkIndent >= 4) return false;
@@ -3246,7 +3296,7 @@ window.__ModuleLoader__.load({
3246
3296
  return true;
3247
3297
  }
3248
3298
  //#endregion
3249
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_block/paragraph.mjs
3299
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_block/paragraph.mjs
3250
3300
  function paragraph(state, startLine, endLine) {
3251
3301
  const terminatorRules = state.md.block.ruler.getRules("paragraph");
3252
3302
  const oldParentType = state.parentType;
@@ -3275,7 +3325,7 @@ window.__ModuleLoader__.load({
3275
3325
  return true;
3276
3326
  }
3277
3327
  //#endregion
3278
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/parser_block.mjs
3328
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/parser_block.mjs
3279
3329
  /** internal
3280
3330
  * class ParserBlock
3281
3331
  *
@@ -3407,7 +3457,7 @@ window.__ModuleLoader__.load({
3407
3457
  };
3408
3458
  ParserBlock.prototype.State = StateBlock;
3409
3459
  //#endregion
3410
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/state_inline.mjs
3460
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/state_inline.mjs
3411
3461
  function StateInline(src, md, env, outTokens) {
3412
3462
  this.src = src;
3413
3463
  this.env = env;
@@ -3424,6 +3474,7 @@ window.__ModuleLoader__.load({
3424
3474
  this._prev_delimiters = [];
3425
3475
  this.backticks = {};
3426
3476
  this.backticksScanned = false;
3477
+ this.skipHtmlSpecial = false;
3427
3478
  this.linkLevel = 0;
3428
3479
  }
3429
3480
  StateInline.prototype.pushPending = function() {
@@ -3491,7 +3542,7 @@ window.__ModuleLoader__.load({
3491
3542
  };
3492
3543
  StateInline.prototype.Token = Token;
3493
3544
  //#endregion
3494
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/text.mjs
3545
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/text.mjs
3495
3546
  function isTerminatorChar(ch) {
3496
3547
  switch (ch) {
3497
3548
  case 10:
@@ -3529,8 +3580,13 @@ window.__ModuleLoader__.load({
3529
3580
  return true;
3530
3581
  }
3531
3582
  //#endregion
3532
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/linkify.mjs
3533
- const SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
3583
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/linkify.mjs
3584
+ function isAsciiAlpha(code) {
3585
+ return code >= 65 && code <= 90 || code >= 97 && code <= 122;
3586
+ }
3587
+ function isSchemeChar(code) {
3588
+ return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 45 || code === 46;
3589
+ }
3534
3590
  function linkify(state, silent) {
3535
3591
  if (!state.md.options.linkify) return false;
3536
3592
  if (state.linkLevel > 0) return false;
@@ -3540,20 +3596,22 @@ window.__ModuleLoader__.load({
3540
3596
  if (state.src.charCodeAt(pos) !== 58) return false;
3541
3597
  if (state.src.charCodeAt(pos + 1) !== 47) return false;
3542
3598
  if (state.src.charCodeAt(pos + 2) !== 47) return false;
3543
- const match = state.pending.match(SCHEME_RE);
3544
- if (!match) return false;
3545
- const proto = match[1];
3546
- const link = state.md.linkify.matchAtStart(state.src.slice(pos - proto.length));
3599
+ const protoMin = pos - Math.min(10, state.pending.length, pos);
3600
+ let protoStart = pos;
3601
+ while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) protoStart--;
3602
+ if (protoStart === pos || !isAsciiAlpha(state.src.charCodeAt(protoStart))) return false;
3603
+ const protoLength = pos - protoStart;
3604
+ const link = state.md.linkify.matchAtStart(state.src.slice(protoStart));
3547
3605
  if (!link) return false;
3548
3606
  let url = link.url;
3549
- if (url.length <= proto.length) return false;
3607
+ if (url.length <= protoLength) return false;
3550
3608
  let urlEnd = url.length;
3551
3609
  while (urlEnd > 0 && url.charCodeAt(urlEnd - 1) === 42) urlEnd--;
3552
3610
  if (urlEnd !== url.length) url = url.slice(0, urlEnd);
3553
3611
  const fullUrl = state.md.normalizeLink(url);
3554
3612
  if (!state.md.validateLink(fullUrl)) return false;
3555
3613
  if (!silent) {
3556
- state.pending = state.pending.slice(0, -proto.length);
3614
+ state.pending = state.pending.slice(0, -protoLength);
3557
3615
  const token_o = state.push("link_open", "a", 1);
3558
3616
  token_o.attrs = [["href", fullUrl]];
3559
3617
  token_o.markup = "linkify";
@@ -3564,11 +3622,11 @@ window.__ModuleLoader__.load({
3564
3622
  token_c.markup = "linkify";
3565
3623
  token_c.info = "auto";
3566
3624
  }
3567
- state.pos += url.length - proto.length;
3625
+ state.pos += url.length - protoLength;
3568
3626
  return true;
3569
3627
  }
3570
3628
  //#endregion
3571
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/newline.mjs
3629
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/newline.mjs
3572
3630
  function newline(state, silent) {
3573
3631
  let pos = state.pos;
3574
3632
  if (state.src.charCodeAt(pos) !== 10) return false;
@@ -3590,7 +3648,7 @@ window.__ModuleLoader__.load({
3590
3648
  return true;
3591
3649
  }
3592
3650
  //#endregion
3593
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/escape.mjs
3651
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/escape.mjs
3594
3652
  const ESCAPED = [];
3595
3653
  for (let i = 0; i < 256; i++) ESCAPED.push(0);
3596
3654
  "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(ch) {
@@ -3644,7 +3702,7 @@ window.__ModuleLoader__.load({
3644
3702
  return true;
3645
3703
  }
3646
3704
  //#endregion
3647
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/backticks.mjs
3705
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/backticks.mjs
3648
3706
  function backtick(state, silent) {
3649
3707
  let pos = state.pos;
3650
3708
  if (state.src.charCodeAt(pos) !== 96) return false;
@@ -3682,7 +3740,7 @@ window.__ModuleLoader__.load({
3682
3740
  return true;
3683
3741
  }
3684
3742
  //#endregion
3685
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs
3743
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs
3686
3744
  function strikethrough_tokenize(state, silent) {
3687
3745
  const start = state.pos;
3688
3746
  const marker = state.src.charCodeAt(start);
@@ -3759,7 +3817,7 @@ window.__ModuleLoader__.load({
3759
3817
  postProcess: strikethrough_postProcess
3760
3818
  };
3761
3819
  //#endregion
3762
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/emphasis.mjs
3820
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/emphasis.mjs
3763
3821
  function emphasis_tokenize(state, silent) {
3764
3822
  const start = state.pos;
3765
3823
  const marker = state.src.charCodeAt(start);
@@ -3820,7 +3878,7 @@ window.__ModuleLoader__.load({
3820
3878
  postProcess: emphasis_post_process
3821
3879
  };
3822
3880
  //#endregion
3823
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/link.mjs
3881
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/link.mjs
3824
3882
  function link$1(state, silent) {
3825
3883
  let code, label, res, ref;
3826
3884
  let href = "";
@@ -3900,7 +3958,7 @@ window.__ModuleLoader__.load({
3900
3958
  return true;
3901
3959
  }
3902
3960
  //#endregion
3903
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/image.mjs
3961
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/image.mjs
3904
3962
  function image(state, silent) {
3905
3963
  let code, content, label, pos, ref, res, title, start;
3906
3964
  let href = "";
@@ -3978,7 +4036,7 @@ window.__ModuleLoader__.load({
3978
4036
  return true;
3979
4037
  }
3980
4038
  //#endregion
3981
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/autolink.mjs
4039
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/autolink.mjs
3982
4040
  const EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/;
3983
4041
  const AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;
3984
4042
  function autolink(state, silent) {
@@ -4030,7 +4088,7 @@ window.__ModuleLoader__.load({
4030
4088
  return false;
4031
4089
  }
4032
4090
  //#endregion
4033
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/html_inline.mjs
4091
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/html_inline.mjs
4034
4092
  function isLinkOpen(str) {
4035
4093
  return /^<a[>\s]/i.test(str);
4036
4094
  }
@@ -4041,26 +4099,57 @@ window.__ModuleLoader__.load({
4041
4099
  const lc = ch | 32;
4042
4100
  return lc >= 97 && lc <= 122;
4043
4101
  }
4102
+ function scanSpecial(state, pos) {
4103
+ const src = state.src;
4104
+ let start;
4105
+ let terminator;
4106
+ if (src.startsWith("<!--", pos)) {
4107
+ if (src.startsWith(">", pos + 4)) return pos + 5;
4108
+ if (src.startsWith("->", pos + 4)) return pos + 6;
4109
+ start = pos + 4;
4110
+ terminator = "-->";
4111
+ } else if (src.startsWith("<![CDATA[", pos)) {
4112
+ start = pos + 9;
4113
+ terminator = "]]>";
4114
+ } else if (src.charCodeAt(pos + 1) === 63) {
4115
+ start = pos + 2;
4116
+ terminator = "?>";
4117
+ } else if (isLetter(src.charCodeAt(pos + 2))) {
4118
+ start = pos + 3;
4119
+ terminator = ">";
4120
+ } else return -1;
4121
+ if (state.skipHtmlSpecial) return -1;
4122
+ const end = src.indexOf(terminator, start);
4123
+ if (end < 0) {
4124
+ state.skipHtmlSpecial = true;
4125
+ return -1;
4126
+ }
4127
+ return end + terminator.length;
4128
+ }
4044
4129
  function html_inline(state, silent) {
4045
4130
  if (!state.md.options.html) return false;
4046
4131
  const max = state.posMax;
4047
4132
  const pos = state.pos;
4048
4133
  if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) return false;
4134
+ let end;
4049
4135
  const ch = state.src.charCodeAt(pos + 1);
4050
- if (ch !== 33 && ch !== 63 && ch !== 47 && !isLetter(ch)) return false;
4051
- const match = state.src.slice(pos).match(HTML_TAG_RE);
4052
- if (!match) return false;
4136
+ if (ch === 33 || ch === 63) end = scanSpecial(state, pos);
4137
+ else if (ch === 47 || isLetter(ch)) {
4138
+ const match = state.src.slice(pos).match(HTML_OPEN_CLOSE_TAG_RE);
4139
+ end = match ? pos + match[0].length : -1;
4140
+ } else return false;
4141
+ if (end < 0) return false;
4053
4142
  if (!silent) {
4054
4143
  const token = state.push("html_inline", "", 0);
4055
- token.content = match[0];
4144
+ token.content = state.src.slice(pos, end);
4056
4145
  if (isLinkOpen(token.content)) state.linkLevel++;
4057
4146
  if (isLinkClose(token.content)) state.linkLevel--;
4058
4147
  }
4059
- state.pos += match[0].length;
4148
+ state.pos = end;
4060
4149
  return true;
4061
4150
  }
4062
4151
  //#endregion
4063
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/entity.mjs
4152
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/entity.mjs
4064
4153
  const DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
4065
4154
  const NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
4066
4155
  function entity(state, silent) {
@@ -4100,7 +4189,7 @@ window.__ModuleLoader__.load({
4100
4189
  return false;
4101
4190
  }
4102
4191
  //#endregion
4103
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs
4192
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs
4104
4193
  function processDelimiters(delimiters) {
4105
4194
  const openersBottom = {};
4106
4195
  const max = delimiters.length;
@@ -4159,7 +4248,7 @@ window.__ModuleLoader__.load({
4159
4248
  for (let curr = 0; curr < max; curr++) if (tokens_meta[curr] && tokens_meta[curr].delimiters) processDelimiters(tokens_meta[curr].delimiters);
4160
4249
  }
4161
4250
  //#endregion
4162
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs
4251
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs
4163
4252
  function fragments_join(state) {
4164
4253
  let curr, last;
4165
4254
  let level = 0;
@@ -4178,7 +4267,7 @@ window.__ModuleLoader__.load({
4178
4267
  if (curr !== last) tokens.length = last;
4179
4268
  }
4180
4269
  //#endregion
4181
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/parser_inline.mjs
4270
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/parser_inline.mjs
4182
4271
  /** internal
4183
4272
  * class ParserInline
4184
4273
  *
@@ -4778,7 +4867,7 @@ window.__ModuleLoader__.load({
4778
4867
  **/
4779
4868
  LinkifyIt.prototype.onCompile = function onCompile() {};
4780
4869
  //#endregion
4781
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/presets/default.mjs
4870
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/presets/default.mjs
4782
4871
  var import_punycode = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4783
4872
  /** Highest positive signed 32-bit float value */
4784
4873
  const maxInt = 2147483647;
@@ -5076,7 +5165,7 @@ window.__ModuleLoader__.load({
5076
5165
  };
5077
5166
  })))(), 1);
5078
5167
  //#endregion
5079
- //#region node_modules/.pnpm/markdown-it@14.3.0/node_modules/markdown-it/lib/index.mjs
5168
+ //#region node_modules/.pnpm/markdown-it@14.3.3/node_modules/markdown-it/lib/index.mjs
5080
5169
  const config = {
5081
5170
  default: {
5082
5171
  options: {
@@ -5718,7 +5807,7 @@ window.__ModuleLoader__.load({
5718
5807
  return new OrderedMap(content);
5719
5808
  };
5720
5809
  //#endregion
5721
- //#region node_modules/.pnpm/prosemirror-model@1.25.11/node_modules/prosemirror-model/dist/index.js
5810
+ //#region node_modules/.pnpm/prosemirror-model@1.25.13/node_modules/prosemirror-model/dist/index.js
5722
5811
  function findDiffStart(a, b, pos) {
5723
5812
  for (let i = 0;; i++) {
5724
5813
  if (i == a.childCount || i == b.childCount) return a.childCount == b.childCount ? null : pos;
@@ -6164,9 +6253,7 @@ window.__ModuleLoader__.load({
6164
6253
  if (!json) throw new RangeError("Invalid input for Mark.fromJSON");
6165
6254
  let type = schema.marks[json.type];
6166
6255
  if (!type) throw new RangeError(`There is no mark type ${json.type} in this schema`);
6167
- let mark = type.create(json.attrs);
6168
- type.checkAttrs(mark.attrs);
6169
- return mark;
6256
+ return type.create(json.attrs);
6170
6257
  }
6171
6258
  /**
6172
6259
  Test whether two sets of marks are identical.
@@ -7063,11 +7150,11 @@ window.__ModuleLoader__.load({
7063
7150
  */
7064
7151
  check() {
7065
7152
  this.type.checkContent(this.content);
7066
- this.type.checkAttrs(this.attrs);
7153
+ checkAttrs(this.type.attrs, this.attrs, "node", this.type.name);
7067
7154
  let copy = Mark$1.none;
7068
7155
  for (let i = 0; i < this.marks.length; i++) {
7069
7156
  let mark = this.marks[i];
7070
- mark.type.checkAttrs(mark.attrs);
7157
+ checkAttrs(mark.type.attrs, mark.attrs, "mark", mark.type.name);
7071
7158
  copy = mark.addToSet(copy);
7072
7159
  }
7073
7160
  if (!Mark$1.sameSet(copy, this.marks)) throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`);
@@ -7101,12 +7188,19 @@ window.__ModuleLoader__.load({
7101
7188
  return schema.text(json.text, marks);
7102
7189
  }
7103
7190
  let content = Fragment.fromJSON(schema, json.content);
7104
- let node = schema.nodeType(json.type).create(json.attrs, content, marks);
7105
- node.type.checkAttrs(node.attrs);
7106
- return node;
7191
+ return schema.nodeType(json.type).create(json.attrs, content, marks);
7107
7192
  }
7108
7193
  };
7109
7194
  Node$3.prototype.text = void 0;
7195
+ const v8InternHack = (() => {
7196
+ let { stack } = /* @__PURE__ */ new Error("/");
7197
+ if (!stack || !/\n\s*at\s/.test(stack)) return (s) => s;
7198
+ let obj = Object.create(null);
7199
+ return (s) => {
7200
+ obj[s];
7201
+ return s;
7202
+ };
7203
+ })();
7110
7204
  var TextNode = class TextNode extends Node$3 {
7111
7205
  /**
7112
7206
  @internal
@@ -7124,7 +7218,7 @@ window.__ModuleLoader__.load({
7124
7218
  return this.text;
7125
7219
  }
7126
7220
  textBetween(from, to) {
7127
- return this.text.slice(from, to);
7221
+ return v8InternHack(this.text.slice(from, to));
7128
7222
  }
7129
7223
  get nodeSize() {
7130
7224
  return this.text.length;
@@ -7138,7 +7232,7 @@ window.__ModuleLoader__.load({
7138
7232
  }
7139
7233
  cut(from = 0, to = this.text.length) {
7140
7234
  if (from == 0 && to == this.text.length) return this;
7141
- return this.withText(this.text.slice(from, to));
7235
+ return this.withText(v8InternHack(this.text.slice(from, to)));
7142
7236
  }
7143
7237
  eq(other) {
7144
7238
  return this.sameMarkup(other) && this.text == other.text;
@@ -7153,6 +7247,10 @@ window.__ModuleLoader__.load({
7153
7247
  for (let i = marks.length - 1; i >= 0; i--) str = marks[i].type.name + "(" + str + ")";
7154
7248
  return str;
7155
7249
  }
7250
+ function checkAttrs(attrs, values, type, name) {
7251
+ for (let attr in values) if (!(attr in attrs)) throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
7252
+ for (let attr in attrs) if (attrs[attr].validate) attrs[attr].validate(values[attr]);
7253
+ }
7156
7254
  /**
7157
7255
  Instances of this class represent a match state of a node type's
7158
7256
  [content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to
@@ -7561,20 +7659,15 @@ window.__ModuleLoader__.load({
7561
7659
  function computeAttrs(attrs, value) {
7562
7660
  let built = Object.create(null);
7563
7661
  for (let name in attrs) {
7662
+ let attr = attrs[name];
7564
7663
  let given = value && value[name];
7565
- if (given === void 0) {
7566
- let attr = attrs[name];
7567
- if (attr.hasDefault) given = attr.default;
7568
- else throw new RangeError("No value supplied for attribute " + name);
7569
- }
7664
+ if (given === void 0) if (attr.hasDefault) given = attr.default;
7665
+ else throw new RangeError("No value supplied for attribute " + name);
7666
+ else if (attr.validate) attr.validate(given);
7570
7667
  built[name] = given;
7571
7668
  }
7572
7669
  return built;
7573
7670
  }
7574
- function checkAttrs(attrs, values, type, name) {
7575
- for (let attr in values) if (!(attr in attrs)) throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
7576
- for (let attr in attrs) if (attrs[attr].validate) attrs[attr].validate(values[attr]);
7577
- }
7578
7671
  function initAttrs(typeName, attrs) {
7579
7672
  let result = Object.create(null);
7580
7673
  if (attrs) for (let name in attrs) result[name] = new Attribute(typeName, name, attrs[name]);
@@ -7729,11 +7822,9 @@ window.__ModuleLoader__.load({
7729
7822
  if (!this.validContent(content)) throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
7730
7823
  }
7731
7824
  /**
7732
- @internal
7825
+ @internal no longer useful, but called by old prosemirror-view versions
7733
7826
  */
7734
- checkAttrs(attrs) {
7735
- checkAttrs(this.attrs, attrs, "node", this.name);
7736
- }
7827
+ checkAttrs(attrs) {}
7737
7828
  /**
7738
7829
  Check whether the given mark type is allowed in this node.
7739
7830
  */
@@ -7844,12 +7935,6 @@ window.__ModuleLoader__.load({
7844
7935
  for (let i = 0; i < set.length; i++) if (set[i].type == this) return set[i];
7845
7936
  }
7846
7937
  /**
7847
- @internal
7848
- */
7849
- checkAttrs(attrs) {
7850
- checkAttrs(this.attrs, attrs, "mark", this.name);
7851
- }
7852
- /**
7853
7938
  Queries whether a given mark type is
7854
7939
  [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
7855
7940
  */
@@ -8708,7 +8793,7 @@ window.__ModuleLoader__.load({
8708
8793
  };
8709
8794
  }
8710
8795
  //#endregion
8711
- //#region node_modules/.pnpm/prosemirror-transform@1.12.0/node_modules/prosemirror-transform/dist/index.js
8796
+ //#region node_modules/.pnpm/prosemirror-transform@1.12.5/node_modules/prosemirror-transform/dist/index.js
8712
8797
  const lower16 = 65535;
8713
8798
  const factor16 = Math.pow(2, 16);
8714
8799
  function makeRecover(index, offset) {
@@ -8811,8 +8896,11 @@ window.__ModuleLoader__.load({
8811
8896
  let result = start + diff + (side < 0 ? 0 : newSize);
8812
8897
  if (simple) return result;
8813
8898
  let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
8814
- let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
8815
- if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
8899
+ let del = 0;
8900
+ if (oldSize) {
8901
+ del |= pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
8902
+ if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
8903
+ }
8816
8904
  return new MapResult(result, del, recover);
8817
8905
  }
8818
8906
  diff += newSize - oldSize;
@@ -9128,13 +9216,24 @@ window.__ModuleLoader__.load({
9128
9216
  }, parent), oldSlice.openStart, oldSlice.openEnd);
9129
9217
  return StepResult.fromReplace(doc, this.from, this.to, slice);
9130
9218
  }
9131
- invert() {
9132
- return new RemoveMarkStep(this.from, this.to, this.mark);
9219
+ invert(doc) {
9220
+ let steps = [];
9221
+ doc.nodesBetween(this.from, this.to, (node, pos) => {
9222
+ if (node.isInline && node.isAtom) {
9223
+ let added = this.mark.addToSet(node.marks);
9224
+ if (!Mark$1.sameSet(added, node.marks)) {
9225
+ let from = Math.max(this.from, pos), to = Math.min(this.to, pos + node.nodeSize);
9226
+ pushMarkStep(RemoveMarkStep, from, to, this.mark, steps);
9227
+ for (let mark of node.marks) if (!mark.isInSet(added)) pushMarkStep(AddMarkStep, from, to, mark, steps);
9228
+ }
9229
+ }
9230
+ });
9231
+ return steps.length == 1 ? steps[0] : new MarkSetStep(steps);
9133
9232
  }
9134
9233
  map(mapping) {
9135
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
9136
- if (from.deleted && to.deleted || from.pos >= to.pos) return null;
9137
- return new AddMarkStep(from.pos, to.pos, this.mark);
9234
+ let from = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
9235
+ if (from >= to) return null;
9236
+ return new AddMarkStep(from, to, this.mark);
9138
9237
  }
9139
9238
  merge(other) {
9140
9239
  if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
@@ -9177,13 +9276,17 @@ window.__ModuleLoader__.load({
9177
9276
  }, doc), oldSlice.openStart, oldSlice.openEnd);
9178
9277
  return StepResult.fromReplace(doc, this.from, this.to, slice);
9179
9278
  }
9180
- invert() {
9181
- return new AddMarkStep(this.from, this.to, this.mark);
9279
+ invert(doc) {
9280
+ let steps = [];
9281
+ doc.nodesBetween(this.from, this.to, (node, pos) => {
9282
+ if (node.isInline && node.isAtom && this.mark.isInSet(node.marks)) pushMarkStep(AddMarkStep, Math.max(this.from, pos), Math.min(this.to, pos + node.nodeSize), this.mark, steps);
9283
+ });
9284
+ return steps.length == 1 ? steps[0] : new MarkSetStep(steps);
9182
9285
  }
9183
9286
  map(mapping) {
9184
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
9185
- if (from.deleted && to.deleted || from.pos >= to.pos) return null;
9186
- return new RemoveMarkStep(from.pos, to.pos, this.mark);
9287
+ let from = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
9288
+ if (from >= to) return null;
9289
+ return new RemoveMarkStep(from, to, this.mark);
9187
9290
  }
9188
9291
  merge(other) {
9189
9292
  if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
@@ -9206,6 +9309,47 @@ window.__ModuleLoader__.load({
9206
9309
  }
9207
9310
  };
9208
9311
  Step.jsonID("removeMark", RemoveMarkStep);
9312
+ function pushMarkStep(cls, from, to, mark, target) {
9313
+ let last = target.length ? target[target.length - 1] : null;
9314
+ if (last && last instanceof cls && last.to == from && last.mark.eq(mark)) target[target.length - 1] = new cls(last.from, to, mark);
9315
+ else target.push(new cls(from, to, mark));
9316
+ }
9317
+ var MarkSetStep = class MarkSetStep extends Step {
9318
+ constructor(steps) {
9319
+ super();
9320
+ this.steps = steps;
9321
+ }
9322
+ apply(doc) {
9323
+ for (let step of this.steps) {
9324
+ let result = step.apply(doc);
9325
+ if (!result.doc) return result;
9326
+ doc = result.doc;
9327
+ }
9328
+ return new StepResult(doc, null);
9329
+ }
9330
+ invert(doc) {
9331
+ return new MarkSetStep(this.steps.map((s) => s.invert(doc)));
9332
+ }
9333
+ map(mapping) {
9334
+ let result = [];
9335
+ for (let step of this.steps) {
9336
+ let mapped = step.map(mapping);
9337
+ if (mapped) result.push(mapped);
9338
+ }
9339
+ return result.length ? new MarkSetStep(result) : null;
9340
+ }
9341
+ toJSON() {
9342
+ return {
9343
+ stepType: "markSet",
9344
+ steps: this.steps.map((s) => s.toJSON())
9345
+ };
9346
+ }
9347
+ static fromJSON(schema, json) {
9348
+ if (!Array.isArray(json.steps) || !json.steps.every((s) => s.stepType == "addMark" || s.stepType == "removeMark")) throw new RangeError("Invalid JSON for MarkSetStep");
9349
+ return new MarkSetStep(json.steps.map((s) => Step.fromJSON(schema, s)));
9350
+ }
9351
+ };
9352
+ Step.jsonID("markSet", MarkSetStep);
9209
9353
  /**
9210
9354
  Add a mark to a specific node.
9211
9355
  */
@@ -9424,7 +9568,7 @@ window.__ModuleLoader__.load({
9424
9568
  let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
9425
9569
  let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
9426
9570
  let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
9427
- if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos) return null;
9571
+ if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos || gapFrom > gapTo) return null;
9428
9572
  return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
9429
9573
  }
9430
9574
  toJSON() {
@@ -9466,27 +9610,18 @@ window.__ModuleLoader__.load({
9466
9610
  return false;
9467
9611
  }
9468
9612
  function addMark(tr, from, to, mark) {
9469
- let removed = [], added = [];
9470
- let removing, adding;
9613
+ let added = [];
9471
9614
  tr.doc.nodesBetween(from, to, (node, pos, parent) => {
9472
9615
  if (!node.isInline) return;
9473
9616
  let marks = node.marks;
9474
- if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
9475
- let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);
9476
- let newSet = mark.addToSet(marks);
9477
- for (let i = 0; i < marks.length; i++) if (!marks[i].isInSet(newSet)) if (removing && removing.to == start && removing.mark.eq(marks[i])) removing.to = end;
9478
- else removed.push(removing = new RemoveMarkStep(start, end, marks[i]));
9479
- if (adding && adding.to == start) adding.to = end;
9480
- else added.push(adding = new AddMarkStep(start, end, mark));
9481
- }
9617
+ if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) pushMarkStep(AddMarkStep, Math.max(pos, from), Math.min(pos + node.nodeSize, to), mark, added);
9482
9618
  });
9483
- removed.forEach((s) => tr.step(s));
9484
9619
  added.forEach((s) => tr.step(s));
9485
9620
  }
9486
9621
  function removeMark(tr, from, to, mark) {
9487
9622
  let matched = [], step = 0;
9488
9623
  tr.doc.nodesBetween(from, to, (node, pos) => {
9489
- if (!node.isInline) return;
9624
+ if (!node.isInline || !node.isAtom) return;
9490
9625
  step++;
9491
9626
  let toRemove = null;
9492
9627
  if (mark instanceof MarkType) {
@@ -9908,9 +10043,9 @@ window.__ModuleLoader__.load({
9908
10043
  }
9909
10044
  openMore() {
9910
10045
  let { content, openStart, openEnd } = this.unplaced;
9911
- let inner = contentAt(content, openStart);
9912
- if (!inner.childCount || inner.firstChild.isLeaf) return false;
9913
- this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
10046
+ if (maxOpen(content, -1) <= openStart) return false;
10047
+ if (this.unplaced.size > 1 && maxOpen(content, 1) > openEnd) openEnd++;
10048
+ this.unplaced = new Slice(content, openStart + 1, openEnd);
9914
10049
  return true;
9915
10050
  }
9916
10051
  dropNode() {
@@ -9947,15 +10082,14 @@ window.__ModuleLoader__.load({
9947
10082
  this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));
9948
10083
  this.frontier[frontierDepth].match = match;
9949
10084
  if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1) this.closeFrontierNode();
9950
- for (let i = 0, cur = fragment; i < openEndCount; i++) {
9951
- let node = cur.lastChild;
10085
+ for (let i = 0, cur = add[add.length - 1]; cur && i < openEndCount; i++) {
9952
10086
  this.frontier.push({
9953
- type: node.type,
9954
- match: node.contentMatchAt(node.childCount)
10087
+ type: cur.type,
10088
+ match: cur.contentMatchAt(cur.childCount)
9955
10089
  });
9956
- cur = node.content;
10090
+ cur = cur.lastChild;
9957
10091
  }
9958
- this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
10092
+ this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), sliceDepth, slice.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
9959
10093
  }
9960
10094
  mustMoveInline() {
9961
10095
  if (!this.$to.parent.isTextblock) return -1;
@@ -10044,6 +10178,13 @@ window.__ModuleLoader__.load({
10044
10178
  function definesContent(type) {
10045
10179
  return type.spec.defining || type.spec.definingForContent;
10046
10180
  }
10181
+ function maxOpen(frag, side) {
10182
+ for (let count = 0;; count++) {
10183
+ let ch = side < 0 ? frag.firstChild : frag.lastChild;
10184
+ if (!ch || ch.isAtom) return count;
10185
+ frag = ch.content;
10186
+ }
10187
+ }
10047
10188
  function replaceRange(tr, from, to, slice) {
10048
10189
  if (!slice.size) return tr.deleteRange(from, to);
10049
10190
  let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
@@ -11489,7 +11630,7 @@ window.__ModuleLoader__.load({
11489
11630
  }
11490
11631
  };
11491
11632
  //#endregion
11492
- //#region node_modules/.pnpm/prosemirror-view@1.42.2/node_modules/prosemirror-view/dist/index.js
11633
+ //#region node_modules/.pnpm/prosemirror-view@1.42.9/node_modules/prosemirror-view/dist/index.js
11493
11634
  const domIndex = function(node) {
11494
11635
  for (var index = 0;; index++) {
11495
11636
  node = node.previousSibling;
@@ -11520,12 +11661,12 @@ window.__ModuleLoader__.load({
11520
11661
  if (node == targetNode && off == targetOff) return true;
11521
11662
  if (off == (dir < 0 ? 0 : nodeSize(node))) {
11522
11663
  let parent = node.parentNode;
11523
- if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == "false") return false;
11664
+ if (!parent || !isElt(parent) || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == "false") return false;
11524
11665
  off = domIndex(node) + (dir < 0 ? 0 : 1);
11525
11666
  node = parent;
11526
- } else if (node.nodeType == 1) {
11667
+ } else if (isElt(node)) {
11527
11668
  let child = node.childNodes[off + (dir < 0 ? -1 : 0)];
11528
- if (child.nodeType == 1 && child.contentEditable == "false") if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection) off += dir;
11669
+ if (isElt(child) && child.contentEditable == "false") if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection) off += dir;
11529
11670
  else return false;
11530
11671
  else {
11531
11672
  node = child;
@@ -11537,10 +11678,19 @@ window.__ModuleLoader__.load({
11537
11678
  function nodeSize(node) {
11538
11679
  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
11539
11680
  }
11681
+ function isElt(node) {
11682
+ return node.nodeType == 1;
11683
+ }
11684
+ function isText(node) {
11685
+ return node.nodeType == 3;
11686
+ }
11687
+ function contains(parent, child) {
11688
+ return child ? parent.contains(isElt(child) ? child : child.parentNode) : false;
11689
+ }
11540
11690
  function textNodeBefore$1(node, offset) {
11541
11691
  for (;;) {
11542
- if (node.nodeType == 3 && offset) return node;
11543
- if (node.nodeType == 1 && offset > 0) {
11692
+ if (isText(node) && offset) return node;
11693
+ if (isElt(node) && offset > 0) {
11544
11694
  if (node.contentEditable == "false") return null;
11545
11695
  node = node.childNodes[offset - 1];
11546
11696
  offset = nodeSize(node);
@@ -11552,8 +11702,8 @@ window.__ModuleLoader__.load({
11552
11702
  }
11553
11703
  function textNodeAfter$1(node, offset) {
11554
11704
  for (;;) {
11555
- if (node.nodeType == 3 && offset < node.nodeValue.length) return node;
11556
- if (node.nodeType == 1 && offset < node.childNodes.length) {
11705
+ if (isText(node) && offset < node.nodeValue.length) return node;
11706
+ if (isElt(node) && offset < node.childNodes.length) {
11557
11707
  if (node.contentEditable == "false") return null;
11558
11708
  node = node.childNodes[offset];
11559
11709
  offset = 0;
@@ -11664,13 +11814,12 @@ window.__ModuleLoader__.load({
11664
11814
  let doc = view.dom.ownerDocument;
11665
11815
  for (let parent = startDOM || view.dom;;) {
11666
11816
  if (!parent) break;
11667
- if (parent.nodeType != 1) {
11817
+ if (!isElt(parent)) {
11668
11818
  parent = parentNode(parent);
11669
11819
  continue;
11670
11820
  }
11671
- let elt = parent;
11672
- let atTop = elt == doc.body;
11673
- let bounding = atTop ? windowRect(doc) : clientRect(elt);
11821
+ let atTop = parent == doc.body;
11822
+ let bounding = atTop ? windowRect(doc) : clientRect(parent);
11674
11823
  let moveX = 0, moveY = 0;
11675
11824
  if (rect.top < bounding.top + getSide(scrollThreshold, "top")) moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
11676
11825
  else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom")) moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
@@ -11678,10 +11827,10 @@ window.__ModuleLoader__.load({
11678
11827
  else if (rect.right > bounding.right - getSide(scrollThreshold, "right")) moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
11679
11828
  if (moveX || moveY) if (atTop) doc.defaultView.scrollBy(moveX, moveY);
11680
11829
  else {
11681
- let startX = elt.scrollLeft, startY = elt.scrollTop;
11682
- if (moveY) elt.scrollTop += moveY;
11683
- if (moveX) elt.scrollLeft += moveX;
11684
- let dX = elt.scrollLeft - startX, dY = elt.scrollTop - startY;
11830
+ let startX = parent.scrollLeft, startY = parent.scrollTop;
11831
+ if (moveY) parent.scrollTop += moveY;
11832
+ if (moveX) parent.scrollLeft += moveX;
11833
+ let dX = parent.scrollLeft - startX, dY = parent.scrollTop - startY;
11685
11834
  rect = {
11686
11835
  left: rect.left - dX,
11687
11836
  top: rect.top - dY,
@@ -11751,13 +11900,14 @@ window.__ModuleLoader__.load({
11751
11900
  }
11752
11901
  }
11753
11902
  function findOffsetInNode(node, coords) {
11754
- let closest, dxClosest = 2e8, coordsClosest, offset = 0;
11903
+ let closest;
11904
+ let dxClosest = 2e8, coordsClosest, offset = 0;
11755
11905
  let rowBot = coords.top, rowTop = coords.top;
11756
11906
  let firstBelow, coordsBelow;
11757
11907
  for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {
11758
11908
  let rects;
11759
- if (child.nodeType == 1) rects = child.getClientRects();
11760
- else if (child.nodeType == 3) rects = textRange(child).getClientRects();
11909
+ if (isElt(child)) rects = child.getClientRects();
11910
+ else if (isText(child)) rects = textRange(child).getClientRects();
11761
11911
  else continue;
11762
11912
  for (let i = 0; i < rects.length; i++) {
11763
11913
  let rect = rects[i];
@@ -11768,11 +11918,11 @@ window.__ModuleLoader__.load({
11768
11918
  if (dx < dxClosest) {
11769
11919
  closest = child;
11770
11920
  dxClosest = dx;
11771
- coordsClosest = dx && closest.nodeType == 3 ? {
11921
+ coordsClosest = dx && isText(closest) ? {
11772
11922
  left: rect.right < coords.left ? rect.right : rect.left,
11773
11923
  top: coords.top
11774
11924
  } : coords;
11775
- if (child.nodeType == 1 && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);
11925
+ if (isElt(child) && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);
11776
11926
  continue;
11777
11927
  }
11778
11928
  } else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {
@@ -11790,8 +11940,8 @@ window.__ModuleLoader__.load({
11790
11940
  coordsClosest = coordsBelow;
11791
11941
  dxClosest = 0;
11792
11942
  }
11793
- if (closest && closest.nodeType == 3) return findOffsetInText(closest, coordsClosest);
11794
- if (!closest || dxClosest && closest.nodeType == 1) return {
11943
+ if (closest && isText(closest)) return findOffsetInText(closest, coordsClosest);
11944
+ if (!closest || dxClosest) return {
11795
11945
  node,
11796
11946
  offset
11797
11947
  };
@@ -11829,7 +11979,7 @@ window.__ModuleLoader__.load({
11829
11979
  }
11830
11980
  function posFromElement(view, elt, coords) {
11831
11981
  let { node, offset } = findOffsetInNode(elt, coords), bias = -1;
11832
- if (node.nodeType == 1 && !node.firstChild) {
11982
+ if (isElt(node) && !node.firstChild) {
11833
11983
  let rect = node.getBoundingClientRect();
11834
11984
  bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;
11835
11985
  }
@@ -11841,7 +11991,7 @@ window.__ModuleLoader__.load({
11841
11991
  if (cur == view.dom) break;
11842
11992
  let desc = view.docView.nearestDesc(cur, true), rect;
11843
11993
  if (!desc) return null;
11844
- if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
11994
+ if (isElt(desc.dom) && (desc.node.isBlock && desc.parent || !desc.contentDOM) && ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
11845
11995
  if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
11846
11996
  if (!sawBlock && rect.left > coords.left || rect.top > coords.top) outsideBlock = desc.posBefore;
11847
11997
  else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top) outsideBlock = desc.posAfter;
@@ -11857,7 +12007,7 @@ window.__ModuleLoader__.load({
11857
12007
  let len = element.childNodes.length;
11858
12008
  if (len && box.top < box.bottom) for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {
11859
12009
  let child = element.childNodes[i];
11860
- if (child.nodeType == 1) {
12010
+ if (isElt(child)) {
11861
12011
  let rects = child.getClientRects();
11862
12012
  for (let j = 0; j < rects.length; j++) {
11863
12013
  let rect = rects[j];
@@ -11874,7 +12024,7 @@ window.__ModuleLoader__.load({
11874
12024
  if (caret) ({node, offset} = caret);
11875
12025
  let elt = (view.root.elementFromPoint ? view.root : doc).elementFromPoint(coords.left, coords.top);
11876
12026
  let pos;
11877
- if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {
12027
+ if (!elt || !view.dom.contains(elt)) {
11878
12028
  let box = view.dom.getBoundingClientRect();
11879
12029
  if (!inRect(coords, box)) return null;
11880
12030
  elt = elementFromPoint(view.dom, coords, box);
@@ -11885,7 +12035,7 @@ window.__ModuleLoader__.load({
11885
12035
  }
11886
12036
  elt = targetKludge(elt, coords);
11887
12037
  if (node) {
11888
- if (gecko && node.nodeType == 1) {
12038
+ if (gecko && isElt(node)) {
11889
12039
  offset = Math.min(offset, node.childNodes.length);
11890
12040
  if (offset < node.childNodes.length) {
11891
12041
  let next = node.childNodes[offset], box;
@@ -11893,9 +12043,9 @@ window.__ModuleLoader__.load({
11893
12043
  }
11894
12044
  }
11895
12045
  let prev;
11896
- if (webkit && offset && node.nodeType == 1 && (prev = node.childNodes[offset - 1]).nodeType == 1 && prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top) offset--;
11897
- if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 && coords.top > node.lastChild.getBoundingClientRect().bottom) pos = view.state.doc.content.size;
11898
- else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != "BR") pos = posFromCaret(view, node, offset, coords);
12046
+ if (webkit && offset && isElt(node) && isElt(prev = node.childNodes[offset - 1]) && prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top) offset--;
12047
+ if (node == view.dom && offset == node.childNodes.length - 1 && isElt(node.lastChild) && coords.top > node.lastChild.getBoundingClientRect().bottom) pos = view.state.doc.content.size;
12048
+ else if (offset == 0 || !isElt(node) || node.childNodes[offset - 1].nodeName != "BR") pos = posFromCaret(view, node, offset, coords);
11899
12049
  }
11900
12050
  if (pos == null) pos = posFromElement(view, elt, coords);
11901
12051
  let desc = view.docView.nearestDesc(elt, true);
@@ -11919,7 +12069,7 @@ window.__ModuleLoader__.load({
11919
12069
  function coordsAtPos(view, pos, side) {
11920
12070
  let { node, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);
11921
12071
  let supportEmptyRange = webkit || gecko;
11922
- if (node.nodeType == 3) if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {
12072
+ if (isText(node)) if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {
11923
12073
  let rect = singleRect(textRange(node, offset, offset), side);
11924
12074
  if (gecko && offset && /\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {
11925
12075
  let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);
@@ -11944,26 +12094,26 @@ window.__ModuleLoader__.load({
11944
12094
  if (!view.state.doc.resolve(pos - (atom || 0)).parent.inlineContent) {
11945
12095
  if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
11946
12096
  let before = node.childNodes[offset - 1];
11947
- if (before.nodeType == 1) return flattenH(before.getBoundingClientRect(), false);
12097
+ if (isElt(before)) return flattenH(before.getBoundingClientRect(), false);
11948
12098
  }
11949
12099
  if (atom == null && offset < nodeSize(node)) {
11950
12100
  let after = node.childNodes[offset];
11951
- if (after.nodeType == 1) return flattenH(after.getBoundingClientRect(), true);
12101
+ if (isElt(after)) return flattenH(after.getBoundingClientRect(), true);
11952
12102
  }
11953
12103
  return flattenH(node.getBoundingClientRect(), side >= 0);
11954
12104
  }
11955
12105
  if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
11956
12106
  let before = node.childNodes[offset - 1];
11957
- let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1)) : before.nodeType == 1 && (before.nodeName != "BR" || !before.nextSibling) ? before : null;
12107
+ let target = isText(before) ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1)) : isElt(before) && (before.nodeName != "BR" || !before.nextSibling) ? before : null;
11958
12108
  if (target) return flattenV(singleRect(target, 1), false);
11959
12109
  }
11960
12110
  if (atom == null && offset < nodeSize(node)) {
11961
12111
  let after = node.childNodes[offset];
11962
12112
  while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords) after = after.nextSibling;
11963
- let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, supportEmptyRange ? 0 : 1) : after.nodeType == 1 ? after : null;
12113
+ let target = !after ? null : isText(after) ? textRange(after, 0, supportEmptyRange ? 0 : 1) : isElt(after) ? after : null;
11964
12114
  if (target) return flattenV(singleRect(target, -1), true);
11965
12115
  }
11966
- return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);
12116
+ return flattenV(singleRect(isText(node) ? textRange(node) : node, -side), side >= 0);
11967
12117
  }
11968
12118
  function flattenV(rect, left) {
11969
12119
  if (rect.width == 0) return rect;
@@ -12013,8 +12163,8 @@ window.__ModuleLoader__.load({
12013
12163
  let coords = coordsAtPos(view, $pos.pos, 1);
12014
12164
  for (let child = dom.firstChild; child; child = child.nextSibling) {
12015
12165
  let boxes;
12016
- if (child.nodeType == 1) boxes = child.getClientRects();
12017
- else if (child.nodeType == 3) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();
12166
+ if (isElt(child)) boxes = child.getClientRects();
12167
+ else if (isText(child)) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();
12018
12168
  else continue;
12019
12169
  for (let i = 0; i < boxes.length; i++) {
12020
12170
  let box = boxes[i];
@@ -12038,7 +12188,7 @@ window.__ModuleLoader__.load({
12038
12188
  sel.modify("move", dir, "character");
12039
12189
  let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;
12040
12190
  let { focusNode: newNode, focusOffset: newOff } = view.domSelectionRange();
12041
- let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) || oldNode == newNode && oldOff == newOff;
12191
+ let result = newNode && !contains(parentDOM, newNode) || oldNode == newNode && oldOff == newOff;
12042
12192
  try {
12043
12193
  sel.collapse(anchorNode, anchorOffset);
12044
12194
  if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend) sel.extend(oldNode, oldOff);
@@ -12120,7 +12270,7 @@ window.__ModuleLoader__.load({
12120
12270
  return this.posAtStart + this.size - 2 * this.border;
12121
12271
  }
12122
12272
  localPosFromDOM(dom, offset, bias) {
12123
- if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) if (bias < 0) {
12273
+ if (this.contentDOM && contains(this.contentDOM, dom)) if (bias < 0) {
12124
12274
  let domBefore, desc;
12125
12275
  if (dom == this.contentDOM) domBefore = dom.childNodes[offset - 1];
12126
12276
  else {
@@ -12141,8 +12291,11 @@ window.__ModuleLoader__.load({
12141
12291
  }
12142
12292
  let atEnd;
12143
12293
  if (dom == this.dom && this.contentDOM) atEnd = offset > domIndex(this.contentDOM);
12144
- else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;
12145
- else if (this.dom.firstChild) {
12294
+ else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {
12295
+ let rel = dom.compareDocumentPosition(this.contentDOM);
12296
+ if (rel & 16) atEnd = offset > Array.from(dom.childNodes).findIndex((n) => n.contains(this.contentDOM));
12297
+ else atEnd = !(rel & 4);
12298
+ } else if (this.dom.firstChild) {
12146
12299
  if (offset == 0) for (let search = dom;; search = search.parentNode) {
12147
12300
  if (search == this.dom) {
12148
12301
  atEnd = false;
@@ -12163,7 +12316,7 @@ window.__ModuleLoader__.load({
12163
12316
  nearestDesc(dom, onlyNodes = false) {
12164
12317
  for (let first = true, cur = dom; cur; cur = cur.parentNode) {
12165
12318
  let desc = this.getDesc(cur), nodeDOM;
12166
- if (desc && (!onlyNodes || desc.node)) if (first && (nodeDOM = desc.nodeDOM) && !(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom)) first = false;
12319
+ if (desc && (!onlyNodes || desc.node)) if (first && (nodeDOM = desc.nodeDOM) && !(isElt(nodeDOM) ? contains(nodeDOM, dom) : nodeDOM == dom)) first = false;
12167
12320
  else return desc;
12168
12321
  }
12169
12322
  }
@@ -12204,14 +12357,17 @@ window.__ModuleLoader__.load({
12204
12357
  let i = 0, offset = 0;
12205
12358
  for (let curPos = 0; i < this.children.length; i++) {
12206
12359
  let child = this.children[i], end = curPos + child.size;
12207
- if (end > pos || child instanceof TrailingHackViewDesc) {
12360
+ if (end > pos) {
12208
12361
  offset = pos - curPos;
12209
12362
  break;
12210
12363
  }
12211
12364
  curPos = end;
12212
12365
  }
12213
12366
  if (offset) return this.children[i].domFromPos(offset - this.children[i].border, side);
12214
- for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--);
12367
+ for (; i > 0; i--) {
12368
+ let prev = this.children[i - 1];
12369
+ if (prev.size || !(prev instanceof BufferHackViewDesc || prev instanceof WidgetViewDesc && prev.side >= 0)) break;
12370
+ }
12215
12371
  if (side <= 0) {
12216
12372
  let prev, enter = true;
12217
12373
  for (;; i--, enter = false) {
@@ -12291,7 +12447,7 @@ window.__ModuleLoader__.load({
12291
12447
  }
12292
12448
  domAfterPos(pos) {
12293
12449
  let { node, offset } = this.domFromPos(pos, 0);
12294
- if (node.nodeType != 1 || offset == node.childNodes.length) throw new RangeError("No node after pos " + pos);
12450
+ if (!isElt(node) || offset == node.childNodes.length) throw new RangeError("No node after pos " + pos);
12295
12451
  return node.childNodes[offset];
12296
12452
  }
12297
12453
  setSelection(anchor, head, view, force = false) {
@@ -12308,7 +12464,7 @@ window.__ModuleLoader__.load({
12308
12464
  let brKludge = false;
12309
12465
  if ((gecko || safari) && anchor == head) {
12310
12466
  let { node, offset } = anchorDOM;
12311
- if (node.nodeType == 3) {
12467
+ if (isText(node)) {
12312
12468
  brKludge = !!(offset && node.nodeValue[offset - 1] == "\n");
12313
12469
  if (brKludge && offset == node.nodeValue.length) for (let scan = node, after; scan; scan = scan.parentNode) {
12314
12470
  if (after = scan.nextSibling) {
@@ -12326,7 +12482,7 @@ window.__ModuleLoader__.load({
12326
12482
  brKludge = prev && (prev.nodeName == "BR" || prev.contentEditable == "false");
12327
12483
  }
12328
12484
  }
12329
- if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {
12485
+ if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && isElt(selRange.focusNode)) {
12330
12486
  let after = selRange.focusNode.childNodes[selRange.focusOffset];
12331
12487
  if (after && after.contentEditable == "false") force = true;
12332
12488
  }
@@ -12402,13 +12558,13 @@ window.__ModuleLoader__.load({
12402
12558
  if (self.parent) return self.parent.posBeforeChild(self);
12403
12559
  });
12404
12560
  if (!widget.type.spec.raw) {
12405
- if (dom.nodeType != 1) {
12406
- let wrap = document.createElement("span");
12407
- wrap.appendChild(dom);
12408
- dom = wrap;
12561
+ let elt = isElt(dom) ? dom : document.createElement("span");
12562
+ if (elt != dom) {
12563
+ elt.appendChild(dom);
12564
+ dom = elt;
12409
12565
  }
12410
- dom.contentEditable = "false";
12411
- dom.classList.add("ProseMirror-widget");
12566
+ if (!elt.hasAttribute("contenteditable")) elt.contentEditable = "false";
12567
+ elt.classList.add("ProseMirror-widget");
12412
12568
  }
12413
12569
  super(parent, [], dom, null);
12414
12570
  this.widget = widget;
@@ -12531,7 +12687,7 @@ window.__ModuleLoader__.load({
12531
12687
  let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;
12532
12688
  if (node.isText) {
12533
12689
  if (!dom) dom = document.createTextNode(node.text);
12534
- else if (dom.nodeType != 3) throw new RangeError("Text must be rendered as a DOM text node");
12690
+ else if (!isText(dom)) throw new RangeError("Text must be rendered as a DOM text node");
12535
12691
  } else if (!dom) {
12536
12692
  let spec = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);
12537
12693
  ({dom, contentDOM} = spec);
@@ -12564,7 +12720,7 @@ window.__ModuleLoader__.load({
12564
12720
  }
12565
12721
  }
12566
12722
  if (!rule.contentElement) {
12567
- let found = addedNodes && addedNodes.find((n) => n.nodeType == 1 && addedNodes.indexOf(n.parentNode) < 0 && this.dom.contains(n));
12723
+ let found = addedNodes && addedNodes.find((n) => isElt(n) && addedNodes.indexOf(n.parentNode) < 0 && this.dom.contains(n));
12568
12724
  if (found) rule.contentElement = found;
12569
12725
  else rule.getContent = () => Fragment.empty;
12570
12726
  }
@@ -12586,18 +12742,21 @@ window.__ModuleLoader__.load({
12586
12742
  let localComposition = composition && composition.pos > -1 ? composition : null;
12587
12743
  let compositionInChild = composition && composition.pos < 0;
12588
12744
  let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);
12745
+ let addBuffers = this.node.inlineContent, atBufferPos = addBuffers && this.node.isBlock;
12589
12746
  iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {
12590
12747
  if (widget.spec.marks) updater.syncToMarks(widget.spec.marks, inline, view, i);
12591
12748
  else if (widget.type.side >= 0 && !insideNode) updater.syncToMarks(i == this.node.childCount ? Mark$1.none : this.node.child(i).marks, inline, view, i);
12592
12749
  updater.placeWidget(widget, view, off);
12593
12750
  }, (child, outerDeco, innerDeco, i) => {
12594
12751
  updater.syncToMarks(child.marks, inline, view, i);
12752
+ if (atBufferPos && child.isAtom && !child.isText) updater.addHackNode("IMG", updater.top);
12595
12753
  let compIndex;
12596
12754
  if (updater.findNodeMatch(child, outerDeco, innerDeco, i));
12597
12755
  else if (compositionInChild && view.state.selection.from > off && view.state.selection.to < off + child.nodeSize && (compIndex = updater.findIndexWithChild(composition.node)) > -1 && updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view));
12598
12756
  else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off));
12599
12757
  else updater.addNode(child, outerDeco, innerDeco, view, off);
12600
12758
  off += child.nodeSize;
12759
+ if (addBuffers) atBufferPos = child.isAtom && !child.isText;
12601
12760
  });
12602
12761
  updater.syncToMarks([], inline, view, 0);
12603
12762
  if (this.node.isTextblock) updater.addTextblockHacks();
@@ -12654,7 +12813,7 @@ window.__ModuleLoader__.load({
12654
12813
  }
12655
12814
  updateOuterDeco(outerDeco) {
12656
12815
  if (sameOuterDeco(outerDeco, this.outerDeco)) return;
12657
- let needsWrap = this.nodeDOM.nodeType != 1;
12816
+ let needsWrap = !isElt(this.nodeDOM);
12658
12817
  let oldDOM = this.dom;
12659
12818
  this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));
12660
12819
  if (this.dom != oldDOM) {
@@ -12664,13 +12823,13 @@ window.__ModuleLoader__.load({
12664
12823
  this.outerDeco = outerDeco;
12665
12824
  }
12666
12825
  selectNode() {
12667
- if (this.nodeDOM.nodeType == 1) {
12826
+ if (isElt(this.nodeDOM)) {
12668
12827
  this.nodeDOM.classList.add("ProseMirror-selectednode");
12669
12828
  if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.draggable = true;
12670
12829
  }
12671
12830
  }
12672
12831
  deselectNode() {
12673
- if (this.nodeDOM.nodeType == 1) {
12832
+ if (isElt(this.nodeDOM)) {
12674
12833
  this.nodeDOM.classList.remove("ProseMirror-selectednode");
12675
12834
  if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.removeAttribute("draggable");
12676
12835
  }
@@ -12738,7 +12897,7 @@ window.__ModuleLoader__.load({
12738
12897
  return this.node.text == text;
12739
12898
  }
12740
12899
  };
12741
- var TrailingHackViewDesc = class extends ViewDesc {
12900
+ var BufferHackViewDesc = class extends ViewDesc {
12742
12901
  parseRule() {
12743
12902
  return { ignore: true };
12744
12903
  }
@@ -12874,7 +13033,7 @@ window.__ModuleLoader__.load({
12874
13033
  }
12875
13034
  }
12876
13035
  function applyOuterDeco(dom, deco, node) {
12877
- return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1));
13036
+ return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, !isElt(dom)));
12878
13037
  }
12879
13038
  function sameOuterDeco(a, b) {
12880
13039
  if (a.length != b.length) return false;
@@ -13064,14 +13223,14 @@ window.__ModuleLoader__.load({
13064
13223
  dom.alt = "";
13065
13224
  }
13066
13225
  if (nodeName == "BR") dom.className = "ProseMirror-trailingBreak";
13067
- let hack = new TrailingHackViewDesc(this.top, [], dom, null);
13226
+ let hack = new BufferHackViewDesc(this.top, [], dom, null);
13068
13227
  if (parent != this.top) parent.children.push(hack);
13069
13228
  else parent.children.splice(this.index++, 0, hack);
13070
13229
  this.changed = true;
13071
13230
  }
13072
13231
  }
13073
13232
  isLocked(node) {
13074
- return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode));
13233
+ return this.lock && (node == this.lock || isElt(node) && node.contains(this.lock.parentNode));
13075
13234
  }
13076
13235
  };
13077
13236
  function preMatch(frag, parentDesc) {
@@ -13215,10 +13374,15 @@ window.__ModuleLoader__.load({
13215
13374
  if (selectionCollapsed(domSel)) {
13216
13375
  anchor = head;
13217
13376
  while (nearestDesc && !nearestDesc.node) nearestDesc = nearestDesc.parent;
13218
- let nearestDescNode = nearestDesc.node;
13219
- if (nearestDesc && nearestDescNode.isAtom && NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {
13377
+ if (nearestDesc && nearestDesc.node.isAtom && NodeSelection.isSelectable(nearestDesc.node) && nearestDesc.parent && !(nearestDesc.node.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {
13220
13378
  let pos = nearestDesc.posBefore;
13221
13379
  selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));
13380
+ } else if (gecko && origin == "key" && head > view.state.selection.to && isElt(domSel.focusNode) && domSel.focusOffset == domSel.focusNode.childNodes.length && nearestDesc && nearestDesc.posAtStart > view.state.selection.to) for (let scan = domSel.focusNode;; scan = scan.parentNode) {
13381
+ if (getComputedStyle(scan).overflow != "visible") {
13382
+ selection = Selection.findFrom(doc.resolve(nearestDesc.posAtStart), 1);
13383
+ break;
13384
+ }
13385
+ if (scan == nearestDesc.dom || scan.nextSibling || !scan.parentNode || !isElt(scan.parentNode)) break;
13222
13386
  }
13223
13387
  } else {
13224
13388
  if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {
@@ -13356,7 +13520,7 @@ window.__ModuleLoader__.load({
13356
13520
  let sel = view.domSelectionRange();
13357
13521
  if (!sel.anchorNode) return false;
13358
13522
  try {
13359
- return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) && (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode));
13523
+ return contains(view.dom, sel.anchorNode) && (view.editable || contains(view.dom, sel.focusNode));
13360
13524
  } catch (_) {
13361
13525
  return false;
13362
13526
  }
@@ -13389,14 +13553,13 @@ window.__ModuleLoader__.load({
13389
13553
  let next = moveSelectionBlock(view.state, dir);
13390
13554
  if (next && next instanceof NodeSelection) return apply$2(view, next);
13391
13555
  return false;
13392
- } else if (!(mac$2 && mods.indexOf("m") > -1)) {
13556
+ } else if (!mac$2 || mods.indexOf("m") < 0) {
13393
13557
  let $head = sel.$head, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter, desc;
13394
13558
  if (!node || node.isText) return false;
13395
13559
  let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;
13396
13560
  if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) return false;
13397
13561
  if (NodeSelection.isSelectable(node)) return apply$2(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));
13398
- else if (webkit) return apply$2(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));
13399
- else return false;
13562
+ else return apply$2(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));
13400
13563
  }
13401
13564
  } else if (sel instanceof NodeSelection && sel.node.isInline) return apply$2(view, new TextSelection(dir > 0 ? sel.$to : sel.$from));
13402
13565
  else {
@@ -13405,12 +13568,9 @@ window.__ModuleLoader__.load({
13405
13568
  return false;
13406
13569
  }
13407
13570
  }
13408
- function nodeLen(node) {
13409
- return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
13410
- }
13411
13571
  function isIgnorable(dom, dir) {
13412
13572
  let desc = dom.pmViewDesc;
13413
- return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR");
13573
+ return desc ? desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR") : isElt(dom) && dom.contentEditable == "false";
13414
13574
  }
13415
13575
  function skipIgnoredNodes(view, dir) {
13416
13576
  return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);
@@ -13420,19 +13580,18 @@ window.__ModuleLoader__.load({
13420
13580
  let node = sel.focusNode, offset = sel.focusOffset;
13421
13581
  if (!node) return;
13422
13582
  let moveNode, moveOffset, force = false;
13423
- if (gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset], -1)) force = true;
13424
- for (;;) if (offset > 0) if (node.nodeType != 1) break;
13425
- else {
13583
+ if (gecko && isElt(node) && offset < nodeSize(node) && isIgnorable(node.childNodes[offset], -1)) force = true;
13584
+ for (;;) if (offset > 0) {
13585
+ if (!isElt(node)) break;
13426
13586
  let before = node.childNodes[offset - 1];
13427
13587
  if (isIgnorable(before, -1)) {
13428
13588
  moveNode = node;
13429
13589
  moveOffset = --offset;
13430
- } else if (before.nodeType == 3) {
13590
+ } else if (isText(before)) {
13431
13591
  node = before;
13432
13592
  offset = node.nodeValue.length;
13433
13593
  } else break;
13434
- }
13435
- else if (isBlockNode(node)) break;
13594
+ } else if (isBlockNode(node)) break;
13436
13595
  else {
13437
13596
  let prev = node.previousSibling;
13438
13597
  while (prev && isIgnorable(prev, -1)) {
@@ -13446,7 +13605,7 @@ window.__ModuleLoader__.load({
13446
13605
  offset = 0;
13447
13606
  } else {
13448
13607
  node = prev;
13449
- offset = nodeLen(node);
13608
+ offset = nodeSize(node);
13450
13609
  }
13451
13610
  }
13452
13611
  if (force) setSelFocus(view, node, offset);
@@ -13456,10 +13615,10 @@ window.__ModuleLoader__.load({
13456
13615
  let sel = view.domSelectionRange();
13457
13616
  let node = sel.focusNode, offset = sel.focusOffset;
13458
13617
  if (!node) return;
13459
- let len = nodeLen(node);
13618
+ let len = nodeSize(node);
13460
13619
  let moveNode, moveOffset;
13461
13620
  for (;;) if (offset < len) {
13462
- if (node.nodeType != 1) break;
13621
+ if (!isElt(node)) break;
13463
13622
  let after = node.childNodes[offset];
13464
13623
  if (isIgnorable(after, 1)) {
13465
13624
  moveNode = node;
@@ -13480,7 +13639,7 @@ window.__ModuleLoader__.load({
13480
13639
  } else {
13481
13640
  node = next;
13482
13641
  offset = 0;
13483
- len = nodeLen(node);
13642
+ len = nodeSize(node);
13484
13643
  }
13485
13644
  }
13486
13645
  if (moveNode) setSelFocus(view, moveNode, moveOffset);
@@ -13496,8 +13655,8 @@ window.__ModuleLoader__.load({
13496
13655
  }
13497
13656
  while (node && offset < node.childNodes.length) {
13498
13657
  let next = node.childNodes[offset];
13499
- if (next.nodeType == 3) return next;
13500
- if (next.nodeType == 1 && next.contentEditable == "false") break;
13658
+ if (isText(next)) return next;
13659
+ if (isElt(next) && next.contentEditable == "false") break;
13501
13660
  node = next;
13502
13661
  offset = 0;
13503
13662
  }
@@ -13509,14 +13668,14 @@ window.__ModuleLoader__.load({
13509
13668
  }
13510
13669
  while (node && offset) {
13511
13670
  let next = node.childNodes[offset - 1];
13512
- if (next.nodeType == 3) return next;
13513
- if (next.nodeType == 1 && next.contentEditable == "false") break;
13671
+ if (isText(next)) return next;
13672
+ if (isElt(next) && next.contentEditable == "false") break;
13514
13673
  node = next;
13515
13674
  offset = node.childNodes.length;
13516
13675
  }
13517
13676
  }
13518
13677
  function setSelFocus(view, node, offset) {
13519
- if (node.nodeType != 3) {
13678
+ if (!isText(node)) {
13520
13679
  let before, after;
13521
13680
  if (after = textNodeAfter(node, offset)) {
13522
13681
  node = after;
@@ -13526,15 +13685,13 @@ window.__ModuleLoader__.load({
13526
13685
  offset = before.nodeValue.length;
13527
13686
  }
13528
13687
  }
13529
- let sel = view.domSelection();
13688
+ let sel = view.domSelection(), range = view.domSelectionRange();
13530
13689
  if (!sel) return;
13531
- if (selectionCollapsed(sel)) {
13532
- let range = document.createRange();
13533
- range.setEnd(node, offset);
13534
- range.setStart(node, offset);
13535
- sel.removeAllRanges();
13536
- sel.addRange(range);
13537
- } else if (sel.extend) sel.extend(node, offset);
13690
+ if (selectionCollapsed(range)) sel.collapse(node, offset);
13691
+ else if (sel.extend) {
13692
+ sel.collapse(range.anchorNode, range.anchorOffset);
13693
+ sel.extend(node, offset);
13694
+ }
13538
13695
  view.domObserver.setCurSelection();
13539
13696
  let { state } = view;
13540
13697
  setTimeout(() => {
@@ -13556,7 +13713,12 @@ window.__ModuleLoader__.load({
13556
13713
  if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1) return after.left > coords.left ? "ltr" : "rtl";
13557
13714
  }
13558
13715
  }
13559
- return getComputedStyle(view.dom).direction == "rtl" ? "rtl" : "ltr";
13716
+ let block = view.dom;
13717
+ for (let d = $pos.depth; d > 0; d--) if ($pos.node(d).isBlock) {
13718
+ block = view.nodeDOM($pos.before(d)) || block;
13719
+ break;
13720
+ }
13721
+ return getComputedStyle(block).direction == "rtl" ? "rtl" : "ltr";
13560
13722
  }
13561
13723
  function selectVertically(view, dir, mods) {
13562
13724
  let sel = view.state.selection;
@@ -13598,7 +13760,7 @@ window.__ModuleLoader__.load({
13598
13760
  function safariDownArrowBug(view) {
13599
13761
  if (!safari || view.state.selection.$head.parentOffset > 0) return false;
13600
13762
  let { focusNode, focusOffset } = view.domSelectionRange();
13601
- if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 && focusNode.firstChild && focusNode.firstChild.contentEditable == "false") {
13763
+ if (focusNode && isElt(focusNode) && focusOffset == 0 && focusNode.firstChild && isElt(focusNode.firstChild) && focusNode.firstChild.contentEditable == "false") {
13602
13764
  let child = focusNode.firstChild;
13603
13765
  switchEditable(view, child, "true");
13604
13766
  setTimeout(() => switchEditable(view, child, "false"), 20);
@@ -13645,7 +13807,7 @@ window.__ModuleLoader__.load({
13645
13807
  let doc = detachedDoc(), wrap = doc.createElement("div");
13646
13808
  wrap.appendChild(serializer.serializeFragment(content, { document: doc }));
13647
13809
  let firstChild = wrap.firstChild, needsWrap, wrappers = 0;
13648
- while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
13810
+ while (firstChild && isElt(firstChild) && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
13649
13811
  for (let i = needsWrap.length - 1; i >= 0; i--) {
13650
13812
  let wrapper = doc.createElement(needsWrap[i]);
13651
13813
  while (wrap.firstChild) wrapper.appendChild(wrap.firstChild);
@@ -13654,7 +13816,7 @@ window.__ModuleLoader__.load({
13654
13816
  }
13655
13817
  firstChild = wrap.firstChild;
13656
13818
  }
13657
- if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
13819
+ if (firstChild && isElt(firstChild)) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
13658
13820
  return {
13659
13821
  dom: wrap,
13660
13822
  text: view.someProp("clipboardTextSerializer", (f) => f(slice, view)) || slice.content.textBetween(0, slice.content.size, "\n\n"),
@@ -13699,7 +13861,7 @@ window.__ModuleLoader__.load({
13699
13861
  let sliceData = contextNode && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(contextNode.getAttribute("data-pm-slice") || "");
13700
13862
  if (sliceData && sliceData[3]) for (let i = +sliceData[3]; i > 0; i--) {
13701
13863
  let child = dom.firstChild;
13702
- while (child && child.nodeType != 1) child = child.nextSibling;
13864
+ while (child && !isElt(child)) child = child.nextSibling;
13703
13865
  if (!child) break;
13704
13866
  dom = child;
13705
13867
  }
@@ -13804,7 +13966,12 @@ window.__ModuleLoader__.load({
13804
13966
  function maybeWrapTrusted(html) {
13805
13967
  let trustedTypes = window.trustedTypes;
13806
13968
  if (!trustedTypes) return html;
13807
- if (!_policy) _policy = trustedTypes.defaultPolicy || trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
13969
+ if (!_policy) {
13970
+ if (_policy = trustedTypes.defaultPolicy) try {
13971
+ return _policy.createHTML(html);
13972
+ } catch (_a) {}
13973
+ _policy = trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
13974
+ }
13808
13975
  return _policy.createHTML(html);
13809
13976
  }
13810
13977
  function readHTML(html) {
@@ -13846,7 +14013,11 @@ window.__ModuleLoader__.load({
13846
14013
  for (let i = array.length - 2; i >= 0; i -= 2) {
13847
14014
  let type = schema.nodes[array[i]];
13848
14015
  if (!type || type.hasRequiredAttrs()) break;
13849
- content = Fragment.from(type.create(array[i + 1], content));
14016
+ try {
14017
+ content = Fragment.from(type.create(array[i + 1], content));
14018
+ } catch (e) {
14019
+ break;
14020
+ }
13850
14021
  openStart++;
13851
14022
  openEnd++;
13852
14023
  }
@@ -13864,6 +14035,7 @@ window.__ModuleLoader__.load({
13864
14035
  this.mouseDown = null;
13865
14036
  this.lastKeyCode = null;
13866
14037
  this.lastKeyCodeTime = 0;
14038
+ this.lastKeyDispatched = false;
13867
14039
  this.lastClick = {
13868
14040
  time: 0,
13869
14041
  x: 0,
@@ -13932,12 +14104,20 @@ window.__ModuleLoader__.load({
13932
14104
  function dispatchEvent(view, event) {
13933
14105
  if (!runCustomHandler(view, event) && handlers[event.type] && (view.editable || !(event.type in editHandlers))) handlers[event.type](view, event);
13934
14106
  }
14107
+ function dispatchKey(view, event) {
14108
+ let { input } = view;
14109
+ if (input.lastKeyDispatched || view.composing) return false;
14110
+ input.lastKeyDispatched = true;
14111
+ if (typeof event == "string") event = keyEvent(event == "Backspace" ? 8 : 13, event);
14112
+ return view.someProp("handleKeyDown", (f) => f(view, event));
14113
+ }
13935
14114
  editHandlers.keydown = (view, _event) => {
13936
14115
  let event = _event;
13937
14116
  view.input.shiftKey = event.keyCode == 16 || event.shiftKey;
13938
14117
  if (inOrNearComposition(view)) return;
13939
14118
  view.input.lastKeyCode = event.keyCode;
13940
14119
  view.input.lastKeyCodeTime = Date.now();
14120
+ view.input.lastKeyDispatched = false;
13941
14121
  if (android && chrome && event.keyCode == 13) return;
13942
14122
  if (event.keyCode != 229) view.domObserver.forceFlush();
13943
14123
  if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {
@@ -13945,11 +14125,11 @@ window.__ModuleLoader__.load({
13945
14125
  view.input.lastIOSEnter = now;
13946
14126
  view.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
13947
14127
  if (view.input.lastIOSEnter == now) {
13948
- view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")));
14128
+ dispatchKey(view, "Enter");
13949
14129
  view.input.lastIOSEnter = 0;
13950
14130
  }
13951
14131
  }, 200);
13952
- } else if (view.someProp("handleKeyDown", (f) => f(view, event)) || captureKeyDown(view, event)) event.preventDefault();
14132
+ } else if (dispatchKey(view, event) || captureKeyDown(view, event)) event.preventDefault();
13953
14133
  else setSelectionOrigin(view, "key");
13954
14134
  };
13955
14135
  editHandlers.keyup = (view, event) => {
@@ -13990,14 +14170,14 @@ window.__ModuleLoader__.load({
13990
14170
  if (!view.focused) view.focus();
13991
14171
  if (view.state.selection.eq(selection)) return;
13992
14172
  let tr = view.state.tr.setSelection(selection);
13993
- if (origin == "pointer") tr.setMeta("pointer", true);
14173
+ tr.setMeta("pointer", true);
13994
14174
  view.dispatch(tr);
13995
14175
  }
13996
14176
  function selectClickedLeaf(view, inside) {
13997
14177
  if (inside == -1) return false;
13998
14178
  let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
13999
14179
  if (node && node.isAtom && NodeSelection.isSelectable(node)) {
14000
- updateSelection(view, new NodeSelection($pos), "pointer");
14180
+ updateSelection(view, new NodeSelection($pos));
14001
14181
  return true;
14002
14182
  }
14003
14183
  return false;
@@ -14016,7 +14196,7 @@ window.__ModuleLoader__.load({
14016
14196
  }
14017
14197
  }
14018
14198
  if (selectAt != null) {
14019
- updateSelection(view, NodeSelection.create(view.state.doc, selectAt), "pointer");
14199
+ updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
14020
14200
  return true;
14021
14201
  } else return false;
14022
14202
  }
@@ -14033,7 +14213,7 @@ window.__ModuleLoader__.load({
14033
14213
  if (event.button != 0) return false;
14034
14214
  let selection = selectionForTripleClick(view, inside, true), doc = view.state.doc;
14035
14215
  if (!selection) return false;
14036
- updateSelection(view, selection, "pointer");
14216
+ updateSelection(view, selection);
14037
14217
  if (selection instanceof TextSelection && doc.eq(view.state.doc)) view.input.mouseDown = new TripleClickDrag(view, selection);
14038
14218
  return true;
14039
14219
  }
@@ -14119,7 +14299,7 @@ window.__ModuleLoader__.load({
14119
14299
  }
14120
14300
  const target = flushed ? null : event.target;
14121
14301
  const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
14122
- this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
14302
+ this.target = targetDesc && isElt(targetDesc.nodeDOM) ? targetDesc.nodeDOM : null;
14123
14303
  let { selection } = view.state;
14124
14304
  if (event.button == 0 && (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)) this.mightDrag = {
14125
14305
  node: targetNode,
@@ -14158,7 +14338,7 @@ window.__ModuleLoader__.load({
14158
14338
  if (this.allowDefault || !pos) setSelectionOrigin(this.view, "pointer");
14159
14339
  else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) event.preventDefault();
14160
14340
  else if (event.button == 0 && (this.flushed || safari && this.mightDrag && !this.mightDrag.node.isAtom || chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {
14161
- updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), "pointer");
14341
+ updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)));
14162
14342
  event.preventDefault();
14163
14343
  } else setSelectionOrigin(this.view, "pointer");
14164
14344
  }
@@ -14194,7 +14374,7 @@ window.__ModuleLoader__.load({
14194
14374
  if (!target) return;
14195
14375
  let { doc } = this.view.state, start = this.startSelection;
14196
14376
  let [anchor, head] = target.from < start.from ? [start.to, target.from] : [start.from, target.to];
14197
- updateSelection(this.view, TextSelection.create(doc, anchor, head), "pointer");
14377
+ updateSelection(this.view, TextSelection.create(doc, anchor, head));
14198
14378
  }
14199
14379
  };
14200
14380
  handlers.touchstart = (view) => {
@@ -14220,7 +14400,7 @@ window.__ModuleLoader__.load({
14220
14400
  if (!view.composing) {
14221
14401
  view.domObserver.flush();
14222
14402
  let { state } = view, $pos = state.selection.$to;
14223
- if (state.selection instanceof TextSelection && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m) => m.type.spec.inclusive === false) || chrome && windows$1 && selectionBeforeUneditable(view))) {
14403
+ if (state.selection instanceof TextSelection && state.selection.empty && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m) => m.type.spec.inclusive === false) || chrome && windows$1 && selectionBeforeUneditable(view))) {
14224
14404
  view.markCursor = view.state.storedMarks || $pos.marks();
14225
14405
  endComposition(view, true);
14226
14406
  view.markCursor = null;
@@ -14228,10 +14408,10 @@ window.__ModuleLoader__.load({
14228
14408
  endComposition(view, !state.selection.empty);
14229
14409
  if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {
14230
14410
  let sel = view.domSelectionRange();
14231
- for (let node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {
14411
+ for (let node = sel.focusNode, offset = sel.focusOffset; node && isElt(node) && offset != 0;) {
14232
14412
  let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];
14233
14413
  if (!before) break;
14234
- if (before.nodeType == 3) {
14414
+ if (isText(before)) {
14235
14415
  let sel = view.domSelection();
14236
14416
  if (sel) sel.collapse(before, before.nodeValue.length);
14237
14417
  break;
@@ -14248,9 +14428,9 @@ window.__ModuleLoader__.load({
14248
14428
  };
14249
14429
  function selectionBeforeUneditable(view) {
14250
14430
  let { focusNode, focusOffset } = view.domSelectionRange();
14251
- if (!focusNode || focusNode.nodeType != 1 || focusOffset >= focusNode.childNodes.length) return false;
14431
+ if (!focusNode || !isElt(focusNode) || focusOffset >= focusNode.childNodes.length) return false;
14252
14432
  let next = focusNode.childNodes[focusOffset];
14253
- return next.nodeType == 1 && next.contentEditable == "false";
14433
+ return isElt(next) && next.contentEditable == "false";
14254
14434
  }
14255
14435
  editHandlers.compositionend = (view, event) => {
14256
14436
  if (view.composing) {
@@ -14403,7 +14583,7 @@ window.__ModuleLoader__.load({
14403
14583
  let node;
14404
14584
  if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to));
14405
14585
  else if (mouseDown && mouseDown.mightDrag) node = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos);
14406
- else if (event.target && event.target.nodeType == 1) {
14586
+ else if (event.target && isElt(event.target)) {
14407
14587
  let desc = view.docView.nearestDesc(event.target, true);
14408
14588
  if (desc && desc.node.type.spec.draggable && desc != view.docView) node = NodeSelection.create(view.state.doc, desc.posBefore);
14409
14589
  }
@@ -14476,9 +14656,14 @@ window.__ModuleLoader__.load({
14476
14656
  view.dom.classList.add("ProseMirror-focused");
14477
14657
  view.domObserver.start();
14478
14658
  view.focused = true;
14479
- setTimeout(() => {
14480
- if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.domSelectionRange())) selectionToDOM(view);
14481
- }, 20);
14659
+ let startSel = view.domSelectionRange();
14660
+ if (!view.domObserver.currentSelection.eq(startSel)) {
14661
+ let { focusNode, focusOffset } = startSel;
14662
+ setTimeout(() => {
14663
+ let newSel = view.domSelectionRange();
14664
+ if (newSel.focusNode == focusNode && newSel.focusOffset == focusOffset && view.docView && view.hasFocus()) selectionToDOM(view);
14665
+ }, 20);
14666
+ }
14482
14667
  }
14483
14668
  };
14484
14669
  handlers.blur = (view, _event) => {
@@ -14496,10 +14681,10 @@ window.__ModuleLoader__.load({
14496
14681
  view.domObserver.flushSoon();
14497
14682
  let { domChangeCount } = view.input;
14498
14683
  setTimeout(() => {
14499
- if (view.input.domChangeCount != domChangeCount) return;
14684
+ if (view.input.domChangeCount != domChangeCount || view.domObserver.pendingRecords().length) return;
14500
14685
  view.dom.blur();
14501
14686
  view.focus();
14502
- if (view.someProp("handleKeyDown", (f) => f(view, keyEvent(8, "Backspace")))) return;
14687
+ if (dispatchKey(view, "Backspace")) return;
14503
14688
  let { $cursor } = view.state.selection;
14504
14689
  if ($cursor && $cursor.pos > 0) view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView());
14505
14690
  }, 50);
@@ -14512,6 +14697,22 @@ window.__ModuleLoader__.load({
14512
14697
  for (let p in b) if (!(p in a)) return false;
14513
14698
  return true;
14514
14699
  }
14700
+ var FragmentCursor = class {
14701
+ constructor(frag) {
14702
+ this.frag = frag;
14703
+ this.index = 0;
14704
+ this.off = 0;
14705
+ }
14706
+ nodeAt(off) {
14707
+ while (this.off <= off && this.index < this.frag.childCount) {
14708
+ let next = this.frag.child(this.index);
14709
+ if (this.off == off) return next;
14710
+ this.off += next.nodeSize;
14711
+ this.index++;
14712
+ }
14713
+ return null;
14714
+ }
14715
+ };
14515
14716
  var WidgetType = class WidgetType {
14516
14717
  constructor(toDOM, spec) {
14517
14718
  this.toDOM = toDOM;
@@ -14565,9 +14766,9 @@ window.__ModuleLoader__.load({
14565
14766
  if (to.deleted || to.pos <= from.pos) return null;
14566
14767
  return new Decoration(from.pos - offset, to.pos - offset, this);
14567
14768
  }
14568
- valid(node, span) {
14569
- let { index, offset } = node.content.findIndex(span.from), child;
14570
- return offset == span.from && !(child = node.child(index)).isText && offset + child.nodeSize == span.to;
14769
+ valid(node, span, cursor) {
14770
+ let found = cursor.nodeAt(span.from);
14771
+ return !!found && !found.isText && span.from + found.nodeSize == span.to;
14571
14772
  }
14572
14773
  eq(other) {
14573
14774
  return this == other || other instanceof NodeType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec);
@@ -14712,10 +14913,13 @@ window.__ModuleLoader__.load({
14712
14913
  */
14713
14914
  mapInner(mapping, node, offset, oldOffset, options) {
14714
14915
  let newLocal;
14715
- for (let i = 0; i < this.local.length; i++) {
14716
- let mapped = this.local[i].map(mapping, offset, oldOffset);
14717
- if (mapped && mapped.type.valid(node, mapped)) (newLocal || (newLocal = [])).push(mapped);
14718
- else if (options.onRemove) options.onRemove(this.local[i].spec);
14916
+ if (this.local.length) {
14917
+ let cur = new FragmentCursor(node.content);
14918
+ for (let i = 0; i < this.local.length; i++) {
14919
+ let mapped = this.local[i].map(mapping, offset, oldOffset);
14920
+ if (mapped && mapped.type.valid(node, mapped, cur)) (newLocal || (newLocal = [])).push(mapped);
14921
+ else if (options.onRemove) options.onRemove(this.local[i].spec);
14922
+ }
14719
14923
  }
14720
14924
  if (this.children.length) return mapChildren(this.children, newLocal || [], mapping, node, offset, oldOffset, options);
14721
14925
  else return newLocal ? new DecorationSet(newLocal.sort(byPos), none) : empty;
@@ -14743,7 +14947,10 @@ window.__ModuleLoader__.load({
14743
14947
  childIndex += 3;
14744
14948
  });
14745
14949
  let local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);
14746
- for (let i = 0; i < local.length; i++) if (!local[i].type.valid(doc, local[i])) local.splice(i--, 1);
14950
+ if (local.length) {
14951
+ let cur = new FragmentCursor(doc.content);
14952
+ for (let i = 0; i < local.length; i++) if (!local[i].type.valid(doc, local[i], cur)) local.splice(i--, 1);
14953
+ }
14747
14954
  return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local, children || this.children);
14748
14955
  }
14749
14956
  /**
@@ -15005,9 +15212,12 @@ window.__ModuleLoader__.load({
15005
15212
  }
15006
15213
  });
15007
15214
  let locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);
15008
- for (let i = 0; i < locals.length; i++) if (!locals[i].type.valid(node, locals[i])) {
15009
- if (options.onRemove) options.onRemove(locals[i].spec);
15010
- locals.splice(i--, 1);
15215
+ if (locals.length) {
15216
+ let cur = new FragmentCursor(node.content);
15217
+ for (let i = 0; i < locals.length; i++) if (!locals[i].type.valid(node, locals[i], cur)) {
15218
+ if (options.onRemove) options.onRemove(locals[i].spec);
15219
+ locals.splice(i--, 1);
15220
+ }
15011
15221
  }
15012
15222
  return locals.length || children.length ? new DecorationSet(locals, children) : empty;
15013
15223
  }
@@ -15176,7 +15386,7 @@ window.__ModuleLoader__.load({
15176
15386
  let desc = container && this.view.docView.nearestDesc(container);
15177
15387
  if (desc && desc.ignoreMutation({
15178
15388
  type: "selection",
15179
- target: container.nodeType == 3 ? container.parentNode : container
15389
+ target: isText(container) ? container.parentNode : container
15180
15390
  })) {
15181
15391
  this.setCurSelection();
15182
15392
  return true;
@@ -15191,8 +15401,11 @@ window.__ModuleLoader__.load({
15191
15401
  if (!view.docView || this.flushingSoon > -1) return;
15192
15402
  let mutations = this.pendingRecords();
15193
15403
  if (mutations.length) this.queue = [];
15194
- let sel = view.domSelectionRange();
15195
- let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);
15404
+ let selRange, newSel = false;
15405
+ if (!this.suppressingSelectionUpdates && hasFocusAndSelection(view)) {
15406
+ selRange = view.domSelectionRange();
15407
+ newSel = !this.currentSelection.eq(selRange) && !this.ignoreSelectionChange(selRange);
15408
+ }
15196
15409
  let from = -1, to = -1, typeOver = false, added = [];
15197
15410
  if (view.editable) for (let i = 0; i < mutations.length; i++) {
15198
15411
  let result = this.registerMutation(mutations[i], added);
@@ -15205,7 +15418,7 @@ window.__ModuleLoader__.load({
15205
15418
  if (added.some((n) => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46 || chrome && (view.composing || view.input.compositionEndedAt > Date.now() - 50) && mutations.some((m) => m.type == "childList" && m.removedNodes.length))) {
15206
15419
  for (let node of added) if (node.nodeName == "BR" && node.parentNode) {
15207
15420
  let after = node.nextSibling;
15208
- while (after && after.nodeType == 1) {
15421
+ while (after && isElt(after)) {
15209
15422
  if (after.contentEditable == "false") {
15210
15423
  node.parentNode.removeChild(node);
15211
15424
  break;
@@ -15228,10 +15441,10 @@ window.__ModuleLoader__.load({
15228
15441
  }
15229
15442
  }
15230
15443
  let readSel = null;
15231
- if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {
15444
+ if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(selRange) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {
15232
15445
  view.input.lastFocus = 0;
15233
15446
  selectionToDOM(view);
15234
- this.currentSelection.set(sel);
15447
+ this.currentSelection.set(selRange);
15235
15448
  view.scrollToSelection();
15236
15449
  } else if (from > -1 || newSel) {
15237
15450
  if (from > -1) {
@@ -15244,8 +15457,8 @@ window.__ModuleLoader__.load({
15244
15457
  }
15245
15458
  this.handleDOMChange(from, to, typeOver, added);
15246
15459
  if (view.docView && view.docView.dirty) view.updateState(view.state);
15247
- else if (!this.currentSelection.eq(sel)) selectionToDOM(view);
15248
- this.currentSelection.set(sel);
15460
+ else if (selRange && !this.currentSelection.eq(selRange)) selectionToDOM(view);
15461
+ if (selRange) this.currentSelection.set(selRange);
15249
15462
  }
15250
15463
  }
15251
15464
  registerMutation(mut, added) {
@@ -15257,7 +15470,7 @@ window.__ModuleLoader__.load({
15257
15470
  for (let i = 0; i < mut.addedNodes.length; i++) {
15258
15471
  let node = mut.addedNodes[i];
15259
15472
  added.push(node);
15260
- if (node.nodeType == 3) this.lastChangedTextNode = node;
15473
+ if (isText(node)) this.lastChangedTextNode = node;
15261
15474
  }
15262
15475
  if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target)) return {
15263
15476
  from: desc.posBefore,
@@ -15356,7 +15569,7 @@ window.__ModuleLoader__.load({
15356
15569
  let parent = nextCell;
15357
15570
  for (;;) {
15358
15571
  let first = parent.firstChild;
15359
- if (!first || first.nodeType != 1 || first.contentEditable == "false" || /^(BR|IMG)$/.test(first.nodeName)) break;
15572
+ if (!first || !isElt(first) || first.contentEditable == "false" || /^(BR|IMG)$/.test(first.nodeName)) break;
15360
15573
  parent = first;
15361
15574
  }
15362
15575
  parent.insertBefore(node, parent.firstChild);
@@ -15369,7 +15582,7 @@ window.__ModuleLoader__.load({
15369
15582
  let domSel = view.domSelectionRange();
15370
15583
  let find;
15371
15584
  let anchor = domSel.anchorNode;
15372
- if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {
15585
+ if (anchor && contains(view.dom, anchor)) {
15373
15586
  find = [{
15374
15587
  node: anchor,
15375
15588
  offset: domSel.anchorOffset
@@ -15436,7 +15649,7 @@ window.__ModuleLoader__.load({
15436
15649
  let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;
15437
15650
  let newSel = selectionFromDOM(view, origin);
15438
15651
  if (newSel && !view.state.selection.eq(newSel)) {
15439
- if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) return;
15652
+ if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && dispatchKey(view, "Enter")) return;
15440
15653
  let tr = view.state.tr.setSelection(newSel);
15441
15654
  if (origin == "pointer") tr.setMeta("pointer", true);
15442
15655
  else if (origin == "key") tr.scrollIntoView();
@@ -15463,7 +15676,7 @@ window.__ModuleLoader__.load({
15463
15676
  view.input.lastKeyCode = null;
15464
15677
  let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);
15465
15678
  if (change) view.input.domChangeCount++;
15466
- if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n) => n.nodeType == 1 && !isInline.test(n.nodeName)) && (!change || change.endA >= change.endB) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
15679
+ if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n) => isElt(n) && !isInline.test(n.nodeName)) && (!change || change.endA >= change.endB) && dispatchKey(view, "Enter")) {
15467
15680
  view.input.lastIOSEnter = 0;
15468
15681
  return;
15469
15682
  }
@@ -15499,11 +15712,11 @@ window.__ModuleLoader__.load({
15499
15712
  let $to = parse.doc.resolveNoCache(change.endB - parse.from);
15500
15713
  let $fromA = doc.resolve(change.start);
15501
15714
  let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
15502
- if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
15715
+ if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && looksLikeEnter(parse.doc, $from.pos, $to.pos)) && dispatchKey(view, "Enter")) {
15503
15716
  view.input.lastIOSEnter = 0;
15504
15717
  return;
15505
15718
  }
15506
- if (view.state.selection.anchor > change.start && looksLikeBackspace(doc, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(8, "Backspace")))) {
15719
+ if (view.state.selection.anchor > change.start && (inlineChange ? change.endA > change.start && change.endB == change.start : looksLikeBlockJoin(doc, change.start, change.endA, $from, $to)) && dispatchKey(view, "Backspace")) {
15507
15720
  if (android && chrome) view.domObserver.suppressSelectionUpdates();
15508
15721
  return;
15509
15722
  }
@@ -15511,11 +15724,7 @@ window.__ModuleLoader__.load({
15511
15724
  if (android && !inlineChange && $from.start() != $to.start() && $to.parentOffset == 0 && $from.depth == $to.depth && parse.sel && parse.sel.anchor == parse.sel.head && parse.sel.head == change.endA) {
15512
15725
  change.endB -= 2;
15513
15726
  $to = parse.doc.resolveNoCache(change.endB - parse.from);
15514
- setTimeout(() => {
15515
- view.someProp("handleKeyDown", function(f) {
15516
- return f(view, keyEvent(13, "Enter"));
15517
- });
15518
- }, 20);
15727
+ setTimeout(() => dispatchKey(view, "Enter"), 20);
15519
15728
  }
15520
15729
  let chFrom = change.start, chTo = change.endA;
15521
15730
  let mkTr = (base) => {
@@ -15574,10 +15783,10 @@ window.__ModuleLoader__.load({
15574
15783
  type
15575
15784
  };
15576
15785
  }
15577
- function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
15786
+ function looksLikeBlockJoin(old, start, end, $newStart, $newEnd) {
15578
15787
  if (end - start <= $newEnd.pos - $newStart.pos || skipClosingAndOpening($newStart, true, false) < $newEnd.pos) return false;
15579
15788
  let $start = old.resolve(start);
15580
- if (!$newStart.parent.isTextblock) {
15789
+ if (!$newStart.parent.inlineContent) {
15581
15790
  let after = $start.nodeAfter;
15582
15791
  return after != null && end == start + after.nodeSize;
15583
15792
  }
@@ -15586,6 +15795,14 @@ window.__ModuleLoader__.load({
15586
15795
  if (!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, true, false) < end) return false;
15587
15796
  return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);
15588
15797
  }
15798
+ function looksLikeEnter(content, from, to) {
15799
+ let newTextlines = 0, newLeaves = 0;
15800
+ content.nodesBetween(from, to, (node, pos) => {
15801
+ if (node.isTextblock && pos >= from && pos < to) newTextlines++;
15802
+ else if (node.isText ? /\S/.test(node.text.slice(Math.max(0, from - pos), Math.min(node.nodeSize, to - pos))) : node.isLeaf) newLeaves++;
15803
+ });
15804
+ return newLeaves == 0 && newTextlines == 1;
15805
+ }
15589
15806
  function skipClosingAndOpening($pos, fromEnd, mayOpen) {
15590
15807
  let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;
15591
15808
  while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {
@@ -15810,11 +16027,11 @@ window.__ModuleLoader__.load({
15810
16027
  */
15811
16028
  scrollToSelection() {
15812
16029
  let startDOM = this.domSelectionRange().focusNode;
15813
- if (!startDOM || !this.dom.contains(startDOM.nodeType == 1 ? startDOM : startDOM.parentNode));
16030
+ if (!startDOM || !contains(this.dom, startDOM));
15814
16031
  else if (this.someProp("handleScrollToSelection", (f) => f(this)));
15815
16032
  else if (this.state.selection instanceof NodeSelection) {
15816
16033
  let target = this.docView.domAfterPos(this.state.selection.from);
15817
- if (target.nodeType == 1) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);
16034
+ if (isElt(target)) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);
15818
16035
  } else scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);
15819
16036
  }
15820
16037
  destroyPluginViews() {
@@ -16043,7 +16260,7 @@ window.__ModuleLoader__.load({
16043
16260
  @internal
16044
16261
  */
16045
16262
  domSelectionRange() {
16046
- let sel = this.domSelection();
16263
+ let sel = this.dom.isConnected !== false && this.domSelection();
16047
16264
  if (!sel) return {
16048
16265
  focusNode: null,
16049
16266
  focusOffset: 0,
@@ -17133,7 +17350,7 @@ window.__ModuleLoader__.load({
17133
17350
  return Append;
17134
17351
  }(RopeSequence);
17135
17352
  //#endregion
17136
- //#region node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.js
17353
+ //#region node_modules/.pnpm/prosemirror-history@1.5.1/node_modules/prosemirror-history/dist/index.js
17137
17354
  const max_empty_items = 500;
17138
17355
  var Branch = class Branch {
17139
17356
  constructor(items, eventCount) {
@@ -17226,7 +17443,8 @@ window.__ModuleLoader__.load({
17226
17443
  }
17227
17444
  rebased(rebasedTransform, rebasedCount) {
17228
17445
  if (!this.eventCount) return this;
17229
- let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);
17446
+ rebasedCount = Math.min(this.items.length, rebasedCount);
17447
+ let rebasedItems = [], start = this.items.length - rebasedCount;
17230
17448
  let mapping = rebasedTransform.mapping;
17231
17449
  let newUntil = rebasedTransform.steps.length;
17232
17450
  let eventCount = this.eventCount;
@@ -46547,265 +46765,265 @@ window.__ModuleLoader__.load({
46547
46765
  document.head.appendChild(tag);
46548
46766
  }
46549
46767
  var workbench_module_css_default = {
46550
- "productName": "-kTeaG_productName",
46551
- "view": "-kTeaG_view",
46552
- "conflictModal": "-kTeaG_conflictModal",
46553
- "readyPackage": "-kTeaG_readyPackage",
46554
- "insightFilters": "-kTeaG_insightFilters",
46555
- "modal": "-kTeaG_modal",
46556
- "myWorkList": "-kTeaG_myWorkList",
46768
+ "checklist": "-kTeaG_checklist",
46769
+ "selectionPromptAbove": "-kTeaG_selectionPromptAbove",
46770
+ "formGrid": "-kTeaG_formGrid",
46557
46771
  "conflictHeader": "-kTeaG_conflictHeader",
46558
- "mobileCollab": "-kTeaG_mobileCollab",
46559
- "documentCommentAnchor": "-kTeaG_documentCommentAnchor",
46560
- "commentThreadSelected": "-kTeaG_commentThreadSelected",
46561
- "decisionSection": "-kTeaG_decisionSection",
46562
- "inlineDecisionOptions": "-kTeaG_inlineDecisionOptions",
46563
- "reviewDecisionContext": "-kTeaG_reviewDecisionContext",
46564
- "noticeHidden": "-kTeaG_noticeHidden",
46772
+ "emptyPanel": "-kTeaG_emptyPanel",
46773
+ "mobileViewSwitch": "-kTeaG_mobileViewSwitch",
46774
+ "collabStateDirty": "-kTeaG_collabStateDirty",
46775
+ "reviewCheckCopy": "-kTeaG_reviewCheckCopy",
46565
46776
  "header": "-kTeaG_header",
46566
- "conflictActions": "-kTeaG_conflictActions",
46567
- "collabMetricActive": "-kTeaG_collabMetricActive",
46568
- "tabPanel": "-kTeaG_tabPanel",
46569
- "selectionPromptHead": "-kTeaG_selectionPromptHead",
46570
- "summaryInput": "-kTeaG_summaryInput",
46571
- "commentThreadClosed": "-kTeaG_commentThreadClosed",
46572
- "inlineReviewSource": "-kTeaG_inlineReviewSource",
46573
- "unreadNotification": "-kTeaG_unreadNotification",
46574
- "selectionPromptAbove": "-kTeaG_selectionPromptAbove",
46575
- "panelSummary": "-kTeaG_panelSummary",
46576
- "reviewCheckBox": "-kTeaG_reviewCheckBox",
46577
- "replyStack": "-kTeaG_replyStack",
46578
- "documentReviewHighlight": "-kTeaG_documentReviewHighlight",
46579
- "badges": "-kTeaG_badges",
46580
- "reviewChecklist": "-kTeaG_reviewChecklist",
46581
- "commentThreadHead": "-kTeaG_commentThreadHead",
46582
- "decisionSourceList": "-kTeaG_decisionSourceList",
46583
- "documentAnchorHighlightSelected": "-kTeaG_documentAnchorHighlightSelected",
46584
- "quietButton": "-kTeaG_quietButton",
46585
- "locateSourceButton": "-kTeaG_locateSourceButton",
46586
- "requirementSearch": "-kTeaG_requirementSearch",
46587
- "conflictColumns": "-kTeaG_conflictColumns",
46777
+ "readyHead": "-kTeaG_readyHead",
46588
46778
  "commentBody": "-kTeaG_commentBody",
46779
+ "documentAnchorSelected": "-kTeaG_documentAnchorSelected",
46780
+ "myWorkButton": "-kTeaG_myWorkButton",
46781
+ "collapseChat": "-kTeaG_collapseChat",
46782
+ "selectionPromptHead": "-kTeaG_selectionPromptHead",
46783
+ "inlineReviewActions": "-kTeaG_inlineReviewActions",
46784
+ "collabBarActions": "-kTeaG_collabBarActions",
46785
+ "reviewDecisionContext": "-kTeaG_reviewDecisionContext",
46786
+ "reviewDecisionBody": "-kTeaG_reviewDecisionBody",
46787
+ "editorTitle": "-kTeaG_editorTitle",
46788
+ "aiMessage": "-kTeaG_aiMessage",
46789
+ "documentCommentAnchor": "-kTeaG_documentCommentAnchor",
46790
+ "userMessage": "-kTeaG_userMessage",
46791
+ "chatError": "-kTeaG_chatError",
46792
+ "reviewChecklistAnswered": "-kTeaG_reviewChecklistAnswered",
46793
+ "statusDot": "-kTeaG_statusDot",
46794
+ "selectedDecisionOption": "-kTeaG_selectedDecisionOption",
46795
+ "reviewCheckMeta": "-kTeaG_reviewCheckMeta",
46589
46796
  "documentCommentHighlight": "-kTeaG_documentCommentHighlight",
46590
- "commentSourceSelected": "-kTeaG_commentSourceSelected",
46591
- "formErrors": "-kTeaG_formErrors",
46592
- "dangerText": "-kTeaG_dangerText",
46593
- "formGrid": "-kTeaG_formGrid",
46594
- "threadStack": "-kTeaG_threadStack",
46797
+ "execute": "-kTeaG_execute",
46798
+ "decisionAsideHead": "-kTeaG_decisionAsideHead",
46799
+ "diffCollapsed": "-kTeaG_diffCollapsed",
46595
46800
  "threadList": "-kTeaG_threadList",
46596
- "patchDetails": "-kTeaG_patchDetails",
46801
+ "notice": "-kTeaG_notice",
46802
+ "compareHead": "-kTeaG_compareHead",
46803
+ "createButton": "-kTeaG_createButton",
46804
+ "emptyAside": "-kTeaG_emptyAside",
46805
+ "unreadNotification": "-kTeaG_unreadNotification",
46806
+ "reviewCheckArrow": "-kTeaG_reviewCheckArrow",
46807
+ "documentAnchorHighlight": "-kTeaG_documentAnchorHighlight",
46808
+ "notificationDialog": "-kTeaG_notificationDialog",
46809
+ "productName": "-kTeaG_productName",
46810
+ "threadPills": "-kTeaG_threadPills",
46811
+ "mobileDocumentsTrigger": "-kTeaG_mobileDocumentsTrigger",
46812
+ "formErrors": "-kTeaG_formErrors",
46813
+ "primaryNav": "-kTeaG_primaryNav",
46814
+ "summaryField": "-kTeaG_summaryField",
46815
+ "taskQueue": "-kTeaG_taskQueue",
46816
+ "documentReviewAnchorBlocking": "-kTeaG_documentReviewAnchorBlocking",
46817
+ "myWorkList": "-kTeaG_myWorkList",
46818
+ "inlineReviewHead": "-kTeaG_inlineReviewHead",
46819
+ "activeMode": "-kTeaG_activeMode",
46820
+ "reviewCheckBox": "-kTeaG_reviewCheckBox",
46821
+ "resizerHidden": "-kTeaG_resizerHidden",
46822
+ "disabledReason": "-kTeaG_disabledReason",
46823
+ "mobileSpec": "-kTeaG_mobileSpec",
46824
+ "checkPassed": "-kTeaG_checkPassed",
46597
46825
  "checkBlocked": "-kTeaG_checkBlocked",
46598
- "createSummary": "-kTeaG_createSummary",
46599
- "myWorkButton": "-kTeaG_myWorkButton",
46600
- "commentThread": "-kTeaG_commentThread",
46826
+ "decisionSectionHead": "-kTeaG_decisionSectionHead",
46827
+ "workflowEyebrow": "-kTeaG_workflowEyebrow",
46828
+ "summaryInput": "-kTeaG_summaryInput",
46601
46829
  "requirementFilters": "-kTeaG_requirementFilters",
46602
- "patchImpact": "-kTeaG_patchImpact",
46603
- "discussionPanel": "-kTeaG_discussionPanel",
46604
- "contextNav": "-kTeaG_contextNav",
46605
- "workbench": "-kTeaG_workbench",
46606
- "richEditorShell": "-kTeaG_richEditorShell",
46607
- "legacyWarning": "-kTeaG_legacyWarning",
46608
- "diffHeader": "-kTeaG_diffHeader",
46609
- "dialogForm": "-kTeaG_dialogForm",
46830
+ "noticeHidden": "-kTeaG_noticeHidden",
46831
+ "chatToggle": "-kTeaG_chatToggle",
46610
46832
  "documentReviewHighlightBlocking": "-kTeaG_documentReviewHighlightBlocking",
46611
- "versionCompare": "-kTeaG_versionCompare",
46612
- "aiConversation": "-kTeaG_aiConversation",
46613
- "run": "-kTeaG_run",
46614
- "reviewCheckMeta": "-kTeaG_reviewCheckMeta",
46615
- "replyComposer": "-kTeaG_replyComposer",
46833
+ "diffDialog": "-kTeaG_diffDialog",
46834
+ "inlineDecisionOptions": "-kTeaG_inlineDecisionOptions",
46835
+ "chatComposer": "-kTeaG_chatComposer",
46836
+ "commentActions": "-kTeaG_commentActions",
46837
+ "paneHead": "-kTeaG_paneHead",
46838
+ "quietButton": "-kTeaG_quietButton",
46839
+ "documentButton": "-kTeaG_documentButton",
46840
+ "entryActive": "-kTeaG_entryActive",
46841
+ "focusMode": "-kTeaG_focusMode",
46842
+ "threadHeaderActions": "-kTeaG_threadHeaderActions",
46843
+ "commentSourceSelected": "-kTeaG_commentSourceSelected",
46844
+ "emptyList": "-kTeaG_emptyList",
46845
+ "collabMetric": "-kTeaG_collabMetric",
46846
+ "contextNav": "-kTeaG_contextNav",
46847
+ "runningDot": "-kTeaG_runningDot",
46848
+ "reviewChecklistSettled": "-kTeaG_reviewChecklistSettled",
46849
+ "importPreview": "-kTeaG_importPreview",
46850
+ "taskAssignment": "-kTeaG_taskAssignment",
46851
+ "collapseRight": "-kTeaG_collapseRight",
46852
+ "collabMetricWarn": "-kTeaG_collabMetricWarn",
46853
+ "decisionEvidence": "-kTeaG_decisionEvidence",
46854
+ "chatMessages": "-kTeaG_chatMessages",
46855
+ "dangerButton": "-kTeaG_dangerButton",
46856
+ "selectionPromptCancel": "-kTeaG_selectionPromptCancel",
46857
+ "headerActions": "-kTeaG_headerActions",
46858
+ "workflowFocus": "-kTeaG_workflowFocus",
46859
+ "resizer": "-kTeaG_resizer",
46860
+ "titleBlock": "-kTeaG_titleBlock",
46861
+ "downstreamReturn": "-kTeaG_downstreamReturn",
46862
+ "threadStack": "-kTeaG_threadStack",
46863
+ "diffActions": "-kTeaG_diffActions",
46864
+ "structuredDiff": "-kTeaG_structuredDiff",
46865
+ "cardActions": "-kTeaG_cardActions",
46866
+ "srOnly": "-kTeaG_srOnly",
46867
+ "decisionSourceList": "-kTeaG_decisionSourceList",
46868
+ "documentAnchorHighlightSelected": "-kTeaG_documentAnchorHighlightSelected",
46616
46869
  "stage_joint-review": "-kTeaG_stage_joint-review",
46617
- "insightCard": "-kTeaG_insightCard",
46870
+ "conflictActions": "-kTeaG_conflictActions",
46618
46871
  "editorCollabBar": "-kTeaG_editorCollabBar",
46619
- "patchAccept": "-kTeaG_patchAccept",
46620
- "reviewCheckCopy": "-kTeaG_reviewCheckCopy",
46872
+ "discussionFilters": "-kTeaG_discussionFilters",
46873
+ "stage_ready": "-kTeaG_stage_ready",
46621
46874
  "inlineReviewBody": "-kTeaG_inlineReviewBody",
46622
- "notificationList": "-kTeaG_notificationList",
46623
- "insightDialog": "-kTeaG_insightDialog",
46624
- "emptyPanel": "-kTeaG_emptyPanel",
46625
- "selectionPrompt": "-kTeaG_selectionPrompt",
46875
+ "patchAccept": "-kTeaG_patchAccept",
46876
+ "reviewDecisionHeader": "-kTeaG_reviewDecisionHeader",
46877
+ "mobileDrawerClose": "-kTeaG_mobileDrawerClose",
46878
+ "collabStateRunning": "-kTeaG_collabStateRunning",
46879
+ "selectionPromptActions": "-kTeaG_selectionPromptActions",
46880
+ "documentReviewAnchorSelected": "-kTeaG_documentReviewAnchorSelected",
46881
+ "myWorkSummary": "-kTeaG_myWorkSummary",
46882
+ "patchImpact": "-kTeaG_patchImpact",
46883
+ "inlineReviewSource": "-kTeaG_inlineReviewSource",
46884
+ "patchPreview": "-kTeaG_patchPreview",
46885
+ "selectionPromptSubmit": "-kTeaG_selectionPromptSubmit",
46886
+ "markdownBody": "-kTeaG_markdownBody",
46887
+ "workbench": "-kTeaG_workbench",
46888
+ "backLabel": "-kTeaG_backLabel",
46889
+ "decisionSourceHead": "-kTeaG_decisionSourceHead",
46890
+ "fileButton": "-kTeaG_fileButton",
46891
+ "taskRow": "-kTeaG_taskRow",
46892
+ "review": "-kTeaG_review",
46626
46893
  "commentGlyph": "-kTeaG_commentGlyph",
46627
- "mobileDocumentsTrigger": "-kTeaG_mobileDocumentsTrigger",
46628
- "documentButton": "-kTeaG_documentButton",
46629
- "recordLinkButton": "-kTeaG_recordLinkButton",
46630
- "reviewChecklistBlocking": "-kTeaG_reviewChecklistBlocking",
46894
+ "reviewDecisionAside": "-kTeaG_reviewDecisionAside",
46895
+ "insightDialog": "-kTeaG_insightDialog",
46896
+ "entry": "-kTeaG_entry",
46897
+ "dangerText": "-kTeaG_dangerText",
46898
+ "selectedDoc": "-kTeaG_selectedDoc",
46899
+ "panelSummary": "-kTeaG_panelSummary",
46900
+ "commentThreadHead": "-kTeaG_commentThreadHead",
46901
+ "decisionSection": "-kTeaG_decisionSection",
46902
+ "reviewChecklistSelected": "-kTeaG_reviewChecklistSelected",
46631
46903
  "requirementMenu": "-kTeaG_requirementMenu",
46632
- "cardActions": "-kTeaG_cardActions",
46633
- "inlineReviewDetails": "-kTeaG_inlineReviewDetails",
46634
- "readyHead": "-kTeaG_readyHead",
46635
- "decisionResponse": "-kTeaG_decisionResponse",
46636
- "selectionPromptBelow": "-kTeaG_selectionPromptBelow",
46637
- "reviewChecklistAnswered": "-kTeaG_reviewChecklistAnswered",
46638
- "chatMessages": "-kTeaG_chatMessages",
46639
- "selectedDecisionOption": "-kTeaG_selectedDecisionOption",
46640
- "activeMode": "-kTeaG_activeMode",
46641
- "inlineReviewHeadActions": "-kTeaG_inlineReviewHeadActions",
46642
- "stage_product-confirmation": "-kTeaG_stage_product-confirmation",
46643
- "taskRow": "-kTeaG_taskRow",
46644
- "collabMetric": "-kTeaG_collabMetric",
46645
- "versionRow": "-kTeaG_versionRow",
46904
+ "historyGroup": "-kTeaG_historyGroup",
46905
+ "diffHeader": "-kTeaG_diffHeader",
46646
46906
  "discussionSummary": "-kTeaG_discussionSummary",
46647
- "reviewDecisionModal": "-kTeaG_reviewDecisionModal",
46907
+ "checkItem": "-kTeaG_checkItem",
46908
+ "notificationList": "-kTeaG_notificationList",
46909
+ "inlineDecisionForm": "-kTeaG_inlineDecisionForm",
46910
+ "insightActions": "-kTeaG_insightActions",
46648
46911
  "editorMeta": "-kTeaG_editorMeta",
46649
- "decisionSectionHead": "-kTeaG_decisionSectionHead",
46912
+ "reviewChecklist": "-kTeaG_reviewChecklist",
46913
+ "rowMenuButton": "-kTeaG_rowMenuButton",
46914
+ "runHistory": "-kTeaG_runHistory",
46915
+ "decisionEvidenceList": "-kTeaG_decisionEvidenceList",
46650
46916
  "notificationButton": "-kTeaG_notificationButton",
46651
- "dialogSurface": "-kTeaG_dialogSurface",
46652
- "selectionPromptClose": "-kTeaG_selectionPromptClose",
46917
+ "activeFilters": "-kTeaG_activeFilters",
46918
+ "footer": "-kTeaG_footer",
46919
+ "saveButton": "-kTeaG_saveButton",
46653
46920
  "diffContext": "-kTeaG_diffContext",
46654
- "versionActions": "-kTeaG_versionActions",
46655
- "checkIcon": "-kTeaG_checkIcon",
46656
- "collabStateRunning": "-kTeaG_collabStateRunning",
46657
- "inlineDecisionForm": "-kTeaG_inlineDecisionForm",
46658
- "runHistory": "-kTeaG_runHistory",
46659
- "unsaved": "-kTeaG_unsaved",
46660
- "requirementRow": "-kTeaG_requirementRow",
46661
- "emptyMain": "-kTeaG_emptyMain",
46662
- "threadHeaderActions": "-kTeaG_threadHeaderActions",
46663
- "rowMenuButton": "-kTeaG_rowMenuButton",
46664
- "checklist": "-kTeaG_checklist",
46665
- "compareHead": "-kTeaG_compareHead",
46666
- "reviewDecisionAside": "-kTeaG_reviewDecisionAside",
46667
- "grid": "-kTeaG_grid",
46668
- "userMessage": "-kTeaG_userMessage",
46669
- "commentActions": "-kTeaG_commentActions",
46670
- "decisionSource": "-kTeaG_decisionSource",
46671
- "entry": "-kTeaG_entry",
46672
- "decisionQuestion": "-kTeaG_decisionQuestion",
46673
- "reviewHeader": "-kTeaG_reviewHeader",
46674
- "statusDot": "-kTeaG_statusDot",
46921
+ "editorBody": "-kTeaG_editorBody",
46675
46922
  "decisionActions": "-kTeaG_decisionActions",
46676
- "collapseChat": "-kTeaG_collapseChat",
46677
- "importPreview": "-kTeaG_importPreview",
46678
- "conflictDialog": "-kTeaG_conflictDialog",
46679
- "workflowEyebrow": "-kTeaG_workflowEyebrow",
46680
- "reviewChecklistRow": "-kTeaG_reviewChecklistRow",
46681
- "execute": "-kTeaG_execute",
46682
- "decisionAsideHead": "-kTeaG_decisionAsideHead",
46683
- "decisionEvidenceList": "-kTeaG_decisionEvidenceList",
46684
- "downstreamReturn": "-kTeaG_downstreamReturn",
46685
- "documentReviewAnchor": "-kTeaG_documentReviewAnchor",
46686
- "panelAction": "-kTeaG_panelAction",
46687
- "mobileSpec": "-kTeaG_mobileSpec",
46688
- "resizer": "-kTeaG_resizer",
46689
- "mobileViewSwitch": "-kTeaG_mobileViewSwitch",
46690
- "stage_ready": "-kTeaG_stage_ready",
46691
- "versionCopy": "-kTeaG_versionCopy",
46692
- "reviewCheckArrow": "-kTeaG_reviewCheckArrow",
46693
- "compareColumns": "-kTeaG_compareColumns",
46694
- "createButton": "-kTeaG_createButton",
46695
- "editorTitle": "-kTeaG_editorTitle",
46696
- "resizerHidden": "-kTeaG_resizerHidden",
46697
- "selectionPromptButtons": "-kTeaG_selectionPromptButtons",
46698
- "decisionTags": "-kTeaG_decisionTags",
46699
- "inlineReviewPrompt": "-kTeaG_inlineReviewPrompt",
46700
- "insightPanel": "-kTeaG_insightPanel",
46701
- "decisionEvidence": "-kTeaG_decisionEvidence",
46702
- "entryActive": "-kTeaG_entryActive",
46703
46923
  "iconButton": "-kTeaG_iconButton",
46704
- "headerActions": "-kTeaG_headerActions",
46705
- "titleBlock": "-kTeaG_titleBlock",
46706
- "insightScore": "-kTeaG_insightScore",
46707
- "backLabel": "-kTeaG_backLabel",
46708
- "topActions": "-kTeaG_topActions",
46709
- "saveButton": "-kTeaG_saveButton",
46710
- "diffActions": "-kTeaG_diffActions",
46924
+ "commentThread": "-kTeaG_commentThread",
46925
+ "stageRail": "-kTeaG_stageRail",
46926
+ "emptyMain": "-kTeaG_emptyMain",
46711
46927
  "reviewCard": "-kTeaG_reviewCard",
46712
- "inlineReviewQuestion": "-kTeaG_inlineReviewQuestion",
46713
- "selectionPromptCancel": "-kTeaG_selectionPromptCancel",
46714
- "footer": "-kTeaG_footer",
46928
+ "dialogHead": "-kTeaG_dialogHead",
46929
+ "reply": "-kTeaG_reply",
46930
+ "readyPackageHead": "-kTeaG_readyPackageHead",
46931
+ "stickyActions": "-kTeaG_stickyActions",
46932
+ "documentReviewAnchor": "-kTeaG_documentReviewAnchor",
46933
+ "identity": "-kTeaG_identity",
46934
+ "requirementRow": "-kTeaG_requirementRow",
46935
+ "inlineReviewPrompt": "-kTeaG_inlineReviewPrompt",
46936
+ "conflictDialog": "-kTeaG_conflictDialog",
46937
+ "toolbar": "-kTeaG_toolbar",
46938
+ "reviewSourceSelected": "-kTeaG_reviewSourceSelected",
46939
+ "commentSourceButton": "-kTeaG_commentSourceButton",
46940
+ "insightFilters": "-kTeaG_insightFilters",
46941
+ "selectionPromptClose": "-kTeaG_selectionPromptClose",
46942
+ "readyPackage": "-kTeaG_readyPackage",
46943
+ "collabMetricActive": "-kTeaG_collabMetricActive",
46944
+ "dialogSurface": "-kTeaG_dialogSurface",
46945
+ "versionCopy": "-kTeaG_versionCopy",
46946
+ "editorContext": "-kTeaG_editorContext",
46947
+ "requirementSearch": "-kTeaG_requirementSearch",
46715
46948
  "decisionEmpty": "-kTeaG_decisionEmpty",
46949
+ "insightCard": "-kTeaG_insightCard",
46716
46950
  "decisionForm": "-kTeaG_decisionForm",
46717
- "documents": "-kTeaG_documents",
46718
- "collapseRight": "-kTeaG_collapseRight",
46719
- "editorContext": "-kTeaG_editorContext",
46720
- "fileButton": "-kTeaG_fileButton",
46721
- "empty": "-kTeaG_empty",
46722
- "activeContext": "-kTeaG_activeContext",
46723
- "inlineReviewActions": "-kTeaG_inlineReviewActions",
46724
- "documentReviewAnchorSelected": "-kTeaG_documentReviewAnchorSelected",
46951
+ "stageDone": "-kTeaG_stageDone",
46952
+ "reviewChecklistBlocking": "-kTeaG_reviewChecklistBlocking",
46953
+ "commentThreadSelected": "-kTeaG_commentThreadSelected",
46725
46954
  "paneClosed": "-kTeaG_paneClosed",
46726
- "reviewTitle": "-kTeaG_reviewTitle",
46727
- "mobileDocumentsOpen": "-kTeaG_mobileDocumentsOpen",
46728
- "collabStateSaved": "-kTeaG_collabStateSaved",
46955
+ "locateSourceButton": "-kTeaG_locateSourceButton",
46956
+ "panelAction": "-kTeaG_panelAction",
46957
+ "legacyWarning": "-kTeaG_legacyWarning",
46958
+ "reviewDecisionModal": "-kTeaG_reviewDecisionModal",
46959
+ "reviewDecisionDialog": "-kTeaG_reviewDecisionDialog",
46960
+ "inlineReviewQuestion": "-kTeaG_inlineReviewQuestion",
46961
+ "tabBadge": "-kTeaG_tabBadge",
46962
+ "selectionPromptBelow": "-kTeaG_selectionPromptBelow",
46963
+ "activeContext": "-kTeaG_activeContext",
46729
46964
  "commentThreadMeta": "-kTeaG_commentThreadMeta",
46730
- "emptyList": "-kTeaG_emptyList",
46965
+ "modal": "-kTeaG_modal",
46966
+ "discussionPanel": "-kTeaG_discussionPanel",
46967
+ "createSummary": "-kTeaG_createSummary",
46968
+ "unsaved": "-kTeaG_unsaved",
46969
+ "mobileDocumentsOpen": "-kTeaG_mobileDocumentsOpen",
46970
+ "diffAdded": "-kTeaG_diffAdded",
46971
+ "run": "-kTeaG_run",
46972
+ "inlineReviewDetails": "-kTeaG_inlineReviewDetails",
46973
+ "insightScore": "-kTeaG_insightScore",
46974
+ "topActions": "-kTeaG_topActions",
46975
+ "documentReviewHighlight": "-kTeaG_documentReviewHighlight",
46976
+ "inlineReviewHeadActions": "-kTeaG_inlineReviewHeadActions",
46977
+ "decisionQuestion": "-kTeaG_decisionQuestion",
46978
+ "mobileCollab": "-kTeaG_mobileCollab",
46979
+ "reviewTitle": "-kTeaG_reviewTitle",
46980
+ "decisionOptions": "-kTeaG_decisionOptions",
46981
+ "collabBarState": "-kTeaG_collabBarState",
46982
+ "diffRemoved": "-kTeaG_diffRemoved",
46983
+ "versionActions": "-kTeaG_versionActions",
46984
+ "richEditor": "-kTeaG_richEditor",
46985
+ "insightPanel": "-kTeaG_insightPanel",
46986
+ "reviewHeader": "-kTeaG_reviewHeader",
46987
+ "replyStack": "-kTeaG_replyStack",
46731
46988
  "stageCurrent": "-kTeaG_stageCurrent",
46732
- "aiMessage": "-kTeaG_aiMessage",
46733
- "stickyActions": "-kTeaG_stickyActions",
46734
- "selectedDoc": "-kTeaG_selectedDoc",
46735
- "collabBarActions": "-kTeaG_collabBarActions",
46989
+ "paneActions": "-kTeaG_paneActions",
46990
+ "compareColumns": "-kTeaG_compareColumns",
46991
+ "decisionResponse": "-kTeaG_decisionResponse",
46992
+ "versionPicker": "-kTeaG_versionPicker",
46993
+ "reviewChecklistRow": "-kTeaG_reviewChecklistRow",
46736
46994
  "editorPane": "-kTeaG_editorPane",
46737
- "selectionPromptSubmit": "-kTeaG_selectionPromptSubmit",
46738
- "collabMetricWarn": "-kTeaG_collabMetricWarn",
46739
- "documentAnchorHighlight": "-kTeaG_documentAnchorHighlight",
46740
- "commentSourceButton": "-kTeaG_commentSourceButton",
46741
- "chatError": "-kTeaG_chatError",
46742
- "checkPassed": "-kTeaG_checkPassed",
46743
- "decisionSourceHead": "-kTeaG_decisionSourceHead",
46744
- "taskQueue": "-kTeaG_taskQueue",
46745
- "decisionModeHint": "-kTeaG_decisionModeHint",
46746
- "documentAnchorSelected": "-kTeaG_documentAnchorSelected",
46747
- "disabledReason": "-kTeaG_disabledReason",
46748
- "diffDialog": "-kTeaG_diffDialog",
46995
+ "replyComposer": "-kTeaG_replyComposer",
46996
+ "empty": "-kTeaG_empty",
46749
46997
  "reviewAnchorLayer": "-kTeaG_reviewAnchorLayer",
46750
- "emptyAside": "-kTeaG_emptyAside",
46751
- "summaryField": "-kTeaG_summaryField",
46752
- "myWorkSummary": "-kTeaG_myWorkSummary",
46753
- "historyGroup": "-kTeaG_historyGroup",
46754
- "documentReviewAnchorBlocking": "-kTeaG_documentReviewAnchorBlocking",
46755
- "srOnly": "-kTeaG_srOnly",
46756
- "reviewChecklistSelected": "-kTeaG_reviewChecklistSelected",
46757
- "reviewDecisionBody": "-kTeaG_reviewDecisionBody",
46758
- "taskAssignment": "-kTeaG_taskAssignment",
46759
- "insightActions": "-kTeaG_insightActions",
46760
- "stageDone": "-kTeaG_stageDone",
46761
- "checkItem": "-kTeaG_checkItem",
46762
- "editorBody": "-kTeaG_editorBody",
46763
- "tabBadge": "-kTeaG_tabBadge",
46764
- "reviewCheckStatus": "-kTeaG_reviewCheckStatus",
46765
- "paneActions": "-kTeaG_paneActions",
46766
- "discussionFilters": "-kTeaG_discussionFilters",
46767
- "notificationDialog": "-kTeaG_notificationDialog",
46768
- "reviewSourceSelected": "-kTeaG_reviewSourceSelected",
46769
- "threadPills": "-kTeaG_threadPills",
46770
- "reviewDecisionDialog": "-kTeaG_reviewDecisionDialog",
46771
- "diffCollapsed": "-kTeaG_diffCollapsed",
46772
- "notice": "-kTeaG_notice",
46998
+ "richEditorShell": "-kTeaG_richEditorShell",
46999
+ "documents": "-kTeaG_documents",
47000
+ "view": "-kTeaG_view",
47001
+ "filterChecks": "-kTeaG_filterChecks",
46773
47002
  "conflictDiffs": "-kTeaG_conflictDiffs",
46774
- "workflowFocus": "-kTeaG_workflowFocus",
46775
- "markdownBody": "-kTeaG_markdownBody",
46776
- "versionPicker": "-kTeaG_versionPicker",
46777
- "inlineReviewHead": "-kTeaG_inlineReviewHead",
46778
- "reviewDecisionHeader": "-kTeaG_reviewDecisionHeader",
46779
- "dialogHead": "-kTeaG_dialogHead",
46780
- "collabStateDirty": "-kTeaG_collabStateDirty",
47003
+ "decisionModeHint": "-kTeaG_decisionModeHint",
47004
+ "decisionSource": "-kTeaG_decisionSource",
47005
+ "selectionPrompt": "-kTeaG_selectionPrompt",
46781
47006
  "pulse": "-kTeaG_pulse",
46782
- "paneHead": "-kTeaG_paneHead",
46783
- "diffAdded": "-kTeaG_diffAdded",
46784
- "filterChecks": "-kTeaG_filterChecks",
46785
- "diffRemoved": "-kTeaG_diffRemoved",
46786
- "richEditor": "-kTeaG_richEditor",
46787
- "patchPreview": "-kTeaG_patchPreview",
46788
- "runningDot": "-kTeaG_runningDot",
46789
- "readyPackageHead": "-kTeaG_readyPackageHead",
46790
- "mobileDrawerClose": "-kTeaG_mobileDrawerClose",
46791
- "checklistMeter": "-kTeaG_checklistMeter",
46792
- "focusMode": "-kTeaG_focusMode",
46793
- "stageRail": "-kTeaG_stageRail",
46794
- "collabBarState": "-kTeaG_collabBarState",
46795
- "structuredDiff": "-kTeaG_structuredDiff",
46796
- "identity": "-kTeaG_identity",
46797
- "reply": "-kTeaG_reply",
46798
- "chatComposer": "-kTeaG_chatComposer",
46799
- "decisionOptions": "-kTeaG_decisionOptions",
46800
- "review": "-kTeaG_review",
47007
+ "tabPanel": "-kTeaG_tabPanel",
47008
+ "reviewCheckStatus": "-kTeaG_reviewCheckStatus",
47009
+ "patchDetails": "-kTeaG_patchDetails",
47010
+ "stage_product-confirmation": "-kTeaG_stage_product-confirmation",
47011
+ "grid": "-kTeaG_grid",
47012
+ "dialogForm": "-kTeaG_dialogForm",
46801
47013
  "insightLinks": "-kTeaG_insightLinks",
46802
- "dangerButton": "-kTeaG_dangerButton",
46803
- "reviewChecklistSettled": "-kTeaG_reviewChecklistSettled",
46804
- "activeFilters": "-kTeaG_activeFilters",
46805
- "primaryNav": "-kTeaG_primaryNav",
46806
- "toolbar": "-kTeaG_toolbar",
46807
- "selectionPromptActions": "-kTeaG_selectionPromptActions",
46808
- "chatToggle": "-kTeaG_chatToggle"
47014
+ "decisionTags": "-kTeaG_decisionTags",
47015
+ "versionCompare": "-kTeaG_versionCompare",
47016
+ "versionRow": "-kTeaG_versionRow",
47017
+ "aiConversation": "-kTeaG_aiConversation",
47018
+ "conflictColumns": "-kTeaG_conflictColumns",
47019
+ "selectionPromptButtons": "-kTeaG_selectionPromptButtons",
47020
+ "collabStateSaved": "-kTeaG_collabStateSaved",
47021
+ "recordLinkButton": "-kTeaG_recordLinkButton",
47022
+ "conflictModal": "-kTeaG_conflictModal",
47023
+ "badges": "-kTeaG_badges",
47024
+ "commentThreadClosed": "-kTeaG_commentThreadClosed",
47025
+ "checkIcon": "-kTeaG_checkIcon",
47026
+ "checklistMeter": "-kTeaG_checklistMeter"
46809
47027
  };
46810
47028
  //#endregion
46811
47029
  //#region src/client/AccessibleDialog.tsx
@@ -52246,6 +52464,11 @@ window.__ModuleLoader__.load({
52246
52464
  element: skillCenter,
52247
52465
  placement: "after"
52248
52466
  };
52467
+ const plugins = document.querySelector("button[aria-label=\"插件\"], button[aria-label=\"Plugins\"]") ?? exactTextButton(document, "插件") ?? exactTextButton(document, "Plugins");
52468
+ if (plugins !== void 0 && plugins !== null) return {
52469
+ element: plugins,
52470
+ placement: "after"
52471
+ };
52249
52472
  const settings = document.querySelector("button[aria-label=\"设置\"]") ?? exactTextButton(document, "设置");
52250
52473
  if (settings !== void 0 && settings !== null) return {
52251
52474
  element: settings,
@@ -52403,7 +52626,6 @@ window.__ModuleLoader__.load({
52403
52626
  }
52404
52627
  //#endregion
52405
52628
  //#region src/client/index.ts
52406
- const inject = ["sessions"];
52407
52629
  function apply(ctx) {
52408
52630
  const api = new SpecApi();
52409
52631
  const disposers = [];
@@ -52418,7 +52640,6 @@ window.__ModuleLoader__.load({
52418
52640
  }
52419
52641
  //#endregion
52420
52642
  exports.apply = apply;
52421
- exports.inject = inject;
52422
52643
  return module.exports;
52423
52644
  }
52424
52645
  });