import{C as s}from"./country-DzBn4kkS.js";import{T as c}from"./tom-select-wx7WhiJ3.js";import{w as d}from"./tz-picker-NAxcAGUi.js";function y(){l(),r(),u(),m()}function l(){const n=document.getElementById("country");if(!n)return;const t=n.dataset.value||"";if(t){const e=document.createElement("option");e.value=t,e.textContent=t,e.selected=!0,n.appendChild(e)}const o=s.getAllCountries().sort((e,i)=>e.name.localeCompare(i.name)).map(e=>({value:e.isoCode,text:`${e.flag?e.flag+"  ":""}${e.name}`}));new c(n,{options:o,maxOptions:null,placeholder:"Search country…",plugins:["clear_button"],allowEmptyOption:!0})}function r(){d("#timezone")}function u(){const n=document.querySelector("[data-mode-existing]"),t=document.querySelector("[data-mode-invite]"),o=document.querySelector("[data-owner-existing]"),e=document.querySelector("[data-owner-invite]");if(!n||!t||!o||!e)return;const i=()=>{const a=t.checked;o.classList.toggle("hidden",a),e.classList.toggle("hidden",!a)};n.addEventListener("change",i),t.addEventListener("change",i),i()}function m(){const n=document.getElementById("dns-help-btn"),t=document.getElementById("dns-help-modal");if(!n||!t)return;const o=()=>t.classList.add("hidden");n.addEventListener("click",e=>{e.preventDefault(),t.classList.remove("hidden")}),t.querySelectorAll("[data-dns-close]").forEach(e=>e.addEventListener("click",o)),t.addEventListener("click",e=>{e.target===t&&o()}),document.addEventListener("keydown",e=>{e.key==="Escape"&&o()})}export{y as default};
