1const STATE_NAME_TO_CODE={ALABAMA:"AL",ALASKA:"AK",ARIZONA:"AZ",ARKANSAS:"AR",CALIFORNIA:"CA",COLORADO:"CO",CONNECTICUT:"CT",DELAWARE:"DE",FLORIDA:"FL",GEORGIA:"GA",HAWAII:"HI",IDAHO:"ID",ILLINOIS:"IL",INDIANA:"IN",IOWA:"IA",KANSAS:"KS",KENTUCKY:"KY",LOUISIANA:"LA",MAINE:"ME",MARYLAND:"MD",MASSACHUSETTS:"MA",MICHIGAN:"MI",MINNESOTA:"MN",MISSISSIPPI:"MS",MISSOURI:"MO",MONTANA:"MT",NEBRASKA:"NE",NEVADA:"NV","NEW HAMPSHIRE":"NH","NEW JERSEY":"NJ","NEW MEXICO":"NM","NEW YORK":"NY","NORTH CAROLINA":"NC","NORTH DAKOTA":"ND",OHIO:"OH",OKLAHOMA:"OK",OREGON:"OR",PENNSYLVANIA:"PA","RHODE ISLAND":"RI","SOUTH CAROLINA":"SC","SOUTH DAKOTA":"SD",TENNESSEE:"TN",TEXAS:"TX",UTAH:"UT",VERMONT:"VT",VIRGINIA:"VA",WASHINGTON:"WA","WEST VIRGINIA":"WV",WISCONSIN:"WI",WYOMING:"WY","DISTRICT OF COLUMBIA":"DC"};function normalizeStateInput(input){const trimmed=input.trim().toUpperCase();return trimmed?trimmed.length===2&&/^[A-Z]{2}$/.test(trimmed)?trimmed:STATE_NAME_TO_CODE[trimmed]||null:null}function parseRestrictedStates(raw){const codes=new Set;if(!raw)return codes;for(const part of raw.split(",")){const code=normalizeStateInput(part);code&&codes.add(code)}return codes}function getUserLocation(){const country=document.body.dataset.sdUserCountry,state=document.body.dataset.sdUserState;return country?Promise.resolve({country,state:state||null}):new Promise(resolve=>{let settled=!1;function settle(value){settled||(settled=!0,clearTimeout(timeout),resolve(value))}const timeout=setTimeout(()=>settle(null),12e3);document.body.addEventListener("sd:user-location-resolved",e=>{const c=e.detail?.country;settle(c?{country:c,state:e.detail?.state||null}:null)},{once:!0});const recheckCountry=document.body.dataset.sdUserCountry;recheckCountry&&settle({country:recheckCountry,state:document.body.dataset.sdUserState||null})})}function applyRestriction(block,userState){const rawStates=block.dataset.sdRestrictedStates||"";if(!parseRestrictedStates(rawStates).has(userState)||block.dataset.sdRestricted==="true")return;const message=block.dataset.sdRestrictionMessage||"Not Available in Your State",formButtons=block.querySelector(".product-form-buttons");formButtons&&(formButtons.hidden=!0);const accelerated=block.querySelector("shopify-accelerated-checkout");accelerated&&(accelerated.hidden=!0);const btn=document.createElement("button");btn.type="button",btn.setAttribute("aria-disabled","true"),btn.className="sd-shipping-restriction-btn",btn.textContent=message;const formComponent=block.querySelector("product-form-component");formComponent?formComponent.after(btn):block.appendChild(btn);const liveRegion=block.querySelector("[aria-live]");liveRegion&&(liveRegion.textContent=message);const localPickup=block.parentElement?.querySelector("local-pickup");localPickup&&(localPickup.hidden=!0),block.dataset.sdRestricted="true"}function processBlocks(userState){const blocks=document.querySelectorAll('[data-sd-shipping-restricted="true"]:not([data-sd-restricted="true"])');for(const block of blocks)applyRestriction(block,userState)}async function init(){const location=await getUserLocation();if(!location||location.country!=="US"||!location.state)return;const userState=location.state;processBlocks(userState),document.addEventListener("sd:quick-add-content-loaded",()=>{processBlocks(userState)});const modalContent=document.getElementById("sd-quick-add-modal-content");if(modalContent){let pending=!1;new MutationObserver(()=>{pending||(pending=!0,requestAnimationFrame(()=>{processBlocks(userState),pending=!1}))}).observe(modalContent,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-sd-shipping-restricted"]})}}init(); 2//# sourceMappingURL=/cdn/shop/t/399/assets/sd-shipping-restriction.js.map?v=130507268105956707081771622212
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.