/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import{E as t}from"./p-BuOEMGyM.js";class e{constructor(...t){this.bindings=t.map((t=>t.toLowerCase()))}matches(t){return this.bindings.length>0&&this.bindings.every((e=>this.bindingMatches(t,e)))}bindingMatches(t,e){const i=e.includes("!");const s=e.replace("!","");return i?!t[s]:t[s]}}class i{constructor(t){this.model=t;this.excludeTagNames=["VERTEX-SCENE-TREE","VERTEX-SCENE-TREE-SEARCH","VERTEX-VIEWER-PIN-TOOL","INPUT","TEXTAREA"];this.excludePredicates=[];this.updateModelExclusions()}updateModel(t){this.model=t}setEnabled(t){this.model.setEnabled(t)}setTeleportMode(t){this.model.setTeleportMode(t)}updateConfiguration(t){const e=this.model.getConfiguration();this.model.setConfiguration({...e,...t})}addKeyBinding(t,...i){this.model.addKeyBinding(t,new e(...i))}replaceKeyBinding(t,...i){this.model.replaceKeyBinding(t,new e(...i))}excludeElement(...t){if(typeof t[0]==="string"){this.excludeTagNames=[...this.excludeTagNames,t[0]];this.updateModelExclusions();return{dispose:()=>{this.excludeTagNames=this.excludeTagNames.filter((e=>e!==t[0]))}}}else{this.excludePredicates=[...this.excludePredicates,t[0]];this.updateModelExclusions();return{dispose:()=>{this.excludePredicates=this.excludePredicates.filter((e=>e!==t[0]))}}}}updateModelExclusions(){this.model.setExcludedPredicate((t=>this.excludeTagNames.some((e=>e===t.tagName))||this.excludePredicates.some((e=>e(t)))))}}var s;(function(t){t["MOVE_DOWN"]="MOVE_DOWN";t["MOVE_UP"]="MOVE_UP";t["PIVOT_DOWN"]="PIVOT_DOWN";t["PIVOT_LEFT"]="PIVOT_LEFT";t["PIVOT_RIGHT"]="PIVOT_RIGHT";t["PIVOT_UP"]="PIVOT_UP";t["WALK_BACKWARD"]="WALK_BACKWARD";t["WALK_FORWARD"]="WALK_FORWARD";t["WALK_LEFT"]="WALK_LEFT";t["WALK_RIGHT"]="WALK_RIGHT"})(s||(s={}));class n{constructor(){this.keyBindings={[s.MOVE_DOWN]:[new e("PageDown","!Shift","!Alt")],[s.MOVE_UP]:[new e("PageUp","!Shift","!Alt")],[s.PIVOT_DOWN]:[new e("ArrowDown","!Shift","!Alt")],[s.PIVOT_LEFT]:[new e("ArrowLeft","!Shift","!Alt")],[s.PIVOT_RIGHT]:[new e("ArrowRight","!Shift","!Alt")],[s.PIVOT_UP]:[new e("ArrowUp","!Shift","!Alt")],[s.WALK_BACKWARD]:[new e("s")],[s.WALK_FORWARD]:[new e("w")],[s.WALK_LEFT]:[new e("a")],[s.WALK_RIGHT]:[new e("d")]};this.configuration={teleportHeightPercentage:11.75,teleportDistancePercentage:2,teleportCollisionDistance:1e3,keyboardWalkSpeed:5,keyboardPivotDegrees:1,keyboardRepeatIntervalMs:25};this.enabled=true;this.enabledChanged=new t;this.teleportModeChanged=new t;this.configurationChanged=new t;this.keyBindingsChanged=new t}setEnabled(t){this.enabled=t;this.enabledChanged.emit(t)}setTeleportMode(t){this.teleportMode=t;this.teleportModeChanged.emit(t)}setConfiguration(t){this.configuration=t;this.configurationChanged.emit(t)}addKeyBinding(t,e){this.keyBindings[t]=[...this.keyBindings[t],e];this.keyBindingsChanged.emit(this.keyBindings)}replaceKeyBinding(t,e){this.keyBindings[t]=[e];this.keyBindingsChanged.emit(this.keyBindings)}setExcludedPredicate(t){this.excludedPredicate=t}getEnabled(){return this.enabled}getTeleportMode(){return this.teleportMode}getTeleportHeightPercentage(){return this.configuration.teleportHeightPercentage}getKeyboardWalkSpeed(){return this.configuration.keyboardWalkSpeed}getKeyboardPivotDegrees(){return this.configuration.keyboardPivotDegrees}getKeyboardRepeatInterval(){return this.configuration.keyboardRepeatIntervalMs}getConfiguration(){return this.configuration}getKeyBindings(){return this.keyBindings}operationMatches(t,e){return this.keyBindings[t].some((t=>t.matches(e)))}isElementExcluded(t){var e;return!!((e=this.excludedPredicate)===null||e===void 0?void 0:e.call(this,t))}onEnabledChange(t){return this.enabledChanged.on(t)}onTeleportModeChange(t){return this.teleportModeChanged.on(t)}onConfigurationChange(t){return this.configurationChanged.on(t)}onKeyBindingsChange(t){return this.keyBindingsChanged.on(t)}}export{s as V,n as W,i as a};
//# sourceMappingURL=p-BiSDVz8o.js.map