import"./hoisted.yFz1BYXO.js";const ne=389900,ie=8500,re=7500,oe=5e4,se=350,ae=390,de=380,ce=10*1024*1024;let E=null,O=null,L="pending",M=null,U=null,P=null,$=!1,D=null,V=null,W=[],k="";function X(i){return"$"+(i/100).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}function e(i){return document.getElementById(i)}function s(i){return document.getElementById(i)}function S(i){return document.getElementById(i)}function j(i){return document.getElementById(i)}function z(){if(e("own_ca_address")?.checked)return 0;const i=W.find(t=>t.slug===k);return i?i.yearly_price_usd:0}function Z(){const i=e("own_ca_address")?.checked;e("own-address-fields")?.classList.toggle("hidden",!i),e("amb-location-section")?.classList.toggle("hidden",i),T()}let x=1;const K=5,le=new URLSearchParams(window.location.search).get("test_mode")==="1";function Y(i){for(let l=1;l<=K;l++){const _=e(`step-${l}`);_&&_.classList.toggle("hidden",l!==i)}e("step-success")?.classList.add("hidden"),document.querySelectorAll("#progress li").forEach(l=>{const _=parseInt(l.dataset.step||"0"),g=l.querySelector(".step-dot"),A=l.querySelector("p"),a=l.querySelector(".step-line");_
"))}const n=e("review-legal-ending");n&&(n.textContent=S("legal_ending").value);const m=b()==="numbered_tradename",l=e("review-trade-name-row");if(l&&l.classList.toggle("hidden",!m),m){const v=e("review-trade-name");v&&(v.textContent=s("trade_name").value.trim())}const _=e("review-director-name");_&&(_.textContent=s("director_name").value.trim());const g=e("review-director-address");g&&(g.textContent=[s("director_street").value.trim(),s("director_city").value.trim()+", "+s("director_province").value.trim()+" "+s("director_postal").value.trim(),s("director_country").value.trim()].join(", "));const A=S("director_citizenship").value,a=e("review-citizenship-row");a&&a.classList.toggle("hidden",!A);const h=e("review-director-citizenship");h&&(h.textContent=A||"Not specified");const f=e("review-services");f&&(f.textContent=j("service_description").value.trim());const y=e("review-coverage");y&&(y.textContent=s("geographic_coverage").value.trim()||"Canada-wide");const o=e("review-bits");o&&(o.textContent=s("include_bits").checked?"Yes":"No");const d=e("review-id-status");d&&(D&&V?d.innerHTML='ID uploaded (direct)':$?d.innerHTML='ID uploaded (phone)':U?d.innerHTML='Phone upload link generated — waiting for upload':d.innerHTML='Not uploaded — you can submit and upload later via email');const c=b(),u=G(),p=e("summary-gov-fee");p&&(p.textContent=`~C$${u}`),e("summary-named-addon-row")?.classList.toggle("hidden",c!=="named"),e("summary-tradename-addon-row")?.classList.toggle("hidden",c!=="numbered_tradename"),e("summary-trade-name-row")?.classList.toggle("hidden",c!=="numbered_tradename"),e("summary-expedited-row")?.classList.toggle("hidden",!q()),T()}function T(){const i=typeof z=="function"?z():0;let t=B()+i;E&&(t-=E.cents),t<0&&(t=0);const r=e("summary-total");r&&(r.textContent=X(t));const n=e("summary-mailbox-row"),m=e("summary-mailbox-fee");n&&n.classList.toggle("hidden",i===0),m&&(m.textContent=X(i))}function fe(i){if(i.size>ce)return"File is too large. Maximum size is 10 MB.";const t=i.name.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","pdf"].includes(t)?null:"Unsupported file type. Please use JPG, PNG, or PDF."}function Q(i,t){const r=i.files?.[0];if(!r)return;const n=fe(r);if(n){alert(n),i.value="";return}t==="front"?D=r:V=r;const m=e(`drop-${t}-placeholder`),l=e(`drop-${t}-preview`),_=e(`drop-${t}-name`),g=e(`drop-${t}`);m&&m.classList.add("hidden"),l&&l.classList.remove("hidden"),_&&(_.textContent=r.name),g&&(g.classList.add("border-green-400"),g.classList.remove("border-gray-300"))}function ve(i){i==="front"?(D=null,e("id-front").value=""):(V=null,e("id-back").value="");const t=e(`drop-${i}-placeholder`),r=e(`drop-${i}-preview`),n=e(`drop-${i}`);t&&t.classList.remove("hidden"),r&&r.classList.add("hidden"),n&&(n.classList.remove("border-green-400"),n.classList.add("border-gray-300"))}async function he(){const i=e("btn-phone-upload");i.disabled=!0,i.textContent="Generating...";try{const t=await fetch((window.__PW_API||"https://api.performancewest.net")+"/api/v1/id-upload/create-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:"canada-crtc"})}),r=await t.json();if(t.ok&&r.token){U=r.token;const n=window.location.origin+"/upload/id?token="+encodeURIComponent(r.token),m=e("phone-upload-url");m&&(m.value=n),e("phone-upload-area")?.classList.remove("hidden"),i.textContent="Link generated",ge(r.token)}else throw new Error(r.error||"Failed to generate upload link.")}catch(t){alert(t.message||"Could not generate upload link. Please try the direct upload instead."),i.disabled=!1,i.innerHTML=' Generate phone upload link'}}function ge(i){P&&clearInterval(P),P=window.setInterval(async()=>{try{if((await(await fetch((window.__PW_API||"https://api.performancewest.net")+"/api/v1/id-upload/"+encodeURIComponent(i)+"/status")).json()).uploaded){$=!0,P&&(clearInterval(P),P=null);const n=e("phone-upload-status");n&&(n.innerHTML=`
ID uploaded successfully!
`)}}catch{}},3e3)}function R(){["identity-start","identity-loading","identity-waiting","identity-verified","identity-review","identity-failed"].forEach(t=>e(`${t}`)?.classList.add("hidden")),!O||L==="pending"?e("identity-start")?.classList.remove("hidden"):L==="verified"?e("identity-verified")?.classList.remove("hidden"):L==="needs_review"?e("identity-review")?.classList.remove("hidden"):L==="failed"&&e("identity-failed")?.classList.remove("hidden")}async function ye(){const i=s("director_name").value.trim(),t=s("director_dob")?.value||null,r=s("customer_email").value.trim();if(!i){alert("Please enter the director's full legal name in Step 2 before verifying identity.");return}e("identity-start")?.classList.add("hidden"),e("identity-loading")?.classList.remove("hidden");try{const n=window.__PW_API||"https://api.performancewest.net",m=await fetch(n+"/api/v1/identity/create-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({director_name:i,director_dob:t,customer_email:r,order_type:"canada_crtc"})}),l=await m.json();if(!m.ok||!l.url)throw new Error(l.error||"Could not start verification");O=l.session_id;const _={},g=["director_first_name","director_middle_name","director_last_name","director_name","director_dob","director_country","director_street","director_street2","director_city","director_province","director_postal","director_citizenship","company_type","company_name","entity_suffix","reg_contact_name","reg_contact_email","reg_contact_phone","customer_name","customer_email","customer_phone","customer_company","existing_ca_did","did_routing_type","did_forward_number","service_description","geographic_coverage","own_ca_company","own_ca_attn","own_ca_street","own_ca_city","own_ca_province","own_ca_postal"];for(const A of g){const a=document.getElementById(A);a&&a.value&&(_[A]=a.value)}k&&(_._amb_location_slug=k),e("own_ca_address")?.checked&&(_._own_ca_address="1"),sessionStorage.setItem("pw_form_snapshot",JSON.stringify(_)),sessionStorage.setItem("pw_identity_session",l.session_id),sessionStorage.setItem("pw_order_return_url",window.location.pathname+window.location.search),window.location.href=l.url}catch(n){e("identity-loading")?.classList.add("hidden"),e("identity-start")?.classList.remove("hidden"),alert("Could not start identity verification: "+(n.message||"Unknown error"))}}async function H(i){try{const r=await(await fetch((window.__PW_API||"https://api.performancewest.net")+`/api/v1/identity/session/${encodeURIComponent(i)}`)).json();if(r.overall_result==="verified"||r.overall_result==="needs_review"||r.overall_result==="failed"){if(M&&(clearInterval(M),M=null),L=r.overall_result,r.overall_result==="verified"||r.overall_result==="needs_review"){const n=e("btn-next");n&&(n.disabled=!1,n.title=""),e("identity-pending-notice")?.classList.add("hidden"),sessionStorage.removeItem("pw_identity_session"),sessionStorage.removeItem("pw_order_return_url")}else r.overall_result==="failed"&&(e("identity-pending-notice")?.classList.add("hidden"),sessionStorage.removeItem("pw_identity_session"),sessionStorage.removeItem("pw_order_return_url"));if(r.overall_result==="verified"){const n=e("identity-verified-detail");if(n){const m=r.name_match_score?` (${r.name_match_score}% name match)`:"",l=r.dob_match==="exact"?", date of birth confirmed":"";n.textContent=`${r.doc_type?.replace("_"," ")||"ID"} from ${r.issuing_country||"unknown country"} verified${m}${l}.`}R(),setTimeout(()=>{te(),Y(x+1)},1500)}if(r.overall_result==="failed"){const n=e("identity-failed-detail");n&&r.name_match_score!==void 0&&(n.textContent=`Name match score: ${r.name_match_score}%. The name on your ID doesn't closely enough match "${s("director_name").value.trim()}". Please check your name in Step 2 or try a different ID document.`)}R()}}catch{}}(function(){const t=new URLSearchParams(window.location.search);if(!(t.get("identity_return")==="1"))return;const n=sessionStorage.getItem("pw_identity_session");if(!n)return;O=n;try{const f=JSON.parse(sessionStorage.getItem("pw_form_snapshot")||"{}");console.log("[restore] Snapshot keys:",Object.keys(f).join(", "));let y=0;for(const[p,v]of Object.entries(f)){const N=document.getElementById(p);N&&v?(N.value=v,N.dispatchEvent(new Event("change",{bubbles:!0})),N.dispatchEvent(new Event("input",{bubbles:!0})),y++):N||console.warn("[restore] Element not found:",p)}const o=document.getElementById("director_first_name")?.value||"",d=document.getElementById("director_middle_name")?.value||"",c=document.getElementById("director_last_name")?.value||"",u=document.getElementById("director_name");if(u&&(o||c)&&(u.value=[o,d,c].filter(Boolean).join(" ")),f._amb_location_slug){k=f._amb_location_slug;const p=document.querySelector(`input[name="amb_location"][value="${f._amb_location_slug}"]`);p&&(p.checked=!0)}if(f._own_ca_address==="1"){const p=e("own_ca_address");p&&(p.checked=!0,p.dispatchEvent(new Event("change",{bubbles:!0})))}console.log("[restore] Restored",y,"fields. service_description value:",document.getElementById("service_description")?.value?.slice(0,30))}catch(f){console.error("[restore] Error:",f)}["identity-start","identity-loading","identity-failed","identity-verified","identity-review"].forEach(f=>e(`${f}`)?.classList.add("hidden")),e("identity-waiting")?.classList.remove("hidden"),Y(4);const l=e("btn-next");l&&(l.disabled=!0,l.title="Waiting for identity verification result..."),e("identity-pending-notice")?.classList.remove("hidden");const _=window.location.pathname+(t.get("test_mode")?"?test_mode=1":"");window.history.replaceState({},"",_);function g(){sessionStorage.removeItem("pw_identity_session"),sessionStorage.removeItem("pw_order_return_url"),l&&(L==="verified"||L==="needs_review")?(l.disabled=!1,l.title="",e("identity-pending-notice")?.classList.add("hidden")):L==="failed"&&e("identity-pending-notice")?.classList.add("hidden")}let A=0;const a=15,h=window.setInterval(async()=>{await H(n),A++,(L!=="pending"||A>=a)&&(clearInterval(h),L==="pending"?M=window.setInterval(()=>H(n),5e3):g())},2e3);H(n).then(()=>{L!=="pending"&&(clearInterval(h),g())})})();e("btn-start-identity")?.addEventListener("click",ye);e("btn-retry-identity")?.addEventListener("click",()=>{O=null,L="pending",sessionStorage.removeItem("pw_identity_session"),R(),Y(1)});async function Ae(){const i=e("btn-next"),t=e("submit-status");i.disabled=!0,i.innerHTML="Submitting...",t&&(t.classList.remove("hidden"),t.className="mt-5 rounded-lg p-4 text-sm bg-gray-50 text-gray-600 border border-gray-200",t.textContent="Placing your order...");const r=b()==="named",n=E?E.cents:0;G();let m=B()-n;m<0&&(m=0);const l={incorporation_province:document.querySelector('input[name="incorporation_province"]:checked')?.value||"BC",company_type:b(),legal_ending:S("legal_ending").value,company_name_choice1:r?s("name_choice_1").value.trim():null,company_name_choice2:r&&s("name_choice_2").value.trim()||null,company_name_choice3:r&&s("name_choice_3").value.trim()||null,add_trade_name:b()==="numbered_tradename",trade_name:b()==="numbered_tradename"?s("trade_name").value.trim():null,director_first_name:s("director_first_name").value.trim(),director_middle_name:s("director_middle_name").value.trim()||null,director_last_name:s("director_last_name").value.trim(),director_name:s("director_name").value.trim(),director_street:s("director_street").value.trim(),director_street2:s("director_street2").value.trim()||null,director_city:s("director_city").value.trim(),director_province:s("director_province").value.trim(),director_postal:s("director_postal").value.trim(),director_country:s("director_country").value.trim(),director_citizenship:S("director_citizenship").value||null,director_mailing_different:e("director_mailing_different")?.checked||!1,director_mailing_street:e("director_mailing_different")?.checked&&s("director_mailing_street").value.trim()||null,director_mailing_street2:e("director_mailing_different")?.checked&&e("director_mailing_street2")?.value.trim()||null,director_mailing_city:e("director_mailing_different")?.checked&&s("director_mailing_city").value.trim()||null,director_mailing_province:e("director_mailing_different")?.checked&&s("director_mailing_province").value.trim()||null,director_mailing_postal:e("director_mailing_different")?.checked&&s("director_mailing_postal").value.trim()||null,director_mailing_country:e("director_mailing_different")?.checked&&e("director_mailing_country")?.value||null,additional_directors:(()=>{const _=[];return document.querySelectorAll("[id^='additional-director-']").forEach(g=>{const A=g.id.split("-").pop(),a=y=>g.querySelector(`[name='addl_director_${A}_${y}']`)?.value?.trim()||"",h=a("first_name"),f=a("last_name");h&&f&&_.push({first_name:h,middle_name:a("middle_name")||null,last_name:f,street:a("street"),city:a("city"),province:a("province"),postal:a("postal"),country:a("country")||"US"})}),_.length>0?_:null})(),expedited:q(),amb_location_slug:e("own_ca_address")?.checked?null:k||null,has_own_ca_address:s("own_ca_address")?.checked||!1,own_ca_company:s("own_ca_company")?.value.trim()||null,own_ca_attn:s("own_ca_attn")?.value.trim()||null,own_ca_street:s("own_ca_street")?.value.trim()||null,own_ca_city:s("own_ca_city")?.value.trim()||null,own_ca_province:s("own_ca_province")?.value.trim()||null,own_ca_postal:s("own_ca_postal")?.value.trim()||null,existing_ca_did:s("existing_ca_did")?.value.trim()||null,did_routing_type:document.querySelector('input[name="did_routing_type"]:checked')?.value||"later",did_forward_number:s("did_forward_number")?.value.trim()||null,did_sip_uri:s("did_sip_uri")?.value.trim()||null,did_sip_ip:s("did_sip_ip")?.value.trim()||null,services_description:j("service_description").value.trim()||JSON.parse(sessionStorage.getItem("pw_form_snapshot")||"{}").service_description||"",geographic_coverage:s("geographic_coverage").value.trim()||JSON.parse(sessionStorage.getItem("pw_form_snapshot")||"{}").geographic_coverage||`${document.querySelector('input[name="incorporation_province"]:checked')?.value||"BC"} and Worldwide`,include_bits:s("include_bits").checked,domain_privacy:s("domain_privacy").checked,regulatory_contact_name:s("reg_contact_name").value.trim()||null,regulatory_contact_email:s("reg_contact_email").value.trim()||null,regulatory_contact_phone:s("reg_contact_phone").value.trim()||null,identity_session_id:O,id_upload_token:U,id_uploaded_direct:!!(D&&V),id_uploaded_phone:$,customer_name:s("customer_name").value.trim(),customer_email:s("customer_email").value.trim(),customer_phone:s("customer_phone").value.trim()||null,customer_company:s("customer_company").value.trim()||null,disclaimer_agreed:s("disclaimer")?.checked||!1,service_fee_cents:B(),discount_code:E?E.code:null,discount_cents:n,total_cents:m};try{if(D&&V&&!$){const d=new FormData;d.append("front",D),d.append("back",V),d.append("service","canada-crtc");const c=await fetch((window.__PW_API||"https://api.performancewest.net")+"/api/v1/id-upload/direct",{method:"POST",body:d}),u=await c.json();c.ok&&u.token&&(l.id_upload_token=u.token,l.id_uploaded_direct=!0)}const _=window.__PW_API||"https://api.performancewest.net";t&&(t.className="mt-5 rounded-lg p-4 text-sm bg-blue-50 text-blue-800 border border-blue-200",t.textContent="Creating your order...",t.classList.remove("hidden"));const g=["customer_name","customer_email","services_description","director_name"].filter(d=>!l[d]);g.length&&console.warn("[submit] Empty required fields:",g.join(", "),"| service_description textarea value:",JSON.stringify(document.getElementById("service_description")?.value));const A=await fetch(_+"/api/v1/canada-crtc/orders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}),a=await A.json();if(!A.ok||!a.success)throw new Error(a.error||"Order creation failed");const h=a.order_number;t&&(t.textContent="Redirecting to payment...");const f=await fetch(_+"/api/v1/checkout/create-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({order_type:"canada_crtc",order_id:h,payment_method:document.querySelector('input[name="payment_method_choice"]:checked')?.value||"card"})}),y=await f.json(),o=y.url||y.checkout_url||y.redirect_url;f.ok&&o?(sessionStorage.setItem("pw_order_number",h),sessionStorage.removeItem("pw_form_snapshot"),sessionStorage.removeItem("pw_identity_session"),window.location.href=o):ue(h)}catch(_){t&&(t.className="mt-5 rounded-lg p-4 text-sm bg-red-50 text-red-800 border border-red-200",t.classList.remove("hidden"),t.textContent=_.message||"Something went wrong. Please try again or contact us."),i.disabled=!1,i.innerHTML='Submit Order '}}async function F(i){if(!i||i.trim().length<2)return;i=i.toUpperCase().trim();const t=e("discount-status"),r=s("discount_code"),n=e("btn-apply-discount");n&&(n.disabled=!0,n.textContent="Checking..."),t&&(t.classList.remove("hidden"),t.className="mt-2 text-xs text-gray-500",t.textContent="Validating code...");try{const m=await fetch(`${window.__PW_API||"https://api.performancewest.net"}/api/v1/discount/${encodeURIComponent(i)}?service=canada-crtc&amount=${B()}`),l=await m.json();if(m.ok&&l.valid){E={code:l.code,type:l.discount_type,value:l.discount_value,cents:l.discount_cents,description:l.description},r&&(r.value=l.code,r.disabled=!0,r.classList.add("bg-green-50","border-green-300")),n&&(n.textContent="Applied",n.classList.add("bg-green-100","text-green-700","border-green-300")),t&&(t.className="mt-2 text-xs text-green-700",t.textContent=`${l.description} applied.${l.referral_partner?` Referred by: ${l.referral_partner}`:""}`),e("summary-discount-row")?.classList.remove("hidden");const _=e("summary-discount-code");_&&(_.textContent=l.code);const g=e("summary-discount-amount");g&&(g.textContent=`-${X(l.discount_cents)}`),T()}else E=null,t&&(t.className="mt-2 text-xs text-red-600",t.textContent=l.error||"Invalid discount code."),n&&(n.disabled=!1,n.textContent="Apply"),e("summary-discount-row")?.classList.add("hidden"),T()}catch{t&&(t.className="mt-2 text-xs text-gray-500",t.textContent="Could not verify code. You can proceed without it."),n&&(n.disabled=!1,n.textContent="Apply")}}document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('input[name="company_type"]').forEach(o=>{o.addEventListener("change",me)});const i=[["AL","Alabama"],["AK","Alaska"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["ME","Maine"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VT","Vermont"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"],["DC","District of Columbia"]],t=[["AB","Alberta"],["BC","British Columbia"],["MB","Manitoba"],["NB","New Brunswick"],["NL","Newfoundland and Labrador"],["NS","Nova Scotia"],["NT","Northwest Territories"],["NU","Nunavut"],["ON","Ontario"],["PE","Prince Edward Island"],["QC","Quebec"],["SK","Saskatchewan"],["YT","Yukon"]],r=[["ACT","Australian Capital Territory"],["NSW","New South Wales"],["NT","Northern Territory"],["QLD","Queensland"],["SA","South Australia"],["TAS","Tasmania"],["VIC","Victoria"],["WA","Western Australia"]],n=[["ENG","England"],["SCT","Scotland"],["WLS","Wales"],["NIR","Northern Ireland"]];function m(){const o=S("director_country").value,d=e("director_province_select"),c=e("director_province_text"),u=e("director_province");let p=null,v="State / Region / Province";o==="US"?(p=i,v="State"):o==="CA"?(p=t,v="Province"):o==="AU"?(p=r,v="State / Territory"):o==="GB"&&(p=n,v="Country / Region"),p?(d.innerHTML=``+p.map(([N,I])=>``).join(""),d.classList.remove("hidden"),c.classList.add("hidden"),c.value="",d.onchange=()=>{u.value=d.value},u.value=d.value):(d.classList.add("hidden"),d.innerHTML="",c.placeholder=v,c.classList.remove("hidden"),c.oninput=()=>{u.value=c.value},u.value=c.value)}e("director_country")?.addEventListener("change",()=>{e("director_street").value="",e("director_street2").value="",e("director_city").value="",e("director_postal").value="",e("director_province").value="";const o=e("director_province_select");o&&(o.value="");const d=e("director_province_text");d&&(d.value=""),m();const c=e("director_address_fields"),u=S("director_country").value;c?.classList.toggle("hidden",!u)});const l={"005":"NY","006":"PR","007":"PR","008":"VI","009":"PR","010":"MA","011":"MA","012":"MA","013":"MA","014":"MA","015":"MA","016":"MA","017":"MA","018":"MA","019":"MA","020":"MA","021":"MA","022":"MA","023":"MA","024":"MA","025":"MA","026":"MA","027":"MA","028":"RI","029":"RI","030":"NH","031":"NH","032":"NH","033":"NH","034":"NH","035":"NH","036":"NH","037":"NH","038":"NH","039":"ME","040":"ME","041":"ME","042":"ME","043":"ME","044":"ME","045":"ME","046":"ME","047":"ME","048":"ME","049":"ME","050":"VT","051":"VT","052":"VT","053":"VT","054":"VT","055":"MA","056":"VT","057":"VT","058":"VT","059":"VT","060":"CT","061":"CT","062":"CT","063":"CT","064":"CT","065":"CT","066":"CT","067":"CT","068":"CT","069":"CT","070":"NJ","071":"NJ","072":"NJ","073":"NJ","074":"NJ","075":"NJ","076":"NJ","077":"NJ","078":"NJ","079":"NJ","080":"NJ","081":"NJ","082":"NJ","083":"NJ","084":"NJ","085":"NJ","086":"NJ","087":"NJ","088":"NJ","089":"NJ",100:"NY",101:"NY",102:"NY",103:"NY",104:"NY",105:"NY",106:"NY",107:"NY",108:"NY",109:"NY",110:"NY",111:"NY",112:"NY",113:"NY",114:"NY",115:"NY",116:"NY",117:"NY",118:"NY",119:"NY",120:"NY",121:"NY",122:"NY",123:"NY",124:"NY",125:"NY",126:"NY",127:"NY",128:"NY",129:"NY",130:"NY",131:"NY",132:"NY",133:"NY",134:"NY",135:"NY",136:"NY",137:"NY",138:"NY",139:"NY",140:"NY",141:"NY",142:"NY",143:"NY",144:"NY",145:"NY",146:"NY",147:"NY",148:"NY",149:"NY",150:"PA",151:"PA",152:"PA",153:"PA",154:"PA",155:"PA",156:"PA",157:"PA",158:"PA",159:"PA",160:"PA",161:"PA",162:"PA",163:"PA",164:"PA",165:"PA",166:"PA",167:"PA",168:"PA",169:"PA",170:"PA",171:"PA",172:"PA",173:"PA",174:"PA",175:"PA",176:"PA",177:"PA",178:"PA",179:"PA",180:"PA",181:"PA",182:"PA",183:"PA",184:"PA",185:"PA",186:"PA",187:"PA",188:"PA",189:"PA",190:"PA",191:"PA",192:"PA",193:"PA",194:"PA",195:"PA",196:"PA",197:"DE",198:"DE",199:"DE",200:"DC",201:"VA",202:"DC",203:"DC",204:"DC",205:"DC",206:"MD",207:"MD",208:"MD",209:"MD",210:"MD",211:"MD",212:"MD",214:"MD",215:"MD",216:"MD",217:"WV",218:"WV",219:"WV",220:"VA",221:"VA",222:"VA",223:"VA",224:"VA",225:"VA",226:"VA",227:"VA",228:"VA",229:"VA",230:"VA",231:"VA",232:"VA",233:"VA",234:"VA",235:"VA",236:"VA",237:"VA",238:"VA",239:"VA",240:"VA",241:"VA",242:"VA",243:"VA",244:"VA",245:"VA",246:"WV",247:"WV",248:"WV",249:"WV",250:"WV",251:"WV",252:"WV",253:"WV",254:"WV",255:"WV",256:"WV",257:"WV",258:"WV",259:"WV",260:"WV",261:"WV",262:"WV",263:"WV",264:"WV",265:"WV",266:"WV",267:"WV",268:"WV",270:"NC",271:"NC",272:"NC",273:"NC",274:"NC",275:"NC",276:"NC",277:"NC",278:"NC",279:"NC",280:"NC",281:"NC",282:"NC",283:"NC",284:"NC",285:"NC",286:"NC",287:"NC",288:"NC",289:"NC",290:"SC",291:"SC",292:"SC",293:"SC",294:"SC",295:"SC",296:"SC",297:"SC",298:"SC",299:"SC",300:"GA",301:"GA",302:"GA",303:"GA",304:"GA",305:"FL",306:"FL",307:"WY",308:"WY",309:"GA",310:"GA",311:"GA",312:"GA",313:"GA",314:"GA",315:"GA",316:"GA",317:"GA",318:"GA",319:"GA",320:"FL",321:"FL",322:"FL",323:"FL",324:"FL",325:"FL",326:"FL",327:"FL",328:"FL",329:"FL",330:"FL",331:"FL",332:"FL",333:"FL",334:"FL",335:"FL",336:"FL",337:"FL",338:"FL",339:"FL",340:"AA",341:"FL",342:"FL",344:"FL",346:"FL",347:"FL",349:"FL",350:"AL",351:"AL",352:"AL",353:"AL",354:"AL",355:"AL",356:"AL",357:"AL",358:"AL",359:"AL",360:"AL",361:"AL",362:"AL",363:"AL",364:"AL",365:"AL",366:"AL",367:"AL",368:"AL",369:"AL",370:"TN",371:"TN",372:"TN",373:"TN",374:"TN",375:"TN",376:"TN",377:"TN",378:"TN",379:"TN",380:"TN",381:"TN",382:"TN",383:"TN",384:"TN",385:"TN",386:"MS",387:"MS",388:"MS",389:"MS",390:"MS",391:"MS",392:"MS",393:"MS",394:"MS",395:"MS",396:"MS",397:"MS",398:"GA",399:"GA",400:"KY",401:"KY",402:"KY",403:"KY",404:"KY",405:"OK",406:"MT",407:"KY",408:"KY",409:"KY",410:"KY",411:"KY",412:"KY",413:"KY",414:"KY",415:"KY",416:"KY",417:"KY",418:"KY",419:"KY",420:"KY",421:"KY",422:"KY",423:"KY",424:"KY",425:"KY",426:"KY",427:"KY",430:"OH",431:"OH",432:"OH",433:"OH",434:"OH",435:"OH",436:"OH",437:"OH",438:"OH",439:"OH",440:"OH",441:"OH",442:"OH",443:"OH",444:"OH",445:"OH",446:"OH",447:"OH",448:"OH",449:"OH",450:"OH",451:"OH",452:"OH",453:"OH",454:"OH",455:"OH",456:"OH",457:"OH",458:"OH",459:"OH",460:"IN",461:"IN",462:"IN",463:"IN",464:"IN",465:"IN",466:"IN",467:"IN",468:"IN",469:"IN",470:"IN",471:"IN",472:"IN",473:"IN",474:"IN",475:"IN",476:"IN",477:"IN",478:"IN",479:"IN",480:"MI",481:"MI",482:"MI",483:"MI",484:"MI",485:"MI",486:"MI",487:"MI",488:"MI",489:"MI",490:"MI",491:"MI",492:"MI",493:"MI",494:"MI",495:"MI",496:"MI",497:"MI",498:"MI",499:"MI",500:"IA",501:"IA",502:"IA",503:"IA",504:"IA",505:"NM",506:"IA",507:"IA",508:"IA",509:"IA",510:"IA",511:"IA",512:"IA",513:"IA",514:"IA",515:"IA",516:"IA",520:"AZ",521:"AZ",522:"IA",523:"IA",524:"IA",525:"IA",526:"IA",527:"IA",528:"IA",530:"WI",531:"WI",532:"WI",534:"WI",535:"WI",537:"WI",538:"WI",539:"WI",540:"WI",541:"WI",542:"WI",543:"WI",544:"WI",545:"WI",546:"WI",547:"WI",548:"WI",549:"WI",550:"MN",551:"MN",553:"MN",554:"MN",555:"MN",556:"MN",557:"MN",558:"MN",559:"MN",560:"MN",561:"MN",562:"MN",563:"MN",564:"MN",565:"MN",566:"MN",567:"MN",570:"SD",571:"SD",572:"SD",573:"SD",574:"SD",575:"SD",576:"SD",577:"SD",580:"ND",581:"ND",582:"ND",583:"ND",584:"ND",585:"ND",586:"ND",587:"ND",588:"ND",590:"MT",591:"MT",592:"MT",593:"MT",594:"MT",595:"MT",596:"MT",597:"MT",598:"MT",599:"MT",600:"IL",601:"IL",602:"IL",603:"IL",604:"IL",605:"IL",606:"IL",607:"IL",608:"IL",609:"IL",610:"IL",611:"IL",612:"IL",613:"IL",614:"IL",615:"IL",616:"IL",617:"IL",618:"IL",619:"IL",620:"IL",621:"IL",622:"IL",623:"IL",624:"IL",625:"IL",626:"IL",627:"IL",628:"IL",629:"IL",630:"MO",631:"MO",633:"MO",634:"MO",635:"MO",636:"MO",637:"MO",638:"MO",639:"MO",640:"MO",641:"MO",644:"MO",645:"MO",646:"MO",647:"MO",648:"MO",649:"MO",650:"MO",651:"MO",652:"MO",653:"MO",654:"MO",655:"MO",656:"MO",657:"MO",658:"MO",659:"MO",660:"KS",661:"KS",662:"KS",664:"KS",665:"KS",666:"KS",667:"KS",668:"KS",669:"KS",670:"KS",671:"KS",672:"KS",673:"KS",674:"KS",675:"KS",676:"KS",677:"KS",678:"KS",679:"KS",680:"NE",681:"NE",683:"NE",684:"NE",685:"NE",686:"NE",687:"NE",688:"NE",689:"NE",690:"NE",691:"NE",692:"NE",693:"NE",700:"LA",701:"LA",703:"LA",704:"LA",705:"LA",706:"LA",707:"LA",708:"LA",710:"LA",711:"LA",712:"LA",713:"LA",714:"LA",716:"AR",717:"AR",718:"AR",719:"CO",720:"CO",721:"AR",722:"AR",723:"AR",724:"AR",725:"AR",726:"AR",727:"AR",728:"AR",729:"AR",730:"OK",731:"OK",733:"TX",734:"OK",735:"OK",736:"OK",737:"TX",738:"OK",739:"OK",740:"OK",741:"OK",743:"OK",744:"OK",745:"OK",746:"OK",747:"OK",748:"OK",749:"OK",750:"TX",751:"TX",752:"TX",753:"TX",754:"TX",755:"TX",756:"TX",757:"TX",758:"TX",759:"TX",760:"TX",761:"TX",762:"TX",763:"TX",764:"TX",765:"TX",766:"TX",767:"TX",768:"TX",769:"TX",770:"TX",771:"TX",772:"TX",773:"TX",774:"TX",775:"TX",776:"TX",777:"TX",778:"TX",779:"TX",780:"TX",781:"TX",782:"TX",783:"TX",784:"TX",785:"TX",786:"TX",787:"TX",788:"TX",789:"TX",790:"TX",791:"TX",792:"TX",793:"TX",794:"TX",795:"TX",796:"TX",797:"TX",798:"TX",799:"TX",800:"CO",801:"CO",802:"CO",803:"CO",804:"CO",805:"CO",806:"CO",807:"CO",808:"CO",809:"CO",810:"CO",811:"CO",812:"CO",813:"CO",814:"CO",815:"CO",816:"CO",820:"WY",821:"WY",822:"WY",823:"WY",824:"WY",825:"WY",826:"WY",827:"WY",828:"WY",829:"WY",830:"WY",831:"WY",832:"ID",833:"ID",834:"ID",835:"ID",836:"ID",837:"ID",838:"ID",840:"UT",841:"UT",842:"UT",843:"UT",844:"UT",845:"UT",846:"UT",847:"UT",850:"AZ",852:"AZ",853:"AZ",855:"AZ",856:"AZ",857:"AZ",859:"AZ",860:"AZ",863:"AZ",864:"AZ",865:"AZ",870:"NM",871:"NM",873:"NM",874:"NM",875:"NM",877:"NM",878:"NM",879:"NM",880:"TX",881:"TX",882:"NM",883:"NM",884:"NM",889:"NV",890:"NV",891:"NV",893:"NV",894:"NV",895:"NV",897:"NV",898:"NV",900:"CA",901:"CA",902:"CA",903:"CA",904:"CA",905:"CA",906:"CA",907:"CA",908:"CA",910:"CA",911:"CA",912:"CA",913:"CA",914:"CA",915:"CA",916:"CA",917:"CA",918:"CA",919:"CA",920:"CA",921:"CA",922:"CA",923:"CA",924:"CA",925:"CA",926:"CA",927:"CA",928:"CA",930:"CA",931:"CA",932:"CA",933:"CA",934:"CA",935:"CA",936:"CA",937:"CA",938:"CA",939:"CA",940:"CA",941:"CA",942:"CA",943:"CA",944:"CA",945:"CA",946:"CA",947:"CA",948:"CA",949:"CA",950:"CA",951:"CA",952:"CA",953:"CA",954:"CA",955:"CA",956:"CA",957:"CA",958:"CA",959:"CA",960:"CA",961:"CA",967:"HI",968:"HI",970:"OR",971:"OR",972:"OR",973:"OR",974:"OR",975:"OR",976:"OR",977:"OR",978:"OR",979:"OR",980:"WA",981:"WA",982:"WA",983:"WA",984:"WA",985:"WA",986:"WA",988:"WA",989:"WA",990:"WA",991:"WA",992:"WA",993:"WA",994:"WA",995:"AK",996:"AK",997:"AK",998:"AK",999:"AK"},_={A:"NL",B:"NS",C:"PE",E:"NB",G:"QC",H:"QC",J:"QC",K:"ON",L:"ON",M:"ON",N:"ON",P:"ON",R:"MB",S:"SK",T:"AB",V:"BC",X:"NT",Y:"YT"};function g(){const o=S("director_country").value,d=s("director_postal").value.trim().toUpperCase();if(!d||!o)return;let c="";if(o==="US"&&/^\d{5}/.test(d)?c=l[d.slice(0,3)]||"":o==="CA"&&/^[A-Z]\d/.test(d)&&(c=_[d[0]]||""),!c)return;const u=e("director_province_select"),p=e("director_province_text"),v=e("director_province");u&&!u.classList.contains("hidden")?Array.from(u.options).map(I=>I.value).includes(c)&&(u.value=c,u.dispatchEvent(new Event("change",{bubbles:!0}))):p&&!p.classList.contains("hidden")&&(p.value=c,p.dispatchEvent(new Event("input",{bubbles:!0}))),v&&(v.value=c)}e("director_postal")?.addEventListener("blur",g),e("director_postal")?.addEventListener("change",g);async function A(o){const d=window.__PW_API||"https://api.performancewest.net",c=o||"BC";try{W=(await(await fetch(`${d}/api/v1/amb/locations?province=${c}`)).json()).locations||[];const v=e("amb-location-list");if(!v)return;if(!W.length){v.innerHTML='
No locations available for this province yet.
';return}v.innerHTML="",W.forEach((N,I)=>{const C=document.createElement("label");C.className="flex items-center gap-3 p-3 rounded-lg border border-gray-200 cursor-pointer hover:border-pw-400 has-[:checked]:border-pw-500 has-[:checked]:bg-pw-50 transition-colors",C.innerHTML=`