1"use strict";(self.webpackChunktwilio_foundation_frontend=self.webpackChunktwilio_foundation_frontend||[]).push([[1462],{1045:function(e,t,s){s.d(t,{d:function(){return o}});const n=".cmp-pagination";class o{parentComponent;pageChangeListeners;scrollViewSelector;enabled;constructor(e,t){this.parentComponent=e,this.pageChangeListeners=[],this.enabled=!0,this.scrollViewSelector=t,this.initialize()}addPageChangeListener(e){this.pageChangeListeners.push(e)}setCurrentPage(e){const t=new URLSearchParams({...Object.fromEntries(new URLSearchParams(window.location.search)),page:`${e}`});history.replaceState(null,"",`${window.location.pathname}?${t.toString()}`),this.pageChangeListeners.forEach(t=>t(+e))}disable(){this.enabled=!1,this.parentComponent.querySelector(n)?.setAttribute("aria-disabled","true")}enable(){this.enabled=!0,this.parentComponent.querySelector(n)?.setAttribute("aria-disabled","false")}appendMobileClasses(){const e=Array.from(this.parentComponent.querySelectorAll(`${n} .cmp-pagination__list__item`)),t=e.findIndex(e=>e.classList.contains("pagination-current"));let s=t-2,o=t+3;s<0&&(o+=Math.abs(s)-1),o>e.length&&(s-=o-e.length),e.forEach((e,t)=>{(t<=s||t>=o)&&e.classList.add("cmp-pagination__list__item--hide-on-mobile")})}refresh(){this.appendMobileClasses()}scrollInToView(){(this.parentComponent.querySelector(this.scrollViewSelector)??this.parentComponent).scrollIntoView({behavior:"smooth"})}initialize(){this.parentComponent?.addEventListener("click",e=>{const t=e.target;if(t&&t.matches(`${n} a,${n} a *`)){if(e.stopPropagation(),e.preventDefault(),!this.enabled)return;let s;s="A"!==t.nodeName?t.closest("a"):e.target;const n=new URLSearchParams(s?.search),o=new URLSearchParams({...Object.fromEntries(new URLSearchParams(window.location.search)),...Object.fromEntries(n)});history.replaceState(null,"",`${window.location.pathname}?${o.toString()}`);const r=n.get("page")??"1";this.pageChangeListeners.forEach(e=>e(parseInt(r,10)))}})}}},31462:function(e,t,s){s.d(t,{j:function(){return u}});var n,o=s(97519),r=s(1045);class i{element;component;submitButton;resetButton;filtersMobileButton;filterCategoryButtons;categoryDropdowns;filtersFacets;categoryTagContainer;selectors;constructor(e,t,s){this.element=t,this.selectors=e,this.component=s??document.body,this.submitButton=this.component.querySelector(e.FILTERS_FORM_SUBMIT_BUTTON),this.resetButton=this.component.querySelector(e.FILTERS_FORM_RESET_BUTTON),this.categoryTagContainer=this.component.querySelector(e.FILTERS_CATEGORY_TAGS),this.filtersMobileButton=this.component.querySelector(e.FILTERS_BUTTON),this.filtersFacets=this.component.querySelectorAll(e.FILTERS_FACETS),this.filterCategoryButtons=this.component.querySelectorAll(e.FILTERS_CATEGORY_BUTTON),this.categoryDropdowns=this.component.querySelectorAll(e.FILTERS_CATEGORY_DROPDOWN),this.initializeListeners()}initializeListeners(){this.toggleCategoryListVisibility(this.filterCategoryButtons,this.categoryDropdowns),this.filterCategoryButtons?.forEach(e=>e.addEventListener("click",this.filterMobileCategoryDisplayToggle.bind(this)));const e="twilio-checkbox-label__focused";this.element?.addEventListener("change",e=>{if(this.updateSelectionCount(),this.hideFilterTags(),!this.resetButton)return;var t;"INPUT"===(t=e.target).nodeName&&"checkbox"===t.getAttribute("type")?.toLowerCase()&&this.toggleButtonsAvailability()}),this.filtersMobileButton?.addEventListener("click",e=>{e.preventDefault(),this.mobileToggleElements()}),this.component.querySelector(this.selectors.FILTERS_CLOSE)?.addEventListener("click",e=>{e.preventDefault(),this.mobileToggleElements()}),this.element?.querySelectorAll("input[type='checkbox']").forEach(t=>t.addEventListener("focus",t=>{const s=t.target;s.parentElement?.querySelector("input:focus-visible")&&s.parentElement?.classList.add(e)})),this.element?.querySelectorAll("input[type='checkbox']").forEach(t=>t.addEventListener("blur",t=>{const s=t.target;s.parentElement?.classList.remove(e)})),this.submitButton?.addEventListener("click",e=>{e.preventDefault(),this.mobileToggleElements()}),this.onReset(()=>{this.resetButton&&(this.resetButton.disabled=!0),this.element?.querySelector("label:first-child")?.focus();const e=this.element?.querySelectorAll('input[type="checkbox"]');
1e?.forEach(e=>{e.checked=!1}),this.updateSelectionCount(),this.hideFilterTags(),this.resetTags(),this.element?.requestSubmit()}),this.checkboxSubmit()}toggleButtonsAvailability(){const e=!this.element?.querySelectorAll('input[type="checkbox"]:checked').length;this.resetButton&&(this.resetButton.disabled=e)}updateSelectionCount(){this.filtersFacets?.forEach(e=>{const t=e.querySelector(this.selectors.FILTERS_CATEGORY_DROPDOWN),s=this.countSelectedCheckboxes(t),n=e.querySelector(this.selectors.FILTER_BUTTON_COUNT_SPAN);n&&(n.textContent=s<=0?"":`(${s.toString()})`)})}resetTags(){this.categoryTagContainer?.querySelectorAll("span").forEach(e=>e.remove())}hideFilterTags(){this.categoryTagContainer?.classList.add(this.selectors.SELECTED_FILTERS_HIDDEN),this.filtersFacets?.forEach(e=>{const t=e.querySelector(this.selectors.FILTERS_CATEGORY_DROPDOWN);this.countSelectedCheckboxes(t)>0&&this.categoryTagContainer?.classList.remove(this.selectors.SELECTED_FILTERS_HIDDEN)})}addTag(e){const t=e.value.split(":").pop();if(this.categoryTagContainer?.classList.remove(this.selectors.SELECTED_FILTERS_HIDDEN),e.checked&&t){const s=document.createElement("span");s.className=this.selectors.FILTERS_TAG,s.id=t;const n=e&&e.labels?.length&&e.labels[0]?.textContent||t;s.innerHTML=n.trim();const o=document.createElement("button");o.className=this.selectors.FILTERS_TAG_CLOSE,o.innerHTML="x",o.onclick=()=>{this.removeTag(t)},s.appendChild(o),this.categoryTagContainer?.insertAdjacentElement("afterbegin",s)}else this.removeTag(t)}onSubmit(e){this.element?.addEventListener("submit",e)}onReset(e){this.element?.addEventListener("reset",e)}reset(){this.element?.reset()}getCheckedCategories(){return new FormData(this.element).getAll("categories")}checkboxSubmit(){this.element?.querySelectorAll("input[type='checkbox']").forEach(e=>e.addEventListener("change",()=>{this.toggleButtonsAvailability(),this.addTag(e),this.element?.requestSubmit()}))}filterMobileCategoryDisplayToggle(e){const t=e.currentTarget.parentElement;t?.classList.contains(this.selectors.EXPANDED_FILTER)?t?.classList.remove(this.selectors.EXPANDED_FILTER):t?.classList?.add(this.selectors.EXPANDED_FILTER)}countSelectedCheckboxes(e){if(e){const t=e?.querySelectorAll('input[type="checkbox"]');return Array.from(t).filter(e=>e.checked).length}return 0}toggleCategoryListVisibility(e,t){const s=()=>{t?.forEach(e=>e.classList.add(this.selectors.CATEGORY_LIST_HIDDEN)),e?.forEach(e=>{e.querySelector("span:last-child")?.classList.remove("arrow-up"),e?.classList.remove("expanded")})};e?.forEach((e,n)=>{e.addEventListener("click",o=>{if(o.preventDefault(),t){const o=t[n],r=!o?.classList.contains(this.selectors.CATEGORY_LIST_HIDDEN);s(),r||(o?.classList.remove(this.selectors.CATEGORY_LIST_HIDDEN),this.toggleButtonArrow(e))}})}),document.addEventListener("keydown",e=>{"Escape"===e.code&&t?.forEach(e=>{e.classList.add(this.selectors.CATEGORY_LIST_HIDDEN)})}),document.addEventListener("click",s=>{const n=s.target;n&&!this.component.contains(n)&&(t?.forEach(e=>{e.classList.add(this.selectors.CATEGORY_LIST_HIDDEN)}),e?.forEach(e=>{e.querySelector("span:last-child")?.classList.remove("arrow-up"),e?.classList.remove("expanded")}))})}toggleButtonArrow(e){e.querySelector("span:last-child")?.classList.toggle("arrow-up"),e?.classList.toggle("expanded")}removeTag(e=""){if(e){const t=this.categoryTagContainer?.querySelector(`#${CSS.escape(e)}`);t?.remove();const s=this.element?.querySelectorAll('input[type="checkbox"]');s?.forEach(t=>{t.value.endsWith(e)&&(t.checked=!1,this.element?.requestSubmit())}),this.updateSelectionCount(),this.hideFilterTags()}}mobileToggleElements(){document.body.classList.toggle(this.selectors.BODY_MOBILE_OVERFLOW_HIDDEN);const e=this.component.closest("main"),t=e?.querySelector("header")??document.querySelector("header");t?.classList.toggle(this.selectors.HIDE_HEADER),this.element?.classList.toggle(this.selectors.FILTERS_OPEN)}}function a(e){return e&&""!==e.trim()&&document.querySelectorAll("[data-cmp-hash]").length>1?e:null}function c(e,t){return e&&""!==e.trim()?`cmp_${e}_${t}`:t}function l(e,t,s,n){n?(function(e,t){[t.LOADING_COMPONENT,t.ERROR_MESSAGE_COMPONENT,t.EMPTY_MESSAGE_COMPONENT].forEach(s=>{l(e,s,t,!1)})}(e,s),e?.querySelector(t)?.classList.add(s.VISIBLE_CLASS_NAME)):e?.querySelector(t)?.classList.remove(s.VISIBLE_CLASS_NAME)}function h(e,t){const s=e.querySelector(t.GRID_VIEW);
1s&&(s.innerHTML="")}function u(e,t,s,u){const p=new r.d(e,t.MAIN);if(p.addPageChangeListener(()=>function({component:e,pagination:t,selectors:s,cmpSelector:r,servletProps:i,paginationCallback:a}){t.disable(),l(e,s.LOADING_COMPONENT,s,!0);const c=e.dataset.cmpPath,u=`.${e.dataset.cmpSelector}`,d=`${i.selector}${r?u:""}`;if(!c)throw l(e,s.ERROR_MESSAGE_COMPONENT,s,!0),new Error("Internal Error: Error getting resource path.");n.fetchContent(c,d,i.extension).then(n=>{h(e,s),function(e,t,s){const n=e.querySelector(t.GRID_VIEW);n&&(n.innerHTML=o.default.sanitize(s))}(e,s,n),t.refresh(),t.scrollInToView()}).then(()=>{a?.()}).catch(()=>{l(e,s.ERROR_MESSAGE_COMPONENT,s,!0)}).finally(()=>{l(e,s.LOADING_COMPONENT,s,!1),t.enable()})}({component:e,pagination:p,selectors:t,cmpSelector:!1,servletProps:s,paginationCallback:u})),p.refresh(),!function(e){return"object"==typeof e&&null!==e&&"FILTERS_FORM"in e}(t))return;const g=e.querySelector(t.CLEAR_ALL_BUTTON),E=e.querySelector(t.FILTERS_FORM);if(!E||!g)return;const m=new i(t,E,e),S=function(e,t,s,n){const o=new URLSearchParams(window.location.search),r=a(n.getAttribute("data-cmp-hash")),i=t=>{t.checked||(t.checked=!0,e.addTag(t))};e.element?.querySelectorAll("input[data-check-on-load]").forEach(i);const l=e.element?.querySelectorAll(t.FILTERS_CATEGORY_BUTTON)??[],h=Array.from(l).map(e=>{const t=e.dataset.tagId??"";return t.endsWith(":")?{parentTag:t.slice(0,-1),separator:":"}:{parentTag:t,separator:"/"}}).filter(e=>Boolean(e.parentTag));h.flatMap(({parentTag:e,separator:t})=>{const s=r?c(r,e):null,n=s&&o.get(s)||o.get(e??"");return n?.split(",").map(s=>`${e}${t}${decodeURIComponent(s)}`)}).filter(Boolean).forEach(t=>{const s=e?.element?.querySelector(`input[type="checkbox"][value="${t}"]`);s&&i(s)}),d(e,h,t,n),e.toggleButtonsAvailability(),e.updateSelectionCount();const u=e.getCheckedCategories()??[];return s.disabled=!u.length,h}(m,t,g,e);m.onSubmit(s=>function(e,t){const{event:s,filtersForm:n,parentTagFilters:o,component:r,pagination:i,clearAllButton:a}=e;s.preventDefault(),d(n,o,t,r),h(r,t),function(e,t){const s=e.querySelector(t.GRID_VIEW);if(s){const e=document.createElement("div");e.setAttribute("class","spinner-dual-ring"),s.appendChild(e)}}(r,t),i.setCurrentPage(1);const c=n.getCheckedCategories()??[];a&&(a.disabled=0===c?.length)}({event:s,component:e,pagination:p,filtersForm:m,parentTagFilters:S,clearAllButton:g},t)),g.addEventListener("click",()=>{!function(e,t,s,n,o,r){o.disabled=!0,s.reset(),d(s,n,r,e),function(e,t,s){h(e,s),t.setCurrentPage(1)}(e,t,r)}(e,p,m,S,g,t),m.updateSelectionCount(),m.resetTags()})}function d(e,t,s,n){const r=e.getCheckedCategories()??[],i=e.element?.querySelector(s.FILTERS_FORM_SUBMIT_BUTTON);if(i){const e=r.length>0?i.getAttribute("data-default-value")??"":i.getAttribute("data-close-value")??"";i.innerText=o.default.sanitize(e)}!function(e,t,s){const n=new URLSearchParams(window.location.search),o=function(e){return e.reduce((e,t)=>{const[s,n]=t.toString().split(/[/:](?=[^/:]*$)/,2);if(!s||!n)return e;const o=e.get(s)||[];return o.push(n),e.set(s,o),e},new Map)}(e),r=a(s.getAttribute("data-cmp-hash"));t.forEach(({parentTag:e})=>
1{if(r){const t=c(r,e);n.delete(t)}else n.delete(e)}),o.forEach((e,t)=>{const s=e.map(e=>encodeURIComponent(e)),o=r?c(r,t):t;n.append(o,s.join(","))});const i=n.size>0?`?${String(n)}`:"";history.replaceState(null,"",window.location.pathname+i)}(r,t,n)}!function(e){e.fetchContent=async function(e,t,s){const n=`${e}.${t}.${s}`,o=new URLSearchParams(window.location.search),r=await fetch(`${n}?${o.toString()}`);if(!r.ok)throw r.status>=400&&r.status<500?new Error(`Client Error: ${r.status}`):r.status>=500&&r.status<600?new Error(`Server Error: ${r.status}`):new Error(`HTTP Error: ${r.status}`);return r.text()}}(n||(n={}))}}]);
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.