+import {onChildEvent} from '../services/dom';
+import {Component} from './component';
+
+/**
+ * @typedef EntitySelectorSearchOptions
+ * @property entityTypes string
+ * @property entityPermission string
+ * @property searchEndpoint string
+ * @property initialValue string
+ */
+
+/**
+ * Entity Selector
+ */
+export class EntitySelector extends Component {
+
+ setup() {
+ this.elem = this.$el;
+
+ this.input = this.$refs.input;
+ this.searchInput = this.$refs.search;
+ this.loading = this.$refs.loading;
+ this.resultsContainer = this.$refs.results;
+
+ this.searchOptions = {
+ entityTypes: this.$opts.entityTypes || 'page,book,chapter',
+ entityPermission: this.$opts.entityPermission || 'view',
+ searchEndpoint: this.$opts.searchEndpoint || '',
+ initialValue: this.searchInput.value || '',
+ };