const require_rolldown_runtime = require('../rolldown-runtime.cjs'); const require_shared_getActiveElement = require('../shared/getActiveElement.cjs'); const require_Drawer_utils = require('../Drawer/utils.cjs'); const vue = require_rolldown_runtime.__toESM(require("vue")); //#region src/Drawer/composables/useDrawerVirtualKeyboard.ts /** Viewport shrinkage below this is browser chrome moving, not the keyboard. */ const KEYBOARD_RESIZE_THRESHOLD = 60; /** Gap kept between the focused field and the edges of the visible band. */ const KEYBOARD_VISIBILITY_MARGIN = 16; const KEYBOARD_REALIGN_INTERVAL = 150; const KEYBOARD_REALIGN_MAX_PASSES = 4; /** Frames the alignment waits for its scroll destination to stop moving. */ const KEYBOARD_SETTLE_FRAME_LIMIT = 60; /** Travel that turns a tap into a scroll/swipe. */ const INPUT_TAP_MOVE_THRESHOLD = 10; const INPUT_TAP_HIT_SLOP = 16; const KEYBOARD_INPUT_TYPES = new Set([ "email", "number", "password", "search", "tel", "text", "url" ]); const INTERACTIVE_SELECTOR = "button,a[href],select,[role=\"button\"],[tabindex]:not([tabindex=\"-1\"]),input:not([type=\"hidden\"]):not([disabled]),textarea:not([disabled]),[contenteditable]:not([contenteditable=\"false\"])"; /** * The lift point landed on another interactive element. Distinct from `null` so * the caller does not fall back to the touchstart target and steal that tap. */ const KEYBOARD_TAP_BLOCKED = Symbol("KeyboardTapBlocked"); function isKeyboardInputElement(element) { if (element.isContentEditable) return true; const win = element.ownerDocument.defaultView ?? window; if (element instanceof win.HTMLTextAreaElement || element instanceof win.HTMLInputElement && KEYBOARD_INPUT_TYPES.has(element.type)) return !element.matches(":disabled"); return false; } /** Nodes inside a `contenteditable` are not focusable; the editing host is. */ function getContentEditableHost(element) { let host = element; while (host.parentElement?.isContentEditable) host = host.parentElement; return host; } /** * Normalizes a target to the element the keyboard is attached to: the field * itself, its `contenteditable` host, or the control a `