(globalThis.webpackChunkcheckout_for_woocommerce=globalThis.webpackChunkcheckout_for_woocommerce||[]).push([[678],{6335:t=>{var e;e=()=>(()=>{var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,n={};((e,i)=>{for(var s in i)t(e,s,{get:i[s],enumerable:!0})})(n,{Iti:()=>_,default:()=>f});var o=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],a=[];for(let t=0;tt.replace(/\D/g,""),y=(t="")=>t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),m=t=>{const e=p(t);if("1"===e.charAt(0)){const t=e.substr(1,3);return-1!==c.indexOf(t)}return!1},C=(t,e,i)=>{const s=document.createElement(t);return e&&Object.entries(e).forEach(([t,e])=>s.setAttribute(t,e)),i&&i.appendChild(s),s},g=t=>{const{instances:e}=b;Object.values(e).forEach(e=>e[t]())},_=class{constructor(t,e={}){this.id=u++,this.telInput=t,this.highlightedItem=null,this.options=Object.assign({},h,e),this.hadInitialPlaceholder=Boolean(t.getAttribute("placeholder"))}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),1===this.options.onlyCountries.length&&(this.options.initialCountry=this.options.onlyCountries[0]),this.options.separateDialCode&&(this.options.nationalMode=!1),!this.options.allowDropdown||this.options.showFlags||this.options.separateDialCode||(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isAndroid="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),this.isRTL=!!this.telInput.closest("[dir=rtl]");const t=this.options.allowDropdown||this.options.separateDialCode;this.showSelectedCountryOnLeft=this.isRTL?!t:t,this.options.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.telInput.style.paddingRight:this.originalPaddingLeft=this.telInput.style.paddingLeft),this.options.i18n={...l,...this.options.i18n};const e=new Promise((t,e)=>{this.resolveAutoCountryPromise=t,this.rejectAutoCountryPromise=e}),i=new Promise((t,e)=>{this.resolveUtilsScriptPromise=t,this.rejectUtilsScriptPromise=e});this.promise=Promise.all([e,i]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this._sortCountries()}_sortCountries(){this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map(t=>t.toLowerCase())),this.countries.sort((t,e)=>{const{countryOrder:i}=this.options;if(i){const s=i.indexOf(t.iso2),n=i.indexOf(e.iso2),o=s>-1,a=n>-1;if(o||a)return o&&a?s-n:o?-1:1}return t.name.localeCompare(e.name)})}_addToDialCodeMap(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.dialCodeToIso2Map.hasOwnProperty(e)||(this.dialCodeToIso2Map[e]=[]);for(let i=0;it.toLowerCase());this.countries=r.filter(t=>e.indexOf(t.iso2)>-1)}else if(e.length){const t=e.map(t=>t.toLowerCase());this.countries=r.filter(e=>-1===t.indexOf(e.iso2))}else this.countries=r}_translateCountryNames(){for(let t=0;t`),n+=`${e.name}`,n+=`+${e.dialCode}`,s.insertAdjacentHTML("beforeend",n)}}_setInitialState(t=!1){const e=this.telInput.getAttribute("value"),i=this.telInput.value,s=!e||"+"!==e.charAt(0)||i&&"+"===i.charAt(0)?i:e,n=this._getDialCode(s),o=m(s),{initialCountry:a,geoIpLookup:r}=this.options,l="auto"===a&&r;if(n&&!o)this._updateCountryFromNumber(s);else if(!l||t){const t=a?a.toLowerCase():"";t&&this._getCountryData(t,!0)?this._setCountry(t):n&&o?this._setCountry("us"):this._setCountry()}s&&this._updateValFromNumber(s)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=t=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():t.preventDefault()};const t=this.telInput.closest("label");t&&t.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{!this.dropdownContent.classList.contains("iti__hide")||this.telInput.disabled||this.telInput.readOnly||this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=t=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this._openDropdown()),"Tab"===t.key&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){const{utilsScript:t,initialCountry:e,geoIpLookup:i}=this.options;t&&!b.utils?b.documentReady()?b.loadUtils(t):window.addEventListener("load",()=>{b.loadUtils(t)}):this.resolveUtilsScriptPromise(),"auto"===e&&i&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){b.autoCountry?this.handleAutoCountry():b.startedLoadingAutoCountry||(b.startedLoadingAutoCountry=!0,"function"==typeof this.options.geoIpLookup&&this.options.geoIpLookup((t="")=>{const e=t.toLowerCase();e&&this._getCountryData(e,!0)?(b.autoCountry=e,setTimeout(()=>g("handleAutoCountry"))):(this._setInitialState(!0),g("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),g("rejectAutoCountryPromise")}))}_openDropdownWithPlus(){this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0)}_initTelInputListeners(){const{strictMode:t,formatAsYouType:e,separateDialCode:i,formatOnDisplay:s,allowDropdown:n,countrySearch:o}=this.options;let a=!1;/\p{L}/u.test(this.telInput.value)&&(a=!0),this._handleInputEvent=r=>{if(this.isAndroid&&"+"===r?.data&&i&&n&&o){const t=this.telInput.selectionStart||0,e=this.telInput.value.substring(0,t-1),i=this.telInput.value.substring(t);return this.telInput.value=e+i,void this._openDropdownWithPlus()}this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();const l=r?.data&&/[^+0-9]/.test(r.data),d="insertFromPaste"===r?.inputType&&this.telInput.value;l||d&&!t?a=!0:/[^+0-9]/.test(this.telInput.value)||(a=!1);const u=r?.detail&&r.detail.isSetNumber&&!s;if(e&&!a&&!u){const t=this.telInput.selectionStart||0,e=this.telInput.value.substring(0,t).replace(/[^+0-9]/g,"").length,i="deleteContentForward"===r?.inputType,s=this._formatNumberAsYouType(),n=((t,e,i,s)=>{if(0===i&&!s)return 0;let n=0;for(let i=0;i{if(e.key&&1===e.key.length&&!e.altKey&&!e.ctrlKey&&!e.metaKey){if(i&&n&&o&&"+"===e.key)return e.preventDefault(),void this._openDropdownWithPlus();if(t){const t=0===this.telInput.selectionStart&&"+"===e.key,s=/^[0-9]$/.test(e.key),n=i?s:t||s,o=this._getFullNumber(),a=b.utils.getCoreNumber(o,this.selectedCountryData.iso2),r=this.maxCoreNumberLength&&a.length>=this.maxCoreNumberLength,l=this.telInput.value.substring(this.telInput.selectionStart,this.telInput.selectionEnd),d=/\d/.test(l);(!n||r&&!d)&&e.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(t){const e=parseInt(this.telInput.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t,e={}){const i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.telInput.dispatchEvent(i)}_openDropdown(){const{fixDropdownWidth:t,countrySearch:e}=this.options;if(t&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition(),e){const t=this.countryList.firstElementChild;t&&(this._highlightListItem(t,!1),this.countryList.scrollTop=0),this.searchInput.focus()}this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){const t=this.telInput.getBoundingClientRect(),e=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=t=>{const e=t.target?.closest(".iti__country");e&&this._highlightListItem(e,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=t=>{const e=t.target?.closest(".iti__country");e&&this._selectListItem(e)},this.countryList.addEventListener("click",this._handleClickCountryList);let t=!0;this._handleClickOffToClose=()=>{t||this._closeDropdown(),t=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);let e="",i=null;if(this._handleKeydownOnDropdown=t=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),"ArrowUp"===t.key||"ArrowDown"===t.key?this._handleUpDownKey(t.key):"Enter"===t.key?this._handleEnterKey():"Escape"===t.key&&this._closeDropdown()),!this.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(t.key)&&(t.stopPropagation(),i&&clearTimeout(i),e+=t.key.toLowerCase(),this._searchForCountry(e),i=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch){const t=()=>{const t=this.searchInput.value.trim();t?this._filterCountries(t):this._filterCountries("",!0)};let e=null;this._handleSearchChange=()=>{e&&clearTimeout(e),e=setTimeout(()=>{t(),e=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",t=>t.stopPropagation())}}_searchForCountry(t){for(let e=0;et[0]).join("").toLowerCase(),r=`+${n.dialCode}`;if(e||o.includes(s)||r.includes(s)||n.iso2.includes(s)||a.includes(s)){const t=n.nodeById[this.id];t&&this.countryList.appendChild(t),i&&(this._highlightListItem(t,!1),i=!1)}}i&&this._highlightListItem(null,!1),this.countryList.scrollTop=0,this._updateSearchResultsText()}_updateSearchResultsText(){const{i18n:t}=this.options,e=this.countryList.childElementCount;let i;i=0===e?t.zeroSearchResults:1===e?t.oneSearchResult:t.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=i}_handleUpDownKey(t){let e="ArrowUp"===t?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e="ArrowUp"===t?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._scrollTo(e),this._highlightListItem(e,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber(t){let e=t;if(this.options.formatOnDisplay&&b.utils&&this.selectedCountryData){const t=this.options.nationalMode||"+"!==e.charAt(0)&&!this.options.separateDialCode,{NATIONAL:i,INTERNATIONAL:s}=b.utils.numberFormat,n=t?i:s;e=b.utils.formatNumber(e,this.selectedCountryData.iso2,n)}e=this._beforeSetNumber(e),this.telInput.value=e}_updateCountryFromNumber(t){const e=t.indexOf("+");let i=e?t.substring(e):t;const s=this.selectedCountryData.dialCode;i&&"1"===s&&"+"!==i.charAt(0)&&("1"!==i.charAt(0)&&(i=`1${i}`),i=`+${i}`),this.options.separateDialCode&&s&&"+"!==i.charAt(0)&&(i=`+${s}${i}`);const n=this._getDialCode(i,!0),o=p(i);let a=null;if(n){const t=this.dialCodeToIso2Map[p(n)],e=-1!==t.indexOf(this.selectedCountryData.iso2)&&o.length<=n.length-1;if(!("1"===s&&m(o)||e))for(let e=0;eo){const t=s-a;e.scrollTop=d-t}}_updateDialCode(t){const e=this.telInput.value,i=`+${t}`;let s;if("+"===e.charAt(0)){const t=this._getDialCode(e);s=t?e.replace(t,i):i,this.telInput.value=s}}_getDialCode(t,e){let i="";if("+"===t.charAt(0)){let s="";for(let n=0;n-1){const i=t.substring(0,e),s=this._utilsIsPossibleNumber(i),n=this._utilsIsPossibleNumber(t);return s&&n}return this._utilsIsPossibleNumber(t)}_utilsIsPossibleNumber(t){return b.utils?b.utils.isPossibleNumber(t,this.selectedCountryData.iso2,this.options.validationNumberType):null}isValidNumberPrecise(){if(!this.selectedCountryData.iso2)return!1;const t=this._getFullNumber(),e=t.search(/\p{L}/u);if(e>-1){const i=t.substring(0,e),s=this._utilsIsValidNumber(i),n=this._utilsIsValidNumber(t);return s&&n}return this._utilsIsValidNumber(t)}_utilsIsValidNumber(t){return b.utils?b.utils.isValidNumber(t,this.selectedCountryData.iso2):null}setCountry(t){const e=t?.toLowerCase(),i=this.selectedCountryData.iso2;(t&&e!==i||!t&&i)&&(this._setCountry(e),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber(t){const e=this._updateCountryFromNumber(t);this._updateValFromNumber(t),e&&this._triggerCountryChange(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(t){this.options.placeholderNumberType=t,this._updatePlaceholder()}setDisabled(t){this.telInput.disabled=t,t?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},b=Object.assign((t,e)=>{const i=new _(t,e);return i._init(),t.setAttribute("data-intl-tel-input-id",i.id.toString()),b.instances[i.id]=i,i},{defaults:h,documentReady:()=>"complete"===document.readyState,getCountryData:()=>r,getInstance:t=>{const e=t.getAttribute("data-intl-tel-input-id");return e?b.instances[e]:null},instances:{},loadUtils:t=>b.utils||b.startedLoadingUtilsScript?null:(b.startedLoadingUtilsScript=!0,new Promise((e,i)=>{import(t).then(({default:t})=>{b.utils=t,g("handleUtils"),e(!0)}).catch(()=>{g("rejectUtilsScriptPromise"),i()})})),version:"24.3.4"}),f=b;return d=n,((n,o,a,r)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let a of i(o))s.call(n,a)||undefined===a||t(n,a,{get:()=>o[a],enumerable:!(r=e(o,a))||r.enumerable});return n})(t({},"__esModule",{value:!0}),d)})().default,t.exports?t.exports=e():window.intlTelInput=e()}}]); (globalThis.webpackChunkcheckout_for_woocommerce=globalThis.webpackChunkcheckout_for_woocommerce||[]).push([[458],{3378:(e,r)=>{r.parseFullName=function(e,r,i,n,s){"use strict";var a,o,l,t,c,d,h,f,m,u,p,g,b,v,k,j=[],x=[null],w=[],C=["&","and","et","e","of","the","und","y"],L={title:"",first:"",middle:"",last:"",nick:"",suffix:"",error:[]};function O(e){if(n)throw"Error: "+e;L.error.push("Error: "+e)}function y(e,r){var i,n,s=["e","y","av","af","da","dal","de","del","der","di","la","le","van","der","den","vel","von","II","III","IV","J.D.","LL.M.","M.D.","D.O.","D.C.","Ph.D."],c=[];if(r)for(c=Object.keys(L).filter(function(e){return"error"!==e}),a=0,l=c.length;a-1?n[o]=s[i]:1===n[o].length?n[o]=n[o].toUpperCase():n[o].length>2&&n[o].slice(0,1)===n[o].slice(0,1).toUpperCase()&&n[o].slice(1,2)===n[o].slice(1,2).toLowerCase()&&n[o].slice(2)===n[o].slice(2).toUpperCase()?n[o]=n[o].slice(0,3)+n[o].slice(3).toLowerCase():"suffix"!==c[o]||"."===n[o].slice(-1)||m.indexOf(n[o].toLowerCase())?n[o]=n[o].slice(0,1).toUpperCase()+n[o].slice(1).toLowerCase():n[o]===n[o].toLowerCase()&&(n[o]=n[o].toUpperCase());e[c[a]]=n.join(" ")}return e}if(r=r&&["title","first","middle","last","nick","suffix","error"].indexOf(r.toLowerCase())>-1?r.toLowerCase():"all",!1===i&&(i=0),!0===i&&(i=1),i="undefined"===i||0!==i&&1!==i?-1:i,!0===n&&(n=1),n=n&&1===n?1:0,!0===s&&(s=1),s=s&&1===s?1:0,!e||"string"!=typeof e)return O("No input"),L=y(L,i),"all"===r?L:L[r];if(e=e.trim(),-1===i&&(i=e===e.toUpperCase()||e===e.toLowerCase()?1:0),s?(m=["esq","esquire","jr","jnr","sr","snr","2","ii","iii","iv","v","clu","chfc","cfp","md","phd","j.d.","ll.m.","m.d.","d.o.","d.c.","p.c.","ph.d."],u=["a","ab","antune","ap","abu","al","alm","alt","bab","bäck","bar","bath","bat","beau","beck","ben","berg","bet","bin","bint","birch","björk","björn","bjur","da","dahl","dal","de","degli","dele","del","della","der","di","dos","du","e","ek","el","escob","esch","fleisch","fitz","fors","gott","griff","haj","haug","holm","ibn","kauf","kil","koop","kvarn","la","le","lind","lönn","lund","mac","mhic","mic","mir","na","naka","neder","nic","ni","nin","nord","norr","ny","o","ua","ui'","öfver","ost","över","öz","papa","pour","quarn","skog","skoog","sten","stor","ström","söder","ter","ter","tre","türk","van","väst","väster","vest","von"],f=["mr","mrs","ms","miss","dr","herr","monsieur","hr","frau","a v m","admiraal","admiral","air cdre","air commodore","air marshal","air vice marshal","alderman","alhaji","ambassador","baron","barones","brig","brig gen","brig general","brigadier","brigadier general","brother","canon","capt","captain","cardinal","cdr","chief","cik","cmdr","coach","col","col dr","colonel","commandant","commander","commissioner","commodore","comte","comtessa","congressman","conseiller","consul","conte","contessa","corporal","councillor","count","countess","crown prince","crown princess","dame","datin","dato","datuk","datuk seri","deacon","deaconess","dean","dhr","dipl ing","doctor","dott","dott sa","dr","dr ing","dra","drs","embajador","embajadora","en","encik","eng","eur ing","exma sra","exmo sr","f o","father","first lieutient","first officer","flt lieut","flying officer","fr","frau","fraulein","fru","gen","generaal","general","governor","graaf","gravin","group captain","grp capt","h e dr","h h","h m","h r h","hajah","haji","hajim","her highness","her majesty","herr","high chief","his highness","his holiness","his majesty","hon","hr","hra","ing","ir","jonkheer","judge","justice","khun ying","kolonel","lady","lcda","lic","lieut","lieut cdr","lieut col","lieut gen","lord","m","m l","m r","madame","mademoiselle","maj gen","major","master","mevrouw","miss","mlle","mme","monsieur","monsignor","mr","mrs","ms","mstr","nti","pastor","president","prince","princess","princesse","prinses","prof","prof dr","prof sir","professor","puan","puan sri","rabbi","rear admiral","rev","rev canon","rev dr","rev mother","reverend","rva","senator","sergeant","sheikh","sheikha","sig","sig na","sig ra","sir","sister","sqn ldr","sr","sr d","sra","srta","sultan","tan sri","tan sri dato","tengku","teuku","than puying","the hon dr","the hon justice","the hon miss","the hon mr","the hon mrs","the hon ms","the hon sir","the very rev","toh puan","tun","vice admiral","viscount","viscountess","wg cdr","ind","misc","mx"]):(m=["esq","esquire","jr","jnr","sr","snr","2","ii","iii","iv","md","phd","j.d.","ll.m.","m.d.","d.o.","d.c.","p.c.","ph.d."],u=["ab","bar","bin","da","dal","de","de la","del","della","der","di","du","ibn","l'","la","le","san","st","st.","ste","ter","van","van de","van der","van den","vel","ver","vere","von"],f=["dr","miss","mr","mrs","ms","prof","sir","frau","herr","hr","monsieur","captain","doctor","judge","officer","professor","ind","misc","mx"]),(g=(" "+e+" ").match(/\s(?:[‘’']([^‘’']+)[‘’']|[“”"]([^“”"]+)[“”"]|\[([^\]]+)\]|\(([^\)]+)\)),?\s/g))&&(w=w.concat(g)),1===(b=w.length))L.nick=w[0].slice(2).slice(0,-2),","===L.nick.slice(-1)&&(L.nick=L.nick.slice(0,-1)),e=(" "+e+" ").replace(w[0]," ").trim(),w=[];else if(b>1){for(O(b+" nicknames found"),a=0;a0;a--)p="."===j[a].slice(-1)?j[a].slice(0,-1).toLowerCase():j[a].toLowerCase(),(m.indexOf(p)>-1||m.indexOf(p+".")>-1)&&(w=j.splice(a,1).concat(w),","===x[a]?x.splice(a+1,1):x.splice(a,1));if(1===(b=w.length)?(L.suffix=w[0],w=[]):b>1&&(O(b+" suffixes found"),L.suffix=w.join(", "),w=[]),!j.length)return L=y(L,i),"all"===r?L:L[r];for(l=j.length,a=l-1;a>=0;a--)p="."===j[a].slice(-1)?j[a].slice(0,-1).toLowerCase():j[a].toLowerCase(),(f.indexOf(p)>-1||f.indexOf(p+".")>-1)&&(w=j.splice(a,1).concat(w),","===x[a]?x.splice(a+1,1):x.splice(a,1));if(1===(b=w.length)?(L.title=w[0],w=[]):b>1&&(O(b+" titles found"),L.title=w.join(", "),w=[]),!j.length)return L=y(L,i),"all"===r?L:L[r];if(j.length>1)for(a=j.length-2;a>=0;a--)u.indexOf(j[a].toLowerCase())>-1&&(j[a]=j[a]+" "+j[a+1],j.splice(a+1,1),x.splice(a+1,1));if(j.length>2)for(a=j.length-3;a>=0;a--)C.indexOf(j[a+1].toLowerCase())>-1&&(j[a]=j[a]+" "+j[a+1]+" "+j[a+2],j.splice(a+1,2),x.splice(a+1,2),a--);if(x.pop(),v=x.indexOf(","),k=x.filter(function(e){return null!==e}).length,v>1||k>1)for(a=j.length-1;a>=2&&","===x[a];a--)w=j.splice(a,1).concat(w),x.splice(a,1),k--;return w.length&&(L.suffix&&(w=[L.suffix].concat(w)),L.suffix=w.join(", "),w=[]),k>0?(k>1&&O(k-1+" extra commas found"),x.indexOf(",")&&(L.last=j.splice(0,x.indexOf(",")).join(" "),x.splice(0,x.indexOf(",")))):L.last=j.pop(),j.length?(L.first=j.shift(),j.length?(j.length>2&&O(j.length+" middle names"),L.middle=j.join(" "),L=y(L,i),"all"===r?L:L[r]):(L=y(L,i),"all"===r?L:L[r])):(L=y(L,i),"all"===r?L:L[r])}}}]);