PageSourceSearch

https://oisehalatte-tourisme.eu/app/plugins/searchwp-live-ajax-sea…/assets/javascript/dist/script.js?ver=1.8.8

js oisehalatte-tourisme.eu collected 2026-10-02 19:10:19 UTC 26,836 bytes, 691 lines download raw bytes

vendor: 7,060 bytes, lines 1-183
1(function () {
2    'use strict';
3
4    var __assign = (window && window.__assign) || function () {
5        __assign = Object.assign || function(t) {
6            for (var s, i = 1, n = arguments.length; i < n; i++) {
7                s = arguments[i];
8                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9                    t[p] = s[p];
10            }
11            return t;
12        };
13        return __assign.apply(this, arguments);
14    };
15    var defaults = {
16        lines: 12,
17        length: 7,
18        width: 5,
19        radius: 10,
20        scale: 1.0,
21        corners: 1,
22        color: '#000',
23        fadeColor: 'transparent',
24        animation: 'spinner-line-fade-default',
25        rotate: 0,
26        direction: 1,
27        speed: 1,
28        zIndex: 2e9,
29        className: 'spinner',
30        top: '50%',
31        left: '50%',
32        shadow: '0 0 1px transparent', // prevent aliased lines
33        position: 'absolute',
34    };
35    var Spinner = /** @class */ (function () {
36        function Spinner(opts) {
37            if (opts === void 0) { opts = {}; }
38            this.opts = __assign(__assign({}, defaults), opts);
39        }
40        /**
41         * Adds the spinner to the given target element. If this instance is already
42         * spinning, it is automatically removed from its previous target by calling
43         * stop() internally.
44         */
45        Spinner.prototype.spin = function (target) {
46            this.stop();
47            this.el = document.createElement('div');
48            this.el.className = this.opts.className;
49            this.el.setAttribute('role', 'progressbar');
50            this.el.style.position = this.opts.position;
51            this.el.style.width = "0";
52            this.el.style.zIndex = this.opts.zIndex.toString();
53            this.el.style.left = this.opts.left;
54            this.el.style.top = this.opts.top;
55            this.el.style.transform = "scale(".concat(this.opts.scale, ")");
56            if (target) {
57                target.insertBefore(this.el, target.firstChild || null);
58            }
59            drawLines(this.el, this.opts);
60            return this;
61        };
62        /**
63         * Stops and removes the Spinner.
64         * Stopped spinners may be reused by calling spin() again.
65         */
66        Spinner.prototype.stop = function () {
67            if (this.el) {
68                if (this.el.parentNode) {
69                    this.el.parentNode.removeChild(this.el);
70                }
71                this.el = undefined;
72            }
73            return this;
74        };
75        return Spinner;
76    }());
77    /**
78     * Returns the line color from the given string or array.
79     */
80    function getColor(color, idx) {
81        return typeof color == 'string' ? color : color[idx % color.length];
82    }
83    /**
84     * Internal method that draws the individual lines.
85     */
86    function drawLines(el, opts) {
87        var borderRadius = (Math.round(opts.corners * opts.width * 500) / 1000) + 'px';
88        var shadow = 'none';
89        if (opts.shadow === true) {
90            shadow = '0 2px 4px #000'; // default shadow
91        }
92        else if (typeof opts.shadow === 'string') {
93            shadow = opts.shadow;
94        }
95        var shadows = parseBoxShadow(shadow);
96        for (var i = 0; i < opts.lines; i++) {
97            var degrees = ~~(360 / opts.lines * i + opts.rotate);
98            var backgroundLine = document.createElement('div');
99            backgroundLine.style.position = 'absolute';
100            backgroundLine.style.top = "".concat(-opts.width / 2, "px");
101            backgroundLine.style.width = (opts.length + opts.width) + 'px';
102            backgroundLine.style.height = opts.width + 'px';
103            backgroundLine.style.background = getColor(opts.fadeColor, i);
104            backgroundLine.style.borderRadius = borderRadius;
105            backgroundLine.style.transformOrigin = 'left';
106            backgroundLine.style.transform = "rotate(".concat(degrees, "deg) translateX(").concat(opts.radius, "px)");
107            var delay = i * opts.direction / opts.lines / opts.speed;
108            delay -= 1 / opts.speed; // so initial animation state will include trail
109            var line = document.createElement('div');
110            line.style.width = '100%';
111            line.style.height = '100%';
112            line.style.background = getColor(opts.color, i);
113            line.style.borderRadius = borderRadius;
114            line.style.boxShadow = normalizeShadow(shadows, degrees);
115            line.style.animation = "".concat(1 / opts.speed, "s linear ").concat(delay, "s infinite ").concat(opts.animation);
116            backgroundLine.appendChild(line);
117            el.appendChild(backgroundLine);
118        }
119    }
120    function parseBoxShadow(boxShadow) {
121        var regex = /^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/;
122        var shadows = [];
123        for (var _i = 0, _a = boxShadow.split(','); _i < _a.length; _i++) {
124            var shadow = _a[_i];
125            var matches = shadow.match(regex);
126            if (matches === null) {
127                continue; // invalid syntax
128            }
129            var x = +matches[2];
130            var y = +matches[5];
131            var xUnits = matches[4];
132            var yUnits = matches[7];
133            if (x === 0 && !xUnits) {
134                xUnits = yUnits;
135            }
136            if (y === 0 && !yUnits) {
137                yUnits = xUnits;
138            }
139            if (xUnits !== yUnits) {
140                continue; // units must match to use as coordinates
141            }
142            shadows.push({
143                prefix: matches[1] || '', // could have value of 'inset' or undefined
144                x: x,
145                y: y,
146                xUnits: xUnits,
147                yUnits: yUnits,
148                end: matches[8],
149            });
150        }
151        return shadows;
152    }
153    /**
154     * Modify box-shadow x/y offsets to counteract rotation
155     */
156    function normalizeShadow(shadows, degrees) {
157        var normalized = [];
158        for (var _i = 0, shadows_1 = shadows; _i < shadows_1.length; _i++) {
159            var shadow = shadows_1[_i];
160            var xy = convertOffset(shadow.x, shadow.y, degrees);
161            normalized.push(shadow.prefix + xy[0] + shadow.xUnits + ' ' + xy[1] + shadow.yUnits + shadow.end);
162        }
163        return normalized.join(', ');
164    }
165    function convertOffset(x, y, degrees) {
166        var radians = degrees * Math.PI / 180;
167        var sin = Math.sin(radians);
168        var cos = Math.cos(radians);
169        return [
170            Math.round((x * cos + y * sin) * 1000) / 1000,
171            Math.round((-x * sin + y * cos) * 1000) / 1000,
172        ];
173    }
174
175    ( function () {
176    	var plugin_name = "searchwp_live_search";
177
178    	function SearchwpLiveSearch( element ) {
179    		this.config = null;
180
181    		// Internal properties.
182    		this.input_el                = element; // the input element itself.
183    		this.results_id              = null;    // the id attribute of the results wrapper for this search f
183ield.
184    		this.results_el              = null;    // the results wrapper element itself.
185    		this.parent_el               = null;    // allows results wrapper element to be injected into a custom parent element.
186    		this.results_showing         = false;   // whether the results are showing.
187    		this.form_el                 = null;    // the search form element itself.
188    		this.timer                   = false;   // powers the delay check.
189    		this.last_string             = '';      // the last search string submitted.
190    		this.spinner                 = null;    // the spinner.
191    		this.spinner_showing         = false;   // whether the spinner is showing.
192    		this.has_results             = false;   // whether results are showing.
193    		this.current_request         = false;   // the current request in progress.
194    		this.results_destroy_on_blur = true;    // destroy the results.
195    		this.a11y_keys               = [ 27, 40, 13, 38, 9 ]; // list of keyCode used for a11y.
196
197    		// Kick it off!
198    		this.init();
199    	}
200
201    	SearchwpLiveSearch.prototype = {
202
203    		// Prep the field and form.
204    		init: function () {
205    			var self        = this,
206    				$input      = this.input_el;
207    			this.form_el    = $input.parents( 'form:eq(0)' );
208    			this.results_id = this.uniqid( 'searchwp_live_search_results_' );
209
210    			// Establish our config (e.g. allow developers to override the config based on the value of the swpconfig data attribute).
211    			var valid_config    = false;
212    			var config_template = $input.data( 'swpconfig' );
213
214    			if ( config_template && typeof config_template !== 'undefined' ) {
215    				// Loop through all available configs.
216    				for ( var config_key in searchwp_live_search_params.config ) {
217    					if ( config_template === config_key ) {
218    						valid_config = true;
219    						this.config  = searchwp_live_search_params.config[config_key];
220    					}
221    				}
222    			} else {
223    				// Use the default.
224    				for ( var default_key in searchwp_live_search_params.config ) {
225    					if ( 'default' === default_key ) {
226    						valid_config = true;
227    						this.config  = searchwp_live_search_params.config[default_key];
228    					}
229    				}
230    			}
231
232    			// If there wasn't a valid config found, alert() it because everything will break.
233    			if ( ! valid_config ) {
234    				alert( searchwp_live_search_params.msg_no_config_found );
235    			} else {
236    				// Allow the swpengine data attribute to override the engine set in the config (prevents new configs just to change engine).
237    				var engine = $input.data( 'swpengine' );
238    				if ( ! engine ) {
239    					engine = this.config.engine;
240    				}
241
242    				$input.data( 'swpengine', engine );
243
244    				// Prevent autocomplete.
245    				$input.attr( 'autocomplete','off' );
246
247    				// #a11y: ARIA attributes
248    				$input.attr( 'aria-owns', this.results_id );
249    				$input.attr( 'aria-autocomplete', 'both' );
250    				$input.attr( 'aria-label', searchwp_live_search_params.aria_instructions );
251
252    				// Set up and position the results' container.
253    				var results_el_html = '<div aria-expanded="false" class="searchwp-live-search-results" id="' + this.results_id + '" tabindex="0"></div>';
254
255    				// If parent_el was specified, inject the results el into it instead of appending it to the body.
256    				var swpparentel = $input.data( 'swpparentel' );
257    				if ( swpparentel ) {
258    					// Specified as a data property on the html input.
259    					this.parent_el = jQuery( swpparentel );
260    					this.parent_el.append( results_el_html );
261    				} else if (this.config.parent_el) {
262    					// Specified by the config set in php.
263    					this.parent_el = jQuery( this.config.parent_el );
264    					this.parent_el.append( results_el_html );
265    				} else {
266    					// No parent, just append to the body.
267    					jQuery( 'body' ).append( jQuery( results_el_html ) );
268    				}
269
270    				this.results_el = jQuery( '#' + this.results_id );
271    				this.position_results();
272    				jQuery( window ).on(
273    					'resize',
274    					function () {
275    						self.position_results();
276    					}
277    				);
278
279    				// Prep the spinner.
280    				if ( this.config.spinner ) {
281    					// Version 1.4 added some new configuration options that may not be included
282    					// if the configuration was configured for an earlier version, so we need
283    					// to check for these new values and re-set them if necessary.
284    					if ( typeof this.config.spinner.scale === 'undefined' ) {
285    						this.config.spinner.scale = 1;
286    					}
287    					if ( typeof this.config.spinner.fadeColor === 'undefined' ) {
288    						this.config.spinner.fadeColor = 'transparent';
289    					}
290    					if ( typeof this.config.spinner.animation === 'undefined' ) {
291    						this.config.spinner.animation = 'searchwp-spinner-line-fade-quick';
292    					}
293    					if ( typeof this.config.spinner.position === 'undefined' ) {
294    						this.config.spinner.position = 'absolute';
295    					}
296
297    					this.spinner = new Spinner( this.config.spinner );
298    				}
299
300    				if ( typeof this.config.abort_on_enter === 'undefined' ) {
301    					this.config.abort_on_enter = true;
302    				}
303
304    				// Bind to keyup.
305    				$input.on(
306    					'keyup',
307    					function ( e ) {
308    						if ( jQuery.inArray( e.keyCode, self.a11y_keys ) > -1 ) {
309    							return;
310    						}
311    						// is there already a request active?
312    						if ( self.current_request && ( self.config.abort_on_enter && e.keyCode === 13 ) ) {
313    							self.current_request.abort();
314    						}
315    						if ( ! self.input_el.val().trim().length ) {
316    							self.destroy_results();
317    						} else if ( ! self.results_showing ) {
318    							// If the user typed, show the results wrapper and spinner.
319    							self.position_results();
320    							self.results_el.addClass( 'searchwp-live-search-results-showing' ).attr( 'role', 'listbox' );
321    							self.show_spinner();
322    							self.results_showing = true;
323    						}
324    						// If there are already results on display and the user is changing the search string,
325    						// remove the existing results and show the spinner.
326    						if ( self.has_results && ! self.spinner_showing && self.last_string !== self.input_el.val().trim() ) {
327    							self.results_el.empty();
328    							self.show_spinner();
329    						}
330
331    						// Capture whether minimum characters have been entered.
332    						if ( e.currentTarget.value.length >= self.config.input.min_chars ) {
333    							self.results_el.removeClass( 'searchwp-live-search-no-min-chars' );
334    						} else {
335    							self.results_el.addClass( 'searchwp-live-search-no-min-chars' );
336    						}
337    						self.position_results();
338    					}
339    				).on(
340    					'keyup',
341    					jQuery.proxy( this.maybe_search, this )
342    				);
343
344    				// Destroy the results when input focus is lost.
345    				if ( this.config.results_destroy_on_blur || typeof this.config.results_destroy_on_blur === 'undefined' ) {
346    					jQuery( 'html' ).on(
347    						'click',
348    						function ( e ) {
349    							// Only destroy the results if the click was placed outside the results' element.
350    							if ( ! jQuery( e.target ).parents( '.searchwp-live-search-results' ).length ) {
351    								self.destroy_results();
352    							}
353    						}
354    					);
355    				}
356    				$input.on(
357    					'click',
358    					function ( e ) {
359    						e.stopPropagation();
360    					}
361    				);
362    			}
363    		},
364
365    		keyboard_navigation: function () {
366    			var self          = this,
367    				$input        = this.input_el,
368    				$results      = this.results_el,
369    				focused_class = 'searchwp-live-search-result--focused',
370    				item_class    = '.searchwp-live-search-result',
371    				a11y_keys     = this.a11y_keys;
372
373    			jQuery( document ).off( 'keyup.searchwp_a11y' ).on(
374    				'keyup.searchwp_a11y',
375    				function ( e ) {
376
377    					// If results are not displayed, don't bind keypress.
378    					if ( ! $results.hasClass( 'searchwp-live-search-results-showing' ) ) {
379    						jQuery( document ).off( 'keyup.searchwp_a11y' );
380    						return;
381    					}
382
383    					// If key pressed doesn't match our a11y keys list do nothing.
384    					if ( jQuery.inArray( e.keyCode, a11y_keys ) === -1 ) {
385    						return;
386    					}
387
388    					e.preventDefault();
389
390    					// On `esc` keypress.
391    					if ( e.keyCode === 27 ) {
392
393    						self.destroy_results();
394
395    						// Unbind keypress.
396    						jQuery( document ).off( 'keyup.searchwp_a11y' );
397
398    						// Get back the focus on input search.
399    						$input.focus();
400
401    						jQuery( document ).trigger( 'searchwp_live_escape_results' );
402
403    						return;
404    					}
405
406    					// On `down` arrow keypress.
407    					if ( e.keyCode === 40 ) {
408    						var $current = jQuery( $results[0] ).find( '.' + focused_class );
409    						if ( $current.length === 1 && $current.next().length === 1 ) {
410    							$current.removeClass( focused_class ).attr( 'aria-selected', 'false' )
411    									.next().addClass( focused_class ).attr( 'aria-selected', 'true' )
412    									.find( 'a' ).focus();
413    						} else {
414    							$current.removeClass( focused_class ).attr( 'aria-selected', 'false' );
415    							$results.find( item_class + ':first' ).addClass( focused_class ).attr( 'aria-selected', 'true' )
416    									.find( 'a' ).focus();
417    						}
418    						jQuery( document ).trigger( 'searchwp_live_key_arrowdown_pressed' );
419    					}
420
421    					// On `up` arrow keypress.
422    					if ( e.keyCode === 38 ) {
423    						var $currentItem = jQuery( $results[0] ).find( '.' + focused_class );
424    						if ( $currentItem.length === 1 && $currentItem.prev().length === 1 ) {
425    							$currentItem.removeClass( focused_class ).attr( 'aria-selected', 'false' )
426    									.prev().addClass( focused_class ).attr( 'aria-selected', 'true' )
427    									.find( 'a' ).focus();
428    						} else {
429    							$currentItem.removeClass( focused_class ).attr( 'aria-selected', 'false' );
430    							$results.find( item_class + ':last' ).addClass( focused_class ).attr( 'aria-selected', 'true' )
431    									.find( 'a' ).focus();
432    						}
433    						jQuery( document ).trigger( 'searchwp_live_key_arrowup_pressed' );
434    					}
435
436    					// On 'enter' keypress.
437    					if ( e.keyCode === 13 ) {
438    						jQuery( document ).trigger( 'searchwp_live_key_enter_pressed' );
439    					}
440
441    					// On 'tab' keypress.
442    					if ( e.keyCode === 9 ) {
443    						jQuery( document ).trigger( 'searchwp_live_key_tab_pressed' );
444    					}
445    				}
446    			);
447
448    			jQuery( document ).trigger( 'searchwp_live_keyboad_navigation' );
449    		},
450
451    		aria_expanded: function ( is_expanded ) {
452    			var $resultsEl = this.results_el;
453
454    			if ( is_expanded ) {
455    				$resultsEl.attr( 'aria-expanded', 'true' );
456    			} else {
457    				$resultsEl.attr( 'aria-expanded', 'false' );
458    			}
459
460    			jQuery( document ).trigger( 'searchwp_live_aria_expanded' );
461    		},
462
463    		position_results: function () {
464    			var $input                  = this.input_el,
465    				$parent_form            = $input.parents( 'form:eq(0)' ),
466    				$input_wrapper		    = $input.parents( '.wp-block-search__inside-wrapper' ),
467    				isGutenbergButtonInside = $parent_form.hasClass( 'wp-block-search__button-inside' ),
468    				$results                = this.results_el,
469    				input_offset	        = {},
470    				results_top_offset      = 0;
471
472    			// Don't try to position a results element when the input field is hidden.
473    			if ( $input.is( ':hidden' ) ) {
474    				return;
475    			}
476
477    			// If this is a Gutenberg search block and the button is placed inside, we need to position the results relative to the input parent.
478    			if ( $input_wrapper.length && isGutenbergButtonInside ) {
479    				$input = $input_wrapper;
480    			}
481
482    			input_offset = $input.offset();
483
484    			// Check for an offset.
485    			input_offset.left += parseInt( this.config.results.offset.x,10 );
486    			input_offset.top  += parseInt( this.config.results.offset.y,10 );
487
488    			// Position the results' container.
489    			switch ( this.config.results.position ) {
490    				case 'top':
491    					results_top_offset = 0 - $results.height();
492    					break;
493    				default:
494    					results_top_offset = $input.outerHeight();
495    			}
496
497    			// Apply the offset and finalize the position.
498    			$results.css( 'left',input_offset.left );
499    			$results.css( 'top', ( input_offset.top + results_top_offset ) + 'px' );
500    			if ( 'auto' === this.config.results.width ) {
501    				$results.width( $input.outerWidth() - parseInt( $results.css( 'paddingRight' ).replace( 'px', '' ),10 ) - parseInt( $results.css( 'paddingLeft' ).replace( 'px', '' ),10 ) );
502    			}
503
504    			jQuery( document ).trigger( 'searchwp_live_position_results', [ $results.css( 'left' ), $results.css( 'top' ), $results.width() ] );
505    		},
506
507    		destroy_results: function ( e ) {
508    			this.hide_spinner();
509    			this.aria_expanded( false );
510    			this.results_el.empty().removeClass( 'searchwp-live-search-results-showing' );
511    			this.results_el.removeAttr( 'role' );
512    			this.results_showing = false;
513    			this.has_results     = false;
514
515    			jQuery( document ).trigger( 'searchwp_live_destroy_results' );
516    		},
517
518    		// If the search value changed, we've waited long enough, and we have at least the minimum characters: search!
519    		maybe_search: function ( e ) {
520    			// If key pressed doesn't match our a11y keys list do nothing.
521    			if ( jQuery.inArray( e.keyCode, this.a11y_keys ) > -1 ) {
522    				return;
523    			}
524    			clearTimeout( this.timer );
525    			if ( e.currentTarget.value.length >= this.config.input.min_chars ) {
526    				if (this.current_request) {
527    					this.current_request.abort();
528    				}
529    				this.timer = setTimeout(
530    					jQuery.proxy( this.search, this, e ),
531    					this.config.input.delay
532    				);
533    			}
534    		},
535
536    		show_spinner: function () {
537    			if ( this.config.spinner && ! this.spinner_showing ) {
538    				this.spinner.spin( document.getElementById( this.results_id ) );
539    				this.spinner_showing = true;
540    				jQuery( document ).trigger( 'searchwp_live_show_spinner' );
541    			}
542    		},
543
544    		hide_spinner: function () {
545    			if ( this.config.spinner ) {
546    				this.spinner.stop();
547    				this.spinner_showing = false;
548    				jQuery( document ).trigger( 'searchwp_live_hide_spinner' );
549    			}
550    		},
551
552    		// Perform the search.
553    		search: function ( e ) {
554    			var self     = this,
555    				$form    = this.form_el,
556    				values   = $form.serialize(),
557    				action   = $form.attr( 'action' ) ? $form.attr( 'action' ) : '',
558    				$input   = this.input_el,
559    				$results = this.results_el;
560
561    			jQuery( document ).trigger( 'searchwp_live_search_start', [ $input, $results, $form, action, values ] );
562
563    			this.aria_expanded( false );
564
565    			// Append our action, engine, and (redundant) query (to save the trouble of finding it again server side).
566    			values += '&action=searchwp_live_search&swpengine=' + $input.data( 'swpengine' );
567    			values += '&swpquery=' + encodeURIComponent( $input.val() );
568    			values += '&origin_id=' + parseInt( searchwp_live_search_params.origin_id,10 );
569
570    			if ( action.indexOf( '?' ) !== -1 ) {
571    				action  = action.split( '?' );
572    				values += '&' + action[1];
573    			}
574
575    			this.last_string = $input.val();
576    			this.has_results = true;
577    			// Put the request into the current_request var.
578    			this.current_request = jQuery.ajax(
579    				{
580    					url: searchwp_live_search_params.ajaxurl,
581    					type: "GET",
582    					data: values,
583    					complete: function () {
584    						jQuery( document ).trigger( 'searchwp_live_search_complete', [ $input, $results, $form, action, values ] );
585    						self.spinner_showing = false;
586    						// Self.hide_spinner().
587    						this.current_request = false;
588    						jQuery( document ).trigger( 'searchwp_live_search_shutdown', [ $input, $results, $form, action, values ] );
589    					},
590    					success: function ( response ) {
591    						if ( response === 0 ) {
592    							response = "";
593    						}
594    						jQuery( document ).trigger( 'searchwp_live_search_success', [ $input, $results, $form, action, values ] );
595    						$results.html( response );
596    						self.position_results();
597    						self.aria_expanded( true );
598    						self.keyboard_navigation();
599    						jQuery( document ).trigger( 'searchwp_live_search_shutdown', [ $input, $results, $form, action, values ] );
600    					}
601    				}
602    			);
603    		},
604
605    		uniqid: function ( prefix, more_entropy ) {
606    			// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
607    			// +    revised by: Kankrelune (http://www.webfaktory.info/)
608    			// %        note 1: Uses an internal counter (in php_js global) to avoid collision
609    			// *     example 1: uniqid();
610    			// *     returns 1: 'a30285b160c14'
611    			// *     example 2: uniqid('foo');
612    			// *     returns 2: 'fooa30285b1cd361'
613    			// *     example 3: uniqid('bar', true);
614    			// *     returns 3: 'bara20285b23dfd1.31879087'
615    			if (typeof prefix === 'undefined') {
616    				prefix = "";
617    			}
618
619    			var retId;
620    			var formatSeed = function ( seed, reqWidth ) {
621    				seed = parseInt( seed, 10 ).toString( 16 ); // To hex str.
622    				if ( reqWidth < seed.length ) { // So long we split.
623    					return seed.slice( seed.length - reqWidth );
624    				}
625    				if ( reqWidth > seed.length ) { // So short we pad.
626    					return new Array( 1 + ( reqWidth - seed.length ) ).join( '0' ) + seed;
627    				}
628    				return seed;
629    			};
630
631    			// BEGIN REDUNDANT.
632    			if ( ! this.php_js ) {
633    				this.php_js = {};
634    			}
635    			// END REDUNDANT.
636    			if ( ! this.php_js.uniqidSeed ) { // Init seed with big random int.
637    				this.php_js.uniqidSeed = Math.floor( Math.random() * 0x75bcd15 );
638    			}
639    			this.php_js.uniqidSeed++;
640
641    			retId  = prefix; // Start with prefix, add current milliseconds hex string.
642    			retId += formatSeed( parseInt( new Date().getTime() / 1000, 10 ), 8 );
643    			retId += formatSeed( this.php_js.uniqidSeed, 5 ); // Add seed hex string.
644    			if ( more_entropy ) {
645    				// For more entropy we add a float lower to 10.
646    				retId += ( Math.random() * 10 ).toFixed( 8 ).toString();
647    			}
648
649    			return retId;
650    		}
651    	};
652
653    	jQuery.fn[plugin_name] = function ( options ) {
654    		this.each(
655    			function () {
656    				if ( ! jQuery.data( this, "plugin_" + plugin_name ) ) {
657    					jQuery.data( this, "plugin_" + plugin_name, new SearchwpLiveSearch( jQuery( this )) );
658    				}
659    			}
660    		);
661
662    		// Chain jQuery functions.
663    		return this;
664    	};
665    })();
666
667    // Find all applicable SearchWP Live Search inputs and bind them.
668    jQuery( document ).ready(
669    	function () {
670    		if ( typeof jQuery().searchwp_live_search == 'function' ) {
671    			jQuery( 'input[data-swplive="true"]' ).searchwp_live_search();
672
673    			// The Gutenberg integration is based on a body class addition because we don't have the
674    			// ability to manipulate the markup as we do with get_search_form().
675    			if ( typeof _SEARCHWP_LIVE_AJAX_SEARCH_BLOCKS !== 'undefined' && _SEARCHWP_LIVE_AJAX_SEARCH_BLOCKS ) {
676    				jQuery( 'input.wp-block-search__input' ).each(
677    					function () {
678    						// Append data vars.
679    						jQuery( this ).attr( 'data-swpengine', _SEARCHWP_LIVE_AJAX_SEARCH_ENGINE );
680    						jQuery( this ).attr( 'data-swpconfig', _SEARCHWP_LIVE_AJAX_SEARCH_CONFIG );
681
682    						// Init live search.
683    						jQuery( this ).searchwp_live_search();
684    					}
685    				);
686    			}
687    		}
688    	}
689    );
690
691})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.