wp/wp-includes/js/clipboard.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
     1 /*!
     1 /*!
     2  * clipboard.js v2.0.6
     2  * clipboard.js v2.0.8
     3  * https://clipboardjs.com/
     3  * https://clipboardjs.com/
     4  * 
     4  *
     5  * Licensed MIT © Zeno Rocha
     5  * Licensed MIT © Zeno Rocha
     6  */
     6  */
     7 (function webpackUniversalModuleDefinition(root, factory) {
     7 (function webpackUniversalModuleDefinition(root, factory) {
     8 	if(typeof exports === 'object' && typeof module === 'object')
     8 	if(typeof exports === 'object' && typeof module === 'object')
     9 		module.exports = factory();
     9 		module.exports = factory();
    12 	else if(typeof exports === 'object')
    12 	else if(typeof exports === 'object')
    13 		exports["ClipboardJS"] = factory();
    13 		exports["ClipboardJS"] = factory();
    14 	else
    14 	else
    15 		root["ClipboardJS"] = factory();
    15 		root["ClipboardJS"] = factory();
    16 })(this, function() {
    16 })(this, function() {
    17 return /******/ (function(modules) { // webpackBootstrap
    17 return /******/ (function() { // webpackBootstrap
    18 /******/ 	// The module cache
    18 /******/ 	var __webpack_modules__ = ({
    19 /******/ 	var installedModules = {};
    19 
    20 /******/
    20 /***/ 134:
    21 /******/ 	// The require function
    21 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
    22 /******/ 	function __webpack_require__(moduleId) {
    22 
    23 /******/
    23 "use strict";
    24 /******/ 		// Check if module is in cache
    24 
    25 /******/ 		if(installedModules[moduleId]) {
    25 // EXPORTS
    26 /******/ 			return installedModules[moduleId].exports;
    26 __webpack_require__.d(__webpack_exports__, {
    27 /******/ 		}
    27   "default": function() { return /* binding */ clipboard; }
    28 /******/ 		// Create a new module (and put it into the cache)
    28 });
    29 /******/ 		var module = installedModules[moduleId] = {
    29 
    30 /******/ 			i: moduleId,
    30 // EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
    31 /******/ 			l: false,
    31 var tiny_emitter = __webpack_require__(279);
    32 /******/ 			exports: {}
    32 var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);
    33 /******/ 		};
    33 // EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js
    34 /******/
    34 var listen = __webpack_require__(370);
    35 /******/ 		// Execute the module function
    35 var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
    36 /******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
    36 // EXTERNAL MODULE: ./node_modules/select/src/select.js
    37 /******/
    37 var src_select = __webpack_require__(817);
    38 /******/ 		// Flag the module as loaded
    38 var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
    39 /******/ 		module.l = true;
    39 ;// CONCATENATED MODULE: ./src/clipboard-action.js
    40 /******/
    40 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    41 /******/ 		// Return the exports of the module
    41 
    42 /******/ 		return module.exports;
    42 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    43 /******/ 	}
    43 
    44 /******/
    44 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); } }
    45 /******/
    45 
    46 /******/ 	// expose the modules object (__webpack_modules__)
    46 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    47 /******/ 	__webpack_require__.m = modules;
    47 
    48 /******/
    48 
    49 /******/ 	// expose the module cache
    49 /**
    50 /******/ 	__webpack_require__.c = installedModules;
    50  * Inner class which performs selection from either `text` or `target`
    51 /******/
    51  * properties and then executes copy or cut operations.
    52 /******/ 	// define getter function for harmony exports
    52  */
    53 /******/ 	__webpack_require__.d = function(exports, name, getter) {
    53 
    54 /******/ 		if(!__webpack_require__.o(exports, name)) {
    54 var ClipboardAction = /*#__PURE__*/function () {
    55 /******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
    55   /**
    56 /******/ 		}
    56    * @param {Object} options
    57 /******/ 	};
    57    */
    58 /******/
    58   function ClipboardAction(options) {
    59 /******/ 	// define __esModule on exports
    59     _classCallCheck(this, ClipboardAction);
    60 /******/ 	__webpack_require__.r = function(exports) {
    60 
    61 /******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    61     this.resolveOptions(options);
    62 /******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    62     this.initSelection();
    63 /******/ 		}
    63   }
    64 /******/ 		Object.defineProperty(exports, '__esModule', { value: true });
    64   /**
    65 /******/ 	};
    65    * Defines base properties passed from constructor.
    66 /******/
    66    * @param {Object} options
    67 /******/ 	// create a fake namespace object
    67    */
    68 /******/ 	// mode & 1: value is a module id, require it
    68 
    69 /******/ 	// mode & 2: merge all properties of value into the ns
    69 
    70 /******/ 	// mode & 4: return value when already ns object
    70   _createClass(ClipboardAction, [{
    71 /******/ 	// mode & 8|1: behave like require
    71     key: "resolveOptions",
    72 /******/ 	__webpack_require__.t = function(value, mode) {
    72     value: function resolveOptions() {
    73 /******/ 		if(mode & 1) value = __webpack_require__(value);
    73       var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    74 /******/ 		if(mode & 8) return value;
    74       this.action = options.action;
    75 /******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
    75       this.container = options.container;
    76 /******/ 		var ns = Object.create(null);
    76       this.emitter = options.emitter;
    77 /******/ 		__webpack_require__.r(ns);
    77       this.target = options.target;
    78 /******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
    78       this.text = options.text;
    79 /******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
    79       this.trigger = options.trigger;
    80 /******/ 		return ns;
    80       this.selectedText = '';
    81 /******/ 	};
    81     }
    82 /******/
    82     /**
    83 /******/ 	// getDefaultExport function for compatibility with non-harmony modules
    83      * Decides which selection strategy is going to be applied based
    84 /******/ 	__webpack_require__.n = function(module) {
    84      * on the existence of `text` and `target` properties.
    85 /******/ 		var getter = module && module.__esModule ?
    85      */
    86 /******/ 			function getDefault() { return module['default']; } :
    86 
    87 /******/ 			function getModuleExports() { return module; };
    87   }, {
    88 /******/ 		__webpack_require__.d(getter, 'a', getter);
    88     key: "initSelection",
    89 /******/ 		return getter;
    89     value: function initSelection() {
    90 /******/ 	};
    90       if (this.text) {
    91 /******/
    91         this.selectFake();
    92 /******/ 	// Object.prototype.hasOwnProperty.call
    92       } else if (this.target) {
    93 /******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
    93         this.selectTarget();
    94 /******/
    94       }
    95 /******/ 	// __webpack_public_path__
    95     }
    96 /******/ 	__webpack_require__.p = "";
    96     /**
    97 /******/
    97      * Creates a fake textarea element, sets its value from `text` property,
    98 /******/
    98      */
    99 /******/ 	// Load entry module and return exports
    99 
   100 /******/ 	return __webpack_require__(__webpack_require__.s = 6);
   100   }, {
   101 /******/ })
   101     key: "createFakeElement",
   102 /************************************************************************/
   102     value: function createFakeElement() {
   103 /******/ ([
   103       var isRTL = document.documentElement.getAttribute('dir') === 'rtl';
   104 /* 0 */
   104       this.fakeElem = document.createElement('textarea'); // Prevent zooming on iOS
   105 /***/ (function(module, exports) {
   105 
   106 
   106       this.fakeElem.style.fontSize = '12pt'; // Reset box model
   107 function select(element) {
   107 
   108     var selectedText;
   108       this.fakeElem.style.border = '0';
   109 
   109       this.fakeElem.style.padding = '0';
   110     if (element.nodeName === 'SELECT') {
   110       this.fakeElem.style.margin = '0'; // Move element out of screen horizontally
   111         element.focus();
   111 
   112 
   112       this.fakeElem.style.position = 'absolute';
   113         selectedText = element.value;
   113       this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically
   114     }
   114 
   115     else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
   115       var yPosition = window.pageYOffset || document.documentElement.scrollTop;
   116         var isReadOnly = element.hasAttribute('readonly');
   116       this.fakeElem.style.top = "".concat(yPosition, "px");
   117 
   117       this.fakeElem.setAttribute('readonly', '');
   118         if (!isReadOnly) {
   118       this.fakeElem.value = this.text;
   119             element.setAttribute('readonly', '');
   119       return this.fakeElem;
       
   120     }
       
   121     /**
       
   122      * Get's the value of fakeElem,
       
   123      * and makes a selection on it.
       
   124      */
       
   125 
       
   126   }, {
       
   127     key: "selectFake",
       
   128     value: function selectFake() {
       
   129       var _this = this;
       
   130 
       
   131       var fakeElem = this.createFakeElement();
       
   132 
       
   133       this.fakeHandlerCallback = function () {
       
   134         return _this.removeFake();
       
   135       };
       
   136 
       
   137       this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
       
   138       this.container.appendChild(fakeElem);
       
   139       this.selectedText = select_default()(fakeElem);
       
   140       this.copyText();
       
   141       this.removeFake();
       
   142     }
       
   143     /**
       
   144      * Only removes the fake element after another click event, that way
       
   145      * a user can hit `Ctrl+C` to copy because selection still exists.
       
   146      */
       
   147 
       
   148   }, {
       
   149     key: "removeFake",
       
   150     value: function removeFake() {
       
   151       if (this.fakeHandler) {
       
   152         this.container.removeEventListener('click', this.fakeHandlerCallback);
       
   153         this.fakeHandler = null;
       
   154         this.fakeHandlerCallback = null;
       
   155       }
       
   156 
       
   157       if (this.fakeElem) {
       
   158         this.container.removeChild(this.fakeElem);
       
   159         this.fakeElem = null;
       
   160       }
       
   161     }
       
   162     /**
       
   163      * Selects the content from element passed on `target` property.
       
   164      */
       
   165 
       
   166   }, {
       
   167     key: "selectTarget",
       
   168     value: function selectTarget() {
       
   169       this.selectedText = select_default()(this.target);
       
   170       this.copyText();
       
   171     }
       
   172     /**
       
   173      * Executes the copy operation based on the current selection.
       
   174      */
       
   175 
       
   176   }, {
       
   177     key: "copyText",
       
   178     value: function copyText() {
       
   179       var succeeded;
       
   180 
       
   181       try {
       
   182         succeeded = document.execCommand(this.action);
       
   183       } catch (err) {
       
   184         succeeded = false;
       
   185       }
       
   186 
       
   187       this.handleResult(succeeded);
       
   188     }
       
   189     /**
       
   190      * Fires an event based on the copy operation result.
       
   191      * @param {Boolean} succeeded
       
   192      */
       
   193 
       
   194   }, {
       
   195     key: "handleResult",
       
   196     value: function handleResult(succeeded) {
       
   197       this.emitter.emit(succeeded ? 'success' : 'error', {
       
   198         action: this.action,
       
   199         text: this.selectedText,
       
   200         trigger: this.trigger,
       
   201         clearSelection: this.clearSelection.bind(this)
       
   202       });
       
   203     }
       
   204     /**
       
   205      * Moves focus away from `target` and back to the trigger, removes current selection.
       
   206      */
       
   207 
       
   208   }, {
       
   209     key: "clearSelection",
       
   210     value: function clearSelection() {
       
   211       if (this.trigger) {
       
   212         this.trigger.focus();
       
   213       }
       
   214 
       
   215       document.activeElement.blur();
       
   216       window.getSelection().removeAllRanges();
       
   217     }
       
   218     /**
       
   219      * Sets the `action` to be performed which can be either 'copy' or 'cut'.
       
   220      * @param {String} action
       
   221      */
       
   222 
       
   223   }, {
       
   224     key: "destroy",
       
   225 
       
   226     /**
       
   227      * Destroy lifecycle.
       
   228      */
       
   229     value: function destroy() {
       
   230       this.removeFake();
       
   231     }
       
   232   }, {
       
   233     key: "action",
       
   234     set: function set() {
       
   235       var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
       
   236       this._action = action;
       
   237 
       
   238       if (this._action !== 'copy' && this._action !== 'cut') {
       
   239         throw new Error('Invalid "action" value, use either "copy" or "cut"');
       
   240       }
       
   241     }
       
   242     /**
       
   243      * Gets the `action` property.
       
   244      * @return {String}
       
   245      */
       
   246     ,
       
   247     get: function get() {
       
   248       return this._action;
       
   249     }
       
   250     /**
       
   251      * Sets the `target` property using an element
       
   252      * that will be have its content copied.
       
   253      * @param {Element} target
       
   254      */
       
   255 
       
   256   }, {
       
   257     key: "target",
       
   258     set: function set(target) {
       
   259       if (target !== undefined) {
       
   260         if (target && _typeof(target) === 'object' && target.nodeType === 1) {
       
   261           if (this.action === 'copy' && target.hasAttribute('disabled')) {
       
   262             throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
       
   263           }
       
   264 
       
   265           if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
       
   266             throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
       
   267           }
       
   268 
       
   269           this._target = target;
       
   270         } else {
       
   271           throw new Error('Invalid "target" value, use a valid Element');
   120         }
   272         }
   121 
   273       }
   122         element.select();
   274     }
   123         element.setSelectionRange(0, element.value.length);
   275     /**
   124 
   276      * Gets the `target` property.
   125         if (!isReadOnly) {
   277      * @return {String|HTMLElement}
   126             element.removeAttribute('readonly');
   278      */
   127         }
   279     ,
   128 
   280     get: function get() {
   129         selectedText = element.value;
   281       return this._target;
   130     }
   282     }
   131     else {
   283   }]);
   132         if (element.hasAttribute('contenteditable')) {
   284 
   133             element.focus();
   285   return ClipboardAction;
   134         }
   286 }();
   135 
   287 
   136         var selection = window.getSelection();
   288 /* harmony default export */ var clipboard_action = (ClipboardAction);
   137         var range = document.createRange();
   289 ;// CONCATENATED MODULE: ./src/clipboard.js
   138 
   290 function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); }
   139         range.selectNodeContents(element);
   291 
   140         selection.removeAllRanges();
   292 function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
   141         selection.addRange(range);
   293 
   142 
   294 function clipboard_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); } }
   143         selectedText = selection.toString();
   295 
   144     }
   296 function clipboard_createClass(Constructor, protoProps, staticProps) { if (protoProps) clipboard_defineProperties(Constructor.prototype, protoProps); if (staticProps) clipboard_defineProperties(Constructor, staticProps); return Constructor; }
   145 
   297 
   146     return selectedText;
   298 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
   147 }
   299 
   148 
   300 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
   149 module.exports = select;
   301 
   150 
   302 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
       
   303 
       
   304 function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
       
   305 
       
   306 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
       
   307 
       
   308 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
       
   309 
       
   310 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
       
   311 
       
   312 
       
   313 
       
   314 
       
   315 /**
       
   316  * Helper function to retrieve attribute value.
       
   317  * @param {String} suffix
       
   318  * @param {Element} element
       
   319  */
       
   320 
       
   321 function getAttributeValue(suffix, element) {
       
   322   var attribute = "data-clipboard-".concat(suffix);
       
   323 
       
   324   if (!element.hasAttribute(attribute)) {
       
   325     return;
       
   326   }
       
   327 
       
   328   return element.getAttribute(attribute);
       
   329 }
       
   330 /**
       
   331  * Base class which takes one or more elements, adds event listeners to them,
       
   332  * and instantiates a new `ClipboardAction` on each click.
       
   333  */
       
   334 
       
   335 
       
   336 var Clipboard = /*#__PURE__*/function (_Emitter) {
       
   337   _inherits(Clipboard, _Emitter);
       
   338 
       
   339   var _super = _createSuper(Clipboard);
       
   340 
       
   341   /**
       
   342    * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
       
   343    * @param {Object} options
       
   344    */
       
   345   function Clipboard(trigger, options) {
       
   346     var _this;
       
   347 
       
   348     clipboard_classCallCheck(this, Clipboard);
       
   349 
       
   350     _this = _super.call(this);
       
   351 
       
   352     _this.resolveOptions(options);
       
   353 
       
   354     _this.listenClick(trigger);
       
   355 
       
   356     return _this;
       
   357   }
       
   358   /**
       
   359    * Defines if attributes would be resolved using internal setter functions
       
   360    * or custom functions that were passed in the constructor.
       
   361    * @param {Object} options
       
   362    */
       
   363 
       
   364 
       
   365   clipboard_createClass(Clipboard, [{
       
   366     key: "resolveOptions",
       
   367     value: function resolveOptions() {
       
   368       var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
       
   369       this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
       
   370       this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
       
   371       this.text = typeof options.text === 'function' ? options.text : this.defaultText;
       
   372       this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;
       
   373     }
       
   374     /**
       
   375      * Adds a click event listener to the passed trigger.
       
   376      * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
       
   377      */
       
   378 
       
   379   }, {
       
   380     key: "listenClick",
       
   381     value: function listenClick(trigger) {
       
   382       var _this2 = this;
       
   383 
       
   384       this.listener = listen_default()(trigger, 'click', function (e) {
       
   385         return _this2.onClick(e);
       
   386       });
       
   387     }
       
   388     /**
       
   389      * Defines a new `ClipboardAction` on each click event.
       
   390      * @param {Event} e
       
   391      */
       
   392 
       
   393   }, {
       
   394     key: "onClick",
       
   395     value: function onClick(e) {
       
   396       var trigger = e.delegateTarget || e.currentTarget;
       
   397 
       
   398       if (this.clipboardAction) {
       
   399         this.clipboardAction = null;
       
   400       }
       
   401 
       
   402       this.clipboardAction = new clipboard_action({
       
   403         action: this.action(trigger),
       
   404         target: this.target(trigger),
       
   405         text: this.text(trigger),
       
   406         container: this.container,
       
   407         trigger: trigger,
       
   408         emitter: this
       
   409       });
       
   410     }
       
   411     /**
       
   412      * Default `action` lookup function.
       
   413      * @param {Element} trigger
       
   414      */
       
   415 
       
   416   }, {
       
   417     key: "defaultAction",
       
   418     value: function defaultAction(trigger) {
       
   419       return getAttributeValue('action', trigger);
       
   420     }
       
   421     /**
       
   422      * Default `target` lookup function.
       
   423      * @param {Element} trigger
       
   424      */
       
   425 
       
   426   }, {
       
   427     key: "defaultTarget",
       
   428     value: function defaultTarget(trigger) {
       
   429       var selector = getAttributeValue('target', trigger);
       
   430 
       
   431       if (selector) {
       
   432         return document.querySelector(selector);
       
   433       }
       
   434     }
       
   435     /**
       
   436      * Returns the support of the given action, or all actions if no action is
       
   437      * given.
       
   438      * @param {String} [action]
       
   439      */
       
   440 
       
   441   }, {
       
   442     key: "defaultText",
       
   443 
       
   444     /**
       
   445      * Default `text` lookup function.
       
   446      * @param {Element} trigger
       
   447      */
       
   448     value: function defaultText(trigger) {
       
   449       return getAttributeValue('text', trigger);
       
   450     }
       
   451     /**
       
   452      * Destroy lifecycle.
       
   453      */
       
   454 
       
   455   }, {
       
   456     key: "destroy",
       
   457     value: function destroy() {
       
   458       this.listener.destroy();
       
   459 
       
   460       if (this.clipboardAction) {
       
   461         this.clipboardAction.destroy();
       
   462         this.clipboardAction = null;
       
   463       }
       
   464     }
       
   465   }], [{
       
   466     key: "isSupported",
       
   467     value: function isSupported() {
       
   468       var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
       
   469       var actions = typeof action === 'string' ? [action] : action;
       
   470       var support = !!document.queryCommandSupported;
       
   471       actions.forEach(function (action) {
       
   472         support = support && !!document.queryCommandSupported(action);
       
   473       });
       
   474       return support;
       
   475     }
       
   476   }]);
       
   477 
       
   478   return Clipboard;
       
   479 }((tiny_emitter_default()));
       
   480 
       
   481 /* harmony default export */ var clipboard = (Clipboard);
   151 
   482 
   152 /***/ }),
   483 /***/ }),
   153 /* 1 */
   484 
   154 /***/ (function(module, exports) {
   485 /***/ 828:
   155 
   486 /***/ (function(module) {
   156 function E () {
       
   157   // Keep this empty so it's easier to inherit from
       
   158   // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
       
   159 }
       
   160 
       
   161 E.prototype = {
       
   162   on: function (name, callback, ctx) {
       
   163     var e = this.e || (this.e = {});
       
   164 
       
   165     (e[name] || (e[name] = [])).push({
       
   166       fn: callback,
       
   167       ctx: ctx
       
   168     });
       
   169 
       
   170     return this;
       
   171   },
       
   172 
       
   173   once: function (name, callback, ctx) {
       
   174     var self = this;
       
   175     function listener () {
       
   176       self.off(name, listener);
       
   177       callback.apply(ctx, arguments);
       
   178     };
       
   179 
       
   180     listener._ = callback
       
   181     return this.on(name, listener, ctx);
       
   182   },
       
   183 
       
   184   emit: function (name) {
       
   185     var data = [].slice.call(arguments, 1);
       
   186     var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
       
   187     var i = 0;
       
   188     var len = evtArr.length;
       
   189 
       
   190     for (i; i < len; i++) {
       
   191       evtArr[i].fn.apply(evtArr[i].ctx, data);
       
   192     }
       
   193 
       
   194     return this;
       
   195   },
       
   196 
       
   197   off: function (name, callback) {
       
   198     var e = this.e || (this.e = {});
       
   199     var evts = e[name];
       
   200     var liveEvents = [];
       
   201 
       
   202     if (evts && callback) {
       
   203       for (var i = 0, len = evts.length; i < len; i++) {
       
   204         if (evts[i].fn !== callback && evts[i].fn._ !== callback)
       
   205           liveEvents.push(evts[i]);
       
   206       }
       
   207     }
       
   208 
       
   209     // Remove event from queue to prevent memory leak
       
   210     // Suggested by https://github.com/lazd
       
   211     // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
       
   212 
       
   213     (liveEvents.length)
       
   214       ? e[name] = liveEvents
       
   215       : delete e[name];
       
   216 
       
   217     return this;
       
   218   }
       
   219 };
       
   220 
       
   221 module.exports = E;
       
   222 module.exports.TinyEmitter = E;
       
   223 
       
   224 
       
   225 /***/ }),
       
   226 /* 2 */
       
   227 /***/ (function(module, exports, __webpack_require__) {
       
   228 
       
   229 var is = __webpack_require__(3);
       
   230 var delegate = __webpack_require__(4);
       
   231 
       
   232 /**
       
   233  * Validates all params and calls the right
       
   234  * listener function based on its target type.
       
   235  *
       
   236  * @param {String|HTMLElement|HTMLCollection|NodeList} target
       
   237  * @param {String} type
       
   238  * @param {Function} callback
       
   239  * @return {Object}
       
   240  */
       
   241 function listen(target, type, callback) {
       
   242     if (!target && !type && !callback) {
       
   243         throw new Error('Missing required arguments');
       
   244     }
       
   245 
       
   246     if (!is.string(type)) {
       
   247         throw new TypeError('Second argument must be a String');
       
   248     }
       
   249 
       
   250     if (!is.fn(callback)) {
       
   251         throw new TypeError('Third argument must be a Function');
       
   252     }
       
   253 
       
   254     if (is.node(target)) {
       
   255         return listenNode(target, type, callback);
       
   256     }
       
   257     else if (is.nodeList(target)) {
       
   258         return listenNodeList(target, type, callback);
       
   259     }
       
   260     else if (is.string(target)) {
       
   261         return listenSelector(target, type, callback);
       
   262     }
       
   263     else {
       
   264         throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
       
   265     }
       
   266 }
       
   267 
       
   268 /**
       
   269  * Adds an event listener to a HTML element
       
   270  * and returns a remove listener function.
       
   271  *
       
   272  * @param {HTMLElement} node
       
   273  * @param {String} type
       
   274  * @param {Function} callback
       
   275  * @return {Object}
       
   276  */
       
   277 function listenNode(node, type, callback) {
       
   278     node.addEventListener(type, callback);
       
   279 
       
   280     return {
       
   281         destroy: function() {
       
   282             node.removeEventListener(type, callback);
       
   283         }
       
   284     }
       
   285 }
       
   286 
       
   287 /**
       
   288  * Add an event listener to a list of HTML elements
       
   289  * and returns a remove listener function.
       
   290  *
       
   291  * @param {NodeList|HTMLCollection} nodeList
       
   292  * @param {String} type
       
   293  * @param {Function} callback
       
   294  * @return {Object}
       
   295  */
       
   296 function listenNodeList(nodeList, type, callback) {
       
   297     Array.prototype.forEach.call(nodeList, function(node) {
       
   298         node.addEventListener(type, callback);
       
   299     });
       
   300 
       
   301     return {
       
   302         destroy: function() {
       
   303             Array.prototype.forEach.call(nodeList, function(node) {
       
   304                 node.removeEventListener(type, callback);
       
   305             });
       
   306         }
       
   307     }
       
   308 }
       
   309 
       
   310 /**
       
   311  * Add an event listener to a selector
       
   312  * and returns a remove listener function.
       
   313  *
       
   314  * @param {String} selector
       
   315  * @param {String} type
       
   316  * @param {Function} callback
       
   317  * @return {Object}
       
   318  */
       
   319 function listenSelector(selector, type, callback) {
       
   320     return delegate(document.body, selector, type, callback);
       
   321 }
       
   322 
       
   323 module.exports = listen;
       
   324 
       
   325 
       
   326 /***/ }),
       
   327 /* 3 */
       
   328 /***/ (function(module, exports) {
       
   329 
       
   330 /**
       
   331  * Check if argument is a HTML element.
       
   332  *
       
   333  * @param {Object} value
       
   334  * @return {Boolean}
       
   335  */
       
   336 exports.node = function(value) {
       
   337     return value !== undefined
       
   338         && value instanceof HTMLElement
       
   339         && value.nodeType === 1;
       
   340 };
       
   341 
       
   342 /**
       
   343  * Check if argument is a list of HTML elements.
       
   344  *
       
   345  * @param {Object} value
       
   346  * @return {Boolean}
       
   347  */
       
   348 exports.nodeList = function(value) {
       
   349     var type = Object.prototype.toString.call(value);
       
   350 
       
   351     return value !== undefined
       
   352         && (type === '[object NodeList]' || type === '[object HTMLCollection]')
       
   353         && ('length' in value)
       
   354         && (value.length === 0 || exports.node(value[0]));
       
   355 };
       
   356 
       
   357 /**
       
   358  * Check if argument is a string.
       
   359  *
       
   360  * @param {Object} value
       
   361  * @return {Boolean}
       
   362  */
       
   363 exports.string = function(value) {
       
   364     return typeof value === 'string'
       
   365         || value instanceof String;
       
   366 };
       
   367 
       
   368 /**
       
   369  * Check if argument is a function.
       
   370  *
       
   371  * @param {Object} value
       
   372  * @return {Boolean}
       
   373  */
       
   374 exports.fn = function(value) {
       
   375     var type = Object.prototype.toString.call(value);
       
   376 
       
   377     return type === '[object Function]';
       
   378 };
       
   379 
       
   380 
       
   381 /***/ }),
       
   382 /* 4 */
       
   383 /***/ (function(module, exports, __webpack_require__) {
       
   384 
       
   385 var closest = __webpack_require__(5);
       
   386 
       
   387 /**
       
   388  * Delegates event to a selector.
       
   389  *
       
   390  * @param {Element} element
       
   391  * @param {String} selector
       
   392  * @param {String} type
       
   393  * @param {Function} callback
       
   394  * @param {Boolean} useCapture
       
   395  * @return {Object}
       
   396  */
       
   397 function _delegate(element, selector, type, callback, useCapture) {
       
   398     var listenerFn = listener.apply(this, arguments);
       
   399 
       
   400     element.addEventListener(type, listenerFn, useCapture);
       
   401 
       
   402     return {
       
   403         destroy: function() {
       
   404             element.removeEventListener(type, listenerFn, useCapture);
       
   405         }
       
   406     }
       
   407 }
       
   408 
       
   409 /**
       
   410  * Delegates event to a selector.
       
   411  *
       
   412  * @param {Element|String|Array} [elements]
       
   413  * @param {String} selector
       
   414  * @param {String} type
       
   415  * @param {Function} callback
       
   416  * @param {Boolean} useCapture
       
   417  * @return {Object}
       
   418  */
       
   419 function delegate(elements, selector, type, callback, useCapture) {
       
   420     // Handle the regular Element usage
       
   421     if (typeof elements.addEventListener === 'function') {
       
   422         return _delegate.apply(null, arguments);
       
   423     }
       
   424 
       
   425     // Handle Element-less usage, it defaults to global delegation
       
   426     if (typeof type === 'function') {
       
   427         // Use `document` as the first parameter, then apply arguments
       
   428         // This is a short way to .unshift `arguments` without running into deoptimizations
       
   429         return _delegate.bind(null, document).apply(null, arguments);
       
   430     }
       
   431 
       
   432     // Handle Selector-based usage
       
   433     if (typeof elements === 'string') {
       
   434         elements = document.querySelectorAll(elements);
       
   435     }
       
   436 
       
   437     // Handle Array-like based usage
       
   438     return Array.prototype.map.call(elements, function (element) {
       
   439         return _delegate(element, selector, type, callback, useCapture);
       
   440     });
       
   441 }
       
   442 
       
   443 /**
       
   444  * Finds closest match and invokes callback.
       
   445  *
       
   446  * @param {Element} element
       
   447  * @param {String} selector
       
   448  * @param {String} type
       
   449  * @param {Function} callback
       
   450  * @return {Function}
       
   451  */
       
   452 function listener(element, selector, type, callback) {
       
   453     return function(e) {
       
   454         e.delegateTarget = closest(e.target, selector);
       
   455 
       
   456         if (e.delegateTarget) {
       
   457             callback.call(element, e);
       
   458         }
       
   459     }
       
   460 }
       
   461 
       
   462 module.exports = delegate;
       
   463 
       
   464 
       
   465 /***/ }),
       
   466 /* 5 */
       
   467 /***/ (function(module, exports) {
       
   468 
   487 
   469 var DOCUMENT_NODE_TYPE = 9;
   488 var DOCUMENT_NODE_TYPE = 9;
   470 
   489 
   471 /**
   490 /**
   472  * A polyfill for Element.matches()
   491  * A polyfill for Element.matches()
   500 
   519 
   501 module.exports = closest;
   520 module.exports = closest;
   502 
   521 
   503 
   522 
   504 /***/ }),
   523 /***/ }),
   505 /* 6 */
   524 
   506 /***/ (function(module, __webpack_exports__, __webpack_require__) {
   525 /***/ 438:
   507 
   526 /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
   508 "use strict";
   527 
   509 __webpack_require__.r(__webpack_exports__);
   528 var closest = __webpack_require__(828);
   510 
   529 
   511 // EXTERNAL MODULE: ./node_modules/select/src/select.js
   530 /**
   512 var src_select = __webpack_require__(0);
   531  * Delegates event to a selector.
   513 var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
   532  *
   514 
   533  * @param {Element} element
   515 // CONCATENATED MODULE: ./src/clipboard-action.js
   534  * @param {String} selector
   516 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
   535  * @param {String} type
   517 
   536  * @param {Function} callback
   518 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; }; }();
   537  * @param {Boolean} useCapture
   519 
   538  * @return {Object}
   520 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
   539  */
   521 
   540 function _delegate(element, selector, type, callback, useCapture) {
   522 
   541     var listenerFn = listener.apply(this, arguments);
   523 
   542 
   524 /**
   543     element.addEventListener(type, listenerFn, useCapture);
   525  * Inner class which performs selection from either `text` or `target`
   544 
   526  * properties and then executes copy or cut operations.
   545     return {
   527  */
   546         destroy: function() {
   528 
   547             element.removeEventListener(type, listenerFn, useCapture);
   529 var clipboard_action_ClipboardAction = function () {
       
   530     /**
       
   531      * @param {Object} options
       
   532      */
       
   533     function ClipboardAction(options) {
       
   534         _classCallCheck(this, ClipboardAction);
       
   535 
       
   536         this.resolveOptions(options);
       
   537         this.initSelection();
       
   538     }
       
   539 
       
   540     /**
       
   541      * Defines base properties passed from constructor.
       
   542      * @param {Object} options
       
   543      */
       
   544 
       
   545 
       
   546     _createClass(ClipboardAction, [{
       
   547         key: 'resolveOptions',
       
   548         value: function resolveOptions() {
       
   549             var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
       
   550 
       
   551             this.action = options.action;
       
   552             this.container = options.container;
       
   553             this.emitter = options.emitter;
       
   554             this.target = options.target;
       
   555             this.text = options.text;
       
   556             this.trigger = options.trigger;
       
   557 
       
   558             this.selectedText = '';
       
   559         }
   548         }
   560 
   549     }
   561         /**
   550 }
   562          * Decides which selection strategy is going to be applied based
   551 
   563          * on the existence of `text` and `target` properties.
   552 /**
   564          */
   553  * Delegates event to a selector.
   565 
   554  *
   566     }, {
   555  * @param {Element|String|Array} [elements]
   567         key: 'initSelection',
   556  * @param {String} selector
   568         value: function initSelection() {
   557  * @param {String} type
   569             if (this.text) {
   558  * @param {Function} callback
   570                 this.selectFake();
   559  * @param {Boolean} useCapture
   571             } else if (this.target) {
   560  * @return {Object}
   572                 this.selectTarget();
   561  */
   573             }
   562 function delegate(elements, selector, type, callback, useCapture) {
       
   563     // Handle the regular Element usage
       
   564     if (typeof elements.addEventListener === 'function') {
       
   565         return _delegate.apply(null, arguments);
       
   566     }
       
   567 
       
   568     // Handle Element-less usage, it defaults to global delegation
       
   569     if (typeof type === 'function') {
       
   570         // Use `document` as the first parameter, then apply arguments
       
   571         // This is a short way to .unshift `arguments` without running into deoptimizations
       
   572         return _delegate.bind(null, document).apply(null, arguments);
       
   573     }
       
   574 
       
   575     // Handle Selector-based usage
       
   576     if (typeof elements === 'string') {
       
   577         elements = document.querySelectorAll(elements);
       
   578     }
       
   579 
       
   580     // Handle Array-like based usage
       
   581     return Array.prototype.map.call(elements, function (element) {
       
   582         return _delegate(element, selector, type, callback, useCapture);
       
   583     });
       
   584 }
       
   585 
       
   586 /**
       
   587  * Finds closest match and invokes callback.
       
   588  *
       
   589  * @param {Element} element
       
   590  * @param {String} selector
       
   591  * @param {String} type
       
   592  * @param {Function} callback
       
   593  * @return {Function}
       
   594  */
       
   595 function listener(element, selector, type, callback) {
       
   596     return function(e) {
       
   597         e.delegateTarget = closest(e.target, selector);
       
   598 
       
   599         if (e.delegateTarget) {
       
   600             callback.call(element, e);
   574         }
   601         }
   575 
   602     }
   576         /**
   603 }
   577          * Creates a fake textarea element, sets its value from `text` property,
   604 
   578          * and makes a selection on it.
   605 module.exports = delegate;
   579          */
   606 
   580 
   607 
   581     }, {
   608 /***/ }),
   582         key: 'selectFake',
   609 
   583         value: function selectFake() {
   610 /***/ 879:
   584             var _this = this;
   611 /***/ (function(__unused_webpack_module, exports) {
   585 
   612 
   586             var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
   613 /**
   587 
   614  * Check if argument is a HTML element.
   588             this.removeFake();
   615  *
   589 
   616  * @param {Object} value
   590             this.fakeHandlerCallback = function () {
   617  * @return {Boolean}
   591                 return _this.removeFake();
   618  */
   592             };
   619 exports.node = function(value) {
   593             this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
   620     return value !== undefined
   594 
   621         && value instanceof HTMLElement
   595             this.fakeElem = document.createElement('textarea');
   622         && value.nodeType === 1;
   596             // Prevent zooming on iOS
   623 };
   597             this.fakeElem.style.fontSize = '12pt';
   624 
   598             // Reset box model
   625 /**
   599             this.fakeElem.style.border = '0';
   626  * Check if argument is a list of HTML elements.
   600             this.fakeElem.style.padding = '0';
   627  *
   601             this.fakeElem.style.margin = '0';
   628  * @param {Object} value
   602             // Move element out of screen horizontally
   629  * @return {Boolean}
   603             this.fakeElem.style.position = 'absolute';
   630  */
   604             this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
   631 exports.nodeList = function(value) {
   605             // Move element to the same position vertically
   632     var type = Object.prototype.toString.call(value);
   606             var yPosition = window.pageYOffset || document.documentElement.scrollTop;
   633 
   607             this.fakeElem.style.top = yPosition + 'px';
   634     return value !== undefined
   608 
   635         && (type === '[object NodeList]' || type === '[object HTMLCollection]')
   609             this.fakeElem.setAttribute('readonly', '');
   636         && ('length' in value)
   610             this.fakeElem.value = this.text;
   637         && (value.length === 0 || exports.node(value[0]));
   611 
   638 };
   612             this.container.appendChild(this.fakeElem);
   639 
   613 
   640 /**
   614             this.selectedText = select_default()(this.fakeElem);
   641  * Check if argument is a string.
   615             this.copyText();
   642  *
       
   643  * @param {Object} value
       
   644  * @return {Boolean}
       
   645  */
       
   646 exports.string = function(value) {
       
   647     return typeof value === 'string'
       
   648         || value instanceof String;
       
   649 };
       
   650 
       
   651 /**
       
   652  * Check if argument is a function.
       
   653  *
       
   654  * @param {Object} value
       
   655  * @return {Boolean}
       
   656  */
       
   657 exports.fn = function(value) {
       
   658     var type = Object.prototype.toString.call(value);
       
   659 
       
   660     return type === '[object Function]';
       
   661 };
       
   662 
       
   663 
       
   664 /***/ }),
       
   665 
       
   666 /***/ 370:
       
   667 /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
       
   668 
       
   669 var is = __webpack_require__(879);
       
   670 var delegate = __webpack_require__(438);
       
   671 
       
   672 /**
       
   673  * Validates all params and calls the right
       
   674  * listener function based on its target type.
       
   675  *
       
   676  * @param {String|HTMLElement|HTMLCollection|NodeList} target
       
   677  * @param {String} type
       
   678  * @param {Function} callback
       
   679  * @return {Object}
       
   680  */
       
   681 function listen(target, type, callback) {
       
   682     if (!target && !type && !callback) {
       
   683         throw new Error('Missing required arguments');
       
   684     }
       
   685 
       
   686     if (!is.string(type)) {
       
   687         throw new TypeError('Second argument must be a String');
       
   688     }
       
   689 
       
   690     if (!is.fn(callback)) {
       
   691         throw new TypeError('Third argument must be a Function');
       
   692     }
       
   693 
       
   694     if (is.node(target)) {
       
   695         return listenNode(target, type, callback);
       
   696     }
       
   697     else if (is.nodeList(target)) {
       
   698         return listenNodeList(target, type, callback);
       
   699     }
       
   700     else if (is.string(target)) {
       
   701         return listenSelector(target, type, callback);
       
   702     }
       
   703     else {
       
   704         throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
       
   705     }
       
   706 }
       
   707 
       
   708 /**
       
   709  * Adds an event listener to a HTML element
       
   710  * and returns a remove listener function.
       
   711  *
       
   712  * @param {HTMLElement} node
       
   713  * @param {String} type
       
   714  * @param {Function} callback
       
   715  * @return {Object}
       
   716  */
       
   717 function listenNode(node, type, callback) {
       
   718     node.addEventListener(type, callback);
       
   719 
       
   720     return {
       
   721         destroy: function() {
       
   722             node.removeEventListener(type, callback);
   616         }
   723         }
   617 
   724     }
   618         /**
   725 }
   619          * Only removes the fake element after another click event, that way
   726 
   620          * a user can hit `Ctrl+C` to copy because selection still exists.
   727 /**
   621          */
   728  * Add an event listener to a list of HTML elements
   622 
   729  * and returns a remove listener function.
   623     }, {
   730  *
   624         key: 'removeFake',
   731  * @param {NodeList|HTMLCollection} nodeList
   625         value: function removeFake() {
   732  * @param {String} type
   626             if (this.fakeHandler) {
   733  * @param {Function} callback
   627                 this.container.removeEventListener('click', this.fakeHandlerCallback);
   734  * @return {Object}
   628                 this.fakeHandler = null;
   735  */
   629                 this.fakeHandlerCallback = null;
   736 function listenNodeList(nodeList, type, callback) {
   630             }
   737     Array.prototype.forEach.call(nodeList, function(node) {
   631 
   738         node.addEventListener(type, callback);
   632             if (this.fakeElem) {
   739     });
   633                 this.container.removeChild(this.fakeElem);
   740 
   634                 this.fakeElem = null;
   741     return {
   635             }
   742         destroy: function() {
   636         }
   743             Array.prototype.forEach.call(nodeList, function(node) {
   637 
   744                 node.removeEventListener(type, callback);
   638         /**
       
   639          * Selects the content from element passed on `target` property.
       
   640          */
       
   641 
       
   642     }, {
       
   643         key: 'selectTarget',
       
   644         value: function selectTarget() {
       
   645             this.selectedText = select_default()(this.target);
       
   646             this.copyText();
       
   647         }
       
   648 
       
   649         /**
       
   650          * Executes the copy operation based on the current selection.
       
   651          */
       
   652 
       
   653     }, {
       
   654         key: 'copyText',
       
   655         value: function copyText() {
       
   656             var succeeded = void 0;
       
   657 
       
   658             try {
       
   659                 succeeded = document.execCommand(this.action);
       
   660             } catch (err) {
       
   661                 succeeded = false;
       
   662             }
       
   663 
       
   664             this.handleResult(succeeded);
       
   665         }
       
   666 
       
   667         /**
       
   668          * Fires an event based on the copy operation result.
       
   669          * @param {Boolean} succeeded
       
   670          */
       
   671 
       
   672     }, {
       
   673         key: 'handleResult',
       
   674         value: function handleResult(succeeded) {
       
   675             this.emitter.emit(succeeded ? 'success' : 'error', {
       
   676                 action: this.action,
       
   677                 text: this.selectedText,
       
   678                 trigger: this.trigger,
       
   679                 clearSelection: this.clearSelection.bind(this)
       
   680             });
   745             });
   681         }
   746         }
   682 
   747     }
   683         /**
   748 }
   684          * Moves focus away from `target` and back to the trigger, removes current selection.
   749 
   685          */
   750 /**
   686 
   751  * Add an event listener to a selector
   687     }, {
   752  * and returns a remove listener function.
   688         key: 'clearSelection',
   753  *
   689         value: function clearSelection() {
   754  * @param {String} selector
   690             if (this.trigger) {
   755  * @param {String} type
   691                 this.trigger.focus();
   756  * @param {Function} callback
   692             }
   757  * @return {Object}
   693             document.activeElement.blur();
   758  */
   694             window.getSelection().removeAllRanges();
   759 function listenSelector(selector, type, callback) {
       
   760     return delegate(document.body, selector, type, callback);
       
   761 }
       
   762 
       
   763 module.exports = listen;
       
   764 
       
   765 
       
   766 /***/ }),
       
   767 
       
   768 /***/ 817:
       
   769 /***/ (function(module) {
       
   770 
       
   771 function select(element) {
       
   772     var selectedText;
       
   773 
       
   774     if (element.nodeName === 'SELECT') {
       
   775         element.focus();
       
   776 
       
   777         selectedText = element.value;
       
   778     }
       
   779     else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
       
   780         var isReadOnly = element.hasAttribute('readonly');
       
   781 
       
   782         if (!isReadOnly) {
       
   783             element.setAttribute('readonly', '');
   695         }
   784         }
   696 
   785 
   697         /**
   786         element.select();
   698          * Sets the `action` to be performed which can be either 'copy' or 'cut'.
   787         element.setSelectionRange(0, element.value.length);
   699          * @param {String} action
   788 
   700          */
   789         if (!isReadOnly) {
   701 
   790             element.removeAttribute('readonly');
   702     }, {
       
   703         key: 'destroy',
       
   704 
       
   705 
       
   706         /**
       
   707          * Destroy lifecycle.
       
   708          */
       
   709         value: function destroy() {
       
   710             this.removeFake();
       
   711         }
   791         }
   712     }, {
   792 
   713         key: 'action',
   793         selectedText = element.value;
   714         set: function set() {
   794     }
   715             var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
   795     else {
   716 
   796         if (element.hasAttribute('contenteditable')) {
   717             this._action = action;
   797             element.focus();
   718 
       
   719             if (this._action !== 'copy' && this._action !== 'cut') {
       
   720                 throw new Error('Invalid "action" value, use either "copy" or "cut"');
       
   721             }
       
   722         }
   798         }
   723 
   799 
   724         /**
   800         var selection = window.getSelection();
   725          * Gets the `action` property.
   801         var range = document.createRange();
   726          * @return {String}
   802 
   727          */
   803         range.selectNodeContents(element);
   728         ,
   804         selection.removeAllRanges();
   729         get: function get() {
   805         selection.addRange(range);
   730             return this._action;
   806 
   731         }
   807         selectedText = selection.toString();
   732 
   808     }
   733         /**
   809 
   734          * Sets the `target` property using an element
   810     return selectedText;
   735          * that will be have its content copied.
   811 }
   736          * @param {Element} target
   812 
   737          */
   813 module.exports = select;
   738 
   814 
   739     }, {
   815 
   740         key: 'target',
   816 /***/ }),
   741         set: function set(target) {
   817 
   742             if (target !== undefined) {
   818 /***/ 279:
   743                 if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
   819 /***/ (function(module) {
   744                     if (this.action === 'copy' && target.hasAttribute('disabled')) {
   820 
   745                         throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
   821 function E () {
   746                     }
   822   // Keep this empty so it's easier to inherit from
   747 
   823   // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
   748                     if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
   824 }
   749                         throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
   825 
   750                     }
   826 E.prototype = {
   751 
   827   on: function (name, callback, ctx) {
   752                     this._target = target;
   828     var e = this.e || (this.e = {});
   753                 } else {
   829 
   754                     throw new Error('Invalid "target" value, use a valid Element');
   830     (e[name] || (e[name] = [])).push({
   755                 }
   831       fn: callback,
   756             }
   832       ctx: ctx
   757         }
   833     });
   758 
   834 
   759         /**
   835     return this;
   760          * Gets the `target` property.
   836   },
   761          * @return {String|HTMLElement}
   837 
   762          */
   838   once: function (name, callback, ctx) {
   763         ,
   839     var self = this;
   764         get: function get() {
   840     function listener () {
   765             return this._target;
   841       self.off(name, listener);
   766         }
   842       callback.apply(ctx, arguments);
   767     }]);
   843     };
   768 
   844 
   769     return ClipboardAction;
   845     listener._ = callback
   770 }();
   846     return this.on(name, listener, ctx);
   771 
   847   },
   772 /* harmony default export */ var clipboard_action = (clipboard_action_ClipboardAction);
   848 
   773 // EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
   849   emit: function (name) {
   774 var tiny_emitter = __webpack_require__(1);
   850     var data = [].slice.call(arguments, 1);
   775 var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);
   851     var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
   776 
   852     var i = 0;
   777 // EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js
   853     var len = evtArr.length;
   778 var listen = __webpack_require__(2);
   854 
   779 var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
   855     for (i; i < len; i++) {
   780 
   856       evtArr[i].fn.apply(evtArr[i].ctx, data);
   781 // CONCATENATED MODULE: ./src/clipboard.js
   857     }
   782 var clipboard_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
   858 
   783 
   859     return this;
   784 var clipboard_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; }; }();
   860   },
   785 
   861 
   786 function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
   862   off: function (name, callback) {
   787 
   863     var e = this.e || (this.e = {});
   788 function _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; }
   864     var evts = e[name];
   789 
   865     var liveEvents = [];
   790 function _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; }
   866 
   791 
   867     if (evts && callback) {
   792 
   868       for (var i = 0, len = evts.length; i < len; i++) {
   793 
   869         if (evts[i].fn !== callback && evts[i].fn._ !== callback)
   794 
   870           liveEvents.push(evts[i]);
   795 
   871       }
   796 /**
   872     }
   797  * Base class which takes one or more elements, adds event listeners to them,
   873 
   798  * and instantiates a new `ClipboardAction` on each click.
   874     // Remove event from queue to prevent memory leak
   799  */
   875     // Suggested by https://github.com/lazd
   800 
   876     // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
   801 var clipboard_Clipboard = function (_Emitter) {
   877 
   802     _inherits(Clipboard, _Emitter);
   878     (liveEvents.length)
   803 
   879       ? e[name] = liveEvents
   804     /**
   880       : delete e[name];
   805      * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
   881 
   806      * @param {Object} options
   882     return this;
   807      */
   883   }
   808     function Clipboard(trigger, options) {
   884 };
   809         clipboard_classCallCheck(this, Clipboard);
   885 
   810 
   886 module.exports = E;
   811         var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
   887 module.exports.TinyEmitter = E;
   812 
   888 
   813         _this.resolveOptions(options);
       
   814         _this.listenClick(trigger);
       
   815         return _this;
       
   816     }
       
   817 
       
   818     /**
       
   819      * Defines if attributes would be resolved using internal setter functions
       
   820      * or custom functions that were passed in the constructor.
       
   821      * @param {Object} options
       
   822      */
       
   823 
       
   824 
       
   825     clipboard_createClass(Clipboard, [{
       
   826         key: 'resolveOptions',
       
   827         value: function resolveOptions() {
       
   828             var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
       
   829 
       
   830             this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
       
   831             this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
       
   832             this.text = typeof options.text === 'function' ? options.text : this.defaultText;
       
   833             this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;
       
   834         }
       
   835 
       
   836         /**
       
   837          * Adds a click event listener to the passed trigger.
       
   838          * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
       
   839          */
       
   840 
       
   841     }, {
       
   842         key: 'listenClick',
       
   843         value: function listenClick(trigger) {
       
   844             var _this2 = this;
       
   845 
       
   846             this.listener = listen_default()(trigger, 'click', function (e) {
       
   847                 return _this2.onClick(e);
       
   848             });
       
   849         }
       
   850 
       
   851         /**
       
   852          * Defines a new `ClipboardAction` on each click event.
       
   853          * @param {Event} e
       
   854          */
       
   855 
       
   856     }, {
       
   857         key: 'onClick',
       
   858         value: function onClick(e) {
       
   859             var trigger = e.delegateTarget || e.currentTarget;
       
   860 
       
   861             if (this.clipboardAction) {
       
   862                 this.clipboardAction = null;
       
   863             }
       
   864 
       
   865             this.clipboardAction = new clipboard_action({
       
   866                 action: this.action(trigger),
       
   867                 target: this.target(trigger),
       
   868                 text: this.text(trigger),
       
   869                 container: this.container,
       
   870                 trigger: trigger,
       
   871                 emitter: this
       
   872             });
       
   873         }
       
   874 
       
   875         /**
       
   876          * Default `action` lookup function.
       
   877          * @param {Element} trigger
       
   878          */
       
   879 
       
   880     }, {
       
   881         key: 'defaultAction',
       
   882         value: function defaultAction(trigger) {
       
   883             return getAttributeValue('action', trigger);
       
   884         }
       
   885 
       
   886         /**
       
   887          * Default `target` lookup function.
       
   888          * @param {Element} trigger
       
   889          */
       
   890 
       
   891     }, {
       
   892         key: 'defaultTarget',
       
   893         value: function defaultTarget(trigger) {
       
   894             var selector = getAttributeValue('target', trigger);
       
   895 
       
   896             if (selector) {
       
   897                 return document.querySelector(selector);
       
   898             }
       
   899         }
       
   900 
       
   901         /**
       
   902          * Returns the support of the given action, or all actions if no action is
       
   903          * given.
       
   904          * @param {String} [action]
       
   905          */
       
   906 
       
   907     }, {
       
   908         key: 'defaultText',
       
   909 
       
   910 
       
   911         /**
       
   912          * Default `text` lookup function.
       
   913          * @param {Element} trigger
       
   914          */
       
   915         value: function defaultText(trigger) {
       
   916             return getAttributeValue('text', trigger);
       
   917         }
       
   918 
       
   919         /**
       
   920          * Destroy lifecycle.
       
   921          */
       
   922 
       
   923     }, {
       
   924         key: 'destroy',
       
   925         value: function destroy() {
       
   926             this.listener.destroy();
       
   927 
       
   928             if (this.clipboardAction) {
       
   929                 this.clipboardAction.destroy();
       
   930                 this.clipboardAction = null;
       
   931             }
       
   932         }
       
   933     }], [{
       
   934         key: 'isSupported',
       
   935         value: function isSupported() {
       
   936             var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
       
   937 
       
   938             var actions = typeof action === 'string' ? [action] : action;
       
   939             var support = !!document.queryCommandSupported;
       
   940 
       
   941             actions.forEach(function (action) {
       
   942                 support = support && !!document.queryCommandSupported(action);
       
   943             });
       
   944 
       
   945             return support;
       
   946         }
       
   947     }]);
       
   948 
       
   949     return Clipboard;
       
   950 }(tiny_emitter_default.a);
       
   951 
       
   952 /**
       
   953  * Helper function to retrieve attribute value.
       
   954  * @param {String} suffix
       
   955  * @param {Element} element
       
   956  */
       
   957 
       
   958 
       
   959 function getAttributeValue(suffix, element) {
       
   960     var attribute = 'data-clipboard-' + suffix;
       
   961 
       
   962     if (!element.hasAttribute(attribute)) {
       
   963         return;
       
   964     }
       
   965 
       
   966     return element.getAttribute(attribute);
       
   967 }
       
   968 
       
   969 /* harmony default export */ var clipboard = __webpack_exports__["default"] = (clipboard_Clipboard);
       
   970 
   889 
   971 /***/ })
   890 /***/ })
   972 /******/ ])["default"];
   891 
       
   892 /******/ 	});
       
   893 /************************************************************************/
       
   894 /******/ 	// The module cache
       
   895 /******/ 	var __webpack_module_cache__ = {};
       
   896 /******/ 	
       
   897 /******/ 	// The require function
       
   898 /******/ 	function __webpack_require__(moduleId) {
       
   899 /******/ 		// Check if module is in cache
       
   900 /******/ 		if(__webpack_module_cache__[moduleId]) {
       
   901 /******/ 			return __webpack_module_cache__[moduleId].exports;
       
   902 /******/ 		}
       
   903 /******/ 		// Create a new module (and put it into the cache)
       
   904 /******/ 		var module = __webpack_module_cache__[moduleId] = {
       
   905 /******/ 			// no module.id needed
       
   906 /******/ 			// no module.loaded needed
       
   907 /******/ 			exports: {}
       
   908 /******/ 		};
       
   909 /******/ 	
       
   910 /******/ 		// Execute the module function
       
   911 /******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
       
   912 /******/ 	
       
   913 /******/ 		// Return the exports of the module
       
   914 /******/ 		return module.exports;
       
   915 /******/ 	}
       
   916 /******/ 	
       
   917 /************************************************************************/
       
   918 /******/ 	/* webpack/runtime/compat get default export */
       
   919 /******/ 	!function() {
       
   920 /******/ 		// getDefaultExport function for compatibility with non-harmony modules
       
   921 /******/ 		__webpack_require__.n = function(module) {
       
   922 /******/ 			var getter = module && module.__esModule ?
       
   923 /******/ 				function() { return module['default']; } :
       
   924 /******/ 				function() { return module; };
       
   925 /******/ 			__webpack_require__.d(getter, { a: getter });
       
   926 /******/ 			return getter;
       
   927 /******/ 		};
       
   928 /******/ 	}();
       
   929 /******/ 	
       
   930 /******/ 	/* webpack/runtime/define property getters */
       
   931 /******/ 	!function() {
       
   932 /******/ 		// define getter functions for harmony exports
       
   933 /******/ 		__webpack_require__.d = function(exports, definition) {
       
   934 /******/ 			for(var key in definition) {
       
   935 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
       
   936 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
       
   937 /******/ 				}
       
   938 /******/ 			}
       
   939 /******/ 		};
       
   940 /******/ 	}();
       
   941 /******/ 	
       
   942 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
       
   943 /******/ 	!function() {
       
   944 /******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
       
   945 /******/ 	}();
       
   946 /******/ 	
       
   947 /************************************************************************/
       
   948 /******/ 	// module exports must be returned from runtime so entry inlining is disabled
       
   949 /******/ 	// startup
       
   950 /******/ 	// Load entry module and return exports
       
   951 /******/ 	return __webpack_require__(134);
       
   952 /******/ })()
       
   953 .default;
   973 });
   954 });