const o=document.querySelector("#menu-list-item-web_api_password a");o!==null&&o.addEventListener("click",e=>{e.preventDefault(),jQuery.fn.mtModal.open(o.href,{large:!0})});const i=document.querySelector("#delete_api_password");i!==null&&i.addEventListener("submit",e=>{confirm(window.trans("Are you sure you want to delete the existing password?"))||e.preventDefault()});const a=document.querySelector("#api-password-display");if(a!==null){a.style.width=a.value.length+"ch";const e=document.querySelector("[data-mt-copy-to-clipboard]");if(e!==null){const t=new bootstrap.Tooltip(e,{container:e});e.addEventListener("click",r=>{r.preventDefault(),window.isSecureContext?navigator.clipboard.writeText(e.dataset.mtCopyToClipboard||"").then(()=>{n(e,t)}):(a.select(),document.execCommand("copy"),n(e,t))})}}function n(e,t){e.dataset.bsOriginalTitle=e.dataset.copiedTitle,t.update(),t.show(),setTimeout(()=>{e.dataset.bsOriginalTitle=e.getAttribute("aria-label"),t.update(),t.hide()},2e3)}
