PageSourceSearch

https://aromafragrance.us/wp-content/plugins/woocommerce-tm-extra-product-options/assets/js/tm-math.js?ver=7.2

js aromafragrance.us collected 2026-10-09 22:05:58 UTC 39,863 bytes, 1,393 lines download raw bytes

1
2/*jshint esversion: 6 */
3( function( window ) {
4	'use strict';
5
6	var empty = function( mixedVar ) {
7		var undef;
8		var key;
9		var i;
10		var len;
11		var emptyValues = [ undef, null, false, 0, '', '0' ];
12		for ( i = 0, len = emptyValues.length; i < len; i++ ) {
13			if ( mixedVar === emptyValues[ i ] ) {
14				return true;
15			}
16		}
17		if ( typeof mixedVar === 'object' ) {
18			for ( key in mixedVar ) {
19				if ( mixedVar.hasOwnProperty( key ) ) {
20					return false;
21				}
22			}
23			return true;
24		}
25		return false;
26	};
27
28	var array_key_exists = function( key, search ) {
29		if ( ! search || ( search.constructor !== Array && search.constructor !== Object ) ) {
30			return false;
31		}
32		return key in search;
33	};
34
35	var getNumberOfParameters = function( func ) {
36		const ARROW = true;
37		const FUNC_ARGS = ARROW ? /^(function)?\s*[^\(]*\(\s*([^\)]*)\)/m : /^(function)\s*[^\(]*\(\s*([^\)]*)\)/m;
38		const FUNC_ARG_SPLIT = /,/;
39		const FUNC_ARG = /^\s*(_?)(.+?)\1\s*$/;
40		const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
41
42		return ( ( func || '' )
43			.toString()
44			.replace( STRIP_COMMENTS, '' )
45			.match( FUNC_ARGS ) || [ '', '', '' ] )[ 2 ]
46			.split( FUNC_ARG_SPLIT )
47			.map( function( arg ) {
48				return arg.replace( FUNC_ARG, function( all, underscore, name ) {
49					return name.split( '=' )[ 0 ].trim();
50				} );
51			} )
52			.filter( String )
53			.length;
54	};
55
56	var getNumberOfRequiredParameters = function( func ) {
57		return func.length;
58	};
59
60	var is_scalar = function( mixedVar ) {
61		return ( /boolean|number|string/ ).test( typeof mixedVar );
62	};
63
64	var gettype = function( obj ) {
65		return window.jQuery.epoAPI.util.getType( obj );
66	};
67
68	var floatval = function( s, d ) {
69		var n;
70
71		if ( ! ( typeof s === 'string' || typeof s === 'number' ) || isNaN( s ) ) {
72			if ( d !== undefined ) {
73				return d;
74			}
75			return 0;
76		}
77		n = parseFloat( s );
78		if ( isNaN( n ) ) {
79			if ( d !== undefined ) {
80				return d;
81			}
82			return s;
83		}
84
85		return n;
86	};
87
88	var strcmp = function( str1, str2 ) {
89		return ( ( str1 === str2 ) ? 0 : ( ( str1 > str2 ) ? 1 : -1 ) );
90	};
91
92	var bindec = function( binaryString ) {
93		binaryString = ( binaryString + '' ).replace( /[^01]/gi, '' );
94		return parseInt( binaryString, 2 );
95	};
96
97	var decbin = function( number ) {
98		if ( number < 0 ) {
99			number = 0xFFFFFFFF + number + 1;
100		}
101		return parseInt( number, 10 ).toString( 2 );
102	};
103
104	var dechex = function( number ) {
105		if ( number < 0 ) {
106			number = 0xFFFFFFFF + number + 1;
107		}
108		return parseInt( number, 10 ).toString( 16 );
109	};
110
111	var decoct = function( number ) {
112		if ( number < 0 ) {
113			number = 0xFFFFFFFF + number + 1;
114		}
115		return parseInt( number, 10 ).toString( 8 );
116	};
117
118	var deg2rad = function( angle ) {
119		return angle * 0.017453292519943295; // (angle / 180) * Math.PI;
120	};
121
122	var roundWithPrecision = function( num, dec = 0 ) {
123		var num_sign = num >= 0 ? 1 : -1;
124		return dec === 0 ? Math.round( num ) : parseFloat( ( Math.round( ( num * Math.pow( 10, dec ) ) + ( num_sign * 0.0001 ) ) / Math.pow( 10, dec ) ).toFixed( dec ) );
125	};
126
127	var hexdec = function( hexString ) {
128		hexString = ( hexString + '' ).replace( /[^a-f0-9]/gi, '' );
129		return parseInt( hexString, 16 );
130	};
131
132	var octdec = function( octString ) {
133		octString = ( octString + '' ).replace( /[^0-7]/gi, '' );
134		return parseInt( octString, 8 );
135	};
136
137	var hypot = function( x, y ) {
138		var t;
139		x = Math.abs( x );
140		y = Math.abs( y );
141		t = Math.min( x, y );
142		x = Math.max( x, y );
143		t = t / x;
144		return x * Math.sqrt( 1 + ( t * t ) ) || null;
145	};
146
147	var THEMECOMPLETE_EPO_MATH = {
148		variables: {},
149		on_var_not_found: undefined,
150		on_var_validation: undefined,
151		operators: {},
152		functions: {},
153		cache: {},
154		construct: function() {
155			this.add_defaults();
156			this.set_division_by_zero_to_zero();
157			return this;
158		},
159		add_operator: function( $operator ) {
160			this.operators[ $operator.operator ] = $operator;
161			return this;
162		},
163		evaluate: function( $expression, $cache = true ) {
164			return this.execute( $expression, $cache );
165		},
166		parse: function( $expression ) {
167			var $tokens;
168			var result;
169			var $calculator;
170			var count = 0;
171			var char;
172
173			for ( char of $expression ) {
174				if ( char === '(' ) {
175					count++;
176				} else if ( char === ')' ) {
177					count--;
178				}
179
180				// If count becomes negative at any point, return false
181				if ( count < 0 ) {
182					return false;
183				}
184			}
185
186			// If count is not zero at the end, parentheses are not balanced
187			if ( count !== 0 ) {
188				return false;
189			}
190
191			$tokens = new THEMECOMPLETE_EPO_MATH_Tokenizer( $expression, this.operators );
192			$tokens = $tokens.tokenize().build_reverse_polish_notation();
193			$calculator = new THEMECOMPLETE_EPO_MATH_Calculator( this.functions, this.operators );
194
195			result = $calculator.calculate( $tokens, this.variables, this.on_var_not_found, this );
196			if ( 'number' !== gettype( result ) || isNaN( result ) ) {
197				return false;
198			}
199			return result;
200		},
201		execute: function( $expression, $cache = true, $canreturnstring = false ) {
202			var $cache_key = $expression;
203			var $calculator;
204			var $tokens;
205			var result;
206
207			if ( ! array_key_exists( $cache_key, this.cache ) ) {
208				$tokens = new THEMECOMPLETE_EPO_MATH_Tokenizer( $expression, this.operators );
209				$tokens = $tokens.tokenize().build_reverse_polish_notation();
210				if ( $cache ) {
211					this.cache[ $cache_key ] = $tokens;
212				}
213			} else {
214				$tokens = this.cache[ $cache_key ];
215			}
216
217			$calculator = new THEMECOMPLETE_EPO_MATH_Calculator( this.functions, this.operators );
218
219			result = $calculator.calculate( $tokens, this.variables, this.on_var_not_found, this );
220
221			if ( false === $canreturnstring && ( 'number' !== gettype( result ) || isNaN( result ) ) ) {
222				result = 0;
223			}
224
225			return result;
226		},
227		add_function: function( $name, $function ) {
228			this.functions[ $name ] = new THEMECOMPLETE_EPO_MATH_CustomFunction( $name, $function );
229			return this;
230		},
231		get_vars: function() {
232			return this.variables;
233		},
234		get_var: function( $variable ) {
235			if ( ! array_key_exists( $variable, this.variables ) ) {
236				if ( this.on_var_not_found && 'function' === typeof this.on_var_not_found ) {
237					this.on_var_not_found( $variable );
238				}
239				return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Variable (' + $variable + ') not set', 'UnknownVariableError', 0 );
240			}
241			return this.variables[ $variable ];
242		},
243		set_var: function( $variable, $value ) {
244			if ( this.on_var_validation && 'function' === typeof this.on_var_validation ) {
245				$value = this.on_var_validation( $variable, $value );
246			}
247			this.variables[ $variable ] = $value;
248			return this;
249		},
250		var_exists: function( $variable ) {
251			return array_key_exists( $variable, this.variables );
252		},
253		set_vars: function( $variables, $clear = true ) {
254			var $this = this;
255			if ( $clear ) {
256				this.remove_vars();
257			}
258			$variables.forFach( function( $value, $name ) {
259				$this.set_var( $name, $value );
260			} );
261			return this;
262		},
263		set_var_not_found_handler: function( $handler ) {
264			this.on_var_not_found = $handler;
265			return this;
266		},
267		set_var_validation_handler: function( $handler ) {
268			this.on_var_validation = $handler;
269			return this;
270		},
271		remove_var: function( $variable ) {
272			delete this.variables[ $variable ];
273			return this;
274		},
275		remove_vars: function() {
276			this.variables = {};
277			this.on_var_not_found = null;
278			return this;
279		},
280		get_operators: function() {
281			return this.operators;
282		},
283		get_functions: function() {
284			return this.functions;
285		},
286		remove_operator: function( $operator ) {
287			delete this.operators[ $operator ];
288		},
289		set_division_by_zero_to_zero: function() {
290			this.add_operator(
291				new THEMECOMPLETE_EPO_MATH_Operator(
292					'/',
293					false,
294					180,
295					function( $a, $b ) {
296						$a = Number( $a );
297						$b = Number( $b );
298						return 0 == $b ? 0 : $a / $b; // eslint-disable-line eqeqeq
299					}
300				)
301			);
302			return this;
303		},
304		get_cache: function() {
305			return this.cache;
306		},
307		clear_cache: function() {
308			this.cache = [];
309		},
310		add_defaults: function() {
311			var $this = this;
312			var default_operators = this.default_operators();
313			var default_functions = this.default_functions();
314			Object.keys( default_operators ).forEach( function( $name ) {
315				var $operator = default_operators[ $name ];
316				$this.add_operator( new THEMECOMPLETE_EPO_MATH_Operator( $name, $operator[ 2 ], $operator[ 1 ], $operator[ 0 ] ) );
317			} );
318			Object.keys( default_functions ).forEach( function( $name ) {
319				var $callable = default_functions[ $name ];
320				$this.add_function( $name, $callable );
321			} );
322			this.on_var_validation = this.default_var_validation;
323			this.variables = this.default_vars();
324			return this;
325		},
326		default_operators: function() {
327			return {
328				'+': [
329					function( $a, $b ) {
330						$a = floatval( $a, 0 );
331						$b = floatval( $b, 0 );
332						return $a + $b;
333					},
334					170,
335					false
336				],
337				'-': [
338					function( $a, $b ) {
339						$a = floatval( $a, 0 );
340						$b = floatval( $b, 0 );
341						return $a - $b;
342					},
343					170,
344					false
345				],
346				// unary positive token.
347				uPos: [
348					function( $a ) {
349						$a = floatval( $a, 0 );
350						return $a;
351					},
352					200,
353					false
354				],
355				// unary minus token.
356				uNeg: [
357					function( $a ) {
358						$a = floatval( $a, 0 );
359						return 0 - $a;
360					},
361					200,
362					false
363				],
364				'*': [
365					function( $a, $b ) {
366						$a = floatval( $a, 0 );
367						$b = floatval( $b, 0 );
368						return $a * $b;
369					},
370					180,
371					false
372				],
373				'/': [
374					function( $a, $b ) {
375						$a = floatval( $a, 0 );
376						$b = floatval( $b, 0 );
377						if ( empty( $b ) ) {
378							return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Division By Zero', 'DivisionByZeroError', 0 );
379						}
380						return $a / $b;
381					},
382					180,
383					false
384				],
385				'^': [
386					function( $a, $b ) {
387						$a = floatval( $a, 0 );
388						$b = floatval( $b, 0 );
389						return Math.pow( $a, $b );
390					},
391					220,
392					true
393				],
394				'%': [
395					function( $a, $b ) {
396						$a = floatval( $a, 0 );
397						$b = floatval( $b, 0 );
398						return $a % $b;
399					},
400					180,
401					false
402				],
403				'&&': [
404					function( $a, $b ) {
405						$a = String( $a );
406						$b = String( $b );
407						if ( $a.isNumeric() ) {
408							$a = floatval( $a, 0 );
409						}
410						if ( $b.isNumeric() ) {
411							$b = floatval( $b, 0 );
412						}
413						return $a && $b ? 1 : 0;
414					},
415					100,
416					false
417				],
418				'||': [
419					function( $a, $b ) {
420						$a = String( $a );
421						$b = String( $b );
422						if ( $a.isNumeric() ) {
423							$a = floatval( $a, 0 );
424						}
425						if ( $b.isNumeric() ) {
426							$b = floatval( $b, 0 );
427						}
428						return $a || $b ? 1 : 0;
429					},
430					90,
431					false
432				],
433				'==': [
434					function( $a, $b ) {
435						$a = String( $a );
436						$b = String( $b );
437						if ( $a.isNumeric() && $b.isNumeric() ) {
438							return floatval( $a ) === floatval( $b ) ? 1 : 0;
439						}
440						return 0 === strcmp( $a, $b ) ? 1 : 0;
441					},
442					140,
443					false
444				],
445				'!=': [
446					function( $a, $b ) {
447						$a = String( $a );
448						$b = String( $b );
449						if ( $a.isNumeric() && $b.isNumeric() ) {
450							return floatval( $a ) !== floatval( $b ) ? 1 : 0;
451						}
452						return 0 !== strcmp( $a, $b ) ? 1 : 0;
453					},
454					140,
455					false
456				],
457				'>=': [
458					function( $a, $b ) {
459						$a = String( $a );
460						$b = String( $b );
461						if ( $a.isNumeric() ) {
462							$a = floatval( $a, 0 );
463						}
464						if ( $b.isNumeric() ) {
465							$b = floatval( $b, 0 );
466						}
467						return $a >= $b ? 1 : 0;
468					},
469					150,
470					false
471				],
472				'>': [
473					function( $a, $b ) {
474						$a = String( $a );
475						$b = String( $b );
476						if ( $a.isNumeric() ) {
477							$a = floatval( $a, 0 );
478						}
479						if ( $b.isNumeric() ) {
480							$b = floatval( $b, 0 );
481						}
482						return $a > $b ? 1 : 0;
483					},
484					150,
485					false
486				],
487				'<=': [
488					function( $a, $b ) {
489						$a = String( $a );
490						$b = String( $b );
491						if ( $a.isNumeric() ) {
492							$a = floatval( $a, 0 );
493						}
494						if ( $b.isNumeric() ) {
495							$b = floatval( $b, 0 );
496						}
497						return $a <= $b ? 1 : 0;
498					},
499					150,
500					false
501				],
502				'<': [
503					function( $a, $b ) {
504						$a = String( $a );
505						$b = String( $b );
506						if ( $a.isNumeric() ) {
507							$a = floatval( $a, 0 );
508						}
509						if ( $b.isNumeric() ) {
510							$b = floatval( $b, 0 );
511						}
512						return $a < $b ? 1 : 0;
513					},
514					150,
515					false
516				]
517			};
518		},
519		default_functions: function() {
520			var $this = this;
521			return {
522				abs: Math.abs,
523				acos: Math.acos,
524				acosh: Math.acosh,
525				arcsin: Math.asin,
526				arcctg: function( $arg ) {
527					return ( Math.PI / 2 ) - Math.atan( $arg );
528				},
529				arccot: function( $arg ) {
530					return ( Math.PI / 2 ) - Math.atan( $arg );
531				},
532				arccotan: function( $arg ) {
533					return ( Math.PI / 2 ) - Math.atan( $arg );
534				},
535				arcsec: function( $arg ) {
536					return Math.acos( 1 / $arg );
537				},
538				arccosec: function( $arg ) {
539					return Math.asin( 1 / $arg );
540				},
541				arccsc: function( $arg ) {
542					return Math.asin( 1 / $arg );
543				},
544				arccos: Math.acos,
545				arctan: Math.atan,
546				arctg: Math.atan,
547				array: function( ...$args ) {
548					return $args;
549				},
550				asin: Math.asin,
551				atan: Math.atan,
552				atan2: Math.atan2,
553				atanh: Math.atanh,
554				atn: Math.atan,
555
556				avg: function( $arg1, ...$args ) {
557					var sum;
558					if ( Array.isArray( $arg1 ) ) {
559						if ( 0 === $arg1.length ) {
560							return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Array must contain at least one element!', 'InvalidArgumentError', 0 );
561						}
562					}
563					$args = [].concat.apply( [], [ $arg1, ...$args ] );
564
565					sum = $args.reduce( function( previousValue, currentValue ) {
566						return floatval( currentValue, 0 ) + floatval( previousValue, 0 );
567					} );
568					return sum / $args.length;
569				},
570				average: function( $arg1, ...$args ) {
571					var sum;
572					if ( Array.isArray( $arg1 ) ) {
573						if ( 0 === $arg1.length ) {
574							return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Array must contain at least one element!', 'InvalidArgumentError', 0 );
575						}
576					}
577					$args = [].concat.apply( [], [ $arg1, ...$args ] );
578
579					sum = $args.reduce( function( previousValue, currentValue ) {
580						return floatval( currentValue, 0 ) + floatval( previousValue, 0 );
581					} );
582					return sum / $args.length;
583				},
584				bindec: bindec,
585				ceil: Math.ceil,
586				cos: Math.cos,
587				cosec: function( $arg ) {
588					return Math.sin( 1 / $arg );
589				},
590				csc: function( $arg ) {
591					return Math.sin( 1 / $arg );
592				},
593				cosh: Math.cosh,
594				ctg: function( $arg ) {
595					return Math.cos( $arg ) / Math.sin( $arg );
596				},
597				cot: function( $arg ) {
598					return Math.cos( $arg ) / Math.sin( $arg );
599				},
600				cotan: function( $arg ) {
601					return Math.cos( $arg ) / Math.sin( $arg );
602				},
603				cotg: function( $arg ) {
604					return Math.cos( $arg ) / Math.sin( $arg );
605				},
606				ctn: function( $arg ) {
607					return Math.cos( $arg ) / Math.sin( $arg );
608				},
609				decbin: decbin,
610				dechex: dechex,
611				decoct: decoct,
612				deg2rad: deg2rad,
613				exp: Math.exp,
614				expm1: Math.expm1,
615				floor: Math.floor,
616				int: Math.floor,
617				fmod: function( $arg1, $arg2 ) {
618					return $arg1 % $arg2;
619				},
620				hexdec: hexdec,
621				hypot: hypot,
622				if: function( ...$args ) {
623					var $exres;
624					var $expr;
625					var $trueval;
626					var $falseval;
627					var $canreturnstring;
628					$expr = $args[ 0 ];
629					$trueval = $args[ 1 ];
630					$falseval = $args[ 2 ];
631					if ( 'string' === gettype( $trueval ) ) {
632						$trueval = "'" + $trueval.replace( /'/g, "\\'" ) + "'";
633					}
634					if ( 'string' === gettype( $falseval ) ) {
635						$falseval = "'" + $falseval.replace( /'/g, "\\'" ) + "'";
636					}
637					$canreturnstring = $args[ 3 ] !== undefined ? $args[ 3 ] : false;
638					if ( 0 === $expr || 1 === $expr || true === $expr || false === $expr ) {
639						$exres = $expr;
640					} else {
641						$exres = $this.execute( $expr, true, $canreturnstring );
642					}
643					if ( $exres ) {
644						return $this.execute( $trueval, true, $canreturnstring );
645					}
646					return $this.execute( $falseval, true, $canreturnstring );
647				},
648				intdiv: function( $arg1, $arg2 ) {
649					return Math.trunc( Math.trunc( $arg1 ) / Math.trunc( $arg2 ) );
650				},
651				ln: Math.log,
652				lg: Math.log10,
653				log: Math.log,
654				log1p: Math.log1p,
655				max: function( $arg1, ...$args ) {
656					var $array;
657					if ( Array.isArray( $arg1 ) && 0 === $arg1.length ) {
658						return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Array must contain at least one element!', 'InvalidArgumentError', 0 );
659					}
660					$array = Array.isArray( $arg1 ) ? $arg1 : [ $arg1, ...$args ];
661					$array = $array.map( floatval );
662
663					return Math.max( ...$array );
664				},
665				min: function( $arg1, ...$args ) {
666					var $array;
667					if ( Array.isArray( $arg1 ) && 0 === $arg1.length ) {
668						return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Array must contain at least one element!', 'InvalidArgumentError', 0 );
669					}
670					$array = Array.isArray( $arg1 ) ? $arg1 : [ $arg1, ...$args ];
671					$array = $array.map( floatval );
672
673					return Math.min( ...$array );
674				},
675				octdec: octdec,
676				pi: function() {
677					return Math.PI;
678				},
679				pow: Math.pow,
680				rad2deg: function( angle ) {
681					return angle * 57.29577951308232; // angle / Math.PI * 180
682				},
683				round: roundWithPrecision,
684				sin: Math.sin,
685				sinh: Math.sinh,
686				sec: function( $arg ) {
687					return 1 / Math.cos( $arg );
688				},
689				sqrt: Math.sqrt,
690				tan: Math.tan,
691				tanh: Math.tanh,
692				tn: Math.tan,
693				tg: Math.tan,
694				lookuptable: function( field, lookupTableId ) {
695					var lookupTables;
696					var x;
697					var y;
698					var table;
699					var xColumn;
700					var price = 0;
701					var tableNum = 0;
702					var TMEPOJS = window.TMEPOJS;
703
704					if ( TMEPOJS ) {
705						lookupTables = window.jQuery.epoAPI.util.parseJSON( TMEPOJS.lookupTables );
706						if ( lookupTables ) {
707							if ( Array.isArray( lookupTableId ) ) {
708								tableNum = lookupTableId[ 1 ];
709								lookupTableId = lookupTableId[ 0 ];
710							}
711							if ( empty( lookupTableId ) ) {
712								return 0;
713							}
714							if ( empty( tableNum ) ) {
715								tableNum = 0;
716							}
717							if ( Array.isArray( field ) ) {
718								x = String( field[ 0 ] );
719								y = String( field[ 1 ] );
720							} else {
721								x = String( field );
722								y = '';
723							}
724
725							table = lookupTables[ lookupTableId ];
726							if ( table ) {
727								table = table[ tableNum ];
728								if ( table ) {
729									table = table.data;
730									xColumn = table[ x ];
731									if ( xColumn === undefined && x && x !== undefined ) {
732										if ( x.isNumeric() && floatval( x ) === 0 ) {
733											xColumn = table[ Object.keys( table )[ 0 ] ];
734										} else if ( x ) {
735											x = $this.find_lookup_table_index( x, table );
736											xColumn = table[ x ];
737										}
738									}
739									if ( xColumn !== undefined ) {
740										if ( y && y !== undefined ) {
741											y = $this.find_lookup_table_index( y, xColumn );
742										} else {
743											// fetch the first row since this means we want
744											// a single row result
745											y = Object.keys( xColumn )[ 0 ];
746										}
747										if ( y === 'max' ) {
748											price = floatval( xColumn[ Object.keys( xColumn )[ Object.keys( xColumn ).length - 1 ] ] );
749										} else {
750											price = floatval( xColumn[ y ] );
751										}
752									}
753								}
754							}
755						}
756					}
757					return price;
758				},
759				concat: function( $arg1, ...$args ) {
760					var $array;
761					if ( Array.isArray( $arg1 ) && 0 === $arg1.length ) {
762						return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Array must contain at least one element!', 'InvalidArgumentError', 0 );
763					}
764					$array = Array.isArray( $arg1 ) ? $arg1 : [ $arg1, ...$args ];
765
766					return $array.join( '' );
767				}
768			};
769		},
770		find_lookup_table_index: function( value, table ) {
771			var r;
772			var keys = Object.keys( table );
773			var hasNumericValuesOrMaxLast = function( arr ) {
774				var lastElement = arr[ arr.length - 1 ];
775				var areAllNumericValues = arr.every( function( val ) {
776					return String( val ).isNumeric();
777				} );
778				return areAllNumericValues || lastElement === 'max';
779			};
780
781			if ( hasNumericValuesOrMaxLast( keys ) ) {
782				value = String( value ).isNumeric() ? floatval( value ) : value;
783				r = keys.map( function( n ) {
784					return String( n ).isNumeric() ? floatval( n ) : n;
785				} ).reduce( function( a, b ) {
786					if ( b === 'max' && value > a ) {
787						return b;
788					}
789					if ( a === 'max' && value > b ) {
790						return a;
791					}
792					if ( a < b ) {
793						if ( value > a && value <= b ) {
794							return b;
795						}
796					} else {
797						if ( ( value > b && value <= a ) || ( value > a || b === 'max' ) ) {
798							return a;
799						}
800						return b;
801					}
802					if ( value > b ) {
803						return b;
804					}
805					return a;
806				} );
807				keys = keys.map( function( n ) {
808					return String( n ).isNumeric() ? floatval( n ) : n;
809				} );
810
811				if ( value > Math.max( ...keys ) || value < Math.min( ...keys ) ) {
812					return false;
813				}
814			} else {
815				r = value;
816			}
817
818			return r;
819		},
820		default_vars: function() {
821			return {
822				pi: 3.141592653589793,
823				e: 2.718281828459045
824			};
825		},
826		default_var_validation: function( $variable, $value ) {
827			if ( ! is_scalar( $value ) && ! Array.isArray( $value ) && undefined !== $value ) {
828				return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Variable (' + $variable + ') type (' + gettype( $value ) + ') is not scalar or array!', 0 );
829			}
830			return $value;
831		}
832	};
833
834	var THEMECOMPLETE_EPO_MATH_Tokenizer = function( $input, $operators ) {
835		var node = {
836			tokens: [],
837			input: '',
838			operators: {},
839			number_buffer: '',
840			string_buffer: '',
841			allow_negative: true,
842			in_single_quoted_string: false,
843			in_double_quoted_string: false,
844			is_number: function( ch ) {
845				return ch >= '0' && ch <= '9';
846			},
847			is_alpha: function( ch ) {
848				return ( ch >= 'a' && ch <= 'z' ) || ( ch >= 'A' && ch <= 'Z' ) || '_' === ch;
849			},
850			is_dot: function( ch ) {
851				return '.' === ch;
852			},
853			is_lp: function( ch ) {
854				return '(' === ch;
855			},
856			is_rp: function( ch ) {
857				return ')' === ch;
858			},
859			is_comma: function( ch ) {
860				return ',' === ch;
861			},
862			empty_number_buffer_as_literal: function() {
863				if ( this.number_buffer.length ) {
864					this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.LITERAL, this.number_buffer ) );
865					this.number_buffer = '';
866				}
867			},
868			empty_str_buffer_as_variable: function() {
869				if ( '' !== this.string_buffer ) {
870					this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.VARIABLE, this.string_buffer ) );
871					this.string_buffer = '';
872				}
873			},
874			tokenize: function() {
875				var is_last_char_escape = false;
876				var $this = this;
877				var $token_test = [];
878
879				this.tokens = [];
880
881				this.input.toString().split( '' ).forEach( function( ch ) {
882					switch ( true ) {
883						case $this.in_single_quoted_string:
884							if ( '\\' === ch ) {
885								if ( is_last_char_escape ) {
886									$this.string_buffer += '\\';
887									is_last_char_escape = false;
888								} else {
889									is_last_char_escape = true;
890								}
891								break;
892							} else if ( "'" === ch ) {
893								if ( is_last_char_escape ) {
894									$this.string_buffer += "'";
895									is_last_char_escape = false;
896								} else {
897									$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.STRING, $this.string_buffer ) );
898									$this.in_single_quoted_string = false;
899									$this.string_buffer = '';
900								}
901								break;
902							}
903							if ( is_last_char_escape ) {
904								$this.string_buffer += '\\';
905								is_last_char_escape = false;
906							}
907							$this.string_buffer += ch;
908							break;
909						case $this.in_double_quoted_string:
910							if ( '\\' === ch ) {
911								if ( is_last_char_escape ) {
912									$this.string_buffer += '\\';
913									is_last_char_escape = false;
914								} else {
915									is_last_char_escape = true;
916								}
917								break;
918							} else if ( '"' === ch ) {
919								if ( is_last_char_escape ) {
920									$this.string_buffer += '"';
921									is_last_char_escape = false;
922								} else {
923									$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.STRING, $this.string_buffer ) );
924									$this.in_double_quoted_string = false;
925									$this.string_buffer = '';
926								}
927								break;
928							}
929							if ( is_last_char_escape ) {
930								$this.string_buffer += '\\';
931								is_last_char_escape = false;
932							}
933							$this.string_buffer += ch;
934							break;
935						case '[' === ch:
936							$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.FUNCTION, 'array' ) );
937							$this.allow_negative = true;
938							$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.LEFTPARENTHESIS, '' ) );
939							break;
940						case ' ' === ch || '\n' === ch || '\r' === ch || '\t' === ch:
941							/**
942							 * In case those tokens must not be ingored use the following
943							 *
944							 * $this.empty_number_buffer_as_literal();
945							 * $this.empty_str_buffer_as_variable();
946							 * $this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.SPACE, '' ) );
947							 */
948							break;
949						case $this.is_number( ch ):
950							if ( '' !== $this.string_buffer ) {
951								$this.string_buffer += ch;
952								break;
953							}
954							$this.number_buffer += ch;
955							$this.allow_negative = false;
956							break;
957						case 'e' === ch.toLowerCase():
958							if ( $this.number_buffer.length && -1 !== $this.number_buffer.indexOf( '.' ) ) {
959								$this.number_buffer += 'e';
960								$this.allow_negative = false;
961								break;
962							}
963							/* falls through */
964						case $this.is_alpha( ch ):
965							if ( $this.number_buffer.length ) {
966								$this.empty_number_buffer_as_literal();
967								$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.OPERATOR, '*' ) );
968							}
969							$this.allow_negative = false;
970							$this.string_buffer += ch;
971							break;
972						case '"' === ch:
973							$this.in_double_quoted_string = true;
974							break;
975						case "'" === ch:
976							$this.in_single_quoted_string = true;
977							break;
978						case $this.is_dot( ch ):
979							$this.number_buffer += ch;
980							$this.allow_negative = false;
981							break;
982						case $this.is_lp( ch ):
983							if ( '' !== $this.string_buffer ) {
984								$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.FUNCTION, $this.string_buffer ) );
985								$this.string_buffer = '';
986							} else if ( $this.number_buffer.length ) {
987								$this.empty_number_buffer_as_literal();
988								$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.OPERATOR, '*' ) );
989							}
990							$this.allow_negative = true;
991							$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.LEFTPARENTHESIS, ch ) );
992							break;
993						case $this.is_rp( ch ) || ']' === ch :
994							$this.empty_number_buffer_as_literal();
995							$this.empty_str_buffer_as_variable();
996							$this.allow_negative = false;
997							$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.RIGHTPARENTHESIS, ch ) );
998							break;
999						case $this.is_comma( ch ):
1000							$this.empty_number_buffer_as_literal();
1001							$this.empty_str_buffer_as_variable();
1002							$this.allow_negative = true;
1003							$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.PARAMSEPARATOR, ch ) );
1004							break;
1005						default:
1006							// special case for unary operations.
1007							if ( '-' === ch || '+' === ch ) {
1008								if ( $this.allow_negative ) {
1009									$this.allow_negative = false;
1010									$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.OPERATOR, '-' === ch ? 'uNeg' : 'uPos' ) );
1011									break;
1012								}
1013								// could be in exponent, in which case negative should be added to the number_buffer.
1014								if ( $this.number_buffer && 'e' === $this.number_buffer[ $this.number_buffer.length - 1 ] ) {
1015									$this.number_buffer += ch;
1016									break;
1017								}
1018							}
1019							$this.empty_number_buffer_as_literal();
1020							$this.empty_str_buffer_as_variable();
1021
1022							if ( '$' !== ch ) {
1023								if ( $this.tokens.length > 0 ) {
1024									if ( THEMECOMPLETE_EPO_MATH_Constants.OPERATOR === $this.tokens[ $this.tokens.length - 1 ].type ) {
1025										$this.tokens[ $this.tokens.length - 1 ].value += ch;
1026									} else {
1027										$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.OPERATOR, ch ) );
1028									}
1029								} else {
1030									$this.tokens.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.OPERATOR, ch ) );
1031								}
1032							}
1033							$this.allow_negative = true;
1034					}
1035				} );
1036				this.empty_number_buffer_as_literal();
1037				this.empty_str_buffer_as_variable();
1038
1039				this.tokens.forEach( function( $token, $key ) {
1040					$token_test[ $key ] = $token.type;
1041				} );
1042				$token_test.forEach( function( $type, $key ) {
1043					if ( $key > 0 && 'space' === $type && 'variable' === $token_test[ $key + 1 ] && 'variable' === $token_test[ $key - 1 ] ) {
1044						$this.tokens[ $key ] = new THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.LITERAL, 0 );
1045						$this.tokens.splice( $key + 1, 1 );
1046						$this.tokens.splice( $key - 1, 1 );
1047					}
1048				} );
1049				return this;
1050			},
1051			build_reverse_polish_notation: function() {
1052				var $tokens = [];
1053				var $stack = [];
1054				var $param_counter = [];
1055				var $ctoken;
1056				var $f;
1057				var $op1;
1058				var $op2;
1059				var $this = this;
1060
1061				try {
1062					this.tokens.forEach( function( $token ) {
1063						switch ( $token.type ) {
1064							case THEMECOMPLETE_EPO_MATH_Constants.LITERAL:
1065							case THEMECOMPLETE_EPO_MATH_Constants.VARIABLE:
1066							case THEMECOMPLETE_EPO_MATH_Constants.STRING:
1067								$tokens.push( $token );
1068
1069								if ( $param_counter.length > 0 && 0 === $param_counter[ $param_counter.length - 1 ] ) {
1070									$param_counter.push( $param_counter.pop() + 1 );
1071								}
1072
1073								break;
1074
1075							case THEMECOMPLETE_EPO_MATH_Constants.FUNCTION:
1076								if ( $param_counter.length > 0 && 0 === $param_counter[ $param_counter.length - 1 ] ) {
1077									$param_counter.push( $param_counter.pop() + 1 );
1078								}
1079								$stack.push( $token );
1080								$param_counter.push( 0 );
1081
1082								break;
1083
1084							case THEMECOMPLETE_EPO_MATH_Constants.LEFTPARENTHESIS:
1085								$stack.push( $token );
1086
1087								break;
1088
1089							case THEMECOMPLETE_EPO_MATH_Constants.PARAMSEPARATOR:
1090								while ( THEMECOMPLETE_EPO_MATH_Constants.LEFTPARENTHESIS !== $stack[ $stack.length - 1 ].type ) {
1091									if ( 0 === $stack.length ) {
1092										return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Incorrect Brackets', 'IncorrectBracketsError', $tokens );
1093									}
1094									$tokens.push( $stack.pop() );
1095								}
1096								$param_counter.push( $param_counter.pop() + 1 );
1097
1098								break;
1099
1100							case THEMECOMPLETE_EPO_MATH_Constants.OPERATOR:
1101								if ( ! array_key_exists( $token.value, $this.operators ) ) {
1102									return THEMECOMPLETE_EPO_MATH_Error.trigger( $token.value, 'UnknownOperatorError', $tokens );
1103								}
1104								$op1 = $this.operators[ $token.value ];
1105
1106								while ( $stack.length > 0 && THEMECOMPLETE_EPO_MATH_Constants.OPERATOR === $stack[ $stack.length - 1 ].type ) {
1107									if ( ! array_key_exists( $stack[ $stack.length - 1 ].value, $this.operators ) ) {
1108										return THEMECOMPLETE_EPO_MATH_Error.trigger( $stack[ $stack.length - 1 ].value, 'UnknownOperatorError', $tokens );
1109									}
1110									$op2 = $this.operators[ $stack[ $stack.length - 1 ].value ];
1111
1112									if ( $op2.priority >= $op1.priority ) {
1113										$tokens.push( $stack.pop() );
1114
1115										continue;
1116									}
1117
1118									break;
1119								}
1120								$stack.push( $token );
1121
1122								break;
1123
1124							case THEMECOMPLETE_EPO_MATH_Constants.RIGHTPARENTHESIS:
1125								while ( true ) {
1126									try {
1127										$ctoken = $stack.pop();
1128
1129										if ( THEMECOMPLETE_EPO_MATH_Constants.LEFTPARENTHESIS === $ctoken.type ) {
1130											break;
1131										}
1132										$tokens.push( $ctoken );
1133									} catch ( $e ) {
1134										return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Incorrect Brackets', 'IncorrectBracketsError', $tokens );
1135									}
1136								}
1137
1138								if ( $stack.length > 0 && THEMECOMPLETE_EPO_MATH_Constants.FUNCTION === $stack[ $stack.length - 1 ].type ) {
1139									$f = $stack.pop();
1140									$f.param_count = $param_counter.pop();
1141									$tokens.push( $f );
1142								}
1143
1144								break;
1145
1146							case THEMECOMPLETE_EPO_MATH_Constants.SPACE:
1147								// do nothing.
1148						}
1149					} );
1150				} catch ( $e ) {
1151					$tokens = [];
1152					return THEMECOMPLETE_EPO_MATH_Error.trigger( $e, 'Error', $tokens );
1153				}
1154
1155				while ( 0 !== $stack.length ) {
1156					if ( THEMECOMPLETE_EPO_MATH_Constants.LEFTPARENTHESIS === $stack[ $stack.length - 1 ].type || THEMECOMPLETE_EPO_MATH_Constants.RIGHTPARENTHESIS === $stack[ $stack.length - 1 ].type ) {
1157						return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Incorrect Brackets', 'IncorrectBracketsError', $tokens );
1158					}
1159
1160					if ( THEMECOMPLETE_EPO_MATH_Constants.SPACE === $stack[ $stack.length - 1 ].type ) {
1161						$stack.pop();
1162						continue;
1163					}
1164					$tokens.push( $stack.pop() );
1165				}
1166
1167				return $tokens;
1168			}
1169		};
1170		node.input = $input;
1171		node.operators = $operators;
1172		return node;
1173	};
1174
1175	var THEMECOMPLETE_EPO_MATH_Constants = {
1176		LITERAL: 'literal',
1177		VARIABLE: 'variable',
1178		OPERATOR: 'operator',
1179		LEFTPARENTHESIS: 'LP',
1180		RIGHTPARENTHESIS: 'RP',
1181		FUNCTION: 'function',
1182		PARAMSEPARATOR: 'separator',
1183		STRING: 'string',
1184		SPACE: 'space'
1185
1186	};
1187
1188	var THEMECOMPLETE_EPO_MATH_Token = function( $type, $value, $name ) {
1189		var node = {
1190			type: THEMECOMPLETE_EPO_MATH_Constants.LITERAL,
1191			value: undefined,
1192			name: undefined,
1193			param_count: null
1194		};
1195		node.type = $type;
1196		node.value = $value;
1197		node.name = $name;
1198		return node;
1199	};
1200
1201	var THEMECOMPLETE_EPO_MATH_Operator = function( $operator, $is_right_assoc, $priority, $function ) {
1202		var node = {
1203			operator: '',
1204			is_right_assoc: false,
1205			priority: 0,
1206			function: null,
1207			places: 0
1208		};
1209		node.operator = $operator;
1210		node.is_right_assoc = $is_right_assoc;
1211		node.priority = $priority;
1212		node.function = $function;
1213		node.places = getNumberOfParameters( $function );
1214
1215		node.execute = function( $stack ) {
1216			var $args = [];
1217			var $i;
1218			var $result;
1219
1220			if ( $stack.length < this.places ) {
1221				// Empty the $stack
1222				$stack.splice( 0, $stack.length );
1223				return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Incorrect Expression', 'IncorrectExpressionError', new THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.LITERAL, 0 ) );
1224			}
1225
1226			for ( $i = 0; $i < this.places; $i++ ) {
1227				$args.unshift( $stack.pop().value );
1228			}
1229
1230			$result = this.function.apply( null, $args );
1231			if ( 'number' !== gettype( $result ) && 'string' !== gettype( $result ) ) {
1232				$result = 0;
1233			}
1234
1235			return new THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.LITERAL, $result );
1236		};
1237
1238		return node;
1239	};
1240
1241	var THEMECOMPLETE_EPO_MATH_CustomFunction = function( $name, $function ) {
1242		var node = {
1243			name: '',
1244			function: undefined,
1245			required_param_count: undefined
1246		};
1247
1248		node.name = $name;
1249		node.function = $function;
1250		node.required_param_count = getNumberOfRequiredParameters( $function );
1251
1252		node.execute = function( $stack, $param_count_in_stack ) {
1253			var $args = [];
1254			var $i;
1255			var $argument;
1256			var $result;
1257			if ( $param_count_in_stack < this.required_param_count ) {
1258				$param_count_in_stack = this.required_param_count;
1259			}
1260			// We skip this section.
1261			if ( $param_count_in_stack < this.required_param_count ) {
1262				// Empty the $stack
1263				$stack.splice( 0, $stack.length );
1264				return THEMECOMPLETE_EPO_MATH_Error.trigger( this.name, 'IncorrectNumberOfFunctionParametersError', new THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.LITERAL, 0 ) );
1265			}
1266
1267			if ( $param_count_in_stack > 0 ) {
1268				for ( $i = 0; $i < $param_count_in_stack; $i++ ) {
1269					$argument = $stack.length ? $stack.pop().value : 0;
1270					if ( null === $argument ) {
1271						$argument = '0';
1272						$args.push( $argument );
1273					} else {
1274						$args.unshift( $argument );
1275					}
1276				}
1277			}
1278
1279			$result = this.function.apply( null, $args );
1280
1281			if ( $result === Infinity || $result === -Infinity ) {
1282				$result = 0;
1283			}
1284
1285			return THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.LITERAL, $result );
1286		};
1287
1288		return node;
1289	};
1290
1291	var THEMECOMPLETE_EPO_MATH_Calculator = function( $functions, $operators ) {
1292		var node = {
1293			functions: {},
1294			operators: {}
1295		};
1296		node.functions = $functions;
1297		node.operators = $operators;
1298
1299		node.calculate = function( $tokens, $variables, $on_var_not_found = null, $math_object = false ) {
1300			var $this = this;
1301			/** Array of THEMECOMPLETE_EPO_MATH_Token */
1302			var $stack = [];
1303			var $result;
1304
1305			if ( empty( $tokens ) ) {
1306				return 0;
1307			}
1308			try {
1309				$tokens.forEach( function( $token ) {
1310					var $variable;
1311					var $value;
1312					if ( THEMECOMPLETE_EPO_MATH_Constants.LITERAL === $token.type || THEMECOMPLETE_EPO_MATH_Constants.STRING === $token.type ) {
1313						$stack.push( $token );
1314					} else if ( THEMECOMPLETE_EPO_MATH_Constants.VARIABLE === $token.type ) {
1315						$variable = $token.value;
1316
1317						$value = null;
1318
1319						if ( array_key_exists( $variable, $variables ) ) {
1320							$value = $variables[ $variable ];
1321						} else if ( $on_var_not_found && 'function' === typeof $on_var_not_found ) {
1322							$value = $on_var_not_found( $variable );
1323						} else {
1324							$value = $variable;
1325							$math_object.variables[ $variable ] = $value;
1326							$variables[ $variable ] = $value;
1327						}
1328						$stack.push( THEMECOMPLETE_EPO_MATH_Token( THEMECOMPLETE_EPO_MATH_Constants.LITERAL, $value, $variable ) );
1329					} else if ( THEMECOMPLETE_EPO_MATH_Constants.FUNCTION === $token.type ) {
1330						if ( ! array_key_exists( $token.value, $this.functions ) ) {
1331							$math_object.add_function(
1332								$token.value,
1333								function() {
1334									return 0;
1335								}
1336							);
1337							$this.functions = $math_object.functions;
1338							if ( ! array_key_exists( $token.value, $this.functions ) ) {
1339								return THEMECOMPLETE_EPO_MATH_Error.trigger( $token.value, 'UnknownFunctionError', 0 );
1340							}
1341							THEMECOMPLETE_EPO_MATH_Error.trigger( $token.value, 'UnknownFunctionError', 0 );
1342						}
1343						$stack.push( $this.functions[ $token.value ].execute( $stack, $token.param_count ) );
1344					} else if ( THEMECOMPLETE_EPO_MATH_Constants.OPERATOR === $token.type ) {
1345						if ( ! array_key_exists( $token.value, $this.operators ) ) {
1346							return THEMECOMPLETE_EPO_MATH_Error.trigger( $token.value, 'UnknownOperatorError', 0 );
1347						}
1348						$stack.push( $this.operators[ $token.value ].execute( $stack ) );
1349					}
1350				} );
1351			} catch ( $e ) {
1352				if ( window.TMEPOJS && window.TMEPOJS.WP_DEBUG ) {
1353					window.console.log( $e );
1354				}
1355			}
1356			$result = $stack.pop();
1357
1358			if ( undefined === $result || null === $result || ! empty( $stack ) ) {
1359				return THEMECOMPLETE_EPO_MATH_Error.trigger( 'Stack must be empty', 'IncorrectExpressionError', 0 );
1360			}
1361
1362			if ( false === $result.value ) {
1363				$result.value = 0;
1364			}
1365
1366			if ( true === $result.value ) {
1367				$result.value = 1;
1368			}
1369
1370			if ( 'string' === gettype( $result.value ) && $result.value.isNumeric() ) {
1371				$result.value = floatval( $result.value );
1372			}
1373
1374			return $result.value;
1375		};
1376		return node;
1377	};
1378
1379	var THEMECOMPLETE_EPO_MATH_Error = {
1380		trigger: function( $msg, $code = '', $return = false ) {
1381			if ( window.TMEPOJS && window.TMEPOJS.WP_DEBUG ) {
1382				window.console.log( $code + '\n' + $msg );
1383				window.console.trace();
1384			}
1385			if ( window.TMEPOGLOBALADMINJS && window.TMEPOGLOBALADMINJS.WP_DEBUG ) {
1386				return $msg;
1387			}
1388			return $return;
1389		}
1390	};
1391
1392	window.tcmexp = THEMECOMPLETE_EPO_MATH.construct();
1393}( window ) );

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.