Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
/**
2
 * TinyMCE version 6.8.3 (2024-02-08)
3
 */
4
 
5
(function () {
6
    'use strict';
7
 
8
    const Cell = initial => {
9
      let value = initial;
10
      const get = () => {
11
        return value;
12
      };
13
      const set = v => {
14
        value = v;
15
      };
16
      return {
17
        get,
18
        set
19
      };
20
    };
21
 
22
    var global$4 = tinymce.util.Tools.resolve('tinymce.PluginManager');
23
 
24
    let unique = 0;
25
    const generate = prefix => {
26
      const date = new Date();
27
      const time = date.getTime();
28
      const random = Math.floor(Math.random() * 1000000000);
29
      unique++;
30
      return prefix + '_' + random + unique + String(time);
31
    };
32
 
33
    const get$1 = customTabs => {
34
      const addTab = spec => {
35
        var _a;
36
        const name = (_a = spec.name) !== null && _a !== void 0 ? _a : generate('tab-name');
37
        const currentCustomTabs = customTabs.get();
38
        currentCustomTabs[name] = spec;
39
        customTabs.set(currentCustomTabs);
40
      };
41
      return { addTab };
42
    };
43
 
44
    const register$2 = (editor, dialogOpener) => {
45
      editor.addCommand('mceHelp', dialogOpener);
46
    };
47
 
48
    const option = name => editor => editor.options.get(name);
49
    const register$1 = editor => {
50
      const registerOption = editor.options.register;
51
      registerOption('help_tabs', { processor: 'array' });
52
    };
53
    const getHelpTabs = option('help_tabs');
54
    const getForcedPlugins = option('forced_plugins');
55
 
56
    const register = (editor, dialogOpener) => {
57
      editor.ui.registry.addButton('help', {
58
        icon: 'help',
59
        tooltip: 'Help',
60
        onAction: dialogOpener
61
      });
62
      editor.ui.registry.addMenuItem('help', {
63
        text: 'Help',
64
        icon: 'help',
65
        shortcut: 'Alt+0',
66
        onAction: dialogOpener
67
      });
68
    };
69
 
70
    const hasProto = (v, constructor, predicate) => {
71
      var _a;
72
      if (predicate(v, constructor.prototype)) {
73
        return true;
74
      } else {
75
        return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
76
      }
77
    };
78
    const typeOf = x => {
79
      const t = typeof x;
80
      if (x === null) {
81
        return 'null';
82
      } else if (t === 'object' && Array.isArray(x)) {
83
        return 'array';
84
      } else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
85
        return 'string';
86
      } else {
87
        return t;
88
      }
89
    };
90
    const isType = type => value => typeOf(value) === type;
91
    const isSimpleType = type => value => typeof value === type;
92
    const eq = t => a => t === a;
93
    const isString = isType('string');
94
    const isUndefined = eq(undefined);
95
    const isNullable = a => a === null || a === undefined;
96
    const isNonNullable = a => !isNullable(a);
97
    const isFunction = isSimpleType('function');
98
 
99
    const constant = value => {
100
      return () => {
101
        return value;
102
      };
103
    };
104
    const never = constant(false);
105
 
106
    class Optional {
107
      constructor(tag, value) {
108
        this.tag = tag;
109
        this.value = value;
110
      }
111
      static some(value) {
112
        return new Optional(true, value);
113
      }
114
      static none() {
115
        return Optional.singletonNone;
116
      }
117
      fold(onNone, onSome) {
118
        if (this.tag) {
119
          return onSome(this.value);
120
        } else {
121
          return onNone();
122
        }
123
      }
124
      isSome() {
125
        return this.tag;
126
      }
127
      isNone() {
128
        return !this.tag;
129
      }
130
      map(mapper) {
131
        if (this.tag) {
132
          return Optional.some(mapper(this.value));
133
        } else {
134
          return Optional.none();
135
        }
136
      }
137
      bind(binder) {
138
        if (this.tag) {
139
          return binder(this.value);
140
        } else {
141
          return Optional.none();
142
        }
143
      }
144
      exists(predicate) {
145
        return this.tag && predicate(this.value);
146
      }
147
      forall(predicate) {
148
        return !this.tag || predicate(this.value);
149
      }
150
      filter(predicate) {
151
        if (!this.tag || predicate(this.value)) {
152
          return this;
153
        } else {
154
          return Optional.none();
155
        }
156
      }
157
      getOr(replacement) {
158
        return this.tag ? this.value : replacement;
159
      }
160
      or(replacement) {
161
        return this.tag ? this : replacement;
162
      }
163
      getOrThunk(thunk) {
164
        return this.tag ? this.value : thunk();
165
      }
166
      orThunk(thunk) {
167
        return this.tag ? this : thunk();
168
      }
169
      getOrDie(message) {
170
        if (!this.tag) {
171
          throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
172
        } else {
173
          return this.value;
174
        }
175
      }
176
      static from(value) {
177
        return isNonNullable(value) ? Optional.some(value) : Optional.none();
178
      }
179
      getOrNull() {
180
        return this.tag ? this.value : null;
181
      }
182
      getOrUndefined() {
183
        return this.value;
184
      }
185
      each(worker) {
186
        if (this.tag) {
187
          worker(this.value);
188
        }
189
      }
190
      toArray() {
191
        return this.tag ? [this.value] : [];
192
      }
193
      toString() {
194
        return this.tag ? `some(${ this.value })` : 'none()';
195
      }
196
    }
197
    Optional.singletonNone = new Optional(false);
198
 
199
    const nativeSlice = Array.prototype.slice;
200
    const nativeIndexOf = Array.prototype.indexOf;
201
    const rawIndexOf = (ts, t) => nativeIndexOf.call(ts, t);
202
    const contains = (xs, x) => rawIndexOf(xs, x) > -1;
203
    const map = (xs, f) => {
204
      const len = xs.length;
205
      const r = new Array(len);
206
      for (let i = 0; i < len; i++) {
207
        const x = xs[i];
208
        r[i] = f(x, i);
209
      }
210
      return r;
211
    };
212
    const filter = (xs, pred) => {
213
      const r = [];
214
      for (let i = 0, len = xs.length; i < len; i++) {
215
        const x = xs[i];
216
        if (pred(x, i)) {
217
          r.push(x);
218
        }
219
      }
220
      return r;
221
    };
222
    const findUntil = (xs, pred, until) => {
223
      for (let i = 0, len = xs.length; i < len; i++) {
224
        const x = xs[i];
225
        if (pred(x, i)) {
226
          return Optional.some(x);
227
        } else if (until(x, i)) {
228
          break;
229
        }
230
      }
231
      return Optional.none();
232
    };
233
    const find = (xs, pred) => {
234
      return findUntil(xs, pred, never);
235
    };
236
    const sort = (xs, comparator) => {
237
      const copy = nativeSlice.call(xs, 0);
238
      copy.sort(comparator);
239
      return copy;
240
    };
241
 
242
    const keys = Object.keys;
243
    const hasOwnProperty = Object.hasOwnProperty;
244
    const get = (obj, key) => {
245
      return has(obj, key) ? Optional.from(obj[key]) : Optional.none();
246
    };
247
    const has = (obj, key) => hasOwnProperty.call(obj, key);
248
 
249
    const cat = arr => {
250
      const r = [];
251
      const push = x => {
252
        r.push(x);
253
      };
254
      for (let i = 0; i < arr.length; i++) {
255
        arr[i].each(push);
256
      }
257
      return r;
258
    };
259
 
260
    var global$3 = tinymce.util.Tools.resolve('tinymce.Resource');
261
 
262
    var global$2 = tinymce.util.Tools.resolve('tinymce.util.I18n');
263
 
264
    const pLoadHtmlByLangCode = (baseUrl, langCode) => global$3.load(`tinymce.html-i18n.help-keynav.${ langCode }`, `${ baseUrl }/js/i18n/keynav/${ langCode }.js`);
265
    const pLoadI18nHtml = baseUrl => pLoadHtmlByLangCode(baseUrl, global$2.getCode()).catch(() => pLoadHtmlByLangCode(baseUrl, 'en'));
266
    const initI18nLoad = (editor, baseUrl) => {
267
      editor.on('init', () => {
268
        pLoadI18nHtml(baseUrl);
269
      });
270
    };
271
 
272
    const pTab = async pluginUrl => {
273
      const body = {
274
        type: 'htmlpanel',
275
        presets: 'document',
276
        html: await pLoadI18nHtml(pluginUrl)
277
      };
278
      return {
279
        name: 'keyboardnav',
280
        title: 'Keyboard Navigation',
281
        items: [body]
282
      };
283
    };
284
 
285
    var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
286
 
287
    const convertText = source => {
288
      const isMac = global$1.os.isMacOS() || global$1.os.isiOS();
289
      const mac = {
290
        alt: '&#x2325;',
291
        ctrl: '&#x2303;',
292
        shift: '&#x21E7;',
293
        meta: '&#x2318;',
294
        access: '&#x2303;&#x2325;'
295
      };
296
      const other = {
297
        meta: 'Ctrl ',
298
        access: 'Shift + Alt '
299
      };
300
      const replace = isMac ? mac : other;
301
      const shortcut = source.split('+');
302
      const updated = map(shortcut, segment => {
303
        const search = segment.toLowerCase().trim();
304
        return has(replace, search) ? replace[search] : segment;
305
      });
306
      return isMac ? updated.join('').replace(/\s/, '') : updated.join('+');
307
    };
308
 
309
    const shortcuts = [
310
      {
311
        shortcuts: ['Meta + B'],
312
        action: 'Bold'
313
      },
314
      {
315
        shortcuts: ['Meta + I'],
316
        action: 'Italic'
317
      },
318
      {
319
        shortcuts: ['Meta + U'],
320
        action: 'Underline'
321
      },
322
      {
323
        shortcuts: ['Meta + A'],
324
        action: 'Select all'
325
      },
326
      {
327
        shortcuts: [
328
          'Meta + Y',
329
          'Meta + Shift + Z'
330
        ],
331
        action: 'Redo'
332
      },
333
      {
334
        shortcuts: ['Meta + Z'],
335
        action: 'Undo'
336
      },
337
      {
338
        shortcuts: ['Access + 1'],
339
        action: 'Heading 1'
340
      },
341
      {
342
        shortcuts: ['Access + 2'],
343
        action: 'Heading 2'
344
      },
345
      {
346
        shortcuts: ['Access + 3'],
347
        action: 'Heading 3'
348
      },
349
      {
350
        shortcuts: ['Access + 4'],
351
        action: 'Heading 4'
352
      },
353
      {
354
        shortcuts: ['Access + 5'],
355
        action: 'Heading 5'
356
      },
357
      {
358
        shortcuts: ['Access + 6'],
359
        action: 'Heading 6'
360
      },
361
      {
362
        shortcuts: ['Access + 7'],
363
        action: 'Paragraph'
364
      },
365
      {
366
        shortcuts: ['Access + 8'],
367
        action: 'Div'
368
      },
369
      {
370
        shortcuts: ['Access + 9'],
371
        action: 'Address'
372
      },
373
      {
374
        shortcuts: ['Alt + 0'],
375
        action: 'Open help dialog'
376
      },
377
      {
378
        shortcuts: ['Alt + F9'],
379
        action: 'Focus to menubar'
380
      },
381
      {
382
        shortcuts: ['Alt + F10'],
383
        action: 'Focus to toolbar'
384
      },
385
      {
386
        shortcuts: ['Alt + F11'],
387
        action: 'Focus to element path'
388
      },
389
      {
390
        shortcuts: ['Ctrl + F9'],
391
        action: 'Focus to contextual toolbar'
392
      },
393
      {
394
        shortcuts: ['Shift + Enter'],
395
        action: 'Open popup menu for split buttons'
396
      },
397
      {
398
        shortcuts: ['Meta + K'],
399
        action: 'Insert link (if link plugin activated)'
400
      },
401
      {
402
        shortcuts: ['Meta + S'],
403
        action: 'Save (if save plugin activated)'
404
      },
405
      {
406
        shortcuts: ['Meta + F'],
407
        action: 'Find (if searchreplace plugin activated)'
408
      },
409
      {
410
        shortcuts: ['Meta + Shift + F'],
411
        action: 'Switch to or from fullscreen mode'
412
      }
413
    ];
414
 
415
    const tab$2 = () => {
416
      const shortcutList = map(shortcuts, shortcut => {
417
        const shortcutText = map(shortcut.shortcuts, convertText).join(' or ');
418
        return [
419
          shortcut.action,
420
          shortcutText
421
        ];
422
      });
423
      const tablePanel = {
424
        type: 'table',
425
        header: [
426
          'Action',
427
          'Shortcut'
428
        ],
429
        cells: shortcutList
430
      };
431
      return {
432
        name: 'shortcuts',
433
        title: 'Handy Shortcuts',
434
        items: [tablePanel]
435
      };
436
    };
437
 
438
    const urls = map([
439
      {
440
        key: 'accordion',
441
        name: 'Accordion'
442
      },
443
      {
444
        key: 'advlist',
445
        name: 'Advanced List'
446
      },
447
      {
448
        key: 'anchor',
449
        name: 'Anchor'
450
      },
451
      {
452
        key: 'autolink',
453
        name: 'Autolink'
454
      },
455
      {
456
        key: 'autoresize',
457
        name: 'Autoresize'
458
      },
459
      {
460
        key: 'autosave',
461
        name: 'Autosave'
462
      },
463
      {
464
        key: 'charmap',
465
        name: 'Character Map'
466
      },
467
      {
468
        key: 'code',
469
        name: 'Code'
470
      },
471
      {
472
        key: 'codesample',
473
        name: 'Code Sample'
474
      },
475
      {
476
        key: 'colorpicker',
477
        name: 'Color Picker'
478
      },
479
      {
480
        key: 'directionality',
481
        name: 'Directionality'
482
      },
483
      {
484
        key: 'emoticons',
485
        name: 'Emoticons'
486
      },
487
      {
488
        key: 'fullscreen',
489
        name: 'Full Screen'
490
      },
491
      {
492
        key: 'help',
493
        name: 'Help'
494
      },
495
      {
496
        key: 'image',
497
        name: 'Image'
498
      },
499
      {
500
        key: 'importcss',
501
        name: 'Import CSS'
502
      },
503
      {
504
        key: 'insertdatetime',
505
        name: 'Insert Date/Time'
506
      },
507
      {
508
        key: 'link',
509
        name: 'Link'
510
      },
511
      {
512
        key: 'lists',
513
        name: 'Lists'
514
      },
515
      {
516
        key: 'media',
517
        name: 'Media'
518
      },
519
      {
520
        key: 'nonbreaking',
521
        name: 'Nonbreaking'
522
      },
523
      {
524
        key: 'pagebreak',
525
        name: 'Page Break'
526
      },
527
      {
528
        key: 'preview',
529
        name: 'Preview'
530
      },
531
      {
532
        key: 'quickbars',
533
        name: 'Quick Toolbars'
534
      },
535
      {
536
        key: 'save',
537
        name: 'Save'
538
      },
539
      {
540
        key: 'searchreplace',
541
        name: 'Search and Replace'
542
      },
543
      {
544
        key: 'table',
545
        name: 'Table'
546
      },
547
      {
548
        key: 'template',
549
        name: 'Template'
550
      },
551
      {
552
        key: 'textcolor',
553
        name: 'Text Color'
554
      },
555
      {
556
        key: 'visualblocks',
557
        name: 'Visual Blocks'
558
      },
559
      {
560
        key: 'visualchars',
561
        name: 'Visual Characters'
562
      },
563
      {
564
        key: 'wordcount',
565
        name: 'Word Count'
566
      },
567
      {
568
        key: 'a11ychecker',
569
        name: 'Accessibility Checker',
570
        type: 'premium'
571
      },
572
      {
573
        key: 'advcode',
574
        name: 'Advanced Code Editor',
575
        type: 'premium'
576
      },
577
      {
578
        key: 'advtable',
579
        name: 'Advanced Tables',
580
        type: 'premium'
581
      },
582
      {
583
        key: 'advtemplate',
584
        name: 'Advanced Templates',
585
        type: 'premium',
586
        slug: 'advanced-templates'
587
      },
588
      {
589
        key: 'ai',
590
        name: 'AI Assistant',
591
        type: 'premium'
592
      },
593
      {
594
        key: 'casechange',
595
        name: 'Case Change',
596
        type: 'premium'
597
      },
598
      {
599
        key: 'checklist',
600
        name: 'Checklist',
601
        type: 'premium'
602
      },
603
      {
604
        key: 'editimage',
605
        name: 'Enhanced Image Editing',
606
        type: 'premium'
607
      },
608
      {
609
        key: 'footnotes',
610
        name: 'Footnotes',
611
        type: 'premium'
612
      },
613
      {
614
        key: 'typography',
615
        name: 'Advanced Typography',
616
        type: 'premium',
617
        slug: 'advanced-typography'
618
      },
619
      {
620
        key: 'mediaembed',
621
        name: 'Enhanced Media Embed',
622
        type: 'premium',
623
        slug: 'introduction-to-mediaembed'
624
      },
625
      {
626
        key: 'export',
627
        name: 'Export',
628
        type: 'premium'
629
      },
630
      {
631
        key: 'formatpainter',
632
        name: 'Format Painter',
633
        type: 'premium'
634
      },
635
      {
636
        key: 'inlinecss',
637
        name: 'Inline CSS',
638
        type: 'premium',
639
        slug: 'inline-css'
640
      },
641
      {
642
        key: 'linkchecker',
643
        name: 'Link Checker',
644
        type: 'premium'
645
      },
646
      {
647
        key: 'mentions',
648
        name: 'Mentions',
649
        type: 'premium'
650
      },
651
      {
652
        key: 'mergetags',
653
        name: 'Merge Tags',
654
        type: 'premium'
655
      },
656
      {
657
        key: 'pageembed',
658
        name: 'Page Embed',
659
        type: 'premium'
660
      },
661
      {
662
        key: 'permanentpen',
663
        name: 'Permanent Pen',
664
        type: 'premium'
665
      },
666
      {
667
        key: 'powerpaste',
668
        name: 'PowerPaste',
669
        type: 'premium',
670
        slug: 'introduction-to-powerpaste'
671
      },
672
      {
673
        key: 'rtc',
674
        name: 'Real-Time Collaboration',
675
        type: 'premium',
676
        slug: 'rtc-introduction'
677
      },
678
      {
679
        key: 'tinymcespellchecker',
680
        name: 'Spell Checker Pro',
681
        type: 'premium',
682
        slug: 'introduction-to-tiny-spellchecker'
683
      },
684
      {
685
        key: 'autocorrect',
686
        name: 'Spelling Autocorrect',
687
        type: 'premium'
688
      },
689
      {
690
        key: 'tableofcontents',
691
        name: 'Table of Contents',
692
        type: 'premium'
693
      },
694
      {
695
        key: 'tinycomments',
696
        name: 'Tiny Comments',
697
        type: 'premium',
698
        slug: 'introduction-to-tiny-comments'
699
      },
700
      {
701
        key: 'tinydrive',
702
        name: 'Tiny Drive',
703
        type: 'premium',
704
        slug: 'tinydrive-introduction'
705
      }
706
    ], item => ({
707
      ...item,
708
      type: item.type || 'opensource',
709
      slug: item.slug || item.key
710
    }));
711
 
712
    const tab$1 = editor => {
713
      const availablePlugins = () => {
714
        const premiumPlugins = filter(urls, ({type}) => {
715
          return type === 'premium';
716
        });
717
        const sortedPremiumPlugins = sort(map(premiumPlugins, p => p.name), (s1, s2) => s1.localeCompare(s2));
718
        const premiumPluginList = map(sortedPremiumPlugins, pluginName => `<li>${ pluginName }</li>`).join('');
719
        return '<div>' + '<p><b>' + global$2.translate('Premium plugins:') + '</b></p>' + '<ul>' + premiumPluginList + '<li class="tox-help__more-link" ">' + '<a href="https://www.tiny.cloud/pricing/?utm_campaign=help_dialog_plugin_tab&utm_source=tiny&utm_medium=referral&utm_term=read_more&utm_content=premium_plugin_heading" rel="noopener" target="_blank"' + ' data-alloy-tabstop="true" tabindex="-1">' + global$2.translate('Learn more...') + '</a></li>' + '</ul>' + '</div>';
720
      };
721
      const makeLink = p => `<a data-alloy-tabstop="true" tabindex="-1" href="${ p.url }" target="_blank" rel="noopener">${ p.name }</a>`;
722
      const identifyUnknownPlugin = (editor, key) => {
723
        const getMetadata = editor.plugins[key].getMetadata;
724
        if (isFunction(getMetadata)) {
725
          const metadata = getMetadata();
726
          return {
727
            name: metadata.name,
728
            html: makeLink(metadata)
729
          };
730
        } else {
731
          return {
732
            name: key,
733
            html: key
734
          };
735
        }
736
      };
737
      const getPluginData = (editor, key) => find(urls, x => {
738
        return x.key === key;
739
      }).fold(() => {
740
        return identifyUnknownPlugin(editor, key);
741
      }, x => {
742
        const name = x.type === 'premium' ? `${ x.name }*` : x.name;
743
        const html = makeLink({
744
          name,
745
          url: `https://www.tiny.cloud/docs/tinymce/6/${ x.slug }/`
746
        });
747
        return {
748
          name,
749
          html
750
        };
751
      });
752
      const getPluginKeys = editor => {
753
        const keys$1 = keys(editor.plugins);
754
        const forcedPlugins = getForcedPlugins(editor);
755
        return isUndefined(forcedPlugins) ? keys$1 : filter(keys$1, k => !contains(forcedPlugins, k));
756
      };
757
      const pluginLister = editor => {
758
        const pluginKeys = getPluginKeys(editor);
759
        const sortedPluginData = sort(map(pluginKeys, k => getPluginData(editor, k)), (pd1, pd2) => pd1.name.localeCompare(pd2.name));
760
        const pluginLis = map(sortedPluginData, key => {
761
          return '<li>' + key.html + '</li>';
762
        });
763
        const count = pluginLis.length;
764
        const pluginsString = pluginLis.join('');
765
        const html = '<p><b>' + global$2.translate([
766
          'Plugins installed ({0}):',
767
          count
768
        ]) + '</b></p>' + '<ul>' + pluginsString + '</ul>';
769
        return html;
770
      };
771
      const installedPlugins = editor => {
772
        if (editor == null) {
773
          return '';
774
        }
775
        return '<div>' + pluginLister(editor) + '</div>';
776
      };
777
      const htmlPanel = {
778
        type: 'htmlpanel',
779
        presets: 'document',
780
        html: [
781
          installedPlugins(editor),
782
          availablePlugins()
783
        ].join('')
784
      };
785
      return {
786
        name: 'plugins',
787
        title: 'Plugins',
788
        items: [htmlPanel]
789
      };
790
    };
791
 
792
    var global = tinymce.util.Tools.resolve('tinymce.EditorManager');
793
 
794
    const tab = () => {
795
      const getVersion = (major, minor) => major.indexOf('@') === 0 ? 'X.X.X' : major + '.' + minor;
796
      const version = getVersion(global.majorVersion, global.minorVersion);
797
      const changeLogLink = '<a data-alloy-tabstop="true" tabindex="-1" href="https://www.tiny.cloud/docs/tinymce/6/changelog/?utm_campaign=help_dialog_version_tab&utm_source=tiny&utm_medium=referral" rel="noopener" target="_blank">TinyMCE ' + version + '</a>';
798
      const htmlPanel = {
799
        type: 'htmlpanel',
800
        html: '<p>' + global$2.translate([
801
          'You are using {0}',
802
          changeLogLink
803
        ]) + '</p>',
804
        presets: 'document'
805
      };
806
      return {
807
        name: 'versions',
808
        title: 'Version',
809
        items: [htmlPanel]
810
      };
811
    };
812
 
813
    const parseHelpTabsSetting = (tabsFromSettings, tabs) => {
814
      const newTabs = {};
815
      const names = map(tabsFromSettings, t => {
816
        var _a;
817
        if (isString(t)) {
818
          if (has(tabs, t)) {
819
            newTabs[t] = tabs[t];
820
          }
821
          return t;
822
        } else {
823
          const name = (_a = t.name) !== null && _a !== void 0 ? _a : generate('tab-name');
824
          newTabs[name] = t;
825
          return name;
826
        }
827
      });
828
      return {
829
        tabs: newTabs,
830
        names
831
      };
832
    };
833
    const getNamesFromTabs = tabs => {
834
      const names = keys(tabs);
835
      const idx = names.indexOf('versions');
836
      if (idx !== -1) {
837
        names.splice(idx, 1);
838
        names.push('versions');
839
      }
840
      return {
841
        tabs,
842
        names
843
      };
844
    };
845
    const pParseCustomTabs = async (editor, customTabs, pluginUrl) => {
846
      const shortcuts = tab$2();
847
      const nav = await pTab(pluginUrl);
848
      const plugins = tab$1(editor);
849
      const versions = tab();
850
      const tabs = {
851
        [shortcuts.name]: shortcuts,
852
        [nav.name]: nav,
853
        [plugins.name]: plugins,
854
        [versions.name]: versions,
855
        ...customTabs.get()
856
      };
857
      return Optional.from(getHelpTabs(editor)).fold(() => getNamesFromTabs(tabs), tabsFromSettings => parseHelpTabsSetting(tabsFromSettings, tabs));
858
    };
859
    const init = (editor, customTabs, pluginUrl) => () => {
860
      pParseCustomTabs(editor, customTabs, pluginUrl).then(({tabs, names}) => {
861
        const foundTabs = map(names, name => get(tabs, name));
862
        const dialogTabs = cat(foundTabs);
863
        const body = {
864
          type: 'tabpanel',
865
          tabs: dialogTabs
866
        };
867
        editor.windowManager.open({
868
          title: 'Help',
869
          size: 'medium',
870
          body,
871
          buttons: [{
872
              type: 'cancel',
873
              name: 'close',
874
              text: 'Close',
875
              primary: true
876
            }],
877
          initialData: {}
878
        });
879
      });
880
    };
881
 
882
    var Plugin = () => {
883
      global$4.add('help', (editor, pluginUrl) => {
884
        const customTabs = Cell({});
885
        const api = get$1(customTabs);
886
        register$1(editor);
887
        const dialogOpener = init(editor, customTabs, pluginUrl);
888
        register(editor, dialogOpener);
889
        register$2(editor, dialogOpener);
890
        editor.shortcuts.add('Alt+0', 'Open help dialog', 'mceHelp');
891
        initI18nLoad(editor, pluginUrl);
892
        return api;
893
      });
894
    };
895
 
896
    Plugin();
897
 
898
})();