@govuk-pay/pay-js-commons 7.0.41 → 7.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/images/custom/osdc.png +0 -0
- package/package.json +8 -2
- package/sass/custom/osdc.scss +80 -0
- package/lib/analytics/dist/cookies.js +0 -972
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@govuk-pay/pay-js-commons",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.43",
|
|
4
4
|
"description": "Reusable js scripts for GOV.UK Pay Node.js projects",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^22.22.0",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"lib": "lib"
|
|
139
139
|
},
|
|
140
140
|
"dependencies": {
|
|
141
|
-
"axios": "
|
|
141
|
+
"axios": "1.14.0",
|
|
142
142
|
"csrf": "^3.1.0",
|
|
143
143
|
"express-rate-limit": "^8.1.0",
|
|
144
144
|
"lodash": "4.17.23",
|
|
@@ -146,5 +146,11 @@
|
|
|
146
146
|
"rfc822-validate": "1.0.0",
|
|
147
147
|
"slugify": "1.6.6",
|
|
148
148
|
"winston": "3.9.0"
|
|
149
|
+
},
|
|
150
|
+
"overrides": {
|
|
151
|
+
"axios": "1.14.0"
|
|
152
|
+
},
|
|
153
|
+
"resolutions": {
|
|
154
|
+
"axios": "1.14.0"
|
|
149
155
|
}
|
|
150
156
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
$govuk-font-family: -apple-system, BlinkMacSystemFont, helvetica neue, helvetica,
|
|
2
|
+
ubuntu, roboto, noto, segoe ui, arial, sans-serif; // Override font as so not to use New Transport
|
|
3
|
+
@import "application";
|
|
4
|
+
|
|
5
|
+
// CUSTOM BRANDING
|
|
6
|
+
// Use the variables below to control the style
|
|
7
|
+
// Make sure banner colours meet minimum colour contrast levels
|
|
8
|
+
|
|
9
|
+
$custom-banner-colour: #ffffff;
|
|
10
|
+
$custom-banner-border-colour: #0b0c0c;
|
|
11
|
+
$custom-text-colour: #0b0c0c;
|
|
12
|
+
$logo-image-height: 2em;
|
|
13
|
+
|
|
14
|
+
.govuk-template--rebranded {
|
|
15
|
+
.custom-branding {
|
|
16
|
+
@if $logo-image-height != null {
|
|
17
|
+
.custom-branding-image {
|
|
18
|
+
max-height: $logo-image-height;
|
|
19
|
+
|
|
20
|
+
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.govuk-header {
|
|
27
|
+
background-color: $custom-banner-colour;
|
|
28
|
+
border-bottom: 10px solid #ffffff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.govuk-header__logo {
|
|
32
|
+
margin-bottom: 10px;
|
|
33
|
+
padding-top: 0;
|
|
34
|
+
padding-bottom: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.govuk-header__service-name {
|
|
38
|
+
margin: 0 0 15px;
|
|
39
|
+
color: $custom-text-colour;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.govuk-header__link {
|
|
43
|
+
&:link,
|
|
44
|
+
&:visited {
|
|
45
|
+
color: $custom-text-colour;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.govuk-header__link--homepage {
|
|
50
|
+
&:hover,
|
|
51
|
+
&:active {
|
|
52
|
+
border-bottom: none;
|
|
53
|
+
margin-bottom: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:not(:focus) {
|
|
57
|
+
background-color: transparent;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.govuk-header__container {
|
|
62
|
+
border-bottom: 10px solid $custom-banner-border-colour;
|
|
63
|
+
margin-bottom: -10px;
|
|
64
|
+
padding-top: 10px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@include govuk-media-query($from: tablet) {
|
|
68
|
+
.govuk-header__content {
|
|
69
|
+
width: 66%;
|
|
70
|
+
vertical-align: bottom;
|
|
71
|
+
margin-bottom: 7px;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.govuk-button {
|
|
76
|
+
padding: 7px 15px 6px;
|
|
77
|
+
padding: 0.368421053em 0.842105263em 0.315789474em;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -1,972 +0,0 @@
|
|
|
1
|
-
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
|
-
/*! js-cookie v3.0.5 | MIT */
|
|
3
|
-
;
|
|
4
|
-
(function (global, factory) {
|
|
5
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
6
|
-
typeof define === 'function' && define.amd ? define(factory) :
|
|
7
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
|
|
8
|
-
var current = global.Cookies;
|
|
9
|
-
var exports = global.Cookies = factory();
|
|
10
|
-
exports.noConflict = function () { global.Cookies = current; return exports; };
|
|
11
|
-
})());
|
|
12
|
-
})(this, (function () { 'use strict';
|
|
13
|
-
|
|
14
|
-
/* eslint-disable no-var */
|
|
15
|
-
function assign (target) {
|
|
16
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
17
|
-
var source = arguments[i];
|
|
18
|
-
for (var key in source) {
|
|
19
|
-
target[key] = source[key];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return target
|
|
23
|
-
}
|
|
24
|
-
/* eslint-enable no-var */
|
|
25
|
-
|
|
26
|
-
/* eslint-disable no-var */
|
|
27
|
-
var defaultConverter = {
|
|
28
|
-
read: function (value) {
|
|
29
|
-
if (value[0] === '"') {
|
|
30
|
-
value = value.slice(1, -1);
|
|
31
|
-
}
|
|
32
|
-
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
|
|
33
|
-
},
|
|
34
|
-
write: function (value) {
|
|
35
|
-
return encodeURIComponent(value).replace(
|
|
36
|
-
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
37
|
-
decodeURIComponent
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
/* eslint-enable no-var */
|
|
42
|
-
|
|
43
|
-
/* eslint-disable no-var */
|
|
44
|
-
|
|
45
|
-
function init (converter, defaultAttributes) {
|
|
46
|
-
function set (name, value, attributes) {
|
|
47
|
-
if (typeof document === 'undefined') {
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
attributes = assign({}, defaultAttributes, attributes);
|
|
52
|
-
|
|
53
|
-
if (typeof attributes.expires === 'number') {
|
|
54
|
-
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
|
|
55
|
-
}
|
|
56
|
-
if (attributes.expires) {
|
|
57
|
-
attributes.expires = attributes.expires.toUTCString();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
name = encodeURIComponent(name)
|
|
61
|
-
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
|
62
|
-
.replace(/[()]/g, escape);
|
|
63
|
-
|
|
64
|
-
var stringifiedAttributes = '';
|
|
65
|
-
for (var attributeName in attributes) {
|
|
66
|
-
if (!attributes[attributeName]) {
|
|
67
|
-
continue
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
stringifiedAttributes += '; ' + attributeName;
|
|
71
|
-
|
|
72
|
-
if (attributes[attributeName] === true) {
|
|
73
|
-
continue
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Considers RFC 6265 section 5.2:
|
|
77
|
-
// ...
|
|
78
|
-
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
|
79
|
-
// character:
|
|
80
|
-
// Consume the characters of the unparsed-attributes up to,
|
|
81
|
-
// not including, the first %x3B (";") character.
|
|
82
|
-
// ...
|
|
83
|
-
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return (document.cookie =
|
|
87
|
-
name + '=' + converter.write(value, name) + stringifiedAttributes)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function get (name) {
|
|
91
|
-
if (typeof document === 'undefined' || (arguments.length && !name)) {
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// To prevent the for loop in the first place assign an empty array
|
|
96
|
-
// in case there are no cookies at all.
|
|
97
|
-
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
|
98
|
-
var jar = {};
|
|
99
|
-
for (var i = 0; i < cookies.length; i++) {
|
|
100
|
-
var parts = cookies[i].split('=');
|
|
101
|
-
var value = parts.slice(1).join('=');
|
|
102
|
-
|
|
103
|
-
try {
|
|
104
|
-
var found = decodeURIComponent(parts[0]);
|
|
105
|
-
jar[found] = converter.read(value, found);
|
|
106
|
-
|
|
107
|
-
if (name === found) {
|
|
108
|
-
break
|
|
109
|
-
}
|
|
110
|
-
} catch (e) {}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return name ? jar[name] : jar
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return Object.create(
|
|
117
|
-
{
|
|
118
|
-
set,
|
|
119
|
-
get,
|
|
120
|
-
remove: function (name, attributes) {
|
|
121
|
-
set(
|
|
122
|
-
name,
|
|
123
|
-
'',
|
|
124
|
-
assign({}, attributes, {
|
|
125
|
-
expires: -1
|
|
126
|
-
})
|
|
127
|
-
);
|
|
128
|
-
},
|
|
129
|
-
withAttributes: function (attributes) {
|
|
130
|
-
return init(this.converter, assign({}, this.attributes, attributes))
|
|
131
|
-
},
|
|
132
|
-
withConverter: function (converter) {
|
|
133
|
-
return init(assign({}, this.converter, converter), this.attributes)
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
attributes: { value: Object.freeze(defaultAttributes) },
|
|
138
|
-
converter: { value: Object.freeze(converter) }
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
var api = init(defaultConverter, { path: '/' });
|
|
144
|
-
/* eslint-enable no-var */
|
|
145
|
-
|
|
146
|
-
return api;
|
|
147
|
-
|
|
148
|
-
}));
|
|
149
|
-
|
|
150
|
-
},{}],2:[function(require,module,exports){
|
|
151
|
-
(function (process){(function (){
|
|
152
|
-
// 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
|
153
|
-
// transplited with Babel
|
|
154
|
-
|
|
155
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
156
|
-
//
|
|
157
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
158
|
-
// copy of this software and associated documentation files (the
|
|
159
|
-
// "Software"), to deal in the Software without restriction, including
|
|
160
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
161
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
162
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
163
|
-
// following conditions:
|
|
164
|
-
//
|
|
165
|
-
// The above copyright notice and this permission notice shall be included
|
|
166
|
-
// in all copies or substantial portions of the Software.
|
|
167
|
-
//
|
|
168
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
169
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
170
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
171
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
172
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
173
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
174
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
175
|
-
|
|
176
|
-
'use strict';
|
|
177
|
-
|
|
178
|
-
function assertPath(path) {
|
|
179
|
-
if (typeof path !== 'string') {
|
|
180
|
-
throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// Resolves . and .. elements in a path with directory names
|
|
185
|
-
function normalizeStringPosix(path, allowAboveRoot) {
|
|
186
|
-
var res = '';
|
|
187
|
-
var lastSegmentLength = 0;
|
|
188
|
-
var lastSlash = -1;
|
|
189
|
-
var dots = 0;
|
|
190
|
-
var code;
|
|
191
|
-
for (var i = 0; i <= path.length; ++i) {
|
|
192
|
-
if (i < path.length)
|
|
193
|
-
code = path.charCodeAt(i);
|
|
194
|
-
else if (code === 47 /*/*/)
|
|
195
|
-
break;
|
|
196
|
-
else
|
|
197
|
-
code = 47 /*/*/;
|
|
198
|
-
if (code === 47 /*/*/) {
|
|
199
|
-
if (lastSlash === i - 1 || dots === 1) {
|
|
200
|
-
// NOOP
|
|
201
|
-
} else if (lastSlash !== i - 1 && dots === 2) {
|
|
202
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
|
|
203
|
-
if (res.length > 2) {
|
|
204
|
-
var lastSlashIndex = res.lastIndexOf('/');
|
|
205
|
-
if (lastSlashIndex !== res.length - 1) {
|
|
206
|
-
if (lastSlashIndex === -1) {
|
|
207
|
-
res = '';
|
|
208
|
-
lastSegmentLength = 0;
|
|
209
|
-
} else {
|
|
210
|
-
res = res.slice(0, lastSlashIndex);
|
|
211
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
|
212
|
-
}
|
|
213
|
-
lastSlash = i;
|
|
214
|
-
dots = 0;
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
} else if (res.length === 2 || res.length === 1) {
|
|
218
|
-
res = '';
|
|
219
|
-
lastSegmentLength = 0;
|
|
220
|
-
lastSlash = i;
|
|
221
|
-
dots = 0;
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (allowAboveRoot) {
|
|
226
|
-
if (res.length > 0)
|
|
227
|
-
res += '/..';
|
|
228
|
-
else
|
|
229
|
-
res = '..';
|
|
230
|
-
lastSegmentLength = 2;
|
|
231
|
-
}
|
|
232
|
-
} else {
|
|
233
|
-
if (res.length > 0)
|
|
234
|
-
res += '/' + path.slice(lastSlash + 1, i);
|
|
235
|
-
else
|
|
236
|
-
res = path.slice(lastSlash + 1, i);
|
|
237
|
-
lastSegmentLength = i - lastSlash - 1;
|
|
238
|
-
}
|
|
239
|
-
lastSlash = i;
|
|
240
|
-
dots = 0;
|
|
241
|
-
} else if (code === 46 /*.*/ && dots !== -1) {
|
|
242
|
-
++dots;
|
|
243
|
-
} else {
|
|
244
|
-
dots = -1;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return res;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function _format(sep, pathObject) {
|
|
251
|
-
var dir = pathObject.dir || pathObject.root;
|
|
252
|
-
var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
|
|
253
|
-
if (!dir) {
|
|
254
|
-
return base;
|
|
255
|
-
}
|
|
256
|
-
if (dir === pathObject.root) {
|
|
257
|
-
return dir + base;
|
|
258
|
-
}
|
|
259
|
-
return dir + sep + base;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
var posix = {
|
|
263
|
-
// path.resolve([from ...], to)
|
|
264
|
-
resolve: function resolve() {
|
|
265
|
-
var resolvedPath = '';
|
|
266
|
-
var resolvedAbsolute = false;
|
|
267
|
-
var cwd;
|
|
268
|
-
|
|
269
|
-
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
270
|
-
var path;
|
|
271
|
-
if (i >= 0)
|
|
272
|
-
path = arguments[i];
|
|
273
|
-
else {
|
|
274
|
-
if (cwd === undefined)
|
|
275
|
-
cwd = process.cwd();
|
|
276
|
-
path = cwd;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
assertPath(path);
|
|
280
|
-
|
|
281
|
-
// Skip empty entries
|
|
282
|
-
if (path.length === 0) {
|
|
283
|
-
continue;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
resolvedPath = path + '/' + resolvedPath;
|
|
287
|
-
resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// At this point the path should be resolved to a full absolute path, but
|
|
291
|
-
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
292
|
-
|
|
293
|
-
// Normalize the path
|
|
294
|
-
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
295
|
-
|
|
296
|
-
if (resolvedAbsolute) {
|
|
297
|
-
if (resolvedPath.length > 0)
|
|
298
|
-
return '/' + resolvedPath;
|
|
299
|
-
else
|
|
300
|
-
return '/';
|
|
301
|
-
} else if (resolvedPath.length > 0) {
|
|
302
|
-
return resolvedPath;
|
|
303
|
-
} else {
|
|
304
|
-
return '.';
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
normalize: function normalize(path) {
|
|
309
|
-
assertPath(path);
|
|
310
|
-
|
|
311
|
-
if (path.length === 0) return '.';
|
|
312
|
-
|
|
313
|
-
var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
|
314
|
-
var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
|
|
315
|
-
|
|
316
|
-
// Normalize the path
|
|
317
|
-
path = normalizeStringPosix(path, !isAbsolute);
|
|
318
|
-
|
|
319
|
-
if (path.length === 0 && !isAbsolute) path = '.';
|
|
320
|
-
if (path.length > 0 && trailingSeparator) path += '/';
|
|
321
|
-
|
|
322
|
-
if (isAbsolute) return '/' + path;
|
|
323
|
-
return path;
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
isAbsolute: function isAbsolute(path) {
|
|
327
|
-
assertPath(path);
|
|
328
|
-
return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
join: function join() {
|
|
332
|
-
if (arguments.length === 0)
|
|
333
|
-
return '.';
|
|
334
|
-
var joined;
|
|
335
|
-
for (var i = 0; i < arguments.length; ++i) {
|
|
336
|
-
var arg = arguments[i];
|
|
337
|
-
assertPath(arg);
|
|
338
|
-
if (arg.length > 0) {
|
|
339
|
-
if (joined === undefined)
|
|
340
|
-
joined = arg;
|
|
341
|
-
else
|
|
342
|
-
joined += '/' + arg;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
if (joined === undefined)
|
|
346
|
-
return '.';
|
|
347
|
-
return posix.normalize(joined);
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
relative: function relative(from, to) {
|
|
351
|
-
assertPath(from);
|
|
352
|
-
assertPath(to);
|
|
353
|
-
|
|
354
|
-
if (from === to) return '';
|
|
355
|
-
|
|
356
|
-
from = posix.resolve(from);
|
|
357
|
-
to = posix.resolve(to);
|
|
358
|
-
|
|
359
|
-
if (from === to) return '';
|
|
360
|
-
|
|
361
|
-
// Trim any leading backslashes
|
|
362
|
-
var fromStart = 1;
|
|
363
|
-
for (; fromStart < from.length; ++fromStart) {
|
|
364
|
-
if (from.charCodeAt(fromStart) !== 47 /*/*/)
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
var fromEnd = from.length;
|
|
368
|
-
var fromLen = fromEnd - fromStart;
|
|
369
|
-
|
|
370
|
-
// Trim any leading backslashes
|
|
371
|
-
var toStart = 1;
|
|
372
|
-
for (; toStart < to.length; ++toStart) {
|
|
373
|
-
if (to.charCodeAt(toStart) !== 47 /*/*/)
|
|
374
|
-
break;
|
|
375
|
-
}
|
|
376
|
-
var toEnd = to.length;
|
|
377
|
-
var toLen = toEnd - toStart;
|
|
378
|
-
|
|
379
|
-
// Compare paths to find the longest common path from root
|
|
380
|
-
var length = fromLen < toLen ? fromLen : toLen;
|
|
381
|
-
var lastCommonSep = -1;
|
|
382
|
-
var i = 0;
|
|
383
|
-
for (; i <= length; ++i) {
|
|
384
|
-
if (i === length) {
|
|
385
|
-
if (toLen > length) {
|
|
386
|
-
if (to.charCodeAt(toStart + i) === 47 /*/*/) {
|
|
387
|
-
// We get here if `from` is the exact base path for `to`.
|
|
388
|
-
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
|
389
|
-
return to.slice(toStart + i + 1);
|
|
390
|
-
} else if (i === 0) {
|
|
391
|
-
// We get here if `from` is the root
|
|
392
|
-
// For example: from='/'; to='/foo'
|
|
393
|
-
return to.slice(toStart + i);
|
|
394
|
-
}
|
|
395
|
-
} else if (fromLen > length) {
|
|
396
|
-
if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
|
|
397
|
-
// We get here if `to` is the exact base path for `from`.
|
|
398
|
-
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
|
399
|
-
lastCommonSep = i;
|
|
400
|
-
} else if (i === 0) {
|
|
401
|
-
// We get here if `to` is the root.
|
|
402
|
-
// For example: from='/foo'; to='/'
|
|
403
|
-
lastCommonSep = 0;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
break;
|
|
407
|
-
}
|
|
408
|
-
var fromCode = from.charCodeAt(fromStart + i);
|
|
409
|
-
var toCode = to.charCodeAt(toStart + i);
|
|
410
|
-
if (fromCode !== toCode)
|
|
411
|
-
break;
|
|
412
|
-
else if (fromCode === 47 /*/*/)
|
|
413
|
-
lastCommonSep = i;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
var out = '';
|
|
417
|
-
// Generate the relative path based on the path difference between `to`
|
|
418
|
-
// and `from`
|
|
419
|
-
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
420
|
-
if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
|
|
421
|
-
if (out.length === 0)
|
|
422
|
-
out += '..';
|
|
423
|
-
else
|
|
424
|
-
out += '/..';
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
429
|
-
// the common path parts
|
|
430
|
-
if (out.length > 0)
|
|
431
|
-
return out + to.slice(toStart + lastCommonSep);
|
|
432
|
-
else {
|
|
433
|
-
toStart += lastCommonSep;
|
|
434
|
-
if (to.charCodeAt(toStart) === 47 /*/*/)
|
|
435
|
-
++toStart;
|
|
436
|
-
return to.slice(toStart);
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
_makeLong: function _makeLong(path) {
|
|
441
|
-
return path;
|
|
442
|
-
},
|
|
443
|
-
|
|
444
|
-
dirname: function dirname(path) {
|
|
445
|
-
assertPath(path);
|
|
446
|
-
if (path.length === 0) return '.';
|
|
447
|
-
var code = path.charCodeAt(0);
|
|
448
|
-
var hasRoot = code === 47 /*/*/;
|
|
449
|
-
var end = -1;
|
|
450
|
-
var matchedSlash = true;
|
|
451
|
-
for (var i = path.length - 1; i >= 1; --i) {
|
|
452
|
-
code = path.charCodeAt(i);
|
|
453
|
-
if (code === 47 /*/*/) {
|
|
454
|
-
if (!matchedSlash) {
|
|
455
|
-
end = i;
|
|
456
|
-
break;
|
|
457
|
-
}
|
|
458
|
-
} else {
|
|
459
|
-
// We saw the first non-path separator
|
|
460
|
-
matchedSlash = false;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
if (end === -1) return hasRoot ? '/' : '.';
|
|
465
|
-
if (hasRoot && end === 1) return '//';
|
|
466
|
-
return path.slice(0, end);
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
basename: function basename(path, ext) {
|
|
470
|
-
if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
|
|
471
|
-
assertPath(path);
|
|
472
|
-
|
|
473
|
-
var start = 0;
|
|
474
|
-
var end = -1;
|
|
475
|
-
var matchedSlash = true;
|
|
476
|
-
var i;
|
|
477
|
-
|
|
478
|
-
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
|
479
|
-
if (ext.length === path.length && ext === path) return '';
|
|
480
|
-
var extIdx = ext.length - 1;
|
|
481
|
-
var firstNonSlashEnd = -1;
|
|
482
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
483
|
-
var code = path.charCodeAt(i);
|
|
484
|
-
if (code === 47 /*/*/) {
|
|
485
|
-
// If we reached a path separator that was not part of a set of path
|
|
486
|
-
// separators at the end of the string, stop now
|
|
487
|
-
if (!matchedSlash) {
|
|
488
|
-
start = i + 1;
|
|
489
|
-
break;
|
|
490
|
-
}
|
|
491
|
-
} else {
|
|
492
|
-
if (firstNonSlashEnd === -1) {
|
|
493
|
-
// We saw the first non-path separator, remember this index in case
|
|
494
|
-
// we need it if the extension ends up not matching
|
|
495
|
-
matchedSlash = false;
|
|
496
|
-
firstNonSlashEnd = i + 1;
|
|
497
|
-
}
|
|
498
|
-
if (extIdx >= 0) {
|
|
499
|
-
// Try to match the explicit extension
|
|
500
|
-
if (code === ext.charCodeAt(extIdx)) {
|
|
501
|
-
if (--extIdx === -1) {
|
|
502
|
-
// We matched the extension, so mark this as the end of our path
|
|
503
|
-
// component
|
|
504
|
-
end = i;
|
|
505
|
-
}
|
|
506
|
-
} else {
|
|
507
|
-
// Extension does not match, so our result is the entire path
|
|
508
|
-
// component
|
|
509
|
-
extIdx = -1;
|
|
510
|
-
end = firstNonSlashEnd;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
|
|
517
|
-
return path.slice(start, end);
|
|
518
|
-
} else {
|
|
519
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
520
|
-
if (path.charCodeAt(i) === 47 /*/*/) {
|
|
521
|
-
// If we reached a path separator that was not part of a set of path
|
|
522
|
-
// separators at the end of the string, stop now
|
|
523
|
-
if (!matchedSlash) {
|
|
524
|
-
start = i + 1;
|
|
525
|
-
break;
|
|
526
|
-
}
|
|
527
|
-
} else if (end === -1) {
|
|
528
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
529
|
-
// path component
|
|
530
|
-
matchedSlash = false;
|
|
531
|
-
end = i + 1;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
if (end === -1) return '';
|
|
536
|
-
return path.slice(start, end);
|
|
537
|
-
}
|
|
538
|
-
},
|
|
539
|
-
|
|
540
|
-
extname: function extname(path) {
|
|
541
|
-
assertPath(path);
|
|
542
|
-
var startDot = -1;
|
|
543
|
-
var startPart = 0;
|
|
544
|
-
var end = -1;
|
|
545
|
-
var matchedSlash = true;
|
|
546
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
547
|
-
// after any path separator we find
|
|
548
|
-
var preDotState = 0;
|
|
549
|
-
for (var i = path.length - 1; i >= 0; --i) {
|
|
550
|
-
var code = path.charCodeAt(i);
|
|
551
|
-
if (code === 47 /*/*/) {
|
|
552
|
-
// If we reached a path separator that was not part of a set of path
|
|
553
|
-
// separators at the end of the string, stop now
|
|
554
|
-
if (!matchedSlash) {
|
|
555
|
-
startPart = i + 1;
|
|
556
|
-
break;
|
|
557
|
-
}
|
|
558
|
-
continue;
|
|
559
|
-
}
|
|
560
|
-
if (end === -1) {
|
|
561
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
562
|
-
// extension
|
|
563
|
-
matchedSlash = false;
|
|
564
|
-
end = i + 1;
|
|
565
|
-
}
|
|
566
|
-
if (code === 46 /*.*/) {
|
|
567
|
-
// If this is our first dot, mark it as the start of our extension
|
|
568
|
-
if (startDot === -1)
|
|
569
|
-
startDot = i;
|
|
570
|
-
else if (preDotState !== 1)
|
|
571
|
-
preDotState = 1;
|
|
572
|
-
} else if (startDot !== -1) {
|
|
573
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
574
|
-
// have a good chance at having a non-empty extension
|
|
575
|
-
preDotState = -1;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
if (startDot === -1 || end === -1 ||
|
|
580
|
-
// We saw a non-dot character immediately before the dot
|
|
581
|
-
preDotState === 0 ||
|
|
582
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
583
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
584
|
-
return '';
|
|
585
|
-
}
|
|
586
|
-
return path.slice(startDot, end);
|
|
587
|
-
},
|
|
588
|
-
|
|
589
|
-
format: function format(pathObject) {
|
|
590
|
-
if (pathObject === null || typeof pathObject !== 'object') {
|
|
591
|
-
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
592
|
-
}
|
|
593
|
-
return _format('/', pathObject);
|
|
594
|
-
},
|
|
595
|
-
|
|
596
|
-
parse: function parse(path) {
|
|
597
|
-
assertPath(path);
|
|
598
|
-
|
|
599
|
-
var ret = { root: '', dir: '', base: '', ext: '', name: '' };
|
|
600
|
-
if (path.length === 0) return ret;
|
|
601
|
-
var code = path.charCodeAt(0);
|
|
602
|
-
var isAbsolute = code === 47 /*/*/;
|
|
603
|
-
var start;
|
|
604
|
-
if (isAbsolute) {
|
|
605
|
-
ret.root = '/';
|
|
606
|
-
start = 1;
|
|
607
|
-
} else {
|
|
608
|
-
start = 0;
|
|
609
|
-
}
|
|
610
|
-
var startDot = -1;
|
|
611
|
-
var startPart = 0;
|
|
612
|
-
var end = -1;
|
|
613
|
-
var matchedSlash = true;
|
|
614
|
-
var i = path.length - 1;
|
|
615
|
-
|
|
616
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
617
|
-
// after any path separator we find
|
|
618
|
-
var preDotState = 0;
|
|
619
|
-
|
|
620
|
-
// Get non-dir info
|
|
621
|
-
for (; i >= start; --i) {
|
|
622
|
-
code = path.charCodeAt(i);
|
|
623
|
-
if (code === 47 /*/*/) {
|
|
624
|
-
// If we reached a path separator that was not part of a set of path
|
|
625
|
-
// separators at the end of the string, stop now
|
|
626
|
-
if (!matchedSlash) {
|
|
627
|
-
startPart = i + 1;
|
|
628
|
-
break;
|
|
629
|
-
}
|
|
630
|
-
continue;
|
|
631
|
-
}
|
|
632
|
-
if (end === -1) {
|
|
633
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
634
|
-
// extension
|
|
635
|
-
matchedSlash = false;
|
|
636
|
-
end = i + 1;
|
|
637
|
-
}
|
|
638
|
-
if (code === 46 /*.*/) {
|
|
639
|
-
// If this is our first dot, mark it as the start of our extension
|
|
640
|
-
if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
|
|
641
|
-
} else if (startDot !== -1) {
|
|
642
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
643
|
-
// have a good chance at having a non-empty extension
|
|
644
|
-
preDotState = -1;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
if (startDot === -1 || end === -1 ||
|
|
649
|
-
// We saw a non-dot character immediately before the dot
|
|
650
|
-
preDotState === 0 ||
|
|
651
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
652
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
653
|
-
if (end !== -1) {
|
|
654
|
-
if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
|
|
655
|
-
}
|
|
656
|
-
} else {
|
|
657
|
-
if (startPart === 0 && isAbsolute) {
|
|
658
|
-
ret.name = path.slice(1, startDot);
|
|
659
|
-
ret.base = path.slice(1, end);
|
|
660
|
-
} else {
|
|
661
|
-
ret.name = path.slice(startPart, startDot);
|
|
662
|
-
ret.base = path.slice(startPart, end);
|
|
663
|
-
}
|
|
664
|
-
ret.ext = path.slice(startDot, end);
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
|
|
668
|
-
|
|
669
|
-
return ret;
|
|
670
|
-
},
|
|
671
|
-
|
|
672
|
-
sep: '/',
|
|
673
|
-
delimiter: ':',
|
|
674
|
-
win32: null,
|
|
675
|
-
posix: null
|
|
676
|
-
};
|
|
677
|
-
|
|
678
|
-
posix.posix = posix;
|
|
679
|
-
|
|
680
|
-
module.exports = posix;
|
|
681
|
-
|
|
682
|
-
}).call(this)}).call(this,require('_process'))
|
|
683
|
-
},{"_process":3}],3:[function(require,module,exports){
|
|
684
|
-
// shim for using process in browser
|
|
685
|
-
var process = module.exports = {};
|
|
686
|
-
|
|
687
|
-
// cached from whatever global is present so that test runners that stub it
|
|
688
|
-
// don't break things. But we need to wrap it in a try catch in case it is
|
|
689
|
-
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
690
|
-
// function because try/catches deoptimize in certain engines.
|
|
691
|
-
|
|
692
|
-
var cachedSetTimeout;
|
|
693
|
-
var cachedClearTimeout;
|
|
694
|
-
|
|
695
|
-
function defaultSetTimout() {
|
|
696
|
-
throw new Error('setTimeout has not been defined');
|
|
697
|
-
}
|
|
698
|
-
function defaultClearTimeout () {
|
|
699
|
-
throw new Error('clearTimeout has not been defined');
|
|
700
|
-
}
|
|
701
|
-
(function () {
|
|
702
|
-
try {
|
|
703
|
-
if (typeof setTimeout === 'function') {
|
|
704
|
-
cachedSetTimeout = setTimeout;
|
|
705
|
-
} else {
|
|
706
|
-
cachedSetTimeout = defaultSetTimout;
|
|
707
|
-
}
|
|
708
|
-
} catch (e) {
|
|
709
|
-
cachedSetTimeout = defaultSetTimout;
|
|
710
|
-
}
|
|
711
|
-
try {
|
|
712
|
-
if (typeof clearTimeout === 'function') {
|
|
713
|
-
cachedClearTimeout = clearTimeout;
|
|
714
|
-
} else {
|
|
715
|
-
cachedClearTimeout = defaultClearTimeout;
|
|
716
|
-
}
|
|
717
|
-
} catch (e) {
|
|
718
|
-
cachedClearTimeout = defaultClearTimeout;
|
|
719
|
-
}
|
|
720
|
-
} ())
|
|
721
|
-
function runTimeout(fun) {
|
|
722
|
-
if (cachedSetTimeout === setTimeout) {
|
|
723
|
-
//normal enviroments in sane situations
|
|
724
|
-
return setTimeout(fun, 0);
|
|
725
|
-
}
|
|
726
|
-
// if setTimeout wasn't available but was latter defined
|
|
727
|
-
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
728
|
-
cachedSetTimeout = setTimeout;
|
|
729
|
-
return setTimeout(fun, 0);
|
|
730
|
-
}
|
|
731
|
-
try {
|
|
732
|
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
733
|
-
return cachedSetTimeout(fun, 0);
|
|
734
|
-
} catch(e){
|
|
735
|
-
try {
|
|
736
|
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
737
|
-
return cachedSetTimeout.call(null, fun, 0);
|
|
738
|
-
} catch(e){
|
|
739
|
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
740
|
-
return cachedSetTimeout.call(this, fun, 0);
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}
|
|
746
|
-
function runClearTimeout(marker) {
|
|
747
|
-
if (cachedClearTimeout === clearTimeout) {
|
|
748
|
-
//normal enviroments in sane situations
|
|
749
|
-
return clearTimeout(marker);
|
|
750
|
-
}
|
|
751
|
-
// if clearTimeout wasn't available but was latter defined
|
|
752
|
-
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
753
|
-
cachedClearTimeout = clearTimeout;
|
|
754
|
-
return clearTimeout(marker);
|
|
755
|
-
}
|
|
756
|
-
try {
|
|
757
|
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
758
|
-
return cachedClearTimeout(marker);
|
|
759
|
-
} catch (e){
|
|
760
|
-
try {
|
|
761
|
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
762
|
-
return cachedClearTimeout.call(null, marker);
|
|
763
|
-
} catch (e){
|
|
764
|
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
765
|
-
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
766
|
-
return cachedClearTimeout.call(this, marker);
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
}
|
|
773
|
-
var queue = [];
|
|
774
|
-
var draining = false;
|
|
775
|
-
var currentQueue;
|
|
776
|
-
var queueIndex = -1;
|
|
777
|
-
|
|
778
|
-
function cleanUpNextTick() {
|
|
779
|
-
if (!draining || !currentQueue) {
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
draining = false;
|
|
783
|
-
if (currentQueue.length) {
|
|
784
|
-
queue = currentQueue.concat(queue);
|
|
785
|
-
} else {
|
|
786
|
-
queueIndex = -1;
|
|
787
|
-
}
|
|
788
|
-
if (queue.length) {
|
|
789
|
-
drainQueue();
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
function drainQueue() {
|
|
794
|
-
if (draining) {
|
|
795
|
-
return;
|
|
796
|
-
}
|
|
797
|
-
var timeout = runTimeout(cleanUpNextTick);
|
|
798
|
-
draining = true;
|
|
799
|
-
|
|
800
|
-
var len = queue.length;
|
|
801
|
-
while(len) {
|
|
802
|
-
currentQueue = queue;
|
|
803
|
-
queue = [];
|
|
804
|
-
while (++queueIndex < len) {
|
|
805
|
-
if (currentQueue) {
|
|
806
|
-
currentQueue[queueIndex].run();
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
queueIndex = -1;
|
|
810
|
-
len = queue.length;
|
|
811
|
-
}
|
|
812
|
-
currentQueue = null;
|
|
813
|
-
draining = false;
|
|
814
|
-
runClearTimeout(timeout);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
process.nextTick = function (fun) {
|
|
818
|
-
var args = new Array(arguments.length - 1);
|
|
819
|
-
if (arguments.length > 1) {
|
|
820
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
821
|
-
args[i - 1] = arguments[i];
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
queue.push(new Item(fun, args));
|
|
825
|
-
if (queue.length === 1 && !draining) {
|
|
826
|
-
runTimeout(drainQueue);
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
// v8 likes predictible objects
|
|
831
|
-
function Item(fun, array) {
|
|
832
|
-
this.fun = fun;
|
|
833
|
-
this.array = array;
|
|
834
|
-
}
|
|
835
|
-
Item.prototype.run = function () {
|
|
836
|
-
this.fun.apply(null, this.array);
|
|
837
|
-
};
|
|
838
|
-
process.title = 'browser';
|
|
839
|
-
process.browser = true;
|
|
840
|
-
process.env = {};
|
|
841
|
-
process.argv = [];
|
|
842
|
-
process.version = ''; // empty string to avoid regexp issues
|
|
843
|
-
process.versions = {};
|
|
844
|
-
|
|
845
|
-
function noop() {}
|
|
846
|
-
|
|
847
|
-
process.on = noop;
|
|
848
|
-
process.addListener = noop;
|
|
849
|
-
process.once = noop;
|
|
850
|
-
process.off = noop;
|
|
851
|
-
process.removeListener = noop;
|
|
852
|
-
process.removeAllListeners = noop;
|
|
853
|
-
process.emit = noop;
|
|
854
|
-
process.prependListener = noop;
|
|
855
|
-
process.prependOnceListener = noop;
|
|
856
|
-
|
|
857
|
-
process.listeners = function (name) { return [] }
|
|
858
|
-
|
|
859
|
-
process.binding = function (name) {
|
|
860
|
-
throw new Error('process.binding is not supported');
|
|
861
|
-
};
|
|
862
|
-
|
|
863
|
-
process.cwd = function () { return '/' };
|
|
864
|
-
process.chdir = function (dir) {
|
|
865
|
-
throw new Error('process.chdir is not supported');
|
|
866
|
-
};
|
|
867
|
-
process.umask = function() { return 0; };
|
|
868
|
-
|
|
869
|
-
},{}],4:[function(require,module,exports){
|
|
870
|
-
"use strict";
|
|
871
|
-
|
|
872
|
-
var Cookies = require('js-cookie');
|
|
873
|
-
var path = require('path');
|
|
874
|
-
var template = "<style>\n\t/* component should only be shown if JS is available, by the cookieMessage JS, so hide by default */\n\t.pay-cookie-banner {\n\t\tdisplay: block;\n\t}\n\n\t.pay-cookie-banner__wrapper {\n\t\tpadding-top: 15px;\n \tpadding-bottom: 15px;\n\t}\n\n\t.pay-cookie-banner__buttons {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t}\n\n\t@media (min-width: 40.0625em){\n\t\t.pay-cookie-banner__buttons {\n\t\t\tflex-wrap: nowrap;\n\t\t}\n\t}\n\n\n\t.pay-cookie-banner__button,\n\t.pay-cookie-banner__link {\n\t\tvertical-align: baseline;\n\t}\n\n\t.pay-cookie-banner__button {\n\t\tdisplay: inline-block;\n\t\tflex: 1 0;\n\t\tpadding-left: 60px;\n\t\tpadding-right: 60px;\n\t\tmargin-bottom: 10px;\n\t\tmargin-right: 20px;\n\t}\n\n\t@media (min-width: 40.0625em){\n\t\t.pay-cookie-banner__button {\n\t\t\tflex: 0 0 150px;\n\t\t\tpadding-left: 10px;\n\t\t\tpadding-right: 10px;\n\t\t\tmargin-bottom: 5px;\n\t\t}\n\t}\n\t\n\t.pay-cookie-banner__link {\n\t\tfont-family: \"GDS Transport\", Arial, sans-serif;\n\t\tfont-weight: 400;\n\t\tfont-size: 16px;\n\t\tfont-size: 1rem;\n\t\tline-height: 1.25;\n\t\tline-height: 1;\n\t\tdisplay: block;\n\t\twidth: 100%;\n\t padding: 9px 0px 6px;\n\t}\n\t\n\t@media (min-width: 40.0625em){\n\t\t.pay-cookie-banner__link {\n\t\t\tdisplay: inline;\n\t\t\twidth: auto;\n\t\t\tmargin-left: 30px;\n\t\t}\n\t}\n\n\n\t.pay-cookie-banner__confirmation {\n\t\tdisplay: none;\n\t\tposition: relative;\n\t\tpadding: 20px 0;\n\n\t\t\n\t}\n\n\t/* This element is focused using JavaScript so that it's being read out by screen readers\n\tor this reason we don't want to show the default outline or emphasise it visually using `govuk-focused-text`*/\n\t.pay-cookie-banner__confirmation:focus {\n\t outline: none;\n\t}\n\n\n\t.pay-cookie-banner__confirmation-message,\n\t.pay-cookie-banner__hide-button {\n\t\tdisplay: block;\n\t}\n\n\n\t@media (min-width: 48.0625em){\n\t\t.pay-cookie-banner__confirmation-message, \n\t\t.pay-cookie-banner__hide-button {\n\t\t display: inline-block;\n\t\t}\n\t}\n\n\t.pay-cookie-banner__confirmation-message {\n\t\tmargin-right: 20px;\n\t}\n\n\t@media (min-width: 48.0625em){\n\t\t.pay-cookie-banner__confirmation-message {\n\t\t\tmax-width: 90%;\n\t\t}\n\t}\n\n\t.pay-cookie-banner__hide-button {\n\t\tfont-family: \"GDS Transport\", Arial, sans-serif;\n\t\tfont-weight: 400;\n\t\tfont-size: 16px;\n\t\tfont-size: 1rem;\n\t\tline-height: 1.25;\n\t\tcolor: #1d70b8;\n\t\toutline: 0;\n\t\tborder: 0;\n\t\tbackground: none;\n\t\ttext-decoration: underline;\n\t\tpadding: 0;\n\t\tmargin-top: 10px;\n\t\tright: 15px;\n\t\tcursor: pointer;\n\t}\n\n\t@media (min-width: 40.0625em){\n\t\t.pay-cookie-banner__hide-button {\n\t\t\tfont-size: 19px;\n\t\t\tfont-size: 1.1875rem;\n\t\t\tline-height: 1.3157894737;\n\t\t}\n\t}\n</style>\n<div id=\"pay-cookie-banner\" class=\"pay-cookie-banner govuk-width-container\" data-module=\"pay-cookie-banner\" role=\"region\" aria-label=\"cookie banner\">\n\t<div class=\"pay-cookie-banner__wrapper\">\n\t\t<h2 class=\"pay-cookie-banner__heading govuk-heading-m\" id=\"pay-cookie-banner__heading\">\n\t\t\tCan we store analytics cookies on your device?\n\t\t</h2>\n\t\t<p class=\"govuk-body\">\n\t\t\tAnalytics cookies help us understand how our website is being used.\n\t\t</p>\n\t\t<div class=\"pay-cookie-banner__buttons\">\n\t\t\t<button class=\"govuk-button pay-cookie-banner__button pay-cookie-banner__button--accept\" type=\"submit\" data-accept-cookies=\"true\" aria-describedby=\"pay-cookie-banner__heading\">\n\t\t\t\tYes<span class=\"govuk-visually-hidden\">, GOV.UK Pay can store analytics cookies on your device</span>\n\t\t\t</button>\n\t\t\t<button class=\"govuk-button pay-cookie-banner__button pay-cookie-banner__button--reject\" type=\"submit\" data-accept-cookies=\"false\" aria-describedby=\"pay-cookie-banner__heading\">\n\t\t\t\tNo<span class=\"govuk-visually-hidden\">, GOV.UK Pay cannot store analytics cookies on your device</span>\n\t\t\t</button>\n\t\t\t<a class=\"govuk-link pay-cookie-banner__link\" href=\"https://www.payments.service.gov.uk/cookies\">How GOV.UK Pay uses cookies</a>\n\t\t</div>\n\t</div>\n\n\t<div class=\"pay-cookie-banner__confirmation\" tabindex=\"-1\">\n\t\t<p class=\"pay-cookie-banner__confirmation-message govuk-body\">\n\t\t\tYou can <a class=\"govuk-link\" href=\"https://www.payments.service.gov.uk/cookies/\">change your cookie settings</a> at any time.\n\t\t</p>\n\t\t<button class=\"pay-cookie-banner__hide-button govuk-link\" data-hide-cookie-banner=\"true\" role=\"link\">Hide</button>\n\t</div>\n</div>\n";
|
|
875
|
-
var GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME = 'govuk_pay_cookie_policy';
|
|
876
|
-
var ANALYTICS_CONSENT_BANNER_ID = 'pay-cookie-banner';
|
|
877
|
-
function hasAnalyticsConsent() {
|
|
878
|
-
var cookie = Cookies.get(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME);
|
|
879
|
-
var parsed = cookie && JSON.parse(cookie);
|
|
880
|
-
return Boolean(parsed) && parsed.analytics === true;
|
|
881
|
-
}
|
|
882
|
-
function getCookieDomain() {
|
|
883
|
-
var PROD_HOSTNAME = 'payments.service.gov.uk';
|
|
884
|
-
if (window.location.hostname.includes(PROD_HOSTNAME)) {
|
|
885
|
-
return PROD_HOSTNAME;
|
|
886
|
-
}
|
|
887
|
-
return undefined;
|
|
888
|
-
}
|
|
889
|
-
function setAnalyticsCookie() {
|
|
890
|
-
var userConsentedToAnalytics = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
891
|
-
var cookieValue = JSON.stringify({
|
|
892
|
-
analytics: userConsentedToAnalytics
|
|
893
|
-
});
|
|
894
|
-
var cookieAttributes = {
|
|
895
|
-
expires: 365,
|
|
896
|
-
path: '/',
|
|
897
|
-
domain: getCookieDomain()
|
|
898
|
-
};
|
|
899
|
-
Cookies.set(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME, cookieValue, cookieAttributes);
|
|
900
|
-
}
|
|
901
|
-
function hideBannerIfExists(event) {
|
|
902
|
-
var banner = document.querySelector("#".concat(ANALYTICS_CONSENT_BANNER_ID));
|
|
903
|
-
if (banner) {
|
|
904
|
-
banner.style.display = 'none';
|
|
905
|
-
}
|
|
906
|
-
if (event.target) {
|
|
907
|
-
event.preventDefault();
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
function showConfirmationMessage(analyticsConsent) {
|
|
911
|
-
var messagePrefix = analyticsConsent ? 'You’ve accepted analytics cookies.' : 'You told us not to use analytics cookies.';
|
|
912
|
-
var $cookieBannerMainContent = document.querySelector('.pay-cookie-banner__wrapper');
|
|
913
|
-
var $cookieBannerConfirmationMessage = document.querySelector('.pay-cookie-banner__confirmation-message');
|
|
914
|
-
$cookieBannerConfirmationMessage.prepend(messagePrefix);
|
|
915
|
-
$cookieBannerMainContent.style.display = 'none';
|
|
916
|
-
var $cookieBannerConfirmationWrapper = document.querySelector('.pay-cookie-banner__confirmation');
|
|
917
|
-
$cookieBannerConfirmationWrapper.style.display = 'block';
|
|
918
|
-
}
|
|
919
|
-
function acceptAnalyticsCookies() {
|
|
920
|
-
setAnalyticsCookie(true);
|
|
921
|
-
showConfirmationMessage(true);
|
|
922
|
-
}
|
|
923
|
-
function rejectAnalyticsCookies() {
|
|
924
|
-
setAnalyticsCookie(false);
|
|
925
|
-
showConfirmationMessage(false);
|
|
926
|
-
}
|
|
927
|
-
function createBannerHTMLElement() {
|
|
928
|
-
var consentProvidedCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
|
|
929
|
-
var banner = document.createElement('div');
|
|
930
|
-
banner.id = ANALYTICS_CONSENT_BANNER_ID;
|
|
931
|
-
banner.innerHTML = template.trim();
|
|
932
|
-
var acceptButton = banner.querySelector('button[data-accept-cookies=true]');
|
|
933
|
-
var rejectButton = banner.querySelector('button[data-accept-cookies=false]');
|
|
934
|
-
if (acceptButton && rejectButton) {
|
|
935
|
-
acceptButton.addEventListener('click', acceptAnalyticsCookies);
|
|
936
|
-
acceptButton.addEventListener('click', consentProvidedCallback);
|
|
937
|
-
rejectButton.addEventListener('click', rejectAnalyticsCookies);
|
|
938
|
-
}
|
|
939
|
-
var hideCookieBannerLink = banner.querySelector('button[data-hide-cookie-banner]');
|
|
940
|
-
if (hideCookieBannerLink) {
|
|
941
|
-
hideCookieBannerLink.addEventListener('click', hideBannerIfExists);
|
|
942
|
-
}
|
|
943
|
-
return banner;
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
* ConsentProvidedCallback: function - generic callback that will be called
|
|
948
|
-
* if and only if the user provides consent
|
|
949
|
-
*/
|
|
950
|
-
function showBannerIfConsentNotSet() {
|
|
951
|
-
var consentProvidedCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
|
|
952
|
-
var consentCookieNotSet = !Cookies.get(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME);
|
|
953
|
-
var banner = document.querySelector("#".concat(ANALYTICS_CONSENT_BANNER_ID));
|
|
954
|
-
if (consentCookieNotSet && !banner) {
|
|
955
|
-
var _banner = createBannerHTMLElement(consentProvidedCallback);
|
|
956
|
-
document.body.prepend(_banner);
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
module.exports = {
|
|
960
|
-
hasAnalyticsConsent: hasAnalyticsConsent,
|
|
961
|
-
showBannerIfConsentNotSet: showBannerIfConsentNotSet
|
|
962
|
-
};
|
|
963
|
-
|
|
964
|
-
},{"js-cookie":1,"path":2}],5:[function(require,module,exports){
|
|
965
|
-
"use strict";
|
|
966
|
-
|
|
967
|
-
var cookies = require('./cookies/validate');
|
|
968
|
-
window.GovUkPay = {
|
|
969
|
-
cookies: cookies
|
|
970
|
-
};
|
|
971
|
-
|
|
972
|
-
},{"./cookies/validate":4}]},{},[5]);
|