PageSourceSearch

https://www.geico.com/_next/static/chunks/gds-gds-address-auto-complete-js.10fc3e43409a79a5.js

js geico.com collected 2026-10-01 08:56:37 UTC 16,168 bytes, 353 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[50167],{43721:(t,e,s)=>{s.r(e),s.d(e,{GdsAddressAutoComplete:()=>c});var i=s(25500),o=s(46058),a=s(12009),r=s(41088),n=s(24291),l=s(85065),d=s(40629),h=s(11598),p=(0,h.b)((0,i.a)(),1),c=class extends d.g{constructor(){super(...arguments),this.layers="address",this.limit=10,this.country="US, PR",this.expandUnits=!1,this.debounceMS=200,this.threshold=3,this.disabled=!1,this.dataQmAllow=!1,this.dataQmEncrypt=!1,this.dataQmMask=!1,this.ariaLabel=null,this._visible=!1,this.errorState=!1}render(){return(0,d.c)`
2      <gds-input-field
3        input-id="${this.inputId}"
4        name="${(0,o.a)(this.name)}"
5        type="search"
6        placeholder="${this.placeholder||"Enter your address"}"
7        aria-label="${(0,o.a)(this.ariaLabel)}"
8        ?data-qm-allow="${this.dataQmAllow}"
9        ?data-qm-encrypt="${this.dataQmEncrypt}"
10        ?data-qm-mask="${this.dataQmMask}"
11        spell-check="${this.spellCheck||"false"}"
12        auto-complete="${this.autoComplete||"off"}"
13        ?disabled="${this.disabled}"
14        full-width
15        label-legend-marker="${(0,o.a)(this.labelLegendMarker)}"
16      >
17        <slot></slot>
18        <span slot="descriptive-copy">
19          <slot name="descriptive-text"></slot>
20        </span>
21        <span slot="${this.errorState?"error-message-copy":""}">
22          <slot
23            @slotchange="${this.handleSlotChange}"
24            name="error-message-text"
25          ></slot>
26        </span>
27      </gds-input-field>
28
29      <gds-dropdown-list ?visible="${this._visible}">
30        <div class="results"></div>
31      </gds-dropdown-list>
32    `}connectedCallback(){super.connectedCallback(),setTimeout(()=>this._init())}handleSlotChange(t){let e=t.target;e.hasAttribute("name")&&"error-message-text"===e.name&&(this.errorState=(0,a.a)(e))}_init(){(this.shadowRoot?.querySelector("gds-input-field")).addEventListener("input-value-change",this._handleInputValueChange.bind(this))}_handleInputValueChange(){let t=this.shadowRoot?.querySelector("gds-input-field");this._inputValue=t.shadowRoot?.querySelector("input").value,this._inputValue.length>=this.threshold?setTimeout(()=>{p.default.autocomplete({query:`${this._inputValue}`,near:this.near,layers:this.layers,limit:this.limit,country:this.country,expandUnits:this.expandUnits},(t,e)=>{if(t)console.log("There was an error",t);else{let t=e.addresses;setTimeout(()=>{this._createListItems(t)},600)}})},this.debounceMS):this._createListItems({})}_createListItems(t){let e=this.shadowRoot?.querySelector(".results");t.length>0?(e.innerHTML="",Array.prototype.forEach.call(t,t=>{let s=t.formattedAddress,i=document.createElement("gds-dropdown-list-item");i.setAttribute("type","address"),i.append(s),e.appendChild(i),i.addEventListener("click",this._selectAddressEventHandler.bind(this,t))}),this._visible=!0):(this._visible=!1,setTimeout(()=>{e.innerHTML=""},500))}_selectAddressEventHandler(t){this.dispatchEvent(new CustomEvent("get-selected-address",{detail:{addressObject:t},...r.a})),this._clearSearch.call(this)}_clearSearch(){(this.shadowRoot?.querySelector("gds-input-field").shadowRoot?.querySelector("input")).value="",this._visible=!1;let t=this.shadowRoot?.querySelector(".results");setTimeout(()=>{t.innerHTML=""},500)}};(0,h.c)([(0,n.b)({type:String,attribute:"input-id"})],c.prototype,"inputId",2),(0,h.c)([(0,n.b)()],c.prototype,"name",2),(0,h.c)([(0,n.b)()],c.prototype,"placeholder",2),(0,h.c)([(0,n.b)({type:String,reflect:!0})],c.prototype,"near",2),(0,h.c)([(0,n.b)({type:String,reflect:!0})],c.prototype,"layers",2),(0,h.c)([(0,n.b)({type:Number,reflect:!0})],c.prototype,"limit",2),(0,h.c)([(0,n.b)({type:String,reflect:!0})],c.prototype,"country",2),(0,h.c)([(0,n.b)({type:Boolean,reflect:!0,attribute:"expand-units"})],c.prototype,"expandUnits",2),(0,h.c)([(0,n.b)({type:Number,reflect:!0,attribute:"debounce-ms"})],c.prototype,"debounceMS",2),(0,h.c)([(0,n.b)({type:Number,reflect:!0})],c.prototype,"threshold",2),(0,h.c)([(0,n.b)({type:Boolean,reflect:!0})],c.prototype,"disabled",2),(0,h.c)([(0,n.b)({type:Boolean,reflect:!0,attribute:"data-qm-allow"})],c.prototype,"dataQmAllow",2),(0,h.c)([(0,n.b)({type:Boolean,reflect:!0,attribute:"data-qm-encrypt"})],c.prototype,"dataQmEncrypt",2),(0,h.c)([(0,n.b)({type:Boolean,reflect:!0,attribute:"data-qm-mask"})],c.prototype,"dataQmMask",2),(0,h.c)([(0,n.b)({attribute:"spell-check"}
32)],c.prototype,"spellCheck",2),(0,h.c)([(0,n.b)({attribute:"auto-complete"})],c.prototype,"autoComplete",2),(0,h.c)([(0,n.b)({type:String,attribute:"aria-label"})],c.prototype,"ariaLabel",2),(0,h.c)([(0,n.b)({type:String,reflect:!0,attribute:"label-legend-marker"})],c.prototype,"labelLegendMarker",2),(0,h.c)([(0,n.c)()],c.prototype,"_inputValue",2),(0,h.c)([(0,n.c)()],c.prototype,"_visible",2),(0,h.c)([(0,n.c)()],c.prototype,"errorState",2),c=(0,h.c)([(0,l.a)("gds-address-auto-complete")],c),s(84665),s(46128),s(70137),s(44489),s(31864),s(62646),s(23827),s(98314),s(8802)},46128:(t,e,s)=>{s.d(e,{a:()=>d});var i=s(41088),o=s(24291),a=s(85065),r=s(40629),n=s(11598),l=(0,r.b)`
33  :host {
34    display: none;
35    opacity: 0;
36    transition: all 0.5s;
37  }
38
39  :host([display]) {
40    display: block;
41  }
42
43  :host([fadeIn]) {
44    opacity: 1;
45  }
46
47  @keyframes slideIn {
48    from {
49      transform: translateY(50%);
50    }
51    to {
52      transform: translateY(0);
53    }
54  }
55
56  @keyframes slideOut {
57    from {
58      transform: translateY(0);
59    }
60    to {
61      transform: translateY(50%);
62    }
63  }
64
65  @keyframes slideInTop {
66    from {
67      transform: translate(-50%, -100%);
68    }
69    to {
70      transform: translate(-50%, 0);
71    }
72  }
73
74  @keyframes slideOutTop {
75    from {
76      transform: translate(-50%, 0);
77    }
78    to {
79      transform: translate(-50%, -100%);
80    }
81  }
82
83  @keyframes slideInTopRight {
84    from {
85      transform: translate(100%, 0%);
86    }
87    to {
88      transform: translate(0, 0);
89    }
90  }
91
92  @keyframes slideOutTopRight {
93    from {
94      transform: translate(0, 0);
95    }
96    to {
97      transform: translate(100%, 0%);
98    }
99  }
100
101  @keyframes slideInBottomRight {
102    from {
103      transform: translateY(100%);
104    }
105    to {
106      transform: translateY(0);
107    }
108  }
109
110  @keyframes slideInBottomLeft {
111    from {
112      transform: translateY(100%);
113    }
114    to {
115      transform: translateY(0);
116    }
117  }
118
119  @keyframes slideInBottom {
120    from {
121      transform: translate(-50%, 100%);
122    }
123    to {
124      transform: translate(-50%, 0);
125    }
126  }
127
128  @keyframes slideOutBottom {
129    from {
130      transform: translate(-50%, 0);
131    }
132    to {
133      transform: translate(-50%, 100%);
134    }
135  }
136
137  :host([slideIn]) {
138    transform: translateY(50%);
139    animation: slideIn 0.5s forwards;
140  }
141
142  :host([slideOut]) {
143    animation: slideOut 0.5s forwards;
144  }
145
146  :host([position="top-slide"]) {
147    top: var(--show-hide-margin);
148    left: 50%;
149    position: fixed;
150    z-index: 1000;
151    animation: slideOutTop 0.5s forwards;
152  }
153
154  :host([position="top-slide"][animate]) {
155    animation: slideInTop 0.5s forwards;
156  }
157
158  :host([position="bottom-right-slide"]) {
159    bottom: var(--show-hide-margin);
160    right: var(--show-hide-margin);
161    position: fixed;
162    z-index: 1000;
163    animation: slideOutBottomRight 0.5s forwards;
164  }
165
166  :host([position="bottom-right-slide"][animate]) {
167    animation: slideInBottomRight 0.5s forwards;
168  }
169
170  :host([position="bottom-left-slide"]) {
171    bottom: var(--show-hide-margin);
172    left: var(--show-hide-margin);
173    position: fixed;
174    z-index: 1000;
175    animation: slideOutBottomLeft 0.5s forwards;
176  }
177
178  :host([position="bottom-left-slide"][animate]) {
179    animation: slideInBottomLeft 0.5s forwards;
180  }
181
182  :host([position="bottom-slide"]) {
183    bottom: var(--show-hide-margin);
184    transform: translate(-50%, 100%);
185    left: 50%;
186    position: fixed;
187    z-index: 1000;
188    animation: slideOutBottom 0.5s forwards;
189  }
190
191  :host([position="bottom-slide"][animate]) {
192    animation: slideInBottom 0.5s forwards;
193  }
194
195  :host([position="top-right-slide"]) {
196    top: var(--show-hide-margin);
197    right: var(--show-hide-margin);
198    position: fixed;
199    z-index: 1000;
200    animation: slideOutTopRight 0.5s forwards;
201  }
202
203  :host([position="top-right-slide"][animate]) {
204    transform: translate(0%, 0%);
205    animation: slideInTopRight 0.5s forwards;
206  }
207`,d=class extends r.g{constructor(){super(...arguments),this.visible=!1,this.slide=!1,this.position="inline"}render(){return(0,r.c)`<slot></slot>`}connectedCallback(){super.connectedCallback();let t=new CSSStyleSheet;t.replaceSync(l.cssText),this.shadowRoot.adoptedStyleSheets=[t]}updated(t){t.has("visible")&&(this.dispatchEvent(new CustomEvent("visibility-changed",{detail:{visible:this.visible},...i.a})),this.visible?(clearTimeout(this.fadeOutTimerId),this.setAttribute("display",""),this.slide&&(!this.position||"inline"===this.position)?this.setAttribute("slideIn",""):this.setAttribute("animate",""),this.fadeInTimerId=setTimeout(()=>{this.setAttribute("fadeIn","")},100)):(clearTimeout(this.fadeInTimerId),this.removeAttribute("fadeIn"),this.slide&&(!this.position||"inline"===this.position)?(this.removeAttribute("slideIn"),this.setAttribute("slideOut","")):this.removeAttribute("animate"),setTimeout(()=>{this.visible||(this.removeAttribute("display"),this.removeAttribute("slideOut"))},550)))}toggle(){this.visible=!this.visible}};(0,n.c)([(0,o.b)({type:Boolean,reflect:!0})],d.prototype,"visible",2),(0,n.c)([(0,o.b)({type:Boolean,reflect:!0})],d.prototype,"slide",2),(0,n.c)([(0,o.b)()],d.prototype,"position",2),(0,n.c)([(0,o.c)()],d.prototype,"fadeInTimerId",2),(0,n.c)([(0,o.c)()],d.prototype,"fadeOutTimerId",2),d=(0,n.c)([(0,a.a)("gds-show-hide")],d)},62646:(t,e,s)=>{s.d(e,{a:()=>d});var i=s(98314),o=s(24291),a=s(85065),r=s(40629),n=s(11598),l=(0,r.b)`
208  :host {
209    display: block;
210    padding: var(--dropdown-list-list-item-padding);
211  }
212
213  :host li {
214    list-style: none;
215    padding: 0;
216    margin: 0;
217  }
218
219  :host([type="heading"]) {
220    padding-left: 0rem;
221    margin-bottom: 0.8rem;
222  }
223
224  :host([type="heading"]) li {
225    color: var(--text-color);
226    font-size: var(--font-size-small);
227    text-transform: capitalize;
228    font-weight: bold;
229    border-bottom: var(--dropdown-list-list-item-seperator-border-bottom);
230  }
231
232  :host([type="link"]) li {
233    &:hover {
234      background: var(--color-neutral-surface-hover-emphasis);
235    }
236  }
237
238  :host([type="link"]) li a {
239    display: block;
240    height: auto !important;
241    text-decoration: none;
242  }
243
244  :host([type="link"]) li a span {
245    display: block;
246    width: 100%;
247
248    &:first-child {
249      font-weight: bold;
250      text-decoration: underline;
251    }
252
253    &:last-child {
254      color: var(--text-color-emphasis);
255      font-weight: normal;
256    }
257  }
258
259  :host([type="address"]) {
260    padding-left: 0rem;
261  }
262
263  :host([type="address"]) li {
264    color: var(--text-color-emphasis);
265    font-size: var(--font-size-small);
266    padding-left: 0rem;
267    cursor: pointer;
268    min-height: 3rem;
269
270    &:hover {
271      background: var(--color-neutral-surface-hover-emphasis);
272    }
273  }
274
275  :host([type="address"][selected]) li {
276    background: var(--color-neutral-surface-hover-emphasis);
277  }
278
279  :host([type="link"][selected]) li {
280    background: var(--color-neutral-surface-hover-emphasis);
281  }
282
283  :host([type="address"]) li span {
284    position: relative;
285
286    &:first-child {
287      top: 0.25rem;
288    }
289
290    &:last-child {
291      margin-bottom: 0.8rem;
292      top: -0.2rem;
293    }
294  }
295`,d=class extends r.g{constructor(){super(...arguments),this.selected=!1}render(){return"heading"===this.type?(0,r.c)` <li role="none">
296        <slot></slot>
297      </li>`:"link"===this.type?(0,r.c)` <li role="none">
298        <a href="${this.href}" target="${this.target||r.e}">
299          <span><slot></slot></span>
300          <span><slot name="subtext"></slot></span>
301        </a>
302      </li>`:"address"===this.type?(0,r.c)` <li role="none" tabindex="0">
303        <span>
304          <gds-icon
305            icon-type="geolocation"
306            size="small"
307            color="action"
308          ></gds-icon>
309        </span>
310        <span>
311          <slot></slot>
312        </span>
313      </li>`:void 0}connectedCallback(){super.connectedCallback();let t=new CSSStyleSheet;t.replaceSync(l.cssText),this.shadowRoot.adoptedStyleSheets=[i.d,t],this.setAttribute("role","listitem")}};(0,n.c)([(0,o.b)({reflect:!0})],d.prototype,"type",2),(0,n.c)([(0,o.b)()],d.prototype,"href",2),(0,n.c)([(0,o.b)()],d.prototype,"target",2),(0,n.c)([(0,o.b)({type:Boolean,reflect:!0})],d.prototype,"selected",2),d=(0,n.c)([(0,a.a)("gds-dropdown-list-item")],d)},84665:(t,e,s)=>{s.d(e,{a:()=>l});var i=s(24291),o=s(85065),a=s(40629),r=s(11598),n=(0,a.b)`
314  :host {
315    position: absolute;
316    height: auto !important;
317    margin: var(--dropdown-list-container-margin);
318    background: var(--page-background-color);
319    white-space: nowrap;
320    border: var(--dropdown-list-container-border);
321    border-radius: var(--dropdown-list-container-border-radius);
322    overflow-y: auto;
323    max-width: fit-content;
324    width: 100%;
325    max-height: var(--dropdown-list-container-max-height);
326    padding: var(--dropdown-list-container-padding);
327    z-index: 17;
328    display: none;
329  }
330
331  ul {
332    margin: 0;
333    padding: 0;
334  }
335
336  :host([position="negative-margin"]) {
337    margin: var(--dropdown-list-container-margin);
338  }
339
340  :host([position="relative"]) {
341    margin: 0.8rem 0 0 0;
342  }
343
344  :host([visible]) {
345    display: block;
346  }
347`,l=class extends a.g{constructor(){super(...arguments),this.visible=!1,this.position="negative-margin",this._selectedIndex=-1,this._items=[],this._updateItems=()=>{let t=this.shadowRoot?.querySelector("slot");if(!t)return;let e=t.assignedElements();this._items=e.filter(t=>"gds-dropdown-list-item"===t.tagName.toLowerCase()&&"heading"!==t.getAttribute("type"))},this._handleKeyDown=t=>{if(!(!this.visible||0===this._items.length))switch(t.key){case"ArrowDown":t.preventDefault(),this._selectNext();break;case"ArrowUp":t.preventDefault(),this._selectPrevious();break;case"Enter":t.preventDefault(),this._activateSelected();break;case"Escape":t.preventDefault(),this._clearSelection(),this.dispatchEvent(new CustomEvent("escape-pressed",{bubbles:!0,composed:!0}));break;case"Home":t.preventDefault(),this._selectFirst();break;case"End":t.preventDefault(),this._selectLast()}}}render(){return(0,a.c)`
348      <gds-show-hide>
349        <ul role="none">
350          <slot></slot>
351        </ul>
352      </gds-show-hide>
353    `}connectedCallback(){super.connectedCallback();let t=new CSSStyleSheet;t.replaceSync(n.cssText),this.shadowRoot.adoptedStyleSheets=[t],this.setAttribute("role","list"),this.addEventListener("keydown",this._handleKeyDown),this.addEventListener("slotchange",this._updateItems)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("slotchange",this._updateItems)}updated(t){if(t.has("visible")){let t=this.renderRoot.querySelector("gds-show-hide");this.visible?(t.setAttribute("visible",""),this._updateItems(),this._selectedIndex=-1):(t.removeAttribute("visible"),this._selectedIndex=-1,this._clearSelection())}}_selectNext(){this._selectedIndex=Math.min(this._selectedIndex+1,this._items.length-1),this._updateSelection()}_selectPrevious(){this._selectedIndex=Math.max(this._selectedIndex-1,-1),this._updateSelection()}_selectFirst(){this._selectedIndex=0,this._updateSelection()}_selectLast(){this._selectedIndex=this._items.length-1,this._updateSelection()}_updateSelection(){this._items.forEach((t,e)=>{e===this._selectedIndex?(t.setAttribute("selected",""),t.scrollIntoView({block:"nearest",behavior:"smooth"})):t.removeAttribute("selected")})}_clearSelection(){this._items.forEach(t=>t.removeAttribute("selected")),this._selectedIndex=-1}_activateSelected(){this._selectedIndex>=0&&this._selectedIndex<this._items.length&&this._items[this._selectedIndex].click()}};(0,r.c)([(0,i.b)({type:Boolean,reflect:!0})],l.prototype,"visible",2),(0,r.c)([(0,i.b)({reflect:!0})],l.prototype,"position",2),(0,r.c)([(0,i.c)()],l.prototype,"_selectedIndex",2),l=(0,r.c)([(0,o.a)("gds-dropdown-list")],l)}}]);

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.