avo 3.13.2 → 3.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18398,12 +18398,12 @@
18398
18398
  this$1$1.runCallbacks();
18399
18399
  }
18400
18400
  };
18401
- var config2 = chart.__config();
18402
- if (config2.language) {
18403
- loadOptions.language = config2.language;
18401
+ var config3 = chart.__config();
18402
+ if (config3.language) {
18403
+ loadOptions.language = config3.language;
18404
18404
  }
18405
- if (pack === "geochart" && config2.mapsApiKey) {
18406
- loadOptions.mapsApiKey = config2.mapsApiKey;
18405
+ if (pack === "geochart" && config3.mapsApiKey) {
18406
+ loadOptions.mapsApiKey = config3.mapsApiKey;
18407
18407
  }
18408
18408
  this.library.charts.load("current", loadOptions);
18409
18409
  }
@@ -18687,7 +18687,7 @@
18687
18687
  xhr.send();
18688
18688
  }
18689
18689
  }
18690
- var config = {};
18690
+ var config2 = {};
18691
18691
  var adapters2 = [];
18692
18692
  function setText(element, text) {
18693
18693
  if (document.body.innerText) {
@@ -18925,7 +18925,7 @@
18925
18925
  renderChart(this.__chartName(), this);
18926
18926
  };
18927
18927
  Chart2.prototype.__config = function __config() {
18928
- return config;
18928
+ return config2;
18929
18929
  };
18930
18930
  var LineChart = /* @__PURE__ */ function(Chart3) {
18931
18931
  function LineChart2() {
@@ -19090,7 +19090,7 @@
19090
19090
  configure: function(options) {
19091
19091
  for (var key in options) {
19092
19092
  if (options.hasOwnProperty(key)) {
19093
- config[key] = options[key];
19093
+ config2[key] = options[key];
19094
19094
  }
19095
19095
  }
19096
19096
  },
@@ -19112,7 +19112,7 @@
19112
19112
  }
19113
19113
  }
19114
19114
  },
19115
- config,
19115
+ config: config2,
19116
19116
  options: {},
19117
19117
  adapters: adapters2,
19118
19118
  addAdapter,
@@ -19124,12 +19124,12 @@
19124
19124
  if (typeof window !== "undefined" && !window.Chartkick) {
19125
19125
  window.Chartkick = Chartkick2;
19126
19126
  document.addEventListener("turbolinks:before-render", function() {
19127
- if (config.autoDestroy !== false) {
19127
+ if (config2.autoDestroy !== false) {
19128
19128
  Chartkick2.destroyAll();
19129
19129
  }
19130
19130
  });
19131
19131
  document.addEventListener("turbo:before-render", function() {
19132
- if (config.autoDestroy !== false) {
19132
+ if (config2.autoDestroy !== false) {
19133
19133
  Chartkick2.destroyAll();
19134
19134
  }
19135
19135
  });
@@ -22785,13 +22785,13 @@
22785
22785
  function isIChartComponent(proto) {
22786
22786
  return "id" in proto && "defaults" in proto;
22787
22787
  }
22788
- function allPlugins(config) {
22788
+ function allPlugins(config2) {
22789
22789
  const plugins2 = [];
22790
22790
  const keys2 = Object.keys(registry.plugins.items);
22791
22791
  for (let i5 = 0; i5 < keys2.length; i5++) {
22792
22792
  plugins2.push(registry.getPlugin(keys2[i5]));
22793
22793
  }
22794
- const local = config.plugins || [];
22794
+ const local = config2.plugins || [];
22795
22795
  for (let i5 = 0; i5 < local.length; i5++) {
22796
22796
  const plugin = local[i5];
22797
22797
  if (plugins2.indexOf(plugin) === -1) {
@@ -22826,10 +22826,10 @@
22826
22826
  }
22827
22827
  return result;
22828
22828
  }
22829
- function pluginOpts(config, plugin, opts, context) {
22830
- const keys2 = config.pluginScopeKeys(plugin);
22831
- const scopes = config.getOptionScopes(opts, keys2);
22832
- return config.createResolver(scopes, context, [""], { scriptable: false, indexable: false, allKeys: true });
22829
+ function pluginOpts(config2, plugin, opts, context) {
22830
+ const keys2 = config2.pluginScopeKeys(plugin);
22831
+ const scopes = config2.getOptionScopes(opts, keys2);
22832
+ return config2.createResolver(scopes, context, [""], { scriptable: false, indexable: false, allKeys: true });
22833
22833
  }
22834
22834
  function getIndexAxis(type, options) {
22835
22835
  const datasetDefaults = defaults.datasets[type] || {};
@@ -22862,10 +22862,10 @@
22862
22862
  }
22863
22863
  return scaleOptions.axis || axisFromPosition(scaleOptions.position) || id.charAt(0).toLowerCase();
22864
22864
  }
22865
- function mergeScaleConfig(config, options) {
22866
- const chartDefaults = overrides[config.type] || { scales: {} };
22865
+ function mergeScaleConfig(config2, options) {
22866
+ const chartDefaults = overrides[config2.type] || { scales: {} };
22867
22867
  const configScales = options.scales || {};
22868
- const chartIndexAxis = getIndexAxis(config.type, options);
22868
+ const chartIndexAxis = getIndexAxis(config2.type, options);
22869
22869
  const firstIDs = /* @__PURE__ */ Object.create(null);
22870
22870
  const scales2 = /* @__PURE__ */ Object.create(null);
22871
22871
  Object.keys(configScales).forEach((id) => {
@@ -22882,8 +22882,8 @@
22882
22882
  firstIDs[axis] = firstIDs[axis] || id;
22883
22883
  scales2[id] = mergeIf(/* @__PURE__ */ Object.create(null), [{ axis }, scaleConf, defaultScaleOptions[axis], defaultScaleOptions[defaultId]]);
22884
22884
  });
22885
- config.data.datasets.forEach((dataset) => {
22886
- const type = dataset.type || config.type;
22885
+ config2.data.datasets.forEach((dataset) => {
22886
+ const type = dataset.type || config2.type;
22887
22887
  const indexAxis = dataset.indexAxis || getIndexAxis(type, options);
22888
22888
  const datasetDefaults = overrides[type] || {};
22889
22889
  const defaultScaleOptions = datasetDefaults.scales || {};
@@ -22900,10 +22900,10 @@
22900
22900
  });
22901
22901
  return scales2;
22902
22902
  }
22903
- function initOptions(config) {
22904
- const options = config.options || (config.options = {});
22903
+ function initOptions(config2) {
22904
+ const options = config2.options || (config2.options = {});
22905
22905
  options.plugins = valueOrDefault(options.plugins, {});
22906
- options.scales = mergeScaleConfig(config, options);
22906
+ options.scales = mergeScaleConfig(config2, options);
22907
22907
  }
22908
22908
  function initData(data) {
22909
22909
  data = data || {};
@@ -22911,11 +22911,11 @@
22911
22911
  data.labels = data.labels || [];
22912
22912
  return data;
22913
22913
  }
22914
- function initConfig(config) {
22915
- config = config || {};
22916
- config.data = initData(config.data);
22917
- initOptions(config);
22918
- return config;
22914
+ function initConfig(config2) {
22915
+ config2 = config2 || {};
22916
+ config2.data = initData(config2.data);
22917
+ initOptions(config2);
22918
+ return config2;
22919
22919
  }
22920
22920
  function cachedKeys(cacheKey, generate) {
22921
22921
  let keys2 = keyCache.get(cacheKey);
@@ -24856,18 +24856,18 @@
24856
24856
  }
24857
24857
  });
24858
24858
  Animations = class {
24859
- constructor(chart, config) {
24859
+ constructor(chart, config2) {
24860
24860
  this._chart = chart;
24861
24861
  this._properties = /* @__PURE__ */ new Map();
24862
- this.configure(config);
24862
+ this.configure(config2);
24863
24863
  }
24864
- configure(config) {
24865
- if (!isObject(config)) {
24864
+ configure(config2) {
24865
+ if (!isObject(config2)) {
24866
24866
  return;
24867
24867
  }
24868
24868
  const animatedProps = this._properties;
24869
- Object.getOwnPropertyNames(config).forEach((key) => {
24870
- const cfg = config[key];
24869
+ Object.getOwnPropertyNames(config2).forEach((key) => {
24870
+ const cfg = config2[key];
24871
24871
  if (!isObject(cfg)) {
24872
24872
  return;
24873
24873
  }
@@ -25068,10 +25068,10 @@
25068
25068
  }
25069
25069
  }
25070
25070
  configure() {
25071
- const config = this.chart.config;
25072
- const scopeKeys = config.datasetScopeKeys(this._type);
25073
- const scopes = config.getOptionScopes(this.getDataset(), scopeKeys, true);
25074
- this.options = config.createResolver(scopes, this.getContext());
25071
+ const config2 = this.chart.config;
25072
+ const scopeKeys = config2.datasetScopeKeys(this._type);
25073
+ const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys, true);
25074
+ this.options = config2.createResolver(scopes, this.getContext());
25075
25075
  this._parsing = this.options.parsing;
25076
25076
  this._cachedDataOpts = {};
25077
25077
  }
@@ -25316,13 +25316,13 @@
25316
25316
  if (cached) {
25317
25317
  return cloneIfNotShared(cached, sharing);
25318
25318
  }
25319
- const config = this.chart.config;
25320
- const scopeKeys = config.datasetElementScopeKeys(this._type, elementType2);
25319
+ const config2 = this.chart.config;
25320
+ const scopeKeys = config2.datasetElementScopeKeys(this._type, elementType2);
25321
25321
  const prefixes = active ? [`${elementType2}Hover`, "hover", elementType2, ""] : [elementType2, ""];
25322
- const scopes = config.getOptionScopes(this.getDataset(), scopeKeys);
25322
+ const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys);
25323
25323
  const names2 = Object.keys(defaults.elements[elementType2]);
25324
25324
  const context = () => this.getContext(index2, active);
25325
- const values = config.resolveNamedOptions(scopes, names2, context, prefixes);
25325
+ const values = config2.resolveNamedOptions(scopes, names2, context, prefixes);
25326
25326
  if (values.$shared) {
25327
25327
  values.$shared = sharing;
25328
25328
  cache2[cacheKey] = Object.freeze(cloneIfNotShared(values, sharing));
@@ -25339,10 +25339,10 @@
25339
25339
  }
25340
25340
  let options;
25341
25341
  if (chart.options.animation !== false) {
25342
- const config = this.chart.config;
25343
- const scopeKeys = config.datasetAnimationScopeKeys(this._type, transition2);
25344
- const scopes = config.getOptionScopes(this.getDataset(), scopeKeys);
25345
- options = config.createResolver(scopes, this.getContext(index2, active, transition2));
25342
+ const config2 = this.chart.config;
25343
+ const scopeKeys = config2.datasetAnimationScopeKeys(this._type, transition2);
25344
+ const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys);
25345
+ options = config2.createResolver(scopes, this.getContext(index2, active, transition2));
25346
25346
  }
25347
25347
  const animations = new Animations(chart, options && options.animations);
25348
25348
  if (options && options._cacheable) {
@@ -26739,15 +26739,15 @@
26739
26739
  isAttached(canvas) {
26740
26740
  return true;
26741
26741
  }
26742
- updateConfig(config) {
26742
+ updateConfig(config2) {
26743
26743
  }
26744
26744
  };
26745
26745
  BasicPlatform = class extends BasePlatform {
26746
26746
  acquireContext(item) {
26747
26747
  return item && item.getContext && item.getContext("2d") || null;
26748
26748
  }
26749
- updateConfig(config) {
26750
- config.options.animation = false;
26749
+ updateConfig(config2) {
26750
+ config2.options.animation = false;
26751
26751
  }
26752
26752
  };
26753
26753
  EXPANDO_KEY = "$chartjs";
@@ -28211,9 +28211,9 @@
28211
28211
  return descriptors2;
28212
28212
  }
28213
28213
  _createDescriptors(chart, all) {
28214
- const config = chart && chart.config;
28215
- const options = valueOrDefault(config.options && config.options.plugins, {});
28216
- const plugins2 = allPlugins(config);
28214
+ const config2 = chart && chart.config;
28215
+ const options = valueOrDefault(config2.options && config2.options.plugins, {});
28216
+ const plugins2 = allPlugins(config2);
28217
28217
  return options === false && !all ? [] : createDescriptors(chart, plugins2, options, all);
28218
28218
  }
28219
28219
  _notifyStateChanges(chart) {
@@ -28233,8 +28233,8 @@
28233
28233
  }
28234
28234
  };
28235
28235
  Config = class {
28236
- constructor(config) {
28237
- this._config = initConfig(config);
28236
+ constructor(config2) {
28237
+ this._config = initConfig(config2);
28238
28238
  this._scopeCache = /* @__PURE__ */ new Map();
28239
28239
  this._resolverCache = /* @__PURE__ */ new Map();
28240
28240
  }
@@ -28263,9 +28263,9 @@
28263
28263
  return this._config.plugins;
28264
28264
  }
28265
28265
  update() {
28266
- const config = this._config;
28266
+ const config2 = this._config;
28267
28267
  this.clearCache();
28268
- initOptions(config);
28268
+ initOptions(config2);
28269
28269
  }
28270
28270
  clearCache() {
28271
28271
  this._scopeCache.clear();
@@ -28394,7 +28394,7 @@
28394
28394
  };
28395
28395
  Chart = class {
28396
28396
  constructor(item, userConfig) {
28397
- const config = this.config = new Config(userConfig);
28397
+ const config2 = this.config = new Config(userConfig);
28398
28398
  const initialCanvas = getCanvas(item);
28399
28399
  const existingChart = getChart(initialCanvas);
28400
28400
  if (existingChart) {
@@ -28402,9 +28402,9 @@
28402
28402
  "Canvas is already in use. Chart with ID '" + existingChart.id + "' must be destroyed before the canvas can be reused."
28403
28403
  );
28404
28404
  }
28405
- const options = config.createResolver(config.chartOptionScopes(), this.getContext());
28406
- this.platform = new (config.platform || _detectPlatform(initialCanvas))();
28407
- this.platform.updateConfig(config);
28405
+ const options = config2.createResolver(config2.chartOptionScopes(), this.getContext());
28406
+ this.platform = new (config2.platform || _detectPlatform(initialCanvas))();
28407
+ this.platform.updateConfig(config2);
28408
28408
  const context = this.platform.acquireContext(initialCanvas, options.aspectRatio);
28409
28409
  const canvas = context && context.canvas;
28410
28410
  const height = canvas && canvas.height;
@@ -28652,9 +28652,9 @@
28652
28652
  this.notifyPlugins("reset");
28653
28653
  }
28654
28654
  update(mode) {
28655
- const config = this.config;
28656
- config.update();
28657
- const options = this._options = config.createResolver(config.chartOptionScopes(), this.getContext());
28655
+ const config2 = this.config;
28656
+ config2.update();
28657
+ const options = this._options = config2.createResolver(config2.chartOptionScopes(), this.getContext());
28658
28658
  const animsDisabled = this._animationsDisabled = !options.animation;
28659
28659
  this._updateScales();
28660
28660
  this._checkEventBindings();
@@ -29719,15 +29719,15 @@
29719
29719
  };
29720
29720
  itemsEqual = (a5, b4) => a5 !== null && b4 !== null && a5.datasetIndex === b4.datasetIndex && a5.index === b4.index;
29721
29721
  Legend = class extends Element2 {
29722
- constructor(config) {
29722
+ constructor(config2) {
29723
29723
  super();
29724
29724
  this._added = false;
29725
29725
  this.legendHitBoxes = [];
29726
29726
  this._hoveredItem = null;
29727
29727
  this.doughnutMode = false;
29728
- this.chart = config.chart;
29729
- this.options = config.options;
29730
- this.ctx = config.ctx;
29728
+ this.chart = config2.chart;
29729
+ this.options = config2.options;
29730
+ this.ctx = config2.ctx;
29731
29731
  this.legendItems = void 0;
29732
29732
  this.columnSizes = void 0;
29733
29733
  this.lineWidths = void 0;
@@ -30176,11 +30176,11 @@
30176
30176
  }
30177
30177
  };
30178
30178
  Title = class extends Element2 {
30179
- constructor(config) {
30179
+ constructor(config2) {
30180
30180
  super();
30181
- this.chart = config.chart;
30182
- this.options = config.options;
30183
- this.ctx = config.ctx;
30181
+ this.chart = config2.chart;
30182
+ this.options = config2.options;
30183
+ this.ctx = config2.ctx;
30184
30184
  this._padding = void 0;
30185
30185
  this.top = void 0;
30186
30186
  this.bottom = void 0;
@@ -30390,7 +30390,7 @@
30390
30390
  }
30391
30391
  };
30392
30392
  Tooltip = class extends Element2 {
30393
- constructor(config) {
30393
+ constructor(config2) {
30394
30394
  super();
30395
30395
  this.opacity = 0;
30396
30396
  this._active = [];
@@ -30400,9 +30400,9 @@
30400
30400
  this._tooltipItems = [];
30401
30401
  this.$animations = void 0;
30402
30402
  this.$context = void 0;
30403
- this.chart = config.chart || config._chart;
30403
+ this.chart = config2.chart || config2._chart;
30404
30404
  this._chart = this.chart;
30405
- this.options = config.options;
30405
+ this.options = config2.options;
30406
30406
  this.dataPoints = void 0;
30407
30407
  this.title = void 0;
30408
30408
  this.beforeBody = void 0;
@@ -55690,6 +55690,7 @@
55690
55690
  StreamSourceElement: () => StreamSourceElement,
55691
55691
  cache: () => cache,
55692
55692
  clearCache: () => clearCache,
55693
+ config: () => config,
55693
55694
  connectStreamSource: () => connectStreamSource,
55694
55695
  disconnectStreamSource: () => disconnectStreamSource,
55695
55696
  fetch: () => fetchWithTurboHeaders,
@@ -55712,9 +55713,9 @@
55712
55713
  return candidate?.type == "submit" ? candidate : null;
55713
55714
  }
55714
55715
  function clickCaptured(event) {
55715
- const submitter = findSubmitterFromClickTarget(event.target);
55716
- if (submitter && submitter.form) {
55717
- submittersByForm.set(submitter.form, submitter);
55716
+ const submitter2 = findSubmitterFromClickTarget(event.target);
55717
+ if (submitter2 && submitter2.form) {
55718
+ submittersByForm.set(submitter2.form, submitter2);
55718
55719
  }
55719
55720
  }
55720
55721
  function frameLoadingStyleFromString(style2) {
@@ -55725,56 +55726,6 @@
55725
55726
  return FrameLoadingStyle.eager;
55726
55727
  }
55727
55728
  }
55728
- function expandURL(locatable) {
55729
- return new URL(locatable.toString(), document.baseURI);
55730
- }
55731
- function getAnchor(url) {
55732
- let anchorMatch;
55733
- if (url.hash) {
55734
- return url.hash.slice(1);
55735
- } else if (anchorMatch = url.href.match(/#(.*)$/)) {
55736
- return anchorMatch[1];
55737
- }
55738
- }
55739
- function getAction$1(form, submitter) {
55740
- const action = submitter?.getAttribute("formaction") || form.getAttribute("action") || form.action;
55741
- return expandURL(action);
55742
- }
55743
- function getExtension(url) {
55744
- return (getLastPathComponent(url).match(/\.[^.]*$/) || [])[0] || "";
55745
- }
55746
- function isHTML(url) {
55747
- return !!getExtension(url).match(/^(?:|\.(?:htm|html|xhtml|php))$/);
55748
- }
55749
- function isPrefixedBy(baseURL, url) {
55750
- const prefix = getPrefix(url);
55751
- return baseURL.href === expandURL(prefix).href || baseURL.href.startsWith(prefix);
55752
- }
55753
- function locationIsVisitable(location2, rootLocation) {
55754
- return isPrefixedBy(location2, rootLocation) && isHTML(location2);
55755
- }
55756
- function getRequestURL(url) {
55757
- const anchor = getAnchor(url);
55758
- return anchor != null ? url.href.slice(0, -(anchor.length + 1)) : url.href;
55759
- }
55760
- function toCacheKey(url) {
55761
- return getRequestURL(url);
55762
- }
55763
- function urlsAreEqual(left2, right2) {
55764
- return expandURL(left2).href == expandURL(right2).href;
55765
- }
55766
- function getPathComponents(url) {
55767
- return url.pathname.split("/").slice(1);
55768
- }
55769
- function getLastPathComponent(url) {
55770
- return getPathComponents(url).slice(-1)[0];
55771
- }
55772
- function getPrefix(url) {
55773
- return addTrailingSlash(url.origin + url.pathname);
55774
- }
55775
- function addTrailingSlash(value) {
55776
- return value.endsWith("/") ? value : value + "/";
55777
- }
55778
55729
  function activateScriptElement(element) {
55779
55730
  if (element.getAttribute("data-turbo-eval") == "false") {
55780
55731
  return element;
@@ -55814,6 +55765,10 @@
55814
55765
  }
55815
55766
  return event;
55816
55767
  }
55768
+ function cancelEvent(event) {
55769
+ event.preventDefault();
55770
+ event.stopImmediatePropagation();
55771
+ }
55817
55772
  function nextRepaint() {
55818
55773
  if (document.visibilityState === "hidden") {
55819
55774
  return nextEventLoopTick();
@@ -55975,6 +55930,53 @@
55975
55930
  timeoutId = setTimeout(callback2, delay);
55976
55931
  };
55977
55932
  }
55933
+ function expandURL(locatable) {
55934
+ return new URL(locatable.toString(), document.baseURI);
55935
+ }
55936
+ function getAnchor(url) {
55937
+ let anchorMatch;
55938
+ if (url.hash) {
55939
+ return url.hash.slice(1);
55940
+ } else if (anchorMatch = url.href.match(/#(.*)$/)) {
55941
+ return anchorMatch[1];
55942
+ }
55943
+ }
55944
+ function getAction$1(form, submitter2) {
55945
+ const action = submitter2?.getAttribute("formaction") || form.getAttribute("action") || form.action;
55946
+ return expandURL(action);
55947
+ }
55948
+ function getExtension(url) {
55949
+ return (getLastPathComponent(url).match(/\.[^.]*$/) || [])[0] || "";
55950
+ }
55951
+ function isPrefixedBy(baseURL, url) {
55952
+ const prefix = getPrefix(url);
55953
+ return baseURL.href === expandURL(prefix).href || baseURL.href.startsWith(prefix);
55954
+ }
55955
+ function locationIsVisitable(location2, rootLocation) {
55956
+ return isPrefixedBy(location2, rootLocation) && !config.drive.unvisitableExtensions.has(getExtension(location2));
55957
+ }
55958
+ function getRequestURL(url) {
55959
+ const anchor = getAnchor(url);
55960
+ return anchor != null ? url.href.slice(0, -(anchor.length + 1)) : url.href;
55961
+ }
55962
+ function toCacheKey(url) {
55963
+ return getRequestURL(url);
55964
+ }
55965
+ function urlsAreEqual(left2, right2) {
55966
+ return expandURL(left2).href == expandURL(right2).href;
55967
+ }
55968
+ function getPathComponents(url) {
55969
+ return url.pathname.split("/").slice(1);
55970
+ }
55971
+ function getLastPathComponent(url) {
55972
+ return getPathComponents(url).slice(-1)[0];
55973
+ }
55974
+ function getPrefix(url) {
55975
+ return addTrailingSlash(url.origin + url.pathname);
55976
+ }
55977
+ function addTrailingSlash(value) {
55978
+ return value.endsWith("/") ? value : value + "/";
55979
+ }
55978
55980
  function fetchWithTurboHeaders(url, options = {}) {
55979
55981
  const modifiedHeaders = new Headers(options.headers || {});
55980
55982
  const requestUID = uuid();
@@ -56047,10 +56049,10 @@
56047
56049
  }
56048
56050
  return fragment;
56049
56051
  }
56050
- function buildFormData(formElement, submitter) {
56052
+ function buildFormData(formElement, submitter2) {
56051
56053
  const formData = new FormData(formElement);
56052
- const name = submitter?.getAttribute("name");
56053
- const value = submitter?.getAttribute("value");
56054
+ const name = submitter2?.getAttribute("name");
56055
+ const value = submitter2?.getAttribute("value");
56054
56056
  if (name) {
56055
56057
  formData.append(name, value || "");
56056
56058
  }
@@ -56069,10 +56071,10 @@
56069
56071
  function responseSucceededWithoutRedirect(response) {
56070
56072
  return response.statusCode == 200 && !response.redirected;
56071
56073
  }
56072
- function getFormAction(formElement, submitter) {
56074
+ function getFormAction(formElement, submitter2) {
56073
56075
  const formElementAction = typeof formElement.action === "string" ? formElement.action : null;
56074
- if (submitter?.hasAttribute("formaction")) {
56075
- return submitter.getAttribute("formaction") || "";
56076
+ if (submitter2?.hasAttribute("formaction")) {
56077
+ return submitter2.getAttribute("formaction") || "";
56076
56078
  } else {
56077
56079
  return formElement.getAttribute("action") || formElementAction || "";
56078
56080
  }
@@ -56084,12 +56086,12 @@
56084
56086
  }
56085
56087
  return action;
56086
56088
  }
56087
- function getMethod(formElement, submitter) {
56088
- const method = submitter?.getAttribute("formmethod") || formElement.getAttribute("method") || "";
56089
+ function getMethod(formElement, submitter2) {
56090
+ const method = submitter2?.getAttribute("formmethod") || formElement.getAttribute("method") || "";
56089
56091
  return fetchMethodFromString(method.toLowerCase()) || FetchMethod.get;
56090
56092
  }
56091
- function getEnctype(formElement, submitter) {
56092
- return fetchEnctypeFromString(submitter?.getAttribute("formenctype") || formElement.enctype);
56093
+ function getEnctype(formElement, submitter2) {
56094
+ return fetchEnctypeFromString(submitter2?.getAttribute("formenctype") || formElement.enctype);
56093
56095
  }
56094
56096
  function getPermanentElementById(node, id) {
56095
56097
  return node.querySelector(`#${id}[data-turbo-permanent]`);
@@ -56097,12 +56099,12 @@
56097
56099
  function queryPermanentElementsAll(node) {
56098
56100
  return node.querySelectorAll("[id][data-turbo-permanent]");
56099
56101
  }
56100
- function submissionDoesNotDismissDialog(form, submitter) {
56101
- const method = submitter?.getAttribute("formmethod") || form.getAttribute("method");
56102
+ function submissionDoesNotDismissDialog(form, submitter2) {
56103
+ const method = submitter2?.getAttribute("formmethod") || form.getAttribute("method");
56102
56104
  return method != "dialog";
56103
56105
  }
56104
- function submissionDoesNotTargetIFrame(form, submitter) {
56105
- const target = submitter?.getAttribute("formtarget") || form.getAttribute("target");
56106
+ function submissionDoesNotTargetIFrame(form, submitter2) {
56107
+ const target = submitter2?.getAttribute("formtarget") || form.getAttribute("target");
56106
56108
  return doesNotTargetIFrame(target);
56107
56109
  }
56108
56110
  function createPlaceholderForPermanentElement(permanentElement) {
@@ -56125,6 +56127,17 @@
56125
56127
  return defaultValue;
56126
56128
  }
56127
56129
  }
56130
+ function morphElements(currentElement, newElement, { callbacks, ...options } = {}) {
56131
+ Idiomorph.morph(currentElement, newElement, {
56132
+ ...options,
56133
+ callbacks: new DefaultIdiomorphCallbacks(callbacks)
56134
+ });
56135
+ }
56136
+ function morphChildren(currentElement, newElement) {
56137
+ morphElements(currentElement, newElement.children, {
56138
+ morphStyle: "innerHTML"
56139
+ });
56140
+ }
56128
56141
  function elementType(element) {
56129
56142
  if (elementIsScript(element)) {
56130
56143
  return "script";
@@ -56228,26 +56241,9 @@
56228
56241
  const contentType = response.contentType ?? "";
56229
56242
  return contentType.startsWith(StreamMessage.contentType);
56230
56243
  }
56231
- function morphElements(currentElement, newElement, { callbacks, ...options } = {}) {
56232
- Idiomorph.morph(currentElement, newElement, {
56233
- ...options,
56234
- callbacks: new DefaultIdiomorphCallbacks(callbacks)
56235
- });
56236
- }
56237
- function morphChildren(currentElement, newElement) {
56238
- morphElements(currentElement, newElement.children, {
56239
- morphStyle: "innerHTML"
56240
- });
56241
- }
56242
56244
  function canRefreshFrame(frame) {
56243
56245
  return frame instanceof FrameElement && frame.src && frame.refresh === "morph" && !frame.closest("[data-turbo-permanent]");
56244
56246
  }
56245
- function refreshFrame(frame) {
56246
- frame.addEventListener("turbo:before-frame-render", ({ detail }) => {
56247
- detail.render = MorphingFrameRenderer.renderElement;
56248
- }, { once: true });
56249
- frame.reload();
56250
- }
56251
56247
  function extendURLWithDeprecatedProperties(url) {
56252
56248
  Object.defineProperties(url, deprecatedLocationPropertyDescriptors);
56253
56249
  }
@@ -56276,13 +56272,22 @@
56276
56272
  session.clearCache();
56277
56273
  }
56278
56274
  function setProgressBarDelay(delay) {
56279
- session.setProgressBarDelay(delay);
56275
+ console.warn(
56276
+ "Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"
56277
+ );
56278
+ config.drive.progressBarDelay = delay;
56280
56279
  }
56281
56280
  function setConfirmMethod(confirmMethod) {
56282
- FormSubmission.confirmMethod = confirmMethod;
56281
+ console.warn(
56282
+ "Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"
56283
+ );
56284
+ config.forms.confirm = confirmMethod;
56283
56285
  }
56284
56286
  function setFormMode(mode) {
56285
- session.setFormMode(mode);
56287
+ console.warn(
56288
+ "Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"
56289
+ );
56290
+ config.forms.mode = mode;
56286
56291
  }
56287
56292
  function getFrameElementById(id) {
56288
56293
  if (id != null) {
@@ -56308,29 +56313,29 @@
56308
56313
  }
56309
56314
  }
56310
56315
  }
56311
- var submittersByForm, FrameLoadingStyle, _FrameElement, FrameElement, FetchResponse, LimitedSet, recentRequests, nativeFetch, FetchMethod, FetchEnctype, FetchRequest, AppearanceObserver, StreamMessage, PREFETCH_DELAY, PrefetchCache, cacheTtl, prefetchCache, FormSubmissionState, FormSubmission, Snapshot, FormSubmitObserver, View, FrameView, LinkInterceptor, LinkClickObserver, FormLinkClickObserver, Bardo, Renderer, FrameRenderer, _ProgressBar, ProgressBar, HeadSnapshot, PageSnapshot, ViewTransitioner, defaultOptions, TimingMetric, VisitState, SystemStatusCode, Direction, Visit, BrowserAdapter, CacheObserver, FrameRedirector, History, LinkPrefetchObserver, unfetchableLink, linkToTheSamePage, linkOptsOut, nonSafeLink, isUJS, eventPrevented, Navigator, PageStage, PageObserver, ScrollObserver, StreamMessageRenderer, StreamObserver, ErrorRenderer, Idiomorph, DefaultIdiomorphCallbacks, MorphingFrameRenderer, PageRenderer, MorphingPageRenderer, SnapshotCache, PageView, Preloader, Cache, Session, deprecatedLocationPropertyDescriptors, session, cache, navigator$1, Turbo, TurboFrameMissingError, FrameController, StreamActions, StreamElement, StreamSourceElement;
56316
+ var submittersByForm, FrameLoadingStyle, _FrameElement, FrameElement, drive, submitter, Config2, forms, config, FetchResponse, LimitedSet, recentRequests, nativeFetch, FetchMethod, FetchEnctype, FetchRequest, AppearanceObserver, StreamMessage, PREFETCH_DELAY, PrefetchCache, cacheTtl, prefetchCache, FormSubmissionState, FormSubmission, Snapshot, FormSubmitObserver, View, FrameView, LinkInterceptor, LinkClickObserver, FormLinkClickObserver, Bardo, Renderer, FrameRenderer, Idiomorph, DefaultIdiomorphCallbacks, MorphingFrameRenderer, _ProgressBar, ProgressBar, HeadSnapshot, PageSnapshot, ViewTransitioner, defaultOptions, TimingMetric, VisitState, SystemStatusCode, Direction, Visit, BrowserAdapter, CacheObserver, FrameRedirector, History, LinkPrefetchObserver, unfetchableLink, linkToTheSamePage, linkOptsOut, nonSafeLink, isUJS, eventPrevented, Navigator, PageStage, PageObserver, ScrollObserver, StreamMessageRenderer, StreamObserver, ErrorRenderer, PageRenderer, MorphingPageRenderer, SnapshotCache, PageView, Preloader, Cache, Session, deprecatedLocationPropertyDescriptors, session, cache, navigator$1, Turbo, TurboFrameMissingError, FrameController, StreamActions, StreamElement, StreamSourceElement;
56312
56317
  var init_turbo_es2017_esm = __esm({
56313
56318
  "node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js"() {
56314
56319
  (function(prototype) {
56315
56320
  if (typeof prototype.requestSubmit == "function")
56316
56321
  return;
56317
- prototype.requestSubmit = function(submitter) {
56318
- if (submitter) {
56319
- validateSubmitter(submitter, this);
56320
- submitter.click();
56322
+ prototype.requestSubmit = function(submitter2) {
56323
+ if (submitter2) {
56324
+ validateSubmitter(submitter2, this);
56325
+ submitter2.click();
56321
56326
  } else {
56322
- submitter = document.createElement("input");
56323
- submitter.type = "submit";
56324
- submitter.hidden = true;
56325
- this.appendChild(submitter);
56326
- submitter.click();
56327
- this.removeChild(submitter);
56327
+ submitter2 = document.createElement("input");
56328
+ submitter2.type = "submit";
56329
+ submitter2.hidden = true;
56330
+ this.appendChild(submitter2);
56331
+ submitter2.click();
56332
+ this.removeChild(submitter2);
56328
56333
  }
56329
56334
  };
56330
- function validateSubmitter(submitter, form) {
56331
- submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'");
56332
- submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button");
56333
- submitter.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError");
56335
+ function validateSubmitter(submitter2, form) {
56336
+ submitter2 instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'");
56337
+ submitter2.type == "submit" || raise(TypeError, "The specified element is not a submit button");
56338
+ submitter2.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError");
56334
56339
  }
56335
56340
  function raise(errorConstructor, message, name) {
56336
56341
  throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".", name);
@@ -56409,6 +56414,9 @@
56409
56414
  this.removeAttribute("refresh");
56410
56415
  }
56411
56416
  }
56417
+ get shouldReloadWithMorph() {
56418
+ return this.src && this.refresh === "morph";
56419
+ }
56412
56420
  get loading() {
56413
56421
  return frameLoadingStyleFromString(this.getAttribute("loading") || "");
56414
56422
  }
@@ -56451,6 +56459,104 @@
56451
56459
  };
56452
56460
  FrameElement = _FrameElement;
56453
56461
  __publicField(FrameElement, "delegateConstructor");
56462
+ drive = {
56463
+ enabled: true,
56464
+ progressBarDelay: 500,
56465
+ unvisitableExtensions: /* @__PURE__ */ new Set(
56466
+ [
56467
+ ".7z",
56468
+ ".aac",
56469
+ ".apk",
56470
+ ".avi",
56471
+ ".bmp",
56472
+ ".bz2",
56473
+ ".css",
56474
+ ".csv",
56475
+ ".deb",
56476
+ ".dmg",
56477
+ ".doc",
56478
+ ".docx",
56479
+ ".exe",
56480
+ ".gif",
56481
+ ".gz",
56482
+ ".heic",
56483
+ ".heif",
56484
+ ".ico",
56485
+ ".iso",
56486
+ ".jpeg",
56487
+ ".jpg",
56488
+ ".js",
56489
+ ".json",
56490
+ ".m4a",
56491
+ ".mkv",
56492
+ ".mov",
56493
+ ".mp3",
56494
+ ".mp4",
56495
+ ".mpeg",
56496
+ ".mpg",
56497
+ ".msi",
56498
+ ".ogg",
56499
+ ".ogv",
56500
+ ".pdf",
56501
+ ".pkg",
56502
+ ".png",
56503
+ ".ppt",
56504
+ ".pptx",
56505
+ ".rar",
56506
+ ".rtf",
56507
+ ".svg",
56508
+ ".tar",
56509
+ ".tif",
56510
+ ".tiff",
56511
+ ".txt",
56512
+ ".wav",
56513
+ ".webm",
56514
+ ".webp",
56515
+ ".wma",
56516
+ ".wmv",
56517
+ ".xls",
56518
+ ".xlsx",
56519
+ ".xml",
56520
+ ".zip"
56521
+ ]
56522
+ )
56523
+ };
56524
+ submitter = {
56525
+ "aria-disabled": {
56526
+ beforeSubmit: (submitter2) => {
56527
+ submitter2.setAttribute("aria-disabled", "true");
56528
+ submitter2.addEventListener("click", cancelEvent);
56529
+ },
56530
+ afterSubmit: (submitter2) => {
56531
+ submitter2.removeAttribute("aria-disabled");
56532
+ submitter2.removeEventListener("click", cancelEvent);
56533
+ }
56534
+ },
56535
+ "disabled": {
56536
+ beforeSubmit: (submitter2) => submitter2.disabled = true,
56537
+ afterSubmit: (submitter2) => submitter2.disabled = false
56538
+ }
56539
+ };
56540
+ Config2 = class {
56541
+ #submitter = null;
56542
+ constructor(config2) {
56543
+ Object.assign(this, config2);
56544
+ }
56545
+ get submitter() {
56546
+ return this.#submitter;
56547
+ }
56548
+ set submitter(value) {
56549
+ this.#submitter = submitter[value] || value;
56550
+ }
56551
+ };
56552
+ forms = new Config2({
56553
+ mode: "on",
56554
+ submitter: "disabled"
56555
+ });
56556
+ config = {
56557
+ drive,
56558
+ forms
56559
+ };
56454
56560
  FetchResponse = class {
56455
56561
  constructor(response) {
56456
56562
  this.response = response;
@@ -56740,17 +56846,17 @@
56740
56846
  };
56741
56847
  FormSubmission = class {
56742
56848
  state = FormSubmissionState.initialized;
56743
- static confirmMethod(message, _element, _submitter) {
56849
+ static confirmMethod(message) {
56744
56850
  return Promise.resolve(confirm(message));
56745
56851
  }
56746
- constructor(delegate, formElement, submitter, mustRedirect = false) {
56747
- const method = getMethod(formElement, submitter);
56748
- const action = getAction(getFormAction(formElement, submitter), method);
56749
- const body = buildFormData(formElement, submitter);
56750
- const enctype = getEnctype(formElement, submitter);
56852
+ constructor(delegate, formElement, submitter2, mustRedirect = false) {
56853
+ const method = getMethod(formElement, submitter2);
56854
+ const action = getAction(getFormAction(formElement, submitter2), method);
56855
+ const body = buildFormData(formElement, submitter2);
56856
+ const enctype = getEnctype(formElement, submitter2);
56751
56857
  this.delegate = delegate;
56752
56858
  this.formElement = formElement;
56753
- this.submitter = submitter;
56859
+ this.submitter = submitter2;
56754
56860
  this.fetchRequest = new FetchRequest(this, method, action, body, formElement, enctype);
56755
56861
  this.mustRedirect = mustRedirect;
56756
56862
  }
@@ -56782,7 +56888,8 @@
56782
56888
  const { initialized, requesting } = FormSubmissionState;
56783
56889
  const confirmationMessage = getAttribute("data-turbo-confirm", this.submitter, this.formElement);
56784
56890
  if (typeof confirmationMessage === "string") {
56785
- const answer = await FormSubmission.confirmMethod(confirmationMessage, this.formElement, this.submitter);
56891
+ const confirmMethod = typeof config.forms.confirm === "function" ? config.forms.confirm : FormSubmission.confirmMethod;
56892
+ const answer = await confirmMethod(confirmationMessage, this.formElement, this.submitter);
56786
56893
  if (!answer) {
56787
56894
  return;
56788
56895
  }
@@ -56813,7 +56920,8 @@
56813
56920
  }
56814
56921
  requestStarted(_request) {
56815
56922
  this.state = FormSubmissionState.waiting;
56816
- this.submitter?.setAttribute("disabled", "");
56923
+ if (this.submitter)
56924
+ config.forms.submitter.beforeSubmit(this.submitter);
56817
56925
  this.setSubmitsWith();
56818
56926
  markAsBusy(this.formElement);
56819
56927
  dispatch("turbo:submit-start", {
@@ -56851,7 +56959,8 @@
56851
56959
  }
56852
56960
  requestFinished(_request) {
56853
56961
  this.state = FormSubmissionState.stopped;
56854
- this.submitter?.removeAttribute("disabled");
56962
+ if (this.submitter)
56963
+ config.forms.submitter.afterSubmit(this.submitter);
56855
56964
  this.resetSubmitterText();
56856
56965
  clearBusyState(this.formElement);
56857
56966
  dispatch("turbo:submit-end", {
@@ -56957,11 +57066,11 @@
56957
57066
  submitBubbled = (event) => {
56958
57067
  if (!event.defaultPrevented) {
56959
57068
  const form = event.target instanceof HTMLFormElement ? event.target : void 0;
56960
- const submitter = event.submitter || void 0;
56961
- if (form && submissionDoesNotDismissDialog(form, submitter) && submissionDoesNotTargetIFrame(form, submitter) && this.delegate.willSubmitForm(form, submitter)) {
57069
+ const submitter2 = event.submitter || void 0;
57070
+ if (form && submissionDoesNotDismissDialog(form, submitter2) && submissionDoesNotTargetIFrame(form, submitter2) && this.delegate.willSubmitForm(form, submitter2)) {
56962
57071
  event.preventDefault();
56963
57072
  event.stopImmediatePropagation();
56964
- this.delegate.formSubmitted(form, submitter);
57073
+ this.delegate.formSubmitted(form, submitter2);
56965
57074
  }
56966
57075
  }
56967
57076
  };
@@ -57249,12 +57358,14 @@
57249
57358
  };
57250
57359
  Renderer = class {
57251
57360
  #activeElement = null;
57252
- constructor(currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) {
57361
+ static renderElement(currentElement, newElement) {
57362
+ }
57363
+ constructor(currentSnapshot, newSnapshot, isPreview, willRender = true) {
57253
57364
  this.currentSnapshot = currentSnapshot;
57254
57365
  this.newSnapshot = newSnapshot;
57255
57366
  this.isPreview = isPreview;
57256
57367
  this.willRender = willRender;
57257
- this.renderElement = renderElement;
57368
+ this.renderElement = this.constructor.renderElement;
57258
57369
  this.promise = new Promise((resolve3, reject) => this.resolvingFunctions = { resolve: resolve3, reject });
57259
57370
  }
57260
57371
  get shouldRender() {
@@ -57373,6 +57484,607 @@
57373
57484
  return this.currentElement.querySelectorAll("script");
57374
57485
  }
57375
57486
  };
57487
+ Idiomorph = function() {
57488
+ let EMPTY_SET = /* @__PURE__ */ new Set();
57489
+ let defaults4 = {
57490
+ morphStyle: "outerHTML",
57491
+ callbacks: {
57492
+ beforeNodeAdded: noOp,
57493
+ afterNodeAdded: noOp,
57494
+ beforeNodeMorphed: noOp,
57495
+ afterNodeMorphed: noOp,
57496
+ beforeNodeRemoved: noOp,
57497
+ afterNodeRemoved: noOp,
57498
+ beforeAttributeUpdated: noOp
57499
+ },
57500
+ head: {
57501
+ style: "merge",
57502
+ shouldPreserve: function(elt) {
57503
+ return elt.getAttribute("im-preserve") === "true";
57504
+ },
57505
+ shouldReAppend: function(elt) {
57506
+ return elt.getAttribute("im-re-append") === "true";
57507
+ },
57508
+ shouldRemove: noOp,
57509
+ afterHeadMorphed: noOp
57510
+ }
57511
+ };
57512
+ function morph2(oldNode, newContent, config2 = {}) {
57513
+ if (oldNode instanceof Document) {
57514
+ oldNode = oldNode.documentElement;
57515
+ }
57516
+ if (typeof newContent === "string") {
57517
+ newContent = parseContent(newContent);
57518
+ }
57519
+ let normalizedContent = normalizeContent(newContent);
57520
+ let ctx = createMorphContext(oldNode, normalizedContent, config2);
57521
+ return morphNormalizedContent(oldNode, normalizedContent, ctx);
57522
+ }
57523
+ function morphNormalizedContent(oldNode, normalizedNewContent, ctx) {
57524
+ if (ctx.head.block) {
57525
+ let oldHead = oldNode.querySelector("head");
57526
+ let newHead = normalizedNewContent.querySelector("head");
57527
+ if (oldHead && newHead) {
57528
+ let promises = handleHeadElement(newHead, oldHead, ctx);
57529
+ Promise.all(promises).then(function() {
57530
+ morphNormalizedContent(oldNode, normalizedNewContent, Object.assign(ctx, {
57531
+ head: {
57532
+ block: false,
57533
+ ignore: true
57534
+ }
57535
+ }));
57536
+ });
57537
+ return;
57538
+ }
57539
+ }
57540
+ if (ctx.morphStyle === "innerHTML") {
57541
+ morphChildren2(normalizedNewContent, oldNode, ctx);
57542
+ return oldNode.children;
57543
+ } else if (ctx.morphStyle === "outerHTML" || ctx.morphStyle == null) {
57544
+ let bestMatch = findBestNodeMatch(normalizedNewContent, oldNode, ctx);
57545
+ let previousSibling = bestMatch?.previousSibling;
57546
+ let nextSibling = bestMatch?.nextSibling;
57547
+ let morphedNode = morphOldNodeTo(oldNode, bestMatch, ctx);
57548
+ if (bestMatch) {
57549
+ return insertSiblings(previousSibling, morphedNode, nextSibling);
57550
+ } else {
57551
+ return [];
57552
+ }
57553
+ } else {
57554
+ throw "Do not understand how to morph style " + ctx.morphStyle;
57555
+ }
57556
+ }
57557
+ function ignoreValueOfActiveElement(possibleActiveElement, ctx) {
57558
+ return ctx.ignoreActiveValue && possibleActiveElement === document.activeElement && possibleActiveElement !== document.body;
57559
+ }
57560
+ function morphOldNodeTo(oldNode, newContent, ctx) {
57561
+ if (ctx.ignoreActive && oldNode === document.activeElement)
57562
+ ;
57563
+ else if (newContent == null) {
57564
+ if (ctx.callbacks.beforeNodeRemoved(oldNode) === false)
57565
+ return oldNode;
57566
+ oldNode.remove();
57567
+ ctx.callbacks.afterNodeRemoved(oldNode);
57568
+ return null;
57569
+ } else if (!isSoftMatch(oldNode, newContent)) {
57570
+ if (ctx.callbacks.beforeNodeRemoved(oldNode) === false)
57571
+ return oldNode;
57572
+ if (ctx.callbacks.beforeNodeAdded(newContent) === false)
57573
+ return oldNode;
57574
+ oldNode.parentElement.replaceChild(newContent, oldNode);
57575
+ ctx.callbacks.afterNodeAdded(newContent);
57576
+ ctx.callbacks.afterNodeRemoved(oldNode);
57577
+ return newContent;
57578
+ } else {
57579
+ if (ctx.callbacks.beforeNodeMorphed(oldNode, newContent) === false)
57580
+ return oldNode;
57581
+ if (oldNode instanceof HTMLHeadElement && ctx.head.ignore)
57582
+ ;
57583
+ else if (oldNode instanceof HTMLHeadElement && ctx.head.style !== "morph") {
57584
+ handleHeadElement(newContent, oldNode, ctx);
57585
+ } else {
57586
+ syncNodeFrom(newContent, oldNode, ctx);
57587
+ if (!ignoreValueOfActiveElement(oldNode, ctx)) {
57588
+ morphChildren2(newContent, oldNode, ctx);
57589
+ }
57590
+ }
57591
+ ctx.callbacks.afterNodeMorphed(oldNode, newContent);
57592
+ return oldNode;
57593
+ }
57594
+ }
57595
+ function morphChildren2(newParent, oldParent, ctx) {
57596
+ let nextNewChild = newParent.firstChild;
57597
+ let insertionPoint = oldParent.firstChild;
57598
+ let newChild;
57599
+ while (nextNewChild) {
57600
+ newChild = nextNewChild;
57601
+ nextNewChild = newChild.nextSibling;
57602
+ if (insertionPoint == null) {
57603
+ if (ctx.callbacks.beforeNodeAdded(newChild) === false)
57604
+ return;
57605
+ oldParent.appendChild(newChild);
57606
+ ctx.callbacks.afterNodeAdded(newChild);
57607
+ removeIdsFromConsideration(ctx, newChild);
57608
+ continue;
57609
+ }
57610
+ if (isIdSetMatch(newChild, insertionPoint, ctx)) {
57611
+ morphOldNodeTo(insertionPoint, newChild, ctx);
57612
+ insertionPoint = insertionPoint.nextSibling;
57613
+ removeIdsFromConsideration(ctx, newChild);
57614
+ continue;
57615
+ }
57616
+ let idSetMatch = findIdSetMatch(newParent, oldParent, newChild, insertionPoint, ctx);
57617
+ if (idSetMatch) {
57618
+ insertionPoint = removeNodesBetween(insertionPoint, idSetMatch, ctx);
57619
+ morphOldNodeTo(idSetMatch, newChild, ctx);
57620
+ removeIdsFromConsideration(ctx, newChild);
57621
+ continue;
57622
+ }
57623
+ let softMatch = findSoftMatch(newParent, oldParent, newChild, insertionPoint, ctx);
57624
+ if (softMatch) {
57625
+ insertionPoint = removeNodesBetween(insertionPoint, softMatch, ctx);
57626
+ morphOldNodeTo(softMatch, newChild, ctx);
57627
+ removeIdsFromConsideration(ctx, newChild);
57628
+ continue;
57629
+ }
57630
+ if (ctx.callbacks.beforeNodeAdded(newChild) === false)
57631
+ return;
57632
+ oldParent.insertBefore(newChild, insertionPoint);
57633
+ ctx.callbacks.afterNodeAdded(newChild);
57634
+ removeIdsFromConsideration(ctx, newChild);
57635
+ }
57636
+ while (insertionPoint !== null) {
57637
+ let tempNode = insertionPoint;
57638
+ insertionPoint = insertionPoint.nextSibling;
57639
+ removeNode(tempNode, ctx);
57640
+ }
57641
+ }
57642
+ function ignoreAttribute(attr, to, updateType, ctx) {
57643
+ if (attr === "value" && ctx.ignoreActiveValue && to === document.activeElement) {
57644
+ return true;
57645
+ }
57646
+ return ctx.callbacks.beforeAttributeUpdated(attr, to, updateType) === false;
57647
+ }
57648
+ function syncNodeFrom(from, to, ctx) {
57649
+ let type = from.nodeType;
57650
+ if (type === 1) {
57651
+ const fromAttributes = from.attributes;
57652
+ const toAttributes = to.attributes;
57653
+ for (const fromAttribute of fromAttributes) {
57654
+ if (ignoreAttribute(fromAttribute.name, to, "update", ctx)) {
57655
+ continue;
57656
+ }
57657
+ if (to.getAttribute(fromAttribute.name) !== fromAttribute.value) {
57658
+ to.setAttribute(fromAttribute.name, fromAttribute.value);
57659
+ }
57660
+ }
57661
+ for (let i5 = toAttributes.length - 1; 0 <= i5; i5--) {
57662
+ const toAttribute = toAttributes[i5];
57663
+ if (ignoreAttribute(toAttribute.name, to, "remove", ctx)) {
57664
+ continue;
57665
+ }
57666
+ if (!from.hasAttribute(toAttribute.name)) {
57667
+ to.removeAttribute(toAttribute.name);
57668
+ }
57669
+ }
57670
+ }
57671
+ if (type === 8 || type === 3) {
57672
+ if (to.nodeValue !== from.nodeValue) {
57673
+ to.nodeValue = from.nodeValue;
57674
+ }
57675
+ }
57676
+ if (!ignoreValueOfActiveElement(to, ctx)) {
57677
+ syncInputValue(from, to, ctx);
57678
+ }
57679
+ }
57680
+ function syncBooleanAttribute(from, to, attributeName, ctx) {
57681
+ if (from[attributeName] !== to[attributeName]) {
57682
+ let ignoreUpdate = ignoreAttribute(attributeName, to, "update", ctx);
57683
+ if (!ignoreUpdate) {
57684
+ to[attributeName] = from[attributeName];
57685
+ }
57686
+ if (from[attributeName]) {
57687
+ if (!ignoreUpdate) {
57688
+ to.setAttribute(attributeName, from[attributeName]);
57689
+ }
57690
+ } else {
57691
+ if (!ignoreAttribute(attributeName, to, "remove", ctx)) {
57692
+ to.removeAttribute(attributeName);
57693
+ }
57694
+ }
57695
+ }
57696
+ }
57697
+ function syncInputValue(from, to, ctx) {
57698
+ if (from instanceof HTMLInputElement && to instanceof HTMLInputElement && from.type !== "file") {
57699
+ let fromValue = from.value;
57700
+ let toValue = to.value;
57701
+ syncBooleanAttribute(from, to, "checked", ctx);
57702
+ syncBooleanAttribute(from, to, "disabled", ctx);
57703
+ if (!from.hasAttribute("value")) {
57704
+ if (!ignoreAttribute("value", to, "remove", ctx)) {
57705
+ to.value = "";
57706
+ to.removeAttribute("value");
57707
+ }
57708
+ } else if (fromValue !== toValue) {
57709
+ if (!ignoreAttribute("value", to, "update", ctx)) {
57710
+ to.setAttribute("value", fromValue);
57711
+ to.value = fromValue;
57712
+ }
57713
+ }
57714
+ } else if (from instanceof HTMLOptionElement) {
57715
+ syncBooleanAttribute(from, to, "selected", ctx);
57716
+ } else if (from instanceof HTMLTextAreaElement && to instanceof HTMLTextAreaElement) {
57717
+ let fromValue = from.value;
57718
+ let toValue = to.value;
57719
+ if (ignoreAttribute("value", to, "update", ctx)) {
57720
+ return;
57721
+ }
57722
+ if (fromValue !== toValue) {
57723
+ to.value = fromValue;
57724
+ }
57725
+ if (to.firstChild && to.firstChild.nodeValue !== fromValue) {
57726
+ to.firstChild.nodeValue = fromValue;
57727
+ }
57728
+ }
57729
+ }
57730
+ function handleHeadElement(newHeadTag, currentHead, ctx) {
57731
+ let added = [];
57732
+ let removed = [];
57733
+ let preserved = [];
57734
+ let nodesToAppend = [];
57735
+ let headMergeStyle = ctx.head.style;
57736
+ let srcToNewHeadNodes = /* @__PURE__ */ new Map();
57737
+ for (const newHeadChild of newHeadTag.children) {
57738
+ srcToNewHeadNodes.set(newHeadChild.outerHTML, newHeadChild);
57739
+ }
57740
+ for (const currentHeadElt of currentHead.children) {
57741
+ let inNewContent = srcToNewHeadNodes.has(currentHeadElt.outerHTML);
57742
+ let isReAppended = ctx.head.shouldReAppend(currentHeadElt);
57743
+ let isPreserved = ctx.head.shouldPreserve(currentHeadElt);
57744
+ if (inNewContent || isPreserved) {
57745
+ if (isReAppended) {
57746
+ removed.push(currentHeadElt);
57747
+ } else {
57748
+ srcToNewHeadNodes.delete(currentHeadElt.outerHTML);
57749
+ preserved.push(currentHeadElt);
57750
+ }
57751
+ } else {
57752
+ if (headMergeStyle === "append") {
57753
+ if (isReAppended) {
57754
+ removed.push(currentHeadElt);
57755
+ nodesToAppend.push(currentHeadElt);
57756
+ }
57757
+ } else {
57758
+ if (ctx.head.shouldRemove(currentHeadElt) !== false) {
57759
+ removed.push(currentHeadElt);
57760
+ }
57761
+ }
57762
+ }
57763
+ }
57764
+ nodesToAppend.push(...srcToNewHeadNodes.values());
57765
+ let promises = [];
57766
+ for (const newNode of nodesToAppend) {
57767
+ let newElt = document.createRange().createContextualFragment(newNode.outerHTML).firstChild;
57768
+ if (ctx.callbacks.beforeNodeAdded(newElt) !== false) {
57769
+ if (newElt.href || newElt.src) {
57770
+ let resolve3 = null;
57771
+ let promise = new Promise(function(_resolve2) {
57772
+ resolve3 = _resolve2;
57773
+ });
57774
+ newElt.addEventListener("load", function() {
57775
+ resolve3();
57776
+ });
57777
+ promises.push(promise);
57778
+ }
57779
+ currentHead.appendChild(newElt);
57780
+ ctx.callbacks.afterNodeAdded(newElt);
57781
+ added.push(newElt);
57782
+ }
57783
+ }
57784
+ for (const removedElement of removed) {
57785
+ if (ctx.callbacks.beforeNodeRemoved(removedElement) !== false) {
57786
+ currentHead.removeChild(removedElement);
57787
+ ctx.callbacks.afterNodeRemoved(removedElement);
57788
+ }
57789
+ }
57790
+ ctx.head.afterHeadMorphed(currentHead, { added, kept: preserved, removed });
57791
+ return promises;
57792
+ }
57793
+ function noOp() {
57794
+ }
57795
+ function mergeDefaults(config2) {
57796
+ let finalConfig = {};
57797
+ Object.assign(finalConfig, defaults4);
57798
+ Object.assign(finalConfig, config2);
57799
+ finalConfig.callbacks = {};
57800
+ Object.assign(finalConfig.callbacks, defaults4.callbacks);
57801
+ Object.assign(finalConfig.callbacks, config2.callbacks);
57802
+ finalConfig.head = {};
57803
+ Object.assign(finalConfig.head, defaults4.head);
57804
+ Object.assign(finalConfig.head, config2.head);
57805
+ return finalConfig;
57806
+ }
57807
+ function createMorphContext(oldNode, newContent, config2) {
57808
+ config2 = mergeDefaults(config2);
57809
+ return {
57810
+ target: oldNode,
57811
+ newContent,
57812
+ config: config2,
57813
+ morphStyle: config2.morphStyle,
57814
+ ignoreActive: config2.ignoreActive,
57815
+ ignoreActiveValue: config2.ignoreActiveValue,
57816
+ idMap: createIdMap(oldNode, newContent),
57817
+ deadIds: /* @__PURE__ */ new Set(),
57818
+ callbacks: config2.callbacks,
57819
+ head: config2.head
57820
+ };
57821
+ }
57822
+ function isIdSetMatch(node1, node2, ctx) {
57823
+ if (node1 == null || node2 == null) {
57824
+ return false;
57825
+ }
57826
+ if (node1.nodeType === node2.nodeType && node1.tagName === node2.tagName) {
57827
+ if (node1.id !== "" && node1.id === node2.id) {
57828
+ return true;
57829
+ } else {
57830
+ return getIdIntersectionCount(ctx, node1, node2) > 0;
57831
+ }
57832
+ }
57833
+ return false;
57834
+ }
57835
+ function isSoftMatch(node1, node2) {
57836
+ if (node1 == null || node2 == null) {
57837
+ return false;
57838
+ }
57839
+ return node1.nodeType === node2.nodeType && node1.tagName === node2.tagName;
57840
+ }
57841
+ function removeNodesBetween(startInclusive, endExclusive, ctx) {
57842
+ while (startInclusive !== endExclusive) {
57843
+ let tempNode = startInclusive;
57844
+ startInclusive = startInclusive.nextSibling;
57845
+ removeNode(tempNode, ctx);
57846
+ }
57847
+ removeIdsFromConsideration(ctx, endExclusive);
57848
+ return endExclusive.nextSibling;
57849
+ }
57850
+ function findIdSetMatch(newContent, oldParent, newChild, insertionPoint, ctx) {
57851
+ let newChildPotentialIdCount = getIdIntersectionCount(ctx, newChild, oldParent);
57852
+ let potentialMatch = null;
57853
+ if (newChildPotentialIdCount > 0) {
57854
+ let potentialMatch2 = insertionPoint;
57855
+ let otherMatchCount = 0;
57856
+ while (potentialMatch2 != null) {
57857
+ if (isIdSetMatch(newChild, potentialMatch2, ctx)) {
57858
+ return potentialMatch2;
57859
+ }
57860
+ otherMatchCount += getIdIntersectionCount(ctx, potentialMatch2, newContent);
57861
+ if (otherMatchCount > newChildPotentialIdCount) {
57862
+ return null;
57863
+ }
57864
+ potentialMatch2 = potentialMatch2.nextSibling;
57865
+ }
57866
+ }
57867
+ return potentialMatch;
57868
+ }
57869
+ function findSoftMatch(newContent, oldParent, newChild, insertionPoint, ctx) {
57870
+ let potentialSoftMatch = insertionPoint;
57871
+ let nextSibling = newChild.nextSibling;
57872
+ let siblingSoftMatchCount = 0;
57873
+ while (potentialSoftMatch != null) {
57874
+ if (getIdIntersectionCount(ctx, potentialSoftMatch, newContent) > 0) {
57875
+ return null;
57876
+ }
57877
+ if (isSoftMatch(newChild, potentialSoftMatch)) {
57878
+ return potentialSoftMatch;
57879
+ }
57880
+ if (isSoftMatch(nextSibling, potentialSoftMatch)) {
57881
+ siblingSoftMatchCount++;
57882
+ nextSibling = nextSibling.nextSibling;
57883
+ if (siblingSoftMatchCount >= 2) {
57884
+ return null;
57885
+ }
57886
+ }
57887
+ potentialSoftMatch = potentialSoftMatch.nextSibling;
57888
+ }
57889
+ return potentialSoftMatch;
57890
+ }
57891
+ function parseContent(newContent) {
57892
+ let parser = new DOMParser();
57893
+ let contentWithSvgsRemoved = newContent.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim, "");
57894
+ if (contentWithSvgsRemoved.match(/<\/html>/) || contentWithSvgsRemoved.match(/<\/head>/) || contentWithSvgsRemoved.match(/<\/body>/)) {
57895
+ let content = parser.parseFromString(newContent, "text/html");
57896
+ if (contentWithSvgsRemoved.match(/<\/html>/)) {
57897
+ content.generatedByIdiomorph = true;
57898
+ return content;
57899
+ } else {
57900
+ let htmlElement = content.firstChild;
57901
+ if (htmlElement) {
57902
+ htmlElement.generatedByIdiomorph = true;
57903
+ return htmlElement;
57904
+ } else {
57905
+ return null;
57906
+ }
57907
+ }
57908
+ } else {
57909
+ let responseDoc = parser.parseFromString("<body><template>" + newContent + "</template></body>", "text/html");
57910
+ let content = responseDoc.body.querySelector("template").content;
57911
+ content.generatedByIdiomorph = true;
57912
+ return content;
57913
+ }
57914
+ }
57915
+ function normalizeContent(newContent) {
57916
+ if (newContent == null) {
57917
+ const dummyParent = document.createElement("div");
57918
+ return dummyParent;
57919
+ } else if (newContent.generatedByIdiomorph) {
57920
+ return newContent;
57921
+ } else if (newContent instanceof Node) {
57922
+ const dummyParent = document.createElement("div");
57923
+ dummyParent.append(newContent);
57924
+ return dummyParent;
57925
+ } else {
57926
+ const dummyParent = document.createElement("div");
57927
+ for (const elt of [...newContent]) {
57928
+ dummyParent.append(elt);
57929
+ }
57930
+ return dummyParent;
57931
+ }
57932
+ }
57933
+ function insertSiblings(previousSibling, morphedNode, nextSibling) {
57934
+ let stack = [];
57935
+ let added = [];
57936
+ while (previousSibling != null) {
57937
+ stack.push(previousSibling);
57938
+ previousSibling = previousSibling.previousSibling;
57939
+ }
57940
+ while (stack.length > 0) {
57941
+ let node = stack.pop();
57942
+ added.push(node);
57943
+ morphedNode.parentElement.insertBefore(node, morphedNode);
57944
+ }
57945
+ added.push(morphedNode);
57946
+ while (nextSibling != null) {
57947
+ stack.push(nextSibling);
57948
+ added.push(nextSibling);
57949
+ nextSibling = nextSibling.nextSibling;
57950
+ }
57951
+ while (stack.length > 0) {
57952
+ morphedNode.parentElement.insertBefore(stack.pop(), morphedNode.nextSibling);
57953
+ }
57954
+ return added;
57955
+ }
57956
+ function findBestNodeMatch(newContent, oldNode, ctx) {
57957
+ let currentElement;
57958
+ currentElement = newContent.firstChild;
57959
+ let bestElement = currentElement;
57960
+ let score = 0;
57961
+ while (currentElement) {
57962
+ let newScore = scoreElement(currentElement, oldNode, ctx);
57963
+ if (newScore > score) {
57964
+ bestElement = currentElement;
57965
+ score = newScore;
57966
+ }
57967
+ currentElement = currentElement.nextSibling;
57968
+ }
57969
+ return bestElement;
57970
+ }
57971
+ function scoreElement(node1, node2, ctx) {
57972
+ if (isSoftMatch(node1, node2)) {
57973
+ return 0.5 + getIdIntersectionCount(ctx, node1, node2);
57974
+ }
57975
+ return 0;
57976
+ }
57977
+ function removeNode(tempNode, ctx) {
57978
+ removeIdsFromConsideration(ctx, tempNode);
57979
+ if (ctx.callbacks.beforeNodeRemoved(tempNode) === false)
57980
+ return;
57981
+ tempNode.remove();
57982
+ ctx.callbacks.afterNodeRemoved(tempNode);
57983
+ }
57984
+ function isIdInConsideration(ctx, id) {
57985
+ return !ctx.deadIds.has(id);
57986
+ }
57987
+ function idIsWithinNode(ctx, id, targetNode) {
57988
+ let idSet = ctx.idMap.get(targetNode) || EMPTY_SET;
57989
+ return idSet.has(id);
57990
+ }
57991
+ function removeIdsFromConsideration(ctx, node) {
57992
+ let idSet = ctx.idMap.get(node) || EMPTY_SET;
57993
+ for (const id of idSet) {
57994
+ ctx.deadIds.add(id);
57995
+ }
57996
+ }
57997
+ function getIdIntersectionCount(ctx, node1, node2) {
57998
+ let sourceSet = ctx.idMap.get(node1) || EMPTY_SET;
57999
+ let matchCount = 0;
58000
+ for (const id of sourceSet) {
58001
+ if (isIdInConsideration(ctx, id) && idIsWithinNode(ctx, id, node2)) {
58002
+ ++matchCount;
58003
+ }
58004
+ }
58005
+ return matchCount;
58006
+ }
58007
+ function populateIdMapForNode(node, idMap) {
58008
+ let nodeParent = node.parentElement;
58009
+ let idElements = node.querySelectorAll("[id]");
58010
+ for (const elt of idElements) {
58011
+ let current = elt;
58012
+ while (current !== nodeParent && current != null) {
58013
+ let idSet = idMap.get(current);
58014
+ if (idSet == null) {
58015
+ idSet = /* @__PURE__ */ new Set();
58016
+ idMap.set(current, idSet);
58017
+ }
58018
+ idSet.add(elt.id);
58019
+ current = current.parentElement;
58020
+ }
58021
+ }
58022
+ }
58023
+ function createIdMap(oldContent, newContent) {
58024
+ let idMap = /* @__PURE__ */ new Map();
58025
+ populateIdMapForNode(oldContent, idMap);
58026
+ populateIdMapForNode(newContent, idMap);
58027
+ return idMap;
58028
+ }
58029
+ return {
58030
+ morph: morph2,
58031
+ defaults: defaults4
58032
+ };
58033
+ }();
58034
+ DefaultIdiomorphCallbacks = class {
58035
+ #beforeNodeMorphed;
58036
+ constructor({ beforeNodeMorphed } = {}) {
58037
+ this.#beforeNodeMorphed = beforeNodeMorphed || (() => true);
58038
+ }
58039
+ beforeNodeAdded = (node) => {
58040
+ return !(node.id && node.hasAttribute("data-turbo-permanent") && document.getElementById(node.id));
58041
+ };
58042
+ beforeNodeMorphed = (currentElement, newElement) => {
58043
+ if (currentElement instanceof Element) {
58044
+ if (!currentElement.hasAttribute("data-turbo-permanent") && this.#beforeNodeMorphed(currentElement, newElement)) {
58045
+ const event = dispatch("turbo:before-morph-element", {
58046
+ cancelable: true,
58047
+ target: currentElement,
58048
+ detail: { currentElement, newElement }
58049
+ });
58050
+ return !event.defaultPrevented;
58051
+ } else {
58052
+ return false;
58053
+ }
58054
+ }
58055
+ };
58056
+ beforeAttributeUpdated = (attributeName, target, mutationType) => {
58057
+ const event = dispatch("turbo:before-morph-attribute", {
58058
+ cancelable: true,
58059
+ target,
58060
+ detail: { attributeName, mutationType }
58061
+ });
58062
+ return !event.defaultPrevented;
58063
+ };
58064
+ beforeNodeRemoved = (node) => {
58065
+ return this.beforeNodeMorphed(node);
58066
+ };
58067
+ afterNodeMorphed = (currentElement, newElement) => {
58068
+ if (currentElement instanceof Element) {
58069
+ dispatch("turbo:morph-element", {
58070
+ target: currentElement,
58071
+ detail: { currentElement, newElement }
58072
+ });
58073
+ }
58074
+ };
58075
+ };
58076
+ MorphingFrameRenderer = class extends FrameRenderer {
58077
+ static renderElement(currentElement, newElement) {
58078
+ dispatch("turbo:before-frame-morph", {
58079
+ target: currentElement,
58080
+ detail: { currentElement, newElement }
58081
+ });
58082
+ morphChildren(currentElement, newElement);
58083
+ }
58084
+ async preservingPermanentElements(callback2) {
58085
+ return await callback2();
58086
+ }
58087
+ };
57376
58088
  _ProgressBar = class {
57377
58089
  static get defaultCSS() {
57378
58090
  return unindent`
@@ -57971,7 +58683,9 @@
57971
58683
  }
57972
58684
  async render(callback2) {
57973
58685
  this.cancelRender();
57974
- this.frame = await nextRepaint();
58686
+ await new Promise((resolve3) => {
58687
+ this.frame = document.visibilityState === "hidden" ? setTimeout(() => resolve3(), 0) : requestAnimationFrame(() => resolve3());
58688
+ });
57975
58689
  await callback2();
57976
58690
  delete this.frame;
57977
58691
  }
@@ -58146,32 +58860,32 @@
58146
58860
  frame.delegate.linkClickIntercepted(element, url, event);
58147
58861
  }
58148
58862
  }
58149
- willSubmitForm(element, submitter) {
58150
- return element.closest("turbo-frame") == null && this.#shouldSubmit(element, submitter) && this.#shouldRedirect(element, submitter);
58863
+ willSubmitForm(element, submitter2) {
58864
+ return element.closest("turbo-frame") == null && this.#shouldSubmit(element, submitter2) && this.#shouldRedirect(element, submitter2);
58151
58865
  }
58152
- formSubmitted(element, submitter) {
58153
- const frame = this.#findFrameElement(element, submitter);
58866
+ formSubmitted(element, submitter2) {
58867
+ const frame = this.#findFrameElement(element, submitter2);
58154
58868
  if (frame) {
58155
- frame.delegate.formSubmitted(element, submitter);
58869
+ frame.delegate.formSubmitted(element, submitter2);
58156
58870
  }
58157
58871
  }
58158
- #shouldSubmit(form, submitter) {
58159
- const action = getAction$1(form, submitter);
58872
+ #shouldSubmit(form, submitter2) {
58873
+ const action = getAction$1(form, submitter2);
58160
58874
  const meta = this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`);
58161
58875
  const rootLocation = expandURL(meta?.content ?? "/");
58162
- return this.#shouldRedirect(form, submitter) && locationIsVisitable(action, rootLocation);
58876
+ return this.#shouldRedirect(form, submitter2) && locationIsVisitable(action, rootLocation);
58163
58877
  }
58164
- #shouldRedirect(element, submitter) {
58165
- const isNavigatable = element instanceof HTMLFormElement ? this.session.submissionIsNavigatable(element, submitter) : this.session.elementIsNavigatable(element);
58878
+ #shouldRedirect(element, submitter2) {
58879
+ const isNavigatable = element instanceof HTMLFormElement ? this.session.submissionIsNavigatable(element, submitter2) : this.session.elementIsNavigatable(element);
58166
58880
  if (isNavigatable) {
58167
- const frame = this.#findFrameElement(element, submitter);
58881
+ const frame = this.#findFrameElement(element, submitter2);
58168
58882
  return frame ? frame != element.closest("turbo-frame") : false;
58169
58883
  } else {
58170
58884
  return false;
58171
58885
  }
58172
58886
  }
58173
- #findFrameElement(element, submitter) {
58174
- const id = submitter?.getAttribute("data-turbo-frame") || element.getAttribute("data-turbo-frame");
58887
+ #findFrameElement(element, submitter2) {
58888
+ const id = submitter2?.getAttribute("data-turbo-frame") || element.getAttribute("data-turbo-frame");
58175
58889
  if (id && id != "_top") {
58176
58890
  const frame = this.element.querySelector(`#${id}:not([disabled])`);
58177
58891
  if (frame instanceof FrameElement) {
@@ -58440,9 +59154,9 @@
58440
59154
  });
58441
59155
  this.currentVisit.start();
58442
59156
  }
58443
- submitForm(form, submitter) {
59157
+ submitForm(form, submitter2) {
58444
59158
  this.stop();
58445
- this.formSubmission = new FormSubmission(this, form, submitter, true);
59159
+ this.formSubmission = new FormSubmission(this, form, submitter2, true);
58446
59160
  this.formSubmission.start();
58447
59161
  }
58448
59162
  stop() {
@@ -58537,8 +59251,8 @@
58537
59251
  return this.history.restorationIdentifier;
58538
59252
  }
58539
59253
  #getActionForFormSubmission(formSubmission, fetchResponse) {
58540
- const { submitter, formElement } = formSubmission;
58541
- return getVisitAction(submitter, formElement) || this.#getDefaultAction(fetchResponse);
59254
+ const { submitter: submitter2, formElement } = formSubmission;
59255
+ return getVisitAction(submitter2, formElement) || this.#getDefaultAction(fetchResponse);
58542
59256
  }
58543
59257
  #getDefaultAction(fetchResponse) {
58544
59258
  const sameLocationRedirect = fetchResponse.redirected && fetchResponse.location.href === this.location?.href;
@@ -58728,604 +59442,6 @@
58728
59442
  return document.documentElement.querySelectorAll("script");
58729
59443
  }
58730
59444
  };
58731
- Idiomorph = function() {
58732
- let EMPTY_SET = /* @__PURE__ */ new Set();
58733
- let defaults4 = {
58734
- morphStyle: "outerHTML",
58735
- callbacks: {
58736
- beforeNodeAdded: noOp,
58737
- afterNodeAdded: noOp,
58738
- beforeNodeMorphed: noOp,
58739
- afterNodeMorphed: noOp,
58740
- beforeNodeRemoved: noOp,
58741
- afterNodeRemoved: noOp,
58742
- beforeAttributeUpdated: noOp
58743
- },
58744
- head: {
58745
- style: "merge",
58746
- shouldPreserve: function(elt) {
58747
- return elt.getAttribute("im-preserve") === "true";
58748
- },
58749
- shouldReAppend: function(elt) {
58750
- return elt.getAttribute("im-re-append") === "true";
58751
- },
58752
- shouldRemove: noOp,
58753
- afterHeadMorphed: noOp
58754
- }
58755
- };
58756
- function morph2(oldNode, newContent, config = {}) {
58757
- if (oldNode instanceof Document) {
58758
- oldNode = oldNode.documentElement;
58759
- }
58760
- if (typeof newContent === "string") {
58761
- newContent = parseContent(newContent);
58762
- }
58763
- let normalizedContent = normalizeContent(newContent);
58764
- let ctx = createMorphContext(oldNode, normalizedContent, config);
58765
- return morphNormalizedContent(oldNode, normalizedContent, ctx);
58766
- }
58767
- function morphNormalizedContent(oldNode, normalizedNewContent, ctx) {
58768
- if (ctx.head.block) {
58769
- let oldHead = oldNode.querySelector("head");
58770
- let newHead = normalizedNewContent.querySelector("head");
58771
- if (oldHead && newHead) {
58772
- let promises = handleHeadElement(newHead, oldHead, ctx);
58773
- Promise.all(promises).then(function() {
58774
- morphNormalizedContent(oldNode, normalizedNewContent, Object.assign(ctx, {
58775
- head: {
58776
- block: false,
58777
- ignore: true
58778
- }
58779
- }));
58780
- });
58781
- return;
58782
- }
58783
- }
58784
- if (ctx.morphStyle === "innerHTML") {
58785
- morphChildren2(normalizedNewContent, oldNode, ctx);
58786
- return oldNode.children;
58787
- } else if (ctx.morphStyle === "outerHTML" || ctx.morphStyle == null) {
58788
- let bestMatch = findBestNodeMatch(normalizedNewContent, oldNode, ctx);
58789
- let previousSibling = bestMatch?.previousSibling;
58790
- let nextSibling = bestMatch?.nextSibling;
58791
- let morphedNode = morphOldNodeTo(oldNode, bestMatch, ctx);
58792
- if (bestMatch) {
58793
- return insertSiblings(previousSibling, morphedNode, nextSibling);
58794
- } else {
58795
- return [];
58796
- }
58797
- } else {
58798
- throw "Do not understand how to morph style " + ctx.morphStyle;
58799
- }
58800
- }
58801
- function ignoreValueOfActiveElement(possibleActiveElement, ctx) {
58802
- return ctx.ignoreActiveValue && possibleActiveElement === document.activeElement && possibleActiveElement !== document.body;
58803
- }
58804
- function morphOldNodeTo(oldNode, newContent, ctx) {
58805
- if (ctx.ignoreActive && oldNode === document.activeElement)
58806
- ;
58807
- else if (newContent == null) {
58808
- if (ctx.callbacks.beforeNodeRemoved(oldNode) === false)
58809
- return oldNode;
58810
- oldNode.remove();
58811
- ctx.callbacks.afterNodeRemoved(oldNode);
58812
- return null;
58813
- } else if (!isSoftMatch(oldNode, newContent)) {
58814
- if (ctx.callbacks.beforeNodeRemoved(oldNode) === false)
58815
- return oldNode;
58816
- if (ctx.callbacks.beforeNodeAdded(newContent) === false)
58817
- return oldNode;
58818
- oldNode.parentElement.replaceChild(newContent, oldNode);
58819
- ctx.callbacks.afterNodeAdded(newContent);
58820
- ctx.callbacks.afterNodeRemoved(oldNode);
58821
- return newContent;
58822
- } else {
58823
- if (ctx.callbacks.beforeNodeMorphed(oldNode, newContent) === false)
58824
- return oldNode;
58825
- if (oldNode instanceof HTMLHeadElement && ctx.head.ignore)
58826
- ;
58827
- else if (oldNode instanceof HTMLHeadElement && ctx.head.style !== "morph") {
58828
- handleHeadElement(newContent, oldNode, ctx);
58829
- } else {
58830
- syncNodeFrom(newContent, oldNode, ctx);
58831
- if (!ignoreValueOfActiveElement(oldNode, ctx)) {
58832
- morphChildren2(newContent, oldNode, ctx);
58833
- }
58834
- }
58835
- ctx.callbacks.afterNodeMorphed(oldNode, newContent);
58836
- return oldNode;
58837
- }
58838
- }
58839
- function morphChildren2(newParent, oldParent, ctx) {
58840
- let nextNewChild = newParent.firstChild;
58841
- let insertionPoint = oldParent.firstChild;
58842
- let newChild;
58843
- while (nextNewChild) {
58844
- newChild = nextNewChild;
58845
- nextNewChild = newChild.nextSibling;
58846
- if (insertionPoint == null) {
58847
- if (ctx.callbacks.beforeNodeAdded(newChild) === false)
58848
- return;
58849
- oldParent.appendChild(newChild);
58850
- ctx.callbacks.afterNodeAdded(newChild);
58851
- removeIdsFromConsideration(ctx, newChild);
58852
- continue;
58853
- }
58854
- if (isIdSetMatch(newChild, insertionPoint, ctx)) {
58855
- morphOldNodeTo(insertionPoint, newChild, ctx);
58856
- insertionPoint = insertionPoint.nextSibling;
58857
- removeIdsFromConsideration(ctx, newChild);
58858
- continue;
58859
- }
58860
- let idSetMatch = findIdSetMatch(newParent, oldParent, newChild, insertionPoint, ctx);
58861
- if (idSetMatch) {
58862
- insertionPoint = removeNodesBetween(insertionPoint, idSetMatch, ctx);
58863
- morphOldNodeTo(idSetMatch, newChild, ctx);
58864
- removeIdsFromConsideration(ctx, newChild);
58865
- continue;
58866
- }
58867
- let softMatch = findSoftMatch(newParent, oldParent, newChild, insertionPoint, ctx);
58868
- if (softMatch) {
58869
- insertionPoint = removeNodesBetween(insertionPoint, softMatch, ctx);
58870
- morphOldNodeTo(softMatch, newChild, ctx);
58871
- removeIdsFromConsideration(ctx, newChild);
58872
- continue;
58873
- }
58874
- if (ctx.callbacks.beforeNodeAdded(newChild) === false)
58875
- return;
58876
- oldParent.insertBefore(newChild, insertionPoint);
58877
- ctx.callbacks.afterNodeAdded(newChild);
58878
- removeIdsFromConsideration(ctx, newChild);
58879
- }
58880
- while (insertionPoint !== null) {
58881
- let tempNode = insertionPoint;
58882
- insertionPoint = insertionPoint.nextSibling;
58883
- removeNode(tempNode, ctx);
58884
- }
58885
- }
58886
- function ignoreAttribute(attr, to, updateType, ctx) {
58887
- if (attr === "value" && ctx.ignoreActiveValue && to === document.activeElement) {
58888
- return true;
58889
- }
58890
- return ctx.callbacks.beforeAttributeUpdated(attr, to, updateType) === false;
58891
- }
58892
- function syncNodeFrom(from, to, ctx) {
58893
- let type = from.nodeType;
58894
- if (type === 1) {
58895
- const fromAttributes = from.attributes;
58896
- const toAttributes = to.attributes;
58897
- for (const fromAttribute of fromAttributes) {
58898
- if (ignoreAttribute(fromAttribute.name, to, "update", ctx)) {
58899
- continue;
58900
- }
58901
- if (to.getAttribute(fromAttribute.name) !== fromAttribute.value) {
58902
- to.setAttribute(fromAttribute.name, fromAttribute.value);
58903
- }
58904
- }
58905
- for (let i5 = toAttributes.length - 1; 0 <= i5; i5--) {
58906
- const toAttribute = toAttributes[i5];
58907
- if (ignoreAttribute(toAttribute.name, to, "remove", ctx)) {
58908
- continue;
58909
- }
58910
- if (!from.hasAttribute(toAttribute.name)) {
58911
- to.removeAttribute(toAttribute.name);
58912
- }
58913
- }
58914
- }
58915
- if (type === 8 || type === 3) {
58916
- if (to.nodeValue !== from.nodeValue) {
58917
- to.nodeValue = from.nodeValue;
58918
- }
58919
- }
58920
- if (!ignoreValueOfActiveElement(to, ctx)) {
58921
- syncInputValue(from, to, ctx);
58922
- }
58923
- }
58924
- function syncBooleanAttribute(from, to, attributeName, ctx) {
58925
- if (from[attributeName] !== to[attributeName]) {
58926
- let ignoreUpdate = ignoreAttribute(attributeName, to, "update", ctx);
58927
- if (!ignoreUpdate) {
58928
- to[attributeName] = from[attributeName];
58929
- }
58930
- if (from[attributeName]) {
58931
- if (!ignoreUpdate) {
58932
- to.setAttribute(attributeName, from[attributeName]);
58933
- }
58934
- } else {
58935
- if (!ignoreAttribute(attributeName, to, "remove", ctx)) {
58936
- to.removeAttribute(attributeName);
58937
- }
58938
- }
58939
- }
58940
- }
58941
- function syncInputValue(from, to, ctx) {
58942
- if (from instanceof HTMLInputElement && to instanceof HTMLInputElement && from.type !== "file") {
58943
- let fromValue = from.value;
58944
- let toValue = to.value;
58945
- syncBooleanAttribute(from, to, "checked", ctx);
58946
- syncBooleanAttribute(from, to, "disabled", ctx);
58947
- if (!from.hasAttribute("value")) {
58948
- if (!ignoreAttribute("value", to, "remove", ctx)) {
58949
- to.value = "";
58950
- to.removeAttribute("value");
58951
- }
58952
- } else if (fromValue !== toValue) {
58953
- if (!ignoreAttribute("value", to, "update", ctx)) {
58954
- to.setAttribute("value", fromValue);
58955
- to.value = fromValue;
58956
- }
58957
- }
58958
- } else if (from instanceof HTMLOptionElement) {
58959
- syncBooleanAttribute(from, to, "selected", ctx);
58960
- } else if (from instanceof HTMLTextAreaElement && to instanceof HTMLTextAreaElement) {
58961
- let fromValue = from.value;
58962
- let toValue = to.value;
58963
- if (ignoreAttribute("value", to, "update", ctx)) {
58964
- return;
58965
- }
58966
- if (fromValue !== toValue) {
58967
- to.value = fromValue;
58968
- }
58969
- if (to.firstChild && to.firstChild.nodeValue !== fromValue) {
58970
- to.firstChild.nodeValue = fromValue;
58971
- }
58972
- }
58973
- }
58974
- function handleHeadElement(newHeadTag, currentHead, ctx) {
58975
- let added = [];
58976
- let removed = [];
58977
- let preserved = [];
58978
- let nodesToAppend = [];
58979
- let headMergeStyle = ctx.head.style;
58980
- let srcToNewHeadNodes = /* @__PURE__ */ new Map();
58981
- for (const newHeadChild of newHeadTag.children) {
58982
- srcToNewHeadNodes.set(newHeadChild.outerHTML, newHeadChild);
58983
- }
58984
- for (const currentHeadElt of currentHead.children) {
58985
- let inNewContent = srcToNewHeadNodes.has(currentHeadElt.outerHTML);
58986
- let isReAppended = ctx.head.shouldReAppend(currentHeadElt);
58987
- let isPreserved = ctx.head.shouldPreserve(currentHeadElt);
58988
- if (inNewContent || isPreserved) {
58989
- if (isReAppended) {
58990
- removed.push(currentHeadElt);
58991
- } else {
58992
- srcToNewHeadNodes.delete(currentHeadElt.outerHTML);
58993
- preserved.push(currentHeadElt);
58994
- }
58995
- } else {
58996
- if (headMergeStyle === "append") {
58997
- if (isReAppended) {
58998
- removed.push(currentHeadElt);
58999
- nodesToAppend.push(currentHeadElt);
59000
- }
59001
- } else {
59002
- if (ctx.head.shouldRemove(currentHeadElt) !== false) {
59003
- removed.push(currentHeadElt);
59004
- }
59005
- }
59006
- }
59007
- }
59008
- nodesToAppend.push(...srcToNewHeadNodes.values());
59009
- let promises = [];
59010
- for (const newNode of nodesToAppend) {
59011
- let newElt = document.createRange().createContextualFragment(newNode.outerHTML).firstChild;
59012
- if (ctx.callbacks.beforeNodeAdded(newElt) !== false) {
59013
- if (newElt.href || newElt.src) {
59014
- let resolve3 = null;
59015
- let promise = new Promise(function(_resolve2) {
59016
- resolve3 = _resolve2;
59017
- });
59018
- newElt.addEventListener("load", function() {
59019
- resolve3();
59020
- });
59021
- promises.push(promise);
59022
- }
59023
- currentHead.appendChild(newElt);
59024
- ctx.callbacks.afterNodeAdded(newElt);
59025
- added.push(newElt);
59026
- }
59027
- }
59028
- for (const removedElement of removed) {
59029
- if (ctx.callbacks.beforeNodeRemoved(removedElement) !== false) {
59030
- currentHead.removeChild(removedElement);
59031
- ctx.callbacks.afterNodeRemoved(removedElement);
59032
- }
59033
- }
59034
- ctx.head.afterHeadMorphed(currentHead, { added, kept: preserved, removed });
59035
- return promises;
59036
- }
59037
- function noOp() {
59038
- }
59039
- function mergeDefaults(config) {
59040
- let finalConfig = {};
59041
- Object.assign(finalConfig, defaults4);
59042
- Object.assign(finalConfig, config);
59043
- finalConfig.callbacks = {};
59044
- Object.assign(finalConfig.callbacks, defaults4.callbacks);
59045
- Object.assign(finalConfig.callbacks, config.callbacks);
59046
- finalConfig.head = {};
59047
- Object.assign(finalConfig.head, defaults4.head);
59048
- Object.assign(finalConfig.head, config.head);
59049
- return finalConfig;
59050
- }
59051
- function createMorphContext(oldNode, newContent, config) {
59052
- config = mergeDefaults(config);
59053
- return {
59054
- target: oldNode,
59055
- newContent,
59056
- config,
59057
- morphStyle: config.morphStyle,
59058
- ignoreActive: config.ignoreActive,
59059
- ignoreActiveValue: config.ignoreActiveValue,
59060
- idMap: createIdMap(oldNode, newContent),
59061
- deadIds: /* @__PURE__ */ new Set(),
59062
- callbacks: config.callbacks,
59063
- head: config.head
59064
- };
59065
- }
59066
- function isIdSetMatch(node1, node2, ctx) {
59067
- if (node1 == null || node2 == null) {
59068
- return false;
59069
- }
59070
- if (node1.nodeType === node2.nodeType && node1.tagName === node2.tagName) {
59071
- if (node1.id !== "" && node1.id === node2.id) {
59072
- return true;
59073
- } else {
59074
- return getIdIntersectionCount(ctx, node1, node2) > 0;
59075
- }
59076
- }
59077
- return false;
59078
- }
59079
- function isSoftMatch(node1, node2) {
59080
- if (node1 == null || node2 == null) {
59081
- return false;
59082
- }
59083
- return node1.nodeType === node2.nodeType && node1.tagName === node2.tagName;
59084
- }
59085
- function removeNodesBetween(startInclusive, endExclusive, ctx) {
59086
- while (startInclusive !== endExclusive) {
59087
- let tempNode = startInclusive;
59088
- startInclusive = startInclusive.nextSibling;
59089
- removeNode(tempNode, ctx);
59090
- }
59091
- removeIdsFromConsideration(ctx, endExclusive);
59092
- return endExclusive.nextSibling;
59093
- }
59094
- function findIdSetMatch(newContent, oldParent, newChild, insertionPoint, ctx) {
59095
- let newChildPotentialIdCount = getIdIntersectionCount(ctx, newChild, oldParent);
59096
- let potentialMatch = null;
59097
- if (newChildPotentialIdCount > 0) {
59098
- let potentialMatch2 = insertionPoint;
59099
- let otherMatchCount = 0;
59100
- while (potentialMatch2 != null) {
59101
- if (isIdSetMatch(newChild, potentialMatch2, ctx)) {
59102
- return potentialMatch2;
59103
- }
59104
- otherMatchCount += getIdIntersectionCount(ctx, potentialMatch2, newContent);
59105
- if (otherMatchCount > newChildPotentialIdCount) {
59106
- return null;
59107
- }
59108
- potentialMatch2 = potentialMatch2.nextSibling;
59109
- }
59110
- }
59111
- return potentialMatch;
59112
- }
59113
- function findSoftMatch(newContent, oldParent, newChild, insertionPoint, ctx) {
59114
- let potentialSoftMatch = insertionPoint;
59115
- let nextSibling = newChild.nextSibling;
59116
- let siblingSoftMatchCount = 0;
59117
- while (potentialSoftMatch != null) {
59118
- if (getIdIntersectionCount(ctx, potentialSoftMatch, newContent) > 0) {
59119
- return null;
59120
- }
59121
- if (isSoftMatch(newChild, potentialSoftMatch)) {
59122
- return potentialSoftMatch;
59123
- }
59124
- if (isSoftMatch(nextSibling, potentialSoftMatch)) {
59125
- siblingSoftMatchCount++;
59126
- nextSibling = nextSibling.nextSibling;
59127
- if (siblingSoftMatchCount >= 2) {
59128
- return null;
59129
- }
59130
- }
59131
- potentialSoftMatch = potentialSoftMatch.nextSibling;
59132
- }
59133
- return potentialSoftMatch;
59134
- }
59135
- function parseContent(newContent) {
59136
- let parser = new DOMParser();
59137
- let contentWithSvgsRemoved = newContent.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim, "");
59138
- if (contentWithSvgsRemoved.match(/<\/html>/) || contentWithSvgsRemoved.match(/<\/head>/) || contentWithSvgsRemoved.match(/<\/body>/)) {
59139
- let content = parser.parseFromString(newContent, "text/html");
59140
- if (contentWithSvgsRemoved.match(/<\/html>/)) {
59141
- content.generatedByIdiomorph = true;
59142
- return content;
59143
- } else {
59144
- let htmlElement = content.firstChild;
59145
- if (htmlElement) {
59146
- htmlElement.generatedByIdiomorph = true;
59147
- return htmlElement;
59148
- } else {
59149
- return null;
59150
- }
59151
- }
59152
- } else {
59153
- let responseDoc = parser.parseFromString("<body><template>" + newContent + "</template></body>", "text/html");
59154
- let content = responseDoc.body.querySelector("template").content;
59155
- content.generatedByIdiomorph = true;
59156
- return content;
59157
- }
59158
- }
59159
- function normalizeContent(newContent) {
59160
- if (newContent == null) {
59161
- const dummyParent = document.createElement("div");
59162
- return dummyParent;
59163
- } else if (newContent.generatedByIdiomorph) {
59164
- return newContent;
59165
- } else if (newContent instanceof Node) {
59166
- const dummyParent = document.createElement("div");
59167
- dummyParent.append(newContent);
59168
- return dummyParent;
59169
- } else {
59170
- const dummyParent = document.createElement("div");
59171
- for (const elt of [...newContent]) {
59172
- dummyParent.append(elt);
59173
- }
59174
- return dummyParent;
59175
- }
59176
- }
59177
- function insertSiblings(previousSibling, morphedNode, nextSibling) {
59178
- let stack = [];
59179
- let added = [];
59180
- while (previousSibling != null) {
59181
- stack.push(previousSibling);
59182
- previousSibling = previousSibling.previousSibling;
59183
- }
59184
- while (stack.length > 0) {
59185
- let node = stack.pop();
59186
- added.push(node);
59187
- morphedNode.parentElement.insertBefore(node, morphedNode);
59188
- }
59189
- added.push(morphedNode);
59190
- while (nextSibling != null) {
59191
- stack.push(nextSibling);
59192
- added.push(nextSibling);
59193
- nextSibling = nextSibling.nextSibling;
59194
- }
59195
- while (stack.length > 0) {
59196
- morphedNode.parentElement.insertBefore(stack.pop(), morphedNode.nextSibling);
59197
- }
59198
- return added;
59199
- }
59200
- function findBestNodeMatch(newContent, oldNode, ctx) {
59201
- let currentElement;
59202
- currentElement = newContent.firstChild;
59203
- let bestElement = currentElement;
59204
- let score = 0;
59205
- while (currentElement) {
59206
- let newScore = scoreElement(currentElement, oldNode, ctx);
59207
- if (newScore > score) {
59208
- bestElement = currentElement;
59209
- score = newScore;
59210
- }
59211
- currentElement = currentElement.nextSibling;
59212
- }
59213
- return bestElement;
59214
- }
59215
- function scoreElement(node1, node2, ctx) {
59216
- if (isSoftMatch(node1, node2)) {
59217
- return 0.5 + getIdIntersectionCount(ctx, node1, node2);
59218
- }
59219
- return 0;
59220
- }
59221
- function removeNode(tempNode, ctx) {
59222
- removeIdsFromConsideration(ctx, tempNode);
59223
- if (ctx.callbacks.beforeNodeRemoved(tempNode) === false)
59224
- return;
59225
- tempNode.remove();
59226
- ctx.callbacks.afterNodeRemoved(tempNode);
59227
- }
59228
- function isIdInConsideration(ctx, id) {
59229
- return !ctx.deadIds.has(id);
59230
- }
59231
- function idIsWithinNode(ctx, id, targetNode) {
59232
- let idSet = ctx.idMap.get(targetNode) || EMPTY_SET;
59233
- return idSet.has(id);
59234
- }
59235
- function removeIdsFromConsideration(ctx, node) {
59236
- let idSet = ctx.idMap.get(node) || EMPTY_SET;
59237
- for (const id of idSet) {
59238
- ctx.deadIds.add(id);
59239
- }
59240
- }
59241
- function getIdIntersectionCount(ctx, node1, node2) {
59242
- let sourceSet = ctx.idMap.get(node1) || EMPTY_SET;
59243
- let matchCount = 0;
59244
- for (const id of sourceSet) {
59245
- if (isIdInConsideration(ctx, id) && idIsWithinNode(ctx, id, node2)) {
59246
- ++matchCount;
59247
- }
59248
- }
59249
- return matchCount;
59250
- }
59251
- function populateIdMapForNode(node, idMap) {
59252
- let nodeParent = node.parentElement;
59253
- let idElements = node.querySelectorAll("[id]");
59254
- for (const elt of idElements) {
59255
- let current = elt;
59256
- while (current !== nodeParent && current != null) {
59257
- let idSet = idMap.get(current);
59258
- if (idSet == null) {
59259
- idSet = /* @__PURE__ */ new Set();
59260
- idMap.set(current, idSet);
59261
- }
59262
- idSet.add(elt.id);
59263
- current = current.parentElement;
59264
- }
59265
- }
59266
- }
59267
- function createIdMap(oldContent, newContent) {
59268
- let idMap = /* @__PURE__ */ new Map();
59269
- populateIdMapForNode(oldContent, idMap);
59270
- populateIdMapForNode(newContent, idMap);
59271
- return idMap;
59272
- }
59273
- return {
59274
- morph: morph2,
59275
- defaults: defaults4
59276
- };
59277
- }();
59278
- DefaultIdiomorphCallbacks = class {
59279
- #beforeNodeMorphed;
59280
- constructor({ beforeNodeMorphed } = {}) {
59281
- this.#beforeNodeMorphed = beforeNodeMorphed || (() => true);
59282
- }
59283
- beforeNodeAdded = (node) => {
59284
- return !(node.id && node.hasAttribute("data-turbo-permanent") && document.getElementById(node.id));
59285
- };
59286
- beforeNodeMorphed = (currentElement, newElement) => {
59287
- if (currentElement instanceof Element) {
59288
- if (!currentElement.hasAttribute("data-turbo-permanent") && this.#beforeNodeMorphed(currentElement, newElement)) {
59289
- const event = dispatch("turbo:before-morph-element", {
59290
- cancelable: true,
59291
- target: currentElement,
59292
- detail: { currentElement, newElement }
59293
- });
59294
- return !event.defaultPrevented;
59295
- } else {
59296
- return false;
59297
- }
59298
- }
59299
- };
59300
- beforeAttributeUpdated = (attributeName, target, mutationType) => {
59301
- const event = dispatch("turbo:before-morph-attribute", {
59302
- cancelable: true,
59303
- target,
59304
- detail: { attributeName, mutationType }
59305
- });
59306
- return !event.defaultPrevented;
59307
- };
59308
- beforeNodeRemoved = (node) => {
59309
- return this.beforeNodeMorphed(node);
59310
- };
59311
- afterNodeMorphed = (currentElement, newElement) => {
59312
- if (currentElement instanceof Element) {
59313
- dispatch("turbo:morph-element", {
59314
- target: currentElement,
59315
- detail: { currentElement, newElement }
59316
- });
59317
- }
59318
- };
59319
- };
59320
- MorphingFrameRenderer = class extends FrameRenderer {
59321
- static renderElement(currentElement, newElement) {
59322
- dispatch("turbo:before-frame-morph", {
59323
- target: currentElement,
59324
- detail: { currentElement, newElement }
59325
- });
59326
- morphChildren(currentElement, newElement);
59327
- }
59328
- };
59329
59445
  PageRenderer = class extends Renderer {
59330
59446
  static renderElement(currentElement, newElement) {
59331
59447
  if (document.body && newElement instanceof HTMLBodyElement) {
@@ -59504,7 +59620,7 @@
59504
59620
  });
59505
59621
  for (const frame of currentElement.querySelectorAll("turbo-frame")) {
59506
59622
  if (canRefreshFrame(frame))
59507
- refreshFrame(frame);
59623
+ frame.reload();
59508
59624
  }
59509
59625
  dispatch("turbo:morph", { detail: { currentElement, newElement } });
59510
59626
  }
@@ -59572,7 +59688,7 @@
59572
59688
  renderPage(snapshot, isPreview = false, willRender = true, visit2) {
59573
59689
  const shouldMorphPage = this.isPageRefresh(visit2) && this.snapshot.shouldMorphPage;
59574
59690
  const rendererClass = shouldMorphPage ? MorphingPageRenderer : PageRenderer;
59575
- const renderer = new rendererClass(this.snapshot, snapshot, rendererClass.renderElement, isPreview, willRender);
59691
+ const renderer = new rendererClass(this.snapshot, snapshot, isPreview, willRender);
59576
59692
  if (!renderer.shouldRender) {
59577
59693
  this.forceReloaded = true;
59578
59694
  } else {
@@ -59582,7 +59698,7 @@
59582
59698
  }
59583
59699
  renderError(snapshot, visit2) {
59584
59700
  visit2?.changeHistory();
59585
- const renderer = new ErrorRenderer(this.snapshot, snapshot, ErrorRenderer.renderElement, false);
59701
+ const renderer = new ErrorRenderer(this.snapshot, snapshot, false);
59586
59702
  return this.render(renderer);
59587
59703
  }
59588
59704
  clearSnapshotCache() {
@@ -59703,11 +59819,8 @@
59703
59819
  frameRedirector = new FrameRedirector(this, document.documentElement);
59704
59820
  streamMessageRenderer = new StreamMessageRenderer();
59705
59821
  cache = new Cache(this);
59706
- drive = true;
59707
59822
  enabled = true;
59708
- progressBarDelay = 500;
59709
59823
  started = false;
59710
- formMode = "on";
59711
59824
  #pageRefreshDebouncePeriod = 150;
59712
59825
  constructor(recentRequests2) {
59713
59826
  this.recentRequests = recentRequests2;
@@ -59783,10 +59896,28 @@
59783
59896
  this.view.clearSnapshotCache();
59784
59897
  }
59785
59898
  setProgressBarDelay(delay) {
59899
+ console.warn(
59900
+ "Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"
59901
+ );
59786
59902
  this.progressBarDelay = delay;
59787
59903
  }
59788
- setFormMode(mode) {
59789
- this.formMode = mode;
59904
+ set progressBarDelay(delay) {
59905
+ config.drive.progressBarDelay = delay;
59906
+ }
59907
+ get progressBarDelay() {
59908
+ return config.drive.progressBarDelay;
59909
+ }
59910
+ set drive(value) {
59911
+ config.drive.enabled = value;
59912
+ }
59913
+ get drive() {
59914
+ return config.drive.enabled;
59915
+ }
59916
+ set formMode(value) {
59917
+ config.forms.mode = value;
59918
+ }
59919
+ get formMode() {
59920
+ return config.forms.mode;
59790
59921
  }
59791
59922
  get location() {
59792
59923
  return this.history.location;
@@ -59873,12 +60004,12 @@
59873
60004
  visitScrolledToSamePageLocation(oldURL, newURL) {
59874
60005
  this.notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL);
59875
60006
  }
59876
- willSubmitForm(form, submitter) {
59877
- const action = getAction$1(form, submitter);
59878
- return this.submissionIsNavigatable(form, submitter) && locationIsVisitable(expandURL(action), this.snapshot.rootLocation);
60007
+ willSubmitForm(form, submitter2) {
60008
+ const action = getAction$1(form, submitter2);
60009
+ return this.submissionIsNavigatable(form, submitter2) && locationIsVisitable(expandURL(action), this.snapshot.rootLocation);
59879
60010
  }
59880
- formSubmitted(form, submitter) {
59881
- this.navigator.submitForm(form, submitter);
60011
+ formSubmitted(form, submitter2) {
60012
+ this.navigator.submitForm(form, submitter2);
59882
60013
  }
59883
60014
  pageBecameInteractive() {
59884
60015
  this.view.lastRenderedLocation = this.location;
@@ -59984,12 +60115,12 @@
59984
60115
  cancelable: true
59985
60116
  });
59986
60117
  }
59987
- submissionIsNavigatable(form, submitter) {
59988
- if (this.formMode == "off") {
60118
+ submissionIsNavigatable(form, submitter2) {
60119
+ if (config.forms.mode == "off") {
59989
60120
  return false;
59990
60121
  } else {
59991
- const submitterIsNavigatable = submitter ? this.elementIsNavigatable(submitter) : true;
59992
- if (this.formMode == "optin") {
60122
+ const submitterIsNavigatable = submitter2 ? this.elementIsNavigatable(submitter2) : true;
60123
+ if (config.forms.mode == "optin") {
59993
60124
  return submitterIsNavigatable && form.closest('[data-turbo="true"]') != null;
59994
60125
  } else {
59995
60126
  return submitterIsNavigatable && this.elementIsNavigatable(form);
@@ -59999,7 +60130,7 @@
59999
60130
  elementIsNavigatable(element) {
60000
60131
  const container = findClosestRecursively(element, "[data-turbo]");
60001
60132
  const withinFrame = findClosestRecursively(element, "turbo-frame");
60002
- if (this.drive || withinFrame) {
60133
+ if (config.drive.enabled || withinFrame) {
60003
60134
  if (container) {
60004
60135
  return container.getAttribute("data-turbo") != "false";
60005
60136
  } else {
@@ -60038,6 +60169,7 @@
60038
60169
  PageSnapshot,
60039
60170
  FrameRenderer,
60040
60171
  fetch: fetchWithTurboHeaders,
60172
+ config,
60041
60173
  start,
60042
60174
  registerAdapter,
60043
60175
  visit,
@@ -60059,6 +60191,7 @@
60059
60191
  #connected = false;
60060
60192
  #hasBeenLoaded = false;
60061
60193
  #ignoredAttributes = /* @__PURE__ */ new Set();
60194
+ #shouldMorphFrame = false;
60062
60195
  action = null;
60063
60196
  constructor(element) {
60064
60197
  this.element = element;
@@ -60107,7 +60240,8 @@
60107
60240
  }
60108
60241
  }
60109
60242
  sourceURLReloaded() {
60110
- const { src } = this.element;
60243
+ const { refresh, src } = this.element;
60244
+ this.#shouldMorphFrame = src && refresh === "morph";
60111
60245
  this.element.removeAttribute("complete");
60112
60246
  this.element.src = null;
60113
60247
  this.element.src = src;
@@ -60145,6 +60279,7 @@
60145
60279
  }
60146
60280
  }
60147
60281
  } finally {
60282
+ this.#shouldMorphFrame = false;
60148
60283
  this.fetchResponseLoaded = () => Promise.resolve();
60149
60284
  }
60150
60285
  }
@@ -60166,14 +60301,14 @@
60166
60301
  linkClickIntercepted(element, location2) {
60167
60302
  this.#navigateFrame(element, location2);
60168
60303
  }
60169
- willSubmitForm(element, submitter) {
60170
- return element.closest("turbo-frame") == this.element && this.#shouldInterceptNavigation(element, submitter);
60304
+ willSubmitForm(element, submitter2) {
60305
+ return element.closest("turbo-frame") == this.element && this.#shouldInterceptNavigation(element, submitter2);
60171
60306
  }
60172
- formSubmitted(element, submitter) {
60307
+ formSubmitted(element, submitter2) {
60173
60308
  if (this.formSubmission) {
60174
60309
  this.formSubmission.stop();
60175
60310
  }
60176
- this.formSubmission = new FormSubmission(this, element, submitter);
60311
+ this.formSubmission = new FormSubmission(this, element, submitter2);
60177
60312
  const { fetchRequest } = this.formSubmission;
60178
60313
  this.prepareRequest(fetchRequest);
60179
60314
  this.formSubmission.start();
@@ -60260,9 +60395,10 @@
60260
60395
  };
60261
60396
  async #loadFrameResponse(fetchResponse, document2) {
60262
60397
  const newFrameElement = await this.extractForeignFrameElement(document2.body);
60398
+ const rendererClass = this.#shouldMorphFrame ? MorphingFrameRenderer : FrameRenderer;
60263
60399
  if (newFrameElement) {
60264
60400
  const snapshot = new Snapshot(newFrameElement);
60265
- const renderer = new FrameRenderer(this, this.view.snapshot, snapshot, FrameRenderer.renderElement, false, false);
60401
+ const renderer = new rendererClass(this, this.view.snapshot, snapshot, false, false);
60266
60402
  if (this.view.renderPromise)
60267
60403
  await this.view.renderPromise;
60268
60404
  this.changeHistory();
@@ -60289,9 +60425,9 @@
60289
60425
  request.perform();
60290
60426
  });
60291
60427
  }
60292
- #navigateFrame(element, url, submitter) {
60293
- const frame = this.#findFrameElement(element, submitter);
60294
- frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(submitter, element, frame));
60428
+ #navigateFrame(element, url, submitter2) {
60429
+ const frame = this.#findFrameElement(element, submitter2);
60430
+ frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(submitter2, element, frame));
60295
60431
  this.#withCurrentNavigationElement(element, () => {
60296
60432
  frame.src = url;
60297
60433
  });
@@ -60364,8 +60500,8 @@
60364
60500
  const { location: location2, redirected, statusCode } = wrapped;
60365
60501
  return session.visit(location2, { response: { redirected, statusCode, responseHTML } });
60366
60502
  }
60367
- #findFrameElement(element, submitter) {
60368
- const id = getAttribute("data-turbo-frame", submitter, element) || this.element.getAttribute("target");
60503
+ #findFrameElement(element, submitter2) {
60504
+ const id = getAttribute("data-turbo-frame", submitter2, element) || this.element.getAttribute("target");
60369
60505
  return getFrameElementById(id) ?? this.element;
60370
60506
  }
60371
60507
  async extractForeignFrameElement(container) {
@@ -60387,13 +60523,13 @@
60387
60523
  }
60388
60524
  return null;
60389
60525
  }
60390
- #formActionIsVisitable(form, submitter) {
60391
- const action = getAction$1(form, submitter);
60526
+ #formActionIsVisitable(form, submitter2) {
60527
+ const action = getAction$1(form, submitter2);
60392
60528
  return locationIsVisitable(expandURL(action), this.rootLocation);
60393
60529
  }
60394
- #shouldInterceptNavigation(element, submitter) {
60395
- const id = getAttribute("data-turbo-frame", submitter, element) || this.element.getAttribute("target");
60396
- if (element instanceof HTMLFormElement && !this.#formActionIsVisitable(element, submitter)) {
60530
+ #shouldInterceptNavigation(element, submitter2) {
60531
+ const id = getAttribute("data-turbo-frame", submitter2, element) || this.element.getAttribute("target");
60532
+ if (element instanceof HTMLFormElement && !this.#formActionIsVisitable(element, submitter2)) {
60397
60533
  return false;
60398
60534
  }
60399
60535
  if (!this.enabled || id == "_top") {
@@ -60408,7 +60544,7 @@
60408
60544
  if (!session.elementIsNavigatable(element)) {
60409
60545
  return false;
60410
60546
  }
60411
- if (submitter && !session.elementIsNavigatable(submitter)) {
60547
+ if (submitter2 && !session.elementIsNavigatable(submitter2)) {
60412
60548
  return false;
60413
60549
  }
60414
60550
  return true;
@@ -61304,6 +61440,13 @@
61304
61440
  disconnectStreamSource(this);
61305
61441
  if (this.subscription)
61306
61442
  this.subscription.unsubscribe();
61443
+ this.subscriptionDisconnected();
61444
+ }
61445
+ attributeChangedCallback() {
61446
+ if (this.subscription) {
61447
+ this.disconnectedCallback();
61448
+ this.connectedCallback();
61449
+ }
61307
61450
  }
61308
61451
  dispatchMessageEvent(data) {
61309
61452
  const event = new MessageEvent("message", { data });
@@ -61321,6 +61464,7 @@
61321
61464
  return { channel, signed_stream_name, ...walk({ ...this.dataset }) };
61322
61465
  }
61323
61466
  };
61467
+ __publicField(TurboCableStreamSourceElement, "observedAttributes", ["channel", "signed-stream-name"]);
61324
61468
  if (customElements.get("turbo-cable-stream-source") === void 0) {
61325
61469
  customElements.define("turbo-cable-stream-source", TurboCableStreamSourceElement);
61326
61470
  }
@@ -61331,9 +61475,9 @@
61331
61475
  function encodeMethodIntoRequestBody(event) {
61332
61476
  if (event.target instanceof HTMLFormElement) {
61333
61477
  const { target: form, detail: { fetchOptions } } = event;
61334
- form.addEventListener("turbo:submit-start", ({ detail: { formSubmission: { submitter } } }) => {
61478
+ form.addEventListener("turbo:submit-start", ({ detail: { formSubmission: { submitter: submitter2 } } }) => {
61335
61479
  const body = isBodyInit(fetchOptions.body) ? fetchOptions.body : new URLSearchParams();
61336
- const method = determineFetchMethod(submitter, body, form);
61480
+ const method = determineFetchMethod(submitter2, body, form);
61337
61481
  if (!/get/i.test(method)) {
61338
61482
  if (/post/i.test(method)) {
61339
61483
  body.delete("_method");
@@ -61345,8 +61489,8 @@
61345
61489
  }, { once: true });
61346
61490
  }
61347
61491
  }
61348
- function determineFetchMethod(submitter, body, form) {
61349
- const formMethod = determineFormMethod(submitter);
61492
+ function determineFetchMethod(submitter2, body, form) {
61493
+ const formMethod = determineFormMethod(submitter2);
61350
61494
  const overrideMethod = body.get("_method");
61351
61495
  const method = form.getAttribute("method") || "get";
61352
61496
  if (typeof formMethod == "string") {
@@ -61357,12 +61501,12 @@
61357
61501
  return method;
61358
61502
  }
61359
61503
  }
61360
- function determineFormMethod(submitter) {
61361
- if (submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement) {
61362
- if (submitter.name === "_method") {
61363
- return submitter.value;
61364
- } else if (submitter.hasAttribute("formmethod")) {
61365
- return submitter.formMethod;
61504
+ function determineFormMethod(submitter2) {
61505
+ if (submitter2 instanceof HTMLButtonElement || submitter2 instanceof HTMLInputElement) {
61506
+ if (submitter2.name === "_method") {
61507
+ return submitter2.value;
61508
+ } else if (submitter2.hasAttribute("formmethod")) {
61509
+ return submitter2.formMethod;
61366
61510
  } else {
61367
61511
  return null;
61368
61512
  }
@@ -81688,11 +81832,11 @@
81688
81832
  mod(CodeMirror);
81689
81833
  })(function(CodeMirror3) {
81690
81834
  "use strict";
81691
- CodeMirror3.defineMode("css", function(config, parserConfig) {
81835
+ CodeMirror3.defineMode("css", function(config2, parserConfig) {
81692
81836
  var inline = parserConfig.inline;
81693
81837
  if (!parserConfig.propertyKeywords)
81694
81838
  parserConfig = CodeMirror3.resolveMode("text/css");
81695
- var indentUnit = config.indentUnit, tokenHooks = parserConfig.tokenHooks, documentTypes2 = parserConfig.documentTypes || {}, mediaTypes2 = parserConfig.mediaTypes || {}, mediaFeatures2 = parserConfig.mediaFeatures || {}, mediaValueKeywords2 = parserConfig.mediaValueKeywords || {}, propertyKeywords2 = parserConfig.propertyKeywords || {}, nonStandardPropertyKeywords2 = parserConfig.nonStandardPropertyKeywords || {}, fontProperties2 = parserConfig.fontProperties || {}, counterDescriptors2 = parserConfig.counterDescriptors || {}, colorKeywords2 = parserConfig.colorKeywords || {}, valueKeywords2 = parserConfig.valueKeywords || {}, allowNested = parserConfig.allowNested, lineComment = parserConfig.lineComment, supportsAtComponent = parserConfig.supportsAtComponent === true, highlightNonStandardPropertyKeywords = config.highlightNonStandardPropertyKeywords !== false;
81839
+ var indentUnit = config2.indentUnit, tokenHooks = parserConfig.tokenHooks, documentTypes2 = parserConfig.documentTypes || {}, mediaTypes2 = parserConfig.mediaTypes || {}, mediaFeatures2 = parserConfig.mediaFeatures || {}, mediaValueKeywords2 = parserConfig.mediaValueKeywords || {}, propertyKeywords2 = parserConfig.propertyKeywords || {}, nonStandardPropertyKeywords2 = parserConfig.nonStandardPropertyKeywords || {}, fontProperties2 = parserConfig.fontProperties || {}, counterDescriptors2 = parserConfig.counterDescriptors || {}, colorKeywords2 = parserConfig.colorKeywords || {}, valueKeywords2 = parserConfig.valueKeywords || {}, allowNested = parserConfig.allowNested, lineComment = parserConfig.lineComment, supportsAtComponent = parserConfig.supportsAtComponent === true, highlightNonStandardPropertyKeywords = config2.highlightNonStandardPropertyKeywords !== false;
81696
81840
  var type, override;
81697
81841
  function ret(style2, tp) {
81698
81842
  type = tp;
@@ -83500,11 +83644,11 @@
83500
83644
  })(function(CodeMirror3) {
83501
83645
  "use strict";
83502
83646
  CodeMirror3.defineSimpleMode = function(name, states) {
83503
- CodeMirror3.defineMode(name, function(config) {
83504
- return CodeMirror3.simpleMode(config, states);
83647
+ CodeMirror3.defineMode(name, function(config2) {
83648
+ return CodeMirror3.simpleMode(config2, states);
83505
83649
  });
83506
83650
  };
83507
- CodeMirror3.simpleMode = function(config, states) {
83651
+ CodeMirror3.simpleMode = function(config2, states) {
83508
83652
  ensureState(states, "start");
83509
83653
  var states_ = {}, meta = states.meta || {}, hasIndentation = false;
83510
83654
  for (var state in states)
@@ -83548,7 +83692,7 @@
83548
83692
  };
83549
83693
  return s6;
83550
83694
  },
83551
- token: tokenFunction(states_, config),
83695
+ token: tokenFunction(states_, config2),
83552
83696
  innerMode: function(state2) {
83553
83697
  return state2.local && { mode: state2.local.mode, state: state2.localState };
83554
83698
  },
@@ -83597,7 +83741,7 @@
83597
83741
  this.token = asToken(data.token);
83598
83742
  this.data = data;
83599
83743
  }
83600
- function tokenFunction(states, config) {
83744
+ function tokenFunction(states, config2) {
83601
83745
  return function(stream, state) {
83602
83746
  if (state.pending) {
83603
83747
  var pend = state.pending.shift();
@@ -83632,9 +83776,9 @@
83632
83776
  state.state = state.stack.pop();
83633
83777
  }
83634
83778
  if (rule.data.mode)
83635
- enterLocalMode(config, state, rule.data.mode, rule.token);
83779
+ enterLocalMode(config2, state, rule.data.mode, rule.token);
83636
83780
  if (rule.data.indent)
83637
- state.indent.push(stream.indentation() + config.indentUnit);
83781
+ state.indent.push(stream.indentation() + config2.indentUnit);
83638
83782
  if (rule.data.dedent)
83639
83783
  state.indent.pop();
83640
83784
  var token = rule.token;
@@ -83675,14 +83819,14 @@
83675
83819
  props--;
83676
83820
  return props == 0;
83677
83821
  }
83678
- function enterLocalMode(config, state, spec, token) {
83822
+ function enterLocalMode(config2, state, spec, token) {
83679
83823
  var pers;
83680
83824
  if (spec.persistent) {
83681
83825
  for (var p4 = state.persistentStates; p4 && !pers; p4 = p4.next)
83682
83826
  if (spec.spec ? cmp2(spec.spec, p4.spec) : spec.mode == p4.mode)
83683
83827
  pers = p4;
83684
83828
  }
83685
- var mode = pers ? pers.mode : spec.mode || CodeMirror3.getMode(config, spec.spec);
83829
+ var mode = pers ? pers.mode : spec.mode || CodeMirror3.getMode(config2, spec.spec);
83686
83830
  var lState = pers ? pers.state : CodeMirror3.startState(mode);
83687
83831
  if (spec.persistent && !pers)
83688
83832
  state.persistentStates = { mode, spec: spec.spec, state: lState, next: state.persistentStates };
@@ -84045,12 +84189,12 @@
84045
84189
  };
84046
84190
  CodeMirror3.defineMode("xml", function(editorConf, config_) {
84047
84191
  var indentUnit = editorConf.indentUnit;
84048
- var config = {};
84192
+ var config2 = {};
84049
84193
  var defaults4 = config_.htmlMode ? htmlConfig : xmlConfig;
84050
84194
  for (var prop in defaults4)
84051
- config[prop] = defaults4[prop];
84195
+ config2[prop] = defaults4[prop];
84052
84196
  for (var prop in config_)
84053
- config[prop] = config_[prop];
84197
+ config2[prop] = config_[prop];
84054
84198
  var type, setStyle3;
84055
84199
  function inText(stream, state) {
84056
84200
  function chain(parser) {
@@ -84174,7 +84318,7 @@
84174
84318
  this.tagName = tagName || "";
84175
84319
  this.indent = state.indented;
84176
84320
  this.startOfLine = startOfLine;
84177
- if (config.doNotIndent.hasOwnProperty(tagName) || state.context && state.context.noIndent)
84321
+ if (config2.doNotIndent.hasOwnProperty(tagName) || state.context && state.context.noIndent)
84178
84322
  this.noIndent = true;
84179
84323
  }
84180
84324
  function popContext(state) {
@@ -84188,7 +84332,7 @@
84188
84332
  return;
84189
84333
  }
84190
84334
  parentTagName = state.context.tagName;
84191
- if (!config.contextGrabbers.hasOwnProperty(parentTagName) || !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
84335
+ if (!config2.contextGrabbers.hasOwnProperty(parentTagName) || !config2.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
84192
84336
  return;
84193
84337
  }
84194
84338
  popContext(state);
@@ -84209,7 +84353,7 @@
84209
84353
  state.tagName = stream.current();
84210
84354
  setStyle3 = "tag";
84211
84355
  return attrState;
84212
- } else if (config.allowMissingTagName && type2 == "endTag") {
84356
+ } else if (config2.allowMissingTagName && type2 == "endTag") {
84213
84357
  setStyle3 = "tag bracket";
84214
84358
  return attrState(type2, stream, state);
84215
84359
  } else {
@@ -84220,16 +84364,16 @@
84220
84364
  function closeTagNameState(type2, stream, state) {
84221
84365
  if (type2 == "word") {
84222
84366
  var tagName = stream.current();
84223
- if (state.context && state.context.tagName != tagName && config.implicitlyClosed.hasOwnProperty(state.context.tagName))
84367
+ if (state.context && state.context.tagName != tagName && config2.implicitlyClosed.hasOwnProperty(state.context.tagName))
84224
84368
  popContext(state);
84225
- if (state.context && state.context.tagName == tagName || config.matchClosing === false) {
84369
+ if (state.context && state.context.tagName == tagName || config2.matchClosing === false) {
84226
84370
  setStyle3 = "tag";
84227
84371
  return closeState;
84228
84372
  } else {
84229
84373
  setStyle3 = "tag error";
84230
84374
  return closeStateErr;
84231
84375
  }
84232
- } else if (config.allowMissingTagName && type2 == "endTag") {
84376
+ } else if (config2.allowMissingTagName && type2 == "endTag") {
84233
84377
  setStyle3 = "tag bracket";
84234
84378
  return closeState(type2, stream, state);
84235
84379
  } else {
@@ -84256,7 +84400,7 @@
84256
84400
  } else if (type2 == "endTag" || type2 == "selfcloseTag") {
84257
84401
  var tagName = state.tagName, tagStart = state.tagStart;
84258
84402
  state.tagName = state.tagStart = null;
84259
- if (type2 == "selfcloseTag" || config.autoSelfClosers.hasOwnProperty(tagName)) {
84403
+ if (type2 == "selfcloseTag" || config2.autoSelfClosers.hasOwnProperty(tagName)) {
84260
84404
  maybePopContext(state, tagName);
84261
84405
  } else {
84262
84406
  maybePopContext(state, tagName);
@@ -84270,14 +84414,14 @@
84270
84414
  function attrEqState(type2, stream, state) {
84271
84415
  if (type2 == "equals")
84272
84416
  return attrValueState;
84273
- if (!config.allowMissing)
84417
+ if (!config2.allowMissing)
84274
84418
  setStyle3 = "error";
84275
84419
  return attrState(type2, stream, state);
84276
84420
  }
84277
84421
  function attrValueState(type2, stream, state) {
84278
84422
  if (type2 == "string")
84279
84423
  return attrContinuedState;
84280
- if (type2 == "word" && config.allowUnquoted) {
84424
+ if (type2 == "word" && config2.allowUnquoted) {
84281
84425
  setStyle3 = "string";
84282
84426
  return attrState;
84283
84427
  }
@@ -84331,12 +84475,12 @@
84331
84475
  if (state.tokenize != inTag && state.tokenize != inText)
84332
84476
  return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
84333
84477
  if (state.tagName) {
84334
- if (config.multilineTagIndentPastTag !== false)
84478
+ if (config2.multilineTagIndentPastTag !== false)
84335
84479
  return state.tagStart + state.tagName.length + 2;
84336
84480
  else
84337
- return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
84481
+ return state.tagStart + indentUnit * (config2.multilineTagIndentFactor || 1);
84338
84482
  }
84339
- if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter))
84483
+ if (config2.alignCDATA && /<!\[CDATA\[/.test(textAfter))
84340
84484
  return 0;
84341
84485
  var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
84342
84486
  if (tagAfter && tagAfter[1]) {
@@ -84344,7 +84488,7 @@
84344
84488
  if (context.tagName == tagAfter[2]) {
84345
84489
  context = context.prev;
84346
84490
  break;
84347
- } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
84491
+ } else if (config2.implicitlyClosed.hasOwnProperty(context.tagName)) {
84348
84492
  context = context.prev;
84349
84493
  } else {
84350
84494
  break;
@@ -84352,7 +84496,7 @@
84352
84496
  }
84353
84497
  } else if (tagAfter) {
84354
84498
  while (context) {
84355
- var grabbers = config.contextGrabbers[context.tagName];
84499
+ var grabbers = config2.contextGrabbers[context.tagName];
84356
84500
  if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
84357
84501
  context = context.prev;
84358
84502
  else
@@ -84369,8 +84513,8 @@
84369
84513
  electricInput: /<\/[\s\w:]+>$/,
84370
84514
  blockCommentStart: "<!--",
84371
84515
  blockCommentEnd: "-->",
84372
- configuration: config.htmlMode ? "html" : "xml",
84373
- helperType: config.htmlMode ? "html" : "xml",
84516
+ configuration: config2.htmlMode ? "html" : "xml",
84517
+ helperType: config2.htmlMode ? "html" : "xml",
84374
84518
  skipAttribute: function(state) {
84375
84519
  if (state.state == attrValueState)
84376
84520
  state.state = attrState;
@@ -84406,8 +84550,8 @@
84406
84550
  mod(CodeMirror);
84407
84551
  })(function(CodeMirror3) {
84408
84552
  "use strict";
84409
- CodeMirror3.defineMode("javascript", function(config, parserConfig) {
84410
- var indentUnit = config.indentUnit;
84553
+ CodeMirror3.defineMode("javascript", function(config2, parserConfig) {
84554
+ var indentUnit = config2.indentUnit;
84411
84555
  var statementIndent = parserConfig.statementIndent;
84412
84556
  var jsonldMode = parserConfig.jsonld;
84413
84557
  var jsonMode = parserConfig.json || jsonldMode;
@@ -85626,8 +85770,8 @@
85626
85770
  return spec[2];
85627
85771
  }
85628
85772
  }
85629
- CodeMirror3.defineMode("htmlmixed", function(config, parserConfig) {
85630
- var htmlMode = CodeMirror3.getMode(config, {
85773
+ CodeMirror3.defineMode("htmlmixed", function(config2, parserConfig) {
85774
+ var htmlMode = CodeMirror3.getMode(config2, {
85631
85775
  name: "xml",
85632
85776
  htmlMode: true,
85633
85777
  multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
@@ -85650,7 +85794,7 @@
85650
85794
  var inTag = /^([\S]+) (.*)/.exec(state.inTag);
85651
85795
  state.inTag = null;
85652
85796
  var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2]);
85653
- var mode = CodeMirror3.getMode(config, modeSpec);
85797
+ var mode = CodeMirror3.getMode(config2, modeSpec);
85654
85798
  var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);
85655
85799
  state.token = function(stream2, state2) {
85656
85800
  if (stream2.match(endTagA, false)) {
@@ -86741,7 +86885,7 @@
86741
86885
  mod(CodeMirror);
86742
86886
  })(function(CodeMirror3) {
86743
86887
  "use strict";
86744
- CodeMirror3.defineMode("nginx", function(config) {
86888
+ CodeMirror3.defineMode("nginx", function(config2) {
86745
86889
  function words(str) {
86746
86890
  var obj = {}, words2 = str.split(" ");
86747
86891
  for (var i5 = 0; i5 < words2.length; ++i5)
@@ -86757,7 +86901,7 @@
86757
86901
  var keywords_important = words(
86758
86902
  "include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"
86759
86903
  );
86760
- var indentUnit = config.indentUnit, type;
86904
+ var indentUnit = config2.indentUnit, type;
86761
86905
  function ret(style2, tp) {
86762
86906
  type = tp;
86763
86907
  return style2;
@@ -86942,8 +87086,8 @@
86942
87086
  context = context.prev;
86943
87087
  }
86944
87088
  }
86945
- CodeMirror3.defineMode("clike", function(config, parserConfig) {
86946
- var indentUnit = config.indentUnit, statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, dontAlignCalls = parserConfig.dontAlignCalls, keywords = parserConfig.keywords || {}, types = parserConfig.types || {}, builtin = parserConfig.builtin || {}, blockKeywords = parserConfig.blockKeywords || {}, defKeywords = parserConfig.defKeywords || {}, atoms = parserConfig.atoms || {}, hooks = parserConfig.hooks || {}, multiLineStrings = parserConfig.multiLineStrings, indentStatements = parserConfig.indentStatements !== false, indentSwitch = parserConfig.indentSwitch !== false, namespaceSeparator = parserConfig.namespaceSeparator, isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/, numberStart = parserConfig.numberStart || /[\d\.]/, number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i, isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/, isIdentifierChar = parserConfig.isIdentifierChar || /[\w\$_\xa1-\uffff]/, isReservedIdentifier = parserConfig.isReservedIdentifier || false;
87089
+ CodeMirror3.defineMode("clike", function(config2, parserConfig) {
87090
+ var indentUnit = config2.indentUnit, statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, dontAlignCalls = parserConfig.dontAlignCalls, keywords = parserConfig.keywords || {}, types = parserConfig.types || {}, builtin = parserConfig.builtin || {}, blockKeywords = parserConfig.blockKeywords || {}, defKeywords = parserConfig.defKeywords || {}, atoms = parserConfig.atoms || {}, hooks = parserConfig.hooks || {}, multiLineStrings = parserConfig.multiLineStrings, indentStatements = parserConfig.indentStatements !== false, indentSwitch = parserConfig.indentSwitch !== false, namespaceSeparator = parserConfig.namespaceSeparator, isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/, numberStart = parserConfig.numberStart || /[\d\.]/, number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i, isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/, isIdentifierChar = parserConfig.isIdentifierChar || /[\w\$_\xa1-\uffff]/, isReservedIdentifier = parserConfig.isReservedIdentifier || false;
86947
87091
  var curPunc, isDefKeyword;
86948
87092
  function tokenBase(stream, state) {
86949
87093
  var ch = stream.next();
@@ -87792,9 +87936,9 @@
87792
87936
  }
87793
87937
  }
87794
87938
  };
87795
- CodeMirror3.defineMode("php", function(config, parserConfig) {
87796
- var htmlMode = CodeMirror3.getMode(config, parserConfig && parserConfig.htmlMode || "text/html");
87797
- var phpMode = CodeMirror3.getMode(config, phpConfig);
87939
+ CodeMirror3.defineMode("php", function(config2, parserConfig) {
87940
+ var htmlMode = CodeMirror3.getMode(config2, parserConfig && parserConfig.htmlMode || "text/html");
87941
+ var phpMode = CodeMirror3.getMode(config2, phpConfig);
87798
87942
  function dispatch3(stream, state) {
87799
87943
  var isPHP = state.curMode == phpMode;
87800
87944
  if (stream.sol() && state.pending && state.pending != '"' && state.pending != "'")
@@ -87981,7 +88125,7 @@
87981
88125
  var dedentWords = wordObj(["end", "until"]);
87982
88126
  var opening = { "[": "]", "{": "}", "(": ")" };
87983
88127
  var closing = { "]": "[", "}": "{", ")": "(" };
87984
- CodeMirror3.defineMode("ruby", function(config) {
88128
+ CodeMirror3.defineMode("ruby", function(config2) {
87985
88129
  var curPunc;
87986
88130
  function chain(newtok, stream, state) {
87987
88131
  state.tokenize.push(newtok);
@@ -88199,7 +88343,7 @@
88199
88343
  return {
88200
88344
  tokenize: [tokenBase],
88201
88345
  indented: 0,
88202
- context: { type: "top", indented: -config.indentUnit },
88346
+ context: { type: "top", indented: -config2.indentUnit },
88203
88347
  continuedLine: false,
88204
88348
  lastTok: null,
88205
88349
  varList: false
@@ -88244,7 +88388,7 @@
88244
88388
  var firstChar = textAfter && textAfter.charAt(0);
88245
88389
  var ct2 = state.context;
88246
88390
  var closed = ct2.type == closing[firstChar] || ct2.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
88247
- return ct2.indented + (closed ? 0 : config.indentUnit) + (state.continuedLine ? config.indentUnit : 0);
88391
+ return ct2.indented + (closed ? 0 : config2.indentUnit) + (state.continuedLine ? config2.indentUnit : 0);
88248
88392
  },
88249
88393
  electricInput: /^\s*(?:end|rescue|elsif|else|\})$/,
88250
88394
  lineComment: "#",
@@ -88269,7 +88413,7 @@
88269
88413
  mod(CodeMirror);
88270
88414
  })(function(CodeMirror3) {
88271
88415
  "use strict";
88272
- CodeMirror3.defineMode("sass", function(config) {
88416
+ CodeMirror3.defineMode("sass", function(config2) {
88273
88417
  var cssMode = CodeMirror3.mimeModes["text/css"];
88274
88418
  var propertyKeywords = cssMode.propertyKeywords || {}, colorKeywords = cssMode.colorKeywords || {}, valueKeywords = cssMode.valueKeywords || {}, fontProperties = cssMode.fontProperties || {};
88275
88419
  function tokenRegexp(words) {
@@ -88383,7 +88527,7 @@
88383
88527
  if (state.indentCount == 0) {
88384
88528
  state.indentCount++;
88385
88529
  var lastScopeOffset = state.scopes[0].offset;
88386
- var currentOffset = lastScopeOffset + config.indentUnit;
88530
+ var currentOffset = lastScopeOffset + config2.indentUnit;
88387
88531
  state.scopes.unshift({ offset: currentOffset });
88388
88532
  }
88389
88533
  }
@@ -88602,7 +88746,7 @@
88602
88746
  }
88603
88747
  if (style2 !== null) {
88604
88748
  var startOfToken = stream.pos - current.length;
88605
- var withCurrentIndent = startOfToken + config.indentUnit * state.indentCount;
88749
+ var withCurrentIndent = startOfToken + config2.indentUnit * state.indentCount;
88606
88750
  var newScopes = [];
88607
88751
  for (var i5 = 0; i5 < state.scopes.length; i5++) {
88608
88752
  var scope = state.scopes[i5];
@@ -88897,7 +89041,7 @@
88897
89041
  mod(CodeMirror);
88898
89042
  })(function(CodeMirror3) {
88899
89043
  "use strict";
88900
- CodeMirror3.defineMode("sql", function(config, parserConfig) {
89044
+ CodeMirror3.defineMode("sql", function(config2, parserConfig) {
88901
89045
  var client = parserConfig.client || {}, atoms = parserConfig.atoms || { "false": true, "true": true, "null": true }, builtin = parserConfig.builtin || set2(defaultBuiltin), keywords = parserConfig.keywords || set2(sqlKeywords), operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^\/]/, support = parserConfig.support || {}, hooks = parserConfig.hooks || {}, dateSQL = parserConfig.dateSQL || { "date": true, "time": true, "timestamp": true }, backslashStringEscapes = parserConfig.backslashStringEscapes !== false, brackets = parserConfig.brackets || /^[\{}\(\)\[\]]/, punctuation = parserConfig.punctuation || /^[;.,:]/;
88902
89046
  function tokenBase(stream, state) {
88903
89047
  var ch = stream.next();
@@ -89040,7 +89184,7 @@
89040
89184
  if (cx.align)
89041
89185
  return cx.col + (closing ? 0 : 1);
89042
89186
  else
89043
- return cx.indent + (closing ? 0 : config.indentUnit);
89187
+ return cx.indent + (closing ? 0 : config2.indentUnit);
89044
89188
  },
89045
89189
  blockCommentStart: "/*",
89046
89190
  blockCommentEnd: "*/",
@@ -89680,8 +89824,8 @@
89680
89824
  mod(CodeMirror);
89681
89825
  })(function(CodeMirror3) {
89682
89826
  "use strict";
89683
- CodeMirror3.defineMode("stylus", function(config) {
89684
- var indentUnit = config.indentUnit, indentUnitString = "", tagKeywords = keySet(tagKeywords_), tagVariablesRegexp = /^(a|b|i|s|col|em)$/i, propertyKeywords = keySet(propertyKeywords_), nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_), valueKeywords = keySet(valueKeywords_), colorKeywords = keySet(colorKeywords_), documentTypes = keySet(documentTypes_), documentTypesRegexp = wordRegexp(documentTypes_), mediaFeatures = keySet(mediaFeatures_), mediaTypes = keySet(mediaTypes_), fontProperties = keySet(fontProperties_), operatorsRegexp = /^\s*([.]{2,3}|&&|\|\||\*\*|[?!=:]?=|[-+*\/%<>]=?|\?:|\~)/, wordOperatorKeywordsRegexp = wordRegexp(wordOperatorKeywords_), blockKeywords = keySet(blockKeywords_), vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/i), commonAtoms = keySet(commonAtoms_), firstWordMatch = "", states = {}, ch, style2, type, override;
89827
+ CodeMirror3.defineMode("stylus", function(config2) {
89828
+ var indentUnit = config2.indentUnit, indentUnitString = "", tagKeywords = keySet(tagKeywords_), tagVariablesRegexp = /^(a|b|i|s|col|em)$/i, propertyKeywords = keySet(propertyKeywords_), nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_), valueKeywords = keySet(valueKeywords_), colorKeywords = keySet(colorKeywords_), documentTypes = keySet(documentTypes_), documentTypesRegexp = wordRegexp(documentTypes_), mediaFeatures = keySet(mediaFeatures_), mediaTypes = keySet(mediaTypes_), fontProperties = keySet(fontProperties_), operatorsRegexp = /^\s*([.]{2,3}|&&|\|\||\*\*|[?!=:]?=|[-+*\/%<>]=?|\?:|\~)/, wordOperatorKeywordsRegexp = wordRegexp(wordOperatorKeywords_), blockKeywords = keySet(blockKeywords_), vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/i), commonAtoms = keySet(commonAtoms_), firstWordMatch = "", states = {}, ch, style2, type, override;
89685
89829
  while (indentUnitString.length < indentUnit)
89686
89830
  indentUnitString += " ";
89687
89831
  function tokenBase(stream, state) {
@@ -90298,7 +90442,7 @@
90298
90442
  mod(CodeMirror);
90299
90443
  })(function(CodeMirror3) {
90300
90444
  "use strict";
90301
- CodeMirror3.defineMode("pug", function(config) {
90445
+ CodeMirror3.defineMode("pug", function(config2) {
90302
90446
  var KEYWORD = "keyword";
90303
90447
  var DOCTYPE = "meta";
90304
90448
  var ID = "builtin";
@@ -90308,7 +90452,7 @@
90308
90452
  "(": ")",
90309
90453
  "[": "]"
90310
90454
  };
90311
- var jsMode = CodeMirror3.getMode(config, "javascript");
90455
+ var jsMode = CodeMirror3.getMode(config2, "javascript");
90312
90456
  function State2() {
90313
90457
  this.javaScriptLine = false;
90314
90458
  this.javaScriptLineExcludesColon = false;
@@ -90567,14 +90711,14 @@
90567
90711
  function filter2(stream, state) {
90568
90712
  if (stream.match(/^:([\w\-]+)/)) {
90569
90713
  var innerMode2;
90570
- if (config && config.innerModes) {
90571
- innerMode2 = config.innerModes(stream.current().substring(1));
90714
+ if (config2 && config2.innerModes) {
90715
+ innerMode2 = config2.innerModes(stream.current().substring(1));
90572
90716
  }
90573
90717
  if (!innerMode2) {
90574
90718
  innerMode2 = stream.current().substring(1);
90575
90719
  }
90576
90720
  if (typeof innerMode2 === "string") {
90577
- innerMode2 = CodeMirror3.getMode(config, innerMode2);
90721
+ innerMode2 = CodeMirror3.getMode(config2, innerMode2);
90578
90722
  }
90579
90723
  setInnerMode(stream, state, innerMode2);
90580
90724
  return "atom";
@@ -90700,9 +90844,9 @@
90700
90844
  }
90701
90845
  function setInnerMode(stream, state, mode) {
90702
90846
  mode = CodeMirror3.mimeModes[mode] || mode;
90703
- mode = config.innerModes ? config.innerModes(mode) || mode : mode;
90847
+ mode = config2.innerModes ? config2.innerModes(mode) || mode : mode;
90704
90848
  mode = CodeMirror3.mimeModes[mode] || mode;
90705
- mode = CodeMirror3.getMode(config, mode);
90849
+ mode = CodeMirror3.getMode(config2, mode);
90706
90850
  state.indentOf = stream.indentation();
90707
90851
  if (mode && mode.name !== "null") {
90708
90852
  state.innerMode = mode;
@@ -90934,12 +91078,12 @@
90934
91078
  blockCommentEnd: "--}}"
90935
91079
  }
90936
91080
  });
90937
- CodeMirror3.defineMode("handlebars", function(config, parserConfig) {
90938
- var handlebars = CodeMirror3.getMode(config, "handlebars-tags");
91081
+ CodeMirror3.defineMode("handlebars", function(config2, parserConfig) {
91082
+ var handlebars = CodeMirror3.getMode(config2, "handlebars-tags");
90939
91083
  if (!parserConfig || !parserConfig.base)
90940
91084
  return handlebars;
90941
91085
  return CodeMirror3.multiplexingMode(
90942
- CodeMirror3.getMode(config, parserConfig.base),
91086
+ CodeMirror3.getMode(config2, parserConfig.base),
90943
91087
  { open: "{{", close: /\}\}\}?/, mode: handlebars, parseDelimiters: true }
90944
91088
  );
90945
91089
  });
@@ -91010,7 +91154,7 @@
91010
91154
  [null, null, "vue-template"]
91011
91155
  ]
91012
91156
  };
91013
- CodeMirror3.defineMode("vue-template", function(config, parserConfig) {
91157
+ CodeMirror3.defineMode("vue-template", function(config2, parserConfig) {
91014
91158
  var mustacheOverlay = {
91015
91159
  token: function(stream) {
91016
91160
  if (stream.match(/^\{\{.*?\}\}/))
@@ -91020,10 +91164,10 @@
91020
91164
  return null;
91021
91165
  }
91022
91166
  };
91023
- return CodeMirror3.overlayMode(CodeMirror3.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
91167
+ return CodeMirror3.overlayMode(CodeMirror3.getMode(config2, parserConfig.backdrop || "text/html"), mustacheOverlay);
91024
91168
  });
91025
- CodeMirror3.defineMode("vue", function(config) {
91026
- return CodeMirror3.getMode(config, { name: "htmlmixed", tags: tagLanguages });
91169
+ CodeMirror3.defineMode("vue", function(config2) {
91170
+ return CodeMirror3.getMode(config2, { name: "htmlmixed", tags: tagLanguages });
91027
91171
  }, "htmlmixed", "xml", "javascript", "coffeescript", "css", "sass", "stylus", "pug", "handlebars");
91028
91172
  CodeMirror3.defineMIME("script/x-vue", "vue");
91029
91173
  CodeMirror3.defineMIME("text/x-vue", "vue");
@@ -93640,16 +93784,16 @@
93640
93784
  ];
93641
93785
  reverseUnits = orderedUnits.slice(0).reverse();
93642
93786
  Duration = class {
93643
- constructor(config) {
93644
- const accurate = config.conversionAccuracy === "longterm" || false;
93787
+ constructor(config2) {
93788
+ const accurate = config2.conversionAccuracy === "longterm" || false;
93645
93789
  let matrix = accurate ? accurateMatrix : casualMatrix;
93646
- if (config.matrix) {
93647
- matrix = config.matrix;
93790
+ if (config2.matrix) {
93791
+ matrix = config2.matrix;
93648
93792
  }
93649
- this.values = config.values;
93650
- this.loc = config.loc || Locale.create();
93793
+ this.values = config2.values;
93794
+ this.loc = config2.loc || Locale.create();
93651
93795
  this.conversionAccuracy = accurate ? "longterm" : "casual";
93652
- this.invalid = config.invalid || null;
93796
+ this.invalid = config2.invalid || null;
93653
93797
  this.matrix = matrix;
93654
93798
  this.isLuxonDuration = true;
93655
93799
  }
@@ -94029,10 +94173,10 @@
94029
94173
  init_formats();
94030
94174
  INVALID2 = "Invalid Interval";
94031
94175
  Interval = class {
94032
- constructor(config) {
94033
- this.s = config.start;
94034
- this.e = config.end;
94035
- this.invalid = config.invalid || null;
94176
+ constructor(config2) {
94177
+ this.s = config2.start;
94178
+ this.e = config2.end;
94179
+ this.invalid = config2.invalid || null;
94036
94180
  this.isLuxonInterval = true;
94037
94181
  }
94038
94182
  static invalid(reason, explanation = null) {
@@ -95203,17 +95347,17 @@
95203
95347
  orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
95204
95348
  zoneOffsetGuessCache = {};
95205
95349
  DateTime = class {
95206
- constructor(config) {
95207
- const zone = config.zone || Settings.defaultZone;
95208
- let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null);
95209
- this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;
95350
+ constructor(config2) {
95351
+ const zone = config2.zone || Settings.defaultZone;
95352
+ let invalid = config2.invalid || (Number.isNaN(config2.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null);
95353
+ this.ts = isUndefined(config2.ts) ? Settings.now() : config2.ts;
95210
95354
  let c4 = null, o5 = null;
95211
95355
  if (!invalid) {
95212
- const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
95356
+ const unchanged = config2.old && config2.old.ts === this.ts && config2.old.zone.equals(zone);
95213
95357
  if (unchanged) {
95214
- [c4, o5] = [config.old.c, config.old.o];
95358
+ [c4, o5] = [config2.old.c, config2.old.o];
95215
95359
  } else {
95216
- const ot2 = isNumber2(config.o) && !config.old ? config.o : zone.offset(this.ts);
95360
+ const ot2 = isNumber2(config2.o) && !config2.old ? config2.o : zone.offset(this.ts);
95217
95361
  c4 = tsToObj(this.ts, ot2);
95218
95362
  invalid = Number.isNaN(c4.year) ? new Invalid("invalid input") : null;
95219
95363
  c4 = invalid ? null : c4;
@@ -95221,7 +95365,7 @@
95221
95365
  }
95222
95366
  }
95223
95367
  this._zone = zone;
95224
- this.loc = config.loc || Locale.create();
95368
+ this.loc = config2.loc || Locale.create();
95225
95369
  this.invalid = invalid;
95226
95370
  this.weekData = null;
95227
95371
  this.localWeekData = null;
@@ -96459,14 +96603,14 @@
96459
96603
  }
96460
96604
  return date1.getTime() - date2.getTime();
96461
96605
  }
96462
- function getDefaultHours(config) {
96463
- var hours = config.defaultHour;
96464
- var minutes = config.defaultMinute;
96465
- var seconds = config.defaultSeconds;
96466
- if (config.minDate !== void 0) {
96467
- var minHour = config.minDate.getHours();
96468
- var minMinutes = config.minDate.getMinutes();
96469
- var minSeconds = config.minDate.getSeconds();
96606
+ function getDefaultHours(config2) {
96607
+ var hours = config2.defaultHour;
96608
+ var minutes = config2.defaultMinute;
96609
+ var seconds = config2.defaultSeconds;
96610
+ if (config2.minDate !== void 0) {
96611
+ var minHour = config2.minDate.getHours();
96612
+ var minMinutes = config2.minDate.getMinutes();
96613
+ var minSeconds = config2.minDate.getSeconds();
96470
96614
  if (hours < minHour) {
96471
96615
  hours = minHour;
96472
96616
  }
@@ -96474,16 +96618,16 @@
96474
96618
  minutes = minMinutes;
96475
96619
  }
96476
96620
  if (hours === minHour && minutes === minMinutes && seconds < minSeconds)
96477
- seconds = config.minDate.getSeconds();
96621
+ seconds = config2.minDate.getSeconds();
96478
96622
  }
96479
- if (config.maxDate !== void 0) {
96480
- var maxHr = config.maxDate.getHours();
96481
- var maxMinutes = config.maxDate.getMinutes();
96623
+ if (config2.maxDate !== void 0) {
96624
+ var maxHr = config2.maxDate.getHours();
96625
+ var maxMinutes = config2.maxDate.getMinutes();
96482
96626
  hours = Math.min(hours, maxHr);
96483
96627
  if (hours === maxHr)
96484
96628
  minutes = Math.min(maxMinutes, minutes);
96485
96629
  if (hours === maxHr && minutes === maxMinutes)
96486
- seconds = config.maxDate.getSeconds();
96630
+ seconds = config2.maxDate.getSeconds();
96487
96631
  }
96488
96632
  return { hours, minutes, seconds };
96489
96633
  }
@@ -96494,19 +96638,19 @@
96494
96638
  init_options();
96495
96639
  init_default();
96496
96640
  createDateFormatter = function(_a) {
96497
- var _b = _a.config, config = _b === void 0 ? defaults2 : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d;
96641
+ var _b = _a.config, config2 = _b === void 0 ? defaults2 : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d;
96498
96642
  return function(dateObj, frmt, overrideLocale) {
96499
96643
  var locale2 = overrideLocale || l10n;
96500
- if (config.formatDate !== void 0 && !isMobile) {
96501
- return config.formatDate(dateObj, frmt, locale2);
96644
+ if (config2.formatDate !== void 0 && !isMobile) {
96645
+ return config2.formatDate(dateObj, frmt, locale2);
96502
96646
  }
96503
96647
  return frmt.split("").map(function(c4, i5, arr) {
96504
- return formats[c4] && arr[i5 - 1] !== "\\" ? formats[c4](dateObj, locale2, config) : c4 !== "\\" ? c4 : "";
96648
+ return formats[c4] && arr[i5 - 1] !== "\\" ? formats[c4](dateObj, locale2, config2) : c4 !== "\\" ? c4 : "";
96505
96649
  }).join("");
96506
96650
  };
96507
96651
  };
96508
96652
  createDateParser = function(_a) {
96509
- var _b = _a.config, config = _b === void 0 ? defaults2 : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
96653
+ var _b = _a.config, config2 = _b === void 0 ? defaults2 : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
96510
96654
  return function(date, givenFormat, timeless, customLocale) {
96511
96655
  if (date !== 0 && !date)
96512
96656
  return void 0;
@@ -96518,13 +96662,13 @@
96518
96662
  else if (typeof date !== "string" && date.toFixed !== void 0)
96519
96663
  parsedDate = new Date(date);
96520
96664
  else if (typeof date === "string") {
96521
- var format2 = givenFormat || (config || defaults2).dateFormat;
96665
+ var format2 = givenFormat || (config2 || defaults2).dateFormat;
96522
96666
  var datestr = String(date).trim();
96523
96667
  if (datestr === "today") {
96524
96668
  parsedDate = new Date();
96525
96669
  timeless = true;
96526
- } else if (config && config.parseDate) {
96527
- parsedDate = config.parseDate(date, format2);
96670
+ } else if (config2 && config2.parseDate) {
96671
+ parsedDate = config2.parseDate(date, format2);
96528
96672
  } else if (/Z$/.test(datestr) || /GMT$/.test(datestr)) {
96529
96673
  parsedDate = new Date(date);
96530
96674
  } else {
@@ -96545,7 +96689,7 @@
96545
96689
  } else if (!isBackSlash)
96546
96690
  regexStr += ".";
96547
96691
  }
96548
- parsedDate = !config || !config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0));
96692
+ parsedDate = !config2 || !config2.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0));
96549
96693
  ops.forEach(function(_a2) {
96550
96694
  var fn3 = _a2.fn, val = _a2.val;
96551
96695
  return parsedDate = fn3(parsedDate, val, locale2) || parsedDate;
@@ -96554,7 +96698,7 @@
96554
96698
  }
96555
96699
  }
96556
96700
  if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {
96557
- config.errorHandler(new Error("Invalid date provided: " + dateOrig));
96701
+ config2.errorHandler(new Error("Invalid date provided: " + dateOrig));
96558
96702
  return void 0;
96559
96703
  }
96560
96704
  if (timeless === true)
@@ -96684,17 +96828,17 @@
96684
96828
  return fn3.bind(self2);
96685
96829
  }
96686
96830
  function setCalendarWidth() {
96687
- var config = self2.config;
96688
- if (config.weekNumbers === false && config.showMonths === 1) {
96831
+ var config2 = self2.config;
96832
+ if (config2.weekNumbers === false && config2.showMonths === 1) {
96689
96833
  return;
96690
- } else if (config.noCalendar !== true) {
96834
+ } else if (config2.noCalendar !== true) {
96691
96835
  window.requestAnimationFrame(function() {
96692
96836
  if (self2.calendarContainer !== void 0) {
96693
96837
  self2.calendarContainer.style.visibility = "hidden";
96694
96838
  self2.calendarContainer.style.display = "block";
96695
96839
  }
96696
96840
  if (self2.daysContainer !== void 0) {
96697
- var daysWidth = (self2.days.offsetWidth + 1) * config.showMonths;
96841
+ var daysWidth = (self2.days.offsetWidth + 1) * config2.showMonths;
96698
96842
  self2.daysContainer.style.width = daysWidth + "px";
96699
96843
  self2.calendarContainer.style.width = daysWidth + (self2.weekWrapper !== void 0 ? self2.weekWrapper.offsetWidth : 0) + "px";
96700
96844
  self2.calendarContainer.style.removeProperty("visibility");
@@ -98309,7 +98453,7 @@
98309
98453
  init3();
98310
98454
  return self2;
98311
98455
  }
98312
- function _flatpickr(nodeList, config) {
98456
+ function _flatpickr(nodeList, config2) {
98313
98457
  var nodes = Array.prototype.slice.call(nodeList).filter(function(x4) {
98314
98458
  return x4 instanceof HTMLElement;
98315
98459
  });
@@ -98323,7 +98467,7 @@
98323
98467
  node._flatpickr.destroy();
98324
98468
  node._flatpickr = void 0;
98325
98469
  }
98326
- node._flatpickr = FlatpickrInstance(node, config || {});
98470
+ node._flatpickr = FlatpickrInstance(node, config2 || {});
98327
98471
  instances2.push(node._flatpickr);
98328
98472
  } catch (e5) {
98329
98473
  console.error(e5);
@@ -98363,20 +98507,20 @@
98363
98507
  };
98364
98508
  DEBOUNCED_CHANGE_MS = 300;
98365
98509
  if (typeof HTMLElement !== "undefined" && typeof HTMLCollection !== "undefined" && typeof NodeList !== "undefined") {
98366
- HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function(config) {
98367
- return _flatpickr(this, config);
98510
+ HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function(config2) {
98511
+ return _flatpickr(this, config2);
98368
98512
  };
98369
- HTMLElement.prototype.flatpickr = function(config) {
98370
- return _flatpickr([this], config);
98513
+ HTMLElement.prototype.flatpickr = function(config2) {
98514
+ return _flatpickr([this], config2);
98371
98515
  };
98372
98516
  }
98373
- flatpickr = function(selector, config) {
98517
+ flatpickr = function(selector, config2) {
98374
98518
  if (typeof selector === "string") {
98375
- return _flatpickr(window.document.querySelectorAll(selector), config);
98519
+ return _flatpickr(window.document.querySelectorAll(selector), config2);
98376
98520
  } else if (selector instanceof Node) {
98377
- return _flatpickr([selector], config);
98521
+ return _flatpickr([selector], config2);
98378
98522
  } else {
98379
- return _flatpickr(selector, config);
98523
+ return _flatpickr(selector, config2);
98380
98524
  }
98381
98525
  };
98382
98526
  flatpickr.defaultConfig = {};
@@ -98387,15 +98531,15 @@
98387
98531
  flatpickr.localize = function(l10n) {
98388
98532
  flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);
98389
98533
  };
98390
- flatpickr.setDefaults = function(config) {
98391
- flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);
98534
+ flatpickr.setDefaults = function(config2) {
98535
+ flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config2);
98392
98536
  };
98393
98537
  flatpickr.parseDate = createDateParser({});
98394
98538
  flatpickr.formatDate = createDateFormatter({});
98395
98539
  flatpickr.compareDates = compareDates;
98396
98540
  if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") {
98397
- jQuery.fn.flatpickr = function(config) {
98398
- return _flatpickr(this, config);
98541
+ jQuery.fn.flatpickr = function(config2) {
98542
+ return _flatpickr(this, config2);
98399
98543
  };
98400
98544
  }
98401
98545
  Date.prototype.fp_incr = function(days) {
@@ -109618,12 +109762,12 @@
109618
109762
  };
109619
109763
  CodeMirror3.defineMode("xml", function(editorConf, config_) {
109620
109764
  var indentUnit = editorConf.indentUnit;
109621
- var config = {};
109765
+ var config2 = {};
109622
109766
  var defaults4 = config_.htmlMode ? htmlConfig : xmlConfig;
109623
109767
  for (var prop in defaults4)
109624
- config[prop] = defaults4[prop];
109768
+ config2[prop] = defaults4[prop];
109625
109769
  for (var prop in config_)
109626
- config[prop] = config_[prop];
109770
+ config2[prop] = config_[prop];
109627
109771
  var type, setStyle3;
109628
109772
  function inText(stream, state) {
109629
109773
  function chain(parser) {
@@ -109750,7 +109894,7 @@
109750
109894
  this.tagName = tagName || "";
109751
109895
  this.indent = state.indented;
109752
109896
  this.startOfLine = startOfLine;
109753
- if (config.doNotIndent.hasOwnProperty(tagName) || state.context && state.context.noIndent)
109897
+ if (config2.doNotIndent.hasOwnProperty(tagName) || state.context && state.context.noIndent)
109754
109898
  this.noIndent = true;
109755
109899
  }
109756
109900
  function popContext(state) {
@@ -109764,7 +109908,7 @@
109764
109908
  return;
109765
109909
  }
109766
109910
  parentTagName = state.context.tagName;
109767
- if (!config.contextGrabbers.hasOwnProperty(lower(parentTagName)) || !config.contextGrabbers[lower(parentTagName)].hasOwnProperty(lower(nextTagName))) {
109911
+ if (!config2.contextGrabbers.hasOwnProperty(lower(parentTagName)) || !config2.contextGrabbers[lower(parentTagName)].hasOwnProperty(lower(nextTagName))) {
109768
109912
  return;
109769
109913
  }
109770
109914
  popContext(state);
@@ -109785,7 +109929,7 @@
109785
109929
  state.tagName = stream.current();
109786
109930
  setStyle3 = "tag";
109787
109931
  return attrState;
109788
- } else if (config.allowMissingTagName && type2 == "endTag") {
109932
+ } else if (config2.allowMissingTagName && type2 == "endTag") {
109789
109933
  setStyle3 = "tag bracket";
109790
109934
  return attrState(type2, stream, state);
109791
109935
  } else {
@@ -109796,16 +109940,16 @@
109796
109940
  function closeTagNameState(type2, stream, state) {
109797
109941
  if (type2 == "word") {
109798
109942
  var tagName = stream.current();
109799
- if (state.context && state.context.tagName != tagName && config.implicitlyClosed.hasOwnProperty(lower(state.context.tagName)))
109943
+ if (state.context && state.context.tagName != tagName && config2.implicitlyClosed.hasOwnProperty(lower(state.context.tagName)))
109800
109944
  popContext(state);
109801
- if (state.context && state.context.tagName == tagName || config.matchClosing === false) {
109945
+ if (state.context && state.context.tagName == tagName || config2.matchClosing === false) {
109802
109946
  setStyle3 = "tag";
109803
109947
  return closeState;
109804
109948
  } else {
109805
109949
  setStyle3 = "tag error";
109806
109950
  return closeStateErr;
109807
109951
  }
109808
- } else if (config.allowMissingTagName && type2 == "endTag") {
109952
+ } else if (config2.allowMissingTagName && type2 == "endTag") {
109809
109953
  setStyle3 = "tag bracket";
109810
109954
  return closeState(type2, stream, state);
109811
109955
  } else {
@@ -109832,7 +109976,7 @@
109832
109976
  } else if (type2 == "endTag" || type2 == "selfcloseTag") {
109833
109977
  var tagName = state.tagName, tagStart = state.tagStart;
109834
109978
  state.tagName = state.tagStart = null;
109835
- if (type2 == "selfcloseTag" || config.autoSelfClosers.hasOwnProperty(lower(tagName))) {
109979
+ if (type2 == "selfcloseTag" || config2.autoSelfClosers.hasOwnProperty(lower(tagName))) {
109836
109980
  maybePopContext(state, tagName);
109837
109981
  } else {
109838
109982
  maybePopContext(state, tagName);
@@ -109846,14 +109990,14 @@
109846
109990
  function attrEqState(type2, stream, state) {
109847
109991
  if (type2 == "equals")
109848
109992
  return attrValueState;
109849
- if (!config.allowMissing)
109993
+ if (!config2.allowMissing)
109850
109994
  setStyle3 = "error";
109851
109995
  return attrState(type2, stream, state);
109852
109996
  }
109853
109997
  function attrValueState(type2, stream, state) {
109854
109998
  if (type2 == "string")
109855
109999
  return attrContinuedState;
109856
- if (type2 == "word" && config.allowUnquoted) {
110000
+ if (type2 == "word" && config2.allowUnquoted) {
109857
110001
  setStyle3 = "string";
109858
110002
  return attrState;
109859
110003
  }
@@ -109907,12 +110051,12 @@
109907
110051
  if (state.tokenize != inTag && state.tokenize != inText)
109908
110052
  return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
109909
110053
  if (state.tagName) {
109910
- if (config.multilineTagIndentPastTag !== false)
110054
+ if (config2.multilineTagIndentPastTag !== false)
109911
110055
  return state.tagStart + state.tagName.length + 2;
109912
110056
  else
109913
- return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
110057
+ return state.tagStart + indentUnit * (config2.multilineTagIndentFactor || 1);
109914
110058
  }
109915
- if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter))
110059
+ if (config2.alignCDATA && /<!\[CDATA\[/.test(textAfter))
109916
110060
  return 0;
109917
110061
  var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
109918
110062
  if (tagAfter && tagAfter[1]) {
@@ -109920,7 +110064,7 @@
109920
110064
  if (context.tagName == tagAfter[2]) {
109921
110065
  context = context.prev;
109922
110066
  break;
109923
- } else if (config.implicitlyClosed.hasOwnProperty(lower(context.tagName))) {
110067
+ } else if (config2.implicitlyClosed.hasOwnProperty(lower(context.tagName))) {
109924
110068
  context = context.prev;
109925
110069
  } else {
109926
110070
  break;
@@ -109928,7 +110072,7 @@
109928
110072
  }
109929
110073
  } else if (tagAfter) {
109930
110074
  while (context) {
109931
- var grabbers = config.contextGrabbers[lower(context.tagName)];
110075
+ var grabbers = config2.contextGrabbers[lower(context.tagName)];
109932
110076
  if (grabbers && grabbers.hasOwnProperty(lower(tagAfter[2])))
109933
110077
  context = context.prev;
109934
110078
  else
@@ -109945,8 +110089,8 @@
109945
110089
  electricInput: /<\/[\s\w:]+>$/,
109946
110090
  blockCommentStart: "<!--",
109947
110091
  blockCommentEnd: "-->",
109948
- configuration: config.htmlMode ? "html" : "xml",
109949
- helperType: config.htmlMode ? "html" : "xml",
110092
+ configuration: config2.htmlMode ? "html" : "xml",
110093
+ helperType: config2.htmlMode ? "html" : "xml",
109950
110094
  skipAttribute: function(state) {
109951
110095
  if (state.state == attrValueState)
109952
110096
  state.state = attrState;
@@ -111662,7 +111806,7 @@
111662
111806
  })(function(CodeMirror3) {
111663
111807
  "use strict";
111664
111808
  var urlRE = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;
111665
- CodeMirror3.defineMode("gfm", function(config, modeConfig) {
111809
+ CodeMirror3.defineMode("gfm", function(config2, modeConfig) {
111666
111810
  var codeDepth = 0;
111667
111811
  function blankLine(state) {
111668
111812
  state.code = false;
@@ -111753,7 +111897,7 @@
111753
111897
  markdownConfig[attr] = modeConfig[attr];
111754
111898
  }
111755
111899
  markdownConfig.name = "markdown";
111756
- return CodeMirror3.overlayMode(CodeMirror3.getMode(config, markdownConfig), gfmOverlay);
111900
+ return CodeMirror3.overlayMode(CodeMirror3.getMode(config2, markdownConfig), gfmOverlay);
111757
111901
  }, "markdown");
111758
111902
  CodeMirror3.defineMIME("text/x-gfm", "gfm");
111759
111903
  });
@@ -112355,7 +112499,7 @@
112355
112499
  return String.prototype.indexOf.apply(this, arguments) !== -1;
112356
112500
  };
112357
112501
  }
112358
- options.codeMirrorInstance.defineMode("spell-checker", function(config) {
112502
+ options.codeMirrorInstance.defineMode("spell-checker", function(config2) {
112359
112503
  if (!CodeMirrorSpellChecker.aff_loading) {
112360
112504
  CodeMirrorSpellChecker.aff_loading = true;
112361
112505
  var xhr_aff = new XMLHttpRequest();
@@ -112409,8 +112553,8 @@
112409
112553
  }
112410
112554
  };
112411
112555
  var mode = options.codeMirrorInstance.getMode(
112412
- config,
112413
- config.backdrop || "text/plain"
112556
+ config2,
112557
+ config2.backdrop || "text/plain"
112414
112558
  );
112415
112559
  return options.codeMirrorInstance.overlayMode(mode, overlay, true);
112416
112560
  });
@@ -116280,8 +116424,8 @@
116280
116424
  document.addEventListener("keydown", this.documentOnKeyDown, false);
116281
116425
  var mode, backdrop;
116282
116426
  if (options.overlayMode) {
116283
- CodeMirror3.defineMode("overlay-mode", function(config) {
116284
- return CodeMirror3.overlayMode(CodeMirror3.getMode(config, options.spellChecker !== false ? "spell-checker" : "gfm"), options.overlayMode.mode, options.overlayMode.combine);
116427
+ CodeMirror3.defineMode("overlay-mode", function(config2) {
116428
+ return CodeMirror3.overlayMode(CodeMirror3.getMode(config2, options.spellChecker !== false ? "spell-checker" : "gfm"), options.overlayMode.mode, options.overlayMode.combine);
116285
116429
  });
116286
116430
  mode = "overlay-mode";
116287
116431
  backdrop = options.parsingConfig;
@@ -117364,7 +117508,7 @@
117364
117508
  const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
117365
117509
  const text = freeze(["#text"]);
117366
117510
  const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
117367
- const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
117511
+ const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
117368
117512
  const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
117369
117513
  const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
117370
117514
  const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
@@ -117438,7 +117582,7 @@
117438
117582
  function createDOMPurify() {
117439
117583
  let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
117440
117584
  const DOMPurify2 = (root) => createDOMPurify(root);
117441
- DOMPurify2.version = "3.1.6";
117585
+ DOMPurify2.version = "3.1.7";
117442
117586
  DOMPurify2.removed = [];
117443
117587
  if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document) {
117444
117588
  DOMPurify2.isSupported = false;
@@ -117702,7 +117846,7 @@
117702
117846
  CONFIG = cfg;
117703
117847
  };
117704
117848
  const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
117705
- const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "annotation-xml"]);
117849
+ const HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
117706
117850
  const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
117707
117851
  const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
117708
117852
  const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
@@ -117977,10 +118121,6 @@
117977
118121
  hookEvent.forceKeepAttr = void 0;
117978
118122
  _executeHook("uponSanitizeAttribute", currentNode, hookEvent);
117979
118123
  value = hookEvent.attrValue;
117980
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
117981
- _removeAttribute(name, currentNode);
117982
- continue;
117983
- }
117984
118124
  if (hookEvent.forceKeepAttr) {
117985
118125
  continue;
117986
118126
  }
@@ -118005,6 +118145,10 @@
118005
118145
  _removeAttribute(name, currentNode);
118006
118146
  value = SANITIZE_NAMED_PROPS_PREFIX + value;
118007
118147
  }
118148
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
118149
+ _removeAttribute(name, currentNode);
118150
+ continue;
118151
+ }
118008
118152
  if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
118009
118153
  if (namespaceURI)
118010
118154
  ;
@@ -138230,24 +138374,24 @@
138230
138374
  };
138231
138375
  baseFields = [
138232
138376
  new FieldDesc("doc", {
138233
- init(config) {
138234
- return config.doc || config.schema.topNodeType.createAndFill();
138377
+ init(config2) {
138378
+ return config2.doc || config2.schema.topNodeType.createAndFill();
138235
138379
  },
138236
138380
  apply(tr2) {
138237
138381
  return tr2.doc;
138238
138382
  }
138239
138383
  }),
138240
138384
  new FieldDesc("selection", {
138241
- init(config, instance) {
138242
- return config.selection || Selection.atStart(instance.doc);
138385
+ init(config2, instance) {
138386
+ return config2.selection || Selection.atStart(instance.doc);
138243
138387
  },
138244
138388
  apply(tr2) {
138245
138389
  return tr2.selection;
138246
138390
  }
138247
138391
  }),
138248
138392
  new FieldDesc("storedMarks", {
138249
- init(config) {
138250
- return config.storedMarks || null;
138393
+ init(config2) {
138394
+ return config2.storedMarks || null;
138251
138395
  },
138252
138396
  apply(tr2, _marks, _old, state) {
138253
138397
  return state.selection.$cursor ? tr2.storedMarks : null;
@@ -138280,8 +138424,8 @@
138280
138424
  }
138281
138425
  };
138282
138426
  EditorState = class {
138283
- constructor(config) {
138284
- this.config = config;
138427
+ constructor(config2) {
138428
+ this.config = config2;
138285
138429
  }
138286
138430
  get schema() {
138287
138431
  return this.config.schema;
@@ -138344,19 +138488,19 @@
138344
138488
  get tr() {
138345
138489
  return new Transaction(this);
138346
138490
  }
138347
- static create(config) {
138348
- let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);
138491
+ static create(config2) {
138492
+ let $config = new Configuration(config2.doc ? config2.doc.type.schema : config2.schema, config2.plugins);
138349
138493
  let instance = new EditorState($config);
138350
138494
  for (let i5 = 0; i5 < $config.fields.length; i5++)
138351
- instance[$config.fields[i5].name] = $config.fields[i5].init(config, instance);
138495
+ instance[$config.fields[i5].name] = $config.fields[i5].init(config2, instance);
138352
138496
  return instance;
138353
138497
  }
138354
- reconfigure(config) {
138355
- let $config = new Configuration(this.schema, config.plugins);
138498
+ reconfigure(config2) {
138499
+ let $config = new Configuration(this.schema, config2.plugins);
138356
138500
  let fields = $config.fields, instance = new EditorState($config);
138357
138501
  for (let i5 = 0; i5 < fields.length; i5++) {
138358
138502
  let name = fields[i5].name;
138359
- instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i5].init(config, instance);
138503
+ instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i5].init(config2, instance);
138360
138504
  }
138361
138505
  return instance;
138362
138506
  }
@@ -138374,31 +138518,31 @@
138374
138518
  }
138375
138519
  return result;
138376
138520
  }
138377
- static fromJSON(config, json, pluginFields) {
138521
+ static fromJSON(config2, json, pluginFields) {
138378
138522
  if (!json)
138379
138523
  throw new RangeError("Invalid input for EditorState.fromJSON");
138380
- if (!config.schema)
138524
+ if (!config2.schema)
138381
138525
  throw new RangeError("Required config field 'schema' missing");
138382
- let $config = new Configuration(config.schema, config.plugins);
138526
+ let $config = new Configuration(config2.schema, config2.plugins);
138383
138527
  let instance = new EditorState($config);
138384
138528
  $config.fields.forEach((field) => {
138385
138529
  if (field.name == "doc") {
138386
- instance.doc = Node2.fromJSON(config.schema, json.doc);
138530
+ instance.doc = Node2.fromJSON(config2.schema, json.doc);
138387
138531
  } else if (field.name == "selection") {
138388
138532
  instance.selection = Selection.fromJSON(instance.doc, json.selection);
138389
138533
  } else if (field.name == "storedMarks") {
138390
138534
  if (json.storedMarks)
138391
- instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);
138535
+ instance.storedMarks = json.storedMarks.map(config2.schema.markFromJSON);
138392
138536
  } else {
138393
138537
  if (pluginFields)
138394
138538
  for (let prop in pluginFields) {
138395
138539
  let plugin = pluginFields[prop], state = plugin.spec.state;
138396
138540
  if (plugin.key == field.name && state && state.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) {
138397
- instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);
138541
+ instance[field.name] = state.fromJSON.call(plugin, config2, json[prop], instance);
138398
138542
  return;
138399
138543
  }
138400
138544
  }
138401
- instance[field.name] = field.init(config, instance);
138545
+ instance[field.name] = field.init(config2, instance);
138402
138546
  }
138403
138547
  });
138404
138548
  return instance;
@@ -139110,14 +139254,14 @@
139110
139254
  try {
139111
139255
  let pos = doc4.caretPositionFromPoint(x4, y4);
139112
139256
  if (pos)
139113
- return { node: pos.offsetNode, offset: pos.offset };
139257
+ return { node: pos.offsetNode, offset: Math.min(nodeSize(pos.offsetNode), pos.offset) };
139114
139258
  } catch (_3) {
139115
139259
  }
139116
139260
  }
139117
139261
  if (doc4.caretRangeFromPoint) {
139118
139262
  let range2 = doc4.caretRangeFromPoint(x4, y4);
139119
139263
  if (range2)
139120
- return { node: range2.startContainer, offset: range2.startOffset };
139264
+ return { node: range2.startContainer, offset: Math.min(nodeSize(range2.startContainer), range2.startOffset) };
139121
139265
  }
139122
139266
  }
139123
139267
  function windowRect(doc4) {
@@ -139548,6 +139692,8 @@
139548
139692
  return false;
139549
139693
  let offset3 = $head.parentOffset, atStart = !offset3, atEnd = offset3 == $head.parent.content.size;
139550
139694
  let sel = view.domSelection();
139695
+ if (!sel)
139696
+ return $head.pos == $head.start() || $head.pos == $head.end();
139551
139697
  if (!maybeRTL.test($head.parent.textContent) || !sel.modify)
139552
139698
  return dir == "left" || dir == "backward" ? atStart : atEnd;
139553
139699
  return withFlushedState(view, state, () => {
@@ -139871,9 +140017,9 @@
139871
140017
  let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1);
139872
140018
  if (head < 0)
139873
140019
  return null;
139874
- let $head = doc4.resolve(head), $anchor, selection;
140020
+ let $head = doc4.resolve(head), anchor, selection;
139875
140021
  if (selectionCollapsed(domSel)) {
139876
- $anchor = $head;
140022
+ anchor = head;
139877
140023
  while (nearestDesc && !nearestDesc.node)
139878
140024
  nearestDesc = nearestDesc.parent;
139879
140025
  let nearestDescNode = nearestDesc.node;
@@ -139882,11 +140028,24 @@
139882
140028
  selection = new NodeSelection(head == pos ? $head : doc4.resolve(pos));
139883
140029
  }
139884
140030
  } else {
139885
- let anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);
140031
+ if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {
140032
+ let min2 = head, max2 = head;
140033
+ for (let i5 = 0; i5 < domSel.rangeCount; i5++) {
140034
+ let range2 = domSel.getRangeAt(i5);
140035
+ min2 = Math.min(min2, view.docView.posFromDOM(range2.startContainer, range2.startOffset, 1));
140036
+ max2 = Math.max(max2, view.docView.posFromDOM(range2.endContainer, range2.endOffset, -1));
140037
+ }
140038
+ if (min2 < 0)
140039
+ return null;
140040
+ [anchor, head] = max2 == view.state.selection.anchor ? [max2, min2] : [min2, max2];
140041
+ $head = doc4.resolve(head);
140042
+ } else {
140043
+ anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);
140044
+ }
139886
140045
  if (anchor < 0)
139887
140046
  return null;
139888
- $anchor = doc4.resolve(anchor);
139889
140047
  }
140048
+ let $anchor = doc4.resolve(anchor);
139890
140049
  if (!selection) {
139891
140050
  let bias = origin == "pointer" || view.state.selection.head < $head.pos && !inWidget ? 1 : -1;
139892
140051
  selection = selectionBetween(view, $anchor, $head, bias);
@@ -139983,12 +140142,14 @@
139983
140142
  }
139984
140143
  function selectCursorWrapper(view) {
139985
140144
  let domSel = view.domSelection(), range2 = document.createRange();
140145
+ if (!domSel)
140146
+ return;
139986
140147
  let node = view.cursorWrapper.dom, img = node.nodeName == "IMG";
139987
140148
  if (img)
139988
- range2.setEnd(node.parentNode, domIndex(node) + 1);
140149
+ range2.setStart(node.parentNode, domIndex(node) + 1);
139989
140150
  else
139990
- range2.setEnd(node, 0);
139991
- range2.collapse(false);
140151
+ range2.setStart(node, 0);
140152
+ range2.collapse(true);
139992
140153
  domSel.removeAllRanges();
139993
140154
  domSel.addRange(range2);
139994
140155
  if (!img && !view.state.selection.visible && ie && ie_version <= 11) {
@@ -140234,6 +140395,8 @@
140234
140395
  }
140235
140396
  }
140236
140397
  let sel = view.domSelection();
140398
+ if (!sel)
140399
+ return;
140237
140400
  if (selectionCollapsed(sel)) {
140238
140401
  let range2 = document.createRange();
140239
140402
  range2.setEnd(node, offset3);
@@ -140538,6 +140701,12 @@
140538
140701
  function detachedDoc() {
140539
140702
  return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument("title"));
140540
140703
  }
140704
+ function maybeWrapTrusted(html) {
140705
+ let trustedTypes = window.trustedTypes;
140706
+ if (!trustedTypes)
140707
+ return html;
140708
+ return trustedTypes.createPolicy("detachedDocument", { createHTML: (s6) => s6 }).createHTML(html);
140709
+ }
140541
140710
  function readHTML(html) {
140542
140711
  let metas = /^(\s*<meta [^>]*>)*/.exec(html);
140543
140712
  if (metas)
@@ -140546,7 +140715,7 @@
140546
140715
  let firstTag = /<([a-z][^>\s]+)/i.exec(html), wrap3;
140547
140716
  if (wrap3 = firstTag && wrapMap[firstTag[1].toLowerCase()])
140548
140717
  html = wrap3.map((n7) => "<" + n7 + ">").join("") + html + wrap3.map((n7) => "</" + n7 + ">").reverse().join("");
140549
- elt.innerHTML = html;
140718
+ elt.innerHTML = maybeWrapTrusted(html);
140550
140719
  if (wrap3)
140551
140720
  for (let i5 = 0; i5 < wrap3.length; i5++)
140552
140721
  elt = elt.querySelector(wrap3[i5]) || elt;
@@ -140650,6 +140819,8 @@
140650
140819
  function updateSelection(view, selection, origin) {
140651
140820
  if (!view.focused)
140652
140821
  view.focus();
140822
+ if (view.state.selection.eq(selection))
140823
+ return;
140653
140824
  let tr2 = view.state.tr.setSelection(selection);
140654
140825
  if (origin == "pointer")
140655
140826
  tr2.setMeta("pointer", true);
@@ -140772,15 +140943,17 @@
140772
140943
  event.initEvent("event", true, true);
140773
140944
  return event.timeStamp;
140774
140945
  }
140775
- function endComposition(view, forceUpdate = false) {
140946
+ function endComposition(view, restarting = false) {
140776
140947
  if (android && view.domObserver.flushingSoon >= 0)
140777
140948
  return;
140778
140949
  view.domObserver.forceFlush();
140779
140950
  clearComposition(view);
140780
- if (forceUpdate || view.docView && view.docView.dirty) {
140951
+ if (restarting || view.docView && view.docView.dirty) {
140781
140952
  let sel = selectionFromDOM(view);
140782
140953
  if (sel && !sel.eq(view.state.selection))
140783
140954
  view.dispatch(view.state.tr.setSelection(sel));
140955
+ else if ((view.markCursor || restarting) && !view.state.selection.empty)
140956
+ view.dispatch(view.state.tr.deleteSelection());
140784
140957
  else
140785
140958
  view.updateState(view.state);
140786
140959
  return true;
@@ -141181,6 +141354,8 @@
141181
141354
  }
141182
141355
  view.input.lastKeyCode = null;
141183
141356
  let change = findDiff(compare.content, parse4.doc.content, parse4.from, preferredPos, preferredSide);
141357
+ if (change)
141358
+ view.input.domChangeCount++;
141184
141359
  if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n7) => n7.nodeType == 1 && !isInline.test(n7.nodeName)) && (!change || change.endA >= change.endB) && view.someProp("handleKeyDown", (f4) => f4(view, keyEvent(13, "Enter")))) {
141185
141360
  view.input.lastIOSEnter = 0;
141186
141361
  return;
@@ -141201,7 +141376,6 @@
141201
141376
  return;
141202
141377
  }
141203
141378
  }
141204
- view.input.domChangeCount++;
141205
141379
  if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
141206
141380
  if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse4.from) {
141207
141381
  change.start = view.state.selection.from;
@@ -141395,7 +141569,7 @@
141395
141569
  dom.className = "ProseMirror-separator";
141396
141570
  dom.setAttribute("mark-placeholder", "true");
141397
141571
  dom.setAttribute("alt", "");
141398
- view.cursorWrapper = { dom, deco: Decoration.widget(view.state.selection.head, dom, { raw: true, marks: view.markCursor }) };
141572
+ view.cursorWrapper = { dom, deco: Decoration.widget(view.state.selection.from, dom, { raw: true, marks: view.markCursor }) };
141399
141573
  } else {
141400
141574
  view.cursorWrapper = null;
141401
141575
  }
@@ -142388,6 +142562,7 @@
142388
142562
  this.index++;
142389
142563
  return true;
142390
142564
  } else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {
142565
+ this.destroyBetween(this.index, i5);
142391
142566
  this.top.children[this.index] = updated;
142392
142567
  if (updated.contentDOM) {
142393
142568
  updated.dirty = CONTENT_DIRTY;
@@ -142404,7 +142579,7 @@
142404
142579
  return false;
142405
142580
  }
142406
142581
  recreateWrapper(next, node, outerDeco, innerDeco, view, pos) {
142407
- if (next.dirty || node.isAtom || !next.children.length || !next.node.content.eq(node.content))
142582
+ if (next.dirty || node.isAtom || !next.children.length || !next.node.content.eq(node.content) || !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco))
142408
142583
  return null;
142409
142584
  let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);
142410
142585
  if (wrapper.contentDOM) {
@@ -142520,7 +142695,9 @@
142520
142695
  view.input.lastKeyCodeTime = Date.now();
142521
142696
  if (android && chrome2 && event.keyCode == 13)
142522
142697
  return;
142523
- if (event.keyCode != 229)
142698
+ if (view.domObserver.selectionChanged(view.domSelectionRange()))
142699
+ view.domObserver.flush();
142700
+ else if (event.keyCode != 229)
142524
142701
  view.domObserver.forceFlush();
142525
142702
  if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {
142526
142703
  let now3 = Date.now();
@@ -142688,13 +142865,13 @@
142688
142865
  editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
142689
142866
  if (!view.composing) {
142690
142867
  view.domObserver.flush();
142691
- let { state } = view, $pos = state.selection.$from;
142692
- if (state.selection.empty && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m4) => m4.type.spec.inclusive === false))) {
142868
+ let { state } = view, $pos = state.selection.$to;
142869
+ if (state.selection instanceof TextSelection && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m4) => m4.type.spec.inclusive === false))) {
142693
142870
  view.markCursor = view.state.storedMarks || $pos.marks();
142694
142871
  endComposition(view, true);
142695
142872
  view.markCursor = null;
142696
142873
  } else {
142697
- endComposition(view);
142874
+ endComposition(view, !state.selection.empty);
142698
142875
  if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {
142699
142876
  let sel = view.domSelectionRange();
142700
142877
  for (let node = sel.focusNode, offset3 = sel.focusOffset; node && node.nodeType == 1 && offset3 != 0; ) {
@@ -142702,7 +142879,9 @@
142702
142879
  if (!before)
142703
142880
  break;
142704
142881
  if (before.nodeType == 3) {
142705
- view.domSelection().collapse(before, before.nodeValue.length);
142882
+ let sel2 = view.domSelection();
142883
+ if (sel2)
142884
+ sel2.collapse(before, before.nodeValue.length);
142706
142885
  break;
142707
142886
  } else {
142708
142887
  node = before;
@@ -143179,6 +143358,9 @@
143179
143358
  }
143180
143359
  return result;
143181
143360
  }
143361
+ forEachSet(f4) {
143362
+ f4(this);
143363
+ }
143182
143364
  };
143183
143365
  DecorationSet.empty = new DecorationSet([], []);
143184
143366
  DecorationSet.removeOverlap = removeOverlap;
@@ -143243,6 +143425,10 @@
143243
143425
  return new DecorationGroup(members.every((m4) => m4 instanceof DecorationSet) ? members : members.reduce((r6, m4) => r6.concat(m4 instanceof DecorationSet ? m4 : m4.members), []));
143244
143426
  }
143245
143427
  }
143428
+ forEachSet(f4) {
143429
+ for (let i5 = 0; i5 < this.members.length; i5++)
143430
+ this.members[i5].forEachSet(f4);
143431
+ }
143246
143432
  };
143247
143433
  observeOptions = {
143248
143434
  childList: true,
@@ -143388,6 +143574,9 @@
143388
143574
  this.queue.push(mut);
143389
143575
  return this.queue;
143390
143576
  }
143577
+ selectionChanged(sel) {
143578
+ return !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(this.view) && !this.ignoreSelectionChange(sel);
143579
+ }
143391
143580
  flush() {
143392
143581
  let { view } = this;
143393
143582
  if (!view.docView || this.flushingSoon > -1)
@@ -143395,8 +143584,7 @@
143395
143584
  let mutations = this.pendingRecords();
143396
143585
  if (mutations.length)
143397
143586
  this.queue = [];
143398
- let sel = view.domSelectionRange();
143399
- let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);
143587
+ let sel = view.domSelectionRange(), newSel = this.selectionChanged(sel);
143400
143588
  let from = -1, to = -1, typeOver = false, added = [];
143401
143589
  if (view.editable) {
143402
143590
  for (let i5 = 0; i5 < mutations.length; i5++) {
@@ -143791,6 +143979,8 @@
143791
143979
  }
143792
143980
  domSelectionRange() {
143793
143981
  let sel = this.domSelection();
143982
+ if (!sel)
143983
+ return { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
143794
143984
  return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
143795
143985
  }
143796
143986
  domSelection() {
@@ -144248,7 +144438,8 @@
144248
144438
  throw new RangeError("Type given to setBlockType should be a textblock");
144249
144439
  let mapFrom = tr2.steps.length;
144250
144440
  tr2.doc.nodesBetween(from, to, (node, pos) => {
144251
- if (node.isTextblock && !node.hasMarkup(type, attrs) && canChangeType2(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type)) {
144441
+ let attrsHere = typeof attrs == "function" ? attrs(node) : attrs;
144442
+ if (node.isTextblock && !node.hasMarkup(type, attrsHere) && canChangeType2(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type)) {
144252
144443
  let convertNewlines = null;
144253
144444
  if (type.schema.linebreakReplacement) {
144254
144445
  let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
@@ -144262,7 +144453,7 @@
144262
144453
  clearIncompatible2(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null);
144263
144454
  let mapping = tr2.mapping.slice(mapFrom);
144264
144455
  let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
144265
- tr2.step(new ReplaceAroundStep3(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrs, null, node.marks)), 0, 0), 1, true));
144456
+ tr2.step(new ReplaceAroundStep3(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
144266
144457
  if (convertNewlines === true)
144267
144458
  replaceNewlines(tr2, node, pos, mapFrom);
144268
144459
  return false;
@@ -145563,7 +145754,7 @@
145563
145754
  if (state.selection instanceof TextSelection || state.selection instanceof AllSelection)
145564
145755
  tr2.deleteSelection();
145565
145756
  let deflt = $from.depth == 0 ? null : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
145566
- let splitType = splitNode && splitNode($to.parent, atEnd);
145757
+ let splitType = splitNode && splitNode($to.parent, atEnd, $from);
145567
145758
  let types = splitType ? [splitType] : atEnd && deflt ? [{ type: deflt }] : void 0;
145568
145759
  let can = canSplit(tr2.doc, tr2.mapping.map($from.pos), 1, types);
145569
145760
  if (!types && !can && canSplit(tr2.doc, tr2.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
@@ -145599,13 +145790,12 @@
145599
145790
  dispatch3(state.tr.clearIncompatible($pos.pos, before.type, before.contentMatchAt(before.childCount)).join($pos.pos).scrollIntoView());
145600
145791
  return true;
145601
145792
  }
145602
- function deleteBarrier(state, $cut, dispatch3) {
145793
+ function deleteBarrier(state, $cut, dispatch3, dir) {
145603
145794
  let before = $cut.nodeBefore, after = $cut.nodeAfter, conn, match3;
145604
- if (before.type.spec.isolating || after.type.spec.isolating)
145605
- return false;
145606
- if (joinMaybeClear(state, $cut, dispatch3))
145795
+ let isolated = before.type.spec.isolating || after.type.spec.isolating;
145796
+ if (!isolated && joinMaybeClear(state, $cut, dispatch3))
145607
145797
  return true;
145608
- let canDelAfter = $cut.parent.canReplace($cut.index(), $cut.index() + 1);
145798
+ let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);
145609
145799
  if (canDelAfter && (conn = (match3 = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match3.matchType(conn[0] || after.type).validEnd) {
145610
145800
  if (dispatch3) {
145611
145801
  let end2 = $cut.pos + after.nodeSize, wrap3 = Fragment.empty;
@@ -145620,7 +145810,7 @@
145620
145810
  }
145621
145811
  return true;
145622
145812
  }
145623
- let selAfter = Selection.findFrom($cut, 1);
145813
+ let selAfter = after.type.spec.isolating || dir > 0 && isolated ? null : Selection.findFrom($cut, 1);
145624
145814
  let range2 = selAfter && selAfter.$from.blockRange(selAfter.$to), target = range2 && liftTarget(range2);
145625
145815
  if (target != null && target >= $cut.depth) {
145626
145816
  if (dispatch3)
@@ -145744,17 +145934,21 @@
145744
145934
  return true;
145745
145935
  }
145746
145936
  let before = $cut.nodeBefore;
145747
- if (!before.type.spec.isolating && deleteBarrier(state, $cut, dispatch3))
145937
+ if (deleteBarrier(state, $cut, dispatch3, -1))
145748
145938
  return true;
145749
145939
  if ($cursor.parent.content.size == 0 && (textblockAt(before, "end") || NodeSelection.isSelectable(before))) {
145750
- let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice.empty);
145751
- if (delStep && delStep.slice.size < delStep.to - delStep.from) {
145752
- if (dispatch3) {
145753
- let tr2 = state.tr.step(delStep);
145754
- tr2.setSelection(textblockAt(before, "end") ? Selection.findFrom(tr2.doc.resolve(tr2.mapping.map($cut.pos, -1)), -1) : NodeSelection.create(tr2.doc, $cut.pos - before.nodeSize));
145755
- dispatch3(tr2.scrollIntoView());
145940
+ for (let depth = $cursor.depth; ; depth--) {
145941
+ let delStep = replaceStep(state.doc, $cursor.before(depth), $cursor.after(depth), Slice.empty);
145942
+ if (delStep && delStep.slice.size < delStep.to - delStep.from) {
145943
+ if (dispatch3) {
145944
+ let tr2 = state.tr.step(delStep);
145945
+ tr2.setSelection(textblockAt(before, "end") ? Selection.findFrom(tr2.doc.resolve(tr2.mapping.map($cut.pos, -1)), -1) : NodeSelection.create(tr2.doc, $cut.pos - before.nodeSize));
145946
+ dispatch3(tr2.scrollIntoView());
145947
+ }
145948
+ return true;
145756
145949
  }
145757
- return true;
145950
+ if (depth == 1 || $cursor.node(depth - 1).childCount > 1)
145951
+ break;
145758
145952
  }
145759
145953
  }
145760
145954
  if (before.isAtom && $cut.depth == $cursor.depth - 1) {
@@ -145802,7 +145996,7 @@
145802
145996
  if (!$cut)
145803
145997
  return false;
145804
145998
  let after = $cut.nodeAfter;
145805
- if (deleteBarrier(state, $cut, dispatch3))
145999
+ if (deleteBarrier(state, $cut, dispatch3, 1))
145806
146000
  return true;
145807
146001
  if ($cursor.parent.content.size == 0 && (textblockAt(after, "start") || NodeSelection.isSelectable(after))) {
145808
146002
  let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice.empty);
@@ -146119,8 +146313,8 @@
146119
146313
  });
146120
146314
 
146121
146315
  // node_modules/@tiptap/core/dist/index.js
146122
- function createChainableState(config) {
146123
- const { state, transaction } = config;
146316
+ function createChainableState(config2) {
146317
+ const { state, transaction } = config2;
146124
146318
  let { selection } = transaction;
146125
146319
  let { doc: doc4 } = transaction;
146126
146320
  let { storedMarks } = transaction;
@@ -146266,7 +146460,18 @@
146266
146460
  const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
146267
146461
  mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
146268
146462
  } else if (key === "style") {
146269
- mergedAttributes[key] = [mergedAttributes[key], value].join("; ");
146463
+ const newStyles = value ? value.split(";").map((style2) => style2.trim()).filter(Boolean) : [];
146464
+ const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(";").map((style2) => style2.trim()).filter(Boolean) : [];
146465
+ const styleMap = /* @__PURE__ */ new Map();
146466
+ existingStyles.forEach((style2) => {
146467
+ const [property, val] = style2.split(":").map((part) => part.trim());
146468
+ styleMap.set(property, val);
146469
+ });
146470
+ newStyles.forEach((style2) => {
146471
+ const [property, val] = style2.split(":").map((part) => part.trim());
146472
+ styleMap.set(property, val);
146473
+ });
146474
+ mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
146270
146475
  } else {
146271
146476
  mergedAttributes[key] = value;
146272
146477
  }
@@ -146275,7 +146480,7 @@
146275
146480
  }, {});
146276
146481
  }
146277
146482
  function getRenderedAttributes(nodeOrMark, extensionAttributes) {
146278
- return extensionAttributes.filter((item) => item.attribute.rendered).map((item) => {
146483
+ return extensionAttributes.filter((attribute) => attribute.type === nodeOrMark.type.name).filter((item) => item.attribute.rendered).map((item) => {
146279
146484
  if (!item.attribute.renderHTML) {
146280
146485
  return {
146281
146486
  [item.name]: nodeOrMark.attrs[item.name]
@@ -146465,9 +146670,9 @@
146465
146670
  function isRegExp(value) {
146466
146671
  return Object.prototype.toString.call(value) === "[object RegExp]";
146467
146672
  }
146468
- function run$1(config) {
146673
+ function run$1(config2) {
146469
146674
  var _a;
146470
- const { editor, from, to, text, rules, plugin } = config;
146675
+ const { editor, from, to, text, rules, plugin } = config2;
146471
146676
  const { view } = editor;
146472
146677
  if (view.composing) {
146473
146678
  return false;
@@ -146606,8 +146811,8 @@
146606
146811
  function isNumber3(value) {
146607
146812
  return typeof value === "number";
146608
146813
  }
146609
- function run(config) {
146610
- const { editor, state, from, to, rule, pasteEvent, dropEvent } = config;
146814
+ function run(config2) {
146815
+ const { editor, state, from, to, rule, pasteEvent, dropEvent } = config2;
146611
146816
  const { commands: commands2, chain, can } = new CommandManager({
146612
146817
  editor,
146613
146818
  state
@@ -147447,11 +147652,11 @@
147447
147652
  document.getElementsByTagName("head")[0].appendChild(styleNode);
147448
147653
  return styleNode;
147449
147654
  }
147450
- function markInputRule(config) {
147655
+ function markInputRule(config2) {
147451
147656
  return new InputRule({
147452
- find: config.find,
147657
+ find: config2.find,
147453
147658
  handler: ({ state, range: range2, match: match3 }) => {
147454
- const attributes = callOrReturn(config.getAttributes, void 0, match3);
147659
+ const attributes = callOrReturn(config2.getAttributes, void 0, match3);
147455
147660
  if (attributes === false || attributes === null) {
147456
147661
  return null;
147457
147662
  }
@@ -147464,7 +147669,7 @@
147464
147669
  const textEnd = textStart + captureGroup.length;
147465
147670
  const excludedMarks = getMarksBetween(range2.from, range2.to, state.doc).filter((item) => {
147466
147671
  const excluded = item.mark.type.excluded;
147467
- return excluded.find((type) => type === config.type && type !== item.mark.type);
147672
+ return excluded.find((type) => type === config2.type && type !== item.mark.type);
147468
147673
  }).filter((item) => item.to > textStart);
147469
147674
  if (excludedMarks.length) {
147470
147675
  return null;
@@ -147476,50 +147681,50 @@
147476
147681
  tr2.delete(range2.from + startSpaces, textStart);
147477
147682
  }
147478
147683
  const markEnd = range2.from + startSpaces + captureGroup.length;
147479
- tr2.addMark(range2.from + startSpaces, markEnd, config.type.create(attributes || {}));
147480
- tr2.removeStoredMark(config.type);
147684
+ tr2.addMark(range2.from + startSpaces, markEnd, config2.type.create(attributes || {}));
147685
+ tr2.removeStoredMark(config2.type);
147481
147686
  }
147482
147687
  }
147483
147688
  });
147484
147689
  }
147485
- function wrappingInputRule(config) {
147690
+ function wrappingInputRule(config2) {
147486
147691
  return new InputRule({
147487
- find: config.find,
147692
+ find: config2.find,
147488
147693
  handler: ({ state, range: range2, match: match3, chain }) => {
147489
- const attributes = callOrReturn(config.getAttributes, void 0, match3) || {};
147694
+ const attributes = callOrReturn(config2.getAttributes, void 0, match3) || {};
147490
147695
  const tr2 = state.tr.delete(range2.from, range2.to);
147491
147696
  const $start = tr2.doc.resolve(range2.from);
147492
147697
  const blockRange = $start.blockRange();
147493
- const wrapping = blockRange && findWrapping2(blockRange, config.type, attributes);
147698
+ const wrapping = blockRange && findWrapping2(blockRange, config2.type, attributes);
147494
147699
  if (!wrapping) {
147495
147700
  return null;
147496
147701
  }
147497
147702
  tr2.wrap(blockRange, wrapping);
147498
- if (config.keepMarks && config.editor) {
147703
+ if (config2.keepMarks && config2.editor) {
147499
147704
  const { selection, storedMarks } = state;
147500
- const { splittableMarks } = config.editor.extensionManager;
147705
+ const { splittableMarks } = config2.editor.extensionManager;
147501
147706
  const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
147502
147707
  if (marks) {
147503
147708
  const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
147504
147709
  tr2.ensureMarks(filteredMarks);
147505
147710
  }
147506
147711
  }
147507
- if (config.keepAttributes) {
147508
- const nodeType = config.type.name === "bulletList" || config.type.name === "orderedList" ? "listItem" : "taskList";
147712
+ if (config2.keepAttributes) {
147713
+ const nodeType = config2.type.name === "bulletList" || config2.type.name === "orderedList" ? "listItem" : "taskList";
147509
147714
  chain().updateAttributes(nodeType, attributes).run();
147510
147715
  }
147511
147716
  const before = tr2.doc.resolve(range2.from - 1).nodeBefore;
147512
- if (before && before.type === config.type && canJoin2(tr2.doc, range2.from - 1) && (!config.joinPredicate || config.joinPredicate(match3, before))) {
147717
+ if (before && before.type === config2.type && canJoin2(tr2.doc, range2.from - 1) && (!config2.joinPredicate || config2.joinPredicate(match3, before))) {
147513
147718
  tr2.join(range2.from - 1);
147514
147719
  }
147515
147720
  }
147516
147721
  });
147517
147722
  }
147518
- function markPasteRule(config) {
147723
+ function markPasteRule(config2) {
147519
147724
  return new PasteRule({
147520
- find: config.find,
147725
+ find: config2.find,
147521
147726
  handler: ({ state, range: range2, match: match3, pasteEvent }) => {
147522
- const attributes = callOrReturn(config.getAttributes, void 0, match3, pasteEvent);
147727
+ const attributes = callOrReturn(config2.getAttributes, void 0, match3, pasteEvent);
147523
147728
  if (attributes === false || attributes === null) {
147524
147729
  return null;
147525
147730
  }
@@ -147533,7 +147738,7 @@
147533
147738
  const textEnd = textStart + captureGroup.length;
147534
147739
  const excludedMarks = getMarksBetween(range2.from, range2.to, state.doc).filter((item) => {
147535
147740
  const excluded = item.mark.type.excluded;
147536
- return excluded.find((type) => type === config.type && type !== item.mark.type);
147741
+ return excluded.find((type) => type === config2.type && type !== item.mark.type);
147537
147742
  }).filter((item) => item.to > textStart);
147538
147743
  if (excludedMarks.length) {
147539
147744
  return null;
@@ -147545,13 +147750,13 @@
147545
147750
  tr2.delete(range2.from + startSpaces, textStart);
147546
147751
  }
147547
147752
  markEnd = range2.from + startSpaces + captureGroup.length;
147548
- tr2.addMark(range2.from + startSpaces, markEnd, config.type.create(attributes || {}));
147549
- tr2.removeStoredMark(config.type);
147753
+ tr2.addMark(range2.from + startSpaces, markEnd, config2.type.create(attributes || {}));
147754
+ tr2.removeStoredMark(config2.type);
147550
147755
  }
147551
147756
  }
147552
147757
  });
147553
147758
  }
147554
- var CommandManager, EventEmitter, getTextContentFromNodes, InputRule, inputRuleMatcherHandler, PasteRule, pasteRuleMatcherHandler, createClipboardPasteEvent, ExtensionManager, Extension, ClipboardTextSerializer, blur, clearContent, clearNodes, command, createParagraphNear2, cut, deleteCurrentNode, deleteNode, deleteRange3, deleteSelection2, enter2, exitCode2, extendMarkRange, first2, focus, forEach, insertContent, removeWhitespaces, isFragment, insertContentAt, joinUp2, joinDown2, joinBackward2, joinForward2, joinItemBackward, joinItemForward, joinTextblockBackward2, joinTextblockForward2, keyboardShortcut, lift4, liftEmptyBlock2, liftListItem2, newlineInCode2, resetAttributes, scrollIntoView, selectAll2, selectNodeBackward2, selectNodeForward2, selectParentNode2, selectTextblockEnd2, selectTextblockStart2, setContent2, setMark, setMeta, setNode, setNodeSelection, setTextSelection, sinkListItem2, splitBlock2, splitListItem, joinListBackwards, joinListForwards, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, updateAttributes, wrapIn2, wrapInList2, commands, Commands, Editable, FocusEvents, Keymap, Tabindex, NodePos, style, Editor, Mark2, Node3;
147759
+ var CommandManager, EventEmitter, getTextContentFromNodes, InputRule, inputRuleMatcherHandler, PasteRule, pasteRuleMatcherHandler, createClipboardPasteEvent, ExtensionManager, Extension, ClipboardTextSerializer, blur, clearContent, clearNodes, command, createParagraphNear2, cut, deleteCurrentNode, deleteNode, deleteRange3, deleteSelection2, enter2, exitCode2, extendMarkRange, first2, focus, forEach, insertContent, removeWhitespaces, isFragment, insertContentAt, joinUp2, joinDown2, joinBackward2, joinForward2, joinItemBackward, joinItemForward, joinTextblockBackward2, joinTextblockForward2, keyboardShortcut, lift4, liftEmptyBlock2, liftListItem2, newlineInCode2, resetAttributes, scrollIntoView, selectAll2, selectNodeBackward2, selectNodeForward2, selectParentNode2, selectTextblockEnd2, selectTextblockStart2, setContent2, setMark, setMeta, setNode, setNodeSelection, setTextSelection, sinkListItem2, splitBlock2, splitListItem, joinListBackwards, joinListForwards, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, updateAttributes, wrapIn2, wrapInList2, commands, Commands, Editable, FocusEvents, Keymap, Tabindex, NodePos, DropPlugin, PastePlugin, style, Editor, Mark2, Node3;
147555
147760
  var init_dist18 = __esm({
147556
147761
  "node_modules/@tiptap/core/dist/index.js"() {
147557
147762
  init_dist5();
@@ -147706,9 +147911,9 @@
147706
147911
  return textBefore;
147707
147912
  };
147708
147913
  InputRule = class {
147709
- constructor(config) {
147710
- this.find = config.find;
147711
- this.handler = config.handler;
147914
+ constructor(config2) {
147915
+ this.find = config2.find;
147916
+ this.handler = config2.handler;
147712
147917
  }
147713
147918
  };
147714
147919
  inputRuleMatcherHandler = (text, find2) => {
@@ -147732,9 +147937,9 @@
147732
147937
  return result;
147733
147938
  };
147734
147939
  PasteRule = class {
147735
- constructor(config) {
147736
- this.find = config.find;
147737
- this.handler = config.handler;
147940
+ constructor(config2) {
147941
+ this.find = config2.find;
147942
+ this.handler = config2.handler;
147738
147943
  }
147739
147944
  };
147740
147945
  pasteRuleMatcherHandler = (text, find2, event) => {
@@ -147903,15 +148108,17 @@
147903
148108
  if (!addNodeView) {
147904
148109
  return [];
147905
148110
  }
147906
- const nodeview = (node, view, getPos, decorations) => {
148111
+ const nodeview = (node, view, getPos, decorations, innerDecorations) => {
147907
148112
  const HTMLAttributes = getRenderedAttributes(node, extensionAttributes);
147908
148113
  return addNodeView()({
147909
- editor,
147910
148114
  node,
148115
+ view,
147911
148116
  getPos,
147912
148117
  decorations,
147913
- HTMLAttributes,
147914
- extension
148118
+ innerDecorations,
148119
+ editor,
148120
+ extension,
148121
+ HTMLAttributes
147915
148122
  });
147916
148123
  };
147917
148124
  return [extension.name, nodeview];
@@ -147970,7 +148177,7 @@
147970
148177
  }
147971
148178
  };
147972
148179
  Extension = class {
147973
- constructor(config = {}) {
148180
+ constructor(config2 = {}) {
147974
148181
  this.type = "extension";
147975
148182
  this.name = "extension";
147976
148183
  this.parent = null;
@@ -147981,10 +148188,10 @@
147981
148188
  };
147982
148189
  this.config = {
147983
148190
  ...this.config,
147984
- ...config
148191
+ ...config2
147985
148192
  };
147986
148193
  this.name = this.config.name;
147987
- if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
148194
+ if (config2.defaultOptions && Object.keys(config2.defaultOptions).length > 0) {
147988
148195
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
147989
148196
  }
147990
148197
  this.options = this.config.defaultOptions;
@@ -147998,8 +148205,8 @@
147998
148205
  options: this.options
147999
148206
  })) || {};
148000
148207
  }
148001
- static create(config = {}) {
148002
- return new Extension(config);
148208
+ static create(config2 = {}) {
148209
+ return new Extension(config2);
148003
148210
  }
148004
148211
  configure(options = {}) {
148005
148212
  const extension = this.extend({
@@ -148800,10 +149007,14 @@
148800
149007
  const type = getNodeType(typeOrName, state.schema);
148801
149008
  const toggleType = getNodeType(toggleTypeOrName, state.schema);
148802
149009
  const isActive2 = isNodeActive(state, type, attributes);
149010
+ let attributesToCopy;
149011
+ if (state.selection.$anchor.sameParent(state.selection.$head)) {
149012
+ attributesToCopy = state.selection.$anchor.parent.attrs;
149013
+ }
148803
149014
  if (isActive2) {
148804
- return commands2.setNode(toggleType);
149015
+ return commands2.setNode(toggleType, attributesToCopy);
148805
149016
  }
148806
- return commands2.setNode(type, attributes);
149017
+ return commands2.setNode(type, { ...attributesToCopy, ...attributes });
148807
149018
  };
148808
149019
  toggleWrap = (typeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
148809
149020
  const type = getNodeType(typeOrName, state.schema);
@@ -149103,7 +149314,8 @@
149103
149314
  key: new PluginKey("clearDocument"),
149104
149315
  appendTransaction: (transactions, oldState, newState) => {
149105
149316
  const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
149106
- if (!docChanges) {
149317
+ const ignoreTr = transactions.some((transaction) => transaction.getMeta("preventClearDocument"));
149318
+ if (!docChanges || ignoreTr) {
149107
149319
  return;
149108
149320
  }
149109
149321
  const { empty: empty2, from, to } = oldState.selection;
@@ -149113,7 +149325,7 @@
149113
149325
  if (empty2 || !allWasSelected) {
149114
149326
  return;
149115
149327
  }
149116
- const isEmpty = newState.doc.textBetween(0, newState.doc.content.size, " ", " ").length === 0;
149328
+ const isEmpty = isNodeEmpty(newState.doc);
149117
149329
  if (!isEmpty) {
149118
149330
  return;
149119
149331
  }
@@ -149316,6 +149528,26 @@
149316
149528
  this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name, attributes).setTextSelection(oldSelection.from).run();
149317
149529
  }
149318
149530
  };
149531
+ DropPlugin = (onDrop) => {
149532
+ return new Plugin({
149533
+ key: new PluginKey("tiptapDrop"),
149534
+ props: {
149535
+ handleDrop: (_3, e5, slice, moved) => {
149536
+ onDrop(e5, slice, moved);
149537
+ }
149538
+ }
149539
+ });
149540
+ };
149541
+ PastePlugin = (onPaste) => {
149542
+ return new Plugin({
149543
+ key: new PluginKey("tiptapPaste"),
149544
+ props: {
149545
+ handlePaste: (_view, e5, slice) => {
149546
+ onPaste(e5, slice);
149547
+ }
149548
+ }
149549
+ });
149550
+ };
149319
149551
  style = `.ProseMirror {
149320
149552
  position: relative;
149321
149553
  }
@@ -149422,7 +149654,9 @@ img.ProseMirror-separator {
149422
149654
  onDestroy: () => null,
149423
149655
  onContentError: ({ error: error2 }) => {
149424
149656
  throw error2;
149425
- }
149657
+ },
149658
+ onPaste: () => null,
149659
+ onDrop: () => null
149426
149660
  };
149427
149661
  this.isCapturingTransaction = false;
149428
149662
  this.capturedTransaction = null;
@@ -149442,6 +149676,12 @@ img.ProseMirror-separator {
149442
149676
  this.on("focus", this.options.onFocus);
149443
149677
  this.on("blur", this.options.onBlur);
149444
149678
  this.on("destroy", this.options.onDestroy);
149679
+ if (this.options.onPaste) {
149680
+ this.registerPlugin(PastePlugin(this.options.onPaste));
149681
+ }
149682
+ if (this.options.onDrop) {
149683
+ this.registerPlugin(DropPlugin(this.options.onDrop));
149684
+ }
149445
149685
  window.setTimeout(() => {
149446
149686
  if (this.isDestroyed) {
149447
149687
  return;
@@ -149497,16 +149737,18 @@ img.ProseMirror-separator {
149497
149737
  const plugins2 = isFunction2(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];
149498
149738
  const state = this.state.reconfigure({ plugins: plugins2 });
149499
149739
  this.view.updateState(state);
149740
+ return state;
149500
149741
  }
149501
149742
  unregisterPlugin(nameOrPluginKey) {
149502
149743
  if (this.isDestroyed) {
149503
- return;
149744
+ return void 0;
149504
149745
  }
149505
149746
  const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
149506
149747
  const state = this.state.reconfigure({
149507
149748
  plugins: this.state.plugins.filter((plugin) => !plugin.key.startsWith(name))
149508
149749
  });
149509
149750
  this.view.updateState(state);
149751
+ return state;
149510
149752
  }
149511
149753
  createExtensionManager() {
149512
149754
  var _a, _b;
@@ -149519,7 +149761,12 @@ img.ProseMirror-separator {
149519
149761
  FocusEvents,
149520
149762
  Keymap,
149521
149763
  Tabindex
149522
- ] : [];
149764
+ ].filter((ext) => {
149765
+ if (typeof this.options.enableCoreExtensions === "object") {
149766
+ return this.options.enableCoreExtensions[ext.name] !== false;
149767
+ }
149768
+ return true;
149769
+ }) : [];
149523
149770
  const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension) => {
149524
149771
  return ["extension", "node", "mark"].includes(extension === null || extension === void 0 ? void 0 : extension.type);
149525
149772
  });
@@ -149679,6 +149926,10 @@ img.ProseMirror-separator {
149679
149926
  destroy() {
149680
149927
  this.emit("destroy");
149681
149928
  if (this.view) {
149929
+ const dom = this.view.dom;
149930
+ if (dom && dom.editor) {
149931
+ delete dom.editor;
149932
+ }
149682
149933
  this.view.destroy();
149683
149934
  }
149684
149935
  this.removeAllListeners();
@@ -149704,7 +149955,7 @@ img.ProseMirror-separator {
149704
149955
  }
149705
149956
  };
149706
149957
  Mark2 = class {
149707
- constructor(config = {}) {
149958
+ constructor(config2 = {}) {
149708
149959
  this.type = "mark";
149709
149960
  this.name = "mark";
149710
149961
  this.parent = null;
@@ -149715,10 +149966,10 @@ img.ProseMirror-separator {
149715
149966
  };
149716
149967
  this.config = {
149717
149968
  ...this.config,
149718
- ...config
149969
+ ...config2
149719
149970
  };
149720
149971
  this.name = this.config.name;
149721
- if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
149972
+ if (config2.defaultOptions && Object.keys(config2.defaultOptions).length > 0) {
149722
149973
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
149723
149974
  }
149724
149975
  this.options = this.config.defaultOptions;
@@ -149732,8 +149983,8 @@ img.ProseMirror-separator {
149732
149983
  options: this.options
149733
149984
  })) || {};
149734
149985
  }
149735
- static create(config = {}) {
149736
- return new Mark2(config);
149986
+ static create(config2 = {}) {
149987
+ return new Mark2(config2);
149737
149988
  }
149738
149989
  configure(options = {}) {
149739
149990
  const extension = this.extend({
@@ -149785,7 +150036,7 @@ img.ProseMirror-separator {
149785
150036
  }
149786
150037
  };
149787
150038
  Node3 = class {
149788
- constructor(config = {}) {
150039
+ constructor(config2 = {}) {
149789
150040
  this.type = "node";
149790
150041
  this.name = "node";
149791
150042
  this.parent = null;
@@ -149796,10 +150047,10 @@ img.ProseMirror-separator {
149796
150047
  };
149797
150048
  this.config = {
149798
150049
  ...this.config,
149799
- ...config
150050
+ ...config2
149800
150051
  };
149801
150052
  this.name = this.config.name;
149802
- if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
150053
+ if (config2.defaultOptions && Object.keys(config2.defaultOptions).length > 0) {
149803
150054
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
149804
150055
  }
149805
150056
  this.options = this.config.defaultOptions;
@@ -149813,8 +150064,8 @@ img.ProseMirror-separator {
149813
150064
  options: this.options
149814
150065
  })) || {};
149815
150066
  }
149816
- static create(config = {}) {
149817
- return new Node3(config);
150067
+ static create(config2 = {}) {
150068
+ return new Node3(config2);
149818
150069
  }
149819
150070
  configure(options = {}) {
149820
150071
  const extension = this.extend({
@@ -158534,7 +158785,7 @@ img.ProseMirror-separator {
158534
158785
  * Licensed under the MIT license.
158535
158786
  */
158536
158787
  /*!
158537
- Turbo 8.0.5
158788
+ Turbo 8.0.10
158538
158789
  Copyright © 2024 37signals LLC
158539
158790
  */
158540
158791
  /*! *****************************************************************************
@@ -158551,7 +158802,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
158551
158802
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
158552
158803
  PERFORMANCE OF THIS SOFTWARE.
158553
158804
  ***************************************************************************** */
158554
- /*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
158805
+ /*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */
158555
158806
  /*! https://mths.be/punycode v1.4.0 by @mathias */
158556
158807
  /*! js-cookie v3.0.5 | MIT */
158557
158808
  /**