/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import{K as e}from"./p-Ccfet-fb.js";import"./p-BIyO17h7.js";import"./p-CsyYiC5f.js";import"./p-gD7P82jx.js";const t="ionKeyboardDidShow",o="ionKeyboardDidHide";let i={},s={},d=!1;const p=()=>{i={},s={},d=!1},r=t=>{if(e.getEngine())a(t);else{if(!t.visualViewport)return;s=g(t.visualViewport),t.visualViewport.onresize=()=>{j(t),h()||b(t)?f(t):c(t)&&n(t)}}},a=e=>{e.addEventListener("keyboardDidShow",(t=>f(e,t))),e.addEventListener("keyboardDidHide",(()=>n(e)))},f=(e,t)=>{m(e,t),d=!0},n=e=>{y(e),d=!1},h=()=>!d&&i.width===s.width&&(i.height-s.height)*s.scale>150,b=e=>d&&!c(e),c=e=>d&&s.height===e.innerHeight,m=(e,o)=>{const i=new CustomEvent(t,{detail:{keyboardHeight:o?o.keyboardHeight:e.innerHeight-s.height}});e.dispatchEvent(i)},y=e=>{const t=new CustomEvent(o);e.dispatchEvent(t)},j=e=>{i=Object.assign({},s),s=g(e.visualViewport)},g=e=>({width:Math.round(e.width),height:Math.round(e.height),offsetTop:e.offsetTop,offsetLeft:e.offsetLeft,pageTop:e.pageTop,pageLeft:e.pageLeft,scale:e.scale});export{o as KEYBOARD_DID_CLOSE,t as KEYBOARD_DID_OPEN,g as copyVisualViewport,c as keyboardDidClose,h as keyboardDidOpen,b as keyboardDidResize,p as resetKeyboardAssist,n as setKeyboardClose,f as setKeyboardOpen,r as startKeyboardAssist,j as trackViewportChanges}