import t from"../utils/browser.prod.js";import i from"../utils/clone.prod.js";import s from"../utils/domObjects.prod.js";import e from"../utils/extend.prod.js";import n from"../utils/raf.prod.js";import*as o from"../utils/window.prod.js";import{Eventable as r}from"./Eventable.prod.js";import{InteractEvent as d}from"./InteractEvent.prod.js";import{Interactable as a}from"./Interactable.prod.js";import{InteractableSet as l}from"./InteractableSet.prod.js";import{defaults as p}from"./defaultOptions.prod.js";import h from"./events.prod.js";import{createInteractStatic as c}from"./interactStatic.prod.js";import u from"./interactions.prod.js";export class Scope{constructor(){this.id="__interact_scope_"+Math.floor(100*Math.random()),this.isInitialized=!1,this.listenerMaps=[],this.browser=t,this.defaults=i(p),this.Eventable=r,this.actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}},this.interactStatic=c(this),this.InteractEvent=d,this.Interactable=void 0,this.interactables=new l(this),this._win=void 0,this.document=void 0,this.window=void 0,this.documents=[],this._plugins={list:[],map:{}},this.onWindowUnload=t=>this.removeDocument(t.target);const s=this;this.Interactable=class extends a{get _defaults(){return s.defaults}set(t){return super.set(t),s.fire("interactable:set",{options:t,interactable:this}),this}unset(){super.unset(),s.interactables.list.splice(s.interactables.list.indexOf(this),1),s.fire("interactable:unset",{interactable:this})}}}addListeners(t,i){this.listenerMaps.push({id:i,map:t})}fire(t,i){for(const{map:{[t]:s}}of this.listenerMaps)if(s&&!1===s(i,this,t))return!1}init(t){return this.isInitialized?this:initScope(this,t)}pluginIsInstalled(t){return this._plugins.map[t.id]||-1!==this._plugins.list.indexOf(t)}usePlugin(t,i){if(!this.isInitialized)return this;if(this.pluginIsInstalled(t))return this;if(t.id&&(this._plugins.map[t.id]=t),this._plugins.list.push(t),t.install&&t.install(this,i),t.listeners&&t.before){let i=0;const s=this.listenerMaps.length,e=t.before.reduce(((t,i)=>(t[i]=!0,t[m(i)]=!0,t)),{});for(;i