1import { 2 IntlTel_initPhoneInput, 3 init_cf_utils 4} from "./chunk-KIZY5IRN.js"; 5import { 6 CF2Component, 7 init_runtime, 8 registerComponent 9} from "./chunk-NQUHJ6NR.js"; 10import { 11 __esm, 12 init_define_process 13} from "./chunk-RFSPGZ3L.js"; 14 15// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/input-v1.ts 16var InputV1; 17var init_input_v1 = __esm({ 18 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/input-v1.ts"() { 19 init_define_process(); 20 init_cf_utils(); 21 init_runtime(); 22 InputV1 = class extends CF2Component { 23 constructor(el, runtimeSel) { 24 super(el, runtimeSel); 25 } 26 mount() { 27 this.input = this.element.querySelector(".elInput"); 28 this.re = /^(([^<>()[\]\.,;:#%\s@"]+(\.[^<>()[\]\.,;:#%\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 29 if (this.input.getAttribute("name") === "shipping_zip") { 30 this.input.setAttribute("maxlength", "10"); 31 } 32 this.addInputListeners(); 33 if (this.isStandalonePhoneNumberInput()) { 34 this.setupPhoneNumberInput(); 35 } 36 } 37 update() { 38 if (this.input.value) { 39 this.element.classList.add("hasValue"); 40 } else { 41 this.element.classList.remove("hasValue"); 42 } 43 } 44 isStandalonePhoneNumberInput() { 45 return this.input.getAttribute("name") === "phone_number" && !$(this.input).closest('[data-page-element="Checkout/V1"]').length && !$(this.input).closest('[data-page-element="Checkout/V2"]').length && !$(this.input).closest('[data-page-element="Survey/V1').length; 46 } 47 addInputListeners() { 48 this.input.addEventListener("focus", () => { 49 this.element.querySelector("[data-input-status-type]").innerHTML = ""; 50 this.element.classList.remove("elInputValid"); 51 this.element.classList.remove("elInputError"); 52 this.element.classList.remove("elInputWarning"); 53 this.element.classList.add("elInputFocused"); 54 }); 55 if (this.isStandalonePhoneNumberInput() && this.input.iti) { 56 this.input.addEventListener("countrychange", () => { 57 const newCountry = this.input.iti.getSelectedCountryData().iso2; 58 document.querySelectorAll('[name="phone_number"]').forEach((s) => { 59 if (s.iti) { 60 s.iti.setCountry(newCountry); 61 } 62 }); 63 }); 64 } 65 this.input.addEventListener("blur", () => { 66 this.element.classList.remove("elInputFocused"); 67 this.update(); 68 if (this.input.getAttribute("name") === "phone_number" && this.input.iti) { 69 document.querySelectorAll('[name="phone_number"]').forEach((s) => { 70 if (s.iti) { 71 s.iti.setCountry(this.input.iti.getSelectedCountryData().iso2); 72 s.iti.setNumber(this.input.value); 73 } 74 }); 75 } 76 if (this.input.classList.contains("required1") && this.element.matches(".elInputError")) { 77 if (this.input.value === "") { 78 return; 79 } else { 80 if (this.input.getAttribute("name") === "email") { 81 const parsedEmail = $.trim(input.value); 82 if (this.re.test(parsedEmail)) { 83 this.element.classList.add("elInputValid"); 84 this.element.classList.remove("elInputError"); 85 } 86 } else if (this.isStandalonePhoneNumberInput() && !window.intlTelInput.utils.isValidNumber(this.input.value)) { 87 this.element.classList.remove("elInputValid"); 88 this.element.classList.add("elInputError"); 89 } else { 90 this.element.classList.remove("elInputError"); 91 this.element.classList.add("elInputValid"); 92 } 93 } 94 } 95 }); 96 } 97 setupPhoneNumberInput() { 98 IntlTel_initPhoneInput(this.input, { 99 initialCountry: window.cfVisitorData?.country ?? "us" 100 }); 101 } 102 }; 103 registerComponent("Input/V1", InputV1);
104 window["InputV1"] = InputV1; 105 } 106}); 107 108export { 109 init_input_v1 110}; 111//# sourceMappingURL=chunk-7HBS56XK.js.map
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.