@lvce-editor/renderer-process 25.1.0 → 26.0.0

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.
@@ -120,24 +120,24 @@ const confirm$1 = message => {
120
120
  return window.confirm(message);
121
121
  };
122
122
 
123
- const state$9 = {
123
+ const state$a = {
124
124
  styleSheets: Object.create(null)
125
125
  };
126
- const set$9 = (id, sheet) => {
127
- state$9.styleSheets[id] = sheet;
126
+ const set$a = (id, sheet) => {
127
+ state$a.styleSheets[id] = sheet;
128
128
  };
129
- const get$a = id => {
130
- return state$9.styleSheets[id];
129
+ const get$b = id => {
130
+ return state$a.styleSheets[id];
131
131
  };
132
132
 
133
133
  const addCssStyleSheet = (id, text) => {
134
- const existing = get$a(id);
134
+ const existing = get$b(id);
135
135
  if (existing) {
136
136
  existing.replaceSync(text);
137
137
  return;
138
138
  }
139
139
  const sheet = new CSSStyleSheet({});
140
- set$9(id, sheet);
140
+ set$a(id, sheet);
141
141
  sheet.replaceSync(text);
142
142
  document.adoptedStyleSheets.push(sheet);
143
143
  };
@@ -181,6 +181,7 @@ const downloadFile = (fileName, url) => {
181
181
  };
182
182
 
183
183
  const uidSymbol = Symbol('uid');
184
+
184
185
  const getUidTarget = $Element => {
185
186
  while ($Element) {
186
187
  if ($Element[uidSymbol]) {
@@ -190,6 +191,7 @@ const getUidTarget = $Element => {
190
191
  }
191
192
  return undefined;
192
193
  };
194
+
193
195
  const setComponentUid = ($Element, uid) => {
194
196
  $Element[uidSymbol] = uid;
195
197
  };
@@ -207,6 +209,7 @@ const getComponentUidFromEvent = event => {
207
209
  } = event;
208
210
  return getComponentUid(currentTarget || target);
209
211
  };
212
+
210
213
  const dragInfos = Object.create(null);
211
214
  const setDragInfo = (id, data) => {
212
215
  dragInfos[id] = data;
@@ -217,6 +220,7 @@ const getDragInfo = id => {
217
220
  const isDragInfoOld = data => {
218
221
  return Array.isArray(data);
219
222
  };
223
+
220
224
  const setDragImage = (dataTransfer, label) => {
221
225
  const dragImage = document.createElement('div');
222
226
  dragImage.className = 'DragImage';
@@ -228,6 +232,7 @@ const setDragImage = (dataTransfer, label) => {
228
232
  };
229
233
  setTimeout(handleTimeOut, 0);
230
234
  };
235
+
231
236
  const applyDragInfoMaybe = event => {
232
237
  const {
233
238
  dataTransfer,
@@ -253,8 +258,10 @@ const applyDragInfoMaybe = event => {
253
258
  }
254
259
  }
255
260
  };
261
+
256
262
  const PointerMove$1 = 'pointermove';
257
263
  const lostpointercapture = 'lostpointercapture';
264
+
258
265
  let ignore = false;
259
266
  const startIgnore = () => {
260
267
  ignore = true;
@@ -265,14 +272,16 @@ const stopIgnore = () => {
265
272
  const enabled = () => {
266
273
  return ignore;
267
274
  };
275
+
268
276
  let id$1 = 0;
269
277
  const create$N = () => {
270
278
  return ++id$1;
271
279
  };
272
- const state$1$1 = Object.create(null);
280
+
281
+ const state$9 = Object.create(null);
273
282
  const acquire$1 = id => {
274
- const promise = state$1$1[id];
275
- delete state$1$1[id];
283
+ const promise = state$9[id];
284
+ delete state$9[id];
276
285
  return promise;
277
286
  };
278
287
  const getFileHandles$1 = async ids => {
@@ -282,13 +291,14 @@ const getFileHandles$1 = async ids => {
282
291
  };
283
292
  const add$1 = promise => {
284
293
  const id = create$N();
285
- state$1$1[id] = promise;
294
+ state$9[id] = promise;
286
295
  return id;
287
296
  };
288
297
  const addFileHandle$1 = fileHandle => {
289
298
  const promise = Promise.resolve(fileHandle);
290
299
  return add$1(promise);
291
300
  };
301
+
292
302
  const unwrapItemString = async item => {
293
303
  const {
294
304
  resolve,
@@ -344,6 +354,22 @@ const handleDataTransferFiles = event => {
344
354
  const ids = promises.map(promise => add$1(promise));
345
355
  return ids;
346
356
  };
357
+ const handleClipboardDataFiles = event => {
358
+ if (!event.clipboardData) {
359
+ return [];
360
+ }
361
+ const files = [];
362
+ for (const item of event.clipboardData.items) {
363
+ if (item.kind !== 'file') {
364
+ continue;
365
+ }
366
+ const file = item.getAsFile();
367
+ if (file) {
368
+ files.push(file);
369
+ }
370
+ }
371
+ return files;
372
+ };
347
373
  const getEventListenerArg = (param, event) => {
348
374
  switch (param) {
349
375
  case 'event.altKey':
@@ -354,6 +380,8 @@ const getEventListenerArg = (param, event) => {
354
380
  return event.clientX;
355
381
  case 'event.clientY':
356
382
  return event.clientY;
383
+ case 'event.clipboardData.files':
384
+ return handleClipboardDataFiles(event);
357
385
  case 'event.ctrlKey':
358
386
  return event.ctrlKey;
359
387
  case 'event.data':
@@ -421,6 +449,7 @@ const getEventListenerArg = (param, event) => {
421
449
  return param;
422
450
  }
423
451
  };
452
+
424
453
  const getEventListenerArgs = (params, event) => {
425
454
  const serialized = [];
426
455
  for (const param of params) {
@@ -428,6 +457,7 @@ const getEventListenerArgs = (params, event) => {
428
457
  }
429
458
  return serialized;
430
459
  };
460
+
431
461
  const state$8 = {
432
462
  ipc: undefined
433
463
  };
@@ -437,14 +467,17 @@ const getIpc = () => {
437
467
  const setIpc = value => {
438
468
  state$8.ipc = value;
439
469
  };
470
+
440
471
  const nameAnonymousFunction$1 = (fn, name) => {
441
472
  Object.defineProperty(fn, 'name', {
442
473
  value: name
443
474
  });
444
475
  };
476
+
445
477
  const isInputElement = element => {
446
478
  return element instanceof HTMLInputElement;
447
479
  };
480
+
448
481
  const preventEventsMaybe = (info, event) => {
449
482
  if (info.preventDefault === 2) {
450
483
  if (!isInputElement(event.target)) {
@@ -457,6 +490,7 @@ const preventEventsMaybe = (info, event) => {
457
490
  event.stopPropagation();
458
491
  }
459
492
  };
493
+
460
494
  const applyPointerTrackMaybe = (info, map, event) => {
461
495
  const {
462
496
  trackPointerEvents
@@ -500,6 +534,7 @@ const createFn = (info, map) => {
500
534
  }
501
535
  return fn;
502
536
  };
537
+
503
538
  const listeners = Object.create(null);
504
539
  const registerEventListeners = (id, eventListeners) => {
505
540
  const map = Object.create(null);
@@ -513,64 +548,67 @@ const getEventListenerMap = id => {
513
548
  const map = listeners[id];
514
549
  return map;
515
550
  };
551
+
516
552
  const clearNode = $Node => {
517
553
  $Node.textContent = '';
518
554
  };
519
- const Audio$2 = 'audio';
520
- const Button$2 = 'button';
521
- const Col$2 = 'col';
522
- const ColGroup$2 = 'colgroup';
523
- const Del$2 = 'del';
524
- const Div$2 = 'div';
525
- const H1$2 = 'h1';
526
- const H2$2 = 'h2';
527
- const H3$2 = 'h3';
528
- const H4$2 = 'h4';
529
- const H5$2 = 'h5';
530
- const H6$2 = 'h6';
531
- const I$2 = 'i';
532
- const Img$2 = 'img';
533
- const Input$2 = 'input';
534
- const Ins$2 = 'ins';
535
- const Kbd$2 = 'kbd';
536
- const Span$2 = 'span';
537
- const Table$2 = 'table';
538
- const TBody$2 = 'tbody';
539
- const Td$2 = 'td';
540
- const Th$2 = 'th';
541
- const THead$2 = 'thead';
555
+
556
+ const Audio$3 = 'audio';
557
+ const Button$1 = 'button';
558
+ const Col$1 = 'col';
559
+ const ColGroup$1 = 'colgroup';
560
+ const Del$1 = 'del';
561
+ const Div$1 = 'div';
562
+ const H1$1 = 'h1';
563
+ const H2$1 = 'h2';
564
+ const H3$1 = 'h3';
565
+ const H4$1 = 'h4';
566
+ const H5$1 = 'h5';
567
+ const H6$1 = 'h6';
568
+ const I$1 = 'i';
569
+ const Img$1 = 'img';
570
+ const Input$1 = 'input';
571
+ const Ins$1 = 'ins';
572
+ const Kbd$1 = 'kbd';
573
+ const Span$1 = 'span';
574
+ const Table$1 = 'table';
575
+ const TBody$1 = 'tbody';
576
+ const Td$1 = 'td';
577
+ const Th$1 = 'th';
578
+ const THead$1 = 'thead';
542
579
  const Tr$2 = 'tr';
543
- const Article$2 = 'article';
544
- const Aside$2 = 'aside';
545
- const Footer$2 = 'footer';
546
- const Header$2 = 'header';
547
- const Nav$2 = 'nav';
548
- const Section$2 = 'section';
549
- const Search$2 = 'search';
550
- const Dd$2 = 'dd';
580
+ const Article$1 = 'article';
581
+ const Aside$1 = 'aside';
582
+ const Footer$1 = 'footer';
583
+ const Header$1 = 'header';
584
+ const Nav$1 = 'nav';
585
+ const Section$1 = 'section';
586
+ const Search$1 = 'search';
587
+ const Dd$1 = 'dd';
551
588
  const Dl$2 = 'dl';
552
- const Figcaption$2 = 'figcaption';
553
- const Figure$2 = 'figure';
554
- const Hr$2 = 'hr';
589
+ const Figcaption$1 = 'figcaption';
590
+ const Figure$1 = 'figure';
591
+ const Hr$1 = 'hr';
555
592
  const Li$2 = 'li';
556
593
  const Ol$2 = 'ol';
557
- const P$2 = 'p';
558
- const Pre$2 = 'pre';
559
- const A$2 = 'a';
594
+ const P$1 = 'p';
595
+ const Pre$1 = 'pre';
596
+ const A$1 = 'a';
560
597
  const Br$2 = 'br';
561
- const Cite$2 = 'cite';
562
- const Data$2 = 'data';
563
- const Time$2 = 'time';
564
- const Tfoot$2 = 'tfoot';
565
- const Ul$2 = 'ul';
598
+ const Cite$1 = 'cite';
599
+ const Data$1 = 'data';
600
+ const Time$1 = 'time';
601
+ const Tfoot$1 = 'tfoot';
602
+ const Ul$1 = 'ul';
566
603
  const Video$2 = 'video';
567
- const TextArea$2 = 'textarea';
568
- const Select$2 = 'select';
569
- const Option$2 = 'option';
604
+ const TextArea$1 = 'textarea';
605
+ const Select$1 = 'select';
606
+ const Option$1 = 'option';
570
607
  const Code$2 = 'code';
571
- const Label$2 = 'label';
608
+ const Label$1 = 'label';
572
609
  const Dt$2 = 'dt';
573
610
  const Iframe$1 = 'iframe';
611
+ const Main$1 = 'main';
574
612
  const Em$1 = 'em';
575
613
  const Strong$1 = 'strong';
576
614
  const Style$1 = 'style';
@@ -579,65 +617,78 @@ const Head$1 = 'head';
579
617
  const Title$1 = 'title';
580
618
  const Meta$1 = 'meta';
581
619
  const Canvas$1 = 'canvas';
620
+ const Circle$1 = 'circle';
582
621
  const Form$1 = 'form';
583
- const Quote$1$1 = 'quote';
622
+ const Defs$1 = 'defs';
623
+ const Ellipse$1 = 'ellipse';
624
+ const G$2 = 'g';
625
+ const Line$1 = 'line';
626
+ const Path$1 = 'path';
627
+ const Polygon$1 = 'polygon';
628
+ const Polyline$1 = 'polyline';
629
+ const Quote$3 = 'quote';
584
630
  const BlockQuote$1 = 'blockquote';
585
- const Audio$1$1 = 0;
586
- const Button$1 = 1;
587
- const Col$1 = 2;
588
- const ColGroup$1 = 3;
589
- const Div$1 = 4;
590
- const H1$1 = 5;
591
- const Input$1 = 6;
592
- const Kbd$1 = 7;
593
- const Span$1 = 8;
594
- const Table$1 = 9;
595
- const TBody$1 = 10;
596
- const Td$1 = 11;
597
- const Text$1$1 = 12;
598
- const Th$1 = 13;
599
- const THead$1 = 14;
631
+ const Rect$1 = 'rect';
632
+ const Svg$1 = 'svg';
633
+ const Use$1 = 'use';
634
+
635
+ const Audio$2 = 0;
636
+ const Button = 1;
637
+ const Col = 2;
638
+ const ColGroup = 3;
639
+ const Div = 4;
640
+ const H1 = 5;
641
+ const Input = 6;
642
+ const Kbd = 7;
643
+ const Span = 8;
644
+ const Table = 9;
645
+ const TBody = 10;
646
+ const Td = 11;
647
+ const Text$3 = 12;
648
+ const Th = 13;
649
+ const THead = 14;
600
650
  const Tr$1 = 15;
601
- const I$1 = 16;
602
- const Img$1 = 17;
603
- const Ins$1 = 20;
604
- const Del$1 = 21;
605
- const H2$1 = 22;
606
- const H3$1 = 23;
607
- const H4$1 = 24;
608
- const H5$1 = 25;
609
- const H6$1 = 26;
610
- const Article$1 = 27;
611
- const Aside$1 = 28;
612
- const Footer$1 = 29;
613
- const Header$1 = 30;
614
- const Nav$1 = 40;
615
- const Section$1 = 41;
616
- const Search$1 = 42;
617
- const Dd$1 = 43;
651
+ const I = 16;
652
+ const Img = 17;
653
+ const Ins = 20;
654
+ const Del = 21;
655
+ const H2 = 22;
656
+ const H3 = 23;
657
+ const H4 = 24;
658
+ const H5 = 25;
659
+ const H6 = 26;
660
+ const Article = 27;
661
+ const Aside = 28;
662
+ const Footer = 29;
663
+ const Header = 30;
664
+ const Nav = 40;
665
+ const Section = 41;
666
+ const Search = 42;
667
+ const Dd = 43;
618
668
  const Dl$1 = 44;
619
- const Figcaption$1 = 45;
620
- const Figure$1 = 46;
621
- const Hr$1 = 47;
669
+ const Figcaption = 45;
670
+ const Figure = 46;
671
+ const Hr = 47;
622
672
  const Li$1 = 48;
623
673
  const Ol$1 = 49;
624
- const P$1 = 50;
625
- const Pre$1 = 51;
626
- const A$1 = 53;
674
+ const P = 50;
675
+ const Pre = 51;
676
+ const A = 53;
627
677
  const Br$1 = 55;
628
- const Cite$1 = 56;
629
- const Data$1 = 57;
630
- const Time$1 = 58;
631
- const Tfoot$1 = 59;
632
- const Ul$1 = 60;
678
+ const Cite = 56;
679
+ const Data = 57;
680
+ const Time = 58;
681
+ const Tfoot = 59;
682
+ const Ul = 60;
633
683
  const Video$1 = 61;
634
- const TextArea$1 = 62;
635
- const Select$1 = 63;
636
- const Option$1 = 64;
684
+ const TextArea = 62;
685
+ const Select = 63;
686
+ const Option = 64;
637
687
  const Code$1 = 65;
638
- const Label$1 = 66;
688
+ const Label = 66;
639
689
  const Dt$1 = 67;
640
690
  const Iframe = 68;
691
+ const Main = 69;
641
692
  const Strong = 70;
642
693
  const Em = 71;
643
694
  const Style = 72;
@@ -649,163 +700,489 @@ const Canvas = 77;
649
700
  const Form = 78;
650
701
  const BlockQuote = 79;
651
702
  const Quote$2 = 80;
703
+ const Circle = 81;
704
+ const Defs = 82;
705
+ const Ellipse = 83;
706
+ const G$1 = 84;
707
+ const Line = 85;
708
+ const Path = 86;
709
+ const Polygon = 87;
710
+ const Polyline = 88;
711
+ const Rect = 89;
712
+ const Svg = 90;
713
+ const Use = 91;
652
714
  const Reference$1 = 100;
653
- const VirtualDomElements$1 = {
715
+
716
+ const VirtualDomElements = {
654
717
  __proto__: null,
718
+ A,
719
+ Article,
720
+ Aside,
721
+ Audio: Audio$2,
722
+ BlockQuote,
723
+ Br: Br$1,
724
+ Button,
725
+ Canvas,
726
+ Circle,
727
+ Cite,
728
+ Code: Code$1,
729
+ Col,
730
+ ColGroup,
731
+ Data,
732
+ Dd,
733
+ Defs,
734
+ Del,
735
+ Div,
736
+ Dl: Dl$1,
737
+ Dt: Dt$1,
738
+ Ellipse,
739
+ Em,
740
+ Figcaption,
741
+ Figure,
742
+ Footer,
743
+ Form,
744
+ G: G$1,
745
+ H1,
746
+ H2,
747
+ H3,
748
+ H4,
749
+ H5,
750
+ H6,
751
+ Head,
752
+ Header,
753
+ Hr,
754
+ Html,
755
+ I,
756
+ Iframe,
757
+ Img,
758
+ Input,
759
+ Ins,
760
+ Kbd,
761
+ Label,
762
+ Li: Li$1,
763
+ Line,
764
+ Main,
765
+ Meta,
766
+ Nav,
767
+ Ol: Ol$1,
768
+ Option,
769
+ P,
770
+ Path,
771
+ Polygon,
772
+ Polyline,
773
+ Pre,
774
+ Quote: Quote$2,
775
+ Rect,
655
776
  Reference: Reference$1,
656
- Text: Text$1$1};
777
+ Search,
778
+ Section,
779
+ Select,
780
+ Span,
781
+ Strong,
782
+ Style,
783
+ Svg,
784
+ TBody,
785
+ THead,
786
+ Table,
787
+ Td,
788
+ Text: Text$3,
789
+ TextArea,
790
+ Tfoot,
791
+ Th,
792
+ Time,
793
+ Title,
794
+ Tr: Tr$1,
795
+ Ul,
796
+ Use,
797
+ Video: Video$1
798
+ };
799
+
800
+ const elementTagMap = {
801
+ [A]: A$1,
802
+ [Article]: Article$1,
803
+ [Aside]: Aside$1,
804
+ [Audio$2]: Audio$3,
805
+ [BlockQuote]: BlockQuote$1,
806
+ [Br$1]: Br$2,
807
+ [Button]: Button$1,
808
+ [Canvas]: Canvas$1,
809
+ [Circle]: Circle$1,
810
+ [Cite]: Cite$1,
811
+ [Code$1]: Code$2,
812
+ [Col]: Col$1,
813
+ [ColGroup]: ColGroup$1,
814
+ [Data]: Data$1,
815
+ [Dd]: Dd$1,
816
+ [Defs]: Defs$1,
817
+ [Del]: Del$1,
818
+ [Div]: Div$1,
819
+ [Dl$1]: Dl$2,
820
+ [Dt$1]: Dt$2,
821
+ [Ellipse]: Ellipse$1,
822
+ [Em]: Em$1,
823
+ [Figcaption]: Figcaption$1,
824
+ [Figure]: Figure$1,
825
+ [Footer]: Footer$1,
826
+ [Form]: Form$1,
827
+ [G$1]: G$2,
828
+ [H1]: H1$1,
829
+ [H2]: H2$1,
830
+ [H3]: H3$1,
831
+ [H4]: H4$1,
832
+ [H5]: H5$1,
833
+ [H6]: H6$1,
834
+ [Head]: Head$1,
835
+ [Header]: Header$1,
836
+ [Hr]: Hr$1,
837
+ [Html]: Html$1,
838
+ [I]: I$1,
839
+ [Iframe]: Iframe$1,
840
+ [Img]: Img$1,
841
+ [Input]: Input$1,
842
+ [Ins]: Ins$1,
843
+ [Kbd]: Kbd$1,
844
+ [Label]: Label$1,
845
+ [Li$1]: Li$2,
846
+ [Line]: Line$1,
847
+ [Main]: Main$1,
848
+ [Meta]: Meta$1,
849
+ [Nav]: Nav$1,
850
+ [Ol$1]: Ol$2,
851
+ [Option]: Option$1,
852
+ [P]: P$1,
853
+ [Path]: Path$1,
854
+ [Polygon]: Polygon$1,
855
+ [Polyline]: Polyline$1,
856
+ [Pre]: Pre$1,
857
+ [Quote$2]: Quote$3,
858
+ [Rect]: Rect$1,
859
+ [Search]: Search$1,
860
+ [Section]: Section$1,
861
+ [Select]: Select$1,
862
+ [Span]: Span$1,
863
+ [Strong]: Strong$1,
864
+ [Style]: Style$1,
865
+ [Svg]: Svg$1,
866
+ [Table]: Table$1,
867
+ [TBody]: TBody$1,
868
+ [Td]: Td$1,
869
+ [TextArea]: TextArea$1,
870
+ [Tfoot]: Tfoot$1,
871
+ [Th]: Th$1,
872
+ [THead]: THead$1,
873
+ [Time]: Time$1,
874
+ [Title]: Title$1,
875
+ [Tr$1]: Tr$2,
876
+ [Ul]: Ul$1,
877
+ [Use]: Use$1,
878
+ [Video$1]: Video$2
879
+ };
657
880
  const getElementTag$1 = type => {
658
- switch (type) {
659
- case A$1:
660
- return A$2;
661
- case Article$1:
662
- return Article$2;
663
- case Aside$1:
664
- return Aside$2;
665
- case Audio$1$1:
666
- return Audio$2;
667
- case BlockQuote:
668
- return BlockQuote$1;
669
- case Br$1:
670
- return Br$2;
671
- case Button$1:
672
- return Button$2;
673
- case Canvas:
674
- return Canvas$1;
675
- case Cite$1:
676
- return Cite$2;
677
- case Code$1:
678
- return Code$2;
679
- case Col$1:
680
- return Col$2;
681
- case ColGroup$1:
682
- return ColGroup$2;
683
- case Data$1:
684
- return Data$2;
685
- case Dd$1:
686
- return Dd$2;
687
- case Del$1:
688
- return Del$2;
689
- case Div$1:
690
- return Div$2;
691
- case Dl$1:
692
- return Dl$2;
693
- case Dt$1:
694
- return Dt$2;
695
- case Em:
696
- return Em$1;
697
- case Figcaption$1:
698
- return Figcaption$2;
699
- case Figure$1:
700
- return Figure$2;
701
- case Footer$1:
702
- return Footer$2;
703
- case Form:
704
- return Form$1;
705
- case H1$1:
706
- return H1$2;
707
- case H2$1:
708
- return H2$2;
709
- case H3$1:
710
- return H3$2;
711
- case H4$1:
712
- return H4$2;
713
- case H5$1:
714
- return H5$2;
715
- case H6$1:
716
- return H6$2;
717
- case Head:
718
- return Head$1;
719
- case Header$1:
720
- return Header$2;
721
- case Hr$1:
722
- return Hr$2;
723
- case Html:
724
- return Html$1;
725
- case I$1:
726
- return I$2;
727
- case Iframe:
728
- return Iframe$1;
729
- case Img$1:
730
- return Img$2;
731
- case Input$1:
732
- return Input$2;
733
- case Ins$1:
734
- return Ins$2;
735
- case Kbd$1:
736
- return Kbd$2;
737
- case Label$1:
738
- return Label$2;
739
- case Li$1:
740
- return Li$2;
741
- case Meta:
742
- return Meta$1;
743
- case Nav$1:
744
- return Nav$2;
745
- case Ol$1:
746
- return Ol$2;
747
- case Option$1:
748
- return Option$2;
749
- case P$1:
750
- return P$2;
751
- case Pre$1:
752
- return Pre$2;
753
- case Quote$2:
754
- return Quote$1$1;
755
- case Search$1:
756
- return Search$2;
757
- case Section$1:
758
- return Section$2;
759
- case Select$1:
760
- return Select$2;
761
- case Span$1:
762
- return Span$2;
763
- case Strong:
764
- return Strong$1;
765
- case Style:
766
- return Style$1;
767
- case Table$1:
768
- return Table$2;
769
- case TBody$1:
770
- return TBody$2;
771
- case Td$1:
772
- return Td$2;
773
- case TextArea$1:
774
- return TextArea$2;
775
- case Tfoot$1:
776
- return Tfoot$2;
777
- case Th$1:
778
- return Th$2;
779
- case THead$1:
780
- return THead$2;
781
- case Time$1:
782
- return Time$2;
783
- case Title:
784
- return Title$1;
785
- case Tr$1:
786
- return Tr$2;
787
- case Ul$1:
788
- return Ul$2;
789
- case Video$1:
790
- return Video$2;
791
- default:
792
- throw new Error(`element tag not found ${type}`);
881
+ const elementTag = elementTagMap[type];
882
+ if (elementTag) {
883
+ return elementTag;
793
884
  }
885
+ throw new Error(`element tag not found ${type}`);
794
886
  };
887
+
795
888
  const ElementTagMap = {
796
889
  __proto__: null,
797
890
  getElementTag: getElementTag$1
798
891
  };
892
+
893
+ const Backspace$1 = 'Backspace';
894
+ const Tab$1 = 'Tab';
895
+ const Space$1 = ' ';
896
+ const Space2 = 'Space';
897
+ const Enter$1 = 'Enter';
898
+ const Escape$1 = 'Escape';
899
+ const PageUp$1 = 'PageUp';
900
+ const PageDown$1 = 'PageDown';
901
+ const Home$1 = 'Home';
902
+ const End$1 = 'End';
903
+ const LeftArrow$1 = 'ArrowLeft';
904
+ const RightArrow$1 = 'ArrowRight';
905
+ const UpArrow$1 = 'ArrowUp';
906
+ const DownArrow$1 = 'ArrowDown';
907
+ const Insert$1 = 'Insert';
908
+ const Delete$1 = 'Delete';
909
+ const Digit0$1 = '0';
910
+ const Digit1$1 = '1';
911
+ const Digit2$1 = '2';
912
+ const Digit3$1 = '3';
913
+ const Digit4$1 = '4';
914
+ const Digit5$1 = '5';
915
+ const Digit6$1 = '6';
916
+ const Digit7$1 = '7';
917
+ const Digit8$1 = '8';
918
+ const Digit9$1 = '9';
919
+ const KeyA$1 = 'a';
920
+ const KeyB$1 = 'b';
921
+ const KeyC$1 = 'c';
922
+ const KeyD$1 = 'd';
923
+ const KeyE$1 = 'e';
924
+ const KeyF$1 = 'f';
925
+ const KeyG$1 = 'g';
926
+ const KeyH$1 = 'h';
927
+ const KeyI$1 = 'i';
928
+ const KeyJ$1 = 'j';
929
+ const KeyK$1 = 'k';
930
+ const KeyL$1 = 'l';
931
+ const KeyM$1 = 'm';
932
+ const KeyN$1 = 'n';
933
+ const KeyO$1 = 'o';
934
+ const KeyP$1 = 'p';
935
+ const KeyQ$1 = 'q';
936
+ const KeyR$1 = 'r';
937
+ const KeyS$1 = 's';
938
+ const KeyT$1 = 't';
939
+ const KeyU$1 = 'u';
940
+ const KeyV$1 = 'v';
941
+ const KeyW$1 = 'w';
942
+ const KeyX$1 = 'x';
943
+ const KeyY$1 = 'y';
944
+ const KeyZ$1 = 'z';
945
+ const F1$1 = 'F1';
946
+ const F2$1 = 'F2';
947
+ const F3$1 = 'F3';
948
+ const F4$1 = 'F4';
949
+ const F5$1 = 'F5';
950
+ const F6$1 = 'F6';
951
+ const F7$1 = 'F7';
952
+ const F8$1 = 'F8';
953
+ const F9$1 = 'F9';
954
+ const F10$1 = 'F10';
955
+ const F11$1 = 'F11';
956
+ const F12$1 = 'F12';
957
+ const F13$1 = 'F13';
958
+ const F14$1 = 'F14';
959
+ const F15$1 = 'F15';
960
+ const F16$1 = 'F16';
961
+ const F17$1 = 'F17';
962
+ const F18$1 = 'F18';
963
+ const F19$1 = 'F19';
964
+ const F20$1 = 'F20';
965
+ const F21$1 = 'F21';
966
+ const F22$1 = 'F22';
967
+ const F23$1 = 'F23';
968
+ const F24$1 = 'F24';
969
+ const SemiColon$1 = ';';
970
+ const Equal$1 = '=';
971
+ const Comma$1 = ',';
972
+ const Minus$1 = '-';
973
+ const Period$1 = '.';
974
+ const Slash$1 = '/';
975
+ const Backquote$1 = '`';
976
+ const Backquote2 = 'Backquote';
977
+ const BracketLeft$1 = '[';
978
+ const Backslash$1 = '\\';
979
+ const BracketRight$1 = ']';
980
+ const Quote$1 = `'`;
981
+ const Star$1 = '*';
982
+ const Plus$1 = '+';
983
+
984
+ const Unknown = 0;
985
+ const Backspace = 1;
986
+ const Tab = 2;
987
+ const Enter = 3;
988
+ const Escape = 8;
989
+ const Space = 9;
990
+ const PageUp = 10;
991
+ const PageDown = 11;
992
+ const End = 255;
993
+ const Home = 12;
994
+ const LeftArrow = 13;
995
+ const UpArrow = 14;
996
+ const RightArrow = 15;
997
+ const DownArrow = 16;
998
+ const Insert = 17;
999
+ const Delete = 18;
1000
+ const Digit0 = 19;
1001
+ const Digit1 = 20;
1002
+ const Digit2 = 21;
1003
+ const Digit3 = 22;
1004
+ const Digit4 = 23;
1005
+ const Digit5 = 24;
1006
+ const Digit6 = 25;
1007
+ const Digit7 = 26;
1008
+ const Digit8 = 27;
1009
+ const Digit9 = 28;
1010
+ const KeyA = 29;
1011
+ const KeyB = 30;
1012
+ const KeyC = 31;
1013
+ const KeyD = 32;
1014
+ const KeyE = 33;
1015
+ const KeyF = 34;
1016
+ const KeyG = 35;
1017
+ const KeyH = 36;
1018
+ const KeyI = 37;
1019
+ const KeyJ = 38;
1020
+ const KeyK = 39;
1021
+ const KeyL = 40;
1022
+ const KeyM = 41;
1023
+ const KeyN = 42;
1024
+ const KeyO = 43;
1025
+ const KeyP = 44;
1026
+ const KeyQ = 45;
1027
+ const KeyR = 46;
1028
+ const KeyS = 47;
1029
+ const KeyT = 48;
1030
+ const KeyU = 49;
1031
+ const KeyV = 50;
1032
+ const KeyW = 51;
1033
+ const KeyX = 52;
1034
+ const KeyY = 53;
1035
+ const KeyZ = 54;
1036
+ const F1 = 57;
1037
+ const F2 = 58;
1038
+ const F3 = 59;
1039
+ const F4 = 60;
1040
+ const F5 = 61;
1041
+ const F6 = 62;
1042
+ const F7 = 63;
1043
+ const F8 = 64;
1044
+ const F9 = 65;
1045
+ const F10 = 66;
1046
+ const F11 = 67;
1047
+ const F12 = 68;
1048
+ const F13 = 69;
1049
+ const F14 = 70;
1050
+ const F15 = 71;
1051
+ const F16 = 72;
1052
+ const F17 = 72;
1053
+ const F18 = 74;
1054
+ const F19 = 75;
1055
+ const F20 = 76;
1056
+ const F21 = 77;
1057
+ const F22 = 78;
1058
+ const F23 = 79;
1059
+ const F24 = 80;
1060
+ const SemiColon = 83;
1061
+ const Equal = 84;
1062
+ const Comma = 85;
1063
+ const Minus = 86;
1064
+ const Period = 87;
1065
+ const Slash = 88;
1066
+ const Backquote = 89;
1067
+ const BracketLeft = 90;
1068
+ const Backslash = 91;
1069
+ const BracketRight = 92;
1070
+ const Quote = 93;
1071
+ const Star = 131;
1072
+ const Plus = 132;
1073
+
1074
+ const keyCodeMap = {
1075
+ [Backquote$1]: Backquote,
1076
+ [Backquote2]: Backquote,
1077
+ [Backslash$1]: Backslash,
1078
+ [Backspace$1]: Backspace,
1079
+ [BracketLeft$1]: BracketLeft,
1080
+ [BracketRight$1]: BracketRight,
1081
+ [Comma$1]: Comma,
1082
+ [Delete$1]: Delete,
1083
+ [Digit0$1]: Digit0,
1084
+ [Digit1$1]: Digit1,
1085
+ [Digit2$1]: Digit2,
1086
+ [Digit3$1]: Digit3,
1087
+ [Digit4$1]: Digit4,
1088
+ [Digit5$1]: Digit5,
1089
+ [Digit6$1]: Digit6,
1090
+ [Digit7$1]: Digit7,
1091
+ [Digit8$1]: Digit8,
1092
+ [Digit9$1]: Digit9,
1093
+ [DownArrow$1]: DownArrow,
1094
+ [End$1]: End,
1095
+ [Enter$1]: Enter,
1096
+ [Equal$1]: Equal,
1097
+ [Escape$1]: Escape,
1098
+ [F1$1]: F1,
1099
+ [F10$1]: F10,
1100
+ [F11$1]: F11,
1101
+ [F12$1]: F12,
1102
+ [F13$1]: F13,
1103
+ [F14$1]: F14,
1104
+ [F15$1]: F15,
1105
+ [F16$1]: F16,
1106
+ [F17$1]: F17,
1107
+ [F18$1]: F18,
1108
+ [F19$1]: F19,
1109
+ [F2$1]: F2,
1110
+ [F20$1]: F20,
1111
+ [F21$1]: F21,
1112
+ [F22$1]: F22,
1113
+ [F23$1]: F23,
1114
+ [F24$1]: F24,
1115
+ [F3$1]: F3,
1116
+ [F4$1]: F4,
1117
+ [F5$1]: F5,
1118
+ [F6$1]: F6,
1119
+ [F7$1]: F7,
1120
+ [F8$1]: F8,
1121
+ [F9$1]: F9,
1122
+ [Home$1]: Home,
1123
+ [Insert$1]: Insert,
1124
+ [KeyA$1]: KeyA,
1125
+ [KeyB$1]: KeyB,
1126
+ [KeyC$1]: KeyC,
1127
+ [KeyD$1]: KeyD,
1128
+ [KeyE$1]: KeyE,
1129
+ [KeyF$1]: KeyF,
1130
+ [KeyG$1]: KeyG,
1131
+ [KeyH$1]: KeyH,
1132
+ [KeyI$1]: KeyI,
1133
+ [KeyJ$1]: KeyJ,
1134
+ [KeyK$1]: KeyK,
1135
+ [KeyL$1]: KeyL,
1136
+ [KeyM$1]: KeyM,
1137
+ [KeyN$1]: KeyN,
1138
+ [KeyO$1]: KeyO,
1139
+ [KeyP$1]: KeyP,
1140
+ [KeyQ$1]: KeyQ,
1141
+ [KeyR$1]: KeyR,
1142
+ [KeyS$1]: KeyS,
1143
+ [KeyT$1]: KeyT,
1144
+ [KeyU$1]: KeyU,
1145
+ [KeyV$1]: KeyV,
1146
+ [KeyW$1]: KeyW,
1147
+ [KeyX$1]: KeyX,
1148
+ [KeyY$1]: KeyY,
1149
+ [KeyZ$1]: KeyZ,
1150
+ [LeftArrow$1]: LeftArrow,
1151
+ [Minus$1]: Minus,
1152
+ [PageDown$1]: PageDown,
1153
+ [PageUp$1]: PageUp,
1154
+ [Period$1]: Period,
1155
+ [Plus$1]: Plus,
1156
+ [Quote$1]: Quote,
1157
+ [RightArrow$1]: RightArrow,
1158
+ [SemiColon$1]: SemiColon,
1159
+ [Slash$1]: Slash,
1160
+ [Space$1]: Space,
1161
+ [Space2]: Space,
1162
+ [Star$1]: Star,
1163
+ [Tab$1]: Tab,
1164
+ [UpArrow$1]: UpArrow
1165
+ };
1166
+ const getKeyCode = key => {
1167
+ return keyCodeMap[key] || Unknown;
1168
+ };
1169
+
1170
+ const CtrlCmd = 1 << 11 >>> 0;
1171
+ const Shift = 1 << 10 >>> 0;
1172
+ const Alt$1 = 1 << 9 >>> 0;
1173
+
799
1174
  const {
800
1175
  getElementTag
801
1176
  } = ElementTagMap;
1177
+
802
1178
  const instances = Object.create(null);
803
- const get$1$1 = viewletId => {
1179
+ const get$a = viewletId => {
804
1180
  return instances[viewletId];
805
1181
  };
806
- const set$1$1 = (viewletId, instance) => {
1182
+ const set$9 = (viewletId, instance) => {
807
1183
  instances[viewletId] = instance;
808
1184
  };
1185
+
809
1186
  const getEventListenerOptions$1 = (eventName, value) => {
810
1187
  if (value.passive) {
811
1188
  return {
@@ -826,6 +1203,7 @@ const getEventListenerOptions$1 = (eventName, value) => {
826
1203
  return undefined;
827
1204
  }
828
1205
  };
1206
+
829
1207
  const cache$1 = new Map();
830
1208
  const has$1 = listener => {
831
1209
  return cache$1.has(listener);
@@ -836,6 +1214,7 @@ const set$8 = (listener, value) => {
836
1214
  const get$9 = listener => {
837
1215
  return cache$1.get(listener);
838
1216
  };
1217
+
839
1218
  const getWrappedListener$1 = (listener, returnValue) => {
840
1219
  if (!returnValue) {
841
1220
  return listener;
@@ -856,6 +1235,7 @@ const getWrappedListener$1 = (listener, returnValue) => {
856
1235
  }
857
1236
  return get$9(listener);
858
1237
  };
1238
+
859
1239
  const attachedListeners = new WeakMap();
860
1240
  const getOptions = fn => {
861
1241
  if (fn.passive) {
@@ -903,6 +1283,7 @@ const attachEvent$1 = ($Node, eventMap, key, value, newEventMap) => {
903
1283
  });
904
1284
  attachedListeners.set($Node, listenersByEvent);
905
1285
  };
1286
+
906
1287
  const STYLE_REGEX = /([^:;]+):\s*([^;]+)/g;
907
1288
  const KEBAB_CASE_REGEX = /-([a-z])/g;
908
1289
  const setStyle = ($Element, styleString) => {
@@ -918,6 +1299,7 @@ const setStyle = ($Element, styleString) => {
918
1299
  $Element.style[camelCaseKey] = value;
919
1300
  }
920
1301
  };
1302
+
921
1303
  const setProp = ($Element, key, value, eventMap, newEventMap) => {
922
1304
  switch (key) {
923
1305
  case 'ariaActivedescendant':
@@ -1027,14 +1409,17 @@ const setProp = ($Element, key, value, eventMap, newEventMap) => {
1027
1409
  }
1028
1410
  }
1029
1411
  };
1412
+
1030
1413
  const setProps = ($Element, props, eventMap, newEventMap) => {
1031
1414
  for (const key in props) {
1032
1415
  setProp($Element, key, props[key], eventMap, newEventMap);
1033
1416
  }
1034
1417
  };
1418
+
1035
1419
  const {
1036
1420
  Text: Text$2,
1037
- Reference} = VirtualDomElements$1;
1421
+ Reference} = VirtualDomElements;
1422
+
1038
1423
  const renderDomTextNode = element => {
1039
1424
  return document.createTextNode(element.text);
1040
1425
  };
@@ -1045,7 +1430,7 @@ const renderDomElement = (element, eventMap, newEventMap) => {
1045
1430
  return $Element;
1046
1431
  };
1047
1432
  const renderReferenceNode = element => {
1048
- const instance = get$1$1(element.uid);
1433
+ const instance = get$a(element.uid);
1049
1434
  if (!instance || !instance.state) {
1050
1435
  return document.createTextNode('Reference node not found');
1051
1436
  }
@@ -1062,6 +1447,7 @@ const render$1 = (element, eventMap, newEventMap) => {
1062
1447
  return renderDomElement(element, eventMap, newEventMap);
1063
1448
  }
1064
1449
  };
1450
+
1065
1451
  const renderInternal = ($Parent, elements, eventMap, newEventMap) => {
1066
1452
  const max = elements.length - 1;
1067
1453
  let stack = [];
@@ -1077,11 +1463,11 @@ const renderInternal = ($Parent, elements, eventMap, newEventMap) => {
1077
1463
  }
1078
1464
  $Parent.append(...stack);
1079
1465
  };
1466
+
1080
1467
  const renderInto = ($Parent, dom, eventMap = {}) => {
1081
1468
  clearNode($Parent);
1082
1469
  renderInternal($Parent, dom, eventMap);
1083
1470
  };
1084
-
1085
1471
  /**
1086
1472
  *
1087
1473
  * @param {any[]} elements
@@ -1092,6 +1478,7 @@ const render = (elements, eventMap = {}, newEventMap = {}) => {
1092
1478
  renderInternal($Root, elements, eventMap, newEventMap);
1093
1479
  return $Root;
1094
1480
  };
1481
+
1095
1482
  const rememberFocus2 = ($Viewlet, dom, eventMap, uid = 0) => {
1096
1483
  if (uid) {
1097
1484
  const newEventMap = getEventListenerMap(uid);
@@ -1115,7 +1502,6 @@ const propertyToAttribute = {
1115
1502
  ariaOwns: 'aria-owns',
1116
1503
  inputType: 'type'
1117
1504
  };
1118
-
1119
1505
  // Style properties that need to be set on element.style
1120
1506
  const styleProperties = new Set(['width', 'height', 'top', 'left', 'marginTop', 'paddingLeft', 'paddingRight']);
1121
1507
  const removeAttribute = ($Element, key) => {
@@ -1154,6 +1540,7 @@ const replace = ($Element, nodes, eventMap = {}) => {
1154
1540
  $Element.replaceWith($NewNode);
1155
1541
  return $NewNode;
1156
1542
  };
1543
+
1157
1544
  const SetText = 1;
1158
1545
  const Replace = 2;
1159
1546
  const SetAttribute = 3;
@@ -1164,6 +1551,7 @@ const NavigateParent = 8;
1164
1551
  const RemoveChild = 9;
1165
1552
  const NavigateSibling = 10;
1166
1553
  const SetReferenceNodeUid = 11;
1554
+
1167
1555
  const applyPatch = ($Element, patches, eventMap = {}, id = 0) => {
1168
1556
  const events = getEventListenerMap(id) || eventMap;
1169
1557
  let $Current = $Element;
@@ -1253,7 +1641,7 @@ const applyPatch = ($Element, patches, eventMap = {}, id = 0) => {
1253
1641
  case SetReferenceNodeUid:
1254
1642
  {
1255
1643
  // Get the new reference node instance
1256
- const instance = get$1$1(patch.uid);
1644
+ const instance = get$a(patch.uid);
1257
1645
  if (!instance || !instance.state) {
1258
1646
  console.error('Cannot set reference node uid: instance not found', {
1259
1647
  uid: patch.uid
@@ -1281,6 +1669,7 @@ const applyPatch = ($Element, patches, eventMap = {}, id = 0) => {
1281
1669
  }
1282
1670
  }
1283
1671
  };
1672
+
1284
1673
  const getActiveElementInside = $Viewlet => {
1285
1674
  if (!$Viewlet) {
1286
1675
  return undefined;
@@ -1294,9 +1683,11 @@ const getActiveElementInside = $Viewlet => {
1294
1683
  }
1295
1684
  return $ActiveElement;
1296
1685
  };
1686
+
1297
1687
  const queryInputs = $Viewlet => {
1298
1688
  return [...$Viewlet.querySelectorAll('input, textarea, select')];
1299
1689
  };
1690
+
1300
1691
  const focusElement = $Element => {
1301
1692
  $Element.focus({
1302
1693
  preventScroll: true
@@ -3238,7 +3629,7 @@ const create2 = async (canvasId, objectId, width, height) => {
3238
3629
  }
3239
3630
  const offscreenCanvas = canvas.transferControlToOffscreen();
3240
3631
  canvas.dataset.id = canvasId;
3241
- set$1$1(canvasId, {
3632
+ set$9(canvasId, {
3242
3633
  factory: {},
3243
3634
  state: {
3244
3635
  $Viewlet: canvas
@@ -3686,12 +4077,11 @@ const hide = (restoreFocus = true) => {
3686
4077
  }
3687
4078
  };
3688
4079
 
3689
- const openUrl = (url, useRedirect = false) => {
3690
- if (useRedirect) {
3691
- window.location.href = url;
3692
- } else {
3693
- window.open(url);
3694
- }
4080
+ const openUrl = url => {
4081
+ window.open(url);
4082
+ };
4083
+ const redirectToUrl = url => {
4084
+ window.location.href = url;
3695
4085
  };
3696
4086
 
3697
4087
  const isElectronUserAgentSpecificMemoryError = error => {
@@ -4001,7 +4391,6 @@ const performAction2 = async (locator, fnName, options) => {
4001
4391
  throw new Error(`element not found`);
4002
4392
  }
4003
4393
  fn(element, options);
4004
- return;
4005
4394
  };
4006
4395
 
4007
4396
  const toHaveText$1 = locator => {
@@ -4246,13 +4635,35 @@ const create$Overlay = () => {
4246
4635
  $TestOverlay.style.contain = 'strict';
4247
4636
  $TestOverlay.style.userSelect = 'text';
4248
4637
  $TestOverlay.style.color = 'black';
4638
+ $TestOverlay.style.display = 'flex';
4639
+ $TestOverlay.style.gap = '10px';
4249
4640
  return $TestOverlay;
4250
4641
  };
4251
- const showOverlay = (state, background, text) => {
4642
+ const createAction = action => {
4643
+ const $action = document.createElement('button');
4644
+ $action.textContent = action.label;
4645
+ $action.style.flexShrink = '0';
4646
+ $action.style.background = 'dodgerblue';
4647
+ $action.style.paddingLeft = '6px';
4648
+ $action.style.paddingRight = '6px';
4649
+ $action.style.color = 'white';
4650
+ $action.style.border = 'none';
4651
+ $action.style.borderRadius = '5px';
4652
+ $action.addEventListener('click', () => {
4653
+ send(action.command);
4654
+ });
4655
+ return $action;
4656
+ };
4657
+ const showOverlay = (state, background, text, actions = []) => {
4252
4658
  const $TestOverlay = create$Overlay();
4253
4659
  $TestOverlay.dataset.state = state;
4254
4660
  $TestOverlay.style.background = background;
4255
- $TestOverlay.textContent = text;
4661
+ const span = document.createElement('span');
4662
+ span.style.flex = '1';
4663
+ span.style.overflow = 'hidden';
4664
+ span.textContent = text;
4665
+ const $actions = actions.map(createAction);
4666
+ $TestOverlay.append(span, ...$actions);
4256
4667
  document.body.append($TestOverlay);
4257
4668
  };
4258
4669
  const performAction = async (locator, fnName, options) => {
@@ -4264,10 +4675,7 @@ const performAction = async (locator, fnName, options) => {
4264
4675
  if (!element) {
4265
4676
  throw new Error(`element not found`);
4266
4677
  }
4267
- if (element) {
4268
- fn(element, options);
4269
- return;
4270
- }
4678
+ fn(element, options);
4271
4679
  };
4272
4680
  const performKeyBoardAction = (fnName, options) => {
4273
4681
  const fn = KeyBoardActions[fnName];
@@ -4344,11 +4752,12 @@ const transferToWebView = objectId => {
4344
4752
  // TODO allow specifying transfer origin from renderer worker
4345
4753
  // TODO allow specifing method from renderer worker
4346
4754
  const port = acquire(objectId);
4755
+ const targetOrigin = new URL($Iframe.src || location.href, location.href).origin;
4347
4756
  contentWindow.postMessage({
4348
4757
  jsonrpc: '2.0',
4349
4758
  method: 'handlePort',
4350
4759
  params: [port]
4351
- }, '*', [port]);
4760
+ }, targetOrigin, [port]);
4352
4761
  };
4353
4762
 
4354
4763
  const attachEvents$6 = ($Node, eventMap) => {
@@ -5964,14 +6373,14 @@ const detachEvent = ($Node, key, listener) => {
5964
6373
 
5965
6374
  const None = 0;
5966
6375
  const Ctrl = 1;
5967
- const Alt$1 = 2;
6376
+ const Alt = 2;
5968
6377
 
5969
6378
  const getModifierKey = event => {
5970
6379
  if (event.ctrlKey) {
5971
6380
  return Ctrl;
5972
6381
  }
5973
6382
  if (event.altKey) {
5974
- return Alt$1;
6383
+ return Alt;
5975
6384
  }
5976
6385
  return None;
5977
6386
  };
@@ -6899,376 +7308,6 @@ const getSashId = $Target => {
6899
7308
  return '';
6900
7309
  };
6901
7310
 
6902
- const Backspace$1 = 'Backspace';
6903
- const Tab$1 = 'Tab';
6904
- const Space$1 = ' ';
6905
- const Space2 = 'Space';
6906
- const Enter$1 = 'Enter';
6907
- const Escape$1 = 'Escape';
6908
- const PageUp$1 = 'PageUp';
6909
- const PageDown$1 = 'PageDown';
6910
- const Home$1 = 'Home';
6911
- const End$1 = 'End';
6912
- const LeftArrow$1 = 'ArrowLeft';
6913
- const RightArrow$1 = 'ArrowRight';
6914
- const UpArrow$1 = 'ArrowUp';
6915
- const DownArrow$1 = 'ArrowDown';
6916
- const Insert$1 = 'Insert';
6917
- const Delete$1 = 'Delete';
6918
- const Digit0$1 = '0';
6919
- const Digit1$1 = '1';
6920
- const Digit2$1 = '2';
6921
- const Digit3$1 = '3';
6922
- const Digit4$1 = '4';
6923
- const Digit5$1 = '5';
6924
- const Digit6$1 = '6';
6925
- const Digit7$1 = '7';
6926
- const Digit8$1 = '8';
6927
- const Digit9$1 = '9';
6928
- const KeyA$1 = 'a';
6929
- const KeyB$1 = 'b';
6930
- const KeyC$1 = 'c';
6931
- const KeyD$1 = 'd';
6932
- const KeyE$1 = 'e';
6933
- const KeyF$1 = 'f';
6934
- const KeyG$1 = 'g';
6935
- const KeyH$1 = 'h';
6936
- const KeyI$1 = 'i';
6937
- const KeyJ$1 = 'j';
6938
- const KeyK$1 = 'k';
6939
- const KeyL$1 = 'l';
6940
- const KeyM$1 = 'm';
6941
- const KeyN$1 = 'n';
6942
- const KeyO$1 = 'o';
6943
- const KeyP$1 = 'p';
6944
- const KeyQ$1 = 'q';
6945
- const KeyR$1 = 'r';
6946
- const KeyS$1 = 's';
6947
- const KeyT$1 = 't';
6948
- const KeyU$1 = 'u';
6949
- const KeyV$1 = 'v';
6950
- const KeyW$1 = 'w';
6951
- const KeyX$1 = 'x';
6952
- const KeyY$1 = 'y';
6953
- const KeyZ$1 = 'z';
6954
- const F1$1 = 'F1';
6955
- const F2$1 = 'F2';
6956
- const F3$1 = 'F3';
6957
- const F4$1 = 'F4';
6958
- const F5$1 = 'F5';
6959
- const F6$1 = 'F6';
6960
- const F7$1 = 'F7';
6961
- const F8$1 = 'F8';
6962
- const F9$1 = 'F9';
6963
- const F10$1 = 'F10';
6964
- const F11$1 = 'F11';
6965
- const F12$1 = 'F12';
6966
- const F13$1 = 'F13';
6967
- const F14$1 = 'F14';
6968
- const F15$1 = 'F15';
6969
- const F16$1 = 'F16';
6970
- const F17$1 = 'F17';
6971
- const F18$1 = 'F18';
6972
- const F19$1 = 'F19';
6973
- const F20$1 = 'F20';
6974
- const F21$1 = 'F21';
6975
- const F22$1 = 'F22';
6976
- const F23$1 = 'F23';
6977
- const F24$1 = 'F24';
6978
- const SemiColon$1 = ';';
6979
- const Equal$1 = '=';
6980
- const Comma$1 = ',';
6981
- const Minus$1 = '-';
6982
- const Period$1 = '.';
6983
- const Slash$1 = '/';
6984
- const Backquote$1 = '`';
6985
- const Backquote2 = 'Backquote';
6986
- const BracketLeft$1 = '[';
6987
- const Backslash$1 = '\\';
6988
- const BracketRight$1 = ']';
6989
- const Quote$1 = `'`;
6990
- const Star$1 = '*';
6991
- const Plus$1 = '+';
6992
-
6993
- const Unknown = 0;
6994
- const Backspace = 1;
6995
- const Tab = 2;
6996
- const Enter = 3;
6997
- const Escape = 8;
6998
- const Space = 9;
6999
- const PageUp = 10;
7000
- const PageDown = 11;
7001
- const End = 255;
7002
- const Home = 12;
7003
- const LeftArrow = 13;
7004
- const UpArrow = 14;
7005
- const RightArrow = 15;
7006
- const DownArrow = 16;
7007
- const Insert = 17;
7008
- const Delete = 18;
7009
- const Digit0 = 19;
7010
- const Digit1 = 20;
7011
- const Digit2 = 21;
7012
- const Digit3 = 22;
7013
- const Digit4 = 23;
7014
- const Digit5 = 24;
7015
- const Digit6 = 25;
7016
- const Digit7 = 26;
7017
- const Digit8 = 27;
7018
- const Digit9 = 28;
7019
- const KeyA = 29;
7020
- const KeyB = 30;
7021
- const KeyC = 31;
7022
- const KeyD = 32;
7023
- const KeyE = 33;
7024
- const KeyF = 34;
7025
- const KeyG = 35;
7026
- const KeyH = 36;
7027
- const KeyI = 37;
7028
- const KeyJ = 38;
7029
- const KeyK = 39;
7030
- const KeyL = 40;
7031
- const KeyM = 41;
7032
- const KeyN = 42;
7033
- const KeyO = 43;
7034
- const KeyP = 44;
7035
- const KeyQ = 45;
7036
- const KeyR = 46;
7037
- const KeyS = 47;
7038
- const KeyT = 48;
7039
- const KeyU = 49;
7040
- const KeyV = 50;
7041
- const KeyW = 51;
7042
- const KeyX = 52;
7043
- const KeyY = 53;
7044
- const KeyZ = 54;
7045
- const F1 = 57;
7046
- const F2 = 58;
7047
- const F3 = 59;
7048
- const F4 = 60;
7049
- const F5 = 61;
7050
- const F6 = 62;
7051
- const F7 = 63;
7052
- const F8 = 64;
7053
- const F9 = 65;
7054
- const F10 = 66;
7055
- const F11 = 67;
7056
- const F12 = 68;
7057
- const F13 = 69;
7058
- const F14 = 70;
7059
- const F15 = 71;
7060
- const F16 = 72;
7061
- const F17 = 72;
7062
- const F18 = 74;
7063
- const F19 = 75;
7064
- const F20 = 76;
7065
- const F21 = 77;
7066
- const F22 = 78;
7067
- const F23 = 79;
7068
- const F24 = 80;
7069
- const SemiColon = 83;
7070
- const Equal = 84;
7071
- const Comma = 85;
7072
- const Minus = 86;
7073
- const Period = 87;
7074
- const Slash = 88;
7075
- const Backquote = 89;
7076
- const BracketLeft = 90;
7077
- const Backslash = 91;
7078
- const BracketRight = 92;
7079
- const Quote = 93;
7080
- const Star = 131;
7081
- const Plus = 132;
7082
-
7083
- const getKeyCode = key => {
7084
- switch (key) {
7085
- case Backquote$1:
7086
- case Backquote2:
7087
- return Backquote;
7088
- case Backslash$1:
7089
- return Backslash;
7090
- case Backspace$1:
7091
- return Backspace;
7092
- case BracketLeft$1:
7093
- return BracketLeft;
7094
- case BracketRight$1:
7095
- return BracketRight;
7096
- case Comma$1:
7097
- return Comma;
7098
- case Delete$1:
7099
- return Delete;
7100
- case Digit0$1:
7101
- return Digit0;
7102
- case Digit1$1:
7103
- return Digit1;
7104
- case Digit2$1:
7105
- return Digit2;
7106
- case Digit3$1:
7107
- return Digit3;
7108
- case Digit4$1:
7109
- return Digit4;
7110
- case Digit5$1:
7111
- return Digit5;
7112
- case Digit6$1:
7113
- return Digit6;
7114
- case Digit7$1:
7115
- return Digit7;
7116
- case Digit8$1:
7117
- return Digit8;
7118
- case Digit9$1:
7119
- return Digit9;
7120
- case DownArrow$1:
7121
- return DownArrow;
7122
- case End$1:
7123
- return End;
7124
- case Enter$1:
7125
- return Enter;
7126
- case Equal$1:
7127
- return Equal;
7128
- case Escape$1:
7129
- return Escape;
7130
- case F1$1:
7131
- return F1;
7132
- case F10$1:
7133
- return F10;
7134
- case F11$1:
7135
- return F11;
7136
- case F12$1:
7137
- return F12;
7138
- case F13$1:
7139
- return F13;
7140
- case F14$1:
7141
- return F14;
7142
- case F15$1:
7143
- return F15;
7144
- case F16$1:
7145
- return F16;
7146
- case F17$1:
7147
- return F17;
7148
- case F18$1:
7149
- return F18;
7150
- case F19$1:
7151
- return F19;
7152
- case F2$1:
7153
- return F2;
7154
- case F20$1:
7155
- return F20;
7156
- case F21$1:
7157
- return F21;
7158
- case F22$1:
7159
- return F22;
7160
- case F23$1:
7161
- return F23;
7162
- case F24$1:
7163
- return F24;
7164
- case F3$1:
7165
- return F3;
7166
- case F4$1:
7167
- return F4;
7168
- case F5$1:
7169
- return F5;
7170
- case F6$1:
7171
- return F6;
7172
- case F7$1:
7173
- return F7;
7174
- case F8$1:
7175
- return F8;
7176
- case F9$1:
7177
- return F9;
7178
- case Home$1:
7179
- return Home;
7180
- case Insert$1:
7181
- return Insert;
7182
- case KeyA$1:
7183
- return KeyA;
7184
- case KeyB$1:
7185
- return KeyB;
7186
- case KeyC$1:
7187
- return KeyC;
7188
- case KeyD$1:
7189
- return KeyD;
7190
- case KeyE$1:
7191
- return KeyE;
7192
- case KeyF$1:
7193
- return KeyF;
7194
- case KeyG$1:
7195
- return KeyG;
7196
- case KeyH$1:
7197
- return KeyH;
7198
- case KeyI$1:
7199
- return KeyI;
7200
- case KeyJ$1:
7201
- return KeyJ;
7202
- case KeyK$1:
7203
- return KeyK;
7204
- case KeyL$1:
7205
- return KeyL;
7206
- case KeyM$1:
7207
- return KeyM;
7208
- case KeyN$1:
7209
- return KeyN;
7210
- case KeyO$1:
7211
- return KeyO;
7212
- case KeyP$1:
7213
- return KeyP;
7214
- case KeyQ$1:
7215
- return KeyQ;
7216
- case KeyR$1:
7217
- return KeyR;
7218
- case KeyS$1:
7219
- return KeyS;
7220
- case KeyT$1:
7221
- return KeyT;
7222
- case KeyU$1:
7223
- return KeyU;
7224
- case KeyV$1:
7225
- return KeyV;
7226
- case KeyW$1:
7227
- return KeyW;
7228
- case KeyX$1:
7229
- return KeyX;
7230
- case KeyY$1:
7231
- return KeyY;
7232
- case KeyZ$1:
7233
- return KeyZ;
7234
- case LeftArrow$1:
7235
- return LeftArrow;
7236
- case Minus$1:
7237
- return Minus;
7238
- case PageDown$1:
7239
- return PageDown;
7240
- case PageUp$1:
7241
- return PageUp;
7242
- case Period$1:
7243
- return Period;
7244
- case Plus$1:
7245
- return Plus;
7246
- case Quote$1:
7247
- return Quote;
7248
- case RightArrow$1:
7249
- return RightArrow;
7250
- case SemiColon$1:
7251
- return SemiColon;
7252
- case Slash$1:
7253
- return Slash;
7254
- case Space$1:
7255
- case Space2:
7256
- return Space;
7257
- case Star$1:
7258
- return Star;
7259
- case Tab$1:
7260
- return Tab;
7261
- case UpArrow$1:
7262
- return UpArrow;
7263
- default:
7264
- return Unknown;
7265
- }
7266
- };
7267
-
7268
- const CtrlCmd = 1 << 11 >>> 0;
7269
- const Shift = 1 << 10 >>> 0;
7270
- const Alt = 1 << 9 >>> 0;
7271
-
7272
7311
  const normalizeKey = (key, code) => {
7273
7312
  if (key.length === 1) {
7274
7313
  return key.toLowerCase();
@@ -7289,7 +7328,7 @@ const getKeyBindingIdentifier = event => {
7289
7328
  } = event;
7290
7329
  const modifierControl = ctrlKey ? CtrlCmd : 0;
7291
7330
  const modifierShift = shiftKey ? Shift : 0;
7292
- const modifierAlt = altKey ? Alt : 0;
7331
+ const modifierAlt = altKey ? Alt$1 : 0;
7293
7332
  const normalizedKey = normalizeKey(key, code);
7294
7333
  const keyCode = getKeyCode(normalizedKey);
7295
7334
  const identifier = modifierControl | modifierShift | modifierAlt | keyCode;
@@ -7706,7 +7745,7 @@ const setActionsDom$1 = (state, actions, childUid) => {
7706
7745
  const {
7707
7746
  $PanelActions
7708
7747
  } = state;
7709
- const instance = get$1$1(childUid);
7748
+ const instance = get$a(childUid);
7710
7749
  if (!instance) {
7711
7750
  throw new Error(`child instance not found`);
7712
7751
  }
@@ -8403,6 +8442,69 @@ const create$Menu = () => {
8403
8442
  // $ContextMenu.onblur = handleBlur
8404
8443
  return $Menu;
8405
8444
  };
8445
+ const addMenu = ($$Menus, change, uid) => {
8446
+ const menu = change[1];
8447
+ const dom = change[2];
8448
+ const $Menu = create$Menu();
8449
+ set$3($Menu, uid);
8450
+ $Menu.onmouseover = handleMenuMouseOver;
8451
+ $Menu.onclick = handleMenuClick;
8452
+ const {
8453
+ focusedIndex,
8454
+ height,
8455
+ level,
8456
+ width,
8457
+ x,
8458
+ y
8459
+ } = menu;
8460
+ setBounds$a($Menu, x, y, width, height);
8461
+ renderInto($Menu, dom);
8462
+ $Menu.id = `Menu-${level}`;
8463
+ append$1($Menu);
8464
+ if (focusedIndex !== -1) {
8465
+ const $Child = $Menu.children[focusedIndex];
8466
+ // @ts-expect-error
8467
+ $Child.focus();
8468
+ }
8469
+ $$Menus.push($Menu);
8470
+ };
8471
+ const closeMenus = ($$Menus, change) => {
8472
+ const keepCount = change[1];
8473
+ const $$ToDispose = $$Menus.slice(keepCount);
8474
+ for (const $ToDispose of $$ToDispose) {
8475
+ remove$1($ToDispose);
8476
+ }
8477
+ $$Menus.length = keepCount;
8478
+ };
8479
+ const updateMenu = ($$Menus, change) => {
8480
+ const menu = change[1];
8481
+ const newLength = change[2];
8482
+ const dom = change[3];
8483
+ const {
8484
+ focusedIndex,
8485
+ height,
8486
+ level,
8487
+ width,
8488
+ x,
8489
+ y
8490
+ } = menu;
8491
+ const $Menu = $$Menus[level];
8492
+ setBounds$a($Menu, x, y, width, height);
8493
+ renderInto($Menu, dom);
8494
+ if (level === newLength - 1) {
8495
+ if (focusedIndex === -1) {
8496
+ $Menu.focus();
8497
+ } else {
8498
+ const $Child = $Menu.children[focusedIndex];
8499
+ $Child.focus();
8500
+ }
8501
+ }
8502
+ };
8503
+ const menuHandlers = {
8504
+ addMenu,
8505
+ closeMenus,
8506
+ updateMenu
8507
+ };
8406
8508
 
8407
8509
  // TODO recycle menus
8408
8510
  const setMenus = (state, changes, uid) => {
@@ -8414,72 +8516,9 @@ const setMenus = (state, changes, uid) => {
8414
8516
  } = state;
8415
8517
  for (const change of changes) {
8416
8518
  const type = change[0];
8417
- switch (type) {
8418
- case 'addMenu':
8419
- {
8420
- const menu = change[1];
8421
- const dom = change[2];
8422
- const $Menu = create$Menu();
8423
- set$3($Menu, uid);
8424
- $Menu.onmouseover = handleMenuMouseOver;
8425
- $Menu.onclick = handleMenuClick;
8426
- const {
8427
- focusedIndex,
8428
- height,
8429
- level,
8430
- width,
8431
- x,
8432
- y
8433
- } = menu;
8434
- setBounds$a($Menu, x, y, width, height);
8435
- renderInto($Menu, dom);
8436
- $Menu.id = `Menu-${level}`;
8437
- append$1($Menu);
8438
- if (focusedIndex !== -1) {
8439
- const $Child = $Menu.children[focusedIndex];
8440
- // @ts-expect-error
8441
- $Child.focus();
8442
- }
8443
- $$Menus.push($Menu);
8444
- break;
8445
- }
8446
- case 'closeMenus':
8447
- {
8448
- const keepCount = change[1];
8449
- const $$ToDispose = $$Menus.slice(keepCount);
8450
- for (const $ToDispose of $$ToDispose) {
8451
- remove$1($ToDispose);
8452
- }
8453
- $$Menus.length = keepCount;
8454
- break;
8455
- }
8456
- case 'updateMenu':
8457
- {
8458
- const menu = change[1];
8459
- const newLength = change[2];
8460
- const dom = change[3];
8461
- const {
8462
- focusedIndex,
8463
- height,
8464
- level,
8465
- width,
8466
- x,
8467
- y
8468
- } = menu;
8469
- const $Menu = $$Menus[level];
8470
- setBounds$a($Menu, x, y, width, height);
8471
- renderInto($Menu, dom);
8472
- if (level === newLength - 1) {
8473
- if (focusedIndex === -1) {
8474
- $Menu.focus();
8475
- } else {
8476
- const $Child = $Menu.children[focusedIndex];
8477
- $Child.focus();
8478
- }
8479
- }
8480
- break;
8481
- }
8482
- // No default
8519
+ const handler = menuHandlers[type];
8520
+ if (handler) {
8521
+ handler($$Menus, change, uid);
8483
8522
  }
8484
8523
  }
8485
8524
  };
@@ -8711,111 +8750,64 @@ const ViewletWebView = {
8711
8750
  setPosition
8712
8751
  };
8713
8752
 
8753
+ const moduleLoaders = {
8754
+ [ActivityBar]: () => ViewletActivityBar,
8755
+ [Audio$1]: () => ViewletAudio,
8756
+ [Clock]: () => ViewletClock,
8757
+ [ColorPicker]: () => ViewletColorPicker,
8758
+ [DebugConsole]: () => ViewletDebugConsole,
8759
+ [DefineKeyBinding]: () => ViewletDefineKeyBinding,
8760
+ [Dialog]: () => ViewletDialog,
8761
+ [DiffEditor]: () => ViewletDiffEditor,
8762
+ [E2eTest]: () => ViewletE2eTest,
8763
+ [E2eTests]: () => ViewletE2eTests,
8764
+ [EditorCodeGenerator]: () => ViewletEditorCodeGenerator,
8765
+ [EditorCompletion]: () => ViewletEditorCompletion,
8766
+ [EditorCompletionDetails]: () => ViewletEditorCompletionDetails,
8767
+ [EditorError]: () => ViewletEditorError,
8768
+ [EditorHover]: () => ViewletEditorHover,
8769
+ [EditorImage]: () => ViewletEditorImage,
8770
+ [EditorPlainText]: () => ViewletEditorPlainText,
8771
+ [EditorSourceActions]: () => ViewletEditorSourceActions,
8772
+ [EditorText]: () => ViewletEditorText,
8773
+ [EditorTextError]: () => ViewletEditorTextError,
8774
+ [EditorWidgetError]: () => ViewletEditorWidgetError,
8775
+ [Empty]: () => ViewletEmpty,
8776
+ [EmptyEditor]: () => ViewletEmptyEditor,
8777
+ [Error$1]: () => ViewletError,
8778
+ [FindWidget]: () => ViewletFindWidget,
8779
+ [ImagePreview]: () => ImagePreview$1,
8780
+ [Implementations]: () => ViewletImplementations,
8781
+ [InlineDiffEditor]: () => ViewletInlineDiffEditor,
8782
+ [KeyBindings]: () => ViewletKeyBindings,
8783
+ [Layout]: () => ViewletLayout,
8784
+ [Output]: () => ViewletOutput,
8785
+ [Panel]: () => ViewletPanel,
8786
+ [References]: () => ViewletReferences,
8787
+ [RunAndDebug]: () => ViewletRunAndDebug,
8788
+ [ScreenCapture]: () => ViewletScreenCapture,
8789
+ [SideBar]: () => ViewletSideBar,
8790
+ [SimpleBrowser]: () => ViewletSimpleBrowser,
8791
+ [SourceControl]: () => ViewletSourceControl,
8792
+ [StatusBar]: () => ViewletStatusBar,
8793
+ [Storage]: () => ViewletStorage,
8794
+ [Terminal]: () => Promise.resolve().then(function () { return ViewletTerminal; }),
8795
+ [Terminal2]: () => Promise.resolve().then(function () { return ViewletTerminal2; }),
8796
+ [Terminals]: () => ViewletTerminals,
8797
+ [TitleBar]: () => ViewletTitleBar,
8798
+ [TitleBarButtons]: () => ViewletTitleBarButtons,
8799
+ [TitleBarIcon]: () => ViewletTitleBarIcon,
8800
+ [TitleBarMenuBar]: () => ViewletTitleBarMenuBar,
8801
+ [TitleBarTitle]: () => ViewletTitleBarTitle,
8802
+ [Video]: () => ViewletVideo,
8803
+ [WebView]: () => ViewletWebView
8804
+ };
8714
8805
  const load$1 = moduleId => {
8715
- switch (moduleId) {
8716
- case ActivityBar:
8717
- return ViewletActivityBar;
8718
- case Audio$1:
8719
- return ViewletAudio;
8720
- case Clock:
8721
- return ViewletClock;
8722
- case ColorPicker:
8723
- return ViewletColorPicker;
8724
- case DebugConsole:
8725
- return ViewletDebugConsole;
8726
- case DefineKeyBinding:
8727
- return ViewletDefineKeyBinding;
8728
- case Dialog:
8729
- return ViewletDialog;
8730
- case DiffEditor:
8731
- return ViewletDiffEditor;
8732
- case E2eTest:
8733
- return ViewletE2eTest;
8734
- case E2eTests:
8735
- return ViewletE2eTests;
8736
- case EditorCodeGenerator:
8737
- return ViewletEditorCodeGenerator;
8738
- case EditorCompletion:
8739
- return ViewletEditorCompletion;
8740
- case EditorCompletionDetails:
8741
- return ViewletEditorCompletionDetails;
8742
- case EditorError:
8743
- return ViewletEditorError;
8744
- case EditorHover:
8745
- return ViewletEditorHover;
8746
- case EditorImage:
8747
- return ViewletEditorImage;
8748
- case EditorPlainText:
8749
- return ViewletEditorPlainText;
8750
- case EditorSourceActions:
8751
- return ViewletEditorSourceActions;
8752
- case EditorText:
8753
- return ViewletEditorText;
8754
- case EditorTextError:
8755
- return ViewletEditorTextError;
8756
- case EditorWidgetError:
8757
- return ViewletEditorWidgetError;
8758
- case Empty:
8759
- return ViewletEmpty;
8760
- case EmptyEditor:
8761
- return ViewletEmptyEditor;
8762
- case Error$1:
8763
- return ViewletError;
8764
- case FindWidget:
8765
- return ViewletFindWidget;
8766
- case ImagePreview:
8767
- return ImagePreview$1;
8768
- case Implementations:
8769
- return ViewletImplementations;
8770
- case InlineDiffEditor:
8771
- return ViewletInlineDiffEditor;
8772
- case KeyBindings:
8773
- return ViewletKeyBindings;
8774
- case Layout:
8775
- return ViewletLayout;
8776
- case Output:
8777
- return ViewletOutput;
8778
- case Panel:
8779
- return ViewletPanel;
8780
- case References:
8781
- return ViewletReferences;
8782
- case RunAndDebug:
8783
- return ViewletRunAndDebug;
8784
- case ScreenCapture:
8785
- return ViewletScreenCapture;
8786
- case SideBar:
8787
- return ViewletSideBar;
8788
- case SimpleBrowser:
8789
- return ViewletSimpleBrowser;
8790
- case SourceControl:
8791
- return ViewletSourceControl;
8792
- case StatusBar:
8793
- return ViewletStatusBar;
8794
- case Storage:
8795
- return ViewletStorage;
8796
- case Terminal:
8797
- return Promise.resolve().then(function () { return ViewletTerminal; });
8798
- case Terminal2:
8799
- return Promise.resolve().then(function () { return ViewletTerminal2; });
8800
- case Terminals:
8801
- return ViewletTerminals;
8802
- case TitleBar:
8803
- return ViewletTitleBar;
8804
- case TitleBarButtons:
8805
- return ViewletTitleBarButtons;
8806
- case TitleBarIcon:
8807
- return ViewletTitleBarIcon;
8808
- case TitleBarMenuBar:
8809
- return ViewletTitleBarMenuBar;
8810
- case TitleBarTitle:
8811
- return ViewletTitleBarTitle;
8812
- case Video:
8813
- return ViewletVideo;
8814
- case WebView:
8815
- return ViewletWebView;
8816
- default:
8817
- throw new Error(`${moduleId} module not found in renderer process`);
8806
+ const loadModule = moduleLoaders[moduleId];
8807
+ if (!loadModule) {
8808
+ throw new Error(`${moduleId} module not found in renderer process`);
8818
8809
  }
8810
+ return loadModule();
8819
8811
  };
8820
8812
 
8821
8813
  const state$1 = {
@@ -8829,7 +8821,7 @@ const create$4 = (id, uid = id) => {
8829
8821
  if (!module) {
8830
8822
  throw new Error(`module not found: ${id}`);
8831
8823
  }
8832
- const existing = get$1$1(id);
8824
+ const existing = get$a(id);
8833
8825
  if (existing?.state.$Viewlet.isConnected) {
8834
8826
  existing.state.$Viewlet.remove();
8835
8827
  }
@@ -8838,7 +8830,7 @@ const create$4 = (id, uid = id) => {
8838
8830
  if (module.attachEvents) {
8839
8831
  module.attachEvents(instanceState);
8840
8832
  }
8841
- set$1$1(uid, {
8833
+ set$9(uid, {
8842
8834
  factory: module,
8843
8835
  state: instanceState
8844
8836
  });
@@ -8851,14 +8843,14 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents) => {
8851
8843
  if (!module) {
8852
8844
  throw new Error(`module not found: ${id}`);
8853
8845
  }
8854
- const existing = get$1$1(id);
8846
+ const existing = get$a(id);
8855
8847
  if (existing?.state.$Viewlet.isConnected) {
8856
8848
  existing.state.$Viewlet.remove();
8857
8849
  }
8858
8850
  const instanceState = {
8859
8851
  $Viewlet: document.createElement('div')
8860
8852
  };
8861
- set$1$1(uid, {
8853
+ set$9(uid, {
8862
8854
  factory: module,
8863
8855
  state: instanceState
8864
8856
  });
@@ -8881,7 +8873,7 @@ const loadModule = async id => {
8881
8873
  };
8882
8874
  const invoke = (viewletId, method, ...args) => {
8883
8875
  string(method);
8884
- const instance = get$1$1(viewletId);
8876
+ const instance = get$a(viewletId);
8885
8877
  if (!instance?.factory) {
8886
8878
  if (viewletId && method !== 'setActionsDom') {
8887
8879
  warn$1(`cannot execute ${method} viewlet instance ${viewletId} not found`);
@@ -8899,7 +8891,7 @@ const focus$1 = viewletId => {
8899
8891
  // eslint-disable-next-line no-console
8900
8892
  console.trace(`focus ${viewletId}`);
8901
8893
  }
8902
- const instance = get$1$1(viewletId);
8894
+ const instance = get$a(viewletId);
8903
8895
  if (instance.factory?.setFocused) {
8904
8896
  instance.factory.setFocused(instance.state, true);
8905
8897
  } else if (instance?.factory?.focus) {
@@ -8915,7 +8907,7 @@ const focusElementByName = (viewletId, name) => {
8915
8907
  // eslint-disable-next-line no-console
8916
8908
  console.trace(`focusByName ${viewletId} ${name}`);
8917
8909
  }
8918
- const instance = get$1$1(viewletId);
8910
+ const instance = get$a(viewletId);
8919
8911
  if (!instance) {
8920
8912
  return;
8921
8913
  }
@@ -8930,7 +8922,7 @@ const focusElementByName = (viewletId, name) => {
8930
8922
  };
8931
8923
  const setElementProperty = (viewletId, name, key, value) => {
8932
8924
  const selector = `[name="${name}"]`;
8933
- const instance = get$1$1(viewletId);
8925
+ const instance = get$a(viewletId);
8934
8926
  if (!instance) {
8935
8927
  return;
8936
8928
  }
@@ -8959,7 +8951,7 @@ const setCheckBoxValue = (viewletId, name, value) => {
8959
8951
  };
8960
8952
  const setSelectionByName = (viewletId, name, start, end) => {
8961
8953
  const selector = `[name="${name}"]`;
8962
- const instance = get$1$1(viewletId);
8954
+ const instance = get$a(viewletId);
8963
8955
  if (!instance) {
8964
8956
  return;
8965
8957
  }
@@ -8974,7 +8966,7 @@ const setSelectionByName = (viewletId, name, start, end) => {
8974
8966
  $Element.selectionEnd = end;
8975
8967
  };
8976
8968
  const setUid = (viewletId, uid) => {
8977
- const instance = get$1$1(viewletId);
8969
+ const instance = get$a(viewletId);
8978
8970
  if (!instance) {
8979
8971
  return;
8980
8972
  }
@@ -8984,7 +8976,7 @@ const setUid = (viewletId, uid) => {
8984
8976
  set$3($Viewlet, uid);
8985
8977
  };
8986
8978
  const focusSelector = (viewletId, selector) => {
8987
- const instance = get$1$1(viewletId);
8979
+ const instance = get$a(viewletId);
8988
8980
  if (!instance) {
8989
8981
  return;
8990
8982
  }
@@ -9002,7 +8994,7 @@ const focusSelector = (viewletId, selector) => {
9002
8994
  * @deprecated
9003
8995
  */
9004
8996
  const refresh$1 = (viewletId, viewletContext) => {
9005
- const instance = get$1$1(viewletId);
8997
+ const instance = get$a(viewletId);
9006
8998
  if (instance) {
9007
8999
  instance.factory.refresh(instance.state, viewletContext);
9008
9000
  } else {
@@ -9021,10 +9013,10 @@ const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
9021
9013
  if (isSpecial(viewletId)) {
9022
9014
  $PlaceHolder.id = viewletId;
9023
9015
  }
9024
- const parentInstance = get$1$1(parentId);
9016
+ const parentInstance = get$a(parentId);
9025
9017
  const $Parent = parentInstance.state.$Viewlet;
9026
9018
  $Parent.append($PlaceHolder);
9027
- set$1$1(viewletId, {
9019
+ set$9(viewletId, {
9028
9020
  state: {
9029
9021
  $Viewlet: $PlaceHolder
9030
9022
  }
@@ -9034,7 +9026,7 @@ const setDragData = (viewletId, dragData) => {
9034
9026
  set$2(viewletId, dragData);
9035
9027
  };
9036
9028
  const setDom = (viewletId, dom) => {
9037
- const instance = get$1$1(viewletId);
9029
+ const instance = get$a(viewletId);
9038
9030
  if (!instance) {
9039
9031
  return;
9040
9032
  }
@@ -9047,7 +9039,7 @@ const setDom = (viewletId, dom) => {
9047
9039
  renderInto($Viewlet, dom, Events);
9048
9040
  };
9049
9041
  const setDom2 = (viewletId, dom) => {
9050
- const instance = get$1$1(viewletId);
9042
+ const instance = get$a(viewletId);
9051
9043
  if (!instance) {
9052
9044
  return;
9053
9045
  }
@@ -9069,7 +9061,7 @@ const setDom2 = (viewletId, dom) => {
9069
9061
  // @ts-ignore
9070
9062
  set$3($NewViewlet, uid);
9071
9063
  }
9072
- set$1$1(viewletId, {
9064
+ set$9(viewletId, {
9073
9065
  ...instance,
9074
9066
  state: {
9075
9067
  ...instance.state,
@@ -9078,7 +9070,7 @@ const setDom2 = (viewletId, dom) => {
9078
9070
  });
9079
9071
  };
9080
9072
  const setPatches = (uid, patches) => {
9081
- const instance = get$1$1(uid);
9073
+ const instance = get$a(uid);
9082
9074
  if (!instance) {
9083
9075
  return;
9084
9076
  }
@@ -9137,167 +9129,12 @@ const attachWindowEvents = () => {
9137
9129
 
9138
9130
  // TODO this code is bad
9139
9131
  const sendMultiple = commands => {
9140
- for (const command of commands) {
9141
- const [_, viewletId, method, ...args] = command;
9142
- switch (_) {
9143
- case 'Css.addCssStyleSheet':
9144
- case 'Viewlet.addCss':
9145
- case 'Viewlet.setCss':
9146
- // @ts-ignore
9147
- addCssStyleSheet(viewletId, method, ...args);
9148
- break;
9149
- case 'Viewlet.addKeyBindings':
9150
- addKeyBindings(viewletId, method);
9151
- break;
9152
- case 'Viewlet.append':
9153
- {
9154
- // @ts-expect-error
9155
- append(viewletId, method, ...args);
9156
- break;
9157
- }
9158
- case 'Viewlet.appendToBody':
9159
- {
9160
- // @ts-expect-error
9161
- appendToBody(viewletId, method, ...args);
9162
- break;
9163
- }
9164
- case 'Viewlet.appendViewlet':
9165
- {
9166
- // @ts-expect-error
9167
- appendViewlet(viewletId, method, ...args);
9168
- break;
9169
- }
9170
- case 'Viewlet.ariaAnnounce':
9171
- {
9172
- ariaAnnounce(viewletId);
9173
- break;
9174
- }
9175
- case 'Viewlet.attachWindowEvents':
9176
- // @ts-ignore
9177
- attachWindowEvents(viewletId, method, ...args);
9178
- break;
9179
- case 'Viewlet.create':
9180
- {
9181
- create$4(viewletId, method);
9182
- break;
9183
- }
9184
- case 'Viewlet.createFunctionalRoot':
9185
- {
9186
- // @ts-ignore
9187
- createFunctionalRoot(viewletId, method, ...args);
9188
- break;
9189
- }
9190
- case 'Viewlet.createPlaceholder':
9191
- {
9192
- // @ts-expect-error
9193
- createPlaceholder(viewletId, method, ...args);
9194
- break;
9195
- }
9196
- case 'Viewlet.dispose':
9197
- {
9198
- dispose$3(viewletId);
9199
- break;
9200
- }
9201
- case 'Viewlet.focus':
9202
- {
9203
- focus$1(viewletId);
9204
- break;
9205
- }
9206
- case 'Viewlet.focusElementByName':
9207
- // @ts-ignore
9208
- focusElementByName(viewletId, method, ...args);
9209
- break;
9210
- case 'Viewlet.focusSelector':
9211
- // @ts-ignore
9212
- focusSelector(viewletId, method, ...args);
9213
- break;
9214
- case 'Viewlet.focusSelector':
9215
- // @ts-ignore
9216
- focusSelector(viewletId, method, ...args);
9217
- break;
9218
- case 'Viewlet.handleError':
9219
- {
9220
- // @ts-expect-error
9221
- handleError$1(viewletId, method, ...args);
9222
- break;
9223
- }
9224
- case 'Viewlet.move':
9225
- // @ts-ignore
9226
- move(viewletId, method, ...args);
9227
- break;
9228
- case 'Viewlet.registerEventListeners':
9229
- // @ts-ignore
9230
- registerEventListeners(viewletId, method, ...args);
9231
- break;
9232
- case 'Viewlet.removeKeyBindings':
9233
- removeKeyBindings(viewletId);
9234
- break;
9235
- case 'Viewlet.replaceChildren':
9236
- // @ts-ignore
9237
- replaceChildren(viewletId, method, ...args);
9238
- break;
9239
- case 'Viewlet.send':
9240
- invoke(viewletId, method, ...args);
9241
- break;
9242
- case 'Viewlet.setBounds':
9243
- {
9244
- // @ts-expect-error
9245
- setBounds$1(viewletId, method, ...args);
9246
- break;
9247
- }
9248
- case 'Viewlet.setCheckBoxValue':
9249
- // @ts-ignore
9250
- setCheckBoxValue(viewletId, method, ...args);
9251
- break;
9252
- case 'Viewlet.setDom':
9253
- // @ts-expect-error
9254
- setDom(viewletId, method, ...args);
9255
- break;
9256
- case 'Viewlet.setDom2':
9257
- // @ts-ignore
9258
- setDom2(viewletId, method, ...args);
9259
- break;
9260
- case 'Viewlet.setDragData':
9261
- // @ts-ignore
9262
- setDragData(viewletId, method, ...args);
9263
- break;
9264
- case 'Viewlet.setInputValues':
9265
- // @ts-ignore
9266
- setInputValues(viewletId, method, ...args);
9267
- break;
9268
- case 'Viewlet.setPatches':
9269
- {
9270
- // @ts-ignore
9271
- setPatches(viewletId, method, ...args);
9272
- break;
9273
- }
9274
- case 'Viewlet.setProperty':
9275
- // @ts-ignore
9276
- setProperty(viewletId, method, ...args);
9277
- break;
9278
- case 'Viewlet.setSelectionByName':
9279
- // @ts-ignore
9280
- setSelectionByName(viewletId, method, ...args);
9281
- break;
9282
- case 'Viewlet.setUid':
9283
- // @ts-ignore
9284
- setUid(viewletId, method, ...args);
9285
- break;
9286
- case 'Viewlet.setValueByName':
9287
- // @ts-ignore
9288
- setValueByName(viewletId, method, ...args);
9289
- break;
9290
- default:
9291
- {
9292
- invoke(viewletId, method, ...args);
9293
- }
9294
- }
9295
- }
9132
+ executeCommands(commands);
9296
9133
  };
9297
9134
  const dispose$3 = id => {
9298
9135
  try {
9299
9136
  number(id);
9300
- const instance = get$1$1(id);
9137
+ const instance = get$a(id);
9301
9138
  if (!instance) {
9302
9139
  warn$1(`viewlet instance ${id} not found and cannot be disposed`);
9303
9140
  return;
@@ -9308,14 +9145,14 @@ const dispose$3 = id => {
9308
9145
  if (instance.state.$Viewlet?.isConnected) {
9309
9146
  instance.state.$Viewlet.remove();
9310
9147
  }
9311
- set$1$1(id, undefined);
9148
+ set$9(id, undefined);
9312
9149
  } catch {
9313
9150
  throw new Error(`Failed to dispose ${id}`);
9314
9151
  }
9315
9152
  };
9316
9153
  const handleError$1 = (id, parentId, message) => {
9317
9154
  info(`[viewlet-error] ${id}: ${message}`);
9318
- const instance = get$1$1(id);
9155
+ const instance = get$a(id);
9319
9156
  if (instance?.state.$Viewlet.isConnected) {
9320
9157
  instance.state.$Viewlet.remove();
9321
9158
  }
@@ -9327,7 +9164,7 @@ const handleError$1 = (id, parentId, message) => {
9327
9164
  instance.state.$Viewlet.textContent = `${message}`;
9328
9165
  }
9329
9166
  // TODO error should bubble up to until highest possible component
9330
- const parentInstance = get$1$1(parentId);
9167
+ const parentInstance = get$a(parentId);
9331
9168
  if (parentInstance?.factory?.handleError) {
9332
9169
  parentInstance.factory.handleError(instance.state, message);
9333
9170
  }
@@ -9341,9 +9178,9 @@ const appendViewlet = (parentId, childId, focus) => {
9341
9178
  // TODO
9342
9179
  return;
9343
9180
  }
9344
- const parentInstanceState = get$1$1(parentId); // TODO must ensure that parent is already created
9181
+ const parentInstanceState = get$a(parentId); // TODO must ensure that parent is already created
9345
9182
  const parentModule = parentInstanceState.factory;
9346
- const childInstance = get$1$1(childId);
9183
+ const childInstance = get$a(childId);
9347
9184
  if (!childInstance) {
9348
9185
  throw new Error(`child instance ${childId} must be defined to be appended to parent ${parentId}`);
9349
9186
  }
@@ -9359,49 +9196,70 @@ const ariaAnnounce = async message => {
9359
9196
  const AriaAlert$1 = await Promise.resolve().then(function () { return AriaAlert; });
9360
9197
  AriaAlert$1.alert(message);
9361
9198
  };
9199
+ const prependChild = ($Parent, $Child) => {
9200
+ $Parent.prepend($Child);
9201
+ return true;
9202
+ };
9203
+ const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
9204
+ for (let i = childIndex - 1; i >= 0; i--) {
9205
+ const beforeId = referenceNodes[i];
9206
+ const beforeInstance = get$a(beforeId);
9207
+ if (beforeInstance) {
9208
+ const $ReferenceNode = beforeInstance.state.$Viewlet;
9209
+ $ReferenceNode.after($Child);
9210
+ return true;
9211
+ }
9212
+ }
9213
+ return false;
9214
+ };
9215
+ const appendBeforeNextReference = (referenceNodes, childIndex, $Child) => {
9216
+ for (let i = childIndex + 1; i < referenceNodes.length; i++) {
9217
+ const afterId = referenceNodes[i];
9218
+ const afterInstance = get$a(afterId);
9219
+ if (afterInstance) {
9220
+ const $ReferenceNode = afterInstance.state.$Viewlet;
9221
+ $ReferenceNode.before($Child);
9222
+ return true;
9223
+ }
9224
+ }
9225
+ return false;
9226
+ };
9227
+ const appendWithReferenceNodes = ($Parent, $Child, childId, referenceNodes) => {
9228
+ if (childId === referenceNodes[0]) {
9229
+ return prependChild($Parent, $Child);
9230
+ }
9231
+ const childIndex = referenceNodes.indexOf(childId);
9232
+ if (childIndex === -1) {
9233
+ $Parent.append($Child);
9234
+ return false;
9235
+ }
9236
+ if (appendAfterPreviousReference(referenceNodes, childIndex, $Child)) {
9237
+ return true;
9238
+ }
9239
+ if (appendBeforeNextReference(referenceNodes, childIndex, $Child)) {
9240
+ return true;
9241
+ }
9242
+ $Parent.append($Child);
9243
+ return false;
9244
+ };
9362
9245
  const append = (parentId, childId, referenceNodes) => {
9363
9246
  number(parentId);
9364
9247
  number(childId);
9365
- const parentInstance = get$1$1(parentId);
9248
+ const parentInstance = get$a(parentId);
9366
9249
  if (!parentInstance) {
9367
9250
  throw new Error(`cannot append child: instance ${parentId} not found`);
9368
9251
  }
9369
9252
  const $Parent = parentInstance.state.$Viewlet;
9370
- const childInstance = get$1$1(childId);
9253
+ const childInstance = get$a(childId);
9371
9254
  if (!childInstance) {
9372
9255
  throw new Error(`cannot append child: child instance not found ${childId}`);
9373
9256
  }
9374
9257
  const $Child = childInstance.state.$Viewlet;
9375
9258
  if (referenceNodes) {
9376
9259
  // TODO this might be too inefficient
9377
- if (childId === referenceNodes[0]) {
9378
- $Parent.prepend($Child);
9260
+ if (appendWithReferenceNodes($Parent, $Child, childId, referenceNodes)) {
9379
9261
  return;
9380
9262
  }
9381
- for (let i = 0; i < referenceNodes.length; i++) {
9382
- const id = referenceNodes[i];
9383
- if (id === childId) {
9384
- for (let j = i - 1; j >= 0; j--) {
9385
- const beforeId = referenceNodes[j];
9386
- const beforeInstance = get$1$1(beforeId);
9387
- if (beforeInstance) {
9388
- const $ReferenceNode = beforeInstance.state.$Viewlet;
9389
- $ReferenceNode.after($Child);
9390
- return;
9391
- }
9392
- }
9393
- for (let j = i + 1; j < referenceNodes.length; j++) {
9394
- const afterId = referenceNodes[j];
9395
- const afterInstance = get$1$1(afterId);
9396
- if (afterInstance) {
9397
- const $ReferenceNode = afterInstance.state.$Viewlet;
9398
- $ReferenceNode.before($Child);
9399
- return;
9400
- }
9401
- }
9402
- }
9403
- }
9404
- $Parent.append($Child);
9405
9263
  } else {
9406
9264
  $Parent.append($Child);
9407
9265
  }
@@ -9410,11 +9268,11 @@ const append = (parentId, childId, referenceNodes) => {
9410
9268
  }
9411
9269
  };
9412
9270
  const replaceChildren = (parentId, childIds) => {
9413
- const parentInstance = get$1$1(parentId);
9271
+ const parentInstance = get$a(parentId);
9414
9272
  const $Parent = parentInstance.state.$Viewlet;
9415
9273
  const $Fragment = document.createDocumentFragment();
9416
9274
  for (const childId of childIds) {
9417
- const childInstance = get$1$1(childId);
9275
+ const childInstance = get$a(childId);
9418
9276
  const $Child = childInstance.state.$Viewlet;
9419
9277
  $Fragment.append($Child);
9420
9278
  }
@@ -9422,72 +9280,10 @@ const replaceChildren = (parentId, childIds) => {
9422
9280
  };
9423
9281
  const appendToBody = childId => {
9424
9282
  const $Parent = document.body;
9425
- const childInstance = get$1$1(childId);
9283
+ const childInstance = get$a(childId);
9426
9284
  const $Child = childInstance.state.$Viewlet;
9427
9285
  $Parent.append($Child);
9428
9286
  };
9429
- const getFn = command => {
9430
- switch (command) {
9431
- case 'Css.addCssStyleSheet':
9432
- case 'Viewlet.addCss':
9433
- case 'Viewlet.setCss':
9434
- return addCssStyleSheet;
9435
- case 'Viewlet.addKeyBindings':
9436
- return addKeyBindings;
9437
- case 'Viewlet.append':
9438
- return append;
9439
- case 'Viewlet.appendToBody':
9440
- return appendToBody;
9441
- case 'Viewlet.appendViewlet':
9442
- return appendViewlet;
9443
- case 'Viewlet.ariaAnnounce':
9444
- return ariaAnnounce;
9445
- case 'Viewlet.attachWindowEvents':
9446
- return attachWindowEvents;
9447
- case 'Viewlet.create':
9448
- return create$4;
9449
- case 'Viewlet.createFunctionalRoot':
9450
- return createFunctionalRoot;
9451
- case 'Viewlet.createPlaceholder':
9452
- return createPlaceholder;
9453
- case 'Viewlet.dispose':
9454
- return dispose$3;
9455
- case 'Viewlet.focus':
9456
- return focus$1;
9457
- case 'Viewlet.focusElementByName':
9458
- return focusElementByName;
9459
- case 'Viewlet.focusSelector':
9460
- return focusSelector;
9461
- case 'Viewlet.registerEventListeners':
9462
- return registerEventListeners;
9463
- case 'Viewlet.replaceChildren':
9464
- return replaceChildren;
9465
- case 'Viewlet.send':
9466
- return invoke;
9467
- case 'Viewlet.setBounds':
9468
- return setBounds$1;
9469
- case 'Viewlet.setCheckBoxValue':
9470
- return setCheckBoxValue;
9471
- case 'Viewlet.setDom':
9472
- return setDom;
9473
- case 'Viewlet.setDom2':
9474
- return setDom2;
9475
- case 'Viewlet.setDragData':
9476
- return setDragData;
9477
- case 'Viewlet.setInputValues':
9478
- return setInputValues;
9479
- case 'Viewlet.setPatches':
9480
- return setPatches;
9481
- case 'Viewlet.setProperty':
9482
- return setProperty;
9483
- case 'Viewlet.setValueByName':
9484
- return setValueByName;
9485
- case 'Viewlet.show':
9486
- return show;
9487
- default:
9488
- throw new Error(`unknown command ${command}`);
9489
- }
9490
- };
9491
9287
  const executeCommands = commands => {
9492
9288
  for (const [command, ...args] of commands) {
9493
9289
  const fn = getFn(command);
@@ -9496,7 +9292,7 @@ const executeCommands = commands => {
9496
9292
  }
9497
9293
  };
9498
9294
  const show = id => {
9499
- const instance = get$1$1(id);
9295
+ const instance = get$a(id);
9500
9296
  const $Viewlet = instance.state.$Viewlet;
9501
9297
  const $Workbench = document.getElementById('Workbench');
9502
9298
  // @ts-expect-error
@@ -9506,7 +9302,7 @@ const show = id => {
9506
9302
  }
9507
9303
  };
9508
9304
  const setBounds$1 = (id, left, top, width, height) => {
9509
- const instance = get$1$1(id);
9305
+ const instance = get$a(id);
9510
9306
  if (!instance) {
9511
9307
  return;
9512
9308
  }
@@ -9514,7 +9310,7 @@ const setBounds$1 = (id, left, top, width, height) => {
9514
9310
  setBounds$a($Viewlet, left, top, width, height);
9515
9311
  };
9516
9312
  const setProperty = (id, selector, property, value) => {
9517
- const instance = get$1$1(id);
9313
+ const instance = get$a(id);
9518
9314
  if (!instance) {
9519
9315
  return;
9520
9316
  }
@@ -9525,6 +9321,49 @@ const setProperty = (id, selector, property, value) => {
9525
9321
  }
9526
9322
  $Element[property] = value;
9527
9323
  };
9324
+ const commandHandlers = {
9325
+ 'Css.addCssStyleSheet': addCssStyleSheet,
9326
+ 'Viewlet.addCss': addCssStyleSheet,
9327
+ 'Viewlet.addKeyBindings': addKeyBindings,
9328
+ 'Viewlet.append': append,
9329
+ 'Viewlet.appendToBody': appendToBody,
9330
+ 'Viewlet.appendViewlet': appendViewlet,
9331
+ 'Viewlet.ariaAnnounce': ariaAnnounce,
9332
+ 'Viewlet.attachWindowEvents': attachWindowEvents,
9333
+ 'Viewlet.create': create$4,
9334
+ 'Viewlet.createFunctionalRoot': createFunctionalRoot,
9335
+ 'Viewlet.createPlaceholder': createPlaceholder,
9336
+ 'Viewlet.dispose': dispose$3,
9337
+ 'Viewlet.focus': focus$1,
9338
+ 'Viewlet.focusElementByName': focusElementByName,
9339
+ 'Viewlet.focusSelector': focusSelector,
9340
+ 'Viewlet.handleError': handleError$1,
9341
+ 'Viewlet.move': move,
9342
+ 'Viewlet.registerEventListeners': registerEventListeners,
9343
+ 'Viewlet.removeKeyBindings': removeKeyBindings,
9344
+ 'Viewlet.replaceChildren': replaceChildren,
9345
+ 'Viewlet.send': invoke,
9346
+ 'Viewlet.setBounds': setBounds$1,
9347
+ 'Viewlet.setCheckBoxValue': setCheckBoxValue,
9348
+ 'Viewlet.setCss': addCssStyleSheet,
9349
+ 'Viewlet.setDom': setDom,
9350
+ 'Viewlet.setDom2': setDom2,
9351
+ 'Viewlet.setDragData': setDragData,
9352
+ 'Viewlet.setInputValues': setInputValues,
9353
+ 'Viewlet.setPatches': setPatches,
9354
+ 'Viewlet.setProperty': setProperty,
9355
+ 'Viewlet.setSelectionByName': setSelectionByName,
9356
+ 'Viewlet.setUid': setUid,
9357
+ 'Viewlet.setValueByName': setValueByName,
9358
+ 'Viewlet.show': show
9359
+ };
9360
+ const getFn = command => {
9361
+ const fn = commandHandlers[command];
9362
+ if (!fn) {
9363
+ throw new Error(`unknown command ${command}`);
9364
+ }
9365
+ return fn;
9366
+ };
9528
9367
 
9529
9368
  const LocalStorage = 1;
9530
9369
  const SessionStorage = 2;
@@ -9627,7 +9466,7 @@ const handleMessagePort = async port => {
9627
9466
  };
9628
9467
 
9629
9468
  const set = ($Iframe, permissionPolicy) => {
9630
- if (permissionPolicy === undefined) {
9469
+ if (!permissionPolicy) {
9631
9470
  return;
9632
9471
  }
9633
9472
  $Iframe.allow = permissionPolicy;
@@ -9748,6 +9587,7 @@ const commandMap = {
9748
9587
  'OffscreenCanvas.create': create$w,
9749
9588
  'OffscreenCanvas.create2': create2,
9750
9589
  'Open.openUrl': openUrl,
9590
+ 'Open.redirectToUrl': redirectToUrl,
9751
9591
  'Performance.getMemory': getMemory,
9752
9592
  'Performance.measureUserAgentSpecificMemory': measureUserAgentSpecificMemory,
9753
9593
  'PointerCapture.mock': mock,
@@ -9971,15 +9811,9 @@ const isNormalStackLine = line => {
9971
9811
  };
9972
9812
  const isApplicationUsefulLine = (line, index) => {
9973
9813
  if (index === 0) {
9974
- if (RE_ASSERT.test(line)) {
9975
- return false;
9976
- }
9977
- return true;
9978
- }
9979
- if (RE_RESTORE_JSON_RPC_ERROR.test(line) || RE_JSON_RPC_INVOKE.test(line) || RE_UNWRAP_JSON_RPC_RESULT.test(line) || RE_CONSTRUCT_ERROR.test(line) || RE_HANDLE_JSON_RPC_MESSAGE.test(line)) {
9980
- return false;
9814
+ return !RE_ASSERT.test(line);
9981
9815
  }
9982
- return true;
9816
+ return !(RE_RESTORE_JSON_RPC_ERROR.test(line) || RE_JSON_RPC_INVOKE.test(line) || RE_UNWRAP_JSON_RPC_RESULT.test(line) || RE_CONSTRUCT_ERROR.test(line) || RE_HANDLE_JSON_RPC_MESSAGE.test(line));
9983
9817
  };
9984
9818
  const cleanLine = line => {
9985
9819
  if (line.startsWith(' at async Module.')) {
@@ -10034,10 +9868,7 @@ const cleanStack = stack => {
10034
9868
  };
10035
9869
 
10036
9870
  const isActualSourceFile = path => {
10037
- if (path === '<anonymous>' || path === 'debugger eval code' || path.startsWith('"') || path.startsWith(`'`) || path.startsWith(')') || path.startsWith('file://')) {
10038
- return false;
10039
- }
10040
- return true;
9871
+ return !(path === '<anonymous>' || path === 'debugger eval code' || path.startsWith('"') || path.startsWith(`'`) || path.startsWith(')') || path.startsWith('file://'));
10041
9872
  };
10042
9873
 
10043
9874
  const getIsFirefox = () => {
@@ -10421,6 +10252,10 @@ const reduceWrite = (state, action) => {
10421
10252
  };
10422
10253
  const reduce = (state, action) => {
10423
10254
  switch (action.type) {
10255
+ case 'focus':
10256
+ {
10257
+ return;
10258
+ }
10424
10259
  case 'write':
10425
10260
  {
10426
10261
  return;
@@ -10535,6 +10370,17 @@ const setMessage = ($Old, $New, message) => {
10535
10370
  $New.removeAttribute(AriaHidden);
10536
10371
  $New.textContent = message;
10537
10372
  };
10373
+ const getElements = () => {
10374
+ const $AriaAlert1 = getAriaAlert1();
10375
+ const $AriaAlert2 = getAriaAlert2();
10376
+ if (!$AriaAlert1 || !$AriaAlert2) {
10377
+ throw new Error('aria alert elements not found');
10378
+ }
10379
+ return {
10380
+ $AriaAlert1,
10381
+ $AriaAlert2
10382
+ };
10383
+ };
10538
10384
  const alert$1 = message => {
10539
10385
  if (!message) {
10540
10386
  return;
@@ -10549,9 +10395,10 @@ const alert$1 = message => {
10549
10395
  document.body.append($AriaMessages);
10550
10396
  setElements($AriaMessages, $AriaAlert1, $AriaAlert2);
10551
10397
  }
10552
- const $AriaAlert1 = getAriaAlert1();
10553
- const $AriaAlert2 = getAriaAlert2();
10554
- // @ts-expect-error
10398
+ const {
10399
+ $AriaAlert1,
10400
+ $AriaAlert2
10401
+ } = getElements();
10555
10402
  if ($AriaAlert1.textContent === message) {
10556
10403
  setMessage($AriaAlert1, $AriaAlert2, message);
10557
10404
  } else {