PageSourceSearch

https://nutrebem.prod.nutrebem.com.br/assets/unlogged-f3ab3ceb0d08…d6b58ecd8f45520520d8cfa87a71d2de1e573b29.js

js nutrebem.com.br collected 2026-09-24 13:16:00 UTC 36,685 bytes, 1,273 lines download raw bytes

1(function(global, doc) {
2  global.iOSLinkFix = function() {
3    var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !global.MSStream;
4
5    if(iOS) {
6      var allPageAnchors = doc.getElementsByTagName('a');
7      allPageAnchors.forEach(function(anchor) {
8        anchor.addEventListener('click', function(e) {
9          e.preventDefault();
10
11          global.location=this.getAttribute('href');
12          return false;
13        });
14      });
15    }
16  };
17}(window, document));
18/*!
19 * JavaScript Cookie v2.2.0
20 * https://github.com/js-cookie/js-cookie
21 *
22 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
23 * Released under the MIT license
24 */
25;(function (factory) {
26	var registeredInModuleLoader = false;
27	if (typeof define === 'function' && define.amd) {
28		define(factory);
29		registeredInModuleLoader = true;
30	}
31	if (typeof exports === 'object') {
32		module.exports = factory();
33		registeredInModuleLoader = true;
34	}
35	if (!registeredInModuleLoader) {
36		var OldCookies = window.Cookies;
37		var api = window.Cookies = factory();
38		api.noConflict = function () {
39			window.Cookies = OldCookies;
40			return api;
41		};
42	}
43}(function () {
44	function extend () {
45		var i = 0;
46		var result = {};
47		for (; i < arguments.length; i++) {
48			var attributes = arguments[ i ];
49			for (var key in attributes) {
50				result[key] = attributes[key];
51			}
52		}
53		return result;
54	}
55
56	function init (converter) {
57		function api (key, value, attributes) {
58			var result;
59			if (typeof document === 'undefined') {
60				return;
61			}
62
63			// Write
64
65			if (arguments.length > 1) {
66				attributes = extend({
67					path: '/'
68				}, api.defaults, attributes);
69
70				if (typeof attributes.expires === 'number') {
71					var expires = new Date();
72					expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
73					attributes.expires = expires;
74				}
75
76				// We're using "expires" because "max-age" is not supported by IE
77				attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
78
79				try {
80					result = JSON.stringify(value);
81					if (/^[\{\[]/.test(result)) {
82						value = result;
83					}
84				} catch (e) {}
85
86				if (!converter.write) {
87					value = encodeURIComponent(String(value))
88						.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
89				} else {
90					value = converter.write(value, key);
91				}
92
93				key = encodeURIComponent(String(key));
94				key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
95				key = key.replace(/[\(\)]/g, escape);
96
97				var stringifiedAttributes = '';
98
99				for (var attributeName in attributes) {
100					if (!attributes[attributeName]) {
101						continue;
102					}
103					stringifiedAttributes += '; ' + attributeName;
104					if (attributes[attributeName] === true) {
105						continue;
106					}
107					stringifiedAttributes += '=' + attributes[attributeName];
108				}
109				return (document.cookie = key + '=' + value + stringifiedAttributes);
110			}
111
112			// Read
113
114			if (!key) {
115				result = {};
116			}
117
118			// To prevent the for loop in the first place assign an empty array
119			// in case there are no cookies at all. Also prevents odd result when
120			// calling "get()"
121			var cookies = document.cookie ? document.cookie.split('; ') : [];
122			var rdecode = /(%[0-9A-Z]{2})+/g;
123			var i = 0;
124
125			for (; i < cookies.length; i++) {
126				var parts = cookies[i].split('=');
127				var cookie = parts.slice(1).join('=');
128
129				if (!this.json && cookie.charAt(0) === '"') {
130					cookie = cookie.slice(1, -1);
131				}
132
133				try {
134					var name = parts[0].replace(rdecode, decodeURIComponent);
135					cookie = converter.read ?
136						converter.read(cookie, name) : converter(cookie, name) ||
137						cookie.replace(rdecode, decodeURIComponent);
138
139					if (this.json) {
140						try {
141							cookie = JSON.parse(cookie);
142						} catch (e) {}
143					}
144
145					if (key === name) {
146						result = cookie;
147						break;
148					}
149
150					if (!key) {
151						result[name] = cookie;
152					}
153				} catch (e) {}
154			}
155
156			return result;
157		}
158
159		api.set = api;
160		api.get = function (key) {
161			return api.call(api, key);
162		};
163		api.getJSON = function () {
164			return api.apply({
165				json: true
166			}, [].slice.call(arguments));
167		};
168		api.defaults = {};
169
170		api.remove = function (key, attributes) {
171			api(key, '', extend(attributes, {
172				expires: -1
173			}));
174		};
175
176		api.withConverter = init;
177
178		return api;
179	}
180
181	return init(function () {});
182}));
183'use strict';
184
185var windowIsTurbolinked = 'Turbolinks' in window;
186
187var cookiesEu = {
188  init: function() {
189    var cookiesEuOKButton = document.querySelector('.js-cookies-eu-ok');
190
191    if (cookiesEuOKButton) {
192      this.addListener(cookiesEuOKButton);
193      // clear turbolinks cache so cookie banner does not reappear
194      windowIsTurbolinked && window.Turbolinks.clearCache();
195    }
196  },
197
198  addListener: function(target) {
199    // Support for IE < 9
200    if (target.attachEvent) {
201      target.attachEvent('onclick', this.setCookie);
202    } else {
203      target.addEventListener('click', this.setCookie, false);
204    }
205  },
206
207  setCookie: function() {
208    var isSecure = location.protocol === 'https:';
209    Cookies.set('cookie_eu_consented', true, { path: '/', expires: 365, secure: isSecure });
210
211    var container = document.querySelector('.js-cookies-eu');
212    container.parentNode.removeChild(container);
213
214    document.dispatchEvent(new CustomEvent('cookies-eu-acknowledged'));
215  }
216};
217
218(function() {
219  function eventName(fallback) {
220    return windowIsTurbolinked ? 'turbolinks:load' : fallback
221  }
222
223  var isCalled = false;
224
225  function isReady() {
226    // return early when cookiesEu.init has been called AND Turbolinks is NOT included
227    // when Turbolinks is included cookiesEu.init has to be called on every page load
228    if (isCalled && !windowIsTurbolinked) {
229      return
230    }
231    isCalled = true;
232
233    cookiesEu.init();
234  }
235
236  if (document.addEventListener) {
237    return document.addEventListener(eventName('DOMContentLoaded'), isReady, false);
238  }
239
240  // Old browsers IE < 9
241  if (window.addEventListener) {
242    window.addEventListener(eventName('load'), isReady, false);
243  } else if (window.attachEvent) {
244    window.attachEvent(eventName('onload'), isReady);
245  }
246})();
247DB = function () {
248  var that = this;
249
250  // This works on all devices/browsers, and uses IndexedDBShim as a final fallback
251  that.indexedDB      = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
252  that.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction;
253  that.IDBKeyRange    = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;
254
255  // Open (or create) the database
256  window.indexedDB.deleteDatabase("nutrebem-student");
257  that.open = indexedDB.open("nutrebem-student", migrations.version);
258
259  // Create the schema
260  that.open.onupgradeneeded = function(event) {
261    migrations.run(that.open.result, event.currentTarget.transaction);
262  };
263
264  that.open.onsuccess = function(e) {
265    that.db = that.open.result;
266    that.ready(e);
267  }
268}
269
270DB.prototype.ready = function(){};
271
272DB.prototype.put = function(objectStoreName, data, onsuccess, onerror){
273  var objectStore = this.getObjectStore([objectStoreName], 'readwrite');
274
275  try {
276    objectStoreRequest = objectStore.add(data);
277
278    objectStoreRequest.onsuccess = function(d) {
279      if(onsuccess) onsuccess(d);
280    }
281
282  } catch(e) {
283    onerror(e);
284  }
285};
286
287DB.prototype.get = function(objectStoreName, key, onsuccess, onerror){
288  var objectStore        = this.getObjectStore([objectStoreName], 'readonly');
289  var objectStoreRequest = objectStore.openCursor(key);
290
291  objectStoreRequest.onsuccess = function(data) {
292    var result = data.target.result ? data.target.result.value : null;
293
294    if(onsuccess) onsuccess(data.target.result);
295  }
296};
297
298DB.prototype.updateOrCreate = function(objectStoreName, key, updatedData, onsuccess, onerror){
299  var self = this;
300  var onsuccess = onsuccess || function(){};
301  var onerror =  onerror || function(){};
302
303  var objectStore        = this.getObjectStore([objectStoreName], 'readwrite');
304  var objectStoreRequest = objectStore.openCursor(key);
305
306  objectStoreRequest.onsuccess = function(data) {
307    var cursor = data.target.result;
308
309    if(cursor) {
310      var request = data.target.result.update(updatedData);
311
312      request.onsuccess = function() { onsuccess(); }
313    } else {
314      self.put(objectStoreName, updatedData, onsuccess, onerror);
315    }
316  }
317};
318
319DB.prototype.getAll = function(objectStoreName, onsuccess, onerror ){
320  var objectStore = this.getObjectStore([objectStoreName], 'readonly');
321
322  if ('getAll' in objectStore) {
323    objectStore.getAll().onsuccess = function(data) {
324      var result = data.target.result.length > 0 ? data.target.result : [];
325      if(onsuccess) onsuccess(result);
326    };
327  } else {
328    var result = [];
329    objectStore.openCursor().onsuccess = function(event) {
330      var cursor = event.target.result;
331      if (cursor) {
332        result.push(cursor.value);
333        cursor.continue();
334      } else {
335        if(onsuccess) onsuccess(result);
336      }
337    };
338  }
339};
340
341DB.prototype.clear = function(objectStoreName, onsuccess, onerror){
342  var objectStore = this.getObjectStore([objectStoreName], 'readwrite');
343
344  try {
345    objectStoreRequest = objectStore.clear();
346
347    objectStoreRequest.onsuccess = function() {
348      if(onsuccess) onsuccess();
349    }
350
351  } catch(e) {
352    if(onerror) onerror(e);
353  }
354};
355
356DB.prototype.getObjectStore = function(store_name, mode) {
357  var tx = this.db.transaction(store_name, mode);
358
359  tx.oncomplete = function() {
360    this.db.close();
361  }
362
363  return tx.objectStore(store_name);
364};
365window.migrations = {
366  version: 1,
367
368  run: function (db, transaction) {
369    if( !db.objectStoreNames.contains("app") ) {
370      db.createObjectStore("app", { keyPath: 'type', autoinncrement: true });
371    }
372
373    if( !db.objectStoreNames.contains("products") ) {
374      store_products = db.createObjectStore("products", { keyPath: "id" });
375    } else {
376      store_products = transaction.objectStore("products");
377    }
378
379    if ( !store_products.indexNames.contains('byStoreId') ) {
380      store_products.createIndex('byStoreId', 'store_id', { unique: false });
381    }
382
383    if( !db.objectStoreNames.contains("intakes") ) {
384      store_products = db.createObjectStore("intakes", { keyPath: "generated_at" });
385    }
386  }
387};
388document.addEventListener('DOMContentLoaded', function() {
389  if ('serviceWorker' in navigator) {
390    var file = location.protocol + '//' + location.host + '/sw.js';
391    navigator.serviceWorker.register(file);
392  }
393});
394(function(N) {
395
396  N.attr = N.attr || function(key, value) {
397    if (value) {
398      this.setAttribute(key, value);
399      return;
400    }
401
402    return this.getAttribute(key);
403  };
404
405  N.removeAttr = N.removeAttr || function(key) {
406    return this.removeAttribute(key);
407  };
408
409}(Node.prototype));
410(function(global, N) {
411
412  var isVisible = function () {
413    return  this.clientWidth !== 0 &&
414      this.clientHeight !== 0 &&
415      this.style.opacity !== 0 &&
416      this.style.visibility !== 'hidden';
417  };
418
419  var isChecked = function() {
420    return this.checked;
421  };
422
423  N.is = function(value) {
424    if (value.indexOf(':') === 0) {
425      var options = {
426        visible: isVisible,
427        checked: isChecked
428      };
429
430      return options[value.split(':')[1]].call(this);
431    }
432
433    if ((this || {}).type === value) {
434      return true;
435    }
436
437    return false;
438  };
439
440  N.isVisibleInViewPort = N.isVisibleInViewPort || function(threshold) {
441    threshold = threshold || 0;
442
443    var el = this;
444    var offsetTop = el.offsetTop;
445    var offsetLeft = el.offsetLeft;
446    var offsetWidth = el.offsetWidth;
447    var offsetHeight = el.offsetHeight;
448
449    while(el.offsetParent) {
450      el = el.offsetParent;
451      offsetTop += el.offsetTop;
452      offsetLeft += el.offsetLeft;
453    }
454
455    return (
456        offsetTop < (global.pageYOffset + global.innerHeight + threshold) &&
457        offsetLeft < (global.pageXOffset + global.innerWidth + threshold) &&
458        (offsetTop + offsetHeight + threshold) > global.pageYOffset &&
459        (offsetLeft + offsetWidth + threshold) > global.pageXOffset
460        );
461  };
462
463}(window, Node.prototype));
464(function(NodeList, HTMLCollection) {
465
466  var forEach = function(callback) {
467    [].forEach.call(this, callback);
468  };
469
470  var filter = function(callback) {
471    return [].filter.call(this, callback);
472  };
473
474  var map = function(callback) {
475    return [].map.call(this, callback);
476  };
477
478  var reduce = function(callback) {
479    return [].reduce.call(this, callback);
480  };
481
482  var some = function(callback) {
483    return [].some.call(this, callback);
484  };
485
486  HTMLCollection.forEach = HTMLCollection.forEach || forEach;
487  HTMLCollection.filter = HTMLCollection.filter || filter;
488  HTMLCollection.map = HTMLCollection.map || map;
489  HTMLCollection.reduce = HTMLCollection.reduce || reduce;
490  HTMLCollection.some = HTMLCollection.some || some;
491  NodeList.forEach = NodeList.forEach || forEach;
492  NodeList.filter = NodeList.filter || filter;
493  NodeList.map = NodeList.map || map;
494  NodeList.reduce = NodeList.reduce || reduce;
495  NodeList.some = NodeList.some || some;
496
497}(NodeList.prototype, HTMLCollection.prototype));
498(function(global, doc) {
499
500  var delegate = function(selector, eventType, callback) {
501    this.addEventListener(eventType, function(e) {
502      var element = e.target;
503
504      if (element && element.matches(selector)) {
505        callback.call(element, e);
506      }
507    }, false);
508  };
509
510  var on = function(eventType, callback) {
511    this.addEventListener(eventType, callback, false);
512    return this;
513  };
514
515  var off = function(eventType, callback) {
516    this.removeEventListener(eventType, callback, false);
517    return this;
518  };
519
520  global.on = global.on || on;
521  global.off = global.off || off;
522  global.delegate = global.delegate || delegate;
523
524  var N = Node.prototype;
525
526  N.trigger = function(value) {
527    if ('createEvent' in doc) {
528      var evt = doc.createEvent('HTMLEvents');
529      evt.initEvent(value, false, true);
530
531      this.dispatchEvent(evt);
532    } else {
533      this.fireEvent('on' + value);
534    }
535  };
536
537  N.on = N.on || on;
538  N.off = N.off || off;
539  N.delegate = N.delegate || delegate;
540
541  var List = NodeList.prototype;
542
543  List.on = List.on || function(eventType, callback) {
544    this.forEach(function(element) {
545      element.on(eventType, callback);
546    });
547  };
548
549  List.off = List.off || function(eventType, callback) {
550    this.forEach(function(element) {
551      element.off(eventType, callback);
552    });
553  };
554
555  List.delegate = List.delegate || delegate;
556
557}(window, document));
558(function(N) {
559
560  N.before = N.before || function(value) {
561    this.insertAdjacentHTML('beforebegin', value);
562    return this;
563  };
564
565  N.after = N.after || function(value) {
566    this.insertAdjacentHTML('afterend', value);
567    return this;
568  };
569
570  N.html = N.html || function(value) {
571    if (value) {
572      this.innerHTML = value;
573      return this;
574    }
575
576    return this.innerHTML;
577  };
578
579}(Node.prototype));
580(function(N, doc) {
581
582  N.findById = N.findById || function(query) {
583    return this.getElementById(query);
584  };
585
586  N.findByName = N.findByName || function(query) {
587    return doc.getElementsByName(query);
588  };
589
590  N.find = N.find || function(value) {
591    return this.querySelector(value);
592  };
593
594  N.findAll = N.findAll || function(query) {
595    return this.querySelectorAll(query);
596  };
597
598}(Node.prototype, document));
599(function(N, L, doc) {
600
601  N.addClass = N.addClass || function(className) {
602    if (this.classList) {
603      this.classList.add(className);
604    } else {
605      this.className += ' ' + className;
606    }
607
608    return this;
609  };
610
611  N.removeClass = N.removeClass || function(className) {
612    if (this.classList) {
613      this.classList.remove(className);
614      return;
615    }
616
617    this.className = this.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
618  };
619
620  N.hasClass = N.hasClass || function(className) {
621    if (typeof this.className !== 'string') { return false; }
622
623    var classes = this.className.split(' ');
624    var index = classes.indexOf(className);
625
626    return index >= 0;
627  };
628
629  N.toggleClass = N.toggleClass || function(className) {
630    if (this.classList) {
631      this.classList.toggle(className);
632      return;
633    }
634
635    var classes = this.className.split(' ');
636    var index = classes.indexOf(className);
637
638    if (index >= 0) {
639      classes.splice(index, 1);
640    } else {
641      classes.push(className);
642    }
643
644    this.className = classes.join(' ');
645  };
646
647  N.css = function(key, value) {
648    this.style[key] = value;
649  };
650
651  L.removeClass = L.removeClass || function(className) {
652    this.forEach(function(element) {
653      element.removeClass(className);
654    });
655  };
656
657  L.addClass = L.addClass || function(className) {
658    this.forEach(function(element) {
659      element.addClass(className);
660    });
661  };
662
663}(Node.prototype, NodeList.prototype, document));
664(function(N) {
665
666  N.closest = N.closest || function(callback) {
667    var element = this;
668
669    while (element) {
670      if (callback(element)) { return element; }
671      element = element.parentNode;
672    }
673  };
674
675}(Node.prototype));
676
677(function(global, doc) {
678
679  var M = global.EasyFood = global.EasyFood || {};
680
681  M.Form = function() {
682    this.elements = {};
683    this.elements.inputs = doc.findAll('input:not([type="submit"]):not([type="hidden"])');
684    this.elements.checkBoxAll = doc.findAll('input[type="checkbox"][data-check-all]');
685    this.elements.clearButton = doc.findAll('*[data-clear]');
686  };
687
688  M.Form.prototype = {
689    _onChange: function() {
690      var name = this.attr('data-check-all') + '[]';
691      var elements = doc.findAll('input[type="checkbox"][name="' + name + '"]');
692      var checked = this.checked;
693
694      elements.forEach(function(el) {
695        el.checked = checked;
696        el.trigger('change');
697      });
698    },
699
700    _checkAll: function() {
701      this.elements.checkBoxAll.on('change', this._onChange);
702    },
703
704    _onFocus: function() {
705      this.addClass('show');
706    },
707
708    _addOrRemoveClass: function() {
709      if (this.value || this.placeholder) {
710        this.addClass('show');
711        return;
712      }
713
714      this.removeClass('show');
715    },
716
717    _dataClear: function() {
718      this.elements.clearButton.on('click', function(e) {
719        e.preventDefault();
720
721        var selector = this.attr('data-clear');
722        doc.find(selector).value = '';
723      });
724    },
725    _passwordToggle: function() {
726      var password = doc.findById('password');
727      var showHidePassword = doc.findById('show_hide_password');
728
729      if(!showHidePassword || !password) { return }
730
731      showHidePassword.on('click', function(e) {
732        e.preventDefault();
733        password.type = password.type === "text" ? "password" : "text"
734        this.classList.toggle("eye-close");
735        this.classList.toggle("eye-open");
736      });
737    },
738
739    start: function() {
740      this.elements.inputs.on('focus', this._onFocus);
741      this.elements.inputs.on('blur', this._addOrRemoveClass);
742      this._checkAll();
743      this._dataClear();
744      this._passwordToggle();
745
746      global.setTimeout(function() {
747        this.elements.inputs.forEach(function(el) {
748          if (el.value) { el.addClass('show'); }
749        }.bind(this));
750      }.bind(this), 100);
751    }
752  };
753
754}(window, document));
755
756(function(global, doc) {
757    var M = global.EasyFood = global.EasyFood || {};
758
759    M.FlashMessage = function() {
760        this.flashes = doc.findAll('.flash-messages');
761    };
762    M.FlashMessage.prototype = {
763        _close: function() {
764            this.addClass('close');
765        },
766
767        start: function() {
768            this.flashes.on('click', this._close);
769            this.flashes.on('touch', this._close);
770        }
771    };
772}(window, document));
773(function(global, doc) {
774
775  var M = global.EasyFood = global.EasyFood || {};
776
777  M.parseDecimal = function(value, precision) {
778    return value.replace(/\D/g, '') / Math.pow(10, precision || 2);
779  };
780
781  M.asCurrency = function(value) {
782    return value === 0 ? '0,00' :
783      Number(value).toFixed(2).replace('.', ',');
784  };
785
786  M.Mask = function() {
787    this.elements = {};
788    this.elements.inputCurrency = doc.findAll('input[data-format="currency"]');
789    this.elements.inputDate = doc.findAll('input[data-format="date"]');
790    this.elements.input = doc.findAll('input[data-mask]');
791    this.BACKSPACE = 8;
792    this.DELETE = 46;
793    this.LEFT_WINDOW_KEY = 91;
794  };
795
796  M.Mask.prototype = {
797    _inputCurrency: function() {
798      this.elements.inputCurrency.on('keyup', function(e) {
799        var element = e.target;
800        var value = M.parseDecimal(element.value);
801
802        // force zero to become empty
803        if (value === 0 && (
804          e.keyCode === this.DELETE ||
805          e.keyCode === this.BACKSPACE ||
806          e.keyCode === this.LEFT_WINDOW_KEY
807        )) {
808          element.value = '';
809        }
810        else {
811          var acceptsZero = element.attr('data-allow-zero');
812          var format = value ||
813            (element.value.trim() !== '' && acceptsZero && value === 0);
814          element.value = format ? M.asCurrency(value) : '';
815        }
816      }.bind(this));
817    },
818
819    _inputDate: function() {
820      this.elements.inputDate.on('keyup', function(e) {
821        if (e.keyCode === this.DELETE ||
822            e.keyCode === this.BACKSPACE ||
823            e.keyCode === this.LEFT_WINDOW_KEY) {
824          return;
825        }
826
827        var element = e.target;
828        var value = element.value;
829
830        if (value.match(/^\d{2}$/)) {
831          element.value = value + '/';
832        } else if (value.match(/^\d{2}\/\d{2}$/)) {
833          element.value = value + '/';
834        }
835      }.bind(this));
836    },
837
838    /*
839     * !!!This mask only works with a data with non-variable length!!!
840     * This mask works with every data-mask attribute.
841     * There must have '*' in every field that receives a number
842     * and the other characters that composes the mask.
843     * For example, for CNPJ, the data-mask attribute should be: data-mask='**.***.***//****-***'
844     */
845    _formatInput: function () {
846      var positionCursorInTheEnd = function(e){
847        if (e.createTextRange) {
848          var range = e.createTextRange();
849          range.move('character', e.maxLength);
850          range.select();
851        } else if (e.selectionStart) {
852          e.focus();
853          e.setSelectionRange(e.maxLength, e.maxLength);
854        }
855      };
856
857      var format = function(input, pattern) {
858        var inputChars = input.split('');
859
860        for (var i=0; i<pattern.length;i++) {
861
862          if (inputChars[i] != null && inputChars[i] !== "undefined" && pattern[i] != inputChars[i]) {
863
864            if (isNaN(inputChars[i]))
865              inputChars.splice(i,1);
866
867            else if (pattern[i] != '*' && pattern[i] != inputChars[i])
868              inputChars.splice(i, 0, pattern[i]);
869          }
870        }
871        return inputChars.join('');
872      };
873
874      this.elements.input.forEach(function(e) {
875        var pattern = e.getAttribute('data-mask');
876        e.maxLength = pattern.length;
877
878        e.addEventListener('keyup', function(event) {
879          positionCursorInTheEnd(e);
880          if(event.key == "Backspace"){
881            return;
882          }
883          e.value = format(e.value, pattern);
884        });
885
886        e.addEventListener('click',function(){ positionCursorInTheEnd(e)});
887      });
888    },
889
890    start: function() {
891      this._inputDate();
892      this._inputCurrency();
893      this._formatInput();
894    }
895  };
896
897}(window, document));
898"use instrict"
899
900new DB().ready = function () {
901  this.get('app', 'authentication', function(authentication) {
902    if( authentication && authentication.id && authentication.token ) 
903      window.location.href = '/student';
904  });
905};
906(function(global) {
907
908  global.EasyFood = global.EasyFood || {};
909
910  global.EasyFood.ajax = {
911    get: function(url, format) {
912      if (!format) {
913        format = 'text/html';
914      }
915
916      return new global.Promise(function(resolve, reject) {
917        var req = new XMLHttpRequest();
918        req.open('GET', url, true);
919
920        req.onload = function() {
921          if (req.status >= 200 && req.status < 400) {
922            resolve(req.response);
923            return;
924          }
925
926          reject(req.response);
927        };
928
929        req.onerror = function() {
930          reject(Error('Network Error'));
931        };
932
933        req.setRequestHeader('Accept', format);
934
935        req.send();
936      });
937    },
938
939    send: function(url, method, _success, _error) {
940      var success = _success || function() {};
941      var error = _error || function() {};
942      var req = new XMLHttpRequest();
943
944      req.onreadystatechange = function() {
945        if (req.readyState === 4 && req.status === 200) {
946          var parse = JSON.parse(req.responseText);
947          success(parse);
948        }
949      };
950
951      req.onerror = function() {
952        error();
953      };
954
955      req.open(method, url, true);
956      req.send();
957    },
958
959    post: function(url, data, _success, _error, _method) {
960      var success = _success || function() {};
961      var error = _error || function() {};
962      var req = new XMLHttpRequest();
963      var method = _method || 'POST';
964
965      req.open(method, url, true);
966      req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
967      req.setRequestHeader('X-CSRF-Token', document.querySelector('meta[name="csrf-token"]').getAttribute('content'));
968
969      req.onload = function() {
970        console.log('POST STATUS:', req.status);
971        // console.log('POST RESPONSE:', JSON.parse(req.responseText).message);
972        if (req.status >= 200 && req.status < 400) {
973          success(req.responseText);
974          return;
975        }
976
977        error();
978      };
979
980      req.onerror = function() {
981        error();
982      };
983
984      req.send(data);
985    },
986
987    delete: function(url, data, _success, _error) {
988      this.post(url, data, _success, _error, 'DELETE');
989    }
990  };
991
992}(window));
993function objectToQuerystring (obj) {
994  if(!obj) return false;
995
996  return Object.keys(obj).reduce(function (str, key, i) {
997    var delimiter, val;
998    delimiter = (i === 0) ? '?' : '&';
999    key = encodeURIComponent(key);
1000    val = encodeURIComponent(obj[key]);
1001    return [str, delimiter, key, '=', val].join('');
1002  }, '');
1003};
1004(function(t){var e=t._PageAccelerator=t._PageAccelerator||{};e.ajax={get:function(e){return new t.Promise(function(t,r){var n=new XMLHttpRequest;n.open("GET",e,true);n.onload=function(){if(n.status>=200&&n.status<400){t(n.response);return}r(n.response)};n.onerror=function(){r(Error("Network Error"))};n.send()})}}})(window);(function(t,e){if(typeof exports==="object"&&exports){e(exports)}else if(typeof define==="function"&&define.amd){define(["exports"],e)}else{e(t)}})(this,function(t){var e=t===window;var r=e?t:window;var n=document;var a=r._PageAccelerator=r._PageAccelerator||{};a.PageAccelerator=function(){this.url=n.location.href;this.beforeLoading=function(){};this.afterLoading=function(){};this.metaKeyIsPressed=false};a.PageAccelerator.prototype={_updateObject:function(t,e){var r=e.attributes;for(var n=0,a=r.length;n<a;n++){t.attrs[r[n].name]=r[n].value}return t},_updateHistory:function(t,e){var n=this._updateObject({head:t.innerHTML.trim(),content:e.innerHTML.trim(),attrs:{}},e);r.history.pushState(n,"",this.url);r.addEventListener("popstate",this._updateBody.bind(this),false)},_DOMParser:function(t){var e=new DOMParser;return e.parseFromString(t,"text/html")},_updateBodyAttributes:function(t){Object.keys(t).forEach(function(e){var r=t[e];n.body.setAttribute(e,r)})},_updateBody:function(t){this.beforeLoading();var e=t.state;this._updateBodyAttributes(e.attrs);n.body.innerHTML=e.content;var a=this._DOMParser(e.head);n.title=a.head.querySelector("title").innerText;this.url=r.location.href;this.start();this.afterLoading()},_loadStyles:function(t,e){var n=[].map.call(t.querySelectorAll('link[rel="stylesheet"]'),function(t){return a.ajax.get(t.getAttribute("href"))});r.Promise.all(n).then(e.bind(this))},_update:function(t){var e=this._DOMParser(t);var a=e.head;this._loadStyles(a,function(){var t=e.body;n.body=t;n.head=a;n.title=a.querySelector("title").innerText;this._updateHistory(a,t);this.afterLoading();r.scrollTo(0,0);this.start()}.bind(this))},_onClick:function(t){this.beforeLoading();this.url=t.href;a.ajax.get(this.url).then(this._update.bind(this)).catch(this._update.bind(this))},_replaceHistory:function(){var t=n.body;var e=this._updateObject({head:n.head.innerHTML.trim(),content:t.innerHTML.trim(),attrs:{}},t);r.history.replaceState(e,"",this.url)},_events:function(){var t=this;r.addEventListener("keydown",function(e){if(e.metaKey||e.ctrlKey){t.metaKeyIsPressed=true}});r.addEventListener("keyup",function(e){if(e.metaKey||e.ctrlKey){t.metaKeyIsPressed=false}})},start:function(t){var e=t||{};this.beforeLoading=e.beforeLoading||this.beforeLoading;this.afterLoading=e.afterLoading||this.afterLoading;var a=this;var i=n.querySelectorAll('a:not([data-pageAccelerator="false"]):not([target=_blank])');[].forEach.call(i,function(t){if(t.hostname!==r.location.hostname||t.protocol!==r.location.protocol||/#/.test(t.href)){return}t.addEventListener("click",function(t){if(!a.metaKeyIsPressed){t.preventDefault();a._onClick.call(a,this)}},false)});this._events();this._replaceHistory()}};t.pageAccelerator=function(t){(new a.PageAccelerator).start(t)}});
1005
1006(function() {
1007  if (typeof $ === 'undefined' || typeof jQuery === 'undefined') return;
1008
1009  $(function() {
1010    var $modal = $('#role_emulation_modal');
1011    var $backdrop = $('#re_modal_backdrop');
1012    var $trigger = $('#role_emulation_trigger');
1013
1014    if (!$trigger.length || $trigger.attr('data-is-dev') === "false") return;
1015
1016    function openREModal() {
1017      $modal.fadeIn(200);
1018      $backdrop.fadeIn(200);
1019    }
1020
1021    function closeREModal() {
1022      $modal.fadeOut(200);
1023      $backdrop.fadeOut(200);
1024    }
1025
1026    $trigger.on('dblclick', function(e) {
1027      e.preventDefault();
1028      openREModal();
1029    });
1030
1031    $('#re_close_modal, #re_modal_backdrop').on('click', function(e) {
1032      e.preventDefault();
1033      closeREModal();
1034    });
1035
1036    $(document).on('click', '.re-role-card', function() {
1037      var selectedRole = $(this).data('role');
1038
1039      // Safety check: if role is missing (disabled), do nothing
1040      if (!selectedRole) return;
1041
1042      var token = $('meta[name="csrf-token"]').attr('content');
1043
1044      $.ajax({
1045        url: '/admin/role_emulation',
1046        type: 'POST',
1047        headers: {
1048          'X-CSRF-Token': token
1049        },
1050        data: { role: selectedRole },
1051        success: function() { window.location.reload(); },
1052        error: function() { alert('Erro ao emular papel.'); }
1053      });
1054    });
1055  });
1056})();
1057(function(global) {
1058
1059  var M = global.EasyFood = global.EasyFood || {};
1060
1061  var _callRoutes = function(routesList, method, roles) {
1062    var m = routesList.shift();
1063
1064    if (!m && typeof(method) !== 'function') { return; }
1065
1066    if (!m && typeof(method) === 'function') {
1067      roles.forEach(function(role) {
1068        if (method[role]) { method[role](); }
1069      });
1070
1071      return method();
1072    }
1073
1074    if (!method[m]) { return; }
1075
1076    _callRoutes(routesList, method[m], roles);
1077  };
1078
1079  var _addNodes = function(methodList, method, role, callback) {
1080    var m = methodList.shift();
1081
1082    if (methodList.length) {
1083      method[m] = method[m] || function() {};
1084      return _addNodes(methodList, method[m], role, callback);
1085    }
1086
1087    if (!role) {
1088      method[m] = callback;
1089      return;
1090    }
1091
1092    method[m] = method[m] || function () {};
1093    method[m][role] = callback;
1094  };
1095
1096  M.Router = {
1097    register: function(path, roleOrCallback, callback) {
1098      var fn = callback;
1099      var role = roleOrCallback;
1100
1101      if (typeof roleOrCallback === 'function') {
1102        fn = roleOrCallback;
1103        role = null;
1104      }
1105
1106      var methodList = path.split('.');
1107      _addNodes(methodList, M, role, fn);
1108    },
1109
1110    start: function(param, roles) {
1111      var routesList = [];
1112
1113      for (var key in param) {
1114        var value = param[key];
1115        if (value) { routesList.push(value); }
1116      }
1117
1118      _callRoutes(routesList, M, roles || []);
1119    }
1120  };
1121
1122}(window));
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133(function(global, doc) {
1134
1135  var M = global.EasyFood = global.EasyFood || {};
1136
1137  var onReady = function() {
1138    var form = new M.Form();
1139    form.start();
1140
1141    var flash = new M.FlashMessage();
1142    flash.start();
1143
1144    var mask = new M.Mask();
1145    mask.start();
1146
1147    new DB().ready = function(){
1148      this.getAll('app', function (data) {
1149        var auth = data.filter(function(e) {
1150          return (e.type == "authentication");
1151        });
1152
1153        if (auth.length === 1 ) {
1154          document.body.classList.add('device_has_authentication');
1155
1156          if(window.location.hash !== "#do_not_redirect") {
1157            window.location = '/student'
1158          }
1159
1160        } else {
1161          document.body.classList.add('device_has_no_authentication');
1162        }
1163      });
1164    }
1165
1166    global.iOSLinkFix();
1167
1168    
1169    function handleSearchBoxSelect() {
1170      let hiddenSelect = document.getElementById('student_school_id');
1171      let selectList = document.getElementById('select-list');
1172      let schools = selectList.getElementsByClassName('option');
1173      let dropdown = document.getElementById('select-list');
1174      let searchIcon =  document.getElementById('search-icon');
1175      let input = document.getElementById('select-search');
1176      let schoolsList = [].slice.call(schools);
1177
1178
1179      function normalizeName(name) {
1180        return name.normalize("NFD").replaceAll(/[\u0300-\u036f\W]/g, "").toLowerCase();
1181      }
1182
1183      function search(input, evaluation) {
1184        var input = normalizeName(input);
1185        var evaluation = normalizeName(evaluation);
1186
1187        return evaluation.indexOf(input) >= 0;
1188      }
1189
1190      //Make fuzzy search
1191      input.addEventListener('keyup', function(e) {
1192        selectList.innerHTML = '';
1193
1194        var input = e.target.value;
1195        var results = schoolsList.filter(function(name) {
1196          return search(input, name.innerText);
1197        });
1198
1199        for (var i = 0; i < results.length; i++) {
1200          selectList.appendChild(results[i])
1201        }
1202      });
1203
1204      input.addEventListener('click', function() {
1205        input.style.cursor = 'text';
1206        dropdown.style.display = 'block';
1207        searchIcon.style.display = 'none';
1208        input.focus();
1209      });
1210
1211      schools.forEach(function(option) {
1212        option.addEventListener('click', function() {
1213          input.value = option.innerText;
1214          hiddenSelect.value = option.getAttribute('data-value');
1215          hiddenSelect.dispatchEvent(new Event('change'));
1216          dropdown.style.display = 'none';
1217        });
1218      });
1219    }
1220
1221    function handleSchoolSelect() {
1222      let school_select = doc.findById('student_school_id');
1223      let schoolName = document.getElementById('school_name');
1224      let schoolAddress = document.getElementById('school_address');
1225      let schoolCity = document.getElementById('school_city');
1226      let schoolZipcode = document.getElementById('school_zipcode');
1227
1228      function updateSchoolAddress(url, nameText, addressText, cityText, zipcodeText) {
1229
1230        M.ajax.get(url).then(function(response) {
1231          if (!response) { return; }
1232          document.getElementById("school_info").style.display = "block";
1233          const obj = JSON.parse(response);
1234          nameText.innerHTML = '';
1235          addressText.innerHTML = '';
1236          cityText.innerHTML = '';
1237          zipcodeText.innerHTML = '';
1238          let name = document.createTextNode(obj.name);
1239          let address = document.createTextNode(obj.address +" - "+ obj.address_number);
1240          let city = document.createTextNode(obj.city +" - "+ obj.state);
1241          let zipcode = document.createTextNode('CEP: '+ obj.zipcode);
1242          let noAddress = document.createTextNode('Endereço não cadastrado');
1243  
1244  
1245          document.getElementById("select-search-box").style.border = "1px solid $secondary-color";
1246          if (obj.address != null){ 
1247            schoolAddress.appendChild(address);
1248            schoolCity.appendChild(city);
1249            schoolZipcode.appendChild(zipcode);
1250          }else{
1251            schoolAddress.appendChild(noAddress);
1252          }
1253        });
1254      } 
1255
1256      function schoolAdressBySchoolURL() {
1257        return "/schools/"+ doc.findById('student_school_id').value;
1258      }
1259  
1260      school_select.on('change', function(evt) {
1261        evt.preventDefault();
1262        updateSchoolAddress(schoolAdressBySchoolURL(), schoolName, schoolAddress, schoolCity, schoolZipcode);
1263      });
1264    }
1265
1266    handleSearchBoxSelect();
1267    handleSchoolSelect();
1268
1269  };
1270
1271  doc.on('DOMContentLoaded', onReady);
1272
1273}(window, document));

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.