PageSourceSearch

https://www.arsmundi.de/theme/3e24dacfef584acff507e92bbfdc409d/js/…/form-country-state-select.plugin.079925.js

js arsmundi.de collected 2026-09-24 21:51:24 UTC 7,108 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["form-country-state-select.plugin"],{6300:(e,t,n)=>{n.r(t),n.d(t,{default:()=>s});var i=n(9568),r=n(4049),o=n(3107);class s extends i.Z{init(){this.initClient(),this.initSelects(),this._getFormFieldToggleInstance(),this._formFieldToggleInstance&&this._formFieldToggleInstance.$emitter.subscribe("onChange",this._onFormFieldToggleChange.bind(this))}initClient(){this._client=new o.Z}initSelects(){this.scopeElement=this.el,this.options.scopeElementSelector&&(this.scopeElement=r.Z.querySelector(document,this.options.scopeElementSelector));let{countrySelectSelector:e,countryStateSelectSelector:t,initialCountryAttribute:n,initialCountryStateAttribute:i}=s.options,o=r.Z.querySelector(this.scopeElement,e),d=r.Z.querySelector(this.scopeElement,t),l=r.Z.getDataAttribute(o,n),a=r.Z.getDataAttribute(d,i),u=o.options[o.selectedIndex],c=!!r.Z.getDataAttribute(u,this.options.vatIdRequired,!1),p=document.querySelector(this.options.vatIdFieldInput),h=!!r.Z.getDataAttribute(u,this.options.stateRequired,!1),g=r.Z.querySelectorAll(document,this.options.zipcodeLabel,!1),q=r.Z.querySelectorAll(document,this.options.zipcodeFieldInput,!1),b=!!r.Z.getDataAttribute(u,this.options.zipcodeRequired,!1);o.addEventListener("change",this.onChangeCountry.bind(this)),l&&(this.requestStateData(l,a,h),b&&this._updateZipcodeRequired(g,q,b),p&&this._updateRequiredVatId(p,c))}onChangeCountry(e){let t=e.target.value,n=e.target.options[e.target.selectedIndex],i=!!r.Z.getDataAttribute(n,this.options.stateRequired);this.requestStateData(t,null,i);let o=r.Z.getDataAttribute(n,this.options.vatIdRequired),s=document.querySelector(this.options.vatIdFieldInput),d=r.Z.querySelectorAll(this.scopeElement,this.options.zipcodeLabel,!1),l=r.Z.querySelectorAll(this.scopeElement,this.options.zipcodeFieldInput,!1),a=!!r.Z.getDataAttribute(n,this.options.zipcodeRequired,!1);this._updateZipcodeRequired(d,l,a),s&&this._updateRequiredVatId(s,o)}requestStateData(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=JSON.stringify({countryId:e});this._client.post(window.router["frontend.country.country-data"],i,e=>{let i=JSON.parse(e);!function(e,t,n,i){let{stateRequired:o,states:s}=e,{countryStateSelectSelector:d,countryStatePlaceholderSelector:l}=i,a=r.Z.querySelector(n,d);(function(e,t){e.querySelectorAll(t).forEach(e=>e.remove())})(a,"option:not(".concat(l,")")),function(e,t,n){if(0===t.length){e.parentNode.classList.add("d-none"),e.setAttribute("disabled","disabled");return}t.map(e=>(function(e,t){let n=document.createElement("option");return n.setAttribute("value",e.id),n.innerText=e.translated.name,e.id===t&&n.setAttribute("selected","selected"),n})(e,n)).forEach(t=>{e.append(t)}),e.parentNode.classList.remove("d-none"),e.removeAttribute("disabled")}(a,s,t),function(e,t,n){let i=e.querySelector(n),r=e.parentNode.querySelector("label");if(t){i.setAttribute("disabled","disabled"),e.setAttribute("required","required"),(null==r?void 0:r.textContent)&&"*"!==r.textContent.substr(-1,1)&&(r.textContent="".concat(r.textContent.trim(),"*"));return}(null==r?void 0:r.textContent)&&"*"===r.textContent.substr(-1,1)&&(r.textContent=r.textContent.substr(0,r.textContent.length-1)),i.removeAttribute("disabled"),e.removeAttribute("required")}(a,o,"option".concat(l))}(i={...i,stateRequired:n},t,this.el,s.options)})}_updateRequiredVatId(e,t){if(this._differentShippingCheckbox&&"billingAddress"===this.options.prefix)return;let n=e.parentNode.querySelector("label");if(t){e.setAttribute("required","required"),(null==n?void 0:n.textContent)&&"*"!==n.textContent.substr(-1,1)&&(n.textContent="".concat(n.textContent,"*"));return}(null==n?void 0:n.textContent)&&"*"===n.textContent.substr(-1,1)&&(n.textContent=n.textContent.substr(0,n.textContent.length-1)),e.removeAttribute("required")}_updateZipcodeRequired(e,t,n){e&&t&&(e.forEach(e=>{e.className=n?"":"d-none"}),t.forEach(e=>{n?e.setAttribute("required","required"):e.removeAttribute("required")}))}_getFormFieldToggleInstance(){let e=r.Z.querySelector(document,'[data-form-field-toggle-target=".js-form-field-toggle-shipping-address"]',!1);e&&(this._formFieldToggleInstance=window.PluginManager.getPluginInstanceFromElement(e,"FormFieldToggle"))}_onFormFieldToggleChange(e){this._differentShippingCheckbox=e.target.checked;let t=this._differentShippingCheckbox?".register-shipping":".register-billing",n=r.Z.querySelector(document,t),i=r.Z.querySelector(n,this.options.countrySelectSelector),o=i.options[i.selectedIndex],s=!!r.Z.getDataAttribute(o,this.options.vatIdRequired,!1),d=document.querySelector(this.options.vatIdFieldInput);d&&this._updateRequiredVatId(d,s)}}s.options={countrySelectSelector:".country-select",initialCountryAttribute:"initial-country-id",countryStateSelectSelector:".country-state-select",initialCountryStateAttribute:"initial-country-state-id",countryStatePlaceholderSelector:'[data-placeholder-option="true"]',vatIdFieldInput:"#vatIds",zipcodeFieldInput:'[data-input-name="zipcodeInput"]',vatIdRequired:"vat-id-required",stateRequired:"state-required",zipcodeRequired:"zipcode-required",zipcodeLabel:"#zipcodeLabel",scopeElementSelector:null,prefix:null}},3107:(e,t,n)=>{n.d(t,{Z:()=>i});class i{get(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",i=this._createPreparedRequest("GET",e,n);return this._sendRequest(i,null,t)}post(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let r=this._createPreparedRequest("POST",e,i);return this._sendRequest(r,t,n)}delete(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let r=this._createPreparedRequest("DELETE",e,i);return this._sendRequest(r,t,n)}
1patch(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let r=this._createPreparedRequest("PATCH",e,i);return this._sendRequest(r,t,n)}abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(e){this._errorHandlingInternal=e}_registerOnLoaded(e,t){t&&(!0===this._errorHandlingInternal?(e.addEventListener("load",()=>{t(e.responseText,e)}),e.addEventListener("abort",()=>{console.warn("the request to ".concat(e.responseURL," was aborted"))}),e.addEventListener("error",()=>{console.warn("the request to ".concat(e.responseURL," failed with status ").concat(e.status))}),e.addEventListener("timeout",()=>{console.warn("the request to ".concat(e.responseURL," timed out"))})):e.addEventListener("loadend",()=>{t(e.responseText,e)}))}_sendRequest(e,t,n){return this._registerOnLoaded(e,n),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,n){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),n&&this._request.setRequestHeader("Content-type",n),this._request}constructor(){this._request=null,this._errorHandlingInternal=!1}}}}]);

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.