@tabler/core 1.0.0-beta15 → 1.0.0-beta17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/dist/css/demo.css +18 -13
  4. package/dist/css/demo.min.css +5 -5
  5. package/dist/css/demo.rtl.css +18 -13
  6. package/dist/css/demo.rtl.min.css +5 -5
  7. package/dist/css/tabler-flags.css +6 -6
  8. package/dist/css/tabler-flags.min.css +5 -5
  9. package/dist/css/tabler-flags.rtl.css +6 -6
  10. package/dist/css/tabler-flags.rtl.min.css +5 -5
  11. package/dist/css/tabler-payments.css +6 -6
  12. package/dist/css/tabler-payments.min.css +5 -5
  13. package/dist/css/tabler-payments.rtl.css +6 -6
  14. package/dist/css/tabler-payments.rtl.min.css +5 -5
  15. package/dist/css/tabler-vendors.css +22 -38
  16. package/dist/css/tabler-vendors.min.css +5 -5
  17. package/dist/css/tabler-vendors.rtl.css +22 -38
  18. package/dist/css/tabler-vendors.rtl.min.css +5 -5
  19. package/dist/css/tabler.css +3077 -1493
  20. package/dist/css/tabler.min.css +5 -10
  21. package/dist/css/tabler.rtl.css +3081 -1493
  22. package/dist/css/tabler.rtl.min.css +5 -10
  23. package/dist/js/demo-theme.js +4 -4
  24. package/dist/js/demo-theme.min.js +4 -4
  25. package/dist/js/demo.js +37 -46
  26. package/dist/js/demo.min.js +5 -5
  27. package/dist/js/tabler.esm.js +137 -133
  28. package/dist/js/tabler.esm.min.js +7 -7
  29. package/dist/js/tabler.js +137 -133
  30. package/dist/js/tabler.min.js +7 -7
  31. package/dist/libs/apexcharts/dist/apexcharts.amd.js +1 -1
  32. package/dist/libs/apexcharts/dist/apexcharts.common.js +4 -4
  33. package/dist/libs/apexcharts/dist/apexcharts.css +193 -303
  34. package/dist/libs/apexcharts/dist/apexcharts.esm.js +4 -4
  35. package/dist/libs/apexcharts/dist/apexcharts.js +22774 -22066
  36. package/dist/libs/apexcharts/dist/apexcharts.min.js +4 -4
  37. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js +521 -1310
  38. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js.map +1 -1
  39. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js +2 -2
  40. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -1
  41. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js +520 -1309
  42. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js.map +1 -1
  43. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js +2 -2
  44. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -1
  45. package/dist/libs/bootstrap/dist/js/bootstrap.js +523 -1313
  46. package/dist/libs/bootstrap/dist/js/bootstrap.js.map +1 -1
  47. package/dist/libs/bootstrap/dist/js/bootstrap.min.js +2 -2
  48. package/dist/libs/bootstrap/dist/js/bootstrap.min.js.map +1 -1
  49. package/dist/libs/plyr/dist/plyr.css +1 -1
  50. package/dist/libs/plyr/dist/plyr.js +1982 -2048
  51. package/dist/libs/plyr/dist/plyr.min.js +1 -1
  52. package/dist/libs/plyr/dist/plyr.min.js.map +1 -1
  53. package/dist/libs/plyr/dist/plyr.min.mjs +1 -1
  54. package/dist/libs/plyr/dist/plyr.min.mjs.map +1 -1
  55. package/dist/libs/plyr/dist/plyr.mjs +1982 -2048
  56. package/dist/libs/plyr/dist/plyr.polyfilled.js +1996 -2127
  57. package/dist/libs/plyr/dist/plyr.polyfilled.min.js +1 -1
  58. package/dist/libs/plyr/dist/plyr.polyfilled.min.js.map +1 -1
  59. package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs +1 -1
  60. package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs.map +1 -1
  61. package/dist/libs/plyr/dist/plyr.polyfilled.mjs +1996 -2127
  62. package/dist/libs/tinymce/CHANGELOG.md +49 -0
  63. package/dist/libs/tinymce/composer.json +1 -1
  64. package/dist/libs/tinymce/icons/default/icons.js +2 -1
  65. package/dist/libs/tinymce/icons/default/icons.min.js +1 -1
  66. package/dist/libs/tinymce/models/dom/model.js +1 -1
  67. package/dist/libs/tinymce/models/dom/model.min.js +1 -1
  68. package/dist/libs/tinymce/package.json +1 -1
  69. package/dist/libs/tinymce/plugins/advlist/plugin.js +1 -1
  70. package/dist/libs/tinymce/plugins/advlist/plugin.min.js +1 -1
  71. package/dist/libs/tinymce/plugins/anchor/plugin.js +1 -1
  72. package/dist/libs/tinymce/plugins/anchor/plugin.min.js +1 -1
  73. package/dist/libs/tinymce/plugins/autolink/plugin.js +1 -1
  74. package/dist/libs/tinymce/plugins/autolink/plugin.min.js +1 -1
  75. package/dist/libs/tinymce/plugins/autoresize/plugin.js +1 -1
  76. package/dist/libs/tinymce/plugins/autoresize/plugin.min.js +1 -1
  77. package/dist/libs/tinymce/plugins/autosave/plugin.js +1 -1
  78. package/dist/libs/tinymce/plugins/autosave/plugin.min.js +1 -1
  79. package/dist/libs/tinymce/plugins/charmap/plugin.js +1 -1
  80. package/dist/libs/tinymce/plugins/charmap/plugin.min.js +1 -1
  81. package/dist/libs/tinymce/plugins/code/plugin.js +1 -1
  82. package/dist/libs/tinymce/plugins/code/plugin.min.js +1 -1
  83. package/dist/libs/tinymce/plugins/codesample/plugin.js +1 -1
  84. package/dist/libs/tinymce/plugins/codesample/plugin.min.js +1 -1
  85. package/dist/libs/tinymce/plugins/directionality/plugin.js +1 -1
  86. package/dist/libs/tinymce/plugins/directionality/plugin.min.js +1 -1
  87. package/dist/libs/tinymce/plugins/emoticons/plugin.js +1 -1
  88. package/dist/libs/tinymce/plugins/emoticons/plugin.min.js +1 -1
  89. package/dist/libs/tinymce/plugins/fullscreen/plugin.js +1 -1
  90. package/dist/libs/tinymce/plugins/fullscreen/plugin.min.js +1 -1
  91. package/dist/libs/tinymce/plugins/help/plugin.js +16 -6
  92. package/dist/libs/tinymce/plugins/help/plugin.min.js +2 -2
  93. package/dist/libs/tinymce/plugins/image/plugin.js +1 -1
  94. package/dist/libs/tinymce/plugins/image/plugin.min.js +1 -1
  95. package/dist/libs/tinymce/plugins/importcss/plugin.js +1 -1
  96. package/dist/libs/tinymce/plugins/importcss/plugin.min.js +1 -1
  97. package/dist/libs/tinymce/plugins/insertdatetime/plugin.js +1 -1
  98. package/dist/libs/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
  99. package/dist/libs/tinymce/plugins/link/plugin.js +12 -3
  100. package/dist/libs/tinymce/plugins/link/plugin.min.js +2 -2
  101. package/dist/libs/tinymce/plugins/lists/plugin.js +1 -1
  102. package/dist/libs/tinymce/plugins/lists/plugin.min.js +1 -1
  103. package/dist/libs/tinymce/plugins/media/plugin.js +1 -1
  104. package/dist/libs/tinymce/plugins/media/plugin.min.js +1 -1
  105. package/dist/libs/tinymce/plugins/nonbreaking/plugin.js +1 -1
  106. package/dist/libs/tinymce/plugins/nonbreaking/plugin.min.js +1 -1
  107. package/dist/libs/tinymce/plugins/pagebreak/plugin.js +1 -1
  108. package/dist/libs/tinymce/plugins/pagebreak/plugin.min.js +1 -1
  109. package/dist/libs/tinymce/plugins/preview/plugin.js +1 -1
  110. package/dist/libs/tinymce/plugins/preview/plugin.min.js +1 -1
  111. package/dist/libs/tinymce/plugins/quickbars/plugin.js +19 -12
  112. package/dist/libs/tinymce/plugins/quickbars/plugin.min.js +2 -2
  113. package/dist/libs/tinymce/plugins/save/plugin.js +1 -1
  114. package/dist/libs/tinymce/plugins/save/plugin.min.js +1 -1
  115. package/dist/libs/tinymce/plugins/searchreplace/plugin.js +1 -1
  116. package/dist/libs/tinymce/plugins/searchreplace/plugin.min.js +1 -1
  117. package/dist/libs/tinymce/plugins/table/plugin.js +1 -1
  118. package/dist/libs/tinymce/plugins/table/plugin.min.js +1 -1
  119. package/dist/libs/tinymce/plugins/template/plugin.js +1 -1
  120. package/dist/libs/tinymce/plugins/template/plugin.min.js +1 -1
  121. package/dist/libs/tinymce/plugins/visualblocks/plugin.js +1 -1
  122. package/dist/libs/tinymce/plugins/visualblocks/plugin.min.js +1 -1
  123. package/dist/libs/tinymce/plugins/visualchars/plugin.js +1 -1
  124. package/dist/libs/tinymce/plugins/visualchars/plugin.min.js +1 -1
  125. package/dist/libs/tinymce/plugins/wordcount/plugin.js +1 -1
  126. package/dist/libs/tinymce/plugins/wordcount/plugin.min.js +1 -1
  127. package/dist/libs/tinymce/skins/ui/oxide/content.css +3 -0
  128. package/dist/libs/tinymce/skins/ui/oxide/content.inline.css +3 -0
  129. package/dist/libs/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  130. package/dist/libs/tinymce/skins/ui/oxide/content.min.css +1 -1
  131. package/dist/libs/tinymce/skins/ui/oxide/skin.css +116 -42
  132. package/dist/libs/tinymce/skins/ui/oxide/skin.min.css +1 -1
  133. package/dist/libs/tinymce/skins/ui/oxide-dark/content.css +3 -0
  134. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.css +3 -0
  135. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  136. package/dist/libs/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  137. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.css +110 -36
  138. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  139. package/dist/libs/tinymce/skins/ui/tinymce-5/content.css +3 -0
  140. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.css +3 -0
  141. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  142. package/dist/libs/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  143. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.css +119 -42
  144. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  145. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.css +3 -0
  146. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.css +3 -0
  147. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  148. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  149. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.css +113 -36
  150. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  151. package/dist/libs/tinymce/themes/silver/theme.js +2394 -377
  152. package/dist/libs/tinymce/themes/silver/theme.min.js +2 -2
  153. package/dist/libs/tinymce/tinymce.d.ts +62 -17
  154. package/dist/libs/tinymce/tinymce.js +808 -566
  155. package/dist/libs/tinymce/tinymce.min.js +2 -2
  156. package/package.json +45 -41
  157. package/src/scss/_bootstrap-components.scss +33 -33
  158. package/src/scss/_bootstrap-config.scss +6 -5
  159. package/src/scss/{_mixins-override.scss → _bootstrap-override.scss} +7 -0
  160. package/src/scss/_config.scss +1 -1
  161. package/src/scss/_core.scss +2 -0
  162. package/src/scss/_variables.scss +60 -28
  163. package/src/scss/demo/_examples.scss +1 -1
  164. package/src/scss/layout/_core.scss +1 -1
  165. package/src/scss/layout/_dark.scss +4 -10
  166. package/src/scss/layout/_navbar.scss +3 -2
  167. package/src/scss/layout/_page.scss +31 -5
  168. package/src/scss/layout/_root.scss +3 -1
  169. package/src/scss/mixins/_functions.scss +2 -1
  170. package/src/scss/mixins/_mixins.scss +11 -6
  171. package/src/scss/ui/_avatars.scss +18 -10
  172. package/src/scss/ui/_breadcrumbs.scss +23 -1
  173. package/src/scss/ui/_button-group.scss +14 -0
  174. package/src/scss/ui/_buttons.scss +12 -1
  175. package/src/scss/ui/_cards.scss +2 -2
  176. package/src/scss/ui/_forms.scss +2 -17
  177. package/src/scss/ui/_images.scss +7 -2
  178. package/src/scss/ui/_lists.scss +0 -95
  179. package/src/scss/ui/_pagination.scss +1 -1
  180. package/src/scss/ui/_progress.scss +1 -1
  181. package/src/scss/ui/_status.scss +1 -1
  182. package/src/scss/ui/_steps.scss +81 -59
  183. package/src/scss/ui/_tables.scss +2 -2
  184. package/src/scss/ui/_timeline.scss +61 -0
  185. package/src/scss/ui/_type.scss +6 -4
  186. package/src/scss/ui/forms/_form-colorinput.scss +1 -2
  187. package/src/scss/ui/forms/_form-imagecheck.scss +1 -1
  188. package/src/scss/ui/forms/_form-selectgroup.scss +3 -3
  189. package/src/scss/utils/_colors.scss +11 -6
  190. package/src/scss/vendor/_dropzone.scss +2 -2
  191. package/src/scss/vendor/_tom-select.scss +1 -0
@@ -1,11 +1,11 @@
1
1
  /**
2
- * TinyMCE version 6.2.0 (2022-09-08)
2
+ * TinyMCE version 6.3.1 (2022-12-06)
3
3
  */
4
4
 
5
5
  (function () {
6
6
  'use strict';
7
7
 
8
- const getPrototypeOf$1 = Object.getPrototypeOf;
8
+ const getPrototypeOf$2 = Object.getPrototypeOf;
9
9
  const hasProto = (v, constructor, predicate) => {
10
10
  var _a;
11
11
  if (predicate(v, constructor.prototype)) {
@@ -29,7 +29,7 @@
29
29
  const isType$1 = type => value => typeOf(value) === type;
30
30
  const isSimpleType = type => value => typeof value === type;
31
31
  const eq$1 = t => a => t === a;
32
- const is$2 = (value, constructor) => isObject(value) && hasProto(value, constructor, (o, proto) => getPrototypeOf$1(o) === proto);
32
+ const is$2 = (value, constructor) => isObject(value) && hasProto(value, constructor, (o, proto) => getPrototypeOf$2(o) === proto);
33
33
  const isString = isType$1('string');
34
34
  const isObject = isType$1('object');
35
35
  const isPlainObject = value => is$2(value, Object);
@@ -85,7 +85,7 @@
85
85
  throw new Error(msg);
86
86
  };
87
87
  };
88
- const apply = f => {
88
+ const apply$1 = f => {
89
89
  return f();
90
90
  };
91
91
  const never = constant$1(false);
@@ -353,7 +353,7 @@
353
353
  };
354
354
 
355
355
  const keys = Object.keys;
356
- const hasOwnProperty = Object.hasOwnProperty;
356
+ const hasOwnProperty$1 = Object.hasOwnProperty;
357
357
  const each = (obj, f) => {
358
358
  const props = keys(obj);
359
359
  for (let k = 0, len = props.length; k < len; k++) {
@@ -422,7 +422,7 @@
422
422
  const get$g = (obj, key) => {
423
423
  return has$2(obj, key) ? Optional.from(obj[key]) : Optional.none();
424
424
  };
425
- const has$2 = (obj, key) => hasOwnProperty.call(obj, key);
425
+ const has$2 = (obj, key) => hasOwnProperty$1.call(obj, key);
426
426
  const hasNonNullableKey = (obj, key) => has$2(obj, key) && obj[key] !== undefined && obj[key] !== null;
427
427
 
428
428
  const is$1 = (lhs, rhs, comparator = tripleEquals) => lhs.exists(left => comparator(left, rhs));
@@ -550,13 +550,13 @@
550
550
  return actual;
551
551
  };
552
552
 
553
- const getPrototypeOf = Object.getPrototypeOf;
553
+ const getPrototypeOf$1 = Object.getPrototypeOf;
554
554
  const sandHTMLElement = scope => {
555
555
  return getOrDie$1('HTMLElement', scope);
556
556
  };
557
557
  const isPrototypeOf = x => {
558
558
  const scope = resolve('ownerDocument.defaultView', x);
559
- return isObject(x) && (sandHTMLElement(scope).prototype.isPrototypeOf(x) || /^HTML\w*Element$/.test(getPrototypeOf(x).constructor.name));
559
+ return isObject(x) && (sandHTMLElement(scope).prototype.isPrototypeOf(x) || /^HTML\w*Element$/.test(getPrototypeOf$1(x).constructor.name));
560
560
  };
561
561
 
562
562
  const DOCUMENT = 9;
@@ -709,7 +709,7 @@
709
709
  const remove$7 = (element, key) => {
710
710
  element.dom.removeAttribute(key);
711
711
  };
712
- const clone$1 = element => foldl(element.dom.attributes, (acc, attr) => {
712
+ const clone$2 = element => foldl(element.dom.attributes, (acc, attr) => {
713
713
  acc[attr.name] = attr.value;
714
714
  return acc;
715
715
  }, {});
@@ -1489,8 +1489,8 @@
1489
1489
  forall: always,
1490
1490
  getOr: identity,
1491
1491
  or: identity,
1492
- getOrThunk: apply,
1493
- orThunk: apply,
1492
+ getOrThunk: apply$1,
1493
+ orThunk: apply$1,
1494
1494
  getOrDie: die(String(error)),
1495
1495
  each: noop,
1496
1496
  toOptional: Optional.none
@@ -2369,8 +2369,8 @@
2369
2369
  return get$9(container);
2370
2370
  };
2371
2371
 
2372
- const clone = (original, isDeep) => SugarElement.fromDom(original.dom.cloneNode(isDeep));
2373
- const shallow = original => clone(original, false);
2372
+ const clone$1 = (original, isDeep) => SugarElement.fromDom(original.dom.cloneNode(isDeep));
2373
+ const shallow = original => clone$1(original, false);
2374
2374
 
2375
2375
  const getHtml = element => {
2376
2376
  if (isShadowRoot(element)) {
@@ -2900,7 +2900,7 @@
2900
2900
  class: clazz,
2901
2901
  style,
2902
2902
  ...existingAttributes
2903
- } = clone$1(obsoleted);
2903
+ } = clone$2(obsoleted);
2904
2904
  const {
2905
2905
  toSet: attrsToSet,
2906
2906
  toRemove: attrsToRemove
@@ -3072,7 +3072,7 @@
3072
3072
  };
3073
3073
  return Result.value(build$2(completeSpec, obsoleted));
3074
3074
  };
3075
- const text$1 = textContent => {
3075
+ const text$2 = textContent => {
3076
3076
  const element = SugarElement.fromText(textContent);
3077
3077
  return external$1({ element });
3078
3078
  };
@@ -3551,7 +3551,7 @@
3551
3551
  const loadEvent = (bConfig, bState, f) => runOnInit((component, _simulatedEvent) => {
3552
3552
  f(component, bConfig, bState);
3553
3553
  });
3554
- const create$4 = (schema, name, active, apis, extra, state) => {
3554
+ const create$5 = (schema, name, active, apis, extra, state) => {
3555
3555
  const configSchema = objOfOnly(schema);
3556
3556
  const schemaSchema = optionObjOf(name, [optionObjOfOnly('config', schema)]);
3557
3557
  return doCreate(configSchema, schemaSchema, name, active, apis, extra, state);
@@ -3628,9 +3628,9 @@
3628
3628
  defaulted('state', NoState),
3629
3629
  defaulted('extra', {})
3630
3630
  ]);
3631
- const create$3 = data => {
3631
+ const create$4 = data => {
3632
3632
  const value = asRawOrDie$1('Creating behaviour: ' + data.name, simpleSchema, data);
3633
- return create$4(value.fields, value.name, value.active, value.apis, value.extra, value.state);
3633
+ return create$5(value.fields, value.name, value.active, value.apis, value.extra, value.state);
3634
3634
  };
3635
3635
  const modeSchema = objOfOnly([
3636
3636
  required$1('branchKey'),
@@ -3647,7 +3647,7 @@
3647
3647
  };
3648
3648
  const revoke = constant$1(undefined);
3649
3649
 
3650
- const Receiving = create$3({
3650
+ const Receiving = create$4({
3651
3651
  fields: ReceivingSchema,
3652
3652
  name: 'receiving',
3653
3653
  active: ActiveReceiving
@@ -4385,13 +4385,13 @@
4385
4385
  const zeroWidth = '\uFEFF';
4386
4386
  const nbsp = '\xA0';
4387
4387
 
4388
- const create$2 = (start, soffset, finish, foffset) => ({
4388
+ const create$3 = (start, soffset, finish, foffset) => ({
4389
4389
  start,
4390
4390
  soffset,
4391
4391
  finish,
4392
4392
  foffset
4393
4393
  });
4394
- const SimRange = { create: create$2 };
4394
+ const SimRange = { create: create$3 };
4395
4395
 
4396
4396
  const adt$6 = Adt.generate([
4397
4397
  { before: ['element'] },
@@ -4870,7 +4870,7 @@
4870
4870
  init: init$g
4871
4871
  });
4872
4872
 
4873
- const Positioning = create$3({
4873
+ const Positioning = create$4({
4874
4874
  fields: PositionSchema,
4875
4875
  name: 'positioning',
4876
4876
  active: ActivePosition,
@@ -5112,7 +5112,7 @@
5112
5112
  init: init$f
5113
5113
  });
5114
5114
 
5115
- const Sandboxing = create$3({
5115
+ const Sandboxing = create$4({
5116
5116
  fields: SandboxSchema,
5117
5117
  name: 'sandboxing',
5118
5118
  active: ActiveSandbox,
@@ -5367,7 +5367,7 @@
5367
5367
  defaulted('resetOnDom', false)
5368
5368
  ];
5369
5369
 
5370
- const Representing = create$3({
5370
+ const Representing = create$4({
5371
5371
  fields: RepresentSchema,
5372
5372
  name: 'representing',
5373
5373
  active: ActiveRepresenting,
@@ -5763,7 +5763,7 @@
5763
5763
 
5764
5764
  const ComposeSchema = [required$1('find')];
5765
5765
 
5766
- const Composing = create$3({
5766
+ const Composing = create$4({
5767
5767
  fields: ComposeSchema,
5768
5768
  name: 'composing',
5769
5769
  apis: ComposeApis
@@ -5845,7 +5845,7 @@
5845
5845
  onHandler('onEnabled')
5846
5846
  ];
5847
5847
 
5848
- const Disabling = create$3({
5848
+ const Disabling = create$4({
5849
5849
  fields: DisableSchema,
5850
5850
  name: 'disabling',
5851
5851
  active: ActiveDisable,
@@ -5957,7 +5957,7 @@
5957
5957
  onHandler('onDehighlight')
5958
5958
  ];
5959
5959
 
5960
- const Highlighting = create$3({
5960
+ const Highlighting = create$4({
5961
5961
  fields: HighlightSchema,
5962
5962
  name: 'highlighting',
5963
5963
  apis: HighlightApis
@@ -6115,7 +6115,7 @@
6115
6115
  return me;
6116
6116
  };
6117
6117
 
6118
- const create$1 = cyclicField => {
6118
+ const create$2 = cyclicField => {
6119
6119
  const schema = [
6120
6120
  option$3('onEscape'),
6121
6121
  option$3('onEnter'),
@@ -6176,9 +6176,9 @@
6176
6176
  return typical(schema, NoState.init, getKeydownRules, getKeyupRules, () => Optional.some(focusIn));
6177
6177
  };
6178
6178
 
6179
- var AcyclicType = create$1(customField('cyclic', never));
6179
+ var AcyclicType = create$2(customField('cyclic', never));
6180
6180
 
6181
- var CyclicType = create$1(customField('cyclic', always));
6181
+ var CyclicType = create$2(customField('cyclic', always));
6182
6182
 
6183
6183
  const doDefaultExecute = (component, _simulatedEvent, focused) => {
6184
6184
  dispatch(component, focused, execute$5());
@@ -6689,7 +6689,7 @@
6689
6689
  contents: contents
6690
6690
  });
6691
6691
 
6692
- const Replacing = create$3({
6692
+ const Replacing = create$4({
6693
6693
  fields: [defaultedBoolean('reuseDom', true)],
6694
6694
  name: 'replacing',
6695
6695
  apis: ReplaceApis
@@ -6697,7 +6697,7 @@
6697
6697
 
6698
6698
  const events$d = (name, eventHandlers) => {
6699
6699
  const events = derive$2(eventHandlers);
6700
- return create$3({
6700
+ return create$4({
6701
6701
  fields: [required$1('enabled')],
6702
6702
  name,
6703
6703
  active: { events: constant$1(events) }
@@ -6760,7 +6760,7 @@
6760
6760
  defaulted('ignore', false)
6761
6761
  ];
6762
6762
 
6763
- const Focusing = create$3({
6763
+ const Focusing = create$4({
6764
6764
  fields: FocusSchema,
6765
6765
  name: 'focusing',
6766
6766
  active: ActiveFocus,
@@ -6879,7 +6879,7 @@
6879
6879
  }))
6880
6880
  ];
6881
6881
 
6882
- const Toggling = create$3({
6882
+ const Toggling = create$4({
6883
6883
  fields: ToggleSchema,
6884
6884
  name: 'toggling',
6885
6885
  active: ActiveToggle,
@@ -7134,6 +7134,7 @@
7134
7134
  row: movementInfo.rowSelector,
7135
7135
  cell: '.' + detail.markers.item
7136
7136
  },
7137
+ previousSelector: movementInfo.previousSelector,
7137
7138
  focusManager: detail.focusManager
7138
7139
  });
7139
7140
  const configureMenu = (detail, movementInfo) => ({
@@ -7187,7 +7188,8 @@
7187
7188
  ],
7188
7189
  matrix: [
7189
7190
  output$1('config', configureMatrix),
7190
- required$1('rowSelector')
7191
+ required$1('rowSelector'),
7192
+ defaulted('previousSelector', Optional.none)
7191
7193
  ],
7192
7194
  menu: [
7193
7195
  defaulted('moveOnTab', true),
@@ -7780,7 +7782,7 @@
7780
7782
  }
7781
7783
  });
7782
7784
  };
7783
- const factory$m = (detail, spec) => {
7785
+ const factory$o = (detail, spec) => {
7784
7786
  const isPartOfRelated = (sandbox, queryElem) => {
7785
7787
  const related = detail.getRelated(sandbox);
7786
7788
  return related.exists(rel => isPartOf$1(rel, queryElem));
@@ -7907,7 +7909,7 @@
7907
7909
  defaulted('isExtraPart', never),
7908
7910
  defaulted('eventOrder', Optional.none)
7909
7911
  ],
7910
- factory: factory$m,
7912
+ factory: factory$o,
7911
7913
  apis: {
7912
7914
  showAt: (apis, component, anchor, thing) => {
7913
7915
  apis.showAt(component, anchor, thing);
@@ -7940,7 +7942,7 @@
7940
7942
 
7941
7943
  var global$9 = tinymce.util.Tools.resolve('tinymce.util.Delay');
7942
7944
 
7943
- const factory$l = detail => {
7945
+ const factory$n = detail => {
7944
7946
  const events = events$a(detail.action);
7945
7947
  const tag = detail.dom.tag;
7946
7948
  const lookupAttr = attr => get$g(detail.dom, 'attributes').bind(attrs => get$g(attrs, attr));
@@ -7976,7 +7978,7 @@
7976
7978
  };
7977
7979
  const Button = single({
7978
7980
  name: 'Button',
7979
- factory: factory$l,
7981
+ factory: factory$n,
7980
7982
  configFields: [
7981
7983
  defaulted('uid', undefined),
7982
7984
  required$1('dom'),
@@ -8076,7 +8078,7 @@
8076
8078
  warn: 'warning',
8077
8079
  info: 'info'
8078
8080
  };
8079
- const factory$k = detail => {
8081
+ const factory$m = detail => {
8080
8082
  const memBannerText = record({
8081
8083
  dom: {
8082
8084
  tag: 'p',
@@ -8137,7 +8139,7 @@
8137
8139
  const updateText = (comp, text) => {
8138
8140
  if (comp.getSystem().isConnected()) {
8139
8141
  const banner = memBannerText.get(comp);
8140
- Replacing.set(banner, [text$1(text)]);
8142
+ Replacing.set(banner, [text$2(text)]);
8141
8143
  }
8142
8144
  };
8143
8145
  const apis = {
@@ -8210,7 +8212,7 @@
8210
8212
  };
8211
8213
  const Notification = single({
8212
8214
  name: 'Notification',
8213
- factory: factory$k,
8215
+ factory: factory$m,
8214
8216
  configFields: [
8215
8217
  option$3('level'),
8216
8218
  required$1('progress'),
@@ -8843,7 +8845,7 @@
8843
8845
  classes: detail.inputClasses
8844
8846
  });
8845
8847
 
8846
- const factory$j = (detail, _spec) => ({
8848
+ const factory$l = (detail, _spec) => ({
8847
8849
  uid: detail.uid,
8848
8850
  dom: dom(detail),
8849
8851
  components: [],
@@ -8853,7 +8855,7 @@
8853
8855
  const Input = single({
8854
8856
  name: 'Input',
8855
8857
  configFields: schema$l(),
8856
- factory: factory$j
8858
+ factory: factory$l
8857
8859
  });
8858
8860
 
8859
8861
  const refetchTriggerEvent = generate$6('refetch-trigger-event');
@@ -9183,7 +9185,7 @@
9183
9185
  const type = requiredString('type');
9184
9186
  const name$1 = requiredString('name');
9185
9187
  const label = requiredString('label');
9186
- const text = requiredString('text');
9188
+ const text$1 = requiredString('text');
9187
9189
  const title = requiredString('title');
9188
9190
  const icon = requiredString('icon');
9189
9191
  const value$1 = requiredString('value');
@@ -9307,7 +9309,7 @@
9307
9309
 
9308
9310
  const cardTextFields = [
9309
9311
  type,
9310
- text,
9312
+ text$1,
9311
9313
  optionalName,
9312
9314
  defaultedArrayOf('classes', ['tox-collection__item-label'], string)
9313
9315
  ];
@@ -9358,6 +9360,7 @@
9358
9360
  const insertTableFields = [defaulted('initData', {})].concat(baseFields);
9359
9361
  const colorSwatchFields = [defaultedObjOf('initData', {}, [
9360
9362
  defaultedBoolean('allowCustomColors', true),
9363
+ defaultedString('storageKey', 'default'),
9361
9364
  optionArrayOf('colors', anyValue())
9362
9365
  ])].concat(baseFields);
9363
9366
  const fancyMenuItemSchema = choose$1('fancytype', {
@@ -9584,7 +9587,7 @@
9584
9587
  init: init$b
9585
9588
  });
9586
9589
 
9587
- const Tooltipping = create$3({
9590
+ const Tooltipping = create$4({
9588
9591
  fields: TooltippingSchema,
9589
9592
  name: 'tooltipping',
9590
9593
  active: ActiveTooltipping,
@@ -9596,23 +9599,29 @@
9596
9599
 
9597
9600
  const ReadOnlyChannel = 'silver.readonly';
9598
9601
  const ReadOnlyDataSchema = objOf([requiredBoolean('readonly')]);
9599
- const broadcastReadonly = (uiComponents, readonly) => {
9600
- const outerContainer = uiComponents.outerContainer;
9602
+ const broadcastReadonly = (uiRefs, readonly) => {
9603
+ const outerContainer = uiRefs.mainUi.outerContainer;
9601
9604
  const target = outerContainer.element;
9605
+ const motherships = [
9606
+ uiRefs.mainUi.mothership,
9607
+ ...uiRefs.uiMotherships
9608
+ ];
9602
9609
  if (readonly) {
9603
- uiComponents.mothership.broadcastOn([dismissPopups()], { target });
9604
- uiComponents.uiMothership.broadcastOn([dismissPopups()], { target });
9610
+ each$1(motherships, m => {
9611
+ m.broadcastOn([dismissPopups()], { target });
9612
+ });
9605
9613
  }
9606
- uiComponents.mothership.broadcastOn([ReadOnlyChannel], { readonly });
9607
- uiComponents.uiMothership.broadcastOn([ReadOnlyChannel], { readonly });
9614
+ each$1(motherships, m => {
9615
+ m.broadcastOn([ReadOnlyChannel], { readonly });
9616
+ });
9608
9617
  };
9609
- const setupReadonlyModeSwitch = (editor, uiComponents) => {
9618
+ const setupReadonlyModeSwitch = (editor, uiRefs) => {
9610
9619
  editor.on('init', () => {
9611
9620
  if (editor.mode.isReadOnly()) {
9612
- broadcastReadonly(uiComponents, true);
9621
+ broadcastReadonly(uiRefs, true);
9613
9622
  }
9614
9623
  });
9615
- editor.on('SwitchMode', () => broadcastReadonly(uiComponents, editor.mode.isReadOnly()));
9624
+ editor.on('SwitchMode', () => broadcastReadonly(uiRefs, editor.mode.isReadOnly()));
9616
9625
  if (isReadOnly(editor)) {
9617
9626
  editor.mode.set('readonly');
9618
9627
  }
@@ -9745,7 +9754,7 @@
9745
9754
  tag: 'div',
9746
9755
  classes: [textClass]
9747
9756
  },
9748
- components: [text$1(global$8.translate(text))]
9757
+ components: [text$2(global$8.translate(text))]
9749
9758
  });
9750
9759
  const renderHtml = (html, classes) => ({
9751
9760
  dom: {
@@ -9764,7 +9773,7 @@
9764
9773
  tag: style.tag,
9765
9774
  styles: style.styles
9766
9775
  },
9767
- components: [text$1(global$8.translate(text))]
9776
+ components: [text$2(global$8.translate(text))]
9768
9777
  }]
9769
9778
  });
9770
9779
  const renderShortcut = shortcut => ({
@@ -9772,7 +9781,7 @@
9772
9781
  tag: 'div',
9773
9782
  classes: [accessoryClass]
9774
9783
  },
9775
- components: [text$1(convertText(shortcut))]
9784
+ components: [text$2(convertText(shortcut))]
9776
9785
  });
9777
9786
  const renderCheckmark = icons => renderIcon$1('checkmark', icons, [checkmarkClass]);
9778
9787
  const renderSubmenuCaret = icons => renderIcon$1('chevron-right', icons, [caretClass]);
@@ -9855,7 +9864,8 @@
9855
9864
  ...baseDom.attributes,
9856
9865
  'data-mce-color': itemValue
9857
9866
  },
9858
- styles: { 'background-color': itemValue }
9867
+ styles: { 'background-color': itemValue },
9868
+ innerHtml: icon
9859
9869
  };
9860
9870
  } else {
9861
9871
  return baseDom;
@@ -10213,6 +10223,58 @@
10213
10223
  name: node.nodeName.toLowerCase(),
10214
10224
  target: node
10215
10225
  });
10226
+ const fireToggleToolbarDrawer = (editor, state) => {
10227
+ editor.dispatch('ToggleToolbarDrawer', { state });
10228
+ };
10229
+
10230
+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');
10231
+
10232
+ const cacheStorage = {};
10233
+ const ColorCache = (storageId, max = 10) => {
10234
+ const storageString = global$4.getItem(storageId);
10235
+ const localstorage = isString(storageString) ? JSON.parse(storageString) : [];
10236
+ const prune = list => {
10237
+ const diff = max - list.length;
10238
+ return diff < 0 ? list.slice(0, max) : list;
10239
+ };
10240
+ const cache = prune(localstorage);
10241
+ const add = key => {
10242
+ indexOf(cache, key).each(remove);
10243
+ cache.unshift(key);
10244
+ if (cache.length > max) {
10245
+ cache.pop();
10246
+ }
10247
+ global$4.setItem(storageId, JSON.stringify(cache));
10248
+ };
10249
+ const remove = idx => {
10250
+ cache.splice(idx, 1);
10251
+ };
10252
+ const state = () => cache.slice(0);
10253
+ return {
10254
+ add,
10255
+ state
10256
+ };
10257
+ };
10258
+ const getCacheForId = id => get$g(cacheStorage, id).getOrThunk(() => {
10259
+ const storageId = `tinymce-custom-colors-${ id }`;
10260
+ const currentData = global$4.getItem(storageId);
10261
+ if (isNullable(currentData)) {
10262
+ const legacyDefault = global$4.getItem('tinymce-custom-colors');
10263
+ global$4.setItem(storageId, isNonNullable(legacyDefault) ? legacyDefault : '[]');
10264
+ }
10265
+ const storage = ColorCache(storageId, 10);
10266
+ cacheStorage[id] = storage;
10267
+ return storage;
10268
+ });
10269
+ const getCurrentColors = id => map$2(getCacheForId(id).state(), color => ({
10270
+ type: 'choiceitem',
10271
+ text: color,
10272
+ icon: 'checkmark',
10273
+ value: color
10274
+ }));
10275
+ const addColor = (id, color) => {
10276
+ getCacheForId(id).add(color);
10277
+ };
10216
10278
 
10217
10279
  const hsvColour = (hue, saturation, value) => ({
10218
10280
  hue,
@@ -10259,36 +10321,8 @@
10259
10321
  return fromRgba(rgbaColour(r, g, b, a));
10260
10322
  });
10261
10323
 
10262
- var global$4 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');
10263
-
10264
- const storageName = 'tinymce-custom-colors';
10265
- const ColorCache = (max = 10) => {
10266
- const storageString = global$4.getItem(storageName);
10267
- const localstorage = isString(storageString) ? JSON.parse(storageString) : [];
10268
- const prune = list => {
10269
- const diff = max - list.length;
10270
- return diff < 0 ? list.slice(0, max) : list;
10271
- };
10272
- const cache = prune(localstorage);
10273
- const add = key => {
10274
- indexOf(cache, key).each(remove);
10275
- cache.unshift(key);
10276
- if (cache.length > max) {
10277
- cache.pop();
10278
- }
10279
- global$4.setItem(storageName, JSON.stringify(cache));
10280
- };
10281
- const remove = idx => {
10282
- cache.splice(idx, 1);
10283
- };
10284
- const state = () => cache.slice(0);
10285
- return {
10286
- add,
10287
- state
10288
- };
10289
- };
10290
-
10291
- const colorCache = ColorCache(10);
10324
+ const foregroundId = 'forecolor';
10325
+ const backgroundId = 'hilitecolor';
10292
10326
  const calcCols = colors => Math.max(5, Math.ceil(Math.sqrt(colors)));
10293
10327
  const mapColors = colorMap => {
10294
10328
  const colors = [];
@@ -10296,28 +10330,31 @@
10296
10330
  colors.push({
10297
10331
  text: colorMap[i + 1],
10298
10332
  value: '#' + anyToHex(colorMap[i]).value,
10333
+ icon: 'checkmark',
10299
10334
  type: 'choiceitem'
10300
10335
  });
10301
10336
  }
10302
10337
  return colors;
10303
10338
  };
10304
10339
  const option$1 = name => editor => editor.options.get(name);
10340
+ const fallbackColor = '#000000';
10305
10341
  const register$d = editor => {
10306
10342
  const registerOption = editor.options.register;
10343
+ const colorProcessor = value => {
10344
+ if (isArrayOf(value, isString)) {
10345
+ return {
10346
+ value: mapColors(value),
10347
+ valid: true
10348
+ };
10349
+ } else {
10350
+ return {
10351
+ valid: false,
10352
+ message: 'Must be an array of strings.'
10353
+ };
10354
+ }
10355
+ };
10307
10356
  registerOption('color_map', {
10308
- processor: value => {
10309
- if (isArrayOf(value, isString)) {
10310
- return {
10311
- value: mapColors(value),
10312
- valid: true
10313
- };
10314
- } else {
10315
- return {
10316
- valid: false,
10317
- message: 'Must be an array of strings.'
10318
- };
10319
- }
10320
- },
10357
+ processor: colorProcessor,
10321
10358
  default: [
10322
10359
  '#BFEDD2',
10323
10360
  'Light Green',
@@ -10365,38 +10402,58 @@
10365
10402
  'White'
10366
10403
  ]
10367
10404
  });
10405
+ registerOption('color_map_background', { processor: colorProcessor });
10406
+ registerOption('color_map_foreground', { processor: colorProcessor });
10368
10407
  registerOption('color_cols', {
10369
10408
  processor: 'number',
10370
- default: calcCols(getColors$2(editor).length)
10409
+ default: calcCols(getColors$2(editor, 'default').length)
10410
+ });
10411
+ registerOption('color_cols_foreground', {
10412
+ processor: 'number',
10413
+ default: calcCols(getColors$2(editor, foregroundId).length)
10414
+ });
10415
+ registerOption('color_cols_background', {
10416
+ processor: 'number',
10417
+ default: calcCols(getColors$2(editor, backgroundId).length)
10371
10418
  });
10372
10419
  registerOption('custom_colors', {
10373
10420
  processor: 'boolean',
10374
10421
  default: true
10375
10422
  });
10423
+ registerOption('color_default_foreground', {
10424
+ processor: 'string',
10425
+ default: fallbackColor
10426
+ });
10427
+ registerOption('color_default_background', {
10428
+ processor: 'string',
10429
+ default: fallbackColor
10430
+ });
10431
+ };
10432
+ const getColorCols$1 = (editor, id) => {
10433
+ if (id === foregroundId) {
10434
+ return option$1('color_cols_foreground')(editor);
10435
+ } else if (id === backgroundId) {
10436
+ return option$1('color_cols_background')(editor);
10437
+ } else {
10438
+ return option$1('color_cols')(editor);
10439
+ }
10376
10440
  };
10377
- const getColorCols$1 = option$1('color_cols');
10378
10441
  const hasCustomColors$1 = option$1('custom_colors');
10379
- const getColors$2 = option$1('color_map');
10380
- const getCurrentColors = () => map$2(colorCache.state(), color => ({
10381
- type: 'choiceitem',
10382
- text: color,
10383
- value: color
10384
- }));
10385
- const addColor = color => {
10386
- colorCache.add(color);
10442
+ const getColors$2 = (editor, id) => {
10443
+ if (id === foregroundId && editor.options.isSet('color_map_foreground')) {
10444
+ return option$1('color_map_foreground')(editor);
10445
+ } else if (id === backgroundId && editor.options.isSet('color_map_background')) {
10446
+ return option$1('color_map_background')(editor);
10447
+ } else {
10448
+ return option$1('color_map')(editor);
10449
+ }
10387
10450
  };
10451
+ const getDefaultForegroundColor = option$1('color_default_foreground');
10452
+ const getDefaultBackgroundColor = option$1('color_default_background');
10388
10453
 
10389
- const fallbackColor = '#000000';
10390
- const hasStyleApi = node => isNonNullable(node.style);
10391
10454
  const getCurrentColor = (editor, format) => {
10392
- let color;
10393
- editor.dom.getParents(editor.selection.getStart(), elm => {
10394
- const value = hasStyleApi(elm) ? elm.style[format === 'forecolor' ? 'color' : 'backgroundColor'] : null;
10395
- if (value) {
10396
- color = color ? color : value;
10397
- }
10398
- });
10399
- return Optional.from(color);
10455
+ const cssRgbValue = get$e(SugarElement.fromDom(editor.selection.getStart()), format === 'hilitecolor' ? 'background-color' : 'color');
10456
+ return fromString(cssRgbValue).map(rgba => '#' + fromRgba(rgba).value);
10400
10457
  };
10401
10458
  const applyFormat = (editor, format, value) => {
10402
10459
  editor.undoManager.transact(() => {
@@ -10444,11 +10501,11 @@
10444
10501
  const dialog = colorPickerDialog(editor);
10445
10502
  dialog(colorOpt => {
10446
10503
  colorOpt.each(color => {
10447
- addColor(color);
10504
+ addColor(format, color);
10448
10505
  editor.execCommand('mceApplyTextcolor', format, color);
10449
10506
  onChoice(color);
10450
10507
  });
10451
- }, fallbackColor);
10508
+ }, getCurrentColor(editor, format).getOr(fallbackColor));
10452
10509
  } else if (value === 'remove') {
10453
10510
  onChoice('');
10454
10511
  editor.execCommand('mceRemoveTextcolor', format);
@@ -10457,9 +10514,9 @@
10457
10514
  editor.execCommand('mceApplyTextcolor', format, value);
10458
10515
  }
10459
10516
  };
10460
- const getColors$1 = (colors, hasCustom) => colors.concat(getCurrentColors().concat(getAdditionalColors(hasCustom)));
10461
- const getFetch$1 = (colors, hasCustom) => callback => {
10462
- callback(getColors$1(colors, hasCustom));
10517
+ const getColors$1 = (colors, id, hasCustom) => colors.concat(getCurrentColors(id).concat(getAdditionalColors(hasCustom)));
10518
+ const getFetch$1 = (colors, id, hasCustom) => callback => {
10519
+ callback(getColors$1(colors, id, hasCustom));
10463
10520
  };
10464
10521
  const setIconColor = (splitButtonApi, name, newColor) => {
10465
10522
  const id = name === 'forecolor' ? 'tox-icon-text-color__color' : 'tox-icon-highlight-bg-color__color';
@@ -10471,14 +10528,11 @@
10471
10528
  presets: 'color',
10472
10529
  icon: name === 'forecolor' ? 'text-color' : 'highlight-bg-color',
10473
10530
  select: value => {
10474
- const optCurrentRgb = getCurrentColor(editor, format);
10475
- return optCurrentRgb.bind(currentRgb => fromString(currentRgb).map(rgba => {
10476
- const currentHex = fromRgba(rgba).value;
10477
- return contains$1(value.toLowerCase(), currentHex);
10478
- })).getOr(false);
10479
- },
10480
- columns: getColorCols$1(editor),
10481
- fetch: getFetch$1(getColors$2(editor), hasCustomColors$1(editor)),
10531
+ const optCurrentHex = getCurrentColor(editor, format);
10532
+ return is$1(optCurrentHex, value.toUpperCase());
10533
+ },
10534
+ columns: getColorCols$1(editor, format),
10535
+ fetch: getFetch$1(getColors$2(editor, format), format, hasCustomColors$1(editor)),
10482
10536
  onAction: _splitButtonApi => {
10483
10537
  applyColor(editor, format, lastColor.get(), noop);
10484
10538
  },
@@ -10512,6 +10566,7 @@
10512
10566
  getSubmenuItems: () => [{
10513
10567
  type: 'fancymenuitem',
10514
10568
  fancytype: 'colorswatch',
10569
+ initData: { storageKey: format },
10515
10570
  onAction: data => {
10516
10571
  applyColor(editor, format, data.value, noop);
10517
10572
  }
@@ -10574,8 +10629,10 @@
10574
10629
  };
10575
10630
  const register$c = editor => {
10576
10631
  registerCommands(editor);
10577
- const lastForeColor = Cell(fallbackColor);
10578
- const lastBackColor = Cell(fallbackColor);
10632
+ const fallbackColorForeground = getDefaultForegroundColor(editor);
10633
+ const fallbackColorBackground = getDefaultBackgroundColor(editor);
10634
+ const lastForeColor = Cell(fallbackColorForeground);
10635
+ const lastBackColor = Cell(fallbackColorBackground);
10579
10636
  registerTextColorButton(editor, 'forecolor', 'forecolor', 'Text color', lastForeColor);
10580
10637
  registerTextColorButton(editor, 'backcolor', 'hilitecolor', 'Background color', lastBackColor);
10581
10638
  registerTextColorMenuItem(editor, 'forecolor', 'forecolor', 'Text color');
@@ -10617,7 +10674,10 @@
10617
10674
  const rowClass = presets === 'color' ? 'tox-swatches__row' : 'tox-collection__group';
10618
10675
  return {
10619
10676
  mode: 'matrix',
10620
- rowSelector: '.' + rowClass
10677
+ rowSelector: '.' + rowClass,
10678
+ previousSelector: menu => {
10679
+ return presets === 'color' ? descendant(menu.element, '[aria-checked=true]') : Optional.none();
10680
+ }
10621
10681
  };
10622
10682
  }
10623
10683
  };
@@ -10650,7 +10710,7 @@
10650
10710
 
10651
10711
  const renderColorSwatchItem = (spec, backstage) => {
10652
10712
  const items = getColorItems(spec, backstage);
10653
- const columns = backstage.colorinput.getColorCols();
10713
+ const columns = backstage.colorinput.getColorCols(spec.initData.storageKey);
10654
10714
  const presets = 'color';
10655
10715
  const menuSpec = createPartialChoiceMenu(generate$6('menu-value'), items, value => {
10656
10716
  spec.onAction({ value });
@@ -10673,7 +10733,7 @@
10673
10733
  };
10674
10734
  const getColorItems = (spec, backstage) => {
10675
10735
  const useCustomColors = spec.initData.allowCustomColors && backstage.colorinput.hasCustomColors();
10676
- return spec.initData.colors.fold(() => getColors$1(backstage.colorinput.getColors(), useCustomColors), colors => colors.concat(getAdditionalColors(useCustomColors)));
10736
+ return spec.initData.colors.fold(() => getColors$1(backstage.colorinput.getColors(spec.initData.storageKey), spec.initData.storageKey, useCustomColors), colors => colors.concat(getAdditionalColors(useCustomColors)));
10677
10737
  };
10678
10738
 
10679
10739
  const cellOverEvent = generate$6('cell-over');
@@ -10733,7 +10793,7 @@
10733
10793
  }
10734
10794
  };
10735
10795
  const makeComponents = cells => bind$3(cells, cellRow => map$2(cellRow, premade));
10736
- const makeLabelText = (row, col) => text$1(`${ col }x${ row }`);
10796
+ const makeLabelText = (row, col) => text$2(`${ col }x${ row }`);
10737
10797
  const renderInsertTableMenuItem = spec => {
10738
10798
  const numRows = 10;
10739
10799
  const numColumns = 10;
@@ -10863,7 +10923,7 @@
10863
10923
  groupHeadingClass
10864
10924
  ]
10865
10925
  },
10866
- components: spec.text.map(text$1).toArray()
10926
+ components: spec.text.map(text$2).toArray()
10867
10927
  });
10868
10928
 
10869
10929
  const renderToggleMenuItem = (spec, itemResponse, providersBackstage, renderIcons = true) => {
@@ -10960,7 +11020,7 @@
10960
11020
  init: init$a
10961
11021
  });
10962
11022
 
10963
- const Coupling = create$3({
11023
+ const Coupling = create$4({
10964
11024
  fields: CouplingSchema,
10965
11025
  name: 'coupling',
10966
11026
  apis: CouplingApis,
@@ -11293,7 +11353,7 @@
11293
11353
  partType$1()
11294
11354
  ]);
11295
11355
 
11296
- const factory$i = (detail, components, _spec, externals) => {
11356
+ const factory$k = (detail, components, _spec, externals) => {
11297
11357
  const lookupAttr = attr => get$g(detail.dom, 'attributes').bind(attrs => get$g(attrs, attr));
11298
11358
  const switchToMenu = sandbox => {
11299
11359
  Sandboxing.getState(sandbox).each(tmenu => {
@@ -11408,7 +11468,7 @@
11408
11468
  name: 'Dropdown',
11409
11469
  configFields: schema$k(),
11410
11470
  partFields: parts$e(),
11411
- factory: factory$i,
11471
+ factory: factory$k,
11412
11472
  apis: {
11413
11473
  open: (apis, comp) => apis.open(comp),
11414
11474
  refetch: (apis, comp) => apis.refetch(comp),
@@ -12034,7 +12094,7 @@
12034
12094
  };
12035
12095
  };
12036
12096
 
12037
- const factory$h = detail => {
12097
+ const factory$j = detail => {
12038
12098
  const {attributes, ...domWithoutAttributes} = detail.dom;
12039
12099
  return {
12040
12100
  uid: detail.uid,
@@ -12055,7 +12115,7 @@
12055
12115
  };
12056
12116
  const Container = single({
12057
12117
  name: 'Container',
12058
- factory: factory$h,
12118
+ factory: factory$j,
12059
12119
  configFields: [
12060
12120
  defaulted('components', []),
12061
12121
  field('containerBehaviours', []),
@@ -12252,7 +12312,7 @@
12252
12312
  })
12253
12313
  ]);
12254
12314
 
12255
- const factory$g = (detail, components, _spec, _externals) => {
12315
+ const factory$i = (detail, components, _spec, _externals) => {
12256
12316
  const behaviours = augment(detail.fieldBehaviours, [
12257
12317
  Composing.config({
12258
12318
  find: container => {
@@ -12309,7 +12369,7 @@
12309
12369
  name: 'FormField',
12310
12370
  configFields: schema$j(),
12311
12371
  partFields: parts$d(),
12312
- factory: factory$g,
12372
+ factory: factory$i,
12313
12373
  apis: {
12314
12374
  getField: (apis, comp) => apis.getField(comp),
12315
12375
  getLabel: (apis, comp) => apis.getLabel(comp)
@@ -12330,7 +12390,7 @@
12330
12390
 
12331
12391
  var TabstopSchema = [defaulted('tabAttr', 'data-alloy-tabstop')];
12332
12392
 
12333
- const Tabstopping = create$3({
12393
+ const Tabstopping = create$4({
12334
12394
  fields: TabstopSchema,
12335
12395
  name: 'tabstopping',
12336
12396
  active: ActiveTabstopping
@@ -12358,7 +12418,7 @@
12358
12418
  tag: 'label',
12359
12419
  classes: ['tox-label']
12360
12420
  },
12361
- components: [text$1(providersBackstage.translate(label))]
12421
+ components: [text$2(providersBackstage.translate(label))]
12362
12422
  });
12363
12423
 
12364
12424
  const formChangeEvent = generate$6('form-component-change');
@@ -12582,7 +12642,7 @@
12582
12642
  ])
12583
12643
  ];
12584
12644
 
12585
- const Invalidating = create$3({
12645
+ const Invalidating = create$4({
12586
12646
  fields: InvalidateSchema,
12587
12647
  name: 'invalidating',
12588
12648
  active: ActiveInvalidate,
@@ -12614,7 +12674,7 @@
12614
12674
  exhibit: exhibit$1
12615
12675
  });
12616
12676
 
12617
- const Unselecting = create$3({
12677
+ const Unselecting = create$4({
12618
12678
  fields: [],
12619
12679
  name: 'unselecting',
12620
12680
  active: ActiveUnselecting
@@ -12689,7 +12749,7 @@
12689
12749
  colorInputBackstage.colorPicker(valueOpt => {
12690
12750
  valueOpt.fold(() => emit(colorBit, colorPickerCancelEvent), value => {
12691
12751
  emitSwatchChange(colorBit, value);
12692
- addColor(value);
12752
+ addColor(spec.storageKey, value);
12693
12753
  });
12694
12754
  }, '#ffffff');
12695
12755
  } else if (value === 'remove') {
@@ -12717,8 +12777,8 @@
12717
12777
  ]
12718
12778
  },
12719
12779
  components: [],
12720
- fetch: getFetch$1(colorInputBackstage.getColors(), colorInputBackstage.hasCustomColors()),
12721
- columns: colorInputBackstage.getColorCols(),
12780
+ fetch: getFetch$1(colorInputBackstage.getColors(spec.storageKey), spec.storageKey, colorInputBackstage.hasCustomColors()),
12781
+ columns: colorInputBackstage.getColorCols(spec.storageKey),
12722
12782
  presets: 'color',
12723
12783
  onItemAction
12724
12784
  }, sharedBackstage));
@@ -13648,7 +13708,7 @@
13648
13708
  tag: 'label',
13649
13709
  attributes: { 'aria-label': description }
13650
13710
  },
13651
- components: [text$1(label)]
13711
+ components: [text$2(label)]
13652
13712
  });
13653
13713
  const pField = FormField.parts.field({
13654
13714
  data,
@@ -14288,7 +14348,7 @@
14288
14348
  components: [
14289
14349
  {
14290
14350
  dom: { tag: 'p' },
14291
- components: [text$1(providersBackstage.translate('Drop an image here'))]
14351
+ components: [text$2(providersBackstage.translate('Drop an image here'))]
14292
14352
  },
14293
14353
  Button.sketch({
14294
14354
  dom: {
@@ -14300,7 +14360,7 @@
14300
14360
  ]
14301
14361
  },
14302
14362
  components: [
14303
- text$1(providersBackstage.translate('Browse for an image')),
14363
+ text$2(providersBackstage.translate('Browse for an image')),
14304
14364
  memInput.asSpec()
14305
14365
  ],
14306
14366
  action: comp => {
@@ -14549,7 +14609,7 @@
14549
14609
  tag: 'label',
14550
14610
  classes: ['tox-label']
14551
14611
  },
14552
- components: [text$1(backstageShared.providers.translate(spec.label))]
14612
+ components: [text$2(backstageShared.providers.translate(spec.label))]
14553
14613
  };
14554
14614
  const comps = map$2(spec.items, backstageShared.interpreter);
14555
14615
  return {
@@ -14601,7 +14661,7 @@
14601
14661
  tag: 'span',
14602
14662
  classes: [`${ prefix }__select-label`]
14603
14663
  },
14604
- components: [text$1(providersBackstage.translate(text))],
14664
+ components: [text$2(providersBackstage.translate(text))],
14605
14665
  behaviours: derive$1([Replacing.config({})])
14606
14666
  });
14607
14667
 
@@ -14666,7 +14726,7 @@
14666
14726
  config('menubutton-update-display-text', [
14667
14727
  run$1(updateMenuText, (comp, se) => {
14668
14728
  optMemDisplayText.bind(mem => mem.getOpt(comp)).each(displayText => {
14669
- Replacing.set(displayText, [text$1(sharedBackstage.providers.translate(se.event.text))]);
14729
+ Replacing.set(displayText, [text$2(sharedBackstage.providers.translate(se.event.text))]);
14670
14730
  });
14671
14731
  }),
14672
14732
  run$1(updateMenuIcon, (comp, se) => {
@@ -14917,7 +14977,7 @@
14917
14977
  components: map$2(spec.items, backstage.shared.interpreter)
14918
14978
  });
14919
14979
 
14920
- const factory$f = (detail, _spec) => {
14980
+ const factory$h = (detail, _spec) => {
14921
14981
  const options = map$2(detail.options, option => ({
14922
14982
  dom: {
14923
14983
  tag: 'option',
@@ -14966,7 +15026,7 @@
14966
15026
  defaulted('selectAttributes', {}),
14967
15027
  option$3('data')
14968
15028
  ],
14969
- factory: factory$f
15029
+ factory: factory$h
14970
15030
  });
14971
15031
 
14972
15032
  const renderSelectBox = (spec, providersBackstage, initialData) => {
@@ -15075,7 +15135,7 @@
15075
15135
  })
15076
15136
  ]);
15077
15137
 
15078
- const factory$e = (detail, components, _spec, _externals) => ({
15138
+ const factory$g = (detail, components, _spec, _externals) => ({
15079
15139
  uid: detail.uid,
15080
15140
  dom: detail.dom,
15081
15141
  components,
@@ -15119,7 +15179,7 @@
15119
15179
  name: 'FormCoupledInputs',
15120
15180
  configFields: schema$h(),
15121
15181
  partFields: parts$c(),
15122
- factory: factory$e,
15182
+ factory: factory$g,
15123
15183
  apis: {
15124
15184
  getField1: (apis, component) => apis.getField1(component),
15125
15185
  getField2: (apis, component) => apis.getField2(component),
@@ -15258,7 +15318,7 @@
15258
15318
  tag: 'label',
15259
15319
  classes: ['tox-label']
15260
15320
  },
15261
- components: [text$1(providersBackstage.translate(label))]
15321
+ components: [text$2(providersBackstage.translate(label))]
15262
15322
  });
15263
15323
  const widthField = FormCoupledInputs.parts.field1(formGroup([
15264
15324
  FormField.parts.label(getLabel('Width')),
@@ -15331,7 +15391,7 @@
15331
15391
  tag: 'label',
15332
15392
  classes: ['tox-label']
15333
15393
  },
15334
- components: [text$1(providerBackstage.translate(spec.label))]
15394
+ components: [text$2(providerBackstage.translate(spec.label))]
15335
15395
  });
15336
15396
  const spectrum = Slider.parts.spectrum({
15337
15397
  dom: {
@@ -15629,7 +15689,7 @@
15629
15689
  onStrictHandler('onStream')
15630
15690
  ];
15631
15691
 
15632
- const Streaming = create$3({
15692
+ const Streaming = create$4({
15633
15693
  fields: StreamingSchema,
15634
15694
  name: 'streaming',
15635
15695
  active: ActiveStreaming,
@@ -16157,7 +16217,7 @@
16157
16217
  const renderButtonSpec = (spec, action, providersBackstage, extraBehaviours = [], extraClasses = []) => {
16158
16218
  const translatedText = providersBackstage.translate(spec.text);
16159
16219
  const icon = spec.icon.map(iconName => renderIconFromPack(iconName, providersBackstage.icons));
16160
- const components = [icon.getOrThunk(() => text$1(translatedText))];
16220
+ const components = [icon.getOrThunk(() => text$2(translatedText))];
16161
16221
  const buttonType = spec.buttonType.getOr(!spec.primary && !spec.borderless ? 'secondary' : 'primary');
16162
16222
  const baseClasses = calculateClassesFromButtonType(buttonType);
16163
16223
  const classes = [
@@ -16576,7 +16636,7 @@
16576
16636
  tag: 'span',
16577
16637
  classes: ['tox-checkbox__label']
16578
16638
  },
16579
- components: [text$1(providerBackstage.translate(spec.label))],
16639
+ components: [text$2(providerBackstage.translate(spec.label))],
16580
16640
  behaviours: derive$1([Unselecting.config({})])
16581
16641
  });
16582
16642
  const makeIcon = className => {
@@ -16859,8 +16919,8 @@
16859
16919
  dialog(callback, value);
16860
16920
  };
16861
16921
  const hasCustomColors = editor => () => hasCustomColors$1(editor);
16862
- const getColors = editor => () => getColors$2(editor);
16863
- const getColorCols = editor => () => getColorCols$1(editor);
16922
+ const getColors = editor => id => getColors$2(editor, id);
16923
+ const getColorCols = editor => id => getColorCols$1(editor, id);
16864
16924
  const ColorInputBackstage = editor => ({
16865
16925
  colorPicker: colorPicker(editor),
16866
16926
  hasCustomColors: hasCustomColors(editor),
@@ -17146,7 +17206,7 @@
17146
17206
  };
17147
17207
  const isContentEditableTrue = hasContentEditableState('true');
17148
17208
  const isContentEditableFalse = hasContentEditableState('false');
17149
- const create = (type, title, url, level, attach) => ({
17209
+ const create$1 = (type, title, url, level, attach) => ({
17150
17210
  type,
17151
17211
  title,
17152
17212
  url,
@@ -17198,12 +17258,12 @@
17198
17258
  const attach = () => {
17199
17259
  elm.id = headerId;
17200
17260
  };
17201
- return create('header', (_a = getElementText(elm)) !== null && _a !== void 0 ? _a : '', '#' + headerId, getLevel(elm), attach);
17261
+ return create$1('header', (_a = getElementText(elm)) !== null && _a !== void 0 ? _a : '', '#' + headerId, getLevel(elm), attach);
17202
17262
  };
17203
17263
  const anchorTarget = elm => {
17204
17264
  const anchorId = elm.id || elm.name;
17205
17265
  const anchorText = getElementText(elm);
17206
- return create('anchor', anchorText ? anchorText : '#' + anchorId, '#' + anchorId, 0, noop);
17266
+ return create$1('anchor', anchorText ? anchorText : '#' + anchorId, '#' + anchorId, 0, noop);
17207
17267
  };
17208
17268
  const getHeaderTargets = elms => {
17209
17269
  return map$2(filter$2(elms, isValidHeader), headerTarget);
@@ -17327,48 +17387,72 @@
17327
17387
  getUrlPicker: filetype => getUrlPicker(editor, filetype)
17328
17388
  });
17329
17389
 
17330
- const init$7 = (lazySink, editor, lazyAnchorbar) => {
17390
+ const init$7 = (lazySinks, editor, lazyAnchorbar) => {
17331
17391
  const contextMenuState = Cell(false);
17332
17392
  const toolbar = HeaderBackstage(editor);
17333
- const backstage = {
17393
+ const providers = {
17394
+ icons: () => editor.ui.registry.getAll().icons,
17395
+ menuItems: () => editor.ui.registry.getAll().menuItems,
17396
+ translate: global$8.translate,
17397
+ isDisabled: () => editor.mode.isReadOnly() || !editor.ui.isEnabled(),
17398
+ getOption: editor.options.get
17399
+ };
17400
+ const urlinput = UrlInputBackstage(editor);
17401
+ const styles = init$8(editor);
17402
+ const colorinput = ColorInputBackstage(editor);
17403
+ const dialogSettings = DialogBackstage(editor);
17404
+ const isContextMenuOpen = () => contextMenuState.get();
17405
+ const setContextMenuState = state => contextMenuState.set(state);
17406
+ const commonBackstage = {
17334
17407
  shared: {
17335
- providers: {
17336
- icons: () => editor.ui.registry.getAll().icons,
17337
- menuItems: () => editor.ui.registry.getAll().menuItems,
17338
- translate: global$8.translate,
17339
- isDisabled: () => editor.mode.isReadOnly() || !editor.ui.isEnabled(),
17340
- getOption: editor.options.get
17341
- },
17342
- interpreter: s => interpretWithoutForm(s, {}, backstage),
17408
+ providers,
17343
17409
  anchors: getAnchors(editor, lazyAnchorbar, toolbar.isPositionedAtTop),
17344
- header: toolbar,
17345
- getSink: lazySink
17410
+ header: toolbar
17346
17411
  },
17347
- urlinput: UrlInputBackstage(editor),
17348
- styles: init$8(editor),
17349
- colorinput: ColorInputBackstage(editor),
17350
- dialog: DialogBackstage(editor),
17351
- isContextMenuOpen: () => contextMenuState.get(),
17352
- setContextMenuState: state => contextMenuState.set(state)
17412
+ urlinput,
17413
+ styles,
17414
+ colorinput,
17415
+ dialog: dialogSettings,
17416
+ isContextMenuOpen,
17417
+ setContextMenuState
17418
+ };
17419
+ const popupBackstage = {
17420
+ ...commonBackstage,
17421
+ shared: {
17422
+ ...commonBackstage.shared,
17423
+ interpreter: s => interpretWithoutForm(s, {}, popupBackstage),
17424
+ getSink: lazySinks.popup
17425
+ }
17426
+ };
17427
+ const dialogBackstage = {
17428
+ ...commonBackstage,
17429
+ shared: {
17430
+ ...commonBackstage.shared,
17431
+ interpreter: s => interpretWithoutForm(s, {}, dialogBackstage),
17432
+ getSink: lazySinks.dialog
17433
+ }
17434
+ };
17435
+ return {
17436
+ popup: popupBackstage,
17437
+ dialog: dialogBackstage
17353
17438
  };
17354
- return backstage;
17355
17439
  };
17356
17440
 
17357
- const setup$b = (editor, mothership, uiMothership) => {
17441
+ const setup$b = (editor, mothership, uiMotherships) => {
17358
17442
  const broadcastEvent = (name, evt) => {
17359
17443
  each$1([
17360
17444
  mothership,
17361
- uiMothership
17362
- ], ship => {
17363
- ship.broadcastEvent(name, evt);
17445
+ ...uiMotherships
17446
+ ], m => {
17447
+ m.broadcastEvent(name, evt);
17364
17448
  });
17365
17449
  };
17366
17450
  const broadcastOn = (channel, message) => {
17367
17451
  each$1([
17368
17452
  mothership,
17369
- uiMothership
17370
- ], ship => {
17371
- ship.broadcastOn([channel], message);
17453
+ ...uiMotherships
17454
+ ], m => {
17455
+ m.broadcastOn([channel], message);
17372
17456
  });
17373
17457
  };
17374
17458
  const fireDismissPopups = evt => broadcastOn(dismissPopups(), { target: evt.target });
@@ -17437,10 +17521,14 @@
17437
17521
  onMouseup.unbind();
17438
17522
  });
17439
17523
  editor.on('detach', () => {
17440
- detachSystem(mothership);
17441
- detachSystem(uiMothership);
17442
- mothership.destroy();
17443
- uiMothership.destroy();
17524
+ each$1([
17525
+ mothership,
17526
+ ...uiMotherships
17527
+ ], detachSystem);
17528
+ each$1([
17529
+ mothership,
17530
+ ...uiMotherships
17531
+ ], m => m.destroy());
17444
17532
  });
17445
17533
  };
17446
17534
 
@@ -17461,7 +17549,7 @@
17461
17549
  const parts$9 = constant$1([itemsPart]);
17462
17550
  const name = constant$1('CustomList');
17463
17551
 
17464
- const factory$d = (detail, components, _spec, _external) => {
17552
+ const factory$f = (detail, components, _spec, _external) => {
17465
17553
  const setItems = (list, items) => {
17466
17554
  getListContainer(list).fold(() => {
17467
17555
  console.error('Custom List was defined to not be a shell, but no item container was specified in components');
@@ -17500,7 +17588,7 @@
17500
17588
  name: name(),
17501
17589
  configFields: schema$f(),
17502
17590
  partFields: parts$9(),
17503
- factory: factory$d,
17591
+ factory: factory$f,
17504
17592
  apis: {
17505
17593
  setItems: (apis, list, items) => {
17506
17594
  apis.setItems(list, items);
@@ -17519,7 +17607,7 @@
17519
17607
  overrides: enhanceGroups
17520
17608
  })]);
17521
17609
 
17522
- const factory$c = (detail, components, _spec, _externals) => {
17610
+ const factory$e = (detail, components, _spec, _externals) => {
17523
17611
  const setGroups = (toolbar, groups) => {
17524
17612
  getGroupContainer(toolbar).fold(() => {
17525
17613
  console.error('Toolbar was defined to not be a shell, but no groups container was specified in components');
@@ -17549,7 +17637,7 @@
17549
17637
  name: 'Toolbar',
17550
17638
  configFields: schema$e(),
17551
17639
  partFields: parts$8(),
17552
- factory: factory$c,
17640
+ factory: factory$e,
17553
17641
  apis: {
17554
17642
  setGroups: (apis, toolbar, groups) => {
17555
17643
  apis.setGroups(toolbar, groups);
@@ -17818,7 +17906,7 @@
17818
17906
  init: init$6
17819
17907
  });
17820
17908
 
17821
- const Docking = create$3({
17909
+ const Docking = create$4({
17822
17910
  fields: DockingSchema,
17823
17911
  name: 'docking',
17824
17912
  active: ActiveDocking,
@@ -18075,7 +18163,7 @@
18075
18163
  ]);
18076
18164
  const createSplitButton = spec => asRaw('SplitButton', splitButtonSchema, spec);
18077
18165
 
18078
- const factory$b = (detail, spec) => {
18166
+ const factory$d = (detail, spec) => {
18079
18167
  const setMenus = (comp, menus) => {
18080
18168
  const newMenus = map$2(menus, m => {
18081
18169
  const buttonSpec = {
@@ -18145,7 +18233,7 @@
18145
18233
  };
18146
18234
  };
18147
18235
  var SilverMenubar = single({
18148
- factory: factory$b,
18236
+ factory: factory$d,
18149
18237
  name: 'silver.Menubar',
18150
18238
  configFields: [
18151
18239
  required$1('dom'),
@@ -18386,7 +18474,7 @@
18386
18474
  init: init$5
18387
18475
  });
18388
18476
 
18389
- const Sliding = create$3({
18477
+ const Sliding = create$4({
18390
18478
  fields: SlidingSchema,
18391
18479
  name: 'sliding',
18392
18480
  active: ActiveSliding,
@@ -18724,7 +18812,7 @@
18724
18812
  init: init$4
18725
18813
  });
18726
18814
 
18727
- const Blocking = create$3({
18815
+ const Blocking = create$4({
18728
18816
  fields: BlockingSchema,
18729
18817
  name: 'blocking',
18730
18818
  apis: BlockingApis,
@@ -18977,7 +19065,9 @@
18977
19065
  markers$1(['overflowToggledClass']),
18978
19066
  optionFunction('getOverflowBounds'),
18979
19067
  required$1('lazySink'),
18980
- customField('overflowGroups', () => Cell([]))
19068
+ customField('overflowGroups', () => Cell([])),
19069
+ onHandler('onOpened'),
19070
+ onHandler('onClosed')
18981
19071
  ].concat(schema$c()));
18982
19072
  const parts$7 = constant$1([
18983
19073
  required({
@@ -19003,7 +19093,8 @@
19003
19093
  requiredFunction('fetch'),
19004
19094
  optionFunction('getBounds'),
19005
19095
  optionObjOf('fireDismissalEventInstead', [defaulted('event', dismissRequested())]),
19006
- schema$y()
19096
+ schema$y(),
19097
+ onHandler('onToggled')
19007
19098
  ]);
19008
19099
  const parts$6 = constant$1([
19009
19100
  external({
@@ -19013,7 +19104,8 @@
19013
19104
  buttonBehaviours: derive$1([Toggling.config({
19014
19105
  toggleClass: detail.markers.toggledClass,
19015
19106
  aria: { mode: 'expanded' },
19016
- toggleOnExecute: false
19107
+ toggleOnExecute: false,
19108
+ onToggled: detail.onToggled
19017
19109
  })])
19018
19110
  })
19019
19111
  }),
@@ -19115,7 +19207,7 @@
19115
19207
  ])
19116
19208
  };
19117
19209
  };
19118
- const factory$a = (detail, components, spec, externals) => ({
19210
+ const factory$c = (detail, components, spec, externals) => ({
19119
19211
  ...Button.sketch({
19120
19212
  ...externals.button(),
19121
19213
  action: button => {
@@ -19153,7 +19245,7 @@
19153
19245
  });
19154
19246
  const FloatingToolbarButton = composite({
19155
19247
  name: 'FloatingToolbarButton',
19156
- factory: factory$a,
19248
+ factory: factory$c,
19157
19249
  configFields: schema$a(),
19158
19250
  partFields: parts$6(),
19159
19251
  apis: {
@@ -19181,7 +19273,7 @@
19181
19273
  unit: 'item'
19182
19274
  })]);
19183
19275
 
19184
- const factory$9 = (detail, components, _spec, _externals) => ({
19276
+ const factory$b = (detail, components, _spec, _externals) => ({
19185
19277
  uid: detail.uid,
19186
19278
  dom: detail.dom,
19187
19279
  components,
@@ -19195,7 +19287,7 @@
19195
19287
  name: 'ToolbarGroup',
19196
19288
  configFields: schema$9(),
19197
19289
  partFields: parts$5(),
19198
- factory: factory$9
19290
+ factory: factory$b
19199
19291
  });
19200
19292
 
19201
19293
  const buildGroups = comps => map$2(comps, g => premade(g));
@@ -19207,7 +19299,7 @@
19207
19299
  });
19208
19300
  });
19209
19301
  };
19210
- const factory$8 = (detail, components, spec, externals) => {
19302
+ const factory$a = (detail, components, spec, externals) => {
19211
19303
  const memFloatingToolbarButton = record(FloatingToolbarButton.sketch({
19212
19304
  fetch: () => Future.nu(resolve => {
19213
19305
  resolve(buildGroups(detail.overflowGroups.get()));
@@ -19237,7 +19329,8 @@
19237
19329
  parts: {
19238
19330
  button: externals['overflow-button'](),
19239
19331
  toolbar: externals.overflow()
19240
- }
19332
+ },
19333
+ onToggled: (comp, state) => detail[state ? 'onOpened' : 'onClosed'](comp)
19241
19334
  }));
19242
19335
  return {
19243
19336
  uid: detail.uid,
@@ -19279,7 +19372,7 @@
19279
19372
  name: 'SplitFloatingToolbar',
19280
19373
  configFields: schema$b(),
19281
19374
  partFields: parts$7(),
19282
- factory: factory$8,
19375
+ factory: factory$a,
19283
19376
  apis: {
19284
19377
  setGroups: (apis, toolbar, groups) => {
19285
19378
  apis.setGroups(toolbar, groups);
@@ -19388,7 +19481,7 @@
19388
19481
  Sliding.refresh(overflow);
19389
19482
  });
19390
19483
  };
19391
- const factory$7 = (detail, components, spec, externals) => {
19484
+ const factory$9 = (detail, components, spec, externals) => {
19392
19485
  const toolbarToggleEvent = 'alloy.toolbar.toggle';
19393
19486
  const doSetGroups = (toolbar, groups) => {
19394
19487
  const built = map$2(groups, toolbar.getSystem().build);
@@ -19434,7 +19527,7 @@
19434
19527
  name: 'SplitSlidingToolbar',
19435
19528
  configFields: schema$8(),
19436
19529
  partFields: parts$4(),
19437
- factory: factory$7,
19530
+ factory: factory$9,
19438
19531
  apis: {
19439
19532
  setGroups: (apis, toolbar, groups) => {
19440
19533
  apis.setGroups(toolbar, groups);
@@ -19540,7 +19633,9 @@
19540
19633
  }
19541
19634
  },
19542
19635
  components: [primary],
19543
- markers: { overflowToggledClass: 'tox-tbtn--enabled' }
19636
+ markers: { overflowToggledClass: 'tox-tbtn--enabled' },
19637
+ onOpened: comp => toolbarSpec.onToggled(comp, true),
19638
+ onClosed: comp => toolbarSpec.onToggled(comp, false)
19544
19639
  });
19545
19640
  };
19546
19641
  const renderSlidingMoreToolbar = toolbarSpec => {
@@ -19572,9 +19667,11 @@
19572
19667
  },
19573
19668
  onOpened: comp => {
19574
19669
  comp.getSystem().broadcastOn([toolbarHeightChange()], { type: 'opened' });
19670
+ toolbarSpec.onToggled(comp, true);
19575
19671
  },
19576
19672
  onClosed: comp => {
19577
19673
  comp.getSystem().broadcastOn([toolbarHeightChange()], { type: 'closed' });
19674
+ toolbarSpec.onToggled(comp, false);
19578
19675
  }
19579
19676
  });
19580
19677
  };
@@ -19591,7 +19688,229 @@
19591
19688
  });
19592
19689
  };
19593
19690
 
19691
+ const normalButtonFields = [
19692
+ requiredStringEnum('type', ['button']),
19693
+ text$1,
19694
+ defaultedStringEnum('buttonType', 'secondary', [
19695
+ 'primary',
19696
+ 'secondary'
19697
+ ]),
19698
+ requiredFunction('onAction')
19699
+ ];
19700
+ const viewButtonSchema = choose$1('type', { button: normalButtonFields });
19701
+
19702
+ const viewSchema = objOf([
19703
+ defaultedArrayOf('buttons', [], viewButtonSchema),
19704
+ requiredFunction('onShow'),
19705
+ requiredFunction('onHide')
19706
+ ]);
19707
+ const createView = spec => asRaw('view', viewSchema, spec);
19708
+
19709
+ const renderViewButton = (spec, providers) => {
19710
+ return renderButton({
19711
+ text: spec.text,
19712
+ enabled: true,
19713
+ primary: false,
19714
+ name: 'name',
19715
+ icon: Optional.none(),
19716
+ borderless: false,
19717
+ buttonType: Optional.some(spec.buttonType)
19718
+ }, _comp => {
19719
+ spec.onAction();
19720
+ }, providers);
19721
+ };
19722
+ const renderViewHeader = spec => {
19723
+ const endButtons = map$2(spec.buttons, btnspec => renderViewButton(btnspec, spec.providers));
19724
+ return {
19725
+ uid: spec.uid,
19726
+ dom: {
19727
+ tag: 'div',
19728
+ classes: ['tox-view__header']
19729
+ },
19730
+ components: [
19731
+ Container.sketch({
19732
+ dom: {
19733
+ tag: 'div',
19734
+ classes: ['tox-view__header-start']
19735
+ },
19736
+ components: []
19737
+ }),
19738
+ Container.sketch({
19739
+ dom: {
19740
+ tag: 'div',
19741
+ classes: ['tox-view__header-end']
19742
+ },
19743
+ components: endButtons
19744
+ })
19745
+ ]
19746
+ };
19747
+ };
19748
+ const renderViewPane = spec => {
19749
+ return {
19750
+ uid: spec.uid,
19751
+ dom: {
19752
+ tag: 'div',
19753
+ classes: ['tox-view__pane']
19754
+ }
19755
+ };
19756
+ };
19757
+ const factory$8 = (detail, components, _spec, _externals) => {
19758
+ const apis = {
19759
+ getPane: comp => parts$a.getPart(comp, detail, 'pane'),
19760
+ getOnShow: _comp => detail.viewConfig.onShow,
19761
+ getOnHide: _comp => detail.viewConfig.onHide
19762
+ };
19763
+ return {
19764
+ uid: detail.uid,
19765
+ dom: detail.dom,
19766
+ components,
19767
+ apis
19768
+ };
19769
+ };
19770
+ var View = composite({
19771
+ name: 'silver.View',
19772
+ configFields: [required$1('viewConfig')],
19773
+ partFields: [
19774
+ optional({
19775
+ factory: { sketch: renderViewHeader },
19776
+ schema: [
19777
+ required$1('buttons'),
19778
+ required$1('providers')
19779
+ ],
19780
+ name: 'header'
19781
+ }),
19782
+ optional({
19783
+ factory: { sketch: renderViewPane },
19784
+ schema: [],
19785
+ name: 'pane'
19786
+ })
19787
+ ],
19788
+ factory: factory$8,
19789
+ apis: {
19790
+ getPane: (apis, comp) => apis.getPane(comp),
19791
+ getOnShow: (apis, comp) => apis.getOnShow(comp),
19792
+ getOnHide: (apis, comp) => apis.getOnHide(comp)
19793
+ }
19794
+ });
19795
+
19796
+ const makeViews = (parts, viewConfigs, providers) => {
19797
+ return mapToArray(viewConfigs, (config, name) => {
19798
+ const internalViewConfig = getOrDie(createView(config));
19799
+ return parts.slot(name, View.sketch({
19800
+ dom: {
19801
+ tag: 'div',
19802
+ classes: ['tox-view']
19803
+ },
19804
+ viewConfig: internalViewConfig,
19805
+ components: [
19806
+ ...internalViewConfig.buttons.length > 0 ? [View.parts.header({
19807
+ buttons: internalViewConfig.buttons,
19808
+ providers
19809
+ })] : [],
19810
+ View.parts.pane({})
19811
+ ]
19812
+ }));
19813
+ });
19814
+ };
19815
+ const makeSlotContainer = (viewConfigs, providers) => SlotContainer.sketch(parts => ({
19816
+ dom: {
19817
+ tag: 'div',
19818
+ classes: ['tox-view-wrap__slot-container']
19819
+ },
19820
+ components: makeViews(parts, viewConfigs, providers),
19821
+ slotBehaviours: SimpleBehaviours.unnamedEvents([runOnAttached(slotContainer => SlotContainer.hideAllSlots(slotContainer))])
19822
+ }));
19823
+ const getCurrentName = slotContainer => {
19824
+ return find$5(SlotContainer.getSlotNames(slotContainer), name => SlotContainer.isShowing(slotContainer, name));
19825
+ };
19826
+ const hideContainer = comp => {
19827
+ const element = comp.element;
19828
+ set$8(element, 'display', 'none');
19829
+ set$9(element, 'aria-hidden', 'true');
19830
+ };
19831
+ const showContainer = comp => {
19832
+ const element = comp.element;
19833
+ remove$6(element, 'display');
19834
+ remove$7(element, 'aria-hidden');
19835
+ };
19836
+ const makeViewInstanceApi = slot => ({ getContainer: constant$1(slot) });
19837
+ const runOnPaneWithInstanceApi = (slotContainer, name, get) => {
19838
+ SlotContainer.getSlot(slotContainer, name).each(view => {
19839
+ View.getPane(view).each(pane => {
19840
+ const onCallback = get(view);
19841
+ onCallback(makeViewInstanceApi(pane.element.dom));
19842
+ });
19843
+ });
19844
+ };
19845
+ const runOnShow = (slotContainer, name) => runOnPaneWithInstanceApi(slotContainer, name, View.getOnShow);
19846
+ const runOnHide = (slotContainer, name) => runOnPaneWithInstanceApi(slotContainer, name, View.getOnHide);
19847
+ const factory$7 = (detail, spec) => {
19848
+ const setViews = (comp, viewConfigs) => {
19849
+ Replacing.set(comp, [makeSlotContainer(viewConfigs, spec.backstage.shared.providers)]);
19850
+ };
19851
+ const whichView = comp => {
19852
+ return Composing.getCurrent(comp).bind(getCurrentName);
19853
+ };
19854
+ const toggleView = (comp, showMainView, hideMainView, name) => {
19855
+ return Composing.getCurrent(comp).exists(slotContainer => {
19856
+ const optCurrentSlotName = getCurrentName(slotContainer);
19857
+ const isTogglingCurrentView = optCurrentSlotName.exists(current => name === current);
19858
+ const exists = SlotContainer.getSlot(slotContainer, name).isSome();
19859
+ if (exists) {
19860
+ SlotContainer.hideAllSlots(slotContainer);
19861
+ if (!isTogglingCurrentView) {
19862
+ hideMainView();
19863
+ showContainer(comp);
19864
+ SlotContainer.showSlot(slotContainer, name);
19865
+ runOnShow(slotContainer, name);
19866
+ } else {
19867
+ hideContainer(comp);
19868
+ showMainView();
19869
+ }
19870
+ optCurrentSlotName.each(prevName => runOnHide(slotContainer, prevName));
19871
+ }
19872
+ return exists;
19873
+ });
19874
+ };
19875
+ const apis = {
19876
+ setViews,
19877
+ whichView,
19878
+ toggleView
19879
+ };
19880
+ return {
19881
+ uid: detail.uid,
19882
+ dom: {
19883
+ tag: 'div',
19884
+ classes: ['tox-view-wrap'],
19885
+ attributes: { 'aria-hidden': 'true' },
19886
+ styles: { display: 'none' }
19887
+ },
19888
+ components: [],
19889
+ behaviours: derive$1([
19890
+ Replacing.config({}),
19891
+ Composing.config({
19892
+ find: comp => {
19893
+ const children = Replacing.contents(comp);
19894
+ return head(children);
19895
+ }
19896
+ })
19897
+ ]),
19898
+ apis
19899
+ };
19900
+ };
19901
+ var ViewWrapper = single({
19902
+ factory: factory$7,
19903
+ name: 'silver.ViewWrapper',
19904
+ configFields: [required$1('backstage')],
19905
+ apis: {
19906
+ setViews: (apis, comp, views) => apis.setViews(comp, views),
19907
+ toggleView: (apis, comp, outerContainer, editorCont, name) => apis.toggleView(comp, outerContainer, editorCont, name),
19908
+ whichView: (apis, comp) => apis.whichView(comp)
19909
+ }
19910
+ });
19911
+
19594
19912
  const factory$6 = (detail, components, _spec) => {
19913
+ let toolbarDrawerOpenState = false;
19595
19914
  const apis = {
19596
19915
  getSocket: comp => {
19597
19916
  return parts$a.getPart(comp, detail, 'socket');
@@ -19653,15 +19972,47 @@
19653
19972
  parts$a.getPart(comp, detail, 'menubar').each(menubar => {
19654
19973
  SilverMenubar.focus(menubar);
19655
19974
  });
19656
- }
19657
- };
19658
- return {
19659
- uid: detail.uid,
19660
- dom: detail.dom,
19661
- components,
19662
- apis,
19663
- behaviours: detail.behaviours
19664
- };
19975
+ },
19976
+ setViews: (comp, viewConfigs) => {
19977
+ parts$a.getPart(comp, detail, 'viewWrapper').each(wrapper => {
19978
+ ViewWrapper.setViews(wrapper, viewConfigs);
19979
+ });
19980
+ },
19981
+ toggleView: (comp, name) => {
19982
+ return parts$a.getPart(comp, detail, 'viewWrapper').exists(wrapper => ViewWrapper.toggleView(wrapper, () => apis.showMainView(comp), () => apis.hideMainView(comp), name));
19983
+ },
19984
+ whichView: comp => {
19985
+ return parts$a.getPart(comp, detail, 'viewWrapper').bind(ViewWrapper.whichView).getOrNull();
19986
+ },
19987
+ hideMainView: comp => {
19988
+ toolbarDrawerOpenState = apis.isToolbarDrawerToggled(comp);
19989
+ if (toolbarDrawerOpenState) {
19990
+ apis.toggleToolbarDrawer(comp);
19991
+ }
19992
+ parts$a.getPart(comp, detail, 'editorContainer').each(editorContainer => {
19993
+ const element = editorContainer.element;
19994
+ set$8(element, 'display', 'none');
19995
+ set$9(element, 'aria-hidden', 'true');
19996
+ });
19997
+ },
19998
+ showMainView: comp => {
19999
+ if (toolbarDrawerOpenState) {
20000
+ apis.toggleToolbarDrawer(comp);
20001
+ }
20002
+ parts$a.getPart(comp, detail, 'editorContainer').each(editorContainer => {
20003
+ const element = editorContainer.element;
20004
+ remove$6(element, 'display');
20005
+ remove$7(element, 'aria-hidden');
20006
+ });
20007
+ }
20008
+ };
20009
+ return {
20010
+ uid: detail.uid,
20011
+ dom: detail.dom,
20012
+ components,
20013
+ apis,
20014
+ behaviours: detail.behaviours
20015
+ };
19665
20016
  };
19666
20017
  const partMenubar = partType.optional({
19667
20018
  factory: SilverMenubar,
@@ -19720,6 +20071,7 @@
19720
20071
  spec.onEscape();
19721
20072
  return Optional.some(true);
19722
20073
  },
20074
+ onToggled: (_comp, state) => spec.onToolbarToggled(state),
19723
20075
  cyclicKeying: false,
19724
20076
  initGroups: [],
19725
20077
  getSink: spec.getSink,
@@ -19765,6 +20117,24 @@
19765
20117
  name: 'throbber',
19766
20118
  schema: [required$1('dom')]
19767
20119
  });
20120
+ const partViewWrapper = partType.optional({
20121
+ factory: ViewWrapper,
20122
+ name: 'viewWrapper',
20123
+ schema: [required$1('backstage')]
20124
+ });
20125
+ const renderEditorContainer = spec => ({
20126
+ uid: spec.uid,
20127
+ dom: {
20128
+ tag: 'div',
20129
+ classes: ['tox-editor-container']
20130
+ },
20131
+ components: spec.components
20132
+ });
20133
+ const partEditorContainer = partType.optional({
20134
+ factory: { sketch: renderEditorContainer },
20135
+ name: 'editorContainer',
20136
+ schema: []
20137
+ });
19768
20138
  var OuterContainer = composite({
19769
20139
  name: 'OuterContainer',
19770
20140
  factory: factory$6,
@@ -19780,7 +20150,9 @@
19780
20150
  partSocket,
19781
20151
  partSidebar,
19782
20152
  partPromotion,
19783
- partThrobber
20153
+ partThrobber,
20154
+ partViewWrapper,
20155
+ partEditorContainer
19784
20156
  ],
19785
20157
  apis: {
19786
20158
  getSocket: (apis, comp) => {
@@ -19827,6 +20199,15 @@
19827
20199
  },
19828
20200
  focusToolbar: (apis, comp) => {
19829
20201
  apis.focusToolbar(comp);
20202
+ },
20203
+ setViews: (apis, comp, views) => {
20204
+ apis.setViews(comp, views);
20205
+ },
20206
+ toggleView: (apis, comp, name) => {
20207
+ return apis.toggleView(comp, name);
20208
+ },
20209
+ whichView: (apis, comp) => {
20210
+ return apis.whichView(comp);
19830
20211
  }
19831
20212
  }
19832
20213
  });
@@ -20536,7 +20917,7 @@
20536
20917
  init: init$3
20537
20918
  });
20538
20919
 
20539
- const Reflecting = create$3({
20920
+ const Reflecting = create$4({
20540
20921
  fields: ReflectingSchema,
20541
20922
  name: 'reflecting',
20542
20923
  active: ActiveReflecting,
@@ -21084,8 +21465,8 @@
21084
21465
  return filter$2(groups, group => group.items.length > 0);
21085
21466
  };
21086
21467
 
21087
- const setToolbar = (editor, uiComponents, rawUiConfig, backstage) => {
21088
- const comp = uiComponents.outerContainer;
21468
+ const setToolbar = (editor, uiRefs, rawUiConfig, backstage) => {
21469
+ const outerContainer = uiRefs.mainUi.outerContainer;
21089
21470
  const toolbarConfig = rawUiConfig.toolbar;
21090
21471
  const toolbarButtonsConfig = rawUiConfig.buttons;
21091
21472
  if (isArrayOf(toolbarConfig, isString)) {
@@ -21097,15 +21478,16 @@
21097
21478
  };
21098
21479
  return identifyButtons(editor, config, backstage, Optional.none());
21099
21480
  });
21100
- OuterContainer.setToolbars(comp, toolbars);
21481
+ OuterContainer.setToolbars(outerContainer, toolbars);
21101
21482
  } else {
21102
- OuterContainer.setToolbar(comp, identifyButtons(editor, rawUiConfig, backstage, Optional.none()));
21483
+ OuterContainer.setToolbar(outerContainer, identifyButtons(editor, rawUiConfig, backstage, Optional.none()));
21103
21484
  }
21104
21485
  };
21105
21486
 
21106
21487
  const detection = detect$1();
21107
21488
  const isiOS12 = detection.os.isiOS() && detection.os.version.major <= 12;
21108
- const setupEvents$1 = (editor, uiComponents) => {
21489
+ const setupEvents$1 = (editor, uiRefs) => {
21490
+ const {uiMotherships} = uiRefs;
21109
21491
  const dom = editor.dom;
21110
21492
  let contentWindow = editor.getWin();
21111
21493
  const initialDocEle = editor.getDoc().documentElement;
@@ -21132,12 +21514,15 @@
21132
21514
  dom.bind(contentWindow, 'resize', resizeWindow);
21133
21515
  dom.bind(contentWindow, 'scroll', scroll);
21134
21516
  const elementLoad = capture(SugarElement.fromDom(editor.getBody()), 'load', resizeDocument);
21135
- const mothership = uiComponents.uiMothership.element;
21136
21517
  editor.on('hide', () => {
21137
- set$8(mothership, 'display', 'none');
21518
+ each$1(uiMotherships, m => {
21519
+ set$8(m.element, 'display', 'none');
21520
+ });
21138
21521
  });
21139
21522
  editor.on('show', () => {
21140
- remove$6(mothership, 'display');
21523
+ each$1(uiMotherships, m => {
21524
+ remove$6(m.element, 'display');
21525
+ });
21141
21526
  });
21142
21527
  editor.on('NodeChange', resizeDocument);
21143
21528
  editor.on('remove', () => {
@@ -21147,20 +21532,25 @@
21147
21532
  contentWindow = null;
21148
21533
  });
21149
21534
  };
21150
- const render$1 = (editor, uiComponents, rawUiConfig, backstage, args) => {
21535
+ const attachUiMotherships$1 = (uiRoot, uiRefs) => {
21536
+ attachSystem(uiRoot, uiRefs.dialogUi.mothership);
21537
+ };
21538
+ const render$1 = (editor, uiRefs, rawUiConfig, backstage, args) => {
21539
+ const {mainUi, uiMotherships} = uiRefs;
21151
21540
  const lastToolbarWidth = Cell(0);
21152
- const outerContainer = uiComponents.outerContainer;
21541
+ const outerContainer = mainUi.outerContainer;
21153
21542
  iframe(editor);
21154
21543
  const eTargetNode = SugarElement.fromDom(args.targetNode);
21155
21544
  const uiRoot = getContentContainer(getRootNode(eTargetNode));
21156
- attachSystemAfter(eTargetNode, uiComponents.mothership);
21157
- attachSystem(uiRoot, uiComponents.uiMothership);
21545
+ attachSystemAfter(eTargetNode, mainUi.mothership);
21546
+ attachUiMotherships$1(uiRoot, uiRefs);
21158
21547
  editor.on('PostRender', () => {
21159
21548
  OuterContainer.setSidebar(outerContainer, rawUiConfig.sidebar, getSidebarShow(editor));
21160
- setToolbar(editor, uiComponents, rawUiConfig, backstage);
21549
+ setToolbar(editor, uiRefs, rawUiConfig, backstage);
21161
21550
  lastToolbarWidth.set(editor.getWin().innerWidth);
21162
21551
  OuterContainer.setMenubar(outerContainer, identifyMenus(editor, rawUiConfig));
21163
- setupEvents$1(editor, uiComponents);
21552
+ OuterContainer.setViews(outerContainer, rawUiConfig.views);
21553
+ setupEvents$1(editor, uiRefs);
21164
21554
  });
21165
21555
  const socket = OuterContainer.getSocket(outerContainer).getOrDie('Could not find expected socket element');
21166
21556
  if (isiOS12) {
@@ -21174,7 +21564,7 @@
21174
21564
  const unbinder = bind(socket.element, 'scroll', limit.throttle);
21175
21565
  editor.on('remove', unbinder.unbind);
21176
21566
  }
21177
- setupReadonlyModeSwitch(editor, uiComponents);
21567
+ setupReadonlyModeSwitch(editor, uiRefs);
21178
21568
  editor.addCommand('ToggleSidebar', (_ui, value) => {
21179
21569
  OuterContainer.toggleSidebar(outerContainer, value);
21180
21570
  editor.dispatch('ToggleSidebar');
@@ -21183,9 +21573,26 @@
21183
21573
  var _a;
21184
21574
  return (_a = OuterContainer.whichSidebar(outerContainer)) !== null && _a !== void 0 ? _a : '';
21185
21575
  });
21576
+ editor.addCommand('ToggleView', (_ui, value) => {
21577
+ if (OuterContainer.toggleView(outerContainer, value)) {
21578
+ const target = outerContainer.element;
21579
+ mainUi.mothership.broadcastOn([dismissPopups()], { target });
21580
+ each$1(uiMotherships, m => {
21581
+ m.broadcastOn([dismissPopups()], { target });
21582
+ });
21583
+ if (isNull(OuterContainer.whichView(outerContainer))) {
21584
+ editor.focus();
21585
+ editor.nodeChanged();
21586
+ }
21587
+ }
21588
+ });
21589
+ editor.addQueryValueHandler('ToggleView', () => {
21590
+ var _a;
21591
+ return (_a = OuterContainer.whichView(outerContainer)) !== null && _a !== void 0 ? _a : '';
21592
+ });
21186
21593
  const toolbarMode = getToolbarMode(editor);
21187
21594
  const refreshDrawer = () => {
21188
- OuterContainer.refreshToolbar(uiComponents.outerContainer);
21595
+ OuterContainer.refreshToolbar(uiRefs.mainUi.outerContainer);
21189
21596
  };
21190
21597
  if (toolbarMode === ToolbarMode$1.sliding || toolbarMode === ToolbarMode$1.floating) {
21191
21598
  editor.on('ResizeWindow ResizeEditor ResizeContent', () => {
@@ -21198,7 +21605,7 @@
21198
21605
  }
21199
21606
  const api = {
21200
21607
  setEnabled: state => {
21201
- broadcastReadonly(uiComponents, !state);
21608
+ broadcastReadonly(uiRefs, !state);
21202
21609
  },
21203
21610
  isEnabled: () => !Disabling.isDisabled(outerContainer)
21204
21611
  };
@@ -21250,8 +21657,8 @@
21250
21657
  };
21251
21658
 
21252
21659
  const {ToolbarLocation, ToolbarMode} = Options;
21253
- const InlineHeader = (editor, targetElm, uiComponents, backstage, floatContainer) => {
21254
- const {uiMothership, outerContainer} = uiComponents;
21660
+ const InlineHeader = (editor, targetElm, uiRefs, backstage, floatContainer) => {
21661
+ const {mainUi, uiMotherships} = uiRefs;
21255
21662
  const DOM = global$7.DOM;
21256
21663
  const useFixedToolbarContainer = useFixedContainer(editor);
21257
21664
  const isSticky = isStickyToolbar(editor);
@@ -21266,7 +21673,7 @@
21266
21673
  const calcMode = container => {
21267
21674
  switch (getToolbarLocation(editor)) {
21268
21675
  case ToolbarLocation.auto:
21269
- const toolbar = OuterContainer.getToolbar(outerContainer);
21676
+ const toolbar = OuterContainer.getToolbar(mainUi.outerContainer);
21270
21677
  const offset = calcToolbarOffset(toolbar);
21271
21678
  const toolbarHeight = get$d(container.element) - offset;
21272
21679
  const targetBounds = box$1(targetElm);
@@ -21311,11 +21718,11 @@
21311
21718
  };
21312
21719
  const updateChromePosition = () => {
21313
21720
  floatContainer.on(container => {
21314
- const toolbar = OuterContainer.getToolbar(outerContainer);
21721
+ const toolbar = OuterContainer.getToolbar(mainUi.outerContainer);
21315
21722
  const offset = calcToolbarOffset(toolbar);
21316
21723
  const targetBounds = box$1(targetElm);
21317
21724
  const top = isPositionedAtTop() ? Math.max(targetBounds.y - get$d(container.element) + offset, 0) : targetBounds.bottom;
21318
- setAll(outerContainer.element, {
21725
+ setAll(mainUi.outerContainer.element, {
21319
21726
  position: 'absolute',
21320
21727
  top: Math.round(top) + 'px',
21321
21728
  left: Math.round(targetBounds.x) + 'px'
@@ -21323,7 +21730,9 @@
21323
21730
  });
21324
21731
  };
21325
21732
  const repositionPopups$1 = () => {
21326
- uiMothership.broadcastOn([repositionPopups()], {});
21733
+ each$1(uiMotherships, m => {
21734
+ m.broadcastOn([repositionPopups()], {});
21735
+ });
21327
21736
  };
21328
21737
  const updateChromeUi = (resetDocking = false) => {
21329
21738
  if (!isVisible()) {
@@ -21333,7 +21742,7 @@
21333
21742
  updateChromeWidth();
21334
21743
  }
21335
21744
  if (isSplitToolbar) {
21336
- OuterContainer.refreshToolbar(outerContainer);
21745
+ OuterContainer.refreshToolbar(mainUi.outerContainer);
21337
21746
  }
21338
21747
  if (!useFixedToolbarContainer) {
21339
21748
  updateChromePosition();
@@ -21361,19 +21770,21 @@
21361
21770
  };
21362
21771
  const show = () => {
21363
21772
  visible.set(true);
21364
- set$8(outerContainer.element, 'display', 'flex');
21773
+ set$8(mainUi.outerContainer.element, 'display', 'flex');
21365
21774
  DOM.addClass(editor.getBody(), 'mce-edit-focus');
21366
- remove$6(uiMothership.element, 'display');
21775
+ each$1(uiMotherships, m => {
21776
+ remove$6(m.element, 'display');
21777
+ });
21367
21778
  updateMode(false);
21368
21779
  updateChromeUi();
21369
21780
  };
21370
21781
  const hide = () => {
21371
21782
  visible.set(false);
21372
- if (uiComponents.outerContainer) {
21373
- set$8(outerContainer.element, 'display', 'none');
21374
- DOM.removeClass(editor.getBody(), 'mce-edit-focus');
21375
- }
21376
- set$8(uiMothership.element, 'display', 'none');
21783
+ set$8(mainUi.outerContainer.element, 'display', 'none');
21784
+ DOM.removeClass(editor.getBody(), 'mce-edit-focus');
21785
+ each$1(uiMotherships, m => {
21786
+ set$8(m.element, 'display', 'none');
21787
+ });
21377
21788
  };
21378
21789
  return {
21379
21790
  isVisible,
@@ -21433,11 +21844,14 @@
21433
21844
  elementLoad.clear();
21434
21845
  });
21435
21846
  };
21436
- const render = (editor, uiComponents, rawUiConfig, backstage, args) => {
21437
- const {mothership, uiMothership, outerContainer} = uiComponents;
21847
+ const attachUiMotherships = (uiRoot, uiRefs) => {
21848
+ attachSystem(uiRoot, uiRefs.dialogUi.mothership);
21849
+ };
21850
+ const render = (editor, uiRefs, rawUiConfig, backstage, args) => {
21851
+ const {mainUi} = uiRefs;
21438
21852
  const floatContainer = value$2();
21439
21853
  const targetElm = SugarElement.fromDom(args.targetNode);
21440
- const ui = InlineHeader(editor, targetElm, uiComponents, backstage, floatContainer);
21854
+ const ui = InlineHeader(editor, targetElm, uiRefs, backstage, floatContainer);
21441
21855
  const toolbarPersist = isToolbarPersist(editor);
21442
21856
  inline(editor);
21443
21857
  const render = () => {
@@ -21445,12 +21859,12 @@
21445
21859
  ui.show();
21446
21860
  return;
21447
21861
  }
21448
- floatContainer.set(OuterContainer.getHeader(outerContainer).getOrDie());
21862
+ floatContainer.set(OuterContainer.getHeader(mainUi.outerContainer).getOrDie());
21449
21863
  const uiContainer = getUiContainer(editor);
21450
- attachSystem(uiContainer, mothership);
21451
- attachSystem(uiContainer, uiMothership);
21452
- setToolbar(editor, uiComponents, rawUiConfig, backstage);
21453
- OuterContainer.setMenubar(outerContainer, identifyMenus(editor, rawUiConfig));
21864
+ attachSystem(uiContainer, mainUi.mothership);
21865
+ attachUiMotherships(uiContainer, uiRefs);
21866
+ setToolbar(editor, uiRefs, rawUiConfig, backstage);
21867
+ OuterContainer.setMenubar(mainUi.outerContainer, identifyMenus(editor, rawUiConfig));
21454
21868
  ui.show();
21455
21869
  setupEvents(editor, targetElm, ui, toolbarPersist);
21456
21870
  editor.nodeChanged();
@@ -21466,17 +21880,17 @@
21466
21880
  render();
21467
21881
  }
21468
21882
  });
21469
- setupReadonlyModeSwitch(editor, uiComponents);
21883
+ setupReadonlyModeSwitch(editor, uiRefs);
21470
21884
  const api = {
21471
21885
  show: render,
21472
21886
  hide: ui.hide,
21473
21887
  setEnabled: state => {
21474
- broadcastReadonly(uiComponents, !state);
21888
+ broadcastReadonly(uiRefs, !state);
21475
21889
  },
21476
- isEnabled: () => !Disabling.isDisabled(outerContainer)
21890
+ isEnabled: () => !Disabling.isDisabled(mainUi.outerContainer)
21477
21891
  };
21478
21892
  return {
21479
- editorContainer: outerContainer.element.dom,
21893
+ editorContainer: mainUi.outerContainer.element.dom,
21480
21894
  api
21481
21895
  };
21482
21896
  };
@@ -21486,6 +21900,24 @@
21486
21900
  render: render
21487
21901
  });
21488
21902
 
21903
+ const LazyUiReferences = () => {
21904
+ const dialogUi = value$2();
21905
+ const popupUi = value$2();
21906
+ const mainUi = value$2();
21907
+ const setupDialogUi = ui => {
21908
+ dialogUi.set(ui);
21909
+ };
21910
+ const lazyGetInOuterOrDie = (label, f) => () => mainUi.get().bind(oc => f(oc.outerContainer)).getOrDie(`Could not find ${ label } element in OuterContainer`);
21911
+ return {
21912
+ dialogUi,
21913
+ popupUi,
21914
+ mainUi,
21915
+ getUiMotherships: () => [...dialogUi.get().map(e => e.mothership).toArray()],
21916
+ setupDialogUi,
21917
+ lazyGetInOuterOrDie
21918
+ };
21919
+ };
21920
+
21489
21921
  const showContextToolbarEvent = 'contexttoolbar-show';
21490
21922
  const hideContextToolbarEvent = 'contexttoolbar-hide';
21491
21923
 
@@ -21591,7 +22023,7 @@
21591
22023
  buildInitGroups
21592
22024
  };
21593
22025
 
21594
- const isVerticalOverlap = (a, b, threshold = 0.01) => b.bottom - a.y >= threshold && a.bottom - b.y >= threshold;
22026
+ const isVerticalOverlap = (a, b, threshold) => b.bottom - a.y >= threshold && a.bottom - b.y >= threshold;
21595
22027
  const getRangeRect = rng => {
21596
22028
  const rect = rng.getBoundingClientRect();
21597
22029
  if (rect.height <= 0 && rect.width <= 0) {
@@ -21702,7 +22134,7 @@
21702
22134
  return isSameAnchorElement ? preserve : north;
21703
22135
  } else if (isSameAnchorElement) {
21704
22136
  return preservePosition(contextbar, data.getMode(), () => {
21705
- const isOverlapping = isVerticalOverlap(selectionBounds, box$1(contextbar));
22137
+ const isOverlapping = isVerticalOverlap(selectionBounds, box$1(contextbar), -20);
21706
22138
  return isOverlapping && !data.isReposition() ? flip : preserve;
21707
22139
  });
21708
22140
  } else {
@@ -22043,7 +22475,7 @@
22043
22475
  } else {
22044
22476
  const contextToolbarBounds = getBounds();
22045
22477
  const anchorBounds = is$1(lastContextPosition.get(), 'node') ? getAnchorElementBounds(editor, lastElement.get()) : getSelectionBounds(editor);
22046
- return contextToolbarBounds.height <= 0 || !isVerticalOverlap(anchorBounds, contextToolbarBounds);
22478
+ return contextToolbarBounds.height <= 0 || !isVerticalOverlap(anchorBounds, contextToolbarBounds, 0.01);
22047
22479
  }
22048
22480
  };
22049
22481
  const close = () => {
@@ -23836,7 +24268,7 @@
23836
24268
  'aria-level': index + 1
23837
24269
  }
23838
24270
  },
23839
- components: [text$1(name)],
24271
+ components: [text$2(name)],
23840
24272
  action: _btn => {
23841
24273
  editor.focus();
23842
24274
  editor.selection.select(element);
@@ -23853,7 +24285,7 @@
23853
24285
  classes: ['tox-statusbar__path-divider'],
23854
24286
  attributes: { 'aria-hidden': true }
23855
24287
  },
23856
- components: [text$1(` ${ delimiter } `)]
24288
+ components: [text$2(` ${ delimiter } `)]
23857
24289
  });
23858
24290
  const renderPathData = data => foldl(data, (acc, path, index) => {
23859
24291
  const element = renderElement(path.name, path.element, index);
@@ -23984,7 +24416,7 @@
23984
24416
  };
23985
24417
 
23986
24418
  const renderWordCount = (editor, providersBackstage) => {
23987
- const replaceCountText = (comp, count, mode) => Replacing.set(comp, [text$1(providersBackstage.translate([
24419
+ const replaceCountText = (comp, count, mode) => Replacing.set(comp, [text$2(providersBackstage.translate([
23988
24420
  '{0} ' + mode,
23989
24421
  count[mode]
23990
24422
  ]))]);
@@ -24104,15 +24536,14 @@
24104
24536
  };
24105
24537
  };
24106
24538
 
24107
- const getLazyMothership = singleton => singleton.get().getOrDie('UI has not been rendered');
24539
+ const getLazyMothership = (label, singleton) => singleton.get().getOrDie(`UI for ${ label } has not been rendered`);
24108
24540
  const setup$3 = editor => {
24109
24541
  const isInline = editor.inline;
24110
24542
  const mode = isInline ? Inline : Iframe;
24111
24543
  const header = isStickyToolbar(editor) ? StickyHeader : StaticHeader;
24112
- const lazySink = value$2();
24113
- const lazyOuterContainer = value$2();
24544
+ const lazyUiRefs = LazyUiReferences();
24114
24545
  const lazyMothership = value$2();
24115
- const lazyUiMothership = value$2();
24546
+ const lazyDialogMothership = value$2();
24116
24547
  const platform = detect$1();
24117
24548
  const isTouch = platform.deviceType.isTouch();
24118
24549
  const touchPlatformClass = 'tox-platform-touch';
@@ -24125,12 +24556,16 @@
24125
24556
  classes: ['tox-anchorbar']
24126
24557
  }
24127
24558
  });
24128
- const lazyHeader = () => lazyOuterContainer.get().bind(OuterContainer.getHeader);
24129
- const lazySinkResult = () => Result.fromOption(lazySink.get(), 'UI has not been rendered');
24130
- const lazyAnchorBar = () => lazyOuterContainer.get().bind(container => memAnchorBar.getOpt(container)).getOrDie('Could not find a anchor bar element');
24131
- const lazyToolbar = () => lazyOuterContainer.get().bind(container => OuterContainer.getToolbar(container)).getOrDie('Could not find more toolbar element');
24132
- const lazyThrobber = () => lazyOuterContainer.get().bind(container => OuterContainer.getThrobber(container)).getOrDie('Could not find throbber element');
24133
- const backstage = init$7(lazySinkResult, editor, lazyAnchorBar);
24559
+ const lazyHeader = () => lazyUiRefs.mainUi.get().map(ui => ui.outerContainer).bind(OuterContainer.getHeader);
24560
+ const lazyDialogSinkResult = () => Result.fromOption(lazyUiRefs.dialogUi.get().map(ui => ui.sink), 'UI has not been rendered');
24561
+ const lazyPopupSinkResult = () => Result.fromOption(lazyUiRefs.popupUi.get().map(ui => ui.sink), '(popup) UI has not been rendered');
24562
+ const lazyAnchorBar = lazyUiRefs.lazyGetInOuterOrDie('anchor bar', memAnchorBar.getOpt);
24563
+ const lazyToolbar = lazyUiRefs.lazyGetInOuterOrDie('toolbar', OuterContainer.getToolbar);
24564
+ const lazyThrobber = lazyUiRefs.lazyGetInOuterOrDie('throbber', OuterContainer.getThrobber);
24565
+ const backstages = init$7({
24566
+ popup: lazyPopupSinkResult,
24567
+ dialog: lazyDialogSinkResult
24568
+ }, editor, lazyAnchorBar);
24134
24569
  const makeHeaderPart = () => {
24135
24570
  const verticalDirAttributes = { attributes: { [Attribute]: isToolbarBottom ? AttributeValue.BottomToTop : AttributeValue.TopToBottom } };
24136
24571
  const partMenubar = OuterContainer.parts.menubar({
@@ -24138,7 +24573,7 @@
24138
24573
  tag: 'div',
24139
24574
  classes: ['tox-menubar']
24140
24575
  },
24141
- backstage,
24576
+ backstage: backstages.popup,
24142
24577
  onEscape: () => {
24143
24578
  editor.focus();
24144
24579
  }
@@ -24148,11 +24583,14 @@
24148
24583
  tag: 'div',
24149
24584
  classes: ['tox-toolbar']
24150
24585
  },
24151
- getSink: lazySinkResult,
24152
- providers: backstage.shared.providers,
24586
+ getSink: backstages.popup.shared.getSink,
24587
+ providers: backstages.popup.shared.providers,
24153
24588
  onEscape: () => {
24154
24589
  editor.focus();
24155
24590
  },
24591
+ onToolbarToggled: state => {
24592
+ fireToggleToolbarDrawer(editor, state);
24593
+ },
24156
24594
  type: toolbarMode,
24157
24595
  lazyToolbar,
24158
24596
  lazyHeader: () => lazyHeader().getOrDie('Could not find header element'),
@@ -24163,7 +24601,7 @@
24163
24601
  tag: 'div',
24164
24602
  classes: ['tox-toolbar-overlord']
24165
24603
  },
24166
- providers: backstage.shared.providers,
24604
+ providers: backstages.popup.shared.providers,
24167
24605
  onEscape: () => {
24168
24606
  editor.focus();
24169
24607
  },
@@ -24174,6 +24612,7 @@
24174
24612
  const hasMenubar = isMenubarEnabled(editor);
24175
24613
  const shouldHavePromotion = promotionEnabled(editor);
24176
24614
  const partPromotion = makePromotion();
24615
+ const hasAnyContents = hasMultipleToolbar || hasToolbar || hasMenubar;
24177
24616
  const getPartToolbar = () => {
24178
24617
  if (hasMultipleToolbar) {
24179
24618
  return [partMultipleToolbar];
@@ -24190,7 +24629,7 @@
24190
24629
  return OuterContainer.parts.header({
24191
24630
  dom: {
24192
24631
  tag: 'div',
24193
- classes: ['tox-editor-header'],
24632
+ classes: ['tox-editor-header'].concat(hasAnyContents ? [] : ['tox-editor-header--empty']),
24194
24633
  ...verticalDirAttributes
24195
24634
  },
24196
24635
  components: flatten([
@@ -24200,7 +24639,7 @@
24200
24639
  ]),
24201
24640
  sticky: isStickyToolbar(editor),
24202
24641
  editor,
24203
- sharedBackstage: backstage.shared
24642
+ sharedBackstage: backstages.popup.shared
24204
24643
  });
24205
24644
  };
24206
24645
  const makePromotion = () => {
@@ -24235,7 +24674,7 @@
24235
24674
  ]
24236
24675
  };
24237
24676
  };
24238
- const renderSink = () => {
24677
+ const renderDialogUi = () => {
24239
24678
  const uiContainer = getUiContainer(editor);
24240
24679
  const isGridUiContainer = eq(body(), uiContainer) && get$e(uiContainer, 'display') === 'grid';
24241
24680
  const sinkSpec = {
@@ -24258,14 +24697,14 @@
24258
24697
  };
24259
24698
  const sink = build$1(deepMerge(sinkSpec, isGridUiContainer ? reactiveWidthSpec : {}));
24260
24699
  const uiMothership = takeover(sink);
24261
- lazySink.set(sink);
24262
- lazyUiMothership.set(uiMothership);
24700
+ lazyDialogMothership.set(uiMothership);
24263
24701
  return {
24264
24702
  sink,
24265
- uiMothership
24703
+ mothership: uiMothership
24266
24704
  };
24267
24705
  };
24268
- const renderContainer = () => {
24706
+ const renderPopupUi = identity;
24707
+ const renderMainUi = () => {
24269
24708
  const partHeader = makeHeaderPart();
24270
24709
  const sidebarContainer = makeSidebarDefinition();
24271
24710
  const partThrobber = OuterContainer.parts.throbber({
@@ -24273,26 +24712,21 @@
24273
24712
  tag: 'div',
24274
24713
  classes: ['tox-throbber']
24275
24714
  },
24276
- backstage
24715
+ backstage: backstages.popup
24277
24716
  });
24278
- const statusbar = useStatusBar(editor) && !isInline ? Optional.some(renderStatusbar(editor, backstage.shared.providers)) : Optional.none();
24717
+ const partViewWrapper = OuterContainer.parts.viewWrapper({ backstage: backstages.popup });
24718
+ const statusbar = useStatusBar(editor) && !isInline ? Optional.some(renderStatusbar(editor, backstages.popup.shared.providers)) : Optional.none();
24279
24719
  const editorComponents = flatten([
24280
24720
  isToolbarBottom ? [] : [partHeader],
24281
24721
  isInline ? [] : [sidebarContainer],
24282
24722
  isToolbarBottom ? [partHeader] : []
24283
24723
  ]);
24284
- const editorContainer = {
24285
- dom: {
24286
- tag: 'div',
24287
- classes: ['tox-editor-container']
24288
- },
24289
- components: editorComponents
24290
- };
24291
- const containerComponents = flatten([
24292
- [editorContainer],
24293
- isInline ? [] : statusbar.toArray(),
24294
- [partThrobber]
24295
- ]);
24724
+ const editorContainer = OuterContainer.parts.editorContainer({
24725
+ components: flatten([
24726
+ editorComponents,
24727
+ isInline ? [] : statusbar.toArray()
24728
+ ])
24729
+ });
24296
24730
  const isHidden = isDistractionFree(editor);
24297
24731
  const attributes = {
24298
24732
  role: 'application',
@@ -24315,7 +24749,11 @@
24315
24749
  },
24316
24750
  attributes
24317
24751
  },
24318
- components: containerComponents,
24752
+ components: [
24753
+ editorContainer,
24754
+ ...isInline ? [] : [partViewWrapper],
24755
+ partThrobber
24756
+ ],
24319
24757
  behaviours: derive$1([
24320
24758
  receivingConfig(),
24321
24759
  Disabling.config({ disableClass: 'tox-tinymce--disabled' }),
@@ -24326,7 +24764,6 @@
24326
24764
  ])
24327
24765
  }));
24328
24766
  const mothership = takeover(outerContainer);
24329
- lazyOuterContainer.set(outerContainer);
24330
24767
  lazyMothership.set(mothership);
24331
24768
  return {
24332
24769
  mothership,
@@ -24360,13 +24797,12 @@
24360
24797
  });
24361
24798
  editor.addQueryStateHandler('ToggleToolbarDrawer', () => OuterContainer.isToolbarDrawerToggled(outerContainer));
24362
24799
  };
24363
- const renderUI = () => {
24364
- const {mothership, outerContainer} = renderContainer();
24365
- const {uiMothership, sink} = renderSink();
24800
+ const renderUIWithRefs = uiRefs => {
24801
+ const {mainUi, popupUi, uiMotherships} = uiRefs;
24366
24802
  map$1(getToolbarGroups(editor), (toolbarGroupButtonConfig, name) => {
24367
24803
  editor.ui.registry.addGroupToolbarButton(name, toolbarGroupButtonConfig);
24368
24804
  });
24369
- const {buttons, menuItems, contextToolbars, sidebars} = editor.ui.registry.getAll();
24805
+ const {buttons, menuItems, contextToolbars, sidebars, views} = editor.ui.registry.getAll();
24370
24806
  const toolbarOpt = getMultipleToolbarsOption(editor);
24371
24807
  const rawUiConfig = {
24372
24808
  menuItems,
@@ -24375,37 +24811,50 @@
24375
24811
  toolbar: toolbarOpt.getOrThunk(() => getToolbar(editor)),
24376
24812
  allowToolbarGroups: toolbarMode === ToolbarMode$1.floating,
24377
24813
  buttons,
24378
- sidebar: sidebars
24814
+ sidebar: sidebars,
24815
+ views
24379
24816
  };
24380
- setupShortcutsAndCommands(outerContainer);
24381
- setup$b(editor, mothership, uiMothership);
24382
- header.setup(editor, backstage.shared, lazyHeader);
24383
- setup$6(editor, backstage);
24384
- setup$5(editor, lazySinkResult, backstage);
24817
+ setupShortcutsAndCommands(mainUi.outerContainer);
24818
+ setup$b(editor, mainUi.mothership, uiMotherships);
24819
+ header.setup(editor, backstages.popup.shared, lazyHeader);
24820
+ setup$6(editor, backstages.popup);
24821
+ setup$5(editor, backstages.popup.shared.getSink, backstages.popup);
24385
24822
  setup$8(editor);
24386
- setup$7(editor, lazyThrobber, backstage.shared);
24387
- register$9(editor, contextToolbars, sink, { backstage });
24388
- setup$4(editor, sink);
24823
+ setup$7(editor, lazyThrobber, backstages.popup.shared);
24824
+ register$9(editor, contextToolbars, popupUi.sink, { backstage: backstages.popup });
24825
+ setup$4(editor, popupUi.sink);
24389
24826
  const elm = editor.getElement();
24390
- const height = setEditorSize(outerContainer);
24391
- const uiComponents = {
24392
- mothership,
24393
- uiMothership,
24394
- outerContainer,
24395
- sink
24396
- };
24827
+ const height = setEditorSize(mainUi.outerContainer);
24397
24828
  const args = {
24398
24829
  targetNode: elm,
24399
24830
  height
24400
24831
  };
24401
- return mode.render(editor, uiComponents, rawUiConfig, backstage, args);
24832
+ return mode.render(editor, uiRefs, rawUiConfig, backstages.popup, args);
24833
+ };
24834
+ const renderUI = () => {
24835
+ const mainUi = renderMainUi();
24836
+ const dialogUi = renderDialogUi();
24837
+ const popupUi = renderPopupUi(dialogUi);
24838
+ lazyUiRefs.dialogUi.set(dialogUi);
24839
+ lazyUiRefs.popupUi.set(popupUi);
24840
+ lazyUiRefs.mainUi.set(mainUi);
24841
+ const uiRefs = {
24842
+ popupUi,
24843
+ dialogUi,
24844
+ mainUi,
24845
+ uiMotherships: lazyUiRefs.getUiMotherships()
24846
+ };
24847
+ return renderUIWithRefs(uiRefs);
24402
24848
  };
24403
- const getMothership = () => getLazyMothership(lazyMothership);
24404
- const getUiMothership = () => getLazyMothership(lazyUiMothership);
24405
24849
  return {
24406
- getMothership,
24407
- getUiMothership,
24408
- backstage,
24850
+ popups: {
24851
+ backstage: backstages.popup,
24852
+ getMothership: () => getLazyMothership('popups', lazyDialogMothership)
24853
+ },
24854
+ dialogs: {
24855
+ backstage: backstages.dialog,
24856
+ getMothership: () => getLazyMothership('dialogs', lazyDialogMothership)
24857
+ },
24409
24858
  renderUI
24410
24859
  };
24411
24860
  };
@@ -24619,7 +25068,7 @@
24619
25068
  ];
24620
25069
  const dialogFooterButtonFields = [
24621
25070
  ...baseFooterButtonFields,
24622
- text
25071
+ text$1
24623
25072
  ];
24624
25073
  const normalFooterButtonFields = [
24625
25074
  requiredStringEnum('type', [
@@ -24646,7 +25095,7 @@
24646
25095
 
24647
25096
  const alertBannerFields = [
24648
25097
  type,
24649
- text,
25098
+ text$1,
24650
25099
  requiredStringEnum('level', [
24651
25100
  'info',
24652
25101
  'warn',
@@ -24665,7 +25114,7 @@
24665
25114
 
24666
25115
  const buttonFields = [
24667
25116
  type,
24668
- text,
25117
+ text$1,
24669
25118
  enabled,
24670
25119
  generatedName('button'),
24671
25120
  optionalIcon,
@@ -24696,11 +25145,11 @@
24696
25145
  const collectionSchema = objOf(collectionFields);
24697
25146
  const collectionDataProcessor = arrOfObj([
24698
25147
  value$1,
24699
- text,
25148
+ text$1,
24700
25149
  icon
24701
25150
  ]);
24702
25151
 
24703
- const colorInputFields = formComponentWithLabelFields;
25152
+ const colorInputFields = formComponentWithLabelFields.concat([defaultedString('storageKey', 'default')]);
24704
25153
  const colorInputSchema = objOf(colorInputFields);
24705
25154
  const colorInputDataProcessor = string;
24706
25155
 
@@ -24772,11 +25221,11 @@
24772
25221
  ];
24773
25222
 
24774
25223
  const listBoxSingleItemFields = [
24775
- text,
25224
+ text$1,
24776
25225
  value$1
24777
25226
  ];
24778
25227
  const listBoxNestedItemFields = [
24779
- text,
25228
+ text$1,
24780
25229
  requiredArrayOf('items', thunkOf('items', () => listBoxItemSchema))
24781
25230
  ];
24782
25231
  const listBoxItemSchema = oneOf([
@@ -24792,7 +25241,7 @@
24792
25241
 
24793
25242
  const selectBoxFields = formComponentWithLabelFields.concat([
24794
25243
  requiredArrayOfObj('items', [
24795
- text,
25244
+ text$1,
24796
25245
  value$1
24797
25246
  ]),
24798
25247
  defaultedNumber('size', 1),
@@ -25419,7 +25868,7 @@
25419
25868
  tag: 'div',
25420
25869
  classes: ['tox-dialog__body-nav-item']
25421
25870
  },
25422
- components: [text$1(backstage.shared.providers.translate(tab.title))],
25871
+ components: [text$2(backstage.shared.providers.translate(tab.title))],
25423
25872
  view: () => {
25424
25873
  return [Form.sketch(parts => ({
25425
25874
  dom: {
@@ -25580,6 +26029,1571 @@
25580
26029
  return ModalDialog.parts.body(bodySpec);
25581
26030
  };
25582
26031
 
26032
+ function _typeof(obj) {
26033
+ '@babel/helpers - typeof';
26034
+ return _typeof = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (obj) {
26035
+ return typeof obj;
26036
+ } : function (obj) {
26037
+ return obj && 'function' == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;
26038
+ }, _typeof(obj);
26039
+ }
26040
+ function _setPrototypeOf(o, p) {
26041
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
26042
+ o.__proto__ = p;
26043
+ return o;
26044
+ };
26045
+ return _setPrototypeOf(o, p);
26046
+ }
26047
+ function _isNativeReflectConstruct() {
26048
+ if (typeof Reflect === 'undefined' || !Reflect.construct)
26049
+ return false;
26050
+ if (Reflect.construct.sham)
26051
+ return false;
26052
+ if (typeof Proxy === 'function')
26053
+ return true;
26054
+ try {
26055
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {
26056
+ }));
26057
+ return true;
26058
+ } catch (e) {
26059
+ return false;
26060
+ }
26061
+ }
26062
+ function _construct(Parent, args, Class) {
26063
+ if (_isNativeReflectConstruct()) {
26064
+ _construct = Reflect.construct;
26065
+ } else {
26066
+ _construct = function _construct(Parent, args, Class) {
26067
+ var a = [null];
26068
+ a.push.apply(a, args);
26069
+ var Constructor = Function.bind.apply(Parent, a);
26070
+ var instance = new Constructor();
26071
+ if (Class)
26072
+ _setPrototypeOf(instance, Class.prototype);
26073
+ return instance;
26074
+ };
26075
+ }
26076
+ return _construct.apply(null, arguments);
26077
+ }
26078
+ function _toConsumableArray(arr) {
26079
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
26080
+ }
26081
+ function _arrayWithoutHoles(arr) {
26082
+ if (Array.isArray(arr))
26083
+ return _arrayLikeToArray(arr);
26084
+ }
26085
+ function _iterableToArray(iter) {
26086
+ if (typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null || iter['@@iterator'] != null)
26087
+ return Array.from(iter);
26088
+ }
26089
+ function _unsupportedIterableToArray(o, minLen) {
26090
+ if (!o)
26091
+ return;
26092
+ if (typeof o === 'string')
26093
+ return _arrayLikeToArray(o, minLen);
26094
+ var n = Object.prototype.toString.call(o).slice(8, -1);
26095
+ if (n === 'Object' && o.constructor)
26096
+ n = o.constructor.name;
26097
+ if (n === 'Map' || n === 'Set')
26098
+ return Array.from(o);
26099
+ if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
26100
+ return _arrayLikeToArray(o, minLen);
26101
+ }
26102
+ function _arrayLikeToArray(arr, len) {
26103
+ if (len == null || len > arr.length)
26104
+ len = arr.length;
26105
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
26106
+ arr2[i] = arr[i];
26107
+ return arr2;
26108
+ }
26109
+ function _nonIterableSpread() {
26110
+ throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
26111
+ }
26112
+ var hasOwnProperty = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
26113
+ var freeze = Object.freeze, seal = Object.seal, create = Object.create;
26114
+ var _ref = typeof Reflect !== 'undefined' && Reflect, apply = _ref.apply, construct = _ref.construct;
26115
+ if (!apply) {
26116
+ apply = function apply(fun, thisValue, args) {
26117
+ return fun.apply(thisValue, args);
26118
+ };
26119
+ }
26120
+ if (!freeze) {
26121
+ freeze = function freeze(x) {
26122
+ return x;
26123
+ };
26124
+ }
26125
+ if (!seal) {
26126
+ seal = function seal(x) {
26127
+ return x;
26128
+ };
26129
+ }
26130
+ if (!construct) {
26131
+ construct = function construct(Func, args) {
26132
+ return _construct(Func, _toConsumableArray(args));
26133
+ };
26134
+ }
26135
+ var arrayForEach = unapply(Array.prototype.forEach);
26136
+ var arrayPop = unapply(Array.prototype.pop);
26137
+ var arrayPush = unapply(Array.prototype.push);
26138
+ var stringToLowerCase = unapply(String.prototype.toLowerCase);
26139
+ var stringMatch = unapply(String.prototype.match);
26140
+ var stringReplace = unapply(String.prototype.replace);
26141
+ var stringIndexOf = unapply(String.prototype.indexOf);
26142
+ var stringTrim = unapply(String.prototype.trim);
26143
+ var regExpTest = unapply(RegExp.prototype.test);
26144
+ var typeErrorCreate = unconstruct(TypeError);
26145
+ function unapply(func) {
26146
+ return function (thisArg) {
26147
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
26148
+ args[_key - 1] = arguments[_key];
26149
+ }
26150
+ return apply(func, thisArg, args);
26151
+ };
26152
+ }
26153
+ function unconstruct(func) {
26154
+ return function () {
26155
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
26156
+ args[_key2] = arguments[_key2];
26157
+ }
26158
+ return construct(func, args);
26159
+ };
26160
+ }
26161
+ function addToSet(set, array) {
26162
+ if (setPrototypeOf) {
26163
+ setPrototypeOf(set, null);
26164
+ }
26165
+ var l = array.length;
26166
+ while (l--) {
26167
+ var element = array[l];
26168
+ if (typeof element === 'string') {
26169
+ var lcElement = stringToLowerCase(element);
26170
+ if (lcElement !== element) {
26171
+ if (!isFrozen(array)) {
26172
+ array[l] = lcElement;
26173
+ }
26174
+ element = lcElement;
26175
+ }
26176
+ }
26177
+ set[element] = true;
26178
+ }
26179
+ return set;
26180
+ }
26181
+ function clone(object) {
26182
+ var newObject = create(null);
26183
+ var property;
26184
+ for (property in object) {
26185
+ if (apply(hasOwnProperty, object, [property])) {
26186
+ newObject[property] = object[property];
26187
+ }
26188
+ }
26189
+ return newObject;
26190
+ }
26191
+ function lookupGetter(object, prop) {
26192
+ while (object !== null) {
26193
+ var desc = getOwnPropertyDescriptor(object, prop);
26194
+ if (desc) {
26195
+ if (desc.get) {
26196
+ return unapply(desc.get);
26197
+ }
26198
+ if (typeof desc.value === 'function') {
26199
+ return unapply(desc.value);
26200
+ }
26201
+ }
26202
+ object = getPrototypeOf(object);
26203
+ }
26204
+ function fallbackValue(element) {
26205
+ console.warn('fallback value for', element);
26206
+ return null;
26207
+ }
26208
+ return fallbackValue;
26209
+ }
26210
+ var html$1 = freeze([
26211
+ 'a',
26212
+ 'abbr',
26213
+ 'acronym',
26214
+ 'address',
26215
+ 'area',
26216
+ 'article',
26217
+ 'aside',
26218
+ 'audio',
26219
+ 'b',
26220
+ 'bdi',
26221
+ 'bdo',
26222
+ 'big',
26223
+ 'blink',
26224
+ 'blockquote',
26225
+ 'body',
26226
+ 'br',
26227
+ 'button',
26228
+ 'canvas',
26229
+ 'caption',
26230
+ 'center',
26231
+ 'cite',
26232
+ 'code',
26233
+ 'col',
26234
+ 'colgroup',
26235
+ 'content',
26236
+ 'data',
26237
+ 'datalist',
26238
+ 'dd',
26239
+ 'decorator',
26240
+ 'del',
26241
+ 'details',
26242
+ 'dfn',
26243
+ 'dialog',
26244
+ 'dir',
26245
+ 'div',
26246
+ 'dl',
26247
+ 'dt',
26248
+ 'element',
26249
+ 'em',
26250
+ 'fieldset',
26251
+ 'figcaption',
26252
+ 'figure',
26253
+ 'font',
26254
+ 'footer',
26255
+ 'form',
26256
+ 'h1',
26257
+ 'h2',
26258
+ 'h3',
26259
+ 'h4',
26260
+ 'h5',
26261
+ 'h6',
26262
+ 'head',
26263
+ 'header',
26264
+ 'hgroup',
26265
+ 'hr',
26266
+ 'html',
26267
+ 'i',
26268
+ 'img',
26269
+ 'input',
26270
+ 'ins',
26271
+ 'kbd',
26272
+ 'label',
26273
+ 'legend',
26274
+ 'li',
26275
+ 'main',
26276
+ 'map',
26277
+ 'mark',
26278
+ 'marquee',
26279
+ 'menu',
26280
+ 'menuitem',
26281
+ 'meter',
26282
+ 'nav',
26283
+ 'nobr',
26284
+ 'ol',
26285
+ 'optgroup',
26286
+ 'option',
26287
+ 'output',
26288
+ 'p',
26289
+ 'picture',
26290
+ 'pre',
26291
+ 'progress',
26292
+ 'q',
26293
+ 'rp',
26294
+ 'rt',
26295
+ 'ruby',
26296
+ 's',
26297
+ 'samp',
26298
+ 'section',
26299
+ 'select',
26300
+ 'shadow',
26301
+ 'small',
26302
+ 'source',
26303
+ 'spacer',
26304
+ 'span',
26305
+ 'strike',
26306
+ 'strong',
26307
+ 'style',
26308
+ 'sub',
26309
+ 'summary',
26310
+ 'sup',
26311
+ 'table',
26312
+ 'tbody',
26313
+ 'td',
26314
+ 'template',
26315
+ 'textarea',
26316
+ 'tfoot',
26317
+ 'th',
26318
+ 'thead',
26319
+ 'time',
26320
+ 'tr',
26321
+ 'track',
26322
+ 'tt',
26323
+ 'u',
26324
+ 'ul',
26325
+ 'var',
26326
+ 'video',
26327
+ 'wbr'
26328
+ ]);
26329
+ var svg$1 = freeze([
26330
+ 'svg',
26331
+ 'a',
26332
+ 'altglyph',
26333
+ 'altglyphdef',
26334
+ 'altglyphitem',
26335
+ 'animatecolor',
26336
+ 'animatemotion',
26337
+ 'animatetransform',
26338
+ 'circle',
26339
+ 'clippath',
26340
+ 'defs',
26341
+ 'desc',
26342
+ 'ellipse',
26343
+ 'filter',
26344
+ 'font',
26345
+ 'g',
26346
+ 'glyph',
26347
+ 'glyphref',
26348
+ 'hkern',
26349
+ 'image',
26350
+ 'line',
26351
+ 'lineargradient',
26352
+ 'marker',
26353
+ 'mask',
26354
+ 'metadata',
26355
+ 'mpath',
26356
+ 'path',
26357
+ 'pattern',
26358
+ 'polygon',
26359
+ 'polyline',
26360
+ 'radialgradient',
26361
+ 'rect',
26362
+ 'stop',
26363
+ 'style',
26364
+ 'switch',
26365
+ 'symbol',
26366
+ 'text',
26367
+ 'textpath',
26368
+ 'title',
26369
+ 'tref',
26370
+ 'tspan',
26371
+ 'view',
26372
+ 'vkern'
26373
+ ]);
26374
+ var svgFilters = freeze([
26375
+ 'feBlend',
26376
+ 'feColorMatrix',
26377
+ 'feComponentTransfer',
26378
+ 'feComposite',
26379
+ 'feConvolveMatrix',
26380
+ 'feDiffuseLighting',
26381
+ 'feDisplacementMap',
26382
+ 'feDistantLight',
26383
+ 'feFlood',
26384
+ 'feFuncA',
26385
+ 'feFuncB',
26386
+ 'feFuncG',
26387
+ 'feFuncR',
26388
+ 'feGaussianBlur',
26389
+ 'feImage',
26390
+ 'feMerge',
26391
+ 'feMergeNode',
26392
+ 'feMorphology',
26393
+ 'feOffset',
26394
+ 'fePointLight',
26395
+ 'feSpecularLighting',
26396
+ 'feSpotLight',
26397
+ 'feTile',
26398
+ 'feTurbulence'
26399
+ ]);
26400
+ var svgDisallowed = freeze([
26401
+ 'animate',
26402
+ 'color-profile',
26403
+ 'cursor',
26404
+ 'discard',
26405
+ 'fedropshadow',
26406
+ 'font-face',
26407
+ 'font-face-format',
26408
+ 'font-face-name',
26409
+ 'font-face-src',
26410
+ 'font-face-uri',
26411
+ 'foreignobject',
26412
+ 'hatch',
26413
+ 'hatchpath',
26414
+ 'mesh',
26415
+ 'meshgradient',
26416
+ 'meshpatch',
26417
+ 'meshrow',
26418
+ 'missing-glyph',
26419
+ 'script',
26420
+ 'set',
26421
+ 'solidcolor',
26422
+ 'unknown',
26423
+ 'use'
26424
+ ]);
26425
+ var mathMl$1 = freeze([
26426
+ 'math',
26427
+ 'menclose',
26428
+ 'merror',
26429
+ 'mfenced',
26430
+ 'mfrac',
26431
+ 'mglyph',
26432
+ 'mi',
26433
+ 'mlabeledtr',
26434
+ 'mmultiscripts',
26435
+ 'mn',
26436
+ 'mo',
26437
+ 'mover',
26438
+ 'mpadded',
26439
+ 'mphantom',
26440
+ 'mroot',
26441
+ 'mrow',
26442
+ 'ms',
26443
+ 'mspace',
26444
+ 'msqrt',
26445
+ 'mstyle',
26446
+ 'msub',
26447
+ 'msup',
26448
+ 'msubsup',
26449
+ 'mtable',
26450
+ 'mtd',
26451
+ 'mtext',
26452
+ 'mtr',
26453
+ 'munder',
26454
+ 'munderover'
26455
+ ]);
26456
+ var mathMlDisallowed = freeze([
26457
+ 'maction',
26458
+ 'maligngroup',
26459
+ 'malignmark',
26460
+ 'mlongdiv',
26461
+ 'mscarries',
26462
+ 'mscarry',
26463
+ 'msgroup',
26464
+ 'mstack',
26465
+ 'msline',
26466
+ 'msrow',
26467
+ 'semantics',
26468
+ 'annotation',
26469
+ 'annotation-xml',
26470
+ 'mprescripts',
26471
+ 'none'
26472
+ ]);
26473
+ var text = freeze(['#text']);
26474
+ var html = freeze([
26475
+ 'accept',
26476
+ 'action',
26477
+ 'align',
26478
+ 'alt',
26479
+ 'autocapitalize',
26480
+ 'autocomplete',
26481
+ 'autopictureinpicture',
26482
+ 'autoplay',
26483
+ 'background',
26484
+ 'bgcolor',
26485
+ 'border',
26486
+ 'capture',
26487
+ 'cellpadding',
26488
+ 'cellspacing',
26489
+ 'checked',
26490
+ 'cite',
26491
+ 'class',
26492
+ 'clear',
26493
+ 'color',
26494
+ 'cols',
26495
+ 'colspan',
26496
+ 'controls',
26497
+ 'controlslist',
26498
+ 'coords',
26499
+ 'crossorigin',
26500
+ 'datetime',
26501
+ 'decoding',
26502
+ 'default',
26503
+ 'dir',
26504
+ 'disabled',
26505
+ 'disablepictureinpicture',
26506
+ 'disableremoteplayback',
26507
+ 'download',
26508
+ 'draggable',
26509
+ 'enctype',
26510
+ 'enterkeyhint',
26511
+ 'face',
26512
+ 'for',
26513
+ 'headers',
26514
+ 'height',
26515
+ 'hidden',
26516
+ 'high',
26517
+ 'href',
26518
+ 'hreflang',
26519
+ 'id',
26520
+ 'inputmode',
26521
+ 'integrity',
26522
+ 'ismap',
26523
+ 'kind',
26524
+ 'label',
26525
+ 'lang',
26526
+ 'list',
26527
+ 'loading',
26528
+ 'loop',
26529
+ 'low',
26530
+ 'max',
26531
+ 'maxlength',
26532
+ 'media',
26533
+ 'method',
26534
+ 'min',
26535
+ 'minlength',
26536
+ 'multiple',
26537
+ 'muted',
26538
+ 'name',
26539
+ 'nonce',
26540
+ 'noshade',
26541
+ 'novalidate',
26542
+ 'nowrap',
26543
+ 'open',
26544
+ 'optimum',
26545
+ 'pattern',
26546
+ 'placeholder',
26547
+ 'playsinline',
26548
+ 'poster',
26549
+ 'preload',
26550
+ 'pubdate',
26551
+ 'radiogroup',
26552
+ 'readonly',
26553
+ 'rel',
26554
+ 'required',
26555
+ 'rev',
26556
+ 'reversed',
26557
+ 'role',
26558
+ 'rows',
26559
+ 'rowspan',
26560
+ 'spellcheck',
26561
+ 'scope',
26562
+ 'selected',
26563
+ 'shape',
26564
+ 'size',
26565
+ 'sizes',
26566
+ 'span',
26567
+ 'srclang',
26568
+ 'start',
26569
+ 'src',
26570
+ 'srcset',
26571
+ 'step',
26572
+ 'style',
26573
+ 'summary',
26574
+ 'tabindex',
26575
+ 'title',
26576
+ 'translate',
26577
+ 'type',
26578
+ 'usemap',
26579
+ 'valign',
26580
+ 'value',
26581
+ 'width',
26582
+ 'xmlns',
26583
+ 'slot'
26584
+ ]);
26585
+ var svg = freeze([
26586
+ 'accent-height',
26587
+ 'accumulate',
26588
+ 'additive',
26589
+ 'alignment-baseline',
26590
+ 'ascent',
26591
+ 'attributename',
26592
+ 'attributetype',
26593
+ 'azimuth',
26594
+ 'basefrequency',
26595
+ 'baseline-shift',
26596
+ 'begin',
26597
+ 'bias',
26598
+ 'by',
26599
+ 'class',
26600
+ 'clip',
26601
+ 'clippathunits',
26602
+ 'clip-path',
26603
+ 'clip-rule',
26604
+ 'color',
26605
+ 'color-interpolation',
26606
+ 'color-interpolation-filters',
26607
+ 'color-profile',
26608
+ 'color-rendering',
26609
+ 'cx',
26610
+ 'cy',
26611
+ 'd',
26612
+ 'dx',
26613
+ 'dy',
26614
+ 'diffuseconstant',
26615
+ 'direction',
26616
+ 'display',
26617
+ 'divisor',
26618
+ 'dur',
26619
+ 'edgemode',
26620
+ 'elevation',
26621
+ 'end',
26622
+ 'fill',
26623
+ 'fill-opacity',
26624
+ 'fill-rule',
26625
+ 'filter',
26626
+ 'filterunits',
26627
+ 'flood-color',
26628
+ 'flood-opacity',
26629
+ 'font-family',
26630
+ 'font-size',
26631
+ 'font-size-adjust',
26632
+ 'font-stretch',
26633
+ 'font-style',
26634
+ 'font-variant',
26635
+ 'font-weight',
26636
+ 'fx',
26637
+ 'fy',
26638
+ 'g1',
26639
+ 'g2',
26640
+ 'glyph-name',
26641
+ 'glyphref',
26642
+ 'gradientunits',
26643
+ 'gradienttransform',
26644
+ 'height',
26645
+ 'href',
26646
+ 'id',
26647
+ 'image-rendering',
26648
+ 'in',
26649
+ 'in2',
26650
+ 'k',
26651
+ 'k1',
26652
+ 'k2',
26653
+ 'k3',
26654
+ 'k4',
26655
+ 'kerning',
26656
+ 'keypoints',
26657
+ 'keysplines',
26658
+ 'keytimes',
26659
+ 'lang',
26660
+ 'lengthadjust',
26661
+ 'letter-spacing',
26662
+ 'kernelmatrix',
26663
+ 'kernelunitlength',
26664
+ 'lighting-color',
26665
+ 'local',
26666
+ 'marker-end',
26667
+ 'marker-mid',
26668
+ 'marker-start',
26669
+ 'markerheight',
26670
+ 'markerunits',
26671
+ 'markerwidth',
26672
+ 'maskcontentunits',
26673
+ 'maskunits',
26674
+ 'max',
26675
+ 'mask',
26676
+ 'media',
26677
+ 'method',
26678
+ 'mode',
26679
+ 'min',
26680
+ 'name',
26681
+ 'numoctaves',
26682
+ 'offset',
26683
+ 'operator',
26684
+ 'opacity',
26685
+ 'order',
26686
+ 'orient',
26687
+ 'orientation',
26688
+ 'origin',
26689
+ 'overflow',
26690
+ 'paint-order',
26691
+ 'path',
26692
+ 'pathlength',
26693
+ 'patterncontentunits',
26694
+ 'patterntransform',
26695
+ 'patternunits',
26696
+ 'points',
26697
+ 'preservealpha',
26698
+ 'preserveaspectratio',
26699
+ 'primitiveunits',
26700
+ 'r',
26701
+ 'rx',
26702
+ 'ry',
26703
+ 'radius',
26704
+ 'refx',
26705
+ 'refy',
26706
+ 'repeatcount',
26707
+ 'repeatdur',
26708
+ 'restart',
26709
+ 'result',
26710
+ 'rotate',
26711
+ 'scale',
26712
+ 'seed',
26713
+ 'shape-rendering',
26714
+ 'specularconstant',
26715
+ 'specularexponent',
26716
+ 'spreadmethod',
26717
+ 'startoffset',
26718
+ 'stddeviation',
26719
+ 'stitchtiles',
26720
+ 'stop-color',
26721
+ 'stop-opacity',
26722
+ 'stroke-dasharray',
26723
+ 'stroke-dashoffset',
26724
+ 'stroke-linecap',
26725
+ 'stroke-linejoin',
26726
+ 'stroke-miterlimit',
26727
+ 'stroke-opacity',
26728
+ 'stroke',
26729
+ 'stroke-width',
26730
+ 'style',
26731
+ 'surfacescale',
26732
+ 'systemlanguage',
26733
+ 'tabindex',
26734
+ 'targetx',
26735
+ 'targety',
26736
+ 'transform',
26737
+ 'transform-origin',
26738
+ 'text-anchor',
26739
+ 'text-decoration',
26740
+ 'text-rendering',
26741
+ 'textlength',
26742
+ 'type',
26743
+ 'u1',
26744
+ 'u2',
26745
+ 'unicode',
26746
+ 'values',
26747
+ 'viewbox',
26748
+ 'visibility',
26749
+ 'version',
26750
+ 'vert-adv-y',
26751
+ 'vert-origin-x',
26752
+ 'vert-origin-y',
26753
+ 'width',
26754
+ 'word-spacing',
26755
+ 'wrap',
26756
+ 'writing-mode',
26757
+ 'xchannelselector',
26758
+ 'ychannelselector',
26759
+ 'x',
26760
+ 'x1',
26761
+ 'x2',
26762
+ 'xmlns',
26763
+ 'y',
26764
+ 'y1',
26765
+ 'y2',
26766
+ 'z',
26767
+ 'zoomandpan'
26768
+ ]);
26769
+ var mathMl = freeze([
26770
+ 'accent',
26771
+ 'accentunder',
26772
+ 'align',
26773
+ 'bevelled',
26774
+ 'close',
26775
+ 'columnsalign',
26776
+ 'columnlines',
26777
+ 'columnspan',
26778
+ 'denomalign',
26779
+ 'depth',
26780
+ 'dir',
26781
+ 'display',
26782
+ 'displaystyle',
26783
+ 'encoding',
26784
+ 'fence',
26785
+ 'frame',
26786
+ 'height',
26787
+ 'href',
26788
+ 'id',
26789
+ 'largeop',
26790
+ 'length',
26791
+ 'linethickness',
26792
+ 'lspace',
26793
+ 'lquote',
26794
+ 'mathbackground',
26795
+ 'mathcolor',
26796
+ 'mathsize',
26797
+ 'mathvariant',
26798
+ 'maxsize',
26799
+ 'minsize',
26800
+ 'movablelimits',
26801
+ 'notation',
26802
+ 'numalign',
26803
+ 'open',
26804
+ 'rowalign',
26805
+ 'rowlines',
26806
+ 'rowspacing',
26807
+ 'rowspan',
26808
+ 'rspace',
26809
+ 'rquote',
26810
+ 'scriptlevel',
26811
+ 'scriptminsize',
26812
+ 'scriptsizemultiplier',
26813
+ 'selection',
26814
+ 'separator',
26815
+ 'separators',
26816
+ 'stretchy',
26817
+ 'subscriptshift',
26818
+ 'supscriptshift',
26819
+ 'symmetric',
26820
+ 'voffset',
26821
+ 'width',
26822
+ 'xmlns'
26823
+ ]);
26824
+ var xml = freeze([
26825
+ 'xlink:href',
26826
+ 'xml:id',
26827
+ 'xlink:title',
26828
+ 'xml:space',
26829
+ 'xmlns:xlink'
26830
+ ]);
26831
+ var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
26832
+ var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
26833
+ var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/);
26834
+ var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
26835
+ var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
26836
+ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
26837
+ var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
26838
+ var DOCTYPE_NAME = seal(/^html$/i);
26839
+ var getGlobal = function getGlobal() {
26840
+ return typeof window === 'undefined' ? null : window;
26841
+ };
26842
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
26843
+ if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
26844
+ return null;
26845
+ }
26846
+ var suffix = null;
26847
+ var ATTR_NAME = 'data-tt-policy-suffix';
26848
+ if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
26849
+ suffix = document.currentScript.getAttribute(ATTR_NAME);
26850
+ }
26851
+ var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
26852
+ try {
26853
+ return trustedTypes.createPolicy(policyName, {
26854
+ createHTML: function createHTML(html) {
26855
+ return html;
26856
+ }
26857
+ });
26858
+ } catch (_) {
26859
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
26860
+ return null;
26861
+ }
26862
+ };
26863
+ function createDOMPurify() {
26864
+ var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
26865
+ var DOMPurify = function DOMPurify(root) {
26866
+ return createDOMPurify(root);
26867
+ };
26868
+ DOMPurify.version = '2.3.8';
26869
+ DOMPurify.removed = [];
26870
+ if (!window || !window.document || window.document.nodeType !== 9) {
26871
+ DOMPurify.isSupported = false;
26872
+ return DOMPurify;
26873
+ }
26874
+ var originalDocument = window.document;
26875
+ var document = window.document;
26876
+ var DocumentFragment = window.DocumentFragment, HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter, _window$NamedNodeMap = window.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window.HTMLFormElement, DOMParser = window.DOMParser, trustedTypes = window.trustedTypes;
26877
+ var ElementPrototype = Element.prototype;
26878
+ var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
26879
+ var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
26880
+ var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
26881
+ var getParentNode = lookupGetter(ElementPrototype, 'parentNode');
26882
+ if (typeof HTMLTemplateElement === 'function') {
26883
+ var template = document.createElement('template');
26884
+ if (template.content && template.content.ownerDocument) {
26885
+ document = template.content.ownerDocument;
26886
+ }
26887
+ }
26888
+ var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
26889
+ var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
26890
+ var _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
26891
+ var importNode = originalDocument.importNode;
26892
+ var documentMode = {};
26893
+ try {
26894
+ documentMode = clone(document).documentMode ? document.documentMode : {};
26895
+ } catch (_) {
26896
+ }
26897
+ var hooks = {};
26898
+ DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;
26899
+ var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE;
26900
+ var IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
26901
+ var ALLOWED_TAGS = null;
26902
+ var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));
26903
+ var ALLOWED_ATTR = null;
26904
+ var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
26905
+ var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
26906
+ tagNameCheck: {
26907
+ writable: true,
26908
+ configurable: false,
26909
+ enumerable: true,
26910
+ value: null
26911
+ },
26912
+ attributeNameCheck: {
26913
+ writable: true,
26914
+ configurable: false,
26915
+ enumerable: true,
26916
+ value: null
26917
+ },
26918
+ allowCustomizedBuiltInElements: {
26919
+ writable: true,
26920
+ configurable: false,
26921
+ enumerable: true,
26922
+ value: false
26923
+ }
26924
+ }));
26925
+ var FORBID_TAGS = null;
26926
+ var FORBID_ATTR = null;
26927
+ var ALLOW_ARIA_ATTR = true;
26928
+ var ALLOW_DATA_ATTR = true;
26929
+ var ALLOW_UNKNOWN_PROTOCOLS = false;
26930
+ var SAFE_FOR_TEMPLATES = false;
26931
+ var WHOLE_DOCUMENT = false;
26932
+ var SET_CONFIG = false;
26933
+ var FORCE_BODY = false;
26934
+ var RETURN_DOM = false;
26935
+ var RETURN_DOM_FRAGMENT = false;
26936
+ var RETURN_TRUSTED_TYPE = false;
26937
+ var SANITIZE_DOM = true;
26938
+ var KEEP_CONTENT = true;
26939
+ var IN_PLACE = false;
26940
+ var USE_PROFILES = {};
26941
+ var FORBID_CONTENTS = null;
26942
+ var DEFAULT_FORBID_CONTENTS = addToSet({}, [
26943
+ 'annotation-xml',
26944
+ 'audio',
26945
+ 'colgroup',
26946
+ 'desc',
26947
+ 'foreignobject',
26948
+ 'head',
26949
+ 'iframe',
26950
+ 'math',
26951
+ 'mi',
26952
+ 'mn',
26953
+ 'mo',
26954
+ 'ms',
26955
+ 'mtext',
26956
+ 'noembed',
26957
+ 'noframes',
26958
+ 'noscript',
26959
+ 'plaintext',
26960
+ 'script',
26961
+ 'style',
26962
+ 'svg',
26963
+ 'template',
26964
+ 'thead',
26965
+ 'title',
26966
+ 'video',
26967
+ 'xmp'
26968
+ ]);
26969
+ var DATA_URI_TAGS = null;
26970
+ var DEFAULT_DATA_URI_TAGS = addToSet({}, [
26971
+ 'audio',
26972
+ 'video',
26973
+ 'img',
26974
+ 'source',
26975
+ 'image',
26976
+ 'track'
26977
+ ]);
26978
+ var URI_SAFE_ATTRIBUTES = null;
26979
+ var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
26980
+ 'alt',
26981
+ 'class',
26982
+ 'for',
26983
+ 'id',
26984
+ 'label',
26985
+ 'name',
26986
+ 'pattern',
26987
+ 'placeholder',
26988
+ 'role',
26989
+ 'summary',
26990
+ 'title',
26991
+ 'value',
26992
+ 'style',
26993
+ 'xmlns'
26994
+ ]);
26995
+ var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
26996
+ var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
26997
+ var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
26998
+ var NAMESPACE = HTML_NAMESPACE;
26999
+ var IS_EMPTY_INPUT = false;
27000
+ var PARSER_MEDIA_TYPE;
27001
+ var SUPPORTED_PARSER_MEDIA_TYPES = [
27002
+ 'application/xhtml+xml',
27003
+ 'text/html'
27004
+ ];
27005
+ var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
27006
+ var transformCaseFunc;
27007
+ var CONFIG = null;
27008
+ var formElement = document.createElement('form');
27009
+ var isRegexOrFunction = function isRegexOrFunction(testValue) {
27010
+ return testValue instanceof RegExp || testValue instanceof Function;
27011
+ };
27012
+ var _parseConfig = function _parseConfig(cfg) {
27013
+ if (CONFIG && CONFIG === cfg) {
27014
+ return;
27015
+ }
27016
+ if (!cfg || _typeof(cfg) !== 'object') {
27017
+ cfg = {};
27018
+ }
27019
+ cfg = clone(cfg);
27020
+ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
27021
+ ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
27022
+ URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES;
27023
+ DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS;
27024
+ FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS;
27025
+ FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};
27026
+ FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};
27027
+ USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
27028
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
27029
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
27030
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
27031
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
27032
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
27033
+ RETURN_DOM = cfg.RETURN_DOM || false;
27034
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
27035
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
27036
+ FORCE_BODY = cfg.FORCE_BODY || false;
27037
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
27038
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
27039
+ IN_PLACE = cfg.IN_PLACE || false;
27040
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;
27041
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
27042
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
27043
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
27044
+ }
27045
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
27046
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
27047
+ }
27048
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
27049
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
27050
+ }
27051
+ PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;
27052
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
27053
+ return x;
27054
+ } : stringToLowerCase;
27055
+ if (SAFE_FOR_TEMPLATES) {
27056
+ ALLOW_DATA_ATTR = false;
27057
+ }
27058
+ if (RETURN_DOM_FRAGMENT) {
27059
+ RETURN_DOM = true;
27060
+ }
27061
+ if (USE_PROFILES) {
27062
+ ALLOWED_TAGS = addToSet({}, _toConsumableArray(text));
27063
+ ALLOWED_ATTR = [];
27064
+ if (USE_PROFILES.html === true) {
27065
+ addToSet(ALLOWED_TAGS, html$1);
27066
+ addToSet(ALLOWED_ATTR, html);
27067
+ }
27068
+ if (USE_PROFILES.svg === true) {
27069
+ addToSet(ALLOWED_TAGS, svg$1);
27070
+ addToSet(ALLOWED_ATTR, svg);
27071
+ addToSet(ALLOWED_ATTR, xml);
27072
+ }
27073
+ if (USE_PROFILES.svgFilters === true) {
27074
+ addToSet(ALLOWED_TAGS, svgFilters);
27075
+ addToSet(ALLOWED_ATTR, svg);
27076
+ addToSet(ALLOWED_ATTR, xml);
27077
+ }
27078
+ if (USE_PROFILES.mathMl === true) {
27079
+ addToSet(ALLOWED_TAGS, mathMl$1);
27080
+ addToSet(ALLOWED_ATTR, mathMl);
27081
+ addToSet(ALLOWED_ATTR, xml);
27082
+ }
27083
+ }
27084
+ if (cfg.ADD_TAGS) {
27085
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
27086
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
27087
+ }
27088
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
27089
+ }
27090
+ if (cfg.ADD_ATTR) {
27091
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
27092
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
27093
+ }
27094
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
27095
+ }
27096
+ if (cfg.ADD_URI_SAFE_ATTR) {
27097
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
27098
+ }
27099
+ if (cfg.FORBID_CONTENTS) {
27100
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
27101
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
27102
+ }
27103
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS);
27104
+ }
27105
+ if (KEEP_CONTENT) {
27106
+ ALLOWED_TAGS['#text'] = true;
27107
+ }
27108
+ if (WHOLE_DOCUMENT) {
27109
+ addToSet(ALLOWED_TAGS, [
27110
+ 'html',
27111
+ 'head',
27112
+ 'body'
27113
+ ]);
27114
+ }
27115
+ if (ALLOWED_TAGS.table) {
27116
+ addToSet(ALLOWED_TAGS, ['tbody']);
27117
+ delete FORBID_TAGS.tbody;
27118
+ }
27119
+ if (freeze) {
27120
+ freeze(cfg);
27121
+ }
27122
+ CONFIG = cfg;
27123
+ };
27124
+ var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [
27125
+ 'mi',
27126
+ 'mo',
27127
+ 'mn',
27128
+ 'ms',
27129
+ 'mtext'
27130
+ ]);
27131
+ var HTML_INTEGRATION_POINTS = addToSet({}, [
27132
+ 'foreignobject',
27133
+ 'desc',
27134
+ 'title',
27135
+ 'annotation-xml'
27136
+ ]);
27137
+ var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
27138
+ 'title',
27139
+ 'style',
27140
+ 'font',
27141
+ 'a',
27142
+ 'script'
27143
+ ]);
27144
+ var ALL_SVG_TAGS = addToSet({}, svg$1);
27145
+ addToSet(ALL_SVG_TAGS, svgFilters);
27146
+ addToSet(ALL_SVG_TAGS, svgDisallowed);
27147
+ var ALL_MATHML_TAGS = addToSet({}, mathMl$1);
27148
+ addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
27149
+ var _checkValidNamespace = function _checkValidNamespace(element) {
27150
+ var parent = getParentNode(element);
27151
+ if (!parent || !parent.tagName) {
27152
+ parent = {
27153
+ namespaceURI: HTML_NAMESPACE,
27154
+ tagName: 'template'
27155
+ };
27156
+ }
27157
+ var tagName = stringToLowerCase(element.tagName);
27158
+ var parentTagName = stringToLowerCase(parent.tagName);
27159
+ if (element.namespaceURI === SVG_NAMESPACE) {
27160
+ if (parent.namespaceURI === HTML_NAMESPACE) {
27161
+ return tagName === 'svg';
27162
+ }
27163
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
27164
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
27165
+ }
27166
+ return Boolean(ALL_SVG_TAGS[tagName]);
27167
+ }
27168
+ if (element.namespaceURI === MATHML_NAMESPACE) {
27169
+ if (parent.namespaceURI === HTML_NAMESPACE) {
27170
+ return tagName === 'math';
27171
+ }
27172
+ if (parent.namespaceURI === SVG_NAMESPACE) {
27173
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
27174
+ }
27175
+ return Boolean(ALL_MATHML_TAGS[tagName]);
27176
+ }
27177
+ if (element.namespaceURI === HTML_NAMESPACE) {
27178
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
27179
+ return false;
27180
+ }
27181
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
27182
+ return false;
27183
+ }
27184
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
27185
+ }
27186
+ return false;
27187
+ };
27188
+ var _forceRemove = function _forceRemove(node) {
27189
+ arrayPush(DOMPurify.removed, { element: node });
27190
+ try {
27191
+ node.parentNode.removeChild(node);
27192
+ } catch (_) {
27193
+ try {
27194
+ node.outerHTML = emptyHTML;
27195
+ } catch (_) {
27196
+ node.remove();
27197
+ }
27198
+ }
27199
+ };
27200
+ var _removeAttribute = function _removeAttribute(name, node) {
27201
+ try {
27202
+ arrayPush(DOMPurify.removed, {
27203
+ attribute: node.getAttributeNode(name),
27204
+ from: node
27205
+ });
27206
+ } catch (_) {
27207
+ arrayPush(DOMPurify.removed, {
27208
+ attribute: null,
27209
+ from: node
27210
+ });
27211
+ }
27212
+ node.removeAttribute(name);
27213
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
27214
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
27215
+ try {
27216
+ _forceRemove(node);
27217
+ } catch (_) {
27218
+ }
27219
+ } else {
27220
+ try {
27221
+ node.setAttribute(name, '');
27222
+ } catch (_) {
27223
+ }
27224
+ }
27225
+ }
27226
+ };
27227
+ var _initDocument = function _initDocument(dirty) {
27228
+ var doc;
27229
+ var leadingWhitespace;
27230
+ if (FORCE_BODY) {
27231
+ dirty = '<remove></remove>' + dirty;
27232
+ } else {
27233
+ var matches = stringMatch(dirty, /^[\r\n\t ]+/);
27234
+ leadingWhitespace = matches && matches[0];
27235
+ }
27236
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {
27237
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
27238
+ }
27239
+ var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
27240
+ if (NAMESPACE === HTML_NAMESPACE) {
27241
+ try {
27242
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
27243
+ } catch (_) {
27244
+ }
27245
+ }
27246
+ if (!doc || !doc.documentElement) {
27247
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
27248
+ try {
27249
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload;
27250
+ } catch (_) {
27251
+ }
27252
+ }
27253
+ var body = doc.body || doc.documentElement;
27254
+ if (dirty && leadingWhitespace) {
27255
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
27256
+ }
27257
+ if (NAMESPACE === HTML_NAMESPACE) {
27258
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
27259
+ }
27260
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
27261
+ };
27262
+ var _createIterator = function _createIterator(root) {
27263
+ return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
27264
+ };
27265
+ var _isClobbered = function _isClobbered(elm) {
27266
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function');
27267
+ };
27268
+ var _isNode = function _isNode(object) {
27269
+ return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
27270
+ };
27271
+ var _executeHook = function _executeHook(entryPoint, currentNode, data) {
27272
+ if (!hooks[entryPoint]) {
27273
+ return;
27274
+ }
27275
+ arrayForEach(hooks[entryPoint], function (hook) {
27276
+ hook.call(DOMPurify, currentNode, data, CONFIG);
27277
+ });
27278
+ };
27279
+ var _sanitizeElements = function _sanitizeElements(currentNode) {
27280
+ var content;
27281
+ _executeHook('beforeSanitizeElements', currentNode, null);
27282
+ if (_isClobbered(currentNode)) {
27283
+ _forceRemove(currentNode);
27284
+ return true;
27285
+ }
27286
+ if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) {
27287
+ _forceRemove(currentNode);
27288
+ return true;
27289
+ }
27290
+ var tagName = transformCaseFunc(currentNode.nodeName);
27291
+ _executeHook('uponSanitizeElement', currentNode, {
27292
+ tagName: tagName,
27293
+ allowedTags: ALLOWED_TAGS
27294
+ });
27295
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
27296
+ _forceRemove(currentNode);
27297
+ return true;
27298
+ }
27299
+ if (tagName === 'select' && regExpTest(/<template/i, currentNode.innerHTML)) {
27300
+ _forceRemove(currentNode);
27301
+ return true;
27302
+ }
27303
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
27304
+ if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
27305
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName))
27306
+ return false;
27307
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName))
27308
+ return false;
27309
+ }
27310
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
27311
+ var parentNode = getParentNode(currentNode) || currentNode.parentNode;
27312
+ var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
27313
+ if (childNodes && parentNode) {
27314
+ var childCount = childNodes.length;
27315
+ for (var i = childCount - 1; i >= 0; --i) {
27316
+ parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
27317
+ }
27318
+ }
27319
+ }
27320
+ _forceRemove(currentNode);
27321
+ return true;
27322
+ }
27323
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
27324
+ _forceRemove(currentNode);
27325
+ return true;
27326
+ }
27327
+ if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
27328
+ _forceRemove(currentNode);
27329
+ return true;
27330
+ }
27331
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
27332
+ content = currentNode.textContent;
27333
+ content = stringReplace(content, MUSTACHE_EXPR$1, ' ');
27334
+ content = stringReplace(content, ERB_EXPR$1, ' ');
27335
+ if (currentNode.textContent !== content) {
27336
+ arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
27337
+ currentNode.textContent = content;
27338
+ }
27339
+ }
27340
+ _executeHook('afterSanitizeElements', currentNode, null);
27341
+ return false;
27342
+ };
27343
+ var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
27344
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
27345
+ return false;
27346
+ }
27347
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName));
27348
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName));
27349
+ else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
27350
+ if (_basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)));
27351
+ else {
27352
+ return false;
27353
+ }
27354
+ } else if (URI_SAFE_ATTRIBUTES[lcName]);
27355
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, '')));
27356
+ else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]);
27357
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, '')));
27358
+ else if (!value);
27359
+ else {
27360
+ return false;
27361
+ }
27362
+ return true;
27363
+ };
27364
+ var _basicCustomElementTest = function _basicCustomElementTest(tagName) {
27365
+ return tagName.indexOf('-') > 0;
27366
+ };
27367
+ var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
27368
+ var attr;
27369
+ var value;
27370
+ var lcName;
27371
+ var l;
27372
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
27373
+ var attributes = currentNode.attributes;
27374
+ if (!attributes) {
27375
+ return;
27376
+ }
27377
+ var hookEvent = {
27378
+ attrName: '',
27379
+ attrValue: '',
27380
+ keepAttr: true,
27381
+ allowedAttributes: ALLOWED_ATTR
27382
+ };
27383
+ l = attributes.length;
27384
+ while (l--) {
27385
+ attr = attributes[l];
27386
+ var _attr = attr, name = _attr.name, namespaceURI = _attr.namespaceURI;
27387
+ value = name === 'value' ? attr.value : stringTrim(attr.value);
27388
+ lcName = transformCaseFunc(name);
27389
+ var initValue = value;
27390
+ hookEvent.attrName = lcName;
27391
+ hookEvent.attrValue = value;
27392
+ hookEvent.keepAttr = true;
27393
+ hookEvent.forceKeepAttr = undefined;
27394
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
27395
+ value = hookEvent.attrValue;
27396
+ if (hookEvent.forceKeepAttr) {
27397
+ continue;
27398
+ }
27399
+ if (!hookEvent.keepAttr) {
27400
+ _removeAttribute(name, currentNode);
27401
+ continue;
27402
+ }
27403
+ if (regExpTest(/\/>/i, value)) {
27404
+ _removeAttribute(name, currentNode);
27405
+ continue;
27406
+ }
27407
+ if (SAFE_FOR_TEMPLATES) {
27408
+ value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
27409
+ value = stringReplace(value, ERB_EXPR$1, ' ');
27410
+ }
27411
+ var lcTag = transformCaseFunc(currentNode.nodeName);
27412
+ if (!_isValidAttribute(lcTag, lcName, value)) {
27413
+ _removeAttribute(name, currentNode);
27414
+ continue;
27415
+ }
27416
+ if (value !== initValue) {
27417
+ try {
27418
+ if (namespaceURI) {
27419
+ currentNode.setAttributeNS(namespaceURI, name, value);
27420
+ } else {
27421
+ currentNode.setAttribute(name, value);
27422
+ }
27423
+ } catch (_) {
27424
+ _removeAttribute(name, currentNode);
27425
+ }
27426
+ }
27427
+ }
27428
+ _executeHook('afterSanitizeAttributes', currentNode, null);
27429
+ };
27430
+ var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
27431
+ var shadowNode;
27432
+ var shadowIterator = _createIterator(fragment);
27433
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
27434
+ while (shadowNode = shadowIterator.nextNode()) {
27435
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
27436
+ if (_sanitizeElements(shadowNode)) {
27437
+ continue;
27438
+ }
27439
+ if (shadowNode.content instanceof DocumentFragment) {
27440
+ _sanitizeShadowDOM(shadowNode.content);
27441
+ }
27442
+ _sanitizeAttributes(shadowNode);
27443
+ }
27444
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
27445
+ };
27446
+ DOMPurify.sanitize = function (dirty, cfg) {
27447
+ var body;
27448
+ var importedNode;
27449
+ var currentNode;
27450
+ var oldNode;
27451
+ var returnNode;
27452
+ IS_EMPTY_INPUT = !dirty;
27453
+ if (IS_EMPTY_INPUT) {
27454
+ dirty = '<!-->';
27455
+ }
27456
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
27457
+ if (typeof dirty.toString !== 'function') {
27458
+ throw typeErrorCreate('toString is not a function');
27459
+ } else {
27460
+ dirty = dirty.toString();
27461
+ if (typeof dirty !== 'string') {
27462
+ throw typeErrorCreate('dirty is not a string, aborting');
27463
+ }
27464
+ }
27465
+ }
27466
+ if (!DOMPurify.isSupported) {
27467
+ if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
27468
+ if (typeof dirty === 'string') {
27469
+ return window.toStaticHTML(dirty);
27470
+ }
27471
+ if (_isNode(dirty)) {
27472
+ return window.toStaticHTML(dirty.outerHTML);
27473
+ }
27474
+ }
27475
+ return dirty;
27476
+ }
27477
+ if (!SET_CONFIG) {
27478
+ _parseConfig(cfg);
27479
+ }
27480
+ DOMPurify.removed = [];
27481
+ if (typeof dirty === 'string') {
27482
+ IN_PLACE = false;
27483
+ }
27484
+ if (IN_PLACE) {
27485
+ if (dirty.nodeName) {
27486
+ var tagName = transformCaseFunc(dirty.nodeName);
27487
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
27488
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
27489
+ }
27490
+ }
27491
+ } else if (dirty instanceof Node) {
27492
+ body = _initDocument('<!---->');
27493
+ importedNode = body.ownerDocument.importNode(dirty, true);
27494
+ if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
27495
+ body = importedNode;
27496
+ } else if (importedNode.nodeName === 'HTML') {
27497
+ body = importedNode;
27498
+ } else {
27499
+ body.appendChild(importedNode);
27500
+ }
27501
+ } else {
27502
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf('<') === -1) {
27503
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
27504
+ }
27505
+ body = _initDocument(dirty);
27506
+ if (!body) {
27507
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
27508
+ }
27509
+ }
27510
+ if (body && FORCE_BODY) {
27511
+ _forceRemove(body.firstChild);
27512
+ }
27513
+ var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
27514
+ while (currentNode = nodeIterator.nextNode()) {
27515
+ if (currentNode.nodeType === 3 && currentNode === oldNode) {
27516
+ continue;
27517
+ }
27518
+ if (_sanitizeElements(currentNode)) {
27519
+ continue;
27520
+ }
27521
+ if (currentNode.content instanceof DocumentFragment) {
27522
+ _sanitizeShadowDOM(currentNode.content);
27523
+ }
27524
+ _sanitizeAttributes(currentNode);
27525
+ oldNode = currentNode;
27526
+ }
27527
+ oldNode = null;
27528
+ if (IN_PLACE) {
27529
+ return dirty;
27530
+ }
27531
+ if (RETURN_DOM) {
27532
+ if (RETURN_DOM_FRAGMENT) {
27533
+ returnNode = createDocumentFragment.call(body.ownerDocument);
27534
+ while (body.firstChild) {
27535
+ returnNode.appendChild(body.firstChild);
27536
+ }
27537
+ } else {
27538
+ returnNode = body;
27539
+ }
27540
+ if (ALLOWED_ATTR.shadowroot) {
27541
+ returnNode = importNode.call(originalDocument, returnNode, true);
27542
+ }
27543
+ return returnNode;
27544
+ }
27545
+ var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
27546
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
27547
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
27548
+ }
27549
+ if (SAFE_FOR_TEMPLATES) {
27550
+ serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, ' ');
27551
+ serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, ' ');
27552
+ }
27553
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
27554
+ };
27555
+ DOMPurify.setConfig = function (cfg) {
27556
+ _parseConfig(cfg);
27557
+ SET_CONFIG = true;
27558
+ };
27559
+ DOMPurify.clearConfig = function () {
27560
+ CONFIG = null;
27561
+ SET_CONFIG = false;
27562
+ };
27563
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
27564
+ if (!CONFIG) {
27565
+ _parseConfig({});
27566
+ }
27567
+ var lcTag = transformCaseFunc(tag);
27568
+ var lcName = transformCaseFunc(attr);
27569
+ return _isValidAttribute(lcTag, lcName, value);
27570
+ };
27571
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
27572
+ if (typeof hookFunction !== 'function') {
27573
+ return;
27574
+ }
27575
+ hooks[entryPoint] = hooks[entryPoint] || [];
27576
+ arrayPush(hooks[entryPoint], hookFunction);
27577
+ };
27578
+ DOMPurify.removeHook = function (entryPoint) {
27579
+ if (hooks[entryPoint]) {
27580
+ return arrayPop(hooks[entryPoint]);
27581
+ }
27582
+ };
27583
+ DOMPurify.removeHooks = function (entryPoint) {
27584
+ if (hooks[entryPoint]) {
27585
+ hooks[entryPoint] = [];
27586
+ }
27587
+ };
27588
+ DOMPurify.removeAllHooks = function () {
27589
+ hooks = {};
27590
+ };
27591
+ return DOMPurify;
27592
+ }
27593
+ var purify = createDOMPurify();
27594
+
27595
+ const sanitizeHtmlString = html => purify().sanitize(html);
27596
+
25583
27597
  const isTouch = global$5.deviceType.isTouch();
25584
27598
  const hiddenHeader = (title, close) => ({
25585
27599
  dom: {
@@ -25626,7 +27640,7 @@
25626
27640
  tag: 'div',
25627
27641
  classes: ['tox-dialog__body-content']
25628
27642
  },
25629
- components: [{ dom: fromHtml(`<p>${ providersBackstage.translate(message) }</p>`) }]
27643
+ components: [{ dom: fromHtml(`<p>${ sanitizeHtmlString(providersBackstage.translate(message)) }</p>`) }]
25630
27644
  }]
25631
27645
  });
25632
27646
  const pFooter = buttons => ModalDialog.parts.footer({
@@ -25747,7 +27761,7 @@
25747
27761
  }
25748
27762
  });
25749
27763
  const renderTitle = (spec, dialogId, titleId, providersBackstage) => {
25750
- const renderComponents = data => [text$1(providersBackstage.translate(data.title))];
27764
+ const renderComponents = data => [text$2(providersBackstage.translate(data.title))];
25751
27765
  return {
25752
27766
  dom: {
25753
27767
  tag: 'div',
@@ -26534,16 +28548,15 @@
26534
28548
  }
26535
28549
  };
26536
28550
  const setup = extras => {
26537
- const backstage = extras.backstage;
26538
28551
  const editor = extras.editor;
26539
28552
  const isStickyToolbar$1 = isStickyToolbar(editor);
26540
- const alertDialog = setup$2(backstage);
26541
- const confirmDialog = setup$1(backstage);
28553
+ const alertDialog = setup$2(extras.backstages.dialog);
28554
+ const confirmDialog = setup$1(extras.backstages.dialog);
26542
28555
  const open = (config, params, closeWindow) => {
26543
28556
  if (params !== undefined && params.inline === 'toolbar') {
26544
- return openInlineDialog(config, backstage.shared.anchors.inlineDialog(), closeWindow, params.ariaAttrs);
28557
+ return openInlineDialog(config, extras.backstages.popup.shared.anchors.inlineDialog(), closeWindow, params.ariaAttrs);
26545
28558
  } else if (params !== undefined && params.inline === 'cursor') {
26546
- return openInlineDialog(config, backstage.shared.anchors.cursor(), closeWindow, params.ariaAttrs);
28559
+ return openInlineDialog(config, extras.backstages.popup.shared.anchors.cursor(), closeWindow, params.ariaAttrs);
26547
28560
  } else {
26548
28561
  return openModalDialog(config, closeWindow);
26549
28562
  }
@@ -26556,7 +28569,7 @@
26556
28569
  ModalDialog.hide(dialog.dialog);
26557
28570
  closeWindow(dialog.instanceApi);
26558
28571
  }
26559
- }, editor, backstage);
28572
+ }, editor, extras.backstages.dialog);
26560
28573
  ModalDialog.show(dialog.dialog);
26561
28574
  return dialog.instanceApi;
26562
28575
  };
@@ -26576,7 +28589,7 @@
26576
28589
  ModalDialog.hide(dialog.dialog);
26577
28590
  closeWindow(dialog.instanceApi);
26578
28591
  }
26579
- }, backstage);
28592
+ }, extras.backstages.dialog);
26580
28593
  ModalDialog.show(dialog.dialog);
26581
28594
  dialog.instanceApi.setData(initialData);
26582
28595
  return dialog.instanceApi;
@@ -26587,7 +28600,7 @@
26587
28600
  const factory = (contents, internalInitialData, dataValidator) => {
26588
28601
  const initialData = validateData(internalInitialData, dataValidator);
26589
28602
  const inlineDialog = value$2();
26590
- const isToolbarLocationTop = backstage.shared.header.isPositionedAtTop();
28603
+ const isToolbarLocationTop = extras.backstages.popup.shared.header.isPositionedAtTop();
26591
28604
  const dialogInit = {
26592
28605
  dataValidator,
26593
28606
  initialData,
@@ -26605,9 +28618,9 @@
26605
28618
  inlineDialog.clear();
26606
28619
  closeWindow(dialogUi.instanceApi);
26607
28620
  }
26608
- }, backstage, ariaAttrs);
28621
+ }, extras.backstages.popup, ariaAttrs);
26609
28622
  const inlineDialogComp = build$1(InlineView.sketch({
26610
- lazySink: backstage.shared.getSink,
28623
+ lazySink: extras.backstages.popup.shared.getSink,
26611
28624
  dom: {
26612
28625
  tag: 'div',
26613
28626
  classes: []
@@ -26660,16 +28673,20 @@
26660
28673
  var Theme = () => {
26661
28674
  global$a.add('silver', editor => {
26662
28675
  registerOptions(editor);
26663
- const {getUiMothership, backstage, renderUI} = setup$3(editor);
26664
- Autocompleter.register(editor, backstage.shared);
28676
+ const {dialogs, popups, renderUI} = setup$3(editor);
28677
+ Autocompleter.register(editor, popups.backstage.shared);
26665
28678
  const windowMgr = setup({
26666
28679
  editor,
26667
- backstage
28680
+ backstages: {
28681
+ popup: popups.backstage,
28682
+ dialog: dialogs.backstage
28683
+ }
26668
28684
  });
28685
+ const getNotificationManagerImpl = () => NotificationManagerImpl(editor, { backstage: popups.backstage }, popups.getMothership());
26669
28686
  return {
26670
28687
  renderUI,
26671
28688
  getWindowManagerImpl: constant$1(windowMgr),
26672
- getNotificationManagerImpl: () => NotificationManagerImpl(editor, { backstage }, getUiMothership())
28689
+ getNotificationManagerImpl
26673
28690
  };
26674
28691
  });
26675
28692
  };