@bagelink/vue 0.0.596 → 0.0.598

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -112,21 +112,12 @@ function getPaddingObject(padding) {
112
112
  };
113
113
  }
114
114
  function rectToClientRect$1(rect) {
115
- const {
116
- x: x2,
117
- y: y2,
118
- width,
119
- height
120
- } = rect;
121
115
  return {
122
- width,
123
- height,
124
- top: y2,
125
- left: x2,
126
- right: x2 + width,
127
- bottom: y2 + height,
128
- x: x2,
129
- y: y2
116
+ ...rect,
117
+ top: rect.y,
118
+ left: rect.x,
119
+ right: rect.x + rect.width,
120
+ bottom: rect.y + rect.height
130
121
  };
131
122
  }
132
123
  function computeCoordsFromPlacement(_ref, placement, rtl) {
@@ -297,10 +288,9 @@ async function detectOverflow$1(state2, options) {
297
288
  strategy
298
289
  }));
299
290
  const rect = elementContext === "floating" ? {
291
+ ...rects.floating,
300
292
  x: x2,
301
- y: y2,
302
- width: rects.floating.width,
303
- height: rects.floating.height
293
+ y: y2
304
294
  } : rects.reference;
305
295
  const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
306
296
  const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
@@ -511,12 +501,10 @@ const flip$2 = function(options) {
511
501
  return {};
512
502
  }
513
503
  const side = getSide$1(placement);
514
- const initialSideAxis = getSideAxis(initialPlacement);
515
504
  const isBasePlacement = getSide$1(initialPlacement) === initialPlacement;
516
505
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
517
506
  const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement$1(initialPlacement)] : getExpandedPlacements(initialPlacement));
518
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
519
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
507
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
520
508
  fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
521
509
  }
522
510
  const placements2 = [initialPlacement, ...fallbackPlacements];
@@ -553,16 +541,8 @@ const flip$2 = function(options) {
553
541
  if (!resetPlacement) {
554
542
  switch (fallbackStrategy) {
555
543
  case "bestFit": {
556
- var _overflowsData$filter2;
557
- const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
558
- if (hasFallbackAxisSideDirection) {
559
- const currentSideAxis = getSideAxis(d2.placement);
560
- return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
561
- // reading directions favoring greater width.
562
- currentSideAxis === "y";
563
- }
564
- return true;
565
- }).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
544
+ var _overflowsData$map$so;
545
+ const placement2 = (_overflowsData$map$so = overflowsData.map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
566
546
  if (placement2) {
567
547
  resetPlacement = placement2;
568
548
  }
@@ -757,16 +737,16 @@ const size = function(options) {
757
737
  widthSide = side;
758
738
  heightSide = alignment === "end" ? "top" : "bottom";
759
739
  }
760
- const maximumClippingHeight = height - overflow.top - overflow.bottom;
761
- const maximumClippingWidth = width - overflow.left - overflow.right;
762
- const overflowAvailableHeight = min$3(height - overflow[heightSide], maximumClippingHeight);
763
- const overflowAvailableWidth = min$3(width - overflow[widthSide], maximumClippingWidth);
740
+ const overflowAvailableHeight = height - overflow[heightSide];
741
+ const overflowAvailableWidth = width - overflow[widthSide];
764
742
  const noShift = !state2.middlewareData.shift;
765
743
  let availableHeight = overflowAvailableHeight;
766
744
  let availableWidth = overflowAvailableWidth;
767
745
  if (isYAxis) {
746
+ const maximumClippingWidth = width - overflow.left - overflow.right;
768
747
  availableWidth = alignment || noShift ? min$3(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
769
748
  } else {
749
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
770
750
  availableHeight = alignment || noShift ? min$3(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
771
751
  }
772
752
  if (noShift && !alignment) {
@@ -3403,6 +3383,7 @@ const defaults$1 = {
3403
3383
  utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
3404
3384
  defaults$1.headers[method] = {};
3405
3385
  });
3386
+ const defaults$2 = defaults$1;
3406
3387
  const ignoreDuplicateOf = utils$1.toObjectSet([
3407
3388
  "age",
3408
3389
  "authorization",
@@ -3664,10 +3645,11 @@ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
3664
3645
  };
3665
3646
  });
3666
3647
  utils$1.freezeMethods(AxiosHeaders);
3648
+ const AxiosHeaders$1 = AxiosHeaders;
3667
3649
  function transformData(fns, response) {
3668
- const config = this || defaults$1;
3650
+ const config = this || defaults$2;
3669
3651
  const context = response || config;
3670
- const headers = AxiosHeaders.from(context.headers);
3652
+ const headers = AxiosHeaders$1.from(context.headers);
3671
3653
  let data2 = context.data;
3672
3654
  utils$1.forEach(fns, function transform(fn3) {
3673
3655
  data2 = fn3.call(config, data2, headers.normalize(), response ? response.status : void 0);
@@ -3866,7 +3848,7 @@ function buildFullPath(baseURL, requestedURL) {
3866
3848
  }
3867
3849
  return requestedURL;
3868
3850
  }
3869
- const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
3851
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
3870
3852
  function mergeConfig(config1, config2) {
3871
3853
  config2 = config2 || {};
3872
3854
  const config = {};
@@ -3947,7 +3929,7 @@ function mergeConfig(config1, config2) {
3947
3929
  const resolveConfig = (config) => {
3948
3930
  const newConfig = mergeConfig({}, config);
3949
3931
  let { data: data2, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
3950
- newConfig.headers = headers = AxiosHeaders.from(headers);
3932
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
3951
3933
  newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
3952
3934
  if (auth) {
3953
3935
  headers.set(
@@ -3980,7 +3962,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
3980
3962
  return new Promise(function dispatchXhrRequest(resolve, reject3) {
3981
3963
  const _config = resolveConfig(config);
3982
3964
  let requestData = _config.data;
3983
- const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
3965
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
3984
3966
  let { responseType } = _config;
3985
3967
  let onCanceled;
3986
3968
  function done() {
@@ -3998,7 +3980,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
3998
3980
  if (!request) {
3999
3981
  return;
4000
3982
  }
4001
- const responseHeaders = AxiosHeaders.from(
3983
+ const responseHeaders = AxiosHeaders$1.from(
4002
3984
  "getAllResponseHeaders" in request && request.getAllResponseHeaders()
4003
3985
  );
4004
3986
  const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
@@ -4314,7 +4296,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
4314
4296
  return await new Promise((resolve, reject3) => {
4315
4297
  settle(resolve, reject3, {
4316
4298
  data: responseData,
4317
- headers: AxiosHeaders.from(response.headers),
4299
+ headers: AxiosHeaders$1.from(response.headers),
4318
4300
  status: response.status,
4319
4301
  statusText: response.statusText,
4320
4302
  config,
@@ -4396,7 +4378,7 @@ function throwIfCancellationRequested(config) {
4396
4378
  }
4397
4379
  function dispatchRequest(config) {
4398
4380
  throwIfCancellationRequested(config);
4399
- config.headers = AxiosHeaders.from(config.headers);
4381
+ config.headers = AxiosHeaders$1.from(config.headers);
4400
4382
  config.data = transformData.call(
4401
4383
  config,
4402
4384
  config.transformRequest
@@ -4404,7 +4386,7 @@ function dispatchRequest(config) {
4404
4386
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
4405
4387
  config.headers.setContentType("application/x-www-form-urlencoded", false);
4406
4388
  }
4407
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
4389
+ const adapter = adapters.getAdapter(config.adapter || defaults$2.adapter);
4408
4390
  return adapter(config).then(function onAdapterResolution(response) {
4409
4391
  throwIfCancellationRequested(config);
4410
4392
  response.data = transformData.call(
@@ -4412,7 +4394,7 @@ function dispatchRequest(config) {
4412
4394
  config.transformResponse,
4413
4395
  response
4414
4396
  );
4415
- response.headers = AxiosHeaders.from(response.headers);
4397
+ response.headers = AxiosHeaders$1.from(response.headers);
4416
4398
  return response;
4417
4399
  }, function onAdapterRejection(reason) {
4418
4400
  if (!isCancel(reason)) {
@@ -4423,7 +4405,7 @@ function dispatchRequest(config) {
4423
4405
  config.transformResponse,
4424
4406
  reason.response
4425
4407
  );
4426
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
4408
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
4427
4409
  }
4428
4410
  }
4429
4411
  return Promise.reject(reason);
@@ -4562,7 +4544,7 @@ class Axios {
4562
4544
  delete headers[method];
4563
4545
  }
4564
4546
  );
4565
- config.headers = AxiosHeaders.concat(contextHeaders, headers);
4547
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
4566
4548
  const requestInterceptorChain = [];
4567
4549
  let synchronousRequestInterceptors = true;
4568
4550
  this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
@@ -4646,6 +4628,7 @@ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method)
4646
4628
  Axios.prototype[method] = generateHTTPMethod();
4647
4629
  Axios.prototype[method + "Form"] = generateHTTPMethod(true);
4648
4630
  });
4631
+ const Axios$1 = Axios;
4649
4632
  class CancelToken {
4650
4633
  constructor(executor) {
4651
4634
  if (typeof executor !== "function") {
@@ -4732,6 +4715,7 @@ class CancelToken {
4732
4715
  };
4733
4716
  }
4734
4717
  }
4718
+ const CancelToken$1 = CancelToken;
4735
4719
  function spread(callback) {
4736
4720
  return function wrap2(arr) {
4737
4721
  return callback.apply(null, arr);
@@ -4808,20 +4792,21 @@ const HttpStatusCode = {
4808
4792
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
4809
4793
  HttpStatusCode[value] = key;
4810
4794
  });
4795
+ const HttpStatusCode$1 = HttpStatusCode;
4811
4796
  function createInstance(defaultConfig2) {
4812
- const context = new Axios(defaultConfig2);
4813
- const instance = bind$2(Axios.prototype.request, context);
4814
- utils$1.extend(instance, Axios.prototype, context, { allOwnKeys: true });
4797
+ const context = new Axios$1(defaultConfig2);
4798
+ const instance = bind$2(Axios$1.prototype.request, context);
4799
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
4815
4800
  utils$1.extend(instance, context, null, { allOwnKeys: true });
4816
4801
  instance.create = function create(instanceConfig) {
4817
4802
  return createInstance(mergeConfig(defaultConfig2, instanceConfig));
4818
4803
  };
4819
4804
  return instance;
4820
4805
  }
4821
- const axios$1 = createInstance(defaults$1);
4822
- axios$1.Axios = Axios;
4806
+ const axios$1 = createInstance(defaults$2);
4807
+ axios$1.Axios = Axios$1;
4823
4808
  axios$1.CanceledError = CanceledError;
4824
- axios$1.CancelToken = CancelToken;
4809
+ axios$1.CancelToken = CancelToken$1;
4825
4810
  axios$1.isCancel = isCancel;
4826
4811
  axios$1.VERSION = VERSION;
4827
4812
  axios$1.toFormData = toFormData;
@@ -4833,10 +4818,10 @@ axios$1.all = function all(promises) {
4833
4818
  axios$1.spread = spread;
4834
4819
  axios$1.isAxiosError = isAxiosError;
4835
4820
  axios$1.mergeConfig = mergeConfig;
4836
- axios$1.AxiosHeaders = AxiosHeaders;
4821
+ axios$1.AxiosHeaders = AxiosHeaders$1;
4837
4822
  axios$1.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4838
4823
  axios$1.getAdapter = adapters.getAdapter;
4839
- axios$1.HttpStatusCode = HttpStatusCode;
4824
+ axios$1.HttpStatusCode = HttpStatusCode$1;
4840
4825
  axios$1.default = axios$1;
4841
4826
  var __defProp = Object.defineProperty;
4842
4827
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -5080,10 +5065,7 @@ class Bagel {
5080
5065
  this._setAuthorization();
5081
5066
  const formData = new FormData();
5082
5067
  formData.append("file", file);
5083
- let url = "/static_files/upload";
5084
- if (options == null ? void 0 : options.topic)
5085
- url = `/static_files/upload?topic=${options.topic}`;
5086
- const { data: data2 } = await axios.post(url, formData, {
5068
+ const { data: data2 } = await axios.post("/static_files/upload", formData, {
5087
5069
  headers: {
5088
5070
  "Content-Type": "multipart/form-data"
5089
5071
  },
@@ -6052,7 +6034,7 @@ function toValue(r2) {
6052
6034
  const isClient = typeof window !== "undefined" && typeof document !== "undefined";
6053
6035
  typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
6054
6036
  function getLifeCycleTarget(target) {
6055
- return vue.getCurrentInstance();
6037
+ return target || vue.getCurrentInstance();
6056
6038
  }
6057
6039
  function tryOnMounted(fn3, sync = true, target) {
6058
6040
  const instance = getLifeCycleTarget();
@@ -6360,9 +6342,9 @@ const _hoisted_3$j = [
6360
6342
  const _hoisted_4$d = { class: "infinite-wrapper" };
6361
6343
  const _hoisted_5$d = { class: "row first-row" };
6362
6344
  const _hoisted_6$8 = { key: 0 };
6363
- const _hoisted_7$3 = ["onClick"];
6364
- const _hoisted_8$1 = { class: "flex" };
6365
- const _hoisted_9$1 = ["onClick"];
6345
+ const _hoisted_7$4 = ["onClick"];
6346
+ const _hoisted_8$2 = { class: "flex" };
6347
+ const _hoisted_9$2 = ["onClick"];
6366
6348
  const _hoisted_10$1 = { key: 0 };
6367
6349
  const _hoisted_11$1 = ["value"];
6368
6350
  const _hoisted_12$1 = { key: 1 };
@@ -6520,7 +6502,7 @@ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
6520
6502
  class: "col",
6521
6503
  onClick: ($event) => sort2((field == null ? void 0 : field.id) || "")
6522
6504
  }, [
6523
- vue.createElementVNode("div", _hoisted_8$1, [
6505
+ vue.createElementVNode("div", _hoisted_8$2, [
6524
6506
  vue.createTextVNode(vue.toDisplayString(field.label || vue.unref(keyToLabel)(field.id)) + " ", 1),
6525
6507
  vue.createElementVNode("div", {
6526
6508
  class: vue.normalizeClass(["list-arrows", { sorted: vue.unref(sortField) === field.id }])
@@ -6531,7 +6513,7 @@ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
6531
6513
  }, null, 8, ["class"])
6532
6514
  ], 2)
6533
6515
  ])
6534
- ], 8, _hoisted_7$3);
6516
+ ], 8, _hoisted_7$4);
6535
6517
  }), 128))
6536
6518
  ]),
6537
6519
  vue.createElementVNode("tbody", null, [
@@ -6574,7 +6556,7 @@ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
6574
6556
  ]))
6575
6557
  ]);
6576
6558
  }), 128))
6577
- ], 10, _hoisted_9$1);
6559
+ ], 10, _hoisted_9$2);
6578
6560
  }), 128))
6579
6561
  ])
6580
6562
  ])
@@ -6624,9 +6606,12 @@ const _hoisted_2$s = {
6624
6606
  class: "data-row"
6625
6607
  };
6626
6608
  const _hoisted_3$i = { class: "key" };
6627
- const _hoisted_4$c = { key: 1 };
6628
- const _hoisted_5$c = { class: "key" };
6629
- const _hoisted_6$7 = { class: "vlue" };
6609
+ const _hoisted_4$c = { class: "m-0" };
6610
+ const _hoisted_5$c = { key: 1 };
6611
+ const _hoisted_6$7 = { class: "key" };
6612
+ const _hoisted_7$3 = { class: "m-0" };
6613
+ const _hoisted_8$1 = { class: "vlue" };
6614
+ const _hoisted_9$1 = { class: "m-0" };
6630
6615
  const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
6631
6616
  __name: "DataPreview",
6632
6617
  props: /* @__PURE__ */ vue.mergeModels({
@@ -6659,7 +6644,9 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
6659
6644
  key: field.id
6660
6645
  }, [
6661
6646
  vue.unref(iffer)(field, itemData.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$s, [
6662
- vue.createElementVNode("div", _hoisted_3$i, vue.toDisplayString((field == null ? void 0 : field.label) || vue.unref(keyToLabel)(field.id)), 1),
6647
+ vue.createElementVNode("div", _hoisted_3$i, [
6648
+ vue.createElementVNode("p", _hoisted_4$c, vue.toDisplayString((field == null ? void 0 : field.label) || vue.unref(keyToLabel)(field.id)), 1)
6649
+ ]),
6663
6650
  vue.createVNode(vue.unref(_sfc_main$p), {
6664
6651
  modelValue: itemData.value,
6665
6652
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => itemData.value = $event),
@@ -6670,14 +6657,18 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
6670
6657
  ])) : vue.createCommentVNode("", true)
6671
6658
  ], 64);
6672
6659
  }), 128)),
6673
- !((_a2 = _ctx.schema) == null ? void 0 : _a2.length) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$c, [
6660
+ !((_a2 = _ctx.schema) == null ? void 0 : _a2.length) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$c, [
6674
6661
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(computedSchema.value, ({ id, label }) => {
6675
6662
  return vue.openBlock(), vue.createElementBlock("div", {
6676
6663
  key: id,
6677
6664
  class: "data-row"
6678
6665
  }, [
6679
- vue.createElementVNode("div", _hoisted_5$c, vue.toDisplayString(label), 1),
6680
- vue.createElementVNode("div", _hoisted_6$7, vue.toDisplayString(itemData.value[id ?? ""]), 1)
6666
+ vue.createElementVNode("div", _hoisted_6$7, [
6667
+ vue.createElementVNode("p", _hoisted_7$3, vue.toDisplayString(label), 1)
6668
+ ]),
6669
+ vue.createElementVNode("div", _hoisted_8$1, [
6670
+ vue.createElementVNode("p", _hoisted_9$1, vue.toDisplayString(itemData.value[id ?? ""]), 1)
6671
+ ])
6681
6672
  ]);
6682
6673
  }), 128))
6683
6674
  ])) : vue.createCommentVNode("", true),
@@ -6686,7 +6677,7 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
6686
6677
  };
6687
6678
  }
6688
6679
  });
6689
- const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-2281300f"]]);
6680
+ const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-02756011"]]);
6690
6681
  const _hoisted_1$z = {
6691
6682
  key: 0,
6692
6683
  class: "card_label"
@@ -16970,12 +16961,11 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
16970
16961
  }
16971
16962
  });
16972
16963
  const vIf = vue.computed(() => {
16973
- if (props2.field["v-if"] === void 0) return true;
16974
- if (typeof props2.field["v-if"] === "boolean") return props2.field["v-if"];
16975
- if (typeof props2.field["v-if"] === "string") return true;
16976
- if (typeof props2.field["v-if"] === "function") {
16977
- return props2.field["v-if"](fieldData.value, formData.value);
16978
- }
16964
+ if (props2.field["v-if"] === void 0 && props2.field.vIf === void 0) return true;
16965
+ if (typeof props2.field["v-if"] === "boolean" || typeof props2.field.vIf === "boolean") return props2.field["v-if"];
16966
+ if (typeof props2.field["v-if"] === "string" || typeof props2.field.vIf === "string") return true;
16967
+ if (typeof props2.field["v-if"] === "function") return props2.field["v-if"](fieldData.value, formData.value);
16968
+ if (typeof props2.field.vIf === "function") return props2.field.vIf(fieldData.value, formData.value);
16979
16969
  return true;
16980
16970
  });
16981
16971
  const computedFieldData = vue.computed(
@@ -17288,7 +17278,12 @@ function eachDayOfInterval(interval, options) {
17288
17278
  const endTime = reversed ? +startDate : +endDate;
17289
17279
  const currentDate = reversed ? endDate : startDate;
17290
17280
  currentDate.setHours(0, 0, 0, 0);
17291
- let step = 1;
17281
+ let step = (options == null ? void 0 : options.step) ?? 1;
17282
+ if (!step) return [];
17283
+ if (step < 0) {
17284
+ step = -step;
17285
+ reversed = !reversed;
17286
+ }
17292
17287
  const dates = [];
17293
17288
  while (+currentDate <= endTime) {
17294
17289
  dates.push(toDate(currentDate));
@@ -17311,7 +17306,12 @@ function eachQuarterOfInterval(interval, options) {
17311
17306
  let reversed = +startDate > +endDate;
17312
17307
  const endTime = reversed ? +startOfQuarter(startDate) : +startOfQuarter(endDate);
17313
17308
  let currentDate = reversed ? startOfQuarter(endDate) : startOfQuarter(startDate);
17314
- let step = 1;
17309
+ let step = (options == null ? void 0 : options.step) ?? 1;
17310
+ if (!step) return [];
17311
+ if (step < 0) {
17312
+ step = -step;
17313
+ reversed = !reversed;
17314
+ }
17315
17315
  const dates = [];
17316
17316
  while (+currentDate <= endTime) {
17317
17317
  dates.push(toDate(currentDate));
@@ -26157,8 +26157,10 @@ function isScrolledPast(el, elSide, parentSide) {
26157
26157
  var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
26158
26158
  while (parent) {
26159
26159
  var parentSideVal = getRect(parent)[parentSide], visible = void 0;
26160
- {
26160
+ if (parentSide === "top" || parentSide === "left") {
26161
26161
  visible = elSideVal >= parentSideVal;
26162
+ } else {
26163
+ visible = elSideVal <= parentSideVal;
26162
26164
  }
26163
26165
  if (!visible) return parent;
26164
26166
  if (parent === getWindowScrollingElement()) break;
@@ -29533,7 +29535,7 @@ class Fragment {
29533
29535
  /**
29534
29536
  Find the index and inner offset corresponding to a given relative
29535
29537
  position in this fragment. The result object will be reused
29536
- (overwritten) the next time the function is called. @internal
29538
+ (overwritten) the next time the function is called. (Not public.)
29537
29539
  */
29538
29540
  findIndex(pos, round2 = -1) {
29539
29541
  if (pos == 0)
@@ -29739,9 +29741,7 @@ let Mark$1 = class Mark2 {
29739
29741
  let type3 = schema.marks[json.type];
29740
29742
  if (!type3)
29741
29743
  throw new RangeError(`There is no mark type ${json.type} in this schema`);
29742
- let mark = type3.create(json.attrs);
29743
- type3.checkAttrs(mark.attrs);
29744
- return mark;
29744
+ return type3.create(json.attrs);
29745
29745
  }
29746
29746
  /**
29747
29747
  Test whether two sets of marks are identical.
@@ -29875,6 +29875,8 @@ function removeRange(content, from2, to2) {
29875
29875
  function insertInto(content, dist, insert, parent) {
29876
29876
  let { index: index2, offset: offset2 } = content.findIndex(dist), child = content.maybeChild(index2);
29877
29877
  if (offset2 == dist || child.isText) {
29878
+ if (parent && !parent.canReplace(index2, index2, insert))
29879
+ return null;
29878
29880
  return content.cut(0, dist).append(insert).append(content.cut(dist));
29879
29881
  }
29880
29882
  let inner = insertInto(child.content, dist - offset2 - 1, insert);
@@ -30236,28 +30238,17 @@ class ResolvedPos {
30236
30238
  @internal
30237
30239
  */
30238
30240
  static resolveCached(doc2, pos) {
30239
- let cache = resolveCache.get(doc2);
30240
- if (cache) {
30241
- for (let i2 = 0; i2 < cache.elts.length; i2++) {
30242
- let elt = cache.elts[i2];
30243
- if (elt.pos == pos)
30244
- return elt;
30245
- }
30246
- } else {
30247
- resolveCache.set(doc2, cache = new ResolveCache());
30241
+ for (let i2 = 0; i2 < resolveCache.length; i2++) {
30242
+ let cached2 = resolveCache[i2];
30243
+ if (cached2.pos == pos && cached2.doc == doc2)
30244
+ return cached2;
30248
30245
  }
30249
- let result2 = cache.elts[cache.i] = ResolvedPos.resolve(doc2, pos);
30250
- cache.i = (cache.i + 1) % resolveCacheSize;
30246
+ let result2 = resolveCache[resolveCachePos] = ResolvedPos.resolve(doc2, pos);
30247
+ resolveCachePos = (resolveCachePos + 1) % resolveCacheSize;
30251
30248
  return result2;
30252
30249
  }
30253
30250
  }
30254
- class ResolveCache {
30255
- constructor() {
30256
- this.elts = [];
30257
- this.i = 0;
30258
- }
30259
- }
30260
- const resolveCacheSize = 12, resolveCache = /* @__PURE__ */ new WeakMap();
30251
+ let resolveCache = [], resolveCachePos = 0, resolveCacheSize = 12;
30261
30252
  class NodeRange {
30262
30253
  /**
30263
30254
  Construct a node range. `$from` and `$to` should point into the
@@ -30643,17 +30634,13 @@ let Node$3 = class Node2 {
30643
30634
  }
30644
30635
  /**
30645
30636
  Check whether this node and its descendants conform to the
30646
- schema, and raise an exception when they do not.
30637
+ schema, and raise error when they do not.
30647
30638
  */
30648
30639
  check() {
30649
30640
  this.type.checkContent(this.content);
30650
- this.type.checkAttrs(this.attrs);
30651
30641
  let copy2 = Mark$1.none;
30652
- for (let i2 = 0; i2 < this.marks.length; i2++) {
30653
- let mark = this.marks[i2];
30654
- mark.type.checkAttrs(mark.attrs);
30655
- copy2 = mark.addToSet(copy2);
30656
- }
30642
+ for (let i2 = 0; i2 < this.marks.length; i2++)
30643
+ copy2 = this.marks[i2].addToSet(copy2);
30657
30644
  if (!Mark$1.sameSet(copy2, this.marks))
30658
30645
  throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
30659
30646
  this.content.forEach((node) => node.check());
@@ -30679,7 +30666,7 @@ let Node$3 = class Node2 {
30679
30666
  static fromJSON(schema, json) {
30680
30667
  if (!json)
30681
30668
  throw new RangeError("Invalid input for Node.fromJSON");
30682
- let marks = void 0;
30669
+ let marks = null;
30683
30670
  if (json.marks) {
30684
30671
  if (!Array.isArray(json.marks))
30685
30672
  throw new RangeError("Invalid mark data for Node.fromJSON");
@@ -30691,9 +30678,7 @@ let Node$3 = class Node2 {
30691
30678
  return schema.text(json.text, marks);
30692
30679
  }
30693
30680
  let content = Fragment.fromJSON(schema, json.content);
30694
- let node = schema.nodeType(json.type).create(json.attrs, content, marks);
30695
- node.type.checkAttrs(node.attrs);
30696
- return node;
30681
+ return schema.nodeType(json.type).create(json.attrs, content, marks);
30697
30682
  }
30698
30683
  };
30699
30684
  Node$3.prototype.text = void 0;
@@ -31175,16 +31160,6 @@ function computeAttrs(attrs, value) {
31175
31160
  }
31176
31161
  return built;
31177
31162
  }
31178
- function checkAttrs(attrs, values3, type3, name) {
31179
- for (let name2 in values3)
31180
- if (!(name2 in attrs))
31181
- throw new RangeError(`Unsupported attribute ${name2} for ${type3} of type ${name2}`);
31182
- for (let name2 in attrs) {
31183
- let attr = attrs[name2];
31184
- if (attr.validate)
31185
- attr.validate(values3[name2]);
31186
- }
31187
- }
31188
31163
  function initAttrs(attrs) {
31189
31164
  let result2 = /* @__PURE__ */ Object.create(null);
31190
31165
  if (attrs)
@@ -31314,7 +31289,7 @@ let NodeType$1 = class NodeType2 {
31314
31289
  }
31315
31290
  /**
31316
31291
  Returns true if the given fragment is valid content for this node
31317
- type.
31292
+ type with the given attributes.
31318
31293
  */
31319
31294
  validContent(content) {
31320
31295
  let result2 = this.contentMatch.matchFragment(content);
@@ -31335,12 +31310,6 @@ let NodeType$1 = class NodeType2 {
31335
31310
  throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
31336
31311
  }
31337
31312
  /**
31338
- @internal
31339
- */
31340
- checkAttrs(attrs) {
31341
- checkAttrs(this.attrs, attrs, "node", this.name);
31342
- }
31343
- /**
31344
31313
  Check whether the given mark type is allowed in this node.
31345
31314
  */
31346
31315
  allowsMarkType(markType) {
@@ -31390,19 +31359,10 @@ let NodeType$1 = class NodeType2 {
31390
31359
  return result2;
31391
31360
  }
31392
31361
  };
31393
- function validateType(type3) {
31394
- let types = type3.split("|");
31395
- return (value) => {
31396
- let name = value === null ? "null" : typeof value;
31397
- if (types.indexOf(name) < 0)
31398
- throw new RangeError(`Expected value of type ${types}, got ${name}`);
31399
- };
31400
- }
31401
31362
  class Attribute {
31402
31363
  constructor(options) {
31403
31364
  this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
31404
31365
  this.default = options.default;
31405
- this.validate = typeof options.validate == "string" ? validateType(options.validate) : options.validate;
31406
31366
  }
31407
31367
  get isRequired() {
31408
31368
  return !this.hasDefault;
@@ -31461,12 +31421,6 @@ class MarkType {
31461
31421
  return set2[i2];
31462
31422
  }
31463
31423
  /**
31464
- @internal
31465
- */
31466
- checkAttrs(attrs) {
31467
- checkAttrs(this.attrs, attrs, "mark", this.name);
31468
- }
31469
- /**
31470
31424
  Queries whether a given mark type is
31471
31425
  [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
31472
31426
  */
@@ -31479,7 +31433,6 @@ class Schema {
31479
31433
  Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
31480
31434
  */
31481
31435
  constructor(spec) {
31482
- this.linebreakReplacement = null;
31483
31436
  this.cached = /* @__PURE__ */ Object.create(null);
31484
31437
  let instanceSpec = this.spec = {};
31485
31438
  for (let prop3 in spec)
@@ -31493,13 +31446,6 @@ class Schema {
31493
31446
  let type3 = this.nodes[prop3], contentExpr = type3.spec.content || "", markExpr = type3.spec.marks;
31494
31447
  type3.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
31495
31448
  type3.inlineContent = type3.contentMatch.inlineContent;
31496
- if (type3.spec.linebreakReplacement) {
31497
- if (this.linebreakReplacement)
31498
- throw new RangeError("Multiple linebreak nodes defined");
31499
- if (!type3.isInline || !type3.isLeaf)
31500
- throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
31501
- this.linebreakReplacement = type3;
31502
- }
31503
31449
  type3.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type3.inlineContent ? [] : null;
31504
31450
  }
31505
31451
  for (let prop3 in this.marks) {
@@ -31584,12 +31530,6 @@ function gatherMarks(schema, marks) {
31584
31530
  }
31585
31531
  return found2;
31586
31532
  }
31587
- function isTagRule(rule) {
31588
- return rule.tag != null;
31589
- }
31590
- function isStyleRule(rule) {
31591
- return rule.style != null;
31592
- }
31593
31533
  class DOMParser {
31594
31534
  /**
31595
31535
  Create a parser that targets the given schema, using the given
@@ -31600,16 +31540,11 @@ class DOMParser {
31600
31540
  this.rules = rules;
31601
31541
  this.tags = [];
31602
31542
  this.styles = [];
31603
- let matchedStyles = this.matchedStyles = [];
31604
31543
  rules.forEach((rule) => {
31605
- if (isTagRule(rule)) {
31544
+ if (rule.tag)
31606
31545
  this.tags.push(rule);
31607
- } else if (isStyleRule(rule)) {
31608
- let prop3 = /[^=]*/.exec(rule.style)[0];
31609
- if (matchedStyles.indexOf(prop3) < 0)
31610
- matchedStyles.push(prop3);
31546
+ else if (rule.style)
31611
31547
  this.styles.push(rule);
31612
- }
31613
31548
  });
31614
31549
  this.normalizeLists = !this.tags.some((r2) => {
31615
31550
  if (!/^(ul|ol)\b/.test(r2.tag) || !r2.node)
@@ -31869,10 +31804,10 @@ class ParseContext {
31869
31804
  this.addElement(dom);
31870
31805
  }
31871
31806
  withStyleRules(dom, f2) {
31872
- let style2 = dom.style;
31873
- if (!style2 || !style2.length)
31807
+ let style2 = dom.getAttribute("style");
31808
+ if (!style2)
31874
31809
  return f2();
31875
- let marks = this.readStyles(dom.style);
31810
+ let marks = this.readStyles(parseStyles(style2));
31876
31811
  if (!marks)
31877
31812
  return;
31878
31813
  let [addMarks, removeMarks] = marks, top2 = this.top;
@@ -31966,30 +31901,27 @@ class ParseContext {
31966
31901
  // had a rule with `ignore` set.
31967
31902
  readStyles(styles) {
31968
31903
  let add2 = Mark$1.none, remove2 = Mark$1.none;
31969
- if (styles.length)
31970
- for (let i2 = 0; i2 < this.parser.matchedStyles.length; i2++) {
31971
- let name = this.parser.matchedStyles[i2], value = styles.getPropertyValue(name);
31972
- if (value)
31973
- for (let after = void 0; ; ) {
31974
- let rule = this.parser.matchStyle(name, value, this, after);
31975
- if (!rule)
31976
- break;
31977
- if (rule.ignore)
31978
- return null;
31979
- if (rule.clearMark) {
31980
- this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
31981
- if (rule.clearMark(m2))
31982
- remove2 = m2.addToSet(remove2);
31983
- });
31984
- } else {
31985
- add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
31986
- }
31987
- if (rule.consuming === false)
31988
- after = rule;
31989
- else
31990
- break;
31991
- }
31904
+ for (let i2 = 0; i2 < styles.length; i2 += 2) {
31905
+ for (let after = void 0; ; ) {
31906
+ let rule = this.parser.matchStyle(styles[i2], styles[i2 + 1], this, after);
31907
+ if (!rule)
31908
+ break;
31909
+ if (rule.ignore)
31910
+ return null;
31911
+ if (rule.clearMark) {
31912
+ this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
31913
+ if (rule.clearMark(m2))
31914
+ remove2 = m2.addToSet(remove2);
31915
+ });
31916
+ } else {
31917
+ add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
31918
+ }
31919
+ if (rule.consuming === false)
31920
+ after = rule;
31921
+ else
31922
+ break;
31992
31923
  }
31924
+ }
31993
31925
  return [add2, remove2];
31994
31926
  }
31995
31927
  // Look up a handler for the given node. If none are found, return
@@ -32258,6 +32190,12 @@ function normalizeList(dom) {
32258
32190
  function matches(dom, selector2) {
32259
32191
  return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector2);
32260
32192
  }
32193
+ function parseStyles(style2) {
32194
+ let re2 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m2, result2 = [];
32195
+ while (m2 = re2.exec(style2))
32196
+ result2.push(m2[1], m2[2].trim());
32197
+ return result2;
32198
+ }
32261
32199
  function copy$2(obj) {
32262
32200
  let copy2 = {};
32263
32201
  for (let prop3 in obj)
@@ -32348,7 +32286,7 @@ class DOMSerializer {
32348
32286
  @internal
32349
32287
  */
32350
32288
  serializeNodeInner(node, options) {
32351
- let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
32289
+ let { dom, contentDOM } = DOMSerializer.renderSpec(doc$1(options), this.nodes[node.type.name](node));
32352
32290
  if (contentDOM) {
32353
32291
  if (node.isLeaf)
32354
32292
  throw new RangeError("Content hole not allowed in a leaf node spec");
@@ -32379,7 +32317,7 @@ class DOMSerializer {
32379
32317
  */
32380
32318
  serializeMark(mark, inline, options = {}) {
32381
32319
  let toDOM = this.marks[mark.type.name];
32382
- return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
32320
+ return toDOM && DOMSerializer.renderSpec(doc$1(options), toDOM(mark, inline));
32383
32321
  }
32384
32322
  /**
32385
32323
  Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If
@@ -32387,7 +32325,48 @@ class DOMSerializer {
32387
32325
  node with the hole.
32388
32326
  */
32389
32327
  static renderSpec(doc2, structure, xmlNS = null) {
32390
- return renderSpec(doc2, structure, xmlNS);
32328
+ if (typeof structure == "string")
32329
+ return { dom: doc2.createTextNode(structure) };
32330
+ if (structure.nodeType != null)
32331
+ return { dom: structure };
32332
+ if (structure.dom && structure.dom.nodeType != null)
32333
+ return structure;
32334
+ let tagName = structure[0], space = tagName.indexOf(" ");
32335
+ if (space > 0) {
32336
+ xmlNS = tagName.slice(0, space);
32337
+ tagName = tagName.slice(space + 1);
32338
+ }
32339
+ let contentDOM;
32340
+ let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
32341
+ let attrs = structure[1], start2 = 1;
32342
+ if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
32343
+ start2 = 2;
32344
+ for (let name in attrs)
32345
+ if (attrs[name] != null) {
32346
+ let space2 = name.indexOf(" ");
32347
+ if (space2 > 0)
32348
+ dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
32349
+ else
32350
+ dom.setAttribute(name, attrs[name]);
32351
+ }
32352
+ }
32353
+ for (let i2 = start2; i2 < structure.length; i2++) {
32354
+ let child = structure[i2];
32355
+ if (child === 0) {
32356
+ if (i2 < structure.length - 1 || i2 > start2)
32357
+ throw new RangeError("Content hole must be the only child of its parent node");
32358
+ return { dom, contentDOM: dom };
32359
+ } else {
32360
+ let { dom: inner, contentDOM: innerContent } = DOMSerializer.renderSpec(doc2, child, xmlNS);
32361
+ dom.appendChild(inner);
32362
+ if (innerContent) {
32363
+ if (contentDOM)
32364
+ throw new RangeError("Multiple content holes");
32365
+ contentDOM = innerContent;
32366
+ }
32367
+ }
32368
+ }
32369
+ return { dom, contentDOM };
32391
32370
  }
32392
32371
  /**
32393
32372
  Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
@@ -32425,84 +32404,6 @@ function gatherToDOM(obj) {
32425
32404
  function doc$1(options) {
32426
32405
  return options.document || window.document;
32427
32406
  }
32428
- const suspiciousAttributeCache = /* @__PURE__ */ new WeakMap();
32429
- function suspiciousAttributes(attrs) {
32430
- let value = suspiciousAttributeCache.get(attrs);
32431
- if (value === void 0)
32432
- suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
32433
- return value;
32434
- }
32435
- function suspiciousAttributesInner(attrs) {
32436
- let result2 = null;
32437
- function scan(value) {
32438
- if (value && typeof value == "object") {
32439
- if (Array.isArray(value)) {
32440
- if (typeof value[0] == "string") {
32441
- if (!result2)
32442
- result2 = [];
32443
- result2.push(value);
32444
- } else {
32445
- for (let i2 = 0; i2 < value.length; i2++)
32446
- scan(value[i2]);
32447
- }
32448
- } else {
32449
- for (let prop3 in value)
32450
- scan(value[prop3]);
32451
- }
32452
- }
32453
- }
32454
- scan(attrs);
32455
- return result2;
32456
- }
32457
- function renderSpec(doc2, structure, xmlNS, blockArraysIn) {
32458
- if (typeof structure == "string")
32459
- return { dom: doc2.createTextNode(structure) };
32460
- if (structure.nodeType != null)
32461
- return { dom: structure };
32462
- if (structure.dom && structure.dom.nodeType != null)
32463
- return structure;
32464
- let tagName = structure[0], suspicious;
32465
- if (typeof tagName != "string")
32466
- throw new RangeError("Invalid array passed to renderSpec");
32467
- if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1)
32468
- throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
32469
- let space = tagName.indexOf(" ");
32470
- if (space > 0) {
32471
- xmlNS = tagName.slice(0, space);
32472
- tagName = tagName.slice(space + 1);
32473
- }
32474
- let contentDOM;
32475
- let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
32476
- let attrs = structure[1], start2 = 1;
32477
- if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
32478
- start2 = 2;
32479
- for (let name in attrs)
32480
- if (attrs[name] != null) {
32481
- let space2 = name.indexOf(" ");
32482
- if (space2 > 0)
32483
- dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
32484
- else
32485
- dom.setAttribute(name, attrs[name]);
32486
- }
32487
- }
32488
- for (let i2 = start2; i2 < structure.length; i2++) {
32489
- let child = structure[i2];
32490
- if (child === 0) {
32491
- if (i2 < structure.length - 1 || i2 > start2)
32492
- throw new RangeError("Content hole must be the only child of its parent node");
32493
- return { dom, contentDOM: dom };
32494
- } else {
32495
- let { dom: inner, contentDOM: innerContent } = renderSpec(doc2, child, xmlNS, blockArraysIn);
32496
- dom.appendChild(inner);
32497
- if (innerContent) {
32498
- if (contentDOM)
32499
- throw new RangeError("Multiple content holes");
32500
- contentDOM = innerContent;
32501
- }
32502
- }
32503
- }
32504
- return { dom, contentDOM };
32505
- }
32506
32407
  const lower16 = 65535;
32507
32408
  const factor16 = Math.pow(2, 16);
32508
32409
  function makeRecover(index2, offset2) {
@@ -33162,8 +33063,7 @@ class ReplaceAroundStep extends Step$1 {
33162
33063
  }
33163
33064
  map(mapping) {
33164
33065
  let from2 = mapping.mapResult(this.from, 1), to2 = mapping.mapResult(this.to, -1);
33165
- let gapFrom = this.from == this.gapFrom ? from2.pos : mapping.map(this.gapFrom, -1);
33166
- let gapTo = this.to == this.gapTo ? to2.pos : mapping.map(this.gapTo, 1);
33066
+ let gapFrom = mapping.map(this.gapFrom, -1), gapTo = mapping.map(this.gapTo, 1);
33167
33067
  if (from2.deletedAcross && to2.deletedAcross || gapFrom < from2.pos || gapTo > to2.pos)
33168
33068
  return null;
33169
33069
  return new ReplaceAroundStep(from2.pos, to2.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
@@ -33276,7 +33176,7 @@ function removeMark(tr2, from2, to2, mark) {
33276
33176
  });
33277
33177
  matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
33278
33178
  }
33279
- function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch, clearNewlines = true) {
33179
+ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch) {
33280
33180
  let node = tr2.doc.nodeAt(pos);
33281
33181
  let replSteps = [], cur = pos + 1;
33282
33182
  for (let i2 = 0; i2 < node.childCount; i2++) {
@@ -33289,7 +33189,7 @@ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatc
33289
33189
  for (let j2 = 0; j2 < child.marks.length; j2++)
33290
33190
  if (!parentType.allowsMarkType(child.marks[j2].type))
33291
33191
  tr2.step(new RemoveMarkStep(cur, end2, child.marks[j2]));
33292
- if (clearNewlines && child.isText && parentType.whitespace != "pre") {
33192
+ if (child.isText && !parentType.spec.code) {
33293
33193
  let m2, newline = /\r?\n|\r/g, slice4;
33294
33194
  while (m2 = newline.exec(child.text)) {
33295
33195
  if (!slice4)
@@ -33398,45 +33298,14 @@ function setBlockType$1(tr2, from2, to2, type3, attrs) {
33398
33298
  let mapFrom = tr2.steps.length;
33399
33299
  tr2.doc.nodesBetween(from2, to2, (node, pos) => {
33400
33300
  if (node.isTextblock && !node.hasMarkup(type3, attrs) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type3)) {
33401
- let convertNewlines = null;
33402
- if (type3.schema.linebreakReplacement) {
33403
- let pre = type3.whitespace == "pre", supportLinebreak = !!type3.contentMatch.matchType(type3.schema.linebreakReplacement);
33404
- if (pre && !supportLinebreak)
33405
- convertNewlines = false;
33406
- else if (!pre && supportLinebreak)
33407
- convertNewlines = true;
33408
- }
33409
- if (convertNewlines === false)
33410
- replaceLinebreaks(tr2, node, pos, mapFrom);
33411
- clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type3, void 0, convertNewlines === null);
33301
+ tr2.clearIncompatible(tr2.mapping.slice(mapFrom).map(pos, 1), type3);
33412
33302
  let mapping = tr2.mapping.slice(mapFrom);
33413
33303
  let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
33414
33304
  tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type3.create(attrs, null, node.marks)), 0, 0), 1, true));
33415
- if (convertNewlines === true)
33416
- replaceNewlines(tr2, node, pos, mapFrom);
33417
33305
  return false;
33418
33306
  }
33419
33307
  });
33420
33308
  }
33421
- function replaceNewlines(tr2, node, pos, mapFrom) {
33422
- node.forEach((child, offset2) => {
33423
- if (child.isText) {
33424
- let m2, newline = /\r?\n|\r/g;
33425
- while (m2 = newline.exec(child.text)) {
33426
- let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2 + m2.index);
33427
- tr2.replaceWith(start2, start2 + 1, node.type.schema.linebreakReplacement.create());
33428
- }
33429
- }
33430
- });
33431
- }
33432
- function replaceLinebreaks(tr2, node, pos, mapFrom) {
33433
- node.forEach((child, offset2) => {
33434
- if (child.type == child.type.schema.linebreakReplacement) {
33435
- let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2);
33436
- tr2.replaceWith(start2, start2 + 1, node.type.schema.text("\n"));
33437
- }
33438
- });
33439
- }
33440
33309
  function canChangeType(doc2, pos, type3) {
33441
33310
  let $pos = doc2.resolve(pos), index2 = $pos.index();
33442
33311
  return $pos.parent.canReplaceWith(index2, index2 + 1, type3);
@@ -35202,9 +35071,6 @@ const textRange = function(node, from2, to2) {
35202
35071
  range2.setStart(node, from2 || 0);
35203
35072
  return range2;
35204
35073
  };
35205
- const clearReusedRange = function() {
35206
- reusedRange = null;
35207
- };
35208
35074
  const isEquivalentPosition = function(node, off2, targetNode, targetOff) {
35209
35075
  return targetNode && (scanFor(node, off2, targetNode, targetOff, -1) || scanFor(node, off2, targetNode, targetOff, 1));
35210
35076
  };
@@ -35232,40 +35098,6 @@ function scanFor(node, off2, targetNode, targetOff, dir) {
35232
35098
  function nodeSize(node) {
35233
35099
  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
35234
35100
  }
35235
- function textNodeBefore$1(node, offset2) {
35236
- for (; ; ) {
35237
- if (node.nodeType == 3 && offset2)
35238
- return node;
35239
- if (node.nodeType == 1 && offset2 > 0) {
35240
- if (node.contentEditable == "false")
35241
- return null;
35242
- node = node.childNodes[offset2 - 1];
35243
- offset2 = nodeSize(node);
35244
- } else if (node.parentNode && !hasBlockDesc(node)) {
35245
- offset2 = domIndex(node);
35246
- node = node.parentNode;
35247
- } else {
35248
- return null;
35249
- }
35250
- }
35251
- }
35252
- function textNodeAfter$1(node, offset2) {
35253
- for (; ; ) {
35254
- if (node.nodeType == 3 && offset2 < node.nodeValue.length)
35255
- return node;
35256
- if (node.nodeType == 1 && offset2 < node.childNodes.length) {
35257
- if (node.contentEditable == "false")
35258
- return null;
35259
- node = node.childNodes[offset2];
35260
- offset2 = 0;
35261
- } else if (node.parentNode && !hasBlockDesc(node)) {
35262
- offset2 = domIndex(node) + 1;
35263
- node = node.parentNode;
35264
- } else {
35265
- return null;
35266
- }
35267
- }
35268
- }
35269
35101
  function isOnEdge(node, offset2, parent) {
35270
35102
  for (let atStart = offset2 == 0, atEnd = offset2 == nodeSize(node); atStart || atEnd; ) {
35271
35103
  if (node == parent)
@@ -35337,14 +35169,6 @@ const android = /Android \d/.test(agent);
35337
35169
  const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
35338
35170
  const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
35339
35171
  function windowRect(doc2) {
35340
- let vp = doc2.defaultView && doc2.defaultView.visualViewport;
35341
- if (vp)
35342
- return {
35343
- left: 0,
35344
- right: vp.width,
35345
- top: 0,
35346
- bottom: vp.height
35347
- };
35348
35172
  return {
35349
35173
  left: 0,
35350
35174
  right: doc2.documentElement.clientWidth,
@@ -35546,14 +35370,14 @@ function posFromCaret(view, node, offset2, coords) {
35546
35370
  let desc = view.docView.nearestDesc(cur, true);
35547
35371
  if (!desc)
35548
35372
  return null;
35549
- if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {
35373
+ if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent && !sawBlock || !desc.contentDOM)) {
35550
35374
  let rect = desc.dom.getBoundingClientRect();
35551
- if (desc.node.isBlock && desc.parent) {
35552
- if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
35375
+ if (desc.node.isBlock && desc.parent && !sawBlock) {
35376
+ sawBlock = true;
35377
+ if (rect.left > coords.left || rect.top > coords.top)
35553
35378
  outsideBlock = desc.posBefore;
35554
- else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
35379
+ else if (rect.right < coords.left || rect.bottom < coords.top)
35555
35380
  outsideBlock = desc.posAfter;
35556
- sawBlock = true;
35557
35381
  }
35558
35382
  if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
35559
35383
  let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;
@@ -36168,9 +35992,6 @@ class ViewDesc {
36168
35992
  get ignoreForCoords() {
36169
35993
  return false;
36170
35994
  }
36171
- isText(text) {
36172
- return false;
36173
- }
36174
35995
  }
36175
35996
  class WidgetViewDesc extends ViewDesc {
36176
35997
  constructor(parent, widget, view, pos) {
@@ -36409,7 +36230,8 @@ class NodeViewDesc extends ViewDesc {
36409
36230
  let { from: from2, to: to2 } = view.state.selection;
36410
36231
  if (!(view.state.selection instanceof TextSelection) || from2 < pos || to2 > pos + this.node.content.size)
36411
36232
  return null;
36412
- let textNode = view.input.compositionNode;
36233
+ let sel = view.domSelectionRange();
36234
+ let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
36413
36235
  if (!textNode || !this.dom.contains(textNode.parentNode))
36414
36236
  return null;
36415
36237
  if (this.node.inlineContent) {
@@ -36475,11 +36297,10 @@ class NodeViewDesc extends ViewDesc {
36475
36297
  }
36476
36298
  // Remove selected node marking from this node.
36477
36299
  deselectNode() {
36478
- if (this.nodeDOM.nodeType == 1) {
36300
+ if (this.nodeDOM.nodeType == 1)
36479
36301
  this.nodeDOM.classList.remove("ProseMirror-selectednode");
36480
- if (this.contentDOM || !this.node.type.spec.draggable)
36481
- this.dom.removeAttribute("draggable");
36482
- }
36302
+ if (this.contentDOM || !this.node.type.spec.draggable)
36303
+ this.dom.removeAttribute("draggable");
36483
36304
  }
36484
36305
  get domAtom() {
36485
36306
  return this.node.isAtom;
@@ -36545,9 +36366,6 @@ class TextViewDesc extends NodeViewDesc {
36545
36366
  get domAtom() {
36546
36367
  return false;
36547
36368
  }
36548
- isText(text) {
36549
- return this.node.text == text;
36550
- }
36551
36369
  }
36552
36370
  class TrailingHackViewDesc extends ViewDesc {
36553
36371
  parseRule() {
@@ -37063,6 +36881,23 @@ function iosHacks(dom) {
37063
36881
  dom.style.cssText = oldCSS;
37064
36882
  }
37065
36883
  }
36884
+ function nearbyTextNode(node, offset2) {
36885
+ for (; ; ) {
36886
+ if (node.nodeType == 3)
36887
+ return node;
36888
+ if (node.nodeType == 1 && offset2 > 0) {
36889
+ if (node.childNodes.length > offset2 && node.childNodes[offset2].nodeType == 3)
36890
+ return node.childNodes[offset2];
36891
+ node = node.childNodes[offset2 - 1];
36892
+ offset2 = nodeSize(node);
36893
+ } else if (node.nodeType == 1 && offset2 < node.childNodes.length) {
36894
+ node = node.childNodes[offset2];
36895
+ offset2 = 0;
36896
+ } else {
36897
+ return null;
36898
+ }
36899
+ }
36900
+ }
37066
36901
  function findTextInFragment(frag, text, from2, to2) {
37067
36902
  for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to2; ) {
37068
36903
  let child = frag.child(i2++), childStart = pos;
@@ -37637,7 +37472,7 @@ function serializeForClipboard(view, slice4) {
37637
37472
  if (firstChild && firstChild.nodeType == 1)
37638
37473
  firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
37639
37474
  let text = view.someProp("clipboardTextSerializer", (f2) => f2(slice4, view)) || slice4.content.textBetween(0, slice4.content.size, "\n\n");
37640
- return { dom: wrap2, text, slice: slice4 };
37475
+ return { dom: wrap2, text };
37641
37476
  }
37642
37477
  function parseFromClipboard(view, text, html, plainText, $context) {
37643
37478
  let inCode = $context.parent.type.spec.code;
@@ -37857,7 +37692,6 @@ class InputState {
37857
37692
  this.lastTouch = 0;
37858
37693
  this.lastAndroidDelete = 0;
37859
37694
  this.composing = false;
37860
- this.compositionNode = null;
37861
37695
  this.composingTimeout = -1;
37862
37696
  this.compositionNodes = [];
37863
37697
  this.compositionEndedAt = -2e8;
@@ -37985,7 +37819,8 @@ function updateSelection(view, selection, origin2) {
37985
37819
  if (!view.focused)
37986
37820
  view.focus();
37987
37821
  let tr2 = view.state.tr.setSelection(selection);
37988
- tr2.setMeta("pointer", true);
37822
+ if (origin2 == "pointer")
37823
+ tr2.setMeta("pointer", true);
37989
37824
  view.dispatch(tr2);
37990
37825
  }
37991
37826
  function selectClickedLeaf(view, inside) {
@@ -37993,7 +37828,7 @@ function selectClickedLeaf(view, inside) {
37993
37828
  return false;
37994
37829
  let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
37995
37830
  if (node && node.isAtom && NodeSelection.isSelectable(node)) {
37996
- updateSelection(view, new NodeSelection($pos));
37831
+ updateSelection(view, new NodeSelection($pos), "pointer");
37997
37832
  return true;
37998
37833
  }
37999
37834
  return false;
@@ -38016,7 +37851,7 @@ function selectClickedNode(view, inside) {
38016
37851
  }
38017
37852
  }
38018
37853
  if (selectAt != null) {
38019
- updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
37854
+ updateSelection(view, NodeSelection.create(view.state.doc, selectAt), "pointer");
38020
37855
  return true;
38021
37856
  } else {
38022
37857
  return false;
@@ -38037,7 +37872,7 @@ function defaultTripleClick(view, inside, event) {
38037
37872
  let doc2 = view.state.doc;
38038
37873
  if (inside == -1) {
38039
37874
  if (doc2.inlineContent) {
38040
- updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size));
37875
+ updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size), "pointer");
38041
37876
  return true;
38042
37877
  }
38043
37878
  return false;
@@ -38047,9 +37882,9 @@ function defaultTripleClick(view, inside, event) {
38047
37882
  let node = i2 > $pos.depth ? $pos.nodeAfter : $pos.node(i2);
38048
37883
  let nodePos = $pos.before(i2);
38049
37884
  if (node.inlineContent)
38050
- updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size));
37885
+ updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size), "pointer");
38051
37886
  else if (NodeSelection.isSelectable(node))
38052
- updateSelection(view, NodeSelection.create(doc2, nodePos));
37887
+ updateSelection(view, NodeSelection.create(doc2, nodePos), "pointer");
38053
37888
  else
38054
37889
  continue;
38055
37890
  return true;
@@ -38106,7 +37941,7 @@ class MouseDown {
38106
37941
  }
38107
37942
  const target = flushed ? null : event.target;
38108
37943
  const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
38109
- this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;
37944
+ this.target = targetDesc ? targetDesc.dom : null;
38110
37945
  let { selection } = view.state;
38111
37946
  if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
38112
37947
  this.mightDrag = {
@@ -38166,7 +38001,7 @@ class MouseDown {
38166
38001
  // thus doesn't get a reaction from ProseMirror. This
38167
38002
  // works around that.
38168
38003
  chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {
38169
- updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)));
38004
+ updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)), "pointer");
38170
38005
  event.preventDefault();
38171
38006
  } else {
38172
38007
  setSelectionOrigin(this.view, "pointer");
@@ -38238,7 +38073,6 @@ editHandlers.compositionend = (view, event) => {
38238
38073
  view.input.composing = false;
38239
38074
  view.input.compositionEndedAt = event.timeStamp;
38240
38075
  view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
38241
- view.input.compositionNode = null;
38242
38076
  if (view.input.compositionPendingChanges)
38243
38077
  Promise.resolve().then(() => view.domObserver.flush());
38244
38078
  view.input.compositionID++;
@@ -38258,26 +38092,6 @@ function clearComposition(view) {
38258
38092
  while (view.input.compositionNodes.length > 0)
38259
38093
  view.input.compositionNodes.pop().markParentsDirty();
38260
38094
  }
38261
- function findCompositionNode(view) {
38262
- let sel = view.domSelectionRange();
38263
- if (!sel.focusNode)
38264
- return null;
38265
- let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
38266
- let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
38267
- if (textBefore && textAfter && textBefore != textAfter) {
38268
- let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;
38269
- if (textBefore == lastChanged || textAfter == lastChanged)
38270
- return lastChanged;
38271
- if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
38272
- return textAfter;
38273
- } else if (view.input.compositionNode == textAfter) {
38274
- let descBefore = textBefore.pmViewDesc;
38275
- if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
38276
- return textAfter;
38277
- }
38278
- }
38279
- return textBefore || textAfter;
38280
- }
38281
38095
  function timestampFromCustomEvent() {
38282
38096
  let event = document.createEvent("Event");
38283
38097
  event.initEvent("event", true, true);
@@ -38412,8 +38226,7 @@ handlers.dragstart = (view, _event) => {
38412
38226
  if (desc && desc.node.type.spec.draggable && desc != view.docView)
38413
38227
  node = NodeSelection.create(view.state.doc, desc.posBefore);
38414
38228
  }
38415
- let draggedSlice = (node || view.state.selection).content();
38416
- let { dom, text, slice: slice4 } = serializeForClipboard(view, draggedSlice);
38229
+ let slice4 = (node || view.state.selection).content(), { dom, text } = serializeForClipboard(view, slice4);
38417
38230
  event.dataTransfer.clearData();
38418
38231
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
38419
38232
  event.dataTransfer.effectAllowed = "copyMove";
@@ -38833,6 +38646,9 @@ class DecorationSet {
38833
38646
  return this;
38834
38647
  return local.length || children2.length ? new DecorationSet(local, children2) : empty$1;
38835
38648
  }
38649
+ /**
38650
+ @internal
38651
+ */
38836
38652
  forChild(offset2, node) {
38837
38653
  if (this == empty$1)
38838
38654
  return this;
@@ -39186,7 +39002,6 @@ class DOMObserver {
39186
39002
  this.currentSelection = new SelectionState();
39187
39003
  this.onCharData = null;
39188
39004
  this.suppressingSelectionUpdates = false;
39189
- this.lastChangedTextNode = null;
39190
39005
  this.observer = window.MutationObserver && new window.MutationObserver((mutations) => {
39191
39006
  for (let i2 = 0; i2 < mutations.length; i2++)
39192
39007
  this.queue.push(mutations[i2]);
@@ -39312,21 +39127,14 @@ class DOMObserver {
39312
39127
  }
39313
39128
  }
39314
39129
  }
39315
- if (gecko && added.length) {
39130
+ if (gecko && added.length > 1) {
39316
39131
  let brs = added.filter((n2) => n2.nodeName == "BR");
39317
39132
  if (brs.length == 2) {
39318
- let [a2, b2] = brs;
39133
+ let a2 = brs[0], b2 = brs[1];
39319
39134
  if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode)
39320
39135
  b2.remove();
39321
39136
  else
39322
39137
  a2.remove();
39323
- } else {
39324
- let { focusNode } = this.currentSelection;
39325
- for (let br2 of brs) {
39326
- let parent = br2.parentNode;
39327
- if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
39328
- br2.remove();
39329
- }
39330
39138
  }
39331
39139
  }
39332
39140
  let readSel = null;
@@ -39358,12 +39166,8 @@ class DOMObserver {
39358
39166
  if (!desc || desc.ignoreMutation(mut))
39359
39167
  return null;
39360
39168
  if (mut.type == "childList") {
39361
- for (let i2 = 0; i2 < mut.addedNodes.length; i2++) {
39362
- let node = mut.addedNodes[i2];
39363
- added.push(node);
39364
- if (node.nodeType == 3)
39365
- this.lastChangedTextNode = node;
39366
- }
39169
+ for (let i2 = 0; i2 < mut.addedNodes.length; i2++)
39170
+ added.push(mut.addedNodes[i2]);
39367
39171
  if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))
39368
39172
  return { from: desc.posBefore, to: desc.posAfter };
39369
39173
  let prev = mut.previousSibling, next = mut.nextSibling;
@@ -39384,7 +39188,6 @@ class DOMObserver {
39384
39188
  } else if (mut.type == "attributes") {
39385
39189
  return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
39386
39190
  } else {
39387
- this.lastChangedTextNode = mut.target;
39388
39191
  return {
39389
39192
  from: desc.posAtStart,
39390
39193
  to: desc.posAtEnd,
@@ -39411,20 +39214,7 @@ function checkCSS(view) {
39411
39214
  cssCheckWarned = true;
39412
39215
  }
39413
39216
  }
39414
- function rangeToSelectionRange(view, range2) {
39415
- let anchorNode = range2.startContainer, anchorOffset = range2.startOffset;
39416
- let focusNode = range2.endContainer, focusOffset = range2.endOffset;
39417
- let currentAnchor = view.domAtPos(view.state.selection.anchor);
39418
- if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
39419
- [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
39420
- return { anchorNode, anchorOffset, focusNode, focusOffset };
39421
- }
39422
- function safariShadowSelectionRange(view, selection) {
39423
- if (selection.getComposedRanges) {
39424
- let range2 = selection.getComposedRanges(view.root)[0];
39425
- if (range2)
39426
- return rangeToSelectionRange(view, range2);
39427
- }
39217
+ function safariShadowSelectionRange(view) {
39428
39218
  let found2;
39429
39219
  function read2(event) {
39430
39220
  event.preventDefault();
@@ -39434,15 +39224,12 @@ function safariShadowSelectionRange(view, selection) {
39434
39224
  view.dom.addEventListener("beforeinput", read2, true);
39435
39225
  document.execCommand("indent");
39436
39226
  view.dom.removeEventListener("beforeinput", read2, true);
39437
- return found2 ? rangeToSelectionRange(view, found2) : null;
39438
- }
39439
- function blockParent(view, node) {
39440
- for (let p2 = node.parentNode; p2 && p2 != view.dom; p2 = p2.parentNode) {
39441
- let desc = view.docView.nearestDesc(p2, true);
39442
- if (desc && desc.node.isBlock)
39443
- return p2;
39444
- }
39445
- return null;
39227
+ let anchorNode = found2.startContainer, anchorOffset = found2.startOffset;
39228
+ let focusNode = found2.endContainer, focusOffset = found2.endOffset;
39229
+ let currentAnchor = view.domAtPos(view.state.selection.anchor);
39230
+ if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
39231
+ [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
39232
+ return { anchorNode, anchorOffset, focusNode, focusOffset };
39446
39233
  }
39447
39234
  function parseBetween(view, from_, to_) {
39448
39235
  let { node: parent, fromOffset, toOffset, from: from2, to: to2 } = view.docView.parseRange(from_, to_);
@@ -39562,6 +39349,10 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
39562
39349
  return;
39563
39350
  }
39564
39351
  }
39352
+ if (chrome && view.cursorWrapper && parse2.sel && parse2.sel.anchor == view.cursorWrapper.deco.from && parse2.sel.head == parse2.sel.anchor) {
39353
+ let size2 = change.endB - change.start;
39354
+ parse2.sel = { anchor: parse2.sel.anchor + size2, head: parse2.sel.anchor + size2 };
39355
+ }
39565
39356
  view.input.domChangeCount++;
39566
39357
  if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
39567
39358
  if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
@@ -39585,7 +39376,7 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
39585
39376
  view.input.lastIOSEnter = 0;
39586
39377
  return;
39587
39378
  }
39588
- if (view.state.selection.anchor > change.start && looksLikeBackspace(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
39379
+ if (view.state.selection.anchor > change.start && looksLikeJoin(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
39589
39380
  if (android && chrome)
39590
39381
  view.domObserver.suppressSelectionUpdates();
39591
39382
  return;
@@ -39669,18 +39460,12 @@ function isMarkChange(cur, prev) {
39669
39460
  if (Fragment.from(updated).eq(cur))
39670
39461
  return { mark, type: type3 };
39671
39462
  }
39672
- function looksLikeBackspace(old, start2, end2, $newStart, $newEnd) {
39673
- if (
39674
- // The content must have shrunk
39675
- end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
39676
- skipClosingAndOpening($newStart, true, false) < $newEnd.pos
39677
- )
39463
+ function looksLikeJoin(old, start2, end2, $newStart, $newEnd) {
39464
+ if (!$newStart.parent.isTextblock || // The content must have shrunk
39465
+ end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
39466
+ skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
39678
39467
  return false;
39679
39468
  let $start = old.resolve(start2);
39680
- if (!$newStart.parent.isTextblock) {
39681
- let after = $start.nodeAfter;
39682
- return after != null && end2 == start2 + after.nodeSize;
39683
- }
39684
39469
  if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
39685
39470
  return false;
39686
39471
  let $next = old.resolve(skipClosingAndOpening($start, true, true));
@@ -39869,10 +39654,8 @@ class EditorView {
39869
39654
  let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state2.selection.empty && selectionContextChanged(prev.selection, state2.selection);
39870
39655
  if (updateDoc) {
39871
39656
  let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
39872
- if (this.composing)
39873
- this.input.compositionNode = findCompositionNode(this);
39874
39657
  if (redraw || !this.docView.update(state2.doc, outerDeco, innerDeco, this)) {
39875
- this.docView.updateOuterDeco(outerDeco);
39658
+ this.docView.updateOuterDeco([]);
39876
39659
  this.docView.destroy();
39877
39660
  this.docView = docViewDesc(state2.doc, outerDeco, innerDeco, this.dom, this);
39878
39661
  }
@@ -40131,7 +39914,6 @@ class EditorView {
40131
39914
  }
40132
39915
  this.docView.destroy();
40133
39916
  this.docView = null;
40134
- clearReusedRange();
40135
39917
  }
40136
39918
  /**
40137
39919
  This is true when the view has been
@@ -40167,8 +39949,7 @@ class EditorView {
40167
39949
  @internal
40168
39950
  */
40169
39951
  domSelectionRange() {
40170
- let sel = this.domSelection();
40171
- return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
39952
+ return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom ? safariShadowSelectionRange(this) : this.domSelection();
40172
39953
  }
40173
39954
  /**
40174
39955
  @internal
@@ -41159,8 +40940,7 @@ function getAttributesFromExtensions(extensions) {
41159
40940
  const context = {
41160
40941
  name: extension.name,
41161
40942
  options: extension.options,
41162
- storage: extension.storage,
41163
- extensions: nodeAndMarkExtensions
40943
+ storage: extension.storage
41164
40944
  };
41165
40945
  const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", context);
41166
40946
  if (!addGlobalAttributes) {
@@ -41286,7 +41066,7 @@ function fromString(value) {
41286
41066
  return value;
41287
41067
  }
41288
41068
  function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
41289
- if ("style" in parseRule) {
41069
+ if (parseRule.style) {
41290
41070
  return parseRule;
41291
41071
  }
41292
41072
  return {
@@ -41351,7 +41131,6 @@ function getSchemaByResolvedExtensions(extensions, editor) {
41351
41131
  selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
41352
41132
  draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
41353
41133
  code: callOrReturn(getExtensionField(extension, "code", context)),
41354
- whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
41355
41134
  defining: callOrReturn(getExtensionField(extension, "defining", context)),
41356
41135
  isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
41357
41136
  attrs: Object.fromEntries(extensionAttributes.map((extensionAttribute) => {
@@ -41907,7 +41686,7 @@ class ExtensionManager {
41907
41686
  const plugins2 = [];
41908
41687
  const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
41909
41688
  let defaultBindings = {};
41910
- if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) {
41689
+ if (extension.type === "mark" && extension.config.exitable) {
41911
41690
  defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
41912
41691
  }
41913
41692
  if (addKeyboardShortcuts) {
@@ -42055,10 +41834,14 @@ function mergeDeep(target, source) {
42055
41834
  const output = { ...target };
42056
41835
  if (isPlainObject(target) && isPlainObject(source)) {
42057
41836
  Object.keys(source).forEach((key) => {
42058
- if (isPlainObject(source[key]) && isPlainObject(target[key])) {
42059
- output[key] = mergeDeep(target[key], source[key]);
41837
+ if (isPlainObject(source[key])) {
41838
+ if (!(key in target)) {
41839
+ Object.assign(output, { [key]: source[key] });
41840
+ } else {
41841
+ output[key] = mergeDeep(target[key], source[key]);
41842
+ }
42060
41843
  } else {
42061
- output[key] = source[key];
41844
+ Object.assign(output, { [key]: source[key] });
42062
41845
  }
42063
41846
  });
42064
41847
  }
@@ -42097,14 +41880,13 @@ class Extension {
42097
41880
  return new Extension(config);
42098
41881
  }
42099
41882
  configure(options = {}) {
42100
- const extension = this.extend({
42101
- ...this.config,
42102
- addOptions: () => {
42103
- return mergeDeep(this.options, options);
42104
- }
42105
- });
42106
- extension.name = this.name;
41883
+ const extension = this.extend();
42107
41884
  extension.parent = this.parent;
41885
+ extension.options = mergeDeep(this.options, options);
41886
+ extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
41887
+ name: extension.name,
41888
+ options: extension.options
41889
+ }));
42108
41890
  return extension;
42109
41891
  }
42110
41892
  extend(extendedConfig = {}) {
@@ -42112,7 +41894,7 @@ class Extension {
42112
41894
  extension.parent = this;
42113
41895
  this.child = extension;
42114
41896
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
42115
- if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
41897
+ if (extendedConfig.defaultOptions) {
42116
41898
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
42117
41899
  }
42118
41900
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -42496,47 +42278,13 @@ function createNodeFromContent(content, schema, options) {
42496
42278
  }
42497
42279
  return schema.nodeFromJSON(content);
42498
42280
  } catch (error) {
42499
- if (options.errorOnInvalidContent) {
42500
- throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
42501
- }
42502
42281
  console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
42503
42282
  return createNodeFromContent("", schema, options);
42504
42283
  }
42505
42284
  }
42506
42285
  if (isTextContent) {
42507
- let schemaToUse = schema;
42508
- let hasInvalidContent = false;
42509
- let invalidContent = "";
42510
- if (options.errorOnInvalidContent) {
42511
- schemaToUse = new Schema({
42512
- topNode: schema.spec.topNode,
42513
- marks: schema.spec.marks,
42514
- // Prosemirror's schemas are executed such that: the last to execute, matches last
42515
- // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
42516
- nodes: schema.spec.nodes.append({
42517
- __tiptap__private__unknown__catch__all__node: {
42518
- content: "inline*",
42519
- group: "block",
42520
- parseDOM: [
42521
- {
42522
- tag: "*",
42523
- getAttrs: (e) => {
42524
- hasInvalidContent = true;
42525
- invalidContent = typeof e === "string" ? e : e.outerHTML;
42526
- return null;
42527
- }
42528
- }
42529
- ]
42530
- }
42531
- })
42532
- });
42533
- }
42534
- const parser = DOMParser.fromSchema(schemaToUse);
42535
- const response = options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
42536
- if (options.errorOnInvalidContent && hasInvalidContent) {
42537
- throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
42538
- }
42539
- return response;
42286
+ const parser = DOMParser.fromSchema(schema);
42287
+ return options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
42540
42288
  }
42541
42289
  return createNodeFromContent("", schema, options);
42542
42290
  }
@@ -42559,10 +42307,9 @@ function selectionToInsertionEnd(tr2, startLen, bias) {
42559
42307
  tr2.setSelection(Selection$1.near(tr2.doc.resolve(end2), bias));
42560
42308
  }
42561
42309
  const isFragment = (nodeOrFragment) => {
42562
- return !("type" in nodeOrFragment);
42310
+ return nodeOrFragment.toString().startsWith("<");
42563
42311
  };
42564
42312
  const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, editor }) => {
42565
- var _a2;
42566
42313
  if (dispatch) {
42567
42314
  options = {
42568
42315
  parseOptions: {},
@@ -42571,17 +42318,14 @@ const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, edit
42571
42318
  applyPasteRules: false,
42572
42319
  ...options
42573
42320
  };
42574
- let content;
42575
- try {
42576
- content = createNodeFromContent(value, editor.schema, {
42577
- parseOptions: {
42578
- preserveWhitespace: "full",
42579
- ...options.parseOptions
42580
- },
42581
- errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
42582
- });
42583
- } catch (e) {
42584
- return false;
42321
+ const content = createNodeFromContent(value, editor.schema, {
42322
+ parseOptions: {
42323
+ preserveWhitespace: "full",
42324
+ ...options.parseOptions
42325
+ }
42326
+ });
42327
+ if (content.toString() === "<>") {
42328
+ return true;
42585
42329
  }
42586
42330
  let { from: from2, to: to2 } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
42587
42331
  let isOnlyTextContent = true;
@@ -42638,7 +42382,7 @@ const joinBackward = () => ({ state: state2, dispatch }) => {
42638
42382
  const joinForward = () => ({ state: state2, dispatch }) => {
42639
42383
  return joinForward$1(state2, dispatch);
42640
42384
  };
42641
- const joinItemBackward = () => ({ state: state2, dispatch, tr: tr2 }) => {
42385
+ const joinItemBackward = () => ({ tr: tr2, state: state2, dispatch }) => {
42642
42386
  try {
42643
42387
  const point2 = joinPoint(state2.doc, state2.selection.$from.pos, -1);
42644
42388
  if (point2 === null || point2 === void 0) {
@@ -42649,7 +42393,7 @@ const joinItemBackward = () => ({ state: state2, dispatch, tr: tr2 }) => {
42649
42393
  dispatch(tr2);
42650
42394
  }
42651
42395
  return true;
42652
- } catch (e) {
42396
+ } catch {
42653
42397
  return false;
42654
42398
  }
42655
42399
  };
@@ -42867,32 +42611,16 @@ const selectTextblockEnd = () => ({ state: state2, dispatch }) => {
42867
42611
  const selectTextblockStart = () => ({ state: state2, dispatch }) => {
42868
42612
  return selectTextblockStart$1(state2, dispatch);
42869
42613
  };
42870
- function createDocument(content, schema, parseOptions = {}, options = {}) {
42871
- return createNodeFromContent(content, schema, {
42872
- slice: false,
42873
- parseOptions,
42874
- errorOnInvalidContent: options.errorOnInvalidContent
42875
- });
42614
+ function createDocument(content, schema, parseOptions = {}) {
42615
+ return createNodeFromContent(content, schema, { slice: false, parseOptions });
42876
42616
  }
42877
- const setContent$1 = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr: tr2, dispatch, commands: commands2 }) => {
42878
- var _a2, _b;
42617
+ const setContent$1 = (content, emitUpdate = false, parseOptions = {}) => ({ tr: tr2, editor, dispatch }) => {
42879
42618
  const { doc: doc2 } = tr2;
42880
- if (parseOptions.preserveWhitespace !== "full") {
42881
- const document2 = createDocument(content, editor.schema, parseOptions, {
42882
- errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
42883
- });
42884
- if (dispatch) {
42885
- tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
42886
- }
42887
- return true;
42888
- }
42619
+ const document2 = createDocument(content, editor.schema, parseOptions);
42889
42620
  if (dispatch) {
42890
- tr2.setMeta("preventUpdate", !emitUpdate);
42621
+ tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
42891
42622
  }
42892
- return commands2.insertContentAt({ from: 0, to: doc2.content.size }, content, {
42893
- parseOptions,
42894
- errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
42895
- });
42623
+ return true;
42896
42624
  };
42897
42625
  function getMarkAttributes(state2, typeOrName) {
42898
42626
  const type3 = getMarkType(typeOrName, state2.schema);
@@ -43095,11 +42823,10 @@ function isList(name, extensions) {
43095
42823
  return group.split(" ").includes("list");
43096
42824
  }
43097
42825
  function isNodeEmpty(node) {
43098
- const defaultContent = node.type.createAndFill();
43099
- if (!defaultContent) {
43100
- return false;
43101
- }
43102
- return node.eq(defaultContent);
42826
+ var _a2;
42827
+ const defaultContent = (_a2 = node.type.createAndFill()) === null || _a2 === void 0 ? void 0 : _a2.toJSON();
42828
+ const content = node.toJSON();
42829
+ return JSON.stringify(defaultContent) === JSON.stringify(content);
43103
42830
  }
43104
42831
  function isNodeSelection(value) {
43105
42832
  return value instanceof NodeSelection;
@@ -43614,14 +43341,14 @@ var commands = /* @__PURE__ */ Object.freeze({
43614
43341
  forEach,
43615
43342
  insertContent,
43616
43343
  insertContentAt,
43617
- joinBackward,
43344
+ joinUp,
43618
43345
  joinDown,
43346
+ joinBackward,
43619
43347
  joinForward,
43620
43348
  joinItemBackward,
43621
43349
  joinItemForward,
43622
43350
  joinTextblockBackward,
43623
43351
  joinTextblockForward,
43624
- joinUp,
43625
43352
  keyboardShortcut,
43626
43353
  lift,
43627
43354
  liftEmptyBlock,
@@ -43818,16 +43545,13 @@ const Tabindex = Extension.create({
43818
43545
  new Plugin({
43819
43546
  key: new PluginKey("tabindex"),
43820
43547
  props: {
43821
- attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
43548
+ attributes: this.editor.isEditable ? { tabindex: "0" } : {}
43822
43549
  }
43823
43550
  })
43824
43551
  ];
43825
43552
  }
43826
43553
  });
43827
43554
  class NodePos {
43828
- get name() {
43829
- return this.node.type.name;
43830
- }
43831
43555
  constructor(pos, editor, isBlock = false, node = null) {
43832
43556
  this.currentNode = null;
43833
43557
  this.actualDepth = null;
@@ -43836,6 +43560,9 @@ class NodePos {
43836
43560
  this.editor = editor;
43837
43561
  this.currentNode = node;
43838
43562
  }
43563
+ get name() {
43564
+ return this.node.type.name;
43565
+ }
43839
43566
  get node() {
43840
43567
  return this.currentNode || this.resolvedPos.node();
43841
43568
  }
@@ -44067,7 +43794,7 @@ img.ProseMirror-separator {
44067
43794
  opacity: 0
44068
43795
  }`;
44069
43796
  function createStyleTag(style2, nonce, suffix) {
44070
- const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${""}]`);
43797
+ const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ""}]`);
44071
43798
  if (tiptapStyleTag !== null) {
44072
43799
  return tiptapStyleTag;
44073
43800
  }
@@ -44075,7 +43802,7 @@ function createStyleTag(style2, nonce, suffix) {
44075
43802
  if (nonce) {
44076
43803
  styleNode.setAttribute("nonce", nonce);
44077
43804
  }
44078
- styleNode.setAttribute(`data-tiptap-style${""}`, "");
43805
+ styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ""}`, "");
44079
43806
  styleNode.innerHTML = style2;
44080
43807
  document.getElementsByTagName("head")[0].appendChild(styleNode);
44081
43808
  return styleNode;
@@ -44099,7 +43826,6 @@ let Editor$1 = class Editor2 extends EventEmitter {
44099
43826
  enableInputRules: true,
44100
43827
  enablePasteRules: true,
44101
43828
  enableCoreExtensions: true,
44102
- enableContentCheck: false,
44103
43829
  onBeforeCreate: () => null,
44104
43830
  onCreate: () => null,
44105
43831
  onUpdate: () => null,
@@ -44107,10 +43833,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
44107
43833
  onTransaction: () => null,
44108
43834
  onFocus: () => null,
44109
43835
  onBlur: () => null,
44110
- onDestroy: () => null,
44111
- onContentError: ({ error }) => {
44112
- throw error;
44113
- }
43836
+ onDestroy: () => null
44114
43837
  };
44115
43838
  this.isCapturingTransaction = false;
44116
43839
  this.capturedTransaction = null;
@@ -44120,7 +43843,6 @@ let Editor$1 = class Editor2 extends EventEmitter {
44120
43843
  this.createSchema();
44121
43844
  this.on("beforeCreate", this.options.onBeforeCreate);
44122
43845
  this.emit("beforeCreate", { editor: this });
44123
- this.on("contentError", this.options.onContentError);
44124
43846
  this.createView();
44125
43847
  this.injectCSS();
44126
43848
  this.on("create", this.options.onCreate);
@@ -44274,23 +43996,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
44274
43996
  * Creates a ProseMirror view.
44275
43997
  */
44276
43998
  createView() {
44277
- let doc2;
44278
- try {
44279
- doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
44280
- } catch (e) {
44281
- if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) {
44282
- throw e;
44283
- }
44284
- this.emit("contentError", {
44285
- editor: this,
44286
- error: e,
44287
- disableCollaboration: () => {
44288
- this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
44289
- this.createExtensionManager();
44290
- }
44291
- });
44292
- doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
44293
- }
43999
+ const doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions);
44294
44000
  const selection = resolveFocusPosition(doc2, this.options.autofocus);
44295
44001
  this.view = new EditorView(this.options.element, {
44296
44002
  ...this.options.editorProps,
@@ -44528,8 +44234,7 @@ function nodeInputRule(config) {
44528
44234
  tr2.insertText(lastChar, start2 + match2[0].length - 1);
44529
44235
  tr2.replaceWith(matchStart, end2, newNode);
44530
44236
  } else if (match2[0]) {
44531
- const insertionStart = config.type.isInline ? start2 : start2 - 1;
44532
- tr2.insert(insertionStart, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
44237
+ tr2.insert(start2 - 1, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
44533
44238
  }
44534
44239
  tr2.scrollIntoView();
44535
44240
  }
@@ -44614,22 +44319,20 @@ class Mark {
44614
44319
  return new Mark(config);
44615
44320
  }
44616
44321
  configure(options = {}) {
44617
- const extension = this.extend({
44618
- ...this.config,
44619
- addOptions: () => {
44620
- return mergeDeep(this.options, options);
44621
- }
44622
- });
44623
- extension.name = this.name;
44624
- extension.parent = this.parent;
44322
+ const extension = this.extend();
44323
+ extension.options = mergeDeep(this.options, options);
44324
+ extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
44325
+ name: extension.name,
44326
+ options: extension.options
44327
+ }));
44625
44328
  return extension;
44626
44329
  }
44627
44330
  extend(extendedConfig = {}) {
44628
- const extension = new Mark(extendedConfig);
44331
+ const extension = new Mark({ ...this.config, ...extendedConfig });
44629
44332
  extension.parent = this;
44630
44333
  this.child = extension;
44631
44334
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
44632
- if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
44335
+ if (extendedConfig.defaultOptions) {
44633
44336
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
44634
44337
  }
44635
44338
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -44695,22 +44398,20 @@ let Node$2 = class Node3 {
44695
44398
  return new Node3(config);
44696
44399
  }
44697
44400
  configure(options = {}) {
44698
- const extension = this.extend({
44699
- ...this.config,
44700
- addOptions: () => {
44701
- return mergeDeep(this.options, options);
44702
- }
44703
- });
44704
- extension.name = this.name;
44705
- extension.parent = this.parent;
44401
+ const extension = this.extend();
44402
+ extension.options = mergeDeep(this.options, options);
44403
+ extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
44404
+ name: extension.name,
44405
+ options: extension.options
44406
+ }));
44706
44407
  return extension;
44707
44408
  }
44708
44409
  extend(extendedConfig = {}) {
44709
- const extension = new Node3(extendedConfig);
44410
+ const extension = new Node3({ ...this.config, ...extendedConfig });
44710
44411
  extension.parent = this;
44711
44412
  this.child = extension;
44712
44413
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
44713
- if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
44414
+ if (extendedConfig.defaultOptions) {
44714
44415
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
44715
44416
  }
44716
44417
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -45245,12 +44946,14 @@ const CodeBlock = Node$2.create({
45245
44946
  if (!text || !language) {
45246
44947
  return false;
45247
44948
  }
45248
- const { tr: tr2, schema } = view.state;
45249
- const textNode = schema.text(text.replace(/\r\n?/g, "\n"));
45250
- tr2.replaceSelectionWith(this.type.create({ language }, textNode));
45251
- if (tr2.selection.$from.parent.type !== this.type) {
45252
- tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
44949
+ const { tr: tr2 } = view.state;
44950
+ if (view.state.selection.from === view.state.doc.nodeSize - (1 + view.state.selection.$to.depth * 2)) {
44951
+ tr2.insert(view.state.selection.from - 1, this.type.create({ language }));
44952
+ } else {
44953
+ tr2.replaceSelectionWith(this.type.create({ language }));
45253
44954
  }
44955
+ tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
44956
+ tr2.insertText(text.replace(/\r\n?/g, "\n"));
45254
44957
  tr2.setMeta("paste", true);
45255
44958
  view.dispatch(tr2);
45256
44959
  return true;
@@ -46166,13 +45869,13 @@ function applyTransaction(history2, state2, tr2, options) {
46166
45869
  return history2;
46167
45870
  } else if (appended && appended.getMeta(historyKey)) {
46168
45871
  if (appended.getMeta(historyKey).redo)
46169
- return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps), history2.prevTime, history2.prevComposition);
45872
+ return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps[tr2.steps.length - 1]), history2.prevTime, history2.prevComposition);
46170
45873
  else
46171
45874
  return new HistoryState(history2.done, history2.undone.addTransform(tr2, void 0, options, mustPreserveItems(state2)), null, history2.prevTime, history2.prevComposition);
46172
45875
  } else if (tr2.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
46173
45876
  let composition = tr2.getMeta("composition");
46174
45877
  let newGroup = history2.prevTime == 0 || !appended && history2.prevComposition != composition && (history2.prevTime < (tr2.time || 0) - options.newGroupDelay || !isAdjacentTo(tr2, history2.prevRanges));
46175
- let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps);
45878
+ let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps[tr2.steps.length - 1]);
46176
45879
  return new HistoryState(history2.done.addTransform(tr2, newGroup ? state2.selection.getBookmark() : void 0, options, mustPreserveItems(state2)), Branch.empty, prevRanges, tr2.time, composition == null ? history2.prevComposition : composition);
46177
45880
  } else if (rebased = tr2.getMeta("rebased")) {
46178
45881
  return new HistoryState(history2.done.rebased(tr2, rebased), history2.undone.rebased(tr2, rebased), mapRanges(history2.prevRanges, tr2.mapping), history2.prevTime, history2.prevComposition);
@@ -46193,10 +45896,9 @@ function isAdjacentTo(transform, prevRanges) {
46193
45896
  });
46194
45897
  return adjacent;
46195
45898
  }
46196
- function rangesFor(maps) {
45899
+ function rangesFor(map4) {
46197
45900
  let result2 = [];
46198
- for (let i2 = maps.length - 1; i2 >= 0 && result2.length == 0; i2--)
46199
- maps[i2].forEach((_from, _to, from2, to2) => result2.push(from2, to2));
45901
+ map4.forEach((_from, _to, from2, to2) => result2.push(from2, to2));
46200
45902
  return result2;
46201
45903
  }
46202
45904
  function mapRanges(ranges, mapping) {
@@ -46210,16 +45912,16 @@ function mapRanges(ranges, mapping) {
46210
45912
  }
46211
45913
  return result2;
46212
45914
  }
46213
- function histTransaction(history2, state2, redo2) {
45915
+ function histTransaction(history2, state2, dispatch, redo2) {
46214
45916
  let preserveItems = mustPreserveItems(state2);
46215
45917
  let histOptions = historyKey.get(state2).spec.config;
46216
45918
  let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
46217
45919
  if (!pop)
46218
- return null;
45920
+ return;
46219
45921
  let selection = pop.selection.resolve(pop.transform.doc);
46220
45922
  let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
46221
45923
  let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
46222
- return pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist });
45924
+ dispatch(pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist }).scrollIntoView());
46223
45925
  }
46224
45926
  let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
46225
45927
  function mustPreserveItems(state2) {
@@ -46267,21 +45969,22 @@ function history(config = {}) {
46267
45969
  }
46268
45970
  });
46269
45971
  }
46270
- function buildCommand(redo2, scroll) {
46271
- return (state2, dispatch) => {
46272
- let hist = historyKey.getState(state2);
46273
- if (!hist || (redo2 ? hist.undone : hist.done).eventCount == 0)
46274
- return false;
46275
- if (dispatch) {
46276
- let tr2 = histTransaction(hist, state2, redo2);
46277
- if (tr2)
46278
- dispatch(scroll ? tr2.scrollIntoView() : tr2);
46279
- }
46280
- return true;
46281
- };
46282
- }
46283
- const undo = buildCommand(false, true);
46284
- const redo = buildCommand(true, true);
45972
+ const undo = (state2, dispatch) => {
45973
+ let hist = historyKey.getState(state2);
45974
+ if (!hist || hist.done.eventCount == 0)
45975
+ return false;
45976
+ if (dispatch)
45977
+ histTransaction(hist, state2, dispatch, false);
45978
+ return true;
45979
+ };
45980
+ const redo = (state2, dispatch) => {
45981
+ let hist = historyKey.getState(state2);
45982
+ if (!hist || hist.undone.eventCount == 0)
45983
+ return false;
45984
+ if (dispatch)
45985
+ histTransaction(hist, state2, dispatch, true);
45986
+ return true;
45987
+ };
46285
45988
  const History = Extension.create({
46286
45989
  name: "history",
46287
45990
  addOptions() {
@@ -46333,20 +46036,10 @@ const HorizontalRule = Node$2.create({
46333
46036
  addCommands() {
46334
46037
  return {
46335
46038
  setHorizontalRule: () => ({ chain, state: state2 }) => {
46336
- const { selection } = state2;
46337
- const { $from: $originFrom, $to: $originTo } = selection;
46039
+ const { $to: $originTo } = state2.selection;
46338
46040
  const currentChain = chain();
46339
- if ($originFrom.parentOffset === 0) {
46340
- currentChain.insertContentAt({
46341
- from: Math.max($originFrom.pos - 1, 0),
46342
- to: $originTo.pos
46343
- }, {
46344
- type: this.name
46345
- });
46346
- } else if (isNodeSelection(selection)) {
46347
- currentChain.insertContentAt($originTo.pos, {
46348
- type: this.name
46349
- });
46041
+ if ($originTo.parentOffset === 0) {
46042
+ currentChain.insertContentAt(Math.max($originTo.pos - 2, 0), { type: this.name });
46350
46043
  } else {
46351
46044
  currentChain.insertContent({ type: this.name });
46352
46045
  }
@@ -46732,11 +46425,11 @@ const StarterKit = Extension.create({
46732
46425
  addExtensions() {
46733
46426
  var _a2, _b, _c, _d, _e2, _f, _g, _h, _j, _k, _l2, _m, _o, _p, _q, _r2, _s, _t2;
46734
46427
  const extensions = [];
46735
- if (this.options.bold !== false) {
46736
- extensions.push(Bold.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.bold));
46737
- }
46738
46428
  if (this.options.blockquote !== false) {
46739
- extensions.push(Blockquote.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.blockquote));
46429
+ extensions.push(Blockquote.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.blockquote));
46430
+ }
46431
+ if (this.options.bold !== false) {
46432
+ extensions.push(Bold.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.bold));
46740
46433
  }
46741
46434
  if (this.options.bulletList !== false) {
46742
46435
  extensions.push(BulletList.configure((_c = this.options) === null || _c === void 0 ? void 0 : _c.bulletList));
@@ -49543,7 +49236,7 @@ class BubbleMenuView {
49543
49236
  }
49544
49237
  update(view, oldState) {
49545
49238
  const { state: state2 } = view;
49546
- const hasValidSelection = state2.selection.from !== state2.selection.to;
49239
+ const hasValidSelection = state2.selection.$from.pos !== state2.selection.$to.pos;
49547
49240
  if (this.updateDelay > 0 && hasValidSelection) {
49548
49241
  this.handleDebouncedUpdate(view, oldState);
49549
49242
  return;
@@ -52588,6 +52281,9 @@ function createColGroup(node, cellMinWidth, overrideCol, overrideValue) {
52588
52281
  return { colgroup, tableWidth, tableMinWidth };
52589
52282
  }
52590
52283
  function createCell(cellType, cellContent) {
52284
+ if (cellContent) {
52285
+ return cellType.createChecked(null, cellContent);
52286
+ }
52591
52287
  return cellType.createAndFill();
52592
52288
  }
52593
52289
  function getTableNodeTypes(schema) {
@@ -52609,12 +52305,12 @@ function createTable$1(schema, rowsCount, colsCount, withHeaderRow, cellContent)
52609
52305
  const headerCells = [];
52610
52306
  const cells = [];
52611
52307
  for (let index2 = 0; index2 < colsCount; index2 += 1) {
52612
- const cell = createCell(types.cell);
52308
+ const cell = createCell(types.cell, cellContent);
52613
52309
  if (cell) {
52614
52310
  cells.push(cell);
52615
52311
  }
52616
52312
  if (withHeaderRow) {
52617
- const headerCell = createCell(types.header_cell);
52313
+ const headerCell = createCell(types.header_cell, cellContent);
52618
52314
  if (headerCell) {
52619
52315
  headerCells.push(headerCell);
52620
52316
  }
@@ -52692,7 +52388,7 @@ const Table = Node$2.create({
52692
52388
  insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ tr: tr2, dispatch, editor }) => {
52693
52389
  const node = createTable$1(editor.schema, rows, cols, withHeaderRow);
52694
52390
  if (dispatch) {
52695
- const offset2 = tr2.selection.from + 1;
52391
+ const offset2 = tr2.selection.anchor + 1;
52696
52392
  tr2.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr2.doc.resolve(offset2)));
52697
52393
  }
52698
52394
  return true;
@@ -53169,7 +52865,18 @@ function _typeof$1(obj) {
53169
52865
  return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
53170
52866
  }, _typeof$1(obj);
53171
52867
  }
52868
+ function _defineProperties$2(target, props2) {
52869
+ for (var i2 = 0; i2 < props2.length; i2++) {
52870
+ var descriptor = props2[i2];
52871
+ descriptor.enumerable = descriptor.enumerable || false;
52872
+ descriptor.configurable = true;
52873
+ if ("value" in descriptor) descriptor.writable = true;
52874
+ Object.defineProperty(target, descriptor.key, descriptor);
52875
+ }
52876
+ }
53172
52877
  function _createClass$2(Constructor, protoProps, staticProps) {
52878
+ if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
52879
+ if (staticProps) _defineProperties$2(Constructor, staticProps);
53173
52880
  Object.defineProperty(Constructor, "prototype", { writable: false });
53174
52881
  return Constructor;
53175
52882
  }
@@ -53346,6 +53053,7 @@ function _defineProperties$1(target, props2) {
53346
53053
  }
53347
53054
  function _createClass$1(Constructor, protoProps, staticProps) {
53348
53055
  if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
53056
+ if (staticProps) _defineProperties$1(Constructor, staticProps);
53349
53057
  Object.defineProperty(Constructor, "prototype", { writable: false });
53350
53058
  return Constructor;
53351
53059
  }
@@ -53987,10 +53695,10 @@ var DIGITS = {
53987
53695
  function parseDigit(character) {
53988
53696
  return DIGITS[character];
53989
53697
  }
53990
- function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
53698
+ function _createForOfIteratorHelperLoose$4(o2, allowArrayLike) {
53991
53699
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
53992
53700
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
53993
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$4(o2)) || allowArrayLike) {
53701
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$5(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
53994
53702
  if (it2) o2 = it2;
53995
53703
  var i2 = 0;
53996
53704
  return function() {
@@ -54000,15 +53708,15 @@ function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
54000
53708
  }
54001
53709
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54002
53710
  }
54003
- function _unsupportedIterableToArray$4(o2, minLen) {
53711
+ function _unsupportedIterableToArray$5(o2, minLen) {
54004
53712
  if (!o2) return;
54005
- if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen);
53713
+ if (typeof o2 === "string") return _arrayLikeToArray$5(o2, minLen);
54006
53714
  var n2 = Object.prototype.toString.call(o2).slice(8, -1);
54007
53715
  if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name;
54008
53716
  if (n2 === "Map" || n2 === "Set") return Array.from(o2);
54009
- if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen);
53717
+ if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$5(o2, minLen);
54010
53718
  }
54011
- function _arrayLikeToArray$4(arr, len) {
53719
+ function _arrayLikeToArray$5(arr, len) {
54012
53720
  if (len == null || len > arr.length) len = arr.length;
54013
53721
  for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
54014
53722
  arr2[i2] = arr[i2];
@@ -54017,7 +53725,7 @@ function _arrayLikeToArray$4(arr, len) {
54017
53725
  }
54018
53726
  function parseIncompletePhoneNumber(string2) {
54019
53727
  var result2 = "";
54020
- for (var _iterator = _createForOfIteratorHelperLoose$3(string2.split("")), _step; !(_step = _iterator()).done; ) {
53728
+ for (var _iterator = _createForOfIteratorHelperLoose$4(string2.split("")), _step; !(_step = _iterator()).done; ) {
54021
53729
  var character = _step.value;
54022
53730
  result2 += parsePhoneNumberCharacter(character, result2) || "";
54023
53731
  }
@@ -54026,12 +53734,55 @@ function parseIncompletePhoneNumber(string2) {
54026
53734
  function parsePhoneNumberCharacter(character, prevParsedCharacters, emitEvent) {
54027
53735
  if (character === "+") {
54028
53736
  if (prevParsedCharacters) {
53737
+ if (typeof emitEvent === "function") {
53738
+ emitEvent("end");
53739
+ }
54029
53740
  return;
54030
53741
  }
54031
53742
  return "+";
54032
53743
  }
54033
53744
  return parseDigit(character);
54034
53745
  }
53746
+ function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
53747
+ var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
53748
+ if (it2) return (it2 = it2.call(o2)).next.bind(it2);
53749
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$4(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
53750
+ if (it2) o2 = it2;
53751
+ var i2 = 0;
53752
+ return function() {
53753
+ if (i2 >= o2.length) return { done: true };
53754
+ return { done: false, value: o2[i2++] };
53755
+ };
53756
+ }
53757
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
53758
+ }
53759
+ function _unsupportedIterableToArray$4(o2, minLen) {
53760
+ if (!o2) return;
53761
+ if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen);
53762
+ var n2 = Object.prototype.toString.call(o2).slice(8, -1);
53763
+ if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name;
53764
+ if (n2 === "Map" || n2 === "Set") return Array.from(o2);
53765
+ if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen);
53766
+ }
53767
+ function _arrayLikeToArray$4(arr, len) {
53768
+ if (len == null || len > arr.length) len = arr.length;
53769
+ for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
53770
+ arr2[i2] = arr[i2];
53771
+ }
53772
+ return arr2;
53773
+ }
53774
+ function mergeArrays(a2, b2) {
53775
+ var merged = a2.slice();
53776
+ for (var _iterator = _createForOfIteratorHelperLoose$3(b2), _step; !(_step = _iterator()).done; ) {
53777
+ var element = _step.value;
53778
+ if (a2.indexOf(element) < 0) {
53779
+ merged.push(element);
53780
+ }
53781
+ }
53782
+ return merged.sort(function(a3, b3) {
53783
+ return a3 - b3;
53784
+ });
53785
+ }
54035
53786
  function checkNumberLength(nationalNumber, metadata2) {
54036
53787
  return checkNumberLengthForType(nationalNumber, void 0, metadata2);
54037
53788
  }
@@ -54041,6 +53792,17 @@ function checkNumberLengthForType(nationalNumber, type3, metadata2) {
54041
53792
  if (!possible_lengths) {
54042
53793
  return "IS_POSSIBLE";
54043
53794
  }
53795
+ if (type3 === "FIXED_LINE_OR_MOBILE") {
53796
+ if (!metadata2.type("FIXED_LINE")) {
53797
+ return checkNumberLengthForType(nationalNumber, "MOBILE", metadata2);
53798
+ }
53799
+ var mobile_type = metadata2.type("MOBILE");
53800
+ if (mobile_type) {
53801
+ possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths());
53802
+ }
53803
+ } else if (type3 && !type_info) {
53804
+ return "INVALID_LENGTH";
53805
+ }
54044
53806
  var actual_length = nationalNumber.length;
54045
53807
  var minimum_length = possible_lengths[0];
54046
53808
  if (minimum_length === actual_length) {
@@ -54105,7 +53867,7 @@ function matchesEntirely(text, regular_expression) {
54105
53867
  function _createForOfIteratorHelperLoose$2(o2, allowArrayLike) {
54106
53868
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
54107
53869
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
54108
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$3(o2)) || allowArrayLike) {
53870
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$3(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54109
53871
  if (it2) o2 = it2;
54110
53872
  var i2 = 0;
54111
53873
  return function() {
@@ -54205,6 +53967,8 @@ function applyInternationalSeparatorStyle(formattedNumber) {
54205
53967
  var FIRST_GROUP_PATTERN = /(\$\d)/;
54206
53968
  function formatNationalNumberUsingFormat(number2, format2, _ref) {
54207
53969
  var useInternationalFormat = _ref.useInternationalFormat, withNationalPrefix = _ref.withNationalPrefix;
53970
+ _ref.carrierCode;
53971
+ _ref.metadata;
54208
53972
  var formattedNumber = number2.replace(new RegExp(format2.pattern()), useInternationalFormat ? format2.internationalFormat() : (
54209
53973
  // This library doesn't use `domestic_carrier_code_formatting_rule`,
54210
53974
  // because that one is only used when formatting phone numbers
@@ -54250,7 +54014,7 @@ function formatRFC3966(_ref) {
54250
54014
  function _createForOfIteratorHelperLoose$1(o2, allowArrayLike) {
54251
54015
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
54252
54016
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
54253
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$2(o2)) || allowArrayLike) {
54017
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$2(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54254
54018
  if (it2) o2 = it2;
54255
54019
  var i2 = 0;
54256
54020
  return function() {
@@ -54446,6 +54210,7 @@ function _defineProperties(target, props2) {
54446
54210
  }
54447
54211
  function _createClass(Constructor, protoProps, staticProps) {
54448
54212
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
54213
+ if (staticProps) _defineProperties(Constructor, staticProps);
54449
54214
  Object.defineProperty(Constructor, "prototype", { writable: false });
54450
54215
  return Constructor;
54451
54216
  }
@@ -54742,7 +54507,7 @@ function extractCountryCallingCode(number2, country, callingCode, metadata2) {
54742
54507
  function _createForOfIteratorHelperLoose(o2, allowArrayLike) {
54743
54508
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
54744
54509
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
54745
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$1(o2)) || allowArrayLike) {
54510
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$1(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54746
54511
  if (it2) o2 = it2;
54747
54512
  var i2 = 0;
54748
54513
  return function() {
@@ -54796,8 +54561,14 @@ function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
54796
54561
  return matchingCountries[0];
54797
54562
  }
54798
54563
  }
54564
+ var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
54799
54565
  function getCountryByCallingCode(callingCode, _ref) {
54800
54566
  var nationalPhoneNumber = _ref.nationalNumber, defaultCountry = _ref.defaultCountry, metadata2 = _ref.metadata;
54567
+ if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
54568
+ if (metadata2.isNonGeographicCallingCode(callingCode)) {
54569
+ return "001";
54570
+ }
54571
+ }
54801
54572
  var possibleCountries = metadata2.getCountryCodesForCallingCode(callingCode);
54802
54573
  if (!possibleCountries) {
54803
54574
  return;
@@ -57631,7 +57402,7 @@ const bisectCenter = bisector(number$2).center;
57631
57402
  function extent(values3, valueof) {
57632
57403
  let min2;
57633
57404
  let max2;
57634
- {
57405
+ if (valueof === void 0) {
57635
57406
  for (const value of values3) {
57636
57407
  if (value != null) {
57637
57408
  if (min2 === void 0) {
@@ -57642,6 +57413,18 @@ function extent(values3, valueof) {
57642
57413
  }
57643
57414
  }
57644
57415
  }
57416
+ } else {
57417
+ let index2 = -1;
57418
+ for (let value of values3) {
57419
+ if ((value = valueof(value, ++index2, values3)) != null) {
57420
+ if (min2 === void 0) {
57421
+ if (value >= value) min2 = max2 = value;
57422
+ } else {
57423
+ if (min2 > value) min2 = value;
57424
+ if (max2 < value) max2 = value;
57425
+ }
57426
+ }
57427
+ }
57645
57428
  }
57646
57429
  return [min2, max2];
57647
57430
  }