{"version":3,"sources":["webpack:///textcomplete.min.js","webpack:///webpack/bootstrap 5fdd342a07201b673919","webpack:///./src/search_result.js","webpack:///./node_modules/eventemitter3/index.js","webpack:///./src/strategy.js","webpack:///./src/utils.js","webpack:///./src/editor.js","webpack:///./src/main.js","webpack:///(webpack)/buildin/global.js","webpack:///./src/textcomplete.js","webpack:///./src/completer.js","webpack:///./src/query.js","webpack:///./src/dropdown.js","webpack:///./src/dropdown_item.js","webpack:///./src/textarea.js","webpack:///./node_modules/undate/lib/update.js","webpack:///./node_modules/textarea-caret/index.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","_classCallCheck","instance","Constructor","TypeError","value","_createClass","defineProperties","target","props","length","descriptor","writable","key","protoProps","staticProps","_strategy","SearchResult","obj","data","term","strategy","this","beforeCursor","afterCursor","replacement","replace","Array","isArray","match","matchText","_","p1","parseInt","slice","index","join","template","default","Events","EE","fn","context","once","EventEmitter","_events","_eventsCount","has","prefix","create","__proto__","eventNames","events","names","push","getOwnPropertySymbols","concat","listeners","event","exists","evt","available","ee","emit","a1","a2","a3","a4","a5","args","len","arguments","removeListener","undefined","apply","j","on","listener","removeAllListeners","off","addListener","setMaxListeners","prefixed","DEFAULT_TEMPLATE","Strategy","cache","callback","searchWithCache","search","_this","results","text","calculateElementOffset","el","rect","getBoundingClientRect","_el$ownerDocument","ownerDocument","defaultView","documentElement","offset","top","pageYOffset","left","pageXOffset","clientTop","clientLeft","isDigit","charCode","CHAR_CODE_ZERO","CHAR_CODE_NINE","getLineHeightPx","node","computedStyle","window","getComputedStyle","lineHeight","charCodeAt","parseFloat","fontSize","calculateLineHeightPx","nodeName","body","document","tempNode","createElement","innerHTML","style","fontFamily","padding","appendChild","HTMLTextAreaElement","rows","height","offsetHeight","removeChild","createCustomEvent","CustomEvent","type","options","cancelable","detail","createEvent","initCustomEvent","_interopRequireDefault","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","constructor","setPrototypeOf","_eventemitter","_eventemitter2","_utils","_search_result","Editor","_EventEmitter","getPrototypeOf","Error","code","moveEvent","enterEvent","changeEvent","getBeforeCursor","escEvent","e","keyCode","ctrlKey","global","_textcomplete","_textcomplete2","_textarea","_textarea2","editors","Textcomplete","Textarea","g","Function","eval","_completer","_completer2","_editor","_dropdown","_dropdown2","_strategy2","CALLBACK_METHODS","editor","completer","isQueryInFlight","nextPendingQuery","dropdown","forEach","method","bind","startListening","destroyEditor","destroy","stopListening","deactivate","strategyPropsArray","_this2","registerStrategy","run","_ref","searchResults","render","getCursorOffset","trigger","up","down","activeItem","getActiveItem","select","preventDefault","shown","selectEvent","defaultPrevented","applySearchResult","searchResult","_this3","handleMove","handleEnter","handleEsc","handleChange","handleSelect","eventName","handleHit","_query","_query2","Completer","strategies","query","extractQuery","execute","handleQueryResult","build","_search_result2","Query","map","result","_dropdown_item","_dropdown_item2","DEFAULT_CLASS_NAME","Dropdown","items","footer","header","maxCount","className","rotate","placement","itemOptions","item","keys","display","position","zIndex","parentNode","clear","_el","cursorOffset","renderEvent","rawResults","dropdownItems","setStrategyId","renderEdge","append","show","setOffset","hide","dropdownItem","moveActiveItem","fragment","createDocumentFragment","appended","doc","elementWidth","offsetWidth","browserWidth","clientWidth","right","isPlacementTop","bottom","clientHeight","showEvent","hideEvent","direction","nextActiveItem","next","prev","activate","strategyId","id","setAttribute","removeAttribute","source","content","li","classList","add","DropdownItem","active","activeClassName","removeEventListener","onClick","onMouseover","siblings","a","addEventListener","nextIndex","_get","receiver","desc","getOwnPropertyDescriptor","parent","_update","_update2","_editor2","getCaretCoordinates","_Editor","before","getAfterCursor","focus","dispatchEvent","Event","elOffset","elScroll","getElScroll","cursorPosition","getCursorPosition","dir","selectionStart","selectionEnd","substring","scrollTop","scrollLeft","emitChangeEvent","getCode","emitMoveEvent","emitEnterEvent","emitEscEvent","onInput","onKeydown","createInputEvent","bubbles","initEvent","headToCursor","cursorToTail","curr","activeElement","aLength","cLength","Math","min","setSelectionRange","strB2","execCommand","element","isBrowser","debug","querySelector","div","computed","currentStyle","whiteSpace","wordWrap","visibility","properties","prop","isFirefox","scrollHeight","overflowY","overflow","textContent","span","coordinates","offsetTop","offsetLeft","backgroundColor","mozInnerScreenX"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMM,SAAUtB,EAAQD,EAASH,GAEjC,YAeA,SAAS2B,GAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCAZhHhB,OAAOC,eAAeZ,EAAS,cAC7B4B,OAAO,GAGT,IAAIC,GAAe,WAAc,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAI9B,GAAI,EAAGA,EAAI8B,EAAMC,OAAQ/B,IAAK,CAAE,GAAIgC,G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A,UACA,cAIAT,EAAA,mBAAAtP,QACAiQ,EAAAX,GAAA,MAAAtP,OAAA2Q,oBAwEA,KAAAnZ,OAAA,KAAAA,EAAAD,QACAC,EAAAD,QAAAuV,EACCwC,IACDtP,OAAA8M","file":"textcomplete.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 5);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _strategy = __webpack_require__(2);\n\nvar _strategy2 = _interopRequireDefault(_strategy);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Encapsulate an result of each search results.\n */\nvar SearchResult = function () {\n\n /**\n * @param {object} data - An element of array callbacked by search function.\n */\n function SearchResult(data, term, strategy) {\n _classCallCheck(this, SearchResult);\n\n this.data = data;\n this.term = term;\n this.strategy = strategy;\n }\n\n _createClass(SearchResult, [{\n key: \"replace\",\n value: function replace(beforeCursor, afterCursor) {\n var replacement = this.strategy.replace(this.data);\n if (replacement !== null) {\n if (Array.isArray(replacement)) {\n afterCursor = replacement[1] + afterCursor;\n replacement = replacement[0];\n }\n var match = this.strategy.matchText(beforeCursor);\n if (match) {\n replacement = replacement.replace(/\\$&/g, match[0]).replace(/\\$(\\d)/g, function (_, p1) {\n return match[parseInt(p1, 10)];\n });\n return [[beforeCursor.slice(0, match.index), replacement, beforeCursor.slice(match.index + match[0].length)].join(\"\"), afterCursor];\n }\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return this.strategy.template(this.data, this.term);\n }\n }]);\n\n return SearchResult;\n}();\n\nexports.default = SearchResult;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @api private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {Mixed} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @api public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Boolean} exists Only check if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {Mixed} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn\n && (!once || listeners.once)\n && (!context || listeners.context === context)\n ) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {String|Symbol} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif (true) {\n module.exports = EventEmitter;\n}\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar DEFAULT_INDEX = 2;\n\nfunction DEFAULT_TEMPLATE(value) {\n return value;\n}\n\n/**\n * Properties for a strategy.\n *\n * @typedef\n */\n\n/**\n * Encapsulate a single strategy.\n */\nvar Strategy = function () {\n function Strategy(props) {\n _classCallCheck(this, Strategy);\n\n this.props = props;\n this.cache = props.cache ? {} : null;\n }\n\n /**\n * @return {this}\n */\n\n\n _createClass(Strategy, [{\n key: \"destroy\",\n value: function destroy() {\n this.cache = null;\n return this;\n }\n }, {\n key: \"search\",\n value: function search(term, callback, match) {\n if (this.cache) {\n this.searchWithCache(term, callback, match);\n } else {\n this.props.search(term, callback, match);\n }\n }\n\n /**\n * @param {object} data - An element of array callbacked by search function.\n */\n\n }, {\n key: \"replace\",\n value: function replace(data) {\n return this.props.replace(data);\n }\n\n /** @private */\n\n }, {\n key: \"searchWithCache\",\n value: function searchWithCache(term, callback, match) {\n var _this = this;\n\n if (this.cache && this.cache[term]) {\n callback(this.cache[term]);\n } else {\n this.props.search(term, function (results) {\n if (_this.cache) {\n _this.cache[term] = results;\n }\n callback(results);\n }, match);\n }\n }\n\n /** @private */\n\n }, {\n key: \"matchText\",\n value: function matchText(text) {\n if (typeof this.match === \"function\") {\n return this.match(text);\n } else {\n return text.match(this.match);\n }\n }\n\n /** @private */\n\n }, {\n key: \"match\",\n get: function get() {\n return this.props.match;\n }\n\n /** @private */\n\n }, {\n key: \"index\",\n get: function get() {\n return typeof this.props.index === \"number\" ? this.props.index : DEFAULT_INDEX;\n }\n }, {\n key: \"template\",\n get: function get() {\n return this.props.template || DEFAULT_TEMPLATE;\n }\n }]);\n\n return Strategy;\n}();\n\nexports.default = Strategy;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.calculateElementOffset = calculateElementOffset;\nexports.getLineHeightPx = getLineHeightPx;\nexports.calculateLineHeightPx = calculateLineHeightPx;\n\n\n/**\n * Create a custom event\n *\n * @private\n */\nvar createCustomEvent = exports.createCustomEvent = function () {\n if (typeof window.CustomEvent === \"function\") {\n return function (type, options) {\n return new document.defaultView.CustomEvent(type, {\n cancelable: options && options.cancelable || false,\n detail: options && options.detail || undefined\n });\n };\n } else {\n // Custom event polyfill from\n // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#polyfill\n return function (type, options) {\n var event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(type,\n /* bubbles */false, options && options.cancelable || false, options && options.detail || undefined);\n return event;\n };\n }\n}\n\n/**\n * Get the current coordinates of the `el` relative to the document.\n *\n * @private\n */\n();function calculateElementOffset(el) {\n var rect = el.getBoundingClientRect();\n var _el$ownerDocument = el.ownerDocument,\n defaultView = _el$ownerDocument.defaultView,\n documentElement = _el$ownerDocument.documentElement;\n\n var offset = {\n top: rect.top + defaultView.pageYOffset,\n left: rect.left + defaultView.pageXOffset\n };\n if (documentElement) {\n offset.top -= documentElement.clientTop;\n offset.left -= documentElement.clientLeft;\n }\n return offset;\n}\n\nvar CHAR_CODE_ZERO = \"0\".charCodeAt(0);\nvar CHAR_CODE_NINE = \"9\".charCodeAt(0);\n\nfunction isDigit(charCode) {\n return charCode >= CHAR_CODE_ZERO && charCode <= CHAR_CODE_NINE;\n}\n\n/**\n * Returns the line-height of the given node in pixels.\n *\n * @private\n */\nfunction getLineHeightPx(node) {\n var computedStyle = window.getComputedStyle(node\n\n // If the char code starts with a digit, it is either a value in pixels,\n // or unitless, as per:\n // https://drafts.csswg.org/css2/visudet.html#propdef-line-height\n // https://drafts.csswg.org/css2/cascade.html#computed-value\n );if (isDigit(computedStyle.lineHeight.charCodeAt(0))) {\n // In real browsers the value is *always* in pixels, even for unit-less\n // line-heights. However, we still check as per the spec.\n if (isDigit(computedStyle.lineHeight.charCodeAt(computedStyle.lineHeight.length - 1))) {\n return parseFloat(computedStyle.lineHeight) * parseFloat(computedStyle.fontSize);\n } else {\n return parseFloat(computedStyle.lineHeight);\n }\n }\n\n // Otherwise, the value is \"normal\".\n // If the line-height is \"normal\", calculate by font-size\n return calculateLineHeightPx(node.nodeName, computedStyle);\n}\n\n/**\n * Returns calculated line-height of the given node in pixels.\n *\n * @private\n */\nfunction calculateLineHeightPx(nodeName, computedStyle) {\n var body = document.body;\n if (!body) {\n return 0;\n }\n\n var tempNode = document.createElement(nodeName);\n tempNode.innerHTML = \" \";\n tempNode.style.fontSize = computedStyle.fontSize;\n tempNode.style.fontFamily = computedStyle.fontFamily;\n tempNode.style.padding = \"0\";\n body.appendChild(tempNode\n\n // Make sure textarea has only 1 row\n );if (tempNode instanceof HTMLTextAreaElement) {\n ;tempNode.rows = 1;\n }\n\n // Assume the height of the element is the line-height\n var height = tempNode.offsetHeight;\n body.removeChild(tempNode);\n\n return height;\n}\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _eventemitter = __webpack_require__(1);\n\nvar _eventemitter2 = _interopRequireDefault(_eventemitter);\n\nvar _utils = __webpack_require__(3);\n\nvar _search_result = __webpack_require__(0);\n\nvar _search_result2 = _interopRequireDefault(_search_result);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n/*eslint no-unused-vars: off*/\n\n/**\n * Abstract class representing a editor target.\n *\n * Editor classes must implement `#applySearchResult`, `#getCursorOffset` and\n * `#getBeforeCursor` methods.\n *\n * Editor classes must invoke `#emitMoveEvent`, `#emitEnterEvent`,\n * `#emitChangeEvent` and `#emitEscEvent` at proper timing.\n *\n * @abstract\n */\n\n\n/** @typedef */\nvar Editor = function (_EventEmitter) {\n _inherits(Editor, _EventEmitter);\n\n function Editor() {\n _classCallCheck(this, Editor);\n\n return _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).apply(this, arguments));\n }\n\n _createClass(Editor, [{\n key: \"destroy\",\n\n /**\n * It is called when associated textcomplete object is destroyed.\n *\n * @return {this}\n */\n value: function destroy() {\n return this;\n }\n\n /**\n * It is called when a search result is selected by a user.\n */\n\n }, {\n key: \"applySearchResult\",\n value: function applySearchResult(_) {\n throw new Error(\"Not implemented.\");\n }\n\n /**\n * The input cursor's absolute coordinates from the window's left\n * top corner.\n */\n\n }, {\n key: \"getCursorOffset\",\n value: function getCursorOffset() {\n throw new Error(\"Not implemented.\");\n }\n\n /**\n * Editor string value from head to cursor.\n * Returns null if selection type is range not cursor.\n */\n\n }, {\n key: \"getBeforeCursor\",\n value: function getBeforeCursor() {\n throw new Error(\"Not implemented.\");\n }\n\n /**\n * Emit a move event, which moves active dropdown element.\n * Child class must call this method at proper timing with proper parameter.\n *\n * @see {@link Textarea} for live example.\n */\n\n }, {\n key: \"emitMoveEvent\",\n value: function emitMoveEvent(code) {\n var moveEvent = (0, _utils.createCustomEvent)(\"move\", {\n cancelable: true,\n detail: {\n code: code\n }\n });\n this.emit(\"move\", moveEvent);\n return moveEvent;\n }\n\n /**\n * Emit a enter event, which selects current search result.\n * Child class must call this method at proper timing.\n *\n * @see {@link Textarea} for live example.\n */\n\n }, {\n key: \"emitEnterEvent\",\n value: function emitEnterEvent() {\n var enterEvent = (0, _utils.createCustomEvent)(\"enter\", { cancelable: true });\n this.emit(\"enter\", enterEvent);\n return enterEvent;\n }\n\n /**\n * Emit a change event, which triggers auto completion.\n * Child class must call this method at proper timing.\n *\n * @see {@link Textarea} for live example.\n */\n\n }, {\n key: \"emitChangeEvent\",\n value: function emitChangeEvent() {\n var changeEvent = (0, _utils.createCustomEvent)(\"change\", {\n detail: {\n beforeCursor: this.getBeforeCursor()\n }\n });\n this.emit(\"change\", changeEvent);\n return changeEvent;\n }\n\n /**\n * Emit a esc event, which hides dropdown element.\n * Child class must call this method at proper timing.\n *\n * @see {@link Textarea} for live example.\n */\n\n }, {\n key: \"emitEscEvent\",\n value: function emitEscEvent() {\n var escEvent = (0, _utils.createCustomEvent)(\"esc\", { cancelable: true });\n this.emit(\"esc\", escEvent);\n return escEvent;\n }\n\n /**\n * Helper method for parsing KeyboardEvent.\n *\n * @see {@link Textarea} for live example.\n */\n\n }, {\n key: \"getCode\",\n value: function getCode(e) {\n return e.keyCode === 9 ? \"ENTER\" // tab\n : e.keyCode === 13 ? \"ENTER\" // enter\n : e.keyCode === 27 ? \"ESC\" // esc\n : e.keyCode === 38 ? \"UP\" // up\n : e.keyCode === 40 ? \"DOWN\" // down\n : e.keyCode === 78 && e.ctrlKey ? \"DOWN\" // ctrl-n\n : e.keyCode === 80 && e.ctrlKey ? \"UP\" // ctrl-p\n : \"OTHER\";\n }\n }]);\n\n return Editor;\n}(_eventemitter2.default);\n\nexports.default = Editor;\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\nvar _textcomplete = __webpack_require__(7);\n\nvar _textcomplete2 = _interopRequireDefault(_textcomplete);\n\nvar _textarea = __webpack_require__(12);\n\nvar _textarea2 = _interopRequireDefault(_textarea);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar editors = void 0;\nif (global.Textcomplete && global.Textcomplete.editors) {\n editors = global.Textcomplete.editors;\n} else {\n editors = {};\n}\neditors.Textarea = _textarea2.default;\n\nglobal.Textcomplete = _textcomplete2.default;\nglobal.Textcomplete.editors = editors;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6)))\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _completer = __webpack_require__(8);\n\nvar _completer2 = _interopRequireDefault(_completer);\n\nvar _editor = __webpack_require__(4);\n\nvar _editor2 = _interopRequireDefault(_editor);\n\nvar _dropdown = __webpack_require__(10);\n\nvar _dropdown2 = _interopRequireDefault(_dropdown);\n\nvar _strategy = __webpack_require__(2);\n\nvar _strategy2 = _interopRequireDefault(_strategy);\n\nvar _search_result = __webpack_require__(0);\n\nvar _search_result2 = _interopRequireDefault(_search_result);\n\nvar _eventemitter = __webpack_require__(1);\n\nvar _eventemitter2 = _interopRequireDefault(_eventemitter);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar CALLBACK_METHODS = [\"handleChange\", \"handleEnter\", \"handleEsc\", \"handleHit\", \"handleMove\", \"handleSelect\"];\n\n/** @typedef */\n\n/**\n * The core of textcomplete. It acts as a mediator.\n */\nvar Textcomplete = function (_EventEmitter) {\n _inherits(Textcomplete, _EventEmitter);\n\n /**\n * @param {Editor} editor - Where the textcomplete works on.\n */\n function Textcomplete(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Textcomplete);\n\n var _this = _possibleConstructorReturn(this, (Textcomplete.__proto__ || Object.getPrototypeOf(Textcomplete)).call(this));\n\n _this.completer = new _completer2.default();\n _this.isQueryInFlight = false;\n _this.nextPendingQuery = null;\n _this.dropdown = new _dropdown2.default(options.dropdown || {});\n _this.editor = editor;\n _this.options = options;\n\n CALLBACK_METHODS.forEach(function (method) {\n ;_this[method] = _this[method].bind(_this);\n });\n\n _this.startListening();\n return _this;\n }\n\n /**\n * @return {this}\n */\n\n\n _createClass(Textcomplete, [{\n key: \"destroy\",\n value: function destroy() {\n var destroyEditor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n\n this.completer.destroy();\n this.dropdown.destroy();\n if (destroyEditor) {\n this.editor.destroy();\n }\n this.stopListening();\n return this;\n }\n\n /**\n * @return {this}\n */\n\n }, {\n key: \"hide\",\n value: function hide() {\n this.dropdown.deactivate();\n return this;\n }\n\n /**\n * @return {this}\n * @example\n * textcomplete.register([{\n * match: /(^|\\s)(\\w+)$/,\n * search: function (term, callback) {\n * $.ajax({ ... })\n * .done(callback)\n * .fail([]);\n * },\n * replace: function (value) {\n * return '$1' + value + ' ';\n * }\n * }]);\n */\n\n }, {\n key: \"register\",\n value: function register(strategyPropsArray) {\n var _this2 = this;\n\n strategyPropsArray.forEach(function (props) {\n _this2.completer.registerStrategy(new _strategy2.default(props));\n });\n return this;\n }\n\n /**\n * Start autocompleting.\n *\n * @param {string} text - Head to input cursor.\n * @return {this}\n */\n\n }, {\n key: \"trigger\",\n value: function trigger(text) {\n if (this.isQueryInFlight) {\n this.nextPendingQuery = text;\n } else {\n this.isQueryInFlight = true;\n this.nextPendingQuery = null;\n this.completer.run(text);\n }\n return this;\n }\n\n /** @private */\n\n }, {\n key: \"handleHit\",\n value: function handleHit(_ref) {\n var searchResults = _ref.searchResults;\n\n if (searchResults.length) {\n this.dropdown.render(searchResults, this.editor.getCursorOffset());\n } else {\n this.dropdown.deactivate();\n }\n this.isQueryInFlight = false;\n if (this.nextPendingQuery !== null) {\n this.trigger(this.nextPendingQuery);\n }\n }\n\n /** @private */\n\n }, {\n key: \"handleMove\",\n value: function handleMove(e) {\n e.detail.code === \"UP\" ? this.dropdown.up(e) : this.dropdown.down(e);\n }\n\n /** @private */\n\n }, {\n key: \"handleEnter\",\n value: function handleEnter(e) {\n var activeItem = this.dropdown.getActiveItem();\n if (activeItem) {\n this.dropdown.select(activeItem);\n e.preventDefault();\n } else {\n this.dropdown.deactivate();\n }\n }\n\n /** @private */\n\n }, {\n key: \"handleEsc\",\n value: function handleEsc(e) {\n if (this.dropdown.shown) {\n this.dropdown.deactivate();\n e.preventDefault();\n }\n }\n\n /** @private */\n\n }, {\n key: \"handleChange\",\n value: function handleChange(e) {\n if (e.detail.beforeCursor != null) {\n this.trigger(e.detail.beforeCursor);\n } else {\n this.dropdown.deactivate();\n }\n }\n\n /** @private */\n\n }, {\n key: \"handleSelect\",\n value: function handleSelect(selectEvent) {\n this.emit(\"select\", selectEvent);\n if (!selectEvent.defaultPrevented) {\n this.editor.applySearchResult(selectEvent.detail.searchResult);\n }\n }\n\n /** @private */\n\n }, {\n key: \"startListening\",\n value: function startListening() {\n var _this3 = this;\n\n this.editor.on(\"move\", this.handleMove).on(\"enter\", this.handleEnter).on(\"esc\", this.handleEsc).on(\"change\", this.handleChange);\n this.dropdown.on(\"select\", this.handleSelect);[\"show\", \"shown\", \"render\", \"rendered\", \"selected\", \"hidden\", \"hide\"].forEach(function (eventName) {\n _this3.dropdown.on(eventName, function () {\n return _this3.emit(eventName);\n });\n });\n this.completer.on(\"hit\", this.handleHit);\n }\n\n /** @private */\n\n }, {\n key: \"stopListening\",\n value: function stopListening() {\n this.completer.removeAllListeners();\n this.dropdown.removeAllListeners();\n this.editor.removeListener(\"move\", this.handleMove).removeListener(\"enter\", this.handleEnter).removeListener(\"esc\", this.handleEsc).removeListener(\"change\", this.handleChange);\n }\n }]);\n\n return Textcomplete;\n}(_eventemitter2.default);\n\nexports.default = Textcomplete;\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _eventemitter = __webpack_require__(1);\n\nvar _eventemitter2 = _interopRequireDefault(_eventemitter);\n\nvar _query = __webpack_require__(9);\n\nvar _query2 = _interopRequireDefault(_query);\n\nvar _search_result = __webpack_require__(0);\n\nvar _search_result2 = _interopRequireDefault(_search_result);\n\nvar _strategy = __webpack_require__(2);\n\nvar _strategy2 = _interopRequireDefault(_strategy);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar CALLBACK_METHODS = [\"handleQueryResult\"];\n\n/**\n * Complete engine.\n */\n\nvar Completer = function (_EventEmitter) {\n _inherits(Completer, _EventEmitter);\n\n function Completer() {\n _classCallCheck(this, Completer);\n\n var _this = _possibleConstructorReturn(this, (Completer.__proto__ || Object.getPrototypeOf(Completer)).call(this));\n\n _this.strategies = [];\n\n CALLBACK_METHODS.forEach(function (method) {\n ;_this[method] = _this[method].bind(_this);\n });\n return _this;\n }\n\n /**\n * @return {this}\n */\n\n\n _createClass(Completer, [{\n key: \"destroy\",\n value: function destroy() {\n this.strategies.forEach(function (strategy) {\n return strategy.destroy();\n });\n return this;\n }\n\n /**\n * Register a strategy to the completer.\n *\n * @return {this}\n */\n\n }, {\n key: \"registerStrategy\",\n value: function registerStrategy(strategy) {\n this.strategies.push(strategy);\n return this;\n }\n\n /**\n * @param {string} text - Head to input cursor.\n */\n\n }, {\n key: \"run\",\n value: function run(text) {\n var query = this.extractQuery(text);\n if (query) {\n query.execute(this.handleQueryResult);\n } else {\n this.handleQueryResult([]);\n }\n }\n\n /**\n * Find a query, which matches to the given text.\n *\n * @private\n */\n\n }, {\n key: \"extractQuery\",\n value: function extractQuery(text) {\n for (var i = 0; i < this.strategies.length; i++) {\n var query = _query2.default.build(this.strategies[i], text);\n if (query) {\n return query;\n }\n }\n return null;\n }\n\n /**\n * Callbacked by {@link Query#execute}.\n *\n * @private\n */\n\n }, {\n key: \"handleQueryResult\",\n value: function handleQueryResult(searchResults) {\n this.emit(\"hit\", { searchResults: searchResults });\n }\n }]);\n\n return Completer;\n}(_eventemitter2.default);\n\nexports.default = Completer;\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _search_result = __webpack_require__(0);\n\nvar _search_result2 = _interopRequireDefault(_search_result);\n\nvar _strategy = __webpack_require__(2);\n\nvar _strategy2 = _interopRequireDefault(_strategy);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Encapsulate matching condition between a Strategy and current editor's value.\n */\nvar Query = function () {\n _createClass(Query, null, [{\n key: \"build\",\n\n\n /**\n * Build a Query object by the given string if this matches to the string.\n *\n * @param {string} text - Head to input cursor.\n */\n value: function build(strategy, text) {\n if (typeof strategy.props.context === \"function\") {\n var context = strategy.props.context(text);\n if (typeof context === \"string\") {\n text = context;\n } else if (!context) {\n return null;\n }\n }\n var match = strategy.matchText(text);\n return match ? new Query(strategy, match[strategy.index], match) : null;\n }\n }]);\n\n function Query(strategy, term, match) {\n _classCallCheck(this, Query);\n\n this.strategy = strategy;\n this.term = term;\n this.match = match;\n }\n\n /**\n * Invoke search strategy and callback the given function.\n */\n\n\n _createClass(Query, [{\n key: \"execute\",\n value: function execute(callback) {\n var _this = this;\n\n this.strategy.search(this.term, function (results) {\n callback(results.map(function (result) {\n return new _search_result2.default(result, _this.term, _this.strategy);\n }));\n }, this.match);\n }\n }]);\n\n return Query;\n}();\n\nexports.default = Query;\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _eventemitter = __webpack_require__(1);\n\nvar _eventemitter2 = _interopRequireDefault(_eventemitter);\n\nvar _dropdown_item = __webpack_require__(11);\n\nvar _dropdown_item2 = _interopRequireDefault(_dropdown_item);\n\nvar _search_result = __webpack_require__(0);\n\nvar _search_result2 = _interopRequireDefault(_search_result);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar DEFAULT_CLASS_NAME = \"dropdown-menu textcomplete-dropdown\";\n\n/** @typedef */\n\n/**\n * Encapsulate a dropdown view.\n *\n * @prop {boolean} shown - Whether the #el is shown or not.\n * @prop {DropdownItem[]} items - The array of rendered dropdown items.\n */\nvar Dropdown = function (_EventEmitter) {\n _inherits(Dropdown, _EventEmitter);\n\n _createClass(Dropdown, null, [{\n key: \"createElement\",\n value: function createElement() {\n var el = document.createElement(\"ul\");\n var style = el.style;\n style.display = \"none\";\n style.position = \"absolute\";\n style.zIndex = \"10000\";\n var body = document.body;\n if (body) {\n body.appendChild(el);\n }\n return el;\n }\n }]);\n\n function Dropdown(options) {\n _classCallCheck(this, Dropdown);\n\n var _this = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this));\n\n _this.shown = false;\n _this.items = [];\n _this.activeItem = null;\n _this.footer = options.footer;\n _this.header = options.header;\n _this.maxCount = options.maxCount || 10;\n _this.el.className = options.className || DEFAULT_CLASS_NAME;\n _this.rotate = options.hasOwnProperty(\"rotate\") ? options.rotate : true;\n _this.placement = options.placement;\n _this.itemOptions = options.item || {};\n var style = options.style;\n if (style) {\n Object.keys(style).forEach(function (key) {\n ;_this.el.style[key] = style[key];\n });\n }\n return _this;\n }\n\n /**\n * @return {this}\n */\n\n\n _createClass(Dropdown, [{\n key: \"destroy\",\n value: function destroy() {\n var parentNode = this.el.parentNode;\n if (parentNode) {\n parentNode.removeChild(this.el);\n }\n this.clear()._el = null;\n return this;\n }\n }, {\n key: \"render\",\n\n\n /**\n * Render the given data as dropdown items.\n *\n * @return {this}\n */\n value: function render(searchResults, cursorOffset) {\n var _this2 = this;\n\n var renderEvent = (0, _utils.createCustomEvent)(\"render\", { cancelable: true });\n this.emit(\"render\", renderEvent);\n if (renderEvent.defaultPrevented) {\n return this;\n }\n var rawResults = searchResults.map(function (searchResult) {\n return searchResult.data;\n });\n var dropdownItems = searchResults.slice(0, this.maxCount || searchResults.length).map(function (searchResult) {\n return new _dropdown_item2.default(searchResult, _this2.itemOptions);\n });\n this.clear().setStrategyId(searchResults[0]).renderEdge(rawResults, \"header\").append(dropdownItems).renderEdge(rawResults, \"footer\").show().setOffset(cursorOffset);\n this.emit(\"rendered\", (0, _utils.createCustomEvent)(\"rendered\"));\n return this;\n }\n\n /**\n * Hide the dropdown then sweep out items.\n *\n * @return {this}\n */\n\n }, {\n key: \"deactivate\",\n value: function deactivate() {\n return this.hide().clear();\n }\n\n /**\n * @return {this}\n */\n\n }, {\n key: \"select\",\n value: function select(dropdownItem) {\n var detail = { searchResult: dropdownItem.searchResult };\n var selectEvent = (0, _utils.createCustomEvent)(\"select\", {\n cancelable: true,\n detail: detail\n });\n this.emit(\"select\", selectEvent);\n if (selectEvent.defaultPrevented) {\n return this;\n }\n this.deactivate();\n this.emit(\"selected\", (0, _utils.createCustomEvent)(\"selected\", { detail: detail }));\n return this;\n }\n\n /**\n * @return {this}\n */\n\n }, {\n key: \"up\",\n value: function up(e) {\n return this.shown ? this.moveActiveItem(\"prev\", e) : this;\n }\n\n /**\n * @return {this}\n */\n\n }, {\n key: \"down\",\n value: function down(e) {\n return this.shown ? this.moveActiveItem(\"next\", e) : this;\n }\n\n /**\n * Retrieve the active item.\n */\n\n }, {\n key: \"getActiveItem\",\n value: function getActiveItem() {\n return this.activeItem;\n }\n\n /**\n * Add items to dropdown.\n *\n * @private\n */\n\n }, {\n key: \"append\",\n value: function append(items) {\n var _this3 = this;\n\n var fragment = document.createDocumentFragment();\n items.forEach(function (item) {\n _this3.items.push(item);\n item.appended(_this3);\n fragment.appendChild(item.el);\n });\n this.el.appendChild(fragment);\n return this;\n }\n\n /** @private */\n\n }, {\n key: \"setOffset\",\n value: function setOffset(cursorOffset) {\n var doc = document.documentElement;\n if (doc) {\n var elementWidth = this.el.offsetWidth;\n if (cursorOffset.left) {\n var browserWidth = doc.clientWidth;\n if (cursorOffset.left + elementWidth > browserWidth) {\n cursorOffset.left = browserWidth - elementWidth;\n }\n this.el.style.left = cursorOffset.left + \"px\";\n } else if (cursorOffset.right) {\n if (cursorOffset.right - elementWidth < 0) {\n cursorOffset.right = 0;\n }\n this.el.style.right = cursorOffset.right + \"px\";\n }\n if (this.isPlacementTop()) {\n this.el.style.bottom = doc.clientHeight - cursorOffset.top + cursorOffset.lineHeight + \"px\";\n } else {\n this.el.style.top = cursorOffset.top + \"px\";\n }\n }\n return this;\n }\n\n /**\n * Show the element.\n *\n * @private\n */\n\n }, {\n key: \"show\",\n value: function show() {\n if (!this.shown) {\n var showEvent = (0, _utils.createCustomEvent)(\"show\", { cancelable: true });\n this.emit(\"show\", showEvent);\n if (showEvent.defaultPrevented) {\n return this;\n }\n this.el.style.display = \"block\";\n this.shown = true;\n this.emit(\"shown\", (0, _utils.createCustomEvent)(\"shown\"));\n }\n return this;\n }\n\n /**\n * Hide the element.\n *\n * @private\n */\n\n }, {\n key: \"hide\",\n value: function hide() {\n if (this.shown) {\n var hideEvent = (0, _utils.createCustomEvent)(\"hide\", { cancelable: true });\n this.emit(\"hide\", hideEvent);\n if (hideEvent.defaultPrevented) {\n return this;\n }\n this.el.style.display = \"none\";\n this.shown = false;\n this.emit(\"hidden\", (0, _utils.createCustomEvent)(\"hidden\"));\n }\n return this;\n }\n\n /**\n * Clear search results.\n *\n * @private\n */\n\n }, {\n key: \"clear\",\n value: function clear() {\n this.el.innerHTML = \"\";\n this.items.forEach(function (item) {\n return item.destroy();\n });\n this.items = [];\n return this;\n }\n\n /** @private */\n\n }, {\n key: \"moveActiveItem\",\n value: function moveActiveItem(direction, e) {\n var nextActiveItem = direction === \"next\" ? this.activeItem ? this.activeItem.next : this.items[0] : this.activeItem ? this.activeItem.prev : this.items[this.items.length - 1];\n if (nextActiveItem) {\n nextActiveItem.activate();\n e.preventDefault();\n }\n return this;\n }\n\n /** @private */\n\n }, {\n key: \"setStrategyId\",\n value: function setStrategyId(searchResult) {\n var strategyId = searchResult && searchResult.strategy.props.id;\n if (strategyId) {\n this.el.setAttribute(\"data-strategy\", strategyId);\n } else {\n this.el.removeAttribute(\"data-strategy\");\n }\n return this;\n }\n\n /**\n * @private\n * @param {object[]} rawResults - What callbacked by search function.\n */\n\n }, {\n key: \"renderEdge\",\n value: function renderEdge(rawResults, type) {\n var source = (type === \"header\" ? this.header : this.footer) || \"\";\n var content = typeof source === \"function\" ? source(rawResults) : source;\n var li = document.createElement(\"li\");\n li.classList.add(\"textcomplete-\" + type);\n li.innerHTML = content;\n this.el.appendChild(li);\n return this;\n }\n\n /** @private */\n\n }, {\n key: \"isPlacementTop\",\n value: function isPlacementTop() {\n return this.placement === \"top\";\n }\n }, {\n key: \"el\",\n get: function get() {\n if (!this._el) {\n this._el = Dropdown.createElement();\n }\n return this._el;\n }\n }]);\n\n return Dropdown;\n}(_eventemitter2.default);\n\nexports.default = Dropdown;\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.DEFAULT_CLASS_NAME = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _search_result = __webpack_require__(0);\n\nvar _search_result2 = _interopRequireDefault(_search_result);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar DEFAULT_CLASS_NAME = exports.DEFAULT_CLASS_NAME = \"textcomplete-item\";\nvar CALLBACK_METHODS = [\"onClick\", \"onMouseover\"];\n\n/** @typedef */\n\n\n// Declare interface instead of importing Dropdown itself to prevent circular dependency.\n\n/**\n * Encapsulate an item of dropdown.\n */\nvar DropdownItem = function () {\n function DropdownItem(searchResult, options) {\n var _this = this;\n\n _classCallCheck(this, DropdownItem);\n\n this.searchResult = searchResult;\n this.active = false;\n this.className = options.className || DEFAULT_CLASS_NAME;\n this.activeClassName = this.className + \" active\";\n\n CALLBACK_METHODS.forEach(function (method) {\n ;_this[method] = _this[method].bind(_this);\n });\n }\n\n _createClass(DropdownItem, [{\n key: \"destroy\",\n\n\n /**\n * Try to free resources and perform other cleanup operations.\n */\n value: function destroy() {\n this.el.removeEventListener(\"mousedown\", this.onClick, false);\n this.el.removeEventListener(\"mouseover\", this.onMouseover, false);\n this.el.removeEventListener(\"touchstart\", this.onClick, false);\n if (this.active) {\n this.dropdown.activeItem = null;\n }\n // This element has already been removed by {@link Dropdown#clear}.\n this._el = null;\n }\n\n /**\n * Callbacked when it is appended to a dropdown.\n *\n * @see Dropdown#append\n */\n\n }, {\n key: \"appended\",\n value: function appended(dropdown) {\n this.dropdown = dropdown;\n this.siblings = dropdown.items;\n this.index = this.siblings.length - 1;\n }\n\n /**\n * Deactivate active item then activate itself.\n *\n * @return {this}\n */\n\n }, {\n key: \"activate\",\n value: function activate() {\n if (!this.active) {\n var _activeItem = this.dropdown.getActiveItem();\n if (_activeItem) {\n _activeItem.deactivate();\n }\n this.dropdown.activeItem = this;\n this.active = true;\n this.el.className = this.activeClassName;\n }\n return this;\n }\n\n /**\n * Get the next sibling.\n */\n\n }, {\n key: \"deactivate\",\n\n\n /** @private */\n value: function deactivate() {\n if (this.active) {\n this.active = false;\n this.el.className = this.className;\n this.dropdown.activeItem = null;\n }\n return this;\n }\n\n /** @private */\n\n }, {\n key: \"onClick\",\n value: function onClick(e) {\n e.preventDefault // Prevent blur event\n ();this.dropdown.select(this);\n }\n\n /** @private */\n\n }, {\n key: \"onMouseover\",\n value: function onMouseover() {\n this.activate();\n }\n }, {\n key: \"el\",\n get: function get() {\n if (this._el) {\n return this._el;\n }\n var li = document.createElement(\"li\");\n li.className = this.active ? this.activeClassName : this.className;\n var a = document.createElement(\"a\");\n a.innerHTML = this.searchResult.render();\n li.appendChild(a);\n this._el = li;\n li.addEventListener(\"mousedown\", this.onClick);\n li.addEventListener(\"mouseover\", this.onMouseover);\n li.addEventListener(\"touchstart\", this.onClick);\n return li;\n }\n }, {\n key: \"next\",\n get: function get() {\n var nextIndex = void 0;\n if (this.index === this.siblings.length - 1) {\n if (!this.dropdown.rotate) {\n return null;\n }\n nextIndex = 0;\n } else {\n nextIndex = this.index + 1;\n }\n return this.siblings[nextIndex];\n }\n\n /**\n * Get the previous sibling.\n */\n\n }, {\n key: \"prev\",\n get: function get() {\n var nextIndex = void 0;\n if (this.index === 0) {\n if (!this.dropdown.rotate) {\n return null;\n }\n nextIndex = this.siblings.length - 1;\n } else {\n nextIndex = this.index - 1;\n }\n return this.siblings[nextIndex];\n }\n }]);\n\n return DropdownItem;\n}();\n\nexports.default = DropdownItem;\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _update = __webpack_require__(13);\n\nvar _update2 = _interopRequireDefault(_update);\n\nvar _editor = __webpack_require__(4);\n\nvar _editor2 = _interopRequireDefault(_editor);\n\nvar _utils = __webpack_require__(3);\n\nvar _search_result = __webpack_require__(0);\n\nvar _search_result2 = _interopRequireDefault(_search_result);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar getCaretCoordinates = __webpack_require__(14);\n\nvar CALLBACK_METHODS = [\"onInput\", \"onKeydown\"];\n\n/**\n * Encapsulate the target textarea element.\n */\n\nvar Textarea = function (_Editor) {\n _inherits(Textarea, _Editor);\n\n /**\n * @param {HTMLTextAreaElement} el - Where the textcomplete works on.\n */\n function Textarea(el) {\n _classCallCheck(this, Textarea);\n\n var _this = _possibleConstructorReturn(this, (Textarea.__proto__ || Object.getPrototypeOf(Textarea)).call(this));\n\n _this.el = el;\n\n CALLBACK_METHODS.forEach(function (method) {\n ;_this[method] = _this[method].bind(_this);\n });\n\n _this.startListening();\n return _this;\n }\n\n /**\n * @return {this}\n */\n\n\n _createClass(Textarea, [{\n key: \"destroy\",\n value: function destroy() {\n _get(Textarea.prototype.__proto__ || Object.getPrototypeOf(Textarea.prototype), \"destroy\", this).call(this);\n this.stopListening\n // Release the element reference early to help garbage collection.\n ();this.el = null;\n return this;\n }\n\n /**\n * Implementation for {@link Editor#applySearchResult}\n */\n\n }, {\n key: \"applySearchResult\",\n value: function applySearchResult(searchResult) {\n var before = this.getBeforeCursor();\n if (before != null) {\n var replace = searchResult.replace(before, this.getAfterCursor());\n this.el.focus // Clicking a dropdown item removes focus from the element.\n ();if (Array.isArray(replace)) {\n (0, _update2.default)(this.el, replace[0], replace[1]);\n this.el.dispatchEvent(new Event(\"input\"));\n }\n }\n }\n\n /**\n * Implementation for {@link Editor#getCursorOffset}\n */\n\n }, {\n key: \"getCursorOffset\",\n value: function getCursorOffset() {\n var elOffset = (0, _utils.calculateElementOffset)(this.el);\n var elScroll = this.getElScroll();\n var cursorPosition = this.getCursorPosition();\n var lineHeight = (0, _utils.getLineHeightPx)(this.el);\n var top = elOffset.top - elScroll.top + cursorPosition.top + lineHeight;\n var left = elOffset.left - elScroll.left + cursorPosition.left;\n if (this.el.dir !== \"rtl\") {\n return { top: top, left: left, lineHeight: lineHeight };\n } else {\n var right = document.documentElement ? document.documentElement.clientWidth - left : 0;\n return { top: top, right: right, lineHeight: lineHeight };\n }\n }\n\n /**\n * Implementation for {@link Editor#getBeforeCursor}\n */\n\n }, {\n key: \"getBeforeCursor\",\n value: function getBeforeCursor() {\n return this.el.selectionStart !== this.el.selectionEnd ? null : this.el.value.substring(0, this.el.selectionEnd);\n }\n\n /** @private */\n\n }, {\n key: \"getAfterCursor\",\n value: function getAfterCursor() {\n return this.el.value.substring(this.el.selectionEnd);\n }\n\n /** @private */\n\n }, {\n key: \"getElScroll\",\n value: function getElScroll() {\n return { top: this.el.scrollTop, left: this.el.scrollLeft };\n }\n\n /**\n * The input cursor's relative coordinates from the textarea's left\n * top corner.\n *\n * @private\n */\n\n }, {\n key: \"getCursorPosition\",\n value: function getCursorPosition() {\n return getCaretCoordinates(this.el, this.el.selectionEnd);\n }\n\n /** @private */\n\n }, {\n key: \"onInput\",\n value: function onInput() {\n this.emitChangeEvent();\n }\n\n /** @private */\n\n }, {\n key: \"onKeydown\",\n value: function onKeydown(e) {\n var code = this.getCode(e);\n var event = void 0;\n if (code === \"UP\" || code === \"DOWN\") {\n event = this.emitMoveEvent(code);\n } else if (code === \"ENTER\") {\n event = this.emitEnterEvent();\n } else if (code === \"ESC\") {\n event = this.emitEscEvent();\n }\n if (event && event.defaultPrevented) {\n e.preventDefault();\n }\n }\n\n /** @private */\n\n }, {\n key: \"startListening\",\n value: function startListening() {\n this.el.addEventListener(\"input\", this.onInput);\n this.el.addEventListener(\"keydown\", this.onKeydown);\n }\n\n /** @private */\n\n }, {\n key: \"stopListening\",\n value: function stopListening() {\n this.el.removeEventListener(\"input\", this.onInput);\n this.el.removeEventListener(\"keydown\", this.onKeydown);\n }\n }]);\n\n return Textarea;\n}(_editor2.default);\n\nexports.default = Textarea;\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nexports.default = function (el, headToCursor, cursorToTail) {\n var curr = el.value,\n // strA + strB1 + strC\n next = headToCursor + (cursorToTail || ''),\n // strA + strB2 + strC\n activeElement = document.activeElement;\n\n // Calculate length of strA and strC\n var aLength = 0,\n cLength = 0;\n while (aLength < curr.length && aLength < next.length && curr[aLength] === next[aLength]) {\n aLength++;\n }\n while (curr.length - cLength - 1 >= 0 && next.length - cLength - 1 >= 0 && curr[curr.length - cLength - 1] === next[next.length - cLength - 1]) {\n cLength++;\n }\n aLength = Math.min(aLength, Math.min(curr.length, next.length) - cLength);\n\n // Select strB1\n el.setSelectionRange(aLength, curr.length - cLength);\n\n // Get strB2\n var strB2 = next.substring(aLength, next.length - cLength);\n\n // Replace strB1 with strB2\n el.focus();\n if (!document.execCommand('insertText', false, strB2)) {\n // Document.execCommand returns false if the command is not supported.\n // Firefox and IE returns false in this case.\n el.value = next;\n el.dispatchEvent(createInputEvent());\n }\n\n // Move cursor to the end of headToCursor\n el.setSelectionRange(headToCursor.length, headToCursor.length);\n\n activeElement && activeElement.focus();\n return el;\n};\n\nfunction createInputEvent() {\n if (typeof Event !== \"undefined\") {\n return new Event(\"input\", { bubbles: true, cancelable: true });\n } else {\n var event = document.createEvent(\"Event\");\n event.initEvent(\"input\", true, true);\n return event;\n }\n}\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports) {\n\n/* jshint browser: true */\n\n(function () {\n\n// The properties that we copy into a mirrored div.\n// Note that some browsers, such as Firefox,\n// do not concatenate properties, i.e. padding-top, bottom etc. -> padding,\n// so we have to do every single property specifically.\nvar properties = [\n 'direction', // RTL support\n 'boxSizing',\n 'width', // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does\n 'height',\n 'overflowX',\n 'overflowY', // copy the scrollbar for IE\n\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderStyle',\n\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/font\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration', // might not make a difference, but better be safe\n\n 'letterSpacing',\n 'wordSpacing',\n\n 'tabSize',\n 'MozTabSize'\n\n];\n\nvar isBrowser = (typeof window !== 'undefined');\nvar isFirefox = (isBrowser && window.mozInnerScreenX != null);\n\nfunction getCaretCoordinates(element, position, options) {\n if(!isBrowser) {\n throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser');\n }\n\n var debug = options && options.debug || false;\n if (debug) {\n var el = document.querySelector('#input-textarea-caret-position-mirror-div');\n if ( el ) { el.parentNode.removeChild(el); }\n }\n\n // mirrored div\n var div = document.createElement('div');\n div.id = 'input-textarea-caret-position-mirror-div';\n document.body.appendChild(div);\n\n var style = div.style;\n var computed = window.getComputedStyle? getComputedStyle(element) : element.currentStyle; // currentStyle for IE < 9\n\n // default textarea styles\n style.whiteSpace = 'pre-wrap';\n if (element.nodeName !== 'INPUT')\n style.wordWrap = 'break-word'; // only for textarea-s\n\n // position off-screen\n style.position = 'absolute'; // required to return coordinates properly\n if (!debug)\n style.visibility = 'hidden'; // not 'display: none' because we want rendering\n\n // transfer the element's properties to the div\n properties.forEach(function (prop) {\n style[prop] = computed[prop];\n });\n\n if (isFirefox) {\n // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275\n if (element.scrollHeight > parseInt(computed.height))\n style.overflowY = 'scroll';\n } else {\n style.overflow = 'hidden'; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'\n }\n\n div.textContent = element.value.substring(0, position);\n // the second special handling for input type=\"text\" vs textarea: spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037\n if (element.nodeName === 'INPUT')\n div.textContent = div.textContent.replace(/\\s/g, '\\u00a0');\n\n var span = document.createElement('span');\n // Wrapping must be replicated *exactly*, including when a long word gets\n // onto the next line, with whitespace at the end of the line before (#7).\n // The *only* reliable way to do that is to copy the *entire* rest of the\n // textarea's content into the created at the caret position.\n // for inputs, just '.' would be enough, but why bother?\n span.textContent = element.value.substring(position) || '.'; // || because a completely empty faux span doesn't render at all\n div.appendChild(span);\n\n var coordinates = {\n top: span.offsetTop + parseInt(computed['borderTopWidth']),\n left: span.offsetLeft + parseInt(computed['borderLeftWidth'])\n };\n\n if (debug) {\n span.style.backgroundColor = '#aaa';\n } else {\n document.body.removeChild(div);\n }\n\n return coordinates;\n}\n\nif (typeof module != 'undefined' && typeof module.exports != 'undefined') {\n module.exports = getCaretCoordinates;\n} else if(isBrowser){\n window.getCaretCoordinates = getCaretCoordinates;\n}\n\n}());\n\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// textcomplete.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 5fdd342a07201b673919","// @flow\n\nimport Strategy from \"./strategy\"\n\n/**\n * Encapsulate an result of each search results.\n */\nexport default class SearchResult {\n data: Object\n term: string\n strategy: Strategy\n\n /**\n * @param {object} data - An element of array callbacked by search function.\n */\n constructor(data: Object, term: string, strategy: Strategy) {\n this.data = data\n this.term = term\n this.strategy = strategy\n }\n\n replace(beforeCursor: string, afterCursor: string) {\n let replacement = this.strategy.replace(this.data)\n if (replacement !== null) {\n if (Array.isArray(replacement)) {\n afterCursor = replacement[1] + afterCursor\n replacement = replacement[0]\n }\n const match = this.strategy.matchText(beforeCursor)\n if (match) {\n replacement = replacement\n .replace(/\\$&/g, match[0])\n .replace(/\\$(\\d)/g, (_, p1) => match[parseInt(p1, 10)])\n return [\n [\n beforeCursor.slice(0, match.index),\n replacement,\n beforeCursor.slice(match.index + match[0].length),\n ].join(\"\"),\n afterCursor,\n ]\n }\n }\n }\n\n render(): string {\n return this.strategy.template(this.data, this.term)\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/search_result.js","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @api private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {Mixed} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @api public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Boolean} exists Only check if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {Mixed} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn\n && (!once || listeners.once)\n && (!context || listeners.context === context)\n ) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {String|Symbol} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/eventemitter3/index.js\n// module id = 1\n// module chunks = 0","// @flow\n\ndeclare class MatchData extends Array {\n index: number;\n}\n\nexport type { MatchData }\n\nconst DEFAULT_INDEX = 2\n\nfunction DEFAULT_TEMPLATE(value) {\n return value\n}\n\n/**\n * Properties for a strategy.\n *\n * @typedef\n */\nexport type StrategyProperties = {\n match: RegExp | (string => MatchData | null),\n search: Function,\n replace: any => string[] | string | null,\n cache?: boolean,\n context?: Function,\n template?: any => string,\n index?: number,\n id?: string,\n}\n\n/**\n * Encapsulate a single strategy.\n */\nexport default class Strategy {\n props: StrategyProperties\n cache: ?Object\n\n constructor(props: StrategyProperties) {\n this.props = props\n this.cache = props.cache ? {} : null\n }\n\n /**\n * @return {this}\n */\n destroy() {\n this.cache = null\n return this\n }\n\n search(term: string, callback: Function, match: MatchData): void {\n if (this.cache) {\n this.searchWithCache(term, callback, match)\n } else {\n this.props.search(term, callback, match)\n }\n }\n\n /**\n * @param {object} data - An element of array callbacked by search function.\n */\n replace(data: any) {\n return this.props.replace(data)\n }\n\n /** @private */\n searchWithCache(term: string, callback: Function, match: MatchData): void {\n if (this.cache && this.cache[term]) {\n callback(this.cache[term])\n } else {\n this.props.search(\n term,\n results => {\n if (this.cache) {\n this.cache[term] = results\n }\n callback(results)\n },\n match,\n )\n }\n }\n\n /** @private */\n matchText(text: string): MatchData | null {\n if (typeof this.match === \"function\") {\n return this.match(text)\n } else {\n return (text.match(this.match): any)\n }\n }\n\n /** @private */\n get match(): $PropertyType {\n return this.props.match\n }\n\n /** @private */\n get index(): number {\n return typeof this.props.index === \"number\"\n ? this.props.index\n : DEFAULT_INDEX\n }\n\n get template(): (...any) => string {\n return this.props.template || DEFAULT_TEMPLATE\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/strategy.js","// @flow\n\n/**\n * Create a custom event\n *\n * @private\n */\nexport const createCustomEvent = (() => {\n if (typeof window.CustomEvent === \"function\") {\n return function(\n type: string,\n options: ?{ detail?: Object, cancelable?: boolean },\n ): CustomEvent {\n return new document.defaultView.CustomEvent(type, {\n cancelable: (options && options.cancelable) || false,\n detail: (options && options.detail) || undefined,\n })\n }\n } else {\n // Custom event polyfill from\n // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#polyfill\n return function(\n type: string,\n options: ?{ detail?: Object, cancelable?: boolean },\n ): CustomEvent {\n const event = document.createEvent(\"CustomEvent\")\n event.initCustomEvent(\n type,\n /* bubbles */ false,\n (options && options.cancelable) || false,\n (options && options.detail) || undefined,\n )\n return event\n }\n }\n})()\n\n/**\n * Get the current coordinates of the `el` relative to the document.\n *\n * @private\n */\nexport function calculateElementOffset(\n el: HTMLElement,\n): { top: number, left: number } {\n const rect = el.getBoundingClientRect()\n const { defaultView, documentElement } = el.ownerDocument\n const offset = {\n top: rect.top + defaultView.pageYOffset,\n left: rect.left + defaultView.pageXOffset,\n }\n if (documentElement) {\n offset.top -= documentElement.clientTop\n offset.left -= documentElement.clientLeft\n }\n return offset\n}\n\nconst CHAR_CODE_ZERO = \"0\".charCodeAt(0)\nconst CHAR_CODE_NINE = \"9\".charCodeAt(0)\n\nfunction isDigit(charCode: number): boolean {\n return charCode >= CHAR_CODE_ZERO && charCode <= CHAR_CODE_NINE\n}\n\n/**\n * Returns the line-height of the given node in pixels.\n *\n * @private\n */\nexport function getLineHeightPx(node: HTMLElement): number {\n const computedStyle = window.getComputedStyle(node)\n\n // If the char code starts with a digit, it is either a value in pixels,\n // or unitless, as per:\n // https://drafts.csswg.org/css2/visudet.html#propdef-line-height\n // https://drafts.csswg.org/css2/cascade.html#computed-value\n if (isDigit(computedStyle.lineHeight.charCodeAt(0))) {\n // In real browsers the value is *always* in pixels, even for unit-less\n // line-heights. However, we still check as per the spec.\n if (\n isDigit(\n computedStyle.lineHeight.charCodeAt(\n computedStyle.lineHeight.length - 1,\n ),\n )\n ) {\n return (\n parseFloat(computedStyle.lineHeight) *\n parseFloat(computedStyle.fontSize)\n )\n } else {\n return parseFloat(computedStyle.lineHeight)\n }\n }\n\n // Otherwise, the value is \"normal\".\n // If the line-height is \"normal\", calculate by font-size\n return calculateLineHeightPx(node.nodeName, computedStyle)\n}\n\n/**\n * Returns calculated line-height of the given node in pixels.\n *\n * @private\n */\nexport function calculateLineHeightPx(\n nodeName: string,\n computedStyle: CSSStyleDeclaration,\n): number {\n const body = document.body\n if (!body) {\n return 0\n }\n\n const tempNode = document.createElement(nodeName)\n tempNode.innerHTML = \" \"\n tempNode.style.fontSize = computedStyle.fontSize\n tempNode.style.fontFamily = computedStyle.fontFamily\n tempNode.style.padding = \"0\"\n body.appendChild(tempNode)\n\n // Make sure textarea has only 1 row\n if (tempNode instanceof HTMLTextAreaElement) {\n ;(tempNode: HTMLTextAreaElement).rows = 1\n }\n\n // Assume the height of the element is the line-height\n const height = tempNode.offsetHeight\n body.removeChild(tempNode)\n\n return height\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils.js","// @flow\n/*eslint no-unused-vars: off*/\n\nimport EventEmitter from \"eventemitter3\"\n\nimport { createCustomEvent } from \"./utils\"\nimport SearchResult from \"./search_result\"\n\n/** @typedef */\nexport type CursorOffset = {\n lineHeight: number,\n top: number,\n left?: number,\n right?: number,\n}\n\ntype KeyCode = \"ESC\" | \"ENTER\" | \"UP\" | \"DOWN\" | \"OTHER\"\n\n/**\n * Abstract class representing a editor target.\n *\n * Editor classes must implement `#applySearchResult`, `#getCursorOffset` and\n * `#getBeforeCursor` methods.\n *\n * Editor classes must invoke `#emitMoveEvent`, `#emitEnterEvent`,\n * `#emitChangeEvent` and `#emitEscEvent` at proper timing.\n *\n * @abstract\n */\nexport default class Editor extends EventEmitter {\n /**\n * It is called when associated textcomplete object is destroyed.\n *\n * @return {this}\n */\n destroy() {\n return this\n }\n\n /**\n * It is called when a search result is selected by a user.\n */\n applySearchResult(_: SearchResult): void {\n throw new Error(\"Not implemented.\")\n }\n\n /**\n * The input cursor's absolute coordinates from the window's left\n * top corner.\n */\n getCursorOffset(): CursorOffset {\n throw new Error(\"Not implemented.\")\n }\n\n /**\n * Editor string value from head to cursor.\n * Returns null if selection type is range not cursor.\n */\n getBeforeCursor(): ?string {\n throw new Error(\"Not implemented.\")\n }\n\n /**\n * Emit a move event, which moves active dropdown element.\n * Child class must call this method at proper timing with proper parameter.\n *\n * @see {@link Textarea} for live example.\n */\n emitMoveEvent(code: \"UP\" | \"DOWN\"): CustomEvent {\n const moveEvent = createCustomEvent(\"move\", {\n cancelable: true,\n detail: {\n code: code,\n },\n })\n this.emit(\"move\", moveEvent)\n return moveEvent\n }\n\n /**\n * Emit a enter event, which selects current search result.\n * Child class must call this method at proper timing.\n *\n * @see {@link Textarea} for live example.\n */\n emitEnterEvent(): CustomEvent {\n const enterEvent = createCustomEvent(\"enter\", { cancelable: true })\n this.emit(\"enter\", enterEvent)\n return enterEvent\n }\n\n /**\n * Emit a change event, which triggers auto completion.\n * Child class must call this method at proper timing.\n *\n * @see {@link Textarea} for live example.\n */\n emitChangeEvent(): CustomEvent {\n const changeEvent = createCustomEvent(\"change\", {\n detail: {\n beforeCursor: this.getBeforeCursor(),\n },\n })\n this.emit(\"change\", changeEvent)\n return changeEvent\n }\n\n /**\n * Emit a esc event, which hides dropdown element.\n * Child class must call this method at proper timing.\n *\n * @see {@link Textarea} for live example.\n */\n emitEscEvent(): CustomEvent {\n const escEvent = createCustomEvent(\"esc\", { cancelable: true })\n this.emit(\"esc\", escEvent)\n return escEvent\n }\n\n /**\n * Helper method for parsing KeyboardEvent.\n *\n * @see {@link Textarea} for live example.\n */\n getCode(e: KeyboardEvent): KeyCode {\n return e.keyCode === 9\n ? \"ENTER\" // tab\n : e.keyCode === 13\n ? \"ENTER\" // enter\n : e.keyCode === 27\n ? \"ESC\" // esc\n : e.keyCode === 38\n ? \"UP\" // up\n : e.keyCode === 40\n ? \"DOWN\" // down\n : e.keyCode === 78 && e.ctrlKey\n ? \"DOWN\" // ctrl-n\n : e.keyCode === 80 && e.ctrlKey\n ? \"UP\" // ctrl-p\n : \"OTHER\"\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/editor.js","import Textcomplete from \"./textcomplete\"\nimport Textarea from \"./textarea\"\n\nlet editors\nif (global.Textcomplete && global.Textcomplete.editors) {\n editors = global.Textcomplete.editors\n} else {\n editors = {}\n}\neditors.Textarea = Textarea\n\nglobal.Textcomplete = Textcomplete\nglobal.Textcomplete.editors = editors\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 6\n// module chunks = 0","// @flow\n\nimport Completer from \"./completer\"\nimport Editor from \"./editor\"\nimport Dropdown, { type DropdownOptions } from \"./dropdown\"\nimport Strategy, { type StrategyProperties } from \"./strategy\"\nimport SearchResult from \"./search_result\"\n\nimport EventEmitter from \"eventemitter3\"\n\nconst CALLBACK_METHODS = [\n \"handleChange\",\n \"handleEnter\",\n \"handleEsc\",\n \"handleHit\",\n \"handleMove\",\n \"handleSelect\",\n]\n\n/** @typedef */\ntype TextcompleteOptions = {\n dropdown?: DropdownOptions,\n}\n\n/**\n * The core of textcomplete. It acts as a mediator.\n */\nexport default class Textcomplete extends EventEmitter {\n dropdown: Dropdown\n editor: Editor\n options: TextcompleteOptions\n completer: Completer\n isQueryInFlight: boolean\n nextPendingQuery: string | null\n\n /**\n * @param {Editor} editor - Where the textcomplete works on.\n */\n constructor(editor: Editor, options: TextcompleteOptions = {}) {\n super()\n\n this.completer = new Completer()\n this.isQueryInFlight = false\n this.nextPendingQuery = null\n this.dropdown = new Dropdown(options.dropdown || {})\n this.editor = editor\n this.options = options\n\n CALLBACK_METHODS.forEach(method => {\n ;(this: any)[method] = (this: any)[method].bind(this)\n })\n\n this.startListening()\n }\n\n /**\n * @return {this}\n */\n destroy(destroyEditor: boolean = true) {\n this.completer.destroy()\n this.dropdown.destroy()\n if (destroyEditor) {\n this.editor.destroy()\n }\n this.stopListening()\n return this\n }\n\n /**\n * @return {this}\n */\n hide() {\n this.dropdown.deactivate()\n return this\n }\n\n /**\n * @return {this}\n * @example\n * textcomplete.register([{\n * match: /(^|\\s)(\\w+)$/,\n * search: function (term, callback) {\n * $.ajax({ ... })\n * .done(callback)\n * .fail([]);\n * },\n * replace: function (value) {\n * return '$1' + value + ' ';\n * }\n * }]);\n */\n register(strategyPropsArray: StrategyProperties[]) {\n strategyPropsArray.forEach(props => {\n this.completer.registerStrategy(new Strategy(props))\n })\n return this\n }\n\n /**\n * Start autocompleting.\n *\n * @param {string} text - Head to input cursor.\n * @return {this}\n */\n trigger(text: string) {\n if (this.isQueryInFlight) {\n this.nextPendingQuery = text\n } else {\n this.isQueryInFlight = true\n this.nextPendingQuery = null\n this.completer.run(text)\n }\n return this\n }\n\n /** @private */\n handleHit({ searchResults }: { searchResults: SearchResult[] }) {\n if (searchResults.length) {\n this.dropdown.render(searchResults, this.editor.getCursorOffset())\n } else {\n this.dropdown.deactivate()\n }\n this.isQueryInFlight = false\n if (this.nextPendingQuery !== null) {\n this.trigger(this.nextPendingQuery)\n }\n }\n\n /** @private */\n handleMove(e: CustomEvent) {\n e.detail.code === \"UP\" ? this.dropdown.up(e) : this.dropdown.down(e)\n }\n\n /** @private */\n handleEnter(e: CustomEvent) {\n const activeItem = this.dropdown.getActiveItem()\n if (activeItem) {\n this.dropdown.select(activeItem)\n e.preventDefault()\n } else {\n this.dropdown.deactivate()\n }\n }\n\n /** @private */\n handleEsc(e: CustomEvent) {\n if (this.dropdown.shown) {\n this.dropdown.deactivate()\n e.preventDefault()\n }\n }\n\n /** @private */\n handleChange(e: CustomEvent) {\n if (e.detail.beforeCursor != null) {\n this.trigger(e.detail.beforeCursor)\n } else {\n this.dropdown.deactivate()\n }\n }\n\n /** @private */\n handleSelect(selectEvent: CustomEvent) {\n this.emit(\"select\", selectEvent)\n if (!selectEvent.defaultPrevented) {\n this.editor.applySearchResult(selectEvent.detail.searchResult)\n }\n }\n\n /** @private */\n startListening() {\n this.editor\n .on(\"move\", this.handleMove)\n .on(\"enter\", this.handleEnter)\n .on(\"esc\", this.handleEsc)\n .on(\"change\", this.handleChange)\n this.dropdown.on(\"select\", this.handleSelect)\n ;[\n \"show\",\n \"shown\",\n \"render\",\n \"rendered\",\n \"selected\",\n \"hidden\",\n \"hide\",\n ].forEach(eventName => {\n this.dropdown.on(eventName, () => this.emit(eventName))\n })\n this.completer.on(\"hit\", this.handleHit)\n }\n\n /** @private */\n stopListening() {\n this.completer.removeAllListeners()\n this.dropdown.removeAllListeners()\n this.editor\n .removeListener(\"move\", this.handleMove)\n .removeListener(\"enter\", this.handleEnter)\n .removeListener(\"esc\", this.handleEsc)\n .removeListener(\"change\", this.handleChange)\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/textcomplete.js","// @flow\n\nimport EventEmitter from \"eventemitter3\"\n\nimport Query from \"./query\"\nimport SearchResult from \"./search_result\"\nimport Strategy from \"./strategy\"\n\nconst CALLBACK_METHODS = [\"handleQueryResult\"]\n\n/**\n * Complete engine.\n */\nexport default class Completer extends EventEmitter {\n strategies: Strategy[]\n\n constructor() {\n super()\n this.strategies = []\n\n CALLBACK_METHODS.forEach(method => {\n ;(this: any)[method] = (this: any)[method].bind(this)\n })\n }\n\n /**\n * @return {this}\n */\n destroy() {\n this.strategies.forEach(strategy => strategy.destroy())\n return this\n }\n\n /**\n * Register a strategy to the completer.\n *\n * @return {this}\n */\n registerStrategy(strategy: Strategy) {\n this.strategies.push(strategy)\n return this\n }\n\n /**\n * @param {string} text - Head to input cursor.\n */\n run(text: string): void {\n const query = this.extractQuery(text)\n if (query) {\n query.execute(this.handleQueryResult)\n } else {\n this.handleQueryResult([])\n }\n }\n\n /**\n * Find a query, which matches to the given text.\n *\n * @private\n */\n extractQuery(text: string) {\n for (let i = 0; i < this.strategies.length; i++) {\n const query = Query.build(this.strategies[i], text)\n if (query) {\n return query\n }\n }\n return null\n }\n\n /**\n * Callbacked by {@link Query#execute}.\n *\n * @private\n */\n handleQueryResult(searchResults: SearchResult[]) {\n this.emit(\"hit\", { searchResults })\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/completer.js","// @flow\n\nimport SearchResult from \"./search_result\"\nimport Strategy from \"./strategy\"\nimport type { MatchData } from \"./strategy\"\n\n/**\n * Encapsulate matching condition between a Strategy and current editor's value.\n */\nexport default class Query {\n strategy: Strategy\n term: string\n match: MatchData\n\n /**\n * Build a Query object by the given string if this matches to the string.\n *\n * @param {string} text - Head to input cursor.\n */\n static build(strategy: Strategy, text: string): ?Query {\n if (typeof strategy.props.context === \"function\") {\n const context = strategy.props.context(text)\n if (typeof context === \"string\") {\n text = context\n } else if (!context) {\n return null\n }\n }\n const match = strategy.matchText(text)\n return match ? new Query(strategy, match[strategy.index], match) : null\n }\n\n constructor(strategy: Strategy, term: string, match: MatchData) {\n this.strategy = strategy\n this.term = term\n this.match = match\n }\n\n /**\n * Invoke search strategy and callback the given function.\n */\n execute(callback: (SearchResult[]) => void) {\n this.strategy.search(\n this.term,\n results => {\n callback(\n results.map(result => {\n return new SearchResult(result, this.term, this.strategy)\n }),\n )\n },\n this.match,\n )\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/query.js","// @flow\nimport EventEmitter from \"eventemitter3\"\n\nimport DropdownItem, { type DropdownItemOptions } from \"./dropdown_item\"\nimport SearchResult from \"./search_result\"\nimport { createCustomEvent } from \"./utils\"\nimport type { CursorOffset } from \"./editor\"\n\nconst DEFAULT_CLASS_NAME = \"dropdown-menu textcomplete-dropdown\"\n\n/** @typedef */\nexport type DropdownOptions = {\n className?: string,\n footer?: any => string | string,\n header?: any => string | string,\n maxCount?: number,\n placement?: string,\n rotate?: boolean,\n style?: { [string]: string },\n item?: DropdownItemOptions,\n}\n\n/**\n * Encapsulate a dropdown view.\n *\n * @prop {boolean} shown - Whether the #el is shown or not.\n * @prop {DropdownItem[]} items - The array of rendered dropdown items.\n */\nexport default class Dropdown extends EventEmitter {\n shown: boolean\n items: DropdownItem[]\n activeItem: DropdownItem | null\n footer: $PropertyType\n header: $PropertyType\n maxCount: $PropertyType\n rotate: $PropertyType\n placement: $PropertyType\n itemOptions: DropdownItemOptions\n _el: ?HTMLUListElement\n\n static createElement(): HTMLUListElement {\n const el = document.createElement(\"ul\")\n const style = el.style\n style.display = \"none\"\n style.position = \"absolute\"\n style.zIndex = \"10000\"\n const body = document.body\n if (body) {\n body.appendChild(el)\n }\n return el\n }\n\n constructor(options: DropdownOptions) {\n super()\n this.shown = false\n this.items = []\n this.activeItem = null\n this.footer = options.footer\n this.header = options.header\n this.maxCount = options.maxCount || 10\n this.el.className = options.className || DEFAULT_CLASS_NAME\n this.rotate = options.hasOwnProperty(\"rotate\") ? options.rotate : true\n this.placement = options.placement\n this.itemOptions = options.item || {}\n const style = options.style\n if (style) {\n Object.keys(style).forEach(key => {\n ;(this.el.style: any)[key] = style[key]\n })\n }\n }\n\n /**\n * @return {this}\n */\n destroy() {\n const parentNode = this.el.parentNode\n if (parentNode) {\n parentNode.removeChild(this.el)\n }\n this.clear()._el = null\n return this\n }\n\n get el(): HTMLUListElement {\n if (!this._el) {\n this._el = Dropdown.createElement()\n }\n return this._el\n }\n\n /**\n * Render the given data as dropdown items.\n *\n * @return {this}\n */\n render(searchResults: SearchResult[], cursorOffset: CursorOffset) {\n const renderEvent = createCustomEvent(\"render\", { cancelable: true })\n this.emit(\"render\", renderEvent)\n if (renderEvent.defaultPrevented) {\n return this\n }\n const rawResults = searchResults.map(searchResult => searchResult.data)\n const dropdownItems = searchResults\n .slice(0, this.maxCount || searchResults.length)\n .map(searchResult => new DropdownItem(searchResult, this.itemOptions))\n this.clear()\n .setStrategyId(searchResults[0])\n .renderEdge(rawResults, \"header\")\n .append(dropdownItems)\n .renderEdge(rawResults, \"footer\")\n .show()\n .setOffset(cursorOffset)\n this.emit(\"rendered\", createCustomEvent(\"rendered\"))\n return this\n }\n\n /**\n * Hide the dropdown then sweep out items.\n *\n * @return {this}\n */\n deactivate() {\n return this.hide().clear()\n }\n\n /**\n * @return {this}\n */\n select(dropdownItem: DropdownItem) {\n const detail = { searchResult: dropdownItem.searchResult }\n const selectEvent = createCustomEvent(\"select\", {\n cancelable: true,\n detail: detail,\n })\n this.emit(\"select\", selectEvent)\n if (selectEvent.defaultPrevented) {\n return this\n }\n this.deactivate()\n this.emit(\"selected\", createCustomEvent(\"selected\", { detail }))\n return this\n }\n\n /**\n * @return {this}\n */\n up(e: CustomEvent) {\n return this.shown ? this.moveActiveItem(\"prev\", e) : this\n }\n\n /**\n * @return {this}\n */\n down(e: CustomEvent) {\n return this.shown ? this.moveActiveItem(\"next\", e) : this\n }\n\n /**\n * Retrieve the active item.\n */\n getActiveItem(): DropdownItem | null {\n return this.activeItem\n }\n\n /**\n * Add items to dropdown.\n *\n * @private\n */\n append(items: DropdownItem[]) {\n const fragment = document.createDocumentFragment()\n items.forEach(item => {\n this.items.push(item)\n item.appended(this)\n fragment.appendChild(item.el)\n })\n this.el.appendChild(fragment)\n return this\n }\n\n /** @private */\n setOffset(cursorOffset: CursorOffset) {\n const doc = document.documentElement\n if (doc) {\n const elementWidth = this.el.offsetWidth\n if (cursorOffset.left) {\n const browserWidth = doc.clientWidth\n if (cursorOffset.left + elementWidth > browserWidth) {\n cursorOffset.left = browserWidth - elementWidth\n }\n this.el.style.left = `${cursorOffset.left}px`\n } else if (cursorOffset.right) {\n if (cursorOffset.right - elementWidth < 0) {\n cursorOffset.right = 0\n }\n this.el.style.right = `${cursorOffset.right}px`\n }\n if (this.isPlacementTop()) {\n this.el.style.bottom = `${doc.clientHeight -\n cursorOffset.top +\n cursorOffset.lineHeight}px`\n } else {\n this.el.style.top = `${cursorOffset.top}px`\n }\n }\n return this\n }\n\n /**\n * Show the element.\n *\n * @private\n */\n show() {\n if (!this.shown) {\n const showEvent = createCustomEvent(\"show\", { cancelable: true })\n this.emit(\"show\", showEvent)\n if (showEvent.defaultPrevented) {\n return this\n }\n this.el.style.display = \"block\"\n this.shown = true\n this.emit(\"shown\", createCustomEvent(\"shown\"))\n }\n return this\n }\n\n /**\n * Hide the element.\n *\n * @private\n */\n hide() {\n if (this.shown) {\n const hideEvent = createCustomEvent(\"hide\", { cancelable: true })\n this.emit(\"hide\", hideEvent)\n if (hideEvent.defaultPrevented) {\n return this\n }\n this.el.style.display = \"none\"\n this.shown = false\n this.emit(\"hidden\", createCustomEvent(\"hidden\"))\n }\n return this\n }\n\n /**\n * Clear search results.\n *\n * @private\n */\n clear() {\n this.el.innerHTML = \"\"\n this.items.forEach(item => item.destroy())\n this.items = []\n return this\n }\n\n /** @private */\n moveActiveItem(direction: \"next\" | \"prev\", e: CustomEvent) {\n const nextActiveItem =\n direction === \"next\"\n ? this.activeItem ? this.activeItem.next : this.items[0]\n : this.activeItem\n ? this.activeItem.prev\n : this.items[this.items.length - 1]\n if (nextActiveItem) {\n nextActiveItem.activate()\n e.preventDefault()\n }\n return this\n }\n\n /** @private */\n setStrategyId(searchResult: ?SearchResult) {\n const strategyId = searchResult && searchResult.strategy.props.id\n if (strategyId) {\n this.el.setAttribute(\"data-strategy\", strategyId)\n } else {\n this.el.removeAttribute(\"data-strategy\")\n }\n return this\n }\n\n /**\n * @private\n * @param {object[]} rawResults - What callbacked by search function.\n */\n renderEdge(rawResults: Object[], type: \"header\" | \"footer\") {\n const source = (type === \"header\" ? this.header : this.footer) || \"\"\n const content: any =\n typeof source === \"function\" ? source(rawResults) : source\n const li = document.createElement(\"li\")\n li.classList.add(`textcomplete-${type}`)\n li.innerHTML = content\n this.el.appendChild(li)\n return this\n }\n\n /** @private */\n isPlacementTop() {\n return this.placement === \"top\"\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/dropdown.js","// @flow\n\nimport SearchResult from \"./search_result\"\n\nexport const DEFAULT_CLASS_NAME = \"textcomplete-item\"\nconst CALLBACK_METHODS = [\"onClick\", \"onMouseover\"]\n\n/** @typedef */\nexport type DropdownItemOptions = {\n className?: string,\n}\n\n// Declare interface instead of importing Dropdown itself to prevent circular dependency.\ninterface Dropdown {\n activeItem: DropdownItem | null;\n items: DropdownItem[];\n rotate: ?Boolean;\n getActiveItem(): DropdownItem | null;\n select(DropdownItem): DropdownItem;\n}\n\n/**\n * Encapsulate an item of dropdown.\n */\nexport default class DropdownItem {\n searchResult: SearchResult\n active: boolean\n className: string\n activeClassName: string\n siblings: DropdownItem[]\n dropdown: Dropdown\n index: number\n _el: ?HTMLLIElement\n\n constructor(searchResult: SearchResult, options: DropdownItemOptions) {\n this.searchResult = searchResult\n this.active = false\n this.className = options.className || DEFAULT_CLASS_NAME\n this.activeClassName = `${this.className} active`\n\n CALLBACK_METHODS.forEach(method => {\n ;(this: any)[method] = (this: any)[method].bind(this)\n })\n }\n\n get el(): HTMLLIElement {\n if (this._el) {\n return this._el\n }\n const li = document.createElement(\"li\")\n li.className = this.active ? this.activeClassName : this.className\n const a = document.createElement(\"a\")\n a.innerHTML = this.searchResult.render()\n li.appendChild(a)\n this._el = li\n li.addEventListener(\"mousedown\", this.onClick)\n li.addEventListener(\"mouseover\", this.onMouseover)\n li.addEventListener(\"touchstart\", this.onClick)\n return li\n }\n\n /**\n * Try to free resources and perform other cleanup operations.\n */\n destroy() {\n this.el.removeEventListener(\"mousedown\", this.onClick, false)\n this.el.removeEventListener(\"mouseover\", this.onMouseover, false)\n this.el.removeEventListener(\"touchstart\", this.onClick, false)\n if (this.active) {\n this.dropdown.activeItem = null\n }\n // This element has already been removed by {@link Dropdown#clear}.\n this._el = null\n }\n\n /**\n * Callbacked when it is appended to a dropdown.\n *\n * @see Dropdown#append\n */\n appended(dropdown: Dropdown) {\n this.dropdown = dropdown\n this.siblings = dropdown.items\n this.index = this.siblings.length - 1\n }\n\n /**\n * Deactivate active item then activate itself.\n *\n * @return {this}\n */\n activate() {\n if (!this.active) {\n const activeItem = this.dropdown.getActiveItem()\n if (activeItem) {\n activeItem.deactivate()\n }\n this.dropdown.activeItem = this\n this.active = true\n this.el.className = this.activeClassName\n }\n return this\n }\n\n /**\n * Get the next sibling.\n */\n get next(): ?DropdownItem {\n let nextIndex\n if (this.index === this.siblings.length - 1) {\n if (!this.dropdown.rotate) {\n return null\n }\n nextIndex = 0\n } else {\n nextIndex = this.index + 1\n }\n return this.siblings[nextIndex]\n }\n\n /**\n * Get the previous sibling.\n */\n get prev(): ?DropdownItem {\n let nextIndex\n if (this.index === 0) {\n if (!this.dropdown.rotate) {\n return null\n }\n nextIndex = this.siblings.length - 1\n } else {\n nextIndex = this.index - 1\n }\n return this.siblings[nextIndex]\n }\n\n /** @private */\n deactivate() {\n if (this.active) {\n this.active = false\n this.el.className = this.className\n this.dropdown.activeItem = null\n }\n return this\n }\n\n /** @private */\n onClick(e: Event) {\n e.preventDefault() // Prevent blur event\n this.dropdown.select(this)\n }\n\n /** @private */\n onMouseover() {\n this.activate()\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/dropdown_item.js","// @flow\n\nimport update from \"undate/lib/update\"\n\nimport Editor from \"./editor\"\nimport { calculateElementOffset, getLineHeightPx } from \"./utils\"\nimport SearchResult from \"./search_result\"\n\nconst getCaretCoordinates = require(\"textarea-caret\")\n\nconst CALLBACK_METHODS = [\"onInput\", \"onKeydown\"]\n\n/**\n * Encapsulate the target textarea element.\n */\nexport default class Textarea extends Editor {\n el: HTMLTextAreaElement\n\n /**\n * @param {HTMLTextAreaElement} el - Where the textcomplete works on.\n */\n constructor(el: HTMLTextAreaElement) {\n super()\n this.el = el\n\n CALLBACK_METHODS.forEach(method => {\n ;(this: any)[method] = (this: any)[method].bind(this)\n })\n\n this.startListening()\n }\n\n /**\n * @return {this}\n */\n destroy() {\n super.destroy()\n this.stopListening()\n // Release the element reference early to help garbage collection.\n ;(this: any).el = null\n return this\n }\n\n /**\n * Implementation for {@link Editor#applySearchResult}\n */\n applySearchResult(searchResult: SearchResult) {\n const before = this.getBeforeCursor()\n if (before != null) {\n const replace = searchResult.replace(before, this.getAfterCursor())\n this.el.focus() // Clicking a dropdown item removes focus from the element.\n if (Array.isArray(replace)) {\n update(this.el, replace[0], replace[1])\n this.el.dispatchEvent(new Event(\"input\"))\n }\n }\n }\n\n /**\n * Implementation for {@link Editor#getCursorOffset}\n */\n getCursorOffset() {\n const elOffset = calculateElementOffset(this.el)\n const elScroll = this.getElScroll()\n const cursorPosition = this.getCursorPosition()\n const lineHeight = getLineHeightPx(this.el)\n const top = elOffset.top - elScroll.top + cursorPosition.top + lineHeight\n const left = elOffset.left - elScroll.left + cursorPosition.left\n if (this.el.dir !== \"rtl\") {\n return { top, left, lineHeight }\n } else {\n const right = document.documentElement\n ? document.documentElement.clientWidth - left\n : 0\n return { top, right, lineHeight }\n }\n }\n\n /**\n * Implementation for {@link Editor#getBeforeCursor}\n */\n getBeforeCursor() {\n return this.el.selectionStart !== this.el.selectionEnd\n ? null\n : this.el.value.substring(0, this.el.selectionEnd)\n }\n\n /** @private */\n getAfterCursor() {\n return this.el.value.substring(this.el.selectionEnd)\n }\n\n /** @private */\n getElScroll(): { top: number, left: number } {\n return { top: this.el.scrollTop, left: this.el.scrollLeft }\n }\n\n /**\n * The input cursor's relative coordinates from the textarea's left\n * top corner.\n *\n * @private\n */\n getCursorPosition(): { top: number, left: number } {\n return getCaretCoordinates(this.el, this.el.selectionEnd)\n }\n\n /** @private */\n onInput() {\n this.emitChangeEvent()\n }\n\n /** @private */\n onKeydown(e: KeyboardEvent) {\n const code = this.getCode(e)\n let event\n if (code === \"UP\" || code === \"DOWN\") {\n event = this.emitMoveEvent(code)\n } else if (code === \"ENTER\") {\n event = this.emitEnterEvent()\n } else if (code === \"ESC\") {\n event = this.emitEscEvent()\n }\n if (event && event.defaultPrevented) {\n e.preventDefault()\n }\n }\n\n /** @private */\n startListening() {\n this.el.addEventListener(\"input\", this.onInput)\n this.el.addEventListener(\"keydown\", this.onKeydown)\n }\n\n /** @private */\n stopListening() {\n this.el.removeEventListener(\"input\", this.onInput)\n this.el.removeEventListener(\"keydown\", this.onKeydown)\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/textarea.js","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nexports.default = function (el, headToCursor, cursorToTail) {\n var curr = el.value,\n // strA + strB1 + strC\n next = headToCursor + (cursorToTail || ''),\n // strA + strB2 + strC\n activeElement = document.activeElement;\n\n // Calculate length of strA and strC\n var aLength = 0,\n cLength = 0;\n while (aLength < curr.length && aLength < next.length && curr[aLength] === next[aLength]) {\n aLength++;\n }\n while (curr.length - cLength - 1 >= 0 && next.length - cLength - 1 >= 0 && curr[curr.length - cLength - 1] === next[next.length - cLength - 1]) {\n cLength++;\n }\n aLength = Math.min(aLength, Math.min(curr.length, next.length) - cLength);\n\n // Select strB1\n el.setSelectionRange(aLength, curr.length - cLength);\n\n // Get strB2\n var strB2 = next.substring(aLength, next.length - cLength);\n\n // Replace strB1 with strB2\n el.focus();\n if (!document.execCommand('insertText', false, strB2)) {\n // Document.execCommand returns false if the command is not supported.\n // Firefox and IE returns false in this case.\n el.value = next;\n el.dispatchEvent(createInputEvent());\n }\n\n // Move cursor to the end of headToCursor\n el.setSelectionRange(headToCursor.length, headToCursor.length);\n\n activeElement && activeElement.focus();\n return el;\n};\n\nfunction createInputEvent() {\n if (typeof Event !== \"undefined\") {\n return new Event(\"input\", { bubbles: true, cancelable: true });\n } else {\n var event = document.createEvent(\"Event\");\n event.initEvent(\"input\", true, true);\n return event;\n }\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/undate/lib/update.js\n// module id = 13\n// module chunks = 0","/* jshint browser: true */\n\n(function () {\n\n// The properties that we copy into a mirrored div.\n// Note that some browsers, such as Firefox,\n// do not concatenate properties, i.e. padding-top, bottom etc. -> padding,\n// so we have to do every single property specifically.\nvar properties = [\n 'direction', // RTL support\n 'boxSizing',\n 'width', // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does\n 'height',\n 'overflowX',\n 'overflowY', // copy the scrollbar for IE\n\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderStyle',\n\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/font\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration', // might not make a difference, but better be safe\n\n 'letterSpacing',\n 'wordSpacing',\n\n 'tabSize',\n 'MozTabSize'\n\n];\n\nvar isBrowser = (typeof window !== 'undefined');\nvar isFirefox = (isBrowser && window.mozInnerScreenX != null);\n\nfunction getCaretCoordinates(element, position, options) {\n if(!isBrowser) {\n throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser');\n }\n\n var debug = options && options.debug || false;\n if (debug) {\n var el = document.querySelector('#input-textarea-caret-position-mirror-div');\n if ( el ) { el.parentNode.removeChild(el); }\n }\n\n // mirrored div\n var div = document.createElement('div');\n div.id = 'input-textarea-caret-position-mirror-div';\n document.body.appendChild(div);\n\n var style = div.style;\n var computed = window.getComputedStyle? getComputedStyle(element) : element.currentStyle; // currentStyle for IE < 9\n\n // default textarea styles\n style.whiteSpace = 'pre-wrap';\n if (element.nodeName !== 'INPUT')\n style.wordWrap = 'break-word'; // only for textarea-s\n\n // position off-screen\n style.position = 'absolute'; // required to return coordinates properly\n if (!debug)\n style.visibility = 'hidden'; // not 'display: none' because we want rendering\n\n // transfer the element's properties to the div\n properties.forEach(function (prop) {\n style[prop] = computed[prop];\n });\n\n if (isFirefox) {\n // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275\n if (element.scrollHeight > parseInt(computed.height))\n style.overflowY = 'scroll';\n } else {\n style.overflow = 'hidden'; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'\n }\n\n div.textContent = element.value.substring(0, position);\n // the second special handling for input type=\"text\" vs textarea: spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037\n if (element.nodeName === 'INPUT')\n div.textContent = div.textContent.replace(/\\s/g, '\\u00a0');\n\n var span = document.createElement('span');\n // Wrapping must be replicated *exactly*, including when a long word gets\n // onto the next line, with whitespace at the end of the line before (#7).\n // The *only* reliable way to do that is to copy the *entire* rest of the\n // textarea's content into the created at the caret position.\n // for inputs, just '.' would be enough, but why bother?\n span.textContent = element.value.substring(position) || '.'; // || because a completely empty faux span doesn't render at all\n div.appendChild(span);\n\n var coordinates = {\n top: span.offsetTop + parseInt(computed['borderTopWidth']),\n left: span.offsetLeft + parseInt(computed['borderLeftWidth'])\n };\n\n if (debug) {\n span.style.backgroundColor = '#aaa';\n } else {\n document.body.removeChild(div);\n }\n\n return coordinates;\n}\n\nif (typeof module != 'undefined' && typeof module.exports != 'undefined') {\n module.exports = getCaretCoordinates;\n} else if(isBrowser){\n window.getCaretCoordinates = getCaretCoordinates;\n}\n\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/textarea-caret/index.js\n// module id = 14\n// module chunks = 0"],"sourceRoot":""}