@bagelink/vue 0.0.600 → 0.0.605

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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  var __defProp2 = Object.defineProperty;
2
2
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, createElementBlock, normalizeClass, renderSlot, normalizeProps, guardReactiveProps, withScopeId, resolveComponent, normalizeStyle, withKeys, createElementVNode, Fragment as Fragment$1, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h as h$2, toDisplayString, reactive, computed, inject, unref, renderList, resolveDynamicComponent, useCssVars, useSlots, withModifiers, createTextVNode, watch, onMounted, onUnmounted, mergeModels, useModel, createSlots, Transition, getCurrentScope, onScopeDispose, getCurrentInstance, shallowRef, withDirectives, isRef, vModelCheckbox, provide, toRef, Teleport, render as render$f, onBeforeUpdate, vShow, TransitionGroup, vModelDynamic, vModelText, vModelRadio, onBeforeUnmount, watchEffect, markRaw, customRef, resolveDirective } from "vue";
4
+ import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, createElementBlock, normalizeClass, renderSlot, normalizeProps, guardReactiveProps, withScopeId, resolveComponent, normalizeStyle, withKeys, createElementVNode, Fragment as Fragment$1, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h as h$2, toDisplayString, reactive, computed, inject, watch, unref, renderList, resolveDynamicComponent, useCssVars, useSlots, withModifiers, createTextVNode, onMounted, onUnmounted, mergeModels, useModel, createSlots, Transition, getCurrentScope, onScopeDispose, getCurrentInstance, shallowRef, withDirectives, isRef, vModelCheckbox, provide, toRef, Teleport, render as render$f, onBeforeUpdate, vShow, TransitionGroup, vModelDynamic, vModelText, vModelRadio, onBeforeUnmount, watchEffect, markRaw, customRef, resolveDirective } from "vue";
5
5
  const sides = ["top", "right", "bottom", "left"];
6
6
  const alignments = ["start", "end"];
7
7
  const placements$1 = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
@@ -110,12 +110,21 @@ function getPaddingObject(padding) {
110
110
  };
111
111
  }
112
112
  function rectToClientRect$1(rect) {
113
+ const {
114
+ x: x2,
115
+ y: y2,
116
+ width,
117
+ height
118
+ } = rect;
113
119
  return {
114
- ...rect,
115
- top: rect.y,
116
- left: rect.x,
117
- right: rect.x + rect.width,
118
- bottom: rect.y + rect.height
120
+ width,
121
+ height,
122
+ top: y2,
123
+ left: x2,
124
+ right: x2 + width,
125
+ bottom: y2 + height,
126
+ x: x2,
127
+ y: y2
119
128
  };
120
129
  }
121
130
  function computeCoordsFromPlacement(_ref, placement, rtl) {
@@ -286,9 +295,10 @@ async function detectOverflow$1(state2, options) {
286
295
  strategy
287
296
  }));
288
297
  const rect = elementContext === "floating" ? {
289
- ...rects.floating,
290
298
  x: x2,
291
- y: y2
299
+ y: y2,
300
+ width: rects.floating.width,
301
+ height: rects.floating.height
292
302
  } : rects.reference;
293
303
  const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
294
304
  const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
@@ -499,10 +509,12 @@ const flip$2 = function(options) {
499
509
  return {};
500
510
  }
501
511
  const side = getSide$1(placement);
512
+ const initialSideAxis = getSideAxis(initialPlacement);
502
513
  const isBasePlacement = getSide$1(initialPlacement) === initialPlacement;
503
514
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
504
515
  const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement$1(initialPlacement)] : getExpandedPlacements(initialPlacement));
505
- if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
516
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
517
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
506
518
  fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
507
519
  }
508
520
  const placements2 = [initialPlacement, ...fallbackPlacements];
@@ -539,8 +551,16 @@ const flip$2 = function(options) {
539
551
  if (!resetPlacement) {
540
552
  switch (fallbackStrategy) {
541
553
  case "bestFit": {
542
- var _overflowsData$map$so;
543
- 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];
554
+ var _overflowsData$filter2;
555
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
556
+ if (hasFallbackAxisSideDirection) {
557
+ const currentSideAxis = getSideAxis(d2.placement);
558
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
559
+ // reading directions favoring greater width.
560
+ currentSideAxis === "y";
561
+ }
562
+ return true;
563
+ }).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
564
  if (placement2) {
545
565
  resetPlacement = placement2;
546
566
  }
@@ -735,16 +755,16 @@ const size = function(options) {
735
755
  widthSide = side;
736
756
  heightSide = alignment === "end" ? "top" : "bottom";
737
757
  }
738
- const overflowAvailableHeight = height - overflow[heightSide];
739
- const overflowAvailableWidth = width - overflow[widthSide];
758
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
759
+ const maximumClippingWidth = width - overflow.left - overflow.right;
760
+ const overflowAvailableHeight = min$3(height - overflow[heightSide], maximumClippingHeight);
761
+ const overflowAvailableWidth = min$3(width - overflow[widthSide], maximumClippingWidth);
740
762
  const noShift = !state2.middlewareData.shift;
741
763
  let availableHeight = overflowAvailableHeight;
742
764
  let availableWidth = overflowAvailableWidth;
743
765
  if (isYAxis) {
744
- const maximumClippingWidth = width - overflow.left - overflow.right;
745
766
  availableWidth = alignment || noShift ? min$3(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
746
767
  } else {
747
- const maximumClippingHeight = height - overflow.top - overflow.bottom;
748
768
  availableHeight = alignment || noShift ? min$3(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
749
769
  }
750
770
  if (noShift && !alignment) {
@@ -3381,7 +3401,6 @@ const defaults$1 = {
3381
3401
  utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
3382
3402
  defaults$1.headers[method] = {};
3383
3403
  });
3384
- const defaults$2 = defaults$1;
3385
3404
  const ignoreDuplicateOf = utils$1.toObjectSet([
3386
3405
  "age",
3387
3406
  "authorization",
@@ -3643,11 +3662,10 @@ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
3643
3662
  };
3644
3663
  });
3645
3664
  utils$1.freezeMethods(AxiosHeaders);
3646
- const AxiosHeaders$1 = AxiosHeaders;
3647
3665
  function transformData(fns, response) {
3648
- const config = this || defaults$2;
3666
+ const config = this || defaults$1;
3649
3667
  const context = response || config;
3650
- const headers = AxiosHeaders$1.from(context.headers);
3668
+ const headers = AxiosHeaders.from(context.headers);
3651
3669
  let data2 = context.data;
3652
3670
  utils$1.forEach(fns, function transform(fn3) {
3653
3671
  data2 = fn3.call(config, data2, headers.normalize(), response ? response.status : void 0);
@@ -3846,7 +3864,7 @@ function buildFullPath(baseURL, requestedURL) {
3846
3864
  }
3847
3865
  return requestedURL;
3848
3866
  }
3849
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
3867
+ const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
3850
3868
  function mergeConfig(config1, config2) {
3851
3869
  config2 = config2 || {};
3852
3870
  const config = {};
@@ -3927,7 +3945,7 @@ function mergeConfig(config1, config2) {
3927
3945
  const resolveConfig = (config) => {
3928
3946
  const newConfig = mergeConfig({}, config);
3929
3947
  let { data: data2, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
3930
- newConfig.headers = headers = AxiosHeaders$1.from(headers);
3948
+ newConfig.headers = headers = AxiosHeaders.from(headers);
3931
3949
  newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
3932
3950
  if (auth) {
3933
3951
  headers.set(
@@ -3960,7 +3978,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
3960
3978
  return new Promise(function dispatchXhrRequest(resolve, reject3) {
3961
3979
  const _config = resolveConfig(config);
3962
3980
  let requestData = _config.data;
3963
- const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
3981
+ const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
3964
3982
  let { responseType } = _config;
3965
3983
  let onCanceled;
3966
3984
  function done() {
@@ -3978,7 +3996,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
3978
3996
  if (!request) {
3979
3997
  return;
3980
3998
  }
3981
- const responseHeaders = AxiosHeaders$1.from(
3999
+ const responseHeaders = AxiosHeaders.from(
3982
4000
  "getAllResponseHeaders" in request && request.getAllResponseHeaders()
3983
4001
  );
3984
4002
  const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
@@ -4294,7 +4312,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
4294
4312
  return await new Promise((resolve, reject3) => {
4295
4313
  settle(resolve, reject3, {
4296
4314
  data: responseData,
4297
- headers: AxiosHeaders$1.from(response.headers),
4315
+ headers: AxiosHeaders.from(response.headers),
4298
4316
  status: response.status,
4299
4317
  statusText: response.statusText,
4300
4318
  config,
@@ -4376,7 +4394,7 @@ function throwIfCancellationRequested(config) {
4376
4394
  }
4377
4395
  function dispatchRequest(config) {
4378
4396
  throwIfCancellationRequested(config);
4379
- config.headers = AxiosHeaders$1.from(config.headers);
4397
+ config.headers = AxiosHeaders.from(config.headers);
4380
4398
  config.data = transformData.call(
4381
4399
  config,
4382
4400
  config.transformRequest
@@ -4384,7 +4402,7 @@ function dispatchRequest(config) {
4384
4402
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
4385
4403
  config.headers.setContentType("application/x-www-form-urlencoded", false);
4386
4404
  }
4387
- const adapter = adapters.getAdapter(config.adapter || defaults$2.adapter);
4405
+ const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
4388
4406
  return adapter(config).then(function onAdapterResolution(response) {
4389
4407
  throwIfCancellationRequested(config);
4390
4408
  response.data = transformData.call(
@@ -4392,7 +4410,7 @@ function dispatchRequest(config) {
4392
4410
  config.transformResponse,
4393
4411
  response
4394
4412
  );
4395
- response.headers = AxiosHeaders$1.from(response.headers);
4413
+ response.headers = AxiosHeaders.from(response.headers);
4396
4414
  return response;
4397
4415
  }, function onAdapterRejection(reason) {
4398
4416
  if (!isCancel(reason)) {
@@ -4403,7 +4421,7 @@ function dispatchRequest(config) {
4403
4421
  config.transformResponse,
4404
4422
  reason.response
4405
4423
  );
4406
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
4424
+ reason.response.headers = AxiosHeaders.from(reason.response.headers);
4407
4425
  }
4408
4426
  }
4409
4427
  return Promise.reject(reason);
@@ -4542,7 +4560,7 @@ class Axios {
4542
4560
  delete headers[method];
4543
4561
  }
4544
4562
  );
4545
- config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
4563
+ config.headers = AxiosHeaders.concat(contextHeaders, headers);
4546
4564
  const requestInterceptorChain = [];
4547
4565
  let synchronousRequestInterceptors = true;
4548
4566
  this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
@@ -4626,7 +4644,6 @@ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method)
4626
4644
  Axios.prototype[method] = generateHTTPMethod();
4627
4645
  Axios.prototype[method + "Form"] = generateHTTPMethod(true);
4628
4646
  });
4629
- const Axios$1 = Axios;
4630
4647
  class CancelToken {
4631
4648
  constructor(executor) {
4632
4649
  if (typeof executor !== "function") {
@@ -4713,7 +4730,6 @@ class CancelToken {
4713
4730
  };
4714
4731
  }
4715
4732
  }
4716
- const CancelToken$1 = CancelToken;
4717
4733
  function spread(callback) {
4718
4734
  return function wrap2(arr) {
4719
4735
  return callback.apply(null, arr);
@@ -4790,21 +4806,20 @@ const HttpStatusCode = {
4790
4806
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
4791
4807
  HttpStatusCode[value] = key;
4792
4808
  });
4793
- const HttpStatusCode$1 = HttpStatusCode;
4794
4809
  function createInstance(defaultConfig2) {
4795
- const context = new Axios$1(defaultConfig2);
4796
- const instance = bind$2(Axios$1.prototype.request, context);
4797
- utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
4810
+ const context = new Axios(defaultConfig2);
4811
+ const instance = bind$2(Axios.prototype.request, context);
4812
+ utils$1.extend(instance, Axios.prototype, context, { allOwnKeys: true });
4798
4813
  utils$1.extend(instance, context, null, { allOwnKeys: true });
4799
4814
  instance.create = function create(instanceConfig) {
4800
4815
  return createInstance(mergeConfig(defaultConfig2, instanceConfig));
4801
4816
  };
4802
4817
  return instance;
4803
4818
  }
4804
- const axios$1 = createInstance(defaults$2);
4805
- axios$1.Axios = Axios$1;
4819
+ const axios$1 = createInstance(defaults$1);
4820
+ axios$1.Axios = Axios;
4806
4821
  axios$1.CanceledError = CanceledError;
4807
- axios$1.CancelToken = CancelToken$1;
4822
+ axios$1.CancelToken = CancelToken;
4808
4823
  axios$1.isCancel = isCancel;
4809
4824
  axios$1.VERSION = VERSION;
4810
4825
  axios$1.toFormData = toFormData;
@@ -4816,10 +4831,10 @@ axios$1.all = function all(promises) {
4816
4831
  axios$1.spread = spread;
4817
4832
  axios$1.isAxiosError = isAxiosError;
4818
4833
  axios$1.mergeConfig = mergeConfig;
4819
- axios$1.AxiosHeaders = AxiosHeaders$1;
4834
+ axios$1.AxiosHeaders = AxiosHeaders;
4820
4835
  axios$1.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4821
4836
  axios$1.getAdapter = adapters.getAdapter;
4822
- axios$1.HttpStatusCode = HttpStatusCode$1;
4837
+ axios$1.HttpStatusCode = HttpStatusCode;
4823
4838
  axios$1.default = axios$1;
4824
4839
  var __defProp = Object.defineProperty;
4825
4840
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -5063,7 +5078,11 @@ class Bagel {
5063
5078
  this._setAuthorization();
5064
5079
  const formData = new FormData();
5065
5080
  formData.append("file", file);
5066
- const { data: data2 } = await axios.post("/static_files/upload", formData, {
5081
+ let url = "/static_files/upload";
5082
+ console.log(options == null ? void 0 : options.topic);
5083
+ if (options == null ? void 0 : options.topic)
5084
+ url = `/static_files/upload?topic=${options.topic}`;
5085
+ const { data: data2 } = await axios.post(url, formData, {
5067
5086
  headers: {
5068
5087
  "Content-Type": "multipart/form-data"
5069
5088
  },
@@ -5243,7 +5262,8 @@ function debounce$2(fn3, delay = 500) {
5243
5262
  timeout = setTimeout(fn3, delay);
5244
5263
  }
5245
5264
  function keyToLabel(key) {
5246
- return (key == null ? void 0 : key.split("_").map((k2) => k2.charAt(0).toUpperCase() + k2.slice(1)).join(" ")) || key;
5265
+ if (key === void 0) return key;
5266
+ return key.split("_").map((k2) => k2.charAt(0).toUpperCase() + k2.slice(1)).join(" ") || key;
5247
5267
  }
5248
5268
  async function copyText(text, cb) {
5249
5269
  await navigator.clipboard.writeText(text);
@@ -5397,6 +5417,15 @@ function useBglSchema({ schema, showFields, data: data2 } = {}) {
5397
5417
  }
5398
5418
  return getFallbackSchema(data2, showFields);
5399
5419
  }
5420
+ function useLocalStorage(key, initialValue) {
5421
+ const storedValue = localStorage.getItem(key);
5422
+ const initial = storedValue ? JSON.parse(storedValue) : initialValue;
5423
+ const value = ref(initial);
5424
+ watch(() => value.value, (val) => {
5425
+ localStorage.setItem(key, JSON.stringify(val));
5426
+ }, { immediate: true, deep: true });
5427
+ return value;
5428
+ }
5400
5429
  const _sfc_main$O = /* @__PURE__ */ defineComponent({
5401
5430
  __name: "MaterialIcon",
5402
5431
  props: {
@@ -6032,7 +6061,7 @@ function toValue(r2) {
6032
6061
  const isClient = typeof window !== "undefined" && typeof document !== "undefined";
6033
6062
  typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
6034
6063
  function getLifeCycleTarget(target) {
6035
- return target || getCurrentInstance();
6064
+ return getCurrentInstance();
6036
6065
  }
6037
6066
  function tryOnMounted(fn3, sync = true, target) {
6038
6067
  const instance = getLifeCycleTarget();
@@ -6328,7 +6357,7 @@ function useVerticalVirtualList(options, list) {
6328
6357
  containerRef
6329
6358
  };
6330
6359
  }
6331
- const _withScopeId$3 = (n2) => (pushScopeId("data-v-73d79ea6"), n2 = n2(), popScopeId(), n2);
6360
+ const _withScopeId$3 = (n2) => (pushScopeId("data-v-84e79d8d"), n2 = n2(), popScopeId(), n2);
6332
6361
  const _hoisted_1$C = {
6333
6362
  key: 0,
6334
6363
  class: "loading-table-wrapper z-99 h-100 w-100 absolute inset"
@@ -6362,7 +6391,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6362
6391
  emits: /* @__PURE__ */ mergeModels(["update:selectedItems", "orderBy", "select"], ["update:loading", "update:itemHeight"]),
6363
6392
  setup(__props, { emit: __emit }) {
6364
6393
  useCssVars((_ctx) => ({
6365
- "59d71ad2": unref(computedItemHiehgt)
6394
+ "2438e78c": unref(computedItemHiehgt)
6366
6395
  }));
6367
6396
  const props2 = __props;
6368
6397
  const emit2 = __emit;
@@ -6463,7 +6492,11 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6463
6492
  }
6464
6493
  function toggleSelectItem(item) {
6465
6494
  if (!computedSelectedItems.value.length) {
6466
- emit2("select", item);
6495
+ const obj = { ...item };
6496
+ Object.keys(obj).forEach((key) => {
6497
+ if (key.startsWith("_transformed_")) delete obj[key];
6498
+ });
6499
+ emit2("select", obj);
6467
6500
  return;
6468
6501
  }
6469
6502
  const index2 = computedSelectedItems.value.indexOf(item.id);
@@ -6563,7 +6596,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6563
6596
  };
6564
6597
  }
6565
6598
  });
6566
- const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-73d79ea6"]]);
6599
+ const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-84e79d8d"]]);
6567
6600
  const _sfc_main$E = {};
6568
6601
  const _hoisted_1$B = { class: "flex space-between" };
6569
6602
  function _sfc_render$1(_ctx, _cache) {
@@ -6606,16 +6639,23 @@ const _hoisted_2$s = {
6606
6639
  const _hoisted_3$i = { class: "key" };
6607
6640
  const _hoisted_4$c = { class: "m-0" };
6608
6641
  const _hoisted_5$c = { key: 1 };
6609
- const _hoisted_6$7 = { class: "key" };
6610
- const _hoisted_7$3 = { class: "m-0" };
6611
- const _hoisted_8$1 = { class: "vlue" };
6612
- const _hoisted_9$1 = { class: "m-0" };
6642
+ const _hoisted_6$7 = {
6643
+ key: 0,
6644
+ class: "data-row"
6645
+ };
6646
+ const _hoisted_7$3 = { class: "key" };
6647
+ const _hoisted_8$1 = { class: "m-0" };
6648
+ const _hoisted_9$1 = {
6649
+ key: 0,
6650
+ class: "m-0"
6651
+ };
6613
6652
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
6614
6653
  __name: "DataPreview",
6615
6654
  props: /* @__PURE__ */ mergeModels({
6616
6655
  showFields: {},
6617
6656
  schema: {},
6618
- title: {}
6657
+ title: {},
6658
+ excludeUnset: { type: Boolean }
6619
6659
  }, {
6620
6660
  "data": { default: {} },
6621
6661
  "dataModifiers": {}
@@ -6624,12 +6664,25 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6624
6664
  setup(__props) {
6625
6665
  const props2 = __props;
6626
6666
  const itemData = useModel(__props, "data");
6627
- const computedSchema = computed(
6628
- () => getFallbackSchema(
6629
- [itemData.value],
6630
- props2.showFields
6631
- )
6632
- );
6667
+ function dataTransform(dataValue) {
6668
+ if (!dataValue) return dataValue;
6669
+ if (Array.isArray(dataValue)) return dataValue.map(dataTransform);
6670
+ if (typeof dataValue === "object") {
6671
+ Object.keys(dataValue).forEach((key) => {
6672
+ dataValue[key] = dataTransform(dataValue[key]);
6673
+ });
6674
+ }
6675
+ if (typeof dataValue === "string" && /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(dataValue)) {
6676
+ const date2 = new Date(dataValue);
6677
+ return date2.toDateString();
6678
+ }
6679
+ return dataValue;
6680
+ }
6681
+ function isUnset(value) {
6682
+ if (!props2.excludeUnset) return false;
6683
+ return value === void 0 || value === null || value === "" || value.length === 0;
6684
+ }
6685
+ const computedSchema = computed(() => getFallbackSchema([itemData.value], props2.showFields));
6633
6686
  return (_ctx, _cache) => {
6634
6687
  var _a2;
6635
6688
  return __props.data ? (openBlock(), createElementBlock("div", _hoisted_1$A, [
@@ -6657,17 +6710,16 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6657
6710
  }), 128)),
6658
6711
  !((_a2 = _ctx.schema) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("div", _hoisted_5$c, [
6659
6712
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(computedSchema.value, ({ id, label }) => {
6660
- return openBlock(), createElementBlock("div", {
6661
- key: id,
6662
- class: "data-row"
6663
- }, [
6664
- createElementVNode("div", _hoisted_6$7, [
6665
- createElementVNode("p", _hoisted_7$3, toDisplayString(label), 1)
6666
- ]),
6667
- createElementVNode("div", _hoisted_8$1, [
6668
- createElementVNode("p", _hoisted_9$1, toDisplayString(itemData.value[id ?? ""]), 1)
6669
- ])
6670
- ]);
6713
+ return openBlock(), createElementBlock(Fragment$1, { key: id }, [
6714
+ !isUnset(itemData.value[id]) ? (openBlock(), createElementBlock("div", _hoisted_6$7, [
6715
+ createElementVNode("div", _hoisted_7$3, [
6716
+ createElementVNode("p", _hoisted_8$1, toDisplayString(label), 1)
6717
+ ]),
6718
+ createElementVNode("div", null, [
6719
+ id ? (openBlock(), createElementBlock("p", _hoisted_9$1, toDisplayString(dataTransform(itemData.value[id])), 1)) : createCommentVNode("", true)
6720
+ ])
6721
+ ])) : createCommentVNode("", true)
6722
+ ], 64);
6671
6723
  }), 128))
6672
6724
  ])) : createCommentVNode("", true),
6673
6725
  renderSlot(_ctx.$slots, "footer", {}, void 0, true)
@@ -6675,7 +6727,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6675
6727
  };
6676
6728
  }
6677
6729
  });
6678
- const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-792f7ec0"]]);
6730
+ const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-d1cbc45f"]]);
6679
6731
  const _hoisted_1$z = {
6680
6732
  key: 0,
6681
6733
  class: "card_label"
@@ -17276,12 +17328,7 @@ function eachDayOfInterval(interval, options) {
17276
17328
  const endTime = reversed ? +startDate : +endDate;
17277
17329
  const currentDate = reversed ? endDate : startDate;
17278
17330
  currentDate.setHours(0, 0, 0, 0);
17279
- let step = (options == null ? void 0 : options.step) ?? 1;
17280
- if (!step) return [];
17281
- if (step < 0) {
17282
- step = -step;
17283
- reversed = !reversed;
17284
- }
17331
+ let step = 1;
17285
17332
  const dates = [];
17286
17333
  while (+currentDate <= endTime) {
17287
17334
  dates.push(toDate(currentDate));
@@ -17304,12 +17351,7 @@ function eachQuarterOfInterval(interval, options) {
17304
17351
  let reversed = +startDate > +endDate;
17305
17352
  const endTime = reversed ? +startOfQuarter(startDate) : +startOfQuarter(endDate);
17306
17353
  let currentDate = reversed ? startOfQuarter(endDate) : startOfQuarter(startDate);
17307
- let step = (options == null ? void 0 : options.step) ?? 1;
17308
- if (!step) return [];
17309
- if (step < 0) {
17310
- step = -step;
17311
- reversed = !reversed;
17312
- }
17354
+ let step = 1;
17313
17355
  const dates = [];
17314
17356
  while (+currentDate <= endTime) {
17315
17357
  dates.push(toDate(currentDate));
@@ -26155,10 +26197,8 @@ function isScrolledPast(el, elSide, parentSide) {
26155
26197
  var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
26156
26198
  while (parent) {
26157
26199
  var parentSideVal = getRect(parent)[parentSide], visible = void 0;
26158
- if (parentSide === "top" || parentSide === "left") {
26200
+ {
26159
26201
  visible = elSideVal >= parentSideVal;
26160
- } else {
26161
- visible = elSideVal <= parentSideVal;
26162
26202
  }
26163
26203
  if (!visible) return parent;
26164
26204
  if (parent === getWindowScrollingElement()) break;
@@ -28856,7 +28896,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
28856
28896
  }
28857
28897
  });
28858
28898
  const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-681173be"]]);
28859
- const _withScopeId$2 = (n2) => (pushScopeId("data-v-5409803c"), n2 = n2(), popScopeId(), n2);
28899
+ const _withScopeId$2 = (n2) => (pushScopeId("data-v-6716fd45"), n2 = n2(), popScopeId(), n2);
28860
28900
  const _hoisted_1$j = { class: "bagel-input" };
28861
28901
  const _hoisted_2$e = {
28862
28902
  key: 0,
@@ -29100,7 +29140,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
29100
29140
  };
29101
29141
  }
29102
29142
  });
29103
- const $el = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-5409803c"]]);
29143
+ const $el = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-6716fd45"]]);
29104
29144
  const _withScopeId$1 = (n2) => (pushScopeId("data-v-eceeebfb"), n2 = n2(), popScopeId(), n2);
29105
29145
  const _hoisted_1$i = ["title"];
29106
29146
  const _hoisted_2$d = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "slider round" }, null, -1));
@@ -29533,7 +29573,7 @@ class Fragment {
29533
29573
  /**
29534
29574
  Find the index and inner offset corresponding to a given relative
29535
29575
  position in this fragment. The result object will be reused
29536
- (overwritten) the next time the function is called. (Not public.)
29576
+ (overwritten) the next time the function is called. @internal
29537
29577
  */
29538
29578
  findIndex(pos, round2 = -1) {
29539
29579
  if (pos == 0)
@@ -29739,7 +29779,9 @@ let Mark$1 = class Mark2 {
29739
29779
  let type3 = schema.marks[json.type];
29740
29780
  if (!type3)
29741
29781
  throw new RangeError(`There is no mark type ${json.type} in this schema`);
29742
- return type3.create(json.attrs);
29782
+ let mark = type3.create(json.attrs);
29783
+ type3.checkAttrs(mark.attrs);
29784
+ return mark;
29743
29785
  }
29744
29786
  /**
29745
29787
  Test whether two sets of marks are identical.
@@ -29873,8 +29915,6 @@ function removeRange(content, from2, to2) {
29873
29915
  function insertInto(content, dist, insert, parent) {
29874
29916
  let { index: index2, offset: offset2 } = content.findIndex(dist), child = content.maybeChild(index2);
29875
29917
  if (offset2 == dist || child.isText) {
29876
- if (parent && !parent.canReplace(index2, index2, insert))
29877
- return null;
29878
29918
  return content.cut(0, dist).append(insert).append(content.cut(dist));
29879
29919
  }
29880
29920
  let inner = insertInto(child.content, dist - offset2 - 1, insert);
@@ -30236,17 +30276,28 @@ class ResolvedPos {
30236
30276
  @internal
30237
30277
  */
30238
30278
  static resolveCached(doc2, pos) {
30239
- for (let i2 = 0; i2 < resolveCache.length; i2++) {
30240
- let cached2 = resolveCache[i2];
30241
- if (cached2.pos == pos && cached2.doc == doc2)
30242
- return cached2;
30279
+ let cache = resolveCache.get(doc2);
30280
+ if (cache) {
30281
+ for (let i2 = 0; i2 < cache.elts.length; i2++) {
30282
+ let elt = cache.elts[i2];
30283
+ if (elt.pos == pos)
30284
+ return elt;
30285
+ }
30286
+ } else {
30287
+ resolveCache.set(doc2, cache = new ResolveCache());
30243
30288
  }
30244
- let result2 = resolveCache[resolveCachePos] = ResolvedPos.resolve(doc2, pos);
30245
- resolveCachePos = (resolveCachePos + 1) % resolveCacheSize;
30289
+ let result2 = cache.elts[cache.i] = ResolvedPos.resolve(doc2, pos);
30290
+ cache.i = (cache.i + 1) % resolveCacheSize;
30246
30291
  return result2;
30247
30292
  }
30248
30293
  }
30249
- let resolveCache = [], resolveCachePos = 0, resolveCacheSize = 12;
30294
+ class ResolveCache {
30295
+ constructor() {
30296
+ this.elts = [];
30297
+ this.i = 0;
30298
+ }
30299
+ }
30300
+ const resolveCacheSize = 12, resolveCache = /* @__PURE__ */ new WeakMap();
30250
30301
  class NodeRange {
30251
30302
  /**
30252
30303
  Construct a node range. `$from` and `$to` should point into the
@@ -30632,13 +30683,17 @@ let Node$3 = class Node2 {
30632
30683
  }
30633
30684
  /**
30634
30685
  Check whether this node and its descendants conform to the
30635
- schema, and raise error when they do not.
30686
+ schema, and raise an exception when they do not.
30636
30687
  */
30637
30688
  check() {
30638
30689
  this.type.checkContent(this.content);
30690
+ this.type.checkAttrs(this.attrs);
30639
30691
  let copy2 = Mark$1.none;
30640
- for (let i2 = 0; i2 < this.marks.length; i2++)
30641
- copy2 = this.marks[i2].addToSet(copy2);
30692
+ for (let i2 = 0; i2 < this.marks.length; i2++) {
30693
+ let mark = this.marks[i2];
30694
+ mark.type.checkAttrs(mark.attrs);
30695
+ copy2 = mark.addToSet(copy2);
30696
+ }
30642
30697
  if (!Mark$1.sameSet(copy2, this.marks))
30643
30698
  throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
30644
30699
  this.content.forEach((node) => node.check());
@@ -30664,7 +30719,7 @@ let Node$3 = class Node2 {
30664
30719
  static fromJSON(schema, json) {
30665
30720
  if (!json)
30666
30721
  throw new RangeError("Invalid input for Node.fromJSON");
30667
- let marks = null;
30722
+ let marks = void 0;
30668
30723
  if (json.marks) {
30669
30724
  if (!Array.isArray(json.marks))
30670
30725
  throw new RangeError("Invalid mark data for Node.fromJSON");
@@ -30676,7 +30731,9 @@ let Node$3 = class Node2 {
30676
30731
  return schema.text(json.text, marks);
30677
30732
  }
30678
30733
  let content = Fragment.fromJSON(schema, json.content);
30679
- return schema.nodeType(json.type).create(json.attrs, content, marks);
30734
+ let node = schema.nodeType(json.type).create(json.attrs, content, marks);
30735
+ node.type.checkAttrs(node.attrs);
30736
+ return node;
30680
30737
  }
30681
30738
  };
30682
30739
  Node$3.prototype.text = void 0;
@@ -31158,6 +31215,16 @@ function computeAttrs(attrs, value) {
31158
31215
  }
31159
31216
  return built;
31160
31217
  }
31218
+ function checkAttrs(attrs, values3, type3, name) {
31219
+ for (let name2 in values3)
31220
+ if (!(name2 in attrs))
31221
+ throw new RangeError(`Unsupported attribute ${name2} for ${type3} of type ${name2}`);
31222
+ for (let name2 in attrs) {
31223
+ let attr = attrs[name2];
31224
+ if (attr.validate)
31225
+ attr.validate(values3[name2]);
31226
+ }
31227
+ }
31161
31228
  function initAttrs(attrs) {
31162
31229
  let result2 = /* @__PURE__ */ Object.create(null);
31163
31230
  if (attrs)
@@ -31287,7 +31354,7 @@ let NodeType$1 = class NodeType2 {
31287
31354
  }
31288
31355
  /**
31289
31356
  Returns true if the given fragment is valid content for this node
31290
- type with the given attributes.
31357
+ type.
31291
31358
  */
31292
31359
  validContent(content) {
31293
31360
  let result2 = this.contentMatch.matchFragment(content);
@@ -31308,6 +31375,12 @@ let NodeType$1 = class NodeType2 {
31308
31375
  throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
31309
31376
  }
31310
31377
  /**
31378
+ @internal
31379
+ */
31380
+ checkAttrs(attrs) {
31381
+ checkAttrs(this.attrs, attrs, "node", this.name);
31382
+ }
31383
+ /**
31311
31384
  Check whether the given mark type is allowed in this node.
31312
31385
  */
31313
31386
  allowsMarkType(markType) {
@@ -31357,10 +31430,19 @@ let NodeType$1 = class NodeType2 {
31357
31430
  return result2;
31358
31431
  }
31359
31432
  };
31433
+ function validateType(type3) {
31434
+ let types = type3.split("|");
31435
+ return (value) => {
31436
+ let name = value === null ? "null" : typeof value;
31437
+ if (types.indexOf(name) < 0)
31438
+ throw new RangeError(`Expected value of type ${types}, got ${name}`);
31439
+ };
31440
+ }
31360
31441
  class Attribute {
31361
31442
  constructor(options) {
31362
31443
  this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
31363
31444
  this.default = options.default;
31445
+ this.validate = typeof options.validate == "string" ? validateType(options.validate) : options.validate;
31364
31446
  }
31365
31447
  get isRequired() {
31366
31448
  return !this.hasDefault;
@@ -31419,6 +31501,12 @@ class MarkType {
31419
31501
  return set2[i2];
31420
31502
  }
31421
31503
  /**
31504
+ @internal
31505
+ */
31506
+ checkAttrs(attrs) {
31507
+ checkAttrs(this.attrs, attrs, "mark", this.name);
31508
+ }
31509
+ /**
31422
31510
  Queries whether a given mark type is
31423
31511
  [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
31424
31512
  */
@@ -31431,6 +31519,7 @@ class Schema {
31431
31519
  Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
31432
31520
  */
31433
31521
  constructor(spec) {
31522
+ this.linebreakReplacement = null;
31434
31523
  this.cached = /* @__PURE__ */ Object.create(null);
31435
31524
  let instanceSpec = this.spec = {};
31436
31525
  for (let prop3 in spec)
@@ -31444,6 +31533,13 @@ class Schema {
31444
31533
  let type3 = this.nodes[prop3], contentExpr = type3.spec.content || "", markExpr = type3.spec.marks;
31445
31534
  type3.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
31446
31535
  type3.inlineContent = type3.contentMatch.inlineContent;
31536
+ if (type3.spec.linebreakReplacement) {
31537
+ if (this.linebreakReplacement)
31538
+ throw new RangeError("Multiple linebreak nodes defined");
31539
+ if (!type3.isInline || !type3.isLeaf)
31540
+ throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
31541
+ this.linebreakReplacement = type3;
31542
+ }
31447
31543
  type3.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type3.inlineContent ? [] : null;
31448
31544
  }
31449
31545
  for (let prop3 in this.marks) {
@@ -31528,6 +31624,12 @@ function gatherMarks(schema, marks) {
31528
31624
  }
31529
31625
  return found2;
31530
31626
  }
31627
+ function isTagRule(rule) {
31628
+ return rule.tag != null;
31629
+ }
31630
+ function isStyleRule(rule) {
31631
+ return rule.style != null;
31632
+ }
31531
31633
  class DOMParser {
31532
31634
  /**
31533
31635
  Create a parser that targets the given schema, using the given
@@ -31538,11 +31640,16 @@ class DOMParser {
31538
31640
  this.rules = rules;
31539
31641
  this.tags = [];
31540
31642
  this.styles = [];
31643
+ let matchedStyles = this.matchedStyles = [];
31541
31644
  rules.forEach((rule) => {
31542
- if (rule.tag)
31645
+ if (isTagRule(rule)) {
31543
31646
  this.tags.push(rule);
31544
- else if (rule.style)
31647
+ } else if (isStyleRule(rule)) {
31648
+ let prop3 = /[^=]*/.exec(rule.style)[0];
31649
+ if (matchedStyles.indexOf(prop3) < 0)
31650
+ matchedStyles.push(prop3);
31545
31651
  this.styles.push(rule);
31652
+ }
31546
31653
  });
31547
31654
  this.normalizeLists = !this.tags.some((r2) => {
31548
31655
  if (!/^(ul|ol)\b/.test(r2.tag) || !r2.node)
@@ -31802,10 +31909,10 @@ class ParseContext {
31802
31909
  this.addElement(dom);
31803
31910
  }
31804
31911
  withStyleRules(dom, f2) {
31805
- let style2 = dom.getAttribute("style");
31806
- if (!style2)
31912
+ let style2 = dom.style;
31913
+ if (!style2 || !style2.length)
31807
31914
  return f2();
31808
- let marks = this.readStyles(parseStyles(style2));
31915
+ let marks = this.readStyles(dom.style);
31809
31916
  if (!marks)
31810
31917
  return;
31811
31918
  let [addMarks, removeMarks] = marks, top2 = this.top;
@@ -31899,27 +32006,30 @@ class ParseContext {
31899
32006
  // had a rule with `ignore` set.
31900
32007
  readStyles(styles) {
31901
32008
  let add2 = Mark$1.none, remove2 = Mark$1.none;
31902
- for (let i2 = 0; i2 < styles.length; i2 += 2) {
31903
- for (let after = void 0; ; ) {
31904
- let rule = this.parser.matchStyle(styles[i2], styles[i2 + 1], this, after);
31905
- if (!rule)
31906
- break;
31907
- if (rule.ignore)
31908
- return null;
31909
- if (rule.clearMark) {
31910
- this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
31911
- if (rule.clearMark(m2))
31912
- remove2 = m2.addToSet(remove2);
31913
- });
31914
- } else {
31915
- add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
31916
- }
31917
- if (rule.consuming === false)
31918
- after = rule;
31919
- else
31920
- break;
32009
+ if (styles.length)
32010
+ for (let i2 = 0; i2 < this.parser.matchedStyles.length; i2++) {
32011
+ let name = this.parser.matchedStyles[i2], value = styles.getPropertyValue(name);
32012
+ if (value)
32013
+ for (let after = void 0; ; ) {
32014
+ let rule = this.parser.matchStyle(name, value, this, after);
32015
+ if (!rule)
32016
+ break;
32017
+ if (rule.ignore)
32018
+ return null;
32019
+ if (rule.clearMark) {
32020
+ this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
32021
+ if (rule.clearMark(m2))
32022
+ remove2 = m2.addToSet(remove2);
32023
+ });
32024
+ } else {
32025
+ add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
32026
+ }
32027
+ if (rule.consuming === false)
32028
+ after = rule;
32029
+ else
32030
+ break;
32031
+ }
31921
32032
  }
31922
- }
31923
32033
  return [add2, remove2];
31924
32034
  }
31925
32035
  // Look up a handler for the given node. If none are found, return
@@ -32188,12 +32298,6 @@ function normalizeList(dom) {
32188
32298
  function matches(dom, selector2) {
32189
32299
  return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector2);
32190
32300
  }
32191
- function parseStyles(style2) {
32192
- let re2 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m2, result2 = [];
32193
- while (m2 = re2.exec(style2))
32194
- result2.push(m2[1], m2[2].trim());
32195
- return result2;
32196
- }
32197
32301
  function copy$2(obj) {
32198
32302
  let copy2 = {};
32199
32303
  for (let prop3 in obj)
@@ -32284,7 +32388,7 @@ class DOMSerializer {
32284
32388
  @internal
32285
32389
  */
32286
32390
  serializeNodeInner(node, options) {
32287
- let { dom, contentDOM } = DOMSerializer.renderSpec(doc$1(options), this.nodes[node.type.name](node));
32391
+ let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
32288
32392
  if (contentDOM) {
32289
32393
  if (node.isLeaf)
32290
32394
  throw new RangeError("Content hole not allowed in a leaf node spec");
@@ -32315,7 +32419,7 @@ class DOMSerializer {
32315
32419
  */
32316
32420
  serializeMark(mark, inline, options = {}) {
32317
32421
  let toDOM = this.marks[mark.type.name];
32318
- return toDOM && DOMSerializer.renderSpec(doc$1(options), toDOM(mark, inline));
32422
+ return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
32319
32423
  }
32320
32424
  /**
32321
32425
  Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If
@@ -32323,48 +32427,7 @@ class DOMSerializer {
32323
32427
  node with the hole.
32324
32428
  */
32325
32429
  static renderSpec(doc2, structure, xmlNS = null) {
32326
- if (typeof structure == "string")
32327
- return { dom: doc2.createTextNode(structure) };
32328
- if (structure.nodeType != null)
32329
- return { dom: structure };
32330
- if (structure.dom && structure.dom.nodeType != null)
32331
- return structure;
32332
- let tagName = structure[0], space = tagName.indexOf(" ");
32333
- if (space > 0) {
32334
- xmlNS = tagName.slice(0, space);
32335
- tagName = tagName.slice(space + 1);
32336
- }
32337
- let contentDOM;
32338
- let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
32339
- let attrs = structure[1], start2 = 1;
32340
- if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
32341
- start2 = 2;
32342
- for (let name in attrs)
32343
- if (attrs[name] != null) {
32344
- let space2 = name.indexOf(" ");
32345
- if (space2 > 0)
32346
- dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
32347
- else
32348
- dom.setAttribute(name, attrs[name]);
32349
- }
32350
- }
32351
- for (let i2 = start2; i2 < structure.length; i2++) {
32352
- let child = structure[i2];
32353
- if (child === 0) {
32354
- if (i2 < structure.length - 1 || i2 > start2)
32355
- throw new RangeError("Content hole must be the only child of its parent node");
32356
- return { dom, contentDOM: dom };
32357
- } else {
32358
- let { dom: inner, contentDOM: innerContent } = DOMSerializer.renderSpec(doc2, child, xmlNS);
32359
- dom.appendChild(inner);
32360
- if (innerContent) {
32361
- if (contentDOM)
32362
- throw new RangeError("Multiple content holes");
32363
- contentDOM = innerContent;
32364
- }
32365
- }
32366
- }
32367
- return { dom, contentDOM };
32430
+ return renderSpec(doc2, structure, xmlNS);
32368
32431
  }
32369
32432
  /**
32370
32433
  Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
@@ -32402,6 +32465,84 @@ function gatherToDOM(obj) {
32402
32465
  function doc$1(options) {
32403
32466
  return options.document || window.document;
32404
32467
  }
32468
+ const suspiciousAttributeCache = /* @__PURE__ */ new WeakMap();
32469
+ function suspiciousAttributes(attrs) {
32470
+ let value = suspiciousAttributeCache.get(attrs);
32471
+ if (value === void 0)
32472
+ suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
32473
+ return value;
32474
+ }
32475
+ function suspiciousAttributesInner(attrs) {
32476
+ let result2 = null;
32477
+ function scan(value) {
32478
+ if (value && typeof value == "object") {
32479
+ if (Array.isArray(value)) {
32480
+ if (typeof value[0] == "string") {
32481
+ if (!result2)
32482
+ result2 = [];
32483
+ result2.push(value);
32484
+ } else {
32485
+ for (let i2 = 0; i2 < value.length; i2++)
32486
+ scan(value[i2]);
32487
+ }
32488
+ } else {
32489
+ for (let prop3 in value)
32490
+ scan(value[prop3]);
32491
+ }
32492
+ }
32493
+ }
32494
+ scan(attrs);
32495
+ return result2;
32496
+ }
32497
+ function renderSpec(doc2, structure, xmlNS, blockArraysIn) {
32498
+ if (typeof structure == "string")
32499
+ return { dom: doc2.createTextNode(structure) };
32500
+ if (structure.nodeType != null)
32501
+ return { dom: structure };
32502
+ if (structure.dom && structure.dom.nodeType != null)
32503
+ return structure;
32504
+ let tagName = structure[0], suspicious;
32505
+ if (typeof tagName != "string")
32506
+ throw new RangeError("Invalid array passed to renderSpec");
32507
+ if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1)
32508
+ throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
32509
+ let space = tagName.indexOf(" ");
32510
+ if (space > 0) {
32511
+ xmlNS = tagName.slice(0, space);
32512
+ tagName = tagName.slice(space + 1);
32513
+ }
32514
+ let contentDOM;
32515
+ let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
32516
+ let attrs = structure[1], start2 = 1;
32517
+ if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
32518
+ start2 = 2;
32519
+ for (let name in attrs)
32520
+ if (attrs[name] != null) {
32521
+ let space2 = name.indexOf(" ");
32522
+ if (space2 > 0)
32523
+ dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
32524
+ else
32525
+ dom.setAttribute(name, attrs[name]);
32526
+ }
32527
+ }
32528
+ for (let i2 = start2; i2 < structure.length; i2++) {
32529
+ let child = structure[i2];
32530
+ if (child === 0) {
32531
+ if (i2 < structure.length - 1 || i2 > start2)
32532
+ throw new RangeError("Content hole must be the only child of its parent node");
32533
+ return { dom, contentDOM: dom };
32534
+ } else {
32535
+ let { dom: inner, contentDOM: innerContent } = renderSpec(doc2, child, xmlNS, blockArraysIn);
32536
+ dom.appendChild(inner);
32537
+ if (innerContent) {
32538
+ if (contentDOM)
32539
+ throw new RangeError("Multiple content holes");
32540
+ contentDOM = innerContent;
32541
+ }
32542
+ }
32543
+ }
32544
+ return { dom, contentDOM };
32545
+ }
32405
32546
  const lower16 = 65535;
32406
32547
  const factor16 = Math.pow(2, 16);
32407
32548
  function makeRecover(index2, offset2) {
@@ -33061,7 +33202,8 @@ class ReplaceAroundStep extends Step$1 {
33061
33202
  }
33062
33203
  map(mapping) {
33063
33204
  let from2 = mapping.mapResult(this.from, 1), to2 = mapping.mapResult(this.to, -1);
33064
- let gapFrom = mapping.map(this.gapFrom, -1), gapTo = mapping.map(this.gapTo, 1);
33205
+ let gapFrom = this.from == this.gapFrom ? from2.pos : mapping.map(this.gapFrom, -1);
33206
+ let gapTo = this.to == this.gapTo ? to2.pos : mapping.map(this.gapTo, 1);
33065
33207
  if (from2.deletedAcross && to2.deletedAcross || gapFrom < from2.pos || gapTo > to2.pos)
33066
33208
  return null;
33067
33209
  return new ReplaceAroundStep(from2.pos, to2.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
@@ -33174,7 +33316,7 @@ function removeMark(tr2, from2, to2, mark) {
33174
33316
  });
33175
33317
  matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
33176
33318
  }
33177
- function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch) {
33319
+ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch, clearNewlines = true) {
33178
33320
  let node = tr2.doc.nodeAt(pos);
33179
33321
  let replSteps = [], cur = pos + 1;
33180
33322
  for (let i2 = 0; i2 < node.childCount; i2++) {
@@ -33187,7 +33329,7 @@ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatc
33187
33329
  for (let j2 = 0; j2 < child.marks.length; j2++)
33188
33330
  if (!parentType.allowsMarkType(child.marks[j2].type))
33189
33331
  tr2.step(new RemoveMarkStep(cur, end2, child.marks[j2]));
33190
- if (child.isText && !parentType.spec.code) {
33332
+ if (clearNewlines && child.isText && parentType.whitespace != "pre") {
33191
33333
  let m2, newline = /\r?\n|\r/g, slice4;
33192
33334
  while (m2 = newline.exec(child.text)) {
33193
33335
  if (!slice4)
@@ -33296,14 +33438,45 @@ function setBlockType$1(tr2, from2, to2, type3, attrs) {
33296
33438
  let mapFrom = tr2.steps.length;
33297
33439
  tr2.doc.nodesBetween(from2, to2, (node, pos) => {
33298
33440
  if (node.isTextblock && !node.hasMarkup(type3, attrs) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type3)) {
33299
- tr2.clearIncompatible(tr2.mapping.slice(mapFrom).map(pos, 1), type3);
33441
+ let convertNewlines = null;
33442
+ if (type3.schema.linebreakReplacement) {
33443
+ let pre = type3.whitespace == "pre", supportLinebreak = !!type3.contentMatch.matchType(type3.schema.linebreakReplacement);
33444
+ if (pre && !supportLinebreak)
33445
+ convertNewlines = false;
33446
+ else if (!pre && supportLinebreak)
33447
+ convertNewlines = true;
33448
+ }
33449
+ if (convertNewlines === false)
33450
+ replaceLinebreaks(tr2, node, pos, mapFrom);
33451
+ clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type3, void 0, convertNewlines === null);
33300
33452
  let mapping = tr2.mapping.slice(mapFrom);
33301
33453
  let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
33302
33454
  tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type3.create(attrs, null, node.marks)), 0, 0), 1, true));
33455
+ if (convertNewlines === true)
33456
+ replaceNewlines(tr2, node, pos, mapFrom);
33303
33457
  return false;
33304
33458
  }
33305
33459
  });
33306
33460
  }
33461
+ function replaceNewlines(tr2, node, pos, mapFrom) {
33462
+ node.forEach((child, offset2) => {
33463
+ if (child.isText) {
33464
+ let m2, newline = /\r?\n|\r/g;
33465
+ while (m2 = newline.exec(child.text)) {
33466
+ let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2 + m2.index);
33467
+ tr2.replaceWith(start2, start2 + 1, node.type.schema.linebreakReplacement.create());
33468
+ }
33469
+ }
33470
+ });
33471
+ }
33472
+ function replaceLinebreaks(tr2, node, pos, mapFrom) {
33473
+ node.forEach((child, offset2) => {
33474
+ if (child.type == child.type.schema.linebreakReplacement) {
33475
+ let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2);
33476
+ tr2.replaceWith(start2, start2 + 1, node.type.schema.text("\n"));
33477
+ }
33478
+ });
33479
+ }
33307
33480
  function canChangeType(doc2, pos, type3) {
33308
33481
  let $pos = doc2.resolve(pos), index2 = $pos.index();
33309
33482
  return $pos.parent.canReplaceWith(index2, index2 + 1, type3);
@@ -35069,6 +35242,9 @@ const textRange = function(node, from2, to2) {
35069
35242
  range2.setStart(node, from2 || 0);
35070
35243
  return range2;
35071
35244
  };
35245
+ const clearReusedRange = function() {
35246
+ reusedRange = null;
35247
+ };
35072
35248
  const isEquivalentPosition = function(node, off2, targetNode, targetOff) {
35073
35249
  return targetNode && (scanFor(node, off2, targetNode, targetOff, -1) || scanFor(node, off2, targetNode, targetOff, 1));
35074
35250
  };
@@ -35096,6 +35272,40 @@ function scanFor(node, off2, targetNode, targetOff, dir) {
35096
35272
  function nodeSize(node) {
35097
35273
  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
35098
35274
  }
35275
+ function textNodeBefore$1(node, offset2) {
35276
+ for (; ; ) {
35277
+ if (node.nodeType == 3 && offset2)
35278
+ return node;
35279
+ if (node.nodeType == 1 && offset2 > 0) {
35280
+ if (node.contentEditable == "false")
35281
+ return null;
35282
+ node = node.childNodes[offset2 - 1];
35283
+ offset2 = nodeSize(node);
35284
+ } else if (node.parentNode && !hasBlockDesc(node)) {
35285
+ offset2 = domIndex(node);
35286
+ node = node.parentNode;
35287
+ } else {
35288
+ return null;
35289
+ }
35290
+ }
35291
+ }
35292
+ function textNodeAfter$1(node, offset2) {
35293
+ for (; ; ) {
35294
+ if (node.nodeType == 3 && offset2 < node.nodeValue.length)
35295
+ return node;
35296
+ if (node.nodeType == 1 && offset2 < node.childNodes.length) {
35297
+ if (node.contentEditable == "false")
35298
+ return null;
35299
+ node = node.childNodes[offset2];
35300
+ offset2 = 0;
35301
+ } else if (node.parentNode && !hasBlockDesc(node)) {
35302
+ offset2 = domIndex(node) + 1;
35303
+ node = node.parentNode;
35304
+ } else {
35305
+ return null;
35306
+ }
35307
+ }
35308
+ }
35099
35309
  function isOnEdge(node, offset2, parent) {
35100
35310
  for (let atStart = offset2 == 0, atEnd = offset2 == nodeSize(node); atStart || atEnd; ) {
35101
35311
  if (node == parent)
@@ -35167,6 +35377,14 @@ const android = /Android \d/.test(agent);
35167
35377
  const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
35168
35378
  const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
35169
35379
  function windowRect(doc2) {
35380
+ let vp = doc2.defaultView && doc2.defaultView.visualViewport;
35381
+ if (vp)
35382
+ return {
35383
+ left: 0,
35384
+ right: vp.width,
35385
+ top: 0,
35386
+ bottom: vp.height
35387
+ };
35170
35388
  return {
35171
35389
  left: 0,
35172
35390
  right: doc2.documentElement.clientWidth,
@@ -35368,14 +35586,14 @@ function posFromCaret(view, node, offset2, coords) {
35368
35586
  let desc = view.docView.nearestDesc(cur, true);
35369
35587
  if (!desc)
35370
35588
  return null;
35371
- if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent && !sawBlock || !desc.contentDOM)) {
35589
+ if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {
35372
35590
  let rect = desc.dom.getBoundingClientRect();
35373
- if (desc.node.isBlock && desc.parent && !sawBlock) {
35374
- sawBlock = true;
35375
- if (rect.left > coords.left || rect.top > coords.top)
35591
+ if (desc.node.isBlock && desc.parent) {
35592
+ if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
35376
35593
  outsideBlock = desc.posBefore;
35377
- else if (rect.right < coords.left || rect.bottom < coords.top)
35594
+ else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
35378
35595
  outsideBlock = desc.posAfter;
35596
+ sawBlock = true;
35379
35597
  }
35380
35598
  if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
35381
35599
  let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;
@@ -35990,6 +36208,9 @@ class ViewDesc {
35990
36208
  get ignoreForCoords() {
35991
36209
  return false;
35992
36210
  }
36211
+ isText(text) {
36212
+ return false;
36213
+ }
35993
36214
  }
35994
36215
  class WidgetViewDesc extends ViewDesc {
35995
36216
  constructor(parent, widget, view, pos) {
@@ -36228,8 +36449,7 @@ class NodeViewDesc extends ViewDesc {
36228
36449
  let { from: from2, to: to2 } = view.state.selection;
36229
36450
  if (!(view.state.selection instanceof TextSelection) || from2 < pos || to2 > pos + this.node.content.size)
36230
36451
  return null;
36231
- let sel = view.domSelectionRange();
36232
- let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
36452
+ let textNode = view.input.compositionNode;
36233
36453
  if (!textNode || !this.dom.contains(textNode.parentNode))
36234
36454
  return null;
36235
36455
  if (this.node.inlineContent) {
@@ -36295,10 +36515,11 @@ class NodeViewDesc extends ViewDesc {
36295
36515
  }
36296
36516
  // Remove selected node marking from this node.
36297
36517
  deselectNode() {
36298
- if (this.nodeDOM.nodeType == 1)
36518
+ if (this.nodeDOM.nodeType == 1) {
36299
36519
  this.nodeDOM.classList.remove("ProseMirror-selectednode");
36300
- if (this.contentDOM || !this.node.type.spec.draggable)
36301
- this.dom.removeAttribute("draggable");
36520
+ if (this.contentDOM || !this.node.type.spec.draggable)
36521
+ this.dom.removeAttribute("draggable");
36522
+ }
36302
36523
  }
36303
36524
  get domAtom() {
36304
36525
  return this.node.isAtom;
@@ -36364,6 +36585,9 @@ class TextViewDesc extends NodeViewDesc {
36364
36585
  get domAtom() {
36365
36586
  return false;
36366
36587
  }
36588
+ isText(text) {
36589
+ return this.node.text == text;
36590
+ }
36367
36591
  }
36368
36592
  class TrailingHackViewDesc extends ViewDesc {
36369
36593
  parseRule() {
@@ -36879,23 +37103,6 @@ function iosHacks(dom) {
36879
37103
  dom.style.cssText = oldCSS;
36880
37104
  }
36881
37105
  }
36882
- function nearbyTextNode(node, offset2) {
36883
- for (; ; ) {
36884
- if (node.nodeType == 3)
36885
- return node;
36886
- if (node.nodeType == 1 && offset2 > 0) {
36887
- if (node.childNodes.length > offset2 && node.childNodes[offset2].nodeType == 3)
36888
- return node.childNodes[offset2];
36889
- node = node.childNodes[offset2 - 1];
36890
- offset2 = nodeSize(node);
36891
- } else if (node.nodeType == 1 && offset2 < node.childNodes.length) {
36892
- node = node.childNodes[offset2];
36893
- offset2 = 0;
36894
- } else {
36895
- return null;
36896
- }
36897
- }
36898
- }
36899
37106
  function findTextInFragment(frag, text, from2, to2) {
36900
37107
  for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to2; ) {
36901
37108
  let child = frag.child(i2++), childStart = pos;
@@ -37470,7 +37677,7 @@ function serializeForClipboard(view, slice4) {
37470
37677
  if (firstChild && firstChild.nodeType == 1)
37471
37678
  firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
37472
37679
  let text = view.someProp("clipboardTextSerializer", (f2) => f2(slice4, view)) || slice4.content.textBetween(0, slice4.content.size, "\n\n");
37473
- return { dom: wrap2, text };
37680
+ return { dom: wrap2, text, slice: slice4 };
37474
37681
  }
37475
37682
  function parseFromClipboard(view, text, html, plainText, $context) {
37476
37683
  let inCode = $context.parent.type.spec.code;
@@ -37690,6 +37897,7 @@ class InputState {
37690
37897
  this.lastTouch = 0;
37691
37898
  this.lastAndroidDelete = 0;
37692
37899
  this.composing = false;
37900
+ this.compositionNode = null;
37693
37901
  this.composingTimeout = -1;
37694
37902
  this.compositionNodes = [];
37695
37903
  this.compositionEndedAt = -2e8;
@@ -37817,8 +38025,7 @@ function updateSelection(view, selection, origin2) {
37817
38025
  if (!view.focused)
37818
38026
  view.focus();
37819
38027
  let tr2 = view.state.tr.setSelection(selection);
37820
- if (origin2 == "pointer")
37821
- tr2.setMeta("pointer", true);
38028
+ tr2.setMeta("pointer", true);
37822
38029
  view.dispatch(tr2);
37823
38030
  }
37824
38031
  function selectClickedLeaf(view, inside) {
@@ -37826,7 +38033,7 @@ function selectClickedLeaf(view, inside) {
37826
38033
  return false;
37827
38034
  let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
37828
38035
  if (node && node.isAtom && NodeSelection.isSelectable(node)) {
37829
- updateSelection(view, new NodeSelection($pos), "pointer");
38036
+ updateSelection(view, new NodeSelection($pos));
37830
38037
  return true;
37831
38038
  }
37832
38039
  return false;
@@ -37849,7 +38056,7 @@ function selectClickedNode(view, inside) {
37849
38056
  }
37850
38057
  }
37851
38058
  if (selectAt != null) {
37852
- updateSelection(view, NodeSelection.create(view.state.doc, selectAt), "pointer");
38059
+ updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
37853
38060
  return true;
37854
38061
  } else {
37855
38062
  return false;
@@ -37870,7 +38077,7 @@ function defaultTripleClick(view, inside, event) {
37870
38077
  let doc2 = view.state.doc;
37871
38078
  if (inside == -1) {
37872
38079
  if (doc2.inlineContent) {
37873
- updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size), "pointer");
38080
+ updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size));
37874
38081
  return true;
37875
38082
  }
37876
38083
  return false;
@@ -37880,9 +38087,9 @@ function defaultTripleClick(view, inside, event) {
37880
38087
  let node = i2 > $pos.depth ? $pos.nodeAfter : $pos.node(i2);
37881
38088
  let nodePos = $pos.before(i2);
37882
38089
  if (node.inlineContent)
37883
- updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size), "pointer");
38090
+ updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size));
37884
38091
  else if (NodeSelection.isSelectable(node))
37885
- updateSelection(view, NodeSelection.create(doc2, nodePos), "pointer");
38092
+ updateSelection(view, NodeSelection.create(doc2, nodePos));
37886
38093
  else
37887
38094
  continue;
37888
38095
  return true;
@@ -37939,7 +38146,7 @@ class MouseDown {
37939
38146
  }
37940
38147
  const target = flushed ? null : event.target;
37941
38148
  const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
37942
- this.target = targetDesc ? targetDesc.dom : null;
38149
+ this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;
37943
38150
  let { selection } = view.state;
37944
38151
  if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
37945
38152
  this.mightDrag = {
@@ -37999,7 +38206,7 @@ class MouseDown {
37999
38206
  // thus doesn't get a reaction from ProseMirror. This
38000
38207
  // works around that.
38001
38208
  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)) {
38002
- updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)), "pointer");
38209
+ updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)));
38003
38210
  event.preventDefault();
38004
38211
  } else {
38005
38212
  setSelectionOrigin(this.view, "pointer");
@@ -38071,6 +38278,7 @@ editHandlers.compositionend = (view, event) => {
38071
38278
  view.input.composing = false;
38072
38279
  view.input.compositionEndedAt = event.timeStamp;
38073
38280
  view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
38281
+ view.input.compositionNode = null;
38074
38282
  if (view.input.compositionPendingChanges)
38075
38283
  Promise.resolve().then(() => view.domObserver.flush());
38076
38284
  view.input.compositionID++;
@@ -38090,6 +38298,26 @@ function clearComposition(view) {
38090
38298
  while (view.input.compositionNodes.length > 0)
38091
38299
  view.input.compositionNodes.pop().markParentsDirty();
38092
38300
  }
38301
+ function findCompositionNode(view) {
38302
+ let sel = view.domSelectionRange();
38303
+ if (!sel.focusNode)
38304
+ return null;
38305
+ let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
38306
+ let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
38307
+ if (textBefore && textAfter && textBefore != textAfter) {
38308
+ let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;
38309
+ if (textBefore == lastChanged || textAfter == lastChanged)
38310
+ return lastChanged;
38311
+ if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
38312
+ return textAfter;
38313
+ } else if (view.input.compositionNode == textAfter) {
38314
+ let descBefore = textBefore.pmViewDesc;
38315
+ if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
38316
+ return textAfter;
38317
+ }
38318
+ }
38319
+ return textBefore || textAfter;
38320
+ }
38093
38321
  function timestampFromCustomEvent() {
38094
38322
  let event = document.createEvent("Event");
38095
38323
  event.initEvent("event", true, true);
@@ -38224,7 +38452,8 @@ handlers.dragstart = (view, _event) => {
38224
38452
  if (desc && desc.node.type.spec.draggable && desc != view.docView)
38225
38453
  node = NodeSelection.create(view.state.doc, desc.posBefore);
38226
38454
  }
38227
- let slice4 = (node || view.state.selection).content(), { dom, text } = serializeForClipboard(view, slice4);
38455
+ let draggedSlice = (node || view.state.selection).content();
38456
+ let { dom, text, slice: slice4 } = serializeForClipboard(view, draggedSlice);
38228
38457
  event.dataTransfer.clearData();
38229
38458
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
38230
38459
  event.dataTransfer.effectAllowed = "copyMove";
@@ -38644,9 +38873,6 @@ class DecorationSet {
38644
38873
  return this;
38645
38874
  return local.length || children2.length ? new DecorationSet(local, children2) : empty$1;
38646
38875
  }
38647
- /**
38648
- @internal
38649
- */
38650
38876
  forChild(offset2, node) {
38651
38877
  if (this == empty$1)
38652
38878
  return this;
@@ -39000,6 +39226,7 @@ class DOMObserver {
39000
39226
  this.currentSelection = new SelectionState();
39001
39227
  this.onCharData = null;
39002
39228
  this.suppressingSelectionUpdates = false;
39229
+ this.lastChangedTextNode = null;
39003
39230
  this.observer = window.MutationObserver && new window.MutationObserver((mutations) => {
39004
39231
  for (let i2 = 0; i2 < mutations.length; i2++)
39005
39232
  this.queue.push(mutations[i2]);
@@ -39125,14 +39352,21 @@ class DOMObserver {
39125
39352
  }
39126
39353
  }
39127
39354
  }
39128
- if (gecko && added.length > 1) {
39355
+ if (gecko && added.length) {
39129
39356
  let brs = added.filter((n2) => n2.nodeName == "BR");
39130
39357
  if (brs.length == 2) {
39131
- let a2 = brs[0], b2 = brs[1];
39358
+ let [a2, b2] = brs;
39132
39359
  if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode)
39133
39360
  b2.remove();
39134
39361
  else
39135
39362
  a2.remove();
39363
+ } else {
39364
+ let { focusNode } = this.currentSelection;
39365
+ for (let br2 of brs) {
39366
+ let parent = br2.parentNode;
39367
+ if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
39368
+ br2.remove();
39369
+ }
39136
39370
  }
39137
39371
  }
39138
39372
  let readSel = null;
@@ -39164,8 +39398,12 @@ class DOMObserver {
39164
39398
  if (!desc || desc.ignoreMutation(mut))
39165
39399
  return null;
39166
39400
  if (mut.type == "childList") {
39167
- for (let i2 = 0; i2 < mut.addedNodes.length; i2++)
39168
- added.push(mut.addedNodes[i2]);
39401
+ for (let i2 = 0; i2 < mut.addedNodes.length; i2++) {
39402
+ let node = mut.addedNodes[i2];
39403
+ added.push(node);
39404
+ if (node.nodeType == 3)
39405
+ this.lastChangedTextNode = node;
39406
+ }
39169
39407
  if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))
39170
39408
  return { from: desc.posBefore, to: desc.posAfter };
39171
39409
  let prev = mut.previousSibling, next = mut.nextSibling;
@@ -39186,6 +39424,7 @@ class DOMObserver {
39186
39424
  } else if (mut.type == "attributes") {
39187
39425
  return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
39188
39426
  } else {
39427
+ this.lastChangedTextNode = mut.target;
39189
39428
  return {
39190
39429
  from: desc.posAtStart,
39191
39430
  to: desc.posAtEnd,
@@ -39212,7 +39451,20 @@ function checkCSS(view) {
39212
39451
  cssCheckWarned = true;
39213
39452
  }
39214
39453
  }
39215
- function safariShadowSelectionRange(view) {
39454
+ function rangeToSelectionRange(view, range2) {
39455
+ let anchorNode = range2.startContainer, anchorOffset = range2.startOffset;
39456
+ let focusNode = range2.endContainer, focusOffset = range2.endOffset;
39457
+ let currentAnchor = view.domAtPos(view.state.selection.anchor);
39458
+ if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
39459
+ [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
39460
+ return { anchorNode, anchorOffset, focusNode, focusOffset };
39461
+ }
39462
+ function safariShadowSelectionRange(view, selection) {
39463
+ if (selection.getComposedRanges) {
39464
+ let range2 = selection.getComposedRanges(view.root)[0];
39465
+ if (range2)
39466
+ return rangeToSelectionRange(view, range2);
39467
+ }
39216
39468
  let found2;
39217
39469
  function read2(event) {
39218
39470
  event.preventDefault();
@@ -39222,12 +39474,15 @@ function safariShadowSelectionRange(view) {
39222
39474
  view.dom.addEventListener("beforeinput", read2, true);
39223
39475
  document.execCommand("indent");
39224
39476
  view.dom.removeEventListener("beforeinput", read2, true);
39225
- let anchorNode = found2.startContainer, anchorOffset = found2.startOffset;
39226
- let focusNode = found2.endContainer, focusOffset = found2.endOffset;
39227
- let currentAnchor = view.domAtPos(view.state.selection.anchor);
39228
- if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
39229
- [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
39230
- return { anchorNode, anchorOffset, focusNode, focusOffset };
39477
+ return found2 ? rangeToSelectionRange(view, found2) : null;
39478
+ }
39479
+ function blockParent(view, node) {
39480
+ for (let p2 = node.parentNode; p2 && p2 != view.dom; p2 = p2.parentNode) {
39481
+ let desc = view.docView.nearestDesc(p2, true);
39482
+ if (desc && desc.node.isBlock)
39483
+ return p2;
39484
+ }
39485
+ return null;
39231
39486
  }
39232
39487
  function parseBetween(view, from_, to_) {
39233
39488
  let { node: parent, fromOffset, toOffset, from: from2, to: to2 } = view.docView.parseRange(from_, to_);
@@ -39347,10 +39602,6 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
39347
39602
  return;
39348
39603
  }
39349
39604
  }
39350
- if (chrome && view.cursorWrapper && parse2.sel && parse2.sel.anchor == view.cursorWrapper.deco.from && parse2.sel.head == parse2.sel.anchor) {
39351
- let size2 = change.endB - change.start;
39352
- parse2.sel = { anchor: parse2.sel.anchor + size2, head: parse2.sel.anchor + size2 };
39353
- }
39354
39605
  view.input.domChangeCount++;
39355
39606
  if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
39356
39607
  if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
@@ -39374,7 +39625,7 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
39374
39625
  view.input.lastIOSEnter = 0;
39375
39626
  return;
39376
39627
  }
39377
- if (view.state.selection.anchor > change.start && looksLikeJoin(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
39628
+ if (view.state.selection.anchor > change.start && looksLikeBackspace(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
39378
39629
  if (android && chrome)
39379
39630
  view.domObserver.suppressSelectionUpdates();
39380
39631
  return;
@@ -39458,12 +39709,18 @@ function isMarkChange(cur, prev) {
39458
39709
  if (Fragment.from(updated).eq(cur))
39459
39710
  return { mark, type: type3 };
39460
39711
  }
39461
- function looksLikeJoin(old, start2, end2, $newStart, $newEnd) {
39462
- if (!$newStart.parent.isTextblock || // The content must have shrunk
39463
- end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
39464
- skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
39712
+ function looksLikeBackspace(old, start2, end2, $newStart, $newEnd) {
39713
+ if (
39714
+ // The content must have shrunk
39715
+ end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
39716
+ skipClosingAndOpening($newStart, true, false) < $newEnd.pos
39717
+ )
39465
39718
  return false;
39466
39719
  let $start = old.resolve(start2);
39720
+ if (!$newStart.parent.isTextblock) {
39721
+ let after = $start.nodeAfter;
39722
+ return after != null && end2 == start2 + after.nodeSize;
39723
+ }
39467
39724
  if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
39468
39725
  return false;
39469
39726
  let $next = old.resolve(skipClosingAndOpening($start, true, true));
@@ -39652,8 +39909,10 @@ class EditorView {
39652
39909
  let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state2.selection.empty && selectionContextChanged(prev.selection, state2.selection);
39653
39910
  if (updateDoc) {
39654
39911
  let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
39912
+ if (this.composing)
39913
+ this.input.compositionNode = findCompositionNode(this);
39655
39914
  if (redraw || !this.docView.update(state2.doc, outerDeco, innerDeco, this)) {
39656
- this.docView.updateOuterDeco([]);
39915
+ this.docView.updateOuterDeco(outerDeco);
39657
39916
  this.docView.destroy();
39658
39917
  this.docView = docViewDesc(state2.doc, outerDeco, innerDeco, this.dom, this);
39659
39918
  }
@@ -39912,6 +40171,7 @@ class EditorView {
39912
40171
  }
39913
40172
  this.docView.destroy();
39914
40173
  this.docView = null;
40174
+ clearReusedRange();
39915
40175
  }
39916
40176
  /**
39917
40177
  This is true when the view has been
@@ -39947,7 +40207,8 @@ class EditorView {
39947
40207
  @internal
39948
40208
  */
39949
40209
  domSelectionRange() {
39950
- return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom ? safariShadowSelectionRange(this) : this.domSelection();
40210
+ let sel = this.domSelection();
40211
+ return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
39951
40212
  }
39952
40213
  /**
39953
40214
  @internal
@@ -40938,7 +41199,8 @@ function getAttributesFromExtensions(extensions) {
40938
41199
  const context = {
40939
41200
  name: extension.name,
40940
41201
  options: extension.options,
40941
- storage: extension.storage
41202
+ storage: extension.storage,
41203
+ extensions: nodeAndMarkExtensions
40942
41204
  };
40943
41205
  const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", context);
40944
41206
  if (!addGlobalAttributes) {
@@ -41064,7 +41326,7 @@ function fromString(value) {
41064
41326
  return value;
41065
41327
  }
41066
41328
  function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
41067
- if (parseRule.style) {
41329
+ if ("style" in parseRule) {
41068
41330
  return parseRule;
41069
41331
  }
41070
41332
  return {
@@ -41129,6 +41391,7 @@ function getSchemaByResolvedExtensions(extensions, editor) {
41129
41391
  selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
41130
41392
  draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
41131
41393
  code: callOrReturn(getExtensionField(extension, "code", context)),
41394
+ whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
41132
41395
  defining: callOrReturn(getExtensionField(extension, "defining", context)),
41133
41396
  isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
41134
41397
  attrs: Object.fromEntries(extensionAttributes.map((extensionAttribute) => {
@@ -41684,7 +41947,7 @@ class ExtensionManager {
41684
41947
  const plugins2 = [];
41685
41948
  const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
41686
41949
  let defaultBindings = {};
41687
- if (extension.type === "mark" && extension.config.exitable) {
41950
+ if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) {
41688
41951
  defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
41689
41952
  }
41690
41953
  if (addKeyboardShortcuts) {
@@ -41832,14 +42095,10 @@ function mergeDeep(target, source) {
41832
42095
  const output = { ...target };
41833
42096
  if (isPlainObject(target) && isPlainObject(source)) {
41834
42097
  Object.keys(source).forEach((key) => {
41835
- if (isPlainObject(source[key])) {
41836
- if (!(key in target)) {
41837
- Object.assign(output, { [key]: source[key] });
41838
- } else {
41839
- output[key] = mergeDeep(target[key], source[key]);
41840
- }
42098
+ if (isPlainObject(source[key]) && isPlainObject(target[key])) {
42099
+ output[key] = mergeDeep(target[key], source[key]);
41841
42100
  } else {
41842
- Object.assign(output, { [key]: source[key] });
42101
+ output[key] = source[key];
41843
42102
  }
41844
42103
  });
41845
42104
  }
@@ -41878,13 +42137,14 @@ class Extension {
41878
42137
  return new Extension(config);
41879
42138
  }
41880
42139
  configure(options = {}) {
41881
- const extension = this.extend();
42140
+ const extension = this.extend({
42141
+ ...this.config,
42142
+ addOptions: () => {
42143
+ return mergeDeep(this.options, options);
42144
+ }
42145
+ });
42146
+ extension.name = this.name;
41882
42147
  extension.parent = this.parent;
41883
- extension.options = mergeDeep(this.options, options);
41884
- extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
41885
- name: extension.name,
41886
- options: extension.options
41887
- }));
41888
42148
  return extension;
41889
42149
  }
41890
42150
  extend(extendedConfig = {}) {
@@ -41892,7 +42152,7 @@ class Extension {
41892
42152
  extension.parent = this;
41893
42153
  this.child = extension;
41894
42154
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
41895
- if (extendedConfig.defaultOptions) {
42155
+ if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
41896
42156
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
41897
42157
  }
41898
42158
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -42276,13 +42536,47 @@ function createNodeFromContent(content, schema, options) {
42276
42536
  }
42277
42537
  return schema.nodeFromJSON(content);
42278
42538
  } catch (error) {
42539
+ if (options.errorOnInvalidContent) {
42540
+ throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
42541
+ }
42279
42542
  console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
42280
42543
  return createNodeFromContent("", schema, options);
42281
42544
  }
42282
42545
  }
42283
42546
  if (isTextContent) {
42284
- const parser = DOMParser.fromSchema(schema);
42285
- return options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
42547
+ let schemaToUse = schema;
42548
+ let hasInvalidContent = false;
42549
+ let invalidContent = "";
42550
+ if (options.errorOnInvalidContent) {
42551
+ schemaToUse = new Schema({
42552
+ topNode: schema.spec.topNode,
42553
+ marks: schema.spec.marks,
42554
+ // Prosemirror's schemas are executed such that: the last to execute, matches last
42555
+ // 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
42556
+ nodes: schema.spec.nodes.append({
42557
+ __tiptap__private__unknown__catch__all__node: {
42558
+ content: "inline*",
42559
+ group: "block",
42560
+ parseDOM: [
42561
+ {
42562
+ tag: "*",
42563
+ getAttrs: (e) => {
42564
+ hasInvalidContent = true;
42565
+ invalidContent = typeof e === "string" ? e : e.outerHTML;
42566
+ return null;
42567
+ }
42568
+ }
42569
+ ]
42570
+ }
42571
+ })
42572
+ });
42573
+ }
42574
+ const parser = DOMParser.fromSchema(schemaToUse);
42575
+ const response = options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
42576
+ if (options.errorOnInvalidContent && hasInvalidContent) {
42577
+ throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
42578
+ }
42579
+ return response;
42286
42580
  }
42287
42581
  return createNodeFromContent("", schema, options);
42288
42582
  }
@@ -42305,9 +42599,10 @@ function selectionToInsertionEnd(tr2, startLen, bias) {
42305
42599
  tr2.setSelection(Selection$1.near(tr2.doc.resolve(end2), bias));
42306
42600
  }
42307
42601
  const isFragment = (nodeOrFragment) => {
42308
- return nodeOrFragment.toString().startsWith("<");
42602
+ return !("type" in nodeOrFragment);
42309
42603
  };
42310
42604
  const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, editor }) => {
42605
+ var _a2;
42311
42606
  if (dispatch) {
42312
42607
  options = {
42313
42608
  parseOptions: {},
@@ -42316,14 +42611,17 @@ const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, edit
42316
42611
  applyPasteRules: false,
42317
42612
  ...options
42318
42613
  };
42319
- const content = createNodeFromContent(value, editor.schema, {
42320
- parseOptions: {
42321
- preserveWhitespace: "full",
42322
- ...options.parseOptions
42323
- }
42324
- });
42325
- if (content.toString() === "<>") {
42326
- return true;
42614
+ let content;
42615
+ try {
42616
+ content = createNodeFromContent(value, editor.schema, {
42617
+ parseOptions: {
42618
+ preserveWhitespace: "full",
42619
+ ...options.parseOptions
42620
+ },
42621
+ errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
42622
+ });
42623
+ } catch (e) {
42624
+ return false;
42327
42625
  }
42328
42626
  let { from: from2, to: to2 } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
42329
42627
  let isOnlyTextContent = true;
@@ -42380,7 +42678,7 @@ const joinBackward = () => ({ state: state2, dispatch }) => {
42380
42678
  const joinForward = () => ({ state: state2, dispatch }) => {
42381
42679
  return joinForward$1(state2, dispatch);
42382
42680
  };
42383
- const joinItemBackward = () => ({ tr: tr2, state: state2, dispatch }) => {
42681
+ const joinItemBackward = () => ({ state: state2, dispatch, tr: tr2 }) => {
42384
42682
  try {
42385
42683
  const point2 = joinPoint(state2.doc, state2.selection.$from.pos, -1);
42386
42684
  if (point2 === null || point2 === void 0) {
@@ -42391,7 +42689,7 @@ const joinItemBackward = () => ({ tr: tr2, state: state2, dispatch }) => {
42391
42689
  dispatch(tr2);
42392
42690
  }
42393
42691
  return true;
42394
- } catch {
42692
+ } catch (e) {
42395
42693
  return false;
42396
42694
  }
42397
42695
  };
@@ -42609,16 +42907,32 @@ const selectTextblockEnd = () => ({ state: state2, dispatch }) => {
42609
42907
  const selectTextblockStart = () => ({ state: state2, dispatch }) => {
42610
42908
  return selectTextblockStart$1(state2, dispatch);
42611
42909
  };
42612
- function createDocument(content, schema, parseOptions = {}) {
42613
- return createNodeFromContent(content, schema, { slice: false, parseOptions });
42910
+ function createDocument(content, schema, parseOptions = {}, options = {}) {
42911
+ return createNodeFromContent(content, schema, {
42912
+ slice: false,
42913
+ parseOptions,
42914
+ errorOnInvalidContent: options.errorOnInvalidContent
42915
+ });
42614
42916
  }
42615
- const setContent$1 = (content, emitUpdate = false, parseOptions = {}) => ({ tr: tr2, editor, dispatch }) => {
42917
+ const setContent$1 = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr: tr2, dispatch, commands: commands2 }) => {
42918
+ var _a2, _b;
42616
42919
  const { doc: doc2 } = tr2;
42617
- const document2 = createDocument(content, editor.schema, parseOptions);
42920
+ if (parseOptions.preserveWhitespace !== "full") {
42921
+ const document2 = createDocument(content, editor.schema, parseOptions, {
42922
+ errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
42923
+ });
42924
+ if (dispatch) {
42925
+ tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
42926
+ }
42927
+ return true;
42928
+ }
42618
42929
  if (dispatch) {
42619
- tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
42930
+ tr2.setMeta("preventUpdate", !emitUpdate);
42620
42931
  }
42621
- return true;
42932
+ return commands2.insertContentAt({ from: 0, to: doc2.content.size }, content, {
42933
+ parseOptions,
42934
+ errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
42935
+ });
42622
42936
  };
42623
42937
  function getMarkAttributes(state2, typeOrName) {
42624
42938
  const type3 = getMarkType(typeOrName, state2.schema);
@@ -42821,10 +43135,11 @@ function isList(name, extensions) {
42821
43135
  return group.split(" ").includes("list");
42822
43136
  }
42823
43137
  function isNodeEmpty(node) {
42824
- var _a2;
42825
- const defaultContent = (_a2 = node.type.createAndFill()) === null || _a2 === void 0 ? void 0 : _a2.toJSON();
42826
- const content = node.toJSON();
42827
- return JSON.stringify(defaultContent) === JSON.stringify(content);
43138
+ const defaultContent = node.type.createAndFill();
43139
+ if (!defaultContent) {
43140
+ return false;
43141
+ }
43142
+ return node.eq(defaultContent);
42828
43143
  }
42829
43144
  function isNodeSelection(value) {
42830
43145
  return value instanceof NodeSelection;
@@ -43339,14 +43654,14 @@ var commands = /* @__PURE__ */ Object.freeze({
43339
43654
  forEach,
43340
43655
  insertContent,
43341
43656
  insertContentAt,
43342
- joinUp,
43343
- joinDown,
43344
43657
  joinBackward,
43658
+ joinDown,
43345
43659
  joinForward,
43346
43660
  joinItemBackward,
43347
43661
  joinItemForward,
43348
43662
  joinTextblockBackward,
43349
43663
  joinTextblockForward,
43664
+ joinUp,
43350
43665
  keyboardShortcut,
43351
43666
  lift,
43352
43667
  liftEmptyBlock,
@@ -43543,13 +43858,16 @@ const Tabindex = Extension.create({
43543
43858
  new Plugin({
43544
43859
  key: new PluginKey("tabindex"),
43545
43860
  props: {
43546
- attributes: this.editor.isEditable ? { tabindex: "0" } : {}
43861
+ attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
43547
43862
  }
43548
43863
  })
43549
43864
  ];
43550
43865
  }
43551
43866
  });
43552
43867
  class NodePos {
43868
+ get name() {
43869
+ return this.node.type.name;
43870
+ }
43553
43871
  constructor(pos, editor, isBlock = false, node = null) {
43554
43872
  this.currentNode = null;
43555
43873
  this.actualDepth = null;
@@ -43558,9 +43876,6 @@ class NodePos {
43558
43876
  this.editor = editor;
43559
43877
  this.currentNode = node;
43560
43878
  }
43561
- get name() {
43562
- return this.node.type.name;
43563
- }
43564
43879
  get node() {
43565
43880
  return this.currentNode || this.resolvedPos.node();
43566
43881
  }
@@ -43792,7 +44107,7 @@ img.ProseMirror-separator {
43792
44107
  opacity: 0
43793
44108
  }`;
43794
44109
  function createStyleTag(style2, nonce, suffix) {
43795
- const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ""}]`);
44110
+ const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${""}]`);
43796
44111
  if (tiptapStyleTag !== null) {
43797
44112
  return tiptapStyleTag;
43798
44113
  }
@@ -43800,7 +44115,7 @@ function createStyleTag(style2, nonce, suffix) {
43800
44115
  if (nonce) {
43801
44116
  styleNode.setAttribute("nonce", nonce);
43802
44117
  }
43803
- styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ""}`, "");
44118
+ styleNode.setAttribute(`data-tiptap-style${""}`, "");
43804
44119
  styleNode.innerHTML = style2;
43805
44120
  document.getElementsByTagName("head")[0].appendChild(styleNode);
43806
44121
  return styleNode;
@@ -43824,6 +44139,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
43824
44139
  enableInputRules: true,
43825
44140
  enablePasteRules: true,
43826
44141
  enableCoreExtensions: true,
44142
+ enableContentCheck: false,
43827
44143
  onBeforeCreate: () => null,
43828
44144
  onCreate: () => null,
43829
44145
  onUpdate: () => null,
@@ -43831,7 +44147,10 @@ let Editor$1 = class Editor2 extends EventEmitter {
43831
44147
  onTransaction: () => null,
43832
44148
  onFocus: () => null,
43833
44149
  onBlur: () => null,
43834
- onDestroy: () => null
44150
+ onDestroy: () => null,
44151
+ onContentError: ({ error }) => {
44152
+ throw error;
44153
+ }
43835
44154
  };
43836
44155
  this.isCapturingTransaction = false;
43837
44156
  this.capturedTransaction = null;
@@ -43841,6 +44160,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
43841
44160
  this.createSchema();
43842
44161
  this.on("beforeCreate", this.options.onBeforeCreate);
43843
44162
  this.emit("beforeCreate", { editor: this });
44163
+ this.on("contentError", this.options.onContentError);
43844
44164
  this.createView();
43845
44165
  this.injectCSS();
43846
44166
  this.on("create", this.options.onCreate);
@@ -43994,7 +44314,23 @@ let Editor$1 = class Editor2 extends EventEmitter {
43994
44314
  * Creates a ProseMirror view.
43995
44315
  */
43996
44316
  createView() {
43997
- const doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions);
44317
+ let doc2;
44318
+ try {
44319
+ doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
44320
+ } catch (e) {
44321
+ if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) {
44322
+ throw e;
44323
+ }
44324
+ this.emit("contentError", {
44325
+ editor: this,
44326
+ error: e,
44327
+ disableCollaboration: () => {
44328
+ this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
44329
+ this.createExtensionManager();
44330
+ }
44331
+ });
44332
+ doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
44333
+ }
43998
44334
  const selection = resolveFocusPosition(doc2, this.options.autofocus);
43999
44335
  this.view = new EditorView(this.options.element, {
44000
44336
  ...this.options.editorProps,
@@ -44232,7 +44568,8 @@ function nodeInputRule(config) {
44232
44568
  tr2.insertText(lastChar, start2 + match2[0].length - 1);
44233
44569
  tr2.replaceWith(matchStart, end2, newNode);
44234
44570
  } else if (match2[0]) {
44235
- tr2.insert(start2 - 1, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
44571
+ const insertionStart = config.type.isInline ? start2 : start2 - 1;
44572
+ tr2.insert(insertionStart, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
44236
44573
  }
44237
44574
  tr2.scrollIntoView();
44238
44575
  }
@@ -44317,20 +44654,22 @@ class Mark {
44317
44654
  return new Mark(config);
44318
44655
  }
44319
44656
  configure(options = {}) {
44320
- const extension = this.extend();
44321
- extension.options = mergeDeep(this.options, options);
44322
- extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
44323
- name: extension.name,
44324
- options: extension.options
44325
- }));
44657
+ const extension = this.extend({
44658
+ ...this.config,
44659
+ addOptions: () => {
44660
+ return mergeDeep(this.options, options);
44661
+ }
44662
+ });
44663
+ extension.name = this.name;
44664
+ extension.parent = this.parent;
44326
44665
  return extension;
44327
44666
  }
44328
44667
  extend(extendedConfig = {}) {
44329
- const extension = new Mark({ ...this.config, ...extendedConfig });
44668
+ const extension = new Mark(extendedConfig);
44330
44669
  extension.parent = this;
44331
44670
  this.child = extension;
44332
44671
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
44333
- if (extendedConfig.defaultOptions) {
44672
+ if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
44334
44673
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
44335
44674
  }
44336
44675
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -44396,20 +44735,22 @@ let Node$2 = class Node3 {
44396
44735
  return new Node3(config);
44397
44736
  }
44398
44737
  configure(options = {}) {
44399
- const extension = this.extend();
44400
- extension.options = mergeDeep(this.options, options);
44401
- extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
44402
- name: extension.name,
44403
- options: extension.options
44404
- }));
44738
+ const extension = this.extend({
44739
+ ...this.config,
44740
+ addOptions: () => {
44741
+ return mergeDeep(this.options, options);
44742
+ }
44743
+ });
44744
+ extension.name = this.name;
44745
+ extension.parent = this.parent;
44405
44746
  return extension;
44406
44747
  }
44407
44748
  extend(extendedConfig = {}) {
44408
- const extension = new Node3({ ...this.config, ...extendedConfig });
44749
+ const extension = new Node3(extendedConfig);
44409
44750
  extension.parent = this;
44410
44751
  this.child = extension;
44411
44752
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
44412
- if (extendedConfig.defaultOptions) {
44753
+ if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
44413
44754
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
44414
44755
  }
44415
44756
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -44944,14 +45285,12 @@ const CodeBlock = Node$2.create({
44944
45285
  if (!text || !language) {
44945
45286
  return false;
44946
45287
  }
44947
- const { tr: tr2 } = view.state;
44948
- if (view.state.selection.from === view.state.doc.nodeSize - (1 + view.state.selection.$to.depth * 2)) {
44949
- tr2.insert(view.state.selection.from - 1, this.type.create({ language }));
44950
- } else {
44951
- tr2.replaceSelectionWith(this.type.create({ language }));
45288
+ const { tr: tr2, schema } = view.state;
45289
+ const textNode = schema.text(text.replace(/\r\n?/g, "\n"));
45290
+ tr2.replaceSelectionWith(this.type.create({ language }, textNode));
45291
+ if (tr2.selection.$from.parent.type !== this.type) {
45292
+ tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
44952
45293
  }
44953
- tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
44954
- tr2.insertText(text.replace(/\r\n?/g, "\n"));
44955
45294
  tr2.setMeta("paste", true);
44956
45295
  view.dispatch(tr2);
44957
45296
  return true;
@@ -45867,13 +46206,13 @@ function applyTransaction(history2, state2, tr2, options) {
45867
46206
  return history2;
45868
46207
  } else if (appended && appended.getMeta(historyKey)) {
45869
46208
  if (appended.getMeta(historyKey).redo)
45870
- 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);
46209
+ return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps), history2.prevTime, history2.prevComposition);
45871
46210
  else
45872
46211
  return new HistoryState(history2.done, history2.undone.addTransform(tr2, void 0, options, mustPreserveItems(state2)), null, history2.prevTime, history2.prevComposition);
45873
46212
  } else if (tr2.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
45874
46213
  let composition = tr2.getMeta("composition");
45875
46214
  let newGroup = history2.prevTime == 0 || !appended && history2.prevComposition != composition && (history2.prevTime < (tr2.time || 0) - options.newGroupDelay || !isAdjacentTo(tr2, history2.prevRanges));
45876
- let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps[tr2.steps.length - 1]);
46215
+ let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps);
45877
46216
  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);
45878
46217
  } else if (rebased = tr2.getMeta("rebased")) {
45879
46218
  return new HistoryState(history2.done.rebased(tr2, rebased), history2.undone.rebased(tr2, rebased), mapRanges(history2.prevRanges, tr2.mapping), history2.prevTime, history2.prevComposition);
@@ -45894,9 +46233,10 @@ function isAdjacentTo(transform, prevRanges) {
45894
46233
  });
45895
46234
  return adjacent;
45896
46235
  }
45897
- function rangesFor(map4) {
46236
+ function rangesFor(maps) {
45898
46237
  let result2 = [];
45899
- map4.forEach((_from, _to, from2, to2) => result2.push(from2, to2));
46238
+ for (let i2 = maps.length - 1; i2 >= 0 && result2.length == 0; i2--)
46239
+ maps[i2].forEach((_from, _to, from2, to2) => result2.push(from2, to2));
45900
46240
  return result2;
45901
46241
  }
45902
46242
  function mapRanges(ranges, mapping) {
@@ -45910,16 +46250,16 @@ function mapRanges(ranges, mapping) {
45910
46250
  }
45911
46251
  return result2;
45912
46252
  }
45913
- function histTransaction(history2, state2, dispatch, redo2) {
46253
+ function histTransaction(history2, state2, redo2) {
45914
46254
  let preserveItems = mustPreserveItems(state2);
45915
46255
  let histOptions = historyKey.get(state2).spec.config;
45916
46256
  let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
45917
46257
  if (!pop)
45918
- return;
46258
+ return null;
45919
46259
  let selection = pop.selection.resolve(pop.transform.doc);
45920
46260
  let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
45921
46261
  let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
45922
- dispatch(pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist }).scrollIntoView());
46262
+ return pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist });
45923
46263
  }
45924
46264
  let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
45925
46265
  function mustPreserveItems(state2) {
@@ -45967,22 +46307,21 @@ function history(config = {}) {
45967
46307
  }
45968
46308
  });
45969
46309
  }
45970
- const undo = (state2, dispatch) => {
45971
- let hist = historyKey.getState(state2);
45972
- if (!hist || hist.done.eventCount == 0)
45973
- return false;
45974
- if (dispatch)
45975
- histTransaction(hist, state2, dispatch, false);
45976
- return true;
45977
- };
45978
- const redo = (state2, dispatch) => {
45979
- let hist = historyKey.getState(state2);
45980
- if (!hist || hist.undone.eventCount == 0)
45981
- return false;
45982
- if (dispatch)
45983
- histTransaction(hist, state2, dispatch, true);
45984
- return true;
45985
- };
46310
+ function buildCommand(redo2, scroll) {
46311
+ return (state2, dispatch) => {
46312
+ let hist = historyKey.getState(state2);
46313
+ if (!hist || (redo2 ? hist.undone : hist.done).eventCount == 0)
46314
+ return false;
46315
+ if (dispatch) {
46316
+ let tr2 = histTransaction(hist, state2, redo2);
46317
+ if (tr2)
46318
+ dispatch(scroll ? tr2.scrollIntoView() : tr2);
46319
+ }
46320
+ return true;
46321
+ };
46322
+ }
46323
+ const undo = buildCommand(false, true);
46324
+ const redo = buildCommand(true, true);
45986
46325
  const History = Extension.create({
45987
46326
  name: "history",
45988
46327
  addOptions() {
@@ -46034,10 +46373,20 @@ const HorizontalRule = Node$2.create({
46034
46373
  addCommands() {
46035
46374
  return {
46036
46375
  setHorizontalRule: () => ({ chain, state: state2 }) => {
46037
- const { $to: $originTo } = state2.selection;
46376
+ const { selection } = state2;
46377
+ const { $from: $originFrom, $to: $originTo } = selection;
46038
46378
  const currentChain = chain();
46039
- if ($originTo.parentOffset === 0) {
46040
- currentChain.insertContentAt(Math.max($originTo.pos - 2, 0), { type: this.name });
46379
+ if ($originFrom.parentOffset === 0) {
46380
+ currentChain.insertContentAt({
46381
+ from: Math.max($originFrom.pos - 1, 0),
46382
+ to: $originTo.pos
46383
+ }, {
46384
+ type: this.name
46385
+ });
46386
+ } else if (isNodeSelection(selection)) {
46387
+ currentChain.insertContentAt($originTo.pos, {
46388
+ type: this.name
46389
+ });
46041
46390
  } else {
46042
46391
  currentChain.insertContent({ type: this.name });
46043
46392
  }
@@ -46423,11 +46772,11 @@ const StarterKit = Extension.create({
46423
46772
  addExtensions() {
46424
46773
  var _a2, _b, _c, _d, _e2, _f, _g, _h, _j, _k, _l2, _m, _o, _p, _q, _r2, _s, _t2;
46425
46774
  const extensions = [];
46426
- if (this.options.blockquote !== false) {
46427
- extensions.push(Blockquote.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.blockquote));
46428
- }
46429
46775
  if (this.options.bold !== false) {
46430
- extensions.push(Bold.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.bold));
46776
+ extensions.push(Bold.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.bold));
46777
+ }
46778
+ if (this.options.blockquote !== false) {
46779
+ extensions.push(Blockquote.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.blockquote));
46431
46780
  }
46432
46781
  if (this.options.bulletList !== false) {
46433
46782
  extensions.push(BulletList.configure((_c = this.options) === null || _c === void 0 ? void 0 : _c.bulletList));
@@ -49234,7 +49583,7 @@ class BubbleMenuView {
49234
49583
  }
49235
49584
  update(view, oldState) {
49236
49585
  const { state: state2 } = view;
49237
- const hasValidSelection = state2.selection.$from.pos !== state2.selection.$to.pos;
49586
+ const hasValidSelection = state2.selection.from !== state2.selection.to;
49238
49587
  if (this.updateDelay > 0 && hasValidSelection) {
49239
49588
  this.handleDebouncedUpdate(view, oldState);
49240
49589
  return;
@@ -52279,9 +52628,6 @@ function createColGroup(node, cellMinWidth, overrideCol, overrideValue) {
52279
52628
  return { colgroup, tableWidth, tableMinWidth };
52280
52629
  }
52281
52630
  function createCell(cellType, cellContent) {
52282
- if (cellContent) {
52283
- return cellType.createChecked(null, cellContent);
52284
- }
52285
52631
  return cellType.createAndFill();
52286
52632
  }
52287
52633
  function getTableNodeTypes(schema) {
@@ -52303,12 +52649,12 @@ function createTable$1(schema, rowsCount, colsCount, withHeaderRow, cellContent)
52303
52649
  const headerCells = [];
52304
52650
  const cells = [];
52305
52651
  for (let index2 = 0; index2 < colsCount; index2 += 1) {
52306
- const cell = createCell(types.cell, cellContent);
52652
+ const cell = createCell(types.cell);
52307
52653
  if (cell) {
52308
52654
  cells.push(cell);
52309
52655
  }
52310
52656
  if (withHeaderRow) {
52311
- const headerCell = createCell(types.header_cell, cellContent);
52657
+ const headerCell = createCell(types.header_cell);
52312
52658
  if (headerCell) {
52313
52659
  headerCells.push(headerCell);
52314
52660
  }
@@ -52386,7 +52732,7 @@ const Table = Node$2.create({
52386
52732
  insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ tr: tr2, dispatch, editor }) => {
52387
52733
  const node = createTable$1(editor.schema, rows, cols, withHeaderRow);
52388
52734
  if (dispatch) {
52389
- const offset2 = tr2.selection.anchor + 1;
52735
+ const offset2 = tr2.selection.from + 1;
52390
52736
  tr2.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr2.doc.resolve(offset2)));
52391
52737
  }
52392
52738
  return true;
@@ -52863,18 +53209,7 @@ function _typeof$1(obj) {
52863
53209
  return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
52864
53210
  }, _typeof$1(obj);
52865
53211
  }
52866
- function _defineProperties$2(target, props2) {
52867
- for (var i2 = 0; i2 < props2.length; i2++) {
52868
- var descriptor = props2[i2];
52869
- descriptor.enumerable = descriptor.enumerable || false;
52870
- descriptor.configurable = true;
52871
- if ("value" in descriptor) descriptor.writable = true;
52872
- Object.defineProperty(target, descriptor.key, descriptor);
52873
- }
52874
- }
52875
53212
  function _createClass$2(Constructor, protoProps, staticProps) {
52876
- if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
52877
- if (staticProps) _defineProperties$2(Constructor, staticProps);
52878
53213
  Object.defineProperty(Constructor, "prototype", { writable: false });
52879
53214
  return Constructor;
52880
53215
  }
@@ -53051,7 +53386,6 @@ function _defineProperties$1(target, props2) {
53051
53386
  }
53052
53387
  function _createClass$1(Constructor, protoProps, staticProps) {
53053
53388
  if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
53054
- if (staticProps) _defineProperties$1(Constructor, staticProps);
53055
53389
  Object.defineProperty(Constructor, "prototype", { writable: false });
53056
53390
  return Constructor;
53057
53391
  }
@@ -53693,10 +54027,10 @@ var DIGITS = {
53693
54027
  function parseDigit(character) {
53694
54028
  return DIGITS[character];
53695
54029
  }
53696
- function _createForOfIteratorHelperLoose$4(o2, allowArrayLike) {
54030
+ function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
53697
54031
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
53698
54032
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
53699
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$5(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54033
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$4(o2)) || allowArrayLike) {
53700
54034
  if (it2) o2 = it2;
53701
54035
  var i2 = 0;
53702
54036
  return function() {
@@ -53706,15 +54040,15 @@ function _createForOfIteratorHelperLoose$4(o2, allowArrayLike) {
53706
54040
  }
53707
54041
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
53708
54042
  }
53709
- function _unsupportedIterableToArray$5(o2, minLen) {
54043
+ function _unsupportedIterableToArray$4(o2, minLen) {
53710
54044
  if (!o2) return;
53711
- if (typeof o2 === "string") return _arrayLikeToArray$5(o2, minLen);
54045
+ if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen);
53712
54046
  var n2 = Object.prototype.toString.call(o2).slice(8, -1);
53713
54047
  if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name;
53714
54048
  if (n2 === "Map" || n2 === "Set") return Array.from(o2);
53715
- if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$5(o2, minLen);
54049
+ if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen);
53716
54050
  }
53717
- function _arrayLikeToArray$5(arr, len) {
54051
+ function _arrayLikeToArray$4(arr, len) {
53718
54052
  if (len == null || len > arr.length) len = arr.length;
53719
54053
  for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
53720
54054
  arr2[i2] = arr[i2];
@@ -53723,7 +54057,7 @@ function _arrayLikeToArray$5(arr, len) {
53723
54057
  }
53724
54058
  function parseIncompletePhoneNumber(string2) {
53725
54059
  var result2 = "";
53726
- for (var _iterator = _createForOfIteratorHelperLoose$4(string2.split("")), _step; !(_step = _iterator()).done; ) {
54060
+ for (var _iterator = _createForOfIteratorHelperLoose$3(string2.split("")), _step; !(_step = _iterator()).done; ) {
53727
54061
  var character = _step.value;
53728
54062
  result2 += parsePhoneNumberCharacter(character, result2) || "";
53729
54063
  }
@@ -53732,55 +54066,12 @@ function parseIncompletePhoneNumber(string2) {
53732
54066
  function parsePhoneNumberCharacter(character, prevParsedCharacters, emitEvent) {
53733
54067
  if (character === "+") {
53734
54068
  if (prevParsedCharacters) {
53735
- if (typeof emitEvent === "function") {
53736
- emitEvent("end");
53737
- }
53738
54069
  return;
53739
54070
  }
53740
54071
  return "+";
53741
54072
  }
53742
54073
  return parseDigit(character);
53743
54074
  }
53744
- function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
53745
- var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
53746
- if (it2) return (it2 = it2.call(o2)).next.bind(it2);
53747
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$4(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
53748
- if (it2) o2 = it2;
53749
- var i2 = 0;
53750
- return function() {
53751
- if (i2 >= o2.length) return { done: true };
53752
- return { done: false, value: o2[i2++] };
53753
- };
53754
- }
53755
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
53756
- }
53757
- function _unsupportedIterableToArray$4(o2, minLen) {
53758
- if (!o2) return;
53759
- if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen);
53760
- var n2 = Object.prototype.toString.call(o2).slice(8, -1);
53761
- if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name;
53762
- if (n2 === "Map" || n2 === "Set") return Array.from(o2);
53763
- if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen);
53764
- }
53765
- function _arrayLikeToArray$4(arr, len) {
53766
- if (len == null || len > arr.length) len = arr.length;
53767
- for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
53768
- arr2[i2] = arr[i2];
53769
- }
53770
- return arr2;
53771
- }
53772
- function mergeArrays(a2, b2) {
53773
- var merged = a2.slice();
53774
- for (var _iterator = _createForOfIteratorHelperLoose$3(b2), _step; !(_step = _iterator()).done; ) {
53775
- var element = _step.value;
53776
- if (a2.indexOf(element) < 0) {
53777
- merged.push(element);
53778
- }
53779
- }
53780
- return merged.sort(function(a3, b3) {
53781
- return a3 - b3;
53782
- });
53783
- }
53784
54075
  function checkNumberLength(nationalNumber, metadata2) {
53785
54076
  return checkNumberLengthForType(nationalNumber, void 0, metadata2);
53786
54077
  }
@@ -53790,17 +54081,6 @@ function checkNumberLengthForType(nationalNumber, type3, metadata2) {
53790
54081
  if (!possible_lengths) {
53791
54082
  return "IS_POSSIBLE";
53792
54083
  }
53793
- if (type3 === "FIXED_LINE_OR_MOBILE") {
53794
- if (!metadata2.type("FIXED_LINE")) {
53795
- return checkNumberLengthForType(nationalNumber, "MOBILE", metadata2);
53796
- }
53797
- var mobile_type = metadata2.type("MOBILE");
53798
- if (mobile_type) {
53799
- possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths());
53800
- }
53801
- } else if (type3 && !type_info) {
53802
- return "INVALID_LENGTH";
53803
- }
53804
54084
  var actual_length = nationalNumber.length;
53805
54085
  var minimum_length = possible_lengths[0];
53806
54086
  if (minimum_length === actual_length) {
@@ -53865,7 +54145,7 @@ function matchesEntirely(text, regular_expression) {
53865
54145
  function _createForOfIteratorHelperLoose$2(o2, allowArrayLike) {
53866
54146
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
53867
54147
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
53868
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$3(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54148
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$3(o2)) || allowArrayLike) {
53869
54149
  if (it2) o2 = it2;
53870
54150
  var i2 = 0;
53871
54151
  return function() {
@@ -53965,8 +54245,6 @@ function applyInternationalSeparatorStyle(formattedNumber) {
53965
54245
  var FIRST_GROUP_PATTERN = /(\$\d)/;
53966
54246
  function formatNationalNumberUsingFormat(number2, format2, _ref) {
53967
54247
  var useInternationalFormat = _ref.useInternationalFormat, withNationalPrefix = _ref.withNationalPrefix;
53968
- _ref.carrierCode;
53969
- _ref.metadata;
53970
54248
  var formattedNumber = number2.replace(new RegExp(format2.pattern()), useInternationalFormat ? format2.internationalFormat() : (
53971
54249
  // This library doesn't use `domestic_carrier_code_formatting_rule`,
53972
54250
  // because that one is only used when formatting phone numbers
@@ -54012,7 +54290,7 @@ function formatRFC3966(_ref) {
54012
54290
  function _createForOfIteratorHelperLoose$1(o2, allowArrayLike) {
54013
54291
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
54014
54292
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
54015
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$2(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54293
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$2(o2)) || allowArrayLike) {
54016
54294
  if (it2) o2 = it2;
54017
54295
  var i2 = 0;
54018
54296
  return function() {
@@ -54208,7 +54486,6 @@ function _defineProperties(target, props2) {
54208
54486
  }
54209
54487
  function _createClass(Constructor, protoProps, staticProps) {
54210
54488
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
54211
- if (staticProps) _defineProperties(Constructor, staticProps);
54212
54489
  Object.defineProperty(Constructor, "prototype", { writable: false });
54213
54490
  return Constructor;
54214
54491
  }
@@ -54505,7 +54782,7 @@ function extractCountryCallingCode(number2, country, callingCode, metadata2) {
54505
54782
  function _createForOfIteratorHelperLoose(o2, allowArrayLike) {
54506
54783
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
54507
54784
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
54508
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$1(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54785
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$1(o2)) || allowArrayLike) {
54509
54786
  if (it2) o2 = it2;
54510
54787
  var i2 = 0;
54511
54788
  return function() {
@@ -54559,14 +54836,8 @@ function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
54559
54836
  return matchingCountries[0];
54560
54837
  }
54561
54838
  }
54562
- var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
54563
54839
  function getCountryByCallingCode(callingCode, _ref) {
54564
54840
  var nationalPhoneNumber = _ref.nationalNumber, defaultCountry = _ref.defaultCountry, metadata2 = _ref.metadata;
54565
- if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
54566
- if (metadata2.isNonGeographicCallingCode(callingCode)) {
54567
- return "001";
54568
- }
54569
- }
54570
54841
  var possibleCountries = metadata2.getCountryCodesForCallingCode(callingCode);
54571
54842
  if (!possibleCountries) {
54572
54843
  return;
@@ -57400,7 +57671,7 @@ const bisectCenter = bisector(number$2).center;
57400
57671
  function extent(values3, valueof) {
57401
57672
  let min2;
57402
57673
  let max2;
57403
- if (valueof === void 0) {
57674
+ {
57404
57675
  for (const value of values3) {
57405
57676
  if (value != null) {
57406
57677
  if (min2 === void 0) {
@@ -57411,18 +57682,6 @@ function extent(values3, valueof) {
57411
57682
  }
57412
57683
  }
57413
57684
  }
57414
- } else {
57415
- let index2 = -1;
57416
- for (let value of values3) {
57417
- if ((value = valueof(value, ++index2, values3)) != null) {
57418
- if (min2 === void 0) {
57419
- if (value >= value) min2 = max2 = value;
57420
- } else {
57421
- if (min2 > value) min2 = value;
57422
- if (max2 < value) max2 = value;
57423
- }
57424
- }
57425
- }
57426
57685
  }
57427
57686
  return [min2, max2];
57428
57687
  }
@@ -63389,5 +63648,6 @@ export {
63389
63648
  useEscape,
63390
63649
  useI18nT,
63391
63650
  useLang,
63651
+ useLocalStorage,
63392
63652
  useModal
63393
63653
  };