changeset 18 | be944660c56a |
parent 16 | a86126ab1dd4 |
child 19 | 3d72ae0968f4 |
17:34716fd837a4 | 18:be944660c56a |
---|---|
80 /******/ // __webpack_public_path__ |
80 /******/ // __webpack_public_path__ |
81 /******/ __webpack_require__.p = ""; |
81 /******/ __webpack_require__.p = ""; |
82 /******/ |
82 /******/ |
83 /******/ |
83 /******/ |
84 /******/ // Load entry module and return exports |
84 /******/ // Load entry module and return exports |
85 /******/ return __webpack_require__(__webpack_require__.s = 444); |
85 /******/ return __webpack_require__(__webpack_require__.s = "lbya"); |
86 /******/ }) |
86 /******/ }) |
87 /************************************************************************/ |
87 /************************************************************************/ |
88 /******/ ({ |
88 /******/ ({ |
89 |
89 |
90 /***/ 115: |
90 /***/ "YLtl": |
91 /***/ (function(module, exports, __webpack_require__) { |
91 /***/ (function(module, exports) { |
92 |
92 |
93 "use strict"; |
93 (function() { module.exports = window["lodash"]; }()); |
94 |
|
95 |
|
96 var stringify = __webpack_require__(433); |
|
97 var parse = __webpack_require__(434); |
|
98 var formats = __webpack_require__(259); |
|
99 |
|
100 module.exports = { |
|
101 formats: formats, |
|
102 parse: parse, |
|
103 stringify: stringify |
|
104 }; |
|
105 |
|
106 |
94 |
107 /***/ }), |
95 /***/ }), |
108 |
96 |
109 /***/ 2: |
97 /***/ "lbya": |
110 /***/ (function(module, exports) { |
|
111 |
|
112 (function() { module.exports = this["lodash"]; }()); |
|
113 |
|
114 /***/ }), |
|
115 |
|
116 /***/ 258: |
|
117 /***/ (function(module, exports, __webpack_require__) { |
|
118 |
|
119 "use strict"; |
|
120 |
|
121 |
|
122 var has = Object.prototype.hasOwnProperty; |
|
123 var isArray = Array.isArray; |
|
124 |
|
125 var hexTable = (function () { |
|
126 var array = []; |
|
127 for (var i = 0; i < 256; ++i) { |
|
128 array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); |
|
129 } |
|
130 |
|
131 return array; |
|
132 }()); |
|
133 |
|
134 var compactQueue = function compactQueue(queue) { |
|
135 while (queue.length > 1) { |
|
136 var item = queue.pop(); |
|
137 var obj = item.obj[item.prop]; |
|
138 |
|
139 if (isArray(obj)) { |
|
140 var compacted = []; |
|
141 |
|
142 for (var j = 0; j < obj.length; ++j) { |
|
143 if (typeof obj[j] !== 'undefined') { |
|
144 compacted.push(obj[j]); |
|
145 } |
|
146 } |
|
147 |
|
148 item.obj[item.prop] = compacted; |
|
149 } |
|
150 } |
|
151 }; |
|
152 |
|
153 var arrayToObject = function arrayToObject(source, options) { |
|
154 var obj = options && options.plainObjects ? Object.create(null) : {}; |
|
155 for (var i = 0; i < source.length; ++i) { |
|
156 if (typeof source[i] !== 'undefined') { |
|
157 obj[i] = source[i]; |
|
158 } |
|
159 } |
|
160 |
|
161 return obj; |
|
162 }; |
|
163 |
|
164 var merge = function merge(target, source, options) { |
|
165 if (!source) { |
|
166 return target; |
|
167 } |
|
168 |
|
169 if (typeof source !== 'object') { |
|
170 if (isArray(target)) { |
|
171 target.push(source); |
|
172 } else if (target && typeof target === 'object') { |
|
173 if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { |
|
174 target[source] = true; |
|
175 } |
|
176 } else { |
|
177 return [target, source]; |
|
178 } |
|
179 |
|
180 return target; |
|
181 } |
|
182 |
|
183 if (!target || typeof target !== 'object') { |
|
184 return [target].concat(source); |
|
185 } |
|
186 |
|
187 var mergeTarget = target; |
|
188 if (isArray(target) && !isArray(source)) { |
|
189 mergeTarget = arrayToObject(target, options); |
|
190 } |
|
191 |
|
192 if (isArray(target) && isArray(source)) { |
|
193 source.forEach(function (item, i) { |
|
194 if (has.call(target, i)) { |
|
195 var targetItem = target[i]; |
|
196 if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { |
|
197 target[i] = merge(targetItem, item, options); |
|
198 } else { |
|
199 target.push(item); |
|
200 } |
|
201 } else { |
|
202 target[i] = item; |
|
203 } |
|
204 }); |
|
205 return target; |
|
206 } |
|
207 |
|
208 return Object.keys(source).reduce(function (acc, key) { |
|
209 var value = source[key]; |
|
210 |
|
211 if (has.call(acc, key)) { |
|
212 acc[key] = merge(acc[key], value, options); |
|
213 } else { |
|
214 acc[key] = value; |
|
215 } |
|
216 return acc; |
|
217 }, mergeTarget); |
|
218 }; |
|
219 |
|
220 var assign = function assignSingleSource(target, source) { |
|
221 return Object.keys(source).reduce(function (acc, key) { |
|
222 acc[key] = source[key]; |
|
223 return acc; |
|
224 }, target); |
|
225 }; |
|
226 |
|
227 var decode = function (str, decoder, charset) { |
|
228 var strWithoutPlus = str.replace(/\+/g, ' '); |
|
229 if (charset === 'iso-8859-1') { |
|
230 // unescape never throws, no try...catch needed: |
|
231 return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); |
|
232 } |
|
233 // utf-8 |
|
234 try { |
|
235 return decodeURIComponent(strWithoutPlus); |
|
236 } catch (e) { |
|
237 return strWithoutPlus; |
|
238 } |
|
239 }; |
|
240 |
|
241 var encode = function encode(str, defaultEncoder, charset) { |
|
242 // This code was originally written by Brian White (mscdex) for the io.js core querystring library. |
|
243 // It has been adapted here for stricter adherence to RFC 3986 |
|
244 if (str.length === 0) { |
|
245 return str; |
|
246 } |
|
247 |
|
248 var string = typeof str === 'string' ? str : String(str); |
|
249 |
|
250 if (charset === 'iso-8859-1') { |
|
251 return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) { |
|
252 return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; |
|
253 }); |
|
254 } |
|
255 |
|
256 var out = ''; |
|
257 for (var i = 0; i < string.length; ++i) { |
|
258 var c = string.charCodeAt(i); |
|
259 |
|
260 if ( |
|
261 c === 0x2D // - |
|
262 || c === 0x2E // . |
|
263 || c === 0x5F // _ |
|
264 || c === 0x7E // ~ |
|
265 || (c >= 0x30 && c <= 0x39) // 0-9 |
|
266 || (c >= 0x41 && c <= 0x5A) // a-z |
|
267 || (c >= 0x61 && c <= 0x7A) // A-Z |
|
268 ) { |
|
269 out += string.charAt(i); |
|
270 continue; |
|
271 } |
|
272 |
|
273 if (c < 0x80) { |
|
274 out = out + hexTable[c]; |
|
275 continue; |
|
276 } |
|
277 |
|
278 if (c < 0x800) { |
|
279 out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); |
|
280 continue; |
|
281 } |
|
282 |
|
283 if (c < 0xD800 || c >= 0xE000) { |
|
284 out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); |
|
285 continue; |
|
286 } |
|
287 |
|
288 i += 1; |
|
289 c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); |
|
290 out += hexTable[0xF0 | (c >> 18)] |
|
291 + hexTable[0x80 | ((c >> 12) & 0x3F)] |
|
292 + hexTable[0x80 | ((c >> 6) & 0x3F)] |
|
293 + hexTable[0x80 | (c & 0x3F)]; |
|
294 } |
|
295 |
|
296 return out; |
|
297 }; |
|
298 |
|
299 var compact = function compact(value) { |
|
300 var queue = [{ obj: { o: value }, prop: 'o' }]; |
|
301 var refs = []; |
|
302 |
|
303 for (var i = 0; i < queue.length; ++i) { |
|
304 var item = queue[i]; |
|
305 var obj = item.obj[item.prop]; |
|
306 |
|
307 var keys = Object.keys(obj); |
|
308 for (var j = 0; j < keys.length; ++j) { |
|
309 var key = keys[j]; |
|
310 var val = obj[key]; |
|
311 if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { |
|
312 queue.push({ obj: obj, prop: key }); |
|
313 refs.push(val); |
|
314 } |
|
315 } |
|
316 } |
|
317 |
|
318 compactQueue(queue); |
|
319 |
|
320 return value; |
|
321 }; |
|
322 |
|
323 var isRegExp = function isRegExp(obj) { |
|
324 return Object.prototype.toString.call(obj) === '[object RegExp]'; |
|
325 }; |
|
326 |
|
327 var isBuffer = function isBuffer(obj) { |
|
328 if (!obj || typeof obj !== 'object') { |
|
329 return false; |
|
330 } |
|
331 |
|
332 return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); |
|
333 }; |
|
334 |
|
335 var combine = function combine(a, b) { |
|
336 return [].concat(a, b); |
|
337 }; |
|
338 |
|
339 module.exports = { |
|
340 arrayToObject: arrayToObject, |
|
341 assign: assign, |
|
342 combine: combine, |
|
343 compact: compact, |
|
344 decode: decode, |
|
345 encode: encode, |
|
346 isBuffer: isBuffer, |
|
347 isRegExp: isRegExp, |
|
348 merge: merge |
|
349 }; |
|
350 |
|
351 |
|
352 /***/ }), |
|
353 |
|
354 /***/ 259: |
|
355 /***/ (function(module, exports, __webpack_require__) { |
|
356 |
|
357 "use strict"; |
|
358 |
|
359 |
|
360 var replace = String.prototype.replace; |
|
361 var percentTwenties = /%20/g; |
|
362 |
|
363 module.exports = { |
|
364 'default': 'RFC3986', |
|
365 formatters: { |
|
366 RFC1738: function (value) { |
|
367 return replace.call(value, percentTwenties, '+'); |
|
368 }, |
|
369 RFC3986: function (value) { |
|
370 return value; |
|
371 } |
|
372 }, |
|
373 RFC1738: 'RFC1738', |
|
374 RFC3986: 'RFC3986' |
|
375 }; |
|
376 |
|
377 |
|
378 /***/ }), |
|
379 |
|
380 /***/ 433: |
|
381 /***/ (function(module, exports, __webpack_require__) { |
|
382 |
|
383 "use strict"; |
|
384 |
|
385 |
|
386 var utils = __webpack_require__(258); |
|
387 var formats = __webpack_require__(259); |
|
388 var has = Object.prototype.hasOwnProperty; |
|
389 |
|
390 var arrayPrefixGenerators = { |
|
391 brackets: function brackets(prefix) { // eslint-disable-line func-name-matching |
|
392 return prefix + '[]'; |
|
393 }, |
|
394 comma: 'comma', |
|
395 indices: function indices(prefix, key) { // eslint-disable-line func-name-matching |
|
396 return prefix + '[' + key + ']'; |
|
397 }, |
|
398 repeat: function repeat(prefix) { // eslint-disable-line func-name-matching |
|
399 return prefix; |
|
400 } |
|
401 }; |
|
402 |
|
403 var isArray = Array.isArray; |
|
404 var push = Array.prototype.push; |
|
405 var pushToArray = function (arr, valueOrArray) { |
|
406 push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); |
|
407 }; |
|
408 |
|
409 var toISO = Date.prototype.toISOString; |
|
410 |
|
411 var defaults = { |
|
412 addQueryPrefix: false, |
|
413 allowDots: false, |
|
414 charset: 'utf-8', |
|
415 charsetSentinel: false, |
|
416 delimiter: '&', |
|
417 encode: true, |
|
418 encoder: utils.encode, |
|
419 encodeValuesOnly: false, |
|
420 formatter: formats.formatters[formats['default']], |
|
421 // deprecated |
|
422 indices: false, |
|
423 serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching |
|
424 return toISO.call(date); |
|
425 }, |
|
426 skipNulls: false, |
|
427 strictNullHandling: false |
|
428 }; |
|
429 |
|
430 var stringify = function stringify( // eslint-disable-line func-name-matching |
|
431 object, |
|
432 prefix, |
|
433 generateArrayPrefix, |
|
434 strictNullHandling, |
|
435 skipNulls, |
|
436 encoder, |
|
437 filter, |
|
438 sort, |
|
439 allowDots, |
|
440 serializeDate, |
|
441 formatter, |
|
442 encodeValuesOnly, |
|
443 charset |
|
444 ) { |
|
445 var obj = object; |
|
446 if (typeof filter === 'function') { |
|
447 obj = filter(prefix, obj); |
|
448 } else if (obj instanceof Date) { |
|
449 obj = serializeDate(obj); |
|
450 } else if (generateArrayPrefix === 'comma' && isArray(obj)) { |
|
451 obj = obj.join(','); |
|
452 } |
|
453 |
|
454 if (obj === null) { |
|
455 if (strictNullHandling) { |
|
456 return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset) : prefix; |
|
457 } |
|
458 |
|
459 obj = ''; |
|
460 } |
|
461 |
|
462 if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) { |
|
463 if (encoder) { |
|
464 var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset); |
|
465 return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset))]; |
|
466 } |
|
467 return [formatter(prefix) + '=' + formatter(String(obj))]; |
|
468 } |
|
469 |
|
470 var values = []; |
|
471 |
|
472 if (typeof obj === 'undefined') { |
|
473 return values; |
|
474 } |
|
475 |
|
476 var objKeys; |
|
477 if (isArray(filter)) { |
|
478 objKeys = filter; |
|
479 } else { |
|
480 var keys = Object.keys(obj); |
|
481 objKeys = sort ? keys.sort(sort) : keys; |
|
482 } |
|
483 |
|
484 for (var i = 0; i < objKeys.length; ++i) { |
|
485 var key = objKeys[i]; |
|
486 |
|
487 if (skipNulls && obj[key] === null) { |
|
488 continue; |
|
489 } |
|
490 |
|
491 if (isArray(obj)) { |
|
492 pushToArray(values, stringify( |
|
493 obj[key], |
|
494 typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix, |
|
495 generateArrayPrefix, |
|
496 strictNullHandling, |
|
497 skipNulls, |
|
498 encoder, |
|
499 filter, |
|
500 sort, |
|
501 allowDots, |
|
502 serializeDate, |
|
503 formatter, |
|
504 encodeValuesOnly, |
|
505 charset |
|
506 )); |
|
507 } else { |
|
508 pushToArray(values, stringify( |
|
509 obj[key], |
|
510 prefix + (allowDots ? '.' + key : '[' + key + ']'), |
|
511 generateArrayPrefix, |
|
512 strictNullHandling, |
|
513 skipNulls, |
|
514 encoder, |
|
515 filter, |
|
516 sort, |
|
517 allowDots, |
|
518 serializeDate, |
|
519 formatter, |
|
520 encodeValuesOnly, |
|
521 charset |
|
522 )); |
|
523 } |
|
524 } |
|
525 |
|
526 return values; |
|
527 }; |
|
528 |
|
529 var normalizeStringifyOptions = function normalizeStringifyOptions(opts) { |
|
530 if (!opts) { |
|
531 return defaults; |
|
532 } |
|
533 |
|
534 if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') { |
|
535 throw new TypeError('Encoder has to be a function.'); |
|
536 } |
|
537 |
|
538 var charset = opts.charset || defaults.charset; |
|
539 if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { |
|
540 throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); |
|
541 } |
|
542 |
|
543 var format = formats['default']; |
|
544 if (typeof opts.format !== 'undefined') { |
|
545 if (!has.call(formats.formatters, opts.format)) { |
|
546 throw new TypeError('Unknown format option provided.'); |
|
547 } |
|
548 format = opts.format; |
|
549 } |
|
550 var formatter = formats.formatters[format]; |
|
551 |
|
552 var filter = defaults.filter; |
|
553 if (typeof opts.filter === 'function' || isArray(opts.filter)) { |
|
554 filter = opts.filter; |
|
555 } |
|
556 |
|
557 return { |
|
558 addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix, |
|
559 allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, |
|
560 charset: charset, |
|
561 charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, |
|
562 delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, |
|
563 encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, |
|
564 encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder, |
|
565 encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly, |
|
566 filter: filter, |
|
567 formatter: formatter, |
|
568 serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate, |
|
569 skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls, |
|
570 sort: typeof opts.sort === 'function' ? opts.sort : null, |
|
571 strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling |
|
572 }; |
|
573 }; |
|
574 |
|
575 module.exports = function (object, opts) { |
|
576 var obj = object; |
|
577 var options = normalizeStringifyOptions(opts); |
|
578 |
|
579 var objKeys; |
|
580 var filter; |
|
581 |
|
582 if (typeof options.filter === 'function') { |
|
583 filter = options.filter; |
|
584 obj = filter('', obj); |
|
585 } else if (isArray(options.filter)) { |
|
586 filter = options.filter; |
|
587 objKeys = filter; |
|
588 } |
|
589 |
|
590 var keys = []; |
|
591 |
|
592 if (typeof obj !== 'object' || obj === null) { |
|
593 return ''; |
|
594 } |
|
595 |
|
596 var arrayFormat; |
|
597 if (opts && opts.arrayFormat in arrayPrefixGenerators) { |
|
598 arrayFormat = opts.arrayFormat; |
|
599 } else if (opts && 'indices' in opts) { |
|
600 arrayFormat = opts.indices ? 'indices' : 'repeat'; |
|
601 } else { |
|
602 arrayFormat = 'indices'; |
|
603 } |
|
604 |
|
605 var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; |
|
606 |
|
607 if (!objKeys) { |
|
608 objKeys = Object.keys(obj); |
|
609 } |
|
610 |
|
611 if (options.sort) { |
|
612 objKeys.sort(options.sort); |
|
613 } |
|
614 |
|
615 for (var i = 0; i < objKeys.length; ++i) { |
|
616 var key = objKeys[i]; |
|
617 |
|
618 if (options.skipNulls && obj[key] === null) { |
|
619 continue; |
|
620 } |
|
621 pushToArray(keys, stringify( |
|
622 obj[key], |
|
623 key, |
|
624 generateArrayPrefix, |
|
625 options.strictNullHandling, |
|
626 options.skipNulls, |
|
627 options.encode ? options.encoder : null, |
|
628 options.filter, |
|
629 options.sort, |
|
630 options.allowDots, |
|
631 options.serializeDate, |
|
632 options.formatter, |
|
633 options.encodeValuesOnly, |
|
634 options.charset |
|
635 )); |
|
636 } |
|
637 |
|
638 var joined = keys.join(options.delimiter); |
|
639 var prefix = options.addQueryPrefix === true ? '?' : ''; |
|
640 |
|
641 if (options.charsetSentinel) { |
|
642 if (options.charset === 'iso-8859-1') { |
|
643 // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark |
|
644 prefix += 'utf8=%26%2310003%3B&'; |
|
645 } else { |
|
646 // encodeURIComponent('✓') |
|
647 prefix += 'utf8=%E2%9C%93&'; |
|
648 } |
|
649 } |
|
650 |
|
651 return joined.length > 0 ? prefix + joined : ''; |
|
652 }; |
|
653 |
|
654 |
|
655 /***/ }), |
|
656 |
|
657 /***/ 434: |
|
658 /***/ (function(module, exports, __webpack_require__) { |
|
659 |
|
660 "use strict"; |
|
661 |
|
662 |
|
663 var utils = __webpack_require__(258); |
|
664 |
|
665 var has = Object.prototype.hasOwnProperty; |
|
666 |
|
667 var defaults = { |
|
668 allowDots: false, |
|
669 allowPrototypes: false, |
|
670 arrayLimit: 20, |
|
671 charset: 'utf-8', |
|
672 charsetSentinel: false, |
|
673 comma: false, |
|
674 decoder: utils.decode, |
|
675 delimiter: '&', |
|
676 depth: 5, |
|
677 ignoreQueryPrefix: false, |
|
678 interpretNumericEntities: false, |
|
679 parameterLimit: 1000, |
|
680 parseArrays: true, |
|
681 plainObjects: false, |
|
682 strictNullHandling: false |
|
683 }; |
|
684 |
|
685 var interpretNumericEntities = function (str) { |
|
686 return str.replace(/&#(\d+);/g, function ($0, numberStr) { |
|
687 return String.fromCharCode(parseInt(numberStr, 10)); |
|
688 }); |
|
689 }; |
|
690 |
|
691 // This is what browsers will submit when the ✓ character occurs in an |
|
692 // application/x-www-form-urlencoded body and the encoding of the page containing |
|
693 // the form is iso-8859-1, or when the submitted form has an accept-charset |
|
694 // attribute of iso-8859-1. Presumably also with other charsets that do not contain |
|
695 // the ✓ character, such as us-ascii. |
|
696 var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓') |
|
697 |
|
698 // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded. |
|
699 var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓') |
|
700 |
|
701 var parseValues = function parseQueryStringValues(str, options) { |
|
702 var obj = {}; |
|
703 var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; |
|
704 var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; |
|
705 var parts = cleanStr.split(options.delimiter, limit); |
|
706 var skipIndex = -1; // Keep track of where the utf8 sentinel was found |
|
707 var i; |
|
708 |
|
709 var charset = options.charset; |
|
710 if (options.charsetSentinel) { |
|
711 for (i = 0; i < parts.length; ++i) { |
|
712 if (parts[i].indexOf('utf8=') === 0) { |
|
713 if (parts[i] === charsetSentinel) { |
|
714 charset = 'utf-8'; |
|
715 } else if (parts[i] === isoSentinel) { |
|
716 charset = 'iso-8859-1'; |
|
717 } |
|
718 skipIndex = i; |
|
719 i = parts.length; // The eslint settings do not allow break; |
|
720 } |
|
721 } |
|
722 } |
|
723 |
|
724 for (i = 0; i < parts.length; ++i) { |
|
725 if (i === skipIndex) { |
|
726 continue; |
|
727 } |
|
728 var part = parts[i]; |
|
729 |
|
730 var bracketEqualsPos = part.indexOf(']='); |
|
731 var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1; |
|
732 |
|
733 var key, val; |
|
734 if (pos === -1) { |
|
735 key = options.decoder(part, defaults.decoder, charset); |
|
736 val = options.strictNullHandling ? null : ''; |
|
737 } else { |
|
738 key = options.decoder(part.slice(0, pos), defaults.decoder, charset); |
|
739 val = options.decoder(part.slice(pos + 1), defaults.decoder, charset); |
|
740 } |
|
741 |
|
742 if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { |
|
743 val = interpretNumericEntities(val); |
|
744 } |
|
745 |
|
746 if (val && options.comma && val.indexOf(',') > -1) { |
|
747 val = val.split(','); |
|
748 } |
|
749 |
|
750 if (has.call(obj, key)) { |
|
751 obj[key] = utils.combine(obj[key], val); |
|
752 } else { |
|
753 obj[key] = val; |
|
754 } |
|
755 } |
|
756 |
|
757 return obj; |
|
758 }; |
|
759 |
|
760 var parseObject = function (chain, val, options) { |
|
761 var leaf = val; |
|
762 |
|
763 for (var i = chain.length - 1; i >= 0; --i) { |
|
764 var obj; |
|
765 var root = chain[i]; |
|
766 |
|
767 if (root === '[]' && options.parseArrays) { |
|
768 obj = [].concat(leaf); |
|
769 } else { |
|
770 obj = options.plainObjects ? Object.create(null) : {}; |
|
771 var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; |
|
772 var index = parseInt(cleanRoot, 10); |
|
773 if (!options.parseArrays && cleanRoot === '') { |
|
774 obj = { 0: leaf }; |
|
775 } else if ( |
|
776 !isNaN(index) |
|
777 && root !== cleanRoot |
|
778 && String(index) === cleanRoot |
|
779 && index >= 0 |
|
780 && (options.parseArrays && index <= options.arrayLimit) |
|
781 ) { |
|
782 obj = []; |
|
783 obj[index] = leaf; |
|
784 } else { |
|
785 obj[cleanRoot] = leaf; |
|
786 } |
|
787 } |
|
788 |
|
789 leaf = obj; |
|
790 } |
|
791 |
|
792 return leaf; |
|
793 }; |
|
794 |
|
795 var parseKeys = function parseQueryStringKeys(givenKey, val, options) { |
|
796 if (!givenKey) { |
|
797 return; |
|
798 } |
|
799 |
|
800 // Transform dot notation to bracket notation |
|
801 var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; |
|
802 |
|
803 // The regex chunks |
|
804 |
|
805 var brackets = /(\[[^[\]]*])/; |
|
806 var child = /(\[[^[\]]*])/g; |
|
807 |
|
808 // Get the parent |
|
809 |
|
810 var segment = brackets.exec(key); |
|
811 var parent = segment ? key.slice(0, segment.index) : key; |
|
812 |
|
813 // Stash the parent if it exists |
|
814 |
|
815 var keys = []; |
|
816 if (parent) { |
|
817 // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties |
|
818 if (!options.plainObjects && has.call(Object.prototype, parent)) { |
|
819 if (!options.allowPrototypes) { |
|
820 return; |
|
821 } |
|
822 } |
|
823 |
|
824 keys.push(parent); |
|
825 } |
|
826 |
|
827 // Loop through children appending to the array until we hit depth |
|
828 |
|
829 var i = 0; |
|
830 while ((segment = child.exec(key)) !== null && i < options.depth) { |
|
831 i += 1; |
|
832 if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { |
|
833 if (!options.allowPrototypes) { |
|
834 return; |
|
835 } |
|
836 } |
|
837 keys.push(segment[1]); |
|
838 } |
|
839 |
|
840 // If there's a remainder, just add whatever is left |
|
841 |
|
842 if (segment) { |
|
843 keys.push('[' + key.slice(segment.index) + ']'); |
|
844 } |
|
845 |
|
846 return parseObject(keys, val, options); |
|
847 }; |
|
848 |
|
849 var normalizeParseOptions = function normalizeParseOptions(opts) { |
|
850 if (!opts) { |
|
851 return defaults; |
|
852 } |
|
853 |
|
854 if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') { |
|
855 throw new TypeError('Decoder has to be a function.'); |
|
856 } |
|
857 |
|
858 if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { |
|
859 throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined'); |
|
860 } |
|
861 var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; |
|
862 |
|
863 return { |
|
864 allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, |
|
865 allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes, |
|
866 arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit, |
|
867 charset: charset, |
|
868 charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, |
|
869 comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma, |
|
870 decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder, |
|
871 delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, |
|
872 depth: typeof opts.depth === 'number' ? opts.depth : defaults.depth, |
|
873 ignoreQueryPrefix: opts.ignoreQueryPrefix === true, |
|
874 interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities, |
|
875 parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit, |
|
876 parseArrays: opts.parseArrays !== false, |
|
877 plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects, |
|
878 strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling |
|
879 }; |
|
880 }; |
|
881 |
|
882 module.exports = function (str, opts) { |
|
883 var options = normalizeParseOptions(opts); |
|
884 |
|
885 if (str === '' || str === null || typeof str === 'undefined') { |
|
886 return options.plainObjects ? Object.create(null) : {}; |
|
887 } |
|
888 |
|
889 var tempObj = typeof str === 'string' ? parseValues(str, options) : str; |
|
890 var obj = options.plainObjects ? Object.create(null) : {}; |
|
891 |
|
892 // Iterate over the keys and setup the new object |
|
893 |
|
894 var keys = Object.keys(tempObj); |
|
895 for (var i = 0; i < keys.length; ++i) { |
|
896 var key = keys[i]; |
|
897 var newObj = parseKeys(key, tempObj[key], options); |
|
898 obj = utils.merge(obj, newObj, options); |
|
899 } |
|
900 |
|
901 return utils.compact(obj); |
|
902 }; |
|
903 |
|
904 |
|
905 /***/ }), |
|
906 |
|
907 /***/ 444: |
|
908 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
98 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
909 |
99 |
910 "use strict"; |
100 "use strict"; |
911 // ESM COMPAT FLAG |
101 // ESM COMPAT FLAG |
912 __webpack_require__.r(__webpack_exports__); |
102 __webpack_require__.r(__webpack_exports__); |
919 __webpack_require__.d(__webpack_exports__, "getAuthority", function() { return /* reexport */ getAuthority; }); |
109 __webpack_require__.d(__webpack_exports__, "getAuthority", function() { return /* reexport */ getAuthority; }); |
920 __webpack_require__.d(__webpack_exports__, "isValidAuthority", function() { return /* reexport */ isValidAuthority; }); |
110 __webpack_require__.d(__webpack_exports__, "isValidAuthority", function() { return /* reexport */ isValidAuthority; }); |
921 __webpack_require__.d(__webpack_exports__, "getPath", function() { return /* reexport */ getPath; }); |
111 __webpack_require__.d(__webpack_exports__, "getPath", function() { return /* reexport */ getPath; }); |
922 __webpack_require__.d(__webpack_exports__, "isValidPath", function() { return /* reexport */ isValidPath; }); |
112 __webpack_require__.d(__webpack_exports__, "isValidPath", function() { return /* reexport */ isValidPath; }); |
923 __webpack_require__.d(__webpack_exports__, "getQueryString", function() { return /* reexport */ getQueryString; }); |
113 __webpack_require__.d(__webpack_exports__, "getQueryString", function() { return /* reexport */ getQueryString; }); |
114 __webpack_require__.d(__webpack_exports__, "buildQueryString", function() { return /* reexport */ buildQueryString; }); |
|
924 __webpack_require__.d(__webpack_exports__, "isValidQueryString", function() { return /* reexport */ isValidQueryString; }); |
115 __webpack_require__.d(__webpack_exports__, "isValidQueryString", function() { return /* reexport */ isValidQueryString; }); |
925 __webpack_require__.d(__webpack_exports__, "getPathAndQueryString", function() { return /* reexport */ getPathAndQueryString; }); |
116 __webpack_require__.d(__webpack_exports__, "getPathAndQueryString", function() { return /* reexport */ getPathAndQueryString; }); |
926 __webpack_require__.d(__webpack_exports__, "getFragment", function() { return /* reexport */ getFragment; }); |
117 __webpack_require__.d(__webpack_exports__, "getFragment", function() { return /* reexport */ getFragment; }); |
927 __webpack_require__.d(__webpack_exports__, "isValidFragment", function() { return /* reexport */ isValidFragment; }); |
118 __webpack_require__.d(__webpack_exports__, "isValidFragment", function() { return /* reexport */ isValidFragment; }); |
928 __webpack_require__.d(__webpack_exports__, "addQueryArgs", function() { return /* reexport */ addQueryArgs; }); |
119 __webpack_require__.d(__webpack_exports__, "addQueryArgs", function() { return /* reexport */ addQueryArgs; }); |
929 __webpack_require__.d(__webpack_exports__, "getQueryArg", function() { return /* reexport */ getQueryArg; }); |
120 __webpack_require__.d(__webpack_exports__, "getQueryArg", function() { return /* reexport */ getQueryArg; }); |
121 __webpack_require__.d(__webpack_exports__, "getQueryArgs", function() { return /* reexport */ getQueryArgs; }); |
|
930 __webpack_require__.d(__webpack_exports__, "hasQueryArg", function() { return /* reexport */ hasQueryArg; }); |
122 __webpack_require__.d(__webpack_exports__, "hasQueryArg", function() { return /* reexport */ hasQueryArg; }); |
931 __webpack_require__.d(__webpack_exports__, "removeQueryArgs", function() { return /* reexport */ removeQueryArgs; }); |
123 __webpack_require__.d(__webpack_exports__, "removeQueryArgs", function() { return /* reexport */ removeQueryArgs; }); |
932 __webpack_require__.d(__webpack_exports__, "prependHTTP", function() { return /* reexport */ prependHTTP; }); |
124 __webpack_require__.d(__webpack_exports__, "prependHTTP", function() { return /* reexport */ prependHTTP; }); |
933 __webpack_require__.d(__webpack_exports__, "safeDecodeURI", function() { return /* reexport */ safeDecodeURI; }); |
125 __webpack_require__.d(__webpack_exports__, "safeDecodeURI", function() { return /* reexport */ safeDecodeURI; }); |
934 __webpack_require__.d(__webpack_exports__, "safeDecodeURIComponent", function() { return /* reexport */ safeDecodeURIComponent; }); |
126 __webpack_require__.d(__webpack_exports__, "safeDecodeURIComponent", function() { return /* reexport */ safeDecodeURIComponent; }); |
955 // A URL can be considered value if the `URL` constructor is able to parse |
147 // A URL can be considered value if the `URL` constructor is able to parse |
956 // it. The constructor throws an error for an invalid URL. |
148 // it. The constructor throws an error for an invalid URL. |
957 try { |
149 try { |
958 new URL(url); |
150 new URL(url); |
959 return true; |
151 return true; |
960 } catch (_unused) { |
152 } catch { |
961 return false; |
153 return false; |
962 } |
154 } |
963 } |
155 } |
964 |
156 |
965 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-email.js |
157 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-email.js |
966 var EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i; |
158 const EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i; |
967 /** |
159 /** |
968 * Determines whether the given string looks like an email. |
160 * Determines whether the given string looks like an email. |
969 * |
161 * |
970 * @param {string} email The string to scrutinise. |
162 * @param {string} email The string to scrutinise. |
971 * |
163 * |
994 * ``` |
186 * ``` |
995 * |
187 * |
996 * @return {string|void} The protocol part of the URL. |
188 * @return {string|void} The protocol part of the URL. |
997 */ |
189 */ |
998 function getProtocol(url) { |
190 function getProtocol(url) { |
999 var matches = /^([^\s:]+:)/.exec(url); |
191 const matches = /^([^\s:]+:)/.exec(url); |
1000 |
192 |
1001 if (matches) { |
193 if (matches) { |
1002 return matches[1]; |
194 return matches[1]; |
1003 } |
195 } |
1004 } |
196 } |
1038 * ``` |
230 * ``` |
1039 * |
231 * |
1040 * @return {string|void} The authority part of the URL. |
232 * @return {string|void} The authority part of the URL. |
1041 */ |
233 */ |
1042 function getAuthority(url) { |
234 function getAuthority(url) { |
1043 var matches = /^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(url); |
235 const matches = /^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(url); |
1044 |
236 |
1045 if (matches) { |
237 if (matches) { |
1046 return matches[1]; |
238 return matches[1]; |
1047 } |
239 } |
1048 } |
240 } |
1082 * ``` |
274 * ``` |
1083 * |
275 * |
1084 * @return {string|void} The path part of the URL. |
276 * @return {string|void} The path part of the URL. |
1085 */ |
277 */ |
1086 function getPath(url) { |
278 function getPath(url) { |
1087 var matches = /^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(url); |
279 const matches = /^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(url); |
1088 |
280 |
1089 if (matches) { |
281 if (matches) { |
1090 return matches[1]; |
282 return matches[1]; |
1091 } |
283 } |
1092 } |
284 } |
1125 * ``` |
317 * ``` |
1126 * |
318 * |
1127 * @return {string|void} The query string part of the URL. |
319 * @return {string|void} The query string part of the URL. |
1128 */ |
320 */ |
1129 function getQueryString(url) { |
321 function getQueryString(url) { |
1130 var query; |
322 let query; |
1131 |
323 |
1132 try { |
324 try { |
1133 query = new URL(url).search.substring(1); |
325 query = new URL(url, 'http://example.com').search.substring(1); |
1134 } catch (error) {} |
326 } catch (error) {} |
1135 |
327 |
1136 if (query) { |
328 if (query) { |
1137 return query; |
329 return query; |
1138 } |
330 } |
331 } |
|
332 |
|
333 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/build-query-string.js |
|
334 /** |
|
335 * Generates URL-encoded query string using input query data. |
|
336 * |
|
337 * It is intended to behave equivalent as PHP's `http_build_query`, configured |
|
338 * with encoding type PHP_QUERY_RFC3986 (spaces as `%20`). |
|
339 * |
|
340 * @example |
|
341 * ```js |
|
342 * const queryString = buildQueryString( { |
|
343 * simple: 'is ok', |
|
344 * arrays: [ 'are', 'fine', 'too' ], |
|
345 * objects: { |
|
346 * evenNested: { |
|
347 * ok: 'yes', |
|
348 * }, |
|
349 * }, |
|
350 * } ); |
|
351 * // "simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes" |
|
352 * ``` |
|
353 * |
|
354 * @param {Record<string,*>} data Data to encode. |
|
355 * |
|
356 * @return {string} Query string. |
|
357 */ |
|
358 function buildQueryString(data) { |
|
359 let string = ''; |
|
360 const stack = Object.entries(data); |
|
361 let pair; |
|
362 |
|
363 while (pair = stack.shift()) { |
|
364 let [key, value] = pair; // Support building deeply nested data, from array or object values. |
|
365 |
|
366 const hasNestedData = Array.isArray(value) || value && value.constructor === Object; |
|
367 |
|
368 if (hasNestedData) { |
|
369 // Push array or object values onto the stack as composed of their |
|
370 // original key and nested index or key, retaining order by a |
|
371 // combination of Array#reverse and Array#unshift onto the stack. |
|
372 const valuePairs = Object.entries(value).reverse(); |
|
373 |
|
374 for (const [member, memberValue] of valuePairs) { |
|
375 stack.unshift([`${key}[${member}]`, memberValue]); |
|
376 } |
|
377 } else if (value !== undefined) { |
|
378 // Null is treated as special case, equivalent to empty string. |
|
379 if (value === null) { |
|
380 value = ''; |
|
381 } |
|
382 |
|
383 string += '&' + [key, value].map(encodeURIComponent).join('='); |
|
384 } |
|
385 } // Loop will concatenate with leading `&`, but it's only expected for all |
|
386 // but the first query parameter. This strips the leading `&`, while still |
|
387 // accounting for the case that the string may in-fact be empty. |
|
388 |
|
389 |
|
390 return string.substr(1); |
|
1139 } |
391 } |
1140 |
392 |
1141 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-query-string.js |
393 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-query-string.js |
1142 /** |
394 /** |
1143 * Checks for invalid characters within the provided query string. |
395 * Checks for invalid characters within the provided query string. |
1178 * |
430 * |
1179 * @return {string} The path part and query string part of the URL. |
431 * @return {string} The path part and query string part of the URL. |
1180 */ |
432 */ |
1181 |
433 |
1182 function getPathAndQueryString(url) { |
434 function getPathAndQueryString(url) { |
1183 var path = getPath(url); |
435 const path = getPath(url); |
1184 var queryString = getQueryString(url); |
436 const queryString = getQueryString(url); |
1185 var value = '/'; |
437 let value = '/'; |
1186 if (path) value += path; |
438 if (path) value += path; |
1187 if (queryString) value += "?".concat(queryString); |
439 if (queryString) value += `?${queryString}`; |
1188 return value; |
440 return value; |
1189 } |
441 } |
1190 |
442 |
1191 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-fragment.js |
443 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-fragment.js |
1192 /** |
444 /** |
1201 * ``` |
453 * ``` |
1202 * |
454 * |
1203 * @return {string|void} The fragment part of the URL. |
455 * @return {string|void} The fragment part of the URL. |
1204 */ |
456 */ |
1205 function getFragment(url) { |
457 function getFragment(url) { |
1206 var matches = /^\S+?(#[^\s\?]*)/.exec(url); |
458 const matches = /^\S+?(#[^\s\?]*)/.exec(url); |
1207 |
459 |
1208 if (matches) { |
460 if (matches) { |
1209 return matches[1]; |
461 return matches[1]; |
1210 } |
462 } |
1211 } |
463 } |
1230 } |
482 } |
1231 |
483 |
1232 return /^#[^\s#?\/]*$/.test(fragment); |
484 return /^#[^\s#?\/]*$/.test(fragment); |
1233 } |
485 } |
1234 |
486 |
1235 // EXTERNAL MODULE: ./node_modules/qs/lib/index.js |
487 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-args.js |
1236 var lib = __webpack_require__(115); |
488 /** |
489 * Internal dependencies |
|
490 */ |
|
491 |
|
492 /** @typedef {import('./get-query-arg').QueryArgParsed} QueryArgParsed */ |
|
493 |
|
494 /** |
|
495 * @typedef {Record<string,QueryArgParsed>} QueryArgs |
|
496 */ |
|
497 |
|
498 /** |
|
499 * Sets a value in object deeply by a given array of path segments. Mutates the |
|
500 * object reference. |
|
501 * |
|
502 * @param {Record<string,*>} object Object in which to assign. |
|
503 * @param {string[]} path Path segment at which to set value. |
|
504 * @param {*} value Value to set. |
|
505 */ |
|
506 |
|
507 function setPath(object, path, value) { |
|
508 const length = path.length; |
|
509 const lastIndex = length - 1; |
|
510 |
|
511 for (let i = 0; i < length; i++) { |
|
512 let key = path[i]; |
|
513 |
|
514 if (!key && Array.isArray(object)) { |
|
515 // If key is empty string and next value is array, derive key from |
|
516 // the current length of the array. |
|
517 key = object.length.toString(); |
|
518 } // If the next key in the path is numeric (or empty string), it will be |
|
519 // created as an array. Otherwise, it will be created as an object. |
|
520 |
|
521 |
|
522 const isNextKeyArrayIndex = !isNaN(Number(path[i + 1])); |
|
523 object[key] = i === lastIndex ? // If at end of path, assign the intended value. |
|
524 value : // Otherwise, advance to the next object in the path, creating |
|
525 // it if it does not yet exist. |
|
526 object[key] || (isNextKeyArrayIndex ? [] : {}); |
|
527 |
|
528 if (Array.isArray(object[key]) && !isNextKeyArrayIndex) { |
|
529 // If we current key is non-numeric, but the next value is an |
|
530 // array, coerce the value to an object. |
|
531 object[key] = { ...object[key] |
|
532 }; |
|
533 } // Update working reference object to the next in the path. |
|
534 |
|
535 |
|
536 object = object[key]; |
|
537 } |
|
538 } |
|
539 /** |
|
540 * Returns an object of query arguments of the given URL. If the given URL is |
|
541 * invalid or has no querystring, an empty object is returned. |
|
542 * |
|
543 * @param {string} url URL. |
|
544 * |
|
545 * @example |
|
546 * ```js |
|
547 * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' ); |
|
548 * // { "foo": "bar", "bar": "baz" } |
|
549 * ``` |
|
550 * |
|
551 * @return {QueryArgs} Query args object. |
|
552 */ |
|
553 |
|
554 |
|
555 function getQueryArgs(url) { |
|
556 return (getQueryString(url) || ''). // Normalize space encoding, accounting for PHP URL encoding |
|
557 // corresponding to `application/x-www-form-urlencoded`. |
|
558 // |
|
559 // See: https://tools.ietf.org/html/rfc1866#section-8.2.1 |
|
560 replace(/\+/g, '%20').split('&').reduce((accumulator, keyValue) => { |
|
561 const [key, value = ''] = keyValue.split('=') // Filtering avoids decoding as `undefined` for value, where |
|
562 // default is restored in destructuring assignment. |
|
563 .filter(Boolean).map(decodeURIComponent); |
|
564 |
|
565 if (key) { |
|
566 const segments = key.replace(/\]/g, '').split('['); |
|
567 setPath(accumulator, segments, value); |
|
568 } |
|
569 |
|
570 return accumulator; |
|
571 }, {}); |
|
572 } |
|
1237 |
573 |
1238 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/add-query-args.js |
574 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/add-query-args.js |
1239 /** |
575 /** |
1240 * External dependencies |
576 * Internal dependencies |
1241 */ |
577 */ |
578 |
|
1242 |
579 |
1243 /** |
580 /** |
1244 * Appends arguments as querystring to the provided URL. If the URL already |
581 * Appends arguments as querystring to the provided URL. If the URL already |
1245 * includes query arguments, the arguments are merged with (and take precedent |
582 * includes query arguments, the arguments are merged with (and take precedent |
1246 * over) the existing set. |
583 * over) the existing set. |
1255 * ``` |
592 * ``` |
1256 * |
593 * |
1257 * @return {string} URL with arguments applied. |
594 * @return {string} URL with arguments applied. |
1258 */ |
595 */ |
1259 |
596 |
1260 function addQueryArgs() { |
597 function addQueryArgs(url = '', args) { |
1261 var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; |
|
1262 var args = arguments.length > 1 ? arguments[1] : undefined; |
|
1263 |
|
1264 // If no arguments are to be appended, return original URL. |
598 // If no arguments are to be appended, return original URL. |
1265 if (!args || !Object.keys(args).length) { |
599 if (!args || !Object.keys(args).length) { |
1266 return url; |
600 return url; |
1267 } |
601 } |
1268 |
602 |
1269 var baseUrl = url; // Determine whether URL already had query arguments. |
603 let baseUrl = url; // Determine whether URL already had query arguments. |
1270 |
604 |
1271 var queryStringIndex = url.indexOf('?'); |
605 const queryStringIndex = url.indexOf('?'); |
1272 |
606 |
1273 if (queryStringIndex !== -1) { |
607 if (queryStringIndex !== -1) { |
1274 // Merge into existing query arguments. |
608 // Merge into existing query arguments. |
1275 args = Object.assign(Object(lib["parse"])(url.substr(queryStringIndex + 1)), args); // Change working base URL to omit previous query arguments. |
609 args = Object.assign(getQueryArgs(url), args); // Change working base URL to omit previous query arguments. |
1276 |
610 |
1277 baseUrl = baseUrl.substr(0, queryStringIndex); |
611 baseUrl = baseUrl.substr(0, queryStringIndex); |
1278 } |
612 } |
1279 |
613 |
1280 return baseUrl + '?' + Object(lib["stringify"])(args); |
614 return baseUrl + '?' + buildQueryString(args); |
1281 } |
615 } |
1282 |
616 |
1283 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-arg.js |
617 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-arg.js |
1284 /** |
618 /** |
1285 * External dependencies |
619 * Internal dependencies |
1286 */ |
620 */ |
1287 |
|
1288 /* eslint-disable jsdoc/valid-types */ |
|
1289 |
621 |
1290 /** |
622 /** |
1291 * @typedef {{[key: string]: QueryArgParsed}} QueryArgObject |
623 * @typedef {{[key: string]: QueryArgParsed}} QueryArgObject |
1292 */ |
624 */ |
1293 |
|
1294 /* eslint-enable */ |
|
1295 |
625 |
1296 /** |
626 /** |
1297 * @typedef {string|string[]|QueryArgObject} QueryArgParsed |
627 * @typedef {string|string[]|QueryArgObject} QueryArgParsed |
1298 */ |
628 */ |
1299 |
629 |
1306 * @example |
636 * @example |
1307 * ```js |
637 * ```js |
1308 * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar |
638 * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar |
1309 * ``` |
639 * ``` |
1310 * |
640 * |
1311 * @return {QueryArgParsed|undefined} Query arg value. |
641 * @return {QueryArgParsed|void} Query arg value. |
1312 */ |
642 */ |
1313 |
643 |
1314 function getQueryArg(url, arg) { |
644 function getQueryArg(url, arg) { |
1315 var queryStringIndex = url.indexOf('?'); |
645 return getQueryArgs(url)[arg]; |
1316 var query = queryStringIndex !== -1 ? Object(lib["parse"])(url.substr(queryStringIndex + 1)) : {}; |
|
1317 return query[arg]; |
|
1318 } |
646 } |
1319 |
647 |
1320 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/has-query-arg.js |
648 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/has-query-arg.js |
1321 /** |
649 /** |
1322 * Internal dependencies |
650 * Internal dependencies |
1340 return getQueryArg(url, arg) !== undefined; |
668 return getQueryArg(url, arg) !== undefined; |
1341 } |
669 } |
1342 |
670 |
1343 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/remove-query-args.js |
671 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/remove-query-args.js |
1344 /** |
672 /** |
1345 * External dependencies |
673 * Internal dependencies |
1346 */ |
674 */ |
675 |
|
1347 |
676 |
1348 /** |
677 /** |
1349 * Removes arguments from the query string of the url |
678 * Removes arguments from the query string of the url |
1350 * |
679 * |
1351 * @param {string} url URL. |
680 * @param {string} url URL. |
1357 * ``` |
686 * ``` |
1358 * |
687 * |
1359 * @return {string} Updated URL. |
688 * @return {string} Updated URL. |
1360 */ |
689 */ |
1361 |
690 |
1362 function removeQueryArgs(url) { |
691 function removeQueryArgs(url, ...args) { |
1363 var queryStringIndex = url.indexOf('?'); |
692 const queryStringIndex = url.indexOf('?'); |
1364 var query = queryStringIndex !== -1 ? Object(lib["parse"])(url.substr(queryStringIndex + 1)) : {}; |
693 |
1365 var baseUrl = queryStringIndex !== -1 ? url.substr(0, queryStringIndex) : url; |
694 if (queryStringIndex === -1) { |
1366 |
695 return url; |
1367 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
696 } |
1368 args[_key - 1] = arguments[_key]; |
697 |
1369 } |
698 const query = getQueryArgs(url); |
1370 |
699 const baseURL = url.substr(0, queryStringIndex); |
1371 args.forEach(function (arg) { |
700 args.forEach(arg => delete query[arg]); |
1372 return delete query[arg]; |
701 const queryString = buildQueryString(query); |
1373 }); |
702 return queryString ? baseURL + '?' + queryString : baseURL; |
1374 return baseUrl + '?' + Object(lib["stringify"])(query); |
|
1375 } |
703 } |
1376 |
704 |
1377 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-http.js |
705 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-http.js |
1378 /** |
706 /** |
1379 * Internal dependencies |
707 * Internal dependencies |
1380 */ |
708 */ |
1381 |
709 |
1382 var USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i; |
710 const USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i; |
1383 /** |
711 /** |
1384 * Prepends "http://" to a url, if it looks like something that is meant to be a TLD. |
712 * Prepends "http://" to a url, if it looks like something that is meant to be a TLD. |
1385 * |
713 * |
1386 * @param {string} url The URL to test. |
714 * @param {string} url The URL to test. |
1387 * |
715 * |
1449 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/filter-url-for-display.js |
777 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/filter-url-for-display.js |
1450 /** |
778 /** |
1451 * Returns a URL for display. |
779 * Returns a URL for display. |
1452 * |
780 * |
1453 * @param {string} url Original URL. |
781 * @param {string} url Original URL. |
782 * @param {number|null} maxLength URL length. |
|
1454 * |
783 * |
1455 * @example |
784 * @example |
1456 * ```js |
785 * ```js |
1457 * const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg |
786 * const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg |
787 * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png |
|
1458 * ``` |
788 * ``` |
1459 * |
789 * |
1460 * @return {string} Displayed URL. |
790 * @return {string} Displayed URL. |
1461 */ |
791 */ |
1462 function filterURLForDisplay(url) { |
792 function filterURLForDisplay(url, maxLength = null) { |
1463 // Remove protocol and www prefixes. |
793 // Remove protocol and www prefixes. |
1464 var filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it. |
794 let filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it. |
1465 |
795 |
1466 if (filteredURL.match(/^[^\/]+\/$/)) { |
796 if (filteredURL.match(/^[^\/]+\/$/)) { |
1467 return filteredURL.replace('/', ''); |
797 filteredURL = filteredURL.replace('/', ''); |
1468 } |
798 } |
1469 |
799 |
1470 return filteredURL; |
800 const mediaRegexp = /([\w|:])*\.(?:jpg|jpeg|gif|png|svg)/; |
1471 } |
801 |
1472 |
802 if (!maxLength || filteredURL.length <= maxLength || !filteredURL.match(mediaRegexp)) { |
1473 // EXTERNAL MODULE: external {"this":"lodash"} |
803 return filteredURL; |
1474 var external_this_lodash_ = __webpack_require__(2); |
804 } // If the file is not greater than max length, return last portion of URL. |
805 |
|
806 |
|
807 filteredURL = filteredURL.split('?')[0]; |
|
808 const urlPieces = filteredURL.split('/'); |
|
809 const file = urlPieces[urlPieces.length - 1]; |
|
810 |
|
811 if (file.length <= maxLength) { |
|
812 return '…' + filteredURL.slice(-maxLength); |
|
813 } // If the file is greater than max length, truncate the file. |
|
814 |
|
815 |
|
816 const index = file.lastIndexOf('.'); |
|
817 const [fileName, extension] = [file.slice(0, index), file.slice(index + 1)]; |
|
818 const truncatedFile = fileName.slice(-3) + '.' + extension; |
|
819 return file.slice(0, maxLength - truncatedFile.length - 1) + '…' + truncatedFile; |
|
820 } |
|
821 |
|
822 // EXTERNAL MODULE: external "lodash" |
|
823 var external_lodash_ = __webpack_require__("YLtl"); |
|
1475 |
824 |
1476 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/clean-for-slug.js |
825 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/clean-for-slug.js |
1477 /** |
826 /** |
1478 * External dependencies |
827 * External dependencies |
1479 */ |
828 */ |
1498 function cleanForSlug(string) { |
847 function cleanForSlug(string) { |
1499 if (!string) { |
848 if (!string) { |
1500 return ''; |
849 return ''; |
1501 } |
850 } |
1502 |
851 |
1503 return Object(external_this_lodash_["trim"])(Object(external_this_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\w-]+/g, '').toLowerCase(), '-'); |
852 return Object(external_lodash_["trim"])(Object(external_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\w-]+/g, '').toLowerCase(), '-'); |
1504 } |
853 } |
1505 |
854 |
1506 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/index.js |
855 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/index.js |
1507 |
856 |
1508 |
857 |
1526 |
875 |
1527 |
876 |
1528 |
877 |
1529 |
878 |
1530 |
879 |
880 |
|
881 |
|
1531 /***/ }) |
882 /***/ }) |
1532 |
883 |
1533 /******/ }); |
884 /******/ }); |