1(function(scope){function engravingState(value,limit,skyline){const text=String(value||""),maximum=limit===null||limit===""?null:Number(limit),symbols=["\u2661","~","\u2740","\u2721"].map(symbol=>text.split(symbol).length-1),count=text.length+(skyline?22:0),exceedsCharacters=Number.isFinite(maximum)&&count>maximum,exceedsSymbols=symbols[0]>2||symbols[1]>3||symbols[2]>1||symbols[3]>3||symbols.reduce((sum,value2)=>sum+value2,0)>3;return{count,maximum,exceedsCharacters,exceedsSymbols,valid:!exceedsCharacters&&!exceedsSymbols}}if(typeof module<"u"&&module.exports&&(module.exports={engravingState}),!scope.document)return;const document=scope.document,controllers=new Map;function initialize(root){if(controllers.has(root))return;let queued=!1;const locked=new Map;function reconcile(){const settings=root.querySelector("#myvars");if(!settings)return!0;const skyline=typeof scope.getSkylineSelected=="function"?scope.getSkylineSelected():"none";let invalid=!1;for(const side of["front","back"]){const field=root.querySelector("."+side+"_tbox textarea");if(!field)continue;const state=engravingState(field.value,settings.getAttribute("max_words_"+side),skyline===side+" only"||skyline==="both sides");
1invalid=invalid||!state.valid,field.setAttribute("aria-invalid",String(!state.valid));const counter=root.querySelector("#current_words_"+side);counter&&counter.textContent!==String(state.count)&&(counter.textContent=String(state.count));const wrapper=field.closest("."+side+"_tbox")?.querySelector(".word_counter_wrapper");if(wrapper){wrapper.classList.toggle("red_alert",!state.valid),wrapper.classList.toggle("symbols_max",state.exceedsSymbols);for(const name of["heart_max","tilde_max","flower_max","sod_max"])wrapper.classList.remove(name)}const remaining=Number.isFinite(state.maximum)?String(state.maximum-state.count):"";settings.getAttribute(side+"2go")!==remaining&&settings.setAttribute(side+"2go",remaining)}for(const button of root.querySelectorAll(".product-form__submit"))if(invalid)locked.has(button)||locked.set(button,button.disabled),button.disabled=!0;else if(locked.has(button)){const prior=locked.get(button);locked.delete(button),button.disabled=prior||root.dataset.hadayaProductAvailable==="false"}return!invalid}function schedule(){queued||(queued=!0,queueMicrotask(()=>{queued=!1,reconcile()}))}function blockInvalid(event){event.type==="click"&&!event.target.closest(".product-form__submit")||event.type==="submit"&&!event.target.matches('form[data-type="add-to-cart-form"]')||reconcile()||(event.preventDefault(),event.stopImmediatePropagation(),root.querySelector('textarea[aria-invalid="true"]')?.focus())}for(const name of["input","change","keyup","click"])root.addEventListener(name,schedule);root.addEventListener("click",blockInvalid,!0),root.addEventListener("submit",blockInvalid,!0);const observer=new MutationObserver(schedule);observer.observe(root,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["max_words_front","max_words_back"]}),controllers.set(root,{reconcile,destroy(){observer.disconnect();for(const name of["input","change","keyup","click"])root.removeEventListener(name,schedule);root.removeEventListener("click",blockInvalid,!0),root.removeEventListener("submit",blockInvalid,!0),controllers.delete(root)}}),reconcile()}scope.hadayaEngravingValidate=function(){let valid=!0;for(const controller of controllers.values())valid=controller.reconcile()&&valid;return valid};function boot(){document.querySelectorAll('[id^="MainProduct-"]').forEach(initialize)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",boot,{once:!0}):boot(),document.addEventListener("shopify:section:load",boot),document.addEventListener("shopify:section:unload",event=>{for(const[root,controller]of controllers)event.target.contains(root)&&controller.destroy()})})(typeof window>"u"?{}:window); 2//# sourceMappingURL=/cdn/shop/t/17/assets/hadaya-engraving-validation.js.map?v=30095197002349053591791390519
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.