Updated to noVNC 1.3.0, #2603
Ylian Saint-Hilaire committed
Nov 29, 2021 at 12:08 UTC
112ebde4f21ad8a4d423312c62e23ab1c8ec792b
75 files changed
+3714
-60024
public/novnc/LICENSE.txt
+1
-7
@@ -1,4 +1,4 @@
1
-noVNC is Copyright (C) 2018 The noVNC Authors
1
+noVNC is Copyright (C) 2019 The noVNC Authors
2
(./AUTHORS)
3
4
The noVNC core library files are licensed under the MPL 2.0 (Mozilla
@@ -42,12 +42,6 @@ licenses (all MPL 2.0 compatible):
42
43
vendor/pako/ : MIT
44
45
- vendor/browser-es-module-loader/src/ : MIT
46
-
47
- vendor/browser-es-module-loader/dist/ : Various BSD style licenses
48
-
49
- vendor/promise.js : MIT
50
-
45
Any other files not mentioned above are typically marked with
46
a copyright/license header at the top of the file. The default noVNC
47
license is MPL-2.0.
public/novnc/app/error-handler.js
+8
@@ -1,3 +1,11 @@
1
+/*
2
+ * noVNC: HTML5 VNC client
3
+ * Copyright (C) 2019 The noVNC Authors
4
+ * Licensed under MPL 2.0 (see LICENSE.txt)
5
+ *
6
+ * See README.md for usage and integration instructions.
7
+ */
8
+
9
// NB: this should *not* be included as a module until we have
10
// native support in the browsers, so that our error handler
11
// can catch script-loading errors.
public/novnc/app/images/icons/Makefile
new
+42
@@ -0,0 +1,42 @@
1
+ICONS := \
2
+ novnc-16x16.png \
3
+ novnc-24x24.png \
4
+ novnc-32x32.png \
5
+ novnc-48x48.png \
6
+ novnc-64x64.png
7
+
8
+ANDROID_LAUNCHER := \
9
+ novnc-48x48.png \
10
+ novnc-72x72.png \
11
+ novnc-96x96.png \
12
+ novnc-144x144.png \
13
+ novnc-192x192.png
14
+
15
+IPHONE_LAUNCHER := \
16
+ novnc-60x60.png \
17
+ novnc-120x120.png
18
+
19
+IPAD_LAUNCHER := \
20
+ novnc-76x76.png \
21
+ novnc-152x152.png
22
+
23
+ALL_ICONS := $(ICONS) $(ANDROID_LAUNCHER) $(IPHONE_LAUNCHER) $(IPAD_LAUNCHER)
24
+
25
+all: $(ALL_ICONS)
26
+
27
+novnc-16x16.png: novnc-icon-sm.svg
28
+ convert -density 90 \
29
+ -background transparent "$<" "$@"
30
+novnc-24x24.png: novnc-icon-sm.svg
31
+ convert -density 135 \
32
+ -background transparent "$<" "$@"
33
+novnc-32x32.png: novnc-icon-sm.svg
34
+ convert -density 180 \
35
+ -background transparent "$<" "$@"
36
+
37
+novnc-%.png: novnc-icon.svg
38
+ convert -density $$[`echo $* | cut -d x -f 1` * 90 / 48] \
39
+ -background transparent "$<" "$@"
40
+
41
+clean:
42
+ rm -f *.png
public/novnc/app/images/icons/novnc-120x120.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-120x120.png differ
public/novnc/app/images/icons/novnc-144x144.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-144x144.png differ
public/novnc/app/images/icons/novnc-152x152.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-152x152.png differ
public/novnc/app/images/icons/novnc-16x16.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-16x16.png differ
public/novnc/app/images/icons/novnc-192x192.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-192x192.png differ
public/novnc/app/images/icons/novnc-24x24.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-24x24.png differ
public/novnc/app/images/icons/novnc-32x32.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-32x32.png differ
public/novnc/app/images/icons/novnc-48x48.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-48x48.png differ
public/novnc/app/images/icons/novnc-60x60.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-60x60.png differ
public/novnc/app/images/icons/novnc-64x64.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-64x64.png differ
public/novnc/app/images/icons/novnc-72x72.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-72x72.png differ
public/novnc/app/images/icons/novnc-76x76.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-76x76.png differ
public/novnc/app/images/icons/novnc-96x96.png
Binary files /dev/null and b/public/novnc/app/images/icons/novnc-96x96.png differ
public/novnc/app/images/icons/novnc-icon-sm.svg
new
+163
@@ -0,0 +1,163 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+<svg
5
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+ xmlns:cc="http://creativecommons.org/ns#"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ xmlns:svg="http://www.w3.org/2000/svg"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
+ width="16"
13
+ height="16"
14
+ viewBox="0 0 16 16"
15
+ id="svg2"
16
+ version="1.1"
17
+ inkscape:version="0.91 r13725"
18
+ sodipodi:docname="novnc-icon-sm.svg">
19
+ <defs
20
+ id="defs4" />
21
+ <sodipodi:namedview
22
+ id="base"
23
+ pagecolor="#ffffff"
24
+ bordercolor="#666666"
25
+ borderopacity="1.0"
26
+ inkscape:pageopacity="0.0"
27
+ inkscape:pageshadow="2"
28
+ inkscape:zoom="45.254834"
29
+ inkscape:cx="9.722703"
30
+ inkscape:cy="5.5311896"
31
+ inkscape:document-units="px"
32
+ inkscape:current-layer="layer1"
33
+ showgrid="false"
34
+ units="px"
35
+ inkscape:object-nodes="true"
36
+ inkscape:snap-smooth-nodes="true"
37
+ inkscape:snap-midpoints="true"
38
+ inkscape:window-width="1920"
39
+ inkscape:window-height="1136"
40
+ inkscape:window-x="1920"
41
+ inkscape:window-y="27"
42
+ inkscape:window-maximized="1">
43
+ <inkscape:grid
44
+ type="xygrid"
45
+ id="grid4169" />
46
+ </sodipodi:namedview>
47
+ <metadata
48
+ id="metadata7">
49
+ <rdf:RDF>
50
+ <cc:Work
51
+ rdf:about="">
52
+ <dc:format>image/svg+xml</dc:format>
53
+ <dc:type
54
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
55
+ <dc:title></dc:title>
56
+ </cc:Work>
57
+ </rdf:RDF>
58
+ </metadata>
59
+ <g
60
+ inkscape:label="Layer 1"
61
+ inkscape:groupmode="layer"
62
+ id="layer1"
63
+ transform="translate(0,-1036.3621)">
64
+ <rect
65
+ style="opacity:1;fill:#494949;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
66
+ id="rect4167"
67
+ width="16"
68
+ height="15.999992"
69
+ x="0"
70
+ y="1036.3622"
71
+ ry="2.6666584" />
72
+ <path
73
+ style="opacity:1;fill:#313131;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
74
+ d="M 2.6666667,1036.3621 C 1.1893373,1036.3621 0,1037.5515 0,1039.0288 l 0,10.6666 c 0,1.4774 1.1893373,2.6667 2.6666667,2.6667 l 4,0 C 11.837333,1052.3621 16,1046.7128 16,1039.6955 l 0,-0.6667 c 0,-1.4773 -1.189337,-2.6667 -2.666667,-2.6667 l -10.6666663,0 z"
75
+ id="rect4173"
76
+ inkscape:connector-curvature="0" />
77
+ <g
78
+ id="g4381">
79
+ <g
80
+ transform="translate(0.25,0.25)"
81
+ style="fill:#000000;fill-opacity:1"
82
+ id="g4365">
83
+ <g
84
+ style="fill:#000000;fill-opacity:1"
85
+ id="g4367">
86
+ <path
87
+ inkscape:connector-curvature="0"
88
+ id="path4369"
89
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
90
+ d="m 4.3289754,1039.3621 c 0.1846149,0 0.3419956,0.071 0.4716623,0.2121 C 4.933546,1039.7121 5,1039.8793 5,1040.0759 l 0,3.2862 -1,0 0,-2.964 c 0,-0.024 -0.011592,-0.036 -0.034038,-0.036 l -1.931924,0 C 2.011349,1040.3621 2,1040.3741 2,1040.3981 l 0,2.964 -1,0 0,-4 z"
91
+ sodipodi:nodetypes="scsccsssscccs" />
92
+ <path
93
+ inkscape:connector-curvature="0"
94
+ id="path4371"
95
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
96
+ d="m 6.6710244,1039.3621 2.6579513,0 c 0.184775,0 0.3419957,0.071 0.471662,0.2121 C 9.933546,1039.7121 10,1039.8793 10,1040.0759 l 0,2.5724 c 0,0.1966 -0.066454,0.3655 -0.1993623,0.5069 -0.1296663,0.1379 -0.286887,0.2069 -0.471662,0.2069 l -2.6579513,0 c -0.184775,0 -0.3436164,-0.069 -0.4765247,-0.2069 C 6.0648334,1043.0138 6,1042.8449 6,1042.6483 l 0,-2.5724 c 0,-0.1966 0.064833,-0.3638 0.1944997,-0.5017 0.1329083,-0.1414 0.2917497,-0.2121 0.4765247,-0.2121 z m 2.2949386,1 -1.931926,0 C 7.011344,1040.3621 7,1040.3741 7,1040.3981 l 0,1.928 c 0,0.024 0.011347,0.036 0.034037,0.036 l 1.931926,0 c 0.02269,0 0.034037,-0.012 0.034037,-0.036 l 0,-1.928 c 0,-0.024 -0.011347,-0.036 -0.034037,-0.036 z"
97
+ sodipodi:nodetypes="sscsscsscsscssssssssss" />
98
+ </g>
99
+ <g
100
+ style="fill:#000000;fill-opacity:1"
101
+ id="g4373">
102
+ <path
103
+ inkscape:connector-curvature="0"
104
+ id="path4375"
105
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
106
+ d="m 3,1047.1121 1,-2.75 1,0 -1.5,4 -1,0 -1.5,-4 1,0 z"
107
+ sodipodi:nodetypes="cccccccc" />
108
+ <path
109
+ inkscape:connector-curvature="0"
110
+ id="path4377"
111
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
112
+ d="m 9,1046.8621 0,-2.5 1,0 0,4 -1,0 -2,-2.5 0,2.5 -1,0 0,-4 1,0 z"
113
+ sodipodi:nodetypes="ccccccccccc" />
114
+ <path
115
+ inkscape:connector-curvature="0"
116
+ id="path4379"
117
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
118
+ d="m 15,1045.3621 -2.96596,0 c -0.02269,0 -0.03404,0.012 -0.03404,0.036 l 0,1.928 c 0,0.024 0.01135,0.036 0.03404,0.036 l 2.96596,0 0,1 -3.324113,0 c -0.188017,0 -0.348479,-0.068 -0.481388,-0.2037 C 11.064833,1048.0192 11,1047.8511 11,1047.6542 l 0,-2.5842 c 0,-0.1969 0.06483,-0.3633 0.194499,-0.4991 0.132909,-0.1392 0.293371,-0.2088 0.481388,-0.2088 l 3.324113,0 z"
119
+ sodipodi:nodetypes="cssssccscsscscc" />
120
+ </g>
121
+ </g>
122
+ <g
123
+ id="g4356">
124
+ <g
125
+ id="g4347">
126
+ <path
127
+ sodipodi:nodetypes="scsccsssscccs"
128
+ d="m 4.3289754,1039.3621 c 0.1846149,0 0.3419956,0.071 0.4716623,0.2121 C 4.933546,1039.7121 5,1039.8793 5,1040.0759 l 0,3.2862 -1,0 0,-2.964 c 0,-0.024 -0.011592,-0.036 -0.034038,-0.036 l -1.931924,0 c -0.022689,0 -0.034038,0.012 -0.034038,0.036 l 0,2.964 -1,0 0,-4 z"
129
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
130
+ id="path4143"
131
+ inkscape:connector-curvature="0" />
132
+ <path
133
+ sodipodi:nodetypes="sscsscsscsscssssssssss"
134
+ d="m 6.6710244,1039.3621 2.6579513,0 c 0.184775,0 0.3419957,0.071 0.471662,0.2121 C 9.933546,1039.7121 10,1039.8793 10,1040.0759 l 0,2.5724 c 0,0.1966 -0.066454,0.3655 -0.1993623,0.5069 -0.1296663,0.1379 -0.286887,0.2069 -0.471662,0.2069 l -2.6579513,0 c -0.184775,0 -0.3436164,-0.069 -0.4765247,-0.2069 C 6.0648334,1043.0138 6,1042.8449 6,1042.6483 l 0,-2.5724 c 0,-0.1966 0.064833,-0.3638 0.1944997,-0.5017 0.1329083,-0.1414 0.2917497,-0.2121 0.4765247,-0.2121 z m 2.2949386,1 -1.931926,0 C 7.011344,1040.3621 7,1040.3741 7,1040.3981 l 0,1.928 c 0,0.024 0.011347,0.036 0.034037,0.036 l 1.931926,0 c 0.02269,0 0.034037,-0.012 0.034037,-0.036 l 0,-1.928 c 0,-0.024 -0.011347,-0.036 -0.034037,-0.036 z"
135
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
136
+ id="path4145"
137
+ inkscape:connector-curvature="0" />
138
+ </g>
139
+ <g
140
+ id="g4351">
141
+ <path
142
+ sodipodi:nodetypes="cccccccc"
143
+ d="m 3,1047.1121 1,-2.75 1,0 -1.5,4 -1,0 -1.5,-4 1,0 z"
144
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
145
+ id="path4147"
146
+ inkscape:connector-curvature="0" />
147
+ <path
148
+ sodipodi:nodetypes="ccccccccccc"
149
+ d="m 9,1046.8621 0,-2.5 1,0 0,4 -1,0 -2,-2.5 0,2.5 -1,0 0,-4 1,0 z"
150
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
151
+ id="path4149"
152
+ inkscape:connector-curvature="0" />
153
+ <path
154
+ sodipodi:nodetypes="cssssccscsscscc"
155
+ d="m 15,1045.3621 -2.96596,0 c -0.02269,0 -0.03404,0.012 -0.03404,0.036 l 0,1.928 c 0,0.024 0.01135,0.036 0.03404,0.036 l 2.96596,0 0,1 -3.324113,0 c -0.188017,0 -0.348479,-0.068 -0.481388,-0.2037 C 11.064833,1048.0192 11,1047.8511 11,1047.6542 l 0,-2.5842 c 0,-0.1969 0.06483,-0.3633 0.194499,-0.4991 0.132909,-0.1392 0.293371,-0.2088 0.481388,-0.2088 l 3.324113,0 z"
156
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
157
+ id="path4151"
158
+ inkscape:connector-curvature="0" />
159
+ </g>
160
+ </g>
161
+ </g>
162
+ </g>
163
+</svg>
public/novnc/app/images/icons/novnc-icon.svg
new
+163
@@ -0,0 +1,163 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+<svg
5
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+ xmlns:cc="http://creativecommons.org/ns#"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ xmlns:svg="http://www.w3.org/2000/svg"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
+ width="48"
13
+ height="48"
14
+ viewBox="0 0 48 48.000001"
15
+ id="svg2"
16
+ version="1.1"
17
+ inkscape:version="0.91 r13725"
18
+ sodipodi:docname="novnc-icon.svg">
19
+ <defs
20
+ id="defs4" />
21
+ <sodipodi:namedview
22
+ id="base"
23
+ pagecolor="#ffffff"
24
+ bordercolor="#666666"
25
+ borderopacity="1.0"
26
+ inkscape:pageopacity="0.0"
27
+ inkscape:pageshadow="2"
28
+ inkscape:zoom="11.313708"
29
+ inkscape:cx="27.187245"
30
+ inkscape:cy="17.700974"
31
+ inkscape:document-units="px"
32
+ inkscape:current-layer="layer1"
33
+ showgrid="false"
34
+ units="px"
35
+ inkscape:object-nodes="true"
36
+ inkscape:snap-smooth-nodes="true"
37
+ inkscape:snap-midpoints="true"
38
+ inkscape:window-width="1920"
39
+ inkscape:window-height="1136"
40
+ inkscape:window-x="1920"
41
+ inkscape:window-y="27"
42
+ inkscape:window-maximized="1">
43
+ <inkscape:grid
44
+ type="xygrid"
45
+ id="grid4169" />
46
+ </sodipodi:namedview>
47
+ <metadata
48
+ id="metadata7">
49
+ <rdf:RDF>
50
+ <cc:Work
51
+ rdf:about="">
52
+ <dc:format>image/svg+xml</dc:format>
53
+ <dc:type
54
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
55
+ <dc:title />
56
+ </cc:Work>
57
+ </rdf:RDF>
58
+ </metadata>
59
+ <g
60
+ inkscape:label="Layer 1"
61
+ inkscape:groupmode="layer"
62
+ id="layer1"
63
+ transform="translate(0,-1004.3621)">
64
+ <rect
65
+ style="opacity:1;fill:#494949;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
66
+ id="rect4167"
67
+ width="48"
68
+ height="48"
69
+ x="0"
70
+ y="1004.3621"
71
+ ry="7.9999785" />
72
+ <path
73
+ style="opacity:1;fill:#313131;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
74
+ d="m 8,1004.3621 c -4.4319881,0 -8,3.568 -8,8 l 0,32 c 0,4.432 3.5680119,8 8,8 l 12,0 c 15.512,0 28,-16.948 28,-38 l 0,-2 c 0,-4.432 -3.568012,-8 -8,-8 l -32,0 z"
75
+ id="rect4173"
76
+ inkscape:connector-curvature="0" />
77
+ <g
78
+ id="g4300"
79
+ style="fill:#000000;fill-opacity:1;stroke:none"
80
+ transform="translate(0.5,0.5)">
81
+ <g
82
+ id="g4302"
83
+ style="fill:#000000;fill-opacity:1;stroke:none">
84
+ <path
85
+ sodipodi:nodetypes="scsccsssscccs"
86
+ d="m 11.986926,1016.3621 c 0.554325,0 1.025987,0.2121 1.414987,0.6362 0.398725,0.4138 0.600909,0.9155 0.598087,1.5052 l 0,6.8586 -2,0 0,-6.8914 c 0,-0.072 -0.03404,-0.1086 -0.102113,-0.1086 l -4.7957745,0 C 7.0340375,1018.3621 7,1018.3983 7,1018.4707 l 0,6.8914 -2,0 0,-9 z"
87
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
88
+ id="path4304"
89
+ inkscape:connector-curvature="0" />
90
+ <path
91
+ sodipodi:nodetypes="sscsscsscsscssssssssss"
92
+ d="m 17.013073,1016.3621 4.973854,0 c 0.554325,0 1.025987,0.2121 1.414986,0.6362 0.398725,0.4138 0.598087,0.9155 0.598087,1.5052 l 0,4.7172 c 0,0.5897 -0.199362,1.0966 -0.598087,1.5207 -0.388999,0.4138 -0.860661,0.6207 -1.414986,0.6207 l -4.973854,0 c -0.554325,0 -1.030849,-0.2069 -1.429574,-0.6207 C 15.1945,1024.3173 15,1023.8104 15,1023.2207 l 0,-4.7172 c 0,-0.5897 0.1945,-1.0914 0.583499,-1.5052 0.398725,-0.4241 0.875249,-0.6362 1.429574,-0.6362 z m 4.884815,2 -4.795776,0 c -0.06808,0 -0.102112,0.036 -0.102112,0.1086 l 0,4.7828 c 0,0.072 0.03404,0.1086 0.102112,0.1086 l 4.795776,0 c 0.06807,0 0.102112,-0.036 0.102112,-0.1086 l 0,-4.7828 c 0,-0.072 -0.03404,-0.1086 -0.102112,-0.1086 z"
93
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
94
+ id="path4306"
95
+ inkscape:connector-curvature="0" />
96
+ </g>
97
+ <g
98
+ id="g4308"
99
+ style="fill:#000000;fill-opacity:1;stroke:none">
100
+ <path
101
+ sodipodi:nodetypes="cccccccc"
102
+ d="m 12,1036.9177 4.768114,-8.5556 2.231886,0 -6,11 -2,0 -6,-11 2.2318854,0 z"
103
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
104
+ id="path4310"
105
+ inkscape:connector-curvature="0" />
106
+ <path
107
+ sodipodi:nodetypes="ccccccccccc"
108
+ d="m 29,1036.3621 0,-8 2,0 0,11 -2,0 -7,-8 0,8 -2,0 0,-11 2,0 z"
109
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
110
+ id="path4312"
111
+ inkscape:connector-curvature="0" />
112
+ <path
113
+ sodipodi:nodetypes="cssssccscsscscc"
114
+ d="m 43,1030.3621 -8.897887,0 c -0.06808,0 -0.102113,0.036 -0.102113,0.1069 l 0,6.7862 c 0,0.071 0.03404,0.1069 0.102113,0.1069 l 8.897887,0 0,2 -8.972339,0 c -0.56405,0 -1.045437,-0.2037 -1.444162,-0.6111 C 32.1945,1038.3334 32,1037.8292 32,1037.2385 l 0,-6.7528 c 0,-0.5907 0.1945,-1.0898 0.583499,-1.4972 0.398725,-0.4176 0.880112,-0.6264 1.444162,-0.6264 l 8.972339,0 z"
115
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
116
+ id="path4314"
117
+ inkscape:connector-curvature="0" />
118
+ </g>
119
+ </g>
120
+ <g
121
+ id="g4291"
122
+ style="stroke:none">
123
+ <g
124
+ id="g4282"
125
+ style="stroke:none">
126
+ <path
127
+ inkscape:connector-curvature="0"
128
+ id="path4143"
129
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
130
+ d="m 11.986926,1016.3621 c 0.554325,0 1.025987,0.2121 1.414987,0.6362 0.398725,0.4138 0.600909,0.9155 0.598087,1.5052 l 0,6.8586 -2,0 0,-6.8914 c 0,-0.072 -0.03404,-0.1086 -0.102113,-0.1086 l -4.7957745,0 C 7.0340375,1018.3621 7,1018.3983 7,1018.4707 l 0,6.8914 -2,0 0,-9 z"
131
+ sodipodi:nodetypes="scsccsssscccs" />
132
+ <path
133
+ inkscape:connector-curvature="0"
134
+ id="path4145"
135
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
136
+ d="m 17.013073,1016.3621 4.973854,0 c 0.554325,0 1.025987,0.2121 1.414986,0.6362 0.398725,0.4138 0.598087,0.9155 0.598087,1.5052 l 0,4.7172 c 0,0.5897 -0.199362,1.0966 -0.598087,1.5207 -0.388999,0.4138 -0.860661,0.6207 -1.414986,0.6207 l -4.973854,0 c -0.554325,0 -1.030849,-0.2069 -1.429574,-0.6207 C 15.1945,1024.3173 15,1023.8104 15,1023.2207 l 0,-4.7172 c 0,-0.5897 0.1945,-1.0914 0.583499,-1.5052 0.398725,-0.4241 0.875249,-0.6362 1.429574,-0.6362 z m 4.884815,2 -4.795776,0 c -0.06808,0 -0.102112,0.036 -0.102112,0.1086 l 0,4.7828 c 0,0.072 0.03404,0.1086 0.102112,0.1086 l 4.795776,0 c 0.06807,0 0.102112,-0.036 0.102112,-0.1086 l 0,-4.7828 c 0,-0.072 -0.03404,-0.1086 -0.102112,-0.1086 z"
137
+ sodipodi:nodetypes="sscsscsscsscssssssssss" />
138
+ </g>
139
+ <g
140
+ id="g4286"
141
+ style="stroke:none">
142
+ <path
143
+ inkscape:connector-curvature="0"
144
+ id="path4147"
145
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
146
+ d="m 12,1036.9177 4.768114,-8.5556 2.231886,0 -6,11 -2,0 -6,-11 2.2318854,0 z"
147
+ sodipodi:nodetypes="cccccccc" />
148
+ <path
149
+ inkscape:connector-curvature="0"
150
+ id="path4149"
151
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
152
+ d="m 29,1036.3621 0,-8 2,0 0,11 -2,0 -7,-8 0,8 -2,0 0,-11 2,0 z"
153
+ sodipodi:nodetypes="ccccccccccc" />
154
+ <path
155
+ inkscape:connector-curvature="0"
156
+ id="path4151"
157
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:medium;line-height:125%;font-family:Orbitron;-inkscape-font-specification:'Orbitron Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
158
+ d="m 43,1030.3621 -8.897887,0 c -0.06808,0 -0.102113,0.036 -0.102113,0.1069 l 0,6.7862 c 0,0.071 0.03404,0.1069 0.102113,0.1069 l 8.897887,0 0,2 -8.972339,0 c -0.56405,0 -1.045437,-0.2037 -1.444162,-0.6111 C 32.1945,1038.3334 32,1037.8292 32,1037.2385 l 0,-6.7528 c 0,-0.5907 0.1945,-1.0898 0.583499,-1.4972 0.398725,-0.4176 0.880112,-0.6264 1.444162,-0.6264 l 8.972339,0 z"
159
+ sodipodi:nodetypes="cssssccscsscscc" />
160
+ </g>
161
+ </g>
162
+ </g>
163
+</svg>
public/novnc/app/images/mouse_left.svg
deleted
-92
@@ -1,92 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
-
4
-<svg
5
- xmlns:dc="http://purl.org/dc/elements/1.1/"
6
- xmlns:cc="http://creativecommons.org/ns#"
7
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
- xmlns:svg="http://www.w3.org/2000/svg"
9
- xmlns="http://www.w3.org/2000/svg"
10
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
- width="25"
13
- height="25"
14
- viewBox="0 0 25 25"
15
- id="svg2"
16
- version="1.1"
17
- inkscape:version="0.91 r13725"
18
- sodipodi:docname="mouse_left.svg"
19
- inkscape:export-filename="/home/ossman/devel/noVNC/images/drag.png"
20
- inkscape:export-xdpi="90"
21
- inkscape:export-ydpi="90">
22
- <defs
23
- id="defs4" />
24
- <sodipodi:namedview
25
- id="base"
26
- pagecolor="#959595"
27
- bordercolor="#666666"
28
- borderopacity="1.0"
29
- inkscape:pageopacity="0"
30
- inkscape:pageshadow="2"
31
- inkscape:zoom="11.313708"
32
- inkscape:cx="15.551515"
33
- inkscape:cy="12.205592"
34
- inkscape:document-units="px"
35
- inkscape:current-layer="layer1"
36
- showgrid="false"
37
- units="px"
38
- inkscape:snap-bbox="true"
39
- inkscape:bbox-paths="true"
40
- inkscape:bbox-nodes="true"
41
- inkscape:snap-bbox-edge-midpoints="true"
42
- inkscape:object-paths="true"
43
- showguides="true"
44
- inkscape:window-width="1920"
45
- inkscape:window-height="1136"
46
- inkscape:window-x="1920"
47
- inkscape:window-y="27"
48
- inkscape:window-maximized="1"
49
- inkscape:snap-smooth-nodes="true"
50
- inkscape:object-nodes="true"
51
- inkscape:snap-intersection-paths="true"
52
- inkscape:snap-nodes="true"
53
- inkscape:snap-global="true">
54
- <inkscape:grid
55
- type="xygrid"
56
- id="grid4136" />
57
- </sodipodi:namedview>
58
- <metadata
59
- id="metadata7">
60
- <rdf:RDF>
61
- <cc:Work
62
- rdf:about="">
63
- <dc:format>image/svg+xml</dc:format>
64
- <dc:type
65
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
66
- <dc:title></dc:title>
67
- </cc:Work>
68
- </rdf:RDF>
69
- </metadata>
70
- <g
71
- inkscape:label="Layer 1"
72
- inkscape:groupmode="layer"
73
- id="layer1"
74
- transform="translate(0,-1027.3622)">
75
- <path
76
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#0068f6;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
77
- d="m 8,1030.3622 c -2.1987124,0 -4,1.8013 -4,4 l 0,2 5,0 0,-2 c 0,-1.4738 1.090393,-2.7071 2.5,-2.9492 l 0,-1.0508 -3.5,0 z"
78
- id="path6219" />
79
- <path
80
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
81
- d="m 13.5,1030.3622 0,1.0508 c 1.409607,0.2421 2.5,1.4754 2.5,2.9492 l 0,2 5,0 0,-2 c 0,-2.1987 -1.801288,-4 -4,-4 l -3.5,0 z"
82
- id="path6217" />
83
- <path
84
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
85
- d="m 12,1033.3622 c -0.571311,0 -1,0.4287 -1,1 l 0,5 c 0,0.5713 0.428689,1 1,1 l 1,0 c 0.571311,0 1,-0.4287 1,-1 l 0,-5 c 0,-0.5713 -0.428689,-1 -1,-1 l -1,0 z"
86
- id="path6215" />
87
- <path
88
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
89
- d="m 4,1038.3622 0,3.5 c 0,4.1377 3.362302,7.5 7.5,7.5 l 2,0 c 4.137698,0 7.5,-3.3623 7.5,-7.5 l 0,-3.5 -5,0 0,1 c 0,1.6447 -1.355293,3 -3,3 l -1,0 c -1.644707,0 -3,-1.3553 -3,-3 l 0,-1 -5,0 z"
90
- id="rect6178" />
91
- </g>
92
-</svg>
public/novnc/app/images/mouse_middle.svg
deleted
-92
@@ -1,92 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
-
4
-<svg
5
- xmlns:dc="http://purl.org/dc/elements/1.1/"
6
- xmlns:cc="http://creativecommons.org/ns#"
7
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
- xmlns:svg="http://www.w3.org/2000/svg"
9
- xmlns="http://www.w3.org/2000/svg"
10
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
- width="25"
13
- height="25"
14
- viewBox="0 0 25 25"
15
- id="svg2"
16
- version="1.1"
17
- inkscape:version="0.91 r13725"
18
- sodipodi:docname="mouse_middle.svg"
19
- inkscape:export-filename="/home/ossman/devel/noVNC/images/drag.png"
20
- inkscape:export-xdpi="90"
21
- inkscape:export-ydpi="90">
22
- <defs
23
- id="defs4" />
24
- <sodipodi:namedview
25
- id="base"
26
- pagecolor="#959595"
27
- bordercolor="#666666"
28
- borderopacity="1.0"
29
- inkscape:pageopacity="0"
30
- inkscape:pageshadow="2"
31
- inkscape:zoom="11.313708"
32
- inkscape:cx="15.551515"
33
- inkscape:cy="12.205592"
34
- inkscape:document-units="px"
35
- inkscape:current-layer="layer1"
36
- showgrid="false"
37
- units="px"
38
- inkscape:snap-bbox="true"
39
- inkscape:bbox-paths="true"
40
- inkscape:bbox-nodes="true"
41
- inkscape:snap-bbox-edge-midpoints="true"
42
- inkscape:object-paths="true"
43
- showguides="true"
44
- inkscape:window-width="1920"
45
- inkscape:window-height="1136"
46
- inkscape:window-x="1920"
47
- inkscape:window-y="27"
48
- inkscape:window-maximized="1"
49
- inkscape:snap-smooth-nodes="true"
50
- inkscape:object-nodes="true"
51
- inkscape:snap-intersection-paths="true"
52
- inkscape:snap-nodes="true"
53
- inkscape:snap-global="true">
54
- <inkscape:grid
55
- type="xygrid"
56
- id="grid4136" />
57
- </sodipodi:namedview>
58
- <metadata
59
- id="metadata7">
60
- <rdf:RDF>
61
- <cc:Work
62
- rdf:about="">
63
- <dc:format>image/svg+xml</dc:format>
64
- <dc:type
65
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
66
- <dc:title></dc:title>
67
- </cc:Work>
68
- </rdf:RDF>
69
- </metadata>
70
- <g
71
- inkscape:label="Layer 1"
72
- inkscape:groupmode="layer"
73
- id="layer1"
74
- transform="translate(0,-1027.3622)">
75
- <path
76
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
77
- d="m 8,1030.3622 c -2.1987124,0 -4,1.8013 -4,4 l 0,2 5,0 0,-2 c 0,-1.4738 1.090393,-2.7071 2.5,-2.9492 l 0,-1.0508 -3.5,0 z"
78
- id="path6219" />
79
- <path
80
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
81
- d="m 13.5,1030.3622 0,1.0508 c 1.409607,0.2421 2.5,1.4754 2.5,2.9492 l 0,2 5,0 0,-2 c 0,-2.1987 -1.801288,-4 -4,-4 l -3.5,0 z"
82
- id="path6217" />
83
- <path
84
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#0068f6;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
85
- d="m 12,1033.3622 c -0.571311,0 -1,0.4287 -1,1 l 0,5 c 0,0.5713 0.428689,1 1,1 l 1,0 c 0.571311,0 1,-0.4287 1,-1 l 0,-5 c 0,-0.5713 -0.428689,-1 -1,-1 l -1,0 z"
86
- id="path6215" />
87
- <path
88
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
89
- d="m 4,1038.3622 0,3.5 c 0,4.1377 3.362302,7.5 7.5,7.5 l 2,0 c 4.137698,0 7.5,-3.3623 7.5,-7.5 l 0,-3.5 -5,0 0,1 c 0,1.6447 -1.355293,3 -3,3 l -1,0 c -1.644707,0 -3,-1.3553 -3,-3 l 0,-1 -5,0 z"
90
- id="rect6178" />
91
- </g>
92
-</svg>
public/novnc/app/images/mouse_none.svg
deleted
-92
@@ -1,92 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
-
4
-<svg
5
- xmlns:dc="http://purl.org/dc/elements/1.1/"
6
- xmlns:cc="http://creativecommons.org/ns#"
7
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
- xmlns:svg="http://www.w3.org/2000/svg"
9
- xmlns="http://www.w3.org/2000/svg"
10
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
- width="25"
13
- height="25"
14
- viewBox="0 0 25 25"
15
- id="svg2"
16
- version="1.1"
17
- inkscape:version="0.91 r13725"
18
- sodipodi:docname="mouse_none.svg"
19
- inkscape:export-filename="/home/ossman/devel/noVNC/images/drag.png"
20
- inkscape:export-xdpi="90"
21
- inkscape:export-ydpi="90">
22
- <defs
23
- id="defs4" />
24
- <sodipodi:namedview
25
- id="base"
26
- pagecolor="#959595"
27
- bordercolor="#666666"
28
- borderopacity="1.0"
29
- inkscape:pageopacity="0"
30
- inkscape:pageshadow="2"
31
- inkscape:zoom="16"
32
- inkscape:cx="23.160825"
33
- inkscape:cy="13.208262"
34
- inkscape:document-units="px"
35
- inkscape:current-layer="layer1"
36
- showgrid="false"
37
- units="px"
38
- inkscape:snap-bbox="true"
39
- inkscape:bbox-paths="true"
40
- inkscape:bbox-nodes="true"
41
- inkscape:snap-bbox-edge-midpoints="true"
42
- inkscape:object-paths="true"
43
- showguides="true"
44
- inkscape:window-width="1920"
45
- inkscape:window-height="1136"
46
- inkscape:window-x="1920"
47
- inkscape:window-y="27"
48
- inkscape:window-maximized="1"
49
- inkscape:snap-smooth-nodes="true"
50
- inkscape:object-nodes="true"
51
- inkscape:snap-intersection-paths="true"
52
- inkscape:snap-nodes="true"
53
- inkscape:snap-global="true">
54
- <inkscape:grid
55
- type="xygrid"
56
- id="grid4136" />
57
- </sodipodi:namedview>
58
- <metadata
59
- id="metadata7">
60
- <rdf:RDF>
61
- <cc:Work
62
- rdf:about="">
63
- <dc:format>image/svg+xml</dc:format>
64
- <dc:type
65
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
66
- <dc:title></dc:title>
67
- </cc:Work>
68
- </rdf:RDF>
69
- </metadata>
70
- <g
71
- inkscape:label="Layer 1"
72
- inkscape:groupmode="layer"
73
- id="layer1"
74
- transform="translate(0,-1027.3622)">
75
- <path
76
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
77
- d="m 8,1030.3622 c -2.1987124,0 -4,1.8013 -4,4 l 0,2 5,0 0,-2 c 0,-1.4738 1.090393,-2.7071 2.5,-2.9492 l 0,-1.0508 -3.5,0 z"
78
- id="path6219" />
79
- <path
80
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
81
- d="m 13.5,1030.3622 0,1.0508 c 1.409607,0.2421 2.5,1.4754 2.5,2.9492 l 0,2 5,0 0,-2 c 0,-2.1987 -1.801288,-4 -4,-4 l -3.5,0 z"
82
- id="path6217" />
83
- <path
84
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
85
- d="m 12,1033.3622 c -0.571311,0 -1,0.4287 -1,1 l 0,5 c 0,0.5713 0.428689,1 1,1 l 1,0 c 0.571311,0 1,-0.4287 1,-1 l 0,-5 c 0,-0.5713 -0.428689,-1 -1,-1 l -1,0 z"
86
- id="path6215" />
87
- <path
88
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
89
- d="m 4,1038.3622 0,3.5 c 0,4.1377 3.362302,7.5 7.5,7.5 l 2,0 c 4.137698,0 7.5,-3.3623 7.5,-7.5 l 0,-3.5 -5,0 0,1 c 0,1.6447 -1.355293,3 -3,3 l -1,0 c -1.644707,0 -3,-1.3553 -3,-3 l 0,-1 -5,0 z"
90
- id="rect6178" />
91
- </g>
92
-</svg>
public/novnc/app/images/mouse_right.svg
deleted
-92
@@ -1,92 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
-
4
-<svg
5
- xmlns:dc="http://purl.org/dc/elements/1.1/"
6
- xmlns:cc="http://creativecommons.org/ns#"
7
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
- xmlns:svg="http://www.w3.org/2000/svg"
9
- xmlns="http://www.w3.org/2000/svg"
10
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
- width="25"
13
- height="25"
14
- viewBox="0 0 25 25"
15
- id="svg2"
16
- version="1.1"
17
- inkscape:version="0.91 r13725"
18
- sodipodi:docname="mouse_right.svg"
19
- inkscape:export-filename="/home/ossman/devel/noVNC/images/drag.png"
20
- inkscape:export-xdpi="90"
21
- inkscape:export-ydpi="90">
22
- <defs
23
- id="defs4" />
24
- <sodipodi:namedview
25
- id="base"
26
- pagecolor="#959595"
27
- bordercolor="#666666"
28
- borderopacity="1.0"
29
- inkscape:pageopacity="0"
30
- inkscape:pageshadow="2"
31
- inkscape:zoom="11.313708"
32
- inkscape:cx="15.551515"
33
- inkscape:cy="12.205592"
34
- inkscape:document-units="px"
35
- inkscape:current-layer="layer1"
36
- showgrid="false"
37
- units="px"
38
- inkscape:snap-bbox="true"
39
- inkscape:bbox-paths="true"
40
- inkscape:bbox-nodes="true"
41
- inkscape:snap-bbox-edge-midpoints="true"
42
- inkscape:object-paths="true"
43
- showguides="true"
44
- inkscape:window-width="1920"
45
- inkscape:window-height="1136"
46
- inkscape:window-x="1920"
47
- inkscape:window-y="27"
48
- inkscape:window-maximized="1"
49
- inkscape:snap-smooth-nodes="true"
50
- inkscape:object-nodes="true"
51
- inkscape:snap-intersection-paths="true"
52
- inkscape:snap-nodes="true"
53
- inkscape:snap-global="true">
54
- <inkscape:grid
55
- type="xygrid"
56
- id="grid4136" />
57
- </sodipodi:namedview>
58
- <metadata
59
- id="metadata7">
60
- <rdf:RDF>
61
- <cc:Work
62
- rdf:about="">
63
- <dc:format>image/svg+xml</dc:format>
64
- <dc:type
65
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
66
- <dc:title></dc:title>
67
- </cc:Work>
68
- </rdf:RDF>
69
- </metadata>
70
- <g
71
- inkscape:label="Layer 1"
72
- inkscape:groupmode="layer"
73
- id="layer1"
74
- transform="translate(0,-1027.3622)">
75
- <path
76
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
77
- d="m 8,1030.3622 c -2.1987124,0 -4,1.8013 -4,4 l 0,2 5,0 0,-2 c 0,-1.4738 1.090393,-2.7071 2.5,-2.9492 l 0,-1.0508 -3.5,0 z"
78
- id="path6219" />
79
- <path
80
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#0068f6;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
81
- d="m 13.5,1030.3622 0,1.0508 c 1.409607,0.2421 2.5,1.4754 2.5,2.9492 l 0,2 5,0 0,-2 c 0,-2.1987 -1.801288,-4 -4,-4 l -3.5,0 z"
82
- id="path6217" />
83
- <path
84
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
85
- d="m 12,1033.3622 c -0.571311,0 -1,0.4287 -1,1 l 0,5 c 0,0.5713 0.428689,1 1,1 l 1,0 c 0.571311,0 1,-0.4287 1,-1 l 0,-5 c 0,-0.5713 -0.428689,-1 -1,-1 l -1,0 z"
86
- id="path6215" />
87
- <path
88
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
89
- d="m 4,1038.3622 0,3.5 c 0,4.1377 3.362302,7.5 7.5,7.5 l 2,0 c 4.137698,0 7.5,-3.3623 7.5,-7.5 l 0,-3.5 -5,0 0,1 c 0,1.6447 -1.355293,3 -3,3 l -1,0 c -1.644707,0 -3,-1.3553 -3,-3 l 0,-1 -5,0 z"
90
- id="rect6178" />
91
- </g>
92
-</svg>
public/novnc/app/images/windows.svg
+25
-45
@@ -15,18 +15,18 @@
15
inkscape:export-xdpi="90"
16
sodipodi:docname="windows.svg"
17
inkscape:export-filename="/home/ossman/devel/noVNC/images/drag.png"
18
- inkscape:version="0.92.3 (2405546, 2018-03-11)"
18
+ inkscape:version="0.92.4 (unknown)"
19
x="0px"
20
y="0px"
21
- viewBox="-293 384 25 23"
21
+ viewBox="-293 384 25 25"
22
xml:space="preserve"
23
width="25"
24
- height="23"><metadata
24
+ height="25"><metadata
25
id="metadata21"><rdf:RDF><cc:Work
26
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
27
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
28
id="defs19" /><sodipodi:namedview
29
- pagecolor="#ffffff"
29
+ pagecolor="#959595"
30
bordercolor="#666666"
31
borderopacity="1"
32
objecttolerance="10"
@@ -35,51 +35,31 @@
35
inkscape:pageopacity="0"
36
inkscape:pageshadow="2"
37
inkscape:window-width="1920"
38
- inkscape:window-height="1017"
38
+ inkscape:window-height="1136"
39
id="namedview17"
40
- showgrid="false"
41
- inkscape:pagecheckerboard="true"
42
- inkscape:zoom="9.44"
43
- inkscape:cx="-0.84745763"
44
- inkscape:cy="12.5"
45
- inkscape:window-x="2552"
46
- inkscape:window-y="122"
40
+ showgrid="true"
41
+ inkscape:pagecheckerboard="false"
42
+ inkscape:zoom="32"
43
+ inkscape:cx="3.926913"
44
+ inkscape:cy="13.255959"
45
+ inkscape:window-x="1920"
46
+ inkscape:window-y="27"
47
inkscape:window-maximized="1"
48
- inkscape:current-layer="svg2" />
48
+ inkscape:current-layer="svg2"><inkscape:grid
49
+ type="xygrid"
50
+ id="grid818" /></sodipodi:namedview>
51
<style
52
type="text/css"
53
id="style2">
54
.st0{fill:#FFFFFF;}
55
</style>
54
-<g
55
- id="g14"
56
- transform="matrix(1.2624869,0,0,1.3601695,73.614445,-144.84322)">
57
- <g
58
- id="g12">
59
- <path
60
- class="st0"
61
- d="m -277.4,396 c -0.7,0 -1.3,0 -2,0 -0.4,0 -0.5,-0.1 -0.5,-0.5 0,-1 0,-2 0,-3 0,-0.3 0.2,-0.5 0.5,-0.5 1.3,-0.1 2.6,-0.3 3.9,-0.4 0.4,0 0.7,0.1 0.7,0.6 0,1.1 0,2.2 0,3.3 0,0.4 -0.2,0.6 -0.6,0.6 -0.7,-0.1 -1.4,-0.1 -2,-0.1 z"
62
- id="path4"
63
- inkscape:connector-curvature="0"
64
- style="fill:#ffffff" />
65
- <path
66
- class="st0"
67
- d="m -274.9,399.3 c 0,0.6 0,1.1 0,1.7 0,0.4 -0.1,0.6 -0.6,0.6 -1.4,-0.1 -2.8,-0.3 -4.1,-0.4 -0.3,0 -0.4,-0.3 -0.4,-0.5 0,-1 0,-2 0,-3 0,-0.4 0.2,-0.5 0.6,-0.5 1.3,0 2.6,0 3.9,0 0.5,0 0.6,0.2 0.6,0.6 0,0.4 0,0.9 0,1.5 z"
68
- id="path6"
69
- inkscape:connector-curvature="0"
70
- style="fill:#ffffff" />
71
- <path
72
- class="st0"
73
- d="m -283.5,396 c -0.6,0 -1.3,0 -1.9,0 -0.4,0 -0.6,-0.1 -0.6,-0.6 0,-0.8 0,-1.5 0,-2.3 0,-0.4 0.2,-0.6 0.6,-0.7 1.3,-0.1 2.7,-0.3 4,-0.4 0.4,0 0.5,0.1 0.5,0.5 0,1 0,1.9 0,2.9 0,0.4 -0.2,0.5 -0.5,0.5 -0.8,0.1 -1.5,0.1 -2.1,0.1 z"
74
- id="path8"
75
- inkscape:connector-curvature="0"
76
- style="fill:#ffffff" />
77
- <path
78
- class="st0"
79
- d="m -283.5,397 c 0.6,0 1.3,0 1.9,0 0.4,0 0.6,0.1 0.6,0.5 0,1 0,1.9 0,2.9 0,0.4 -0.2,0.5 -0.5,0.5 -1.3,-0.1 -2.7,-0.3 -4,-0.4 -0.4,0 -0.6,-0.2 -0.6,-0.7 0,-0.7 0,-1.5 0,-2.2 0,-0.5 0.2,-0.7 0.7,-0.7 0.6,0.1 1.2,0.1 1.9,0.1 z"
80
- id="path10"
81
- inkscape:connector-curvature="0"
82
- style="fill:#ffffff" />
83
- </g>
84
-</g>
85
-</svg>
\ No newline at end of file
56
+
57
+<path
58
+ style="fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
59
+ d="M 21 4 L 11 5.1757812 L 11 12 L 21 12 L 21 4 z M 10 5.2949219 L 4 6 L 4 12 L 10 12 L 10 5.2949219 z "
60
+ transform="translate(-293,384)"
61
+ id="path853" /><path
62
+ id="path858"
63
+ d="m -272,405 -10,-1.17578 V 397 h 10 z M -283,403.70508 -289,403 v -6 h 6 z"
64
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
65
+ inkscape:connector-curvature="0" /></svg>
\ No newline at end of file
public/novnc/app/locale/README
new
+1
@@ -0,0 +1 @@
1
+DO NOT MODIFY THE FILES IN THIS FOLDER, THEY ARE AUTOMATICALLY GENERATED FROM THE PO-FILES.
public/novnc/app/locale/es.json
+11
-11
@@ -4,9 +4,9 @@
4
"Connected (unencrypted) to ": "Conectado (sin encriptación) a",
5
"Disconnecting...": "Desconectando...",
6
"Disconnected": "Desconectado",
7
- "Must set host": "Debes configurar el host",
7
+ "Must set host": "Se debe configurar el host",
8
"Reconnecting...": "Reconectando...",
9
- "Password is required": "Contraseña es obligatoria",
9
+ "Password is required": "La contraseña es obligatoria",
10
"Disconnect timeout": "Tiempo de desconexión agotado",
11
"noVNC encountered an error:": "noVNC ha encontrado un error:",
12
"Hide/Show the control bar": "Ocultar/Mostrar la barra de control",
@@ -41,6 +41,7 @@
41
"Clear": "Vaciar",
42
"Fullscreen": "Pantalla Completa",
43
"Settings": "Configuraciones",
44
+ "Encrypt": "Encriptar",
45
"Shared Mode": "Modo Compartido",
46
"View Only": "Solo visualización",
47
"Clip to Window": "Recortar al tamaño de la ventana",
@@ -51,18 +52,17 @@
52
"Remote Resizing": "Cambio de tamaño remoto",
53
"Advanced": "Avanzado",
54
"Local Cursor": "Cursor Local",
54
- "Repeater ID:": "ID del Repetidor",
55
+ "Repeater ID:": "ID del Repetidor:",
56
"WebSocket": "WebSocket",
56
- "Encrypt": "",
57
- "Host:": "Host",
58
- "Port:": "Puesto",
59
- "Path:": "Ruta",
57
+ "Host:": "Host:",
58
+ "Port:": "Puerto:",
59
+ "Path:": "Ruta:",
60
"Automatic Reconnect": "Reconexión automática",
61
- "Reconnect Delay (ms):": "Retraso en la reconexión (ms)",
62
- "Logging:": "Logging",
61
+ "Reconnect Delay (ms):": "Retraso en la reconexión (ms):",
62
+ "Logging:": "Registrando:",
63
"Disconnect": "Desconectar",
64
"Connect": "Conectar",
65
- "Password:": "Contraseña",
65
+ "Password:": "Contraseña:",
66
"Cancel": "Cancelar",
67
- "Canvas not supported.": "Canvas no está soportado"
67
+ "Canvas not supported.": "Canvas no soportado."
68
}
\ No newline at end of file
public/novnc/app/locale/fr.json
new
+72
@@ -0,0 +1,72 @@
1
+{
2
+ "Connecting...": "En cours de connexion...",
3
+ "Disconnecting...": "Déconnexion en cours...",
4
+ "Reconnecting...": "Reconnexion en cours...",
5
+ "Internal error": "Erreur interne",
6
+ "Must set host": "Doit définir l'hôte",
7
+ "Connected (encrypted) to ": "Connecté (crypté) à ",
8
+ "Connected (unencrypted) to ": "Connecté (non crypté) à ",
9
+ "Something went wrong, connection is closed": "Quelque chose est arrivé, la connexion est fermée",
10
+ "Failed to connect to server": "Échec de connexion au serveur",
11
+ "Disconnected": "Déconnecté",
12
+ "New connection has been rejected with reason: ": "Une nouvelle connexion a été rejetée avec raison: ",
13
+ "New connection has been rejected": "Une nouvelle connexion a été rejetée",
14
+ "Credentials are required": "Les identifiants sont requis",
15
+ "noVNC encountered an error:": "noVNC a rencontré une erreur:",
16
+ "Hide/Show the control bar": "Masquer/Afficher la barre de contrôle",
17
+ "Drag": "Faire glisser",
18
+ "Move/Drag Viewport": "Déplacer/faire glisser Viewport",
19
+ "Keyboard": "Clavier",
20
+ "Show Keyboard": "Afficher le clavier",
21
+ "Extra keys": "Touches supplémentaires",
22
+ "Show Extra Keys": "Afficher les touches supplémentaires",
23
+ "Ctrl": "Ctrl",
24
+ "Toggle Ctrl": "Basculer Ctrl",
25
+ "Alt": "Alt",
26
+ "Toggle Alt": "Basculer Alt",
27
+ "Toggle Windows": "Basculer Windows",
28
+ "Windows": "Windows",
29
+ "Send Tab": "Envoyer l'onglet",
30
+ "Tab": "l'onglet",
31
+ "Esc": "Esc",
32
+ "Send Escape": "Envoyer Escape",
33
+ "Ctrl+Alt+Del": "Ctrl+Alt+Del",
34
+ "Send Ctrl-Alt-Del": "Envoyer Ctrl-Alt-Del",
35
+ "Shutdown/Reboot": "Arrêter/Redémarrer",
36
+ "Shutdown/Reboot...": "Arrêter/Redémarrer...",
37
+ "Power": "Alimentation",
38
+ "Shutdown": "Arrêter",
39
+ "Reboot": "Redémarrer",
40
+ "Reset": "Réinitialiser",
41
+ "Clipboard": "Presse-papiers",
42
+ "Clear": "Effacer",
43
+ "Fullscreen": "Plein écran",
44
+ "Settings": "Paramètres",
45
+ "Shared Mode": "Mode partagé",
46
+ "View Only": "Afficher uniquement",
47
+ "Clip to Window": "Clip à fenêtre",
48
+ "Scaling Mode:": "Mode mise à l'échelle:",
49
+ "None": "Aucun",
50
+ "Local Scaling": "Mise à l'échelle locale",
51
+ "Remote Resizing": "Redimensionnement à distance",
52
+ "Advanced": "Avancé",
53
+ "Quality:": "Qualité:",
54
+ "Compression level:": "Niveau de compression:",
55
+ "Repeater ID:": "ID Répéteur:",
56
+ "WebSocket": "WebSocket",
57
+ "Encrypt": "Crypter",
58
+ "Host:": "Hôte:",
59
+ "Port:": "Port:",
60
+ "Path:": "Chemin:",
61
+ "Automatic Reconnect": "Reconnecter automatiquemen",
62
+ "Reconnect Delay (ms):": "Délai de reconnexion (ms):",
63
+ "Show Dot when No Cursor": "Afficher le point lorsqu'il n'y a pas de curseur",
64
+ "Logging:": "Se connecter:",
65
+ "Version:": "Version:",
66
+ "Disconnect": "Déconnecter",
67
+ "Connect": "Connecter",
68
+ "Username:": "Nom d'utilisateur:",
69
+ "Password:": "Mot de passe:",
70
+ "Send Credentials": "Envoyer les identifiants",
71
+ "Cancel": "Annuler"
72
+}
\ No newline at end of file
public/novnc/app/locale/ja.json
new
+72
@@ -0,0 +1,72 @@
1
+{
2
+ "Connecting...": "接続しています...",
3
+ "Disconnecting...": "切断しています...",
4
+ "Reconnecting...": "再接続しています...",
5
+ "Internal error": "内部エラー",
6
+ "Must set host": "ホストを設定する必要があります",
7
+ "Connected (encrypted) to ": "接続しました (暗号化済み): ",
8
+ "Connected (unencrypted) to ": "接続しました (暗号化されていません): ",
9
+ "Something went wrong, connection is closed": "何らかの問題で、接続が閉じられました",
10
+ "Failed to connect to server": "サーバーへの接続に失敗しました",
11
+ "Disconnected": "切断しました",
12
+ "New connection has been rejected with reason: ": "新規接続は次の理由で拒否されました: ",
13
+ "New connection has been rejected": "新規接続は拒否されました",
14
+ "Credentials are required": "資格情報が必要です",
15
+ "noVNC encountered an error:": "noVNC でエラーが発生しました:",
16
+ "Hide/Show the control bar": "コントロールバーを隠す/表示する",
17
+ "Drag": "ドラッグ",
18
+ "Move/Drag Viewport": "ビューポートを移動/ドラッグ",
19
+ "Keyboard": "キーボード",
20
+ "Show Keyboard": "キーボードを表示",
21
+ "Extra keys": "追加キー",
22
+ "Show Extra Keys": "追加キーを表示",
23
+ "Ctrl": "Ctrl",
24
+ "Toggle Ctrl": "Ctrl キーを切り替え",
25
+ "Alt": "Alt",
26
+ "Toggle Alt": "Alt キーを切り替え",
27
+ "Toggle Windows": "Windows キーを切り替え",
28
+ "Windows": "Windows",
29
+ "Send Tab": "Tab キーを送信",
30
+ "Tab": "Tab",
31
+ "Esc": "Esc",
32
+ "Send Escape": "Escape キーを送信",
33
+ "Ctrl+Alt+Del": "Ctrl+Alt+Del",
34
+ "Send Ctrl-Alt-Del": "Ctrl-Alt-Del を送信",
35
+ "Shutdown/Reboot": "シャットダウン/再起動",
36
+ "Shutdown/Reboot...": "シャットダウン/再起動...",
37
+ "Power": "電源",
38
+ "Shutdown": "シャットダウン",
39
+ "Reboot": "再起動",
40
+ "Reset": "リセット",
41
+ "Clipboard": "クリップボード",
42
+ "Clear": "クリア",
43
+ "Fullscreen": "全画面表示",
44
+ "Settings": "設定",
45
+ "Shared Mode": "共有モード",
46
+ "View Only": "表示のみ",
47
+ "Clip to Window": "ウィンドウにクリップ",
48
+ "Scaling Mode:": "スケーリングモード:",
49
+ "None": "なし",
50
+ "Local Scaling": "ローカルスケーリング",
51
+ "Remote Resizing": "リモートでリサイズ",
52
+ "Advanced": "高度",
53
+ "Quality:": "品質:",
54
+ "Compression level:": "圧縮レベル:",
55
+ "Repeater ID:": "リピーター ID:",
56
+ "WebSocket": "WebSocket",
57
+ "Encrypt": "暗号化",
58
+ "Host:": "ホスト:",
59
+ "Port:": "ポート:",
60
+ "Path:": "パス:",
61
+ "Automatic Reconnect": "自動再接続",
62
+ "Reconnect Delay (ms):": "再接続する遅延 (ミリ秒):",
63
+ "Show Dot when No Cursor": "カーソルがないときにドットを表示",
64
+ "Logging:": "ロギング:",
65
+ "Version:": "バージョン:",
66
+ "Disconnect": "切断",
67
+ "Connect": "接続",
68
+ "Username:": "ユーザー名:",
69
+ "Password:": "パスワード:",
70
+ "Send Credentials": "資格情報を送信",
71
+ "Cancel": "キャンセル"
72
+}
\ No newline at end of file
public/novnc/app/locale/pt_BR.json
new
+72
@@ -0,0 +1,72 @@
1
+{
2
+ "Connecting...": "Conectando...",
3
+ "Disconnecting...": "Desconectando...",
4
+ "Reconnecting...": "Reconectando...",
5
+ "Internal error": "Erro interno",
6
+ "Must set host": "É necessário definir o host",
7
+ "Connected (encrypted) to ": "Conectado (com criptografia) a ",
8
+ "Connected (unencrypted) to ": "Conectado (sem criptografia) a ",
9
+ "Something went wrong, connection is closed": "Algo deu errado. A conexão foi encerrada.",
10
+ "Failed to connect to server": "Falha ao conectar-se ao servidor",
11
+ "Disconnected": "Desconectado",
12
+ "New connection has been rejected with reason: ": "A nova conexão foi rejeitada pelo motivo: ",
13
+ "New connection has been rejected": "A nova conexão foi rejeitada",
14
+ "Credentials are required": "Credenciais são obrigatórias",
15
+ "noVNC encountered an error:": "O noVNC encontrou um erro:",
16
+ "Hide/Show the control bar": "Esconder/mostrar a barra de controles",
17
+ "Drag": "Arrastar",
18
+ "Move/Drag Viewport": "Mover/arrastar a janela",
19
+ "Keyboard": "Teclado",
20
+ "Show Keyboard": "Mostrar teclado",
21
+ "Extra keys": "Teclas adicionais",
22
+ "Show Extra Keys": "Mostar teclas adicionais",
23
+ "Ctrl": "Ctrl",
24
+ "Toggle Ctrl": "Pressionar/soltar Ctrl",
25
+ "Alt": "Alt",
26
+ "Toggle Alt": "Pressionar/soltar Alt",
27
+ "Toggle Windows": "Pressionar/soltar Windows",
28
+ "Windows": "Windows",
29
+ "Send Tab": "Enviar Tab",
30
+ "Tab": "Tab",
31
+ "Esc": "Esc",
32
+ "Send Escape": "Enviar Esc",
33
+ "Ctrl+Alt+Del": "Ctrl+Alt+Del",
34
+ "Send Ctrl-Alt-Del": "Enviar Ctrl-Alt-Del",
35
+ "Shutdown/Reboot": "Desligar/reiniciar",
36
+ "Shutdown/Reboot...": "Desligar/reiniciar...",
37
+ "Power": "Ligar",
38
+ "Shutdown": "Desligar",
39
+ "Reboot": "Reiniciar",
40
+ "Reset": "Reiniciar (forçado)",
41
+ "Clipboard": "Área de transferência",
42
+ "Clear": "Limpar",
43
+ "Fullscreen": "Tela cheia",
44
+ "Settings": "Configurações",
45
+ "Shared Mode": "Modo compartilhado",
46
+ "View Only": "Apenas visualizar",
47
+ "Clip to Window": "Recortar à janela",
48
+ "Scaling Mode:": "Modo de dimensionamento:",
49
+ "None": "Nenhum",
50
+ "Local Scaling": "Local",
51
+ "Remote Resizing": "Remoto",
52
+ "Advanced": "Avançado",
53
+ "Quality:": "Qualidade:",
54
+ "Compression level:": "Nível de compressão:",
55
+ "Repeater ID:": "ID do repetidor:",
56
+ "WebSocket": "WebSocket",
57
+ "Encrypt": "Criptografar",
58
+ "Host:": "Host:",
59
+ "Port:": "Porta:",
60
+ "Path:": "Caminho:",
61
+ "Automatic Reconnect": "Reconexão automática",
62
+ "Reconnect Delay (ms):": "Atraso da reconexão (ms)",
63
+ "Show Dot when No Cursor": "Mostrar ponto quando não há cursor",
64
+ "Logging:": "Registros:",
65
+ "Version:": "Versão:",
66
+ "Disconnect": "Desconectar",
67
+ "Connect": "Conectar",
68
+ "Username:": "Nome de usuário:",
69
+ "Password:": "Senha:",
70
+ "Send Credentials": "Enviar credenciais",
71
+ "Cancel": "Cancelar"
72
+}
\ No newline at end of file
public/novnc/app/locale/ru.json
+15
-16
@@ -9,26 +9,21 @@
9
"Something went wrong, connection is closed": "Что-то пошло не так, подключение разорвано",
10
"Failed to connect to server": "Ошибка подключения к серверу",
11
"Disconnected": "Отключено",
12
- "New connection has been rejected with reason: ": "Подключиться не удалось: ",
13
- "New connection has been rejected": "Подключиться не удалось",
14
- "Password is required": "Требуется пароль",
12
+ "New connection has been rejected with reason: ": "Новое соединение отклонено по причине: ",
13
+ "New connection has been rejected": "Новое соединение отклонено",
14
+ "Credentials are required": "Требуются учетные данные",
15
"noVNC encountered an error:": "Ошибка noVNC: ",
16
"Hide/Show the control bar": "Скрыть/Показать контрольную панель",
17
+ "Drag": "Переместить",
18
"Move/Drag Viewport": "Переместить окно",
18
- "viewport drag": "Переместить окно",
19
- "Active Mouse Button": "Активировать кнопки мыши",
20
- "No mousebutton": "Отключить кнопки мыши",
21
- "Left mousebutton": "Левая кнопка мыши",
22
- "Middle mousebutton": "Средняя кнопка мыши",
23
- "Right mousebutton": "Правая кнопка мыши",
19
"Keyboard": "Клавиатура",
20
"Show Keyboard": "Показать клавиатуру",
26
- "Extra keys": "Доп. кнопки",
27
- "Show Extra Keys": "Показать дополнительные кнопки",
21
+ "Extra keys": "Дополнительные Кнопки",
22
+ "Show Extra Keys": "Показать Дополнительные Кнопки",
23
"Ctrl": "Ctrl",
29
- "Toggle Ctrl": "Передать нажатие Ctrl",
24
+ "Toggle Ctrl": "Переключение нажатия Ctrl",
25
"Alt": "Alt",
31
- "Toggle Alt": "Передать нажатие Alt",
26
+ "Toggle Alt": "Переключение нажатия Alt",
27
"Toggle Windows": "Переключение вкладок",
28
"Windows": "Вкладка",
29
"Send Tab": "Передать нажатие Tab",
@@ -48,13 +43,15 @@
43
"Fullscreen": "Во весь экран",
44
"Settings": "Настройки",
45
"Shared Mode": "Общий режим",
51
- "View Only": "Просмотр",
46
+ "View Only": "Только Просмотр",
47
"Clip to Window": "В окно",
48
"Scaling Mode:": "Масштаб:",
49
"None": "Нет",
50
"Local Scaling": "Локльный масштаб",
56
- "Remote Resizing": "Удаленный масштаб",
51
+ "Remote Resizing": "Удаленная перенастройка размера",
52
"Advanced": "Дополнительно",
53
+ "Quality:": "Качество",
54
+ "Compression level:": "Уровень Сжатия",
55
"Repeater ID:": "Идентификатор ID:",
56
"WebSocket": "WebSocket",
57
"Encrypt": "Шифрование",
@@ -65,9 +62,11 @@
62
"Reconnect Delay (ms):": "Задержка переподключения (мс):",
63
"Show Dot when No Cursor": "Показать точку вместо курсора",
64
"Logging:": "Лог:",
65
+ "Version:": "Версия",
66
"Disconnect": "Отключение",
67
"Connect": "Подключение",
68
+ "Username:": "Имя Пользователя",
69
"Password:": "Пароль:",
71
- "Send Password": "Пароль: ",
70
+ "Send Credentials": "Передача Учетных Данных",
71
"Cancel": "Выход"
72
}
\ No newline at end of file
public/novnc/app/locale/sv.json
+7
-8
@@ -11,16 +11,11 @@
11
"Disconnected": "Frånkopplad",
12
"New connection has been rejected with reason: ": "Ny anslutning har blivit nekad med följande skäl: ",
13
"New connection has been rejected": "Ny anslutning har blivit nekad",
14
- "Password is required": "Lösenord krävs",
14
+ "Credentials are required": "Användaruppgifter krävs",
15
"noVNC encountered an error:": "noVNC stötte på ett problem:",
16
"Hide/Show the control bar": "Göm/Visa kontrollbaren",
17
+ "Drag": "Dra",
18
"Move/Drag Viewport": "Flytta/Dra Vyn",
18
- "viewport drag": "dra vy",
19
- "Active Mouse Button": "Aktiv musknapp",
20
- "No mousebutton": "Ingen musknapp",
21
- "Left mousebutton": "Vänster musknapp",
22
- "Middle mousebutton": "Mitten-musknapp",
23
- "Right mousebutton": "Höger musknapp",
19
"Keyboard": "Tangentbord",
20
"Show Keyboard": "Visa Tangentbord",
21
"Extra keys": "Extraknappar",
@@ -55,6 +50,8 @@
50
"Local Scaling": "Lokal Skalning",
51
"Remote Resizing": "Ändra Storlek",
52
"Advanced": "Avancerat",
53
+ "Quality:": "Kvalitet:",
54
+ "Compression level:": "Kompressionsnivå:",
55
"Repeater ID:": "Repeater-ID:",
56
"WebSocket": "WebSocket",
57
"Encrypt": "Kryptera",
@@ -65,9 +62,11 @@
62
"Reconnect Delay (ms):": "Fördröjning (ms):",
63
"Show Dot when No Cursor": "Visa prick när ingen muspekare finns",
64
"Logging:": "Loggning:",
65
+ "Version:": "Version:",
66
"Disconnect": "Koppla från",
67
"Connect": "Anslut",
68
+ "Username:": "Användarnamn:",
69
"Password:": "Lösenord:",
71
- "Send Password": "Skicka lösenord",
70
+ "Send Credentials": "Skicka Användaruppgifter",
71
"Cancel": "Avbryt"
72
}
\ No newline at end of file
public/novnc/app/locale/zh_CN.json
+17
-17
@@ -1,19 +1,19 @@
1
{
2
- "Connecting...": "链接中...",
3
- "Disconnecting...": "正在中断连接...",
4
- "Reconnecting...": "重新链接中...",
2
+ "Connecting...": "连接中...",
3
+ "Disconnecting...": "正在断开连接...",
4
+ "Reconnecting...": "重新连接中...",
5
"Internal error": "内部错误",
6
"Must set host": "请提供主机名",
7
- "Connected (encrypted) to ": "已加密链接到",
8
- "Connected (unencrypted) to ": "未加密链接到",
9
- "Something went wrong, connection is closed": "发生错误,链接已关闭",
10
- "Failed to connect to server": "无法链接到服务器",
11
- "Disconnected": "链接已中断",
12
- "New connection has been rejected with reason: ": "链接被拒绝,原因:",
13
- "New connection has been rejected": "链接被拒绝",
7
+ "Connected (encrypted) to ": "已连接到(加密)",
8
+ "Connected (unencrypted) to ": "已连接到(未加密)",
9
+ "Something went wrong, connection is closed": "发生错误,连接已关闭",
10
+ "Failed to connect to server": "无法连接到服务器",
11
+ "Disconnected": "已断开连接",
12
+ "New connection has been rejected with reason: ": "连接被拒绝,原因:",
13
+ "New connection has been rejected": "连接被拒绝",
14
"Password is required": "请提供密码",
15
"noVNC encountered an error:": "noVNC 遇到一个错误:",
16
- "Hide/Show the control bar": "显示/隐藏控制列",
16
+ "Hide/Show the control bar": "显示/隐藏控制栏",
17
"Move/Drag Viewport": "拖放显示范围",
18
"viewport drag": "显示范围拖放",
19
"Active Mouse Button": "启动鼠标按鍵",
@@ -43,10 +43,10 @@
43
"Reset": "重置",
44
"Clipboard": "剪贴板",
45
"Clear": "清除",
46
- "Fullscreen": "全屏幕",
46
+ "Fullscreen": "全屏",
47
"Settings": "设置",
48
"Shared Mode": "分享模式",
49
- "View Only": "仅检视",
49
+ "View Only": "仅查看",
50
"Clip to Window": "限制/裁切窗口大小",
51
"Scaling Mode:": "缩放模式:",
52
"None": "无",
@@ -59,11 +59,11 @@
59
"Host:": "主机:",
60
"Port:": "端口:",
61
"Path:": "路径:",
62
- "Automatic Reconnect": "自动重新链接",
63
- "Reconnect Delay (ms):": "重新链接间隔 (ms):",
62
+ "Automatic Reconnect": "自动重新连接",
63
+ "Reconnect Delay (ms):": "重新连接间隔 (ms):",
64
"Logging:": "日志级别:",
65
- "Disconnect": "终端链接",
66
- "Connect": "链接",
65
+ "Disconnect": "中断连接",
66
+ "Connect": "连接",
67
"Password:": "密码:",
68
"Cancel": "取消"
69
}
\ No newline at end of file
public/novnc/app/localization.js
+1
-3
@@ -20,11 +20,9 @@ export class Localizer {
20
}
21
22
// Configure suitable language based on user preferences
23
- setup(supportedLanguages, language) {
23
+ setup(supportedLanguages) {
24
this.language = 'en'; // Default: US English
25
26
- if (language != null) { this.language = language; return; }
27
-
26
/*
27
* Navigator.languages only available in Chrome (32+) and FireFox (32+)
28
* Fall back to navigator.language for other browsers
public/novnc/app/styles/base.css
+87
-17
@@ -1,6 +1,6 @@
1
/*
2
* noVNC base CSS
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
5
* This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
6
*/
@@ -83,8 +83,20 @@ html {
83
* ----------------------------------------
84
*/
85
86
-input[type=input], input[type=password], input[type=number],
87
-input:not([type]), textarea {
86
+input:not([type]),
87
+input[type=date],
88
+input[type=datetime-local],
89
+input[type=email],
90
+input[type=month],
91
+input[type=number],
92
+input[type=password],
93
+input[type=search],
94
+input[type=tel],
95
+input[type=text],
96
+input[type=time],
97
+input[type=url],
98
+input[type=week],
99
+textarea {
100
/* Disable default rendering */
101
-webkit-appearance: none;
102
-moz-appearance: none;
@@ -98,7 +110,11 @@ input:not([type]), textarea {
110
background: linear-gradient(to top, rgb(255, 255, 255) 80%, rgb(240, 240, 240));
111
}
112
101
-input[type=button], input[type=submit], select {
113
+input[type=button],
114
+input[type=color],
115
+input[type=reset],
116
+input[type=submit],
117
+select {
118
/* Disable default rendering */
119
-webkit-appearance: none;
120
-moz-appearance: none;
@@ -116,7 +132,10 @@ input[type=button], input[type=submit], select {
132
vertical-align: middle;
133
}
134
119
-input[type=button], input[type=submit] {
135
+input[type=button],
136
+input[type=color],
137
+input[type=reset],
138
+input[type=submit] {
139
padding-left: 20px;
140
padding-right: 20px;
141
}
@@ -126,35 +145,72 @@ option {
145
background: white;
146
}
147
129
-input[type=input]:focus, input[type=password]:focus,
130
-input:not([type]):focus, input[type=button]:focus,
148
+input:not([type]):focus,
149
+input[type=button]:focus,
150
+input[type=color]:focus,
151
+input[type=date]:focus,
152
+input[type=datetime-local]:focus,
153
+input[type=email]:focus,
154
+input[type=month]:focus,
155
+input[type=number]:focus,
156
+input[type=password]:focus,
157
+input[type=reset]:focus,
158
+input[type=search]:focus,
159
input[type=submit]:focus,
132
-textarea:focus, select:focus {
160
+input[type=tel]:focus,
161
+input[type=text]:focus,
162
+input[type=time]:focus,
163
+input[type=url]:focus,
164
+input[type=week]:focus,
165
+select:focus,
166
+textarea:focus {
167
box-shadow: 0px 0px 3px rgba(74, 144, 217, 0.5);
168
border-color: rgb(74, 144, 217);
169
outline: none;
170
}
171
172
input[type=button]::-moz-focus-inner,
173
+input[type=color]::-moz-focus-inner,
174
+input[type=reset]::-moz-focus-inner,
175
input[type=submit]::-moz-focus-inner {
176
border: none;
177
}
178
143
-input[type=input]:disabled, input[type=password]:disabled,
144
-input:not([type]):disabled, input[type=button]:disabled,
145
-input[type=submit]:disabled, input[type=number]:disabled,
146
-textarea:disabled, select:disabled {
179
+input:not([type]):disabled,
180
+input[type=button]:disabled,
181
+input[type=color]:disabled,
182
+input[type=date]:disabled,
183
+input[type=datetime-local]:disabled,
184
+input[type=email]:disabled,
185
+input[type=month]:disabled,
186
+input[type=number]:disabled,
187
+input[type=password]:disabled,
188
+input[type=reset]:disabled,
189
+input[type=search]:disabled,
190
+input[type=submit]:disabled,
191
+input[type=tel]:disabled,
192
+input[type=text]:disabled,
193
+input[type=time]:disabled,
194
+input[type=url]:disabled,
195
+input[type=week]:disabled,
196
+select:disabled,
197
+textarea:disabled {
198
color: rgb(128, 128, 128);
199
background: rgb(240, 240, 240);
200
}
201
151
-input[type=button]:active, input[type=submit]:active,
202
+input[type=button]:active,
203
+input[type=color]:active,
204
+input[type=reset]:active,
205
+input[type=submit]:active,
206
select:active {
207
border-bottom-width: 1px;
208
margin-top: 3px;
209
}
210
211
:root:not(.noVNC_touch) input[type=button]:hover:not(:disabled),
212
+:root:not(.noVNC_touch) input[type=color]:hover:not(:disabled),
213
+:root:not(.noVNC_touch) input[type=reset]:hover:not(:disabled),
214
:root:not(.noVNC_touch) input[type=submit]:hover:not(:disabled),
215
:root:not(.noVNC_touch) select:hover:not(:disabled) {
216
background: linear-gradient(to top, rgb(255, 255, 255), rgb(250, 250, 250));
@@ -579,7 +635,7 @@ select:active {
635
}
636
637
/* Extra manual keys */
582
-:root:not(.noVNC_connected) #noVNC_extra_keys {
638
+:root:not(.noVNC_connected) #noVNC_toggle_extra_keys_button {
639
display: none;
640
}
641
@@ -631,6 +687,16 @@ select:active {
687
width: 100px;
688
}
689
690
+/* Version */
691
+
692
+.noVNC_version_wrapper {
693
+ font-size: small;
694
+}
695
+
696
+.noVNC_version {
697
+ margin-left: 1rem;
698
+}
699
+
700
/* Connection Controls */
701
:root:not(.noVNC_connected) #noVNC_disconnect_button {
702
display: none;
@@ -780,19 +846,23 @@ select:active {
846
* ----------------------------------------
847
*/
848
783
-#noVNC_password_dlg {
849
+#noVNC_credentials_dlg {
850
position: relative;
851
852
transform: translateY(-50px);
853
}
788
-#noVNC_password_dlg.noVNC_open {
854
+#noVNC_credentials_dlg.noVNC_open {
855
transform: translateY(0);
856
}
791
-#noVNC_password_dlg ul {
857
+#noVNC_credentials_dlg ul {
858
list-style: none;
859
margin: 0px;
860
padding: 0px;
861
}
862
+.noVNC_hidden {
863
+ display: none;
864
+}
865
+
866
867
/* ----------------------------------------
868
* Main Area
public/novnc/app/ui.js
+177
-121
@@ -1,6 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
@@ -8,7 +8,7 @@
8
9
import * as Log from '../core/util/logging.js';
10
import _, { l10n } from './localization.js';
11
-import { isTouchDevice, isSafari, isIOS, isAndroid, dragThreshold }
11
+import { isTouchDevice, isSafari, hasScrollbarGutter, dragThreshold }
12
from '../core/util/browser.js';
13
import { setCapture, getPointerEvent } from '../core/util/events.js';
14
import KeyTable from "../core/input/keysym.js";
@@ -60,9 +60,9 @@ const UI = {
60
lastKeyboardinput: null,
61
defaultKeyboardinputLen: 100,
62
63
- inhibit_reconnect: true,
64
- reconnect_callback: null,
65
- reconnect_password: null,
63
+ inhibitReconnect: true,
64
+ reconnectCallback: null,
65
+ reconnectPassword: null,
66
67
prime() {
68
return WebUtil.initSettings().then(() => {
@@ -86,6 +86,23 @@ const UI = {
86
// Translate the DOM
87
l10n.translateDOM();
88
89
+ fetch('./package.json')
90
+ .then((response) => {
91
+ if (!response.ok) {
92
+ throw Error("" + response.status + " " + response.statusText);
93
+ }
94
+ return response.json();
95
+ })
96
+ .then((packageInfo) => {
97
+ Array.from(document.getElementsByClassName('noVNC_version')).forEach(el => el.innerText = packageInfo.version);
98
+ })
99
+ .catch((err) => {
100
+ Log.Error("Couldn't fetch package.json: " + err);
101
+ Array.from(document.getElementsByClassName('noVNC_version_wrapper'))
102
+ .concat(Array.from(document.getElementsByClassName('noVNC_version_separator')))
103
+ .forEach(el => el.style.display = 'none');
104
+ });
105
+
106
// Adapt the interface for touch screen devices
107
if (isTouchDevice) {
108
document.documentElement.classList.add("noVNC_touch");
@@ -175,6 +192,8 @@ const UI = {
192
UI.initSetting('encrypt', (window.location.protocol === "https:"));
193
UI.initSetting('view_clip', false);
194
UI.initSetting('resize', 'off');
195
+ UI.initSetting('quality', 6);
196
+ UI.initSetting('compression', 2);
197
UI.initSetting('shared', true);
198
UI.initSetting('view_only', false);
199
UI.initSetting('show_dot', false);
@@ -246,14 +265,6 @@ const UI = {
265
},
266
267
addTouchSpecificHandlers() {
249
- document.getElementById("noVNC_mouse_button0")
250
- .addEventListener('click', () => UI.setMouseButton(1));
251
- document.getElementById("noVNC_mouse_button1")
252
- .addEventListener('click', () => UI.setMouseButton(2));
253
- document.getElementById("noVNC_mouse_button2")
254
- .addEventListener('click', () => UI.setMouseButton(4));
255
- document.getElementById("noVNC_mouse_button4")
256
- .addEventListener('click', () => UI.setMouseButton(0));
268
document.getElementById("noVNC_keyboard_button")
269
.addEventListener('click', UI.toggleVirtualKeyboard);
270
@@ -330,8 +341,8 @@ const UI = {
341
document.getElementById("noVNC_cancel_reconnect_button")
342
.addEventListener('click', UI.cancelReconnect);
343
333
- document.getElementById("noVNC_password_button")
334
- .addEventListener('click', UI.setPassword);
344
+ document.getElementById("noVNC_credentials_button")
345
+ .addEventListener('click', UI.setCredentials);
346
},
347
348
addClipboardHandlers() {
@@ -361,6 +372,10 @@ const UI = {
372
UI.addSettingChangeHandler('resize');
373
UI.addSettingChangeHandler('resize', UI.applyResizeMode);
374
UI.addSettingChangeHandler('resize', UI.updateViewClip);
375
+ UI.addSettingChangeHandler('quality');
376
+ UI.addSettingChangeHandler('quality', UI.updateQuality);
377
+ UI.addSettingChangeHandler('compression');
378
+ UI.addSettingChangeHandler('compression', UI.updateCompression);
379
UI.addSettingChangeHandler('view_clip');
380
UI.addSettingChangeHandler('view_clip', UI.updateViewClip);
381
UI.addSettingChangeHandler('shared');
@@ -402,25 +417,25 @@ const UI = {
417
document.documentElement.classList.remove("noVNC_disconnecting");
418
document.documentElement.classList.remove("noVNC_reconnecting");
419
405
- const transition_elem = document.getElementById("noVNC_transition_text");
420
+ const transitionElem = document.getElementById("noVNC_transition_text");
421
switch (state) {
422
case 'init':
423
break;
424
case 'connecting':
410
- transition_elem.textContent = _("Connecting...");
425
+ transitionElem.textContent = _("Connecting...");
426
document.documentElement.classList.add("noVNC_connecting");
427
break;
428
case 'connected':
429
document.documentElement.classList.add("noVNC_connected");
430
break;
431
case 'disconnecting':
417
- transition_elem.textContent = _("Disconnecting...");
432
+ transitionElem.textContent = _("Disconnecting...");
433
document.documentElement.classList.add("noVNC_disconnecting");
434
break;
435
case 'disconnected':
436
break;
437
case 'reconnecting':
423
- transition_elem.textContent = _("Reconnecting...");
438
+ transitionElem.textContent = _("Reconnecting...");
439
document.documentElement.classList.add("noVNC_reconnecting");
440
break;
441
default:
@@ -438,7 +453,6 @@ const UI = {
453
UI.disableSetting('port');
454
UI.disableSetting('path');
455
UI.disableSetting('repeaterID');
441
- UI.setMouseButton(1);
456
457
// Hide the controlbar after 2 seconds
458
UI.closeControlbarTimeout = setTimeout(UI.closeControlbar, 2000);
@@ -453,38 +467,35 @@ const UI = {
467
UI.keepControlbar();
468
}
469
456
- // State change closes the password dialog
457
- document.getElementById('noVNC_password_dlg')
470
+ // State change closes dialogs as they may not be relevant
471
+ // anymore
472
+ UI.closeAllPanels();
473
+ document.getElementById('noVNC_credentials_dlg')
474
.classList.remove('noVNC_open');
475
},
476
461
- showStatus(text, status_type, time) {
477
+ showStatus(text, statusType, time) {
478
const statusElem = document.getElementById('noVNC_status');
479
464
- clearTimeout(UI.statusTimeout);
465
-
466
- if (typeof status_type === 'undefined') {
467
- status_type = 'normal';
480
+ if (typeof statusType === 'undefined') {
481
+ statusType = 'normal';
482
}
483
484
// Don't overwrite more severe visible statuses and never
485
// errors. Only shows the first error.
472
- let visible_status_type = 'none';
486
if (statusElem.classList.contains("noVNC_open")) {
487
if (statusElem.classList.contains("noVNC_status_error")) {
475
- visible_status_type = 'error';
476
- } else if (statusElem.classList.contains("noVNC_status_warn")) {
477
- visible_status_type = 'warn';
478
- } else {
479
- visible_status_type = 'normal';
488
+ return;
489
+ }
490
+ if (statusElem.classList.contains("noVNC_status_warn") &&
491
+ statusType === 'normal') {
492
+ return;
493
}
494
}
482
- if (visible_status_type === 'error' ||
483
- (visible_status_type === 'warn' && status_type === 'normal')) {
484
- return;
485
- }
495
487
- switch (status_type) {
496
+ clearTimeout(UI.statusTimeout);
497
+
498
+ switch (statusType) {
499
case 'error':
500
statusElem.classList.remove("noVNC_status_warn");
501
statusElem.classList.remove("noVNC_status_normal");
@@ -514,7 +525,7 @@ const UI = {
525
}
526
527
// Error messages do not timeout
517
- if (status_type !== 'error') {
528
+ if (statusType !== 'error') {
529
UI.statusTimeout = window.setTimeout(UI.hideStatus, time);
530
}
531
},
@@ -534,6 +545,13 @@ const UI = {
545
},
546
547
idleControlbar() {
548
+ // Don't fade if a child of the control bar has focus
549
+ if (document.getElementById('noVNC_control_bar')
550
+ .contains(document.activeElement) && document.hasFocus()) {
551
+ UI.activateControlbar();
552
+ return;
553
+ }
554
+
555
document.getElementById('noVNC_control_bar_anchor')
556
.classList.add("noVNC_idle");
557
},
@@ -551,6 +569,7 @@ const UI = {
569
UI.closeAllPanels();
570
document.getElementById('noVNC_control_bar')
571
.classList.remove("noVNC_open");
572
+ UI.rfb.focus();
573
},
574
575
toggleControlbar() {
@@ -767,11 +786,6 @@ const UI = {
786
}
787
}
788
} else {
770
- /*Weird IE9 error leads to 'null' appearring
771
- in textboxes instead of ''.*/
772
- if (value === null) {
773
- value = "";
774
- }
789
ctrl.value = value;
790
}
791
},
@@ -848,6 +862,8 @@ const UI = {
862
UI.updateSetting('encrypt');
863
UI.updateSetting('view_clip');
864
UI.updateSetting('resize');
865
+ UI.updateSetting('quality');
866
+ UI.updateSetting('compression');
867
UI.updateSetting('shared');
868
UI.updateSetting('view_only');
869
UI.updateSetting('path');
@@ -1004,7 +1020,7 @@ const UI = {
1020
1021
if (typeof password === 'undefined') {
1022
password = WebUtil.getConfigVar('password');
1007
- UI.reconnect_password = password;
1023
+ UI.reconnectPassword = password;
1024
}
1025
1026
if (password === null) {
@@ -1019,14 +1035,12 @@ const UI = {
1035
return;
1036
}
1037
1022
- UI.closeAllPanels();
1038
UI.closeConnectPanel();
1039
1040
UI.updateVisualState('connecting');
1041
1042
UI.rfb = new RFB(document.getElementById('noVNC_container'), urlargs.ws,
1043
{ shared: UI.getSetting('shared'),
1029
- showDotCursor: UI.getSetting('show_dot'),
1044
repeaterID: UI.getSetting('repeaterID'),
1045
credentials: { password: password } });
1046
UI.rfb.addEventListener("connect", UI.connectFinished);
@@ -1040,18 +1054,20 @@ const UI = {
1054
UI.rfb.clipViewport = UI.getSetting('view_clip');
1055
UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
1056
UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
1057
+ UI.rfb.qualityLevel = parseInt(UI.getSetting('quality'));
1058
+ UI.rfb.compressionLevel = parseInt(UI.getSetting('compression'));
1059
+ UI.rfb.showDotCursor = UI.getSetting('show_dot');
1060
1061
UI.updateViewOnly(); // requires UI.rfb
1062
},
1063
1064
disconnect() {
1048
- UI.closeAllPanels();
1065
UI.rfb.disconnect();
1066
1067
UI.connected = false;
1068
1069
// Disable automatic reconnecting
1054
- UI.inhibit_reconnect = true;
1070
+ UI.inhibitReconnect = true;
1071
1072
UI.updateVisualState('disconnecting');
1073
@@ -1059,20 +1075,20 @@ const UI = {
1075
},
1076
1077
reconnect() {
1062
- UI.reconnect_callback = null;
1078
+ UI.reconnectCallback = null;
1079
1080
// if reconnect has been disabled in the meantime, do nothing.
1065
- if (UI.inhibit_reconnect) {
1081
+ if (UI.inhibitReconnect) {
1082
return;
1083
}
1084
1069
- UI.connect(null, UI.reconnect_password);
1085
+ UI.connect(null, UI.reconnectPassword);
1086
},
1087
1088
cancelReconnect() {
1073
- if (UI.reconnect_callback !== null) {
1074
- clearTimeout(UI.reconnect_callback);
1075
- UI.reconnect_callback = null;
1089
+ if (UI.reconnectCallback !== null) {
1090
+ clearTimeout(UI.reconnectCallback);
1091
+ UI.reconnectCallback = null;
1092
}
1093
1094
UI.updateVisualState('disconnected');
@@ -1083,7 +1099,7 @@ const UI = {
1099
1100
connectFinished(e) {
1101
UI.connected = true;
1086
- UI.inhibit_reconnect = false;
1102
+ UI.inhibitReconnect = false;
1103
1104
let msg;
1105
if (UI.getSetting('encrypt')) {
@@ -1117,11 +1133,11 @@ const UI = {
1133
} else {
1134
UI.showStatus(_("Failed to connect to server"), 'error');
1135
}
1120
- } else if (UI.getSetting('reconnect', false) === true && !UI.inhibit_reconnect) {
1136
+ } else if (UI.getSetting('reconnect', false) === true && !UI.inhibitReconnect) {
1137
UI.updateVisualState('reconnecting');
1138
1139
const delay = parseInt(UI.getSetting('reconnect_delay'));
1124
- UI.reconnect_callback = setTimeout(UI.reconnect, delay);
1140
+ UI.reconnectCallback = setTimeout(UI.reconnect, delay);
1141
return;
1142
} else {
1143
UI.updateVisualState('disconnected');
@@ -1154,27 +1170,46 @@ const UI = {
1170
1171
credentials(e) {
1172
// FIXME: handle more types
1157
- document.getElementById('noVNC_password_dlg')
1173
+
1174
+ document.getElementById("noVNC_username_block").classList.remove("noVNC_hidden");
1175
+ document.getElementById("noVNC_password_block").classList.remove("noVNC_hidden");
1176
+
1177
+ let inputFocus = "none";
1178
+ if (e.detail.types.indexOf("username") === -1) {
1179
+ document.getElementById("noVNC_username_block").classList.add("noVNC_hidden");
1180
+ } else {
1181
+ inputFocus = inputFocus === "none" ? "noVNC_username_input" : inputFocus;
1182
+ }
1183
+ if (e.detail.types.indexOf("password") === -1) {
1184
+ document.getElementById("noVNC_password_block").classList.add("noVNC_hidden");
1185
+ } else {
1186
+ inputFocus = inputFocus === "none" ? "noVNC_password_input" : inputFocus;
1187
+ }
1188
+ document.getElementById('noVNC_credentials_dlg')
1189
.classList.add('noVNC_open');
1190
1191
setTimeout(() => document
1161
- .getElementById('noVNC_password_input').focus(), 100);
1192
+ .getElementById(inputFocus).focus(), 100);
1193
1163
- Log.Warn("Server asked for a password");
1164
- UI.showStatus(_("Password is required"), "warning");
1194
+ Log.Warn("Server asked for credentials");
1195
+ UI.showStatus(_("Credentials are required"), "warning");
1196
},
1197
1167
- setPassword(e) {
1198
+ setCredentials(e) {
1199
// Prevent actually submitting the form
1200
e.preventDefault();
1201
1171
- const inputElem = document.getElementById('noVNC_password_input');
1172
- const password = inputElem.value;
1202
+ let inputElemUsername = document.getElementById('noVNC_username_input');
1203
+ const username = inputElemUsername.value;
1204
+
1205
+ let inputElemPassword = document.getElementById('noVNC_password_input');
1206
+ const password = inputElemPassword.value;
1207
// Clear the input after reading the password
1174
- inputElem.value = "";
1175
- UI.rfb.sendCredentials({ password: password });
1176
- UI.reconnect_password = password;
1177
- document.getElementById('noVNC_password_dlg')
1208
+ inputElemPassword.value = "";
1209
+
1210
+ UI.rfb.sendCredentials({ username: username, password: password });
1211
+ UI.reconnectPassword = password;
1212
+ document.getElementById('noVNC_credentials_dlg')
1213
.classList.remove('noVNC_open');
1214
},
1215
@@ -1257,8 +1292,9 @@ const UI = {
1292
// Can't be clipping if viewport is scaled to fit
1293
UI.forceSetting('view_clip', false);
1294
UI.rfb.clipViewport = false;
1260
- } else if (isIOS() || isAndroid()) {
1261
- // iOS and Android usually have shit scrollbars
1295
+ } else if (!hasScrollbarGutter) {
1296
+ // Some platforms have scrollbars that are difficult
1297
+ // to use in our case, so we always use our own panning
1298
UI.forceSetting('view_clip', true);
1299
UI.rfb.clipViewport = true;
1300
} else {
@@ -1301,30 +1337,40 @@ const UI = {
1337
viewDragButton.classList.remove("noVNC_selected");
1338
}
1339
1304
- // Different behaviour for touch vs non-touch
1305
- // The button is disabled instead of hidden on touch devices
1306
- if (isTouchDevice) {
1340
+ if (UI.rfb.clipViewport) {
1341
viewDragButton.classList.remove("noVNC_hidden");
1308
-
1309
- if (UI.rfb.clipViewport) {
1310
- viewDragButton.disabled = false;
1311
- } else {
1312
- viewDragButton.disabled = true;
1313
- }
1342
} else {
1315
- viewDragButton.disabled = false;
1316
-
1317
- if (UI.rfb.clipViewport) {
1318
- viewDragButton.classList.remove("noVNC_hidden");
1319
- } else {
1320
- viewDragButton.classList.add("noVNC_hidden");
1321
- }
1343
+ viewDragButton.classList.add("noVNC_hidden");
1344
}
1345
},
1346
1347
/* ------^-------
1348
* /VIEWDRAG
1349
* ==============
1350
+ * QUALITY
1351
+ * ------v------*/
1352
+
1353
+ updateQuality() {
1354
+ if (!UI.rfb) return;
1355
+
1356
+ UI.rfb.qualityLevel = parseInt(UI.getSetting('quality'));
1357
+ },
1358
+
1359
+/* ------^-------
1360
+ * /QUALITY
1361
+ * ==============
1362
+ * COMPRESSION
1363
+ * ------v------*/
1364
+
1365
+ updateCompression() {
1366
+ if (!UI.rfb) return;
1367
+
1368
+ UI.rfb.compressionLevel = parseInt(UI.getSetting('compression'));
1369
+ },
1370
+
1371
+/* ------^-------
1372
+ * /COMPRESSION
1373
+ * ==============
1374
* KEYBOARD
1375
* ------v------*/
1376
@@ -1519,20 +1565,20 @@ const UI = {
1565
},
1566
1567
sendEsc() {
1522
- UI.rfb.sendKey(KeyTable.XK_Escape, "Escape");
1568
+ UI.sendKey(KeyTable.XK_Escape, "Escape");
1569
},
1570
1571
sendTab() {
1526
- UI.rfb.sendKey(KeyTable.XK_Tab);
1572
+ UI.sendKey(KeyTable.XK_Tab, "Tab");
1573
},
1574
1575
toggleCtrl() {
1576
const btn = document.getElementById('noVNC_toggle_ctrl_button');
1577
if (btn.classList.contains("noVNC_selected")) {
1532
- UI.rfb.sendKey(KeyTable.XK_Control_L, "ControlLeft", false);
1578
+ UI.sendKey(KeyTable.XK_Control_L, "ControlLeft", false);
1579
btn.classList.remove("noVNC_selected");
1580
} else {
1535
- UI.rfb.sendKey(KeyTable.XK_Control_L, "ControlLeft", true);
1581
+ UI.sendKey(KeyTable.XK_Control_L, "ControlLeft", true);
1582
btn.classList.add("noVNC_selected");
1583
}
1584
},
@@ -1540,10 +1586,10 @@ const UI = {
1586
toggleWindows() {
1587
const btn = document.getElementById('noVNC_toggle_windows_button');
1588
if (btn.classList.contains("noVNC_selected")) {
1543
- UI.rfb.sendKey(KeyTable.XK_Super_L, "MetaLeft", false);
1589
+ UI.sendKey(KeyTable.XK_Super_L, "MetaLeft", false);
1590
btn.classList.remove("noVNC_selected");
1591
} else {
1546
- UI.rfb.sendKey(KeyTable.XK_Super_L, "MetaLeft", true);
1592
+ UI.sendKey(KeyTable.XK_Super_L, "MetaLeft", true);
1593
btn.classList.add("noVNC_selected");
1594
}
1595
},
@@ -1551,16 +1597,39 @@ const UI = {
1597
toggleAlt() {
1598
const btn = document.getElementById('noVNC_toggle_alt_button');
1599
if (btn.classList.contains("noVNC_selected")) {
1554
- UI.rfb.sendKey(KeyTable.XK_Alt_L, "AltLeft", false);
1600
+ UI.sendKey(KeyTable.XK_Alt_L, "AltLeft", false);
1601
btn.classList.remove("noVNC_selected");
1602
} else {
1557
- UI.rfb.sendKey(KeyTable.XK_Alt_L, "AltLeft", true);
1603
+ UI.sendKey(KeyTable.XK_Alt_L, "AltLeft", true);
1604
btn.classList.add("noVNC_selected");
1605
}
1606
},
1607
1608
sendCtrlAltDel() {
1609
UI.rfb.sendCtrlAltDel();
1610
+ // See below
1611
+ UI.rfb.focus();
1612
+ UI.idleControlbar();
1613
+ },
1614
+
1615
+ sendKey(keysym, code, down) {
1616
+ UI.rfb.sendKey(keysym, code, down);
1617
+
1618
+ // Move focus to the screen in order to be able to use the
1619
+ // keyboard right after these extra keys.
1620
+ // The exception is when a virtual keyboard is used, because
1621
+ // if we focus the screen the virtual keyboard would be closed.
1622
+ // In this case we focus our special virtual keyboard input
1623
+ // element instead.
1624
+ if (document.getElementById('noVNC_keyboard_button')
1625
+ .classList.contains("noVNC_selected")) {
1626
+ document.getElementById('noVNC_keyboardinput').focus();
1627
+ } else {
1628
+ UI.rfb.focus();
1629
+ }
1630
+ // fade out the controlbar to highlight that
1631
+ // the focus has been moved to the screen
1632
+ UI.idleControlbar();
1633
},
1634
1635
/* ------^-------
@@ -1569,24 +1638,6 @@ const UI = {
1638
* MISC
1639
* ------v------*/
1640
1572
- setMouseButton(num) {
1573
- const view_only = UI.rfb.viewOnly;
1574
- if (UI.rfb && !view_only) {
1575
- UI.rfb.touchButton = num;
1576
- }
1577
-
1578
- const blist = [0, 1, 2, 4];
1579
- for (let b = 0; b < blist.length; b++) {
1580
- const button = document.getElementById('noVNC_mouse_button' +
1581
- blist[b]);
1582
- if (blist[b] === num && !view_only) {
1583
- button.classList.remove("noVNC_hidden");
1584
- } else {
1585
- button.classList.add("noVNC_hidden");
1586
- }
1587
- }
1588
- },
1589
-
1641
updateViewOnly() {
1642
if (!UI.rfb) return;
1643
UI.rfb.viewOnly = UI.getSetting('view_only');
@@ -1597,14 +1648,14 @@ const UI = {
1648
.classList.add('noVNC_hidden');
1649
document.getElementById('noVNC_toggle_extra_keys_button')
1650
.classList.add('noVNC_hidden');
1600
- document.getElementById('noVNC_mouse_button' + UI.rfb.touchButton)
1651
+ document.getElementById('noVNC_clipboard_button')
1652
.classList.add('noVNC_hidden');
1653
} else {
1654
document.getElementById('noVNC_keyboard_button')
1655
.classList.remove('noVNC_hidden');
1656
document.getElementById('noVNC_toggle_extra_keys_button')
1657
.classList.remove('noVNC_hidden');
1607
- document.getElementById('noVNC_mouse_button' + UI.rfb.touchButton)
1658
+ document.getElementById('noVNC_clipboard_button')
1659
.classList.remove('noVNC_hidden');
1660
}
1661
},
@@ -1615,13 +1666,13 @@ const UI = {
1666
},
1667
1668
updateLogging() {
1618
- WebUtil.init_logging(UI.getSetting('logging'));
1669
+ WebUtil.initLogging(UI.getSetting('logging'));
1670
},
1671
1672
updateDesktopName(e) {
1673
//UI.desktopName = e.detail.name;
1674
// Display the desktop name in the document title
1624
- //document.title = e.detail.name + " - noVNC";
1675
+ //document.title = e.detail.name + " - " + PAGE_TITLE;
1676
},
1677
1678
bell(e) {
@@ -1657,13 +1708,18 @@ const UI = {
1708
};
1709
1710
// Set up translations
1660
-const LINGUAS = ["cs", "de", "el", "es", "ko", "nl", "pl", "ru", "sv", "tr", "zh_CN", "zh_TW"];
1661
-if (urlargs.l == "zh-chs") { urlargs.l = "zh_CN"; }
1662
-l10n.setup(LINGUAS, urlargs.l);
1711
+const LINGUAS = ["cs", "de", "el", "es", "fr", "ja", "ko", "nl", "pl", "pt_BR", "ru", "sv", "tr", "zh_CN", "zh_TW"];
1712
+l10n.setup(LINGUAS);
1713
if (l10n.language === "en" || l10n.dictionary !== undefined) {
1714
UI.prime();
1715
} else {
1666
- WebUtil.fetchJSON('app/locale/' + l10n.language + '.json')
1716
+ fetch('app/locale/' + l10n.language + '.json')
1717
+ .then((response) => {
1718
+ if (!response.ok) {
1719
+ throw Error("" + response.status + " " + response.statusText);
1720
+ }
1721
+ return response.json();
1722
+ })
1723
.then((translations) => { l10n.dictionary = translations; })
1724
.catch(err => Log.Error("Failed to load translations: " + err))
1725
.then(UI.prime);
public/novnc/app/webutil.js
+15
-68
@@ -1,29 +1,38 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
7
*/
8
9
-import { init_logging as main_init_logging } from '../core/util/logging.js';
9
+import { initLogging as mainInitLogging } from '../core/util/logging.js';
10
11
// init log level reading the logging HTTP param
12
-export function init_logging(level) {
12
+export function initLogging(level) {
13
"use strict";
14
if (typeof level !== "undefined") {
15
- main_init_logging(level);
15
+ mainInitLogging(level);
16
} else {
17
const param = document.location.href.match(/logging=([A-Za-z0-9._-]*)/);
18
- main_init_logging(param || undefined);
18
+ mainInitLogging(param || undefined);
19
}
20
}
21
22
// Read a query string variable
23
+// A URL with a query parameter can look like this (But will most probably get logged on the http server):
24
+// https://www.example.com?myqueryparam=myvalue
25
+//
26
+// For privacy (Using a hastag #, the parameters will not be sent to the server)
27
+// the url can be requested in the following way:
28
+// https://www.example.com#myqueryparam=myvalue&password=secreatvalue
29
+//
30
+// Even Mixing public and non public parameters will work:
31
+// https://www.example.com?nonsecretparam=example.com#password=secreatvalue
32
export function getQueryVar(name, defVal) {
33
"use strict";
34
const re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
26
- match = document.location.href.match(re);
35
+ match = ''.concat(document.location.href, window.location.hash).match(re);
36
if (typeof defVal === 'undefined') { defVal = null; }
37
38
if (match) {
@@ -175,65 +184,3 @@ export function eraseSetting(name) {
184
localStorage.removeItem(name);
185
}
186
}
178
-
179
-export function injectParamIfMissing(path, param, value) {
180
- // force pretend that we're dealing with a relative path
181
- // (assume that we wanted an extra if we pass one in)
182
- path = "/" + path;
183
-
184
- const elem = document.createElement('a');
185
- elem.href = path;
186
-
187
- const param_eq = encodeURIComponent(param) + "=";
188
- let query;
189
- if (elem.search) {
190
- query = elem.search.slice(1).split('&');
191
- } else {
192
- query = [];
193
- }
194
-
195
- if (!query.some(v => v.startsWith(param_eq))) {
196
- query.push(param_eq + encodeURIComponent(value));
197
- elem.search = "?" + query.join("&");
198
- }
199
-
200
- // some browsers (e.g. IE11) may occasionally omit the leading slash
201
- // in the elem.pathname string. Handle that case gracefully.
202
- if (elem.pathname.charAt(0) == "/") {
203
- return elem.pathname.slice(1) + elem.search + elem.hash;
204
- }
205
-
206
- return elem.pathname + elem.search + elem.hash;
207
-}
208
-
209
-// sadly, we can't use the Fetch API until we decide to drop
210
-// IE11 support or polyfill promises and fetch in IE11.
211
-// resolve will receive an object on success, while reject
212
-// will receive either an event or an error on failure.
213
-export function fetchJSON(path) {
214
- return new Promise((resolve, reject) => {
215
- // NB: IE11 doesn't support JSON as a responseType
216
- const req = new XMLHttpRequest();
217
- req.open('GET', path);
218
-
219
- req.onload = () => {
220
- if (req.status === 200) {
221
- let resObj;
222
- try {
223
- resObj = JSON.parse(req.responseText);
224
- } catch (err) {
225
- reject(err);
226
- }
227
- resolve(resObj);
228
- } else {
229
- reject(new Error("XHR got non-200 status while trying to load '" + path + "': " + req.status));
230
- }
231
- };
232
-
233
- req.onerror = evt => reject(new Error("XHR encountered an error while trying to load '" + path + "': " + evt.message));
234
-
235
- req.ontimeout = evt => reject(new Error("XHR timed out while trying to load '" + path + "'"));
236
-
237
- req.send();
238
- });
239
-}
public/novnc/core/base64.js
+4
-4
@@ -57,12 +57,12 @@ export default {
57
/* eslint-enable comma-spacing */
58
59
decode(data, offset = 0) {
60
- let data_length = data.indexOf('=') - offset;
61
- if (data_length < 0) { data_length = data.length - offset; }
60
+ let dataLength = data.indexOf('=') - offset;
61
+ if (dataLength < 0) { dataLength = data.length - offset; }
62
63
/* Every four characters is 3 resulting numbers */
64
- const result_length = (data_length >> 2) * 3 + Math.floor((data_length % 4) / 1.5);
65
- const result = new Array(result_length);
64
+ const resultLength = (dataLength >> 2) * 3 + Math.floor((dataLength % 4) / 1.5);
65
+ const result = new Array(resultLength);
66
67
// Convert one by one.
68
public/novnc/core/decoders/copyrect.js
+6
-3
@@ -1,8 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2012 Joel Martin
4
- * Copyright (C) 2018 Samuel Mannehed for Cendio AB
5
- * Copyright (C) 2018 Pierre Ossman for Cendio AB
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
@@ -17,6 +15,11 @@ export default class CopyRectDecoder {
15
16
let deltaX = sock.rQshift16();
17
let deltaY = sock.rQshift16();
18
+
19
+ if ((width === 0) || (height === 0)) {
20
+ return true;
21
+ }
22
+
23
display.copyImage(deltaX, deltaY, x, y, width, height);
24
25
return true;
public/novnc/core/decoders/hextile.js
+67
-15
@@ -1,8 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2012 Joel Martin
4
- * Copyright (C) 2018 Samuel Mannehed for Cendio AB
5
- * Copyright (C) 2018 Pierre Ossman for Cendio AB
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
@@ -15,14 +13,15 @@ export default class HextileDecoder {
13
constructor() {
14
this._tiles = 0;
15
this._lastsubencoding = 0;
16
+ this._tileBuffer = new Uint8Array(16 * 16 * 4);
17
}
18
19
decodeRect(x, y, width, height, sock, display, depth) {
20
if (this._tiles === 0) {
22
- this._tiles_x = Math.ceil(width / 16);
23
- this._tiles_y = Math.ceil(height / 16);
24
- this._total_tiles = this._tiles_x * this._tiles_y;
25
- this._tiles = this._total_tiles;
21
+ this._tilesX = Math.ceil(width / 16);
22
+ this._tilesY = Math.ceil(height / 16);
23
+ this._totalTiles = this._tilesX * this._tilesY;
24
+ this._tiles = this._totalTiles;
25
}
26
27
while (this._tiles > 0) {
@@ -41,11 +40,11 @@ export default class HextileDecoder {
40
subencoding + ")");
41
}
42
44
- const curr_tile = this._total_tiles - this._tiles;
45
- const tile_x = curr_tile % this._tiles_x;
46
- const tile_y = Math.floor(curr_tile / this._tiles_x);
47
- const tx = x + tile_x * 16;
48
- const ty = y + tile_y * 16;
43
+ const currTile = this._totalTiles - this._tiles;
44
+ const tileX = currTile % this._tilesX;
45
+ const tileY = Math.floor(currTile / this._tilesX);
46
+ const tx = x + tileX * 16;
47
+ const ty = y + tileY * 16;
48
const tw = Math.min(16, (x + width) - tx);
49
const th = Math.min(16, (y + height) - ty);
50
@@ -89,6 +88,11 @@ export default class HextileDecoder {
88
display.fillRect(tx, ty, tw, th, this._background);
89
}
90
} else if (subencoding & 0x01) { // Raw
91
+ let pixels = tw * th;
92
+ // Max sure the image is fully opaque
93
+ for (let i = 0;i < pixels;i++) {
94
+ rQ[rQi + i * 4 + 3] = 255;
95
+ }
96
display.blitImage(tx, ty, tw, th, rQ, rQi);
97
rQi += bytes - 1;
98
} else {
@@ -101,7 +105,7 @@ export default class HextileDecoder {
105
rQi += 4;
106
}
107
104
- display.startTile(tx, ty, tw, th, this._background);
108
+ this._startTile(tx, ty, tw, th, this._background);
109
if (subencoding & 0x08) { // AnySubrects
110
let subrects = rQ[rQi];
111
rQi++;
@@ -124,10 +128,10 @@ export default class HextileDecoder {
128
const sw = (wh >> 4) + 1;
129
const sh = (wh & 0x0f) + 1;
130
127
- display.subTile(sx, sy, sw, sh, color);
131
+ this._subTile(sx, sy, sw, sh, color);
132
}
133
}
130
- display.finishTile();
134
+ this._finishTile(display);
135
}
136
sock.rQi = rQi;
137
this._lastsubencoding = subencoding;
@@ -136,4 +140,52 @@ export default class HextileDecoder {
140
141
return true;
142
}
143
+
144
+ // start updating a tile
145
+ _startTile(x, y, width, height, color) {
146
+ this._tileX = x;
147
+ this._tileY = y;
148
+ this._tileW = width;
149
+ this._tileH = height;
150
+
151
+ const red = color[0];
152
+ const green = color[1];
153
+ const blue = color[2];
154
+
155
+ const data = this._tileBuffer;
156
+ for (let i = 0; i < width * height * 4; i += 4) {
157
+ data[i] = red;
158
+ data[i + 1] = green;
159
+ data[i + 2] = blue;
160
+ data[i + 3] = 255;
161
+ }
162
+ }
163
+
164
+ // update sub-rectangle of the current tile
165
+ _subTile(x, y, w, h, color) {
166
+ const red = color[0];
167
+ const green = color[1];
168
+ const blue = color[2];
169
+ const xend = x + w;
170
+ const yend = y + h;
171
+
172
+ const data = this._tileBuffer;
173
+ const width = this._tileW;
174
+ for (let j = y; j < yend; j++) {
175
+ for (let i = x; i < xend; i++) {
176
+ const p = (i + (j * width)) * 4;
177
+ data[p] = red;
178
+ data[p + 1] = green;
179
+ data[p + 2] = blue;
180
+ data[p + 3] = 255;
181
+ }
182
+ }
183
+ }
184
+
185
+ // draw the current tile to the screen
186
+ _finishTile(display) {
187
+ display.blitImage(this._tileX, this._tileY,
188
+ this._tileW, this._tileH,
189
+ this._tileBuffer, 0);
190
+ }
191
}
public/novnc/core/decoders/raw.js
+19
-11
@@ -1,8 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2012 Joel Martin
4
- * Copyright (C) 2018 Samuel Mannehed for Cendio AB
5
- * Copyright (C) 2018 Pierre Ossman for Cendio AB
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
@@ -15,6 +13,10 @@ export default class RawDecoder {
13
}
14
15
decodeRect(x, y, width, height, sock, display, depth) {
16
+ if ((width === 0) || (height === 0)) {
17
+ return true;
18
+ }
19
+
20
if (this._lines === 0) {
21
this._lines = height;
22
}
@@ -26,29 +28,35 @@ export default class RawDecoder {
28
return false;
29
}
30
29
- const cur_y = y + (height - this._lines);
30
- const curr_height = Math.min(this._lines,
31
- Math.floor(sock.rQlen / bytesPerLine));
31
+ const curY = y + (height - this._lines);
32
+ const currHeight = Math.min(this._lines,
33
+ Math.floor(sock.rQlen / bytesPerLine));
34
+ const pixels = width * currHeight;
35
+
36
let data = sock.rQ;
37
let index = sock.rQi;
38
39
// Convert data if needed
40
if (depth == 8) {
37
- const pixels = width * curr_height;
41
const newdata = new Uint8Array(pixels * 4);
42
for (let i = 0; i < pixels; i++) {
43
newdata[i * 4 + 0] = ((data[index + i] >> 0) & 0x3) * 255 / 3;
44
newdata[i * 4 + 1] = ((data[index + i] >> 2) & 0x3) * 255 / 3;
45
newdata[i * 4 + 2] = ((data[index + i] >> 4) & 0x3) * 255 / 3;
43
- newdata[i * 4 + 4] = 0;
46
+ newdata[i * 4 + 3] = 255;
47
}
48
data = newdata;
49
index = 0;
50
}
51
49
- display.blitImage(x, cur_y, width, curr_height, data, index);
50
- sock.rQskipBytes(curr_height * bytesPerLine);
51
- this._lines -= curr_height;
52
+ // Max sure the image is fully opaque
53
+ for (let i = 0; i < pixels; i++) {
54
+ data[i * 4 + 3] = 255;
55
+ }
56
+
57
+ display.blitImage(x, curY, width, currHeight, data, index);
58
+ sock.rQskipBytes(currHeight * bytesPerLine);
59
+ this._lines -= currHeight;
60
if (this._lines > 0) {
61
return false;
62
}
public/novnc/core/decoders/rre.js
+1
-3
@@ -1,8 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2012 Joel Martin
4
- * Copyright (C) 2018 Samuel Mannehed for Cendio AB
5
- * Copyright (C) 2018 Pierre Ossman for Cendio AB
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
public/novnc/core/decoders/tight.js
+32
-20
@@ -1,9 +1,7 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2012 Joel Martin
3
+ * Copyright (C) 2019 The noVNC Authors
4
* (c) 2012 Michael Tinglof, Joe Balaz, Les Piech (Mercuri.ca)
5
- * Copyright (C) 2018 Samuel Mannehed for Cendio AB
6
- * Copyright (C) 2018 Pierre Ossman for Cendio AB
5
* Licensed under MPL 2.0 (see LICENSE.txt)
6
*
7
* See README.md for usage and integration instructions.
@@ -58,7 +56,7 @@ export default class TightDecoder {
56
} else if (this._ctl === 0x0A) {
57
ret = this._pngRect(x, y, width, height,
58
sock, display, depth);
61
- } else if ((this._ctl & 0x80) == 0) {
59
+ } else if ((this._ctl & 0x08) == 0) {
60
ret = this._basicRect(this._ctl, x, y, width, height,
61
sock, display, depth);
62
} else {
@@ -82,7 +80,7 @@ export default class TightDecoder {
80
const rQ = sock.rQ;
81
82
display.fillRect(x, y, width, height,
85
- [rQ[rQi + 2], rQ[rQi + 1], rQ[rQi]], false);
83
+ [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2]], false);
84
sock.rQskipBytes(3);
85
86
return true;
@@ -94,7 +92,7 @@ export default class TightDecoder {
92
return false;
93
}
94
97
- display.imageRect(x, y, "image/jpeg", data);
95
+ display.imageRect(x, y, width, height, "image/jpeg", data);
96
97
return true;
98
}
@@ -150,6 +148,10 @@ export default class TightDecoder {
148
const uncompressedSize = width * height * 3;
149
let data;
150
151
+ if (uncompressedSize === 0) {
152
+ return true;
153
+ }
154
+
155
if (uncompressedSize < 12) {
156
if (sock.rQwait("TIGHT", uncompressedSize)) {
157
return false;
@@ -162,13 +164,20 @@ export default class TightDecoder {
164
return false;
165
}
166
165
- data = this._zlibs[streamId].inflate(data, true, uncompressedSize);
166
- if (data.length != uncompressedSize) {
167
- throw new Error("Incomplete zlib block");
168
- }
167
+ this._zlibs[streamId].setInput(data);
168
+ data = this._zlibs[streamId].inflate(uncompressedSize);
169
+ this._zlibs[streamId].setInput(null);
170
+ }
171
+
172
+ let rgbx = new Uint8Array(width * height * 4);
173
+ for (let i = 0, j = 0; i < width * height * 4; i += 4, j += 3) {
174
+ rgbx[i] = data[j];
175
+ rgbx[i + 1] = data[j + 1];
176
+ rgbx[i + 2] = data[j + 2];
177
+ rgbx[i + 3] = 255; // Alpha
178
}
179
171
- display.blitRgbImage(x, y, width, height, data, 0, false);
180
+ display.blitImage(x, y, width, height, rgbx, 0, false);
181
182
return true;
183
}
@@ -198,6 +207,10 @@ export default class TightDecoder {
207
208
let data;
209
210
+ if (uncompressedSize === 0) {
211
+ return true;
212
+ }
213
+
214
if (uncompressedSize < 12) {
215
if (sock.rQwait("TIGHT", uncompressedSize)) {
216
return false;
@@ -210,10 +223,9 @@ export default class TightDecoder {
223
return false;
224
}
225
213
- data = this._zlibs[streamId].inflate(data, true, uncompressedSize);
214
- if (data.length != uncompressedSize) {
215
- throw new Error("Incomplete zlib block");
216
- }
226
+ this._zlibs[streamId].setInput(data);
227
+ data = this._zlibs[streamId].inflate(uncompressedSize);
228
+ this._zlibs[streamId].setInput(null);
229
}
230
231
// Convert indexed (palette based) image data to RGB
@@ -241,7 +253,7 @@ export default class TightDecoder {
253
for (let b = 7; b >= 0; b--) {
254
dp = (y * width + x * 8 + 7 - b) * 4;
255
sp = (data[y * w + x] >> b & 1) * 3;
244
- dest[dp] = palette[sp];
256
+ dest[dp] = palette[sp];
257
dest[dp + 1] = palette[sp + 1];
258
dest[dp + 2] = palette[sp + 2];
259
dest[dp + 3] = 255;
@@ -251,14 +263,14 @@ export default class TightDecoder {
263
for (let b = 7; b >= 8 - width % 8; b--) {
264
dp = (y * width + x * 8 + 7 - b) * 4;
265
sp = (data[y * w + x] >> b & 1) * 3;
254
- dest[dp] = palette[sp];
266
+ dest[dp] = palette[sp];
267
dest[dp + 1] = palette[sp + 1];
268
dest[dp + 2] = palette[sp + 2];
269
dest[dp + 3] = 255;
270
}
271
}
272
261
- display.blitRgbxImage(x, y, width, height, dest, 0, false);
273
+ display.blitImage(x, y, width, height, dest, 0, false);
274
}
275
276
_paletteRect(x, y, width, height, data, palette, display) {
@@ -267,13 +279,13 @@ export default class TightDecoder {
279
const total = width * height * 4;
280
for (let i = 0, j = 0; i < total; i += 4, j++) {
281
const sp = data[j] * 3;
270
- dest[i] = palette[sp];
282
+ dest[i] = palette[sp];
283
dest[i + 1] = palette[sp + 1];
284
dest[i + 2] = palette[sp + 2];
285
dest[i + 3] = 255;
286
}
287
276
- display.blitRgbxImage(x, y, width, height, dest, 0, false);
288
+ display.blitImage(x, y, width, height, dest, 0, false);
289
}
290
291
_gradientFilter(streamId, x, y, width, height, sock, display, depth) {
public/novnc/core/decoders/tightpng.js
+2
-4
@@ -1,8 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2012 Joel Martin
4
- * Copyright (C) 2018 Samuel Mannehed for Cendio AB
5
- * Copyright (C) 2018 Pierre Ossman for Cendio AB
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
@@ -18,7 +16,7 @@ export default class TightPNGDecoder extends TightDecoder {
16
return false;
17
}
18
21
- display.imageRect(x, y, "image/png", data);
19
+ display.imageRect(x, y, width, height, "image/png", data);
20
21
return true;
22
}
public/novnc/core/deflator.js
new
+85
@@ -0,0 +1,85 @@
1
+/*
2
+ * noVNC: HTML5 VNC client
3
+ * Copyright (C) 2020 The noVNC Authors
4
+ * Licensed under MPL 2.0 (see LICENSE.txt)
5
+ *
6
+ * See README.md for usage and integration instructions.
7
+ */
8
+
9
+import { deflateInit, deflate } from "../vendor/pako/lib/zlib/deflate.js";
10
+import { Z_FULL_FLUSH } from "../vendor/pako/lib/zlib/deflate.js";
11
+import ZStream from "../vendor/pako/lib/zlib/zstream.js";
12
+
13
+export default class Deflator {
14
+ constructor() {
15
+ this.strm = new ZStream();
16
+ this.chunkSize = 1024 * 10 * 10;
17
+ this.outputBuffer = new Uint8Array(this.chunkSize);
18
+ this.windowBits = 5;
19
+
20
+ deflateInit(this.strm, this.windowBits);
21
+ }
22
+
23
+ deflate(inData) {
24
+ /* eslint-disable camelcase */
25
+ this.strm.input = inData;
26
+ this.strm.avail_in = this.strm.input.length;
27
+ this.strm.next_in = 0;
28
+ this.strm.output = this.outputBuffer;
29
+ this.strm.avail_out = this.chunkSize;
30
+ this.strm.next_out = 0;
31
+ /* eslint-enable camelcase */
32
+
33
+ let lastRet = deflate(this.strm, Z_FULL_FLUSH);
34
+ let outData = new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
35
+
36
+ if (lastRet < 0) {
37
+ throw new Error("zlib deflate failed");
38
+ }
39
+
40
+ if (this.strm.avail_in > 0) {
41
+ // Read chunks until done
42
+
43
+ let chunks = [outData];
44
+ let totalLen = outData.length;
45
+ do {
46
+ /* eslint-disable camelcase */
47
+ this.strm.output = new Uint8Array(this.chunkSize);
48
+ this.strm.next_out = 0;
49
+ this.strm.avail_out = this.chunkSize;
50
+ /* eslint-enable camelcase */
51
+
52
+ lastRet = deflate(this.strm, Z_FULL_FLUSH);
53
+
54
+ if (lastRet < 0) {
55
+ throw new Error("zlib deflate failed");
56
+ }
57
+
58
+ let chunk = new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
59
+ totalLen += chunk.length;
60
+ chunks.push(chunk);
61
+ } while (this.strm.avail_in > 0);
62
+
63
+ // Combine chunks into a single data
64
+
65
+ let newData = new Uint8Array(totalLen);
66
+ let offset = 0;
67
+
68
+ for (let i = 0; i < chunks.length; i++) {
69
+ newData.set(chunks[i], offset);
70
+ offset += chunks[i].length;
71
+ }
72
+
73
+ outData = newData;
74
+ }
75
+
76
+ /* eslint-disable camelcase */
77
+ this.strm.input = null;
78
+ this.strm.avail_in = 0;
79
+ this.strm.next_in = 0;
80
+ /* eslint-enable camelcase */
81
+
82
+ return outData;
83
+ }
84
+
85
+}
public/novnc/core/display.js
+76
-217
@@ -1,6 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
@@ -8,25 +8,20 @@
8
9
import * as Log from './util/logging.js';
10
import Base64 from "./base64.js";
11
-import { supportsImageMetadata } from './util/browser.js';
11
+import { toSigned32bit } from './util/int.js';
12
13
export default class Display {
14
constructor(target) {
15
this._drawCtx = null;
16
- this._c_forceCanvas = false;
16
17
this._renderQ = []; // queue drawing actions for in-oder rendering
18
this._flushing = false;
19
20
// the full frame buffer (logical canvas) size
22
- this._fb_width = 0;
23
- this._fb_height = 0;
21
+ this._fbWidth = 0;
22
+ this._fbHeight = 0;
23
24
this._prevDrawStyle = "";
26
- this._tile = null;
27
- this._tile16x16 = null;
28
- this._tile_x = 0;
29
- this._tile_y = 0;
25
26
Log.Debug(">> Display.constructor");
27
@@ -60,21 +55,12 @@ export default class Display {
55
56
Log.Debug("User Agent: " + navigator.userAgent);
57
63
- this.clear();
64
-
65
- // Check canvas features
66
- if (!('createImageData' in this._drawCtx)) {
67
- throw new Error("Canvas does not support createImageData");
68
- }
69
-
70
- this._tile16x16 = this._drawCtx.createImageData(16, 16);
58
Log.Debug("<< Display.constructor");
59
60
// ===== PROPERTIES =====
61
62
this._scale = 1.0;
63
this._clipViewport = false;
77
- this.logo = null;
64
65
// ===== EVENT HANDLERS =====
66
@@ -98,11 +84,11 @@ export default class Display {
84
}
85
86
get width() {
101
- return this._fb_width;
87
+ return this._fbWidth;
88
}
89
90
get height() {
105
- return this._fb_height;
91
+ return this._fbHeight;
92
}
93
94
// ===== PUBLIC METHODS =====
@@ -125,15 +111,15 @@ export default class Display {
111
if (deltaX < 0 && vp.x + deltaX < 0) {
112
deltaX = -vp.x;
113
}
128
- if (vx2 + deltaX >= this._fb_width) {
129
- deltaX -= vx2 + deltaX - this._fb_width + 1;
114
+ if (vx2 + deltaX >= this._fbWidth) {
115
+ deltaX -= vx2 + deltaX - this._fbWidth + 1;
116
}
117
118
if (vp.y + deltaY < 0) {
119
deltaY = -vp.y;
120
}
135
- if (vy2 + deltaY >= this._fb_height) {
136
- deltaY -= (vy2 + deltaY - this._fb_height + 1);
121
+ if (vy2 + deltaY >= this._fbHeight) {
122
+ deltaY -= (vy2 + deltaY - this._fbHeight + 1);
123
}
124
125
if (deltaX === 0 && deltaY === 0) {
@@ -156,18 +142,18 @@ export default class Display {
142
typeof(height) === "undefined") {
143
144
Log.Debug("Setting viewport to full display region");
159
- width = this._fb_width;
160
- height = this._fb_height;
145
+ width = this._fbWidth;
146
+ height = this._fbHeight;
147
}
148
149
width = Math.floor(width);
150
height = Math.floor(height);
151
166
- if (width > this._fb_width) {
167
- width = this._fb_width;
152
+ if (width > this._fbWidth) {
153
+ width = this._fbWidth;
154
}
169
- if (height > this._fb_height) {
170
- height = this._fb_height;
155
+ if (height > this._fbHeight) {
156
+ height = this._fbHeight;
157
}
158
159
const vp = this._viewportLoc;
@@ -194,21 +180,21 @@ export default class Display {
180
if (this._scale === 0) {
181
return 0;
182
}
197
- return x / this._scale + this._viewportLoc.x;
183
+ return toSigned32bit(x / this._scale + this._viewportLoc.x);
184
}
185
186
absY(y) {
187
if (this._scale === 0) {
188
return 0;
189
}
204
- return y / this._scale + this._viewportLoc.y;
190
+ return toSigned32bit(y / this._scale + this._viewportLoc.y);
191
}
192
193
resize(width, height) {
194
this._prevDrawStyle = "";
195
210
- this._fb_width = width;
211
- this._fb_height = height;
196
+ this._fbWidth = width;
197
+ this._fbHeight = height;
198
199
const canvas = this._backbuffer;
200
if (canvas.width !== width || canvas.height !== height) {
@@ -256,9 +242,9 @@ export default class Display {
242
243
// Update the visible canvas with the contents of the
244
// rendering canvas
259
- flip(from_queue) {
260
- if (this._renderQ.length !== 0 && !from_queue) {
261
- this._renderQ_push({
245
+ flip(fromQueue) {
246
+ if (this._renderQ.length !== 0 && !fromQueue) {
247
+ this._renderQPush({
248
'type': 'flip'
249
});
250
} else {
@@ -302,17 +288,6 @@ export default class Display {
288
}
289
}
290
305
- clear() {
306
- if (this._logo) {
307
- this.resize(this._logo.width, this._logo.height);
308
- this.imageRect(0, 0, this._logo.type, this._logo.data);
309
- } else {
310
- this.resize(240, 20);
311
- this._drawCtx.clearRect(0, 0, this._fb_width, this._fb_height);
312
- }
313
- this.flip();
314
- }
315
-
291
pending() {
292
return this._renderQ.length > 0;
293
}
@@ -325,9 +300,9 @@ export default class Display {
300
}
301
}
302
328
- fillRect(x, y, width, height, color, from_queue) {
329
- if (this._renderQ.length !== 0 && !from_queue) {
330
- this._renderQ_push({
303
+ fillRect(x, y, width, height, color, fromQueue) {
304
+ if (this._renderQ.length !== 0 && !fromQueue) {
305
+ this._renderQPush({
306
'type': 'fill',
307
'x': x,
308
'y': y,
@@ -342,14 +317,14 @@ export default class Display {
317
}
318
}
319
345
- copyImage(old_x, old_y, new_x, new_y, w, h, from_queue) {
346
- if (this._renderQ.length !== 0 && !from_queue) {
347
- this._renderQ_push({
320
+ copyImage(oldX, oldY, newX, newY, w, h, fromQueue) {
321
+ if (this._renderQ.length !== 0 && !fromQueue) {
322
+ this._renderQPush({
323
'type': 'copy',
349
- 'old_x': old_x,
350
- 'old_y': old_y,
351
- 'x': new_x,
352
- 'y': new_y,
324
+ 'oldX': oldX,
325
+ 'oldY': oldY,
326
+ 'x': newX,
327
+ 'y': newY,
328
'width': w,
329
'height': h,
330
});
@@ -367,131 +342,54 @@ export default class Display {
342
this._drawCtx.imageSmoothingEnabled = false;
343
344
this._drawCtx.drawImage(this._backbuffer,
370
- old_x, old_y, w, h,
371
- new_x, new_y, w, h);
372
- this._damage(new_x, new_y, w, h);
345
+ oldX, oldY, w, h,
346
+ newX, newY, w, h);
347
+ this._damage(newX, newY, w, h);
348
}
349
}
350
376
- imageRect(x, y, mime, arr) {
351
+ imageRect(x, y, width, height, mime, arr) {
352
+ /* The internal logic cannot handle empty images, so bail early */
353
+ if ((width === 0) || (height === 0)) {
354
+ return;
355
+ }
356
+
357
const img = new Image();
358
img.src = "data: " + mime + ";base64," + Base64.encode(arr);
379
- this._renderQ_push({
359
+
360
+ this._renderQPush({
361
'type': 'img',
362
'img': img,
363
'x': x,
383
- 'y': y
364
+ 'y': y,
365
+ 'width': width,
366
+ 'height': height
367
});
368
}
369
387
- // start updating a tile
388
- startTile(x, y, width, height, color) {
389
- this._tile_x = x;
390
- this._tile_y = y;
391
- if (width === 16 && height === 16) {
392
- this._tile = this._tile16x16;
393
- } else {
394
- this._tile = this._drawCtx.createImageData(width, height);
395
- }
396
-
397
- const red = color[2];
398
- const green = color[1];
399
- const blue = color[0];
400
-
401
- const data = this._tile.data;
402
- for (let i = 0; i < width * height * 4; i += 4) {
403
- data[i] = red;
404
- data[i + 1] = green;
405
- data[i + 2] = blue;
406
- data[i + 3] = 255;
407
- }
408
- }
409
-
410
- // update sub-rectangle of the current tile
411
- subTile(x, y, w, h, color) {
412
- const red = color[2];
413
- const green = color[1];
414
- const blue = color[0];
415
- const xend = x + w;
416
- const yend = y + h;
417
-
418
- const data = this._tile.data;
419
- const width = this._tile.width;
420
- for (let j = y; j < yend; j++) {
421
- for (let i = x; i < xend; i++) {
422
- const p = (i + (j * width)) * 4;
423
- data[p] = red;
424
- data[p + 1] = green;
425
- data[p + 2] = blue;
426
- data[p + 3] = 255;
427
- }
428
- }
429
- }
430
-
431
- // draw the current tile to the screen
432
- finishTile() {
433
- this._drawCtx.putImageData(this._tile, this._tile_x, this._tile_y);
434
- this._damage(this._tile_x, this._tile_y,
435
- this._tile.width, this._tile.height);
436
- }
437
-
438
- blitImage(x, y, width, height, arr, offset, from_queue) {
439
- if (this._renderQ.length !== 0 && !from_queue) {
370
+ blitImage(x, y, width, height, arr, offset, fromQueue) {
371
+ if (this._renderQ.length !== 0 && !fromQueue) {
372
// NB(directxman12): it's technically more performant here to use preallocated arrays,
373
// but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
374
// this probably isn't getting called *nearly* as much
443
- const new_arr = new Uint8Array(width * height * 4);
444
- new_arr.set(new Uint8Array(arr.buffer, 0, new_arr.length));
445
- this._renderQ_push({
375
+ const newArr = new Uint8Array(width * height * 4);
376
+ newArr.set(new Uint8Array(arr.buffer, 0, newArr.length));
377
+ this._renderQPush({
378
'type': 'blit',
447
- 'data': new_arr,
379
+ 'data': newArr,
380
'x': x,
381
'y': y,
382
'width': width,
383
'height': height,
384
});
385
} else {
454
- this._bgrxImageData(x, y, width, height, arr, offset);
455
- }
456
- }
457
-
458
- blitRgbImage(x, y, width, height, arr, offset, from_queue) {
459
- if (this._renderQ.length !== 0 && !from_queue) {
460
- // NB(directxman12): it's technically more performant here to use preallocated arrays,
461
- // but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
462
- // this probably isn't getting called *nearly* as much
463
- const new_arr = new Uint8Array(width * height * 3);
464
- new_arr.set(new Uint8Array(arr.buffer, 0, new_arr.length));
465
- this._renderQ_push({
466
- 'type': 'blitRgb',
467
- 'data': new_arr,
468
- 'x': x,
469
- 'y': y,
470
- 'width': width,
471
- 'height': height,
472
- });
473
- } else {
474
- this._rgbImageData(x, y, width, height, arr, offset);
475
- }
476
- }
477
-
478
- blitRgbxImage(x, y, width, height, arr, offset, from_queue) {
479
- if (this._renderQ.length !== 0 && !from_queue) {
480
- // NB(directxman12): it's technically more performant here to use preallocated arrays,
481
- // but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
482
- // this probably isn't getting called *nearly* as much
483
- const new_arr = new Uint8Array(width * height * 4);
484
- new_arr.set(new Uint8Array(arr.buffer, 0, new_arr.length));
485
- this._renderQ_push({
486
- 'type': 'blitRgbx',
487
- 'data': new_arr,
488
- 'x': x,
489
- 'y': y,
490
- 'width': width,
491
- 'height': height,
492
- });
493
- } else {
494
- this._rgbxImageData(x, y, width, height, arr, offset);
386
+ // NB(directxman12): arr must be an Type Array view
387
+ let data = new Uint8ClampedArray(arr.buffer,
388
+ arr.byteOffset + offset,
389
+ width * height * 4);
390
+ let img = new ImageData(data, width, height);
391
+ this._drawCtx.putImageData(img, x, y);
392
+ this._damage(x, y, width, height);
393
}
394
}
395
@@ -543,69 +441,30 @@ export default class Display {
441
}
442
443
_setFillColor(color) {
546
- const newStyle = 'rgb(' + color[2] + ',' + color[1] + ',' + color[0] + ')';
444
+ const newStyle = 'rgb(' + color[0] + ',' + color[1] + ',' + color[2] + ')';
445
if (newStyle !== this._prevDrawStyle) {
446
this._drawCtx.fillStyle = newStyle;
447
this._prevDrawStyle = newStyle;
448
}
449
}
450
553
- _rgbImageData(x, y, width, height, arr, offset) {
554
- const img = this._drawCtx.createImageData(width, height);
555
- const data = img.data;
556
- for (let i = 0, j = offset; i < width * height * 4; i += 4, j += 3) {
557
- data[i] = arr[j];
558
- data[i + 1] = arr[j + 1];
559
- data[i + 2] = arr[j + 2];
560
- data[i + 3] = 255; // Alpha
561
- }
562
- this._drawCtx.putImageData(img, x, y);
563
- this._damage(x, y, img.width, img.height);
564
- }
565
-
566
- _bgrxImageData(x, y, width, height, arr, offset) {
567
- const img = this._drawCtx.createImageData(width, height);
568
- const data = img.data;
569
- for (let i = 0, j = offset; i < width * height * 4; i += 4, j += 4) {
570
- data[i] = arr[j + 2];
571
- data[i + 1] = arr[j + 1];
572
- data[i + 2] = arr[j];
573
- data[i + 3] = 255; // Alpha
574
- }
575
- this._drawCtx.putImageData(img, x, y);
576
- this._damage(x, y, img.width, img.height);
577
- }
578
-
579
- _rgbxImageData(x, y, width, height, arr, offset) {
580
- // NB(directxman12): arr must be an Type Array view
581
- let img;
582
- if (supportsImageMetadata) {
583
- img = new ImageData(new Uint8ClampedArray(arr.buffer, arr.byteOffset, width * height * 4), width, height);
584
- } else {
585
- img = this._drawCtx.createImageData(width, height);
586
- img.data.set(new Uint8ClampedArray(arr.buffer, arr.byteOffset, width * height * 4));
587
- }
588
- this._drawCtx.putImageData(img, x, y);
589
- this._damage(x, y, img.width, img.height);
590
- }
591
-
592
- _renderQ_push(action) {
451
+ _renderQPush(action) {
452
this._renderQ.push(action);
453
if (this._renderQ.length === 1) {
454
// If this can be rendered immediately it will be, otherwise
455
// the scanner will wait for the relevant event
597
- this._scan_renderQ();
456
+ this._scanRenderQ();
457
}
458
}
459
601
- _resume_renderQ() {
460
+ _resumeRenderQ() {
461
// "this" is the object that is ready, not the
462
// display object
604
- this.removeEventListener('load', this._noVNC_display._resume_renderQ);
605
- this._noVNC_display._scan_renderQ();
463
+ this.removeEventListener('load', this._noVNCDisplay._resumeRenderQ);
464
+ this._noVNCDisplay._scanRenderQ();
465
}
466
608
- _scan_renderQ() {
467
+ _scanRenderQ() {
468
let ready = true;
469
while (ready && this._renderQ.length > 0) {
470
const a = this._renderQ[0];
@@ -614,7 +473,7 @@ export default class Display {
473
this.flip(true);
474
break;
475
case 'copy':
617
- this.copyImage(a.old_x, a.old_y, a.x, a.y, a.width, a.height, true);
476
+ this.copyImage(a.oldX, a.oldY, a.x, a.y, a.width, a.height, true);
477
break;
478
case 'fill':
479
this.fillRect(a.x, a.y, a.width, a.height, a.color, true);
@@ -622,18 +481,18 @@ export default class Display {
481
case 'blit':
482
this.blitImage(a.x, a.y, a.width, a.height, a.data, 0, true);
483
break;
625
- case 'blitRgb':
626
- this.blitRgbImage(a.x, a.y, a.width, a.height, a.data, 0, true);
627
- break;
628
- case 'blitRgbx':
629
- this.blitRgbxImage(a.x, a.y, a.width, a.height, a.data, 0, true);
630
- break;
484
case 'img':
485
if (a.img.complete) {
486
+ if (a.img.width !== a.width || a.img.height !== a.height) {
487
+ Log.Error("Decoded image has incorrect dimensions. Got " +
488
+ a.img.width + "x" + a.img.height + ". Expected " +
489
+ a.width + "x" + a.height + ".");
490
+ return;
491
+ }
492
this.drawImage(a.img, a.x, a.y);
493
} else {
635
- a.img._noVNC_display = this;
636
- a.img.addEventListener('load', this._resume_renderQ);
494
+ a.img._noVNCDisplay = this;
495
+ a.img.addEventListener('load', this._resumeRenderQ);
496
// We need to wait for this image to 'load'
497
// to keep things in-order
498
ready = false;
public/novnc/core/encodings.js
+4
-1
@@ -1,6 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
@@ -20,12 +20,15 @@ export const encodings = {
20
pseudoEncodingLastRect: -224,
21
pseudoEncodingCursor: -239,
22
pseudoEncodingQEMUExtendedKeyEvent: -258,
23
+ pseudoEncodingDesktopName: -307,
24
pseudoEncodingExtendedDesktopSize: -308,
25
pseudoEncodingXvp: -309,
26
pseudoEncodingFence: -312,
27
pseudoEncodingContinuousUpdates: -313,
28
pseudoEncodingCompressLevel9: -247,
29
pseudoEncodingCompressLevel0: -256,
30
+ pseudoEncodingVMwareCursor: 0x574d5664,
31
+ pseudoEncodingExtendedClipboard: 0xc0a1e5ce
32
};
33
34
export function encodingName(num) {
public/novnc/core/inflator.js
+35
-7
@@ -1,3 +1,11 @@
1
+/*
2
+ * noVNC: HTML5 VNC client
3
+ * Copyright (C) 2020 The noVNC Authors
4
+ * Licensed under MPL 2.0 (see LICENSE.txt)
5
+ *
6
+ * See README.md for usage and integration instructions.
7
+ */
8
+
9
import { inflateInit, inflate, inflateReset } from "../vendor/pako/lib/zlib/inflate.js";
10
import ZStream from "../vendor/pako/lib/zlib/zstream.js";
11
@@ -11,12 +19,22 @@ export default class Inflate {
19
inflateInit(this.strm, this.windowBits);
20
}
21
14
- inflate(data, flush, expected) {
15
- this.strm.input = data;
16
- this.strm.avail_in = this.strm.input.length;
17
- this.strm.next_in = 0;
18
- this.strm.next_out = 0;
22
+ setInput(data) {
23
+ if (!data) {
24
+ //FIXME: flush remaining data.
25
+ /* eslint-disable camelcase */
26
+ this.strm.input = null;
27
+ this.strm.avail_in = 0;
28
+ this.strm.next_in = 0;
29
+ } else {
30
+ this.strm.input = data;
31
+ this.strm.avail_in = this.strm.input.length;
32
+ this.strm.next_in = 0;
33
+ /* eslint-enable camelcase */
34
+ }
35
+ }
36
37
+ inflate(expected) {
38
// resize our output buffer if it's too small
39
// (we could just use multiple chunks, but that would cause an extra
40
// allocation each time to flatten the chunks)
@@ -25,9 +43,19 @@ export default class Inflate {
43
this.strm.output = new Uint8Array(this.chunkSize);
44
}
45
28
- this.strm.avail_out = this.chunkSize;
46
+ /* eslint-disable camelcase */
47
+ this.strm.next_out = 0;
48
+ this.strm.avail_out = expected;
49
+ /* eslint-enable camelcase */
50
+
51
+ let ret = inflate(this.strm, 0); // Flush argument not used.
52
+ if (ret < 0) {
53
+ throw new Error("zlib inflate failed");
54
+ }
55
30
- inflate(this.strm, flush);
56
+ if (this.strm.next_out != expected) {
57
+ throw new Error("Incomplete zlib block");
58
+ }
59
60
return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
61
}
public/novnc/core/input/domkeytable.js
+32
-28
@@ -35,7 +35,7 @@ function addNumpad(key, standard, numpad) {
35
DOMKeyTable[key] = [standard, standard, standard, numpad];
36
}
37
38
-// 2.2. Modifier Keys
38
+// 3.2. Modifier Keys
39
40
addLeftRight("Alt", KeyTable.XK_Alt_L, KeyTable.XK_Alt_R);
41
addStandard("AltGraph", KeyTable.XK_ISO_Level3_Shift);
@@ -43,35 +43,38 @@ addStandard("CapsLock", KeyTable.XK_Caps_Lock);
43
addLeftRight("Control", KeyTable.XK_Control_L, KeyTable.XK_Control_R);
44
// - Fn
45
// - FnLock
46
-addLeftRight("Hyper", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
46
addLeftRight("Meta", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
47
addStandard("NumLock", KeyTable.XK_Num_Lock);
48
addStandard("ScrollLock", KeyTable.XK_Scroll_Lock);
49
addLeftRight("Shift", KeyTable.XK_Shift_L, KeyTable.XK_Shift_R);
51
-addLeftRight("Super", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
50
// - Symbol
51
// - SymbolLock
52
+// - Hyper
53
+// - Super
54
55
-// 2.3. Whitespace Keys
55
+// 3.3. Whitespace Keys
56
57
addNumpad("Enter", KeyTable.XK_Return, KeyTable.XK_KP_Enter);
58
addStandard("Tab", KeyTable.XK_Tab);
59
addNumpad(" ", KeyTable.XK_space, KeyTable.XK_KP_Space);
60
61
-// 2.4. Navigation Keys
61
+// 3.4. Navigation Keys
62
63
addNumpad("ArrowDown", KeyTable.XK_Down, KeyTable.XK_KP_Down);
64
-addNumpad("ArrowUp", KeyTable.XK_Up, KeyTable.XK_KP_Up);
64
addNumpad("ArrowLeft", KeyTable.XK_Left, KeyTable.XK_KP_Left);
65
addNumpad("ArrowRight", KeyTable.XK_Right, KeyTable.XK_KP_Right);
66
+addNumpad("ArrowUp", KeyTable.XK_Up, KeyTable.XK_KP_Up);
67
addNumpad("End", KeyTable.XK_End, KeyTable.XK_KP_End);
68
addNumpad("Home", KeyTable.XK_Home, KeyTable.XK_KP_Home);
69
addNumpad("PageDown", KeyTable.XK_Next, KeyTable.XK_KP_Next);
70
addNumpad("PageUp", KeyTable.XK_Prior, KeyTable.XK_KP_Prior);
71
72
-// 2.5. Editing Keys
72
+// 3.5. Editing Keys
73
74
addStandard("Backspace", KeyTable.XK_BackSpace);
75
+// Browsers send "Clear" for the numpad 5 without NumLock because
76
+// Windows uses VK_Clear for that key. But Unix expects KP_Begin for
77
+// that scenario.
78
addNumpad("Clear", KeyTable.XK_Clear, KeyTable.XK_KP_Begin);
79
addStandard("Copy", KeyTable.XF86XK_Copy);
80
// - CrSel
@@ -84,7 +87,7 @@ addStandard("Paste", KeyTable.XF86XK_Paste);
87
addStandard("Redo", KeyTable.XK_Redo);
88
addStandard("Undo", KeyTable.XK_Undo);
89
87
-// 2.6. UI Keys
90
+// 3.6. UI Keys
91
92
// - Accept
93
// - Again (could just be XK_Redo)
@@ -102,7 +105,7 @@ addStandard("Select", KeyTable.XK_Select);
105
addStandard("ZoomIn", KeyTable.XF86XK_ZoomIn);
106
addStandard("ZoomOut", KeyTable.XF86XK_ZoomOut);
107
105
-// 2.7. Device Keys
108
+// 3.7. Device Keys
109
110
addStandard("BrightnessDown", KeyTable.XF86XK_MonBrightnessDown);
111
addStandard("BrightnessUp", KeyTable.XF86XK_MonBrightnessUp);
@@ -115,10 +118,10 @@ addStandard("Hibernate", KeyTable.XF86XK_Hibernate);
118
addStandard("Standby", KeyTable.XF86XK_Standby);
119
addStandard("WakeUp", KeyTable.XF86XK_WakeUp);
120
118
-// 2.8. IME and Composition Keys
121
+// 3.8. IME and Composition Keys
122
123
addStandard("AllCandidates", KeyTable.XK_MultipleCandidate);
121
-addStandard("Alphanumeric", KeyTable.XK_Eisu_Shift); // could also be _Eisu_Toggle
124
+addStandard("Alphanumeric", KeyTable.XK_Eisu_toggle);
125
addStandard("CodeInput", KeyTable.XK_Codeinput);
126
addStandard("Compose", KeyTable.XK_Multi_key);
127
addStandard("Convert", KeyTable.XK_Henkan);
@@ -136,7 +139,7 @@ addStandard("PreviousCandidate", KeyTable.XK_PreviousCandidate);
139
addStandard("SingleCandidate", KeyTable.XK_SingleCandidate);
140
addStandard("HangulMode", KeyTable.XK_Hangul);
141
addStandard("HanjaMode", KeyTable.XK_Hangul_Hanja);
139
-addStandard("JunjuaMode", KeyTable.XK_Hangul_Jeonja);
142
+addStandard("JunjaMode", KeyTable.XK_Hangul_Jeonja);
143
addStandard("Eisu", KeyTable.XK_Eisu_toggle);
144
addStandard("Hankaku", KeyTable.XK_Hankaku);
145
addStandard("Hiragana", KeyTable.XK_Hiragana);
@@ -146,9 +149,9 @@ addStandard("KanjiMode", KeyTable.XK_Kanji);
149
addStandard("Katakana", KeyTable.XK_Katakana);
150
addStandard("Romaji", KeyTable.XK_Romaji);
151
addStandard("Zenkaku", KeyTable.XK_Zenkaku);
149
-addStandard("ZenkakuHanaku", KeyTable.XK_Zenkaku_Hankaku);
152
+addStandard("ZenkakuHankaku", KeyTable.XK_Zenkaku_Hankaku);
153
151
-// 2.9. General-Purpose Function Keys
154
+// 3.9. General-Purpose Function Keys
155
156
addStandard("F1", KeyTable.XK_F1);
157
addStandard("F2", KeyTable.XK_F2);
@@ -187,17 +190,19 @@ addStandard("F34", KeyTable.XK_F34);
190
addStandard("F35", KeyTable.XK_F35);
191
// - Soft1...
192
190
-// 2.10. Multimedia Keys
193
+// 3.10. Multimedia Keys
194
195
// - ChannelDown
196
// - ChannelUp
197
addStandard("Close", KeyTable.XF86XK_Close);
198
addStandard("MailForward", KeyTable.XF86XK_MailForward);
199
addStandard("MailReply", KeyTable.XF86XK_Reply);
197
-addStandard("MainSend", KeyTable.XF86XK_Send);
200
+addStandard("MailSend", KeyTable.XF86XK_Send);
201
+// - MediaClose
202
addStandard("MediaFastForward", KeyTable.XF86XK_AudioForward);
203
addStandard("MediaPause", KeyTable.XF86XK_AudioPause);
204
addStandard("MediaPlay", KeyTable.XF86XK_AudioPlay);
205
+// - MediaPlayPause
206
addStandard("MediaRecord", KeyTable.XF86XK_AudioRecord);
207
addStandard("MediaRewind", KeyTable.XF86XK_AudioRewind);
208
addStandard("MediaStop", KeyTable.XF86XK_AudioStop);
@@ -209,20 +214,18 @@ addStandard("Print", KeyTable.XK_Print);
214
addStandard("Save", KeyTable.XF86XK_Save);
215
addStandard("SpellCheck", KeyTable.XF86XK_Spell);
216
212
-// 2.11. Multimedia Numpad Keys
217
+// 3.11. Multimedia Numpad Keys
218
219
// - Key11
220
// - Key12
221
217
-// 2.12. Audio Keys
222
+// 3.12. Audio Keys
223
224
// - AudioBalanceLeft
225
// - AudioBalanceRight
221
-// - AudioBassDown
226
// - AudioBassBoostDown
227
// - AudioBassBoostToggle
228
// - AudioBassBoostUp
225
-// - AudioBassUp
229
// - AudioFaderFront
230
// - AudioFaderRear
231
// - AudioSurroundModeNext
@@ -236,19 +239,20 @@ addStandard("AudioVolumeMute", KeyTable.XF86XK_AudioMute);
239
// - MicrophoneVolumeUp
240
addStandard("MicrophoneVolumeMute", KeyTable.XF86XK_AudioMicMute);
241
239
-// 2.13. Speech Keys
242
+// 3.13. Speech Keys
243
244
// - SpeechCorrectionList
245
// - SpeechInputToggle
246
244
-// 2.14. Application Keys
247
+// 3.14. Application Keys
248
246
-addStandard("LaunchCalculator", KeyTable.XF86XK_Calculator);
249
+addStandard("LaunchApplication1", KeyTable.XF86XK_MyComputer);
250
+addStandard("LaunchApplication2", KeyTable.XF86XK_Calculator);
251
addStandard("LaunchCalendar", KeyTable.XF86XK_Calendar);
252
+// - LaunchContacts
253
addStandard("LaunchMail", KeyTable.XF86XK_Mail);
254
addStandard("LaunchMediaPlayer", KeyTable.XF86XK_AudioMedia);
255
addStandard("LaunchMusicPlayer", KeyTable.XF86XK_Music);
251
-addStandard("LaunchMyComputer", KeyTable.XF86XK_MyComputer);
256
addStandard("LaunchPhone", KeyTable.XF86XK_Phone);
257
addStandard("LaunchScreenSaver", KeyTable.XF86XK_ScreenSaver);
258
addStandard("LaunchSpreadsheet", KeyTable.XF86XK_Excel);
@@ -256,7 +260,7 @@ addStandard("LaunchWebBrowser", KeyTable.XF86XK_WWW);
260
addStandard("LaunchWebCam", KeyTable.XF86XK_WebCam);
261
addStandard("LaunchWordProcessor", KeyTable.XF86XK_Word);
262
259
-// 2.15. Browser Keys
263
+// 3.15. Browser Keys
264
265
addStandard("BrowserBack", KeyTable.XF86XK_Back);
266
addStandard("BrowserFavorites", KeyTable.XF86XK_Favorites);
@@ -266,15 +270,15 @@ addStandard("BrowserRefresh", KeyTable.XF86XK_Refresh);
270
addStandard("BrowserSearch", KeyTable.XF86XK_Search);
271
addStandard("BrowserStop", KeyTable.XF86XK_Stop);
272
269
-// 2.16. Mobile Phone Keys
273
+// 3.16. Mobile Phone Keys
274
275
// - A whole bunch...
276
273
-// 2.17. TV Keys
277
+// 3.17. TV Keys
278
279
// - A whole bunch...
280
277
-// 2.18. Media Controller Keys
281
+// 3.18. Media Controller Keys
282
283
// - A whole bunch...
284
addStandard("Dimmer", KeyTable.XF86XK_BrightnessAdjust);
public/novnc/core/input/gesturehandler.js
new
+567
@@ -0,0 +1,567 @@
1
+/*
2
+ * noVNC: HTML5 VNC client
3
+ * Copyright (C) 2020 The noVNC Authors
4
+ * Licensed under MPL 2.0 (see LICENSE.txt)
5
+ *
6
+ * See README.md for usage and integration instructions.
7
+ *
8
+ */
9
+
10
+const GH_NOGESTURE = 0;
11
+const GH_ONETAP = 1;
12
+const GH_TWOTAP = 2;
13
+const GH_THREETAP = 4;
14
+const GH_DRAG = 8;
15
+const GH_LONGPRESS = 16;
16
+const GH_TWODRAG = 32;
17
+const GH_PINCH = 64;
18
+
19
+const GH_INITSTATE = 127;
20
+
21
+const GH_MOVE_THRESHOLD = 50;
22
+const GH_ANGLE_THRESHOLD = 90; // Degrees
23
+
24
+// Timeout when waiting for gestures (ms)
25
+const GH_MULTITOUCH_TIMEOUT = 250;
26
+
27
+// Maximum time between press and release for a tap (ms)
28
+const GH_TAP_TIMEOUT = 1000;
29
+
30
+// Timeout when waiting for longpress (ms)
31
+const GH_LONGPRESS_TIMEOUT = 1000;
32
+
33
+// Timeout when waiting to decide between PINCH and TWODRAG (ms)
34
+const GH_TWOTOUCH_TIMEOUT = 50;
35
+
36
+export default class GestureHandler {
37
+ constructor() {
38
+ this._target = null;
39
+
40
+ this._state = GH_INITSTATE;
41
+
42
+ this._tracked = [];
43
+ this._ignored = [];
44
+
45
+ this._waitingRelease = false;
46
+ this._releaseStart = 0.0;
47
+
48
+ this._longpressTimeoutId = null;
49
+ this._twoTouchTimeoutId = null;
50
+
51
+ this._boundEventHandler = this._eventHandler.bind(this);
52
+ }
53
+
54
+ attach(target) {
55
+ this.detach();
56
+
57
+ this._target = target;
58
+ this._target.addEventListener('touchstart',
59
+ this._boundEventHandler);
60
+ this._target.addEventListener('touchmove',
61
+ this._boundEventHandler);
62
+ this._target.addEventListener('touchend',
63
+ this._boundEventHandler);
64
+ this._target.addEventListener('touchcancel',
65
+ this._boundEventHandler);
66
+ }
67
+
68
+ detach() {
69
+ if (!this._target) {
70
+ return;
71
+ }
72
+
73
+ this._stopLongpressTimeout();
74
+ this._stopTwoTouchTimeout();
75
+
76
+ this._target.removeEventListener('touchstart',
77
+ this._boundEventHandler);
78
+ this._target.removeEventListener('touchmove',
79
+ this._boundEventHandler);
80
+ this._target.removeEventListener('touchend',
81
+ this._boundEventHandler);
82
+ this._target.removeEventListener('touchcancel',
83
+ this._boundEventHandler);
84
+ this._target = null;
85
+ }
86
+
87
+ _eventHandler(e) {
88
+ let fn;
89
+
90
+ e.stopPropagation();
91
+ e.preventDefault();
92
+
93
+ switch (e.type) {
94
+ case 'touchstart':
95
+ fn = this._touchStart;
96
+ break;
97
+ case 'touchmove':
98
+ fn = this._touchMove;
99
+ break;
100
+ case 'touchend':
101
+ case 'touchcancel':
102
+ fn = this._touchEnd;
103
+ break;
104
+ }
105
+
106
+ for (let i = 0; i < e.changedTouches.length; i++) {
107
+ let touch = e.changedTouches[i];
108
+ fn.call(this, touch.identifier, touch.clientX, touch.clientY);
109
+ }
110
+ }
111
+
112
+ _touchStart(id, x, y) {
113
+ // Ignore any new touches if there is already an active gesture,
114
+ // or we're in a cleanup state
115
+ if (this._hasDetectedGesture() || (this._state === GH_NOGESTURE)) {
116
+ this._ignored.push(id);
117
+ return;
118
+ }
119
+
120
+ // Did it take too long between touches that we should no longer
121
+ // consider this a single gesture?
122
+ if ((this._tracked.length > 0) &&
123
+ ((Date.now() - this._tracked[0].started) > GH_MULTITOUCH_TIMEOUT)) {
124
+ this._state = GH_NOGESTURE;
125
+ this._ignored.push(id);
126
+ return;
127
+ }
128
+
129
+ // If we're waiting for fingers to release then we should no longer
130
+ // recognize new touches
131
+ if (this._waitingRelease) {
132
+ this._state = GH_NOGESTURE;
133
+ this._ignored.push(id);
134
+ return;
135
+ }
136
+
137
+ this._tracked.push({
138
+ id: id,
139
+ started: Date.now(),
140
+ active: true,
141
+ firstX: x,
142
+ firstY: y,
143
+ lastX: x,
144
+ lastY: y,
145
+ angle: 0
146
+ });
147
+
148
+ switch (this._tracked.length) {
149
+ case 1:
150
+ this._startLongpressTimeout();
151
+ break;
152
+
153
+ case 2:
154
+ this._state &= ~(GH_ONETAP | GH_DRAG | GH_LONGPRESS);
155
+ this._stopLongpressTimeout();
156
+ break;
157
+
158
+ case 3:
159
+ this._state &= ~(GH_TWOTAP | GH_TWODRAG | GH_PINCH);
160
+ break;
161
+
162
+ default:
163
+ this._state = GH_NOGESTURE;
164
+ }
165
+ }
166
+
167
+ _touchMove(id, x, y) {
168
+ let touch = this._tracked.find(t => t.id === id);
169
+
170
+ // If this is an update for a touch we're not tracking, ignore it
171
+ if (touch === undefined) {
172
+ return;
173
+ }
174
+
175
+ // Update the touches last position with the event coordinates
176
+ touch.lastX = x;
177
+ touch.lastY = y;
178
+
179
+ let deltaX = x - touch.firstX;
180
+ let deltaY = y - touch.firstY;
181
+
182
+ // Update angle when the touch has moved
183
+ if ((touch.firstX !== touch.lastX) ||
184
+ (touch.firstY !== touch.lastY)) {
185
+ touch.angle = Math.atan2(deltaY, deltaX) * 180 / Math.PI;
186
+ }
187
+
188
+ if (!this._hasDetectedGesture()) {
189
+ // Ignore moves smaller than the minimum threshold
190
+ if (Math.hypot(deltaX, deltaY) < GH_MOVE_THRESHOLD) {
191
+ return;
192
+ }
193
+
194
+ // Can't be a tap or long press as we've seen movement
195
+ this._state &= ~(GH_ONETAP | GH_TWOTAP | GH_THREETAP | GH_LONGPRESS);
196
+ this._stopLongpressTimeout();
197
+
198
+ if (this._tracked.length !== 1) {
199
+ this._state &= ~(GH_DRAG);
200
+ }
201
+ if (this._tracked.length !== 2) {
202
+ this._state &= ~(GH_TWODRAG | GH_PINCH);
203
+ }
204
+
205
+ // We need to figure out which of our different two touch gestures
206
+ // this might be
207
+ if (this._tracked.length === 2) {
208
+
209
+ // The other touch is the one where the id doesn't match
210
+ let prevTouch = this._tracked.find(t => t.id !== id);
211
+
212
+ // How far the previous touch point has moved since start
213
+ let prevDeltaMove = Math.hypot(prevTouch.firstX - prevTouch.lastX,
214
+ prevTouch.firstY - prevTouch.lastY);
215
+
216
+ // We know that the current touch moved far enough,
217
+ // but unless both touches moved further than their
218
+ // threshold we don't want to disqualify any gestures
219
+ if (prevDeltaMove > GH_MOVE_THRESHOLD) {
220
+
221
+ // The angle difference between the direction of the touch points
222
+ let deltaAngle = Math.abs(touch.angle - prevTouch.angle);
223
+ deltaAngle = Math.abs(((deltaAngle + 180) % 360) - 180);
224
+
225
+ // PINCH or TWODRAG can be eliminated depending on the angle
226
+ if (deltaAngle > GH_ANGLE_THRESHOLD) {
227
+ this._state &= ~GH_TWODRAG;
228
+ } else {
229
+ this._state &= ~GH_PINCH;
230
+ }
231
+
232
+ if (this._isTwoTouchTimeoutRunning()) {
233
+ this._stopTwoTouchTimeout();
234
+ }
235
+ } else if (!this._isTwoTouchTimeoutRunning()) {
236
+ // We can't determine the gesture right now, let's
237
+ // wait and see if more events are on their way
238
+ this._startTwoTouchTimeout();
239
+ }
240
+ }
241
+
242
+ if (!this._hasDetectedGesture()) {
243
+ return;
244
+ }
245
+
246
+ this._pushEvent('gesturestart');
247
+ }
248
+
249
+ this._pushEvent('gesturemove');
250
+ }
251
+
252
+ _touchEnd(id, x, y) {
253
+ // Check if this is an ignored touch
254
+ if (this._ignored.indexOf(id) !== -1) {
255
+ // Remove this touch from ignored
256
+ this._ignored.splice(this._ignored.indexOf(id), 1);
257
+
258
+ // And reset the state if there are no more touches
259
+ if ((this._ignored.length === 0) &&
260
+ (this._tracked.length === 0)) {
261
+ this._state = GH_INITSTATE;
262
+ this._waitingRelease = false;
263
+ }
264
+ return;
265
+ }
266
+
267
+ // We got a touchend before the timer triggered,
268
+ // this cannot result in a gesture anymore.
269
+ if (!this._hasDetectedGesture() &&
270
+ this._isTwoTouchTimeoutRunning()) {
271
+ this._stopTwoTouchTimeout();
272
+ this._state = GH_NOGESTURE;
273
+ }
274
+
275
+ // Some gestures don't trigger until a touch is released
276
+ if (!this._hasDetectedGesture()) {
277
+ // Can't be a gesture that relies on movement
278
+ this._state &= ~(GH_DRAG | GH_TWODRAG | GH_PINCH);
279
+ // Or something that relies on more time
280
+ this._state &= ~GH_LONGPRESS;
281
+ this._stopLongpressTimeout();
282
+
283
+ if (!this._waitingRelease) {
284
+ this._releaseStart = Date.now();
285
+ this._waitingRelease = true;
286
+
287
+ // Can't be a tap that requires more touches than we current have
288
+ switch (this._tracked.length) {
289
+ case 1:
290
+ this._state &= ~(GH_TWOTAP | GH_THREETAP);
291
+ break;
292
+
293
+ case 2:
294
+ this._state &= ~(GH_ONETAP | GH_THREETAP);
295
+ break;
296
+ }
297
+ }
298
+ }
299
+
300
+ // Waiting for all touches to release? (i.e. some tap)
301
+ if (this._waitingRelease) {
302
+ // Were all touches released at roughly the same time?
303
+ if ((Date.now() - this._releaseStart) > GH_MULTITOUCH_TIMEOUT) {
304
+ this._state = GH_NOGESTURE;
305
+ }
306
+
307
+ // Did too long time pass between press and release?
308
+ if (this._tracked.some(t => (Date.now() - t.started) > GH_TAP_TIMEOUT)) {
309
+ this._state = GH_NOGESTURE;
310
+ }
311
+
312
+ let touch = this._tracked.find(t => t.id === id);
313
+ touch.active = false;
314
+
315
+ // Are we still waiting for more releases?
316
+ if (this._hasDetectedGesture()) {
317
+ this._pushEvent('gesturestart');
318
+ } else {
319
+ // Have we reached a dead end?
320
+ if (this._state !== GH_NOGESTURE) {
321
+ return;
322
+ }
323
+ }
324
+ }
325
+
326
+ if (this._hasDetectedGesture()) {
327
+ this._pushEvent('gestureend');
328
+ }
329
+
330
+ // Ignore any remaining touches until they are ended
331
+ for (let i = 0; i < this._tracked.length; i++) {
332
+ if (this._tracked[i].active) {
333
+ this._ignored.push(this._tracked[i].id);
334
+ }
335
+ }
336
+ this._tracked = [];
337
+
338
+ this._state = GH_NOGESTURE;
339
+
340
+ // Remove this touch from ignored if it's in there
341
+ if (this._ignored.indexOf(id) !== -1) {
342
+ this._ignored.splice(this._ignored.indexOf(id), 1);
343
+ }
344
+
345
+ // We reset the state if ignored is empty
346
+ if ((this._ignored.length === 0)) {
347
+ this._state = GH_INITSTATE;
348
+ this._waitingRelease = false;
349
+ }
350
+ }
351
+
352
+ _hasDetectedGesture() {
353
+ if (this._state === GH_NOGESTURE) {
354
+ return false;
355
+ }
356
+ // Check to see if the bitmask value is a power of 2
357
+ // (i.e. only one bit set). If it is, we have a state.
358
+ if (this._state & (this._state - 1)) {
359
+ return false;
360
+ }
361
+
362
+ // For taps we also need to have all touches released
363
+ // before we've fully detected the gesture
364
+ if (this._state & (GH_ONETAP | GH_TWOTAP | GH_THREETAP)) {
365
+ if (this._tracked.some(t => t.active)) {
366
+ return false;
367
+ }
368
+ }
369
+
370
+ return true;
371
+ }
372
+
373
+ _startLongpressTimeout() {
374
+ this._stopLongpressTimeout();
375
+ this._longpressTimeoutId = setTimeout(() => this._longpressTimeout(),
376
+ GH_LONGPRESS_TIMEOUT);
377
+ }
378
+
379
+ _stopLongpressTimeout() {
380
+ clearTimeout(this._longpressTimeoutId);
381
+ this._longpressTimeoutId = null;
382
+ }
383
+
384
+ _longpressTimeout() {
385
+ if (this._hasDetectedGesture()) {
386
+ throw new Error("A longpress gesture failed, conflict with a different gesture");
387
+ }
388
+
389
+ this._state = GH_LONGPRESS;
390
+ this._pushEvent('gesturestart');
391
+ }
392
+
393
+ _startTwoTouchTimeout() {
394
+ this._stopTwoTouchTimeout();
395
+ this._twoTouchTimeoutId = setTimeout(() => this._twoTouchTimeout(),
396
+ GH_TWOTOUCH_TIMEOUT);
397
+ }
398
+
399
+ _stopTwoTouchTimeout() {
400
+ clearTimeout(this._twoTouchTimeoutId);
401
+ this._twoTouchTimeoutId = null;
402
+ }
403
+
404
+ _isTwoTouchTimeoutRunning() {
405
+ return this._twoTouchTimeoutId !== null;
406
+ }
407
+
408
+ _twoTouchTimeout() {
409
+ if (this._tracked.length === 0) {
410
+ throw new Error("A pinch or two drag gesture failed, no tracked touches");
411
+ }
412
+
413
+ // How far each touch point has moved since start
414
+ let avgM = this._getAverageMovement();
415
+ let avgMoveH = Math.abs(avgM.x);
416
+ let avgMoveV = Math.abs(avgM.y);
417
+
418
+ // The difference in the distance between where
419
+ // the touch points started and where they are now
420
+ let avgD = this._getAverageDistance();
421
+ let deltaTouchDistance = Math.abs(Math.hypot(avgD.first.x, avgD.first.y) -
422
+ Math.hypot(avgD.last.x, avgD.last.y));
423
+
424
+ if ((avgMoveV < deltaTouchDistance) &&
425
+ (avgMoveH < deltaTouchDistance)) {
426
+ this._state = GH_PINCH;
427
+ } else {
428
+ this._state = GH_TWODRAG;
429
+ }
430
+
431
+ this._pushEvent('gesturestart');
432
+ this._pushEvent('gesturemove');
433
+ }
434
+
435
+ _pushEvent(type) {
436
+ let detail = { type: this._stateToGesture(this._state) };
437
+
438
+ // For most gesture events the current (average) position is the
439
+ // most useful
440
+ let avg = this._getPosition();
441
+ let pos = avg.last;
442
+
443
+ // However we have a slight distance to detect gestures, so for the
444
+ // first gesture event we want to use the first positions we saw
445
+ if (type === 'gesturestart') {
446
+ pos = avg.first;
447
+ }
448
+
449
+ // For these gestures, we always want the event coordinates
450
+ // to be where the gesture began, not the current touch location.
451
+ switch (this._state) {
452
+ case GH_TWODRAG:
453
+ case GH_PINCH:
454
+ pos = avg.first;
455
+ break;
456
+ }
457
+
458
+ detail['clientX'] = pos.x;
459
+ detail['clientY'] = pos.y;
460
+
461
+ // FIXME: other coordinates?
462
+
463
+ // Some gestures also have a magnitude
464
+ if (this._state === GH_PINCH) {
465
+ let distance = this._getAverageDistance();
466
+ if (type === 'gesturestart') {
467
+ detail['magnitudeX'] = distance.first.x;
468
+ detail['magnitudeY'] = distance.first.y;
469
+ } else {
470
+ detail['magnitudeX'] = distance.last.x;
471
+ detail['magnitudeY'] = distance.last.y;
472
+ }
473
+ } else if (this._state === GH_TWODRAG) {
474
+ if (type === 'gesturestart') {
475
+ detail['magnitudeX'] = 0.0;
476
+ detail['magnitudeY'] = 0.0;
477
+ } else {
478
+ let movement = this._getAverageMovement();
479
+ detail['magnitudeX'] = movement.x;
480
+ detail['magnitudeY'] = movement.y;
481
+ }
482
+ }
483
+
484
+ let gev = new CustomEvent(type, { detail: detail });
485
+ this._target.dispatchEvent(gev);
486
+ }
487
+
488
+ _stateToGesture(state) {
489
+ switch (state) {
490
+ case GH_ONETAP:
491
+ return 'onetap';
492
+ case GH_TWOTAP:
493
+ return 'twotap';
494
+ case GH_THREETAP:
495
+ return 'threetap';
496
+ case GH_DRAG:
497
+ return 'drag';
498
+ case GH_LONGPRESS:
499
+ return 'longpress';
500
+ case GH_TWODRAG:
501
+ return 'twodrag';
502
+ case GH_PINCH:
503
+ return 'pinch';
504
+ }
505
+
506
+ throw new Error("Unknown gesture state: " + state);
507
+ }
508
+
509
+ _getPosition() {
510
+ if (this._tracked.length === 0) {
511
+ throw new Error("Failed to get gesture position, no tracked touches");
512
+ }
513
+
514
+ let size = this._tracked.length;
515
+ let fx = 0, fy = 0, lx = 0, ly = 0;
516
+
517
+ for (let i = 0; i < this._tracked.length; i++) {
518
+ fx += this._tracked[i].firstX;
519
+ fy += this._tracked[i].firstY;
520
+ lx += this._tracked[i].lastX;
521
+ ly += this._tracked[i].lastY;
522
+ }
523
+
524
+ return { first: { x: fx / size,
525
+ y: fy / size },
526
+ last: { x: lx / size,
527
+ y: ly / size } };
528
+ }
529
+
530
+ _getAverageMovement() {
531
+ if (this._tracked.length === 0) {
532
+ throw new Error("Failed to get gesture movement, no tracked touches");
533
+ }
534
+
535
+ let totalH, totalV;
536
+ totalH = totalV = 0;
537
+ let size = this._tracked.length;
538
+
539
+ for (let i = 0; i < this._tracked.length; i++) {
540
+ totalH += this._tracked[i].lastX - this._tracked[i].firstX;
541
+ totalV += this._tracked[i].lastY - this._tracked[i].firstY;
542
+ }
543
+
544
+ return { x: totalH / size,
545
+ y: totalV / size };
546
+ }
547
+
548
+ _getAverageDistance() {
549
+ if (this._tracked.length === 0) {
550
+ throw new Error("Failed to get gesture distance, no tracked touches");
551
+ }
552
+
553
+ // Distance between the first and last tracked touches
554
+
555
+ let first = this._tracked[0];
556
+ let last = this._tracked[this._tracked.length - 1];
557
+
558
+ let fdx = Math.abs(last.firstX - first.firstX);
559
+ let fdy = Math.abs(last.firstY - first.firstY);
560
+
561
+ let ldx = Math.abs(last.lastX - first.lastX);
562
+ let ldy = Math.abs(last.lastY - first.lastY);
563
+
564
+ return { first: { x: fdx, y: fdy },
565
+ last: { x: ldx, y: ldy } };
566
+ }
567
+}
public/novnc/core/input/keyboard.js
+32
-129
@@ -1,6 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
5
*/
6
@@ -20,16 +20,13 @@ export default class Keyboard {
20
21
this._keyDownList = {}; // List of depressed keys
22
// (even if they are happy)
23
- this._pendingKey = null; // Key waiting for keypress
23
this._altGrArmed = false; // Windows AltGr detection
24
25
// keep these here so we can refer to them later
26
this._eventHandlers = {
27
'keyup': this._handleKeyUp.bind(this),
28
'keydown': this._handleKeyDown.bind(this),
30
- 'keypress': this._handleKeyPress.bind(this),
29
'blur': this._allKeysUp.bind(this),
32
- 'checkalt': this._checkAlt.bind(this),
30
};
31
32
// ===== EVENT HANDLERS =====
@@ -62,9 +59,7 @@ export default class Keyboard {
59
}
60
61
// Unstable, but we don't have anything else to go on
65
- // (don't use it for 'keypress' events thought since
66
- // WebKit sets it to the same as charCode)
67
- if (e.keyCode && (e.type !== 'keypress')) {
62
+ if (e.keyCode) {
63
// 229 is used for composition events
64
if (e.keyCode !== 229) {
65
return 'Platform' + e.keyCode;
@@ -118,9 +113,7 @@ export default class Keyboard {
113
114
// We cannot handle keys we cannot track, but we also need
115
// to deal with virtual keyboards which omit key info
121
- // (iOS omits tracking info on keyup events, which forces us to
122
- // special treat that platform here)
123
- if ((code === 'Unidentified') || browser.isIOS()) {
116
+ if (code === 'Unidentified') {
117
if (keysym) {
118
// If it's a virtual keyboard then it should be
119
// sufficient to just send press and release right
@@ -137,7 +130,7 @@ export default class Keyboard {
130
// keys around a bit to make things more sane for the remote
131
// server. This method is used by RealVNC and TigerVNC (and
132
// possibly others).
140
- if (browser.isMac()) {
133
+ if (browser.isMac() || browser.isIOS()) {
134
switch (keysym) {
135
case KeyTable.XK_Super_L:
136
keysym = KeyTable.XK_Alt_L;
@@ -164,27 +157,27 @@ export default class Keyboard {
157
// state change events. That gets extra confusing for CapsLock
158
// which toggles on each press, but not on release. So pretend
159
// it was a quick press and release of the button.
167
- if (browser.isMac() && (code === 'CapsLock')) {
160
+ if ((browser.isMac() || browser.isIOS()) && (code === 'CapsLock')) {
161
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
162
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
163
stopEvent(e);
164
return;
165
}
166
174
- // If this is a legacy browser then we'll need to wait for
175
- // a keypress event as well
176
- // (IE and Edge has a broken KeyboardEvent.key, so we can't
177
- // just check for the presence of that field)
178
- if (!keysym && (!e.key || browser.isIE() || browser.isEdge())) {
179
- this._pendingKey = code;
180
- // However we might not get a keypress event if the key
181
- // is non-printable, which needs some special fallback
182
- // handling
183
- setTimeout(this._handleKeyPressTimeout.bind(this), 10, e);
167
+ // Windows doesn't send proper key releases for a bunch of
168
+ // Japanese IM keys so we have to fake the release right away
169
+ const jpBadKeys = [ KeyTable.XK_Zenkaku_Hankaku,
170
+ KeyTable.XK_Eisu_toggle,
171
+ KeyTable.XK_Katakana,
172
+ KeyTable.XK_Hiragana,
173
+ KeyTable.XK_Romaji ];
174
+ if (browser.isWindows() && jpBadKeys.includes(keysym)) {
175
+ this._sendKeyEvent(keysym, code, true);
176
+ this._sendKeyEvent(keysym, code, false);
177
+ stopEvent(e);
178
return;
179
}
180
187
- this._pendingKey = null;
181
stopEvent(e);
182
183
// Possible start of AltGr sequence? (see above)
@@ -199,69 +192,6 @@ export default class Keyboard {
192
this._sendKeyEvent(keysym, code, true);
193
}
194
202
- // Legacy event for browsers without code/key
203
- _handleKeyPress(e) {
204
- stopEvent(e);
205
-
206
- // Are we expecting a keypress?
207
- if (this._pendingKey === null) {
208
- return;
209
- }
210
-
211
- let code = this._getKeyCode(e);
212
- const keysym = KeyboardUtil.getKeysym(e);
213
-
214
- // The key we were waiting for?
215
- if ((code !== 'Unidentified') && (code != this._pendingKey)) {
216
- return;
217
- }
218
-
219
- code = this._pendingKey;
220
- this._pendingKey = null;
221
-
222
- if (!keysym) {
223
- Log.Info('keypress with no keysym:', e);
224
- return;
225
- }
226
-
227
- this._sendKeyEvent(keysym, code, true);
228
- }
229
-
230
- _handleKeyPressTimeout(e) {
231
- // Did someone manage to sort out the key already?
232
- if (this._pendingKey === null) {
233
- return;
234
- }
235
-
236
- let keysym;
237
-
238
- const code = this._pendingKey;
239
- this._pendingKey = null;
240
-
241
- // We have no way of knowing the proper keysym with the
242
- // information given, but the following are true for most
243
- // layouts
244
- if ((e.keyCode >= 0x30) && (e.keyCode <= 0x39)) {
245
- // Digit
246
- keysym = e.keyCode;
247
- } else if ((e.keyCode >= 0x41) && (e.keyCode <= 0x5a)) {
248
- // Character (A-Z)
249
- let char = String.fromCharCode(e.keyCode);
250
- // A feeble attempt at the correct case
251
- if (e.shiftKey) {
252
- char = char.toUpperCase();
253
- } else {
254
- char = char.toLowerCase();
255
- }
256
- keysym = char.charCodeAt();
257
- } else {
258
- // Unknown, give up
259
- keysym = 0;
260
- }
261
-
262
- this._sendKeyEvent(keysym, code, true);
263
- }
264
-
195
_handleKeyUp(e) {
196
stopEvent(e);
197
@@ -276,13 +206,28 @@ export default class Keyboard {
206
}
207
208
// See comment in _handleKeyDown()
279
- if (browser.isMac() && (code === 'CapsLock')) {
209
+ if ((browser.isMac() || browser.isIOS()) && (code === 'CapsLock')) {
210
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
211
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
212
return;
213
}
214
215
this._sendKeyEvent(this._keyDownList[code], code, false);
216
+
217
+ // Windows has a rather nasty bug where it won't send key
218
+ // release events for a Shift button if the other Shift is still
219
+ // pressed
220
+ if (browser.isWindows() && ((code === 'ShiftLeft') ||
221
+ (code === 'ShiftRight'))) {
222
+ if ('ShiftRight' in this._keyDownList) {
223
+ this._sendKeyEvent(this._keyDownList['ShiftRight'],
224
+ 'ShiftRight', false);
225
+ }
226
+ if ('ShiftLeft' in this._keyDownList) {
227
+ this._sendKeyEvent(this._keyDownList['ShiftLeft'],
228
+ 'ShiftLeft', false);
229
+ }
230
+ }
231
}
232
233
_handleAltGrTimeout() {
@@ -299,26 +244,6 @@ export default class Keyboard {
244
Log.Debug("<< Keyboard.allKeysUp");
245
}
246
302
- // Firefox Alt workaround, see below
303
- _checkAlt(e) {
304
- if (e.altKey) {
305
- return;
306
- }
307
-
308
- const target = this._target;
309
- const downList = this._keyDownList;
310
- ['AltLeft', 'AltRight'].forEach((code) => {
311
- if (!(code in downList)) {
312
- return;
313
- }
314
-
315
- const event = new KeyboardEvent('keyup',
316
- { key: downList[code],
317
- code: code });
318
- target.dispatchEvent(event);
319
- });
320
- }
321
-
247
// ===== PUBLIC METHODS =====
248
249
grab() {
@@ -326,40 +251,18 @@ export default class Keyboard {
251
252
this._target.addEventListener('keydown', this._eventHandlers.keydown);
253
this._target.addEventListener('keyup', this._eventHandlers.keyup);
329
- this._target.addEventListener('keypress', this._eventHandlers.keypress);
254
255
// Release (key up) if window loses focus
256
window.addEventListener('blur', this._eventHandlers.blur);
257
334
- // Firefox has broken handling of Alt, so we need to poll as
335
- // best we can for releases (still doesn't prevent the menu
336
- // from popping up though as we can't call preventDefault())
337
- if (browser.isWindows() && browser.isFirefox()) {
338
- const handler = this._eventHandlers.checkalt;
339
- ['mousedown', 'mouseup', 'mousemove', 'wheel',
340
- 'touchstart', 'touchend', 'touchmove',
341
- 'keydown', 'keyup'].forEach(type =>
342
- document.addEventListener(type, handler,
343
- { capture: true,
344
- passive: true }));
345
- }
346
-
258
//Log.Debug("<< Keyboard.grab");
259
}
260
261
ungrab() {
262
//Log.Debug(">> Keyboard.ungrab");
263
353
- if (browser.isWindows() && browser.isFirefox()) {
354
- const handler = this._eventHandlers.checkalt;
355
- ['mousedown', 'mouseup', 'mousemove', 'wheel',
356
- 'touchstart', 'touchend', 'touchmove',
357
- 'keydown', 'keyup'].forEach(type => document.removeEventListener(type, handler));
358
- }
359
-
264
this._target.removeEventListener('keydown', this._eventHandlers.keydown);
265
this._target.removeEventListener('keyup', this._eventHandlers.keyup);
362
- this._target.removeEventListener('keypress', this._eventHandlers.keypress);
266
window.removeEventListener('blur', this._eventHandlers.blur);
267
268
// Release (key up) all keys that are in a down state
public/novnc/core/input/mouse.js
deleted
-276
@@ -1,276 +0,0 @@
1
-/*
2
- * noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
4
- * Licensed under MPL 2.0 or any later version (see LICENSE.txt)
5
- */
6
-
7
-import * as Log from '../util/logging.js';
8
-import { isTouchDevice } from '../util/browser.js';
9
-import { setCapture, stopEvent, getPointerEvent } from '../util/events.js';
10
-
11
-const WHEEL_STEP = 10; // Delta threshold for a mouse wheel step
12
-const WHEEL_STEP_TIMEOUT = 50; // ms
13
-const WHEEL_LINE_HEIGHT = 19;
14
-
15
-export default class Mouse {
16
- constructor(target) {
17
- this._target = target || document;
18
-
19
- this._doubleClickTimer = null;
20
- this._lastTouchPos = null;
21
-
22
- this._pos = null;
23
- this._wheelStepXTimer = null;
24
- this._wheelStepYTimer = null;
25
- this._accumulatedWheelDeltaX = 0;
26
- this._accumulatedWheelDeltaY = 0;
27
-
28
- this._eventHandlers = {
29
- 'mousedown': this._handleMouseDown.bind(this),
30
- 'mouseup': this._handleMouseUp.bind(this),
31
- 'mousemove': this._handleMouseMove.bind(this),
32
- 'mousewheel': this._handleMouseWheel.bind(this),
33
- 'mousedisable': this._handleMouseDisable.bind(this)
34
- };
35
-
36
- // ===== PROPERTIES =====
37
-
38
- this.touchButton = 1; // Button mask (1, 2, 4) for touch devices (0 means ignore clicks)
39
-
40
- // ===== EVENT HANDLERS =====
41
-
42
- this.onmousebutton = () => {}; // Handler for mouse button click/release
43
- this.onmousemove = () => {}; // Handler for mouse movement
44
- }
45
-
46
- // ===== PRIVATE METHODS =====
47
-
48
- _resetDoubleClickTimer() {
49
- this._doubleClickTimer = null;
50
- }
51
-
52
- _handleMouseButton(e, down) {
53
- this._updateMousePosition(e);
54
- let pos = this._pos;
55
-
56
- let bmask;
57
- if (e.touches || e.changedTouches) {
58
- // Touch device
59
-
60
- // When two touches occur within 500 ms of each other and are
61
- // close enough together a double click is triggered.
62
- if (down == 1) {
63
- if (this._doubleClickTimer === null) {
64
- this._lastTouchPos = pos;
65
- } else {
66
- clearTimeout(this._doubleClickTimer);
67
-
68
- // When the distance between the two touches is small enough
69
- // force the position of the latter touch to the position of
70
- // the first.
71
-
72
- const xs = this._lastTouchPos.x - pos.x;
73
- const ys = this._lastTouchPos.y - pos.y;
74
- const d = Math.sqrt((xs * xs) + (ys * ys));
75
-
76
- // The goal is to trigger on a certain physical width, the
77
- // devicePixelRatio brings us a bit closer but is not optimal.
78
- const threshold = 20 * (window.devicePixelRatio || 1);
79
- if (d < threshold) {
80
- pos = this._lastTouchPos;
81
- }
82
- }
83
- this._doubleClickTimer = setTimeout(this._resetDoubleClickTimer.bind(this), 500);
84
- }
85
- bmask = this.touchButton;
86
- // If bmask is set
87
- } else if (e.which) {
88
- /* everything except IE */
89
- bmask = 1 << e.button;
90
- } else {
91
- /* IE including 9 */
92
- bmask = (e.button & 0x1) + // Left
93
- (e.button & 0x2) * 2 + // Right
94
- (e.button & 0x4) / 2; // Middle
95
- }
96
-
97
- Log.Debug("onmousebutton " + (down ? "down" : "up") +
98
- ", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask);
99
- this.onmousebutton(pos.x, pos.y, down, bmask);
100
-
101
- stopEvent(e);
102
- }
103
-
104
- _handleMouseDown(e) {
105
- // Touch events have implicit capture
106
- if (e.type === "mousedown") {
107
- setCapture(this._target);
108
- }
109
-
110
- this._handleMouseButton(e, 1);
111
- }
112
-
113
- _handleMouseUp(e) {
114
- this._handleMouseButton(e, 0);
115
- }
116
-
117
- // Mouse wheel events are sent in steps over VNC. This means that the VNC
118
- // protocol can't handle a wheel event with specific distance or speed.
119
- // Therefor, if we get a lot of small mouse wheel events we combine them.
120
- _generateWheelStepX() {
121
-
122
- if (this._accumulatedWheelDeltaX < 0) {
123
- this.onmousebutton(this._pos.x, this._pos.y, 1, 1 << 5);
124
- this.onmousebutton(this._pos.x, this._pos.y, 0, 1 << 5);
125
- } else if (this._accumulatedWheelDeltaX > 0) {
126
- this.onmousebutton(this._pos.x, this._pos.y, 1, 1 << 6);
127
- this.onmousebutton(this._pos.x, this._pos.y, 0, 1 << 6);
128
- }
129
-
130
- this._accumulatedWheelDeltaX = 0;
131
- }
132
-
133
- _generateWheelStepY() {
134
-
135
- if (this._accumulatedWheelDeltaY < 0) {
136
- this.onmousebutton(this._pos.x, this._pos.y, 1, 1 << 3);
137
- this.onmousebutton(this._pos.x, this._pos.y, 0, 1 << 3);
138
- } else if (this._accumulatedWheelDeltaY > 0) {
139
- this.onmousebutton(this._pos.x, this._pos.y, 1, 1 << 4);
140
- this.onmousebutton(this._pos.x, this._pos.y, 0, 1 << 4);
141
- }
142
-
143
- this._accumulatedWheelDeltaY = 0;
144
- }
145
-
146
- _resetWheelStepTimers() {
147
- window.clearTimeout(this._wheelStepXTimer);
148
- window.clearTimeout(this._wheelStepYTimer);
149
- this._wheelStepXTimer = null;
150
- this._wheelStepYTimer = null;
151
- }
152
-
153
- _handleMouseWheel(e) {
154
- this._resetWheelStepTimers();
155
-
156
- this._updateMousePosition(e);
157
-
158
- let dX = e.deltaX;
159
- let dY = e.deltaY;
160
-
161
- // Pixel units unless it's non-zero.
162
- // Note that if deltamode is line or page won't matter since we aren't
163
- // sending the mouse wheel delta to the server anyway.
164
- // The difference between pixel and line can be important however since
165
- // we have a threshold that can be smaller than the line height.
166
- if (e.deltaMode !== 0) {
167
- dX *= WHEEL_LINE_HEIGHT;
168
- dY *= WHEEL_LINE_HEIGHT;
169
- }
170
-
171
- this._accumulatedWheelDeltaX += dX;
172
- this._accumulatedWheelDeltaY += dY;
173
-
174
- // Generate a mouse wheel step event when the accumulated delta
175
- // for one of the axes is large enough.
176
- // Small delta events that do not pass the threshold get sent
177
- // after a timeout.
178
- if (Math.abs(this._accumulatedWheelDeltaX) > WHEEL_STEP) {
179
- this._generateWheelStepX();
180
- } else {
181
- this._wheelStepXTimer =
182
- window.setTimeout(this._generateWheelStepX.bind(this),
183
- WHEEL_STEP_TIMEOUT);
184
- }
185
- if (Math.abs(this._accumulatedWheelDeltaY) > WHEEL_STEP) {
186
- this._generateWheelStepY();
187
- } else {
188
- this._wheelStepYTimer =
189
- window.setTimeout(this._generateWheelStepY.bind(this),
190
- WHEEL_STEP_TIMEOUT);
191
- }
192
-
193
- stopEvent(e);
194
- }
195
-
196
- _handleMouseMove(e) {
197
- this._updateMousePosition(e);
198
- this.onmousemove(this._pos.x, this._pos.y);
199
- stopEvent(e);
200
- }
201
-
202
- _handleMouseDisable(e) {
203
- /*
204
- * Stop propagation if inside canvas area
205
- * Note: This is only needed for the 'click' event as it fails
206
- * to fire properly for the target element so we have
207
- * to listen on the document element instead.
208
- */
209
- if (e.target == this._target) {
210
- stopEvent(e);
211
- }
212
- }
213
-
214
- // Update coordinates relative to target
215
- _updateMousePosition(e) {
216
- e = getPointerEvent(e);
217
- const bounds = this._target.getBoundingClientRect();
218
- let x;
219
- let y;
220
- // Clip to target bounds
221
- if (e.clientX < bounds.left) {
222
- x = 0;
223
- } else if (e.clientX >= bounds.right) {
224
- x = bounds.width - 1;
225
- } else {
226
- x = e.clientX - bounds.left;
227
- }
228
- if (e.clientY < bounds.top) {
229
- y = 0;
230
- } else if (e.clientY >= bounds.bottom) {
231
- y = bounds.height - 1;
232
- } else {
233
- y = e.clientY - bounds.top;
234
- }
235
- this._pos = {x: x, y: y};
236
- }
237
-
238
- // ===== PUBLIC METHODS =====
239
-
240
- grab() {
241
- if (isTouchDevice) {
242
- this._target.addEventListener('touchstart', this._eventHandlers.mousedown);
243
- this._target.addEventListener('touchend', this._eventHandlers.mouseup);
244
- this._target.addEventListener('touchmove', this._eventHandlers.mousemove);
245
- }
246
- this._target.addEventListener('mousedown', this._eventHandlers.mousedown);
247
- this._target.addEventListener('mouseup', this._eventHandlers.mouseup);
248
- this._target.addEventListener('mousemove', this._eventHandlers.mousemove);
249
- this._target.addEventListener('wheel', this._eventHandlers.mousewheel);
250
-
251
- /* Prevent middle-click pasting (see above for why we bind to document) */
252
- document.addEventListener('click', this._eventHandlers.mousedisable);
253
-
254
- /* preventDefault() on mousedown doesn't stop this event for some
255
- reason so we have to explicitly block it */
256
- this._target.addEventListener('contextmenu', this._eventHandlers.mousedisable);
257
- }
258
-
259
- ungrab() {
260
- this._resetWheelStepTimers();
261
-
262
- if (isTouchDevice) {
263
- this._target.removeEventListener('touchstart', this._eventHandlers.mousedown);
264
- this._target.removeEventListener('touchend', this._eventHandlers.mouseup);
265
- this._target.removeEventListener('touchmove', this._eventHandlers.mousemove);
266
- }
267
- this._target.removeEventListener('mousedown', this._eventHandlers.mousedown);
268
- this._target.removeEventListener('mouseup', this._eventHandlers.mouseup);
269
- this._target.removeEventListener('mousemove', this._eventHandlers.mousemove);
270
- this._target.removeEventListener('wheel', this._eventHandlers.mousewheel);
271
-
272
- document.removeEventListener('click', this._eventHandlers.mousedisable);
273
-
274
- this._target.removeEventListener('contextmenu', this._eventHandlers.mousedisable);
275
- }
276
-}
public/novnc/core/input/util.js
+54
-27
@@ -1,3 +1,4 @@
1
+import KeyTable from "./keysym.js";
2
import keysyms from "./keysymdef.js";
3
import vkeys from "./vkeys.js";
4
import fixedkeys from "./fixedkeys.js";
@@ -21,9 +22,8 @@ export function getKeycode(evt) {
22
}
23
24
// The de-facto standard is to use Windows Virtual-Key codes
24
- // in the 'keyCode' field for non-printable characters. However
25
- // Webkit sets it to the same as charCode in 'keypress' events.
26
- if ((evt.type !== 'keypress') && (evt.keyCode in vkeys)) {
25
+ // in the 'keyCode' field for non-printable characters
26
+ if (evt.keyCode in vkeys) {
27
let code = vkeys[evt.keyCode];
28
29
// macOS has messed up this code for some reason
@@ -68,29 +68,11 @@ export function getKeycode(evt) {
68
export function getKey(evt) {
69
// Are we getting a proper key value?
70
if (evt.key !== undefined) {
71
- // IE and Edge use some ancient version of the spec
72
- // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/
73
- switch (evt.key) {
74
- case 'Spacebar': return ' ';
75
- case 'Esc': return 'Escape';
76
- case 'Scroll': return 'ScrollLock';
77
- case 'Win': return 'Meta';
78
- case 'Apps': return 'ContextMenu';
79
- case 'Up': return 'ArrowUp';
80
- case 'Left': return 'ArrowLeft';
81
- case 'Right': return 'ArrowRight';
82
- case 'Down': return 'ArrowDown';
83
- case 'Del': return 'Delete';
84
- case 'Divide': return '/';
85
- case 'Multiply': return '*';
86
- case 'Subtract': return '-';
87
- case 'Add': return '+';
88
- case 'Decimal': return evt.char;
89
- }
90
-
71
// Mozilla isn't fully in sync with the spec yet
72
switch (evt.key) {
73
case 'OS': return 'Meta';
74
+ case 'LaunchMyComputer': return 'LaunchApplication1';
75
+ case 'LaunchCalculator': return 'LaunchApplication2';
76
}
77
78
// iOS leaks some OS names
@@ -102,11 +84,12 @@ export function getKey(evt) {
84
case 'UIKeyInputEscape': return 'Escape';
85
}
86
105
- // IE and Edge have broken handling of AltGraph so we cannot
106
- // trust them for printable characters
107
- if ((evt.key.length !== 1) || (!browser.isIE() && !browser.isEdge())) {
108
- return evt.key;
87
+ // Broken behaviour in Chrome
88
+ if ((evt.key === '\x00') && (evt.code === 'NumpadDecimal')) {
89
+ return 'Delete';
90
}
91
+
92
+ return evt.key;
93
}
94
95
// Try to deduce it based on the physical key
@@ -141,10 +124,54 @@ export function getKeysym(evt) {
124
location = 2;
125
}
126
127
+ // And for Clear
128
+ if ((key === 'Clear') && (location === 3)) {
129
+ let code = getKeycode(evt);
130
+ if (code === 'NumLock') {
131
+ location = 0;
132
+ }
133
+ }
134
+
135
if ((location === undefined) || (location > 3)) {
136
location = 0;
137
}
138
139
+ // The original Meta key now gets confused with the Windows key
140
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1020141
141
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1232918
142
+ if (key === 'Meta') {
143
+ let code = getKeycode(evt);
144
+ if (code === 'AltLeft') {
145
+ return KeyTable.XK_Meta_L;
146
+ } else if (code === 'AltRight') {
147
+ return KeyTable.XK_Meta_R;
148
+ }
149
+ }
150
+
151
+ // macOS has Clear instead of NumLock, but the remote system is
152
+ // probably not macOS, so lying here is probably best...
153
+ if (key === 'Clear') {
154
+ let code = getKeycode(evt);
155
+ if (code === 'NumLock') {
156
+ return KeyTable.XK_Num_Lock;
157
+ }
158
+ }
159
+
160
+ // Windows sends alternating symbols for some keys when using a
161
+ // Japanese layout. We have no way of synchronising with the IM
162
+ // running on the remote system, so we send some combined keysym
163
+ // instead and hope for the best.
164
+ if (browser.isWindows()) {
165
+ switch (key) {
166
+ case 'Zenkaku':
167
+ case 'Hankaku':
168
+ return KeyTable.XK_Zenkaku_Hankaku;
169
+ case 'Romaji':
170
+ case 'KanaMode':
171
+ return KeyTable.XK_Romaji;
172
+ }
173
+ }
174
+
175
return DOMKeyTable[key][location];
176
}
177
public/novnc/core/input/vkeys.js
-1
@@ -13,7 +13,6 @@ export default {
13
0x08: 'Backspace',
14
0x09: 'Tab',
15
0x0a: 'NumpadClear',
16
- 0x0c: 'Numpad5', // IE11 sends evt.keyCode: 12 when numlock is off
16
0x0d: 'Enter',
17
0x10: 'ShiftLeft',
18
0x11: 'ControlLeft',
public/novnc/core/input/xtscancodes.js
+5
-3
@@ -1,8 +1,8 @@
1
/*
2
- * This file is auto-generated from keymaps.csv on 2017-05-31 16:20
3
- * Database checksum sha256(92fd165507f2a3b8c5b3fa56e425d45788dbcb98cf067a307527d91ce22cab94)
2
+ * This file is auto-generated from keymaps.csv
3
+ * Database checksum sha256(76d68c10e97d37fe2ea459e210125ae41796253fb217e900bf2983ade13a7920)
4
* To re-generate, run:
5
- * keymap-gen --lang=js code-map keymaps.csv html atset1
5
+ * keymap-gen code-map --lang=js keymaps.csv html atset1
6
*/
7
export default {
8
"Again": 0xe005, /* html:Again (Again) -> linux:129 (KEY_AGAIN) -> atset1:57349 */
@@ -111,6 +111,8 @@ export default {
111
"KeyX": 0x2d, /* html:KeyX (KeyX) -> linux:45 (KEY_X) -> atset1:45 */
112
"KeyY": 0x15, /* html:KeyY (KeyY) -> linux:21 (KEY_Y) -> atset1:21 */
113
"KeyZ": 0x2c, /* html:KeyZ (KeyZ) -> linux:44 (KEY_Z) -> atset1:44 */
114
+ "Lang1": 0x72, /* html:Lang1 (Lang1) -> linux:122 (KEY_HANGEUL) -> atset1:114 */
115
+ "Lang2": 0x71, /* html:Lang2 (Lang2) -> linux:123 (KEY_HANJA) -> atset1:113 */
116
"Lang3": 0x78, /* html:Lang3 (Lang3) -> linux:90 (KEY_KATAKANA) -> atset1:120 */
117
"Lang4": 0x77, /* html:Lang4 (Lang4) -> linux:91 (KEY_HIRAGANA) -> atset1:119 */
118
"Lang5": 0x76, /* html:Lang5 (Lang5) -> linux:85 (KEY_ZENKAKUHANKAKU) -> atset1:118 */
public/novnc/core/rfb.js
+1316
-383
@@ -1,26 +1,30 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2020 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
7
*
8
*/
9
10
+import { toUnsigned32bit, toSigned32bit } from './util/int.js';
11
import * as Log from './util/logging.js';
11
-import { decodeUTF8 } from './util/strings.js';
12
+import { encodeUTF8, decodeUTF8 } from './util/strings.js';
13
import { dragThreshold } from './util/browser.js';
14
+import { clientToElement } from './util/element.js';
15
+import { setCapture } from './util/events.js';
16
import EventTargetMixin from './util/eventtarget.js';
17
import Display from "./display.js";
18
+import Inflator from "./inflator.js";
19
+import Deflator from "./deflator.js";
20
import Keyboard from "./input/keyboard.js";
16
-import Mouse from "./input/mouse.js";
21
+import GestureHandler from "./input/gesturehandler.js";
22
import Cursor from "./util/cursor.js";
23
import Websock from "./websock.js";
24
import DES from "./des.js";
25
import KeyTable from "./input/keysym.js";
26
import XtScancode from "./input/xtscancodes.js";
27
import { encodings } from "./encodings.js";
23
-import "./util/polyfill.js";
28
29
import RawDecoder from "./decoders/raw.js";
30
import CopyRectDecoder from "./decoders/copyrect.js";
@@ -33,43 +37,79 @@ import TightPNGDecoder from "./decoders/tightpng.js";
37
const DISCONNECT_TIMEOUT = 3;
38
const DEFAULT_BACKGROUND = 'rgb(40, 40, 40)';
39
40
+// Minimum wait (ms) between two mouse moves
41
+const MOUSE_MOVE_DELAY = 17;
42
+
43
+// Wheel thresholds
44
+const WHEEL_STEP = 50; // Pixels needed for one step
45
+const WHEEL_LINE_HEIGHT = 19; // Assumed pixels for one line step
46
+
47
+// Gesture thresholds
48
+const GESTURE_ZOOMSENS = 75;
49
+const GESTURE_SCRLSENS = 50;
50
+const DOUBLE_TAP_TIMEOUT = 1000;
51
+const DOUBLE_TAP_THRESHOLD = 50;
52
+
53
+// Extended clipboard pseudo-encoding formats
54
+const extendedClipboardFormatText = 1;
55
+/*eslint-disable no-unused-vars */
56
+const extendedClipboardFormatRtf = 1 << 1;
57
+const extendedClipboardFormatHtml = 1 << 2;
58
+const extendedClipboardFormatDib = 1 << 3;
59
+const extendedClipboardFormatFiles = 1 << 4;
60
+/*eslint-enable */
61
+
62
+// Extended clipboard pseudo-encoding actions
63
+const extendedClipboardActionCaps = 1 << 24;
64
+const extendedClipboardActionRequest = 1 << 25;
65
+const extendedClipboardActionPeek = 1 << 26;
66
+const extendedClipboardActionNotify = 1 << 27;
67
+const extendedClipboardActionProvide = 1 << 28;
68
+
69
export default class RFB extends EventTargetMixin {
37
- constructor(target, url, options) {
70
+ constructor(target, urlOrChannel, options) {
71
if (!target) {
72
throw new Error("Must specify target");
73
}
41
- if (!url) {
42
- throw new Error("Must specify URL");
74
+ if (!urlOrChannel) {
75
+ throw new Error("Must specify URL, WebSocket or RTCDataChannel");
76
}
77
78
super();
79
80
this._target = target;
48
- this._url = url;
81
+
82
+ if (typeof urlOrChannel === "string") {
83
+ this._url = urlOrChannel;
84
+ } else {
85
+ this._url = null;
86
+ this._rawChannel = urlOrChannel;
87
+ }
88
89
// Connection details
90
options = options || {};
52
- this._rfb_credentials = options.credentials || {};
91
+ this._rfbCredentials = options.credentials || {};
92
this._shared = 'shared' in options ? !!options.shared : true;
93
this._repeaterID = options.repeaterID || '';
55
- this._showDotCursor = options.showDotCursor || false;
94
+ this._wsProtocols = options.wsProtocols || [];
95
96
// Internal state
58
- this._rfb_connection_state = '';
59
- this._rfb_init_state = '';
60
- this._rfb_auth_scheme = -1;
61
- this._rfb_clean_disconnect = true;
97
+ this._rfbConnectionState = '';
98
+ this._rfbInitState = '';
99
+ this._rfbAuthScheme = -1;
100
+ this._rfbCleanDisconnect = true;
101
102
// Server capabilities
64
- this._rfb_version = 0;
65
- this._rfb_max_version = 3.8;
66
- this._rfb_tightvnc = false;
67
- this._rfb_xvp_ver = 0;
103
+ this._rfbVersion = 0;
104
+ this._rfbMaxVersion = 3.8;
105
+ this._rfbTightVNC = false;
106
+ this._rfbVeNCryptState = 0;
107
+ this._rfbXvpVer = 0;
108
69
- this._fb_width = 0;
70
- this._fb_height = 0;
109
+ this._fbWidth = 0;
110
+ this._fbHeight = 0;
111
72
- this._fb_name = "";
112
+ this._fbName = "";
113
114
this._capabilities = { power: false };
115
@@ -79,21 +119,27 @@ export default class RFB extends EventTargetMixin {
119
this._enabledContinuousUpdates = false;
120
121
this._supportsSetDesktopSize = false;
82
- this._screen_id = 0;
83
- this._screen_flags = 0;
122
+ this._screenID = 0;
123
+ this._screenFlags = 0;
124
125
this._qemuExtKeyEventSupported = false;
126
127
+ this._clipboardText = null;
128
+ this._clipboardServerCapabilitiesActions = {};
129
+ this._clipboardServerCapabilitiesFormats = {};
130
+
131
// Internal objects
132
this._sock = null; // Websock object
133
this._display = null; // Display object
134
this._flushing = false; // Display flushing state
135
this._keyboard = null; // Keyboard input handler object
92
- this._mouse = null; // Mouse input handler object
136
+ this._gestures = null; // Gesture input handler object
137
+ this._resizeObserver = null; // Resize observer object
138
139
// Timers
140
this._disconnTimer = null; // disconnection timer
141
this._resizeTimeout = null; // resize rate limiting
142
+ this._mouseMoveTimer = null;
143
144
// Decoder states
145
this._decoders = {};
@@ -108,16 +154,28 @@ export default class RFB extends EventTargetMixin {
154
};
155
156
// Mouse state
111
- this._mouse_buttonMask = 0;
112
- this._mouse_arr = [];
157
+ this._mousePos = {};
158
+ this._mouseButtonMask = 0;
159
+ this._mouseLastMoveTime = 0;
160
this._viewportDragging = false;
161
this._viewportDragPos = {};
162
this._viewportHasMoved = false;
163
+ this._accumulatedWheelDeltaX = 0;
164
+ this._accumulatedWheelDeltaY = 0;
165
+
166
+ // Gesture state
167
+ this._gestureLastTapTime = null;
168
+ this._gestureFirstDoubleTapEv = null;
169
+ this._gestureLastMagnitudeX = 0;
170
+ this._gestureLastMagnitudeY = 0;
171
172
// Bound event handlers
173
this._eventHandlers = {
174
focusCanvas: this._focusCanvas.bind(this),
120
- windowResize: this._windowResize.bind(this),
175
+ handleResize: this._handleResize.bind(this),
176
+ handleMouse: this._handleMouse.bind(this),
177
+ handleWheel: this._handleWheel.bind(this),
178
+ handleGesture: this._handleGesture.bind(this),
179
};
180
181
// main setup
@@ -134,8 +192,6 @@ export default class RFB extends EventTargetMixin {
192
this._canvas.style.margin = 'auto';
193
// Some browsers add an outline on focus
194
this._canvas.style.outline = 'none';
137
- // IE miscalculates width without this :(
138
- this._canvas.style.flexShrink = '0';
195
this._canvas.width = 0;
196
this._canvas.height = 0;
197
this._canvas.tabIndex = -1;
@@ -172,68 +228,22 @@ export default class RFB extends EventTargetMixin {
228
throw exc;
229
}
230
this._display.onflush = this._onFlush.bind(this);
175
- this._display.clear();
231
232
this._keyboard = new Keyboard(this._canvas);
233
this._keyboard.onkeyevent = this._handleKeyEvent.bind(this);
234
180
- this._mouse = new Mouse(this._canvas);
181
- this._mouse.onmousebutton = this._handleMouseButton.bind(this);
182
- this._mouse.onmousemove = this._handleMouseMove.bind(this);
235
+ this._gestures = new GestureHandler();
236
237
this._sock = new Websock();
185
- this._sock.on('message', () => {
186
- this._handle_message();
187
- });
188
- this._sock.on('open', () => {
189
- if ((this._rfb_connection_state === 'connecting') &&
190
- (this._rfb_init_state === '')) {
191
- this._rfb_init_state = 'ProtocolVersion';
192
- Log.Debug("Starting VNC handshake");
193
- } else {
194
- this._fail("Unexpected server connection while " +
195
- this._rfb_connection_state);
196
- }
197
- });
198
- this._sock.on('close', (e) => {
199
- Log.Debug("WebSocket on-close event");
200
- let msg = "";
201
- if (e.code) {
202
- msg = "(code: " + e.code;
203
- if (e.reason) {
204
- msg += ", reason: " + e.reason;
205
- }
206
- msg += ")";
207
- }
208
- switch (this._rfb_connection_state) {
209
- case 'connecting':
210
- this._fail("Connection closed " + msg);
211
- break;
212
- case 'connected':
213
- // Handle disconnects that were initiated server-side
214
- this._updateConnectionState('disconnecting');
215
- this._updateConnectionState('disconnected');
216
- break;
217
- case 'disconnecting':
218
- // Normal disconnection path
219
- this._updateConnectionState('disconnected');
220
- break;
221
- case 'disconnected':
222
- this._fail("Unexpected server disconnect " +
223
- "when already disconnected " + msg);
224
- break;
225
- default:
226
- this._fail("Unexpected server disconnect before connecting " +
227
- msg);
228
- break;
229
- }
230
- this._sock.off('close');
231
- });
232
- this._sock.on('error', e => Log.Warn("WebSocket on-error event"));
238
+ this._sock.on('open', this._socketOpen.bind(this));
239
+ this._sock.on('close', this._socketClose.bind(this));
240
+ this._sock.on('message', this._handleMessage.bind(this));
241
+ this._sock.on('error', this._socketError.bind(this));
242
234
- // Slight delay of the actual connection so that the caller has
235
- // time to set up callbacks
236
- setTimeout(this._updateConnectionState.bind(this, 'connecting'));
243
+ this._resizeObserver = new ResizeObserver(this._eventHandlers.handleResize);
244
+
245
+ // All prepared, kick off the connection
246
+ this._updateConnectionState('connecting');
247
248
Log.Debug("<< RFB.constructor");
249
@@ -246,6 +256,15 @@ export default class RFB extends EventTargetMixin {
256
this._clipViewport = false;
257
this._scaleViewport = false;
258
this._resizeSession = false;
259
+
260
+ this._showDotCursor = false;
261
+ if (options.showDotCursor !== undefined) {
262
+ Log.Warn("Specifying showDotCursor as a RFB constructor argument is deprecated");
263
+ this._showDotCursor = options.showDotCursor;
264
+ }
265
+
266
+ this._qualityLevel = 6;
267
+ this._compressionLevel = 2;
268
}
269
270
// ===== PROPERTIES =====
@@ -254,22 +273,20 @@ export default class RFB extends EventTargetMixin {
273
set viewOnly(viewOnly) {
274
this._viewOnly = viewOnly;
275
257
- if (this._rfb_connection_state === "connecting" ||
258
- this._rfb_connection_state === "connected") {
276
+ if (this._rfbConnectionState === "connecting" ||
277
+ this._rfbConnectionState === "connected") {
278
if (viewOnly) {
279
this._keyboard.ungrab();
261
- this._mouse.ungrab();
280
} else {
281
this._keyboard.grab();
264
- this._mouse.grab();
282
}
283
}
284
}
285
286
get capabilities() { return this._capabilities; }
287
271
- get touchButton() { return this._mouse.touchButton; }
272
- set touchButton(button) { this._mouse.touchButton = button; }
288
+ get touchButton() { return 0; }
289
+ set touchButton(button) { Log.Warn("Using old API!"); }
290
291
get clipViewport() { return this._clipViewport; }
292
set clipViewport(viewport) {
@@ -308,6 +325,46 @@ export default class RFB extends EventTargetMixin {
325
get background() { return this._screen.style.background; }
326
set background(cssValue) { this._screen.style.background = cssValue; }
327
328
+ get qualityLevel() {
329
+ return this._qualityLevel;
330
+ }
331
+ set qualityLevel(qualityLevel) {
332
+ if (!Number.isInteger(qualityLevel) || qualityLevel < 0 || qualityLevel > 9) {
333
+ Log.Error("qualityLevel must be an integer between 0 and 9");
334
+ return;
335
+ }
336
+
337
+ if (this._qualityLevel === qualityLevel) {
338
+ return;
339
+ }
340
+
341
+ this._qualityLevel = qualityLevel;
342
+
343
+ if (this._rfbConnectionState === 'connected') {
344
+ this._sendEncodings();
345
+ }
346
+ }
347
+
348
+ get compressionLevel() {
349
+ return this._compressionLevel;
350
+ }
351
+ set compressionLevel(compressionLevel) {
352
+ if (!Number.isInteger(compressionLevel) || compressionLevel < 0 || compressionLevel > 9) {
353
+ Log.Error("compressionLevel must be an integer between 0 and 9");
354
+ return;
355
+ }
356
+
357
+ if (this._compressionLevel === compressionLevel) {
358
+ return;
359
+ }
360
+
361
+ this._compressionLevel = compressionLevel;
362
+
363
+ if (this._rfbConnectionState === 'connected') {
364
+ this._sendEncodings();
365
+ }
366
+ }
367
+
368
// ===== PUBLIC METHODS =====
369
370
disconnect() {
@@ -318,12 +375,12 @@ export default class RFB extends EventTargetMixin {
375
}
376
377
sendCredentials(creds) {
321
- this._rfb_credentials = creds;
322
- setTimeout(this._init_msg.bind(this), 0);
378
+ this._rfbCredentials = creds;
379
+ setTimeout(this._initMsg.bind(this), 0);
380
}
381
382
sendCtrlAltDel() {
326
- if (this._rfb_connection_state !== 'connected' || this._viewOnly) { return; }
383
+ if (this._rfbConnectionState !== 'connected' || this._viewOnly) { return; }
384
Log.Info("Sending Ctrl-Alt-Del");
385
386
this.sendKey(KeyTable.XK_Control_L, "ControlLeft", true);
@@ -349,7 +406,7 @@ export default class RFB extends EventTargetMixin {
406
// Send a key press. If 'down' is not specified then send a down key
407
// followed by an up key.
408
sendKey(keysym, code, down) {
352
- if (this._rfb_connection_state !== 'connected' || this._viewOnly) { return; }
409
+ if (this._rfbConnectionState !== 'connected' || this._viewOnly) { return; }
410
411
if (down === undefined) {
412
this.sendKey(keysym, code, true);
@@ -384,8 +441,22 @@ export default class RFB extends EventTargetMixin {
441
}
442
443
clipboardPasteFrom(text) {
387
- if (this._rfb_connection_state !== 'connected' || this._viewOnly) { return; }
388
- RFB.messages.clientCutText(this._sock, text);
444
+ if (this._rfbConnectionState !== 'connected' || this._viewOnly) { return; }
445
+
446
+ if (this._clipboardServerCapabilitiesFormats[extendedClipboardFormatText] &&
447
+ this._clipboardServerCapabilitiesActions[extendedClipboardActionNotify]) {
448
+
449
+ this._clipboardText = text;
450
+ RFB.messages.extendedClipboardNotify(this._sock, [extendedClipboardFormatText]);
451
+ } else {
452
+ let data = new Uint8Array(text.length);
453
+ for (let i = 0; i < text.length; i++) {
454
+ // FIXME: text can have values outside of Latin1/Uint8
455
+ data[i] = text.charCodeAt(i);
456
+ }
457
+
458
+ RFB.messages.clientCutText(this._sock, data);
459
+ }
460
}
461
462
// ===== PRIVATE METHODS =====
@@ -393,44 +464,78 @@ export default class RFB extends EventTargetMixin {
464
_connect() {
465
Log.Debug(">> RFB.connect");
466
396
- Log.Info("connecting to " + this._url);
467
+ if (this._url) {
468
+ Log.Info(`connecting to ${this._url}`);
469
+ this._sock.open(this._url, this._wsProtocols);
470
+ } else {
471
+ Log.Info(`attaching ${this._rawChannel} to Websock`);
472
+ this._sock.attach(this._rawChannel);
473
398
- try {
399
- // WebSocket.onopen transitions to the RFB init states
400
- this._sock.open(this._url + '&p=12', ['binary']);
401
- } catch (e) {
402
- if (e.name === 'SyntaxError') {
403
- this._fail("Invalid host or port (" + e + ")");
404
- } else {
405
- this._fail("Error when opening socket (" + e + ")");
474
+ if (this._sock.readyState === 'closed') {
475
+ throw Error("Cannot use already closed WebSocket/RTCDataChannel");
476
+ }
477
+
478
+ if (this._sock.readyState === 'open') {
479
+ // FIXME: _socketOpen() can in theory call _fail(), which
480
+ // isn't allowed this early, but I'm not sure that can
481
+ // happen without a bug messing up our state variables
482
+ this._socketOpen();
483
}
484
}
485
486
// Make our elements part of the page
487
this._target.appendChild(this._screen);
488
489
+ this._gestures.attach(this._canvas);
490
+
491
this._cursor.attach(this._canvas);
492
this._refreshCursor();
493
415
- // Monitor size changes of the screen
416
- // FIXME: Use ResizeObserver, or hidden overflow
417
- window.addEventListener('resize', this._eventHandlers.windowResize);
494
+ // Monitor size changes of the screen element
495
+ this._resizeObserver.observe(this._screen);
496
497
// Always grab focus on some kind of click event
498
this._canvas.addEventListener("mousedown", this._eventHandlers.focusCanvas);
499
this._canvas.addEventListener("touchstart", this._eventHandlers.focusCanvas);
500
501
+ // Mouse events
502
+ this._canvas.addEventListener('mousedown', this._eventHandlers.handleMouse);
503
+ this._canvas.addEventListener('mouseup', this._eventHandlers.handleMouse);
504
+ this._canvas.addEventListener('mousemove', this._eventHandlers.handleMouse);
505
+ // Prevent middle-click pasting (see handler for why we bind to document)
506
+ this._canvas.addEventListener('click', this._eventHandlers.handleMouse);
507
+ // preventDefault() on mousedown doesn't stop this event for some
508
+ // reason so we have to explicitly block it
509
+ this._canvas.addEventListener('contextmenu', this._eventHandlers.handleMouse);
510
+
511
+ // Wheel events
512
+ this._canvas.addEventListener("wheel", this._eventHandlers.handleWheel);
513
+
514
+ // Gesture events
515
+ this._canvas.addEventListener("gesturestart", this._eventHandlers.handleGesture);
516
+ this._canvas.addEventListener("gesturemove", this._eventHandlers.handleGesture);
517
+ this._canvas.addEventListener("gestureend", this._eventHandlers.handleGesture);
518
+
519
Log.Debug("<< RFB.connect");
520
}
521
522
_disconnect() {
523
Log.Debug(">> RFB.disconnect");
524
this._cursor.detach();
525
+ this._canvas.removeEventListener("gesturestart", this._eventHandlers.handleGesture);
526
+ this._canvas.removeEventListener("gesturemove", this._eventHandlers.handleGesture);
527
+ this._canvas.removeEventListener("gestureend", this._eventHandlers.handleGesture);
528
+ this._canvas.removeEventListener("wheel", this._eventHandlers.handleWheel);
529
+ this._canvas.removeEventListener('mousedown', this._eventHandlers.handleMouse);
530
+ this._canvas.removeEventListener('mouseup', this._eventHandlers.handleMouse);
531
+ this._canvas.removeEventListener('mousemove', this._eventHandlers.handleMouse);
532
+ this._canvas.removeEventListener('click', this._eventHandlers.handleMouse);
533
+ this._canvas.removeEventListener('contextmenu', this._eventHandlers.handleMouse);
534
this._canvas.removeEventListener("mousedown", this._eventHandlers.focusCanvas);
535
this._canvas.removeEventListener("touchstart", this._eventHandlers.focusCanvas);
431
- window.removeEventListener('resize', this._eventHandlers.windowResize);
536
+ this._resizeObserver.disconnect();
537
this._keyboard.ungrab();
433
- this._mouse.ungrab();
538
+ this._gestures.detach();
539
this._sock.close();
540
try {
541
this._target.removeChild(this._screen);
@@ -443,15 +548,63 @@ export default class RFB extends EventTargetMixin {
548
}
549
}
550
clearTimeout(this._resizeTimeout);
551
+ clearTimeout(this._mouseMoveTimer);
552
Log.Debug("<< RFB.disconnect");
553
}
554
449
- _focusCanvas(event) {
450
- // Respect earlier handlers' request to not do side-effects
451
- if (event.defaultPrevented) {
452
- return;
555
+ _socketOpen() {
556
+ if ((this._rfbConnectionState === 'connecting') &&
557
+ (this._rfbInitState === '')) {
558
+ this._rfbInitState = 'ProtocolVersion';
559
+ Log.Debug("Starting VNC handshake");
560
+ } else {
561
+ this._fail("Unexpected server connection while " +
562
+ this._rfbConnectionState);
563
+ }
564
+ }
565
+
566
+ _socketClose(e) {
567
+ Log.Debug("WebSocket on-close event");
568
+ let msg = "";
569
+ if (e.code) {
570
+ msg = "(code: " + e.code;
571
+ if (e.reason) {
572
+ msg += ", reason: " + e.reason;
573
+ }
574
+ msg += ")";
575
+ }
576
+ switch (this._rfbConnectionState) {
577
+ case 'connecting':
578
+ this._fail("Connection closed " + msg);
579
+ break;
580
+ case 'connected':
581
+ // Handle disconnects that were initiated server-side
582
+ this._updateConnectionState('disconnecting');
583
+ this._updateConnectionState('disconnected');
584
+ break;
585
+ case 'disconnecting':
586
+ // Normal disconnection path
587
+ this._updateConnectionState('disconnected');
588
+ break;
589
+ case 'disconnected':
590
+ this._fail("Unexpected server disconnect " +
591
+ "when already disconnected " + msg);
592
+ break;
593
+ default:
594
+ this._fail("Unexpected server disconnect before connecting " +
595
+ msg);
596
+ break;
597
}
598
+ this._sock.off('close');
599
+ // Delete reference to raw channel to allow cleanup.
600
+ this._rawChannel = null;
601
+ }
602
+
603
+ _socketError(e) {
604
+ Log.Warn("WebSocket on-error event");
605
+ }
606
607
+ _focusCanvas(event) {
608
if (!this.focusOnClick) {
609
return;
610
}
@@ -459,7 +612,14 @@ export default class RFB extends EventTargetMixin {
612
this.focus();
613
}
614
462
- _windowResize(event) {
615
+ _setDesktopName(name) {
616
+ this._fbName = name;
617
+ this.dispatchEvent(new CustomEvent(
618
+ "desktopname",
619
+ { detail: { name: this._fbName } }));
620
+ }
621
+
622
+ _handleResize() {
623
// If the window resized then our screen element might have
624
// as well. Update the viewport dimensions.
625
window.requestAnimationFrame(() => {
@@ -481,19 +641,19 @@ export default class RFB extends EventTargetMixin {
641
// Update state of clipping in Display object, and make sure the
642
// configured viewport matches the current screen size
643
_updateClip() {
484
- const cur_clip = this._display.clipViewport;
485
- let new_clip = this._clipViewport;
644
+ const curClip = this._display.clipViewport;
645
+ let newClip = this._clipViewport;
646
647
if (this._scaleViewport) {
648
// Disable viewport clipping if we are scaling
489
- new_clip = false;
649
+ newClip = false;
650
}
651
492
- if (cur_clip !== new_clip) {
493
- this._display.clipViewport = new_clip;
652
+ if (curClip !== newClip) {
653
+ this._display.clipViewport = newClip;
654
}
655
496
- if (new_clip) {
656
+ if (newClip) {
657
// When clipping is enabled, the screen is limited to
658
// the size of the container.
659
const size = this._screenSize();
@@ -526,7 +686,7 @@ export default class RFB extends EventTargetMixin {
686
const size = this._screenSize();
687
RFB.messages.setDesktopSize(this._sock,
688
Math.floor(size.w), Math.floor(size.h),
529
- this._screen_id, this._screen_flags);
689
+ this._screenID, this._screenFlags);
690
691
Log.Debug('Requested new desktop size: ' +
692
size.w + 'x' + size.h);
@@ -558,7 +718,7 @@ export default class RFB extends EventTargetMixin {
718
* disconnected - permanent state
719
*/
720
_updateConnectionState(state) {
561
- const oldstate = this._rfb_connection_state;
721
+ const oldstate = this._rfbConnectionState;
722
723
if (state === oldstate) {
724
Log.Debug("Already in state '" + state + "', ignoring");
@@ -612,7 +772,7 @@ export default class RFB extends EventTargetMixin {
772
773
// State change actions
774
615
- this._rfb_connection_state = state;
775
+ this._rfbConnectionState = state;
776
777
Log.Debug("New state '" + state + "', was '" + oldstate + "'.");
778
@@ -646,7 +806,7 @@ export default class RFB extends EventTargetMixin {
806
case 'disconnected':
807
this.dispatchEvent(new CustomEvent(
808
"disconnect", { detail:
649
- { clean: this._rfb_clean_disconnect } }));
809
+ { clean: this._rfbCleanDisconnect } }));
810
break;
811
}
812
}
@@ -657,7 +817,7 @@ export default class RFB extends EventTargetMixin {
817
* should be logged but not sent to the user interface.
818
*/
819
_fail(details) {
660
- switch (this._rfb_connection_state) {
820
+ switch (this._rfbConnectionState) {
821
case 'disconnecting':
822
Log.Error("Failed when disconnecting: " + details);
823
break;
@@ -671,7 +831,7 @@ export default class RFB extends EventTargetMixin {
831
Log.Error("RFB failure: " + details);
832
break;
833
}
674
- this._rfb_clean_disconnect = false; //This is sent to the UI
834
+ this._rfbCleanDisconnect = false; //This is sent to the UI
835
836
// Transition to disconnected without waiting for socket to close
837
this._updateConnectionState('disconnecting');
@@ -686,13 +846,13 @@ export default class RFB extends EventTargetMixin {
846
{ detail: { capabilities: this._capabilities } }));
847
}
848
689
- _handle_message() {
849
+ _handleMessage() {
850
if (this._sock.rQlen === 0) {
691
- Log.Warn("handle_message called on an empty receive queue");
851
+ Log.Warn("handleMessage called on an empty receive queue");
852
return;
853
}
854
695
- switch (this._rfb_connection_state) {
855
+ switch (this._rfbConnectionState) {
856
case 'disconnected':
857
Log.Error("Got data while disconnected");
858
break;
@@ -701,7 +861,7 @@ export default class RFB extends EventTargetMixin {
861
if (this._flushing) {
862
break;
863
}
704
- if (!this._normal_msg()) {
864
+ if (!this._normalMsg()) {
865
break;
866
}
867
if (this._sock.rQlen === 0) {
@@ -710,7 +870,7 @@ export default class RFB extends EventTargetMixin {
870
}
871
break;
872
default:
713
- this._init_msg();
873
+ this._initMsg();
874
break;
875
}
876
}
@@ -719,13 +879,52 @@ export default class RFB extends EventTargetMixin {
879
this.sendKey(keysym, code, down);
880
}
881
722
- _handleMouseButton(x, y, down, bmask) {
723
- if (down) {
724
- this._mouse_buttonMask |= bmask;
725
- } else {
726
- this._mouse_buttonMask &= ~bmask;
882
+ _handleMouse(ev) {
883
+ /*
884
+ * We don't check connection status or viewOnly here as the
885
+ * mouse events might be used to control the viewport
886
+ */
887
+
888
+ if (ev.type === 'click') {
889
+ /*
890
+ * Note: This is only needed for the 'click' event as it fails
891
+ * to fire properly for the target element so we have
892
+ * to listen on the document element instead.
893
+ */
894
+ if (ev.target !== this._canvas) {
895
+ return;
896
+ }
897
+ }
898
+
899
+ // FIXME: if we're in view-only and not dragging,
900
+ // should we stop events?
901
+ ev.stopPropagation();
902
+ ev.preventDefault();
903
+
904
+ if ((ev.type === 'click') || (ev.type === 'contextmenu')) {
905
+ return;
906
+ }
907
+
908
+ let pos = clientToElement(ev.clientX, ev.clientY,
909
+ this._canvas);
910
+
911
+ switch (ev.type) {
912
+ case 'mousedown':
913
+ setCapture(this._canvas);
914
+ this._handleMouseButton(pos.x, pos.y,
915
+ true, 1 << ev.button);
916
+ break;
917
+ case 'mouseup':
918
+ this._handleMouseButton(pos.x, pos.y,
919
+ false, 1 << ev.button);
920
+ break;
921
+ case 'mousemove':
922
+ this._handleMouseMove(pos.x, pos.y);
923
+ break;
924
}
925
+ }
926
927
+ _handleMouseButton(x, y, down, bmask) {
928
if (this.dragViewport) {
929
if (down && !this._viewportDragging) {
930
this._viewportDragging = true;
@@ -746,17 +945,24 @@ export default class RFB extends EventTargetMixin {
945
// Otherwise we treat this as a mouse click event.
946
// Send the button down event here, as the button up
947
// event is sent at the end of this function.
749
- RFB.messages.pointerEvent(this._sock,
750
- this._display.absX(x),
751
- this._display.absY(y),
752
- bmask);
948
+ this._sendMouse(x, y, bmask);
949
}
950
}
951
756
- if (this._viewOnly) { return; } // View only, skip mouse events
952
+ // Flush waiting move event first
953
+ if (this._mouseMoveTimer !== null) {
954
+ clearTimeout(this._mouseMoveTimer);
955
+ this._mouseMoveTimer = null;
956
+ this._sendMouse(x, y, this._mouseButtonMask);
957
+ }
958
758
- if (this._rfb_connection_state !== 'connected') { return; }
759
- RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), this._mouse_buttonMask);
959
+ if (down) {
960
+ this._mouseButtonMask |= bmask;
961
+ } else {
962
+ this._mouseButtonMask &= ~bmask;
963
+ }
964
+
965
+ this._sendMouse(x, y, this._mouseButtonMask);
966
}
967
968
_handleMouseMove(x, y) {
@@ -776,126 +982,355 @@ export default class RFB extends EventTargetMixin {
982
return;
983
}
984
985
+ this._mousePos = { 'x': x, 'y': y };
986
+
987
+ // Limit many mouse move events to one every MOUSE_MOVE_DELAY ms
988
+ if (this._mouseMoveTimer == null) {
989
+
990
+ const timeSinceLastMove = Date.now() - this._mouseLastMoveTime;
991
+ if (timeSinceLastMove > MOUSE_MOVE_DELAY) {
992
+ this._sendMouse(x, y, this._mouseButtonMask);
993
+ this._mouseLastMoveTime = Date.now();
994
+ } else {
995
+ // Too soon since the latest move, wait the remaining time
996
+ this._mouseMoveTimer = setTimeout(() => {
997
+ this._handleDelayedMouseMove();
998
+ }, MOUSE_MOVE_DELAY - timeSinceLastMove);
999
+ }
1000
+ }
1001
+ }
1002
+
1003
+ _handleDelayedMouseMove() {
1004
+ this._mouseMoveTimer = null;
1005
+ this._sendMouse(this._mousePos.x, this._mousePos.y,
1006
+ this._mouseButtonMask);
1007
+ this._mouseLastMoveTime = Date.now();
1008
+ }
1009
+
1010
+ _sendMouse(x, y, mask) {
1011
+ if (this._rfbConnectionState !== 'connected') { return; }
1012
+ if (this._viewOnly) { return; } // View only, skip mouse events
1013
+
1014
+ RFB.messages.pointerEvent(this._sock, this._display.absX(x),
1015
+ this._display.absY(y), mask);
1016
+ }
1017
+
1018
+ _handleWheel(ev) {
1019
+ if (this._rfbConnectionState !== 'connected') { return; }
1020
if (this._viewOnly) { return; } // View only, skip mouse events
1021
781
- if (this._rfb_connection_state !== 'connected') { return; }
782
- RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), this._mouse_buttonMask);
1022
+ ev.stopPropagation();
1023
+ ev.preventDefault();
1024
+
1025
+ let pos = clientToElement(ev.clientX, ev.clientY,
1026
+ this._canvas);
1027
+
1028
+ let dX = ev.deltaX;
1029
+ let dY = ev.deltaY;
1030
+
1031
+ // Pixel units unless it's non-zero.
1032
+ // Note that if deltamode is line or page won't matter since we aren't
1033
+ // sending the mouse wheel delta to the server anyway.
1034
+ // The difference between pixel and line can be important however since
1035
+ // we have a threshold that can be smaller than the line height.
1036
+ if (ev.deltaMode !== 0) {
1037
+ dX *= WHEEL_LINE_HEIGHT;
1038
+ dY *= WHEEL_LINE_HEIGHT;
1039
+ }
1040
+
1041
+ // Mouse wheel events are sent in steps over VNC. This means that the VNC
1042
+ // protocol can't handle a wheel event with specific distance or speed.
1043
+ // Therefor, if we get a lot of small mouse wheel events we combine them.
1044
+ this._accumulatedWheelDeltaX += dX;
1045
+ this._accumulatedWheelDeltaY += dY;
1046
+
1047
+ // Generate a mouse wheel step event when the accumulated delta
1048
+ // for one of the axes is large enough.
1049
+ if (Math.abs(this._accumulatedWheelDeltaX) >= WHEEL_STEP) {
1050
+ if (this._accumulatedWheelDeltaX < 0) {
1051
+ this._handleMouseButton(pos.x, pos.y, true, 1 << 5);
1052
+ this._handleMouseButton(pos.x, pos.y, false, 1 << 5);
1053
+ } else if (this._accumulatedWheelDeltaX > 0) {
1054
+ this._handleMouseButton(pos.x, pos.y, true, 1 << 6);
1055
+ this._handleMouseButton(pos.x, pos.y, false, 1 << 6);
1056
+ }
1057
+
1058
+ this._accumulatedWheelDeltaX = 0;
1059
+ }
1060
+ if (Math.abs(this._accumulatedWheelDeltaY) >= WHEEL_STEP) {
1061
+ if (this._accumulatedWheelDeltaY < 0) {
1062
+ this._handleMouseButton(pos.x, pos.y, true, 1 << 3);
1063
+ this._handleMouseButton(pos.x, pos.y, false, 1 << 3);
1064
+ } else if (this._accumulatedWheelDeltaY > 0) {
1065
+ this._handleMouseButton(pos.x, pos.y, true, 1 << 4);
1066
+ this._handleMouseButton(pos.x, pos.y, false, 1 << 4);
1067
+ }
1068
+
1069
+ this._accumulatedWheelDeltaY = 0;
1070
+ }
1071
+ }
1072
+
1073
+ _fakeMouseMove(ev, elementX, elementY) {
1074
+ this._handleMouseMove(elementX, elementY);
1075
+ this._cursor.move(ev.detail.clientX, ev.detail.clientY);
1076
+ }
1077
+
1078
+ _handleTapEvent(ev, bmask) {
1079
+ let pos = clientToElement(ev.detail.clientX, ev.detail.clientY,
1080
+ this._canvas);
1081
+
1082
+ // If the user quickly taps multiple times we assume they meant to
1083
+ // hit the same spot, so slightly adjust coordinates
1084
+
1085
+ if ((this._gestureLastTapTime !== null) &&
1086
+ ((Date.now() - this._gestureLastTapTime) < DOUBLE_TAP_TIMEOUT) &&
1087
+ (this._gestureFirstDoubleTapEv.detail.type === ev.detail.type)) {
1088
+ let dx = this._gestureFirstDoubleTapEv.detail.clientX - ev.detail.clientX;
1089
+ let dy = this._gestureFirstDoubleTapEv.detail.clientY - ev.detail.clientY;
1090
+ let distance = Math.hypot(dx, dy);
1091
+
1092
+ if (distance < DOUBLE_TAP_THRESHOLD) {
1093
+ pos = clientToElement(this._gestureFirstDoubleTapEv.detail.clientX,
1094
+ this._gestureFirstDoubleTapEv.detail.clientY,
1095
+ this._canvas);
1096
+ } else {
1097
+ this._gestureFirstDoubleTapEv = ev;
1098
+ }
1099
+ } else {
1100
+ this._gestureFirstDoubleTapEv = ev;
1101
+ }
1102
+ this._gestureLastTapTime = Date.now();
1103
+
1104
+ this._fakeMouseMove(this._gestureFirstDoubleTapEv, pos.x, pos.y);
1105
+ this._handleMouseButton(pos.x, pos.y, true, bmask);
1106
+ this._handleMouseButton(pos.x, pos.y, false, bmask);
1107
+ }
1108
+
1109
+ _handleGesture(ev) {
1110
+ let magnitude;
1111
+
1112
+ let pos = clientToElement(ev.detail.clientX, ev.detail.clientY,
1113
+ this._canvas);
1114
+ switch (ev.type) {
1115
+ case 'gesturestart':
1116
+ switch (ev.detail.type) {
1117
+ case 'onetap':
1118
+ this._handleTapEvent(ev, 0x1);
1119
+ break;
1120
+ case 'twotap':
1121
+ this._handleTapEvent(ev, 0x4);
1122
+ break;
1123
+ case 'threetap':
1124
+ this._handleTapEvent(ev, 0x2);
1125
+ break;
1126
+ case 'drag':
1127
+ this._fakeMouseMove(ev, pos.x, pos.y);
1128
+ this._handleMouseButton(pos.x, pos.y, true, 0x1);
1129
+ break;
1130
+ case 'longpress':
1131
+ this._fakeMouseMove(ev, pos.x, pos.y);
1132
+ this._handleMouseButton(pos.x, pos.y, true, 0x4);
1133
+ break;
1134
+
1135
+ case 'twodrag':
1136
+ this._gestureLastMagnitudeX = ev.detail.magnitudeX;
1137
+ this._gestureLastMagnitudeY = ev.detail.magnitudeY;
1138
+ this._fakeMouseMove(ev, pos.x, pos.y);
1139
+ break;
1140
+ case 'pinch':
1141
+ this._gestureLastMagnitudeX = Math.hypot(ev.detail.magnitudeX,
1142
+ ev.detail.magnitudeY);
1143
+ this._fakeMouseMove(ev, pos.x, pos.y);
1144
+ break;
1145
+ }
1146
+ break;
1147
+
1148
+ case 'gesturemove':
1149
+ switch (ev.detail.type) {
1150
+ case 'onetap':
1151
+ case 'twotap':
1152
+ case 'threetap':
1153
+ break;
1154
+ case 'drag':
1155
+ case 'longpress':
1156
+ this._fakeMouseMove(ev, pos.x, pos.y);
1157
+ break;
1158
+ case 'twodrag':
1159
+ // Always scroll in the same position.
1160
+ // We don't know if the mouse was moved so we need to move it
1161
+ // every update.
1162
+ this._fakeMouseMove(ev, pos.x, pos.y);
1163
+ while ((ev.detail.magnitudeY - this._gestureLastMagnitudeY) > GESTURE_SCRLSENS) {
1164
+ this._handleMouseButton(pos.x, pos.y, true, 0x8);
1165
+ this._handleMouseButton(pos.x, pos.y, false, 0x8);
1166
+ this._gestureLastMagnitudeY += GESTURE_SCRLSENS;
1167
+ }
1168
+ while ((ev.detail.magnitudeY - this._gestureLastMagnitudeY) < -GESTURE_SCRLSENS) {
1169
+ this._handleMouseButton(pos.x, pos.y, true, 0x10);
1170
+ this._handleMouseButton(pos.x, pos.y, false, 0x10);
1171
+ this._gestureLastMagnitudeY -= GESTURE_SCRLSENS;
1172
+ }
1173
+ while ((ev.detail.magnitudeX - this._gestureLastMagnitudeX) > GESTURE_SCRLSENS) {
1174
+ this._handleMouseButton(pos.x, pos.y, true, 0x20);
1175
+ this._handleMouseButton(pos.x, pos.y, false, 0x20);
1176
+ this._gestureLastMagnitudeX += GESTURE_SCRLSENS;
1177
+ }
1178
+ while ((ev.detail.magnitudeX - this._gestureLastMagnitudeX) < -GESTURE_SCRLSENS) {
1179
+ this._handleMouseButton(pos.x, pos.y, true, 0x40);
1180
+ this._handleMouseButton(pos.x, pos.y, false, 0x40);
1181
+ this._gestureLastMagnitudeX -= GESTURE_SCRLSENS;
1182
+ }
1183
+ break;
1184
+ case 'pinch':
1185
+ // Always scroll in the same position.
1186
+ // We don't know if the mouse was moved so we need to move it
1187
+ // every update.
1188
+ this._fakeMouseMove(ev, pos.x, pos.y);
1189
+ magnitude = Math.hypot(ev.detail.magnitudeX, ev.detail.magnitudeY);
1190
+ if (Math.abs(magnitude - this._gestureLastMagnitudeX) > GESTURE_ZOOMSENS) {
1191
+ this._handleKeyEvent(KeyTable.XK_Control_L, "ControlLeft", true);
1192
+ while ((magnitude - this._gestureLastMagnitudeX) > GESTURE_ZOOMSENS) {
1193
+ this._handleMouseButton(pos.x, pos.y, true, 0x8);
1194
+ this._handleMouseButton(pos.x, pos.y, false, 0x8);
1195
+ this._gestureLastMagnitudeX += GESTURE_ZOOMSENS;
1196
+ }
1197
+ while ((magnitude - this._gestureLastMagnitudeX) < -GESTURE_ZOOMSENS) {
1198
+ this._handleMouseButton(pos.x, pos.y, true, 0x10);
1199
+ this._handleMouseButton(pos.x, pos.y, false, 0x10);
1200
+ this._gestureLastMagnitudeX -= GESTURE_ZOOMSENS;
1201
+ }
1202
+ }
1203
+ this._handleKeyEvent(KeyTable.XK_Control_L, "ControlLeft", false);
1204
+ break;
1205
+ }
1206
+ break;
1207
+
1208
+ case 'gestureend':
1209
+ switch (ev.detail.type) {
1210
+ case 'onetap':
1211
+ case 'twotap':
1212
+ case 'threetap':
1213
+ case 'pinch':
1214
+ case 'twodrag':
1215
+ break;
1216
+ case 'drag':
1217
+ this._fakeMouseMove(ev, pos.x, pos.y);
1218
+ this._handleMouseButton(pos.x, pos.y, false, 0x1);
1219
+ break;
1220
+ case 'longpress':
1221
+ this._fakeMouseMove(ev, pos.x, pos.y);
1222
+ this._handleMouseButton(pos.x, pos.y, false, 0x4);
1223
+ break;
1224
+ }
1225
+ break;
1226
+ }
1227
}
1228
1229
// Message Handlers
1230
787
- _negotiate_protocol_version() {
1231
+ _negotiateProtocolVersion() {
1232
if (this._sock.rQwait("version", 12)) {
1233
return false;
1234
}
1235
1236
const sversion = this._sock.rQshiftStr(12).substr(4, 7);
1237
Log.Info("Server ProtocolVersion: " + sversion);
794
- let is_repeater = 0;
1238
+ let isRepeater = 0;
1239
switch (sversion) {
1240
case "000.000": // UltraVNC repeater
797
- is_repeater = 1;
1241
+ isRepeater = 1;
1242
break;
1243
case "003.003":
1244
case "003.006": // UltraVNC
1245
case "003.889": // Apple Remote Desktop
802
- this._rfb_version = 3.3;
1246
+ this._rfbVersion = 3.3;
1247
break;
1248
case "003.007":
805
- this._rfb_version = 3.7;
1249
+ this._rfbVersion = 3.7;
1250
break;
1251
case "003.008":
1252
case "004.000": // Intel AMT KVM
1253
case "004.001": // RealVNC 4.6
1254
case "005.000": // RealVNC 5.3
811
- this._rfb_version = 3.8;
1255
+ this._rfbVersion = 3.8;
1256
break;
1257
default:
1258
return this._fail("Invalid server version " + sversion);
1259
}
1260
817
- if (is_repeater) {
1261
+ if (isRepeater) {
1262
let repeaterID = "ID:" + this._repeaterID;
1263
while (repeaterID.length < 250) {
1264
repeaterID += "\0";
1265
}
822
- this._sock.send_string(repeaterID);
1266
+ this._sock.sendString(repeaterID);
1267
return true;
1268
}
1269
826
- if (this._rfb_version > this._rfb_max_version) {
827
- this._rfb_version = this._rfb_max_version;
1270
+ if (this._rfbVersion > this._rfbMaxVersion) {
1271
+ this._rfbVersion = this._rfbMaxVersion;
1272
}
1273
830
- const cversion = "00" + parseInt(this._rfb_version, 10) +
831
- ".00" + ((this._rfb_version * 10) % 10);
832
- this._sock.send_string("RFB " + cversion + "\n");
1274
+ const cversion = "00" + parseInt(this._rfbVersion, 10) +
1275
+ ".00" + ((this._rfbVersion * 10) % 10);
1276
+ this._sock.sendString("RFB " + cversion + "\n");
1277
Log.Debug('Sent ProtocolVersion: ' + cversion);
1278
835
- this._rfb_init_state = 'Security';
1279
+ this._rfbInitState = 'Security';
1280
}
1281
838
- _negotiate_security() {
839
- // Polyfill since IE and PhantomJS doesn't have
840
- // TypedArray.includes()
841
- function includes(item, array) {
842
- for (let i = 0; i < array.length; i++) {
843
- if (array[i] === item) {
844
- return true;
845
- }
846
- }
847
- return false;
848
- }
849
-
850
- if (this._rfb_version >= 3.7) {
1282
+ _negotiateSecurity() {
1283
+ if (this._rfbVersion >= 3.7) {
1284
// Server sends supported list, client decides
852
- const num_types = this._sock.rQshift8();
853
- if (this._sock.rQwait("security type", num_types, 1)) { return false; }
854
-
855
- if (num_types === 0) {
856
- this._rfb_init_state = "SecurityReason";
857
- this._security_context = "no security types";
858
- this._security_status = 1;
859
- return this._init_msg();
1285
+ const numTypes = this._sock.rQshift8();
1286
+ if (this._sock.rQwait("security type", numTypes, 1)) { return false; }
1287
+
1288
+ if (numTypes === 0) {
1289
+ this._rfbInitState = "SecurityReason";
1290
+ this._securityContext = "no security types";
1291
+ this._securityStatus = 1;
1292
+ return this._initMsg();
1293
}
1294
862
- const types = this._sock.rQshiftBytes(num_types);
1295
+ const types = this._sock.rQshiftBytes(numTypes);
1296
Log.Debug("Server security types: " + types);
1297
1298
// Look for each auth in preferred order
866
- if (includes(1, types)) {
867
- this._rfb_auth_scheme = 1; // None
868
- } else if (includes(22, types)) {
869
- this._rfb_auth_scheme = 22; // XVP
870
- } else if (includes(16, types)) {
871
- this._rfb_auth_scheme = 16; // Tight
872
- } else if (includes(2, types)) {
873
- this._rfb_auth_scheme = 2; // VNC Auth
1299
+ if (types.includes(1)) {
1300
+ this._rfbAuthScheme = 1; // None
1301
+ } else if (types.includes(22)) {
1302
+ this._rfbAuthScheme = 22; // XVP
1303
+ } else if (types.includes(16)) {
1304
+ this._rfbAuthScheme = 16; // Tight
1305
+ } else if (types.includes(2)) {
1306
+ this._rfbAuthScheme = 2; // VNC Auth
1307
+ } else if (types.includes(19)) {
1308
+ this._rfbAuthScheme = 19; // VeNCrypt Auth
1309
} else {
1310
return this._fail("Unsupported security types (types: " + types + ")");
1311
}
1312
878
- this._sock.send([this._rfb_auth_scheme]);
1313
+ this._sock.send([this._rfbAuthScheme]);
1314
} else {
1315
// Server decides
1316
if (this._sock.rQwait("security scheme", 4)) { return false; }
882
- this._rfb_auth_scheme = this._sock.rQshift32();
1317
+ this._rfbAuthScheme = this._sock.rQshift32();
1318
884
- if (this._rfb_auth_scheme == 0) {
885
- this._rfb_init_state = "SecurityReason";
886
- this._security_context = "authentication scheme";
887
- this._security_status = 1;
888
- return this._init_msg();
1319
+ if (this._rfbAuthScheme == 0) {
1320
+ this._rfbInitState = "SecurityReason";
1321
+ this._securityContext = "authentication scheme";
1322
+ this._securityStatus = 1;
1323
+ return this._initMsg();
1324
}
1325
}
1326
892
- this._rfb_init_state = 'Authentication';
893
- Log.Debug('Authenticating using scheme: ' + this._rfb_auth_scheme);
1327
+ this._rfbInitState = 'Authentication';
1328
+ Log.Debug('Authenticating using scheme: ' + this._rfbAuthScheme);
1329
895
- return this._init_msg(); // jump to authentication
1330
+ return this._initMsg(); // jump to authentication
1331
}
1332
898
- _handle_security_reason() {
1333
+ _handleSecurityReason() {
1334
if (this._sock.rQwait("reason length", 4)) {
1335
return false;
1336
}
@@ -910,46 +1345,143 @@ export default class RFB extends EventTargetMixin {
1345
if (reason !== "") {
1346
this.dispatchEvent(new CustomEvent(
1347
"securityfailure",
913
- { detail: { status: this._security_status,
1348
+ { detail: { status: this._securityStatus,
1349
reason: reason } }));
1350
1351
return this._fail("Security negotiation failed on " +
917
- this._security_context +
1352
+ this._securityContext +
1353
" (reason: " + reason + ")");
1354
} else {
1355
this.dispatchEvent(new CustomEvent(
1356
"securityfailure",
922
- { detail: { status: this._security_status } }));
1357
+ { detail: { status: this._securityStatus } }));
1358
1359
return this._fail("Security negotiation failed on " +
925
- this._security_context);
1360
+ this._securityContext);
1361
}
1362
}
1363
1364
// authentication
930
- _negotiate_xvp_auth() {
931
- if (!this._rfb_credentials.username ||
932
- !this._rfb_credentials.password ||
933
- !this._rfb_credentials.target) {
1365
+ _negotiateXvpAuth() {
1366
+ if (this._rfbCredentials.username === undefined ||
1367
+ this._rfbCredentials.password === undefined ||
1368
+ this._rfbCredentials.target === undefined) {
1369
this.dispatchEvent(new CustomEvent(
1370
"credentialsrequired",
1371
{ detail: { types: ["username", "password", "target"] } }));
1372
return false;
1373
}
1374
940
- const xvp_auth_str = String.fromCharCode(this._rfb_credentials.username.length) +
941
- String.fromCharCode(this._rfb_credentials.target.length) +
942
- this._rfb_credentials.username +
943
- this._rfb_credentials.target;
944
- this._sock.send_string(xvp_auth_str);
945
- this._rfb_auth_scheme = 2;
946
- return this._negotiate_authentication();
1375
+ const xvpAuthStr = String.fromCharCode(this._rfbCredentials.username.length) +
1376
+ String.fromCharCode(this._rfbCredentials.target.length) +
1377
+ this._rfbCredentials.username +
1378
+ this._rfbCredentials.target;
1379
+ this._sock.sendString(xvpAuthStr);
1380
+ this._rfbAuthScheme = 2;
1381
+ return this._negotiateAuthentication();
1382
+ }
1383
+
1384
+ // VeNCrypt authentication, currently only supports version 0.2 and only Plain subtype
1385
+ _negotiateVeNCryptAuth() {
1386
+
1387
+ // waiting for VeNCrypt version
1388
+ if (this._rfbVeNCryptState == 0) {
1389
+ if (this._sock.rQwait("vencrypt version", 2)) { return false; }
1390
+
1391
+ const major = this._sock.rQshift8();
1392
+ const minor = this._sock.rQshift8();
1393
+
1394
+ if (!(major == 0 && minor == 2)) {
1395
+ return this._fail("Unsupported VeNCrypt version " + major + "." + minor);
1396
+ }
1397
+
1398
+ this._sock.send([0, 2]);
1399
+ this._rfbVeNCryptState = 1;
1400
+ }
1401
+
1402
+ // waiting for ACK
1403
+ if (this._rfbVeNCryptState == 1) {
1404
+ if (this._sock.rQwait("vencrypt ack", 1)) { return false; }
1405
+
1406
+ const res = this._sock.rQshift8();
1407
+
1408
+ if (res != 0) {
1409
+ return this._fail("VeNCrypt failure " + res);
1410
+ }
1411
+
1412
+ this._rfbVeNCryptState = 2;
1413
+ }
1414
+ // must fall through here (i.e. no "else if"), beacause we may have already received
1415
+ // the subtypes length and won't be called again
1416
+
1417
+ if (this._rfbVeNCryptState == 2) { // waiting for subtypes length
1418
+ if (this._sock.rQwait("vencrypt subtypes length", 1)) { return false; }
1419
+
1420
+ const subtypesLength = this._sock.rQshift8();
1421
+ if (subtypesLength < 1) {
1422
+ return this._fail("VeNCrypt subtypes empty");
1423
+ }
1424
+
1425
+ this._rfbVeNCryptSubtypesLength = subtypesLength;
1426
+ this._rfbVeNCryptState = 3;
1427
+ }
1428
+
1429
+ // waiting for subtypes list
1430
+ if (this._rfbVeNCryptState == 3) {
1431
+ if (this._sock.rQwait("vencrypt subtypes", 4 * this._rfbVeNCryptSubtypesLength)) { return false; }
1432
+
1433
+ const subtypes = [];
1434
+ for (let i = 0; i < this._rfbVeNCryptSubtypesLength; i++) {
1435
+ subtypes.push(this._sock.rQshift32());
1436
+ }
1437
+
1438
+ // 256 = Plain subtype
1439
+ if (subtypes.indexOf(256) != -1) {
1440
+ // 0x100 = 256
1441
+ this._sock.send([0, 0, 1, 0]);
1442
+ this._rfbVeNCryptState = 4;
1443
+ } else {
1444
+ return this._fail("VeNCrypt Plain subtype not offered by server");
1445
+ }
1446
+ }
1447
+
1448
+ // negotiated Plain subtype, server waits for password
1449
+ if (this._rfbVeNCryptState == 4) {
1450
+ if (this._rfbCredentials.username === undefined ||
1451
+ this._rfbCredentials.password === undefined) {
1452
+ this.dispatchEvent(new CustomEvent(
1453
+ "credentialsrequired",
1454
+ { detail: { types: ["username", "password"] } }));
1455
+ return false;
1456
+ }
1457
+
1458
+ const user = encodeUTF8(this._rfbCredentials.username);
1459
+ const pass = encodeUTF8(this._rfbCredentials.password);
1460
+
1461
+ this._sock.send([
1462
+ (user.length >> 24) & 0xFF,
1463
+ (user.length >> 16) & 0xFF,
1464
+ (user.length >> 8) & 0xFF,
1465
+ user.length & 0xFF
1466
+ ]);
1467
+ this._sock.send([
1468
+ (pass.length >> 24) & 0xFF,
1469
+ (pass.length >> 16) & 0xFF,
1470
+ (pass.length >> 8) & 0xFF,
1471
+ pass.length & 0xFF
1472
+ ]);
1473
+ this._sock.sendString(user);
1474
+ this._sock.sendString(pass);
1475
+
1476
+ this._rfbInitState = "SecurityResult";
1477
+ return true;
1478
+ }
1479
}
1480
949
- _negotiate_std_vnc_auth() {
1481
+ _negotiateStdVNCAuth() {
1482
if (this._sock.rQwait("auth challenge", 16)) { return false; }
1483
952
- if (!this._rfb_credentials.password) {
1484
+ if (this._rfbCredentials.password === undefined) {
1485
this.dispatchEvent(new CustomEvent(
1486
"credentialsrequired",
1487
{ detail: { types: ["password"] } }));
@@ -958,23 +1490,40 @@ export default class RFB extends EventTargetMixin {
1490
1491
// TODO(directxman12): make genDES not require an Array
1492
const challenge = Array.prototype.slice.call(this._sock.rQshiftBytes(16));
961
- const response = RFB.genDES(this._rfb_credentials.password, challenge);
1493
+ const response = RFB.genDES(this._rfbCredentials.password, challenge);
1494
this._sock.send(response);
963
- this._rfb_init_state = "SecurityResult";
1495
+ this._rfbInitState = "SecurityResult";
1496
+ return true;
1497
+ }
1498
+
1499
+ _negotiateTightUnixAuth() {
1500
+ if (this._rfbCredentials.username === undefined ||
1501
+ this._rfbCredentials.password === undefined) {
1502
+ this.dispatchEvent(new CustomEvent(
1503
+ "credentialsrequired",
1504
+ { detail: { types: ["username", "password"] } }));
1505
+ return false;
1506
+ }
1507
+
1508
+ this._sock.send([0, 0, 0, this._rfbCredentials.username.length]);
1509
+ this._sock.send([0, 0, 0, this._rfbCredentials.password.length]);
1510
+ this._sock.sendString(this._rfbCredentials.username);
1511
+ this._sock.sendString(this._rfbCredentials.password);
1512
+ this._rfbInitState = "SecurityResult";
1513
return true;
1514
}
1515
967
- _negotiate_tight_tunnels(numTunnels) {
1516
+ _negotiateTightTunnels(numTunnels) {
1517
const clientSupportedTunnelTypes = {
1518
0: { vendor: 'TGHT', signature: 'NOTUNNEL' }
1519
};
1520
const serverSupportedTunnelTypes = {};
1521
// receive tunnel capabilities
1522
for (let i = 0; i < numTunnels; i++) {
974
- const cap_code = this._sock.rQshift32();
975
- const cap_vendor = this._sock.rQshiftStr(4);
976
- const cap_signature = this._sock.rQshiftStr(8);
977
- serverSupportedTunnelTypes[cap_code] = { vendor: cap_vendor, signature: cap_signature };
1523
+ const capCode = this._sock.rQshift32();
1524
+ const capVendor = this._sock.rQshiftStr(4);
1525
+ const capSignature = this._sock.rQshiftStr(8);
1526
+ serverSupportedTunnelTypes[capCode] = { vendor: capVendor, signature: capSignature };
1527
}
1528
1529
Log.Debug("Server Tight tunnel types: " + serverSupportedTunnelTypes);
@@ -1005,16 +1554,16 @@ export default class RFB extends EventTargetMixin {
1554
}
1555
}
1556
1008
- _negotiate_tight_auth() {
1009
- if (!this._rfb_tightvnc) { // first pass, do the tunnel negotiation
1557
+ _negotiateTightAuth() {
1558
+ if (!this._rfbTightVNC) { // first pass, do the tunnel negotiation
1559
if (this._sock.rQwait("num tunnels", 4)) { return false; }
1560
const numTunnels = this._sock.rQshift32();
1561
if (numTunnels > 0 && this._sock.rQwait("tunnel capabilities", 16 * numTunnels, 4)) { return false; }
1562
1014
- this._rfb_tightvnc = true;
1563
+ this._rfbTightVNC = true;
1564
1565
if (numTunnels > 0) {
1017
- this._negotiate_tight_tunnels(numTunnels);
1566
+ this._negotiateTightTunnels(numTunnels);
1567
return false; // wait until we receive the sub auth to continue
1568
}
1569
}
@@ -1023,7 +1572,7 @@ export default class RFB extends EventTargetMixin {
1572
if (this._sock.rQwait("sub auth count", 4)) { return false; }
1573
const subAuthCount = this._sock.rQshift32();
1574
if (subAuthCount === 0) { // empty sub-auth list received means 'no auth' subtype selected
1026
- this._rfb_init_state = 'SecurityResult';
1575
+ this._rfbInitState = 'SecurityResult';
1576
return true;
1577
}
1578
@@ -1031,7 +1580,8 @@ export default class RFB extends EventTargetMixin {
1580
1581
const clientSupportedTypes = {
1582
'STDVNOAUTH__': 1,
1034
- 'STDVVNCAUTH_': 2
1583
+ 'STDVVNCAUTH_': 2,
1584
+ 'TGHTULGNAUTH': 129
1585
};
1586
1587
const serverSupportedTypes = [];
@@ -1051,11 +1601,14 @@ export default class RFB extends EventTargetMixin {
1601
1602
switch (authType) {
1603
case 'STDVNOAUTH__': // no auth
1054
- this._rfb_init_state = 'SecurityResult';
1604
+ this._rfbInitState = 'SecurityResult';
1605
return true;
1606
case 'STDVVNCAUTH_': // VNC auth
1057
- this._rfb_auth_scheme = 2;
1058
- return this._init_msg();
1607
+ this._rfbAuthScheme = 2;
1608
+ return this._initMsg();
1609
+ case 'TGHTULGNAUTH': // UNIX auth
1610
+ this._rfbAuthScheme = 129;
1611
+ return this._initMsg();
1612
default:
1613
return this._fail("Unsupported tiny auth scheme " +
1614
"(scheme: " + authType + ")");
@@ -1066,46 +1619,52 @@ export default class RFB extends EventTargetMixin {
1619
return this._fail("No supported sub-auth types!");
1620
}
1621
1069
- _negotiate_authentication() {
1070
- switch (this._rfb_auth_scheme) {
1622
+ _negotiateAuthentication() {
1623
+ switch (this._rfbAuthScheme) {
1624
case 1: // no auth
1072
- if (this._rfb_version >= 3.8) {
1073
- this._rfb_init_state = 'SecurityResult';
1625
+ if (this._rfbVersion >= 3.8) {
1626
+ this._rfbInitState = 'SecurityResult';
1627
return true;
1628
}
1076
- this._rfb_init_state = 'ClientInitialisation';
1077
- return this._init_msg();
1629
+ this._rfbInitState = 'ClientInitialisation';
1630
+ return this._initMsg();
1631
1632
case 22: // XVP auth
1080
- return this._negotiate_xvp_auth();
1633
+ return this._negotiateXvpAuth();
1634
1635
case 2: // VNC authentication
1083
- return this._negotiate_std_vnc_auth();
1636
+ return this._negotiateStdVNCAuth();
1637
1638
case 16: // TightVNC Security Type
1086
- return this._negotiate_tight_auth();
1639
+ return this._negotiateTightAuth();
1640
+
1641
+ case 19: // VeNCrypt Security Type
1642
+ return this._negotiateVeNCryptAuth();
1643
+
1644
+ case 129: // TightVNC UNIX Security Type
1645
+ return this._negotiateTightUnixAuth();
1646
1647
default:
1648
return this._fail("Unsupported auth scheme (scheme: " +
1090
- this._rfb_auth_scheme + ")");
1649
+ this._rfbAuthScheme + ")");
1650
}
1651
}
1652
1094
- _handle_security_result() {
1653
+ _handleSecurityResult() {
1654
if (this._sock.rQwait('VNC auth response ', 4)) { return false; }
1655
1656
const status = this._sock.rQshift32();
1657
1658
if (status === 0) { // OK
1100
- this._rfb_init_state = 'ClientInitialisation';
1659
+ this._rfbInitState = 'ClientInitialisation';
1660
Log.Debug('Authentication OK');
1102
- return this._init_msg();
1661
+ return this._initMsg();
1662
} else {
1104
- if (this._rfb_version >= 3.8) {
1105
- this._rfb_init_state = "SecurityReason";
1106
- this._security_context = "security result";
1107
- this._security_status = status;
1108
- return this._init_msg();
1663
+ if (this._rfbVersion >= 3.8) {
1664
+ this._rfbInitState = "SecurityReason";
1665
+ this._securityContext = "security result";
1666
+ this._securityStatus = status;
1667
+ return this._initMsg();
1668
} else {
1669
this.dispatchEvent(new CustomEvent(
1670
"securityfailure",
@@ -1116,7 +1675,7 @@ export default class RFB extends EventTargetMixin {
1675
}
1676
}
1677
1119
- _negotiate_server_init() {
1678
+ _negotiateServerInit() {
1679
if (this._sock.rQwait("server initialization", 24)) { return false; }
1680
1681
/* Screen size */
@@ -1126,27 +1685,28 @@ export default class RFB extends EventTargetMixin {
1685
/* PIXEL_FORMAT */
1686
const bpp = this._sock.rQshift8();
1687
const depth = this._sock.rQshift8();
1129
- const big_endian = this._sock.rQshift8();
1130
- const true_color = this._sock.rQshift8();
1131
-
1132
- const red_max = this._sock.rQshift16();
1133
- const green_max = this._sock.rQshift16();
1134
- const blue_max = this._sock.rQshift16();
1135
- const red_shift = this._sock.rQshift8();
1136
- const green_shift = this._sock.rQshift8();
1137
- const blue_shift = this._sock.rQshift8();
1688
+ const bigEndian = this._sock.rQshift8();
1689
+ const trueColor = this._sock.rQshift8();
1690
+
1691
+ const redMax = this._sock.rQshift16();
1692
+ const greenMax = this._sock.rQshift16();
1693
+ const blueMax = this._sock.rQshift16();
1694
+ const redShift = this._sock.rQshift8();
1695
+ const greenShift = this._sock.rQshift8();
1696
+ const blueShift = this._sock.rQshift8();
1697
this._sock.rQskipBytes(3); // padding
1698
1699
// NB(directxman12): we don't want to call any callbacks or print messages until
1700
// *after* we're past the point where we could backtrack
1701
1702
/* Connection name/title */
1144
- const name_length = this._sock.rQshift32();
1145
- if (this._sock.rQwait('server init name', name_length, 24)) { return false; }
1146
- this._fb_name = decodeUTF8(this._sock.rQshiftStr(name_length));
1703
+ const nameLength = this._sock.rQshift32();
1704
+ if (this._sock.rQwait('server init name', nameLength, 24)) { return false; }
1705
+ let name = this._sock.rQshiftStr(nameLength);
1706
+ name = decodeUTF8(name, true);
1707
1148
- if (this._rfb_tightvnc) {
1149
- if (this._sock.rQwait('TightVNC extended server init header', 8, 24 + name_length)) { return false; }
1708
+ if (this._rfbTightVNC) {
1709
+ if (this._sock.rQwait('TightVNC extended server init header', 8, 24 + nameLength)) { return false; }
1710
// In TightVNC mode, ServerInit message is extended
1711
const numServerMessages = this._sock.rQshift16();
1712
const numClientMessages = this._sock.rQshift16();
@@ -1154,7 +1714,7 @@ export default class RFB extends EventTargetMixin {
1714
this._sock.rQskipBytes(2); // padding
1715
1716
const totalMessagesLength = (numServerMessages + numClientMessages + numEncodings) * 16;
1157
- if (this._sock.rQwait('TightVNC extended server init header', totalMessagesLength, 32 + name_length)) { return false; }
1717
+ if (this._sock.rQwait('TightVNC extended server init header', totalMessagesLength, 32 + nameLength)) { return false; }
1718
1719
// we don't actually do anything with the capability information that TIGHT sends,
1720
// so we just skip the all of this.
@@ -1173,47 +1733,31 @@ export default class RFB extends EventTargetMixin {
1733
// if we backtrack
1734
Log.Info("Screen: " + width + "x" + height +
1735
", bpp: " + bpp + ", depth: " + depth +
1176
- ", big_endian: " + big_endian +
1177
- ", true_color: " + true_color +
1178
- ", red_max: " + red_max +
1179
- ", green_max: " + green_max +
1180
- ", blue_max: " + blue_max +
1181
- ", red_shift: " + red_shift +
1182
- ", green_shift: " + green_shift +
1183
- ", blue_shift: " + blue_shift);
1184
-
1185
- if (big_endian !== 0) {
1186
- Log.Warn("Server native endian is not little endian");
1187
- }
1188
-
1189
- if (red_shift !== 16) {
1190
- Log.Warn("Server native red-shift is not 16");
1191
- }
1192
-
1193
- if (blue_shift !== 0) {
1194
- Log.Warn("Server native blue-shift is not 0");
1195
- }
1736
+ ", bigEndian: " + bigEndian +
1737
+ ", trueColor: " + trueColor +
1738
+ ", redMax: " + redMax +
1739
+ ", greenMax: " + greenMax +
1740
+ ", blueMax: " + blueMax +
1741
+ ", redShift: " + redShift +
1742
+ ", greenShift: " + greenShift +
1743
+ ", blueShift: " + blueShift);
1744
1745
// we're past the point where we could backtrack, so it's safe to call this
1198
- this.dispatchEvent(new CustomEvent(
1199
- "desktopname",
1200
- { detail: { name: this._fb_name } }));
1201
-
1746
+ this._setDesktopName(name);
1747
this._resize(width, height);
1748
1749
if (!this._viewOnly) { this._keyboard.grab(); }
1205
- if (!this._viewOnly) { this._mouse.grab(); }
1750
1207
- this._fb_depth = 24;
1751
+ this._fbDepth = 24;
1752
1209
- if (this._fb_name === "Intel(r) AMT KVM") {
1753
+ if (this._fbName === "Intel(r) AMT KVM") {
1754
Log.Warn("Intel AMT KVM only supports 8/16 bit depths. Using low color mode.");
1211
- this._fb_depth = 8;
1755
+ this._fbDepth = 8;
1756
}
1757
1214
- RFB.messages.pixelFormat(this._sock, this._fb_depth, true);
1758
+ RFB.messages.pixelFormat(this._sock, this._fbDepth, true);
1759
this._sendEncodings();
1216
- RFB.messages.fbUpdateRequest(this._sock, false, 0, 0, this._fb_width, this._fb_height);
1760
+ RFB.messages.fbUpdateRequest(this._sock, false, 0, 0, this._fbWidth, this._fbHeight);
1761
1762
this._updateConnectionState('connected');
1763
return true;
@@ -1225,7 +1769,7 @@ export default class RFB extends EventTargetMixin {
1769
// In preference order
1770
encs.push(encodings.encodingCopyRect);
1771
// Only supported with full depth support
1228
- if (this._fb_depth == 24) {
1772
+ if (this._fbDepth == 24) {
1773
encs.push(encodings.encodingTight);
1774
encs.push(encodings.encodingTightPNG);
1775
encs.push(encodings.encodingHextile);
@@ -1234,8 +1778,8 @@ export default class RFB extends EventTargetMixin {
1778
encs.push(encodings.encodingRaw);
1779
1780
// Psuedo-encoding settings
1237
- encs.push(encodings.pseudoEncodingQualityLevel0 + 6);
1238
- encs.push(encodings.pseudoEncodingCompressLevel0 + 2);
1781
+ encs.push(encodings.pseudoEncodingQualityLevel0 + this._qualityLevel);
1782
+ encs.push(encodings.pseudoEncodingCompressLevel0 + this._compressionLevel);
1783
1784
encs.push(encodings.pseudoEncodingDesktopSize);
1785
encs.push(encodings.pseudoEncodingLastRect);
@@ -1244,8 +1788,11 @@ export default class RFB extends EventTargetMixin {
1788
encs.push(encodings.pseudoEncodingXvp);
1789
encs.push(encodings.pseudoEncodingFence);
1790
encs.push(encodings.pseudoEncodingContinuousUpdates);
1791
+ encs.push(encodings.pseudoEncodingDesktopName);
1792
+ encs.push(encodings.pseudoEncodingExtendedClipboard);
1793
1248
- if (this._fb_depth == 24) {
1794
+ if (this._fbDepth == 24) {
1795
+ encs.push(encodings.pseudoEncodingVMwareCursor);
1796
encs.push(encodings.pseudoEncodingCursor);
1797
}
1798
@@ -1260,63 +1807,212 @@ export default class RFB extends EventTargetMixin {
1807
* ClientInitialization - not triggered by server message
1808
* ServerInitialization
1809
*/
1263
- _init_msg() {
1264
- switch (this._rfb_init_state) {
1810
+ _initMsg() {
1811
+ switch (this._rfbInitState) {
1812
case 'ProtocolVersion':
1266
- return this._negotiate_protocol_version();
1813
+ return this._negotiateProtocolVersion();
1814
1815
case 'Security':
1269
- return this._negotiate_security();
1816
+ return this._negotiateSecurity();
1817
1818
case 'Authentication':
1272
- return this._negotiate_authentication();
1819
+ return this._negotiateAuthentication();
1820
1821
case 'SecurityResult':
1275
- return this._handle_security_result();
1822
+ return this._handleSecurityResult();
1823
1824
case 'SecurityReason':
1278
- return this._handle_security_reason();
1825
+ return this._handleSecurityReason();
1826
1827
case 'ClientInitialisation':
1828
this._sock.send([this._shared ? 1 : 0]); // ClientInitialisation
1282
- this._rfb_init_state = 'ServerInitialisation';
1829
+ this._rfbInitState = 'ServerInitialisation';
1830
return true;
1831
1832
case 'ServerInitialisation':
1286
- return this._negotiate_server_init();
1833
+ return this._negotiateServerInit();
1834
1835
default:
1836
return this._fail("Unknown init state (state: " +
1290
- this._rfb_init_state + ")");
1837
+ this._rfbInitState + ")");
1838
}
1839
}
1840
1294
- _handle_set_colour_map_msg() {
1841
+ _handleSetColourMapMsg() {
1842
Log.Debug("SetColorMapEntries");
1843
1844
return this._fail("Unexpected SetColorMapEntries message");
1845
}
1846
1300
- _handle_server_cut_text() {
1847
+ _handleServerCutText() {
1848
Log.Debug("ServerCutText");
1849
1850
if (this._sock.rQwait("ServerCutText header", 7, 1)) { return false; }
1851
+
1852
this._sock.rQskipBytes(3); // Padding
1305
- const length = this._sock.rQshift32();
1306
- if (this._sock.rQwait("ServerCutText", length, 8)) { return false; }
1853
1308
- const text = this._sock.rQshiftStr(length);
1854
+ let length = this._sock.rQshift32();
1855
+ length = toSigned32bit(length);
1856
1310
- if (this._viewOnly) { return true; }
1857
+ if (this._sock.rQwait("ServerCutText content", Math.abs(length), 8)) { return false; }
1858
1312
- this.dispatchEvent(new CustomEvent(
1313
- "clipboard",
1314
- { detail: { text: text } }));
1859
+ if (length >= 0) {
1860
+ //Standard msg
1861
+ const text = this._sock.rQshiftStr(length);
1862
+ if (this._viewOnly) {
1863
+ return true;
1864
+ }
1865
+
1866
+ this.dispatchEvent(new CustomEvent(
1867
+ "clipboard",
1868
+ { detail: { text: text } }));
1869
1870
+ } else {
1871
+ //Extended msg.
1872
+ length = Math.abs(length);
1873
+ const flags = this._sock.rQshift32();
1874
+ let formats = flags & 0x0000FFFF;
1875
+ let actions = flags & 0xFF000000;
1876
+
1877
+ let isCaps = (!!(actions & extendedClipboardActionCaps));
1878
+ if (isCaps) {
1879
+ this._clipboardServerCapabilitiesFormats = {};
1880
+ this._clipboardServerCapabilitiesActions = {};
1881
+
1882
+ // Update our server capabilities for Formats
1883
+ for (let i = 0; i <= 15; i++) {
1884
+ let index = 1 << i;
1885
+
1886
+ // Check if format flag is set.
1887
+ if ((formats & index)) {
1888
+ this._clipboardServerCapabilitiesFormats[index] = true;
1889
+ // We don't send unsolicited clipboard, so we
1890
+ // ignore the size
1891
+ this._sock.rQshift32();
1892
+ }
1893
+ }
1894
+
1895
+ // Update our server capabilities for Actions
1896
+ for (let i = 24; i <= 31; i++) {
1897
+ let index = 1 << i;
1898
+ this._clipboardServerCapabilitiesActions[index] = !!(actions & index);
1899
+ }
1900
+
1901
+ /* Caps handling done, send caps with the clients
1902
+ capabilities set as a response */
1903
+ let clientActions = [
1904
+ extendedClipboardActionCaps,
1905
+ extendedClipboardActionRequest,
1906
+ extendedClipboardActionPeek,
1907
+ extendedClipboardActionNotify,
1908
+ extendedClipboardActionProvide
1909
+ ];
1910
+ RFB.messages.extendedClipboardCaps(this._sock, clientActions, {extendedClipboardFormatText: 0});
1911
+
1912
+ } else if (actions === extendedClipboardActionRequest) {
1913
+ if (this._viewOnly) {
1914
+ return true;
1915
+ }
1916
+
1917
+ // Check if server has told us it can handle Provide and there is clipboard data to send.
1918
+ if (this._clipboardText != null &&
1919
+ this._clipboardServerCapabilitiesActions[extendedClipboardActionProvide]) {
1920
+
1921
+ if (formats & extendedClipboardFormatText) {
1922
+ RFB.messages.extendedClipboardProvide(this._sock, [extendedClipboardFormatText], [this._clipboardText]);
1923
+ }
1924
+ }
1925
+
1926
+ } else if (actions === extendedClipboardActionPeek) {
1927
+ if (this._viewOnly) {
1928
+ return true;
1929
+ }
1930
+
1931
+ if (this._clipboardServerCapabilitiesActions[extendedClipboardActionNotify]) {
1932
+
1933
+ if (this._clipboardText != null) {
1934
+ RFB.messages.extendedClipboardNotify(this._sock, [extendedClipboardFormatText]);
1935
+ } else {
1936
+ RFB.messages.extendedClipboardNotify(this._sock, []);
1937
+ }
1938
+ }
1939
+
1940
+ } else if (actions === extendedClipboardActionNotify) {
1941
+ if (this._viewOnly) {
1942
+ return true;
1943
+ }
1944
+
1945
+ if (this._clipboardServerCapabilitiesActions[extendedClipboardActionRequest]) {
1946
+
1947
+ if (formats & extendedClipboardFormatText) {
1948
+ RFB.messages.extendedClipboardRequest(this._sock, [extendedClipboardFormatText]);
1949
+ }
1950
+ }
1951
+
1952
+ } else if (actions === extendedClipboardActionProvide) {
1953
+ if (this._viewOnly) {
1954
+ return true;
1955
+ }
1956
+
1957
+ if (!(formats & extendedClipboardFormatText)) {
1958
+ return true;
1959
+ }
1960
+ // Ignore what we had in our clipboard client side.
1961
+ this._clipboardText = null;
1962
+
1963
+ // FIXME: Should probably verify that this data was actually requested
1964
+ let zlibStream = this._sock.rQshiftBytes(length - 4);
1965
+ let streamInflator = new Inflator();
1966
+ let textData = null;
1967
+
1968
+ streamInflator.setInput(zlibStream);
1969
+ for (let i = 0; i <= 15; i++) {
1970
+ let format = 1 << i;
1971
+
1972
+ if (formats & format) {
1973
+
1974
+ let size = 0x00;
1975
+ let sizeArray = streamInflator.inflate(4);
1976
+
1977
+ size |= (sizeArray[0] << 24);
1978
+ size |= (sizeArray[1] << 16);
1979
+ size |= (sizeArray[2] << 8);
1980
+ size |= (sizeArray[3]);
1981
+ let chunk = streamInflator.inflate(size);
1982
+
1983
+ if (format === extendedClipboardFormatText) {
1984
+ textData = chunk;
1985
+ }
1986
+ }
1987
+ }
1988
+ streamInflator.setInput(null);
1989
+
1990
+ if (textData !== null) {
1991
+ let tmpText = "";
1992
+ for (let i = 0; i < textData.length; i++) {
1993
+ tmpText += String.fromCharCode(textData[i]);
1994
+ }
1995
+ textData = tmpText;
1996
+
1997
+ textData = decodeUTF8(textData);
1998
+ if ((textData.length > 0) && "\0" === textData.charAt(textData.length - 1)) {
1999
+ textData = textData.slice(0, -1);
2000
+ }
2001
+
2002
+ textData = textData.replace("\r\n", "\n");
2003
+
2004
+ this.dispatchEvent(new CustomEvent(
2005
+ "clipboard",
2006
+ { detail: { text: textData } }));
2007
+ }
2008
+ } else {
2009
+ return this._fail("Unexpected action in extended clipboard message: " + actions);
2010
+ }
2011
+ }
2012
return true;
2013
}
2014
1319
- _handle_server_fence_msg() {
2015
+ _handleServerFenceMsg() {
2016
if (this._sock.rQwait("ServerFence header", 8, 1)) { return false; }
2017
this._sock.rQskipBytes(3); // Padding
2018
let flags = this._sock.rQshift32();
@@ -1358,49 +2054,49 @@ export default class RFB extends EventTargetMixin {
2054
return true;
2055
}
2056
1361
- _handle_xvp_msg() {
2057
+ _handleXvpMsg() {
2058
if (this._sock.rQwait("XVP version and message", 3, 1)) { return false; }
2059
this._sock.rQskipBytes(1); // Padding
1364
- const xvp_ver = this._sock.rQshift8();
1365
- const xvp_msg = this._sock.rQshift8();
2060
+ const xvpVer = this._sock.rQshift8();
2061
+ const xvpMsg = this._sock.rQshift8();
2062
1367
- switch (xvp_msg) {
2063
+ switch (xvpMsg) {
2064
case 0: // XVP_FAIL
2065
Log.Error("XVP Operation Failed");
2066
break;
2067
case 1: // XVP_INIT
1372
- this._rfb_xvp_ver = xvp_ver;
1373
- Log.Info("XVP extensions enabled (version " + this._rfb_xvp_ver + ")");
2068
+ this._rfbXvpVer = xvpVer;
2069
+ Log.Info("XVP extensions enabled (version " + this._rfbXvpVer + ")");
2070
this._setCapability("power", true);
2071
break;
2072
default:
1377
- this._fail("Illegal server XVP message (msg: " + xvp_msg + ")");
2073
+ this._fail("Illegal server XVP message (msg: " + xvpMsg + ")");
2074
break;
2075
}
2076
2077
return true;
2078
}
2079
1384
- _normal_msg() {
1385
- let msg_type;
2080
+ _normalMsg() {
2081
+ let msgType;
2082
if (this._FBU.rects > 0) {
1387
- msg_type = 0;
2083
+ msgType = 0;
2084
} else {
1389
- msg_type = this._sock.rQshift8();
2085
+ msgType = this._sock.rQshift8();
2086
}
2087
2088
let first, ret;
1393
- switch (msg_type) {
2089
+ switch (msgType) {
2090
case 0: // FramebufferUpdate
2091
ret = this._framebufferUpdate();
2092
if (ret && !this._enabledContinuousUpdates) {
2093
RFB.messages.fbUpdateRequest(this._sock, true, 0, 0,
1398
- this._fb_width, this._fb_height);
2094
+ this._fbWidth, this._fbHeight);
2095
}
2096
return ret;
2097
2098
case 1: // SetColorMapEntries
1403
- return this._handle_set_colour_map_msg();
2099
+ return this._handleSetColourMapMsg();
2100
2101
case 2: // Bell
2102
Log.Debug("Bell");
@@ -1410,7 +2106,7 @@ export default class RFB extends EventTargetMixin {
2106
return true;
2107
2108
case 3: // ServerCutText
1413
- return this._handle_server_cut_text();
2109
+ return this._handleServerCutText();
2110
2111
case 150: // EndOfContinuousUpdates
2112
first = !this._supportsContinuousUpdates;
@@ -1427,13 +2123,13 @@ export default class RFB extends EventTargetMixin {
2123
return true;
2124
2125
case 248: // ServerFence
1430
- return this._handle_server_fence_msg();
2126
+ return this._handleServerFenceMsg();
2127
2128
case 250: // XVP
1433
- return this._handle_xvp_msg();
2129
+ return this._handleXvpMsg();
2130
2131
default:
1436
- this._fail("Unexpected server message (type " + msg_type + ")");
2132
+ this._fail("Unexpected server message (type " + msgType + ")");
2133
Log.Debug("sock.rQslice(0, 30): " + this._sock.rQslice(0, 30));
2134
return true;
2135
}
@@ -1443,7 +2139,7 @@ export default class RFB extends EventTargetMixin {
2139
this._flushing = false;
2140
// Resume processing
2141
if (this._sock.rQlen > 0) {
1446
- this._handle_message();
2142
+ this._handleMessage();
2143
}
2144
}
2145
@@ -1495,21 +2191,19 @@ export default class RFB extends EventTargetMixin {
2191
this._FBU.rects = 1; // Will be decreased when we return
2192
return true;
2193
2194
+ case encodings.pseudoEncodingVMwareCursor:
2195
+ return this._handleVMwareCursor();
2196
+
2197
case encodings.pseudoEncodingCursor:
2198
return this._handleCursor();
2199
2200
case encodings.pseudoEncodingQEMUExtendedKeyEvent:
1502
- // Old Safari doesn't support creating keyboard events
1503
- try {
1504
- const keyboardEvent = document.createEvent("keyboardEvent");
1505
- if (keyboardEvent.code !== undefined) {
1506
- this._qemuExtKeyEventSupported = true;
1507
- }
1508
- } catch (err) {
1509
- // Do nothing
1510
- }
2201
+ this._qemuExtKeyEventSupported = true;
2202
return true;
2203
2204
+ case encodings.pseudoEncodingDesktopName:
2205
+ return this._handleDesktopName();
2206
+
2207
case encodings.pseudoEncodingDesktopSize:
2208
this._resize(this._FBU.width, this._FBU.height);
2209
return true;
@@ -1522,6 +2216,122 @@ export default class RFB extends EventTargetMixin {
2216
}
2217
}
2218
2219
+ _handleVMwareCursor() {
2220
+ const hotx = this._FBU.x; // hotspot-x
2221
+ const hoty = this._FBU.y; // hotspot-y
2222
+ const w = this._FBU.width;
2223
+ const h = this._FBU.height;
2224
+ if (this._sock.rQwait("VMware cursor encoding", 1)) {
2225
+ return false;
2226
+ }
2227
+
2228
+ const cursorType = this._sock.rQshift8();
2229
+
2230
+ this._sock.rQshift8(); //Padding
2231
+
2232
+ let rgba;
2233
+ const bytesPerPixel = 4;
2234
+
2235
+ //Classic cursor
2236
+ if (cursorType == 0) {
2237
+ //Used to filter away unimportant bits.
2238
+ //OR is used for correct conversion in js.
2239
+ const PIXEL_MASK = 0xffffff00 | 0;
2240
+ rgba = new Array(w * h * bytesPerPixel);
2241
+
2242
+ if (this._sock.rQwait("VMware cursor classic encoding",
2243
+ (w * h * bytesPerPixel) * 2, 2)) {
2244
+ return false;
2245
+ }
2246
+
2247
+ let andMask = new Array(w * h);
2248
+ for (let pixel = 0; pixel < (w * h); pixel++) {
2249
+ andMask[pixel] = this._sock.rQshift32();
2250
+ }
2251
+
2252
+ let xorMask = new Array(w * h);
2253
+ for (let pixel = 0; pixel < (w * h); pixel++) {
2254
+ xorMask[pixel] = this._sock.rQshift32();
2255
+ }
2256
+
2257
+ for (let pixel = 0; pixel < (w * h); pixel++) {
2258
+ if (andMask[pixel] == 0) {
2259
+ //Fully opaque pixel
2260
+ let bgr = xorMask[pixel];
2261
+ let r = bgr >> 8 & 0xff;
2262
+ let g = bgr >> 16 & 0xff;
2263
+ let b = bgr >> 24 & 0xff;
2264
+
2265
+ rgba[(pixel * bytesPerPixel) ] = r; //r
2266
+ rgba[(pixel * bytesPerPixel) + 1 ] = g; //g
2267
+ rgba[(pixel * bytesPerPixel) + 2 ] = b; //b
2268
+ rgba[(pixel * bytesPerPixel) + 3 ] = 0xff; //a
2269
+
2270
+ } else if ((andMask[pixel] & PIXEL_MASK) ==
2271
+ PIXEL_MASK) {
2272
+ //Only screen value matters, no mouse colouring
2273
+ if (xorMask[pixel] == 0) {
2274
+ //Transparent pixel
2275
+ rgba[(pixel * bytesPerPixel) ] = 0x00;
2276
+ rgba[(pixel * bytesPerPixel) + 1 ] = 0x00;
2277
+ rgba[(pixel * bytesPerPixel) + 2 ] = 0x00;
2278
+ rgba[(pixel * bytesPerPixel) + 3 ] = 0x00;
2279
+
2280
+ } else if ((xorMask[pixel] & PIXEL_MASK) ==
2281
+ PIXEL_MASK) {
2282
+ //Inverted pixel, not supported in browsers.
2283
+ //Fully opaque instead.
2284
+ rgba[(pixel * bytesPerPixel) ] = 0x00;
2285
+ rgba[(pixel * bytesPerPixel) + 1 ] = 0x00;
2286
+ rgba[(pixel * bytesPerPixel) + 2 ] = 0x00;
2287
+ rgba[(pixel * bytesPerPixel) + 3 ] = 0xff;
2288
+
2289
+ } else {
2290
+ //Unhandled xorMask
2291
+ rgba[(pixel * bytesPerPixel) ] = 0x00;
2292
+ rgba[(pixel * bytesPerPixel) + 1 ] = 0x00;
2293
+ rgba[(pixel * bytesPerPixel) + 2 ] = 0x00;
2294
+ rgba[(pixel * bytesPerPixel) + 3 ] = 0xff;
2295
+ }
2296
+
2297
+ } else {
2298
+ //Unhandled andMask
2299
+ rgba[(pixel * bytesPerPixel) ] = 0x00;
2300
+ rgba[(pixel * bytesPerPixel) + 1 ] = 0x00;
2301
+ rgba[(pixel * bytesPerPixel) + 2 ] = 0x00;
2302
+ rgba[(pixel * bytesPerPixel) + 3 ] = 0xff;
2303
+ }
2304
+ }
2305
+
2306
+ //Alpha cursor.
2307
+ } else if (cursorType == 1) {
2308
+ if (this._sock.rQwait("VMware cursor alpha encoding",
2309
+ (w * h * 4), 2)) {
2310
+ return false;
2311
+ }
2312
+
2313
+ rgba = new Array(w * h * bytesPerPixel);
2314
+
2315
+ for (let pixel = 0; pixel < (w * h); pixel++) {
2316
+ let data = this._sock.rQshift32();
2317
+
2318
+ rgba[(pixel * 4) ] = data >> 24 & 0xff; //r
2319
+ rgba[(pixel * 4) + 1 ] = data >> 16 & 0xff; //g
2320
+ rgba[(pixel * 4) + 2 ] = data >> 8 & 0xff; //b
2321
+ rgba[(pixel * 4) + 3 ] = data & 0xff; //a
2322
+ }
2323
+
2324
+ } else {
2325
+ Log.Warn("The given cursor type is not supported: "
2326
+ + cursorType + " given.");
2327
+ return false;
2328
+ }
2329
+
2330
+ this._updateCursor(rgba, hotx, hoty, w, h);
2331
+
2332
+ return true;
2333
+ }
2334
+
2335
_handleCursor() {
2336
const hotx = this._FBU.x; // hotspot-x
2337
const hoty = this._FBU.y; // hotspot-y
@@ -1541,16 +2351,16 @@ export default class RFB extends EventTargetMixin {
2351
const mask = this._sock.rQshiftBytes(masklength);
2352
let rgba = new Uint8Array(w * h * 4);
2353
1544
- let pix_idx = 0;
2354
+ let pixIdx = 0;
2355
for (let y = 0; y < h; y++) {
2356
for (let x = 0; x < w; x++) {
1547
- let mask_idx = y * Math.ceil(w / 8) + Math.floor(x / 8);
1548
- let alpha = (mask[mask_idx] << (x % 8)) & 0x80 ? 255 : 0;
1549
- rgba[pix_idx ] = pixels[pix_idx + 2];
1550
- rgba[pix_idx + 1] = pixels[pix_idx + 1];
1551
- rgba[pix_idx + 2] = pixels[pix_idx];
1552
- rgba[pix_idx + 3] = alpha;
1553
- pix_idx += 4;
2357
+ let maskIdx = y * Math.ceil(w / 8) + Math.floor(x / 8);
2358
+ let alpha = (mask[maskIdx] << (x % 8)) & 0x80 ? 255 : 0;
2359
+ rgba[pixIdx ] = pixels[pixIdx + 2];
2360
+ rgba[pixIdx + 1] = pixels[pixIdx + 1];
2361
+ rgba[pixIdx + 2] = pixels[pixIdx];
2362
+ rgba[pixIdx + 3] = alpha;
2363
+ pixIdx += 4;
2364
}
2365
}
2366
@@ -1559,14 +2369,33 @@ export default class RFB extends EventTargetMixin {
2369
return true;
2370
}
2371
2372
+ _handleDesktopName() {
2373
+ if (this._sock.rQwait("DesktopName", 4)) {
2374
+ return false;
2375
+ }
2376
+
2377
+ let length = this._sock.rQshift32();
2378
+
2379
+ if (this._sock.rQwait("DesktopName", length, 4)) {
2380
+ return false;
2381
+ }
2382
+
2383
+ let name = this._sock.rQshiftStr(length);
2384
+ name = decodeUTF8(name, true);
2385
+
2386
+ this._setDesktopName(name);
2387
+
2388
+ return true;
2389
+ }
2390
+
2391
_handleExtendedDesktopSize() {
2392
if (this._sock.rQwait("ExtendedDesktopSize", 4)) {
2393
return false;
2394
}
2395
1567
- const number_of_screens = this._sock.rQpeek8();
2396
+ const numberOfScreens = this._sock.rQpeek8();
2397
1569
- let bytes = 4 + (number_of_screens * 16);
2398
+ let bytes = 4 + (numberOfScreens * 16);
2399
if (this._sock.rQwait("ExtendedDesktopSize", bytes)) {
2400
return false;
2401
}
@@ -1585,15 +2414,15 @@ export default class RFB extends EventTargetMixin {
2414
this._sock.rQskipBytes(1); // number-of-screens
2415
this._sock.rQskipBytes(3); // padding
2416
1588
- for (let i = 0; i < number_of_screens; i += 1) {
2417
+ for (let i = 0; i < numberOfScreens; i += 1) {
2418
// Save the id and flags of the first screen
2419
if (i === 0) {
1591
- this._screen_id = this._sock.rQshiftBytes(4); // id
2420
+ this._screenID = this._sock.rQshiftBytes(4); // id
2421
this._sock.rQskipBytes(2); // x-position
2422
this._sock.rQskipBytes(2); // y-position
2423
this._sock.rQskipBytes(2); // width
2424
this._sock.rQskipBytes(2); // height
1596
- this._screen_flags = this._sock.rQshiftBytes(4); // flags
2425
+ this._screenFlags = this._sock.rQshiftBytes(4); // flags
2426
} else {
2427
this._sock.rQskipBytes(16);
2428
}
@@ -1646,7 +2475,7 @@ export default class RFB extends EventTargetMixin {
2475
return decoder.decodeRect(this._FBU.x, this._FBU.y,
2476
this._FBU.width, this._FBU.height,
2477
this._sock, this._display,
1649
- this._fb_depth);
2478
+ this._fbDepth);
2479
} catch (err) {
2480
this._fail("Error decoding rect: " + err);
2481
return false;
@@ -1657,14 +2486,14 @@ export default class RFB extends EventTargetMixin {
2486
if (!this._enabledContinuousUpdates) { return; }
2487
2488
RFB.messages.enableContinuousUpdates(this._sock, true, 0, 0,
1660
- this._fb_width, this._fb_height);
2489
+ this._fbWidth, this._fbHeight);
2490
}
2491
2492
_resize(width, height) {
1664
- this._fb_width = width;
1665
- this._fb_height = height;
2493
+ this._fbWidth = width;
2494
+ this._fbHeight = height;
2495
1667
- this._display.resize(this._fb_width, this._fb_height);
2496
+ this._display.resize(this._fbWidth, this._fbHeight);
2497
2498
// Adjust the visible viewport based on the new dimensions
2499
this._updateClip();
@@ -1674,7 +2503,7 @@ export default class RFB extends EventTargetMixin {
2503
}
2504
2505
_xvpOp(ver, op) {
1677
- if (this._rfb_xvp_ver < ver) { return; }
2506
+ if (this._rfbXvpVer < ver) { return; }
2507
Log.Info("Sending XVP operation " + op + " (version " + ver + ")");
2508
RFB.messages.xvpOp(this._sock, ver, op);
2509
}
@@ -1710,6 +2539,10 @@ export default class RFB extends EventTargetMixin {
2539
}
2540
2541
_refreshCursor() {
2542
+ if (this._rfbConnectionState !== "connecting" &&
2543
+ this._rfbConnectionState !== "connected") {
2544
+ return;
2545
+ }
2546
const image = this._shouldShowDotCursor() ? RFB.cursors.dot : this._cursorImage;
2547
this._cursor.change(image.rgbaPixels,
2548
image.hotx, image.hoty,
@@ -1745,13 +2578,13 @@ RFB.messages = {
2578
},
2579
2580
QEMUExtendedKeyEvent(sock, keysym, down, keycode) {
1748
- function getRFBkeycode(xt_scancode) {
2581
+ function getRFBkeycode(xtScanCode) {
2582
const upperByte = (keycode >> 8);
2583
const lowerByte = (keycode & 0x00ff);
2584
if (upperByte === 0xe0 && lowerByte < 0x7f) {
2585
return lowerByte | 0x80;
2586
}
1754
- return xt_scancode;
2587
+ return xtScanCode;
2588
}
2589
2590
const buff = sock._sQ;
@@ -1797,8 +2630,102 @@ RFB.messages = {
2630
sock.flush();
2631
},
2632
1800
- // TODO(directxman12): make this unicode compatible?
1801
- clientCutText(sock, text) {
2633
+ // Used to build Notify and Request data.
2634
+ _buildExtendedClipboardFlags(actions, formats) {
2635
+ let data = new Uint8Array(4);
2636
+ let formatFlag = 0x00000000;
2637
+ let actionFlag = 0x00000000;
2638
+
2639
+ for (let i = 0; i < actions.length; i++) {
2640
+ actionFlag |= actions[i];
2641
+ }
2642
+
2643
+ for (let i = 0; i < formats.length; i++) {
2644
+ formatFlag |= formats[i];
2645
+ }
2646
+
2647
+ data[0] = actionFlag >> 24; // Actions
2648
+ data[1] = 0x00; // Reserved
2649
+ data[2] = 0x00; // Reserved
2650
+ data[3] = formatFlag; // Formats
2651
+
2652
+ return data;
2653
+ },
2654
+
2655
+ extendedClipboardProvide(sock, formats, inData) {
2656
+ // Deflate incomming data and their sizes
2657
+ let deflator = new Deflator();
2658
+ let dataToDeflate = [];
2659
+
2660
+ for (let i = 0; i < formats.length; i++) {
2661
+ // We only support the format Text at this time
2662
+ if (formats[i] != extendedClipboardFormatText) {
2663
+ throw new Error("Unsupported extended clipboard format for Provide message.");
2664
+ }
2665
+
2666
+ // Change lone \r or \n into \r\n as defined in rfbproto
2667
+ inData[i] = inData[i].replace(/\r\n|\r|\n/gm, "\r\n");
2668
+
2669
+ // Check if it already has \0
2670
+ let text = encodeUTF8(inData[i] + "\0");
2671
+
2672
+ dataToDeflate.push( (text.length >> 24) & 0xFF,
2673
+ (text.length >> 16) & 0xFF,
2674
+ (text.length >> 8) & 0xFF,
2675
+ (text.length & 0xFF));
2676
+
2677
+ for (let j = 0; j < text.length; j++) {
2678
+ dataToDeflate.push(text.charCodeAt(j));
2679
+ }
2680
+ }
2681
+
2682
+ let deflatedData = deflator.deflate(new Uint8Array(dataToDeflate));
2683
+
2684
+ // Build data to send
2685
+ let data = new Uint8Array(4 + deflatedData.length);
2686
+ data.set(RFB.messages._buildExtendedClipboardFlags([extendedClipboardActionProvide],
2687
+ formats));
2688
+ data.set(deflatedData, 4);
2689
+
2690
+ RFB.messages.clientCutText(sock, data, true);
2691
+ },
2692
+
2693
+ extendedClipboardNotify(sock, formats) {
2694
+ let flags = RFB.messages._buildExtendedClipboardFlags([extendedClipboardActionNotify],
2695
+ formats);
2696
+ RFB.messages.clientCutText(sock, flags, true);
2697
+ },
2698
+
2699
+ extendedClipboardRequest(sock, formats) {
2700
+ let flags = RFB.messages._buildExtendedClipboardFlags([extendedClipboardActionRequest],
2701
+ formats);
2702
+ RFB.messages.clientCutText(sock, flags, true);
2703
+ },
2704
+
2705
+ extendedClipboardCaps(sock, actions, formats) {
2706
+ let formatKeys = Object.keys(formats);
2707
+ let data = new Uint8Array(4 + (4 * formatKeys.length));
2708
+
2709
+ formatKeys.map(x => parseInt(x));
2710
+ formatKeys.sort((a, b) => a - b);
2711
+
2712
+ data.set(RFB.messages._buildExtendedClipboardFlags(actions, []));
2713
+
2714
+ let loopOffset = 4;
2715
+ for (let i = 0; i < formatKeys.length; i++) {
2716
+ data[loopOffset] = formats[formatKeys[i]] >> 24;
2717
+ data[loopOffset + 1] = formats[formatKeys[i]] >> 16;
2718
+ data[loopOffset + 2] = formats[formatKeys[i]] >> 8;
2719
+ data[loopOffset + 3] = formats[formatKeys[i]] >> 0;
2720
+
2721
+ loopOffset += 4;
2722
+ data[3] |= (1 << formatKeys[i]); // Update our format flags
2723
+ }
2724
+
2725
+ RFB.messages.clientCutText(sock, data, true);
2726
+ },
2727
+
2728
+ clientCutText(sock, data, extended = false) {
2729
const buff = sock._sQ;
2730
const offset = sock._sQlen;
2731
@@ -1808,7 +2735,12 @@ RFB.messages = {
2735
buff[offset + 2] = 0; // padding
2736
buff[offset + 3] = 0; // padding
2737
1811
- let length = text.length;
2738
+ let length;
2739
+ if (extended) {
2740
+ length = toUnsigned32bit(-data.length);
2741
+ } else {
2742
+ length = data.length;
2743
+ }
2744
2745
buff[offset + 4] = length >> 24;
2746
buff[offset + 5] = length >> 16;
@@ -1817,24 +2749,25 @@ RFB.messages = {
2749
2750
sock._sQlen += 8;
2751
1820
- // We have to keep track of from where in the text we begin creating the
2752
+ // We have to keep track of from where in the data we begin creating the
2753
// buffer for the flush in the next iteration.
1822
- let textOffset = 0;
2754
+ let dataOffset = 0;
2755
1824
- let remaining = length;
2756
+ let remaining = data.length;
2757
while (remaining > 0) {
2758
2759
let flushSize = Math.min(remaining, (sock._sQbufferSize - sock._sQlen));
2760
for (let i = 0; i < flushSize; i++) {
1829
- buff[sock._sQlen + i] = text.charCodeAt(textOffset + i);
2761
+ buff[sock._sQlen + i] = data[dataOffset + i];
2762
}
2763
2764
sock._sQlen += flushSize;
2765
sock.flush();
2766
2767
remaining -= flushSize;
1836
- textOffset += flushSize;
2768
+ dataOffset += flushSize;
2769
}
2770
+
2771
},
2772
2773
setDesktopSize(sock, width, height, id, flags) {
@@ -1920,7 +2853,7 @@ RFB.messages = {
2853
sock.flush();
2854
},
2855
1923
- pixelFormat(sock, depth, true_color) {
2856
+ pixelFormat(sock, depth, trueColor) {
2857
const buff = sock._sQ;
2858
const offset = sock._sQlen;
2859
@@ -1945,7 +2878,7 @@ RFB.messages = {
2878
buff[offset + 4] = bpp; // bits-per-pixel
2879
buff[offset + 5] = depth; // depth
2880
buff[offset + 6] = 0; // little-endian
1948
- buff[offset + 7] = true_color ? 1 : 0; // true-color
2881
+ buff[offset + 7] = trueColor ? 1 : 0; // true-color
2882
2883
buff[offset + 8] = 0; // red-max
2884
buff[offset + 9] = (1 << bits) - 1; // red-max
@@ -1956,9 +2889,9 @@ RFB.messages = {
2889
buff[offset + 12] = 0; // blue-max
2890
buff[offset + 13] = (1 << bits) - 1; // blue-max
2891
1959
- buff[offset + 14] = bits * 2; // red-shift
2892
+ buff[offset + 14] = bits * 0; // red-shift
2893
buff[offset + 15] = bits * 1; // green-shift
1961
- buff[offset + 16] = bits * 0; // blue-shift
2894
+ buff[offset + 16] = bits * 2; // blue-shift
2895
2896
buff[offset + 17] = 0; // padding
2897
buff[offset + 18] = 0; // padding
public/novnc/core/util/browser.js
+33
-20
@@ -1,9 +1,11 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
7
+ *
8
+ * Browser feature support detection
9
*/
10
11
import * as Log from './logging.js';
@@ -31,7 +33,7 @@ try {
33
const target = document.createElement('canvas');
34
target.style.cursor = 'url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default';
35
34
- if (target.style.cursor) {
36
+ if (target.style.cursor.indexOf("url") === 0) {
37
Log.Info("Data URI scheme cursor supported");
38
_supportsCursorURIs = true;
39
} else {
@@ -43,14 +45,37 @@ try {
45
46
export const supportsCursorURIs = _supportsCursorURIs;
47
46
-let _supportsImageMetadata = false;
48
+let _hasScrollbarGutter = true;
49
try {
48
- new ImageData(new Uint8ClampedArray(4), 1, 1);
49
- _supportsImageMetadata = true;
50
-} catch (ex) {
51
- // ignore failure
50
+ // Create invisible container
51
+ const container = document.createElement('div');
52
+ container.style.visibility = 'hidden';
53
+ container.style.overflow = 'scroll'; // forcing scrollbars
54
+ document.body.appendChild(container);
55
+
56
+ // Create a div and place it in the container
57
+ const child = document.createElement('div');
58
+ container.appendChild(child);
59
+
60
+ // Calculate the difference between the container's full width
61
+ // and the child's width - the difference is the scrollbars
62
+ const scrollbarWidth = (container.offsetWidth - child.offsetWidth);
63
+
64
+ // Clean up
65
+ container.parentNode.removeChild(container);
66
+
67
+ _hasScrollbarGutter = scrollbarWidth != 0;
68
+} catch (exc) {
69
+ Log.Error("Scrollbar test exception: " + exc);
70
}
53
-export const supportsImageMetadata = _supportsImageMetadata;
71
+export const hasScrollbarGutter = _hasScrollbarGutter;
72
+
73
+/*
74
+ * The functions for detection of platforms and browsers below are exported
75
+ * but the use of these should be minimized as much as possible.
76
+ *
77
+ * It's better to use feature detection than platform detection.
78
+ */
79
80
export function isMac() {
81
return navigator && !!(/mac/i).exec(navigator.platform);
@@ -67,23 +92,11 @@ export function isIOS() {
92
!!(/ipod/i).exec(navigator.platform));
93
}
94
70
-export function isAndroid() {
71
- return navigator && !!(/android/i).exec(navigator.userAgent);
72
-}
73
-
95
export function isSafari() {
96
return navigator && (navigator.userAgent.indexOf('Safari') !== -1 &&
97
navigator.userAgent.indexOf('Chrome') === -1);
98
}
99
79
-export function isIE() {
80
- return navigator && !!(/trident/i).exec(navigator.userAgent);
81
-}
82
-
83
-export function isEdge() {
84
- return navigator && !!(/edge/i).exec(navigator.userAgent);
85
-}
86
-
100
export function isFirefox() {
101
return navigator && !!(/firefox/i).exec(navigator.userAgent);
102
}
public/novnc/core/util/cursor.js
+67
-45
@@ -1,6 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
5
*/
6
@@ -20,7 +20,6 @@ export default class Cursor {
20
this._canvas.style.pointerEvents = 'none';
21
// Can't use "display" because of Firefox bug #1445997
22
this._canvas.style.visibility = 'hidden';
23
- document.body.appendChild(this._canvas);
23
}
24
25
this._position = { x: 0, y: 0 };
@@ -31,9 +30,6 @@ export default class Cursor {
30
'mouseleave': this._handleMouseLeave.bind(this),
31
'mousemove': this._handleMouseMove.bind(this),
32
'mouseup': this._handleMouseUp.bind(this),
34
- 'touchstart': this._handleTouchStart.bind(this),
35
- 'touchmove': this._handleTouchMove.bind(this),
36
- 'touchend': this._handleTouchEnd.bind(this),
33
};
34
}
35
@@ -45,25 +41,23 @@ export default class Cursor {
41
this._target = target;
42
43
if (useFallback) {
48
- // FIXME: These don't fire properly except for mouse
49
- /// movement in IE. We want to also capture element
50
- // movement, size changes, visibility, etc.
44
+ document.body.appendChild(this._canvas);
45
+
46
const options = { capture: true, passive: true };
47
this._target.addEventListener('mouseover', this._eventHandlers.mouseover, options);
48
this._target.addEventListener('mouseleave', this._eventHandlers.mouseleave, options);
49
this._target.addEventListener('mousemove', this._eventHandlers.mousemove, options);
50
this._target.addEventListener('mouseup', this._eventHandlers.mouseup, options);
56
-
57
- // There is no "touchleave" so we monitor touchstart globally
58
- window.addEventListener('touchstart', this._eventHandlers.touchstart, options);
59
- this._target.addEventListener('touchmove', this._eventHandlers.touchmove, options);
60
- this._target.addEventListener('touchend', this._eventHandlers.touchend, options);
51
}
52
53
this.clear();
54
}
55
56
detach() {
57
+ if (!this._target) {
58
+ return;
59
+ }
60
+
61
if (useFallback) {
62
const options = { capture: true, passive: true };
63
this._target.removeEventListener('mouseover', this._eventHandlers.mouseover, options);
@@ -71,9 +65,7 @@ export default class Cursor {
65
this._target.removeEventListener('mousemove', this._eventHandlers.mousemove, options);
66
this._target.removeEventListener('mouseup', this._eventHandlers.mouseup, options);
67
74
- window.removeEventListener('touchstart', this._eventHandlers.touchstart, options);
75
- this._target.removeEventListener('touchmove', this._eventHandlers.touchmove, options);
76
- this._target.removeEventListener('touchend', this._eventHandlers.touchend, options);
68
+ document.body.removeChild(this._canvas);
69
}
70
71
this._target = null;
@@ -95,14 +87,7 @@ export default class Cursor {
87
this._canvas.width = w;
88
this._canvas.height = h;
89
98
- let img;
99
- try {
100
- // IE doesn't support this
101
- img = new ImageData(new Uint8ClampedArray(rgba), w, h);
102
- } catch (ex) {
103
- img = ctx.createImageData(w, h);
104
- img.data.set(new Uint8ClampedArray(rgba));
105
- }
90
+ let img = new ImageData(new Uint8ClampedArray(rgba), w, h);
91
ctx.clearRect(0, 0, w, h);
92
ctx.putImageData(img, 0, 0);
93
@@ -124,6 +109,27 @@ export default class Cursor {
109
this._hotSpot.y = 0;
110
}
111
112
+ // Mouse events might be emulated, this allows
113
+ // moving the cursor in such cases
114
+ move(clientX, clientY) {
115
+ if (!useFallback) {
116
+ return;
117
+ }
118
+ // clientX/clientY are relative the _visual viewport_,
119
+ // but our position is relative the _layout viewport_,
120
+ // so try to compensate when we can
121
+ if (window.visualViewport) {
122
+ this._position.x = clientX + window.visualViewport.offsetLeft;
123
+ this._position.y = clientY + window.visualViewport.offsetTop;
124
+ } else {
125
+ this._position.x = clientX;
126
+ this._position.y = clientY;
127
+ }
128
+ this._updatePosition();
129
+ let target = document.elementFromPoint(clientX, clientY);
130
+ this._updateVisibility(target);
131
+ }
132
+
133
_handleMouseOver(event) {
134
// This event could be because we're entering the target, or
135
// moving around amongst its sub elements. Let the move handler
@@ -132,7 +138,8 @@ export default class Cursor {
138
}
139
140
_handleMouseLeave(event) {
135
- this._hideCursor();
141
+ // Check if we should show the cursor on the element we are leaving to
142
+ this._updateVisibility(event.relatedTarget);
143
}
144
145
_handleMouseMove(event) {
@@ -150,27 +157,29 @@ export default class Cursor {
157
// now and adjust visibility based on that.
158
let target = document.elementFromPoint(event.clientX, event.clientY);
159
this._updateVisibility(target);
153
- }
154
-
155
- _handleTouchStart(event) {
156
- // Just as for mouseover, we let the move handler deal with it
157
- this._handleTouchMove(event);
158
- }
159
-
160
- _handleTouchMove(event) {
161
- this._updateVisibility(event.target);
162
-
163
- this._position.x = event.changedTouches[0].clientX - this._hotSpot.x;
164
- this._position.y = event.changedTouches[0].clientY - this._hotSpot.y;
165
-
166
- this._updatePosition();
167
- }
160
169
- _handleTouchEnd(event) {
170
- // Same principle as for mouseup
171
- let target = document.elementFromPoint(event.changedTouches[0].clientX,
172
- event.changedTouches[0].clientY);
173
- this._updateVisibility(target);
161
+ // Captures end with a mouseup but we can't know the event order of
162
+ // mouseup vs releaseCapture.
163
+ //
164
+ // In the cases when releaseCapture comes first, the code above is
165
+ // enough.
166
+ //
167
+ // In the cases when the mouseup comes first, we need wait for the
168
+ // browser to flush all events and then check again if the cursor
169
+ // should be visible.
170
+ if (this._captureIsActive()) {
171
+ window.setTimeout(() => {
172
+ // We might have detached at this point
173
+ if (!this._target) {
174
+ return;
175
+ }
176
+ // Refresh the target from elementFromPoint since queued events
177
+ // might have altered the DOM
178
+ target = document.elementFromPoint(event.clientX,
179
+ event.clientY);
180
+ this._updateVisibility(target);
181
+ }, 0);
182
+ }
183
}
184
185
_showCursor() {
@@ -189,6 +198,9 @@ export default class Cursor {
198
// (i.e. are we over the target, or a child of the target without a
199
// different cursor set)
200
_shouldShowCursor(target) {
201
+ if (!target) {
202
+ return false;
203
+ }
204
// Easy case
205
if (target === this._target) {
206
return true;
@@ -207,6 +219,11 @@ export default class Cursor {
219
}
220
221
_updateVisibility(target) {
222
+ // When the cursor target has capture we want to show the cursor.
223
+ // So, if a capture is active - look at the captured element instead.
224
+ if (this._captureIsActive()) {
225
+ target = document.captureElement;
226
+ }
227
if (this._shouldShowCursor(target)) {
228
this._showCursor();
229
} else {
@@ -218,4 +235,9 @@ export default class Cursor {
235
this._canvas.style.left = this._position.x + "px";
236
this._canvas.style.top = this._position.y + "px";
237
}
238
+
239
+ _captureIsActive() {
240
+ return document.captureElement &&
241
+ document.documentElement.contains(document.captureElement);
242
+ }
243
}
public/novnc/core/util/element.js
new
+32
@@ -0,0 +1,32 @@
1
+/*
2
+ * noVNC: HTML5 VNC client
3
+ * Copyright (C) 2020 The noVNC Authors
4
+ * Licensed under MPL 2.0 (see LICENSE.txt)
5
+ *
6
+ * See README.md for usage and integration instructions.
7
+ */
8
+
9
+/*
10
+ * HTML element utility functions
11
+ */
12
+
13
+export function clientToElement(x, y, elem) {
14
+ const bounds = elem.getBoundingClientRect();
15
+ let pos = { x: 0, y: 0 };
16
+ // Clip to target bounds
17
+ if (x < bounds.left) {
18
+ pos.x = 0;
19
+ } else if (x >= bounds.right) {
20
+ pos.x = bounds.width - 1;
21
+ } else {
22
+ pos.x = x - bounds.left;
23
+ }
24
+ if (y < bounds.top) {
25
+ pos.y = 0;
26
+ } else if (y >= bounds.bottom) {
27
+ pos.y = bounds.height - 1;
28
+ } else {
29
+ pos.y = y - bounds.top;
30
+ }
31
+ return pos;
32
+}
public/novnc/core/util/events.js
+46
-47
@@ -21,7 +21,8 @@ export function stopEvent(e) {
21
22
// Emulate Element.setCapture() when not supported
23
let _captureRecursion = false;
24
-let _captureElem = null;
24
+let _elementForUnflushedEvents = null;
25
+document.captureElement = null;
26
function _captureProxy(e) {
27
// Recursion protection as we'll see our own event
28
if (_captureRecursion) return;
@@ -30,7 +31,11 @@ function _captureProxy(e) {
31
const newEv = new e.constructor(e.type, e);
32
33
_captureRecursion = true;
33
- _captureElem.dispatchEvent(newEv);
34
+ if (document.captureElement) {
35
+ document.captureElement.dispatchEvent(newEv);
36
+ } else {
37
+ _elementForUnflushedEvents.dispatchEvent(newEv);
38
+ }
39
_captureRecursion = false;
40
41
// Avoid double events
@@ -48,58 +53,52 @@ function _captureProxy(e) {
53
}
54
55
// Follow cursor style of target element
51
-function _captureElemChanged() {
52
- const captureElem = document.getElementById("noVNC_mouse_capture_elem");
53
- captureElem.style.cursor = window.getComputedStyle(_captureElem).cursor;
56
+function _capturedElemChanged() {
57
+ const proxyElem = document.getElementById("noVNC_mouse_capture_elem");
58
+ proxyElem.style.cursor = window.getComputedStyle(document.captureElement).cursor;
59
}
60
56
-const _captureObserver = new MutationObserver(_captureElemChanged);
57
-
58
-let _captureIndex = 0;
59
-
60
-export function setCapture(elem) {
61
- if (elem.setCapture) {
62
-
63
- elem.setCapture();
61
+const _captureObserver = new MutationObserver(_capturedElemChanged);
62
65
- // IE releases capture on 'click' events which might not trigger
66
- elem.addEventListener('mouseup', releaseCapture);
63
+export function setCapture(target) {
64
+ if (target.setCapture) {
65
66
+ target.setCapture();
67
+ document.captureElement = target;
68
} else {
69
// Release any existing capture in case this method is
70
// called multiple times without coordination
71
releaseCapture();
72
73
- let captureElem = document.getElementById("noVNC_mouse_capture_elem");
73
+ let proxyElem = document.getElementById("noVNC_mouse_capture_elem");
74
75
- if (captureElem === null) {
76
- captureElem = document.createElement("div");
77
- captureElem.id = "noVNC_mouse_capture_elem";
78
- captureElem.style.position = "fixed";
79
- captureElem.style.top = "0px";
80
- captureElem.style.left = "0px";
81
- captureElem.style.width = "100%";
82
- captureElem.style.height = "100%";
83
- captureElem.style.zIndex = 10000;
84
- captureElem.style.display = "none";
85
- document.body.appendChild(captureElem);
75
+ if (proxyElem === null) {
76
+ proxyElem = document.createElement("div");
77
+ proxyElem.id = "noVNC_mouse_capture_elem";
78
+ proxyElem.style.position = "fixed";
79
+ proxyElem.style.top = "0px";
80
+ proxyElem.style.left = "0px";
81
+ proxyElem.style.width = "100%";
82
+ proxyElem.style.height = "100%";
83
+ proxyElem.style.zIndex = 10000;
84
+ proxyElem.style.display = "none";
85
+ document.body.appendChild(proxyElem);
86
87
// This is to make sure callers don't get confused by having
88
// our blocking element as the target
89
- captureElem.addEventListener('contextmenu', _captureProxy);
89
+ proxyElem.addEventListener('contextmenu', _captureProxy);
90
91
- captureElem.addEventListener('mousemove', _captureProxy);
92
- captureElem.addEventListener('mouseup', _captureProxy);
91
+ proxyElem.addEventListener('mousemove', _captureProxy);
92
+ proxyElem.addEventListener('mouseup', _captureProxy);
93
}
94
95
- _captureElem = elem;
96
- _captureIndex++;
95
+ document.captureElement = target;
96
97
// Track cursor and get initial cursor
99
- _captureObserver.observe(elem, {attributes: true});
100
- _captureElemChanged();
98
+ _captureObserver.observe(target, {attributes: true});
99
+ _capturedElemChanged();
100
102
- captureElem.style.display = "";
101
+ proxyElem.style.display = "";
102
103
// We listen to events on window in order to keep tracking if it
104
// happens to leave the viewport
@@ -112,26 +111,26 @@ export function releaseCapture() {
111
if (document.releaseCapture) {
112
113
document.releaseCapture();
114
+ document.captureElement = null;
115
116
} else {
117
- if (!_captureElem) {
117
+ if (!document.captureElement) {
118
return;
119
}
120
121
- // There might be events already queued, so we need to wait for
122
- // them to flush. E.g. contextmenu in Microsoft Edge
123
- window.setTimeout((expected) => {
124
- // Only clear it if it's the expected grab (i.e. no one
125
- // else has initiated a new grab)
126
- if (_captureIndex === expected) {
127
- _captureElem = null;
128
- }
129
- }, 0, _captureIndex);
121
+ // There might be events already queued. The event proxy needs
122
+ // access to the captured element for these queued events.
123
+ // E.g. contextmenu (right-click) in Microsoft Edge
124
+ //
125
+ // Before removing the capturedElem pointer we save it to a
126
+ // temporary variable that the unflushed events can use.
127
+ _elementForUnflushedEvents = document.captureElement;
128
+ document.captureElement = null;
129
130
_captureObserver.disconnect();
131
133
- const captureElem = document.getElementById("noVNC_mouse_capture_elem");
134
- captureElem.style.display = "none";
132
+ const proxyElem = document.getElementById("noVNC_mouse_capture_elem");
133
+ proxyElem.style.display = "none";
134
135
window.removeEventListener('mousemove', _captureProxy);
136
window.removeEventListener('mouseup', _captureProxy);
public/novnc/core/util/eventtarget.js
+1
-1
@@ -1,6 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
public/novnc/core/util/int.js
new
+15
@@ -0,0 +1,15 @@
1
+/*
2
+ * noVNC: HTML5 VNC client
3
+ * Copyright (C) 2020 The noVNC Authors
4
+ * Licensed under MPL 2.0 (see LICENSE.txt)
5
+ *
6
+ * See README.md for usage and integration instructions.
7
+ */
8
+
9
+export function toUnsigned32bit(toConvert) {
10
+ return toConvert >>> 0;
11
+}
12
+
13
+export function toSigned32bit(toConvert) {
14
+ return toConvert | 0;
15
+}
public/novnc/core/util/logging.js
+8
-8
@@ -1,6 +1,6 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
@@ -10,18 +10,18 @@
10
* Logging/debug routines
11
*/
12
13
-let _log_level = 'warn';
13
+let _logLevel = 'warn';
14
15
let Debug = () => {};
16
let Info = () => {};
17
let Warn = () => {};
18
let Error = () => {};
19
20
-export function init_logging(level) {
20
+export function initLogging(level) {
21
if (typeof level === 'undefined') {
22
- level = _log_level;
22
+ level = _logLevel;
23
} else {
24
- _log_level = level;
24
+ _logLevel = level;
25
}
26
27
Debug = Info = Warn = Error = () => {};
@@ -46,11 +46,11 @@ export function init_logging(level) {
46
}
47
}
48
49
-export function get_logging() {
50
- return _log_level;
49
+export function getLogging() {
50
+ return _logLevel;
51
}
52
53
export { Debug, Info, Warn, Error };
54
55
// Initialize logging level
56
-init_logging();
56
+initLogging();
public/novnc/core/util/polyfill.js
deleted
-54
@@ -1,54 +0,0 @@
1
-/*
2
- * noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
4
- * Licensed under MPL 2.0 or any later version (see LICENSE.txt)
5
- */
6
-
7
-/* Polyfills to provide new APIs in old browsers */
8
-
9
-/* Object.assign() (taken from MDN) */
10
-if (typeof Object.assign != 'function') {
11
- // Must be writable: true, enumerable: false, configurable: true
12
- Object.defineProperty(Object, "assign", {
13
- value: function assign(target, varArgs) { // .length of function is 2
14
- 'use strict';
15
- if (target == null) { // TypeError if undefined or null
16
- throw new TypeError('Cannot convert undefined or null to object');
17
- }
18
-
19
- const to = Object(target);
20
-
21
- for (let index = 1; index < arguments.length; index++) {
22
- const nextSource = arguments[index];
23
-
24
- if (nextSource != null) { // Skip over if undefined or null
25
- for (let nextKey in nextSource) {
26
- // Avoid bugs when hasOwnProperty is shadowed
27
- if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
28
- to[nextKey] = nextSource[nextKey];
29
- }
30
- }
31
- }
32
- }
33
- return to;
34
- },
35
- writable: true,
36
- configurable: true
37
- });
38
-}
39
-
40
-/* CustomEvent constructor (taken from MDN) */
41
-(() => {
42
- function CustomEvent(event, params) {
43
- params = params || { bubbles: false, cancelable: false, detail: undefined };
44
- const evt = document.createEvent( 'CustomEvent' );
45
- evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
46
- return evt;
47
- }
48
-
49
- CustomEvent.prototype = window.Event.prototype;
50
-
51
- if (typeof window.CustomEvent !== "function") {
52
- window.CustomEvent = CustomEvent;
53
- }
54
-})();
public/novnc/core/util/strings.js
+20
-6
@@ -1,14 +1,28 @@
1
/*
2
* noVNC: HTML5 VNC client
3
- * Copyright (C) 2018 The noVNC Authors
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
* See README.md for usage and integration instructions.
7
*/
8
9
-/*
10
- * Decode from UTF-8
11
- */
12
-export function decodeUTF8(utf8string) {
13
- return decodeURIComponent(escape(utf8string));
9
+// Decode from UTF-8
10
+export function decodeUTF8(utf8string, allowLatin1=false) {
11
+ try {
12
+ return decodeURIComponent(escape(utf8string));
13
+ } catch (e) {
14
+ if (e instanceof URIError) {
15
+ if (allowLatin1) {
16
+ // If we allow Latin1 we can ignore any decoding fails
17
+ // and in these cases return the original string
18
+ return utf8string;
19
+ }
20
+ }
21
+ throw e;
22
+ }
23
+}
24
+
25
+// Encode to UTF-8
26
+export function encodeUTF8(DOMString) {
27
+ return unescape(encodeURIComponent(DOMString));
28
}
public/novnc/core/websock.js
+107
-44
@@ -1,10 +1,10 @@
1
/*
2
- * Websock: high-performance binary WebSockets
3
- * Copyright (C) 2018 The noVNC Authors
2
+ * Websock: high-performance buffering wrapper
3
+ * Copyright (C) 2019 The noVNC Authors
4
* Licensed under MPL 2.0 (see LICENSE.txt)
5
*
6
- * Websock is similar to the standard WebSocket object but with extra
7
- * buffer handling.
6
+ * Websock is similar to the standard WebSocket / RTCDataChannel object
7
+ * but with extra buffer handling.
8
*
9
* Websock has built-in receive queue buffering; the message event
10
* does not contain actual data but is simply a notification that
@@ -17,17 +17,43 @@ import * as Log from './util/logging.js';
17
// this has performance issues in some versions Chromium, and
18
// doesn't gain a tremendous amount of performance increase in Firefox
19
// at the moment. It may be valuable to turn it on in the future.
20
-const ENABLE_COPYWITHIN = false;
20
const MAX_RQ_GROW_SIZE = 40 * 1024 * 1024; // 40 MiB
21
22
+// Constants pulled from RTCDataChannelState enum
23
+// https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState#RTCDataChannelState_enum
24
+const DataChannel = {
25
+ CONNECTING: "connecting",
26
+ OPEN: "open",
27
+ CLOSING: "closing",
28
+ CLOSED: "closed"
29
+};
30
+
31
+const ReadyStates = {
32
+ CONNECTING: [WebSocket.CONNECTING, DataChannel.CONNECTING],
33
+ OPEN: [WebSocket.OPEN, DataChannel.OPEN],
34
+ CLOSING: [WebSocket.CLOSING, DataChannel.CLOSING],
35
+ CLOSED: [WebSocket.CLOSED, DataChannel.CLOSED],
36
+};
37
+
38
+// Properties a raw channel must have, WebSocket and RTCDataChannel are two examples
39
+const rawChannelProps = [
40
+ "send",
41
+ "close",
42
+ "binaryType",
43
+ "onerror",
44
+ "onmessage",
45
+ "onopen",
46
+ "protocol",
47
+ "readyState",
48
+];
49
+
50
export default class Websock {
51
constructor() {
25
- this._websocket = null; // WebSocket object
52
+ this._websocket = null; // WebSocket or RTCDataChannel object
53
54
this._rQi = 0; // Receive queue index
55
this._rQlen = 0; // Next write position in the receive queue
56
this._rQbufferSize = 1024 * 1024 * 4; // Receive queue buffer size (4 MiB)
30
- this._rQmax = this._rQbufferSize / 8;
57
// called in init: this._rQ = new Uint8Array(this._rQbufferSize);
58
this._rQ = null; // Receive queue
59
@@ -45,6 +71,29 @@ export default class Websock {
71
}
72
73
// Getters and Setters
74
+
75
+ get readyState() {
76
+ let subState;
77
+
78
+ if (this._websocket === null) {
79
+ return "unused";
80
+ }
81
+
82
+ subState = this._websocket.readyState;
83
+
84
+ if (ReadyStates.CONNECTING.includes(subState)) {
85
+ return "connecting";
86
+ } else if (ReadyStates.OPEN.includes(subState)) {
87
+ return "open";
88
+ } else if (ReadyStates.CLOSING.includes(subState)) {
89
+ return "closing";
90
+ } else if (ReadyStates.CLOSED.includes(subState)) {
91
+ return "closed";
92
+ }
93
+
94
+ return "unknown";
95
+ }
96
+
97
get sQ() {
98
return this._sQ;
99
}
@@ -142,8 +191,8 @@ export default class Websock {
191
// Send Queue
192
193
flush() {
145
- if (this._sQlen > 0 && this._websocket.readyState === WebSocket.OPEN) {
146
- this._websocket.send(this._encode_message());
194
+ if (this._sQlen > 0 && this.readyState === 'open') {
195
+ this._websocket.send(this._encodeMessage());
196
this._sQlen = 0;
197
}
198
}
@@ -154,7 +203,7 @@ export default class Websock {
203
this.flush();
204
}
205
157
- send_string(str) {
206
+ sendString(str) {
207
this.send(str.split('').map(chr => chr.charCodeAt(0)));
208
}
209
@@ -167,24 +216,37 @@ export default class Websock {
216
this._eventHandlers[evt] = handler;
217
}
218
170
- _allocate_buffers() {
219
+ _allocateBuffers() {
220
this._rQ = new Uint8Array(this._rQbufferSize);
221
this._sQ = new Uint8Array(this._sQbufferSize);
222
}
223
224
init() {
176
- this._allocate_buffers();
225
+ this._allocateBuffers();
226
this._rQi = 0;
227
this._websocket = null;
228
}
229
230
open(uri, protocols) {
231
+ this.attach(new WebSocket(uri, protocols));
232
+ }
233
+
234
+ attach(rawChannel) {
235
this.init();
236
184
- this._websocket = new WebSocket(uri, protocols);
185
- this._websocket.binaryType = 'arraybuffer';
237
+ // Must get object and class methods to be compatible with the tests.
238
+ const channelProps = [...Object.keys(rawChannel), ...Object.getOwnPropertyNames(Object.getPrototypeOf(rawChannel))];
239
+ for (let i = 0; i < rawChannelProps.length; i++) {
240
+ const prop = rawChannelProps[i];
241
+ if (channelProps.indexOf(prop) < 0) {
242
+ throw new Error('Raw channel missing property: ' + prop);
243
+ }
244
+ }
245
+
246
+ this._websocket = rawChannel;
247
+ this._websocket.binaryType = "arraybuffer";
248
+ this._websocket.onmessage = this._recvMessage.bind(this);
249
187
- this._websocket.onmessage = this._recv_message.bind(this);
250
this._websocket.onopen = () => {
251
Log.Debug('>> WebSock.onopen');
252
if (this._websocket.protocol) {
@@ -194,11 +256,13 @@ export default class Websock {
256
this._eventHandlers.open();
257
Log.Debug("<< WebSock.onopen");
258
};
259
+
260
this._websocket.onclose = (e) => {
261
Log.Debug(">> WebSock.onclose");
262
this._eventHandlers.close(e);
263
Log.Debug("<< WebSock.onclose");
264
};
265
+
266
this._websocket.onerror = (e) => {
267
Log.Debug(">> WebSock.onerror: " + e);
268
this._eventHandlers.error(e);
@@ -208,8 +272,8 @@ export default class Websock {
272
273
close() {
274
if (this._websocket) {
211
- if ((this._websocket.readyState === WebSocket.OPEN) ||
212
- (this._websocket.readyState === WebSocket.CONNECTING)) {
275
+ if (this.readyState === 'connecting' ||
276
+ this.readyState === 'open') {
277
Log.Info("Closing WebSocket connection");
278
this._websocket.close();
279
}
@@ -219,69 +283,68 @@ export default class Websock {
283
}
284
285
// private methods
222
- _encode_message() {
286
+ _encodeMessage() {
287
// Put in a binary arraybuffer
288
// according to the spec, you can send ArrayBufferViews with the send method
289
return new Uint8Array(this._sQ.buffer, 0, this._sQlen);
290
}
291
228
- _expand_compact_rQ(min_fit) {
229
- const resizeNeeded = min_fit || this.rQlen > this._rQbufferSize / 2;
292
+ // We want to move all the unread data to the start of the queue,
293
+ // e.g. compacting.
294
+ // The function also expands the receive que if needed, and for
295
+ // performance reasons we combine these two actions to avoid
296
+ // unneccessary copying.
297
+ _expandCompactRQ(minFit) {
298
+ // if we're using less than 1/8th of the buffer even with the incoming bytes, compact in place
299
+ // instead of resizing
300
+ const requiredBufferSize = (this._rQlen - this._rQi + minFit) * 8;
301
+ const resizeNeeded = this._rQbufferSize < requiredBufferSize;
302
+
303
if (resizeNeeded) {
231
- if (!min_fit) {
232
- // just double the size if we need to do compaction
233
- this._rQbufferSize *= 2;
234
- } else {
235
- // otherwise, make sure we satisy rQlen - rQi + min_fit < rQbufferSize / 8
236
- this._rQbufferSize = (this.rQlen + min_fit) * 8;
237
- }
304
+ // Make sure we always *at least* double the buffer size, and have at least space for 8x
305
+ // the current amount of data
306
+ this._rQbufferSize = Math.max(this._rQbufferSize * 2, requiredBufferSize);
307
}
308
309
// we don't want to grow unboundedly
310
if (this._rQbufferSize > MAX_RQ_GROW_SIZE) {
311
this._rQbufferSize = MAX_RQ_GROW_SIZE;
243
- if (this._rQbufferSize - this.rQlen < min_fit) {
312
+ if (this._rQbufferSize - this.rQlen < minFit) {
313
throw new Error("Receive Queue buffer exceeded " + MAX_RQ_GROW_SIZE + " bytes, and the new message could not fit");
314
}
315
}
316
317
if (resizeNeeded) {
249
- const old_rQbuffer = this._rQ.buffer;
250
- this._rQmax = this._rQbufferSize / 8;
318
+ const oldRQbuffer = this._rQ.buffer;
319
this._rQ = new Uint8Array(this._rQbufferSize);
252
- this._rQ.set(new Uint8Array(old_rQbuffer, this._rQi));
320
+ this._rQ.set(new Uint8Array(oldRQbuffer, this._rQi, this._rQlen - this._rQi));
321
} else {
254
- if (ENABLE_COPYWITHIN) {
255
- this._rQ.copyWithin(0, this._rQi);
256
- } else {
257
- this._rQ.set(new Uint8Array(this._rQ.buffer, this._rQi));
258
- }
322
+ this._rQ.copyWithin(0, this._rQi, this._rQlen);
323
}
324
325
this._rQlen = this._rQlen - this._rQi;
326
this._rQi = 0;
327
}
328
265
- _decode_message(data) {
266
- // push arraybuffer values onto the end
329
+ // push arraybuffer values onto the end of the receive que
330
+ _DecodeMessage(data) {
331
const u8 = new Uint8Array(data);
332
if (u8.length > this._rQbufferSize - this._rQlen) {
269
- this._expand_compact_rQ(u8.length);
333
+ this._expandCompactRQ(u8.length);
334
}
335
this._rQ.set(u8, this._rQlen);
336
this._rQlen += u8.length;
337
}
338
275
- _recv_message(e) {
276
- this._decode_message(e.data);
339
+ _recvMessage(e) {
340
+ this._DecodeMessage(e.data);
341
if (this.rQlen > 0) {
342
this._eventHandlers.message();
279
- // Compact the receive queue
343
if (this._rQlen == this._rQi) {
344
+ // All data has now been processed, this means we
345
+ // can reset the receive queue.
346
this._rQlen = 0;
347
this._rQi = 0;
283
- } else if (this._rQlen > this._rQmax) {
284
- this._expand_compact_rQ();
348
}
349
} else {
350
Log.Debug("Ignoring empty message");
public/novnc/vendor/browser-es-module-loader/README.md
deleted
-15
@@ -1,15 +0,0 @@
1
-Custom Browser ES Module Loader
2
-===============================
3
-
4
-This is a module loader using babel and the ES Module Loader polyfill.
5
-It's based heavily on
6
-https://github.com/ModuleLoader/browser-es-module-loader, but uses
7
-WebWorkers to compile the modules in the background.
8
-
9
-To generate, run `rollup -c` in this directory, and then run `browserify
10
-src/babel-worker.js > dist/babel-worker.js`.
11
-
12
-LICENSE
13
--------
14
-
15
-MIT
public/novnc/vendor/browser-es-module-loader/dist/babel-worker.js
deleted
-55799
@@ -1,55799 +0,0 @@
1
-(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
-'use strict';
3
-module.exports = function () {
4
- return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
5
-};
6
-
7
-},{}],2:[function(require,module,exports){
8
-'use strict';
9
-
10
-function assembleStyles () {
11
- var styles = {
12
- modifiers: {
13
- reset: [0, 0],
14
- bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
15
- dim: [2, 22],
16
- italic: [3, 23],
17
- underline: [4, 24],
18
- inverse: [7, 27],
19
- hidden: [8, 28],
20
- strikethrough: [9, 29]
21
- },
22
- colors: {
23
- black: [30, 39],
24
- red: [31, 39],
25
- green: [32, 39],
26
- yellow: [33, 39],
27
- blue: [34, 39],
28
- magenta: [35, 39],
29
- cyan: [36, 39],
30
- white: [37, 39],
31
- gray: [90, 39]
32
- },
33
- bgColors: {
34
- bgBlack: [40, 49],
35
- bgRed: [41, 49],
36
- bgGreen: [42, 49],
37
- bgYellow: [43, 49],
38
- bgBlue: [44, 49],
39
- bgMagenta: [45, 49],
40
- bgCyan: [46, 49],
41
- bgWhite: [47, 49]
42
- }
43
- };
44
-
45
- // fix humans
46
- styles.colors.grey = styles.colors.gray;
47
-
48
- Object.keys(styles).forEach(function (groupName) {
49
- var group = styles[groupName];
50
-
51
- Object.keys(group).forEach(function (styleName) {
52
- var style = group[styleName];
53
-
54
- styles[styleName] = group[styleName] = {
55
- open: '\u001b[' + style[0] + 'm',
56
- close: '\u001b[' + style[1] + 'm'
57
- };
58
- });
59
-
60
- Object.defineProperty(styles, groupName, {
61
- value: group,
62
- enumerable: false
63
- });
64
- });
65
-
66
- return styles;
67
-}
68
-
69
-Object.defineProperty(module, 'exports', {
70
- enumerable: true,
71
- get: assembleStyles
72
-});
73
-
74
-},{}],3:[function(require,module,exports){
75
-(function (global){
76
-'use strict';
77
-
78
-// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
79
-// original notice:
80
-
81
-/*!
82
- * The buffer module from node.js, for the browser.
83
- *
84
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
85
- * @license MIT
86
- */
87
-function compare(a, b) {
88
- if (a === b) {
89
- return 0;
90
- }
91
-
92
- var x = a.length;
93
- var y = b.length;
94
-
95
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
96
- if (a[i] !== b[i]) {
97
- x = a[i];
98
- y = b[i];
99
- break;
100
- }
101
- }
102
-
103
- if (x < y) {
104
- return -1;
105
- }
106
- if (y < x) {
107
- return 1;
108
- }
109
- return 0;
110
-}
111
-function isBuffer(b) {
112
- if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
113
- return global.Buffer.isBuffer(b);
114
- }
115
- return !!(b != null && b._isBuffer);
116
-}
117
-
118
-// based on node assert, original notice:
119
-
120
-// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
121
-//
122
-// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
123
-//
124
-// Originally from narwhal.js (http://narwhaljs.org)
125
-// Copyright (c) 2009 Thomas Robinson <280north.com>
126
-//
127
-// Permission is hereby granted, free of charge, to any person obtaining a copy
128
-// of this software and associated documentation files (the 'Software'), to
129
-// deal in the Software without restriction, including without limitation the
130
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
131
-// sell copies of the Software, and to permit persons to whom the Software is
132
-// furnished to do so, subject to the following conditions:
133
-//
134
-// The above copyright notice and this permission notice shall be included in
135
-// all copies or substantial portions of the Software.
136
-//
137
-// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
138
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
139
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
140
-// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
141
-// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
142
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
143
-
144
-var util = require('util/');
145
-var hasOwn = Object.prototype.hasOwnProperty;
146
-var pSlice = Array.prototype.slice;
147
-var functionsHaveNames = (function () {
148
- return function foo() {}.name === 'foo';
149
-}());
150
-function pToString (obj) {
151
- return Object.prototype.toString.call(obj);
152
-}
153
-function isView(arrbuf) {
154
- if (isBuffer(arrbuf)) {
155
- return false;
156
- }
157
- if (typeof global.ArrayBuffer !== 'function') {
158
- return false;
159
- }
160
- if (typeof ArrayBuffer.isView === 'function') {
161
- return ArrayBuffer.isView(arrbuf);
162
- }
163
- if (!arrbuf) {
164
- return false;
165
- }
166
- if (arrbuf instanceof DataView) {
167
- return true;
168
- }
169
- if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
170
- return true;
171
- }
172
- return false;
173
-}
174
-// 1. The assert module provides functions that throw
175
-// AssertionError's when particular conditions are not met. The
176
-// assert module must conform to the following interface.
177
-
178
-var assert = module.exports = ok;
179
-
180
-// 2. The AssertionError is defined in assert.
181
-// new assert.AssertionError({ message: message,
182
-// actual: actual,
183
-// expected: expected })
184
-
185
-var regex = /\s*function\s+([^\(\s]*)\s*/;
186
-// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
187
-function getName(func) {
188
- if (!util.isFunction(func)) {
189
- return;
190
- }
191
- if (functionsHaveNames) {
192
- return func.name;
193
- }
194
- var str = func.toString();
195
- var match = str.match(regex);
196
- return match && match[1];
197
-}
198
-assert.AssertionError = function AssertionError(options) {
199
- this.name = 'AssertionError';
200
- this.actual = options.actual;
201
- this.expected = options.expected;
202
- this.operator = options.operator;
203
- if (options.message) {
204
- this.message = options.message;
205
- this.generatedMessage = false;
206
- } else {
207
- this.message = getMessage(this);
208
- this.generatedMessage = true;
209
- }
210
- var stackStartFunction = options.stackStartFunction || fail;
211
- if (Error.captureStackTrace) {
212
- Error.captureStackTrace(this, stackStartFunction);
213
- } else {
214
- // non v8 browsers so we can have a stacktrace
215
- var err = new Error();
216
- if (err.stack) {
217
- var out = err.stack;
218
-
219
- // try to strip useless frames
220
- var fn_name = getName(stackStartFunction);
221
- var idx = out.indexOf('\n' + fn_name);
222
- if (idx >= 0) {
223
- // once we have located the function frame
224
- // we need to strip out everything before it (and its line)
225
- var next_line = out.indexOf('\n', idx + 1);
226
- out = out.substring(next_line + 1);
227
- }
228
-
229
- this.stack = out;
230
- }
231
- }
232
-};
233
-
234
-// assert.AssertionError instanceof Error
235
-util.inherits(assert.AssertionError, Error);
236
-
237
-function truncate(s, n) {
238
- if (typeof s === 'string') {
239
- return s.length < n ? s : s.slice(0, n);
240
- } else {
241
- return s;
242
- }
243
-}
244
-function inspect(something) {
245
- if (functionsHaveNames || !util.isFunction(something)) {
246
- return util.inspect(something);
247
- }
248
- var rawname = getName(something);
249
- var name = rawname ? ': ' + rawname : '';
250
- return '[Function' + name + ']';
251
-}
252
-function getMessage(self) {
253
- return truncate(inspect(self.actual), 128) + ' ' +
254
- self.operator + ' ' +
255
- truncate(inspect(self.expected), 128);
256
-}
257
-
258
-// At present only the three keys mentioned above are used and
259
-// understood by the spec. Implementations or sub modules can pass
260
-// other keys to the AssertionError's constructor - they will be
261
-// ignored.
262
-
263
-// 3. All of the following functions must throw an AssertionError
264
-// when a corresponding condition is not met, with a message that
265
-// may be undefined if not provided. All assertion methods provide
266
-// both the actual and expected values to the assertion error for
267
-// display purposes.
268
-
269
-function fail(actual, expected, message, operator, stackStartFunction) {
270
- throw new assert.AssertionError({
271
- message: message,
272
- actual: actual,
273
- expected: expected,
274
- operator: operator,
275
- stackStartFunction: stackStartFunction
276
- });
277
-}
278
-
279
-// EXTENSION! allows for well behaved errors defined elsewhere.
280
-assert.fail = fail;
281
-
282
-// 4. Pure assertion tests whether a value is truthy, as determined
283
-// by !!guard.
284
-// assert.ok(guard, message_opt);
285
-// This statement is equivalent to assert.equal(true, !!guard,
286
-// message_opt);. To test strictly for the value true, use
287
-// assert.strictEqual(true, guard, message_opt);.
288
-
289
-function ok(value, message) {
290
- if (!value) fail(value, true, message, '==', assert.ok);
291
-}
292
-assert.ok = ok;
293
-
294
-// 5. The equality assertion tests shallow, coercive equality with
295
-// ==.
296
-// assert.equal(actual, expected, message_opt);
297
-
298
-assert.equal = function equal(actual, expected, message) {
299
- if (actual != expected) fail(actual, expected, message, '==', assert.equal);
300
-};
301
-
302
-// 6. The non-equality assertion tests for whether two objects are not equal
303
-// with != assert.notEqual(actual, expected, message_opt);
304
-
305
-assert.notEqual = function notEqual(actual, expected, message) {
306
- if (actual == expected) {
307
- fail(actual, expected, message, '!=', assert.notEqual);
308
- }
309
-};
310
-
311
-// 7. The equivalence assertion tests a deep equality relation.
312
-// assert.deepEqual(actual, expected, message_opt);
313
-
314
-assert.deepEqual = function deepEqual(actual, expected, message) {
315
- if (!_deepEqual(actual, expected, false)) {
316
- fail(actual, expected, message, 'deepEqual', assert.deepEqual);
317
- }
318
-};
319
-
320
-assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
321
- if (!_deepEqual(actual, expected, true)) {
322
- fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
323
- }
324
-};
325
-
326
-function _deepEqual(actual, expected, strict, memos) {
327
- // 7.1. All identical values are equivalent, as determined by ===.
328
- if (actual === expected) {
329
- return true;
330
- } else if (isBuffer(actual) && isBuffer(expected)) {
331
- return compare(actual, expected) === 0;
332
-
333
- // 7.2. If the expected value is a Date object, the actual value is
334
- // equivalent if it is also a Date object that refers to the same time.
335
- } else if (util.isDate(actual) && util.isDate(expected)) {
336
- return actual.getTime() === expected.getTime();
337
-
338
- // 7.3 If the expected value is a RegExp object, the actual value is
339
- // equivalent if it is also a RegExp object with the same source and
340
- // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
341
- } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
342
- return actual.source === expected.source &&
343
- actual.global === expected.global &&
344
- actual.multiline === expected.multiline &&
345
- actual.lastIndex === expected.lastIndex &&
346
- actual.ignoreCase === expected.ignoreCase;
347
-
348
- // 7.4. Other pairs that do not both pass typeof value == 'object',
349
- // equivalence is determined by ==.
350
- } else if ((actual === null || typeof actual !== 'object') &&
351
- (expected === null || typeof expected !== 'object')) {
352
- return strict ? actual === expected : actual == expected;
353
-
354
- // If both values are instances of typed arrays, wrap their underlying
355
- // ArrayBuffers in a Buffer each to increase performance
356
- // This optimization requires the arrays to have the same type as checked by
357
- // Object.prototype.toString (aka pToString). Never perform binary
358
- // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
359
- // bit patterns are not identical.
360
- } else if (isView(actual) && isView(expected) &&
361
- pToString(actual) === pToString(expected) &&
362
- !(actual instanceof Float32Array ||
363
- actual instanceof Float64Array)) {
364
- return compare(new Uint8Array(actual.buffer),
365
- new Uint8Array(expected.buffer)) === 0;
366
-
367
- // 7.5 For all other Object pairs, including Array objects, equivalence is
368
- // determined by having the same number of owned properties (as verified
369
- // with Object.prototype.hasOwnProperty.call), the same set of keys
370
- // (although not necessarily the same order), equivalent values for every
371
- // corresponding key, and an identical 'prototype' property. Note: this
372
- // accounts for both named and indexed properties on Arrays.
373
- } else if (isBuffer(actual) !== isBuffer(expected)) {
374
- return false;
375
- } else {
376
- memos = memos || {actual: [], expected: []};
377
-
378
- var actualIndex = memos.actual.indexOf(actual);
379
- if (actualIndex !== -1) {
380
- if (actualIndex === memos.expected.indexOf(expected)) {
381
- return true;
382
- }
383
- }
384
-
385
- memos.actual.push(actual);
386
- memos.expected.push(expected);
387
-
388
- return objEquiv(actual, expected, strict, memos);
389
- }
390
-}
391
-
392
-function isArguments(object) {
393
- return Object.prototype.toString.call(object) == '[object Arguments]';
394
-}
395
-
396
-function objEquiv(a, b, strict, actualVisitedObjects) {
397
- if (a === null || a === undefined || b === null || b === undefined)
398
- return false;
399
- // if one is a primitive, the other must be same
400
- if (util.isPrimitive(a) || util.isPrimitive(b))
401
- return a === b;
402
- if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
403
- return false;
404
- var aIsArgs = isArguments(a);
405
- var bIsArgs = isArguments(b);
406
- if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
407
- return false;
408
- if (aIsArgs) {
409
- a = pSlice.call(a);
410
- b = pSlice.call(b);
411
- return _deepEqual(a, b, strict);
412
- }
413
- var ka = objectKeys(a);
414
- var kb = objectKeys(b);
415
- var key, i;
416
- // having the same number of owned properties (keys incorporates
417
- // hasOwnProperty)
418
- if (ka.length !== kb.length)
419
- return false;
420
- //the same set of keys (although not necessarily the same order),
421
- ka.sort();
422
- kb.sort();
423
- //~~~cheap key test
424
- for (i = ka.length - 1; i >= 0; i--) {
425
- if (ka[i] !== kb[i])
426
- return false;
427
- }
428
- //equivalent values for every corresponding key, and
429
- //~~~possibly expensive deep test
430
- for (i = ka.length - 1; i >= 0; i--) {
431
- key = ka[i];
432
- if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
433
- return false;
434
- }
435
- return true;
436
-}
437
-
438
-// 8. The non-equivalence assertion tests for any deep inequality.
439
-// assert.notDeepEqual(actual, expected, message_opt);
440
-
441
-assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
442
- if (_deepEqual(actual, expected, false)) {
443
- fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
444
- }
445
-};
446
-
447
-assert.notDeepStrictEqual = notDeepStrictEqual;
448
-function notDeepStrictEqual(actual, expected, message) {
449
- if (_deepEqual(actual, expected, true)) {
450
- fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
451
- }
452
-}
453
-
454
-
455
-// 9. The strict equality assertion tests strict equality, as determined by ===.
456
-// assert.strictEqual(actual, expected, message_opt);
457
-
458
-assert.strictEqual = function strictEqual(actual, expected, message) {
459
- if (actual !== expected) {
460
- fail(actual, expected, message, '===', assert.strictEqual);
461
- }
462
-};
463
-
464
-// 10. The strict non-equality assertion tests for strict inequality, as
465
-// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
466
-
467
-assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
468
- if (actual === expected) {
469
- fail(actual, expected, message, '!==', assert.notStrictEqual);
470
- }
471
-};
472
-
473
-function expectedException(actual, expected) {
474
- if (!actual || !expected) {
475
- return false;
476
- }
477
-
478
- if (Object.prototype.toString.call(expected) == '[object RegExp]') {
479
- return expected.test(actual);
480
- }
481
-
482
- try {
483
- if (actual instanceof expected) {
484
- return true;
485
- }
486
- } catch (e) {
487
- // Ignore. The instanceof check doesn't work for arrow functions.
488
- }
489
-
490
- if (Error.isPrototypeOf(expected)) {
491
- return false;
492
- }
493
-
494
- return expected.call({}, actual) === true;
495
-}
496
-
497
-function _tryBlock(block) {
498
- var error;
499
- try {
500
- block();
501
- } catch (e) {
502
- error = e;
503
- }
504
- return error;
505
-}
506
-
507
-function _throws(shouldThrow, block, expected, message) {
508
- var actual;
509
-
510
- if (typeof block !== 'function') {
511
- throw new TypeError('"block" argument must be a function');
512
- }
513
-
514
- if (typeof expected === 'string') {
515
- message = expected;
516
- expected = null;
517
- }
518
-
519
- actual = _tryBlock(block);
520
-
521
- message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
522
- (message ? ' ' + message : '.');
523
-
524
- if (shouldThrow && !actual) {
525
- fail(actual, expected, 'Missing expected exception' + message);
526
- }
527
-
528
- var userProvidedMessage = typeof message === 'string';
529
- var isUnwantedException = !shouldThrow && util.isError(actual);
530
- var isUnexpectedException = !shouldThrow && actual && !expected;
531
-
532
- if ((isUnwantedException &&
533
- userProvidedMessage &&
534
- expectedException(actual, expected)) ||
535
- isUnexpectedException) {
536
- fail(actual, expected, 'Got unwanted exception' + message);
537
- }
538
-
539
- if ((shouldThrow && actual && expected &&
540
- !expectedException(actual, expected)) || (!shouldThrow && actual)) {
541
- throw actual;
542
- }
543
-}
544
-
545
-// 11. Expected to throw an error:
546
-// assert.throws(block, Error_opt, message_opt);
547
-
548
-assert.throws = function(block, /*optional*/error, /*optional*/message) {
549
- _throws(true, block, error, message);
550
-};
551
-
552
-// EXTENSION! This is annoying to write outside this module.
553
-assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
554
- _throws(false, block, error, message);
555
-};
556
-
557
-assert.ifError = function(err) { if (err) throw err; };
558
-
559
-var objectKeys = Object.keys || function (obj) {
560
- var keys = [];
561
- for (var key in obj) {
562
- if (hasOwn.call(obj, key)) keys.push(key);
563
- }
564
- return keys;
565
-};
566
-
567
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
568
-},{"util/":560}],4:[function(require,module,exports){
569
-"use strict";
570
-
571
-exports.__esModule = true;
572
-
573
-exports.default = function (rawLines, lineNumber, colNumber) {
574
- var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
575
-
576
- colNumber = Math.max(colNumber, 0);
577
-
578
- var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor;
579
- var chalk = _chalk2.default;
580
- if (opts.forceColor) {
581
- chalk = new _chalk2.default.constructor({ enabled: true });
582
- }
583
- var maybeHighlight = function maybeHighlight(chalkFn, string) {
584
- return highlighted ? chalkFn(string) : string;
585
- };
586
- var defs = getDefs(chalk);
587
- if (highlighted) rawLines = highlight(defs, rawLines);
588
-
589
- var linesAbove = opts.linesAbove || 2;
590
- var linesBelow = opts.linesBelow || 3;
591
-
592
- var lines = rawLines.split(NEWLINE);
593
- var start = Math.max(lineNumber - (linesAbove + 1), 0);
594
- var end = Math.min(lines.length, lineNumber + linesBelow);
595
-
596
- if (!lineNumber && !colNumber) {
597
- start = 0;
598
- end = lines.length;
599
- }
600
-
601
- var numberMaxWidth = String(end).length;
602
-
603
- var frame = lines.slice(start, end).map(function (line, index) {
604
- var number = start + 1 + index;
605
- var paddedNumber = (" " + number).slice(-numberMaxWidth);
606
- var gutter = " " + paddedNumber + " | ";
607
- if (number === lineNumber) {
608
- var markerLine = "";
609
- if (colNumber) {
610
- var markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " ");
611
- markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^")].join("");
612
- }
613
- return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
614
- } else {
615
- return " " + maybeHighlight(defs.gutter, gutter) + line;
616
- }
617
- }).join("\n");
618
-
619
- if (highlighted) {
620
- return chalk.reset(frame);
621
- } else {
622
- return frame;
623
- }
624
-};
625
-
626
-var _jsTokens = require("js-tokens");
627
-
628
-var _jsTokens2 = _interopRequireDefault(_jsTokens);
629
-
630
-var _esutils = require("esutils");
631
-
632
-var _esutils2 = _interopRequireDefault(_esutils);
633
-
634
-var _chalk = require("chalk");
635
-
636
-var _chalk2 = _interopRequireDefault(_chalk);
637
-
638
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
639
-
640
-function getDefs(chalk) {
641
- return {
642
- keyword: chalk.cyan,
643
- capitalized: chalk.yellow,
644
- jsx_tag: chalk.yellow,
645
- punctuator: chalk.yellow,
646
-
647
- number: chalk.magenta,
648
- string: chalk.green,
649
- regex: chalk.magenta,
650
- comment: chalk.grey,
651
- invalid: chalk.white.bgRed.bold,
652
- gutter: chalk.grey,
653
- marker: chalk.red.bold
654
- };
655
-}
656
-
657
-var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
658
-
659
-var JSX_TAG = /^[a-z][\w-]*$/i;
660
-
661
-var BRACKET = /^[()\[\]{}]$/;
662
-
663
-function getTokenType(match) {
664
- var _match$slice = match.slice(-2),
665
- offset = _match$slice[0],
666
- text = _match$slice[1];
667
-
668
- var token = (0, _jsTokens.matchToToken)(match);
669
-
670
- if (token.type === "name") {
671
- if (_esutils2.default.keyword.isReservedWordES6(token.value)) {
672
- return "keyword";
673
- }
674
-
675
- if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
676
- return "jsx_tag";
677
- }
678
-
679
- if (token.value[0] !== token.value[0].toLowerCase()) {
680
- return "capitalized";
681
- }
682
- }
683
-
684
- if (token.type === "punctuator" && BRACKET.test(token.value)) {
685
- return "bracket";
686
- }
687
-
688
- return token.type;
689
-}
690
-
691
-function highlight(defs, text) {
692
- return text.replace(_jsTokens2.default, function () {
693
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
694
- args[_key] = arguments[_key];
695
- }
696
-
697
- var type = getTokenType(args);
698
- var colorize = defs[type];
699
- if (colorize) {
700
- return args[0].split(NEWLINE).map(function (str) {
701
- return colorize(str);
702
- }).join("\n");
703
- } else {
704
- return args[0];
705
- }
706
- });
707
-}
708
-
709
-module.exports = exports["default"];
710
-},{"chalk":161,"esutils":287,"js-tokens":295}],5:[function(require,module,exports){
711
-module.exports = require("./lib/api/node.js");
712
-
713
-},{"./lib/api/node.js":6}],6:[function(require,module,exports){
714
-"use strict";
715
-
716
-exports.__esModule = true;
717
-exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.resolvePreset = exports.resolvePlugin = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined;
718
-
719
-var _file = require("../transformation/file");
720
-
721
-Object.defineProperty(exports, "File", {
722
- enumerable: true,
723
- get: function get() {
724
- return _interopRequireDefault(_file).default;
725
- }
726
-});
727
-
728
-var _config = require("../transformation/file/options/config");
729
-
730
-Object.defineProperty(exports, "options", {
731
- enumerable: true,
732
- get: function get() {
733
- return _interopRequireDefault(_config).default;
734
- }
735
-});
736
-
737
-var _buildExternalHelpers = require("../tools/build-external-helpers");
738
-
739
-Object.defineProperty(exports, "buildExternalHelpers", {
740
- enumerable: true,
741
- get: function get() {
742
- return _interopRequireDefault(_buildExternalHelpers).default;
743
- }
744
-});
745
-
746
-var _babelTemplate = require("babel-template");
747
-
748
-Object.defineProperty(exports, "template", {
749
- enumerable: true,
750
- get: function get() {
751
- return _interopRequireDefault(_babelTemplate).default;
752
- }
753
-});
754
-
755
-var _resolvePlugin = require("../helpers/resolve-plugin");
756
-
757
-Object.defineProperty(exports, "resolvePlugin", {
758
- enumerable: true,
759
- get: function get() {
760
- return _interopRequireDefault(_resolvePlugin).default;
761
- }
762
-});
763
-
764
-var _resolvePreset = require("../helpers/resolve-preset");
765
-
766
-Object.defineProperty(exports, "resolvePreset", {
767
- enumerable: true,
768
- get: function get() {
769
- return _interopRequireDefault(_resolvePreset).default;
770
- }
771
-});
772
-
773
-var _package = require("../../package");
774
-
775
-Object.defineProperty(exports, "version", {
776
- enumerable: true,
777
- get: function get() {
778
- return _package.version;
779
- }
780
-});
781
-exports.Plugin = Plugin;
782
-exports.transformFile = transformFile;
783
-exports.transformFileSync = transformFileSync;
784
-
785
-var _fs = require("fs");
786
-
787
-var _fs2 = _interopRequireDefault(_fs);
788
-
789
-var _util = require("../util");
790
-
791
-var util = _interopRequireWildcard(_util);
792
-
793
-var _babelMessages = require("babel-messages");
794
-
795
-var messages = _interopRequireWildcard(_babelMessages);
796
-
797
-var _babelTypes = require("babel-types");
798
-
799
-var t = _interopRequireWildcard(_babelTypes);
800
-
801
-var _babelTraverse = require("babel-traverse");
802
-
803
-var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
804
-
805
-var _optionManager = require("../transformation/file/options/option-manager");
806
-
807
-var _optionManager2 = _interopRequireDefault(_optionManager);
808
-
809
-var _pipeline = require("../transformation/pipeline");
810
-
811
-var _pipeline2 = _interopRequireDefault(_pipeline);
812
-
813
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
814
-
815
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
816
-
817
-exports.util = util;
818
-exports.messages = messages;
819
-exports.types = t;
820
-exports.traverse = _babelTraverse2.default;
821
-exports.OptionManager = _optionManager2.default;
822
-function Plugin(alias) {
823
- throw new Error("The (" + alias + ") Babel 5 plugin is being run with Babel 6.");
824
-}
825
-
826
-exports.Pipeline = _pipeline2.default;
827
-
828
-
829
-var pipeline = new _pipeline2.default();
830
-var analyse = exports.analyse = pipeline.analyse.bind(pipeline);
831
-var transform = exports.transform = pipeline.transform.bind(pipeline);
832
-var transformFromAst = exports.transformFromAst = pipeline.transformFromAst.bind(pipeline);
833
-
834
-function transformFile(filename, opts, callback) {
835
- if (typeof opts === "function") {
836
- callback = opts;
837
- opts = {};
838
- }
839
-
840
- opts.filename = filename;
841
-
842
- _fs2.default.readFile(filename, function (err, code) {
843
- var result = void 0;
844
-
845
- if (!err) {
846
- try {
847
- result = transform(code, opts);
848
- } catch (_err) {
849
- err = _err;
850
- }
851
- }
852
-
853
- if (err) {
854
- callback(err);
855
- } else {
856
- callback(null, result);
857
- }
858
- });
859
-}
860
-
861
-function transformFileSync(filename) {
862
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
863
-
864
- opts.filename = filename;
865
- return transform(_fs2.default.readFileSync(filename, "utf8"), opts);
866
-}
867
-},{"../../package":32,"../helpers/resolve-plugin":12,"../helpers/resolve-preset":13,"../tools/build-external-helpers":16,"../transformation/file":17,"../transformation/file/options/config":21,"../transformation/file/options/option-manager":23,"../transformation/pipeline":28,"../util":31,"babel-messages":61,"babel-template":114,"babel-traverse":118,"babel-types":151,"fs":159}],7:[function(require,module,exports){
868
-"use strict";
869
-
870
-exports.__esModule = true;
871
-exports.default = getPossiblePluginNames;
872
-function getPossiblePluginNames(pluginName) {
873
- return ["babel-plugin-" + pluginName, pluginName];
874
-}
875
-module.exports = exports["default"];
876
-},{}],8:[function(require,module,exports){
877
-"use strict";
878
-
879
-exports.__esModule = true;
880
-exports.default = getPossiblePresetNames;
881
-function getPossiblePresetNames(presetName) {
882
- var possibleNames = ["babel-preset-" + presetName, presetName];
883
-
884
- var matches = presetName.match(/^(@[^/]+)\/(.+)$/);
885
- if (matches) {
886
- var orgName = matches[1],
887
- presetPath = matches[2];
888
-
889
- possibleNames.push(orgName + "/babel-preset-" + presetPath);
890
- }
891
-
892
- return possibleNames;
893
-}
894
-module.exports = exports["default"];
895
-},{}],9:[function(require,module,exports){
896
-"use strict";
897
-
898
-exports.__esModule = true;
899
-
900
-var _getIterator2 = require("babel-runtime/core-js/get-iterator");
901
-
902
-var _getIterator3 = _interopRequireDefault(_getIterator2);
903
-
904
-exports.default = function (dest, src) {
905
- if (!dest || !src) return;
906
-
907
- return (0, _mergeWith2.default)(dest, src, function (a, b) {
908
- if (b && Array.isArray(a)) {
909
- var newArray = b.slice(0);
910
-
911
- for (var _iterator = a, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
912
- var _ref;
913
-
914
- if (_isArray) {
915
- if (_i >= _iterator.length) break;
916
- _ref = _iterator[_i++];
917
- } else {
918
- _i = _iterator.next();
919
- if (_i.done) break;
920
- _ref = _i.value;
921
- }
922
-
923
- var item = _ref;
924
-
925
- if (newArray.indexOf(item) < 0) {
926
- newArray.push(item);
927
- }
928
- }
929
-
930
- return newArray;
931
- }
932
- });
933
-};
934
-
935
-var _mergeWith = require("lodash/mergeWith");
936
-
937
-var _mergeWith2 = _interopRequireDefault(_mergeWith);
938
-
939
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
940
-
941
-module.exports = exports["default"];
942
-},{"babel-runtime/core-js/get-iterator":95,"lodash/mergeWith":502}],10:[function(require,module,exports){
943
-"use strict";
944
-
945
-exports.__esModule = true;
946
-
947
-exports.default = function (ast, comments, tokens) {
948
- if (ast) {
949
- if (ast.type === "Program") {
950
- return t.file(ast, comments || [], tokens || []);
951
- } else if (ast.type === "File") {
952
- return ast;
953
- }
954
- }
955
-
956
- throw new Error("Not a valid ast?");
957
-};
958
-
959
-var _babelTypes = require("babel-types");
960
-
961
-var t = _interopRequireWildcard(_babelTypes);
962
-
963
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
964
-
965
-module.exports = exports["default"];
966
-},{"babel-types":151}],11:[function(require,module,exports){
967
-"use strict";
968
-
969
-exports.__esModule = true;
970
-exports.default = resolveFromPossibleNames;
971
-
972
-var _resolve = require("./resolve");
973
-
974
-var _resolve2 = _interopRequireDefault(_resolve);
975
-
976
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
977
-
978
-function resolveFromPossibleNames(possibleNames, dirname) {
979
- return possibleNames.reduce(function (accum, curr) {
980
- return accum || (0, _resolve2.default)(curr, dirname);
981
- }, null);
982
-}
983
-module.exports = exports["default"];
984
-},{"./resolve":14}],12:[function(require,module,exports){
985
-(function (process){
986
-"use strict";
987
-
988
-exports.__esModule = true;
989
-exports.default = resolvePlugin;
990
-
991
-var _resolveFromPossibleNames = require("./resolve-from-possible-names");
992
-
993
-var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames);
994
-
995
-var _getPossiblePluginNames = require("./get-possible-plugin-names");
996
-
997
-var _getPossiblePluginNames2 = _interopRequireDefault(_getPossiblePluginNames);
998
-
999
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1000
-
1001
-function resolvePlugin(pluginName) {
1002
- var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
1003
-
1004
- return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePluginNames2.default)(pluginName), dirname);
1005
-}
1006
-module.exports = exports["default"];
1007
-}).call(this,require('_process'))
1008
-},{"./get-possible-plugin-names":7,"./resolve-from-possible-names":11,"_process":525}],13:[function(require,module,exports){
1009
-(function (process){
1010
-"use strict";
1011
-
1012
-exports.__esModule = true;
1013
-exports.default = resolvePreset;
1014
-
1015
-var _resolveFromPossibleNames = require("./resolve-from-possible-names");
1016
-
1017
-var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames);
1018
-
1019
-var _getPossiblePresetNames = require("./get-possible-preset-names");
1020
-
1021
-var _getPossiblePresetNames2 = _interopRequireDefault(_getPossiblePresetNames);
1022
-
1023
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1024
-
1025
-function resolvePreset(presetName) {
1026
- var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
1027
-
1028
- return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePresetNames2.default)(presetName), dirname);
1029
-}
1030
-module.exports = exports["default"];
1031
-}).call(this,require('_process'))
1032
-},{"./get-possible-preset-names":8,"./resolve-from-possible-names":11,"_process":525}],14:[function(require,module,exports){
1033
-(function (process){
1034
-"use strict";
1035
-
1036
-exports.__esModule = true;
1037
-
1038
-var _typeof2 = require("babel-runtime/helpers/typeof");
1039
-
1040
-var _typeof3 = _interopRequireDefault(_typeof2);
1041
-
1042
-exports.default = function (loc) {
1043
- var relative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
1044
-
1045
- if ((typeof _module2.default === "undefined" ? "undefined" : (0, _typeof3.default)(_module2.default)) === "object") return null;
1046
-
1047
- var relativeMod = relativeModules[relative];
1048
-
1049
- if (!relativeMod) {
1050
- relativeMod = new _module2.default();
1051
-
1052
- var filename = _path2.default.join(relative, ".babelrc");
1053
- relativeMod.id = filename;
1054
- relativeMod.filename = filename;
1055
-
1056
- relativeMod.paths = _module2.default._nodeModulePaths(relative);
1057
- relativeModules[relative] = relativeMod;
1058
- }
1059
-
1060
- try {
1061
- return _module2.default._resolveFilename(loc, relativeMod);
1062
- } catch (err) {
1063
- return null;
1064
- }
1065
-};
1066
-
1067
-var _module = require("module");
1068
-
1069
-var _module2 = _interopRequireDefault(_module);
1070
-
1071
-var _path = require("path");
1072
-
1073
-var _path2 = _interopRequireDefault(_path);
1074
-
1075
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1076
-
1077
-var relativeModules = {};
1078
-
1079
-module.exports = exports["default"];
1080
-}).call(this,require('_process'))
1081
-},{"_process":525,"babel-runtime/helpers/typeof":113,"module":159,"path":522}],15:[function(require,module,exports){
1082
-"use strict";
1083
-
1084
-exports.__esModule = true;
1085
-
1086
-var _map = require("babel-runtime/core-js/map");
1087
-
1088
-var _map2 = _interopRequireDefault(_map);
1089
-
1090
-var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
1091
-
1092
-var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1093
-
1094
-var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
1095
-
1096
-var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
1097
-
1098
-var _inherits2 = require("babel-runtime/helpers/inherits");
1099
-
1100
-var _inherits3 = _interopRequireDefault(_inherits2);
1101
-
1102
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1103
-
1104
-var Store = function (_Map) {
1105
- (0, _inherits3.default)(Store, _Map);
1106
-
1107
- function Store() {
1108
- (0, _classCallCheck3.default)(this, Store);
1109
-
1110
- var _this = (0, _possibleConstructorReturn3.default)(this, _Map.call(this));
1111
-
1112
- _this.dynamicData = {};
1113
- return _this;
1114
- }
1115
-
1116
- Store.prototype.setDynamic = function setDynamic(key, fn) {
1117
- this.dynamicData[key] = fn;
1118
- };
1119
-
1120
- Store.prototype.get = function get(key) {
1121
- if (this.has(key)) {
1122
- return _Map.prototype.get.call(this, key);
1123
- } else {
1124
- if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) {
1125
- var val = this.dynamicData[key]();
1126
- this.set(key, val);
1127
- return val;
1128
- }
1129
- }
1130
- };
1131
-
1132
- return Store;
1133
-}(_map2.default);
1134
-
1135
-exports.default = Store;
1136
-module.exports = exports["default"];
1137
-},{"babel-runtime/core-js/map":97,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112}],16:[function(require,module,exports){
1138
-"use strict";
1139
-
1140
-exports.__esModule = true;
1141
-
1142
-exports.default = function (whitelist) {
1143
- var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "global";
1144
-
1145
- var namespace = t.identifier("babelHelpers");
1146
-
1147
- var builder = function builder(body) {
1148
- return buildHelpers(body, namespace, whitelist);
1149
- };
1150
-
1151
- var tree = void 0;
1152
-
1153
- var build = {
1154
- global: buildGlobal,
1155
- umd: buildUmd,
1156
- var: buildVar
1157
- }[outputType];
1158
-
1159
- if (build) {
1160
- tree = build(namespace, builder);
1161
- } else {
1162
- throw new Error(messages.get("unsupportedOutputType", outputType));
1163
- }
1164
-
1165
- return (0, _babelGenerator2.default)(tree).code;
1166
-};
1167
-
1168
-var _babelHelpers = require("babel-helpers");
1169
-
1170
-var helpers = _interopRequireWildcard(_babelHelpers);
1171
-
1172
-var _babelGenerator = require("babel-generator");
1173
-
1174
-var _babelGenerator2 = _interopRequireDefault(_babelGenerator);
1175
-
1176
-var _babelMessages = require("babel-messages");
1177
-
1178
-var messages = _interopRequireWildcard(_babelMessages);
1179
-
1180
-var _babelTemplate = require("babel-template");
1181
-
1182
-var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
1183
-
1184
-var _babelTypes = require("babel-types");
1185
-
1186
-var t = _interopRequireWildcard(_babelTypes);
1187
-
1188
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1189
-
1190
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
1191
-
1192
-var buildUmdWrapper = (0, _babelTemplate2.default)("\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n");
1193
-
1194
-function buildGlobal(namespace, builder) {
1195
- var body = [];
1196
- var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body));
1197
- var tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]);
1198
-
1199
- body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([])))]));
1200
-
1201
- builder(body);
1202
-
1203
- return tree;
1204
-}
1205
-
1206
-function buildUmd(namespace, builder) {
1207
- var body = [];
1208
- body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.identifier("global"))]));
1209
-
1210
- builder(body);
1211
-
1212
- return t.program([buildUmdWrapper({
1213
- FACTORY_PARAMETERS: t.identifier("global"),
1214
- BROWSER_ARGUMENTS: t.assignmentExpression("=", t.memberExpression(t.identifier("root"), namespace), t.objectExpression([])),
1215
- COMMON_ARGUMENTS: t.identifier("exports"),
1216
- AMD_ARGUMENTS: t.arrayExpression([t.stringLiteral("exports")]),
1217
- FACTORY_BODY: body,
1218
- UMD_ROOT: t.identifier("this")
1219
- })]);
1220
-}
1221
-
1222
-function buildVar(namespace, builder) {
1223
- var body = [];
1224
- body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.objectExpression([]))]));
1225
- builder(body);
1226
- body.push(t.expressionStatement(namespace));
1227
- return t.program(body);
1228
-}
1229
-
1230
-function buildHelpers(body, namespace, whitelist) {
1231
- helpers.list.forEach(function (name) {
1232
- if (whitelist && whitelist.indexOf(name) < 0) return;
1233
-
1234
- var key = t.identifier(name);
1235
- body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(namespace, key), helpers.get(name))));
1236
- });
1237
-}
1238
-module.exports = exports["default"];
1239
-},{"babel-generator":44,"babel-helpers":60,"babel-messages":61,"babel-template":114,"babel-types":151}],17:[function(require,module,exports){
1240
-(function (process){
1241
-"use strict";
1242
-
1243
-exports.__esModule = true;
1244
-exports.File = undefined;
1245
-
1246
-var _getIterator2 = require("babel-runtime/core-js/get-iterator");
1247
-
1248
-var _getIterator3 = _interopRequireDefault(_getIterator2);
1249
-
1250
-var _create = require("babel-runtime/core-js/object/create");
1251
-
1252
-var _create2 = _interopRequireDefault(_create);
1253
-
1254
-var _assign = require("babel-runtime/core-js/object/assign");
1255
-
1256
-var _assign2 = _interopRequireDefault(_assign);
1257
-
1258
-var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
1259
-
1260
-var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1261
-
1262
-var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
1263
-
1264
-var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
1265
-
1266
-var _inherits2 = require("babel-runtime/helpers/inherits");
1267
-
1268
-var _inherits3 = _interopRequireDefault(_inherits2);
1269
-
1270
-var _babelHelpers = require("babel-helpers");
1271
-
1272
-var _babelHelpers2 = _interopRequireDefault(_babelHelpers);
1273
-
1274
-var _metadata = require("./metadata");
1275
-
1276
-var metadataVisitor = _interopRequireWildcard(_metadata);
1277
-
1278
-var _convertSourceMap = require("convert-source-map");
1279
-
1280
-var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap);
1281
-
1282
-var _optionManager = require("./options/option-manager");
1283
-
1284
-var _optionManager2 = _interopRequireDefault(_optionManager);
1285
-
1286
-var _pluginPass = require("../plugin-pass");
1287
-
1288
-var _pluginPass2 = _interopRequireDefault(_pluginPass);
1289
-
1290
-var _babelTraverse = require("babel-traverse");
1291
-
1292
-var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
1293
-
1294
-var _sourceMap = require("source-map");
1295
-
1296
-var _sourceMap2 = _interopRequireDefault(_sourceMap);
1297
-
1298
-var _babelGenerator = require("babel-generator");
1299
-
1300
-var _babelGenerator2 = _interopRequireDefault(_babelGenerator);
1301
-
1302
-var _babelCodeFrame = require("babel-code-frame");
1303
-
1304
-var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame);
1305
-
1306
-var _defaults = require("lodash/defaults");
1307
-
1308
-var _defaults2 = _interopRequireDefault(_defaults);
1309
-
1310
-var _logger = require("./logger");
1311
-
1312
-var _logger2 = _interopRequireDefault(_logger);
1313
-
1314
-var _store = require("../../store");
1315
-
1316
-var _store2 = _interopRequireDefault(_store);
1317
-
1318
-var _babylon = require("babylon");
1319
-
1320
-var _util = require("../../util");
1321
-
1322
-var util = _interopRequireWildcard(_util);
1323
-
1324
-var _path = require("path");
1325
-
1326
-var _path2 = _interopRequireDefault(_path);
1327
-
1328
-var _babelTypes = require("babel-types");
1329
-
1330
-var t = _interopRequireWildcard(_babelTypes);
1331
-
1332
-var _resolve = require("../../helpers/resolve");
1333
-
1334
-var _resolve2 = _interopRequireDefault(_resolve);
1335
-
1336
-var _blockHoist = require("../internal-plugins/block-hoist");
1337
-
1338
-var _blockHoist2 = _interopRequireDefault(_blockHoist);
1339
-
1340
-var _shadowFunctions = require("../internal-plugins/shadow-functions");
1341
-
1342
-var _shadowFunctions2 = _interopRequireDefault(_shadowFunctions);
1343
-
1344
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
1345
-
1346
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1347
-
1348
-var shebangRegex = /^#!.*/;
1349
-
1350
-var INTERNAL_PLUGINS = [[_blockHoist2.default], [_shadowFunctions2.default]];
1351
-
1352
-var errorVisitor = {
1353
- enter: function enter(path, state) {
1354
- var loc = path.node.loc;
1355
- if (loc) {
1356
- state.loc = loc;
1357
- path.stop();
1358
- }
1359
- }
1360
-};
1361
-
1362
-var File = function (_Store) {
1363
- (0, _inherits3.default)(File, _Store);
1364
-
1365
- function File() {
1366
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1367
- var pipeline = arguments[1];
1368
- (0, _classCallCheck3.default)(this, File);
1369
-
1370
- var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
1371
-
1372
- _this.pipeline = pipeline;
1373
-
1374
- _this.log = new _logger2.default(_this, opts.filename || "unknown");
1375
- _this.opts = _this.initOptions(opts);
1376
-
1377
- _this.parserOpts = {
1378
- sourceType: _this.opts.sourceType,
1379
- sourceFileName: _this.opts.filename,
1380
- plugins: []
1381
- };
1382
-
1383
- _this.pluginVisitors = [];
1384
- _this.pluginPasses = [];
1385
-
1386
- _this.buildPluginsForOptions(_this.opts);
1387
-
1388
- if (_this.opts.passPerPreset) {
1389
- _this.perPresetOpts = [];
1390
- _this.opts.presets.forEach(function (presetOpts) {
1391
- var perPresetOpts = (0, _assign2.default)((0, _create2.default)(_this.opts), presetOpts);
1392
- _this.perPresetOpts.push(perPresetOpts);
1393
- _this.buildPluginsForOptions(perPresetOpts);
1394
- });
1395
- }
1396
-
1397
- _this.metadata = {
1398
- usedHelpers: [],
1399
- marked: [],
1400
- modules: {
1401
- imports: [],
1402
- exports: {
1403
- exported: [],
1404
- specifiers: []
1405
- }
1406
- }
1407
- };
1408
-
1409
- _this.dynamicImportTypes = {};
1410
- _this.dynamicImportIds = {};
1411
- _this.dynamicImports = [];
1412
- _this.declarations = {};
1413
- _this.usedHelpers = {};
1414
-
1415
- _this.path = null;
1416
- _this.ast = {};
1417
-
1418
- _this.code = "";
1419
- _this.shebang = "";
1420
-
1421
- _this.hub = new _babelTraverse.Hub(_this);
1422
- return _this;
1423
- }
1424
-
1425
- File.prototype.getMetadata = function getMetadata() {
1426
- var has = false;
1427
- for (var _iterator = this.ast.program.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
1428
- var _ref;
1429
-
1430
- if (_isArray) {
1431
- if (_i >= _iterator.length) break;
1432
- _ref = _iterator[_i++];
1433
- } else {
1434
- _i = _iterator.next();
1435
- if (_i.done) break;
1436
- _ref = _i.value;
1437
- }
1438
-
1439
- var node = _ref;
1440
-
1441
- if (t.isModuleDeclaration(node)) {
1442
- has = true;
1443
- break;
1444
- }
1445
- }
1446
- if (has) {
1447
- this.path.traverse(metadataVisitor, this);
1448
- }
1449
- };
1450
-
1451
- File.prototype.initOptions = function initOptions(opts) {
1452
- opts = new _optionManager2.default(this.log, this.pipeline).init(opts);
1453
-
1454
- if (opts.inputSourceMap) {
1455
- opts.sourceMaps = true;
1456
- }
1457
-
1458
- if (opts.moduleId) {
1459
- opts.moduleIds = true;
1460
- }
1461
-
1462
- opts.basename = _path2.default.basename(opts.filename, _path2.default.extname(opts.filename));
1463
-
1464
- opts.ignore = util.arrayify(opts.ignore, util.regexify);
1465
-
1466
- if (opts.only) opts.only = util.arrayify(opts.only, util.regexify);
1467
-
1468
- (0, _defaults2.default)(opts, {
1469
- moduleRoot: opts.sourceRoot
1470
- });
1471
-
1472
- (0, _defaults2.default)(opts, {
1473
- sourceRoot: opts.moduleRoot
1474
- });
1475
-
1476
- (0, _defaults2.default)(opts, {
1477
- filenameRelative: opts.filename
1478
- });
1479
-
1480
- var basenameRelative = _path2.default.basename(opts.filenameRelative);
1481
-
1482
- (0, _defaults2.default)(opts, {
1483
- sourceFileName: basenameRelative,
1484
- sourceMapTarget: basenameRelative
1485
- });
1486
-
1487
- return opts;
1488
- };
1489
-
1490
- File.prototype.buildPluginsForOptions = function buildPluginsForOptions(opts) {
1491
- if (!Array.isArray(opts.plugins)) {
1492
- return;
1493
- }
1494
-
1495
- var plugins = opts.plugins.concat(INTERNAL_PLUGINS);
1496
- var currentPluginVisitors = [];
1497
- var currentPluginPasses = [];
1498
-
1499
- for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
1500
- var _ref2;
1501
-
1502
- if (_isArray2) {
1503
- if (_i2 >= _iterator2.length) break;
1504
- _ref2 = _iterator2[_i2++];
1505
- } else {
1506
- _i2 = _iterator2.next();
1507
- if (_i2.done) break;
1508
- _ref2 = _i2.value;
1509
- }
1510
-
1511
- var ref = _ref2;
1512
- var plugin = ref[0],
1513
- pluginOpts = ref[1];
1514
-
1515
-
1516
- currentPluginVisitors.push(plugin.visitor);
1517
- currentPluginPasses.push(new _pluginPass2.default(this, plugin, pluginOpts));
1518
-
1519
- if (plugin.manipulateOptions) {
1520
- plugin.manipulateOptions(opts, this.parserOpts, this);
1521
- }
1522
- }
1523
-
1524
- this.pluginVisitors.push(currentPluginVisitors);
1525
- this.pluginPasses.push(currentPluginPasses);
1526
- };
1527
-
1528
- File.prototype.getModuleName = function getModuleName() {
1529
- var opts = this.opts;
1530
- if (!opts.moduleIds) {
1531
- return null;
1532
- }
1533
-
1534
- if (opts.moduleId != null && !opts.getModuleId) {
1535
- return opts.moduleId;
1536
- }
1537
-
1538
- var filenameRelative = opts.filenameRelative;
1539
- var moduleName = "";
1540
-
1541
- if (opts.moduleRoot != null) {
1542
- moduleName = opts.moduleRoot + "/";
1543
- }
1544
-
1545
- if (!opts.filenameRelative) {
1546
- return moduleName + opts.filename.replace(/^\//, "");
1547
- }
1548
-
1549
- if (opts.sourceRoot != null) {
1550
- var sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?");
1551
- filenameRelative = filenameRelative.replace(sourceRootRegEx, "");
1552
- }
1553
-
1554
- filenameRelative = filenameRelative.replace(/\.(\w*?)$/, "");
1555
-
1556
- moduleName += filenameRelative;
1557
-
1558
- moduleName = moduleName.replace(/\\/g, "/");
1559
-
1560
- if (opts.getModuleId) {
1561
- return opts.getModuleId(moduleName) || moduleName;
1562
- } else {
1563
- return moduleName;
1564
- }
1565
- };
1566
-
1567
- File.prototype.resolveModuleSource = function resolveModuleSource(source) {
1568
- var resolveModuleSource = this.opts.resolveModuleSource;
1569
- if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename);
1570
- return source;
1571
- };
1572
-
1573
- File.prototype.addImport = function addImport(source, imported) {
1574
- var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : imported;
1575
-
1576
- var alias = source + ":" + imported;
1577
- var id = this.dynamicImportIds[alias];
1578
-
1579
- if (!id) {
1580
- source = this.resolveModuleSource(source);
1581
- id = this.dynamicImportIds[alias] = this.scope.generateUidIdentifier(name);
1582
-
1583
- var specifiers = [];
1584
-
1585
- if (imported === "*") {
1586
- specifiers.push(t.importNamespaceSpecifier(id));
1587
- } else if (imported === "default") {
1588
- specifiers.push(t.importDefaultSpecifier(id));
1589
- } else {
1590
- specifiers.push(t.importSpecifier(id, t.identifier(imported)));
1591
- }
1592
-
1593
- var declar = t.importDeclaration(specifiers, t.stringLiteral(source));
1594
- declar._blockHoist = 3;
1595
-
1596
- this.path.unshiftContainer("body", declar);
1597
- }
1598
-
1599
- return id;
1600
- };
1601
-
1602
- File.prototype.addHelper = function addHelper(name) {
1603
- var declar = this.declarations[name];
1604
- if (declar) return declar;
1605
-
1606
- if (!this.usedHelpers[name]) {
1607
- this.metadata.usedHelpers.push(name);
1608
- this.usedHelpers[name] = true;
1609
- }
1610
-
1611
- var generator = this.get("helperGenerator");
1612
- var runtime = this.get("helpersNamespace");
1613
- if (generator) {
1614
- var res = generator(name);
1615
- if (res) return res;
1616
- } else if (runtime) {
1617
- return t.memberExpression(runtime, t.identifier(name));
1618
- }
1619
-
1620
- var ref = (0, _babelHelpers2.default)(name);
1621
- var uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
1622
-
1623
- if (t.isFunctionExpression(ref) && !ref.id) {
1624
- ref.body._compact = true;
1625
- ref._generated = true;
1626
- ref.id = uid;
1627
- ref.type = "FunctionDeclaration";
1628
- this.path.unshiftContainer("body", ref);
1629
- } else {
1630
- ref._compact = true;
1631
- this.scope.push({
1632
- id: uid,
1633
- init: ref,
1634
- unique: true
1635
- });
1636
- }
1637
-
1638
- return uid;
1639
- };
1640
-
1641
- File.prototype.addTemplateObject = function addTemplateObject(helperName, strings, raw) {
1642
- var stringIds = raw.elements.map(function (string) {
1643
- return string.value;
1644
- });
1645
- var name = helperName + "_" + raw.elements.length + "_" + stringIds.join(",");
1646
-
1647
- var declar = this.declarations[name];
1648
- if (declar) return declar;
1649
-
1650
- var uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject");
1651
-
1652
- var helperId = this.addHelper(helperName);
1653
- var init = t.callExpression(helperId, [strings, raw]);
1654
- init._compact = true;
1655
- this.scope.push({
1656
- id: uid,
1657
- init: init,
1658
- _blockHoist: 1.9 });
1659
- return uid;
1660
- };
1661
-
1662
- File.prototype.buildCodeFrameError = function buildCodeFrameError(node, msg) {
1663
- var Error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : SyntaxError;
1664
-
1665
- var loc = node && (node.loc || node._loc);
1666
-
1667
- var err = new Error(msg);
1668
-
1669
- if (loc) {
1670
- err.loc = loc.start;
1671
- } else {
1672
- (0, _babelTraverse2.default)(node, errorVisitor, this.scope, err);
1673
-
1674
- err.message += " (This is an error on an internal node. Probably an internal error";
1675
-
1676
- if (err.loc) {
1677
- err.message += ". Location has been estimated.";
1678
- }
1679
-
1680
- err.message += ")";
1681
- }
1682
-
1683
- return err;
1684
- };
1685
-
1686
- File.prototype.mergeSourceMap = function mergeSourceMap(map) {
1687
- var inputMap = this.opts.inputSourceMap;
1688
-
1689
- if (inputMap) {
1690
- var inputMapConsumer = new _sourceMap2.default.SourceMapConsumer(inputMap);
1691
- var outputMapConsumer = new _sourceMap2.default.SourceMapConsumer(map);
1692
-
1693
- var mergedGenerator = new _sourceMap2.default.SourceMapGenerator({
1694
- file: inputMapConsumer.file,
1695
- sourceRoot: inputMapConsumer.sourceRoot
1696
- });
1697
-
1698
- var source = outputMapConsumer.sources[0];
1699
-
1700
- inputMapConsumer.eachMapping(function (mapping) {
1701
- var generatedPosition = outputMapConsumer.generatedPositionFor({
1702
- line: mapping.generatedLine,
1703
- column: mapping.generatedColumn,
1704
- source: source
1705
- });
1706
- if (generatedPosition.column != null) {
1707
- mergedGenerator.addMapping({
1708
- source: mapping.source,
1709
-
1710
- original: mapping.source == null ? null : {
1711
- line: mapping.originalLine,
1712
- column: mapping.originalColumn
1713
- },
1714
-
1715
- generated: generatedPosition
1716
- });
1717
- }
1718
- });
1719
-
1720
- var mergedMap = mergedGenerator.toJSON();
1721
- inputMap.mappings = mergedMap.mappings;
1722
- return inputMap;
1723
- } else {
1724
- return map;
1725
- }
1726
- };
1727
-
1728
- File.prototype.parse = function parse(code) {
1729
- var parseCode = _babylon.parse;
1730
- var parserOpts = this.opts.parserOpts;
1731
-
1732
- if (parserOpts) {
1733
- parserOpts = (0, _assign2.default)({}, this.parserOpts, parserOpts);
1734
-
1735
- if (parserOpts.parser) {
1736
- if (typeof parserOpts.parser === "string") {
1737
- var dirname = _path2.default.dirname(this.opts.filename) || process.cwd();
1738
- var parser = (0, _resolve2.default)(parserOpts.parser, dirname);
1739
- if (parser) {
1740
- parseCode = require(parser).parse;
1741
- } else {
1742
- throw new Error("Couldn't find parser " + parserOpts.parser + " with \"parse\" method " + ("relative to directory " + dirname));
1743
- }
1744
- } else {
1745
- parseCode = parserOpts.parser;
1746
- }
1747
-
1748
- parserOpts.parser = {
1749
- parse: function parse(source) {
1750
- return (0, _babylon.parse)(source, parserOpts);
1751
- }
1752
- };
1753
- }
1754
- }
1755
-
1756
- this.log.debug("Parse start");
1757
- var ast = parseCode(code, parserOpts || this.parserOpts);
1758
- this.log.debug("Parse stop");
1759
- return ast;
1760
- };
1761
-
1762
- File.prototype._addAst = function _addAst(ast) {
1763
- this.path = _babelTraverse.NodePath.get({
1764
- hub: this.hub,
1765
- parentPath: null,
1766
- parent: ast,
1767
- container: ast,
1768
- key: "program"
1769
- }).setContext();
1770
- this.scope = this.path.scope;
1771
- this.ast = ast;
1772
- this.getMetadata();
1773
- };
1774
-
1775
- File.prototype.addAst = function addAst(ast) {
1776
- this.log.debug("Start set AST");
1777
- this._addAst(ast);
1778
- this.log.debug("End set AST");
1779
- };
1780
-
1781
- File.prototype.transform = function transform() {
1782
- for (var i = 0; i < this.pluginPasses.length; i++) {
1783
- var pluginPasses = this.pluginPasses[i];
1784
- this.call("pre", pluginPasses);
1785
- this.log.debug("Start transform traverse");
1786
-
1787
- var visitor = _babelTraverse2.default.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod);
1788
- (0, _babelTraverse2.default)(this.ast, visitor, this.scope);
1789
-
1790
- this.log.debug("End transform traverse");
1791
- this.call("post", pluginPasses);
1792
- }
1793
-
1794
- return this.generate();
1795
- };
1796
-
1797
- File.prototype.wrap = function wrap(code, callback) {
1798
- code = code + "";
1799
-
1800
- try {
1801
- if (this.shouldIgnore()) {
1802
- return this.makeResult({ code: code, ignored: true });
1803
- } else {
1804
- return callback();
1805
- }
1806
- } catch (err) {
1807
- if (err._babel) {
1808
- throw err;
1809
- } else {
1810
- err._babel = true;
1811
- }
1812
-
1813
- var message = err.message = this.opts.filename + ": " + err.message;
1814
-
1815
- var loc = err.loc;
1816
- if (loc) {
1817
- err.codeFrame = (0, _babelCodeFrame2.default)(code, loc.line, loc.column + 1, this.opts);
1818
- message += "\n" + err.codeFrame;
1819
- }
1820
-
1821
- if (process.browser) {
1822
- err.message = message;
1823
- }
1824
-
1825
- if (err.stack) {
1826
- var newStack = err.stack.replace(err.message, message);
1827
- err.stack = newStack;
1828
- }
1829
-
1830
- throw err;
1831
- }
1832
- };
1833
-
1834
- File.prototype.addCode = function addCode(code) {
1835
- code = (code || "") + "";
1836
- code = this.parseInputSourceMap(code);
1837
- this.code = code;
1838
- };
1839
-
1840
- File.prototype.parseCode = function parseCode() {
1841
- this.parseShebang();
1842
- var ast = this.parse(this.code);
1843
- this.addAst(ast);
1844
- };
1845
-
1846
- File.prototype.shouldIgnore = function shouldIgnore() {
1847
- var opts = this.opts;
1848
- return util.shouldIgnore(opts.filename, opts.ignore, opts.only);
1849
- };
1850
-
1851
- File.prototype.call = function call(key, pluginPasses) {
1852
- for (var _iterator3 = pluginPasses, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
1853
- var _ref3;
1854
-
1855
- if (_isArray3) {
1856
- if (_i3 >= _iterator3.length) break;
1857
- _ref3 = _iterator3[_i3++];
1858
- } else {
1859
- _i3 = _iterator3.next();
1860
- if (_i3.done) break;
1861
- _ref3 = _i3.value;
1862
- }
1863
-
1864
- var pass = _ref3;
1865
-
1866
- var plugin = pass.plugin;
1867
- var fn = plugin[key];
1868
- if (fn) fn.call(pass, this);
1869
- }
1870
- };
1871
-
1872
- File.prototype.parseInputSourceMap = function parseInputSourceMap(code) {
1873
- var opts = this.opts;
1874
-
1875
- if (opts.inputSourceMap !== false) {
1876
- var inputMap = _convertSourceMap2.default.fromSource(code);
1877
- if (inputMap) {
1878
- opts.inputSourceMap = inputMap.toObject();
1879
- code = _convertSourceMap2.default.removeComments(code);
1880
- }
1881
- }
1882
-
1883
- return code;
1884
- };
1885
-
1886
- File.prototype.parseShebang = function parseShebang() {
1887
- var shebangMatch = shebangRegex.exec(this.code);
1888
- if (shebangMatch) {
1889
- this.shebang = shebangMatch[0];
1890
- this.code = this.code.replace(shebangRegex, "");
1891
- }
1892
- };
1893
-
1894
- File.prototype.makeResult = function makeResult(_ref4) {
1895
- var code = _ref4.code,
1896
- map = _ref4.map,
1897
- ast = _ref4.ast,
1898
- ignored = _ref4.ignored;
1899
-
1900
- var result = {
1901
- metadata: null,
1902
- options: this.opts,
1903
- ignored: !!ignored,
1904
- code: null,
1905
- ast: null,
1906
- map: map || null
1907
- };
1908
-
1909
- if (this.opts.code) {
1910
- result.code = code;
1911
- }
1912
-
1913
- if (this.opts.ast) {
1914
- result.ast = ast;
1915
- }
1916
-
1917
- if (this.opts.metadata) {
1918
- result.metadata = this.metadata;
1919
- }
1920
-
1921
- return result;
1922
- };
1923
-
1924
- File.prototype.generate = function generate() {
1925
- var opts = this.opts;
1926
- var ast = this.ast;
1927
-
1928
- var result = { ast: ast };
1929
- if (!opts.code) return this.makeResult(result);
1930
-
1931
- var gen = _babelGenerator2.default;
1932
- if (opts.generatorOpts.generator) {
1933
- gen = opts.generatorOpts.generator;
1934
-
1935
- if (typeof gen === "string") {
1936
- var dirname = _path2.default.dirname(this.opts.filename) || process.cwd();
1937
- var generator = (0, _resolve2.default)(gen, dirname);
1938
- if (generator) {
1939
- gen = require(generator).print;
1940
- } else {
1941
- throw new Error("Couldn't find generator " + gen + " with \"print\" method relative " + ("to directory " + dirname));
1942
- }
1943
- }
1944
- }
1945
-
1946
- this.log.debug("Generation start");
1947
-
1948
- var _result = gen(ast, opts.generatorOpts ? (0, _assign2.default)(opts, opts.generatorOpts) : opts, this.code);
1949
- result.code = _result.code;
1950
- result.map = _result.map;
1951
-
1952
- this.log.debug("Generation end");
1953
-
1954
- if (this.shebang) {
1955
- result.code = this.shebang + "\n" + result.code;
1956
- }
1957
-
1958
- if (result.map) {
1959
- result.map = this.mergeSourceMap(result.map);
1960
- }
1961
-
1962
- if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
1963
- result.code += "\n" + _convertSourceMap2.default.fromObject(result.map).toComment();
1964
- }
1965
-
1966
- if (opts.sourceMaps === "inline") {
1967
- result.map = null;
1968
- }
1969
-
1970
- return this.makeResult(result);
1971
- };
1972
-
1973
- return File;
1974
-}(_store2.default);
1975
-
1976
-exports.default = File;
1977
-exports.File = File;
1978
-}).call(this,require('_process'))
1979
-},{"../../helpers/resolve":14,"../../store":15,"../../util":31,"../internal-plugins/block-hoist":26,"../internal-plugins/shadow-functions":27,"../plugin-pass":29,"./logger":18,"./metadata":19,"./options/option-manager":23,"_process":525,"babel-code-frame":4,"babel-generator":44,"babel-helpers":60,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/object/assign":99,"babel-runtime/core-js/object/create":100,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112,"babel-traverse":118,"babel-types":151,"babylon":155,"convert-source-map":163,"lodash/defaults":470,"path":522,"source-map":552}],18:[function(require,module,exports){
1980
-"use strict";
1981
-
1982
-exports.__esModule = true;
1983
-
1984
-var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
1985
-
1986
-var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1987
-
1988
-var _node = require("debug/node");
1989
-
1990
-var _node2 = _interopRequireDefault(_node);
1991
-
1992
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1993
-
1994
-var verboseDebug = (0, _node2.default)("babel:verbose");
1995
-var generalDebug = (0, _node2.default)("babel");
1996
-
1997
-var seenDeprecatedMessages = [];
1998
-
1999
-var Logger = function () {
2000
- function Logger(file, filename) {
2001
- (0, _classCallCheck3.default)(this, Logger);
2002
-
2003
- this.filename = filename;
2004
- this.file = file;
2005
- }
2006
-
2007
- Logger.prototype._buildMessage = function _buildMessage(msg) {
2008
- var parts = "[BABEL] " + this.filename;
2009
- if (msg) parts += ": " + msg;
2010
- return parts;
2011
- };
2012
-
2013
- Logger.prototype.warn = function warn(msg) {
2014
- console.warn(this._buildMessage(msg));
2015
- };
2016
-
2017
- Logger.prototype.error = function error(msg) {
2018
- var Constructor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error;
2019
-
2020
- throw new Constructor(this._buildMessage(msg));
2021
- };
2022
-
2023
- Logger.prototype.deprecate = function deprecate(msg) {
2024
- if (this.file.opts && this.file.opts.suppressDeprecationMessages) return;
2025
-
2026
- msg = this._buildMessage(msg);
2027
-
2028
- if (seenDeprecatedMessages.indexOf(msg) >= 0) return;
2029
-
2030
- seenDeprecatedMessages.push(msg);
2031
-
2032
- console.error(msg);
2033
- };
2034
-
2035
- Logger.prototype.verbose = function verbose(msg) {
2036
- if (verboseDebug.enabled) verboseDebug(this._buildMessage(msg));
2037
- };
2038
-
2039
- Logger.prototype.debug = function debug(msg) {
2040
- if (generalDebug.enabled) generalDebug(this._buildMessage(msg));
2041
- };
2042
-
2043
- Logger.prototype.deopt = function deopt(node, msg) {
2044
- this.debug(msg);
2045
- };
2046
-
2047
- return Logger;
2048
-}();
2049
-
2050
-exports.default = Logger;
2051
-module.exports = exports["default"];
2052
-},{"babel-runtime/helpers/classCallCheck":109,"debug/node":278}],19:[function(require,module,exports){
2053
-"use strict";
2054
-
2055
-exports.__esModule = true;
2056
-exports.ImportDeclaration = exports.ModuleDeclaration = undefined;
2057
-
2058
-var _getIterator2 = require("babel-runtime/core-js/get-iterator");
2059
-
2060
-var _getIterator3 = _interopRequireDefault(_getIterator2);
2061
-
2062
-exports.ExportDeclaration = ExportDeclaration;
2063
-exports.Scope = Scope;
2064
-
2065
-var _babelTypes = require("babel-types");
2066
-
2067
-var t = _interopRequireWildcard(_babelTypes);
2068
-
2069
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
2070
-
2071
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2072
-
2073
-var ModuleDeclaration = exports.ModuleDeclaration = {
2074
- enter: function enter(path, file) {
2075
- var node = path.node;
2076
-
2077
- if (node.source) {
2078
- node.source.value = file.resolveModuleSource(node.source.value);
2079
- }
2080
- }
2081
-};
2082
-
2083
-var ImportDeclaration = exports.ImportDeclaration = {
2084
- exit: function exit(path, file) {
2085
- var node = path.node;
2086
-
2087
-
2088
- var specifiers = [];
2089
- var imported = [];
2090
- file.metadata.modules.imports.push({
2091
- source: node.source.value,
2092
- imported: imported,
2093
- specifiers: specifiers
2094
- });
2095
-
2096
- for (var _iterator = path.get("specifiers"), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
2097
- var _ref;
2098
-
2099
- if (_isArray) {
2100
- if (_i >= _iterator.length) break;
2101
- _ref = _iterator[_i++];
2102
- } else {
2103
- _i = _iterator.next();
2104
- if (_i.done) break;
2105
- _ref = _i.value;
2106
- }
2107
-
2108
- var specifier = _ref;
2109
-
2110
- var local = specifier.node.local.name;
2111
-
2112
- if (specifier.isImportDefaultSpecifier()) {
2113
- imported.push("default");
2114
- specifiers.push({
2115
- kind: "named",
2116
- imported: "default",
2117
- local: local
2118
- });
2119
- }
2120
-
2121
- if (specifier.isImportSpecifier()) {
2122
- var importedName = specifier.node.imported.name;
2123
- imported.push(importedName);
2124
- specifiers.push({
2125
- kind: "named",
2126
- imported: importedName,
2127
- local: local
2128
- });
2129
- }
2130
-
2131
- if (specifier.isImportNamespaceSpecifier()) {
2132
- imported.push("*");
2133
- specifiers.push({
2134
- kind: "namespace",
2135
- local: local
2136
- });
2137
- }
2138
- }
2139
- }
2140
-};
2141
-
2142
-function ExportDeclaration(path, file) {
2143
- var node = path.node;
2144
-
2145
-
2146
- var source = node.source ? node.source.value : null;
2147
- var exports = file.metadata.modules.exports;
2148
-
2149
- var declar = path.get("declaration");
2150
- if (declar.isStatement()) {
2151
- var bindings = declar.getBindingIdentifiers();
2152
-
2153
- for (var name in bindings) {
2154
- exports.exported.push(name);
2155
- exports.specifiers.push({
2156
- kind: "local",
2157
- local: name,
2158
- exported: path.isExportDefaultDeclaration() ? "default" : name
2159
- });
2160
- }
2161
- }
2162
-
2163
- if (path.isExportNamedDeclaration() && node.specifiers) {
2164
- for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
2165
- var _ref2;
2166
-
2167
- if (_isArray2) {
2168
- if (_i2 >= _iterator2.length) break;
2169
- _ref2 = _iterator2[_i2++];
2170
- } else {
2171
- _i2 = _iterator2.next();
2172
- if (_i2.done) break;
2173
- _ref2 = _i2.value;
2174
- }
2175
-
2176
- var specifier = _ref2;
2177
-
2178
- var exported = specifier.exported.name;
2179
- exports.exported.push(exported);
2180
-
2181
- if (t.isExportDefaultSpecifier(specifier)) {
2182
- exports.specifiers.push({
2183
- kind: "external",
2184
- local: exported,
2185
- exported: exported,
2186
- source: source
2187
- });
2188
- }
2189
-
2190
- if (t.isExportNamespaceSpecifier(specifier)) {
2191
- exports.specifiers.push({
2192
- kind: "external-namespace",
2193
- exported: exported,
2194
- source: source
2195
- });
2196
- }
2197
-
2198
- var local = specifier.local;
2199
- if (!local) continue;
2200
-
2201
- if (source) {
2202
- exports.specifiers.push({
2203
- kind: "external",
2204
- local: local.name,
2205
- exported: exported,
2206
- source: source
2207
- });
2208
- }
2209
-
2210
- if (!source) {
2211
- exports.specifiers.push({
2212
- kind: "local",
2213
- local: local.name,
2214
- exported: exported
2215
- });
2216
- }
2217
- }
2218
- }
2219
-
2220
- if (path.isExportAllDeclaration()) {
2221
- exports.specifiers.push({
2222
- kind: "external-all",
2223
- source: source
2224
- });
2225
- }
2226
-}
2227
-
2228
-function Scope(path) {
2229
- path.skip();
2230
-}
2231
-},{"babel-runtime/core-js/get-iterator":95,"babel-types":151}],20:[function(require,module,exports){
2232
-(function (process){
2233
-"use strict";
2234
-
2235
-exports.__esModule = true;
2236
-
2237
-var _assign = require("babel-runtime/core-js/object/assign");
2238
-
2239
-var _assign2 = _interopRequireDefault(_assign);
2240
-
2241
-var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
2242
-
2243
-var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
2244
-
2245
-exports.default = buildConfigChain;
2246
-
2247
-var _resolve = require("../../../helpers/resolve");
2248
-
2249
-var _resolve2 = _interopRequireDefault(_resolve);
2250
-
2251
-var _json = require("json5");
2252
-
2253
-var _json2 = _interopRequireDefault(_json);
2254
-
2255
-var _pathIsAbsolute = require("path-is-absolute");
2256
-
2257
-var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute);
2258
-
2259
-var _path = require("path");
2260
-
2261
-var _path2 = _interopRequireDefault(_path);
2262
-
2263
-var _fs = require("fs");
2264
-
2265
-var _fs2 = _interopRequireDefault(_fs);
2266
-
2267
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2268
-
2269
-var existsCache = {};
2270
-var jsonCache = {};
2271
-
2272
-var BABELIGNORE_FILENAME = ".babelignore";
2273
-var BABELRC_FILENAME = ".babelrc";
2274
-var PACKAGE_FILENAME = "package.json";
2275
-
2276
-function exists(filename) {
2277
- var cached = existsCache[filename];
2278
- if (cached == null) {
2279
- return existsCache[filename] = _fs2.default.existsSync(filename);
2280
- } else {
2281
- return cached;
2282
- }
2283
-}
2284
-
2285
-function buildConfigChain() {
2286
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2287
- var log = arguments[1];
2288
-
2289
- var filename = opts.filename;
2290
- var builder = new ConfigChainBuilder(log);
2291
-
2292
- if (opts.babelrc !== false) {
2293
- builder.findConfigs(filename);
2294
- }
2295
-
2296
- builder.mergeConfig({
2297
- options: opts,
2298
- alias: "base",
2299
- dirname: filename && _path2.default.dirname(filename)
2300
- });
2301
-
2302
- return builder.configs;
2303
-}
2304
-
2305
-var ConfigChainBuilder = function () {
2306
- function ConfigChainBuilder(log) {
2307
- (0, _classCallCheck3.default)(this, ConfigChainBuilder);
2308
-
2309
- this.resolvedConfigs = [];
2310
- this.configs = [];
2311
- this.log = log;
2312
- }
2313
-
2314
- ConfigChainBuilder.prototype.findConfigs = function findConfigs(loc) {
2315
- if (!loc) return;
2316
-
2317
- if (!(0, _pathIsAbsolute2.default)(loc)) {
2318
- loc = _path2.default.join(process.cwd(), loc);
2319
- }
2320
-
2321
- var foundConfig = false;
2322
- var foundIgnore = false;
2323
-
2324
- while (loc !== (loc = _path2.default.dirname(loc))) {
2325
- if (!foundConfig) {
2326
- var configLoc = _path2.default.join(loc, BABELRC_FILENAME);
2327
- if (exists(configLoc)) {
2328
- this.addConfig(configLoc);
2329
- foundConfig = true;
2330
- }
2331
-
2332
- var pkgLoc = _path2.default.join(loc, PACKAGE_FILENAME);
2333
- if (!foundConfig && exists(pkgLoc)) {
2334
- foundConfig = this.addConfig(pkgLoc, "babel", JSON);
2335
- }
2336
- }
2337
-
2338
- if (!foundIgnore) {
2339
- var ignoreLoc = _path2.default.join(loc, BABELIGNORE_FILENAME);
2340
- if (exists(ignoreLoc)) {
2341
- this.addIgnoreConfig(ignoreLoc);
2342
- foundIgnore = true;
2343
- }
2344
- }
2345
-
2346
- if (foundIgnore && foundConfig) return;
2347
- }
2348
- };
2349
-
2350
- ConfigChainBuilder.prototype.addIgnoreConfig = function addIgnoreConfig(loc) {
2351
- var file = _fs2.default.readFileSync(loc, "utf8");
2352
- var lines = file.split("\n");
2353
-
2354
- lines = lines.map(function (line) {
2355
- return line.replace(/#(.*?)$/, "").trim();
2356
- }).filter(function (line) {
2357
- return !!line;
2358
- });
2359
-
2360
- if (lines.length) {
2361
- this.mergeConfig({
2362
- options: { ignore: lines },
2363
- alias: loc,
2364
- dirname: _path2.default.dirname(loc)
2365
- });
2366
- }
2367
- };
2368
-
2369
- ConfigChainBuilder.prototype.addConfig = function addConfig(loc, key) {
2370
- var json = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _json2.default;
2371
-
2372
- if (this.resolvedConfigs.indexOf(loc) >= 0) {
2373
- return false;
2374
- }
2375
-
2376
- this.resolvedConfigs.push(loc);
2377
-
2378
- var content = _fs2.default.readFileSync(loc, "utf8");
2379
- var options = void 0;
2380
-
2381
- try {
2382
- options = jsonCache[content] = jsonCache[content] || json.parse(content);
2383
- if (key) options = options[key];
2384
- } catch (err) {
2385
- err.message = loc + ": Error while parsing JSON - " + err.message;
2386
- throw err;
2387
- }
2388
-
2389
- this.mergeConfig({
2390
- options: options,
2391
- alias: loc,
2392
- dirname: _path2.default.dirname(loc)
2393
- });
2394
-
2395
- return !!options;
2396
- };
2397
-
2398
- ConfigChainBuilder.prototype.mergeConfig = function mergeConfig(_ref) {
2399
- var options = _ref.options,
2400
- alias = _ref.alias,
2401
- loc = _ref.loc,
2402
- dirname = _ref.dirname;
2403
-
2404
- if (!options) {
2405
- return false;
2406
- }
2407
-
2408
- options = (0, _assign2.default)({}, options);
2409
-
2410
- dirname = dirname || process.cwd();
2411
- loc = loc || alias;
2412
-
2413
- if (options.extends) {
2414
- var extendsLoc = (0, _resolve2.default)(options.extends, dirname);
2415
- if (extendsLoc) {
2416
- this.addConfig(extendsLoc);
2417
- } else {
2418
- if (this.log) this.log.error("Couldn't resolve extends clause of " + options.extends + " in " + alias);
2419
- }
2420
- delete options.extends;
2421
- }
2422
-
2423
- this.configs.push({
2424
- options: options,
2425
- alias: alias,
2426
- loc: loc,
2427
- dirname: dirname
2428
- });
2429
-
2430
- var envOpts = void 0;
2431
- var envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development";
2432
- if (options.env) {
2433
- envOpts = options.env[envKey];
2434
- delete options.env;
2435
- }
2436
-
2437
- this.mergeConfig({
2438
- options: envOpts,
2439
- alias: alias + ".env." + envKey,
2440
- dirname: dirname
2441
- });
2442
- };
2443
-
2444
- return ConfigChainBuilder;
2445
-}();
2446
-
2447
-module.exports = exports["default"];
2448
-}).call(this,require('_process'))
2449
-},{"../../../helpers/resolve":14,"_process":525,"babel-runtime/core-js/object/assign":99,"babel-runtime/helpers/classCallCheck":109,"fs":159,"json5":297,"path":522,"path-is-absolute":523}],21:[function(require,module,exports){
2450
-"use strict";
2451
-
2452
-module.exports = {
2453
- filename: {
2454
- type: "filename",
2455
- description: "filename to use when reading from stdin - this will be used in source-maps, errors etc",
2456
- default: "unknown",
2457
- shorthand: "f"
2458
- },
2459
-
2460
- filenameRelative: {
2461
- hidden: true,
2462
- type: "string"
2463
- },
2464
-
2465
- inputSourceMap: {
2466
- hidden: true
2467
- },
2468
-
2469
- env: {
2470
- hidden: true,
2471
- default: {}
2472
- },
2473
-
2474
- mode: {
2475
- description: "",
2476
- hidden: true
2477
- },
2478
-
2479
- retainLines: {
2480
- type: "boolean",
2481
- default: false,
2482
- description: "retain line numbers - will result in really ugly code"
2483
- },
2484
-
2485
- highlightCode: {
2486
- description: "enable/disable ANSI syntax highlighting of code frames (on by default)",
2487
- type: "boolean",
2488
- default: true
2489
- },
2490
-
2491
- suppressDeprecationMessages: {
2492
- type: "boolean",
2493
- default: false,
2494
- hidden: true
2495
- },
2496
-
2497
- presets: {
2498
- type: "list",
2499
- description: "",
2500
- default: []
2501
- },
2502
-
2503
- plugins: {
2504
- type: "list",
2505
- default: [],
2506
- description: ""
2507
- },
2508
-
2509
- ignore: {
2510
- type: "list",
2511
- description: "list of glob paths to **not** compile",
2512
- default: []
2513
- },
2514
-
2515
- only: {
2516
- type: "list",
2517
- description: "list of glob paths to **only** compile"
2518
- },
2519
-
2520
- code: {
2521
- hidden: true,
2522
- default: true,
2523
- type: "boolean"
2524
- },
2525
-
2526
- metadata: {
2527
- hidden: true,
2528
- default: true,
2529
- type: "boolean"
2530
- },
2531
-
2532
- ast: {
2533
- hidden: true,
2534
- default: true,
2535
- type: "boolean"
2536
- },
2537
-
2538
- extends: {
2539
- type: "string",
2540
- hidden: true
2541
- },
2542
-
2543
- comments: {
2544
- type: "boolean",
2545
- default: true,
2546
- description: "write comments to generated output (true by default)"
2547
- },
2548
-
2549
- shouldPrintComment: {
2550
- hidden: true,
2551
- description: "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"
2552
- },
2553
-
2554
- wrapPluginVisitorMethod: {
2555
- hidden: true,
2556
- description: "optional callback to wrap all visitor methods"
2557
- },
2558
-
2559
- compact: {
2560
- type: "booleanString",
2561
- default: "auto",
2562
- description: "do not include superfluous whitespace characters and line terminators [true|false|auto]"
2563
- },
2564
-
2565
- minified: {
2566
- type: "boolean",
2567
- default: false,
2568
- description: "save as much bytes when printing [true|false]"
2569
- },
2570
-
2571
- sourceMap: {
2572
- alias: "sourceMaps",
2573
- hidden: true
2574
- },
2575
-
2576
- sourceMaps: {
2577
- type: "booleanString",
2578
- description: "[true|false|inline]",
2579
- default: false,
2580
- shorthand: "s"
2581
- },
2582
-
2583
- sourceMapTarget: {
2584
- type: "string",
2585
- description: "set `file` on returned source map"
2586
- },
2587
-
2588
- sourceFileName: {
2589
- type: "string",
2590
- description: "set `sources[0]` on returned source map"
2591
- },
2592
-
2593
- sourceRoot: {
2594
- type: "filename",
2595
- description: "the root from which all sources are relative"
2596
- },
2597
-
2598
- babelrc: {
2599
- description: "Whether or not to look up .babelrc and .babelignore files",
2600
- type: "boolean",
2601
- default: true
2602
- },
2603
-
2604
- sourceType: {
2605
- description: "",
2606
- default: "module"
2607
- },
2608
-
2609
- auxiliaryCommentBefore: {
2610
- type: "string",
2611
- description: "print a comment before any injected non-user code"
2612
- },
2613
-
2614
- auxiliaryCommentAfter: {
2615
- type: "string",
2616
- description: "print a comment after any injected non-user code"
2617
- },
2618
-
2619
- resolveModuleSource: {
2620
- hidden: true
2621
- },
2622
-
2623
- getModuleId: {
2624
- hidden: true
2625
- },
2626
-
2627
- moduleRoot: {
2628
- type: "filename",
2629
- description: "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"
2630
- },
2631
-
2632
- moduleIds: {
2633
- type: "boolean",
2634
- default: false,
2635
- shorthand: "M",
2636
- description: "insert an explicit id for modules"
2637
- },
2638
-
2639
- moduleId: {
2640
- description: "specify a custom name for module ids",
2641
- type: "string"
2642
- },
2643
-
2644
- passPerPreset: {
2645
- description: "Whether to spawn a traversal pass per a preset. By default all presets are merged.",
2646
- type: "boolean",
2647
- default: false,
2648
- hidden: true
2649
- },
2650
-
2651
- parserOpts: {
2652
- description: "Options to pass into the parser, or to change parsers (parserOpts.parser)",
2653
- default: false
2654
- },
2655
-
2656
- generatorOpts: {
2657
- description: "Options to pass into the generator, or to change generators (generatorOpts.generator)",
2658
- default: false
2659
- }
2660
-};
2661
-},{}],22:[function(require,module,exports){
2662
-"use strict";
2663
-
2664
-exports.__esModule = true;
2665
-exports.config = undefined;
2666
-exports.normaliseOptions = normaliseOptions;
2667
-
2668
-var _parsers = require("./parsers");
2669
-
2670
-var parsers = _interopRequireWildcard(_parsers);
2671
-
2672
-var _config = require("./config");
2673
-
2674
-var _config2 = _interopRequireDefault(_config);
2675
-
2676
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2677
-
2678
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
2679
-
2680
-exports.config = _config2.default;
2681
-function normaliseOptions() {
2682
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2683
-
2684
- for (var key in options) {
2685
- var val = options[key];
2686
- if (val == null) continue;
2687
-
2688
- var opt = _config2.default[key];
2689
- if (opt && opt.alias) opt = _config2.default[opt.alias];
2690
- if (!opt) continue;
2691
-
2692
- var parser = parsers[opt.type];
2693
- if (parser) val = parser(val);
2694
-
2695
- options[key] = val;
2696
- }
2697
-
2698
- return options;
2699
-}
2700
-},{"./config":21,"./parsers":24}],23:[function(require,module,exports){
2701
-(function (process){
2702
-"use strict";
2703
-
2704
-exports.__esModule = true;
2705
-
2706
-var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties");
2707
-
2708
-var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
2709
-
2710
-var _stringify = require("babel-runtime/core-js/json/stringify");
2711
-
2712
-var _stringify2 = _interopRequireDefault(_stringify);
2713
-
2714
-var _assign = require("babel-runtime/core-js/object/assign");
2715
-
2716
-var _assign2 = _interopRequireDefault(_assign);
2717
-
2718
-var _getIterator2 = require("babel-runtime/core-js/get-iterator");
2719
-
2720
-var _getIterator3 = _interopRequireDefault(_getIterator2);
2721
-
2722
-var _typeof2 = require("babel-runtime/helpers/typeof");
2723
-
2724
-var _typeof3 = _interopRequireDefault(_typeof2);
2725
-
2726
-var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
2727
-
2728
-var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
2729
-
2730
-var _node = require("../../../api/node");
2731
-
2732
-var context = _interopRequireWildcard(_node);
2733
-
2734
-var _plugin2 = require("../../plugin");
2735
-
2736
-var _plugin3 = _interopRequireDefault(_plugin2);
2737
-
2738
-var _babelMessages = require("babel-messages");
2739
-
2740
-var messages = _interopRequireWildcard(_babelMessages);
2741
-
2742
-var _index = require("./index");
2743
-
2744
-var _resolvePlugin = require("../../../helpers/resolve-plugin");
2745
-
2746
-var _resolvePlugin2 = _interopRequireDefault(_resolvePlugin);
2747
-
2748
-var _resolvePreset = require("../../../helpers/resolve-preset");
2749
-
2750
-var _resolvePreset2 = _interopRequireDefault(_resolvePreset);
2751
-
2752
-var _cloneDeepWith = require("lodash/cloneDeepWith");
2753
-
2754
-var _cloneDeepWith2 = _interopRequireDefault(_cloneDeepWith);
2755
-
2756
-var _clone = require("lodash/clone");
2757
-
2758
-var _clone2 = _interopRequireDefault(_clone);
2759
-
2760
-var _merge = require("../../../helpers/merge");
2761
-
2762
-var _merge2 = _interopRequireDefault(_merge);
2763
-
2764
-var _config2 = require("./config");
2765
-
2766
-var _config3 = _interopRequireDefault(_config2);
2767
-
2768
-var _removed = require("./removed");
2769
-
2770
-var _removed2 = _interopRequireDefault(_removed);
2771
-
2772
-var _buildConfigChain = require("./build-config-chain");
2773
-
2774
-var _buildConfigChain2 = _interopRequireDefault(_buildConfigChain);
2775
-
2776
-var _path = require("path");
2777
-
2778
-var _path2 = _interopRequireDefault(_path);
2779
-
2780
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
2781
-
2782
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2783
-
2784
-var OptionManager = function () {
2785
- function OptionManager(log) {
2786
- (0, _classCallCheck3.default)(this, OptionManager);
2787
-
2788
- this.resolvedConfigs = [];
2789
- this.options = OptionManager.createBareOptions();
2790
- this.log = log;
2791
- }
2792
-
2793
- OptionManager.memoisePluginContainer = function memoisePluginContainer(fn, loc, i, alias) {
2794
- for (var _iterator = OptionManager.memoisedPlugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
2795
- var _ref;
2796
-
2797
- if (_isArray) {
2798
- if (_i >= _iterator.length) break;
2799
- _ref = _iterator[_i++];
2800
- } else {
2801
- _i = _iterator.next();
2802
- if (_i.done) break;
2803
- _ref = _i.value;
2804
- }
2805
-
2806
- var cache = _ref;
2807
-
2808
- if (cache.container === fn) return cache.plugin;
2809
- }
2810
-
2811
- var obj = void 0;
2812
-
2813
- if (typeof fn === "function") {
2814
- obj = fn(context);
2815
- } else {
2816
- obj = fn;
2817
- }
2818
-
2819
- if ((typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) === "object") {
2820
- var _plugin = new _plugin3.default(obj, alias);
2821
- OptionManager.memoisedPlugins.push({
2822
- container: fn,
2823
- plugin: _plugin
2824
- });
2825
- return _plugin;
2826
- } else {
2827
- throw new TypeError(messages.get("pluginNotObject", loc, i, typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) + loc + i);
2828
- }
2829
- };
2830
-
2831
- OptionManager.createBareOptions = function createBareOptions() {
2832
- var opts = {};
2833
-
2834
- for (var _key in _config3.default) {
2835
- var opt = _config3.default[_key];
2836
- opts[_key] = (0, _clone2.default)(opt.default);
2837
- }
2838
-
2839
- return opts;
2840
- };
2841
-
2842
- OptionManager.normalisePlugin = function normalisePlugin(plugin, loc, i, alias) {
2843
- plugin = plugin.__esModule ? plugin.default : plugin;
2844
-
2845
- if (!(plugin instanceof _plugin3.default)) {
2846
- if (typeof plugin === "function" || (typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)) === "object") {
2847
- plugin = OptionManager.memoisePluginContainer(plugin, loc, i, alias);
2848
- } else {
2849
- throw new TypeError(messages.get("pluginNotFunction", loc, i, typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)));
2850
- }
2851
- }
2852
-
2853
- plugin.init(loc, i);
2854
-
2855
- return plugin;
2856
- };
2857
-
2858
- OptionManager.normalisePlugins = function normalisePlugins(loc, dirname, plugins) {
2859
- return plugins.map(function (val, i) {
2860
- var plugin = void 0,
2861
- options = void 0;
2862
-
2863
- if (!val) {
2864
- throw new TypeError("Falsy value found in plugins");
2865
- }
2866
-
2867
- if (Array.isArray(val)) {
2868
- plugin = val[0];
2869
- options = val[1];
2870
- } else {
2871
- plugin = val;
2872
- }
2873
-
2874
- var alias = typeof plugin === "string" ? plugin : loc + "$" + i;
2875
-
2876
- if (typeof plugin === "string") {
2877
- var pluginLoc = (0, _resolvePlugin2.default)(plugin, dirname);
2878
- if (pluginLoc) {
2879
- plugin = require(pluginLoc);
2880
- } else {
2881
- throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
2882
- }
2883
- }
2884
-
2885
- plugin = OptionManager.normalisePlugin(plugin, loc, i, alias);
2886
-
2887
- return [plugin, options];
2888
- });
2889
- };
2890
-
2891
- OptionManager.prototype.mergeOptions = function mergeOptions(_ref2) {
2892
- var _this = this;
2893
-
2894
- var rawOpts = _ref2.options,
2895
- extendingOpts = _ref2.extending,
2896
- alias = _ref2.alias,
2897
- loc = _ref2.loc,
2898
- dirname = _ref2.dirname;
2899
-
2900
- alias = alias || "foreign";
2901
- if (!rawOpts) return;
2902
-
2903
- if ((typeof rawOpts === "undefined" ? "undefined" : (0, _typeof3.default)(rawOpts)) !== "object" || Array.isArray(rawOpts)) {
2904
- this.log.error("Invalid options type for " + alias, TypeError);
2905
- }
2906
-
2907
- var opts = (0, _cloneDeepWith2.default)(rawOpts, function (val) {
2908
- if (val instanceof _plugin3.default) {
2909
- return val;
2910
- }
2911
- });
2912
-
2913
- dirname = dirname || process.cwd();
2914
- loc = loc || alias;
2915
-
2916
- for (var _key2 in opts) {
2917
- var option = _config3.default[_key2];
2918
-
2919
- if (!option && this.log) {
2920
- if (_removed2.default[_key2]) {
2921
- this.log.error("Using removed Babel 5 option: " + alias + "." + _key2 + " - " + _removed2.default[_key2].message, ReferenceError);
2922
- } else {
2923
- var unknownOptErr = "Unknown option: " + alias + "." + _key2 + ". Check out http://babeljs.io/docs/usage/options/ for more information about options.";
2924
- var presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.";
2925
-
2926
-
2927
- this.log.error(unknownOptErr + "\n\n" + presetConfigErr, ReferenceError);
2928
- }
2929
- }
2930
- }
2931
-
2932
- (0, _index.normaliseOptions)(opts);
2933
-
2934
- if (opts.plugins) {
2935
- opts.plugins = OptionManager.normalisePlugins(loc, dirname, opts.plugins);
2936
- }
2937
-
2938
- if (opts.presets) {
2939
- if (opts.passPerPreset) {
2940
- opts.presets = this.resolvePresets(opts.presets, dirname, function (preset, presetLoc) {
2941
- _this.mergeOptions({
2942
- options: preset,
2943
- extending: preset,
2944
- alias: presetLoc,
2945
- loc: presetLoc,
2946
- dirname: dirname
2947
- });
2948
- });
2949
- } else {
2950
- this.mergePresets(opts.presets, dirname);
2951
- delete opts.presets;
2952
- }
2953
- }
2954
-
2955
- if (rawOpts === extendingOpts) {
2956
- (0, _assign2.default)(extendingOpts, opts);
2957
- } else {
2958
- (0, _merge2.default)(extendingOpts || this.options, opts);
2959
- }
2960
- };
2961
-
2962
- OptionManager.prototype.mergePresets = function mergePresets(presets, dirname) {
2963
- var _this2 = this;
2964
-
2965
- this.resolvePresets(presets, dirname, function (presetOpts, presetLoc) {
2966
- _this2.mergeOptions({
2967
- options: presetOpts,
2968
- alias: presetLoc,
2969
- loc: presetLoc,
2970
- dirname: _path2.default.dirname(presetLoc || "")
2971
- });
2972
- });
2973
- };
2974
-
2975
- OptionManager.prototype.resolvePresets = function resolvePresets(presets, dirname, onResolve) {
2976
- return presets.map(function (val) {
2977
- var options = void 0;
2978
- if (Array.isArray(val)) {
2979
- if (val.length > 2) {
2980
- throw new Error("Unexpected extra options " + (0, _stringify2.default)(val.slice(2)) + " passed to preset.");
2981
- }
2982
-
2983
- var _val = val;
2984
- val = _val[0];
2985
- options = _val[1];
2986
- }
2987
-
2988
- var presetLoc = void 0;
2989
- try {
2990
- if (typeof val === "string") {
2991
- presetLoc = (0, _resolvePreset2.default)(val, dirname);
2992
-
2993
- if (!presetLoc) {
2994
- throw new Error("Couldn't find preset " + (0, _stringify2.default)(val) + " relative to directory " + (0, _stringify2.default)(dirname));
2995
- }
2996
-
2997
- val = require(presetLoc);
2998
- }
2999
-
3000
- if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.__esModule) {
3001
- if (val.default) {
3002
- val = val.default;
3003
- } else {
3004
- var _val2 = val,
3005
- __esModule = _val2.__esModule,
3006
- rest = (0, _objectWithoutProperties3.default)(_val2, ["__esModule"]);
3007
-
3008
- val = rest;
3009
- }
3010
- }
3011
-
3012
- if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.buildPreset) val = val.buildPreset;
3013
-
3014
- if (typeof val !== "function" && options !== undefined) {
3015
- throw new Error("Options " + (0, _stringify2.default)(options) + " passed to " + (presetLoc || "a preset") + " which does not accept options.");
3016
- }
3017
-
3018
- if (typeof val === "function") val = val(context, options, { dirname: dirname });
3019
-
3020
- if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) !== "object") {
3021
- throw new Error("Unsupported preset format: " + val + ".");
3022
- }
3023
-
3024
- onResolve && onResolve(val, presetLoc);
3025
- } catch (e) {
3026
- if (presetLoc) {
3027
- e.message += " (While processing preset: " + (0, _stringify2.default)(presetLoc) + ")";
3028
- }
3029
- throw e;
3030
- }
3031
- return val;
3032
- });
3033
- };
3034
-
3035
- OptionManager.prototype.normaliseOptions = function normaliseOptions() {
3036
- var opts = this.options;
3037
-
3038
- for (var _key3 in _config3.default) {
3039
- var option = _config3.default[_key3];
3040
- var val = opts[_key3];
3041
-
3042
- if (!val && option.optional) continue;
3043
-
3044
- if (option.alias) {
3045
- opts[option.alias] = opts[option.alias] || val;
3046
- } else {
3047
- opts[_key3] = val;
3048
- }
3049
- }
3050
- };
3051
-
3052
- OptionManager.prototype.init = function init() {
3053
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3054
-
3055
- for (var _iterator2 = (0, _buildConfigChain2.default)(opts, this.log), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
3056
- var _ref3;
3057
-
3058
- if (_isArray2) {
3059
- if (_i2 >= _iterator2.length) break;
3060
- _ref3 = _iterator2[_i2++];
3061
- } else {
3062
- _i2 = _iterator2.next();
3063
- if (_i2.done) break;
3064
- _ref3 = _i2.value;
3065
- }
3066
-
3067
- var _config = _ref3;
3068
-
3069
- this.mergeOptions(_config);
3070
- }
3071
-
3072
- this.normaliseOptions(opts);
3073
-
3074
- return this.options;
3075
- };
3076
-
3077
- return OptionManager;
3078
-}();
3079
-
3080
-exports.default = OptionManager;
3081
-
3082
-
3083
-OptionManager.memoisedPlugins = [];
3084
-module.exports = exports["default"];
3085
-}).call(this,require('_process'))
3086
-},{"../../../api/node":6,"../../../helpers/merge":9,"../../../helpers/resolve-plugin":12,"../../../helpers/resolve-preset":13,"../../plugin":30,"./build-config-chain":20,"./config":21,"./index":22,"./removed":25,"_process":525,"babel-messages":61,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/json/stringify":96,"babel-runtime/core-js/object/assign":99,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/objectWithoutProperties":111,"babel-runtime/helpers/typeof":113,"lodash/clone":466,"lodash/cloneDeepWith":468,"path":522}],24:[function(require,module,exports){
3087
-"use strict";
3088
-
3089
-exports.__esModule = true;
3090
-exports.filename = undefined;
3091
-exports.boolean = boolean;
3092
-exports.booleanString = booleanString;
3093
-exports.list = list;
3094
-
3095
-var _slash = require("slash");
3096
-
3097
-var _slash2 = _interopRequireDefault(_slash);
3098
-
3099
-var _util = require("../../../util");
3100
-
3101
-var util = _interopRequireWildcard(_util);
3102
-
3103
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
3104
-
3105
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3106
-
3107
-var filename = exports.filename = _slash2.default;
3108
-
3109
-function boolean(val) {
3110
- return !!val;
3111
-}
3112
-
3113
-function booleanString(val) {
3114
- return util.booleanify(val);
3115
-}
3116
-
3117
-function list(val) {
3118
- return util.list(val);
3119
-}
3120
-},{"../../../util":31,"slash":541}],25:[function(require,module,exports){
3121
-"use strict";
3122
-
3123
-module.exports = {
3124
- "auxiliaryComment": {
3125
- "message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
3126
- },
3127
- "blacklist": {
3128
- "message": "Put the specific transforms you want in the `plugins` option"
3129
- },
3130
- "breakConfig": {
3131
- "message": "This is not a necessary option in Babel 6"
3132
- },
3133
- "experimental": {
3134
- "message": "Put the specific transforms you want in the `plugins` option"
3135
- },
3136
- "externalHelpers": {
3137
- "message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"
3138
- },
3139
- "extra": {
3140
- "message": ""
3141
- },
3142
- "jsxPragma": {
3143
- "message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
3144
- },
3145
-
3146
- "loose": {
3147
- "message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."
3148
- },
3149
- "metadataUsedHelpers": {
3150
- "message": "Not required anymore as this is enabled by default"
3151
- },
3152
- "modules": {
3153
- "message": "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"
3154
- },
3155
- "nonStandard": {
3156
- "message": "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
3157
- },
3158
- "optional": {
3159
- "message": "Put the specific transforms you want in the `plugins` option"
3160
- },
3161
- "sourceMapName": {
3162
- "message": "Use the `sourceMapTarget` option"
3163
- },
3164
- "stage": {
3165
- "message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
3166
- },
3167
- "whitelist": {
3168
- "message": "Put the specific transforms you want in the `plugins` option"
3169
- }
3170
-};
3171
-},{}],26:[function(require,module,exports){
3172
-"use strict";
3173
-
3174
-exports.__esModule = true;
3175
-
3176
-var _plugin = require("../plugin");
3177
-
3178
-var _plugin2 = _interopRequireDefault(_plugin);
3179
-
3180
-var _sortBy = require("lodash/sortBy");
3181
-
3182
-var _sortBy2 = _interopRequireDefault(_sortBy);
3183
-
3184
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3185
-
3186
-exports.default = new _plugin2.default({
3187
-
3188
- name: "internal.blockHoist",
3189
-
3190
- visitor: {
3191
- Block: {
3192
- exit: function exit(_ref) {
3193
- var node = _ref.node;
3194
-
3195
- var hasChange = false;
3196
- for (var i = 0; i < node.body.length; i++) {
3197
- var bodyNode = node.body[i];
3198
- if (bodyNode && bodyNode._blockHoist != null) {
3199
- hasChange = true;
3200
- break;
3201
- }
3202
- }
3203
- if (!hasChange) return;
3204
-
3205
- node.body = (0, _sortBy2.default)(node.body, function (bodyNode) {
3206
- var priority = bodyNode && bodyNode._blockHoist;
3207
- if (priority == null) priority = 1;
3208
- if (priority === true) priority = 2;
3209
-
3210
- return -1 * priority;
3211
- });
3212
- }
3213
- }
3214
- }
3215
-});
3216
-module.exports = exports["default"];
3217
-},{"../plugin":30,"lodash/sortBy":508}],27:[function(require,module,exports){
3218
-"use strict";
3219
-
3220
-exports.__esModule = true;
3221
-
3222
-var _symbol = require("babel-runtime/core-js/symbol");
3223
-
3224
-var _symbol2 = _interopRequireDefault(_symbol);
3225
-
3226
-var _plugin = require("../plugin");
3227
-
3228
-var _plugin2 = _interopRequireDefault(_plugin);
3229
-
3230
-var _babelTypes = require("babel-types");
3231
-
3232
-var t = _interopRequireWildcard(_babelTypes);
3233
-
3234
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
3235
-
3236
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3237
-
3238
-var SUPER_THIS_BOUND = (0, _symbol2.default)("super this bound");
3239
-
3240
-var superVisitor = {
3241
- CallExpression: function CallExpression(path) {
3242
- if (!path.get("callee").isSuper()) return;
3243
-
3244
- var node = path.node;
3245
-
3246
- if (node[SUPER_THIS_BOUND]) return;
3247
- node[SUPER_THIS_BOUND] = true;
3248
-
3249
- path.replaceWith(t.assignmentExpression("=", this.id, node));
3250
- }
3251
-};
3252
-
3253
-exports.default = new _plugin2.default({
3254
- name: "internal.shadowFunctions",
3255
-
3256
- visitor: {
3257
- ThisExpression: function ThisExpression(path) {
3258
- remap(path, "this");
3259
- },
3260
- ReferencedIdentifier: function ReferencedIdentifier(path) {
3261
- if (path.node.name === "arguments") {
3262
- remap(path, "arguments");
3263
- }
3264
- }
3265
- }
3266
-});
3267
-
3268
-
3269
-function shouldShadow(path, shadowPath) {
3270
- if (path.is("_forceShadow")) {
3271
- return true;
3272
- } else {
3273
- return shadowPath;
3274
- }
3275
-}
3276
-
3277
-function remap(path, key) {
3278
- var shadowPath = path.inShadow(key);
3279
- if (!shouldShadow(path, shadowPath)) return;
3280
-
3281
- var shadowFunction = path.node._shadowedFunctionLiteral;
3282
-
3283
- var currentFunction = void 0;
3284
- var passedShadowFunction = false;
3285
-
3286
- var fnPath = path.find(function (innerPath) {
3287
- if (innerPath.parentPath && innerPath.parentPath.isClassProperty() && innerPath.key === "value") {
3288
- return true;
3289
- }
3290
- if (path === innerPath) return false;
3291
- if (innerPath.isProgram() || innerPath.isFunction()) {
3292
- currentFunction = currentFunction || innerPath;
3293
- }
3294
-
3295
- if (innerPath.isProgram()) {
3296
- passedShadowFunction = true;
3297
-
3298
- return true;
3299
- } else if (innerPath.isFunction() && !innerPath.isArrowFunctionExpression()) {
3300
- if (shadowFunction) {
3301
- if (innerPath === shadowFunction || innerPath.node === shadowFunction.node) return true;
3302
- } else {
3303
- if (!innerPath.is("shadow")) return true;
3304
- }
3305
-
3306
- passedShadowFunction = true;
3307
- return false;
3308
- }
3309
-
3310
- return false;
3311
- });
3312
-
3313
- if (shadowFunction && fnPath.isProgram() && !shadowFunction.isProgram()) {
3314
- fnPath = path.findParent(function (p) {
3315
- return p.isProgram() || p.isFunction();
3316
- });
3317
- }
3318
-
3319
- if (fnPath === currentFunction) return;
3320
-
3321
- if (!passedShadowFunction) return;
3322
-
3323
- var cached = fnPath.getData(key);
3324
- if (cached) return path.replaceWith(cached);
3325
-
3326
- var id = path.scope.generateUidIdentifier(key);
3327
-
3328
- fnPath.setData(key, id);
3329
-
3330
- var classPath = fnPath.findParent(function (p) {
3331
- return p.isClass();
3332
- });
3333
- var hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass);
3334
-
3335
- if (key === "this" && fnPath.isMethod({ kind: "constructor" }) && hasSuperClass) {
3336
- fnPath.scope.push({ id: id });
3337
-
3338
- fnPath.traverse(superVisitor, { id: id });
3339
- } else {
3340
- var init = key === "this" ? t.thisExpression() : t.identifier(key);
3341
-
3342
- if (shadowFunction) init._shadowedFunctionLiteral = shadowFunction;
3343
-
3344
- fnPath.scope.push({ id: id, init: init });
3345
- }
3346
-
3347
- return path.replaceWith(id);
3348
-}
3349
-module.exports = exports["default"];
3350
-},{"../plugin":30,"babel-runtime/core-js/symbol":104,"babel-types":151}],28:[function(require,module,exports){
3351
-"use strict";
3352
-
3353
-exports.__esModule = true;
3354
-
3355
-var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
3356
-
3357
-var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
3358
-
3359
-var _normalizeAst = require("../helpers/normalize-ast");
3360
-
3361
-var _normalizeAst2 = _interopRequireDefault(_normalizeAst);
3362
-
3363
-var _plugin = require("./plugin");
3364
-
3365
-var _plugin2 = _interopRequireDefault(_plugin);
3366
-
3367
-var _file = require("./file");
3368
-
3369
-var _file2 = _interopRequireDefault(_file);
3370
-
3371
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3372
-
3373
-var Pipeline = function () {
3374
- function Pipeline() {
3375
- (0, _classCallCheck3.default)(this, Pipeline);
3376
- }
3377
-
3378
- Pipeline.prototype.lint = function lint(code) {
3379
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3380
-
3381
- opts.code = false;
3382
- opts.mode = "lint";
3383
- return this.transform(code, opts);
3384
- };
3385
-
3386
- Pipeline.prototype.pretransform = function pretransform(code, opts) {
3387
- var file = new _file2.default(opts, this);
3388
- return file.wrap(code, function () {
3389
- file.addCode(code);
3390
- file.parseCode(code);
3391
- return file;
3392
- });
3393
- };
3394
-
3395
- Pipeline.prototype.transform = function transform(code, opts) {
3396
- var file = new _file2.default(opts, this);
3397
- return file.wrap(code, function () {
3398
- file.addCode(code);
3399
- file.parseCode(code);
3400
- return file.transform();
3401
- });
3402
- };
3403
-
3404
- Pipeline.prototype.analyse = function analyse(code) {
3405
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3406
- var visitor = arguments[2];
3407
-
3408
- opts.code = false;
3409
- if (visitor) {
3410
- opts.plugins = opts.plugins || [];
3411
- opts.plugins.push(new _plugin2.default({ visitor: visitor }));
3412
- }
3413
- return this.transform(code, opts).metadata;
3414
- };
3415
-
3416
- Pipeline.prototype.transformFromAst = function transformFromAst(ast, code, opts) {
3417
- ast = (0, _normalizeAst2.default)(ast);
3418
-
3419
- var file = new _file2.default(opts, this);
3420
- return file.wrap(code, function () {
3421
- file.addCode(code);
3422
- file.addAst(ast);
3423
- return file.transform();
3424
- });
3425
- };
3426
-
3427
- return Pipeline;
3428
-}();
3429
-
3430
-exports.default = Pipeline;
3431
-module.exports = exports["default"];
3432
-},{"../helpers/normalize-ast":10,"./file":17,"./plugin":30,"babel-runtime/helpers/classCallCheck":109}],29:[function(require,module,exports){
3433
-"use strict";
3434
-
3435
-exports.__esModule = true;
3436
-
3437
-var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
3438
-
3439
-var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
3440
-
3441
-var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
3442
-
3443
-var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
3444
-
3445
-var _inherits2 = require("babel-runtime/helpers/inherits");
3446
-
3447
-var _inherits3 = _interopRequireDefault(_inherits2);
3448
-
3449
-var _store = require("../store");
3450
-
3451
-var _store2 = _interopRequireDefault(_store);
3452
-
3453
-var _file5 = require("./file");
3454
-
3455
-var _file6 = _interopRequireDefault(_file5);
3456
-
3457
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3458
-
3459
-var PluginPass = function (_Store) {
3460
- (0, _inherits3.default)(PluginPass, _Store);
3461
-
3462
- function PluginPass(file, plugin) {
3463
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3464
- (0, _classCallCheck3.default)(this, PluginPass);
3465
-
3466
- var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
3467
-
3468
- _this.plugin = plugin;
3469
- _this.key = plugin.key;
3470
- _this.file = file;
3471
- _this.opts = options;
3472
- return _this;
3473
- }
3474
-
3475
- PluginPass.prototype.addHelper = function addHelper() {
3476
- var _file;
3477
-
3478
- return (_file = this.file).addHelper.apply(_file, arguments);
3479
- };
3480
-
3481
- PluginPass.prototype.addImport = function addImport() {
3482
- var _file2;
3483
-
3484
- return (_file2 = this.file).addImport.apply(_file2, arguments);
3485
- };
3486
-
3487
- PluginPass.prototype.getModuleName = function getModuleName() {
3488
- var _file3;
3489
-
3490
- return (_file3 = this.file).getModuleName.apply(_file3, arguments);
3491
- };
3492
-
3493
- PluginPass.prototype.buildCodeFrameError = function buildCodeFrameError() {
3494
- var _file4;
3495
-
3496
- return (_file4 = this.file).buildCodeFrameError.apply(_file4, arguments);
3497
- };
3498
-
3499
- return PluginPass;
3500
-}(_store2.default);
3501
-
3502
-exports.default = PluginPass;
3503
-module.exports = exports["default"];
3504
-},{"../store":15,"./file":17,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112}],30:[function(require,module,exports){
3505
-"use strict";
3506
-
3507
-exports.__esModule = true;
3508
-
3509
-var _getIterator2 = require("babel-runtime/core-js/get-iterator");
3510
-
3511
-var _getIterator3 = _interopRequireDefault(_getIterator2);
3512
-
3513
-var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
3514
-
3515
-var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
3516
-
3517
-var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
3518
-
3519
-var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
3520
-
3521
-var _inherits2 = require("babel-runtime/helpers/inherits");
3522
-
3523
-var _inherits3 = _interopRequireDefault(_inherits2);
3524
-
3525
-var _optionManager = require("./file/options/option-manager");
3526
-
3527
-var _optionManager2 = _interopRequireDefault(_optionManager);
3528
-
3529
-var _babelMessages = require("babel-messages");
3530
-
3531
-var messages = _interopRequireWildcard(_babelMessages);
3532
-
3533
-var _store = require("../store");
3534
-
3535
-var _store2 = _interopRequireDefault(_store);
3536
-
3537
-var _babelTraverse = require("babel-traverse");
3538
-
3539
-var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
3540
-
3541
-var _assign = require("lodash/assign");
3542
-
3543
-var _assign2 = _interopRequireDefault(_assign);
3544
-
3545
-var _clone = require("lodash/clone");
3546
-
3547
-var _clone2 = _interopRequireDefault(_clone);
3548
-
3549
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
3550
-
3551
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3552
-
3553
-var GLOBAL_VISITOR_PROPS = ["enter", "exit"];
3554
-
3555
-var Plugin = function (_Store) {
3556
- (0, _inherits3.default)(Plugin, _Store);
3557
-
3558
- function Plugin(plugin, key) {
3559
- (0, _classCallCheck3.default)(this, Plugin);
3560
-
3561
- var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
3562
-
3563
- _this.initialized = false;
3564
- _this.raw = (0, _assign2.default)({}, plugin);
3565
- _this.key = _this.take("name") || key;
3566
-
3567
- _this.manipulateOptions = _this.take("manipulateOptions");
3568
- _this.post = _this.take("post");
3569
- _this.pre = _this.take("pre");
3570
- _this.visitor = _this.normaliseVisitor((0, _clone2.default)(_this.take("visitor")) || {});
3571
- return _this;
3572
- }
3573
-
3574
- Plugin.prototype.take = function take(key) {
3575
- var val = this.raw[key];
3576
- delete this.raw[key];
3577
- return val;
3578
- };
3579
-
3580
- Plugin.prototype.chain = function chain(target, key) {
3581
- if (!target[key]) return this[key];
3582
- if (!this[key]) return target[key];
3583
-
3584
- var fns = [target[key], this[key]];
3585
-
3586
- return function () {
3587
- var val = void 0;
3588
-
3589
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
3590
- args[_key] = arguments[_key];
3591
- }
3592
-
3593
- for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
3594
- var _ref;
3595
-
3596
- if (_isArray) {
3597
- if (_i >= _iterator.length) break;
3598
- _ref = _iterator[_i++];
3599
- } else {
3600
- _i = _iterator.next();
3601
- if (_i.done) break;
3602
- _ref = _i.value;
3603
- }
3604
-
3605
- var fn = _ref;
3606
-
3607
- if (fn) {
3608
- var ret = fn.apply(this, args);
3609
- if (ret != null) val = ret;
3610
- }
3611
- }
3612
- return val;
3613
- };
3614
- };
3615
-
3616
- Plugin.prototype.maybeInherit = function maybeInherit(loc) {
3617
- var inherits = this.take("inherits");
3618
- if (!inherits) return;
3619
-
3620
- inherits = _optionManager2.default.normalisePlugin(inherits, loc, "inherits");
3621
-
3622
- this.manipulateOptions = this.chain(inherits, "manipulateOptions");
3623
- this.post = this.chain(inherits, "post");
3624
- this.pre = this.chain(inherits, "pre");
3625
- this.visitor = _babelTraverse2.default.visitors.merge([inherits.visitor, this.visitor]);
3626
- };
3627
-
3628
- Plugin.prototype.init = function init(loc, i) {
3629
- if (this.initialized) return;
3630
- this.initialized = true;
3631
-
3632
- this.maybeInherit(loc);
3633
-
3634
- for (var key in this.raw) {
3635
- throw new Error(messages.get("pluginInvalidProperty", loc, i, key));
3636
- }
3637
- };
3638
-
3639
- Plugin.prototype.normaliseVisitor = function normaliseVisitor(visitor) {
3640
- for (var _iterator2 = GLOBAL_VISITOR_PROPS, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
3641
- var _ref2;
3642
-
3643
- if (_isArray2) {
3644
- if (_i2 >= _iterator2.length) break;
3645
- _ref2 = _iterator2[_i2++];
3646
- } else {
3647
- _i2 = _iterator2.next();
3648
- if (_i2.done) break;
3649
- _ref2 = _i2.value;
3650
- }
3651
-
3652
- var key = _ref2;
3653
-
3654
- if (visitor[key]) {
3655
- throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. " + "Please target individual nodes.");
3656
- }
3657
- }
3658
-
3659
- _babelTraverse2.default.explode(visitor);
3660
- return visitor;
3661
- };
3662
-
3663
- return Plugin;
3664
-}(_store2.default);
3665
-
3666
-exports.default = Plugin;
3667
-module.exports = exports["default"];
3668
-},{"../store":15,"./file/options/option-manager":23,"babel-messages":61,"babel-runtime/core-js/get-iterator":95,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112,"babel-traverse":118,"lodash/assign":463,"lodash/clone":466}],31:[function(require,module,exports){
3669
-"use strict";
3670
-
3671
-exports.__esModule = true;
3672
-exports.inspect = exports.inherits = undefined;
3673
-
3674
-var _getIterator2 = require("babel-runtime/core-js/get-iterator");
3675
-
3676
-var _getIterator3 = _interopRequireDefault(_getIterator2);
3677
-
3678
-var _util = require("util");
3679
-
3680
-Object.defineProperty(exports, "inherits", {
3681
- enumerable: true,
3682
- get: function get() {
3683
- return _util.inherits;
3684
- }
3685
-});
3686
-Object.defineProperty(exports, "inspect", {
3687
- enumerable: true,
3688
- get: function get() {
3689
- return _util.inspect;
3690
- }
3691
-});
3692
-exports.canCompile = canCompile;
3693
-exports.list = list;
3694
-exports.regexify = regexify;
3695
-exports.arrayify = arrayify;
3696
-exports.booleanify = booleanify;
3697
-exports.shouldIgnore = shouldIgnore;
3698
-
3699
-var _escapeRegExp = require("lodash/escapeRegExp");
3700
-
3701
-var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp);
3702
-
3703
-var _startsWith = require("lodash/startsWith");
3704
-
3705
-var _startsWith2 = _interopRequireDefault(_startsWith);
3706
-
3707
-var _minimatch = require("minimatch");
3708
-
3709
-var _minimatch2 = _interopRequireDefault(_minimatch);
3710
-
3711
-var _includes = require("lodash/includes");
3712
-
3713
-var _includes2 = _interopRequireDefault(_includes);
3714
-
3715
-var _isRegExp = require("lodash/isRegExp");
3716
-
3717
-var _isRegExp2 = _interopRequireDefault(_isRegExp);
3718
-
3719
-var _path = require("path");
3720
-
3721
-var _path2 = _interopRequireDefault(_path);
3722
-
3723
-var _slash = require("slash");
3724
-
3725
-var _slash2 = _interopRequireDefault(_slash);
3726
-
3727
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3728
-
3729
-function canCompile(filename, altExts) {
3730
- var exts = altExts || canCompile.EXTENSIONS;
3731
- var ext = _path2.default.extname(filename);
3732
- return (0, _includes2.default)(exts, ext);
3733
-}
3734
-
3735
-canCompile.EXTENSIONS = [".js", ".jsx", ".es6", ".es"];
3736
-
3737
-function list(val) {
3738
- if (!val) {
3739
- return [];
3740
- } else if (Array.isArray(val)) {
3741
- return val;
3742
- } else if (typeof val === "string") {
3743
- return val.split(",");
3744
- } else {
3745
- return [val];
3746
- }
3747
-}
3748
-
3749
-function regexify(val) {
3750
- if (!val) {
3751
- return new RegExp(/.^/);
3752
- }
3753
-
3754
- if (Array.isArray(val)) {
3755
- val = new RegExp(val.map(_escapeRegExp2.default).join("|"), "i");
3756
- }
3757
-
3758
- if (typeof val === "string") {
3759
- val = (0, _slash2.default)(val);
3760
-
3761
- if ((0, _startsWith2.default)(val, "./") || (0, _startsWith2.default)(val, "*/")) val = val.slice(2);
3762
- if ((0, _startsWith2.default)(val, "**/")) val = val.slice(3);
3763
-
3764
- var regex = _minimatch2.default.makeRe(val, { nocase: true });
3765
- return new RegExp(regex.source.slice(1, -1), "i");
3766
- }
3767
-
3768
- if ((0, _isRegExp2.default)(val)) {
3769
- return val;
3770
- }
3771
-
3772
- throw new TypeError("illegal type for regexify");
3773
-}
3774
-
3775
-function arrayify(val, mapFn) {
3776
- if (!val) return [];
3777
- if (typeof val === "boolean") return arrayify([val], mapFn);
3778
- if (typeof val === "string") return arrayify(list(val), mapFn);
3779
-
3780
- if (Array.isArray(val)) {
3781
- if (mapFn) val = val.map(mapFn);
3782
- return val;
3783
- }
3784
-
3785
- return [val];
3786
-}
3787
-
3788
-function booleanify(val) {
3789
- if (val === "true" || val == 1) {
3790
- return true;
3791
- }
3792
-
3793
- if (val === "false" || val == 0 || !val) {
3794
- return false;
3795
- }
3796
-
3797
- return val;
3798
-}
3799
-
3800
-function shouldIgnore(filename) {
3801
- var ignore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
3802
- var only = arguments[2];
3803
-
3804
- filename = filename.replace(/\\/g, "/");
3805
-
3806
- if (only) {
3807
- for (var _iterator = only, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
3808
- var _ref;
3809
-
3810
- if (_isArray) {
3811
- if (_i >= _iterator.length) break;
3812
- _ref = _iterator[_i++];
3813
- } else {
3814
- _i = _iterator.next();
3815
- if (_i.done) break;
3816
- _ref = _i.value;
3817
- }
3818
-
3819
- var pattern = _ref;
3820
-
3821
- if (_shouldIgnore(pattern, filename)) return false;
3822
- }
3823
- return true;
3824
- } else if (ignore.length) {
3825
- for (var _iterator2 = ignore, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
3826
- var _ref2;
3827
-
3828
- if (_isArray2) {
3829
- if (_i2 >= _iterator2.length) break;
3830
- _ref2 = _iterator2[_i2++];
3831
- } else {
3832
- _i2 = _iterator2.next();
3833
- if (_i2.done) break;
3834
- _ref2 = _i2.value;
3835
- }
3836
-
3837
- var _pattern = _ref2;
3838
-
3839
- if (_shouldIgnore(_pattern, filename)) return true;
3840
- }
3841
- }
3842
-
3843
- return false;
3844
-}
3845
-
3846
-function _shouldIgnore(pattern, filename) {
3847
- if (typeof pattern === "function") {
3848
- return pattern(filename);
3849
- } else {
3850
- return pattern.test(filename);
3851
- }
3852
-}
3853
-},{"babel-runtime/core-js/get-iterator":95,"lodash/escapeRegExp":472,"lodash/includes":482,"lodash/isRegExp":494,"lodash/startsWith":509,"minimatch":519,"path":522,"slash":541,"util":560}],32:[function(require,module,exports){
3854
-module.exports={
3855
- "_from": "babel-core@^6.22.1",
3856
- "_id": "babel-core@6.26.0",
3857
- "_inBundle": false,
3858
- "_integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=",
3859
- "_location": "/babel-core",
3860
- "_phantomChildren": {},
3861
- "_requested": {
3862
- "type": "range",
3863
- "registry": true,
3864
- "raw": "babel-core@^6.22.1",
3865
- "name": "babel-core",
3866
- "escapedName": "babel-core",
3867
- "rawSpec": "^6.22.1",
3868
- "saveSpec": null,
3869
- "fetchSpec": "^6.22.1"
3870
- },
3871
- "_requiredBy": [
3872
- "#DEV:/",
3873
- "/babel-register",
3874
- "/babelify",
3875
- "/karma-babel-preprocessor"
3876
- ],
3877
- "_resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz",
3878
- "_shasum": "af32f78b31a6fcef119c87b0fd8d9753f03a0bb8",
3879
- "_spec": "babel-core@^6.22.1",
3880
- "_where": "/Users/juanjodiaz/Documents/code/OSS libs/noVNC",
3881
- "author": {
3882
- "name": "Sebastian McKenzie",
3883
- "email": "sebmck@gmail.com"
3884
- },
3885
- "bundleDependencies": false,
3886
- "dependencies": {
3887
- "babel-code-frame": "^6.26.0",
3888
- "babel-generator": "^6.26.0",
3889
- "babel-helpers": "^6.24.1",
3890
- "babel-messages": "^6.23.0",
3891
- "babel-register": "^6.26.0",
3892
- "babel-runtime": "^6.26.0",
3893
- "babel-template": "^6.26.0",
3894
- "babel-traverse": "^6.26.0",
3895
- "babel-types": "^6.26.0",
3896
- "babylon": "^6.18.0",
3897
- "convert-source-map": "^1.5.0",
3898
- "debug": "^2.6.8",
3899
- "json5": "^0.5.1",
3900
- "lodash": "^4.17.4",
3901
- "minimatch": "^3.0.4",
3902
- "path-is-absolute": "^1.0.1",
3903
- "private": "^0.1.7",
3904
- "slash": "^1.0.0",
3905
- "source-map": "^0.5.6"
3906
- },
3907
- "deprecated": false,
3908
- "description": "Babel compiler core.",
3909
- "devDependencies": {
3910
- "babel-helper-fixtures": "^6.26.0",
3911
- "babel-helper-transform-fixture-test-runner": "^6.26.0",
3912
- "babel-polyfill": "^6.26.0"
3913
- },
3914
- "homepage": "https://babeljs.io/",
3915
- "keywords": [
3916
- "6to5",
3917
- "babel",
3918
- "classes",
3919
- "const",
3920
- "es6",
3921
- "harmony",
3922
- "let",
3923
- "modules",
3924
- "transpile",
3925
- "transpiler",
3926
- "var",
3927
- "babel-core",
3928
- "compiler"
3929
- ],
3930
- "license": "MIT",
3931
- "name": "babel-core",
3932
- "repository": {
3933
- "type": "git",
3934
- "url": "https://github.com/babel/babel/tree/master/packages/babel-core"
3935
- },
3936
- "scripts": {
3937
- "bench": "make bench",
3938
- "test": "make test"
3939
- },
3940
- "version": "6.26.0"
3941
-}
3942
-
3943
-},{}],33:[function(require,module,exports){
3944
-"use strict";
3945
-
3946
-exports.__esModule = true;
3947
-
3948
-var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
3949
-
3950
-var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
3951
-
3952
-var _trimRight = require("trim-right");
3953
-
3954
-var _trimRight2 = _interopRequireDefault(_trimRight);
3955
-
3956
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3957
-
3958
-var SPACES_RE = /^[ \t]+$/;
3959
-
3960
-var Buffer = function () {
3961
- function Buffer(map) {
3962
- (0, _classCallCheck3.default)(this, Buffer);
3963
- this._map = null;
3964
- this._buf = [];
3965
- this._last = "";
3966
- this._queue = [];
3967
- this._position = {
3968
- line: 1,
3969
- column: 0
3970
- };
3971
- this._sourcePosition = {
3972
- identifierName: null,
3973
- line: null,
3974
- column: null,
3975
- filename: null
3976
- };
3977
-
3978
- this._map = map;
3979
- }
3980
-
3981
- Buffer.prototype.get = function get() {
3982
- this._flush();
3983
-
3984
- var map = this._map;
3985
- var result = {
3986
- code: (0, _trimRight2.default)(this._buf.join("")),
3987
- map: null,
3988
- rawMappings: map && map.getRawMappings()
3989
- };
3990
-
3991
- if (map) {
3992
- Object.defineProperty(result, "map", {
3993
- configurable: true,
3994
- enumerable: true,
3995
- get: function get() {
3996
- return this.map = map.get();
3997
- },
3998
- set: function set(value) {
3999
- Object.defineProperty(this, "map", { value: value, writable: true });
4000
- }
4001
- });
4002
- }
4003
-
4004
- return result;
4005
- };
4006
-
4007
- Buffer.prototype.append = function append(str) {
4008
- this._flush();
4009
- var _sourcePosition = this._sourcePosition,
4010
- line = _sourcePosition.line,
4011
- column = _sourcePosition.column,
4012
- filename = _sourcePosition.filename,
4013
- identifierName = _sourcePosition.identifierName;
4014
-
4015
- this._append(str, line, column, identifierName, filename);
4016
- };
4017
-
4018
- Buffer.prototype.queue = function queue(str) {
4019
- if (str === "\n") while (this._queue.length > 0 && SPACES_RE.test(this._queue[0][0])) {
4020
- this._queue.shift();
4021
- }var _sourcePosition2 = this._sourcePosition,
4022
- line = _sourcePosition2.line,
4023
- column = _sourcePosition2.column,
4024
- filename = _sourcePosition2.filename,
4025
- identifierName = _sourcePosition2.identifierName;
4026
-
4027
- this._queue.unshift([str, line, column, identifierName, filename]);
4028
- };
4029
-
4030
- Buffer.prototype._flush = function _flush() {
4031
- var item = void 0;
4032
- while (item = this._queue.pop()) {
4033
- this._append.apply(this, item);
4034
- }
4035
- };
4036
-
4037
- Buffer.prototype._append = function _append(str, line, column, identifierName, filename) {
4038
- if (this._map && str[0] !== "\n") {
4039
- this._map.mark(this._position.line, this._position.column, line, column, identifierName, filename);
4040
- }
4041
-
4042
- this._buf.push(str);
4043
- this._last = str[str.length - 1];
4044
-
4045
- for (var i = 0; i < str.length; i++) {
4046
- if (str[i] === "\n") {
4047
- this._position.line++;
4048
- this._position.column = 0;
4049
- } else {
4050
- this._position.column++;
4051
- }
4052
- }
4053
- };
4054
-
4055
- Buffer.prototype.removeTrailingNewline = function removeTrailingNewline() {
4056
- if (this._queue.length > 0 && this._queue[0][0] === "\n") this._queue.shift();
4057
- };
4058
-
4059
- Buffer.prototype.removeLastSemicolon = function removeLastSemicolon() {
4060
- if (this._queue.length > 0 && this._queue[0][0] === ";") this._queue.shift();
4061
- };
4062
-
4063
- Buffer.prototype.endsWith = function endsWith(suffix) {
4064
- if (suffix.length === 1) {
4065
- var last = void 0;
4066
- if (this._queue.length > 0) {
4067
- var str = this._queue[0][0];
4068
- last = str[str.length - 1];
4069
- } else {
4070
- last = this._last;
4071
- }
4072
-
4073
- return last === suffix;
4074
- }
4075
-
4076
- var end = this._last + this._queue.reduce(function (acc, item) {
4077
- return item[0] + acc;
4078
- }, "");
4079
- if (suffix.length <= end.length) {
4080
- return end.slice(-suffix.length) === suffix;
4081
- }
4082
-
4083
- return false;
4084
- };
4085
-
4086
- Buffer.prototype.hasContent = function hasContent() {
4087
- return this._queue.length > 0 || !!this._last;
4088
- };
4089
-
4090
- Buffer.prototype.source = function source(prop, loc) {
4091
- if (prop && !loc) return;
4092
-
4093
- var pos = loc ? loc[prop] : null;
4094
-
4095
- this._sourcePosition.identifierName = loc && loc.identifierName || null;
4096
- this._sourcePosition.line = pos ? pos.line : null;
4097
- this._sourcePosition.column = pos ? pos.column : null;
4098
- this._sourcePosition.filename = loc && loc.filename || null;
4099
- };
4100
-
4101
- Buffer.prototype.withSource = function withSource(prop, loc, cb) {
4102
- if (!this._map) return cb();
4103
-
4104
- var originalLine = this._sourcePosition.line;
4105
- var originalColumn = this._sourcePosition.column;
4106
- var originalFilename = this._sourcePosition.filename;
4107
- var originalIdentifierName = this._sourcePosition.identifierName;
4108
-
4109
- this.source(prop, loc);
4110
-
4111
- cb();
4112
-
4113
- this._sourcePosition.line = originalLine;
4114
- this._sourcePosition.column = originalColumn;
4115
- this._sourcePosition.filename = originalFilename;
4116
- this._sourcePosition.identifierName = originalIdentifierName;
4117
- };
4118
-
4119
- Buffer.prototype.getCurrentColumn = function getCurrentColumn() {
4120
- var extra = this._queue.reduce(function (acc, item) {
4121
- return item[0] + acc;
4122
- }, "");
4123
- var lastIndex = extra.lastIndexOf("\n");
4124
-
4125
- return lastIndex === -1 ? this._position.column + extra.length : extra.length - 1 - lastIndex;
4126
- };
4127
-
4128
- Buffer.prototype.getCurrentLine = function getCurrentLine() {
4129
- var extra = this._queue.reduce(function (acc, item) {
4130
- return item[0] + acc;
4131
- }, "");
4132
-
4133
- var count = 0;
4134
- for (var i = 0; i < extra.length; i++) {
4135
- if (extra[i] === "\n") count++;
4136
- }
4137
-
4138
- return this._position.line + count;
4139
- };
4140
-
4141
- return Buffer;
4142
-}();
4143
-
4144
-exports.default = Buffer;
4145
-module.exports = exports["default"];
4146
-},{"babel-runtime/helpers/classCallCheck":109,"trim-right":556}],34:[function(require,module,exports){
4147
-"use strict";
4148
-
4149
-exports.__esModule = true;
4150
-exports.File = File;
4151
-exports.Program = Program;
4152
-exports.BlockStatement = BlockStatement;
4153
-exports.Noop = Noop;
4154
-exports.Directive = Directive;
4155
-
4156
-var _types = require("./types");
4157
-
4158
-Object.defineProperty(exports, "DirectiveLiteral", {
4159
- enumerable: true,
4160
- get: function get() {
4161
- return _types.StringLiteral;
4162
- }
4163
-});
4164
-function File(node) {
4165
- this.print(node.program, node);
4166
-}
4167
-
4168
-function Program(node) {
4169
- this.printInnerComments(node, false);
4170
-
4171
- this.printSequence(node.directives, node);
4172
- if (node.directives && node.directives.length) this.newline();
4173
-
4174
- this.printSequence(node.body, node);
4175
-}
4176
-
4177
-function BlockStatement(node) {
4178
- this.token("{");
4179
- this.printInnerComments(node);
4180
-
4181
- var hasDirectives = node.directives && node.directives.length;
4182
-
4183
- if (node.body.length || hasDirectives) {
4184
- this.newline();
4185
-
4186
- this.printSequence(node.directives, node, { indent: true });
4187
- if (hasDirectives) this.newline();
4188
-
4189
- this.printSequence(node.body, node, { indent: true });
4190
- this.removeTrailingNewline();
4191
-
4192
- this.source("end", node.loc);
4193
-
4194
- if (!this.endsWith("\n")) this.newline();
4195
-
4196
- this.rightBrace();
4197
- } else {
4198
- this.source("end", node.loc);
4199
- this.token("}");
4200
- }
4201
-}
4202
-
4203
-function Noop() {}
4204
-
4205
-function Directive(node) {
4206
- this.print(node.value, node);
4207
- this.semicolon();
4208
-}
4209
-},{"./types":43}],35:[function(require,module,exports){
4210
-"use strict";
4211
-
4212
-exports.__esModule = true;
4213
-exports.ClassDeclaration = ClassDeclaration;
4214
-exports.ClassBody = ClassBody;
4215
-exports.ClassProperty = ClassProperty;
4216
-exports.ClassMethod = ClassMethod;
4217
-function ClassDeclaration(node) {
4218
- this.printJoin(node.decorators, node);
4219
- this.word("class");
4220
-
4221
- if (node.id) {
4222
- this.space();
4223
- this.print(node.id, node);
4224
- }
4225
-
4226
- this.print(node.typeParameters, node);
4227
-
4228
- if (node.superClass) {
4229
- this.space();
4230
- this.word("extends");
4231
- this.space();
4232
- this.print(node.superClass, node);
4233
- this.print(node.superTypeParameters, node);
4234
- }
4235
-
4236
- if (node.implements) {
4237
- this.space();
4238
- this.word("implements");
4239
- this.space();
4240
- this.printList(node.implements, node);
4241
- }
4242
-
4243
- this.space();
4244
- this.print(node.body, node);
4245
-}
4246
-
4247
-exports.ClassExpression = ClassDeclaration;
4248
-function ClassBody(node) {
4249
- this.token("{");
4250
- this.printInnerComments(node);
4251
- if (node.body.length === 0) {
4252
- this.token("}");
4253
- } else {
4254
- this.newline();
4255
-
4256
- this.indent();
4257
- this.printSequence(node.body, node);
4258
- this.dedent();
4259
-
4260
- if (!this.endsWith("\n")) this.newline();
4261
-
4262
- this.rightBrace();
4263
- }
4264
-}
4265
-
4266
-function ClassProperty(node) {
4267
- this.printJoin(node.decorators, node);
4268
-
4269
- if (node.static) {
4270
- this.word("static");
4271
- this.space();
4272
- }
4273
- if (node.computed) {
4274
- this.token("[");
4275
- this.print(node.key, node);
4276
- this.token("]");
4277
- } else {
4278
- this._variance(node);
4279
- this.print(node.key, node);
4280
- }
4281
- this.print(node.typeAnnotation, node);
4282
- if (node.value) {
4283
- this.space();
4284
- this.token("=");
4285
- this.space();
4286
- this.print(node.value, node);
4287
- }
4288
- this.semicolon();
4289
-}
4290
-
4291
-function ClassMethod(node) {
4292
- this.printJoin(node.decorators, node);
4293
-
4294
- if (node.static) {
4295
- this.word("static");
4296
- this.space();
4297
- }
4298
-
4299
- if (node.kind === "constructorCall") {
4300
- this.word("call");
4301
- this.space();
4302
- }
4303
-
4304
- this._method(node);
4305
-}
4306
-},{}],36:[function(require,module,exports){
4307
-"use strict";
4308
-
4309
-exports.__esModule = true;
4310
-exports.LogicalExpression = exports.BinaryExpression = exports.AwaitExpression = exports.YieldExpression = undefined;
4311
-exports.UnaryExpression = UnaryExpression;
4312
-exports.DoExpression = DoExpression;
4313
-exports.ParenthesizedExpression = ParenthesizedExpression;
4314
-exports.UpdateExpression = UpdateExpression;
4315
-exports.ConditionalExpression = ConditionalExpression;
4316
-exports.NewExpression = NewExpression;
4317
-exports.SequenceExpression = SequenceExpression;
4318
-exports.ThisExpression = ThisExpression;
4319
-exports.Super = Super;
4320
-exports.Decorator = Decorator;
4321
-exports.CallExpression = CallExpression;
4322
-exports.Import = Import;
4323
-exports.EmptyStatement = EmptyStatement;
4324
-exports.ExpressionStatement = ExpressionStatement;
4325
-exports.AssignmentPattern = AssignmentPattern;
4326
-exports.AssignmentExpression = AssignmentExpression;
4327
-exports.BindExpression = BindExpression;
4328
-exports.MemberExpression = MemberExpression;
4329
-exports.MetaProperty = MetaProperty;
4330
-
4331
-var _babelTypes = require("babel-types");
4332
-
4333
-var t = _interopRequireWildcard(_babelTypes);
4334
-
4335
-var _node = require("../node");
4336
-
4337
-var n = _interopRequireWildcard(_node);
4338
-
4339
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
4340
-
4341
-function UnaryExpression(node) {
4342
- if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof") {
4343
- this.word(node.operator);
4344
- this.space();
4345
- } else {
4346
- this.token(node.operator);
4347
- }
4348
-
4349
- this.print(node.argument, node);
4350
-}
4351
-
4352
-function DoExpression(node) {
4353
- this.word("do");
4354
- this.space();
4355
- this.print(node.body, node);
4356
-}
4357
-
4358
-function ParenthesizedExpression(node) {
4359
- this.token("(");
4360
- this.print(node.expression, node);
4361
- this.token(")");
4362
-}
4363
-
4364
-function UpdateExpression(node) {
4365
- if (node.prefix) {
4366
- this.token(node.operator);
4367
- this.print(node.argument, node);
4368
- } else {
4369
- this.print(node.argument, node);
4370
- this.token(node.operator);
4371
- }
4372
-}
4373
-
4374
-function ConditionalExpression(node) {
4375
- this.print(node.test, node);
4376
- this.space();
4377
- this.token("?");
4378
- this.space();
4379
- this.print(node.consequent, node);
4380
- this.space();
4381
- this.token(":");
4382
- this.space();
4383
- this.print(node.alternate, node);
4384
-}
4385
-
4386
-function NewExpression(node, parent) {
4387
- this.word("new");
4388
- this.space();
4389
- this.print(node.callee, node);
4390
- if (node.arguments.length === 0 && this.format.minified && !t.isCallExpression(parent, { callee: node }) && !t.isMemberExpression(parent) && !t.isNewExpression(parent)) return;
4391
-
4392
- this.token("(");
4393
- this.printList(node.arguments, node);
4394
- this.token(")");
4395
-}
4396
-
4397
-function SequenceExpression(node) {
4398
- this.printList(node.expressions, node);
4399
-}
4400
-
4401
-function ThisExpression() {
4402
- this.word("this");
4403
-}
4404
-
4405
-function Super() {
4406
- this.word("super");
4407
-}
4408
-
4409
-function Decorator(node) {
4410
- this.token("@");
4411
- this.print(node.expression, node);
4412
- this.newline();
4413
-}
4414
-
4415
-function commaSeparatorNewline() {
4416
- this.token(",");
4417
- this.newline();
4418
-
4419
- if (!this.endsWith("\n")) this.space();
4420
-}
4421
-
4422
-function CallExpression(node) {
4423
- this.print(node.callee, node);
4424
-
4425
- this.token("(");
4426
-
4427
- var isPrettyCall = node._prettyCall;
4428
-
4429
- var separator = void 0;
4430
- if (isPrettyCall) {
4431
- separator = commaSeparatorNewline;
4432
- this.newline();
4433
- this.indent();
4434
- }
4435
-
4436
- this.printList(node.arguments, node, { separator: separator });
4437
-
4438
- if (isPrettyCall) {
4439
- this.newline();
4440
- this.dedent();
4441
- }
4442
-
4443
- this.token(")");
4444
-}
4445
-
4446
-function Import() {
4447
- this.word("import");
4448
-}
4449
-
4450
-function buildYieldAwait(keyword) {
4451
- return function (node) {
4452
- this.word(keyword);
4453
-
4454
- if (node.delegate) {
4455
- this.token("*");
4456
- }
4457
-
4458
- if (node.argument) {
4459
- this.space();
4460
- var terminatorState = this.startTerminatorless();
4461
- this.print(node.argument, node);
4462
- this.endTerminatorless(terminatorState);
4463
- }
4464
- };
4465
-}
4466
-
4467
-var YieldExpression = exports.YieldExpression = buildYieldAwait("yield");
4468
-var AwaitExpression = exports.AwaitExpression = buildYieldAwait("await");
4469
-
4470
-function EmptyStatement() {
4471
- this.semicolon(true);
4472
-}
4473
-
4474
-function ExpressionStatement(node) {
4475
- this.print(node.expression, node);
4476
- this.semicolon();
4477
-}
4478
-
4479
-function AssignmentPattern(node) {
4480
- this.print(node.left, node);
4481
- if (node.left.optional) this.token("?");
4482
- this.print(node.left.typeAnnotation, node);
4483
- this.space();
4484
- this.token("=");
4485
- this.space();
4486
- this.print(node.right, node);
4487
-}
4488
-
4489
-function AssignmentExpression(node, parent) {
4490
- var parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent);
4491
-
4492
- if (parens) {
4493
- this.token("(");
4494
- }
4495
-
4496
- this.print(node.left, node);
4497
-
4498
- this.space();
4499
- if (node.operator === "in" || node.operator === "instanceof") {
4500
- this.word(node.operator);
4501
- } else {
4502
- this.token(node.operator);
4503
- }
4504
- this.space();
4505
-
4506
- this.print(node.right, node);
4507
-
4508
- if (parens) {
4509
- this.token(")");
4510
- }
4511
-}
4512
-
4513
-function BindExpression(node) {
4514
- this.print(node.object, node);
4515
- this.token("::");
4516
- this.print(node.callee, node);
4517
-}
4518
-
4519
-exports.BinaryExpression = AssignmentExpression;
4520
-exports.LogicalExpression = AssignmentExpression;
4521
-function MemberExpression(node) {
4522
- this.print(node.object, node);
4523
-
4524
- if (!node.computed && t.isMemberExpression(node.property)) {
4525
- throw new TypeError("Got a MemberExpression for MemberExpression property");
4526
- }
4527
-
4528
- var computed = node.computed;
4529
- if (t.isLiteral(node.property) && typeof node.property.value === "number") {
4530
- computed = true;
4531
- }
4532
-
4533
- if (computed) {
4534
- this.token("[");
4535
- this.print(node.property, node);
4536
- this.token("]");
4537
- } else {
4538
- this.token(".");
4539
- this.print(node.property, node);
4540
- }
4541
-}
4542
-
4543
-function MetaProperty(node) {
4544
- this.print(node.meta, node);
4545
- this.token(".");
4546
- this.print(node.property, node);
4547
-}
4548
-},{"../node":45,"babel-types":151}],37:[function(require,module,exports){
4549
-"use strict";
4550
-
4551
-exports.__esModule = true;
4552
-exports.TypeParameterDeclaration = exports.StringLiteralTypeAnnotation = exports.NumericLiteralTypeAnnotation = exports.GenericTypeAnnotation = exports.ClassImplements = undefined;
4553
-exports.AnyTypeAnnotation = AnyTypeAnnotation;
4554
-exports.ArrayTypeAnnotation = ArrayTypeAnnotation;
4555
-exports.BooleanTypeAnnotation = BooleanTypeAnnotation;
4556
-exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation;
4557
-exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation;
4558
-exports.DeclareClass = DeclareClass;
4559
-exports.DeclareFunction = DeclareFunction;
4560
-exports.DeclareInterface = DeclareInterface;
4561
-exports.DeclareModule = DeclareModule;
4562
-exports.DeclareModuleExports = DeclareModuleExports;
4563
-exports.DeclareTypeAlias = DeclareTypeAlias;
4564
-exports.DeclareOpaqueType = DeclareOpaqueType;
4565
-exports.DeclareVariable = DeclareVariable;
4566
-exports.DeclareExportDeclaration = DeclareExportDeclaration;
4567
-exports.ExistentialTypeParam = ExistentialTypeParam;
4568
-exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
4569
-exports.FunctionTypeParam = FunctionTypeParam;
4570
-exports.InterfaceExtends = InterfaceExtends;
4571
-exports._interfaceish = _interfaceish;
4572
-exports._variance = _variance;
4573
-exports.InterfaceDeclaration = InterfaceDeclaration;
4574
-exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;
4575
-exports.MixedTypeAnnotation = MixedTypeAnnotation;
4576
-exports.EmptyTypeAnnotation = EmptyTypeAnnotation;
4577
-exports.NullableTypeAnnotation = NullableTypeAnnotation;
4578
-
4579
-var _types = require("./types");
4580
-
4581
-Object.defineProperty(exports, "NumericLiteralTypeAnnotation", {
4582
- enumerable: true,
4583
- get: function get() {
4584
- return _types.NumericLiteral;
4585
- }
4586
-});
4587
-Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
4588
- enumerable: true,
4589
- get: function get() {
4590
- return _types.StringLiteral;
4591
- }
4592
-});
4593
-exports.NumberTypeAnnotation = NumberTypeAnnotation;
4594
-exports.StringTypeAnnotation = StringTypeAnnotation;
4595
-exports.ThisTypeAnnotation = ThisTypeAnnotation;
4596
-exports.TupleTypeAnnotation = TupleTypeAnnotation;
4597
-exports.TypeofTypeAnnotation = TypeofTypeAnnotation;
4598
-exports.TypeAlias = TypeAlias;
4599
-exports.OpaqueType = OpaqueType;
4600
-exports.TypeAnnotation = TypeAnnotation;
4601
-exports.TypeParameter = TypeParameter;
4602
-exports.TypeParameterInstantiation = TypeParameterInstantiation;
4603
-exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
4604
-exports.ObjectTypeCallProperty = ObjectTypeCallProperty;
4605
-exports.ObjectTypeIndexer = ObjectTypeIndexer;
4606
-exports.ObjectTypeProperty = ObjectTypeProperty;
4607
-exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty;
4608
-exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
4609
-exports.UnionTypeAnnotation = UnionTypeAnnotation;
4610
-exports.TypeCastExpression = TypeCastExpression;
4611
-exports.VoidTypeAnnotation = VoidTypeAnnotation;
4612
-
4613
-var _babelTypes = require("babel-types");
4614
-
4615
-var t = _interopRequireWildcard(_babelTypes);
4616
-
4617
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
4618
-
4619
-function AnyTypeAnnotation() {
4620
- this.word("any");
4621
-}
4622
-
4623
-function ArrayTypeAnnotation(node) {
4624
- this.print(node.elementType, node);
4625
- this.token("[");
4626
- this.token("]");
4627
-}
4628
-
4629
-function BooleanTypeAnnotation() {
4630
- this.word("boolean");
4631
-}
4632
-
4633
-function BooleanLiteralTypeAnnotation(node) {
4634
- this.word(node.value ? "true" : "false");
4635
-}
4636
-
4637
-function NullLiteralTypeAnnotation() {
4638
- this.word("null");
4639
-}
4640
-
4641
-function DeclareClass(node, parent) {
4642
- if (!t.isDeclareExportDeclaration(parent)) {
4643
- this.word("declare");
4644
- this.space();
4645
- }
4646
- this.word("class");
4647
- this.space();
4648
- this._interfaceish(node);
4649
-}
4650
-
4651
-function DeclareFunction(node, parent) {
4652
- if (!t.isDeclareExportDeclaration(parent)) {
4653
- this.word("declare");
4654
- this.space();
4655
- }
4656
- this.word("function");
4657
- this.space();
4658
- this.print(node.id, node);
4659
- this.print(node.id.typeAnnotation.typeAnnotation, node);
4660
- this.semicolon();
4661
-}
4662
-
4663
-function DeclareInterface(node) {
4664
- this.word("declare");
4665
- this.space();
4666
- this.InterfaceDeclaration(node);
4667
-}
4668
-
4669
-function DeclareModule(node) {
4670
- this.word("declare");
4671
- this.space();
4672
- this.word("module");
4673
- this.space();
4674
- this.print(node.id, node);
4675
- this.space();
4676
- this.print(node.body, node);
4677
-}
4678
-
4679
-function DeclareModuleExports(node) {
4680
- this.word("declare");
4681
- this.space();
4682
- this.word("module");
4683
- this.token(".");
4684
- this.word("exports");
4685
- this.print(node.typeAnnotation, node);
4686
-}
4687
-
4688
-function DeclareTypeAlias(node) {
4689
- this.word("declare");
4690
- this.space();
4691
- this.TypeAlias(node);
4692
-}
4693
-
4694
-function DeclareOpaqueType(node, parent) {
4695
- if (!t.isDeclareExportDeclaration(parent)) {
4696
- this.word("declare");
4697
- this.space();
4698
- }
4699
- this.OpaqueType(node);
4700
-}
4701
-
4702
-function DeclareVariable(node, parent) {
4703
- if (!t.isDeclareExportDeclaration(parent)) {
4704
- this.word("declare");
4705
- this.space();
4706
- }
4707
- this.word("var");
4708
- this.space();
4709
- this.print(node.id, node);
4710
- this.print(node.id.typeAnnotation, node);
4711
- this.semicolon();
4712
-}
4713
-
4714
-function DeclareExportDeclaration(node) {
4715
- this.word("declare");
4716
- this.space();
4717
- this.word("export");
4718
- this.space();
4719
- if (node.default) {
4720
- this.word("default");
4721
- this.space();
4722
- }
4723
-
4724
- FlowExportDeclaration.apply(this, arguments);
4725
-}
4726
-
4727
-function FlowExportDeclaration(node) {
4728
- if (node.declaration) {
4729
- var declar = node.declaration;
4730
- this.print(declar, node);
4731
- if (!t.isStatement(declar)) this.semicolon();
4732
- } else {
4733
- this.token("{");
4734
- if (node.specifiers.length) {
4735
- this.space();
4736
- this.printList(node.specifiers, node);
4737
- this.space();
4738
- }
4739
- this.token("}");
4740
-
4741
- if (node.source) {
4742
- this.space();
4743
- this.word("from");
4744
- this.space();
4745
- this.print(node.source, node);
4746
- }
4747
-
4748
- this.semicolon();
4749
- }
4750
-}
4751
-
4752
-function ExistentialTypeParam() {
4753
- this.token("*");
4754
-}
4755
-
4756
-function FunctionTypeAnnotation(node, parent) {
4757
- this.print(node.typeParameters, node);
4758
- this.token("(");
4759
- this.printList(node.params, node);
4760
-
4761
- if (node.rest) {
4762
- if (node.params.length) {
4763
- this.token(",");
4764
- this.space();
4765
- }
4766
- this.token("...");
4767
- this.print(node.rest, node);
4768
- }
4769
-
4770
- this.token(")");
4771
-
4772
- if (parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction") {
4773
- this.token(":");
4774
- } else {
4775
- this.space();
4776
- this.token("=>");
4777
- }
4778
-
4779
- this.space();
4780
- this.print(node.returnType, node);
4781
-}
4782
-
4783
-function FunctionTypeParam(node) {
4784
- this.print(node.name, node);
4785
- if (node.optional) this.token("?");
4786
- this.token(":");
4787
- this.space();
4788
- this.print(node.typeAnnotation, node);
4789
-}
4790
-
4791
-function InterfaceExtends(node) {
4792
- this.print(node.id, node);
4793
- this.print(node.typeParameters, node);
4794
-}
4795
-
4796
-exports.ClassImplements = InterfaceExtends;
4797
-exports.GenericTypeAnnotation = InterfaceExtends;
4798
-function _interfaceish(node) {
4799
- this.print(node.id, node);
4800
- this.print(node.typeParameters, node);
4801
- if (node.extends.length) {
4802
- this.space();
4803
- this.word("extends");
4804
- this.space();
4805
- this.printList(node.extends, node);
4806
- }
4807
- if (node.mixins && node.mixins.length) {
4808
- this.space();
4809
- this.word("mixins");
4810
- this.space();
4811
- this.printList(node.mixins, node);
4812
- }
4813
- this.space();
4814
- this.print(node.body, node);
4815
-}
4816
-
4817
-function _variance(node) {
4818
- if (node.variance === "plus") {
4819
- this.token("+");
4820
- } else if (node.variance === "minus") {
4821
- this.token("-");
4822
- }
4823
-}
4824
-
4825
-function InterfaceDeclaration(node) {
4826
- this.word("interface");
4827
- this.space();
4828
- this._interfaceish(node);
4829
-}
4830
-
4831
-function andSeparator() {
4832
- this.space();
4833
- this.token("&");
4834
- this.space();
4835
-}
4836
-
4837
-function IntersectionTypeAnnotation(node) {
4838
- this.printJoin(node.types, node, { separator: andSeparator });
4839
-}
4840
-
4841
-function MixedTypeAnnotation() {
4842
- this.word("mixed");
4843
-}
4844
-
4845
-function EmptyTypeAnnotation() {
4846
- this.word("empty");
4847
-}
4848
-
4849
-function NullableTypeAnnotation(node) {
4850
- this.token("?");
4851
- this.print(node.typeAnnotation, node);
4852
-}
4853
-
4854
-function NumberTypeAnnotation() {
4855
- this.word("number");
4856
-}
4857
-
4858
-function StringTypeAnnotation() {
4859
- this.word("string");
4860
-}
4861
-
4862
-function ThisTypeAnnotation() {
4863
- this.word("this");
4864
-}
4865
-
4866
-function TupleTypeAnnotation(node) {
4867
- this.token("[");
4868
- this.printList(node.types, node);
4869
- this.token("]");
4870
-}
4871
-
4872
-function TypeofTypeAnnotation(node) {
4873
- this.word("typeof");
4874
- this.space();
4875
- this.print(node.argument, node);
4876
-}
4877
-
4878
-function TypeAlias(node) {
4879
- this.word("type");
4880
- this.space();
4881
- this.print(node.id, node);
4882
- this.print(node.typeParameters, node);
4883
- this.space();
4884
- this.token("=");
4885
- this.space();
4886
- this.print(node.right, node);
4887
- this.semicolon();
4888
-}
4889
-function OpaqueType(node) {
4890
- this.word("opaque");
4891
- this.space();
4892
- this.word("type");
4893
- this.space();
4894
- this.print(node.id, node);
4895
- this.print(node.typeParameters, node);
4896
- if (node.supertype) {
4897
- this.token(":");
4898
- this.space();
4899
- this.print(node.supertype, node);
4900
- }
4901
- if (node.impltype) {
4902
- this.space();
4903
- this.token("=");
4904
- this.space();
4905
- this.print(node.impltype, node);
4906
- }
4907
- this.semicolon();
4908
-}
4909
-
4910
-function TypeAnnotation(node) {
4911
- this.token(":");
4912
- this.space();
4913
- if (node.optional) this.token("?");
4914
- this.print(node.typeAnnotation, node);
4915
-}
4916
-
4917
-function TypeParameter(node) {
4918
- this._variance(node);
4919
-
4920
- this.word(node.name);
4921
-
4922
- if (node.bound) {
4923
- this.print(node.bound, node);
4924
- }
4925
-
4926
- if (node.default) {
4927
- this.space();
4928
- this.token("=");
4929
- this.space();
4930
- this.print(node.default, node);
4931
- }
4932
-}
4933
-
4934
-function TypeParameterInstantiation(node) {
4935
- this.token("<");
4936
- this.printList(node.params, node, {});
4937
- this.token(">");
4938
-}
4939
-
4940
-exports.TypeParameterDeclaration = TypeParameterInstantiation;
4941
-function ObjectTypeAnnotation(node) {
4942
- var _this = this;
4943
-
4944
- if (node.exact) {
4945
- this.token("{|");
4946
- } else {
4947
- this.token("{");
4948
- }
4949
-
4950
- var props = node.properties.concat(node.callProperties, node.indexers);
4951
-
4952
- if (props.length) {
4953
- this.space();
4954
-
4955
- this.printJoin(props, node, {
4956
- addNewlines: function addNewlines(leading) {
4957
- if (leading && !props[0]) return 1;
4958
- },
4959
-
4960
- indent: true,
4961
- statement: true,
4962
- iterator: function iterator() {
4963
- if (props.length !== 1) {
4964
- if (_this.format.flowCommaSeparator) {
4965
- _this.token(",");
4966
- } else {
4967
- _this.semicolon();
4968
- }
4969
- _this.space();
4970
- }
4971
- }
4972
- });
4973
-
4974
- this.space();
4975
- }
4976
-
4977
- if (node.exact) {
4978
- this.token("|}");
4979
- } else {
4980
- this.token("}");
4981
- }
4982
-}
4983
-
4984
-function ObjectTypeCallProperty(node) {
4985
- if (node.static) {
4986
- this.word("static");
4987
- this.space();
4988
- }
4989
- this.print(node.value, node);
4990
-}
4991
-
4992
-function ObjectTypeIndexer(node) {
4993
- if (node.static) {
4994
- this.word("static");
4995
- this.space();
4996
- }
4997
- this._variance(node);
4998
- this.token("[");
4999
- this.print(node.id, node);
This file is too large to show in full.
public/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js
deleted
-1486
@@ -1,1486 +0,0 @@
1
-(function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
- typeof define === 'function' && define.amd ? define(factory) :
4
- (global.BrowserESModuleLoader = factory());
5
-}(this, (function () { 'use strict';
6
-
7
-/*
8
- * Environment
9
- */
10
-var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
11
-var isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
12
-var isWindows = typeof process !== 'undefined' && typeof process.platform === 'string' && process.platform.match(/^win/);
13
-
14
-var envGlobal = typeof self !== 'undefined' ? self : global;
15
-/*
16
- * Simple Symbol() shim
17
- */
18
-var hasSymbol = typeof Symbol !== 'undefined';
19
-function createSymbol (name) {
20
- return hasSymbol ? Symbol() : '@@' + name;
21
-}
22
-
23
-var toStringTag = hasSymbol && Symbol.toStringTag;
24
-
25
-
26
-
27
-
28
-
29
-/*
30
- * Environment baseURI
31
- */
32
-var baseURI;
33
-
34
-// environent baseURI detection
35
-if (typeof document != 'undefined' && document.getElementsByTagName) {
36
- baseURI = document.baseURI;
37
-
38
- if (!baseURI) {
39
- var bases = document.getElementsByTagName('base');
40
- baseURI = bases[0] && bases[0].href || window.location.href;
41
- }
42
-}
43
-else if (typeof location != 'undefined') {
44
- baseURI = location.href;
45
-}
46
-
47
-// sanitize out the hash and querystring
48
-if (baseURI) {
49
- baseURI = baseURI.split('#')[0].split('?')[0];
50
- var slashIndex = baseURI.lastIndexOf('/');
51
- if (slashIndex !== -1)
52
- baseURI = baseURI.substr(0, slashIndex + 1);
53
-}
54
-else if (typeof process !== 'undefined' && process.cwd) {
55
- baseURI = 'file://' + (isWindows ? '/' : '') + process.cwd();
56
- if (isWindows)
57
- baseURI = baseURI.replace(/\\/g, '/');
58
-}
59
-else {
60
- throw new TypeError('No environment baseURI');
61
-}
62
-
63
-// ensure baseURI has trailing "/"
64
-if (baseURI[baseURI.length - 1] !== '/')
65
- baseURI += '/';
66
-
67
-/*
68
- * LoaderError with chaining for loader stacks
69
- */
70
-var errArgs = new Error(0, '_').fileName == '_';
71
-function LoaderError__Check_error_message_for_loader_stack (childErr, newMessage) {
72
- // Convert file:/// URLs to paths in Node
73
- if (!isBrowser)
74
- newMessage = newMessage.replace(isWindows ? /file:\/\/\//g : /file:\/\//g, '');
75
-
76
- var message = (childErr.message || childErr) + '\n ' + newMessage;
77
-
78
- var err;
79
- if (errArgs && childErr.fileName)
80
- err = new Error(message, childErr.fileName, childErr.lineNumber);
81
- else
82
- err = new Error(message);
83
-
84
-
85
- var stack = childErr.originalErr ? childErr.originalErr.stack : childErr.stack;
86
-
87
- if (isNode)
88
- // node doesn't show the message otherwise
89
- err.stack = message + '\n ' + stack;
90
- else
91
- err.stack = stack;
92
-
93
- err.originalErr = childErr.originalErr || childErr;
94
-
95
- return err;
96
-}
97
-
98
-var resolvedPromise$1 = Promise.resolve();
99
-
100
-/*
101
- * Simple Array values shim
102
- */
103
-function arrayValues (arr) {
104
- if (arr.values)
105
- return arr.values();
106
-
107
- if (typeof Symbol === 'undefined' || !Symbol.iterator)
108
- throw new Error('Symbol.iterator not supported in this browser');
109
-
110
- var iterable = {};
111
- iterable[Symbol.iterator] = function () {
112
- var keys = Object.keys(arr);
113
- var keyIndex = 0;
114
- return {
115
- next: function () {
116
- if (keyIndex < keys.length)
117
- return {
118
- value: arr[keys[keyIndex++]],
119
- done: false
120
- };
121
- else
122
- return {
123
- value: undefined,
124
- done: true
125
- };
126
- }
127
- };
128
- };
129
- return iterable;
130
-}
131
-
132
-/*
133
- * 3. Reflect.Loader
134
- *
135
- * We skip the entire native internal pipeline, just providing the bare API
136
- */
137
-// 3.1.1
138
-function Loader () {
139
- this.registry = new Registry();
140
-}
141
-// 3.3.1
142
-Loader.prototype.constructor = Loader;
143
-
144
-function ensureInstantiated (module) {
145
- if (module === undefined)
146
- return;
147
- if (module instanceof ModuleNamespace === false && module[toStringTag] !== 'module')
148
- throw new TypeError('Module instantiation did not return a valid namespace object.');
149
- return module;
150
-}
151
-
152
-// 3.3.2
153
-Loader.prototype.import = function (key, parent) {
154
- if (typeof key !== 'string')
155
- throw new TypeError('Loader import method must be passed a module key string');
156
- // custom resolveInstantiate combined hook for better perf
157
- var loader = this;
158
- return resolvedPromise$1
159
- .then(function () {
160
- return loader[RESOLVE_INSTANTIATE](key, parent);
161
- })
162
- .then(ensureInstantiated)
163
- //.then(Module.evaluate)
164
- .catch(function (err) {
165
- throw LoaderError__Check_error_message_for_loader_stack(err, 'Loading ' + key + (parent ? ' from ' + parent : ''));
166
- });
167
-};
168
-// 3.3.3
169
-var RESOLVE = Loader.resolve = createSymbol('resolve');
170
-
171
-/*
172
- * Combined resolve / instantiate hook
173
- *
174
- * Not in current reduced spec, but necessary to separate RESOLVE from RESOLVE + INSTANTIATE as described
175
- * in the spec notes of this repo to ensure that loader.resolve doesn't instantiate when not wanted.
176
- *
177
- * We implement RESOLVE_INSTANTIATE as a single hook instead of a separate INSTANTIATE in order to avoid
178
- * the need for double registry lookups as a performance optimization.
179
- */
180
-var RESOLVE_INSTANTIATE = Loader.resolveInstantiate = createSymbol('resolveInstantiate');
181
-
182
-// default resolveInstantiate is just to call resolve and then get from the registry
183
-// this provides compatibility for the resolveInstantiate optimization
184
-Loader.prototype[RESOLVE_INSTANTIATE] = function (key, parent) {
185
- var loader = this;
186
- return loader.resolve(key, parent)
187
- .then(function (resolved) {
188
- return loader.registry.get(resolved);
189
- });
190
-};
191
-
192
-function ensureResolution (resolvedKey) {
193
- if (resolvedKey === undefined)
194
- throw new RangeError('No resolution found.');
195
- return resolvedKey;
196
-}
197
-
198
-Loader.prototype.resolve = function (key, parent) {
199
- var loader = this;
200
- return resolvedPromise$1
201
- .then(function() {
202
- return loader[RESOLVE](key, parent);
203
- })
204
- .then(ensureResolution)
205
- .catch(function (err) {
206
- throw LoaderError__Check_error_message_for_loader_stack(err, 'Resolving ' + key + (parent ? ' to ' + parent : ''));
207
- });
208
-};
209
-
210
-// 3.3.4 (import without evaluate)
211
-// this is not documented because the use of deferred evaluation as in Module.evaluate is not
212
-// documented, as it is not considered a stable feature to be encouraged
213
-// Loader.prototype.load may well be deprecated if this stays disabled
214
-/* Loader.prototype.load = function (key, parent) {
215
- return Promise.resolve(this[RESOLVE_INSTANTIATE](key, parent || this.key))
216
- .catch(function (err) {
217
- throw addToError(err, 'Loading ' + key + (parent ? ' from ' + parent : ''));
218
- });
219
-}; */
220
-
221
-/*
222
- * 4. Registry
223
- *
224
- * Instead of structuring through a Map, just use a dictionary object
225
- * We throw for construction attempts so this doesn't affect the public API
226
- *
227
- * Registry has been adjusted to use Namespace objects over ModuleStatus objects
228
- * as part of simplifying loader API implementation
229
- */
230
-var iteratorSupport = typeof Symbol !== 'undefined' && Symbol.iterator;
231
-var REGISTRY = createSymbol('registry');
232
-function Registry() {
233
- this[REGISTRY] = {};
234
-}
235
-// 4.4.1
236
-if (iteratorSupport) {
237
- // 4.4.2
238
- Registry.prototype[Symbol.iterator] = function () {
239
- return this.entries()[Symbol.iterator]();
240
- };
241
-
242
- // 4.4.3
243
- Registry.prototype.entries = function () {
244
- var registry = this[REGISTRY];
245
- return arrayValues(Object.keys(registry).map(function (key) {
246
- return [key, registry[key]];
247
- }));
248
- };
249
-}
250
-
251
-// 4.4.4
252
-Registry.prototype.keys = function () {
253
- return arrayValues(Object.keys(this[REGISTRY]));
254
-};
255
-// 4.4.5
256
-Registry.prototype.values = function () {
257
- var registry = this[REGISTRY];
258
- return arrayValues(Object.keys(registry).map(function (key) {
259
- return registry[key];
260
- }));
261
-};
262
-// 4.4.6
263
-Registry.prototype.get = function (key) {
264
- return this[REGISTRY][key];
265
-};
266
-// 4.4.7
267
-Registry.prototype.set = function (key, namespace) {
268
- if (!(namespace instanceof ModuleNamespace || namespace[toStringTag] === 'module'))
269
- throw new Error('Registry must be set with an instance of Module Namespace');
270
- this[REGISTRY][key] = namespace;
271
- return this;
272
-};
273
-// 4.4.8
274
-Registry.prototype.has = function (key) {
275
- return Object.hasOwnProperty.call(this[REGISTRY], key);
276
-};
277
-// 4.4.9
278
-Registry.prototype.delete = function (key) {
279
- if (Object.hasOwnProperty.call(this[REGISTRY], key)) {
280
- delete this[REGISTRY][key];
281
- return true;
282
- }
283
- return false;
284
-};
285
-
286
-/*
287
- * Simple ModuleNamespace Exotic object based on a baseObject
288
- * We export this for allowing a fast-path for module namespace creation over Module descriptors
289
- */
290
-// var EVALUATE = createSymbol('evaluate');
291
-var BASE_OBJECT = createSymbol('baseObject');
292
-
293
-// 8.3.1 Reflect.Module
294
-/*
295
- * Best-effort simplified non-spec implementation based on
296
- * a baseObject referenced via getters.
297
- *
298
- * Allows:
299
- *
300
- * loader.registry.set('x', new Module({ default: 'x' }));
301
- *
302
- * Optional evaluation function provides experimental Module.evaluate
303
- * support for non-executed modules in registry.
304
- */
305
-function ModuleNamespace (baseObject/*, evaluate*/) {
306
- Object.defineProperty(this, BASE_OBJECT, {
307
- value: baseObject
308
- });
309
-
310
- // evaluate defers namespace population
311
- /* if (evaluate) {
312
- Object.defineProperty(this, EVALUATE, {
313
- value: evaluate,
314
- configurable: true,
315
- writable: true
316
- });
317
- }
318
- else { */
319
- Object.keys(baseObject).forEach(extendNamespace, this);
320
- //}
321
-}
322
-// 8.4.2
323
-ModuleNamespace.prototype = Object.create(null);
324
-
325
-if (toStringTag)
326
- Object.defineProperty(ModuleNamespace.prototype, toStringTag, {
327
- value: 'Module'
328
- });
329
-
330
-function extendNamespace (key) {
331
- Object.defineProperty(this, key, {
332
- enumerable: true,
333
- get: function () {
334
- return this[BASE_OBJECT][key];
335
- }
336
- });
337
-}
338
-
339
-/* function doEvaluate (evaluate, context) {
340
- try {
341
- evaluate.call(context);
342
- }
343
- catch (e) {
344
- return e;
345
- }
346
-}
347
-
348
-// 8.4.1 Module.evaluate... not documented or used because this is potentially unstable
349
-Module.evaluate = function (ns) {
350
- var evaluate = ns[EVALUATE];
351
- if (evaluate) {
352
- ns[EVALUATE] = undefined;
353
- var err = doEvaluate(evaluate);
354
- if (err) {
355
- // cache the error
356
- ns[EVALUATE] = function () {
357
- throw err;
358
- };
359
- throw err;
360
- }
361
- Object.keys(ns[BASE_OBJECT]).forEach(extendNamespace, ns);
362
- }
363
- // make chainable
364
- return ns;
365
-}; */
366
-
367
-/*
368
- * Optimized URL normalization assuming a syntax-valid URL parent
369
- */
370
-function throwResolveError (relUrl, parentUrl) {
371
- throw new RangeError('Unable to resolve "' + relUrl + '" to ' + parentUrl);
372
-}
373
-var backslashRegEx = /\\/g;
374
-function resolveIfNotPlain (relUrl, parentUrl) {
375
- if (relUrl[0] === ' ' || relUrl[relUrl.length - 1] === ' ')
376
- relUrl = relUrl.trim();
377
- var parentProtocol = parentUrl && parentUrl.substr(0, parentUrl.indexOf(':') + 1);
378
-
379
- var firstChar = relUrl[0];
380
- var secondChar = relUrl[1];
381
-
382
- // protocol-relative
383
- if (firstChar === '/' && secondChar === '/') {
384
- if (!parentProtocol)
385
- throwResolveError(relUrl, parentUrl);
386
- if (relUrl.indexOf('\\') !== -1)
387
- relUrl = relUrl.replace(backslashRegEx, '/');
388
- return parentProtocol + relUrl;
389
- }
390
- // relative-url
391
- else if (firstChar === '.' && (secondChar === '/' || secondChar === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
392
- relUrl.length === 1 && (relUrl += '/')) ||
393
- firstChar === '/') {
394
- if (relUrl.indexOf('\\') !== -1)
395
- relUrl = relUrl.replace(backslashRegEx, '/');
396
- var parentIsPlain = !parentProtocol || parentUrl[parentProtocol.length] !== '/';
397
-
398
- // read pathname from parent if a URL
399
- // pathname taken to be part after leading "/"
400
- var pathname;
401
- if (parentIsPlain) {
402
- // resolving to a plain parent -> skip standard URL prefix, and treat entire parent as pathname
403
- if (parentUrl === undefined)
404
- throwResolveError(relUrl, parentUrl);
405
- pathname = parentUrl;
406
- }
407
- else if (parentUrl[parentProtocol.length + 1] === '/') {
408
- // resolving to a :// so we need to read out the auth and host
409
- if (parentProtocol !== 'file:') {
410
- pathname = parentUrl.substr(parentProtocol.length + 2);
411
- pathname = pathname.substr(pathname.indexOf('/') + 1);
412
- }
413
- else {
414
- pathname = parentUrl.substr(8);
415
- }
416
- }
417
- else {
418
- // resolving to :/ so pathname is the /... part
419
- pathname = parentUrl.substr(parentProtocol.length + 1);
420
- }
421
-
422
- if (firstChar === '/') {
423
- if (parentIsPlain)
424
- throwResolveError(relUrl, parentUrl);
425
- else
426
- return parentUrl.substr(0, parentUrl.length - pathname.length - 1) + relUrl;
427
- }
428
-
429
- // join together and split for removal of .. and . segments
430
- // looping the string instead of anything fancy for perf reasons
431
- // '../../../../../z' resolved to 'x/y' is just 'z' regardless of parentIsPlain
432
- var segmented = pathname.substr(0, pathname.lastIndexOf('/') + 1) + relUrl;
433
-
434
- var output = [];
435
- var segmentIndex = -1;
436
-
437
- for (var i = 0; i < segmented.length; i++) {
438
- // busy reading a segment - only terminate on '/'
439
- if (segmentIndex !== -1) {
440
- if (segmented[i] === '/') {
441
- output.push(segmented.substring(segmentIndex, i + 1));
442
- segmentIndex = -1;
443
- }
444
- continue;
445
- }
446
-
447
- // new segment - check if it is relative
448
- if (segmented[i] === '.') {
449
- // ../ segment
450
- if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
451
- output.pop();
452
- i += 2;
453
- }
454
- // ./ segment
455
- else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
456
- i += 1;
457
- }
458
- else {
459
- // the start of a new segment as below
460
- segmentIndex = i;
461
- continue;
462
- }
463
-
464
- // this is the plain URI backtracking error (../, package:x -> error)
465
- if (parentIsPlain && output.length === 0)
466
- throwResolveError(relUrl, parentUrl);
467
-
468
- continue;
469
- }
470
-
471
- // it is the start of a new segment
472
- segmentIndex = i;
473
- }
474
- // finish reading out the last segment
475
- if (segmentIndex !== -1)
476
- output.push(segmented.substr(segmentIndex));
477
-
478
- return parentUrl.substr(0, parentUrl.length - pathname.length) + output.join('');
479
- }
480
-
481
- // sanitizes and verifies (by returning undefined if not a valid URL-like form)
482
- // Windows filepath compatibility is an added convenience here
483
- var protocolIndex = relUrl.indexOf(':');
484
- if (protocolIndex !== -1) {
485
- if (isNode) {
486
- // C:\x becomes file:///c:/x (we don't support C|\x)
487
- if (relUrl[1] === ':' && relUrl[2] === '\\' && relUrl[0].match(/[a-z]/i))
488
- return 'file:///' + relUrl.replace(backslashRegEx, '/');
489
- }
490
- return relUrl;
491
- }
492
-}
493
-
494
-var resolvedPromise = Promise.resolve();
495
-/*
496
- * Register Loader
497
- *
498
- * Builds directly on top of loader polyfill to provide:
499
- * - loader.register support
500
- * - hookable higher-level resolve
501
- * - instantiate hook returning a ModuleNamespace or undefined for es module loading
502
- * - loader error behaviour as in HTML and loader specs, caching load and eval errors separately
503
- * - build tracing support by providing a .trace=true and .loads object format
504
- */
505
-
506
-var REGISTER_INTERNAL = createSymbol('register-internal');
507
-
508
-function RegisterLoader$1 () {
509
- Loader.call(this);
510
-
511
- var registryDelete = this.registry.delete;
512
- this.registry.delete = function (key) {
513
- var deleted = registryDelete.call(this, key);
514
-
515
- // also delete from register registry if linked
516
- if (records.hasOwnProperty(key) && !records[key].linkRecord) {
517
- delete records[key];
518
- deleted = true;
519
- }
520
-
521
- return deleted;
522
- };
523
-
524
- var records = {};
525
-
526
- this[REGISTER_INTERNAL] = {
527
- // last anonymous System.register call
528
- lastRegister: undefined,
529
- // in-flight es module load records
530
- records: records
531
- };
532
-
533
- // tracing
534
- this.trace = false;
535
-}
536
-
537
-RegisterLoader$1.prototype = Object.create(Loader.prototype);
538
-RegisterLoader$1.prototype.constructor = RegisterLoader$1;
539
-
540
-var INSTANTIATE = RegisterLoader$1.instantiate = createSymbol('instantiate');
541
-
542
-// default normalize is the WhatWG style normalizer
543
-RegisterLoader$1.prototype[RegisterLoader$1.resolve = Loader.resolve] = function (key, parentKey) {
544
- return resolveIfNotPlain(key, parentKey || baseURI);
545
-};
546
-
547
-RegisterLoader$1.prototype[INSTANTIATE] = function (key, processAnonRegister) {};
548
-
549
-// once evaluated, the linkRecord is set to undefined leaving just the other load record properties
550
-// this allows tracking new binding listeners for es modules through importerSetters
551
-// for dynamic modules, the load record is removed entirely.
552
-function createLoadRecord (state, key, registration) {
553
- return state.records[key] = {
554
- key: key,
555
-
556
- // defined System.register cache
557
- registration: registration,
558
-
559
- // module namespace object
560
- module: undefined,
561
-
562
- // es-only
563
- // this sticks around so new module loads can listen to binding changes
564
- // for already-loaded modules by adding themselves to their importerSetters
565
- importerSetters: undefined,
566
-
567
- loadError: undefined,
568
- evalError: undefined,
569
-
570
- // in-flight linking record
571
- linkRecord: {
572
- // promise for instantiated
573
- instantiatePromise: undefined,
574
- dependencies: undefined,
575
- execute: undefined,
576
- executingRequire: false,
577
-
578
- // underlying module object bindings
579
- moduleObj: undefined,
580
-
581
- // es only, also indicates if es or not
582
- setters: undefined,
583
-
584
- // promise for instantiated dependencies (dependencyInstantiations populated)
585
- depsInstantiatePromise: undefined,
586
- // will be the array of dependency load record or a module namespace
587
- dependencyInstantiations: undefined,
588
-
589
- // top-level await!
590
- evaluatePromise: undefined,
591
-
592
- // NB optimization and way of ensuring module objects in setters
593
- // indicates setters which should run pre-execution of that dependency
594
- // setters is then just for completely executed module objects
595
- // alternatively we just pass the partially filled module objects as
596
- // arguments into the execute function
597
- // hoisted: undefined
598
- }
599
- };
600
-}
601
-
602
-RegisterLoader$1.prototype[Loader.resolveInstantiate] = function (key, parentKey) {
603
- var loader = this;
604
- var state = this[REGISTER_INTERNAL];
605
- var registry = this.registry[REGISTRY];
606
-
607
- return resolveInstantiate(loader, key, parentKey, registry, state)
608
- .then(function (instantiated) {
609
- if (instantiated instanceof ModuleNamespace || instantiated[toStringTag] === 'module')
610
- return instantiated;
611
-
612
- // resolveInstantiate always returns a load record with a link record and no module value
613
- var link = instantiated.linkRecord;
614
-
615
- // if already beaten to done, return
616
- if (!link) {
617
- if (instantiated.module)
618
- return instantiated.module;
619
- throw instantiated.evalError;
620
- }
621
-
622
- return deepInstantiateDeps(loader, instantiated, link, registry, state)
623
- .then(function () {
624
- return ensureEvaluate(loader, instantiated, link, registry, state);
625
- });
626
- });
627
-};
628
-
629
-function resolveInstantiate (loader, key, parentKey, registry, state) {
630
- // normalization shortpath for already-normalized key
631
- // could add a plain name filter, but doesn't yet seem necessary for perf
632
- var module = registry[key];
633
- if (module)
634
- return Promise.resolve(module);
635
-
636
- var load = state.records[key];
637
-
638
- // already linked but not in main registry is ignored
639
- if (load && !load.module) {
640
- if (load.loadError)
641
- return Promise.reject(load.loadError);
642
- return instantiate(loader, load, load.linkRecord, registry, state);
643
- }
644
-
645
- return loader.resolve(key, parentKey)
646
- .then(function (resolvedKey) {
647
- // main loader registry always takes preference
648
- module = registry[resolvedKey];
649
- if (module)
650
- return module;
651
-
652
- load = state.records[resolvedKey];
653
-
654
- // already has a module value but not already in the registry (load.module)
655
- // means it was removed by registry.delete, so we should
656
- // disgard the current load record creating a new one over it
657
- // but keep any existing registration
658
- if (!load || load.module)
659
- load = createLoadRecord(state, resolvedKey, load && load.registration);
660
-
661
- if (load.loadError)
662
- return Promise.reject(load.loadError);
663
-
664
- var link = load.linkRecord;
665
- if (!link)
666
- return load;
667
-
668
- return instantiate(loader, load, link, registry, state);
669
- });
670
-}
671
-
672
-function createProcessAnonRegister (loader, load, state) {
673
- return function () {
674
- var lastRegister = state.lastRegister;
675
-
676
- if (!lastRegister)
677
- return !!load.registration;
678
-
679
- state.lastRegister = undefined;
680
- load.registration = lastRegister;
681
-
682
- return true;
683
- };
684
-}
685
-
686
-function instantiate (loader, load, link, registry, state) {
687
- return link.instantiatePromise || (link.instantiatePromise =
688
- // if there is already an existing registration, skip running instantiate
689
- (load.registration ? resolvedPromise : resolvedPromise.then(function () {
690
- state.lastRegister = undefined;
691
- return loader[INSTANTIATE](load.key, loader[INSTANTIATE].length > 1 && createProcessAnonRegister(loader, load, state));
692
- }))
693
- .then(function (instantiation) {
694
- // direct module return from instantiate -> we're done
695
- if (instantiation !== undefined) {
696
- if (!(instantiation instanceof ModuleNamespace || instantiation[toStringTag] === 'module'))
697
- throw new TypeError('Instantiate did not return a valid Module object.');
698
-
699
- delete state.records[load.key];
700
- if (loader.trace)
701
- traceLoad(loader, load, link);
702
- return registry[load.key] = instantiation;
703
- }
704
-
705
- // run the cached loader.register declaration if there is one
706
- var registration = load.registration;
707
- // clear to allow new registrations for future loads (combined with registry delete)
708
- load.registration = undefined;
709
- if (!registration)
710
- throw new TypeError('Module instantiation did not call an anonymous or correctly named System.register.');
711
-
712
- link.dependencies = registration[0];
713
-
714
- load.importerSetters = [];
715
-
716
- link.moduleObj = {};
717
-
718
- // process System.registerDynamic declaration
719
- if (registration[2]) {
720
- link.moduleObj.default = link.moduleObj.__useDefault = {};
721
- link.executingRequire = registration[1];
722
- link.execute = registration[2];
723
- }
724
-
725
- // process System.register declaration
726
- else {
727
- registerDeclarative(loader, load, link, registration[1]);
728
- }
729
-
730
- return load;
731
- })
732
- .catch(function (err) {
733
- load.linkRecord = undefined;
734
- throw load.loadError = load.loadError || LoaderError__Check_error_message_for_loader_stack(err, 'Instantiating ' + load.key);
735
- }));
736
-}
737
-
738
-// like resolveInstantiate, but returning load records for linking
739
-function resolveInstantiateDep (loader, key, parentKey, registry, state, traceDepMap) {
740
- // normalization shortpaths for already-normalized key
741
- // DISABLED to prioritise consistent resolver calls
742
- // could add a plain name filter, but doesn't yet seem necessary for perf
743
- /* var load = state.records[key];
744
- var module = registry[key];
745
-
746
- if (module) {
747
- if (traceDepMap)
748
- traceDepMap[key] = key;
749
-
750
- // registry authority check in case module was deleted or replaced in main registry
751
- if (load && load.module && load.module === module)
752
- return load;
753
- else
754
- return module;
755
- }
756
-
757
- // already linked but not in main registry is ignored
758
- if (load && !load.module) {
759
- if (traceDepMap)
760
- traceDepMap[key] = key;
761
- return instantiate(loader, load, load.linkRecord, registry, state);
762
- } */
763
- return loader.resolve(key, parentKey)
764
- .then(function (resolvedKey) {
765
- if (traceDepMap)
766
- traceDepMap[key] = resolvedKey;
767
-
768
- // normalization shortpaths for already-normalized key
769
- var load = state.records[resolvedKey];
770
- var module = registry[resolvedKey];
771
-
772
- // main loader registry always takes preference
773
- if (module && (!load || load.module && module !== load.module))
774
- return module;
775
-
776
- if (load && load.loadError)
777
- throw load.loadError;
778
-
779
- // already has a module value but not already in the registry (load.module)
780
- // means it was removed by registry.delete, so we should
781
- // disgard the current load record creating a new one over it
782
- // but keep any existing registration
783
- if (!load || !module && load.module)
784
- load = createLoadRecord(state, resolvedKey, load && load.registration);
785
-
786
- var link = load.linkRecord;
787
- if (!link)
788
- return load;
789
-
790
- return instantiate(loader, load, link, registry, state);
791
- });
792
-}
793
-
794
-function traceLoad (loader, load, link) {
795
- loader.loads = loader.loads || {};
796
- loader.loads[load.key] = {
797
- key: load.key,
798
- deps: link.dependencies,
799
- dynamicDeps: [],
800
- depMap: link.depMap || {}
801
- };
802
-}
803
-
804
-/*
805
- * Convert a CJS module.exports into a valid object for new Module:
806
- *
807
- * new Module(getEsModule(module.exports))
808
- *
809
- * Sets the default value to the module, while also reading off named exports carefully.
810
- */
811
-function registerDeclarative (loader, load, link, declare) {
812
- var moduleObj = link.moduleObj;
813
- var importerSetters = load.importerSetters;
814
-
815
- var definedExports = false;
816
-
817
- // closure especially not based on link to allow link record disposal
818
- var declared = declare.call(envGlobal, function (name, value) {
819
- if (typeof name === 'object') {
820
- var changed = false;
821
- for (var p in name) {
822
- value = name[p];
823
- if (p !== '__useDefault' && (!(p in moduleObj) || moduleObj[p] !== value)) {
824
- changed = true;
825
- moduleObj[p] = value;
826
- }
827
- }
828
- if (changed === false)
829
- return value;
830
- }
831
- else {
832
- if ((definedExports || name in moduleObj) && moduleObj[name] === value)
833
- return value;
834
- moduleObj[name] = value;
835
- }
836
-
837
- for (var i = 0; i < importerSetters.length; i++)
838
- importerSetters[i](moduleObj);
839
-
840
- return value;
841
- }, new ContextualLoader(loader, load.key));
842
-
843
- link.setters = declared.setters || [];
844
- link.execute = declared.execute;
845
- if (declared.exports) {
846
- link.moduleObj = moduleObj = declared.exports;
847
- definedExports = true;
848
- }
849
-}
850
-
851
-function instantiateDeps (loader, load, link, registry, state) {
852
- if (link.depsInstantiatePromise)
853
- return link.depsInstantiatePromise;
854
-
855
- var depsInstantiatePromises = Array(link.dependencies.length);
856
-
857
- for (var i = 0; i < link.dependencies.length; i++)
858
- depsInstantiatePromises[i] = resolveInstantiateDep(loader, link.dependencies[i], load.key, registry, state, loader.trace && link.depMap || (link.depMap = {}));
859
-
860
- var depsInstantiatePromise = Promise.all(depsInstantiatePromises)
861
- .then(function (dependencyInstantiations) {
862
- link.dependencyInstantiations = dependencyInstantiations;
863
-
864
- // run setters to set up bindings to instantiated dependencies
865
- if (link.setters) {
866
- for (var i = 0; i < dependencyInstantiations.length; i++) {
867
- var setter = link.setters[i];
868
- if (setter) {
869
- var instantiation = dependencyInstantiations[i];
870
-
871
- if (instantiation instanceof ModuleNamespace || instantiation[toStringTag] === 'module') {
872
- setter(instantiation);
873
- }
874
- else {
875
- if (instantiation.loadError)
876
- throw instantiation.loadError;
877
- setter(instantiation.module || instantiation.linkRecord.moduleObj);
878
- // this applies to both es and dynamic registrations
879
- if (instantiation.importerSetters)
880
- instantiation.importerSetters.push(setter);
881
- }
882
- }
883
- }
884
- }
885
-
886
- return load;
887
- });
888
-
889
- if (loader.trace)
890
- depsInstantiatePromise = depsInstantiatePromise.then(function () {
891
- traceLoad(loader, load, link);
892
- return load;
893
- });
894
-
895
- depsInstantiatePromise = depsInstantiatePromise.catch(function (err) {
896
- // throw up the instantiateDeps stack
897
- link.depsInstantiatePromise = undefined;
898
- throw LoaderError__Check_error_message_for_loader_stack(err, 'Loading ' + load.key);
899
- });
900
-
901
- depsInstantiatePromise.catch(function () {});
902
-
903
- return link.depsInstantiatePromise = depsInstantiatePromise;
904
-}
905
-
906
-function deepInstantiateDeps (loader, load, link, registry, state) {
907
- var seen = [];
908
- function addDeps (load, link) {
909
- if (!link)
910
- return resolvedPromise;
911
- if (seen.indexOf(load) !== -1)
912
- return resolvedPromise;
913
- seen.push(load);
914
-
915
- return instantiateDeps(loader, load, link, registry, state)
916
- .then(function () {
917
- var depPromises;
918
- for (var i = 0; i < link.dependencies.length; i++) {
919
- var depLoad = link.dependencyInstantiations[i];
920
- if (!(depLoad instanceof ModuleNamespace || depLoad[toStringTag] === 'module')) {
921
- depPromises = depPromises || [];
922
- depPromises.push(addDeps(depLoad, depLoad.linkRecord));
923
- }
924
- }
925
- if (depPromises)
926
- return Promise.all(depPromises);
927
- });
928
- }
929
-
930
- return addDeps(load, link);
931
-}
932
-
933
-/*
934
- * System.register
935
- */
936
-RegisterLoader$1.prototype.register = function (key, deps, declare) {
937
- var state = this[REGISTER_INTERNAL];
938
-
939
- // anonymous modules get stored as lastAnon
940
- if (declare === undefined) {
941
- state.lastRegister = [key, deps, undefined];
942
- }
943
-
944
- // everything else registers into the register cache
945
- else {
946
- var load = state.records[key] || createLoadRecord(state, key, undefined);
947
- load.registration = [deps, declare, undefined];
948
- }
949
-};
950
-
951
-/*
952
- * System.registerDyanmic
953
- */
954
-RegisterLoader$1.prototype.registerDynamic = function (key, deps, executingRequire, execute) {
955
- var state = this[REGISTER_INTERNAL];
956
-
957
- // anonymous modules get stored as lastAnon
958
- if (typeof key !== 'string') {
959
- state.lastRegister = [key, deps, executingRequire];
960
- }
961
-
962
- // everything else registers into the register cache
963
- else {
964
- var load = state.records[key] || createLoadRecord(state, key, undefined);
965
- load.registration = [deps, executingRequire, execute];
966
- }
967
-};
968
-
969
-// ContextualLoader class
970
-// backwards-compatible with previous System.register context argument by exposing .id, .key
971
-function ContextualLoader (loader, key) {
972
- this.loader = loader;
973
- this.key = this.id = key;
974
- this.meta = {
975
- url: key
976
- // scriptElement: null
977
- };
978
-}
979
-/*ContextualLoader.prototype.constructor = function () {
980
- throw new TypeError('Cannot subclass the contextual loader only Reflect.Loader.');
981
-};*/
982
-ContextualLoader.prototype.import = function (key) {
983
- if (this.loader.trace)
984
- this.loader.loads[this.key].dynamicDeps.push(key);
985
- return this.loader.import(key, this.key);
986
-};
987
-/*ContextualLoader.prototype.resolve = function (key) {
988
- return this.loader.resolve(key, this.key);
989
-};*/
990
-
991
-function ensureEvaluate (loader, load, link, registry, state) {
992
- if (load.module)
993
- return load.module;
994
- if (load.evalError)
995
- throw load.evalError;
996
- if (link.evaluatePromise)
997
- return link.evaluatePromise;
998
-
999
- if (link.setters) {
1000
- var evaluatePromise = doEvaluateDeclarative(loader, load, link, registry, state, [load]);
1001
- if (evaluatePromise)
1002
- return evaluatePromise;
1003
- }
1004
- else {
1005
- doEvaluateDynamic(loader, load, link, registry, state, [load]);
1006
- }
1007
- return load.module;
1008
-}
1009
-
1010
-function makeDynamicRequire (loader, key, dependencies, dependencyInstantiations, registry, state, seen) {
1011
- // we can only require from already-known dependencies
1012
- return function (name) {
1013
- for (var i = 0; i < dependencies.length; i++) {
1014
- if (dependencies[i] === name) {
1015
- var depLoad = dependencyInstantiations[i];
1016
- var module;
1017
-
1018
- if (depLoad instanceof ModuleNamespace || depLoad[toStringTag] === 'module') {
1019
- module = depLoad;
1020
- }
1021
- else {
1022
- if (depLoad.evalError)
1023
- throw depLoad.evalError;
1024
- if (depLoad.module === undefined && seen.indexOf(depLoad) === -1 && !depLoad.linkRecord.evaluatePromise) {
1025
- if (depLoad.linkRecord.setters) {
1026
- doEvaluateDeclarative(loader, depLoad, depLoad.linkRecord, registry, state, [depLoad]);
1027
- }
1028
- else {
1029
- seen.push(depLoad);
1030
- doEvaluateDynamic(loader, depLoad, depLoad.linkRecord, registry, state, seen);
1031
- }
1032
- }
1033
- module = depLoad.module || depLoad.linkRecord.moduleObj;
1034
- }
1035
-
1036
- return '__useDefault' in module ? module.__useDefault : module;
1037
- }
1038
- }
1039
- throw new Error('Module ' + name + ' not declared as a System.registerDynamic dependency of ' + key);
1040
- };
1041
-}
1042
-
1043
-function evalError (load, err) {
1044
- load.linkRecord = undefined;
1045
- var evalError = LoaderError__Check_error_message_for_loader_stack(err, 'Evaluating ' + load.key);
1046
- if (load.evalError === undefined)
1047
- load.evalError = evalError;
1048
- throw evalError;
1049
-}
1050
-
1051
-// es modules evaluate dependencies first
1052
-// returns the error if any
1053
-function doEvaluateDeclarative (loader, load, link, registry, state, seen) {
1054
- var depLoad, depLink;
1055
- var depLoadPromises;
1056
- for (var i = 0; i < link.dependencies.length; i++) {
1057
- var depLoad = link.dependencyInstantiations[i];
1058
- if (depLoad instanceof ModuleNamespace || depLoad[toStringTag] === 'module')
1059
- continue;
1060
-
1061
- // custom Module returned from instantiate
1062
- depLink = depLoad.linkRecord;
1063
- if (depLink) {
1064
- if (depLoad.evalError) {
1065
- evalError(load, depLoad.evalError);
1066
- }
1067
- else if (depLink.setters) {
1068
- if (seen.indexOf(depLoad) === -1) {
1069
- seen.push(depLoad);
1070
- try {
1071
- var depLoadPromise = doEvaluateDeclarative(loader, depLoad, depLink, registry, state, seen);
1072
- }
1073
- catch (e) {
1074
- evalError(load, e);
1075
- }
1076
- if (depLoadPromise) {
1077
- depLoadPromises = depLoadPromises || [];
1078
- depLoadPromises.push(depLoadPromise.catch(function (err) {
1079
- evalError(load, err);
1080
- }));
1081
- }
1082
- }
1083
- }
1084
- else {
1085
- try {
1086
- doEvaluateDynamic(loader, depLoad, depLink, registry, state, [depLoad]);
1087
- }
1088
- catch (e) {
1089
- evalError(load, e);
1090
- }
1091
- }
1092
- }
1093
- }
1094
-
1095
- if (depLoadPromises)
1096
- return link.evaluatePromise = Promise.all(depLoadPromises)
1097
- .then(function () {
1098
- if (link.execute) {
1099
- // ES System.register execute
1100
- // "this" is null in ES
1101
- try {
1102
- var execPromise = link.execute.call(nullContext);
1103
- }
1104
- catch (e) {
1105
- evalError(load, e);
1106
- }
1107
- if (execPromise)
1108
- return execPromise.catch(function (e) {
1109
- evalError(load, e);
1110
- })
1111
- .then(function () {
1112
- load.linkRecord = undefined;
1113
- return registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
1114
- });
1115
- }
1116
-
1117
- // dispose link record
1118
- load.linkRecord = undefined;
1119
- registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
1120
- });
1121
-
1122
- if (link.execute) {
1123
- // ES System.register execute
1124
- // "this" is null in ES
1125
- try {
1126
- var execPromise = link.execute.call(nullContext);
1127
- }
1128
- catch (e) {
1129
- evalError(load, e);
1130
- }
1131
- if (execPromise)
1132
- return link.evaluatePromise = execPromise.catch(function (e) {
1133
- evalError(load, e);
1134
- })
1135
- .then(function () {
1136
- load.linkRecord = undefined;
1137
- return registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
1138
- });
1139
- }
1140
-
1141
- // dispose link record
1142
- load.linkRecord = undefined;
1143
- registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
1144
-}
1145
-
1146
-// non es modules explicitly call moduleEvaluate through require
1147
-function doEvaluateDynamic (loader, load, link, registry, state, seen) {
1148
- // System.registerDynamic execute
1149
- // "this" is "exports" in CJS
1150
- var module = { id: load.key };
1151
- var moduleObj = link.moduleObj;
1152
- Object.defineProperty(module, 'exports', {
1153
- configurable: true,
1154
- set: function (exports) {
1155
- moduleObj.default = moduleObj.__useDefault = exports;
1156
- },
1157
- get: function () {
1158
- return moduleObj.__useDefault;
1159
- }
1160
- });
1161
-
1162
- var require = makeDynamicRequire(loader, load.key, link.dependencies, link.dependencyInstantiations, registry, state, seen);
1163
-
1164
- // evaluate deps first
1165
- if (!link.executingRequire)
1166
- for (var i = 0; i < link.dependencies.length; i++)
1167
- require(link.dependencies[i]);
1168
-
1169
- try {
1170
- var output = link.execute.call(envGlobal, require, moduleObj.default, module);
1171
- if (output !== undefined)
1172
- module.exports = output;
1173
- }
1174
- catch (e) {
1175
- evalError(load, e);
1176
- }
1177
-
1178
- load.linkRecord = undefined;
1179
-
1180
- // pick up defineProperty calls to module.exports when we can
1181
- if (module.exports !== moduleObj.__useDefault)
1182
- moduleObj.default = moduleObj.__useDefault = module.exports;
1183
-
1184
- var moduleDefault = moduleObj.default;
1185
-
1186
- // __esModule flag extension support via lifting
1187
- if (moduleDefault && moduleDefault.__esModule) {
1188
- for (var p in moduleDefault) {
1189
- if (Object.hasOwnProperty.call(moduleDefault, p))
1190
- moduleObj[p] = moduleDefault[p];
1191
- }
1192
- }
1193
-
1194
- registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
1195
-
1196
- // run importer setters and clear them
1197
- // this allows dynamic modules to update themselves into es modules
1198
- // as soon as execution has completed
1199
- if (load.importerSetters)
1200
- for (var i = 0; i < load.importerSetters.length; i++)
1201
- load.importerSetters[i](load.module);
1202
- load.importerSetters = undefined;
1203
-}
1204
-
1205
-// the closest we can get to call(undefined)
1206
-var nullContext = Object.create(null);
1207
-if (Object.freeze)
1208
- Object.freeze(nullContext);
1209
-
1210
-var loader;
1211
-
1212
-// <script type="module"> support
1213
-var anonSources = {};
1214
-if (typeof document != 'undefined' && document.getElementsByTagName) {
1215
- var handleError = function(err) {
1216
- // dispatch an error event so that we can display in errors in browsers
1217
- // that don't yet support unhandledrejection
1218
- if (window.onunhandledrejection === undefined) {
1219
- try {
1220
- var evt = new Event('error');
1221
- } catch (_eventError) {
1222
- var evt = document.createEvent('Event');
1223
- evt.initEvent('error', true, true);
1224
- }
1225
- evt.message = err.message;
1226
- if (err.fileName) {
1227
- evt.filename = err.fileName;
1228
- evt.lineno = err.lineNumber;
1229
- evt.colno = err.columnNumber;
1230
- } else if (err.sourceURL) {
1231
- evt.filename = err.sourceURL;
1232
- evt.lineno = err.line;
1233
- evt.colno = err.column;
1234
- }
1235
- evt.error = err;
1236
- window.dispatchEvent(evt);
1237
- }
1238
-
1239
- // throw so it still shows up in the console
1240
- throw err;
1241
- };
1242
-
1243
- var ready = function() {
1244
- document.removeEventListener('DOMContentLoaded', ready, false );
1245
-
1246
- var anonCnt = 0;
1247
-
1248
- var scripts = document.getElementsByTagName('script');
1249
- for (var i = 0; i < scripts.length; i++) {
1250
- var script = scripts[i];
1251
- if (script.type == 'module' && !script.loaded) {
1252
- script.loaded = true;
1253
- if (script.src) {
1254
- loader.import(script.src).catch(handleError);
1255
- }
1256
- // anonymous modules supported via a custom naming scheme and registry
1257
- else {
1258
- var uri = './<anon' + ++anonCnt + '>.js';
1259
- if (script.id !== ""){
1260
- uri = "./" + script.id;
1261
- }
1262
-
1263
- var anonName = resolveIfNotPlain(uri, baseURI);
1264
- anonSources[anonName] = script.innerHTML;
1265
- loader.import(anonName).catch(handleError);
1266
- }
1267
- }
1268
- }
1269
- };
1270
-
1271
- // simple DOM ready
1272
- if (document.readyState !== 'loading')
1273
- setTimeout(ready);
1274
- else
1275
- document.addEventListener('DOMContentLoaded', ready, false);
1276
-}
1277
-
1278
-function BrowserESModuleLoader(baseKey) {
1279
- if (baseKey)
1280
- this.baseKey = resolveIfNotPlain(baseKey, baseURI) || resolveIfNotPlain('./' + baseKey, baseURI);
1281
-
1282
- RegisterLoader$1.call(this);
1283
-
1284
- var loader = this;
1285
-
1286
- // ensure System.register is available
1287
- envGlobal.System = envGlobal.System || {};
1288
- if (typeof envGlobal.System.register == 'function')
1289
- var prevRegister = envGlobal.System.register;
1290
- envGlobal.System.register = function() {
1291
- loader.register.apply(loader, arguments);
1292
- if (prevRegister)
1293
- prevRegister.apply(this, arguments);
1294
- };
1295
-}
1296
-BrowserESModuleLoader.prototype = Object.create(RegisterLoader$1.prototype);
1297
-
1298
-// normalize is never given a relative name like "./x", that part is already handled
1299
-BrowserESModuleLoader.prototype[RegisterLoader$1.resolve] = function(key, parent) {
1300
- var resolved = RegisterLoader$1.prototype[RegisterLoader$1.resolve].call(this, key, parent || this.baseKey) || key;
1301
- if (!resolved)
1302
- throw new RangeError('ES module loader does not resolve plain module names, resolving "' + key + '" to ' + parent);
1303
-
1304
- return resolved;
1305
-};
1306
-
1307
-function xhrFetch(url, resolve, reject) {
1308
- var xhr = new XMLHttpRequest();
1309
- var load = function(source) {
1310
- resolve(xhr.responseText);
1311
- };
1312
- var error = function() {
1313
- reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
1314
- };
1315
-
1316
- xhr.onreadystatechange = function () {
1317
- if (xhr.readyState === 4) {
1318
- // in Chrome on file:/// URLs, status is 0
1319
- if (xhr.status == 0) {
1320
- if (xhr.responseText) {
1321
- load();
1322
- }
1323
- else {
1324
- // when responseText is empty, wait for load or error event
1325
- // to inform if it is a 404 or empty file
1326
- xhr.addEventListener('error', error);
1327
- xhr.addEventListener('load', load);
1328
- }
1329
- }
1330
- else if (xhr.status === 200) {
1331
- load();
1332
- }
1333
- else {
1334
- error();
1335
- }
1336
- }
1337
- };
1338
- xhr.open("GET", url, true);
1339
- xhr.send(null);
1340
-}
1341
-
1342
-var WorkerPool = function (script, size) {
1343
- var current = document.currentScript;
1344
- // IE doesn't support currentScript
1345
- if (!current) {
1346
- // Find an entry with out basename
1347
- var scripts = document.getElementsByTagName('script');
1348
- for (var i = 0; i < scripts.length; i++) {
1349
- if (scripts[i].src.indexOf("browser-es-module-loader.js") !== -1) {
1350
- current = scripts[i];
1351
- break;
1352
- }
1353
- }
1354
- if (!current)
1355
- throw Error("Could not find own <script> element");
1356
- }
1357
- script = current.src.substr(0, current.src.lastIndexOf("/")) + "/" + script;
1358
- this._workers = new Array(size);
1359
- this._ind = 0;
1360
- this._size = size;
1361
- this._jobs = 0;
1362
- this.onmessage = undefined;
1363
- this._stopTimeout = undefined;
1364
- for (var i = 0; i < size; i++) {
1365
- var wrkr = new Worker(script);
1366
- wrkr._count = 0;
1367
- wrkr._ind = i;
1368
- wrkr.onmessage = this._onmessage.bind(this, wrkr);
1369
- wrkr.onerror = this._onerror.bind(this);
1370
- this._workers[i] = wrkr;
1371
- }
1372
-
1373
- this._checkJobs();
1374
-};
1375
-WorkerPool.prototype = {
1376
- postMessage: function (msg) {
1377
- if (this._stopTimeout !== undefined) {
1378
- clearTimeout(this._stopTimeout);
1379
- this._stopTimeout = undefined;
1380
- }
1381
- var wrkr = this._workers[this._ind % this._size];
1382
- wrkr._count++;
1383
- this._jobs++;
1384
- wrkr.postMessage(msg);
1385
- this._ind++;
1386
- },
1387
-
1388
- _onmessage: function (wrkr, evt) {
1389
- wrkr._count--;
1390
- this._jobs--;
1391
- this.onmessage(evt, wrkr);
1392
- this._checkJobs();
1393
- },
1394
-
1395
- _onerror: function(err) {
1396
- try {
1397
- var evt = new Event('error');
1398
- } catch (_eventError) {
1399
- var evt = document.createEvent('Event');
1400
- evt.initEvent('error', true, true);
1401
- }
1402
- evt.message = err.message;
1403
- evt.filename = err.filename;
1404
- evt.lineno = err.lineno;
1405
- evt.colno = err.colno;
1406
- evt.error = err.error;
1407
- window.dispatchEvent(evt);
1408
- },
1409
-
1410
- _checkJobs: function () {
1411
- if (this._jobs === 0 && this._stopTimeout === undefined) {
1412
- // wait for 2s of inactivity before stopping (that should be enough for local loading)
1413
- this._stopTimeout = setTimeout(this._stop.bind(this), 2000);
1414
- }
1415
- },
1416
-
1417
- _stop: function () {
1418
- this._workers.forEach(function(wrkr) {
1419
- wrkr.terminate();
1420
- });
1421
- }
1422
-};
1423
-
1424
-var promiseMap = new Map();
1425
-var babelWorker = new WorkerPool('babel-worker.js', 3);
1426
-babelWorker.onmessage = function (evt) {
1427
- var promFuncs = promiseMap.get(evt.data.key);
1428
- promFuncs.resolve(evt.data);
1429
- promiseMap.delete(evt.data.key);
1430
-};
1431
-
1432
-// instantiate just needs to run System.register
1433
-// so we fetch the source, convert into the Babel System module format, then evaluate it
1434
-BrowserESModuleLoader.prototype[RegisterLoader$1.instantiate] = function(key, processAnonRegister) {
1435
- var loader = this;
1436
-
1437
- // load as ES with Babel converting into System.register
1438
- return new Promise(function(resolve, reject) {
1439
- // anonymous module
1440
- if (anonSources[key]) {
1441
- resolve(anonSources[key]);
1442
- anonSources[key] = undefined;
1443
- }
1444
- // otherwise we fetch
1445
- else {
1446
- xhrFetch(key, resolve, reject);
1447
- }
1448
- })
1449
- .then(function(source) {
1450
- // check our cache first
1451
- var cacheEntry = localStorage.getItem(key);
1452
- if (cacheEntry) {
1453
- cacheEntry = JSON.parse(cacheEntry);
1454
- // TODO: store a hash instead
1455
- if (cacheEntry.source === source) {
1456
- return Promise.resolve({key: key, code: cacheEntry.code, source: cacheEntry.source});
1457
- }
1458
- }
1459
- return new Promise(function (resolve, reject) {
1460
- promiseMap.set(key, {resolve: resolve, reject: reject});
1461
- babelWorker.postMessage({key: key, source: source});
1462
- });
1463
- }).then(function (data) {
1464
- // evaluate without require, exports and module variables
1465
- // we leave module in for now to allow module.require access
1466
- try {
1467
- var cacheEntry = JSON.stringify({source: data.source, code: data.code});
1468
- localStorage.setItem(key, cacheEntry);
1469
- } catch (e) {
1470
- if (window.console) {
1471
- window.console.warn('Unable to cache transpiled version of ' + key + ': ' + e);
1472
- }
1473
- }
1474
- (0, eval)(data.code + '\n//# sourceURL=' + data.key + '!transpiled');
1475
- processAnonRegister();
1476
- });
1477
-};
1478
-
1479
-// create a default loader instance in the browser
1480
-if (isBrowser)
1481
- loader = new BrowserESModuleLoader();
1482
-
1483
-return BrowserESModuleLoader;
1484
-
1485
-})));
1486
-//# sourceMappingURL=browser-es-module-loader.js.map
public/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js.map
deleted
-1
@@ -1 +0,0 @@
1
-{"version":3,"file":"browser-es-module-loader.js","sources":["../../../node_modules/es-module-loader/core/common.js","../../../node_modules/es-module-loader/core/loader-polyfill.js","../../../node_modules/es-module-loader/core/resolve.js","../../../node_modules/es-module-loader/core/register-loader.js","../src/browser-es-module-loader.js"],"sourcesContent":["/*\r\n * Environment\r\n */\r\nexport var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';\r\nexport var isNode = typeof process !== 'undefined' && process.versions && process.versions.node;\r\nexport var isWindows = typeof process !== 'undefined' && typeof process.platform === 'string' && process.platform.match(/^win/);\r\n\r\nvar envGlobal = typeof self !== 'undefined' ? self : global;\r\nexport { envGlobal as global }\r\n\r\n/*\r\n * Simple Symbol() shim\r\n */\r\nvar hasSymbol = typeof Symbol !== 'undefined';\r\nexport function createSymbol (name) {\r\n return hasSymbol ? Symbol() : '@@' + name;\r\n}\r\n\r\nexport var toStringTag = hasSymbol && Symbol.toStringTag;\r\n\r\nexport function pathToFileUrl (filePath) {\r\n return 'file://' + (isWindows ? '/' : '') + (isWindows ? filePath.replace(/\\\\/g, '/') : filePath);\r\n}\r\n\r\nexport function fileUrlToPath (fileUrl) {\r\n if (fileUrl.substr(0, 7) !== 'file://')\r\n throw new RangeError(fileUrl + ' is not a valid file url');\r\n if (isWindows)\r\n return fileUrl.substr(8).replace(/\\\\/g, '/');\r\n else\r\n return fileUrl.substr(7);\r\n}\r\n\r\n/*\r\n * Environment baseURI\r\n */\r\nexport var baseURI;\r\n\r\n// environent baseURI detection\r\nif (typeof document != 'undefined' && document.getElementsByTagName) {\r\n baseURI = document.baseURI;\r\n\r\n if (!baseURI) {\r\n var bases = document.getElementsByTagName('base');\r\n baseURI = bases[0] && bases[0].href || window.location.href;\r\n }\r\n}\r\nelse if (typeof location != 'undefined') {\r\n baseURI = location.href;\r\n}\r\n\r\n// sanitize out the hash and querystring\r\nif (baseURI) {\r\n baseURI = baseURI.split('#')[0].split('?')[0];\r\n var slashIndex = baseURI.lastIndexOf('/');\r\n if (slashIndex !== -1)\r\n baseURI = baseURI.substr(0, slashIndex + 1);\r\n}\r\nelse if (typeof process !== 'undefined' && process.cwd) {\r\n baseURI = 'file://' + (isWindows ? '/' : '') + process.cwd();\r\n if (isWindows)\r\n baseURI = baseURI.replace(/\\\\/g, '/');\r\n}\r\nelse {\r\n throw new TypeError('No environment baseURI');\r\n}\r\n\r\n// ensure baseURI has trailing \"/\"\r\nif (baseURI[baseURI.length - 1] !== '/')\r\n baseURI += '/';\r\n\r\n/*\r\n * LoaderError with chaining for loader stacks\r\n */\r\nvar errArgs = new Error(0, '_').fileName == '_';\r\nfunction LoaderError__Check_error_message_for_loader_stack (childErr, newMessage) {\r\n // Convert file:/// URLs to paths in Node\r\n if (!isBrowser)\r\n newMessage = newMessage.replace(isWindows ? /file:\\/\\/\\//g : /file:\\/\\//g, '');\r\n\r\n var message = (childErr.message || childErr) + '\\n ' + newMessage;\r\n\r\n var err;\r\n if (errArgs && childErr.fileName)\r\n err = new Error(message, childErr.fileName, childErr.lineNumber);\r\n else\r\n err = new Error(message);\r\n\r\n\r\n var stack = childErr.originalErr ? childErr.originalErr.stack : childErr.stack;\r\n\r\n if (isNode)\r\n // node doesn't show the message otherwise\r\n err.stack = message + '\\n ' + stack;\r\n else\r\n err.stack = stack;\r\n\r\n err.originalErr = childErr.originalErr || childErr;\r\n\r\n return err;\r\n}\r\nexport { LoaderError__Check_error_message_for_loader_stack as addToError }\r\n","import { addToError, createSymbol, toStringTag } from './common.js';\r\n\r\nexport { Loader, ModuleNamespace, REGISTRY }\r\n\r\nvar resolvedPromise = Promise.resolve();\r\n\r\n/*\r\n * Simple Array values shim\r\n */\r\nfunction arrayValues (arr) {\r\n if (arr.values)\r\n return arr.values();\r\n\r\n if (typeof Symbol === 'undefined' || !Symbol.iterator)\r\n throw new Error('Symbol.iterator not supported in this browser');\r\n\r\n var iterable = {};\r\n iterable[Symbol.iterator] = function () {\r\n var keys = Object.keys(arr);\r\n var keyIndex = 0;\r\n return {\r\n next: function () {\r\n if (keyIndex < keys.length)\r\n return {\r\n value: arr[keys[keyIndex++]],\r\n done: false\r\n };\r\n else\r\n return {\r\n value: undefined,\r\n done: true\r\n };\r\n }\r\n };\r\n };\r\n return iterable;\r\n}\r\n\r\n/*\r\n * 3. Reflect.Loader\r\n *\r\n * We skip the entire native internal pipeline, just providing the bare API\r\n */\r\n// 3.1.1\r\nfunction Loader () {\r\n this.registry = new Registry();\r\n}\r\n// 3.3.1\r\nLoader.prototype.constructor = Loader;\r\n\r\nfunction ensureInstantiated (module) {\r\n if (module === undefined)\r\n return;\r\n if (module instanceof ModuleNamespace === false && module[toStringTag] !== 'module')\r\n throw new TypeError('Module instantiation did not return a valid namespace object.');\r\n return module;\r\n}\r\n\r\n// 3.3.2\r\nLoader.prototype.import = function (key, parent) {\r\n if (typeof key !== 'string')\r\n throw new TypeError('Loader import method must be passed a module key string');\r\n // custom resolveInstantiate combined hook for better perf\r\n var loader = this;\r\n return resolvedPromise\r\n .then(function () {\r\n return loader[RESOLVE_INSTANTIATE](key, parent);\r\n })\r\n .then(ensureInstantiated)\r\n //.then(Module.evaluate)\r\n .catch(function (err) {\r\n throw addToError(err, 'Loading ' + key + (parent ? ' from ' + parent : ''));\r\n });\r\n};\r\n// 3.3.3\r\nvar RESOLVE = Loader.resolve = createSymbol('resolve');\r\n\r\n/*\r\n * Combined resolve / instantiate hook\r\n *\r\n * Not in current reduced spec, but necessary to separate RESOLVE from RESOLVE + INSTANTIATE as described\r\n * in the spec notes of this repo to ensure that loader.resolve doesn't instantiate when not wanted.\r\n *\r\n * We implement RESOLVE_INSTANTIATE as a single hook instead of a separate INSTANTIATE in order to avoid\r\n * the need for double registry lookups as a performance optimization.\r\n */\r\nvar RESOLVE_INSTANTIATE = Loader.resolveInstantiate = createSymbol('resolveInstantiate');\r\n\r\n// default resolveInstantiate is just to call resolve and then get from the registry\r\n// this provides compatibility for the resolveInstantiate optimization\r\nLoader.prototype[RESOLVE_INSTANTIATE] = function (key, parent) {\r\n var loader = this;\r\n return loader.resolve(key, parent)\r\n .then(function (resolved) {\r\n return loader.registry.get(resolved);\r\n });\r\n};\r\n\r\nfunction ensureResolution (resolvedKey) {\r\n if (resolvedKey === undefined)\r\n throw new RangeError('No resolution found.');\r\n return resolvedKey;\r\n}\r\n\r\nLoader.prototype.resolve = function (key, parent) {\r\n var loader = this;\r\n return resolvedPromise\r\n .then(function() {\r\n return loader[RESOLVE](key, parent);\r\n })\r\n .then(ensureResolution)\r\n .catch(function (err) {\r\n throw addToError(err, 'Resolving ' + key + (parent ? ' to ' + parent : ''));\r\n });\r\n};\r\n\r\n// 3.3.4 (import without evaluate)\r\n// this is not documented because the use of deferred evaluation as in Module.evaluate is not\r\n// documented, as it is not considered a stable feature to be encouraged\r\n// Loader.prototype.load may well be deprecated if this stays disabled\r\n/* Loader.prototype.load = function (key, parent) {\r\n return Promise.resolve(this[RESOLVE_INSTANTIATE](key, parent || this.key))\r\n .catch(function (err) {\r\n throw addToError(err, 'Loading ' + key + (parent ? ' from ' + parent : ''));\r\n });\r\n}; */\r\n\r\n/*\r\n * 4. Registry\r\n *\r\n * Instead of structuring through a Map, just use a dictionary object\r\n * We throw for construction attempts so this doesn't affect the public API\r\n *\r\n * Registry has been adjusted to use Namespace objects over ModuleStatus objects\r\n * as part of simplifying loader API implementation\r\n */\r\nvar iteratorSupport = typeof Symbol !== 'undefined' && Symbol.iterator;\r\nvar REGISTRY = createSymbol('registry');\r\nfunction Registry() {\r\n this[REGISTRY] = {};\r\n}\r\n// 4.4.1\r\nif (iteratorSupport) {\r\n // 4.4.2\r\n Registry.prototype[Symbol.iterator] = function () {\r\n return this.entries()[Symbol.iterator]();\r\n };\r\n\r\n // 4.4.3\r\n Registry.prototype.entries = function () {\r\n var registry = this[REGISTRY];\r\n return arrayValues(Object.keys(registry).map(function (key) {\r\n return [key, registry[key]];\r\n }));\r\n };\r\n}\r\n\r\n// 4.4.4\r\nRegistry.prototype.keys = function () {\r\n return arrayValues(Object.keys(this[REGISTRY]));\r\n};\r\n// 4.4.5\r\nRegistry.prototype.values = function () {\r\n var registry = this[REGISTRY];\r\n return arrayValues(Object.keys(registry).map(function (key) {\r\n return registry[key];\r\n }));\r\n};\r\n// 4.4.6\r\nRegistry.prototype.get = function (key) {\r\n return this[REGISTRY][key];\r\n};\r\n// 4.4.7\r\nRegistry.prototype.set = function (key, namespace) {\r\n if (!(namespace instanceof ModuleNamespace || namespace[toStringTag] === 'module'))\r\n throw new Error('Registry must be set with an instance of Module Namespace');\r\n this[REGISTRY][key] = namespace;\r\n return this;\r\n};\r\n// 4.4.8\r\nRegistry.prototype.has = function (key) {\r\n return Object.hasOwnProperty.call(this[REGISTRY], key);\r\n};\r\n// 4.4.9\r\nRegistry.prototype.delete = function (key) {\r\n if (Object.hasOwnProperty.call(this[REGISTRY], key)) {\r\n delete this[REGISTRY][key];\r\n return true;\r\n }\r\n return false;\r\n};\r\n\r\n/*\r\n * Simple ModuleNamespace Exotic object based on a baseObject\r\n * We export this for allowing a fast-path for module namespace creation over Module descriptors\r\n */\r\n// var EVALUATE = createSymbol('evaluate');\r\nvar BASE_OBJECT = createSymbol('baseObject');\r\n\r\n// 8.3.1 Reflect.Module\r\n/*\r\n * Best-effort simplified non-spec implementation based on\r\n * a baseObject referenced via getters.\r\n *\r\n * Allows:\r\n *\r\n * loader.registry.set('x', new Module({ default: 'x' }));\r\n *\r\n * Optional evaluation function provides experimental Module.evaluate\r\n * support for non-executed modules in registry.\r\n */\r\nfunction ModuleNamespace (baseObject/*, evaluate*/) {\r\n Object.defineProperty(this, BASE_OBJECT, {\r\n value: baseObject\r\n });\r\n\r\n // evaluate defers namespace population\r\n /* if (evaluate) {\r\n Object.defineProperty(this, EVALUATE, {\r\n value: evaluate,\r\n configurable: true,\r\n writable: true\r\n });\r\n }\r\n else { */\r\n Object.keys(baseObject).forEach(extendNamespace, this);\r\n //}\r\n};\r\n// 8.4.2\r\nModuleNamespace.prototype = Object.create(null);\r\n\r\nif (toStringTag)\r\n Object.defineProperty(ModuleNamespace.prototype, toStringTag, {\r\n value: 'Module'\r\n });\r\n\r\nfunction extendNamespace (key) {\r\n Object.defineProperty(this, key, {\r\n enumerable: true,\r\n get: function () {\r\n return this[BASE_OBJECT][key];\r\n }\r\n });\r\n}\r\n\r\n/* function doEvaluate (evaluate, context) {\r\n try {\r\n evaluate.call(context);\r\n }\r\n catch (e) {\r\n return e;\r\n }\r\n}\r\n\r\n// 8.4.1 Module.evaluate... not documented or used because this is potentially unstable\r\nModule.evaluate = function (ns) {\r\n var evaluate = ns[EVALUATE];\r\n if (evaluate) {\r\n ns[EVALUATE] = undefined;\r\n var err = doEvaluate(evaluate);\r\n if (err) {\r\n // cache the error\r\n ns[EVALUATE] = function () {\r\n throw err;\r\n };\r\n throw err;\r\n }\r\n Object.keys(ns[BASE_OBJECT]).forEach(extendNamespace, ns);\r\n }\r\n // make chainable\r\n return ns;\r\n}; */\r\n","import { isNode } from './common.js';\r\n\r\n/*\r\n * Optimized URL normalization assuming a syntax-valid URL parent\r\n */\r\nfunction throwResolveError (relUrl, parentUrl) {\r\n throw new RangeError('Unable to resolve \"' + relUrl + '\" to ' + parentUrl);\r\n}\r\nvar backslashRegEx = /\\\\/g;\r\nexport function resolveIfNotPlain (relUrl, parentUrl) {\r\n if (relUrl[0] === ' ' || relUrl[relUrl.length - 1] === ' ')\r\n relUrl = relUrl.trim();\r\n var parentProtocol = parentUrl && parentUrl.substr(0, parentUrl.indexOf(':') + 1);\r\n\r\n var firstChar = relUrl[0];\r\n var secondChar = relUrl[1];\r\n\r\n // protocol-relative\r\n if (firstChar === '/' && secondChar === '/') {\r\n if (!parentProtocol)\r\n throwResolveError(relUrl, parentUrl);\r\n if (relUrl.indexOf('\\\\') !== -1)\r\n relUrl = relUrl.replace(backslashRegEx, '/');\r\n return parentProtocol + relUrl;\r\n }\r\n // relative-url\r\n else if (firstChar === '.' && (secondChar === '/' || secondChar === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||\r\n relUrl.length === 1 && (relUrl += '/')) ||\r\n firstChar === '/') {\r\n if (relUrl.indexOf('\\\\') !== -1)\r\n relUrl = relUrl.replace(backslashRegEx, '/');\r\n var parentIsPlain = !parentProtocol || parentUrl[parentProtocol.length] !== '/';\r\n\r\n // read pathname from parent if a URL\r\n // pathname taken to be part after leading \"/\"\r\n var pathname;\r\n if (parentIsPlain) {\r\n // resolving to a plain parent -> skip standard URL prefix, and treat entire parent as pathname\r\n if (parentUrl === undefined)\r\n throwResolveError(relUrl, parentUrl);\r\n pathname = parentUrl;\r\n }\r\n else if (parentUrl[parentProtocol.length + 1] === '/') {\r\n // resolving to a :// so we need to read out the auth and host\r\n if (parentProtocol !== 'file:') {\r\n pathname = parentUrl.substr(parentProtocol.length + 2);\r\n pathname = pathname.substr(pathname.indexOf('/') + 1);\r\n }\r\n else {\r\n pathname = parentUrl.substr(8);\r\n }\r\n }\r\n else {\r\n // resolving to :/ so pathname is the /... part\r\n pathname = parentUrl.substr(parentProtocol.length + 1);\r\n }\r\n\r\n if (firstChar === '/') {\r\n if (parentIsPlain)\r\n throwResolveError(relUrl, parentUrl);\r\n else\r\n return parentUrl.substr(0, parentUrl.length - pathname.length - 1) + relUrl;\r\n }\r\n\r\n // join together and split for removal of .. and . segments\r\n // looping the string instead of anything fancy for perf reasons\r\n // '../../../../../z' resolved to 'x/y' is just 'z' regardless of parentIsPlain\r\n var segmented = pathname.substr(0, pathname.lastIndexOf('/') + 1) + relUrl;\r\n\r\n var output = [];\r\n var segmentIndex = -1;\r\n\r\n for (var i = 0; i < segmented.length; i++) {\r\n // busy reading a segment - only terminate on '/'\r\n if (segmentIndex !== -1) {\r\n if (segmented[i] === '/') {\r\n output.push(segmented.substring(segmentIndex, i + 1));\r\n segmentIndex = -1;\r\n }\r\n continue;\r\n }\r\n\r\n // new segment - check if it is relative\r\n if (segmented[i] === '.') {\r\n // ../ segment\r\n if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {\r\n output.pop();\r\n i += 2;\r\n }\r\n // ./ segment\r\n else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {\r\n i += 1;\r\n }\r\n else {\r\n // the start of a new segment as below\r\n segmentIndex = i;\r\n continue;\r\n }\r\n\r\n // this is the plain URI backtracking error (../, package:x -> error)\r\n if (parentIsPlain && output.length === 0)\r\n throwResolveError(relUrl, parentUrl);\r\n\r\n continue;\r\n }\r\n\r\n // it is the start of a new segment\r\n segmentIndex = i;\r\n }\r\n // finish reading out the last segment\r\n if (segmentIndex !== -1)\r\n output.push(segmented.substr(segmentIndex));\r\n\r\n return parentUrl.substr(0, parentUrl.length - pathname.length) + output.join('');\r\n }\r\n\r\n // sanitizes and verifies (by returning undefined if not a valid URL-like form)\r\n // Windows filepath compatibility is an added convenience here\r\n var protocolIndex = relUrl.indexOf(':');\r\n if (protocolIndex !== -1) {\r\n if (isNode) {\r\n // C:\\x becomes file:///c:/x (we don't support C|\\x)\r\n if (relUrl[1] === ':' && relUrl[2] === '\\\\' && relUrl[0].match(/[a-z]/i))\r\n return 'file:///' + relUrl.replace(backslashRegEx, '/');\r\n }\r\n return relUrl;\r\n }\r\n}\r\n","import { Loader, ModuleNamespace, REGISTRY } from './loader-polyfill.js';\r\nimport { resolveIfNotPlain } from './resolve.js';\r\nimport { addToError, global, createSymbol, baseURI, toStringTag } from './common.js';\r\n\r\nexport default RegisterLoader;\r\n\r\nvar resolvedPromise = Promise.resolve();\r\nvar emptyArray = [];\r\n\r\n/*\r\n * Register Loader\r\n *\r\n * Builds directly on top of loader polyfill to provide:\r\n * - loader.register support\r\n * - hookable higher-level resolve\r\n * - instantiate hook returning a ModuleNamespace or undefined for es module loading\r\n * - loader error behaviour as in HTML and loader specs, caching load and eval errors separately\r\n * - build tracing support by providing a .trace=true and .loads object format\r\n */\r\n\r\nvar REGISTER_INTERNAL = createSymbol('register-internal');\r\n\r\nfunction RegisterLoader () {\r\n Loader.call(this);\r\n\r\n var registryDelete = this.registry.delete;\r\n this.registry.delete = function (key) {\r\n var deleted = registryDelete.call(this, key);\r\n\r\n // also delete from register registry if linked\r\n if (records.hasOwnProperty(key) && !records[key].linkRecord) {\r\n delete records[key];\r\n deleted = true;\r\n }\r\n\r\n return deleted;\r\n };\r\n\r\n var records = {};\r\n\r\n this[REGISTER_INTERNAL] = {\r\n // last anonymous System.register call\r\n lastRegister: undefined,\r\n // in-flight es module load records\r\n records: records\r\n };\r\n\r\n // tracing\r\n this.trace = false;\r\n}\r\n\r\nRegisterLoader.prototype = Object.create(Loader.prototype);\r\nRegisterLoader.prototype.constructor = RegisterLoader;\r\n\r\nvar INSTANTIATE = RegisterLoader.instantiate = createSymbol('instantiate');\r\n\r\n// default normalize is the WhatWG style normalizer\r\nRegisterLoader.prototype[RegisterLoader.resolve = Loader.resolve] = function (key, parentKey) {\r\n return resolveIfNotPlain(key, parentKey || baseURI);\r\n};\r\n\r\nRegisterLoader.prototype[INSTANTIATE] = function (key, processAnonRegister) {};\r\n\r\n// once evaluated, the linkRecord is set to undefined leaving just the other load record properties\r\n// this allows tracking new binding listeners for es modules through importerSetters\r\n// for dynamic modules, the load record is removed entirely.\r\nfunction createLoadRecord (state, key, registration) {\r\n return state.records[key] = {\r\n key: key,\r\n\r\n // defined System.register cache\r\n registration: registration,\r\n\r\n // module namespace object\r\n module: undefined,\r\n\r\n // es-only\r\n // this sticks around so new module loads can listen to binding changes\r\n // for already-loaded modules by adding themselves to their importerSetters\r\n importerSetters: undefined,\r\n\r\n loadError: undefined,\r\n evalError: undefined,\r\n\r\n // in-flight linking record\r\n linkRecord: {\r\n // promise for instantiated\r\n instantiatePromise: undefined,\r\n dependencies: undefined,\r\n execute: undefined,\r\n executingRequire: false,\r\n\r\n // underlying module object bindings\r\n moduleObj: undefined,\r\n\r\n // es only, also indicates if es or not\r\n setters: undefined,\r\n\r\n // promise for instantiated dependencies (dependencyInstantiations populated)\r\n depsInstantiatePromise: undefined,\r\n // will be the array of dependency load record or a module namespace\r\n dependencyInstantiations: undefined,\r\n\r\n // top-level await!\r\n evaluatePromise: undefined,\r\n\r\n // NB optimization and way of ensuring module objects in setters\r\n // indicates setters which should run pre-execution of that dependency\r\n // setters is then just for completely executed module objects\r\n // alternatively we just pass the partially filled module objects as\r\n // arguments into the execute function\r\n // hoisted: undefined\r\n }\r\n };\r\n}\r\n\r\nRegisterLoader.prototype[Loader.resolveInstantiate] = function (key, parentKey) {\r\n var loader = this;\r\n var state = this[REGISTER_INTERNAL];\r\n var registry = this.registry[REGISTRY];\r\n\r\n return resolveInstantiate(loader, key, parentKey, registry, state)\r\n .then(function (instantiated) {\r\n if (instantiated instanceof ModuleNamespace || instantiated[toStringTag] === 'module')\r\n return instantiated;\r\n\r\n // resolveInstantiate always returns a load record with a link record and no module value\r\n var link = instantiated.linkRecord;\r\n\r\n // if already beaten to done, return\r\n if (!link) {\r\n if (instantiated.module)\r\n return instantiated.module;\r\n throw instantiated.evalError;\r\n }\r\n\r\n return deepInstantiateDeps(loader, instantiated, link, registry, state)\r\n .then(function () {\r\n return ensureEvaluate(loader, instantiated, link, registry, state);\r\n });\r\n });\r\n};\r\n\r\nfunction resolveInstantiate (loader, key, parentKey, registry, state) {\r\n // normalization shortpath for already-normalized key\r\n // could add a plain name filter, but doesn't yet seem necessary for perf\r\n var module = registry[key];\r\n if (module)\r\n return Promise.resolve(module);\r\n\r\n var load = state.records[key];\r\n\r\n // already linked but not in main registry is ignored\r\n if (load && !load.module) {\r\n if (load.loadError)\r\n return Promise.reject(load.loadError);\r\n return instantiate(loader, load, load.linkRecord, registry, state);\r\n }\r\n\r\n return loader.resolve(key, parentKey)\r\n .then(function (resolvedKey) {\r\n // main loader registry always takes preference\r\n module = registry[resolvedKey];\r\n if (module)\r\n return module;\r\n\r\n load = state.records[resolvedKey];\r\n\r\n // already has a module value but not already in the registry (load.module)\r\n // means it was removed by registry.delete, so we should\r\n // disgard the current load record creating a new one over it\r\n // but keep any existing registration\r\n if (!load || load.module)\r\n load = createLoadRecord(state, resolvedKey, load && load.registration);\r\n\r\n if (load.loadError)\r\n return Promise.reject(load.loadError);\r\n\r\n var link = load.linkRecord;\r\n if (!link)\r\n return load;\r\n\r\n return instantiate(loader, load, link, registry, state);\r\n });\r\n}\r\n\r\nfunction createProcessAnonRegister (loader, load, state) {\r\n return function () {\r\n var lastRegister = state.lastRegister;\r\n\r\n if (!lastRegister)\r\n return !!load.registration;\r\n\r\n state.lastRegister = undefined;\r\n load.registration = lastRegister;\r\n\r\n return true;\r\n };\r\n}\r\n\r\nfunction instantiate (loader, load, link, registry, state) {\r\n return link.instantiatePromise || (link.instantiatePromise =\r\n // if there is already an existing registration, skip running instantiate\r\n (load.registration ? resolvedPromise : resolvedPromise.then(function () {\r\n state.lastRegister = undefined;\r\n return loader[INSTANTIATE](load.key, loader[INSTANTIATE].length > 1 && createProcessAnonRegister(loader, load, state));\r\n }))\r\n .then(function (instantiation) {\r\n // direct module return from instantiate -> we're done\r\n if (instantiation !== undefined) {\r\n if (!(instantiation instanceof ModuleNamespace || instantiation[toStringTag] === 'module'))\r\n throw new TypeError('Instantiate did not return a valid Module object.');\r\n\r\n delete state.records[load.key];\r\n if (loader.trace)\r\n traceLoad(loader, load, link);\r\n return registry[load.key] = instantiation;\r\n }\r\n\r\n // run the cached loader.register declaration if there is one\r\n var registration = load.registration;\r\n // clear to allow new registrations for future loads (combined with registry delete)\r\n load.registration = undefined;\r\n if (!registration)\r\n throw new TypeError('Module instantiation did not call an anonymous or correctly named System.register.');\r\n\r\n link.dependencies = registration[0];\r\n\r\n load.importerSetters = [];\r\n\r\n link.moduleObj = {};\r\n\r\n // process System.registerDynamic declaration\r\n if (registration[2]) {\r\n link.moduleObj.default = link.moduleObj.__useDefault = {};\r\n link.executingRequire = registration[1];\r\n link.execute = registration[2];\r\n }\r\n\r\n // process System.register declaration\r\n else {\r\n registerDeclarative(loader, load, link, registration[1]);\r\n }\r\n\r\n return load;\r\n })\r\n .catch(function (err) {\r\n load.linkRecord = undefined;\r\n throw load.loadError = load.loadError || addToError(err, 'Instantiating ' + load.key);\r\n }));\r\n}\r\n\r\n// like resolveInstantiate, but returning load records for linking\r\nfunction resolveInstantiateDep (loader, key, parentKey, registry, state, traceDepMap) {\r\n // normalization shortpaths for already-normalized key\r\n // DISABLED to prioritise consistent resolver calls\r\n // could add a plain name filter, but doesn't yet seem necessary for perf\r\n /* var load = state.records[key];\r\n var module = registry[key];\r\n\r\n if (module) {\r\n if (traceDepMap)\r\n traceDepMap[key] = key;\r\n\r\n // registry authority check in case module was deleted or replaced in main registry\r\n if (load && load.module && load.module === module)\r\n return load;\r\n else\r\n return module;\r\n }\r\n\r\n // already linked but not in main registry is ignored\r\n if (load && !load.module) {\r\n if (traceDepMap)\r\n traceDepMap[key] = key;\r\n return instantiate(loader, load, load.linkRecord, registry, state);\r\n } */\r\n return loader.resolve(key, parentKey)\r\n .then(function (resolvedKey) {\r\n if (traceDepMap)\r\n traceDepMap[key] = resolvedKey;\r\n\r\n // normalization shortpaths for already-normalized key\r\n var load = state.records[resolvedKey];\r\n var module = registry[resolvedKey];\r\n\r\n // main loader registry always takes preference\r\n if (module && (!load || load.module && module !== load.module))\r\n return module;\r\n\r\n if (load && load.loadError)\r\n throw load.loadError;\r\n\r\n // already has a module value but not already in the registry (load.module)\r\n // means it was removed by registry.delete, so we should\r\n // disgard the current load record creating a new one over it\r\n // but keep any existing registration\r\n if (!load || !module && load.module)\r\n load = createLoadRecord(state, resolvedKey, load && load.registration);\r\n\r\n var link = load.linkRecord;\r\n if (!link)\r\n return load;\r\n\r\n return instantiate(loader, load, link, registry, state);\r\n });\r\n}\r\n\r\nfunction traceLoad (loader, load, link) {\r\n loader.loads = loader.loads || {};\r\n loader.loads[load.key] = {\r\n key: load.key,\r\n deps: link.dependencies,\r\n dynamicDeps: [],\r\n depMap: link.depMap || {}\r\n };\r\n}\r\n\r\n/*\r\n * Convert a CJS module.exports into a valid object for new Module:\r\n *\r\n * new Module(getEsModule(module.exports))\r\n *\r\n * Sets the default value to the module, while also reading off named exports carefully.\r\n */\r\nfunction registerDeclarative (loader, load, link, declare) {\r\n var moduleObj = link.moduleObj;\r\n var importerSetters = load.importerSetters;\r\n\r\n var definedExports = false;\r\n\r\n // closure especially not based on link to allow link record disposal\r\n var declared = declare.call(global, function (name, value) {\r\n if (typeof name === 'object') {\r\n var changed = false;\r\n for (var p in name) {\r\n value = name[p];\r\n if (p !== '__useDefault' && (!(p in moduleObj) || moduleObj[p] !== value)) {\r\n changed = true;\r\n moduleObj[p] = value;\r\n }\r\n }\r\n if (changed === false)\r\n return value;\r\n }\r\n else {\r\n if ((definedExports || name in moduleObj) && moduleObj[name] === value)\r\n return value;\r\n moduleObj[name] = value;\r\n }\r\n\r\n for (var i = 0; i < importerSetters.length; i++)\r\n importerSetters[i](moduleObj);\r\n\r\n return value;\r\n }, new ContextualLoader(loader, load.key));\r\n\r\n link.setters = declared.setters || [];\r\n link.execute = declared.execute;\r\n if (declared.exports) {\r\n link.moduleObj = moduleObj = declared.exports;\r\n definedExports = true;\r\n }\r\n}\r\n\r\nfunction instantiateDeps (loader, load, link, registry, state) {\r\n if (link.depsInstantiatePromise)\r\n return link.depsInstantiatePromise;\r\n\r\n var depsInstantiatePromises = Array(link.dependencies.length);\r\n\r\n for (var i = 0; i < link.dependencies.length; i++)\r\n depsInstantiatePromises[i] = resolveInstantiateDep(loader, link.dependencies[i], load.key, registry, state, loader.trace && link.depMap || (link.depMap = {}));\r\n\r\n var depsInstantiatePromise = Promise.all(depsInstantiatePromises)\r\n .then(function (dependencyInstantiations) {\r\n link.dependencyInstantiations = dependencyInstantiations;\r\n\r\n // run setters to set up bindings to instantiated dependencies\r\n if (link.setters) {\r\n for (var i = 0; i < dependencyInstantiations.length; i++) {\r\n var setter = link.setters[i];\r\n if (setter) {\r\n var instantiation = dependencyInstantiations[i];\r\n\r\n if (instantiation instanceof ModuleNamespace || instantiation[toStringTag] === 'module') {\r\n setter(instantiation);\r\n }\r\n else {\r\n if (instantiation.loadError)\r\n throw instantiation.loadError;\r\n setter(instantiation.module || instantiation.linkRecord.moduleObj);\r\n // this applies to both es and dynamic registrations\r\n if (instantiation.importerSetters)\r\n instantiation.importerSetters.push(setter);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return load;\r\n });\r\n\r\n if (loader.trace)\r\n depsInstantiatePromise = depsInstantiatePromise.then(function () {\r\n traceLoad(loader, load, link);\r\n return load;\r\n });\r\n\r\n depsInstantiatePromise = depsInstantiatePromise.catch(function (err) {\r\n // throw up the instantiateDeps stack\r\n link.depsInstantiatePromise = undefined;\r\n throw addToError(err, 'Loading ' + load.key);\r\n });\r\n\r\n depsInstantiatePromise.catch(function () {});\r\n\r\n return link.depsInstantiatePromise = depsInstantiatePromise;\r\n}\r\n\r\nfunction deepInstantiateDeps (loader, load, link, registry, state) {\r\n var seen = [];\r\n function addDeps (load, link) {\r\n if (!link)\r\n return resolvedPromise;\r\n if (seen.indexOf(load) !== -1)\r\n return resolvedPromise;\r\n seen.push(load);\r\n \r\n return instantiateDeps(loader, load, link, registry, state)\r\n .then(function () {\r\n var depPromises;\r\n for (var i = 0; i < link.dependencies.length; i++) {\r\n var depLoad = link.dependencyInstantiations[i];\r\n if (!(depLoad instanceof ModuleNamespace || depLoad[toStringTag] === 'module')) {\r\n depPromises = depPromises || [];\r\n depPromises.push(addDeps(depLoad, depLoad.linkRecord));\r\n }\r\n }\r\n if (depPromises)\r\n return Promise.all(depPromises);\r\n });\r\n };\r\n\r\n return addDeps(load, link);\r\n}\r\n\r\n/*\r\n * System.register\r\n */\r\nRegisterLoader.prototype.register = function (key, deps, declare) {\r\n var state = this[REGISTER_INTERNAL];\r\n\r\n // anonymous modules get stored as lastAnon\r\n if (declare === undefined) {\r\n state.lastRegister = [key, deps, undefined];\r\n }\r\n\r\n // everything else registers into the register cache\r\n else {\r\n var load = state.records[key] || createLoadRecord(state, key, undefined);\r\n load.registration = [deps, declare, undefined];\r\n }\r\n};\r\n\r\n/*\r\n * System.registerDyanmic\r\n */\r\nRegisterLoader.prototype.registerDynamic = function (key, deps, executingRequire, execute) {\r\n var state = this[REGISTER_INTERNAL];\r\n\r\n // anonymous modules get stored as lastAnon\r\n if (typeof key !== 'string') {\r\n state.lastRegister = [key, deps, executingRequire];\r\n }\r\n\r\n // everything else registers into the register cache\r\n else {\r\n var load = state.records[key] || createLoadRecord(state, key, undefined);\r\n load.registration = [deps, executingRequire, execute];\r\n }\r\n};\r\n\r\n// ContextualLoader class\r\n// backwards-compatible with previous System.register context argument by exposing .id, .key\r\nfunction ContextualLoader (loader, key) {\r\n this.loader = loader;\r\n this.key = this.id = key;\r\n this.meta = {\r\n url: key\r\n // scriptElement: null\r\n };\r\n}\r\n/*ContextualLoader.prototype.constructor = function () {\r\n throw new TypeError('Cannot subclass the contextual loader only Reflect.Loader.');\r\n};*/\r\nContextualLoader.prototype.import = function (key) {\r\n if (this.loader.trace)\r\n this.loader.loads[this.key].dynamicDeps.push(key);\r\n return this.loader.import(key, this.key);\r\n};\r\n/*ContextualLoader.prototype.resolve = function (key) {\r\n return this.loader.resolve(key, this.key);\r\n};*/\r\n\r\nfunction ensureEvaluate (loader, load, link, registry, state) {\r\n if (load.module)\r\n return load.module;\r\n if (load.evalError)\r\n throw load.evalError;\r\n if (link.evaluatePromise)\r\n return link.evaluatePromise;\r\n\r\n if (link.setters) {\r\n var evaluatePromise = doEvaluateDeclarative(loader, load, link, registry, state, [load]);\r\n if (evaluatePromise)\r\n return evaluatePromise;\r\n }\r\n else {\r\n doEvaluateDynamic(loader, load, link, registry, state, [load]);\r\n }\r\n return load.module;\r\n}\r\n\r\nfunction makeDynamicRequire (loader, key, dependencies, dependencyInstantiations, registry, state, seen) {\r\n // we can only require from already-known dependencies\r\n return function (name) {\r\n for (var i = 0; i < dependencies.length; i++) {\r\n if (dependencies[i] === name) {\r\n var depLoad = dependencyInstantiations[i];\r\n var module;\r\n\r\n if (depLoad instanceof ModuleNamespace || depLoad[toStringTag] === 'module') {\r\n module = depLoad;\r\n }\r\n else {\r\n if (depLoad.evalError)\r\n throw depLoad.evalError;\r\n if (depLoad.module === undefined && seen.indexOf(depLoad) === -1 && !depLoad.linkRecord.evaluatePromise) {\r\n if (depLoad.linkRecord.setters) {\r\n doEvaluateDeclarative(loader, depLoad, depLoad.linkRecord, registry, state, [depLoad]);\r\n }\r\n else {\r\n seen.push(depLoad);\r\n doEvaluateDynamic(loader, depLoad, depLoad.linkRecord, registry, state, seen);\r\n }\r\n }\r\n module = depLoad.module || depLoad.linkRecord.moduleObj;\r\n }\r\n\r\n return '__useDefault' in module ? module.__useDefault : module;\r\n }\r\n }\r\n throw new Error('Module ' + name + ' not declared as a System.registerDynamic dependency of ' + key);\r\n };\r\n}\r\n\r\nfunction evalError (load, err) {\r\n load.linkRecord = undefined;\r\n var evalError = addToError(err, 'Evaluating ' + load.key);\r\n if (load.evalError === undefined)\r\n load.evalError = evalError;\r\n throw evalError;\r\n}\r\n\r\n// es modules evaluate dependencies first\r\n// returns the error if any\r\nfunction doEvaluateDeclarative (loader, load, link, registry, state, seen) {\r\n var depLoad, depLink;\r\n var depLoadPromises;\r\n for (var i = 0; i < link.dependencies.length; i++) {\r\n var depLoad = link.dependencyInstantiations[i];\r\n if (depLoad instanceof ModuleNamespace || depLoad[toStringTag] === 'module')\r\n continue;\r\n\r\n // custom Module returned from instantiate\r\n depLink = depLoad.linkRecord;\r\n if (depLink) {\r\n if (depLoad.evalError) {\r\n evalError(load, depLoad.evalError);\r\n }\r\n else if (depLink.setters) {\r\n if (seen.indexOf(depLoad) === -1) {\r\n seen.push(depLoad);\r\n try {\r\n var depLoadPromise = doEvaluateDeclarative(loader, depLoad, depLink, registry, state, seen);\r\n }\r\n catch (e) {\r\n evalError(load, e);\r\n }\r\n if (depLoadPromise) {\r\n depLoadPromises = depLoadPromises || [];\r\n depLoadPromises.push(depLoadPromise.catch(function (err) {\r\n evalError(load, err);\r\n }));\r\n }\r\n }\r\n }\r\n else {\r\n try {\r\n doEvaluateDynamic(loader, depLoad, depLink, registry, state, [depLoad]);\r\n }\r\n catch (e) {\r\n evalError(load, e);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (depLoadPromises)\r\n return link.evaluatePromise = Promise.all(depLoadPromises)\r\n .then(function () {\r\n if (link.execute) {\r\n // ES System.register execute\r\n // \"this\" is null in ES\r\n try {\r\n var execPromise = link.execute.call(nullContext);\r\n }\r\n catch (e) {\r\n evalError(load, e);\r\n }\r\n if (execPromise)\r\n return execPromise.catch(function (e) {\r\n evalError(load, e);\r\n })\r\n .then(function () {\r\n load.linkRecord = undefined;\r\n return registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);\r\n });\r\n }\r\n \r\n // dispose link record\r\n load.linkRecord = undefined;\r\n registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);\r\n });\r\n\r\n if (link.execute) {\r\n // ES System.register execute\r\n // \"this\" is null in ES\r\n try {\r\n var execPromise = link.execute.call(nullContext);\r\n }\r\n catch (e) {\r\n evalError(load, e);\r\n }\r\n if (execPromise)\r\n return link.evaluatePromise = execPromise.catch(function (e) {\r\n evalError(load, e);\r\n })\r\n .then(function () {\r\n load.linkRecord = undefined;\r\n return registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);\r\n });\r\n }\r\n\r\n // dispose link record\r\n load.linkRecord = undefined;\r\n registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);\r\n}\r\n\r\n// non es modules explicitly call moduleEvaluate through require\r\nfunction doEvaluateDynamic (loader, load, link, registry, state, seen) {\r\n // System.registerDynamic execute\r\n // \"this\" is \"exports\" in CJS\r\n var module = { id: load.key };\r\n var moduleObj = link.moduleObj;\r\n Object.defineProperty(module, 'exports', {\r\n configurable: true,\r\n set: function (exports) {\r\n moduleObj.default = moduleObj.__useDefault = exports;\r\n },\r\n get: function () {\r\n return moduleObj.__useDefault;\r\n }\r\n });\r\n\r\n var require = makeDynamicRequire(loader, load.key, link.dependencies, link.dependencyInstantiations, registry, state, seen);\r\n\r\n // evaluate deps first\r\n if (!link.executingRequire)\r\n for (var i = 0; i < link.dependencies.length; i++)\r\n require(link.dependencies[i]);\r\n\r\n try {\r\n var output = link.execute.call(global, require, moduleObj.default, module);\r\n if (output !== undefined)\r\n module.exports = output;\r\n }\r\n catch (e) {\r\n evalError(load, e);\r\n }\r\n\r\n load.linkRecord = undefined;\r\n\r\n // pick up defineProperty calls to module.exports when we can\r\n if (module.exports !== moduleObj.__useDefault)\r\n moduleObj.default = moduleObj.__useDefault = module.exports;\r\n\r\n var moduleDefault = moduleObj.default;\r\n\r\n // __esModule flag extension support via lifting\r\n if (moduleDefault && moduleDefault.__esModule) {\r\n for (var p in moduleDefault) {\r\n if (Object.hasOwnProperty.call(moduleDefault, p))\r\n moduleObj[p] = moduleDefault[p];\r\n }\r\n }\r\n\r\n registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);\r\n\r\n // run importer setters and clear them\r\n // this allows dynamic modules to update themselves into es modules\r\n // as soon as execution has completed\r\n if (load.importerSetters)\r\n for (var i = 0; i < load.importerSetters.length; i++)\r\n load.importerSetters[i](load.module);\r\n load.importerSetters = undefined;\r\n}\r\n\r\n// the closest we can get to call(undefined)\r\nvar nullContext = Object.create(null);\r\nif (Object.freeze)\r\n Object.freeze(nullContext);\r\n","import RegisterLoader from 'es-module-loader/core/register-loader.js';\nimport { InternalModuleNamespace as ModuleNamespace } from 'es-module-loader/core/loader-polyfill.js';\n\nimport { baseURI, global, isBrowser } from 'es-module-loader/core/common.js';\nimport { resolveIfNotPlain } from 'es-module-loader/core/resolve.js';\n\nvar loader;\n\n// <script type=\"module\"> support\nvar anonSources = {};\nif (typeof document != 'undefined' && document.getElementsByTagName) {\n var handleError = function(err) {\n // dispatch an error event so that we can display in errors in browsers\n // that don't yet support unhandledrejection\n if (window.onunhandledrejection === undefined) {\n try {\n var evt = new Event('error');\n } catch (_eventError) {\n var evt = document.createEvent('Event');\n evt.initEvent('error', true, true);\n }\n evt.message = err.message;\n if (err.fileName) {\n evt.filename = err.fileName;\n evt.lineno = err.lineNumber;\n evt.colno = err.columnNumber;\n } else if (err.sourceURL) {\n evt.filename = err.sourceURL;\n evt.lineno = err.line;\n evt.colno = err.column;\n }\n evt.error = err;\n window.dispatchEvent(evt);\n }\n\n // throw so it still shows up in the console\n throw err;\n }\n\n var ready = function() {\n document.removeEventListener('DOMContentLoaded', ready, false );\n\n var anonCnt = 0;\n\n var scripts = document.getElementsByTagName('script');\n for (var i = 0; i < scripts.length; i++) {\n var script = scripts[i];\n if (script.type == 'module' && !script.loaded) {\n script.loaded = true;\n if (script.src) {\n loader.import(script.src).catch(handleError);\n }\n // anonymous modules supported via a custom naming scheme and registry\n else {\n var uri = './<anon' + ++anonCnt + '>.js';\n if (script.id !== \"\"){\n uri = \"./\" + script.id;\n }\n\n var anonName = resolveIfNotPlain(uri, baseURI);\n anonSources[anonName] = script.innerHTML;\n loader.import(anonName).catch(handleError);\n }\n }\n }\n }\n\n // simple DOM ready\n if (document.readyState !== 'loading')\n setTimeout(ready);\n else\n document.addEventListener('DOMContentLoaded', ready, false);\n}\n\nfunction BrowserESModuleLoader(baseKey) {\n if (baseKey)\n this.baseKey = resolveIfNotPlain(baseKey, baseURI) || resolveIfNotPlain('./' + baseKey, baseURI);\n\n RegisterLoader.call(this);\n\n var loader = this;\n\n // ensure System.register is available\n global.System = global.System || {};\n if (typeof global.System.register == 'function')\n var prevRegister = global.System.register;\n global.System.register = function() {\n loader.register.apply(loader, arguments);\n if (prevRegister)\n prevRegister.apply(this, arguments);\n };\n}\nBrowserESModuleLoader.prototype = Object.create(RegisterLoader.prototype);\n\n// normalize is never given a relative name like \"./x\", that part is already handled\nBrowserESModuleLoader.prototype[RegisterLoader.resolve] = function(key, parent) {\n var resolved = RegisterLoader.prototype[RegisterLoader.resolve].call(this, key, parent || this.baseKey) || key;\n if (!resolved)\n throw new RangeError('ES module loader does not resolve plain module names, resolving \"' + key + '\" to ' + parent);\n\n return resolved;\n};\n\nfunction xhrFetch(url, resolve, reject) {\n var xhr = new XMLHttpRequest();\n var load = function(source) {\n resolve(xhr.responseText);\n }\n var error = function() {\n reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));\n }\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n // in Chrome on file:/// URLs, status is 0\n if (xhr.status == 0) {\n if (xhr.responseText) {\n load();\n }\n else {\n // when responseText is empty, wait for load or error event\n // to inform if it is a 404 or empty file\n xhr.addEventListener('error', error);\n xhr.addEventListener('load', load);\n }\n }\n else if (xhr.status === 200) {\n load();\n }\n else {\n error();\n }\n }\n };\n xhr.open(\"GET\", url, true);\n xhr.send(null);\n}\n\nvar WorkerPool = function (script, size) {\n var current = document.currentScript;\n // IE doesn't support currentScript\n if (!current) {\n // Find an entry with out basename\n var scripts = document.getElementsByTagName('script');\n for (var i = 0; i < scripts.length; i++) {\n if (scripts[i].src.indexOf(\"browser-es-module-loader.js\") !== -1) {\n current = scripts[i];\n break;\n }\n }\n if (!current)\n throw Error(\"Could not find own <script> element\");\n }\n script = current.src.substr(0, current.src.lastIndexOf(\"/\")) + \"/\" + script;\n this._workers = new Array(size);\n this._ind = 0;\n this._size = size;\n this._jobs = 0;\n this.onmessage = undefined;\n this._stopTimeout = undefined;\n for (var i = 0; i < size; i++) {\n var wrkr = new Worker(script);\n wrkr._count = 0;\n wrkr._ind = i;\n wrkr.onmessage = this._onmessage.bind(this, wrkr);\n wrkr.onerror = this._onerror.bind(this);\n this._workers[i] = wrkr;\n }\n\n this._checkJobs();\n};\nWorkerPool.prototype = {\n postMessage: function (msg) {\n if (this._stopTimeout !== undefined) {\n clearTimeout(this._stopTimeout);\n this._stopTimeout = undefined;\n }\n var wrkr = this._workers[this._ind % this._size];\n wrkr._count++;\n this._jobs++;\n wrkr.postMessage(msg);\n this._ind++;\n },\n\n _onmessage: function (wrkr, evt) {\n wrkr._count--;\n this._jobs--;\n this.onmessage(evt, wrkr);\n this._checkJobs();\n },\n\n _onerror: function(err) {\n try {\n var evt = new Event('error');\n } catch (_eventError) {\n var evt = document.createEvent('Event');\n evt.initEvent('error', true, true);\n }\n evt.message = err.message;\n evt.filename = err.filename;\n evt.lineno = err.lineno;\n evt.colno = err.colno;\n evt.error = err.error;\n window.dispatchEvent(evt);\n },\n\n _checkJobs: function () {\n if (this._jobs === 0 && this._stopTimeout === undefined) {\n // wait for 2s of inactivity before stopping (that should be enough for local loading)\n this._stopTimeout = setTimeout(this._stop.bind(this), 2000);\n }\n },\n\n _stop: function () {\n this._workers.forEach(function(wrkr) {\n wrkr.terminate();\n });\n }\n};\n\nvar promiseMap = new Map();\nvar babelWorker = new WorkerPool('babel-worker.js', 3);\nbabelWorker.onmessage = function (evt) {\n var promFuncs = promiseMap.get(evt.data.key);\n promFuncs.resolve(evt.data);\n promiseMap.delete(evt.data.key);\n};\n\n// instantiate just needs to run System.register\n// so we fetch the source, convert into the Babel System module format, then evaluate it\nBrowserESModuleLoader.prototype[RegisterLoader.instantiate] = function(key, processAnonRegister) {\n var loader = this;\n\n // load as ES with Babel converting into System.register\n return new Promise(function(resolve, reject) {\n // anonymous module\n if (anonSources[key]) {\n resolve(anonSources[key])\n anonSources[key] = undefined;\n }\n // otherwise we fetch\n else {\n xhrFetch(key, resolve, reject);\n }\n })\n .then(function(source) {\n // check our cache first\n var cacheEntry = localStorage.getItem(key);\n if (cacheEntry) {\n cacheEntry = JSON.parse(cacheEntry);\n // TODO: store a hash instead\n if (cacheEntry.source === source) {\n return Promise.resolve({key: key, code: cacheEntry.code, source: cacheEntry.source});\n }\n }\n return new Promise(function (resolve, reject) {\n promiseMap.set(key, {resolve: resolve, reject: reject});\n babelWorker.postMessage({key: key, source: source});\n });\n }).then(function (data) {\n // evaluate without require, exports and module variables\n // we leave module in for now to allow module.require access\n try {\n var cacheEntry = JSON.stringify({source: data.source, code: data.code});\n localStorage.setItem(key, cacheEntry);\n } catch (e) {\n if (window.console) {\n window.console.warn('Unable to cache transpiled version of ' + key + ': ' + e);\n }\n }\n (0, eval)(data.code + '\\n//# sourceURL=' + data.key + '!transpiled');\n processAnonRegister();\n });\n};\n\n// create a default loader instance in the browser\nif (isBrowser)\n loader = new BrowserESModuleLoader();\n\nexport default BrowserESModuleLoader;\n"],"names":["resolvedPromise","addToError","RegisterLoader","global"],"mappings":";;;;;;AAAA;;;AAGA,AAAO,IAAI,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,CAAC;AACxF,AAAO,IAAI,MAAM,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;AAChG,AAAO,IAAI,SAAS,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;;AAEhI,IAAI,SAAS,GAAG,OAAO,IAAI,KAAK,WAAW,GAAG,IAAI,GAAG,MAAM,CAAC;AAC5D,AAEA;;;AAGA,IAAI,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AAC9C,AAAO,SAAS,YAAY,EAAE,IAAI,EAAE;EAClC,OAAO,SAAS,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3C;;AAED,AAAO,IAAI,WAAW,GAAG,SAAS,IAAI,MAAM,CAAC,WAAW,CAAC;;AAEzD,AAA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AI,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;MACxE,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;KACvC,CAAC,OAAO,CAAC,EAAE;MACV,IAAI,MAAM,CAAC,OAAO,EAAE;QAClB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,wCAAwC,GAAG,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;OAChF;KACF;IACD,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,kBAAkB,GAAG,IAAI,CAAC,GAAG,GAAG,aAAa,CAAC,CAAC;IACrE,mBAAmB,EAAE,CAAC;GACvB,CAAC,CAAC;CACJ,CAAC;;;AAGF,IAAI,SAAS;EACX,MAAM,GAAG,IAAI,qBAAqB,EAAE,CAAC,AAEvC,AAAqC,;;,;;"}
\ No newline at end of file
public/novnc/vendor/browser-es-module-loader/rollup.config.js
deleted
-16
@@ -1,16 +0,0 @@
1
-import nodeResolve from 'rollup-plugin-node-resolve';
2
-
3
-export default {
4
- entry: 'src/browser-es-module-loader.js',
5
- dest: 'dist/browser-es-module-loader.js',
6
- format: 'umd',
7
- moduleName: 'BrowserESModuleLoader',
8
- sourceMap: true,
9
-
10
- plugins: [
11
- nodeResolve(),
12
- ],
13
-
14
- // skip rollup warnings (specifically the eval warning)
15
- onwarn: function() {}
16
-};
public/novnc/vendor/browser-es-module-loader/src/babel-worker.js
deleted
-25
@@ -1,25 +0,0 @@
1
-/*import { transform as babelTransform } from 'babel-core';
2
-import babelTransformDynamicImport from 'babel-plugin-syntax-dynamic-import';
3
-import babelTransformES2015ModulesSystemJS from 'babel-plugin-transform-es2015-modules-systemjs';*/
4
-
5
-// sadly, due to how rollup works, we can't use es6 imports here
6
-var babelTransform = require('babel-core').transform;
7
-var babelTransformDynamicImport = require('babel-plugin-syntax-dynamic-import');
8
-var babelTransformES2015ModulesSystemJS = require('babel-plugin-transform-es2015-modules-systemjs');
9
-var babelPresetES2015 = require('babel-preset-es2015');
10
-
11
-self.onmessage = function (evt) {
12
- // transform source with Babel
13
- var output = babelTransform(evt.data.source, {
14
- compact: false,
15
- filename: evt.data.key + '!transpiled',
16
- sourceFileName: evt.data.key,
17
- moduleIds: false,
18
- sourceMaps: 'inline',
19
- babelrc: false,
20
- plugins: [babelTransformDynamicImport, babelTransformES2015ModulesSystemJS],
21
- presets: [babelPresetES2015],
22
- });
23
-
24
- self.postMessage({key: evt.data.key, code: output.code, source: evt.data.source});
25
-};
public/novnc/vendor/browser-es-module-loader/src/browser-es-module-loader.js
deleted
-280
@@ -1,280 +0,0 @@
1
-import RegisterLoader from 'es-module-loader/core/register-loader.js';
2
-import { InternalModuleNamespace as ModuleNamespace } from 'es-module-loader/core/loader-polyfill.js';
3
-
4
-import { baseURI, global, isBrowser } from 'es-module-loader/core/common.js';
5
-import { resolveIfNotPlain } from 'es-module-loader/core/resolve.js';
6
-
7
-var loader;
8
-
9
-// <script type="module"> support
10
-var anonSources = {};
11
-if (typeof document != 'undefined' && document.getElementsByTagName) {
12
- var handleError = function(err) {
13
- // dispatch an error event so that we can display in errors in browsers
14
- // that don't yet support unhandledrejection
15
- if (window.onunhandledrejection === undefined) {
16
- try {
17
- var evt = new Event('error');
18
- } catch (_eventError) {
19
- var evt = document.createEvent('Event');
20
- evt.initEvent('error', true, true);
21
- }
22
- evt.message = err.message;
23
- if (err.fileName) {
24
- evt.filename = err.fileName;
25
- evt.lineno = err.lineNumber;
26
- evt.colno = err.columnNumber;
27
- } else if (err.sourceURL) {
28
- evt.filename = err.sourceURL;
29
- evt.lineno = err.line;
30
- evt.colno = err.column;
31
- }
32
- evt.error = err;
33
- window.dispatchEvent(evt);
34
- }
35
-
36
- // throw so it still shows up in the console
37
- throw err;
38
- }
39
-
40
- var ready = function() {
41
- document.removeEventListener('DOMContentLoaded', ready, false );
42
-
43
- var anonCnt = 0;
44
-
45
- var scripts = document.getElementsByTagName('script');
46
- for (var i = 0; i < scripts.length; i++) {
47
- var script = scripts[i];
48
- if (script.type == 'module' && !script.loaded) {
49
- script.loaded = true;
50
- if (script.src) {
51
- loader.import(script.src).catch(handleError);
52
- }
53
- // anonymous modules supported via a custom naming scheme and registry
54
- else {
55
- var uri = './<anon' + ++anonCnt + '>.js';
56
- if (script.id !== ""){
57
- uri = "./" + script.id;
58
- }
59
-
60
- var anonName = resolveIfNotPlain(uri, baseURI);
61
- anonSources[anonName] = script.innerHTML;
62
- loader.import(anonName).catch(handleError);
63
- }
64
- }
65
- }
66
- }
67
-
68
- // simple DOM ready
69
- if (document.readyState !== 'loading')
70
- setTimeout(ready);
71
- else
72
- document.addEventListener('DOMContentLoaded', ready, false);
73
-}
74
-
75
-function BrowserESModuleLoader(baseKey) {
76
- if (baseKey)
77
- this.baseKey = resolveIfNotPlain(baseKey, baseURI) || resolveIfNotPlain('./' + baseKey, baseURI);
78
-
79
- RegisterLoader.call(this);
80
-
81
- var loader = this;
82
-
83
- // ensure System.register is available
84
- global.System = global.System || {};
85
- if (typeof global.System.register == 'function')
86
- var prevRegister = global.System.register;
87
- global.System.register = function() {
88
- loader.register.apply(loader, arguments);
89
- if (prevRegister)
90
- prevRegister.apply(this, arguments);
91
- };
92
-}
93
-BrowserESModuleLoader.prototype = Object.create(RegisterLoader.prototype);
94
-
95
-// normalize is never given a relative name like "./x", that part is already handled
96
-BrowserESModuleLoader.prototype[RegisterLoader.resolve] = function(key, parent) {
97
- var resolved = RegisterLoader.prototype[RegisterLoader.resolve].call(this, key, parent || this.baseKey) || key;
98
- if (!resolved)
99
- throw new RangeError('ES module loader does not resolve plain module names, resolving "' + key + '" to ' + parent);
100
-
101
- return resolved;
102
-};
103
-
104
-function xhrFetch(url, resolve, reject) {
105
- var xhr = new XMLHttpRequest();
106
- var load = function(source) {
107
- resolve(xhr.responseText);
108
- }
109
- var error = function() {
110
- reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
111
- }
112
-
113
- xhr.onreadystatechange = function () {
114
- if (xhr.readyState === 4) {
115
- // in Chrome on file:/// URLs, status is 0
116
- if (xhr.status == 0) {
117
- if (xhr.responseText) {
118
- load();
119
- }
120
- else {
121
- // when responseText is empty, wait for load or error event
122
- // to inform if it is a 404 or empty file
123
- xhr.addEventListener('error', error);
124
- xhr.addEventListener('load', load);
125
- }
126
- }
127
- else if (xhr.status === 200) {
128
- load();
129
- }
130
- else {
131
- error();
132
- }
133
- }
134
- };
135
- xhr.open("GET", url, true);
136
- xhr.send(null);
137
-}
138
-
139
-var WorkerPool = function (script, size) {
140
- var current = document.currentScript;
141
- // IE doesn't support currentScript
142
- if (!current) {
143
- // Find an entry with out basename
144
- var scripts = document.getElementsByTagName('script');
145
- for (var i = 0; i < scripts.length; i++) {
146
- if (scripts[i].src.indexOf("browser-es-module-loader.js") !== -1) {
147
- current = scripts[i];
148
- break;
149
- }
150
- }
151
- if (!current)
152
- throw Error("Could not find own <script> element");
153
- }
154
- script = current.src.substr(0, current.src.lastIndexOf("/")) + "/" + script;
155
- this._workers = new Array(size);
156
- this._ind = 0;
157
- this._size = size;
158
- this._jobs = 0;
159
- this.onmessage = undefined;
160
- this._stopTimeout = undefined;
161
- for (var i = 0; i < size; i++) {
162
- var wrkr = new Worker(script);
163
- wrkr._count = 0;
164
- wrkr._ind = i;
165
- wrkr.onmessage = this._onmessage.bind(this, wrkr);
166
- wrkr.onerror = this._onerror.bind(this);
167
- this._workers[i] = wrkr;
168
- }
169
-
170
- this._checkJobs();
171
-};
172
-WorkerPool.prototype = {
173
- postMessage: function (msg) {
174
- if (this._stopTimeout !== undefined) {
175
- clearTimeout(this._stopTimeout);
176
- this._stopTimeout = undefined;
177
- }
178
- var wrkr = this._workers[this._ind % this._size];
179
- wrkr._count++;
180
- this._jobs++;
181
- wrkr.postMessage(msg);
182
- this._ind++;
183
- },
184
-
185
- _onmessage: function (wrkr, evt) {
186
- wrkr._count--;
187
- this._jobs--;
188
- this.onmessage(evt, wrkr);
189
- this._checkJobs();
190
- },
191
-
192
- _onerror: function(err) {
193
- try {
194
- var evt = new Event('error');
195
- } catch (_eventError) {
196
- var evt = document.createEvent('Event');
197
- evt.initEvent('error', true, true);
198
- }
199
- evt.message = err.message;
200
- evt.filename = err.filename;
201
- evt.lineno = err.lineno;
202
- evt.colno = err.colno;
203
- evt.error = err.error;
204
- window.dispatchEvent(evt);
205
- },
206
-
207
- _checkJobs: function () {
208
- if (this._jobs === 0 && this._stopTimeout === undefined) {
209
- // wait for 2s of inactivity before stopping (that should be enough for local loading)
210
- this._stopTimeout = setTimeout(this._stop.bind(this), 2000);
211
- }
212
- },
213
-
214
- _stop: function () {
215
- this._workers.forEach(function(wrkr) {
216
- wrkr.terminate();
217
- });
218
- }
219
-};
220
-
221
-var promiseMap = new Map();
222
-var babelWorker = new WorkerPool('babel-worker.js', 3);
223
-babelWorker.onmessage = function (evt) {
224
- var promFuncs = promiseMap.get(evt.data.key);
225
- promFuncs.resolve(evt.data);
226
- promiseMap.delete(evt.data.key);
227
-};
228
-
229
-// instantiate just needs to run System.register
230
-// so we fetch the source, convert into the Babel System module format, then evaluate it
231
-BrowserESModuleLoader.prototype[RegisterLoader.instantiate] = function(key, processAnonRegister) {
232
- var loader = this;
233
-
234
- // load as ES with Babel converting into System.register
235
- return new Promise(function(resolve, reject) {
236
- // anonymous module
237
- if (anonSources[key]) {
238
- resolve(anonSources[key])
239
- anonSources[key] = undefined;
240
- }
241
- // otherwise we fetch
242
- else {
243
- xhrFetch(key, resolve, reject);
244
- }
245
- })
246
- .then(function(source) {
247
- // check our cache first
248
- var cacheEntry = localStorage.getItem(key);
249
- if (cacheEntry) {
250
- cacheEntry = JSON.parse(cacheEntry);
251
- // TODO: store a hash instead
252
- if (cacheEntry.source === source) {
253
- return Promise.resolve({key: key, code: cacheEntry.code, source: cacheEntry.source});
254
- }
255
- }
256
- return new Promise(function (resolve, reject) {
257
- promiseMap.set(key, {resolve: resolve, reject: reject});
258
- babelWorker.postMessage({key: key, source: source});
259
- });
260
- }).then(function (data) {
261
- // evaluate without require, exports and module variables
262
- // we leave module in for now to allow module.require access
263
- try {
264
- var cacheEntry = JSON.stringify({source: data.source, code: data.code});
265
- localStorage.setItem(key, cacheEntry);
266
- } catch (e) {
267
- if (window.console) {
268
- window.console.warn('Unable to cache transpiled version of ' + key + ': ' + e);
269
- }
270
- }
271
- (0, eval)(data.code + '\n//# sourceURL=' + data.key + '!transpiled');
272
- processAnonRegister();
273
- });
274
-};
275
-
276
-// create a default loader instance in the browser
277
-if (isBrowser)
278
- loader = new BrowserESModuleLoader();
279
-
280
-export default BrowserESModuleLoader;
public/novnc/vendor/pako/lib/zlib/deflate.js
+30
-30
@@ -9,51 +9,51 @@ import msg from "./messages.js";
9
10
11
/* Allowed flush values; see deflate() and inflate() below for details */
12
-var Z_NO_FLUSH = 0;
13
-var Z_PARTIAL_FLUSH = 1;
14
-//var Z_SYNC_FLUSH = 2;
15
-var Z_FULL_FLUSH = 3;
16
-var Z_FINISH = 4;
17
-var Z_BLOCK = 5;
18
-//var Z_TREES = 6;
12
+export const Z_NO_FLUSH = 0;
13
+export const Z_PARTIAL_FLUSH = 1;
14
+//export const Z_SYNC_FLUSH = 2;
15
+export const Z_FULL_FLUSH = 3;
16
+export const Z_FINISH = 4;
17
+export const Z_BLOCK = 5;
18
+//export const Z_TREES = 6;
19
20
21
/* Return codes for the compression/decompression functions. Negative values
22
* are errors, positive values are used for special but normal events.
23
*/
24
-var Z_OK = 0;
25
-var Z_STREAM_END = 1;
26
-//var Z_NEED_DICT = 2;
27
-//var Z_ERRNO = -1;
28
-var Z_STREAM_ERROR = -2;
29
-var Z_DATA_ERROR = -3;
30
-//var Z_MEM_ERROR = -4;
31
-var Z_BUF_ERROR = -5;
32
-//var Z_VERSION_ERROR = -6;
24
+export const Z_OK = 0;
25
+export const Z_STREAM_END = 1;
26
+//export const Z_NEED_DICT = 2;
27
+//export const Z_ERRNO = -1;
28
+export const Z_STREAM_ERROR = -2;
29
+export const Z_DATA_ERROR = -3;
30
+//export const Z_MEM_ERROR = -4;
31
+export const Z_BUF_ERROR = -5;
32
+//export const Z_VERSION_ERROR = -6;
33
34
35
/* compression levels */
36
-//var Z_NO_COMPRESSION = 0;
37
-//var Z_BEST_SPEED = 1;
38
-//var Z_BEST_COMPRESSION = 9;
39
-var Z_DEFAULT_COMPRESSION = -1;
36
+//export const Z_NO_COMPRESSION = 0;
37
+//export const Z_BEST_SPEED = 1;
38
+//export const Z_BEST_COMPRESSION = 9;
39
+export const Z_DEFAULT_COMPRESSION = -1;
40
41
42
-var Z_FILTERED = 1;
43
-var Z_HUFFMAN_ONLY = 2;
44
-var Z_RLE = 3;
45
-var Z_FIXED = 4;
46
-var Z_DEFAULT_STRATEGY = 0;
42
+export const Z_FILTERED = 1;
43
+export const Z_HUFFMAN_ONLY = 2;
44
+export const Z_RLE = 3;
45
+export const Z_FIXED = 4;
46
+export const Z_DEFAULT_STRATEGY = 0;
47
48
/* Possible values of the data_type field (though see inflate()) */
49
-//var Z_BINARY = 0;
50
-//var Z_TEXT = 1;
51
-//var Z_ASCII = 1; // = Z_TEXT
52
-var Z_UNKNOWN = 2;
49
+//export const Z_BINARY = 0;
50
+//export const Z_TEXT = 1;
51
+//export const Z_ASCII = 1; // = Z_TEXT
52
+export const Z_UNKNOWN = 2;
53
54
55
/* The deflate compression method */
56
-var Z_DEFLATED = 8;
56
+export const Z_DEFLATED = 8;
57
58
/*============================================================================*/
59
public/novnc/vendor/pako/lib/zlib/inflate.js
+17
-17
@@ -13,30 +13,30 @@ var DISTS = 2;
13
14
15
/* Allowed flush values; see deflate() and inflate() below for details */
16
-//var Z_NO_FLUSH = 0;
17
-//var Z_PARTIAL_FLUSH = 1;
18
-//var Z_SYNC_FLUSH = 2;
19
-//var Z_FULL_FLUSH = 3;
20
-var Z_FINISH = 4;
21
-var Z_BLOCK = 5;
22
-var Z_TREES = 6;
16
+//export const Z_NO_FLUSH = 0;
17
+//export const Z_PARTIAL_FLUSH = 1;
18
+//export const Z_SYNC_FLUSH = 2;
19
+//export const Z_FULL_FLUSH = 3;
20
+export const Z_FINISH = 4;
21
+export const Z_BLOCK = 5;
22
+export const Z_TREES = 6;
23
24
25
/* Return codes for the compression/decompression functions. Negative values
26
* are errors, positive values are used for special but normal events.
27
*/
28
-var Z_OK = 0;
29
-var Z_STREAM_END = 1;
30
-var Z_NEED_DICT = 2;
31
-//var Z_ERRNO = -1;
32
-var Z_STREAM_ERROR = -2;
33
-var Z_DATA_ERROR = -3;
34
-var Z_MEM_ERROR = -4;
35
-var Z_BUF_ERROR = -5;
36
-//var Z_VERSION_ERROR = -6;
28
+export const Z_OK = 0;
29
+export const Z_STREAM_END = 1;
30
+export const Z_NEED_DICT = 2;
31
+//export const Z_ERRNO = -1;
32
+export const Z_STREAM_ERROR = -2;
33
+export const Z_DATA_ERROR = -3;
34
+export const Z_MEM_ERROR = -4;
35
+export const Z_BUF_ERROR = -5;
36
+//export const Z_VERSION_ERROR = -6;
37
38
/* The deflate compression method */
39
-var Z_DEFLATED = 8;
39
+export const Z_DEFLATED = 8;
40
41
42
/* STATES ====================================================================*/
public/novnc/vendor/promise.js
deleted
-255
@@ -1,255 +0,0 @@
1
-/* Copyright (c) 2014 Taylor Hakes
2
- * Copyright (c) 2014 Forbes Lindesay
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- * THE SOFTWARE.
21
- */
22
-
23
-(function (root) {
24
-
25
- // Store setTimeout reference so promise-polyfill will be unaffected by
26
- // other code modifying setTimeout (like sinon.useFakeTimers())
27
- var setTimeoutFunc = setTimeout;
28
-
29
- function noop() {}
30
-
31
- // Polyfill for Function.prototype.bind
32
- function bind(fn, thisArg) {
33
- return function () {
34
- fn.apply(thisArg, arguments);
35
- };
36
- }
37
-
38
- function Promise(fn) {
39
- if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');
40
- if (typeof fn !== 'function') throw new TypeError('not a function');
41
- this._state = 0;
42
- this._handled = false;
43
- this._value = undefined;
44
- this._deferreds = [];
45
-
46
- doResolve(fn, this);
47
- }
48
-
49
- function handle(self, deferred) {
50
- while (self._state === 3) {
51
- self = self._value;
52
- }
53
- if (self._state === 0) {
54
- self._deferreds.push(deferred);
55
- return;
56
- }
57
- self._handled = true;
58
- Promise._immediateFn(function () {
59
- var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
60
- if (cb === null) {
61
- (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
62
- return;
63
- }
64
- var ret;
65
- try {
66
- ret = cb(self._value);
67
- } catch (e) {
68
- reject(deferred.promise, e);
69
- return;
70
- }
71
- resolve(deferred.promise, ret);
72
- });
73
- }
74
-
75
- function resolve(self, newValue) {
76
- try {
77
- // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
78
- if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.');
79
- if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
80
- var then = newValue.then;
81
- if (newValue instanceof Promise) {
82
- self._state = 3;
83
- self._value = newValue;
84
- finale(self);
85
- return;
86
- } else if (typeof then === 'function') {
87
- doResolve(bind(then, newValue), self);
88
- return;
89
- }
90
- }
91
- self._state = 1;
92
- self._value = newValue;
93
- finale(self);
94
- } catch (e) {
95
- reject(self, e);
96
- }
97
- }
98
-
99
- function reject(self, newValue) {
100
- self._state = 2;
101
- self._value = newValue;
102
- finale(self);
103
- }
104
-
105
- function finale(self) {
106
- if (self._state === 2 && self._deferreds.length === 0) {
107
- Promise._immediateFn(function() {
108
- if (!self._handled) {
109
- Promise._unhandledRejectionFn(self._value);
110
- }
111
- });
112
- }
113
-
114
- for (var i = 0, len = self._deferreds.length; i < len; i++) {
115
- handle(self, self._deferreds[i]);
116
- }
117
- self._deferreds = null;
118
- }
119
-
120
- function Handler(onFulfilled, onRejected, promise) {
121
- this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
122
- this.onRejected = typeof onRejected === 'function' ? onRejected : null;
123
- this.promise = promise;
124
- }
125
-
126
- /**
127
- * Take a potentially misbehaving resolver function and make sure
128
- * onFulfilled and onRejected are only called once.
129
- *
130
- * Makes no guarantees about asynchrony.
131
- */
132
- function doResolve(fn, self) {
133
- var done = false;
134
- try {
135
- fn(function (value) {
136
- if (done) return;
137
- done = true;
138
- resolve(self, value);
139
- }, function (reason) {
140
- if (done) return;
141
- done = true;
142
- reject(self, reason);
143
- });
144
- } catch (ex) {
145
- if (done) return;
146
- done = true;
147
- reject(self, ex);
148
- }
149
- }
150
-
151
- Promise.prototype['catch'] = function (onRejected) {
152
- return this.then(null, onRejected);
153
- };
154
-
155
- Promise.prototype.then = function (onFulfilled, onRejected) {
156
- var prom = new (this.constructor)(noop);
157
-
158
- handle(this, new Handler(onFulfilled, onRejected, prom));
159
- return prom;
160
- };
161
-
162
- Promise.all = function (arr) {
163
- var args = Array.prototype.slice.call(arr);
164
-
165
- return new Promise(function (resolve, reject) {
166
- if (args.length === 0) return resolve([]);
167
- var remaining = args.length;
168
-
169
- function res(i, val) {
170
- try {
171
- if (val && (typeof val === 'object' || typeof val === 'function')) {
172
- var then = val.then;
173
- if (typeof then === 'function') {
174
- then.call(val, function (val) {
175
- res(i, val);
176
- }, reject);
177
- return;
178
- }
179
- }
180
- args[i] = val;
181
- if (--remaining === 0) {
182
- resolve(args);
183
- }
184
- } catch (ex) {
185
- reject(ex);
186
- }
187
- }
188
-
189
- for (var i = 0; i < args.length; i++) {
190
- res(i, args[i]);
191
- }
192
- });
193
- };
194
-
195
- Promise.resolve = function (value) {
196
- if (value && typeof value === 'object' && value.constructor === Promise) {
197
- return value;
198
- }
199
-
200
- return new Promise(function (resolve) {
201
- resolve(value);
202
- });
203
- };
204
-
205
- Promise.reject = function (value) {
206
- return new Promise(function (resolve, reject) {
207
- reject(value);
208
- });
209
- };
210
-
211
- Promise.race = function (values) {
212
- return new Promise(function (resolve, reject) {
213
- for (var i = 0, len = values.length; i < len; i++) {
214
- values[i].then(resolve, reject);
215
- }
216
- });
217
- };
218
-
219
- // Use polyfill for setImmediate for performance gains
220
- Promise._immediateFn = (typeof setImmediate === 'function' && function (fn) { setImmediate(fn); }) ||
221
- function (fn) {
222
- setTimeoutFunc(fn, 0);
223
- };
224
-
225
- Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
226
- if (typeof console !== 'undefined' && console) {
227
- console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
228
- }
229
- };
230
-
231
- /**
232
- * Set the immediate function to execute callbacks
233
- * @param fn {function} Function to execute
234
- * @deprecated
235
- */
236
- Promise._setImmediateFn = function _setImmediateFn(fn) {
237
- Promise._immediateFn = fn;
238
- };
239
-
240
- /**
241
- * Change the function to execute on unhandled rejection
242
- * @param {function} fn Function to execute on unhandled rejection
243
- * @deprecated
244
- */
245
- Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {
246
- Promise._unhandledRejectionFn = fn;
247
- };
248
-
249
- if (typeof module !== 'undefined' && module.exports) {
250
- module.exports = Promise;
251
- } else if (!root.Promise) {
252
- root.Promise = Promise;
253
- }
254
-
255
-})(this);
public/novnc/vnc.html
+52
-62
@@ -4,7 +4,7 @@
4
5
<!--
6
noVNC example: simple example using default UI
7
- Copyright (C) 2018 The noVNC Authors
7
+ Copyright (C) 2019 The noVNC Authors
8
noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
9
This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
10
@@ -56,27 +56,13 @@
56
<!-- Stylesheets -->
57
<link rel="stylesheet" href="app/styles/base.css">
58
59
- <!-- this is included as a normal file in order to catch script-loading errors as well -->
60
- <script src="app/error-handler.js"></script>
59
+ <!-- Images that will later appear via CSS -->
60
+ <link rel="preload" as="image" href="app/images/info.svg">
61
+ <link rel="preload" as="image" href="app/images/error.svg">
62
+ <link rel="preload" as="image" href="app/images/warning.svg">
63
62
- <!-- begin scripts -->
63
- <!-- promise polyfills promises for IE11 -->
64
- <script src="vendor/promise.js"></script>
65
- <!-- ES2015/ES6 modules polyfill -->
66
- <script type="module">
67
- window._noVNC_has_module_support = true;
68
- </script>
69
- <script>
70
- window.addEventListener("load", function() {
71
- if (window._noVNC_has_module_support) return;
72
- var loader = document.createElement("script");
73
- loader.src = "vendor/browser-es-module-loader/dist/browser-es-module-loader.js";
74
- document.head.appendChild(loader);
75
- });
76
- </script>
77
- <!-- actual script modules -->
64
+ <script src="app/error-handler.js"></script>
65
<script type="module" crossorigin="anonymous" src="app/ui.js"></script>
79
- <!-- end scripts -->
66
</head>
67
68
<body>
@@ -100,55 +86,41 @@
86
<!--<h1 class="noVNC_logo" translate="no"><span>no</span><br>VNC</h1>-->
87
88
<!-- Drag/Pan the viewport -->
103
- <input type="image" alt="viewport drag" src="app/images/drag.svg"
89
+ <input type="image" alt="Drag" src="app/images/drag.svg"
90
id="noVNC_view_drag_button" class="noVNC_button noVNC_hidden"
91
title="Move/Drag Viewport">
92
93
<!--noVNC Touch Device only buttons-->
94
<div id="noVNC_mobile_buttons">
109
- <input type="image" alt="No mousebutton" src="app/images/mouse_none.svg"
110
- id="noVNC_mouse_button0" class="noVNC_button"
111
- title="Active Mouse Button">
112
- <input type="image" alt="Left mousebutton" src="app/images/mouse_left.svg"
113
- id="noVNC_mouse_button1" class="noVNC_button"
114
- title="Active Mouse Button">
115
- <input type="image" alt="Middle mousebutton" src="app/images/mouse_middle.svg"
116
- id="noVNC_mouse_button2" class="noVNC_button"
117
- title="Active Mouse Button">
118
- <input type="image" alt="Right mousebutton" src="app/images/mouse_right.svg"
119
- id="noVNC_mouse_button4" class="noVNC_button"
120
- title="Active Mouse Button">
95
<input type="image" alt="Keyboard" src="app/images/keyboard.svg"
96
id="noVNC_keyboard_button" class="noVNC_button" title="Show Keyboard">
97
</div>
98
99
<!-- Extra manual keys -->
126
- <div id="noVNC_extra_keys">
127
- <input type="image" alt="Extra keys" src="app/images/toggleextrakeys.svg"
128
- id="noVNC_toggle_extra_keys_button" class="noVNC_button"
129
- title="Show Extra Keys">
130
- <div class="noVNC_vcenter">
131
- <div id="noVNC_modifiers" class="noVNC_panel">
132
- <input type="image" alt="Ctrl" src="app/images/ctrl.svg"
133
- id="noVNC_toggle_ctrl_button" class="noVNC_button"
134
- title="Toggle Ctrl">
135
- <input type="image" alt="Alt" src="app/images/alt.svg"
136
- id="noVNC_toggle_alt_button" class="noVNC_button"
137
- title="Toggle Alt">
138
- <input type="image" alt="Windows" src="app/images/windows.svg"
139
- id="noVNC_toggle_windows_button" class="noVNC_button"
140
- title="Toggle Windows">
141
- <input type="image" alt="Tab" src="app/images/tab.svg"
142
- id="noVNC_send_tab_button" class="noVNC_button"
143
- title="Send Tab">
144
- <input type="image" alt="Esc" src="app/images/esc.svg"
145
- id="noVNC_send_esc_button" class="noVNC_button"
146
- title="Send Escape">
147
- <input type="image" alt="Ctrl+Alt+Del" src="app/images/ctrlaltdel.svg"
148
- id="noVNC_send_ctrl_alt_del_button" class="noVNC_button"
149
- title="Send Ctrl-Alt-Del">
150
- </div>
151
- </div>
100
+ <input type="image" alt="Extra keys" src="app/images/toggleextrakeys.svg"
101
+ id="noVNC_toggle_extra_keys_button" class="noVNC_button"
102
+ title="Show Extra Keys">
103
+ <div class="noVNC_vcenter">
104
+ <div id="noVNC_modifiers" class="noVNC_panel">
105
+ <input type="image" alt="Ctrl" src="app/images/ctrl.svg"
106
+ id="noVNC_toggle_ctrl_button" class="noVNC_button"
107
+ title="Toggle Ctrl">
108
+ <input type="image" alt="Alt" src="app/images/alt.svg"
109
+ id="noVNC_toggle_alt_button" class="noVNC_button"
110
+ title="Toggle Alt">
111
+ <input type="image" alt="Windows" src="app/images/windows.svg"
112
+ id="noVNC_toggle_windows_button" class="noVNC_button"
113
+ title="Toggle Windows">
114
+ <input type="image" alt="Tab" src="app/images/tab.svg"
115
+ id="noVNC_send_tab_button" class="noVNC_button"
116
+ title="Send Tab">
117
+ <input type="image" alt="Esc" src="app/images/esc.svg"
118
+ id="noVNC_send_esc_button" class="noVNC_button"
119
+ title="Send Escape">
120
+ <input type="image" alt="Ctrl+Alt+Del" src="app/images/ctrlaltdel.svg"
121
+ id="noVNC_send_ctrl_alt_del_button" class="noVNC_button"
122
+ title="Send Ctrl-Alt-Del">
123
+ </div>
124
</div>
125
126
<!-- Shutdown/Reboot -->
@@ -219,6 +191,15 @@
191
<li>
192
<div class="noVNC_expander">Advanced</div>
193
<div><ul>
194
+ <li>
195
+ <label for="noVNC_setting_quality">Quality:</label>
196
+ <input id="noVNC_setting_quality" type="range" min="0" max="9" value="6">
197
+ </li>
198
+ <li>
199
+ <label for="noVNC_setting_compression">Compression level:</label>
200
+ <input id="noVNC_setting_compression" type="range" min="0" max="9" value="2">
201
+ </li>
202
+ <li><hr></li>
203
<li>
204
<label for="noVNC_setting_repeaterID">Repeater ID:</label>
205
<input id="noVNC_setting_repeaterID" type="text" value="">
@@ -265,6 +246,11 @@
246
</li>
247
</ul></div>
248
</li>
249
+ <li class="noVNC_version_separator"><hr></li>
250
+ <li class="noVNC_version_wrapper">
251
+ <span>Version:</span>
252
+ <span class="noVNC_version"></span>
253
+ </li>
254
</ul>
255
</div>
256
</div>
@@ -296,14 +282,18 @@
282
283
<!-- Password Dialog -->
284
<div class="noVNC_center noVNC_connect_layer">
299
- <div id="noVNC_password_dlg" class="noVNC_panel"><form>
285
+ <div id="noVNC_credentials_dlg" class="noVNC_panel"><form>
286
<ul>
301
- <li>
287
+ <li id="noVNC_username_block">
288
+ <label>Username:</label>
289
+ <input id="noVNC_username_input">
290
+ </li>
291
+ <li id="noVNC_password_block">
292
<label>Password:</label>
293
<input id="noVNC_password_input" type="password">
294
</li>
295
<li>
306
- <input id="noVNC_password_button" type="submit" value="Send Password" class="noVNC_submit">
296
+ <input id="noVNC_credentials_button" type="submit" value="Send Credentials" class="noVNC_submit">
297
</li>
298
</ul>
299
</form></div>