PageSourceSearch

https://www.bronnitsy.com/static/theme/js/jquery.suggestions.dadata.min.js?v=1

js bronnitsy.com collected 2026-09-29 14:07:47 UTC 94,399 bytes, 3,116 lines download raw bytes

1!(function (e, t) {
2  "object" == typeof exports && "undefined" != typeof module
3    ? t(require("jquery"))
4    : "function" == typeof define && define.amd
5    ? define(["jquery"], t)
6    : t(e.jQuery);
7})(this, function (e) {
8  "use strict";
9  function t(e, t) {
10    return function (n, i) {
11      var s,
12        o = [];
13      return (
14        t(i) &&
15          ((s = k.splitTokens(k.split(n, e))),
16          y.each(i, function (t, i) {
17            var r = t.value;
18            if (k.stringEncloses(n, r)) return !1;
19            var a = k.splitTokens(k.split(r, e));
20            0 === y.minus(s, a).length && o.push(i);
21          })),
22        1 === o.length ? o[0] : -1
23      );
24    };
25  }
26  function n(e, t) {
27    var n = e.data && e.data[t];
28    return (
29      n &&
30      new RegExp("^" + k.escapeRegExChars(n) + "([" + w + "]|$)", "i").test(
31        e.value
32      )
33    );
34  }
35  function i(e, t) {
36    var n = /<strong>/;
37    return n.test(t) && !n.test(e) ? t : e;
38  }
39  function s(e, t, n, s, o) {
40    var r = this;
41    return i(r.highlightMatches(e, n, s, o), r.highlightMatches(t, n, s, o));
42  }
43  function o(e) {
44    (this.urlSuffix = e.toLowerCase()),
45      (this.noSuggestionsHint = "Неизвестное значение"),
46      (this.matchers = [F.matchByNormalizedQuery(), F.matchByWords()]);
47  }
48  function r(t, n) {
49    var i = this;
50    (i.element = t),
51      (i.el = e(t)),
52      (i.suggestions = []),
53      (i.badQueries = []),
54      (i.selectedIndex = -1),
55      (i.currentValue = i.element.value),
56      (i.intervalId = 0),
57      (i.cachedResponse = {}),
58      (i.enrichmentCache = {}),
59      (i.currentRequest = null),
60      (i.inputPhase = e.Deferred()),
61      (i.fetchPhase = e.Deferred()),
62      (i.enrichPhase = e.Deferred()),
63      (i.onChangeTimeout = null),
64      (i.triggering = {}),
65      (i.$wrapper = null),
66      (i.options = e.extend({}, V, n)),
67      (i.classes = x),
68      (i.disabled = !1),
69      (i.selection = null),
70      (i.$viewport = e(window)),
71      (i.$body = e(document.body)),
72      (i.type = null),
73      (i.status = {}),
74      i.setupElement(),
75      (i.initializer = e.Deferred()),
76      i.el.is(":visible") ? i.initializer.resolve() : i.deferInitialization(),
77      i.initializer.done(e.proxy(i.initialize, i));
78  }
79  function a() {
80    L.each(G, function (e) {
81      e.abort();
82    }),
83      (G = {});
84  }
85  function u() {
86    (X = null), (V.geoLocation = Y);
87  }
88  function l(t) {
89    return e
90      .map(t, function (e) {
91        var t = L.escapeHtml(e.text);
92        return t && e.matched && (t = "<strong>" + t + "</strong>"), t;
93      })
94      .join("");
95  }
96  function c(t, n) {
97    var i = t.split(", ");
98    return 1 === i.length
99      ? t
100      : e
101          .map(i, function (e) {
102            return '<span class="' + n + '">' + e + "</span>";
103          })
104          .join(", ");
105  }
106  function d(t, n) {
107    var i = !1;
108    return (
109      e.each(t, function (e, t) {
110        if ((i = t.value == n.value && t != n)) return !1;
111      }),
112      i
113    );
114  }
115  function f(e, t) {
116    var n = t.selection,
117      i = n && n.data && t.bounds;
118    return (
119      i &&
120        y.each(t.bounds.all, function (t, s) {
121          return (i = n.data[t] === e.data[t]);
122        }),
123      i
124    );
125  }
126  function p(e) {
127    var t = e.replace(/^(\d{2})(\d*?)(0+)$/g, "$1$2"),
128      n = t.length,
129      i = -1;
130    return (
131      n <= 2
132        ? (i = 2)
133        : n > 2 && n <= 5
134        ? (i = 5)
135        : n > 5 && n <= 8
136        ? (i = 8)
137        : n > 8 && n <= 11
138        ? (i = 11)
139        : n > 11 && n <= 15
140        ? (i = 15)
141        : n > 15 && (i = 19),
142      k.padEnd(t, i, "0")
143    );
144  }
145  function g(e) {
146    this.plan = e.status.plan;
147    var t = e.getContainer();
148    this.element = de.selectByClass(x.promo, t);
149  }
150  function h() {
151    new g(this).show();
152  }
153  e = e && e.hasOwnProperty("default") ? e.default : e;
154  var m = {
155      isArray: function (e) {
156        return Array.isArray(e);
157      },
158      isFunction: function (e) {
159        return "[object Function]" === Object.prototype.toString.call(e);
160      },
161      isEmptyObject: function (e) {
162        return 0 === Object.keys(e).length && e.constructor === Object;
163      },
164      isPlainObject: function (e) {
165        return (
166          void 0 !== e &&
167          "object" == typeof e &&
168          null !== e &&
169          !e.nodeType &&
170          e !== e.window &&
171          !(
172            e.constructor &&
173            !Object.prototype.hasOwnProperty.call(
174              e.constructor.prototype,
175              "isPrototypeOf"
176            )
177          )
178        );
179      },
180    },
181    y = {
182      compact: function (e) {
183        return e.filter(function (e) {
184          return !!e;
185        });
186      },
187      each: function (e, t) {
188        if (Array.isArray(e))
189          return void e.some(function (e, n) {
190            return !1 === t(e, n);
191          });
192        Object.keys(e).some(function (n) {
193          var i = e[n];
194          return !1 === t(i, n);
195        });
196      },
197      intersect: function (e, t) {
198        var n = [];
199        return Array.isArray(e) && Array.isArray(t)
200          ? e.filter(function (e) {
201              return -1 !== t.indexOf(e);
202            })
203          : n;
204      },
205      minus: function (e, t) {
206        return t && 0 !== t.length
207          ? e.filter(function (e) {
208              return -1 === t.indexOf(e);
209            })
210          : e;
211      },
212      makeArray: function (e) {
213        return m.isArray(e) ? Array.prototype.slice.call(e) : [e];
214      },
215      minusWithPartialMatching: function (e, t) {
216        return t && 0 !== t.length
217          ? e.filter(function (e) {
218              return !t.some(function (t) {
219                return 0 === t.indexOf(e);
220              });
221            })
222          : e;
223      },
224      slice: function (e, t) {
225        return Array.prototype.slice.call(e, t);
226      },
227    },
228    _ = {
229      delay: function (e, t) {
230        return setTimeout(e, t || 0);
231      },
232    },
233    v = {
234      areSame: function e(t, n) {
235        var i = !0;
236        return (
237          typeof t == typeof n &&
238          ("object" == typeof t && null != t && null != n
239            ? (y.each(t, function (t, s) {
240                return (i = e(t, n[s]));
241              }),
242              i)
243            : t === n)
244        );
245      },
246      assign: function (e, t) {
247        if ("function" == typeof Object.assign)
248          return Object.assign.apply(null, arguments);
249        if (null == e)
250          throw new TypeError("Cannot convert undefined or null to object");
251        for (var n = Object(e), i = 1; i < arguments.length; i++) {
252          var s = arguments[i];
253          if (null != s)
254            for (var o in s)
255              Object.prototype.hasOwnProperty.call(s, o) && (n[o] = s[o]);
256        }
257        return n;
258      },
259      clone: function (e) {
260        return JSON.parse(JSON.stringify(e));
261      },
262      compact: function (e) {
263        var t = v.clone(e);
264        return (
265          y.each(t, function (e, n) {
266            (null !== e && void 0 !== e && "" !== e) || delete t[n];
267          }),
268          t
269        );
270      },
271      fieldsAreNotEmpty: function (e, t) {
272        if (!m.isPlainObject(e)) return !1;
273        var n = !0;
274        return (
275          y.each(t, function (t, i) {
276            return (n = !!e[t]);
277          }),
278          n
279        );
280      },
281      getDeepValue: function e(t, n) {
282        var i = n.split("."),
283          s = i.shift();
284        return t && (i.length ? e(t[s], i.join(".")) : t[s]);
285      },
286      indexObjectsById: function (e, t, n) {
287        var i = {};
288        return (
289          y.each(e, function (e, s) {
290            var o = e[t],
291              r = {};
292            n && (r[n] = s), (i[o] = v.assign(r, e));
293          }),
294          i
295        );
296      },
297    },
298    b = { ENTER: 13, ESC: 27, TAB: 9, SPACE: 32, UP: 38, DOWN: 40 },
299    x = {
300      hint: "suggestions-hint",
301      mobile: "suggestions-mobile",
302      nowrap: "suggestions-nowrap",
303      promo: "suggestions-promo",
304      selected: "suggestions-selected",
305      suggestion: "suggestions-suggestion",
306      subtext: "suggestions-subtext",
307      subtext_inline: "suggestions-subtext suggestions-subtext_inline",
308      subtext_delimiter: "suggestions-subtext-delimiter",
309      subtext_label: "suggestions-subtext suggestions-subtext_label",
310      removeConstraint: "suggestions-remove",
311      value: "suggestions-value",
312    },
313    S = ".suggestions",
314    w = "\\s\"'~\\*\\.,:\\|\\[\\]\\(\\)\\{\\}<>№",
315    C = new RegExp("[" + w + "]+", "g"),
316    E = new RegExp("[\\-\\+\\\\\\?!@#$%^&]+", "g"),
317    k = {
318      escapeHtml: function (e) {
319        var t = {
320          "&": "&amp;",
321          "<": "&lt;",
322          ">": "&gt;",
323          '"': "&quot;",
324          "'": "&#x27;",
325          "/": "&#x2F;",
326        };
327        return (
328          e &&
329            y.each(t, function (t, n) {
330              e = e.replace(new RegExp(n, "g"), t);
331            }),
332          e
333        );
334      },
335      escapeRegExChars: function (e) {
336        return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
337      },
338      formatToken: function (e) {
339        return e && e.toLowerCase().replace(/[ёЁ]/g, "е");
340      },
341      getWordExtractorRegExp: function () {
342        return new RegExp("([^" + w + "]*)([" + w + "]*)", "g");
343      },
344      normalize: function (e, t) {
345        return k.split(e, t).join(" ");
346      },
347      padEnd: function (e, t, n) {
348        return String.prototype.padEnd
349          ? e.padEnd(t, n)
350          : ((t >>= 0),
351            (n = String(void 0 !== n ? n : " ")),
352            e.length > t
353              ? String(e)
354              : ((t -= e.length),
355                t > n.length && (n += n.repeat(t / n.length)),
356                String(e) + n.slice(0, t)));
357      },
358      split: function (e, t) {
359        var n = e
360            .toLowerCase()
361            .replace("ё", "е")
362            .replace(/(\d+)([а-я]{2,})/g, "$1 $2")
363            .replace(/([а-я]+)(\d+)/g, "$1 $2"),
364          i = y.compact(n.split(C));
365        if (!i.length) return [];
366        var s = i.pop(),
367          o = y.minus(i, t);
368        return o.push(s), o;
369      },
370      splitTokens: function (e) {
371        var t = [];
372        return (
373          y.each(e, function (e, n) {
374            var i = e.split(E);
375            t = t.concat(y.compact(i));
376          }),
377          t
378        );
379      },
380      stringEncloses: function (e, t) {
381        return (
382          e.length > t.length && -1 !== e.toLowerCase().indexOf(t.toLowerCase())
383        );
384      },
385      tokenize: function (e, t) {
386        var n = y.compact(k.formatToken(e).split(C)),
387          i = y.minus(n, t),
388          s = y.minus(n, i);
389        return (n = k.withSubTokens(i.concat(s)));
390      },
391      withSubTokens: function (e) {
392        var t = [];
393        return (
394          y.each(e, function (e, n) {
395            var i = e.split(E);
396            t.push(e), i.length > 1 && (t = t.concat(y.compact(i)));
397          }),
398          t
399        );
400      },
401    },
402    B = {
403      Deferred: function () {
404        return e.Deferred();
405      },
406      ajax: function (t) {
407        return e.ajax(t);
408      },
409      extend: function () {
410        return e.extend.apply(null, arguments);
411      },
412      isJqObject: function (t) {
413        return t instanceof e;
414      },
415      param: function (t) {
416        return e.param(t);
417      },
418      proxy: function (t, n) {
419        return e.proxy(t, n);
420      },
421      select: function (t) {
422        return e(t);
423      },
424      supportsCors: function () {
425        return e.support.cors;
426      },
427    },
428    T = {
429      getDefaultType: function () {
430        return B.supportsCors() ? "POST" : "GET";
431      },
432      getDefaultContentType: function () {
433        return B.supportsCors()
434          ? "application/json"
435          : "application/x-www-form-urlencoded";
436      },
437      fixURLProtocol: function (e) {
438        return B.supportsCors() ? e : e.replace(/^https?:/, location.protocol);
439      },
440      addUrlParams: function (e, t) {
441        return e + (/\?/.test(e) ? "&" : "?") + B.param(t);
442      },
443      serialize: function (e) {
444        return B.supportsCors()
445          ? JSON.stringify(e, function (e, t) {
446              return null === t ? void 0 : t;
447            })
448          : ((e = v.compact(e)), B.param(e, !0));
449      },
450    },
451    j = (function () {
452      var e = 0;
453      return function (t) {
454        return (t || "") + ++e;
455      };
456    })(),
457    L = {
458      escapeRegExChars: k.escapeRegExChars,
459      escapeHtml: k.escapeHtml,
460      formatToken: k.formatToken,
461      normalize: k.normalize,
462      reWordExtractor: k.getWordExtractorRegExp,
463      stringEncloses: k.stringEncloses,
464      addUrlParams: T.addUrlParams,
465      getDefaultContentType: T.getDefaultContentType,
466      getDefaultType: T.getDefaultType,
467      fixURLProtocol: T.fixURLProtocol,
468      serialize: T.serialize,
469      arrayMinus: y.minus,
470      arrayMinusWithPartialMatching: y.minusWithPartialMatching,
471      arraysIntersection: y.intersect,
472      compact: y.compact,
473      each: y.each,
474      makeArray: y.makeArray,
475      slice: y.slice,
476      delay: _.delay,
477      areSame: v.areSame,
478      compactObject: v.compact,
479      getDeepValue: v.getDeepValue,
480      fieldsNotEmpty: v.fieldsAreNotEmpty,
481      indexBy: v.indexObjectsById,
482      isArray: m.isArray,
483      isEmptyObject: m.isEmptyObject,
484      isFunction: m.isFunction,
485      isPlainObject: m.isPlainObject,
486      uniqueId: j,
487    },
488    V = {
489      $helpers: null,
490      autoSelectFirst: !1,
491      containerClass: "suggestions-suggestions",
492      count: 5,
493      deferRequestBy: 100,
494      enrichmentEnabled: !0,
495      formatResult: null,
496      formatSelected: null,
497      headers: null,
498      hint: "Выберите вариант или продолжите ввод",
499      initializeInterval: 100,
500      language: null,
501      minChars: 1,
502      mobileWidth: 600,
503      noCache: !1,
504      noSuggestionsHint: null,
505      onInvalidateSelection: null,
506      onSearchComplete: e.noop,
507      onSearchError: e.noop,
508      onSearchStart: e.noop,
509      onSelect: null,
510      onSelectNothing: null,
511      onSuggestionsFetch: null,
512      paramName: "query",
513      params: {},
514      preventBadQueries: !1,
515      requestMode: "suggest",
516      scrollOnFocus: !1,
517      serviceUrl: "https://suggestions.dadata.ru/suggestions/api/4_1/rs",
518      tabDisabled: !1,
519      timeout: 3e3,
520      triggerSelectOnBlur: !0,
521      triggerSelectOnEnter: !0,
522      triggerSelectOnSpace: !1,
523      type: null,
524      url: null,
525    },
526    O = (function (e) {
527      return function (t) {
528        if (0 === t.length) return !1;
529        if (1 === t.length) return !0;
530        var n = e(t[0].value);
531        return (
532          0 ===
533          t.filter(function (t) {
534            return 0 !== e(t.value).indexOf(n);
535          }).length
536        );
537      };
538    })(function (e) {
539      return e;
540    }),
541    F = {
542      matchByNormalizedQuery: function (e) {
543        return function (t, n) {
544          var i = k.normalize(t, e),
545            s = [];
546          return (
547            y.each(n, function (n, o) {
548              var r = n.value.toLowerCase();
549              return (
550                !k.stringEncloses(t, r) &&
551                !(r.indexOf(i) > 0) &&
552                void (i === k.normalize(r, e) && s.push(o))
553              );
554            }),
555            1 === s.length ? s[0] : -1
556          );
557        };
558      },
559      matchByWords: function (e) {
560        return t(e, O);
561      },
562      matchByWordsAddress: function (e) {
563        return t(e, O);
564      },
565      matchByFields: function (e) {
566        return function (t, n) {
567          var i = k.splitTokens(k.split(t)),
568            s = [];
569          return 1 === n.length &&
570            (e &&
571              y.each(e, function (e, t) {
572                var i = v.getDeepValue(n[0], t),
573                  o = i && k.splitTokens(k.split(i, e));
574                o && o.length && (s = s.concat(o));
575              }),
576            0 === y.minusWithPartialMatching(i, s).length)
577            ? 0
578            : -1;
579        };
580      },
581    },
582    P = [
583      "ао",
584      "аобл",
585      "дом",
586      "респ",
587      "а/я",
588      "аал",
589      "автодорога",
590      "аллея",
591      "арбан",
592      "аул",
593      "б-р",
594      "берег",
595      "бугор",
596      "вал",
597      "вл",
598      "волость",
599      "въезд",
600      "высел",
601      "г",
602      "городок",
603      "гск",
604      "д",
605      "двлд",
606      "днп",
607      "дор",
608      "дп",
609      "ж/д_будка",
610      "ж/д_казарм",
611      "ж/д_оп",
612      "ж/д_платф",
613      "ж/д_пост",
614      "ж/д_рзд",
615      "ж/д_ст",
616      "жилзона",
617      "жилрайон",
618      "жт",
619      "заезд",
620      "заимка",
621      "зона",
622      "к",
623      "казарма",
624      "канал",
625      "кв",
626      "кв-л",
627      "км",
628      "кольцо",
629      "комн",
630      "кордон",
631      "коса",
632      "кп",
633      "край",
634      "линия",
635      "лпх",
636      "м",
637      "массив",
638      "местность",
639      "мкр",
640      "мост",
641      "н/п",
642      "наб",
643      "нп",
644      "обл",
645      "округ",
646      "остров",
647      "оф",
648      "п",
649      "п/о",
650      "п/р",
651      "п/ст",
652      "парк",
653      "пгт",
654      "пер",
655      "переезд",
656      "пл",
657      "пл-ка",
658      "платф",
659      "погост",
660      "полустанок",
661      "починок",
662      "пр-кт",
663      "проезд",
664      "промзона",
665      "просек",
666      "просека",
667      "проселок",
668      "проток",
669      "протока",
670      "проулок",
671      "р-н",
672      "рзд",
673      "россия",
674      "рп",
675      "ряды",
676      "с",
677      "с/а",
678      "с/мо",
679      "с/о",
680      "с/п",
681      "с/с",
682      "сад",
683      "сквер",
684      "сл",
685      "снт",
686      "спуск",
687      "ст",
688      "ст-ца",
689      "стр",
690      "тер",
691      "тракт",
692      "туп",
693      "у",
694      "ул",
695      "уч-к",
696      "ф/х",
697      "ферма",
698      "х",
699      "ш",
700      "бульвар",
701      "владение",
702      "выселки",
703      "гаражно-строительный",
704      "город",
705      "деревня",
706      "домовладение",
707      "дорога",
708      "квартал",
709      "километр",
710      "комната",
711      "корпус",
712      "литер",
713      "леспромхоз",
714      "местечко",
715      "микрорайон",
716      "набережная",
717      "область",
718      "переулок",
719      "платформа",
720      "площадка",
721      "площадь",
722      "поселение",
723      "поселок",
724      "проспект",
725      "разъезд",
726      "район",
727      "республика",
728      "село",
729      "сельсовет",
730      "слобода",
731      "сооружение",
732      "станица",
733      "станция",
734      "строение",
735      "территория",
736      "тупик",
737      "улица",
738      "улус",
739      "участок",
740      "хутор",
741      "шоссе",
742    ],
743    D = [
744      { id: "kladr_id", fields: ["kladr_id"], forBounds: !1, forLocations: !0 },
745      {
746        id: "postal_code",
747        fields: ["postal_code"],
748        forBounds: !1,
749        forLocations: !0,
750      },
751      {
752        id: "country_iso_code",
753        fields: ["country_iso_code"],
754        forBounds: !1,
755        forLocations: !0,
756      },
757      {
758        id: "country",
759        fields: ["country"],
760        forBounds: !0,
761        forLocations: !0,
762        kladrFormat: { digits: 0, zeros: 13 },
763        fiasType: "country_iso_code",
764      },
765      {
766        id: "region_iso_code",
767        fields: ["region_iso_code"],
768        forBounds: !1,
769        forLocations: !0,
770      },
771      {
772        id: "region_fias_id",
773        fields: ["region_fias_id"],
774        forBounds: !1,
775        forLocations: !0,
776      },
777      {
778        id: "region_type_full",
779        fields: ["region_type_full"],
780        forBounds: !1,
781        forLocations: !0,
782        kladrFormat: { digits: 2, zeros: 11 },
783        fiasType: "region_fias_id",
784      },
785      {
786        id: "region",
787        fields: [
788          "region",
789          "region_type",
790          "region_type_full",
791          "region_with_type",
792        ],
793        forBounds: !0,
794        forLocations: !0,
795        kladrFormat: { digits: 2, zeros: 11 },
796        fiasType: "region_fias_id",
797      },
798      {
799        id: "area_fias_id",
800        fields: ["area_fias_id"],
801        forBounds: !1,
802        forLocations: !0,
803      },
804      {
805        id: "area_type_full",
806        fields: ["area_type_full"],
807        forBounds: !1,
808        forLocations: !0,
809        kladrFormat: { digits: 5, zeros: 8 },
810        fiasType: "area_fias_id",
811      },
812      {
813        id: "area",
814        fields: ["area", "area_type", "area_type_full", "area_with_type"],
815        forBounds: !0,
816        forLocations: !0,
817        kladrFormat: { digits: 5, zeros: 8 },
818        fiasType: "area_fias_id",
819      },
820      {
821        id: "city_fias_id",
822        fields: ["city_fias_id"],
823        forBounds: !1,
824        forLocations: !0,
825      },
826      {
827        id: "city_type_full",
828        fields: ["city_type_full"],
829        forBounds: !1,
830        forLocations: !0,
831        kladrFormat: { digits: 8, zeros: 5 },
832        fiasType: "city_fias_id",
833      },
834      {
835        id: "city",
836        fields: ["city", "city_type", "city_type_full", "city_with_type"],
837        forBounds: !0,
838        forLocations: !0,
839        kladrFormat: { digits: 8, zeros: 5 },
840        fiasType: "city_fias_id",
841      },
842      {
843        id: "city_district_fias_id",
844        fields: ["city_district_fias_id"],
845        forBounds: !1,
846        forLocations: !0,
847      },
848      {
849        id: "city_district_type_full",
850        fields: ["city_district_type_full"],
851        forBounds: !1,
852        forLocations: !0,
853        kladrFormat: { digits: 11, zeros: 2 },
854        fiasType: "city_district_fias_id",
855      },
856      {
857        id: "city_district",
858        fields: [
859          "city_district",
860          "city_district_type",
861          "city_district_type_full",
862          "city_district_with_type",
863        ],
864        forBounds: !0,
865        forLocations: !0,
866        kladrFormat: { digits: 11, zeros: 2 },
867        fiasType: "city_district_fias_id",
868      },
869      {
870        id: "settlement_fias_id",
871        fields: ["settlement_fias_id"],
872        forBounds: !1,
873        forLocations: !0,
874      },
875      {
876        id: "settlement_type_full",
877        fields: ["settlement_type_full"],
878        forBounds: !1,
879        forLocations: !0,
880        kladrFormat: { digits: 11, zeros: 2 },
881        fiasType: "settlement_fias_id",
882      },
883      {
884        id: "settlement",
885        fields: [
886          "settlement",
887          "settlement_type",
888          "settlement_type_full",
889          "settlement_with_type",
890        ],
891        forBounds: !0,
892        forLocations: !0,
893        kladrFormat: { digits: 11, zeros: 2 },
894        fiasType: "settlement_fias_id",
895      },
896      {
897        id: "street_fias_id",
898        fields: ["street_fias_id"],
899        forBounds: !1,
900        forLocations: !0,
901      },
902      {
903        id: "street_type_full",
904        fields: ["street_type_full"],
905        forBounds: !1,
906        forLocations: !0,
907        kladrFormat: { digits: 15, zeros: 2 },
908        fiasType: "street_fias_id",
909      },
910      {
911        id: "street",
912        fields: [
913          "street",
914          "street_type",
915          "street_type_full",
916          "street_with_type",
917        ],
918        forBounds: !0,
919        forLocations: !0,
920        kladrFormat: { digits: 15, zeros: 2 },
921        fiasType: "street_fias_id",
922      },
923      {
924        id: "house",
925        fields: [
926          "house",
927          "house_type",
928          "house_type_full",
929          "block",
930          "block_type",
931        ],
932        forBounds: !0,
933        forLocations: !0,
934        kladrFormat: { digits: 19 },
935        fiasType: "house_fias_id",
936      },
937      {
938        id: "flat",
939        fields: ["flat", "flat_type", "flat_type_full"],
940        forBounds: !0,
941        forLocations: !1,
942        kladrFormat: { digits: 19 },
943        fiasType: "flat_fias_id",
944      },
945    ],
946    z = {
947      urlSuffix: "address",
948      noSuggestionsHint: "Неизвестный адрес",
949      matchers: [F.matchByNormalizedQuery(P), F.matchByWordsAddress(P)],
950      dataComponents: D,
951      dataComponentsById: v.indexObjectsById(D, "id", "index"),
952      unformattableTokens: P,
953      enrichmentEnabled: !0,
954      enrichmentMethod: "suggest",
955      enrichmentParams: {
956        count: 1,
957        locations: null,
958        locations_boost: null,
959        from_bound: null,
960        to_bound: null,
961      },
962      getEnrichmentQuery: function (e) {
963        return e.unrestricted_value;
964      },
965      geoEnabled: !0,
966      isDataComplete: function (e) {
967        var t = [this.bounds.to || "flat"],
968          n = e.data;
969        return !m.isPlainObject(n) || v.fieldsAreNotEmpty(n, t);
970      },
971      composeValue: function (e, t) {
972        var n = e.country,
973          i =
974            e.region_with_type ||
975            y.compact([e.region, e.region_type]).join(" ") ||
976            e.region_type_full,
977          s =
978            e.area_with_type ||
979            y.compact([e.area_type, e.area]).join(" ") ||
980            e.area_type_full,
981          o =
982            e.city_with_type ||
983            y.compact([e.city_type, e.city]).join(" ") ||
984            e.city_type_full,
985          r =
986            e.settlement_with_type ||
987            y.compact([e.settlement_type, e.settlement]).join(" ") ||
988            e.settlement_type_full,
989          a =
990            e.city_district_with_type ||
991            y.compact([e.city_district_type, e.city_district]).join(" ") ||
992            e.city_district_type_full,
993          u =
994            e.street_with_type ||
995            y.compact([e.street_type, e.street]).join(" ") ||
996            e.street_type_full,
997          l = y
998            .compact([
999              e.stead_type,
1000              e.stead,
1001              e.house_type,
1002              e.house,
1003              e.block_type,
1004              e.block,
1005            ])
1006            .join(" "),
1007          c = y.compact([e.flat_type, e.flat]).join(" "),
1008          d = e.postal_box && "а/я " + e.postal_box;
1009        return (
1010          i === o && (i = ""),
1011          (t && t.saveCityDistrict) ||
1012            (t && t.excludeCityDistrict
1013              ? (a = "")
1014              : a && !e.city_district_fias_id && (a = "")),
1015          y.compact([n, i, s, o, a, r, u, l, c, d]).join(", ")
1016        );
1017      },
1018      formatResult: (function () {
1019        var e = [],
1020          t = !1;
1021        return (
1022          D.forEach(function (n) {
1023            t && e.push(n.id), "city_district" === n.id && (t = !0);
1024          }),
1025          function (t, n, i, s) {
1026            var o,
1027              r,
1028              a,
1029              u = this,
1030              l = i.data && i.data.city_district_with_type,
1031              c = s && s.unformattableTokens,
1032              d = i.data && i.data.history_values;
1033            return (
1034              d &&
1035                d.length > 0 &&
1036                ((o = k.tokenize(n, c)),
1037                (r = this.type.findUnusedTokens(o, t)),
1038                (a = this.type.getFormattedHistoryValues(r, d)) && (t += a)),
1039              (t = u.highlightMatches(t, n, i, s)),
1040              (t = u.wrapFormattedValue(t, i)),
1041              l &&
1042                (!u.bounds.own.length || u.bounds.own.indexOf("street") >= 0) &&
1043                !m.isEmptyObject(u.copyDataComponents(i.data, e)) &&
1044                (t +=
1045                  '<div class="' +
1046                  u.classes.subtext +
1047                  '">' +
1048                  u.highlightMatches(l, n, i) +
1049                  "</div>"),
1050              t
1051            );
1052          }
1053        );
1054      })(),
1055      findUnusedTokens: function (e, t) {
1056        return e.filter(function (e) {
1057          return -1 === t.indexOf(e);
1058        });
1059      },
1060      getFormattedHistoryValues: function (e, t) {
1061        var n = [],
1062          i = "";
1063        return (
1064          t.forEach(function (t) {
1065            y.each(e, function (e) {
1066              if (t.toLowerCase().indexOf(e) >= 0) return n.push(t), !1;
1067            });
1068          }),
1069          n.length > 0 && (i = " (бывш. " + n.join(", ") + ")"),
1070          i
1071        );
1072      },
1073      getSuggestionValue: function (e, t) {
1074        var n = null;
1075        return (
1076          t.hasSameValues
1077            ? (n = e.options.restrict_value
1078                ? this.getValueWithinConstraints(e, t.suggestion)
1079                : e.bounds.own.length
1080                ? this.getValueWithinBounds(e, t.suggestion)
1081                : t.suggestion.unrestricted_value)
1082            : t.hasBeenEnriched &&
1083              e.options.restrict_value &&
1084              (n = this.getValueWithinConstraints(e, t.suggestion, {
1085                excludeCityDistrict: !0,
1086              })),
1087          n
1088        );
1089      },
1090      getValueWithinConstraints: function (e, t, n) {
1091        return this.composeValue(e.getUnrestrictedData(t.data), n);
1092      },
1093      getValueWithinBounds: function (e, t, n) {
1094        var i = e.copyDataComponents(
1095          t.data,
1096          e.bounds.own.concat(["city_district_fias_id"])
1097        );
1098        return this.composeValue(i, n);
1099      },
1100    },
1101    I = [
1102      { id: "kladr_id", fields: ["kladr_id"], forBounds: !1, forLocations: !0 },
1103      {
1104        id: "region_fias_id",
1105        fields: ["region_fias_id"],
1106        forBounds: !1,
1107        forLocations: !0,
1108      },
1109      {
1110        id: "region_type_full",
1111        fields: ["region_type_full"],
1112        forBounds: !1,
1113        forLocations: !0,
1114        kladrFormat: { digits: 2, zeros: 11 },
1115        fiasType: "region_fias_id",
1116      },
1117      {
1118        id: "region",
1119        fields: [
1120          "region",
1121          "region_type",
1122          "region_type_full",
1123          "region_with_type",
1124        ],
1125        forBounds: !0,
1126        forLocations: !0,
1127        kladrFormat: { digits: 2, zeros: 11 },
1128        fiasType: "region_fias_id",
1129      },
1130      {
1131        id: "area_fias_id",
1132        fields: ["area_fias_id"],
1133        forBounds: !1,
1134        forLocations: !0,
1135      },
1136      {
1137        id: "area_type_full",
1138        fields: ["area_type_full"],
1139        forBounds: !1,
1140        forLocations: !0,
1141        kladrFormat: { digits: 5, zeros: 8 },
1142        fiasType: "area_fias_id",
1143      },
1144      {
1145        id: "area",
1146        fields: ["area", "area_type", "area_type_full", "area_with_type"],
1147        forBounds: !0,
1148        forLocations: !0,
1149        kladrFormat: { digits: 5, zeros: 8 },
1150        fiasType: "area_fias_id",
1151      },
1152      {
1153        id: "city_fias_id",
1154        fields: ["city_fias_id"],
1155        forBounds: !1,
1156        forLocations: !0,
1157      },
1158      {
1159        id: "city_type_full",
1160        fields: ["city_type_full"],
1161        forBounds: !1,
1162        forLocations: !0,
1163        kladrFormat: { digits: 8, zeros: 5 },
1164        fiasType: "city_fias_id",
1165      },
1166      {
1167        id: "city",
1168        fields: ["city", "city_type", "city_type_full", "city_with_type"],
1169        forBounds: !0,
1170        forLocations: !0,
1171        kladrFormat: { digits: 8, zeros: 5 },
1172        fiasType: "city_fias_id",
1173      },
1174      {
1175        id: "city_district_fias_id",
1176        fields: ["city_district_fias_id"],
1177        forBounds: !1,
1178        forLocations: !0,
1179      },
1180      {
1181        id: "city_district_type_full",
1182        fields: ["city_district_type_full"],
1183        forBounds: !1,
1184        forLocations: !0,
1185        kladrFormat: { digits: 11, zeros: 2 },
1186        fiasType: "city_district_fias_id",
1187      },
1188      {
1189        id: "city_district",
1190        fields: [
1191          "city_district",
1192          "city_district_type",
1193          "city_district_type_full",
1194          "city_district_with_type",
1195        ],
1196        forBounds: !0,
1197        forLocations: !0,
1198        kladrFormat: { digits: 11, zeros: 2 },
1199        fiasType: "city_district_fias_id",
1200      },
1201      {
1202        id: "settlement_fias_id",
1203        fields: ["settlement_fias_id"],
1204        forBounds: !1,
1205        forLocations: !0,
1206      },
1207      {
1208        id: "settlement_type_full",
1209        fields: ["settlement_type_full"],
1210        forBounds: !1,
1211        forLocations: !0,
1212        kladrFormat: { digits: 11, zeros: 2 },
1213        fiasType: "settlement_fias_id",
1214      },
1215      {
1216        id: "settlement",
1217        fields: [
1218          "settlement",
1219          "settlement_type",
1220          "settlement_type_full",
1221          "settlement_with_type",
1222        ],
1223        forBounds: !0,
1224        forLocations: !0,
1225        kladrFormat: { digits: 11, zeros: 2 },
1226        fiasType: "settlement_fias_id",
1227      },
1228      {
1229        id: "planning_structure_fias_id",
1230        fields: ["planning_structure_fias_id"],
1231        forBounds: !1,
1232        forLocations: !0,
1233      },
1234      {
1235        id: "planning_structure_type_full",
1236        fields: ["planning_structure_type_full"],
1237        forBounds: !1,
1238        forLocations: !0,
1239        kladrFormat: { digits: 15, zeros: 2 },
1240        fiasType: "planning_structure_fias_id",
1241      },
1242      {
1243        id: "planning_structure",
1244        fields: [
1245          "planning_structure",
1246          "planning_structure_type",
1247          "planning_structure_type_full",
1248          "planning_structure_with_type",
1249        ],
1250        forBounds: !0,
1251        forLocations: !0,
1252        kladrFormat: { digits: 15, zeros: 2 },
1253        fiasType: "planning_structure_fias_id",
1254      },
1255      {
1256        id: "street_fias_id",
1257        fields: ["street_fias_id"],
1258        forBounds: !1,
1259        forLocations: !0,
1260      },
1261      {
1262        id: "street_type_full",
1263        fields: ["street_type_full"],
1264        forBounds: !1,
1265        forLocations: !0,
1266        kladrFormat: { digits: 15, zeros: 2 },
1267        fiasType: "street_fias_id",
1268      },
1269      {
1270        id: "street",
1271        fields: [
1272          "street",
1273          "street_type",
1274          "street_type_full",
1275          "street_with_type",
1276        ],
1277        forBounds: !0,
1278        forLocations: !0,
1279        kladrFormat: { digits: 15, zeros: 2 },
1280        fiasType: "street_fias_id",
1281      },
1282      {
1283        id: "house",
1284        fields: ["house", "house_type", "block", "building_type", "building"],
1285        forBounds: !0,
1286        forLocations: !1,
1287        kladrFormat: { digits: 19 },
1288      },
1289    ],
1290    R = {
1291      urlSuffix: "fias",
1292      noSuggestionsHint: "Неизвестный адрес",
1293      matchers: [F.matchByNormalizedQuery(P), F.matchByWordsAddress(P)],
1294      dataComponents: I,
1295      dataComponentsById: v.indexObjectsById(I, "id", "index"),
1296      unformattableTokens: P,
1297      isDataComplete: function (e) {
1298        var t = [this.bounds.to || "house"],
1299          n = e.data;
1300        return !m.isPlainObject(n) || v.fieldsAreNotEmpty(n, t);
1301      },
1302      composeValue: function (e, t) {
1303        var n = e.country,
1304          i =
1305            e.region_with_type ||
1306            y.compact([e.region, e.region_type]).join(" ") ||
1307            e.region_type_full,
1308          s =
1309            e.area_with_type ||
1310            y.compact([e.area_type, e.area]).join(" ") ||
1311            e.area_type_full,
1312          o =
1313            e.city_with_type ||
1314            y.compact([e.city_type, e.city]).join(" ") ||
1315            e.city_type_full,
1316          r =
1317            e.settlement_with_type ||
1318            y.compact([e.settlement_type, e.settlement]).join(" ") ||
1319            e.settlement_type_full,
1320          a =
1321            e.city_district_with_type ||
1322            y.compact([e.city_district_type, e.city_district]).join(" ") ||
1323            e.city_district_type_full,
1324          u =
1325            e.planning_structure_with_type ||
1326            y
1327              .compact([e.planning_structure_type, e.planning_structure])
1328              .join(" ") ||
1329            e.planning_structure_type_full,
1330          l =
1331            e.street_with_type ||
1332            y.compact([e.street_type, e.street]).join(" ") ||
1333            e.street_type_full,
1334          c = y
1335            .compact([e.house_type, e.house, e.block_type, e.block])
1336            .join(" "),
1337          d = y.compact([e.flat_type, e.flat]).join(" "),
1338          f = e.postal_box && "а/я " + e.postal_box;
1339        return (
1340          i === o && (i = ""),
1341          (t && t.saveCityDistrict) ||
1342            (t && t.excludeCityDistrict
1343              ? (a = "")
1344              : a && !e.city_district_fias_id && (a = "")),
1345          y.compact([n, i, s, o, a, r, u, l, c, d, f]).join(", ")
1346        );
1347      },
1348      formatResult: (function () {
1349        return function (e, t, n, i) {
1350          var s = this;
1351          return (
1352            (e = s.highlightMatches(e, t, n, i)),
1353            (e = s.wrapFormattedValue(e, n))
1354          );
1355        };
1356      })(),
1357      getSuggestionValue: z.getSuggestionValue,
1358      getValueWithinConstraints: z.getValueWithinConstraints,
1359      getValueWithinBounds: z.getValueWithinBounds,
1360    },
1361    q = {
1362      urlSuffix: "fio",
1363      noSuggestionsHint: !1,
1364      matchers: [F.matchByNormalizedQuery(), F.matchByWords()],
1365      fieldNames: { surname: "фамилия", name: "имя", patronymic: "отчество" },
1366      isDataComplete: function (e) {
1367        var t,
1368          i = this,
1369          s = i.options.params,
1370          o = e.data;
1371        return (
1372          m.isFunction(s) && (s = s.call(i.element, e.value)),
1373          s && s.parts
1374            ? (t = s.parts.map(function (e) {
1375                return e.toLowerCase();
1376              }))
1377            : ((t = ["surname", "name"]),
1378              n(e, "surname") && t.push("patronymic")),
1379          v.fieldsAreNotEmpty(o, t)
1380        );
1381      },
1382      composeValue: function (e) {
1383        return y.compact([e.surname, e.name, e.patronymic]).join(" ");
1384      },
1385    },
1386    A = { LEGAL: [2, 2, 5, 1], INDIVIDUAL: [2, 2, 6, 2] },
1387    $ = {
1388      urlSuffix: "party",
1389      noSuggestionsHint: "Неизвестная организация",
1390      matchers: [
1391        F.matchByFields({
1392          value: null,
1393          "data.address.value": P,
1394          "data.inn": null,
1395          "data.ogrn": null,
1396        }),
1397      ],
1398      dataComponents: D,
1399      enrichmentEnabled: !0,
1400      enrichmentMethod: "findById",
1401      enrichmentParams: { count: 1, locations_boost: null },
1402      getEnrichmentQuery: function (e) {
1403        return e.data.hid;
1404      },
1405      geoEnabled: !0,
1406      formatResult: function (e, t, n, o) {
1407        var r = this,
1408          a = r.type.formatResultInn.call(r, n, t),
1409          u = r.highlightMatches(v.getDeepValue(n.data, "ogrn"), t, n),
1410          l = i(a, u),
1411          c = r.highlightMatches(
1412            v.getDeepValue(n.data, "management.name"),
1413            t,
1414            n
1415          ),
1416          d = v.getDeepValue(n.data, "address.value") || "";
1417        return (
1418          r.isMobile && ((o || (o = {})).maxLength = 50),
1419          (e = s.call(r, e, v.getDeepValue(n.data, "name.latin"), t, n, o)),
1420          (e = r.wrapFormattedValue(e, n)),
1421          d &&
1422            ((d = d.replace(/^(\d{6}|Россия),\s+/i, "")),
1423            (d = r.isMobile
1424              ? d.replace(
1425                  new RegExp("^([^" + w + "]+[" + w + "]+[^" + w + "]+).*"),
1426                  "$1"
1427                )
1428              : r.highlightMatches(d, t, n, { unformattableTokens: P }))),
1429          (l || d || c) &&
1430            (e +=
1431              '<div class="' +
1432              r.classes.subtext +
1433              '"><span class="' +
1434              r.classes.subtext_inline +
1435              '">' +
1436              (l || "") +
1437              "</span>" +
1438              (i(d, c) || "") +
1439              "</div>"),
1440          e
1441        );
1442      },
1443      formatResultInn: function (e, t) {
1444        var n,
1445          i,
1446          s = this,
1447          o = e.data && e.data.inn,
1448          r = A[e.data && e.data.type],
1449          a = /\d/;
1450        if (o)
1451          return (
1452            (i = s.highlightMatches(o, t, e)),
1453            r &&
1454              ((i = i.split("")),
1455              (n = r.map(function (e) {
1456                for (var t, n = ""; e && (t = i.shift()); )
1457                  (n += t), a.test(t) && e--;
1458                return n;
1459              })),
1460              (i =
1461                n.join(
1462                  '<span class="' + s.classes.subtext_delimiter + '"></span>'
1463                ) + i.join(""))),
1464            i
1465          );
1466      },
1467    },
1468    N = {
1469      urlSuffix: "email",
1470      noSuggestionsHint: !1,
1471      matchers: [F.matchByNormalizedQuery()],
1472      isQueryRequestable: function (e) {
1473        return this.options.suggest_local || e.indexOf("@") >= 0;
1474      },
1475    },
1476    M = {
1477      urlSuffix: "bank",
1478      noSuggestionsHint: "Неизвестный банк",
1479      matchers: [
1480        F.matchByFields({ value: null, "data.bic": null, "data.swift": null }),
1481      ],
1482      dataComponents: D,
1483      enrichmentEnabled: !0,
1484      enrichmentMethod: "findById",
1485      enrichmentParams: { count: 1 },
1486      getEnrichmentQuery: function (e) {
1487        return e.data.bic;
1488      },
1489      geoEnabled: !0,
1490      formatResult: function (e, t, n, i) {
1491        var s = this,
1492          o = s.highlightMatches(v.getDeepValue(n.data, "bic"), t, n),
1493          r = v.getDeepValue(n.data, "address.value") || "";
1494        return (
1495          (e = s.highlightMatches(e, t, n, i)),
1496          (e = s.wrapFormattedValue(e, n)),
1497          r &&
1498            ((r = r.replace(/^\d{6}( РОССИЯ)?, /i, "")),
1499            (r = s.isMobile
1500              ? r.replace(
1501                  new RegExp("^([^" + w + "]+[" + w + "]+[^" + w + "]+).*"),
1502                  "$1"
1503                )
1504              : s.highlightMatches(r, t, n, { unformattableTokens: P }))),
1505          (o || r) &&
1506            (e +=
1507              '<div class="' +
1508              s.classes.subtext +
1509              '"><span class="' +
1510              s.classes.subtext_inline +
1511              '">' +
1512              o +
1513              "</span>" +
1514              r +
1515              "</div>"),
1516          e
1517        );
1518      },
1519      formatSelected: function (e) {
1520        return v.getDeepValue(e, "data.name.payment") || null;
1521      },
1522    },
1523    W = { NAME: q, ADDRESS: z, FIAS: R, PARTY: $, EMAIL: N, BANK: M };
1524  (W.get = function (e) {
1525    return W.hasOwnProperty(e) ? W[e] : new o(e);
1526  }),
1527    B.extend(V, { suggest_local: !0 });
1528  var U = {
1529      chains: {},
1530      on: function (e, t) {
1531        return this.get(e).push(t), this;
1532      },
1533      get: function (e) {
1534        var t = this.chains;
1535        return t[e] || (t[e] = []);
1536      },
1537    },
1538    H = {
1539      suggest: {
1540        defaultParams: {
1541          type: L.getDefaultType(),
1542          dataType: "json",
1543          contentType: L.getDefaultContentType(),
1544        },
1545        addTypeInUrl: !0,
1546      },
1547      "iplocate/address": {
1548        defaultParams: { type: "GET", dataType: "json" },
1549        addTypeInUrl: !1,
1550      },
1551      status: {
1552        defaultParams: { type: "GET", dataType: "json" },
1553        addTypeInUrl: !0,
1554      },
1555      findById: {
1556        defaultParams: {
1557          type: L.getDefaultType(),
1558          dataType: "json",
1559          contentType: L.getDefaultContentType(),
1560        },
1561        addTypeInUrl: !0,
1562      },
1563    },
1564    Q = {
1565      suggest: {
1566        method: "suggest",
1567        userSelect: !0,
1568        updateValue: !0,
1569        enrichmentEnabled: !0,
1570      },
1571      findById: {
1572        method: "findById",
1573        userSelect: !1,
1574        updateValue: !1,
1575        enrichmentEnabled: !1,
1576      },
1577    };
1578  r.prototype = {
1579    initialize: function () {
1580      var e = this;
1581      (e.uniqueId = L.uniqueId("i")),
1582        e.createWrapper(),
1583        e.notify("initialize"),
1584        e.bindWindowEvents(),
1585        e.setOptions(),
1586        e.inferIsMobile(),
1587        e.notify("ready");
1588    },
1589    deferInitialization: function () {
1590      var e,
1591        t = this,
1592        n = "mouseover focus keydown",
1593        i = function () {
1594          t.initializer.resolve(), t.enable();
1595        };
1596      t.initializer.always(function () {
1597        t.el.off(n, i), clearInterval(e);
1598      }),
1599        (t.disabled = !0),
1600        t.el.on(n, i),
1601        (e = setInterval(function () {
1602          t.el.is(":visible") && i();
1603        }, t.options.initializeInterval));
1604    },
1605    isInitialized: function () {
1606      return "resolved" === this.initializer.state();
1607    },
1608    dispose: function () {
1609      var e = this;
1610      e.initializer.reject(),
1611        e.notify("dispose"),
1612        e.el.removeData("suggestions").removeClass("suggestions-input"),
1613        e.unbindWindowEvents(),
1614        e.removeWrapper(),
1615        e.el.trigger("suggestions-dispose");
1616    },
1617    notify: function (t) {
1618      var n = this,
1619        i = L.slice(arguments, 1);
1620      return e.map(U.get(t), function (e) {
1621        return e.apply(n, i);
1622      });
1623    },
1624    createWrapper: function () {
1625      var t = this;
1626      (t.$wrapper = e('<div class="suggestions-wrapper"/>')),
1627        t.el.after(t.$wrapper),
1628        t.$wrapper.on("mousedown" + S, e.proxy(t.onMousedown, t));
1629    },
1630    removeWrapper: function () {
1631      var t = this;
1632      t.$wrapper && t.$wrapper.remove(), e(t.options.$helpers).off(S);
1633    },
1634    onMousedown: function (t) {
1635      var n = this;
1636      t.preventDefault(),
1637        (n.cancelBlur = !0),
1638        L.delay(function () {
1639          delete n.cancelBlur;
1640        }),
1641        0 == e(t.target).closest(".ui-menu-item").length &&
1642          L.delay(function () {
1643            e(document).one("mousedown", function (t) {
1644              var i = n.el.add(n.$wrapper).add(n.options.$helpers);
1645              n.options.floating && (i = i.add(n.$container)),
1646                (i = i.filter(function () {
1647                  return this === t.target || e.contains(this, t.target);
1648                })),
1649                i.length || n.hide();
1650            });
1651          });
1652    },
1653    bindWindowEvents: function () {
1654      var t = e.proxy(this.inferIsMobile, this);
1655      this.$viewport.on("resize" + S + this.uniqueId, t);
1656    },
1657    unbindWindowEvents: function () {
1658      this.$viewport.off("resize" + S + this.uniqueId);
1659    },
1660    scrollToTop: function () {
1661      var t = this,
1662        n = t.options.scrollOnFocus;
1663      !0 === n && (n = t.el),
1664        n instanceof e &&
1665          n.length > 0 &&
1666          e("body,html").animate({ scrollTop: n.offset().top }, "fast");
1667    },
1668    setOptions: function (t) {
1669      var n = this;
1670      e.extend(n.options, t),
1671        (n.type = W.get(n.options.type)),
1672        e.each({ requestMode: Q }, function (t, i) {
1673          if (((n[t] = i[n.options[t]]), !n[t]))
1674            throw (
1675              (n.disable(),
1676              "`" +
1677                t +
1678                "` option is incorrect! Must be one of: " +
1679                e
1680                  .map(i, function (e, t) {
1681                    return '"' + t + '"';
1682                  })
1683                  .join(", "))
1684            );
1685        }),
1686        e(n.options.$helpers)
1687          .off(S)
1688          .on("mousedown" + S, e.proxy(n.onMousedown, n)),
1689        n.isInitialized() && n.notify("setOptions");
1690    },
1691    inferIsMobile: function () {
1692      this.isMobile = this.$viewport.width() <= this.options.mobileWidth;
1693    },
1694    clearCache: function () {
1695      (this.cachedResponse = {}),
1696        (this.enrichmentCache = {}),
1697        (this.badQueries = []);
1698    },
1699    clear: function () {
1700      var e = this,
1701        t = e.selection;
1702      e.isInitialized() &&
1703        (e.clearCache(),
1704        (e.currentValue = ""),
1705        (e.selection = null),
1706        e.hide(),
1707        (e.suggestions = []),
1708        e.el.val(""),
1709        e.el.trigger("suggestions-clear"),
1710        e.notify("clear"),
1711        e.trigger("InvalidateSelection", t));
1712    },
1713    disable: function () {
1714      var e = this;
1715      (e.disabled = !0), e.abortRequest(), e.visible && e.hide();
1716    },
1717    enable: function () {
1718      this.disabled = !1;
1719    },
1720    isUnavailable: function () {
1721      return this.disabled;
1722    },
1723    update: function () {
1724      var e = this,
1725        t = e.el.val();
1726      e.isInitialized() &&
1727        ((e.currentValue = t),
1728        e.isQueryRequestable(t) ? e.updateSuggestions(t) : e.hide());
1729    },
1730    setSuggestion: function (t) {
1731      var n,
1732        i,
1733        s = this;
1734      e.isPlainObject(t) &&
1735        e.isPlainObject(t.data) &&
1736        ((t = e.extend(!0, {}, t)),
1737        s.isUnavailable() &&
1738          s.initializer &&
1739          "pending" === s.initializer.state() &&
1740          (s.initializer.resolve(), s.enable()),
1741        s.bounds.own.length &&
1742          (s.checkValueBounds(t),
1743          (n = s.copyDataComponents(t.data, s.bounds.all)),
1744          t.data.kladr_id &&
1745            (n.kladr_id = s.getBoundedKladrId(t.data.kladr_id, s.bounds.all)),
1746          (t.data = n)),
1747        (s.selection = t),
1748        (s.suggestions = [t]),
1749        (i = s.getSuggestionValue(t) || ""),
1750        (s.currentValue = i),
1751        s.el.val(i),
1752        s.abortRequest(),
1753        s.el.trigger("suggestions-set"));
1754    },
1755    fixData: function () {
1756      var t = this,
1757        n = t.extendedCurrentValue(),
1758        i = t.el.val(),
1759        s = e.Deferred();
1760      s
1761        .done(function (e) {
1762          t.selectSuggestion(e, 0, i, { hasBeenEnriched: !0 }),
1763            t.el.trigger("suggestions-fixdata", e);
1764        })
1765        .fail(function () {
1766          (t.selection = null), t.el.trigger("suggestions-fixdata");
1767        }),
1768        t.isQueryRequestable(n)
1769          ? ((t.currentValue = n),
1770            t
1771              .getSuggestions(n, { count: 1, from_bound: null, to_bound: null })
1772              .done(function (e) {
1773                var t = e[0];
1774                t ? s.resolve(t) : s.reject();
1775              })
1776              .fail(function () {
1777                s.reject();
1778              }))
1779          : s.reject();
1780    },
1781    extendedCurrentValue: function () {
1782      var t = this,
1783        n = t.getParentInstance(),
1784        i = n && n.extendedCurrentValue(),
1785        s = e.trim(t.el.val());
1786      return L.compact([i, s]).join(" ");
1787    },
1788    getAjaxParams: function (t, n) {
1789      var i = this,
1790        s = e.trim(i.options.token),
1791        o = e.trim(i.options.partner),
1792        a = i.options.serviceUrl,
1793        u = i.options.url,
1794        l = H[t],
1795        c = e.extend({ timeout: i.options.timeout }, l.defaultParams),
1796        d = {};
1797      return (
1798        u
1799          ? (a = u)
1800          : (/\/$/.test(a) || (a += "/"),
1801            (a += t),
1802            l.addTypeInUrl && (a += "/" + i.type.urlSuffix)),
1803        (a = L.fixURLProtocol(a)),
1804        e.support.cors
1805          ? (s && (d.Authorization = "Token " + s),
1806            o && (d["X-Partner"] = o),
1807            (d["X-Version"] = r.version),
1808            c.headers || (c.headers = {}),
1809            c.xhrFields || (c.xhrFields = {}),
1810            e.extend(c.headers, i.options.headers, d),
1811            (c.xhrFields.withCredentials = !1))
1812          : (s && (d.token = s),
1813            o && (d.partner = o),
1814            (d.version = r.version),
1815            (a = L.addUrlParams(a, d))),
1816        (c.url = a),
1817        e.extend(c, n)
1818      );
1819    },
1820    isQueryRequestable: function (e) {
1821      var t,
1822        n = this;
1823      return (
1824        (t = e.length >= n.options.minChars),
1825        t &&
1826          n.type.isQueryRequestable &&
1827          (t = n.type.isQueryRequestable.call(n, e)),
1828        t
1829      );
1830    },
1831    constructRequestParams: function (t, n) {
1832      var i = this,
1833        s = i.options,
1834        o = e.isFunction(s.params)
1835          ? s.params.call(i.element, t)
1836          : e.extend({}, s.params);
1837      return (
1838        i.type.constructRequestParams &&
1839          e.extend(o, i.type.constructRequestParams.call(i)),
1840        e.each(i.notify("requestParams"), function (t, n) {
1841          e.extend(o, n);
1842        }),
1843        (o[s.paramName] = t),
1844        e.isNumeric(s.count) && s.count > 0 && (o.count = s.count),
1845        s.language && (o.language = s.language),
1846        e.extend(o, n)
1847      );
1848    },
1849    updateSuggestions: function (e) {
1850      var t = this;
1851      t.fetchPhase = t.getSuggestions(e).done(function (n) {
1852        t.assignSuggestions(n, e);
1853      });
1854    },
1855    getSuggestions: function (t, n, i) {
1856      var s,
1857        o = this,
1858        r = o.options,
1859        a = i && i.noCallbacks,
1860        u = i && i.useEnrichmentCache,
1861        l = (i && i.method) || o.requestMode.method,
1862        c = o.constructRequestParams(t, n),
1863        d = e.param(c || {}),
1864        f = e.Deferred();
1865      return (
1866        (s = o.cachedResponse[d]),
1867        s && e.isArray(s.suggestions)
1868          ? f.resolve(s.suggestions)
1869          : o.isBadQuery(t)
1870          ? f.reject()
1871          : a || !1 !== r.onSearchStart.call(o.element, c)
1872          ? o
1873              .doGetSuggestions(c, l)
1874              .done(function (e) {
1875                o.processResponse(e) && t == o.currentValue
1876                  ? (r.noCache ||
1877                      (u
1878                        ? (o.enrichmentCache[t] = e.suggestions[0])
1879                        : (o.enrichResponse(e, t),
1880                          (o.cachedResponse[d] = e),
1881                          r.preventBadQueries &&
1882                            0 === e.suggestions.length &&
1883                            o.badQueries.push(t))),
1884                    f.resolve(e.suggestions))
1885                  : f.reject(),
1886                  a || r.onSearchComplete.call(o.element, t, e.suggestions);
1887              })
1888              .fail(function (e, n, i) {
1889                f.reject(),
1890                  a ||
1891                    "abort" === n ||
1892                    r.onSearchError.call(o.element, t, e, n, i);
1893              })
1894          : f.reject(),
1895        f
1896      );
1897    },
1898    doGetSuggestions: function (t, n) {
1899      var i = this,
1900        s = e.ajax(i.getAjaxParams(n, { data: L.serialize(t) }));
1901      return (
1902        i.abortRequest(),
1903        (i.currentRequest = s),
1904        i.notify("request"),
1905        s.always(function () {
1906          (i.currentRequest = null), i.notify("request");
1907        }),
1908        s
1909      );
1910    },
1911    isBadQuery: function (t) {
1912      if (!this.options.preventBadQueries) return !1;
1913      var n = !1;
1914      return (
1915        e.each(this.badQueries, function (e, i) {
1916          return !(n = 0 === t.indexOf(i));
1917        }),
1918        n
1919      );
1920    },
1921    abortRequest: function () {
1922      var e = this;
1923      e.currentRequest && e.currentRequest.abort();
1924    },
1925    processResponse: function (t) {
1926      var n,
1927        i = this;
1928      return (
1929        !(!t || !e.isArray(t.suggestions)) &&
1930        (i.verifySuggestionsFormat(t.suggestions),
1931        i.setUnrestrictedValues(t.suggestions),
1932        e.isFunction(i.options.onSuggestionsFetch) &&
1933          ((n = i.options.onSuggestionsFetch.call(i.element, t.suggestions)),
1934          e.isArray(n) && (t.suggestions = n)),
1935        !0)
1936      );
1937    },
1938    verifySuggestionsFormat: function (t) {
1939      "string" == typeof t[0] &&
1940        e.each(t, function (e, n) {
1941          t[e] = { value: n, data: null };
1942        });
1943    },
1944    getSuggestionValue: function (t, n) {
1945      var i,
1946        s = this,
1947        o = s.options.formatSelected || s.type.formatSelected,
1948        r = n && n.hasSameValues,
1949        a = n && n.hasBeenEnriched,
1950        u = null;
1951      return (
1952        e.isFunction(o) && (i = o.call(s, t)),
1953        "string" != typeof i &&
1954          ((i = t.value),
1955          s.type.getSuggestionValue &&
1956            null !==
1957              (u = s.type.getSuggestionValue(s, {
1958                suggestion: t,
1959                hasSameValues: r,
1960                hasBeenEnriched: a,
1961              })) &&
1962            (i = u)),
1963        i
1964      );
1965    },
1966    hasSameValues: function (t) {
1967      var n = !1;
1968      return (
1969        e.each(this.suggestions, function (e, i) {
1970          if (i.value === t.value && i !== t) return (n = !0), !1;
1971        }),
1972        n
1973      );
1974    },
1975    assignSuggestions: function (e, t) {
1976      var n = this;
1977      (n.suggestions = e), n.notify("assignSuggestions", t);
1978    },
1979    shouldRestrictValues: function () {
1980      var e = this;
1981      return (
1982        e.options.restrict_value &&
1983        e.constraints &&
1984        1 == Object.keys(e.constraints).length
1985      );
1986    },
1987    setUnrestrictedValues: function (t) {
1988      var n = this,
1989        i = n.shouldRestrictValues(),
1990        s = n.getFirstConstraintLabel();
1991      e.each(t, function (e, t) {
1992        t.unrestricted_value ||
1993          (t.unrestricted_value = i ? s + ", " + t.value : t.value);
1994      });
1995    },
1996    areSuggestionsSame: function (e, t) {
1997      return e && t && e.value === t.value && L.areSame(e.data, t.data);
1998    },
1999    getNoSuggestionsHint: function () {
2000      var e = this;
2001      return (
2002        !1 !== e.options.noSuggestionsHint &&
2003        (e.options.noSuggestionsHint || e.type.noSuggestionsHint)
2004      );
2005    },
2006  };
2007  var K = {
2008    setupElement: function () {
2009      this.el
2010        .attr("autocomplete", "new-password")
2011        .attr("autocorrect", "off")
2012        .attr("autocapitalize", "off")
2013        .attr("spellcheck", "false")
2014        .addClass("suggestions-input")
2015        .css("box-sizing", "border-box");
2016    },
2017    bindElementEvents: function () {
2018      var t = this;
2019      t.el.on("keydown" + S, e.proxy(t.onElementKeyDown, t)),
2020        t.el.on(
2021          ["keyup" + S, "cut" + S, "paste" + S, "input" + S].join(" "),
2022          e.proxy(t.onElementKeyUp, t)
2023        ),
2024        t.el.on("blur" + S, e.proxy(t.onElementBlur, t)),
2025        t.el.on("focus" + S, e.proxy(t.onElementFocus, t));
2026    },
2027    unbindElementEvents: function () {
2028      this.el.off(S);
2029    },
2030    onElementBlur: function () {
2031      var e = this;
2032      if (e.cancelBlur) return void (e.cancelBlur = !1);
2033      e.options.triggerSelectOnBlur
2034        ? e.isUnavailable() ||
2035          e.selectCurrentValue({ noSpace: !0 }).always(function () {
2036            e.hide();
2037          })
2038        : e.hide(),
2039        e.fetchPhase.abort && e.fetchPhase.abort();
2040    },
2041    onElementFocus: function () {
2042      var t = this;
2043      t.cancelFocus || L.delay(e.proxy(t.completeOnFocus, t)),
2044        (t.cancelFocus = !1);
2045    },
2046    onElementKeyDown: function (e) {
2047      var t = this;
2048      if (!t.isUnavailable())
2049        if (t.visible) {
2050          switch (e.which) {
2051            case b.ESC:
2052              t.el.val(t.currentValue), t.hide(), t.abortRequest();
2053              break;
2054            case b.TAB:
2055              if (!1 === t.options.tabDisabled) return;
2056              break;
2057            case b.ENTER:
2058              t.options.triggerSelectOnEnter && t.selectCurrentValue();
2059              break;
2060            case b.SPACE:
2061              return void (
2062                t.options.triggerSelectOnSpace &&
2063                t.isCursorAtEnd() &&
2064                (e.preventDefault(),
2065                t
2066                  .selectCurrentValue({ continueSelecting: !0, dontEnrich: !0 })
2067                  .fail(function () {
2068                    (t.currentValue += " "),
2069                      t.el.val(t.currentValue),
2070                      t.proceedChangedValue();
2071                  }))
2072              );
2073            case b.UP:
2074              t.moveUp();
2075              break;
2076            case b.DOWN:
2077              t.moveDown();
2078              break;
2079            default:
2080              return;
2081          }
2082          e.stopImmediatePropagation(), e.preventDefault();
2083        } else
2084          switch (e.which) {
2085            case b.DOWN:
2086              t.suggest();
2087              break;
2088            case b.ENTER:
2089              t.options.triggerSelectOnEnter && t.triggerOnSelectNothing();
2090          }
2091    },
2092    onElementKeyUp: function (e) {
2093      var t = this;
2094      if (!t.isUnavailable()) {
2095        switch (e.which) {
2096          case b.UP:
2097          case b.DOWN:
2098          case b.ENTER:
2099            return;
2100        }
2101        clearTimeout(t.onChangeTimeout),
2102          t.inputPhase.reject(),
2103          t.currentValue !== t.el.val() && t.proceedChangedValue();
2104      }
2105    },
2106    proceedChangedValue: function () {
2107      var t = this;
2108      t.abortRequest(),
2109        (t.inputPhase = e.Deferred().done(e.proxy(t.onValueChange, t))),
2110        t.options.deferRequestBy > 0
2111          ? (t.onChangeTimeout = L.delay(function () {
2112              t.inputPhase.resolve();
2113            }, t.options.deferRequestBy))
2114          : t.inputPhase.resolve();
2115    },
2116    onValueChange: function () {
2117      var e,
2118        t = this;
2119      t.selection &&
2120        ((e = t.selection),
2121        (t.selection = null),
2122        t.trigger("InvalidateSelection", e)),
2123        (t.selectedIndex = -1),
2124        t.update(),
2125        t.notify("valueChange");
2126    },
2127    completeOnFocus: function () {
2128      var e = this;
2129      e.isUnavailable() ||
2130        (e.isElementFocused() &&
2131          (e.update(), e.isMobile && (e.setCursorAtEnd(), e.scrollToTop())));
2132    },
2133    isElementFocused: function () {
2134      return document.activeElement === this.element;
2135    },
2136    isElementDisabled: function () {
2137      return Boolean(
2138        this.element.getAttribute("disabled") ||
2139          this.element.getAttribute("readonly")
2140      );
2141    },
2142    isCursorAtEnd: function () {
2143      var e,
2144        t,
2145        n = this,
2146        i = n.el.val().length;
2147      try {
2148        if ("number" == typeof (e = n.element.selectionStart)) return e === i;
2149      } catch (e) {}
2150      return (
2151        !document.selection ||
2152        ((t = document.selection.createRange()),
2153        t.moveStart("character", -i),
2154        i === t.text.length)
2155      );
2156    },
2157    setCursorAtEnd: function () {
2158      var e = this.element;
2159      try {
2160        (e.selectionEnd = e.selectionStart = e.value.length),
2161          (e.scrollLeft = e.scrollWidth);
2162      } catch (t) {
2163        e.value = e.value;
2164      }
2165    },
2166  };
2167  e.extend(r.prototype, K),
2168    U.on("initialize", K.bindElementEvents).on(
2169      "dispose",
2170      K.unbindElementEvents
2171    );
2172  var G = {};
2173  a();
2174  var J = {
2175    checkStatus: function () {
2176      function e(e) {
2177        L.isFunction(t.options.onSearchError) &&
2178          t.options.onSearchError.call(t.element, null, s, "error", e);
2179      }
2180      var t = this,
2181        n = (t.options.token && t.options.token.trim()) || "",
2182        i = t.options.type + n,
2183        s = G[i];
2184      s || (s = G[i] = B.ajax(t.getAjaxParams("status"))),
2185        s
2186          .done(function (n, i, s) {
2187            if (n.search) {
2188              var o = s.getResponseHeader("X-Plan");
2189              (n.plan = o), B.extend(t.status, n);
2190            } else e("Service Unavailable");
2191          })
2192          .fail(function () {
2193            e(s.statusText);
2194          });
2195    },
2196  };
2197  (r.resetTokens = a),
2198    B.extend(r.prototype, J),
2199    U.on("setOptions", J.checkStatus);
2200  var X,
2201    Y = !0,
2202    Z = {
2203      checkLocation: function () {
2204        var t = this,
2205          n = t.options.geoLocation;
2206        t.type.geoEnabled &&
2207          n &&
2208          ((t.geoLocation = e.Deferred()),
2209          e.isPlainObject(n) || e.isArray(n)
2210            ? t.geoLocation.resolve(n)
2211            : (X || (X = e.ajax(t.getAjaxParams("iplocate/address"))),
2212              X.done(function (e) {
2213                var n = e && e.location && e.location.data;
2214                n && n.kladr_id
2215                  ? t.geoLocation.resolve({ kladr_id: n.kladr_id })
2216                  : t.geoLocation.reject();
2217              }).fail(function () {
2218                t.geoLocation.reject();
2219              })));
2220      },
2221      getGeoLocation: function () {
2222        return this.geoLocation;
2223      },
2224      constructParams: function () {
2225        var t = this,
2226          n = {};
2227        return (
2228          t.geoLocation &&
2229            e.isFunction(t.geoLocation.promise) &&
2230            "resolved" == t.geoLocation.state() &&
2231            t.geoLocation.done(function (t) {
2232              n.locations_boost = e.makeArray(t);
2233            }),
2234          n
2235        );
2236      },
2237    };
2238  "GET" != L.getDefaultType() &&
2239    (e.extend(V, { geoLocation: Y }),
2240    e.extend(r, { resetLocation: u }),
2241    e.extend(r.prototype, { getGeoLocation: Z.getGeoLocation }),
2242    U.on("setOptions", Z.checkLocation).on("requestParams", Z.constructParams));
2243  var ee = {
2244    enrichSuggestion: function (t, n) {
2245      var i = this,
2246        s = e.Deferred();
2247      if (
2248        !i.options.enrichmentEnabled ||
2249        !i.type.enrichmentEnabled ||
2250        !i.requestMode.enrichmentEnabled ||
2251        (n && n.dontEnrich)
2252      )
2253        return s.resolve(t);
2254      if (t.data && null != t.data.qc) return s.resolve(t);
2255      i.disableDropdown();
2256      var o = i.type.getEnrichmentQuery(t),
2257        r = i.type.enrichmentParams,
2258        a = {
2259          noCallbacks: !0,
2260          useEnrichmentCache: !0,
2261          method: i.type.enrichmentMethod,
2262        };
2263      return (
2264        (i.currentValue = o),
2265        (i.enrichPhase = i
2266          .getSuggestions(o, r, a)
2267          .always(function () {
2268            i.enableDropdown();
2269          })
2270          .done(function (e) {
2271            var n = e && e[0];
2272            s.resolve(n || t, !!n);
2273          })
2274          .fail(function () {
2275            s.resolve(t);
2276          })),
2277        s
2278      );
2279    },
2280    enrichResponse: function (t, n) {
2281      var i = this,
2282        s = i.enrichmentCache[n];
2283      s &&
2284        e.each(t.suggestions, function (e, i) {
2285          if (i.value === n) return (t.suggestions[e] = s), !1;
2286        });
2287    },
2288  };
2289  e.extend(r.prototype, ee);
2290  var te = { width: "auto", floating: !1 },
2291    ne = {
2292      createContainer: function () {
2293        var t = this,
2294          n = "." + t.classes.suggestion,
2295          i = t.options,
2296          s = e("<div/>").addClass(i.containerClass).css({ display: "none" });
2297        (t.$container = s),
2298          s.on("click" + S, n, e.proxy(t.onSuggestionClick, t));
2299      },
2300      showContainer: function () {
2301        this.$container.appendTo(
2302          this.options.floating ? this.$body : this.$wrapper
2303        );
2304      },
2305      getContainer: function () {
2306        return this.$container.get(0);
2307      },
2308      removeContainer: function () {
2309        var e = this;
2310        e.options.floating && e.$container.remove();
2311      },
2312      setContainerOptions: function () {
2313        var t = this;
2314        t.$container.off("mousedown.suggestions"),
2315          t.options.floating &&
2316            t.$container.on("mousedown.suggestions", e.proxy(t.onMousedown, t));
2317      },
2318      onSuggestionClick: function (t) {
2319        var n,
2320          i = this,
2321          s = e(t.target);
2322        if (!i.dropdownDisabled) {
2323          for (
2324            i.cancelFocus = !0, i.el.focus();
2325            s.length && !(n = s.attr("data-index"));
2326
2327          )
2328            s = s.closest("." + i.classes.suggestion);
2329          n && !isNaN(n) && i.select(+n);
2330        }
2331      },
2332      getSuggestionsItems: function () {
2333        return this.$container.children("." + this.classes.suggestion);
2334      },
2335      toggleDropdownEnabling: function (e) {
2336        (this.dropdownDisabled = !e), this.$container.attr("disabled", !e);
2337      },
2338      disableDropdown: function () {
2339        this.toggleDropdownEnabling(!1);
2340      },
2341      enableDropdown: function () {
2342        this.toggleDropdownEnabling(!0);
2343      },
2344      hasSuggestionsToChoose: function () {
2345        var t = this;
2346        return (
2347          t.suggestions.length > 1 ||
2348          (1 === t.suggestions.length &&
2349            (!t.selection ||
2350              e.trim(t.suggestions[0].value) !== e.trim(t.selection.value)))
2351        );
2352      },
2353      suggest: function () {
2354        var t = this,
2355          n = t.options,
2356          i = [];
2357        if (t.requestMode.userSelect) {
2358          if (t.hasSuggestionsToChoose())
2359            n.hint &&
2360              t.suggestions.length &&
2361              i.push(
2362                '<div class="' + t.classes.hint + '">' + n.hint + "</div>"
2363              ),
2364              (t.selectedIndex = -1),
2365              t.suggestions.forEach(function (e, n) {
2366                e == t.selection && (t.selectedIndex = n),
2367                  t.buildSuggestionHtml(e, n, i);
2368              });
2369          else {
2370            if (t.suggestions.length) return void t.hide();
2371            var s = t.getNoSuggestionsHint();
2372            if (!s) return void t.hide();
2373            i.push('<div class="' + t.classes.hint + '">' + s + "</div>");
2374          }
2375          i.push('<div class="' + x.promo + '"></div>'),
2376            i.push("</div>"),
2377            t.$container.html(i.join("")),
2378            n.autoSelectFirst &&
2379              -1 === t.selectedIndex &&
2380              (t.selectedIndex = 0),
2381            -1 !== t.selectedIndex &&
2382              t
2383                .getSuggestionsItems()
2384                .eq(t.selectedIndex)
2385                .addClass(t.classes.selected),
2386            e.isFunction(n.beforeRender) &&
2387              n.beforeRender.call(t.element, t.$container),
2388            t.$container.show(),
2389            (t.visible = !0);
2390        }
2391      },
2392      buildSuggestionHtml: function (e, t, n) {
2393        n.push(
2394          '<div class="' + this.classes.suggestion + '" data-index="' + t + '">'
2395        );
2396        var i =
2397          this.options.formatResult ||
2398          this.type.formatResult ||
2399          this.formatResult;
2400        n.push(
2401          i.call(this, e.value, this.currentValue, e, {
2402            unformattableTokens: this.type.unformattableTokens,
2403          })
2404        );
2405        var s = this.makeSuggestionLabel(this.suggestions, e);
2406        s &&
2407          n.push(
2408            '<span class="' +
2409              this.classes.subtext_label +
2410              '">' +
2411              L.escapeHtml(s) +
2412              "</span>"
2413          ),
2414          n.push("</div>");
2415      },
2416      wrapFormattedValue: function (e, t) {
2417        var n = this,
2418          i = L.getDeepValue(t.data, "state.status");
2419        return (
2420          '<span class="' +
2421          n.classes.value +
2422          '"' +
2423          (i ? ' data-suggestion-status="' + i + '"' : "") +
2424          ">" +
2425          e +
2426          "</span>"
2427        );
2428      },
2429      formatResult: function (e, t, n, i) {
2430        var s = this;
2431        return (e = s.highlightMatches(e, t, n, i)), s.wrapFormattedValue(e, n);
2432      },
2433      highlightMatches: function (t, n, i, s) {
2434        var o,
2435          r,
2436          a,
2437          u,
2438          d,
2439          f,
2440          p,
2441          g = this,
2442          h = [],
2443          m = s && s.unformattableTokens,
2444          y = s && s.maxLength,
2445          _ = L.reWordExtractor();
2446        if (!t) return "";
2447        for (
2448          o = k.tokenize(n, m),
2449            r = e.map(o, function (e) {
2450              return new RegExp(
2451                "^((.*)([\\-\\+\\\\\\?!@#$%^&]+))?(" +
2452                  L.escapeRegExChars(e) +
2453                  ")([^\\-\\+\\\\\\?!@#$%^&]*[\\-\\+\\\\\\?!@#$%^&]*)",
2454                "i"
2455              );
2456            });
2457          (a = _.exec(t)) && a[0];
2458
2459        )
2460          (u = a[1]),
2461            h.push({
2462              text: u,
2463              hasUpperCase: u.toLowerCase() !== u,
2464              formatted: L.formatToken(u),
2465              matchable: !0,
2466            }),
2467            a[2] && h.push({ text: a[2] });
2468        for (d = 0; d < h.length; d++)
2469          (f = h[d]),
2470            !f.matchable ||
2471              f.matched ||
2472              (-1 !== e.inArray(f.formatted, m) && !f.hasUpperCase) ||
2473              e.each(r, function (e, t) {
2474                var n,
2475                  i = t.exec(f.formatted),
2476                  s = d + 1;
2477                if (i)
2478                  return (
2479                    (i = {
2480                      before: i[1] || "",
2481                      beforeText: i[2] || "",
2482                      beforeDelimiter: i[3] || "",
2483                      text: i[4] || "",
2484                      after: i[5] || "",
2485                    }),
2486                    i.before &&
2487                      (h.splice(
2488                        d,
2489                        0,
2490                        {
2491                          text: f.text.substr(0, i.beforeText.length),
2492                          formatted: i.beforeText,
2493                          matchable: !0,
2494                        },
2495                        { text: i.beforeDelimiter }
2496                      ),
2497                      (s += 2),
2498                      (n = i.before.length),
2499                      (f.text = f.text.substr(n)),
2500                      (f.formatted = f.formatted.substr(n)),
2501                      d--),
2502                    (n = i.text.length + i.after.length),
2503                    f.formatted.length > n &&
2504                      (h.splice(s, 0, {
2505                        text: f.text.substr(n),
2506                        formatted: f.formatted.substr(n),
2507                        matchable: !0,
2508                      }),
2509                      (f.text = f.text.substr(0, n)),
2510                      (f.formatted = f.formatted.substr(0, n))),
2511                    i.after &&
2512                      ((n = i.text.length),
2513                      h.splice(s, 0, {
2514                        text: f.text.substr(n),
2515                        formatted: f.formatted.substr(n),
2516                      }),
2517                      (f.text = f.text.substr(0, n)),
2518                      (f.formatted = f.formatted.substr(0, n))),
2519                    (f.matched = !0),
2520                    !1
2521                  );
2522              });
2523        if (y) {
2524          for (d = 0; d < h.length && y >= 0; d++)
2525            (f = h[d]),
2526              (y -= f.text.length) < 0 &&
2527                (f.text = f.text.substr(0, f.text.length + y) + "...");
2528          h.length = d;
2529        }
2530        return (p = l(h)), c(p, g.classes.nowrap);
2531      },
2532      makeSuggestionLabel: function (t, n) {
2533        var i,
2534          s,
2535          o = this,
2536          r = o.type.fieldNames,
2537          a = {},
2538          u = L.reWordExtractor(),
2539          l = [];
2540        if (
2541          r &&
2542          d(t, n) &&
2543          n.data &&
2544          (e.each(r, function (e) {
2545            var t = n.data[e];
2546            t && (a[e] = L.formatToken(t));
2547          }),
2548          !e.isEmptyObject(a))
2549        ) {
2550          for (; (i = u.exec(L.formatToken(n.value))) && (s = i[1]); )
2551            e.each(a, function (e, t) {
2552              if (t == s) return l.push(r[e]), delete a[e], !1;
2553            });
2554          if (l.length) return l.join(", ");
2555        }
2556      },
2557      hide: function () {
2558        var e = this;
2559        (e.visible = !1), (e.selectedIndex = -1), e.$container.hide().empty();
2560      },
2561      activate: function (e) {
2562        var t,
2563          n,
2564          i = this,
2565          s = i.classes.selected;
2566        return !i.dropdownDisabled &&
2567          ((n = i.getSuggestionsItems()),
2568          n.removeClass(s),
2569          (i.selectedIndex = e),
2570          -1 !== i.selectedIndex && n.length > i.selectedIndex)
2571          ? ((t = n.eq(i.selectedIndex)), t.addClass(s), t)
2572          : null;
2573      },
2574      deactivate: function (e) {
2575        var t = this;
2576        t.dropdownDisabled ||
2577          ((t.selectedIndex = -1),
2578          t.getSuggestionsItems().removeClass(t.classes.selected),
2579          e && t.el.val(t.currentValue));
2580      },
2581      moveUp: function () {
2582        var e = this;
2583        if (!e.dropdownDisabled)
2584          return -1 === e.selectedIndex
2585            ? void (
2586                e.suggestions.length && e.adjustScroll(e.suggestions.length - 1)
2587              )
2588            : 0 === e.selectedIndex
2589            ? void e.deactivate(!0)
2590            : void e.adjustScroll(e.selectedIndex - 1);
2591      },
2592      moveDown: function () {
2593        var e = this;
2594        if (!e.dropdownDisabled)
2595          return e.selectedIndex === e.suggestions.length - 1
2596            ? void e.deactivate(!0)
2597            : void e.adjustScroll(e.selectedIndex + 1);
2598      },
2599      adjustScroll: function (e) {
2600        var t,
2601          n,
2602          i,
2603          s = this,
2604          o = s.activate(e),
2605          r = s.$container.scrollTop();
2606        o &&
2607          o.length &&
2608          ((t = o.position().top),
2609          t < 0
2610            ? s.$container.scrollTop(r + t)
2611            : ((n = t + o.outerHeight()),
2612              (i = s.$container.innerHeight()),
2613              n > i && s.$container.scrollTop(r - i + n)),
2614          s.el.val(s.suggestions[e].value));
2615      },
2616    };
2617  e.extend(V, te),
2618    e.extend(r.prototype, ne),
2619    U.on("initialize", ne.createContainer)
2620      .on("dispose", ne.removeContainer)
2621      .on("setOptions", ne.setContainerOptions)
2622      .on("ready", ne.showContainer)
2623      .on("assignSuggestions", ne.suggest);
2624  var ie = { constraints: null, restrict_value: !1 },
2625    se = [
2626      "country_iso_code",
2627      "region_iso_code",
2628      "region_fias_id",
2629      "area_fias_id",
2630      "city_fias_id",
2631      "city_district_fias_id",
2632      "settlement_fias_id",
2633      "planning_structure_fias_id",
2634      "street_fias_id",
2635    ],
2636    oe = function (e, t) {
2637      var n,
2638        i,
2639        s = this,
2640        o = {};
2641      (s.instance = t),
2642        (s.fields = {}),
2643        (s.specificity = -1),
2644        m.isPlainObject(e) &&
2645          t.type.dataComponents &&
2646          y.each(t.type.dataComponents, function (t, n) {
2647            var i = t.id;
2648            t.forLocations &&
2649              e[i] &&
2650              ((s.fields[i] = e[i]), (s.specificity = n));
2651          }),
2652        (n = Object.keys(s.fields)),
2653        (i = y.intersect(n, se)),
2654        i.length
2655          ? (y.each(i, function (e, t) {
2656              o[e] = s.fields[e];
2657            }),
2658            (s.fields = o),
2659            (s.specificity = s.getFiasSpecificity(i)))
2660          : s.fields.kladr_id &&
2661            ((s.fields = { kladr_id: s.fields.kladr_id }),
2662            (s.significantKladr = p(s.fields.kladr_id)),
2663            (s.specificity = s.getKladrSpecificity(s.significantKladr)));
2664    };
2665  B.extend(oe.prototype, {
2666    getLabel: function () {
2667      return this.instance.type.composeValue(this.fields, {
2668        saveCityDistrict: !0,
2669      });
2670    },
2671    getFields: function () {
2672      return this.fields;
2673    },
2674    isValid: function () {
2675      return !m.isEmptyObject(this.fields);
2676    },
2677    getKladrSpecificity: function (e) {
2678      var t = -1,
2679        n = e.length;
2680      return (
2681        y.each(this.instance.type.dataComponents, function (e, i) {
2682          e.kladrFormat && n === e.kladrFormat.digits && (t = i);
2683        }),
2684        t
2685      );
2686    },
2687    getFiasSpecificity: function (e) {
2688      var t = -1;
2689      return (
2690        y.each(this.instance.type.dataComponents, function (n, i) {
2691          n.fiasType && e.indexOf(n.fiasType) > -1 && t < i && (t = i);
2692        }),
2693        t
2694      );
2695    },
2696    containsData: function (e) {
2697      var t = !0;
2698      return this.fields.kladr_id
2699        ? !!e.kladr_id && 0 === e.kladr_id.indexOf(this.significantKladr)
2700        : (y.each(this.fields, function (n, i) {
2701            return (t = !!e[i] && e[i].toLowerCase() === n.toLowerCase());
2702          }),
2703          t);
2704    },
2705  }),
2706    (r.ConstraintLocation = oe);
2707  var re = function (e, t) {
2708    (this.id = j("c")), (this.deletable = !!e.deletable), (this.instance = t);
2709    var n = y.makeArray(e && (e.locations || e.restrictions));
2710    (this.locations = n.map(function (e) {
2711      return new oe(e, t);
2712    })),
2713      (this.locations = this.locations.filter(function (e) {
2714        return e.isValid();
2715      })),
2716      (this.label = e.label),
2717      null == this.label &&
2718        t.type.composeValue &&
2719        (this.label = this.locations
2720          .map(function (e) {
2721            return e.getLabel();
2722          })
2723          .join(", "));
2724  };
2725  B.extend(re.prototype, {
2726    isValid: function () {
2727      return this.locations.length > 0;
2728    },
2729    getFields: function () {
2730      return this.locations.map(function (e) {
2731        return e.getFields();
2732      });
2733    },
2734  });
2735  var ae = {
2736    createConstraints: function () {
2737      this.constraints = {};
2738    },
2739    setupConstraints: function () {
2740      var e,
2741        t = this,
2742        n = t.options.constraints;
2743      if (!n) return void t.unbindFromParent();
2744      B.isJqObject(n) || "string" == typeof n || "number" == typeof n.nodeType
2745        ? ((e = B.select(n)),
2746          e.is(t.constraints) ||
2747            (t.unbindFromParent(),
2748            e.is(t.el) || ((t.constraints = e), t.bindToParent())))
2749        : (y.each(t.constraints, function (e, n) {
2750            t.removeConstraint(n);
2751          }),
2752          y.each(y.makeArray(n), function (e, n) {
2753            t.addConstraint(e);
2754          }));
2755    },
2756    filteredLocation: function (e) {
2757      var t = [],
2758        n = {};
2759      if (
2760        (y.each(this.type.dataComponents, function () {
2761          this.forLocations && t.push(this.id);
2762        }),
2763        m.isPlainObject(e) &&
2764          y.each(e, function (e, i) {
2765            e && t.indexOf(i) >= 0 && (n[i] = e);
2766          }),
2767        !m.isEmptyObject(n))
2768      )
2769        return n.kladr_id ? { kladr_id: n.kladr_id } : n;
2770    },
2771    addConstraint: function (e) {
2772      var t = this;
2773      (e = new re(e, t)), e.isValid() && (t.constraints[e.id] = e);
2774    },
2775    removeConstraint: function (e) {
2776      delete this.constraints[e];
2777    },
2778    constructConstraintsParams: function () {
2779      for (
2780        var e, t, n = this, i = [], s = n.constraints, o = {};
2781        B.isJqObject(s) &&
2782        (e = s.suggestions()) &&
2783        !(t = v.getDeepValue(e, "selection.data"));
2784
2785      )
2786        s = e.constraints;
2787      return (
2788        B.isJqObject(s)
2789          ? (t = new oe(t, e).getFields()) &&
2790            (n.bounds.own.indexOf("city") > -1 && delete t.city_fias_id,
2791            (o.locations = [t]),
2792            (o.restrict_value = !0))
2793          : s &&
2794            (y.each(s, function (e, t) {
2795              i = i.concat(e.getFields());
2796            }),
2797            i.length &&
2798              ((o.locations = i),
2799              (o.restrict_value = n.options.restrict_value))),
2800        o
2801      );
2802    },
2803    getFirstConstraintLabel: function () {
2804      var e = this,
2805        t = m.isPlainObject(e.constraints) && Object.keys(e.constraints)[0];
2806      return t ? e.constraints[t].label : "";
2807    },
2808    bindToParent: function () {
2809      var e = this;
2810      e.constraints
2811        .on(
2812          [
2813            "suggestions-select." + e.uniqueId,
2814            "suggestions-invalidateselection." + e.uniqueId,
2815            "suggestions-clear." + e.uniqueId,
2816          ].join(" "),
2817          B.proxy(e.onParentSelectionChanged, e)
2818        )
2819        .on("suggestions-dispose." + e.uniqueId, B.proxy(e.onParentDispose, e));
2820    },
2821    unbindFromParent: function () {
2822      var e = this,
2823        t = e.constraints;
2824      B.isJqObject(t) && t.off("." + e.uniqueId);
2825    },
2826    onParentSelectionChanged: function (e, t, n) {
2827      ("suggestions-select" !== e.type || n) && this.clear();
2828    },
2829    onParentDispose: function (e) {
2830      this.unbindFromParent();
2831    },
2832    getParentInstance: function () {
2833      return B.isJqObject(this.constraints) && this.constraints.suggestions();
2834    },
2835    shareWithParent: function (e) {
2836      var t = this.getParentInstance();
2837      t &&
2838        t.type === this.type &&
2839        !f(e, t) &&
2840        (t.shareWithParent(e), t.setSuggestion(e));
2841    },
2842    getUnrestrictedData: function (e) {
2843      var t = this,
2844        n = [],
2845        i = {},
2846        s = -1;
2847      return (
2848        y.each(t.constraints, function (t, n) {
2849          y.each(t.locations, function (t, n) {
2850            t.containsData(e) && t.specificity > s && (s = t.specificity);
2851          });
2852        }),
2853        s >= 0
2854          ? (e.region_kladr_id &&
2855              e.region_kladr_id === e.city_kladr_id &&
2856              n.push.apply(n, t.type.dataComponentsById.city.fields),
2857            y.each(t.type.dataComponents.slice(0, s + 1), function (e, t) {
2858              n.push.apply(n, e.fields);
2859            }),
2860            y.each(e, function (e, t) {
2861              -1 === n.indexOf(t) && (i[t] = e);
2862            }))
2863          : (i = e),
2864        i
2865      );
2866    },
2867  };
2868  B.extend(V, ie),
2869    B.extend(r.prototype, ae),
2870    "GET" != T.getDefaultType() &&
2871      U.on("initialize", ae.createConstraints)
2872        .on("setOptions", ae.setupConstraints)
2873        .on("requestParams", ae.constructConstraintsParams)
2874        .on("dispose", ae.unbindFromParent);
2875  var ue = {
2876    proceedQuery: function (e) {
2877      var t = this;
2878      e.length >= t.options.minChars ? t.updateSuggestions(e) : t.hide();
2879    },
2880    selectCurrentValue: function (e) {
2881      var t = this,
2882        n = B.Deferred();
2883      return (
2884        t.inputPhase.resolve(),
2885        t.fetchPhase
2886          .done(function () {
2887            var i;
2888            t.selection && !t.visible
2889              ? n.reject()
2890              : ((i = t.findSuggestionIndex()),
2891                t.select(i, e),
2892                -1 === i ? n.reject() : n.resolve(i));
2893          })
2894          .fail(function () {
2895            n.reject();
2896          }),
2897        n
2898      );
2899    },
2900    selectFoundSuggestion: function () {
2901      var e = this;
2902      e.requestMode.userSelect || e.select(0);
2903    },
2904    findSuggestionIndex: function () {
2905      var e,
2906        t = this,
2907        n = t.selectedIndex;
2908      return (
2909        -1 === n &&
2910          (e = t.el.val().trim()) &&
2911          t.type.matchers.some(function (i) {
2912            return -1 !== (n = i(e, t.suggestions));
2913          }),
2914        n
2915      );
2916    },
2917    select: function (e, t) {
2918      var n,
2919        i = this,
2920        s = i.suggestions[e],
2921        o = t && t.continueSelecting,
2922        r = i.currentValue;
2923      if (!i.triggering.Select) {
2924        if (!s)
2925          return (
2926            o || i.selection || i.triggerOnSelectNothing(),
2927            void i.onSelectComplete(o)
2928          );
2929        (n = i.hasSameValues(s)),
2930          i.enrichSuggestion(s, t).done(function (s, o) {
2931            var a = B.extend({ hasBeenEnriched: o, hasSameValues: n }, t);
2932            i.selectSuggestion(s, e, r, a);
2933          });
2934      }
2935    },
2936    selectSuggestion: function (e, t, n, i) {
2937      var s = this,
2938        o = i.continueSelecting,
2939        r = !s.type.isDataComplete || s.type.isDataComplete.call(s, e),
2940        a = s.selection;
2941      s.triggering.Select ||
2942        (s.type.alwaysContinueSelecting && (o = !0),
2943        r && (o = !1),
2944        i.hasBeenEnriched &&
2945          s.suggestions[t] &&
2946          (s.suggestions[t].data = e.data),
2947        s.requestMode.updateValue &&
2948          (s.checkValueBounds(e),
2949          (s.currentValue = s.getSuggestionValue(e, i)),
2950          !s.currentValue || i.noSpace || r || (s.currentValue += " "),
2951          s.el.val(s.currentValue)),
2952        s.currentValue
2953          ? ((s.selection = e),
2954            s.areSuggestionsSame(e, a) ||
2955              s.trigger("Select", e, s.currentValue != n),
2956            s.requestMode.userSelect && s.onSelectComplete(o))
2957          : ((s.selection = null), s.triggerOnSelectNothing()),
2958        s.shareWithParent(e));
2959    },
2960    onSelectComplete: function (e) {
2961      var t = this;
2962      e
2963        ? ((t.selectedIndex = -1), t.updateSuggestions(t.currentValue))
2964        : t.hide();
2965    },
2966    triggerOnSelectNothing: function () {
2967      var e = this;
2968      e.triggering.SelectNothing || e.trigger("SelectNothing", e.currentValue);
2969    },
2970    trigger: function (e) {
2971      var t = this,
2972        n = L.slice(arguments, 1),
2973        i = t.options["on" + e];
2974      (t.triggering[e] = !0),
2975        L.isFunction(i) && i.apply(t.element, n),
2976        t.el.trigger.call(t.el, "suggestions-" + e.toLowerCase(), n),
2977        (t.triggering[e] = !1);
2978    },
2979  };
2980  B.extend(r.prototype, ue),
2981    U.on("assignSuggestions", ue.selectFoundSuggestion);
2982  var le = { bounds: null },
2983    ce = {
2984      setupBounds: function () {
2985        this.bounds = { from: null, to: null };
2986      },
2987      setBoundsOptions: function () {
2988        var t,
2989          n = this,
2990          i = [],
2991          s = e.trim(n.options.bounds).split("-"),
2992          o = s[0],
2993          r = s[s.length - 1],
2994          a = [],
2995          u = [];
2996        n.type.dataComponents &&
2997          e.each(n.type.dataComponents, function () {
2998            this.forBounds && i.push(this.id);
2999          }),
3000          -1 === i.indexOf(o) && (o = null),
3001          -1 === i.indexOf(r) && (r = null),
3002          (o || r) &&
3003            ((t = !o),
3004            e.each(i, function (e, n) {
3005              if ((n == o && (t = !0), u.push(n), t && a.push(n), n == r))
3006                return !1;
3007            })),
3008          (n.bounds.from = o),
3009          (n.bounds.to = r),
3010          (n.bounds.all = u),
3011          (n.bounds.own = a);
3012      },
3013      constructBoundsParams: function () {
3014        var e = this,
3015          t = {};
3016        return (
3017          e.bounds.from && (t.from_bound = { value: e.bounds.from }),
3018          e.bounds.to && (t.to_bound = { value: e.bounds.to }),
3019          t
3020        );
3021      },
3022      checkValueBounds: function (e) {
3023        var t,
3024          n = this;
3025        if (n.bounds.own.length && n.type.composeValue) {
3026          var i = n.bounds.own.slice(0);
3027          1 === i.length &&
3028            "city_district" === i[0] &&
3029            i.push("city_district_fias_id"),
3030            (t = n.copyDataComponents(e.data, i)),
3031            (e.value = n.type.composeValue(t));
3032        }
3033      },
3034      copyDataComponents: function (t, n) {
3035        var i = {},
3036          s = this.type.dataComponentsById;
3037        return (
3038          s &&
3039            e.each(n, function (n, o) {
3040              e.each(s[o].fields, function (e, n) {
3041                null != t[n] && (i[n] = t[n]);
3042              });
3043            }),
3044          i
3045        );
3046      },
3047      getBoundedKladrId: function (t, n) {
3048        var i,
3049          s = n[n.length - 1];
3050        return (
3051          e.each(this.type.dataComponents, function (e, t) {
3052            if (t.id === s) return (i = t.kladrFormat), !1;
3053          }),
3054          t.substr(0, i.digits) + new Array((i.zeros || 0) + 1).join("0")
3055        );
3056      },
3057    };
3058  e.extend(V, le),
3059    e.extend(r.prototype, ce),
3060    U.on("initialize", ce.setupBounds)
3061      .on("setOptions", ce.setBoundsOptions)
3062      .on("requestParams", ce.constructBoundsParams);
3063  var de = {
3064    selectByClass: function (e, t) {
3065      var n = "." + e;
3066      return t ? t.querySelector(n) : document.querySelector(n);
3067    },
3068    addClass: function (e, t) {
3069      var n = e.className.split(" ");
3070      -1 === n.indexOf(t) && n.push(t), (e.className = n.join(" "));
3071    },
3072    setStyle: function (e, t, n) {
3073      e.style[t] = n;
3074    },
3075    listenTo: function (e, t, n, i) {
3076      e.addEventListener(t, i, !1),
3077        n &&
3078          (eventsByNamespace[n] || (eventsByNamespace[n] = []),
3079          eventsByNamespace[n].push({ eventName: t, element: e, callback: i }));
3080    },
3081    stopListeningNamespace: function (e) {
3082      var t = eventsByNamespace[e];
3083      t &&
3084        t.forEach(function (e) {
3085          e.element.removeEventListener(e.eventName, e.callback, !1);
3086        });
3087    },
3088  };
3089  (g.prototype.show = function () {
3090    "FREE" === this.plan && this.element && (this.setStyles(), this.setHtml());
3091  }),
3092    (g.prototype.setStyles = function () {
3093      this.element.style.display = "block";
3094    }),
3095    (g.prototype.setHtml = function () {
3096      this.element.innerHTML =
3097        '<a target="_blank" tabindex="-1" href="https://dadata.ru/suggestions/?utm_source=dadata&utm_medium=module&utm_campaign=suggestions-jquery"><svg version="1.1" viewBox="0 0 128 38" xmlns="http://www.w3.org/2000/svg"><path d="m128 19v16.077c0 1.614-1.302 2.923-2.909 2.923h-122.18c-1.607 0-2.909-1.309-2.909-2.923v-32.154c-0-1.614 1.302-2.923 2.909-2.923h122.18c1.607 0 2.909 1.309 2.909 2.923z" fill="#ef4741"/><path d="m59.52 7.912h-8.902v22.098h9.92c3.724 0 9.872-0.341 9.872-6.703v-8.682c-0.01-6.372-7.166-6.713-10.89-6.713zm5.595 14.81c0 3.186-2.308 3.508-4.936 3.508h-4.276v-14.538h3.287c2.628 0 5.954 0.322 5.954 3.508zm-46.545-14.81h-8.834v22.098h9.871c3.724 0 9.872-0.341 9.872-6.703v-8.682c0-6.372-7.137-6.713-10.88-6.713zm5.595 14.81c0 3.186-2.308 3.508-4.936 3.508h-4.247v-14.538h3.258c2.628 0 5.954 0.322 5.954 3.508zm71.757-13.953h-4.945v16.301c-0.018 0.785 0.113 1.565 0.388 2.3 0.203 0.569 0.535 1.082 0.97 1.5 0.446 0.385 0.962 0.677 1.522 0.858 0.58 0.205 1.182 0.343 1.794 0.409 0.575 0.052 1.248 0.081 2.017 0.088 0.917-1e-3 1.834-0.057 2.744-0.166v-2.796h-1.765c-0.393 0.055-0.795 0.032-1.18-0.071-0.385-0.102-0.745-0.28-1.06-0.524-0.413-0.691-0.59-1.498-0.504-2.299v-8.068h4.509v-3.06h-4.509zm20.364 5.535c-1.176-0.741-3.278-1.108-6.303-1.101h-5.741v0.243l0.708 2.826h5.033c0.837-0.051 1.672 0.117 2.424 0.487 0.259 0.248 0.458 0.553 0.579 0.891 0.121 0.339 0.162 0.701 0.119 1.058v1.12h-5.527c-1.939 0-3.271 0.38-3.995 1.14-0.725 0.76-1.099 2.127-1.125 4.102 0 2.154 0.359 3.06 1.086 3.742 0.728 0.682 2.134 1.188 4.344 1.188h6.847c1.706 0 3.345-0.808 3.345-2.747v-8.584c0-2.176-0.589-3.635-1.765-4.375zm-3.19 12.959h-3.249c-0.735 0.081-1.478-0.036-2.152-0.342-0.285-0.227-0.427-0.876-0.427-1.948s0.136-1.741 0.407-2.007c0.625-0.331 1.336-0.46 2.037-0.371h3.384zm-26.667-12.959c-1.176-0.741-3.277-1.108-6.303-1.101h-5.741v0.243l0.708 2.826h5.033c0.836-0.051 1.672 0.117 2.424 0.487 0.259 0.248 0.457 0.553 0.578 
30970.891 0.121 0.339 0.162 0.701 0.12 1.058v1.12h-5.556c-1.939 0-3.271 0.38-3.995 1.14s-1.086 2.127-1.086 4.102c0 2.154 0.359 3.06 1.086 3.742s2.133 1.188 4.344 1.188h6.846c1.717 0 3.346-0.808 3.346-2.747v-8.584c-7e-3 -2.176-0.595-3.635-1.765-4.375zm-3.181 12.959h-3.248c-0.735 0.081-1.478-0.037-2.153-0.342-0.284-0.227-0.426-0.876-0.426-1.948s0.135-1.741 0.407-2.007c0.624-0.331 1.336-0.46 2.036-0.371h3.384zm-37.74-12.959c-1.176-0.741-3.278-1.108-6.303-1.101h-5.712v0.243l0.708 2.826h5.033c0.837-0.051 1.672 0.117 2.424 0.487 0.259 0.248 0.457 0.553 0.578 0.891 0.121 0.339 0.162 0.701 0.12 1.058v1.12h-5.556c-1.939 0-3.271 0.38-3.995 1.14s-1.099 2.127-1.125 4.102c0 2.154 0.359 3.06 1.086 3.742s2.133 1.188 4.344 1.188h6.846c1.717 0 3.346-0.808 3.346-2.747v-8.584c0-2.176-0.589-3.635-1.765-4.375zm-3.181 12.959h-3.219c-0.735 0.081-1.478-0.037-2.153-0.342-0.284-0.227-0.427-0.876-0.427-1.948s0.136-1.741 0.408-2.007c0.624-0.331 1.336-0.46 2.036-0.371h3.384z" fill="#fff"/></svg></a>';
3098    }),
3099    U.on("assignSuggestions", h),
3100    (r.defaultOptions = V),
3101    (r.version = "22.6.0"),
3102    (e.Suggestions = r),
3103    (e.fn.suggestions = function (t, n) {
3104      return 0 === arguments.length
3105        ? this.first().data("suggestions")
3106        : this.each(function () {
3107            var i = e(this),
3108              s = i.data("suggestions");
3109            "string" == typeof t
3110              ? s && "function" == typeof s[t] && s[t](n)
3111              : (s && s.dispose && s.dispose(),
3112                (s = new r(this, t)),
3113                i.data("suggestions", s));
3114          });
3115    });
3116});

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.