tribute 2.0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 07adcf1617d2cbc1e003927ce8643ec5f35f4f5e
4
+ data.tar.gz: 595f67c8eeb655b35a46b45394f55a5b5d709979
5
+ SHA512:
6
+ metadata.gz: e4e0f02a3df43c2877abe2fd1c8d96ceb98c6541eb1d03bef6a54521c6867637df8c7ae5b3c0837d4c29c024bdf6cf898a307cb4dd43045089e46cf33f1ad5f2
7
+ data.tar.gz: 2855e2177fdf18179cc59822f6789b8eb0b286941048a78da38cd39a51e828e99bcb8cb9aac5e2b36a4b2d92a44358b0794c7871c641e258076681bfa4e793d6
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /tribute_src/
11
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tribute.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 ZURB, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,68 @@
1
+ # Tribute
2
+
3
+ A cross-browser @mention engine written in native JS, no dependencies. Tested in Firefox, Chrome, iOS Safari, Safari, IE 9+, Edge 12+, Android 4+, and Windows Phone.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile, then bundle:
8
+
9
+ ```ruby
10
+ gem 'tribute'
11
+ ```
12
+
13
+ Add the following to your `app/assets/javascripts/application.js`:
14
+
15
+ ```js
16
+ *= require tribute
17
+ ```
18
+
19
+ Then, in your `app/assets/stylesheets/application.css`:
20
+
21
+ ```css
22
+ //= require tribute
23
+ ```
24
+
25
+ ## Initializing
26
+
27
+ There are two ways to initialize Tribute, by passing an array of "collections" or by passing one collection object.
28
+
29
+ ```js
30
+ var tribute = new Tribute({
31
+ values: [
32
+ {key: 'Phil Heartman', value: 'pheartman'},
33
+ {key: 'Gordon Ramsey', value: 'gramsey'}
34
+ ]
35
+ })
36
+ ```
37
+
38
+ You can pass multiple collections on initialization by passing in an array of collection objects to `collection`.
39
+
40
+ ```js
41
+ var tribute = new Tribute({
42
+ collection: []
43
+ })
44
+ ```
45
+
46
+ ### Attaching to elements
47
+
48
+ Once initialized, Tribute can be attached to an `input`, `textarea`, or an element that supports `contenteditable`.
49
+
50
+ ```html
51
+ <div id="caaanDo">I'm Mr. Meeseeks, look at me!</div>
52
+
53
+ <div class="mentionable">Some text here.</div>
54
+ <div class="mentionable">Some more text over here.</div>
55
+
56
+ <script>
57
+ tribute.attach(document.getElementById('caaanDo'));
58
+
59
+ // also works with NodeList
60
+ tribute.attach(document.querySelectorAll('.mentionable'));
61
+ </script>
62
+ ```
63
+
64
+ For more usage information, see the official [Tribute.js README](https://github.com/zurb/tribute#tribute).
65
+
66
+ ## License
67
+
68
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,30 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ namespace :tribute do
9
+ namespace :assets do
10
+ desc 'Update Tribute.'
11
+ task update: :clean do
12
+ version = Tribute::VERSION.sub(/.\d+$/, '')
13
+
14
+ sh 'git clone git@github.com:zurb/tribute.git tribute_src'
15
+ sh "cd tribute_src && git checkout tags/#{version}"
16
+ sh 'cp -R tribute_src/dist/tribute.css vendor/assets/stylesheets/tribute/index.css'
17
+ sh 'cp -R tribute_src/dist/tribute.js vendor/assets/javascripts/tribute/index.js'
18
+
19
+ puts "\n----------------------\n-- Tribute Updated! --\n----------------------\n"
20
+ end
21
+
22
+ desc 'Remove previous Tribute assets.'
23
+ task :clean do
24
+ sh 'rm -rf vendor'
25
+ sh 'rm -rf tribute_src'
26
+ sh 'mkdir -p vendor/assets/stylesheets/tribute/'
27
+ sh 'mkdir -p vendor/assets/javascripts/tribute/'
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "tribute"
5
+
6
+ require "irb"
7
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ require "tribute/version"
2
+ require "tribute/engine" if (defined?(Rails) && defined?(Rails::Engine))
3
+
4
+ module Tribute
5
+ end
@@ -0,0 +1,4 @@
1
+ module Tribute
2
+ class Engine < Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module Tribute
2
+ VERSION = "2.0.5.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tribute/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tribute"
8
+ spec.version = Tribute::VERSION
9
+ spec.authors = ["Zoran"]
10
+ spec.email = ["zoran@zurb.com"]
11
+
12
+ spec.summary = %q{Tribute.js @mentions for Rails.}
13
+ spec.homepage = "https://github.com/zurb/tribute"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.12"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.0"
24
+ end
@@ -0,0 +1,1388 @@
1
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Tribute = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
+ "use strict";
3
+
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+
8
+ var _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; }; }();
9
+
10
+ require("./utils");
11
+
12
+ var _TributeEvents = require("./TributeEvents");
13
+
14
+ var _TributeEvents2 = _interopRequireDefault(_TributeEvents);
15
+
16
+ var _TributeMenuEvents = require("./TributeMenuEvents");
17
+
18
+ var _TributeMenuEvents2 = _interopRequireDefault(_TributeMenuEvents);
19
+
20
+ var _TributeRange = require("./TributeRange");
21
+
22
+ var _TributeRange2 = _interopRequireDefault(_TributeRange);
23
+
24
+ var _TributeSearch = require("./TributeSearch");
25
+
26
+ var _TributeSearch2 = _interopRequireDefault(_TributeSearch);
27
+
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+
30
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
+
32
+ var Tribute = function () {
33
+ function Tribute(_ref) {
34
+ var _this = this;
35
+
36
+ var _ref$values = _ref.values;
37
+ var values = _ref$values === undefined ? null : _ref$values;
38
+ var _ref$iframe = _ref.iframe;
39
+ var iframe = _ref$iframe === undefined ? null : _ref$iframe;
40
+ var _ref$selectClass = _ref.selectClass;
41
+ var selectClass = _ref$selectClass === undefined ? 'highlight' : _ref$selectClass;
42
+ var _ref$trigger = _ref.trigger;
43
+ var trigger = _ref$trigger === undefined ? '@' : _ref$trigger;
44
+ var _ref$selectTemplate = _ref.selectTemplate;
45
+ var selectTemplate = _ref$selectTemplate === undefined ? null : _ref$selectTemplate;
46
+ var _ref$menuItemTemplate = _ref.menuItemTemplate;
47
+ var menuItemTemplate = _ref$menuItemTemplate === undefined ? null : _ref$menuItemTemplate;
48
+ var _ref$lookup = _ref.lookup;
49
+ var lookup = _ref$lookup === undefined ? 'key' : _ref$lookup;
50
+ var _ref$fillAttr = _ref.fillAttr;
51
+ var fillAttr = _ref$fillAttr === undefined ? 'value' : _ref$fillAttr;
52
+ var _ref$collection = _ref.collection;
53
+ var collection = _ref$collection === undefined ? null : _ref$collection;
54
+ var _ref$menuContainer = _ref.menuContainer;
55
+ var menuContainer = _ref$menuContainer === undefined ? null : _ref$menuContainer;
56
+ var _ref$noMatchTemplate = _ref.noMatchTemplate;
57
+ var noMatchTemplate = _ref$noMatchTemplate === undefined ? null : _ref$noMatchTemplate;
58
+
59
+ _classCallCheck(this, Tribute);
60
+
61
+ this.menuSelected = 0;
62
+ this.current = {};
63
+ this.inputEvent = false;
64
+ this.isActive = false;
65
+ this.menuContainer = menuContainer;
66
+
67
+ if (values) {
68
+ this.collection = [{
69
+ // symbol that starts the lookup
70
+ trigger: trigger,
71
+
72
+ iframe: iframe,
73
+
74
+ selectClass: selectClass,
75
+
76
+ // function called on select that retuns the content to insert
77
+ selectTemplate: (selectTemplate || Tribute.defaultSelectTemplate).bind(this),
78
+
79
+ // function called that returns content for an item
80
+ menuItemTemplate: (menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(this),
81
+
82
+ // function called when menu is empty, disables hiding of menu.
83
+ noMatchTemplate: function (t) {
84
+ if (typeof t === 'function') {
85
+ return t.bind(_this);
86
+ }
87
+
88
+ return null;
89
+ }(noMatchTemplate),
90
+
91
+ // column to search against in the object
92
+ lookup: lookup,
93
+
94
+ // column that contains the content to insert by default
95
+ fillAttr: fillAttr,
96
+
97
+ // array of objects
98
+ values: values
99
+ }];
100
+ } else if (collection) {
101
+ this.collection = collection.map(function (item) {
102
+ return {
103
+ trigger: item.trigger || trigger,
104
+ iframe: item.iframe || iframe,
105
+ selectClass: item.selectClass || selectClass,
106
+ selectTemplate: (item.selectTemplate || Tribute.defaultSelectTemplate).bind(_this),
107
+ menuItemTemplate: (item.menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(_this),
108
+ // function called when menu is empty, disables hiding of menu.
109
+ noMatchTemplate: function (t) {
110
+ if (typeof t === 'function') {
111
+ return t.bind(_this);
112
+ }
113
+
114
+ return null;
115
+ }(noMatchTemplate),
116
+ lookup: item.lookup || lookup,
117
+ fillAttr: item.fillAttr || fillAttr,
118
+ values: item.values
119
+ };
120
+ });
121
+ } else {
122
+ throw new Error('[Tribute] No collection specified.');
123
+ }
124
+
125
+ new _TributeRange2.default(this);
126
+ new _TributeEvents2.default(this);
127
+ new _TributeMenuEvents2.default(this);
128
+ new _TributeSearch2.default(this);
129
+ }
130
+
131
+ _createClass(Tribute, [{
132
+ key: "triggers",
133
+ value: function triggers() {
134
+ return this.collection.map(function (config) {
135
+ return config.trigger;
136
+ });
137
+ }
138
+ }, {
139
+ key: "attach",
140
+ value: function attach(el) {
141
+ if (!el) {
142
+ throw new Error('[Tribute] Must pass in a DOM node or NodeList.');
143
+ }
144
+
145
+ // Check if it is a jQuery collection
146
+ if (typeof jQuery !== 'undefined' && el instanceof jQuery) {
147
+ el = el.get();
148
+ }
149
+
150
+ // Is el an Array/Array-like object?
151
+ if (el.constructor === NodeList || el.constructor === HTMLCollection || el.constructor === Array) {
152
+ var length = el.length;
153
+ for (var i = 0; i < length; ++i) {
154
+ this._attach(el[i]);
155
+ }
156
+ } else {
157
+ this._attach(el);
158
+ }
159
+ }
160
+ }, {
161
+ key: "_attach",
162
+ value: function _attach(el) {
163
+ if (el.hasAttribute('data-tribute')) {
164
+ console.warn('Tribute was already bound to ' + el.nodeName);
165
+ }
166
+
167
+ this.ensureEditable(el);
168
+ this.events.bind(el);
169
+ el.setAttribute('data-tribute', true);
170
+ }
171
+ }, {
172
+ key: "ensureEditable",
173
+ value: function ensureEditable(element) {
174
+ if (Tribute.inputTypes().indexOf(element.nodeName) === -1) {
175
+ if (element.contentEditable) {
176
+ element.contentEditable = true;
177
+ } else {
178
+ throw new Error('[Tribute] Cannot bind to ' + element.nodeName);
179
+ }
180
+ }
181
+ }
182
+ }, {
183
+ key: "createMenu",
184
+ value: function createMenu() {
185
+ var wrapper = this.range.getDocument().createElement('div'),
186
+ ul = this.range.getDocument().createElement('ul');
187
+
188
+ wrapper.className = 'tribute-container';
189
+ wrapper.appendChild(ul);
190
+
191
+ if (this.menuContainer) {
192
+ return this.menuContainer.appendChild(wrapper);
193
+ }
194
+
195
+ return this.range.getDocument().body.appendChild(wrapper);
196
+ }
197
+ }, {
198
+ key: "showMenuFor",
199
+ value: function showMenuFor(element, scrollTo) {
200
+ var _this2 = this;
201
+
202
+ var items = void 0;
203
+ // create the menu if it doesn't exist.
204
+ if (!this.menu) {
205
+ this.menu = this.createMenu();
206
+ this.menuEvents.bind(this.menu);
207
+ }
208
+
209
+ this.isActive = true;
210
+ this.menuSelected = 0;
211
+
212
+ if (!this.current.mentionText) {
213
+ this.current.mentionText = '';
214
+ }
215
+
216
+ items = this.search.filter(this.current.mentionText, this.current.collection.values, {
217
+ pre: '<span>',
218
+ post: '</span>',
219
+ extract: function extract(el) {
220
+ if (typeof _this2.current.collection.lookup === 'string') {
221
+ return el[_this2.current.collection.lookup];
222
+ } else if (typeof _this2.current.collection.lookup === 'function') {
223
+ return _this2.current.collection.lookup(el);
224
+ } else {
225
+ throw new Error('Invalid lookup attribute, lookup must be string or function.');
226
+ }
227
+ }
228
+ });
229
+
230
+ this.current.filteredItems = items;
231
+
232
+ var ul = this.menu.querySelector('ul');
233
+
234
+ if (!items.length) {
235
+ var noMatchEvent = new CustomEvent('tribute-no-match', { detail: this.menu });
236
+ this.current.element.dispatchEvent(noMatchEvent);
237
+ if (!this.current.collection.noMatchTemplate) {
238
+ this.hideMenu();
239
+ } else {
240
+ ul.innerHTML = this.current.collection.noMatchTemplate();
241
+ }
242
+
243
+ return;
244
+ }
245
+
246
+ ul.innerHTML = '';
247
+
248
+ items.forEach(function (item, index) {
249
+ var li = _this2.range.getDocument().createElement('li');
250
+ li.setAttribute('data-index', index);
251
+ if (_this2.menuSelected === index) {
252
+ li.className = _this2.current.collection.selectClass;
253
+ }
254
+ li.innerHTML = _this2.current.collection.menuItemTemplate(item);
255
+ ul.appendChild(li);
256
+ });
257
+
258
+ this.range.positionMenuAtCaret(scrollTo);
259
+ }
260
+ }, {
261
+ key: "hideMenu",
262
+ value: function hideMenu() {
263
+ if (this.menu) {
264
+ this.menu.style.cssText = 'display: none;';
265
+ this.isActive = false;
266
+ this.menuSelected = 0;
267
+ this.current = {};
268
+ }
269
+ }
270
+ }, {
271
+ key: "selectItemAtIndex",
272
+ value: function selectItemAtIndex(index) {
273
+ index = parseInt(index);
274
+ if (typeof index !== 'number') return;
275
+ var item = this.current.filteredItems[index];
276
+ var content = this.current.collection.selectTemplate(item);
277
+ this.replaceText(content);
278
+ }
279
+ }, {
280
+ key: "replaceText",
281
+ value: function replaceText(content) {
282
+ this.range.replaceTriggerText(content, true, true);
283
+ }
284
+ }, {
285
+ key: "_append",
286
+ value: function _append(collection, newValues, replace) {
287
+ if (!replace) {
288
+ collection.values = collection.values.concat(newValues);
289
+ } else {
290
+ collection.values = newValues;
291
+ }
292
+ }
293
+ }, {
294
+ key: "append",
295
+ value: function append(collectionIndex, newValues, replace) {
296
+ var index = parseInt(collectionIndex);
297
+ if (typeof index !== 'number') throw new Error('please provide an index for the collection to update.');
298
+
299
+ var collection = this.collection[index];
300
+
301
+ this._append(collection, newValues, replace);
302
+ }
303
+ }, {
304
+ key: "appendCurrent",
305
+ value: function appendCurrent(newValues, replace) {
306
+ if (this.isActive) {
307
+ this._append(this.current.collection, newValues, replace);
308
+ } else {
309
+ throw new Error('No active state. Please use append instead and pass an index.');
310
+ }
311
+ }
312
+ }], [{
313
+ key: "defaultSelectTemplate",
314
+ value: function defaultSelectTemplate(item) {
315
+ return "@" + item.original[this.current.collection.fillAttr];
316
+ }
317
+ }, {
318
+ key: "defaultMenuItemTemplate",
319
+ value: function defaultMenuItemTemplate(matchItem) {
320
+ return matchItem.string;
321
+ }
322
+ }, {
323
+ key: "inputTypes",
324
+ value: function inputTypes() {
325
+ return ['TEXTAREA', 'INPUT'];
326
+ }
327
+ }]);
328
+
329
+ return Tribute;
330
+ }();
331
+
332
+ exports.default = Tribute;
333
+ module.exports = exports["default"];
334
+
335
+ },{"./TributeEvents":2,"./TributeMenuEvents":3,"./TributeRange":4,"./TributeSearch":5,"./utils":7}],2:[function(require,module,exports){
336
+ 'use strict';
337
+
338
+ Object.defineProperty(exports, "__esModule", {
339
+ value: true
340
+ });
341
+
342
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
343
+
344
+ var _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; }; }();
345
+
346
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
347
+
348
+ var TributeEvents = function () {
349
+ function TributeEvents(tribute) {
350
+ _classCallCheck(this, TributeEvents);
351
+
352
+ this.tribute = tribute;
353
+ this.tribute.events = this;
354
+ }
355
+
356
+ _createClass(TributeEvents, [{
357
+ key: 'bind',
358
+ value: function bind(element) {
359
+ element.addEventListener('keydown', this.keydown.bind(element, this), false);
360
+ element.addEventListener('keyup', this.keyup.bind(element, this), false);
361
+ element.addEventListener('input', this.input.bind(element, this), false);
362
+ }
363
+ }, {
364
+ key: 'keydown',
365
+ value: function keydown(instance, event) {
366
+ if (instance.shouldDeactivate(event)) {
367
+ instance.tribute.isActive = false;
368
+ }
369
+
370
+ var element = this;
371
+ instance.commandEvent = false;
372
+
373
+ TributeEvents.keys().forEach(function (o) {
374
+ if (o.key === event.keyCode) {
375
+ instance.commandEvent = true;
376
+ instance.callbacks()[o.value.toLowerCase()](event, element);
377
+ }
378
+ });
379
+ }
380
+ }, {
381
+ key: 'input',
382
+ value: function input(instance, event) {
383
+ instance.inputEvent = true;
384
+ instance.keyup.call(this, instance, event);
385
+ }
386
+ }, {
387
+ key: 'click',
388
+ value: function click(instance, event) {
389
+ var tribute = instance.tribute;
390
+
391
+ if (tribute.menu && tribute.menu.contains(event.target)) {
392
+ var li = event.target;
393
+ while (li.nodeName.toLowerCase() !== 'li') {
394
+ li = li.parentNode;
395
+ if (!li || li === tribute.menu) {
396
+ throw new Error('cannot find the <li> container for the click');
397
+ }
398
+ }
399
+ tribute.selectItemAtIndex(li.getAttribute('data-index'));
400
+ tribute.hideMenu();
401
+ } else if (tribute.current.element) {
402
+ tribute.hideMenu();
403
+ }
404
+ }
405
+ }, {
406
+ key: 'keyup',
407
+ value: function keyup(instance, event) {
408
+ var _this = this;
409
+
410
+ if (instance.inputEvent) {
411
+ instance.inputEvent = false;
412
+ }
413
+ instance.updateSelection(this);
414
+
415
+ if (event.keyCode === 27) return;
416
+
417
+ if (!instance.tribute.isActive) {
418
+ var _ret = function () {
419
+ var keyCode = instance.getKeyCode(instance, _this, event);
420
+
421
+ if (isNaN(keyCode)) return {
422
+ v: void 0
423
+ };
424
+
425
+ var trigger = instance.tribute.triggers().find(function (trigger) {
426
+ return trigger.charCodeAt(0) === keyCode;
427
+ });
428
+
429
+ if (typeof trigger !== 'undefined') {
430
+ instance.callbacks().triggerChar(event, _this, trigger);
431
+ }
432
+ }();
433
+
434
+ if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
435
+ }
436
+
437
+ if (instance.tribute.current.trigger && instance.commandEvent === false || instance.tribute.isActive && event.keyCode === 8) {
438
+ instance.tribute.showMenuFor(this, true);
439
+ }
440
+ }
441
+ }, {
442
+ key: 'shouldDeactivate',
443
+ value: function shouldDeactivate(event) {
444
+ if (!this.tribute.isActive) return false;
445
+
446
+ if (this.tribute.current.mentionText.length === 0) {
447
+ var eventKeyPressed = false;
448
+ TributeEvents.keys().forEach(function (o) {
449
+ if (event.keyCode === o.key) eventKeyPressed = true;
450
+ });
451
+
452
+ return !eventKeyPressed;
453
+ }
454
+
455
+ return false;
456
+ }
457
+ }, {
458
+ key: 'getKeyCode',
459
+ value: function getKeyCode(instance, el, event) {
460
+ var char = void 0;
461
+ var tribute = instance.tribute;
462
+ var info = tribute.range.getTriggerInfo(false, false, true);
463
+
464
+ if (info) {
465
+ return info.mentionTriggerChar.charCodeAt(0);
466
+ } else {
467
+ return false;
468
+ }
469
+ }
470
+ }, {
471
+ key: 'updateSelection',
472
+ value: function updateSelection(el) {
473
+ this.tribute.current.element = el;
474
+ var info = this.tribute.range.getTriggerInfo(false, false, true);
475
+
476
+ if (info) {
477
+ this.tribute.current.selectedPath = info.mentionSelectedPath;
478
+ this.tribute.current.mentionText = info.mentionText;
479
+ this.tribute.current.selectedOffset = info.mentionSelectedOffset;
480
+ }
481
+ }
482
+ }, {
483
+ key: 'callbacks',
484
+ value: function callbacks() {
485
+ var _this2 = this;
486
+
487
+ return {
488
+ triggerChar: function triggerChar(e, el, trigger) {
489
+ var tribute = _this2.tribute;
490
+ tribute.current.trigger = trigger;
491
+
492
+ var collectionItem = tribute.collection.find(function (item) {
493
+ return item.trigger === trigger;
494
+ });
495
+
496
+ tribute.current.collection = collectionItem;
497
+
498
+ tribute.showMenuFor(el, true);
499
+ },
500
+ enter: function enter(e, el) {
501
+ // choose selection
502
+ if (_this2.tribute.isActive) {
503
+ e.preventDefault();
504
+ setTimeout(function () {
505
+ _this2.tribute.selectItemAtIndex(_this2.tribute.menuSelected);
506
+ _this2.tribute.hideMenu();
507
+ }, 0);
508
+ }
509
+ },
510
+ escape: function escape(e, el) {
511
+ if (_this2.tribute.isActive) {
512
+ e.preventDefault();
513
+ _this2.tribute.hideMenu();
514
+ }
515
+ },
516
+ tab: function tab(e, el) {
517
+ // choose first match
518
+ _this2.callbacks().enter(e, el);
519
+ },
520
+ up: function up(e, el) {
521
+ // navigate up ul
522
+ if (_this2.tribute.isActive) {
523
+ e.preventDefault();
524
+ var count = _this2.tribute.current.filteredItems.length,
525
+ selected = _this2.tribute.menuSelected;
526
+
527
+ if (count > selected && selected > 0) {
528
+ _this2.tribute.menuSelected--;
529
+ _this2.setActiveLi();
530
+ }
531
+ }
532
+ },
533
+ down: function down(e, el) {
534
+ // navigate down ul
535
+ if (_this2.tribute.isActive) {
536
+ e.preventDefault();
537
+ var count = _this2.tribute.current.filteredItems.length - 1,
538
+ selected = _this2.tribute.menuSelected;
539
+
540
+ if (count > selected) {
541
+ _this2.tribute.menuSelected++;
542
+ _this2.setActiveLi();
543
+ }
544
+ }
545
+ },
546
+ delete: function _delete(e, el) {
547
+ if (_this2.tribute.isActive && _this2.tribute.current.mentionText.length < 1) {
548
+ _this2.tribute.hideMenu();
549
+ } else if (_this2.tribute.isActive) {
550
+ _this2.tribute.showMenuFor(el);
551
+ }
552
+ }
553
+ };
554
+ }
555
+ }, {
556
+ key: 'setActiveLi',
557
+ value: function setActiveLi(index) {
558
+ var lis = this.tribute.menu.querySelectorAll('li'),
559
+ length = lis.length >>> 0;
560
+
561
+ for (var i = 0; i < length; i++) {
562
+ var li = lis[i];
563
+ if (i === this.tribute.menuSelected) {
564
+ li.className = this.tribute.current.collection.selectClass;
565
+ } else {
566
+ li.className = '';
567
+ }
568
+ }
569
+ }
570
+ }], [{
571
+ key: 'keys',
572
+ value: function keys() {
573
+ return [{
574
+ key: 9,
575
+ value: 'TAB'
576
+ }, {
577
+ key: 8,
578
+ value: 'DELETE'
579
+ }, {
580
+ key: 13,
581
+ value: 'ENTER'
582
+ }, {
583
+ key: 27,
584
+ value: 'ESCAPE'
585
+ }, {
586
+ key: 38,
587
+ value: 'UP'
588
+ }, {
589
+ key: 40,
590
+ value: 'DOWN'
591
+ }];
592
+ }
593
+ }]);
594
+
595
+ return TributeEvents;
596
+ }();
597
+
598
+ exports.default = TributeEvents;
599
+ module.exports = exports['default'];
600
+
601
+ },{}],3:[function(require,module,exports){
602
+ 'use strict';
603
+
604
+ Object.defineProperty(exports, "__esModule", {
605
+ value: true
606
+ });
607
+
608
+ var _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; }; }();
609
+
610
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
611
+
612
+ var TributeMenuEvents = function () {
613
+ function TributeMenuEvents(tribute) {
614
+ _classCallCheck(this, TributeMenuEvents);
615
+
616
+ this.tribute = tribute;
617
+ this.tribute.menuEvents = this;
618
+ this.menu = this.tribute.menu;
619
+ }
620
+
621
+ _createClass(TributeMenuEvents, [{
622
+ key: 'bind',
623
+ value: function bind(menu) {
624
+ var _this = this;
625
+
626
+ menu.addEventListener('keydown', this.tribute.events.keydown.bind(this.menu, this), false);
627
+ this.tribute.range.getDocument().addEventListener('click', this.tribute.events.click.bind(null, this), false);
628
+ window.addEventListener('resize', this.debounce(function () {
629
+ if (_this.tribute.isActive) {
630
+ _this.tribute.showMenuFor(_this.tribute.current.element, true);
631
+ }
632
+ }, 300, false));
633
+
634
+ if (this.menuContainer) {
635
+ this.menuContainer.addEventListener('scroll', this.debounce(function () {
636
+ if (_this.tribute.isActive) {
637
+ _this.tribute.showMenuFor(_this.tribute.current.element, false);
638
+ }
639
+ }, 300, false), false);
640
+ } else {
641
+ window.onscroll = this.debounce(function () {
642
+ if (_this.tribute.isActive) {
643
+ _this.tribute.showMenuFor(_this.tribute.current.element, false);
644
+ }
645
+ }, 300, false);
646
+ }
647
+ }
648
+ }, {
649
+ key: 'debounce',
650
+ value: function debounce(func, wait, immediate) {
651
+ var _this2 = this,
652
+ _arguments = arguments;
653
+
654
+ var timeout;
655
+ return function () {
656
+ var context = _this2,
657
+ args = _arguments;
658
+ var later = function later() {
659
+ timeout = null;
660
+ if (!immediate) func.apply(context, args);
661
+ };
662
+ var callNow = immediate && !timeout;
663
+ clearTimeout(timeout);
664
+ timeout = setTimeout(later, wait);
665
+ if (callNow) func.apply(context, args);
666
+ };
667
+ }
668
+ }]);
669
+
670
+ return TributeMenuEvents;
671
+ }();
672
+
673
+ exports.default = TributeMenuEvents;
674
+ module.exports = exports['default'];
675
+
676
+ },{}],4:[function(require,module,exports){
677
+ 'use strict';
678
+
679
+ Object.defineProperty(exports, "__esModule", {
680
+ value: true
681
+ });
682
+
683
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
684
+
685
+ var _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; }; }();
686
+
687
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
688
+
689
+ // Thanks to https://github.com/jeff-collins/ment.io
690
+
691
+ var TributeRange = function () {
692
+ function TributeRange(tribute) {
693
+ _classCallCheck(this, TributeRange);
694
+
695
+ this.tribute = tribute;
696
+ this.tribute.range = this;
697
+ }
698
+
699
+ _createClass(TributeRange, [{
700
+ key: 'getDocument',
701
+ value: function getDocument() {
702
+ var iframe = void 0;
703
+ if (this.tribute.current.collection) {
704
+ iframe = this.tribute.current.collection.iframe;
705
+ }
706
+
707
+ if (!iframe) {
708
+ return document;
709
+ }
710
+
711
+ return iframe.contentWindow.document;
712
+ }
713
+ }, {
714
+ key: 'positionMenuAtCaret',
715
+ value: function positionMenuAtCaret(scrollTo) {
716
+ var _this = this;
717
+
718
+ var context = this.tribute.current,
719
+ coordinates = void 0;
720
+ var info = this.getTriggerInfo(false, false, true);
721
+
722
+ if (info !== undefined) {
723
+ if (!this.isContentEditable(context.element)) {
724
+ coordinates = this.getTextAreaOrInputUnderlinePosition(this.getDocument().activeElement, info.mentionPosition);
725
+ } else {
726
+ coordinates = this.getContentEditableCaretPosition(info.mentionPosition);
727
+ }
728
+
729
+ // Move the button into place.
730
+ this.tribute.menu.style.cssText = 'top: ' + coordinates.top + 'px;\n left: ' + coordinates.left + 'px;\n position: absolute;\n zIndex: 10000;\n display: block;';
731
+
732
+ setTimeout(function () {
733
+ if (scrollTo) _this.scrollIntoView(_this.getDocument().activeElement);
734
+ }, 0);
735
+ } else {
736
+ this.tribute.menu.style.cssText = 'display: none';
737
+ }
738
+ }
739
+ }, {
740
+ key: 'selectElement',
741
+ value: function selectElement(targetElement, path, offset) {
742
+ var range = void 0;
743
+ var elem = targetElement;
744
+
745
+ if (path) {
746
+ for (var i = 0; i < path.length; i++) {
747
+ elem = elem.childNodes[path[i]];
748
+ if (elem === undefined) {
749
+ return;
750
+ }
751
+ while (elem.length < offset) {
752
+ offset -= elem.length;
753
+ elem = elem.nextSibling;
754
+ }
755
+ if (elem.childNodes.length === 0 && !elem.length) {
756
+ elem = elem.previousSibling;
757
+ }
758
+ }
759
+ }
760
+ var sel = this.getWindowSelection();
761
+
762
+ range = this.getDocument().createRange();
763
+ range.setStart(elem, offset);
764
+ range.setEnd(elem, offset);
765
+ range.collapse(true);
766
+
767
+ try {
768
+ sel.removeAllRanges();
769
+ } catch (error) {}
770
+
771
+ sel.addRange(range);
772
+ targetElement.focus();
773
+ }
774
+ }, {
775
+ key: 'resetSelection',
776
+ value: function resetSelection(targetElement, path, offset) {
777
+ if (!this.isContentEditable(targetElement)) {
778
+ if (targetElement !== this.getDocument().activeElement) {
779
+ targetElement.focus();
780
+ }
781
+ } else {
782
+ this.selectElement(targetElement, path, offset);
783
+ }
784
+ }
785
+ }, {
786
+ key: 'replaceTriggerText',
787
+ value: function replaceTriggerText(text, requireLeadingSpace, hasTrailingSpace) {
788
+ var context = this.tribute.current;
789
+ this.resetSelection(context.element, context.selectedPath, context.selectedOffset);
790
+
791
+ var info = this.getTriggerInfo(requireLeadingSpace, true, hasTrailingSpace);
792
+
793
+ // Create the event
794
+ var replaceEvent = new CustomEvent('tribute-replaced', {
795
+ detail: text
796
+ });
797
+
798
+ if (info !== undefined) {
799
+ if (!this.isContentEditable(context.element)) {
800
+ var myField = this.getDocument().activeElement;
801
+ text += ' ';
802
+ var startPos = info.mentionPosition;
803
+ var endPos = info.mentionPosition + info.mentionText.length + 1;
804
+ myField.value = myField.value.substring(0, startPos) + text + myField.value.substring(endPos, myField.value.length);
805
+ myField.selectionStart = startPos + text.length;
806
+ myField.selectionEnd = startPos + text.length;
807
+ } else {
808
+ // add a space to the end of the pasted text
809
+ text += '\xA0';
810
+ this.pasteHtml(text, info.mentionPosition, info.mentionPosition + info.mentionText.length + 1);
811
+ }
812
+
813
+ context.element.dispatchEvent(replaceEvent);
814
+ }
815
+ }
816
+ }, {
817
+ key: 'pasteHtml',
818
+ value: function pasteHtml(html, startPos, endPos) {
819
+ var range = void 0,
820
+ sel = void 0;
821
+ sel = this.getWindowSelection();
822
+ range = this.getDocument().createRange();
823
+ range.setStart(sel.anchorNode, startPos);
824
+ range.setEnd(sel.anchorNode, endPos);
825
+ range.deleteContents();
826
+
827
+ var el = this.getDocument().createElement('div');
828
+ el.innerHTML = html;
829
+ var frag = this.getDocument().createDocumentFragment(),
830
+ node = void 0,
831
+ lastNode = void 0;
832
+ while (node = el.firstChild) {
833
+ lastNode = frag.appendChild(node);
834
+ }
835
+ range.insertNode(frag);
836
+
837
+ // Preserve the selection
838
+ if (lastNode) {
839
+ range = range.cloneRange();
840
+ range.setStartAfter(lastNode);
841
+ range.collapse(true);
842
+ sel.removeAllRanges();
843
+ sel.addRange(range);
844
+ }
845
+ }
846
+ }, {
847
+ key: 'getWindowSelection',
848
+ value: function getWindowSelection() {
849
+ if (this.tribute.collection.iframe) {
850
+ return this.tribute.collection.iframe.contentWindow.getSelection();
851
+ }
852
+
853
+ return window.getSelection();
854
+ }
855
+ }, {
856
+ key: 'getNodePositionInParent',
857
+ value: function getNodePositionInParent(element) {
858
+ if (element.parentNode === null) {
859
+ return 0;
860
+ }
861
+
862
+ for (var i = 0; i < element.parentNode.childNodes.length; i++) {
863
+ var node = element.parentNode.childNodes[i];
864
+
865
+ if (node === element) {
866
+ return i;
867
+ }
868
+ }
869
+ }
870
+ }, {
871
+ key: 'getContentEditableSelectedPath',
872
+ value: function getContentEditableSelectedPath() {
873
+ // content editable
874
+ var sel = this.getWindowSelection();
875
+ var selected = sel.anchorNode;
876
+ var path = [];
877
+ var offset = void 0;
878
+
879
+ if (selected != null) {
880
+ var i = void 0;
881
+ var ce = selected.contentEditable;
882
+ while (selected !== null && ce !== 'true') {
883
+ i = this.getNodePositionInParent(selected);
884
+ path.push(i);
885
+ selected = selected.parentNode;
886
+ if (selected !== null) {
887
+ ce = selected.contentEditable;
888
+ }
889
+ }
890
+ path.reverse();
891
+
892
+ // getRangeAt may not exist, need alternative
893
+ offset = sel.getRangeAt(0).startOffset;
894
+
895
+ return {
896
+ selected: selected,
897
+ path: path,
898
+ offset: offset
899
+ };
900
+ }
901
+ }
902
+ }, {
903
+ key: 'getTextPrecedingCurrentSelection',
904
+ value: function getTextPrecedingCurrentSelection() {
905
+ var context = this.tribute.current,
906
+ text = void 0;
907
+
908
+ if (!this.isContentEditable(context.element)) {
909
+ var textComponent = this.getDocument().activeElement;
910
+ var startPos = textComponent.selectionStart;
911
+ text = textComponent.value.substring(0, startPos);
912
+ } else {
913
+ var selectedElem = this.getWindowSelection().anchorNode;
914
+
915
+ if (selectedElem != null) {
916
+ var workingNodeContent = selectedElem.textContent;
917
+ var selectStartOffset = this.getWindowSelection().getRangeAt(0).startOffset;
918
+
919
+ if (selectStartOffset >= 0) {
920
+ text = workingNodeContent.substring(0, selectStartOffset);
921
+ }
922
+ }
923
+ }
924
+
925
+ return text;
926
+ }
927
+ }, {
928
+ key: 'getTriggerInfo',
929
+ value: function getTriggerInfo(menuAlreadyActive, hasTrailingSpace, requireLeadingSpace) {
930
+ var _this2 = this;
931
+
932
+ var ctx = this.tribute.current;
933
+ var selected = void 0,
934
+ path = void 0,
935
+ offset = void 0;
936
+
937
+ if (!this.isContentEditable(ctx.element)) {
938
+ selected = this.getDocument().activeElement;
939
+ } else {
940
+ // content editable
941
+ var selectionInfo = this.getContentEditableSelectedPath();
942
+
943
+ if (selectionInfo) {
944
+ selected = selectionInfo.selected;
945
+ path = selectionInfo.path;
946
+ offset = selectionInfo.offset;
947
+ }
948
+ }
949
+
950
+ var effectiveRange = this.getTextPrecedingCurrentSelection();
951
+
952
+ if (effectiveRange !== undefined && effectiveRange !== null) {
953
+ var _ret = function () {
954
+ var mostRecentTriggerCharPos = -1;
955
+ var triggerChar = void 0;
956
+
957
+ _this2.tribute.triggers().forEach(function (c) {
958
+ var idx = effectiveRange.lastIndexOf(c);
959
+
960
+ if (idx > mostRecentTriggerCharPos) {
961
+ mostRecentTriggerCharPos = idx;
962
+ triggerChar = c;
963
+ }
964
+ });
965
+
966
+ if (mostRecentTriggerCharPos >= 0 && (mostRecentTriggerCharPos === 0 || !requireLeadingSpace || /[\xA0\s]/g.test(effectiveRange.substring(mostRecentTriggerCharPos - 1, mostRecentTriggerCharPos)))) {
967
+ var currentTriggerSnippet = effectiveRange.substring(mostRecentTriggerCharPos + 1, effectiveRange.length);
968
+
969
+ triggerChar = effectiveRange.substring(mostRecentTriggerCharPos, mostRecentTriggerCharPos + 1);
970
+ var firstSnippetChar = currentTriggerSnippet.substring(0, 1);
971
+ var leadingSpace = currentTriggerSnippet.length > 0 && (firstSnippetChar === ' ' || firstSnippetChar === '\xA0');
972
+ if (hasTrailingSpace) {
973
+ currentTriggerSnippet = currentTriggerSnippet.trim();
974
+ }
975
+ if (!leadingSpace && (menuAlreadyActive || !/[\xA0\s]/g.test(currentTriggerSnippet))) {
976
+ return {
977
+ v: {
978
+ mentionPosition: mostRecentTriggerCharPos,
979
+ mentionText: currentTriggerSnippet,
980
+ mentionSelectedElement: selected,
981
+ mentionSelectedPath: path,
982
+ mentionSelectedOffset: offset,
983
+ mentionTriggerChar: triggerChar
984
+ }
985
+ };
986
+ }
987
+ }
988
+ }();
989
+
990
+ if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
991
+ }
992
+ }
993
+ }, {
994
+ key: 'isContentEditable',
995
+ value: function isContentEditable(element) {
996
+ return element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA';
997
+ }
998
+ }, {
999
+ key: 'getTextAreaOrInputUnderlinePosition',
1000
+ value: function getTextAreaOrInputUnderlinePosition(element, position) {
1001
+ var properties = ['direction', 'boxSizing', 'width', 'height', 'overflowX', 'overflowY', 'borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'fontStyle', 'fontVariant', 'fontWeight', 'fontStretch', 'fontSize', 'fontSizeAdjust', 'lineHeight', 'fontFamily', 'textAlign', 'textTransform', 'textIndent', 'textDecoration', 'letterSpacing', 'wordSpacing'];
1002
+
1003
+ var isFirefox = window.mozInnerScreenX !== null;
1004
+
1005
+ var div = this.getDocument().createElement('div');
1006
+ div.id = 'input-textarea-caret-position-mirror-div';
1007
+ this.getDocument().body.appendChild(div);
1008
+
1009
+ var style = div.style;
1010
+ var computed = window.getComputedStyle ? getComputedStyle(element) : element.currentStyle;
1011
+
1012
+ style.whiteSpace = 'pre-wrap';
1013
+ if (element.nodeName !== 'INPUT') {
1014
+ style.wordWrap = 'break-word';
1015
+ }
1016
+
1017
+ // position off-screen
1018
+ style.position = 'absolute';
1019
+ style.visibility = 'hidden';
1020
+
1021
+ // transfer the element's properties to the div
1022
+ properties.forEach(function (prop) {
1023
+ style[prop] = computed[prop];
1024
+ });
1025
+
1026
+ if (isFirefox) {
1027
+ style.width = parseInt(computed.width) - 2 + 'px';
1028
+ if (element.scrollHeight > parseInt(computed.height)) style.overflowY = 'scroll';
1029
+ } else {
1030
+ style.overflow = 'hidden';
1031
+ }
1032
+
1033
+ div.textContent = element.value.substring(0, position);
1034
+
1035
+ if (element.nodeName === 'INPUT') {
1036
+ div.textContent = div.textContent.replace(/\s/g, ' ');
1037
+ }
1038
+
1039
+ var span = this.getDocument().createElement('span');
1040
+ span.textContent = element.value.substring(position) || '.';
1041
+ div.appendChild(span);
1042
+
1043
+ var rect = element.getBoundingClientRect();
1044
+ var doc = document.documentElement;
1045
+ var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
1046
+ var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
1047
+
1048
+ var coordinates = {
1049
+ top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize),
1050
+ left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth)
1051
+ };
1052
+
1053
+ this.getDocument().body.removeChild(div);
1054
+
1055
+ return coordinates;
1056
+ }
1057
+ }, {
1058
+ key: 'getContentEditableCaretPosition',
1059
+ value: function getContentEditableCaretPosition(selectedNodePosition) {
1060
+ var markerTextChar = '';
1061
+ var markerEl = void 0,
1062
+ markerId = 'sel_' + new Date().getTime() + '_' + Math.random().toString().substr(2);
1063
+ var range = void 0;
1064
+ var sel = this.getWindowSelection();
1065
+ var prevRange = sel.getRangeAt(0);
1066
+
1067
+ range = this.getDocument().createRange();
1068
+ range.setStart(sel.anchorNode, selectedNodePosition);
1069
+ range.setEnd(sel.anchorNode, selectedNodePosition);
1070
+
1071
+ range.collapse(false);
1072
+
1073
+ // Create the marker element containing a single invisible character using DOM methods and insert it
1074
+ markerEl = this.getDocument().createElement('span');
1075
+ markerEl.id = markerId;
1076
+ markerEl.appendChild(this.getDocument().createTextNode(markerTextChar));
1077
+ range.insertNode(markerEl);
1078
+ sel.removeAllRanges();
1079
+ sel.addRange(prevRange);
1080
+
1081
+ var rect = markerEl.getBoundingClientRect();
1082
+ var doc = document.documentElement;
1083
+ var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
1084
+ var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
1085
+ var coordinates = {
1086
+ left: rect.left + windowLeft,
1087
+ top: rect.top + markerEl.offsetHeight + windowTop
1088
+ };
1089
+
1090
+ markerEl.parentNode.removeChild(markerEl);
1091
+ return coordinates;
1092
+ }
1093
+ }, {
1094
+ key: 'scrollIntoView',
1095
+ value: function scrollIntoView(elem) {
1096
+ var reasonableBuffer = 20,
1097
+ clientRect = void 0;
1098
+ var maxScrollDisplacement = 100;
1099
+ var e = elem;
1100
+
1101
+ while (clientRect === undefined || clientRect.height === 0) {
1102
+ clientRect = e.getBoundingClientRect();
1103
+
1104
+ if (clientRect.height === 0) {
1105
+ e = e.childNodes[0];
1106
+ if (e === undefined || !e.getBoundingClientRect) {
1107
+ return;
1108
+ }
1109
+ }
1110
+ }
1111
+
1112
+ var elemTop = clientRect.top;
1113
+ var elemBottom = elemTop + clientRect.height;
1114
+
1115
+ if (elemTop < 0) {
1116
+ window.scrollTo(0, window.pageYOffset + clientRect.top - reasonableBuffer);
1117
+ } else if (elemBottom > window.innerHeight) {
1118
+ var maxY = window.pageYOffset + clientRect.top - reasonableBuffer;
1119
+
1120
+ if (maxY - window.pageYOffset > maxScrollDisplacement) {
1121
+ maxY = window.pageYOffset + maxScrollDisplacement;
1122
+ }
1123
+
1124
+ var targetY = window.pageYOffset - (window.innerHeight - elemBottom);
1125
+
1126
+ if (targetY > maxY) {
1127
+ targetY = maxY;
1128
+ }
1129
+
1130
+ window.scrollTo(0, targetY);
1131
+ }
1132
+ }
1133
+ }]);
1134
+
1135
+ return TributeRange;
1136
+ }();
1137
+
1138
+ exports.default = TributeRange;
1139
+ module.exports = exports['default'];
1140
+
1141
+ },{}],5:[function(require,module,exports){
1142
+ 'use strict';
1143
+
1144
+ Object.defineProperty(exports, "__esModule", {
1145
+ value: true
1146
+ });
1147
+
1148
+ var _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; }; }();
1149
+
1150
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1151
+
1152
+ // Thanks to https://github.com/mattyork/fuzzy
1153
+
1154
+ var TributeSearch = function () {
1155
+ function TributeSearch(tribute) {
1156
+ _classCallCheck(this, TributeSearch);
1157
+
1158
+ this.tribute = tribute;
1159
+ this.tribute.search = this;
1160
+ }
1161
+
1162
+ _createClass(TributeSearch, [{
1163
+ key: 'simpleFilter',
1164
+ value: function simpleFilter(pattern, array) {
1165
+ var _this = this;
1166
+
1167
+ return array.filter(function (string) {
1168
+ return _this.test(pattern, string);
1169
+ });
1170
+ }
1171
+ }, {
1172
+ key: 'test',
1173
+ value: function test(pattern, string) {
1174
+ return this.match(pattern, string) !== null;
1175
+ }
1176
+ }, {
1177
+ key: 'match',
1178
+ value: function match(pattern, string, opts) {
1179
+ opts = opts || {};
1180
+ var patternIdx = 0,
1181
+ result = [],
1182
+ len = string.length,
1183
+ totalScore = 0,
1184
+ currScore = 0,
1185
+ pre = opts.pre || '',
1186
+ post = opts.post || '',
1187
+ compareString = opts.caseSensitive && string || string.toLowerCase(),
1188
+ ch = void 0,
1189
+ compareChar = void 0;
1190
+
1191
+ pattern = opts.caseSensitive && pattern || pattern.toLowerCase();
1192
+
1193
+ var patternCache = this.traverse(compareString, pattern, 0, 0, []);
1194
+ if (!patternCache) {
1195
+ return null;
1196
+ }
1197
+
1198
+ return {
1199
+ rendered: this.render(string, patternCache.cache, pre, post),
1200
+ score: patternCache.score
1201
+ };
1202
+ }
1203
+ }, {
1204
+ key: 'traverse',
1205
+ value: function traverse(string, pattern, stringIndex, patternIndex, patternCache) {
1206
+ // if the pattern search at end
1207
+ if (pattern.length === patternIndex) {
1208
+
1209
+ // calculate socre and copy the cache containing the indices where it's found
1210
+ return {
1211
+ score: this.calculateScore(patternCache),
1212
+ cache: patternCache.slice()
1213
+ };
1214
+ }
1215
+
1216
+ // if string at end or remaining pattern > remaining string
1217
+ if (string.length === stringIndex || pattern.length - patternIndex > string.length - stringIndex) {
1218
+ return undefined;
1219
+ }
1220
+
1221
+ var c = pattern[patternIndex];
1222
+ var index = string.indexOf(c, stringIndex);
1223
+ var best = void 0,
1224
+ temp = void 0;
1225
+
1226
+ while (index > -1) {
1227
+ patternCache.push(index);
1228
+ temp = this.traverse(string, pattern, index + 1, patternIndex + 1, patternCache);
1229
+ patternCache.pop();
1230
+
1231
+ // if downstream traversal failed, return best answer so far
1232
+ if (!temp) {
1233
+ return best;
1234
+ }
1235
+
1236
+ if (!best || best.score < temp.score) {
1237
+ best = temp;
1238
+ }
1239
+
1240
+ index = string.indexOf(c, index + 1);
1241
+ }
1242
+
1243
+ return best;
1244
+ }
1245
+ }, {
1246
+ key: 'calculateScore',
1247
+ value: function calculateScore(patternCache) {
1248
+ var score = 0;
1249
+ var temp = 1;
1250
+
1251
+ patternCache.forEach(function (index, i) {
1252
+ if (i > 0) {
1253
+ if (patternCache[i - 1] + 1 === index) {
1254
+ temp += temp + 1;
1255
+ } else {
1256
+ temp = 1;
1257
+ }
1258
+ }
1259
+
1260
+ score += temp;
1261
+ });
1262
+
1263
+ return score;
1264
+ }
1265
+ }, {
1266
+ key: 'render',
1267
+ value: function render(string, indices, pre, post) {
1268
+ var rendered = string.substring(0, indices[0]);
1269
+
1270
+ indices.forEach(function (index, i) {
1271
+ rendered += pre + string[index] + post + string.substring(index + 1, indices[i + 1] ? indices[i + 1] : string.length);
1272
+ });
1273
+
1274
+ return rendered;
1275
+ }
1276
+ }, {
1277
+ key: 'filter',
1278
+ value: function filter(pattern, arr, opts) {
1279
+ var _this2 = this;
1280
+
1281
+ opts = opts || {};
1282
+ return arr.reduce(function (prev, element, idx, arr) {
1283
+ var str = element;
1284
+
1285
+ if (opts.extract) {
1286
+ str = opts.extract(element);
1287
+
1288
+ if (!str) {
1289
+ // take care of undefineds / nulls / etc.
1290
+ str = '';
1291
+ }
1292
+ }
1293
+
1294
+ var rendered = _this2.match(pattern, str, opts);
1295
+
1296
+ if (rendered != null) {
1297
+ prev[prev.length] = {
1298
+ string: rendered.rendered,
1299
+ score: rendered.score,
1300
+ index: idx,
1301
+ original: element
1302
+ };
1303
+ }
1304
+
1305
+ return prev;
1306
+ }, []).sort(function (a, b) {
1307
+ var compare = b.score - a.score;
1308
+ if (compare) return compare;
1309
+ return a.index - b.index;
1310
+ });
1311
+ }
1312
+ }]);
1313
+
1314
+ return TributeSearch;
1315
+ }();
1316
+
1317
+ exports.default = TributeSearch;
1318
+ module.exports = exports['default'];
1319
+
1320
+ },{}],6:[function(require,module,exports){
1321
+ "use strict";
1322
+
1323
+ Object.defineProperty(exports, "__esModule", {
1324
+ value: true
1325
+ });
1326
+
1327
+ var _Tribute = require("./Tribute");
1328
+
1329
+ var _Tribute2 = _interopRequireDefault(_Tribute);
1330
+
1331
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1332
+
1333
+ exports.default = _Tribute2.default; /**
1334
+ * Tribute.js
1335
+ * Native ES6 JavaScript @mention Plugin
1336
+ **/
1337
+
1338
+ module.exports = exports["default"];
1339
+
1340
+ },{"./Tribute":1}],7:[function(require,module,exports){
1341
+ 'use strict';
1342
+
1343
+ if (!Array.prototype.find) {
1344
+ Array.prototype.find = function (predicate) {
1345
+ if (this === null) {
1346
+ throw new TypeError('Array.prototype.find called on null or undefined');
1347
+ }
1348
+ if (typeof predicate !== 'function') {
1349
+ throw new TypeError('predicate must be a function');
1350
+ }
1351
+ var list = Object(this);
1352
+ var length = list.length >>> 0;
1353
+ var thisArg = arguments[1];
1354
+ var value;
1355
+
1356
+ for (var i = 0; i < length; i++) {
1357
+ value = list[i];
1358
+ if (predicate.call(thisArg, value, i, list)) {
1359
+ return value;
1360
+ }
1361
+ }
1362
+ return undefined;
1363
+ };
1364
+ }
1365
+
1366
+ (function () {
1367
+
1368
+ if (typeof window.CustomEvent === "function") return false;
1369
+
1370
+ function CustomEvent(event, params) {
1371
+ params = params || {
1372
+ bubbles: false,
1373
+ cancelable: false,
1374
+ detail: undefined
1375
+ };
1376
+ var evt = document.createEvent('CustomEvent');
1377
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
1378
+ return evt;
1379
+ }
1380
+
1381
+ CustomEvent.prototype = window.Event.prototype;
1382
+
1383
+ window.CustomEvent = CustomEvent;
1384
+ })();
1385
+
1386
+ },{}]},{},[6])(6)
1387
+ });
1388
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvVHJpYnV0ZS5qcyIsInNyYy9UcmlidXRlRXZlbnRzLmpzIiwic3JjL1RyaWJ1dGVNZW51RXZlbnRzLmpzIiwic3JjL1RyaWJ1dGVSYW5nZS5qcyIsInNyYy9UcmlidXRlU2VhcmNoLmpzIiwic3JjL2luZGV4LmpzIiwic3JjL3V0aWxzLmpzIl0sIm5hbWVzIjpbXSw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50IHRvIGluc2VydFxuICAgICAgICAgICAgICAgIHNlbGVjdFRlbXBsYXRlOiAoc2VsZWN0VGVtcGxhdGUgfHwgVHJpYnV0ZS5kZWZhdWx0U2VsZWN0VGVtcGxhdGUpLmJpbmQodGhpcyksXG5cbiAgICAgICAgICAgICAgICAvLyBmdW5jdGlvbiBjYWxsZWQgdGhhdCByZXR1cm5zIGNvbnRlbnQgZm9yIGFuIGl0ZW1cbiAgICAgICAgICAgICAgICBtZW51SXRlbVRlbXBsYXRlOiAobWVudUl0ZW1UZW1wbGF0ZSB8fCBUcmlidXRlLmRlZmF1bHRNZW51SXRlbVRlbXBsYXRlKS5iaW5kKHRoaXMpLFxuXG4gICAgICAgICAgICAgICAgLy8gZnVuY3Rpb24gY2FsbGVkIHdoZW4gbWVudSBpcyBlbXB0eSwgZGlzYWJsZXMgaGlkaW5nIG9mIG1lbnUuXG4gICAgICAgICAgICAgICAgbm9NYXRjaFRlbXBsYXRlOiAodCA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdCA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYmluZCh0aGlzKVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGxcbiAgICAgICAgICAgICAgICB9KShub01hdGNoVGVtcGxhdGUpLFxuXG4gICAgICAgICAgICAgICAgLy8gY29sdW1uIHRvIHNlYXJjaCBhZ2FpbnN0IGluIHRoZSBvYmplY3RcbiAgICAgICAgICAgICAgICBsb29rdXA6IGxvb2t1cCxcblxuICAgICAgICAgICAgICAgIC8vIGNvbHVtbiB0aGF0IGNvbnRhaW5zIHRoZSBjb250ZW50IHRvIGluc2VydCBieSBkZWZhdWx0XG4gICAgICAgICAgICAgICAgZmlsbEF0dHI6IGZpbGxBdHRyLFxuXG4gICAgICAgICAgICAgICAgLy8gYXJyYXkgb2Ygb2JqZWN0c1xuICAg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5ub2RlTmFtZSlcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMuZW5zdXJlRWRpdGFibGUoZWwpXG4gICAgICAgIHRoaXMuZXZlbnRzLmJpbmQoZWwpXG4gICAgICAgIGVsLnNldEF0dHJpYnV0ZSgnZGF0YS10cmlidXRlJywgdHJ1ZSlcbiAgICB9XG5cbiAgICBlbnN1cmVFZGl0YWJsZShlbGVtZW50KSB7XG4gICAgICAgIGlmIChUcmlidXRlLmlucHV0VHlwZXMoKS5pbmRleE9mKGVsZW1lbnQubm9kZU5hbWUpID09PSAtMSkge1xuICAgICAgICAgICAgaWYgKGVsZW1lbnQuY29udGVudEVkaXRhYmxlKSB7XG4gICAgICAgICAgICAgICAgZWxlbWVudC5jb250ZW50RWRpdGFibGUgPSB0cnVlXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tUcmlidXRlXSBDYW5ub3QgYmluZCB0byAnICsgZWxlbWVudC5ub2RlTmFtZSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNyZWF0ZU1lbnUoKSB7XG4gICAgICAgIGxldCB3cmFwcGVyID0gdGhpcy5yYW5nZS5nZXREb2N1bWVudCgpLmNyZWF0ZUVsZW1lbnQoJ2RpdicpLFxuICAgICAgICAgICAgdWwgPSB0aGlzLnJhbmdlLmdldERvY3VtZW50KCkuY3JlYXRlRWxlbWVudCgndWwnKVxuXG4gICAgICAgIHdyYXBwZXIuY2xhc3NOYW1lID0gJ3RyaWJ1dGUtY29udGFpbmVyJ1xuICAgICAgICB3cmFwcGVyLmFwcGVuZENoaWxkKHVsKVxuXG4gICAgICAgIGlmICh0aGlzLm1lbnVDb250YWluZXIpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLm1lbnVDb250YWluZXIuYXBwZW5kQ2hpbGQod3JhcHBlcilcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB0aGlzLnJhbmdlLmdldERvY3VtZW50KCkuYm9keS5hcHBlbmRDaGlsZCh3cmFwcGVyKVxuICAgIH1cblxuICAgIHNob3dNZW51Rm9yKGVsZW1lbnQsIHNjcm9sbFRvKSB7XG4gICAgICAgIGxldCBpdGVtc1xuICAgICAgICAgICAgLy8gY3JlYXRlIHRoZSBtZW51IGlmIGl0IGRvZXNuJ3QgZXhpc3QuXG4gICAgICAgIGlmICghdGhpcy5tZW51KSB7XG4gICAgICAgICAgICB0aGlzLm1lbnUgPSB0aGlzLmNyZWF0ZU1lbnUoKVxuICAgICAgICAgICAgdGhpcy5tZW51RXZlbnRzLmJpbmQodGhpcy5tZW51KVxuICAgICAgICB9XG5cbiAgICAgICAgdGhpcy5pc0FjdGl2ZSA9IHRydWVcbiAgICAgICAgdGhpcy5tZW51U2VsZWN0ZWQgPSAwXG5cbiAgICAgICAgaWYgKCF0aGlzLmN1cnJlbnQubWVudGlvblRleHQpIHtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudC5tZW50aW9uVGV4dCA9ICcnXG4gICAgICAgIH1cblxuICAgICAgICBpdGVtcyA9IHRoaXMuc2VhcmNoLmZpbHRlcih0aGlzLmN1cnJlbnQubWVudGlvblRleHQsIHRoaXMuY3VycmVudC5jb2xsZWN0aW9uLnZhbHVlcywge1xuICAgICAgICAgICAgcHJlOiAnPHNwYW4+JyxcbiAgICAgICAgICAgIHBvc3Q6ICc8L3NwYW4+JyxcbiAgICAgICAgICAgIGV4dHJhY3Q6IChlbCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5jdXJyZW50LmNvbGxlY3Rpb24ubG9va3VwID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWxbdGhpcy5jdXJyZW50LmNvbGxlY3Rpb24ubG9va3VwXVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIHRoaXMuY3VycmVudC5jb2xsZWN0aW9uLmxvb2t1cCA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jdXJyZW50LmNvbGxlY3Rpb24ubG9va3VwKGVsKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignSW52YWxpZCBsb29rdXAgYXR0cmlidXRlLCBsb29rdXAgbXVzdCBiZSBzdHJpbmcgb3IgZnVuY3Rpb24uJylcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pXG5cbiAgICAgICAgdGhpcy5jdXJyZW50LmZpbHRlcmVkSXRlbXMgPSBpdGVtc1xuXG4gICAgICAgIGxldCB1bCA9IHRoaXMubWVudS5xdWVyeVNlbGVjdG9yKCd1bCcpXG5cbiAgICAgICAgaWYgKCFpdGVtcy5sZW5ndGgpIHtcbiAgICAgICAgICAgIGxldCBub01hdGNoRXZlbnQgPSBuZXcgQ3VzdG9tRXZlbnQoJ3RyaWJ1dGUtbm8tbWF0Y2gnLCB7IGRldGFpbDogdGhpcy5tZW51IH0pXG4gICAgICAgICAgICB0aGlzLmN1cnJlbnQuZWxlbWVudC5kaXNwYXRjaEV2ZW50KG5vTWF0Y2hFdmVudClcbiAgICAgICAgICAgIGlmICghdGhpcy5jdXJyZW50LmNvbGxlY3Rpb24ubm9NYXRjaFRlbXBsYXRlKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5oaWRlTWVudSgpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHVsLmlubmVySFRNTCA9IHRoaXMuY3VycmVudC5jb2xsZWN0aW9uLm5vTWF0Y2hUZW1wbGF0ZSgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVyblxuICAgICAgICB9XG5cbiAgICAgICAgdWwuaW5uZXJIVE1MID0gJydcblxuICAgICAgICBpdGVtcy5mb3JFYWNoKChpdGVtLCBpbmRleCkgPT4ge1xuICAgICAgICAgICAgbGV0IGxpID0gdGhpcy5yYW5nZS5nZXREb2N1bWVudCgpLmNyZWF0ZUVsZW1lbnQoJ2xpJylcbiAgICAgICAgICAgIGxpLnNldEF0dHJpYnV0ZSgnZGF0YS1pbmRleCcsIGluZGV4KVxuICAgICAgICAgICAgaWYgKHRoaXMubWVudVNlbGVjdGVkID09PSBpbmRleCkge1xuICAgICAgICAgICAgICAgIGxpLmNsYXNzTmFtZSA9IHRoaXMuY3VycmVudC5jb2xsZWN0aW9uLnNlbGVjdENsYXNzXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsaS5pbm5lckhUTUwgPSB0aGlzLmN1cnJlbnQuY29sbGVjdGlvbi5tZW51SXRlbVRlbXBsYXRlKGl0ZW0pXG4gICAgICAgICAgICB1bC5hcHBlbmRDaGlsZChsaSlcbiAgICAgICAgfSlcblxuICAgICAgICB0aGlzLnJhbmdlLnBvc2l0aW9uTWVudUF0Q2FyZXQoc2Nyb2xsVG8pXG5cbiAgICB9XG5cbiAgICBoaWRlTWVudSgpIHtcbiAgICAgICAgaWYgKHRoaXMubWVudSkge1xuICAgICAgICAgICAgdGhpcy5tZW51LnN0eWxlLmNzc1RleHQgPSAnZGlzcGxheTogbm9uZTsnXG4gICAgICAgICAgICB0aGlzLmlzQWN0aXZlID0gZmFsc2VcbiAgICAgICAgICAgIHRoaXMubWVudVNlbGVjdGVkID0gMFxuICAgICAgICAgICAgdGhpcy5jdXJyZW50ID0ge31cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNlbGVjdEl0ZW1BdEluZGV4KGluZGV4KSB7XG4gICAgICAgIGluZGV4ID0gcGFyc2VJbnQoaW5kZXgpXG4gICAgICAgIGlmICh0eXBlb2YgaW5kZXggIT09ICdudW1iZXInKSByZXR1cm5cbiAgICAgICAgbGV0IGl0ZW0gPSB0aGlzLmN1cnJlbnQuZmlsdGVyZWRJdGVtc1tpbmRleF1cbiAgICAgICAgbGV0IGNvbnRlbnQgPSB0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XJyZW50LmNvbGxlY3Rpb24sIG5ld1ZhbHVlcywgcmVwbGFjZSlcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignTm8gYWN0aXZlIHN0YXRlLiBQbGVhc2UgdXNlIGFwcGVuZCBpbnN0ZWFkIGFuZCBwYXNzIGFuIGluZGV4LicpXG4gICAgICAgIH1cbiAgICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFRyaWJ1dGU7XG4iLCJjbGFzcyBUcmlidXRlRXZlbnRzIHtcbiAgICBjb25zdHJ1Y3Rvcih0cmlidXRlKSB7XG4gICAgICAgIHRoaXMudHJpYnV0ZSA9IHRyaWJ1dGVcbiAgICAgICAgdGhpcy50cmlidXRlLmV2ZW50cyA9IHRoaXNcbiAgICB9XG5cbiAgICBzdGF0aWMga2V5cygpIHtcbiAgICAgICAgcmV0dXJuIFt7XG4gICAgICAgICAgICBrZXk6IDksXG4gICAgICAgICAgICB2YWx1ZTogJ1RBQidcbiAgICAgICAgfSwge1xuICAgICAgICAgICAga2V5OiA4LFxuICAgICAgICAgICAgdmFsdWU6ICdERUxFVEUnXG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIGtleTogMTMsXG4gICAgICAgICAgICB2YWx1ZTogJ0VOVEVSJ1xuICAgICAgICB9LCB7XG4gICAgICAgICAgICBrZXk6IDI3LFxuICAgICAgICAgICAgdmFsdWU6ICdFU0NBUEUnXG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIGtleTogMzgsXG4gICAgICAgICAgICB2YWx1ZTogJ1VQJ1xuICAgICAgICB9LCB7XG4gICAgICAgICAgICBrZXk6IDQwLFxuICAgICAgICAgICAgdmFsdWU6ICdET1dOJ1xuICAgICAgICB9XVxuICAgIH1cblxuICAgIGJpbmQoZWxlbWVudCkge1xuICAgICAgICBlbGVtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2tleWRvd24nLFxuICAgICAgICAgICAgdGhpcy5rZXlkb3duLmJp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biAgICAgICAgbGV0IHRyaWJ1dGUgPSBpbnN0YW5jZS50cmlidXRlXG5cbiAgICAgICAgaWYgKHRyaWJ1dGUubWVudSAmJiB0cmlidXRlLm1lbnUuY29udGFpbnMoZXZlbnQudGFyZ2V0KSkge1xuICAgICAgICAgICAgbGV0IGxpID0gZXZlbnQudGFyZ2V0XG4gICAgICAgICAgICB3aGlsZSAobGkubm9kZU5hbWUudG9Mb3dlckNhc2UoKSAhPT0gJ2xpJykge1xuICAgICAgICAgICAgICAgIGxpID0gbGkucGFyZW50Tm9kZVxuICAgICAgICAgICAgICAgIGlmICghbGkgfHwgbGkgPT09IHRyaWJ1dGUubWVudSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ2Nhbm5vdCBmaW5kIHRoZSA8bGk+IGNvbnRhaW5lciBmb3IgdGhlIGNsaWNrJylcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0cmlidXRlLnNlbGVjdEl0ZW1BdEluZGV4KGxpLmdldEF0dHJpYnV0ZSgnZGF0YS1pbmRleCcpKVxuICAgICAgICAgICAgdHJpYnV0ZS5oaWRlTWVudSgpXG4gICAgICAgIH0gZWxzZSBpZiAodHJpYnV0ZS5jdXJyZW50LmVsZW1lbnQpIHtcbiAgICAgICAgICAgIHRyaWJ1dGUuaGlkZU1lbnUoKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAga2V5dXAoaW5zdGFuY2UsIGV2ZW50KSB7XG4gICAgICAgIGlmIChpbnN0YW5jZS5pbnB1dEV2ZW50KSB7XG4gICAgICAgICAgICBpbnN0YW5jZS5pbnB1dEV2ZW50ID0gZmFsc2VcbiAgICAgICAgfVxuICAgICAgICBpbnN0YW5jZS51cGRhdGVTZWxlY3Rpb24odGhpcylcblxuICAgICAgICBpZiAoZXZlbnQua2V5Q29kZSA9PT0gMjcpIHJldHVyblxuXG4gICAgICAgIGlmICghaW5zdGFuY2UudHJpYnV0ZS5pc0FjdGl2ZSkge1xuICAgICAgICAgICAgbGV0IGtleUNvZGUgPSBpbnN0YW5jZS5nZXRLZXlDb2RlKGluc3RhbmNlLCB0aGlzLCBldmVudClcblxuICAgICAgICAgICAgaWYgKGlzTmFOKGtleUNvZGUpKSByZXR1cm5cblxuICAgICAgICAgICAgbGV0IHRyaWdnZXIgPSBpbnN0YW5jZS50cmlidXRlLnRyaWdnZXJzKCkuZmluZCh0cmlnZ2VyID0+IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJpZ2dlci5jaGFyQ29kZUF0KDApID09PSBrZXlDb2RlXG4gICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICBpZiAodHlwZW9mIHRyaWdnZXIgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgaW5zdGFuY2UuY2FsbGJhY2tzKCkudHJpZ2dlckNoYXIoZXZlbnQsIHRoaXMsIHRyaWdnZXIpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaW5zdGFuY2UudHJpYnV0ZS5jdXJyZW50LnRyaWdnZXIgJiYgaW5zdGFuY2UuY29tbWFuZEV2ZW50ID09PSBmYWxzZVxuICAgICAgICAgICAgfHwgaW5zdGFuY2UudHJpYnV0ZS5pc0FjdGl2ZSAmJiBldmVudC5rZXlDb2RlID09PSA4KSB7XG4gICAgICAgICAgICBpbnN0YW5jZS50cmlidXRlLnNob3dNZW51Rm9yKHRoaXMsIHRydWUpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBzaG91bGREZWFjdGl2YXRlKGV2ZW50KSB7XG4gICAgICAgIGlmICghdGhpcy50cmlidXRlLmlzQWN0aXZlKSByZXR1cm4gZmFsc2VcblxuICAgICAgICBpZiAodGhpcy50cmlidXRlLmN1cnJlbnQubWVudGlvblRleHQubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICBsZXQgZXZlbnRLZXlQcmVzc2VkID0gZmFsc2VcbiAgICAgICAgICAgIFRyaWJ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aGlkZU1lbnUoKVxuICAgICAgICAgICAgICAgICAgICB9LCAwKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBlc2NhcGU6IChlLCBlbCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLnRyaWJ1dGUuaXNBY3RpdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpXG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJpYnV0ZS5oaWRlTWVudSgpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHRhYjogKGUsIGVsKSA9PiB7XG4gICAgICAgICAgICAgICAgLy8gY2hvb3NlIGZpcnN0IG1hdGNoXG4gICAgICAgICAgICAgICAgdGhpcy5jYWxsYmFja3MoKS5lbnRlcihlLCBlbClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB1cDogKGUsIGVsKSA9PiB7XG4gICAgICAgICAgICAgICAgLy8gbmF2aWdhdGUgdXAgdWxcbiAgICAgICAgICAgICAgICBpZiAodGhpcy50cmlidXRlLmlzQWN0aXZlKSB7XG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKVxuICAgICAgICAgICAgICAgICAgICBsZXQgY291bnQgPSB0aGlzLnRyaWJ1dGUuY3VycmVudC5maWx0ZXJlZEl0ZW1zLmxlbmd0aCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdGVkID0gdGhpcy50cmlidXRlLm1lbnVTZWxlY3RlZFxuXG4gICAgICAgICAgICAgICAgICAgIGlmIChjb3VudCA+IHNlbGVjdGVkICYmIHNlbGVjdGVkID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50cmlidXRlLm1lbnVTZWxlY3RlZC0tXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRBY3RpdmVMaSgpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZG93bjogKGUsIGVsKSA9PiB7XG4gICAgICAgICAgICAgICAgLy8gbmF2aWdhdGUgZG93biB1bFxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnRyaWJ1dGUuaXNBY3RpdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpXG4gICAgICAgICAgICAgICAgICAgIGxldCBjb3VudCA9IHRoaXMudHJpYnV0ZS5jdXJyZW50LmZpbHRlcmVkSXRlbXMubGVuZ3RoIC0gMSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdGVkID0gdGhpcy50cmlidXRlLm1lbnVTZWxlY3RlZFxuXG4gICAgICAgICAgICAgICAgICAgIGlmIChjb3VudCA+IHNlbGVjdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnRyaWJ1dGUubWVudVNlbGVjdGVkKytcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNldEFjdGl2ZUxpKClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBkZWxldGU6IChlLCBlbCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLnRyaWJ1dGUuaXNBY3RpdmUgJiYgdGhpcy50cmlidXRlLmN1cnJlbnQubWVudGlvblRleHQubGVuZ3RoIDwgMSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyaWJ1dGUuaGlkZU1lbnUoKVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodGhpcy50cmlidXRlLmlzQWN0aXZlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudHJpYnV0ZS5zaG93TWVudUZvcihlbClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBzZXRBY3RpdmVMaShpbmRleCkge1xuICAgICAgICBsZXQgbGlzID0gdGhpcy50cmlidXRlLm1lbnUucXVlcnlTZWxlY3RvckFsbCgnbGknKSxcbiAgICAgICAgICAgIGxlbmd0aCA9IGxpcy5sZW5ndGggPj4+IDBcblxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICBsZXQgbGkgPSBsaXNbaV1cbiAgICAgICAgICAgIGlmIChpID09PSB0aGlzLnRyaWJ1dGUubWVudVNlbGVjdGVkKSB7XG4gICAgICAgICAgICAgICAgbGkuY2xhc3NOYW1lID0gdGhpcy50cmlidXRlLmN1cnJlbnQuY29sbGVjdGlvbi5zZWxlY3RDbGFzc1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBsaS5jbGFzc05hbWUgPSAnJ1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG59XG5cblxuZXhwb3J0IGRlZmF1bHQgVHJpYnV0ZUV2ZW50cztcbiIsImNsYXNzIFRyaWJ1dGVNZW51RXZlbnRzIHtcbiAgICBjb25zdHJ1Y3Rvcih0cmlidXRlKSB7XG4gICAgICAgIHRoaXMudHJpYnV0ZSA9IHRyaWJ1dGVcbiAgICAgICAgdGhpcy50cmlidXRlLm1lbnVFdmVudHMgPSB0aGlzXG4gICAgICAgIHRoaXMubWVudSA9IHRoaXMudHJpYnV0ZS5tZW51XG4gICAgfVxuXG4gICAgYmluZChtZW51KSB7XG4gICAgICAgIG1lbnUuYWRkRXZlbnRMaXN0ZW5lcigna2V5ZG93bicsXG4gICAgICAgICAgICB0aGlzLnRyaWJ1dGUuZXZlbnRzLmtleWRvd24uYmluZCh0aGlzLm1lbnUsIHRoaXMpLCBmYWxzZSlcbiAgICAgICAgdGhpcy50cmlidXRlLnJhbmdlLmdldERvY3VtZW50KCkuYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLFxuICAgICAgICAgICAgdGhpcy50cmlidXRlLmV2ZW50cy5jbGljay5iaW5kKG51bGwsIHRoaXMpLCBmYWxzZSlcbiAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ3Jlc2l6ZScsIHRoaXMuZGVib3VuY2UoKCkgPT4ge1xuICAgICAgICAgICAgaWYgKHRoaXMudHJpYnV0ZS5pc0FjdGl2ZSkge1xuICAgICAgICAgICAgICAgIHRoaXMudHJpYnV0ZS5zaG93TWVudUZvcih0aGlzLnRyaWJ1dGUuY3VycmVudC5lbGVtZW50LCB0cnVlKVxuICAgICAgICAgICAgfVxuICAgICAgICB9LCAzMDAsIGZhbHNlKSlcblxuICAgICAgICBpZiAodGhpcy5tZW51Q29udGFpbmVyKSB7XG4gICAgICAgICAgICB0aGlzLm1lbnVDb250YWluZXIuYWRkRXZlbnRMaXN0ZW5lcignc2Nyb2xsJywgdGhpcy5kZWJvdW5jZSgoKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMudHJpYnV0ZS5pc0FjdGl2ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyaWJ1dGUuc2hvd01lbnVGb3IodGhpcy50cmlidXRlLmN1cnJlbnQuZWxlbWVudCwgZmFsc2UpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSwgMzAwLCBmYWxzZSksIGZhbHNlKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgd2luZG93Lm9uc2Nyb2xsID0gdGhpcy5kZWJvdW5jZSgoKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMudHJpYnV0ZS5pc0FjdGl2ZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyaWJ1dGUuc2hvd01lbnVGb3IodGhpcy50cmlidXRlLmN1cnJlbnQuZWxlbWVudCwgZmFsc2UpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSwgMzAwLCBmYWxzZSlcbiAgICAgICAgfVxuXG4gICAgfVxuXG4gICAgZGVib3VuY2UoZnVuYywgd2FpdCwgaW1tZWRpYXRlKSB7XG4gICAgICAgIHZhciB0aW1lb3V0XG4gICAgICAgIHJldHVybiAoKSA9PiB7XG4gICAgICAgICAgICB2YXIgY29udGV4dCA9IHRoaXMsXG4gICAgICAgICAgICAgICAgYXJncyA9IGFyZ3VtZW50c1xuICAgICAgICAgICAgdmFyIGxhdGVyID0gKCkgPT4ge1xuICAgICAgICAgICAgICAgIHRpbWVvdXQgPSBudWxsXG4gICAgICAgICAgICAgICAgaWYgKCFpbW1lZGlhdGUpIGZ1bmMuYXBwbHkoY29udGV4dCwgYXJncylcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBjYWxsTm93ID0gaW1tZWRpYXRlICYmICF0aW1lb3V0XG4gICAgICAgICAgICBjbGVhclRpbWVvdXQodGltZW91dClcbiAgICAgICAgICAgIHRpbWVvdXQgPSBzZXRUaW1lb3V0KGxhdGVyLCB3YWl0KVxuICAgICAgICAgICAgaWYgKGNhbGxOb3cpIGZ1bmMuYXBwbHkoY29udGV4dCwgYXJncylcbiAgICAgICAgfVxuICAgIH1cbn1cblxuXG5leHBvcnQgZGVmYXVsdCBUcmlidXRlTWVudUV2ZW50cztcbiIsIi8vIFRoYW5rcyB0byBodHRwczovL2dpdGh1Yi5jb20vamVmZi1jb2xsaW5zL21lbnQuaW9cbmNsYXNzIFRyaWJ1dGVSYW5nZSB7XG4gICAgY29uc3RydWN0b3IodHJpYnV0ZSkge1xuICAgICAgICB0aGlzLnRyaWJ1dGUgPSB0cmlidXRlXG4gICAgICAgIHRoaXMudHJpYnV0ZS5yYW5nZSA9IHRoaXNcbiAgICB9XG5cbiAgICBnZXREb2N1bWVudCgpIHtcbiAgICAgICAgbGV0IGlmcmFtZVxuICAgICAgICBpZiAodGhpcy50cmlidXRlLmN1cnJlbnQuY29sbGVjdGlvbikge1xuICAgICAgICAgICAgaWZyYW1lID0gdGhpcy50cmlidXRlLmN1cnJlbnQuY29sbGVjdGlvbi5pZnJhbWVcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghaWZyYW1lKSB7XG4gICAgICAgICAgICByZXR1cm4gZG9jdW1lbnRcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBpZnJhbWUuY29udGVudFdpbmRvdy5kb2N1bWVudFxuICAgIH1cblxuICAgIHBvc2l0aW9uTWVudUF0Q2FyZXQoc2Nyb2xsVG8pIHtcbiAgICAgICAgbGV0IGNvbnRleHQgPSB0aGlzLnRyaWJ1dGUuY3VycmVudCxcbiAgICAgICAgICAgIGNvb3JkaW5hdGVzXG4gICAgICAgIGxldCBpbmZvID0gdGhpcy5nZXRUcmlnZ2VySW5mbyhmYWxzZSwgZmFsc2UsIHRydWUpXG5cbiAgICAgICAgaWYgKGluZm8gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgaWYgKCF0aGlzLmlzQ29udGVudEVkaXRhYmxlKGNvbnRleHQuZWxlbWVudCkpIHtcbiAgICAgICAgICAgICAgICBjb29yZGluYXRlcyA9IHRoaXMuZ2V0VGV4dEFyZWFPcklucHV0VW5kZXJsaW5lUG9zaXRpb24odGhpcy5nZXREb2N1bWVudCgpLmFjdGl2ZUVsZW1lbnQsXG4gICAgICAgICAgICAgICAgICAgIGluZm8ubWVudGlvblBvc2l0aW9uKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgY29vcmRpbmF0ZXMgPSB0aGlzLmdldENvbnRlbnRFZGl0YWJsZUNhcmV0UG9zaXRpb24oaW5mby5tZW50aW9uUG9zaXRpb24pXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIE1vdmUgdGhlIGJ1dHRvbiBpbnRvIHBsYWNlLlxuICAgICAgICAgICAgdGhpcy50cmlidXRlLm1lbnUuc3R5bGUuY3NzVGV4dCA9IGB0b3A6ICR7Y29vcmRpbmF0ZXMudG9wfXB4O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVmdDogJHtjb29yZGluYXRlcy5sZWZ0fXB4O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekluZGV4OiAxMDAwMDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6IGJsb2NrO2BcblxuICAgICAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHNjcm9sbFRvKSB0aGlzLnNjcm9sbEludG9WaWV3KHRoaXMuZ2V0RG9jdW1lbnQoKS5hY3RpdmVFbGVtZW50KVxuICAgICAgICAgICAgfSwgMClcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMudHJpYnV0ZS5tZW51LnN0eWxlLmNzc1RleHQgPSAnZGlzcGxheTogbm9uZSdcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNlbGVjdEVsZW1lbnQodGFyZ2V0RWxlbWVudCwgcGF0aCwgb2Zmc2V0KSB7XG4gICAgICAgIGxldCByYW5nZVxuICAgICAgICBsZXQgZWxlbSA9IHRhcmdldEVsZW1lbnRcblxuICAgICAgICBpZiAocGF0aCkge1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBwYXRoLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgZWxlbSA9IGVsZW0uY2hpbGROb2Rlc1twYXRoW2ldXVxuICAgICAgICAgICAgICAgIGlmIChlbGVtID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHdoaWxlIChlbGVtLmxlbmd0aCA8IG9mZnNldCkge1xuICAgICAgICAgICAgICAgICAgICBvZmZzZXQgLT0gZWxlbS5sZW5ndGhcbiAgICAgICAgICAgICAgICAgICAgZWxlbSA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9zaXRpb25JblBhcmVudChlbGVtZW50KSB7XG4gICAgICAgIGlmIChlbGVtZW50LnBhcmVudE5vZGUgPT09IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiAwXG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGVsZW1lbnQucGFyZW50Tm9kZS5jaGlsZE5vZGVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICBsZXQgbm9kZSA9IGVsZW1lbnQucGFyZW50Tm9kZS5jaGlsZE5vZGVzW2ldXG5cbiAgICAgICAgICAgIGlmIChub2RlID09PSBlbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGdldENvbnRlbnRFZGl0YWJsZVNlbGVjdGVkUGF0aCgpIHtcbiAgICAgICAgLy8gY29udGVudCBlZGl0YWJsZVxuICAgICAgICBsZXQgc2VsID0gdGhpcy5nZXRXaW5kb3dTZWxlY3Rpb24oKVxuICAgICAgICBsZXQgc2VsZWN0ZWQgPSBzZWwuYW5jaG9yTm9kZVxuICAgICAgICBsZXQgcGF0aCA9IFtdXG4gICAgICAgIGxldCBvZmZzZXRcblxuICAgICAgICBpZiAoc2VsZWN0ZWQgIT0gbnVsbCkge1xuICAgICAgICAgICAgbGV0IGlcbiAgICAgICAgICAgIGxldCBjZSA9IHNlbGVjdGVkLmNvbnRlbnRFZGl0YWJsZVxuICAgICAgICAgICAgd2hpbGUgKHNlbGVjdGVkICE9PSBudWxsICYmIGNlICE9PSAndHJ1ZScpIHtcbiAgICAgICAgICAgICAgICBpID0gdGhpcy5nZXROb2RlUG9zaXRpb25JblBhcmVudChzZWxlY3RlZClcbiAgICAgICAgICAgICAgICBwYXRoLnB1c2goaSlcbiAgICAgICAgICAgICAgICBzZWxlY3RlZCA9IHNlbGVjdGVkLnBhcmVudE5vZGVcbiAgICAgICAgICAgICAgICBpZiAoc2VsZWN0ZWQgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgY2UgPSBzZWxlY3RlZC5jb250ZW50RWRpdGFibGVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwYXRoLnJldmVyc2UoKVxuXG4gICAgICAgICAgICAvLyBnZXRSYW5nZUF0IG1heSBub3QgZXhpc3QsIG5lZWQgYWx0ZXJuYXRpdmVcbiAgICAgICAgICAgIG9mZnNldCA9IHNlbC5nZXRSYW5nZUF0KDApLnN0YXJ0T2Zmc2V0XG5cbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgc2VsZWN0ZWQ6IHNlbGVjdGVkLFxuICAgICAgICAgICAgICAgIHBhdGg6IHBhdGgsXG4gICAgICAgICAgICAgICAgb2Zmc2V0OiBvZmZzZXRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGdldFRleHRQcmVjZWRpbmdDdXJyZW50U2VsZWN0aW9uKCkge1xuICAgICAgICBsZXQgY29udGV4dCA9IHRoaXMudHJpYnV0ZS5jdXJyZW50LFxuICAgICAgICAgICAgdGV4dFxuXG4gICAgICAgIGlmICghdGhpcy5pc0NvbnRlbnRFZGl0YWJsZShjb250ZXh0LmVsZW1lbnQpKSB7XG4gICAgICAgICAgICBsZXQgdGV4dENvbXBvbmVudCA9IHRoaXMuZ2V0RG9jdW1lbnQoKS5hY3RpdmVFbGVtZW50XG4gICAgICAgICAgICBsZXQgc3RhcnRQb3MgPSB0ZXh0Q29tcG9uZW50LnNlbGVjdGlvblN0YXJ0XG4gICAgICAgICAgICB0ZXh0ID0gdGV4dENvbXBvbmVudC52YWx1ZS5zdWJzdHJpbmcoMCwgc3RhcnRQb3MpXG5cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGxldCBzZWxlY3RlZEVsZW0gPSB0aGlzLmdldFdpbmRvd1NlbGVjdGlvbigpLmFuY2hvck5vZGVcblxuICAgICAgICA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ICAgICAgICAgICAgICAgL1tcXHhBMFxcc10vZy50ZXN0KFxuICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0aXZlUmFuZ2Uuc3Vic3RyaW5nKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vc3RSZWNlbnRUcmlnZ2VyQ2hhclBvcyAtIDEsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9zdFJlY2VudFRyaWdnZXJDaGFyUG9zKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRUcmlnZ2VyU25pcHBldCA9IGVmZmVjdGl2ZVJhbmdlLnN1YnN0cmluZyhtb3N0UmVjZW50VHJpZ2dlckNoYXJQb3MgKyAxLFxuICAgICAgICAgICAgICAgICAgICBlZmZlY3RpdmVSYW5nZS5sZW5ndGgpXG5cbiAgICAgICAgICAgICAgICB0cmlnZ2VyQ2hhciA9IGVmZmVjdGl2ZVJhbmdlLnN1YnN0cmluZyhtb3N0UmVjZW50VHJpZ2dlckNoYXJQb3MsIG1vc3RSZWNlbnRUcmlnZ2VyQ2hhclBvcyArIDEpXG4gICAgICAgICAgICAgICAgbGV0IGZpcnN0U25pcHBldENoYXIgPSBjdXJyZW50VHJpZ2dlclNuaXBwZXQuc3Vic3RyaW5nKDAsIDEpXG4gICAgICAgICAgICAgICAgbGV0IGxlYWRpbmdTcGFjZSA9IGN1cnJlbnRUcmlnZ2VyU25pcHBldC5sZW5ndGggPiAwICYmXG4gICAgICAgICAgICAgICAgICAgIChcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0U25pcHBldENoYXIgPT09ICcgJyB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RTbmlwcGV0Q2hhciA9PT0gJ1xceEEwJ1xuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgaWYgKGhhc1RyYWlsaW5nU3BhY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgY3VycmVudFRyaWdnZXJTbmlwcGV0ID0gY3VycmVudFRyaWdnZXJTbmlwcGV0LnRyaW0oKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIWxlYWRpbmdTcGFjZSAmJiAobWVudUFscmVhZHlBY3RpdmUgfHwgISgvW1xceEEwXFxzXS9nLnRlc3QoY3VycmVudFRyaWdnZXJTbmlwcGV0KSkpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZW50aW9uUG9zaXRpb246IG1vc3RSZWNlbnRUcmlnZ2VyQ2hhclBvcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lbnRpb25UZXh0OiBjdXJyZW50VHJpZ2dlclNuaXBwZXQsXG4gICAgICAgICAgICAgICAgICAgICAgICBtZW50aW9uU2VsZWN0ZWRFbGVtZW50OiBzZWxlY3RlZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lbnRpb25TZWxlY3RlZFBhdGg6IHBhdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICBtZW50aW9uU2VsZWN0ZWRPZmZzZXQ6IG9mZnNldCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lbnRpb25UcmlnZ2VyQ2hhcjogdHJpZ2dlckNoYXJcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGlzQ29udGVudEVkaXRhYmxlKGVsZW1lbnQpIHtcbiAgICAgICAgcmV0dXJuIGVsZW1lbnQubm9kZU5hbWUgIT09ICdJTlBVVCcgJiYgZWxlbWVudC5ub2RlTmFtZSAhPT0gJ1RFWFRBUkVBJ1xuICAgIH1cblxuICAgIGdldFRleHRBcmVhT3JJbnB1dFVuZGVybGluZVBvc2l0aW9uKGVsZW1lbnQsIHBvc2l0aW9uKSB7XG4gICAgICAg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XJuIGJlc3RcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCFiZXN0IHx8IGJlc3Quc2NvcmUgPCB0ZW1wLnNjb3JlKSB7XG4gICAgICAgICAgICAgICAgYmVzdCA9IHRlbXBcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaW5kZXggPSBzdHJpbmcuaW5kZXhPZihjLCBpbmRleCArIDEpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gYmVzdFxuICAgIH1cblxuICAgIGNhbGN1bGF0ZVNjb3JlKHBhdHRlcm5DYWNoZSkge1xuICAgICAgICBsZXQgc2NvcmUgPSAwXG4gICAgICAgIGxldCB0ZW1wID0gMVxuXG4gICAgICAgIHBhdHRlcm5DYWNoZS5mb3JFYWNoKChpbmRleCwgaSkgPT4ge1xuICAgICAgICAgICAgaWYgKGkgPiAwKSB7XG4gICAgICAgICAgICAgICAgaWYgKHBhdHRlcm5DYWNoZVtpIC0gMV0gKyAxID09PSBpbmRleCkge1xuICAgICAgICAgICAgICAgICAgICB0ZW1wICs9IHRlbXAgKyAxXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0ZW1wID0gMVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgc2NvcmUgKz0gdGVtcFxuICAgICAgICB9KVxuXG4gICAgICAgIHJldHVybiBzY29yZVxuICAgIH1cblxuICAgIHJlbmRlcihzdHJpbmcsIGluZGljZXMsIHByZSwgcG9zdCkge1xuICAgICAgICB2YXIgcmVuZGVyZWQgPSBzdHJpbmcuc3Vic3RyaW5nKDAsIGluZGljZXNbMF0pXG5cbiAgICAgICAgaW5kaWNlcy5mb3JFYWNoKChpbmRleCwgaSkgPT4ge1xuICAgICAgICAgICAgcmVuZGVyZWQgKz0gcHJlICsgc3RyaW5nW2luZGV4XSArIHBvc3QgK1xuICAgICAgICAgICAgICAgIHN0cmluZy5zdWJzdHJpbmcoaW5kZXggKyAxLCAoaW5kaWNlc1tpICsgMV0pID8gaW5kaWNlc1tpICsgMV0gOiBzdHJpbmcubGVuZ3RoKVxuICAgICAgICB9KVxuXG4gICAgICAgIHJldHVybiByZW5kZXJlZFxuICAgIH1cblxuICAgIGZpbHRlcihwYXR0ZXJuLCBhcnIsIG9wdHMpIHtcbiAgICAgICAgb3B0cyA9IG9wdHMgfHwge31cbiAgICAgICAgcmV0dXJuIGFyclxuICAgICAgICAgICAgLnJlZHVjZSgocHJldiwgZWxlbWVudCwgaWR4LCBhcnIpID0+IHtcbiAgICAgICAgICAgICAgICBsZXQgc3RyID0gZWxlbWVudFxuXG4gICAgICAgICAgICAgICAgaWYgKG9wdHMuZXh0cmFjdCkge1xuICAgICAgICAgICAgICAgICAgICBzdHIgPSBvcHRzLmV4dHJhY3QoZWxlbWVudClcblxuICAgICAgICAgICAgICAgICAgICBpZiAoIXN0cikgeyAvLyB0YWtlIGNhcmUgb2YgdW5kZWZpbmVkcyAvIG51bGxzIC8gZXRjLlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyID0gJydcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGxldCByZW5kZXJlZCA9IHRoaXMubWF0Y2gocGF0dGVybiwgc3RyLCBvcHRzKVxuXG4gICAgICAgICAgICAgICAgaWYgKHJlbmRlcmVkICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgcHJldltwcmV2Lmxlbmd0aF0gPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmc6IHJlbmRlcmVkLnJlbmRlcmVkLFxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmU6IHJlbmRlcmVkLnNjb3JlLFxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IGlkeCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG9yaWdpbmFsOiBlbGVtZW50XG4gICAgICAgICAgICAg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