!function (t) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = t(); else if ("function" == typeof define && define.amd) define([], t); else { ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).Clipboard = t() } }(function () { return function t(e, n, o) { function r(c, a) { if (!n[c]) { if (!e[c]) { var s = "function" == typeof require && require; if (!a && s) return s(c, !0); if (i) return i(c, !0); var l = new Error("Cannot find module '" + c + "'"); throw l.code = "MODULE_NOT_FOUND", l } var u = n[c] = { exports: {} }; e[c][0].call(u.exports, function (t) { var n = e[c][1][t]; return r(n || t) }, u, u.exports, t, e, n, o) } return n[c].exports } for (var i = "function" == typeof require && require, c = 0; c < o.length; c++)r(o[c]); return r }({ 1: [function (t, e, n) { var o = t("matches-selector"); e.exports = function (t, e, n) { for (var r = n ? t : t.parentNode; r && r !== document;) { if (o(r, e)) return r; r = r.parentNode } } }, { "matches-selector": 5 }], 2: [function (t, e, n) { function o(t, e, n, o) { return function (n) { n.delegateTarget = r(n.target, e, !0), n.delegateTarget && o.call(t, n) } } var r = t("closest"); e.exports = function (t, e, n, r, i) { var c = o.apply(this, arguments); return t.addEventListener(n, c, i), { destroy: function () { t.removeEventListener(n, c, i) } } } }, { closest: 1 }], 3: [function (t, e, n) { n.node = function (t) { return void 0 !== t && t instanceof HTMLElement && 1 === t.nodeType }, n.nodeList = function (t) { var e = Object.prototype.toString.call(t); return void 0 !== t && ("[object NodeList]" === e || "[object HTMLCollection]" === e) && "length" in t && (0 === t.length || n.node(t[0])) }, n.string = function (t) { return "string" == typeof t || t instanceof String }, n.fn = function (t) { return "[object Function]" === Object.prototype.toString.call(t) } }, {}], 4: [function (t, e, n) { var o = t("./is"), r = t("delegate"); e.exports = function (t, e, n) { if (!t && !e && !n) throw new Error("Missing required arguments"); if (!o.string(e)) throw new TypeError("Second argument must be a String"); if (!o.fn(n)) throw new TypeError("Third argument must be a Function"); if (o.node(t)) return function (t, e, n) { return t.addEventListener(e, n), { destroy: function () { t.removeEventListener(e, n) } } }(t, e, n); if (o.nodeList(t)) return function (t, e, n) { return Array.prototype.forEach.call(t, function (t) { t.addEventListener(e, n) }), { destroy: function () { Array.prototype.forEach.call(t, function (t) { t.removeEventListener(e, n) }) } } }(t, e, n); if (o.string(t)) return function (t, e, n) { return r(document.body, t, e, n) }(t, e, n); throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList") } }, { "./is": 3, delegate: 2 }], 5: [function (t, e, n) { var o = Element.prototype, r = o.matchesSelector || o.webkitMatchesSelector || o.mozMatchesSelector || o.msMatchesSelector || o.oMatchesSelector; e.exports = function (t, e) { if (r) return r.call(t, e); for (var n = t.parentNode.querySelectorAll(e), o = 0; o < n.length; ++o)if (n[o] == t) return !0; return !1 } }, {}], 6: [function (t, e, n) { e.exports = function (t) { var e; if ("INPUT" === t.nodeName || "TEXTAREA" === t.nodeName) t.focus(), t.setSelectionRange(0, t.value.length), e = t.value; else { t.hasAttribute("contenteditable") && t.focus(); var n = window.getSelection(), o = document.createRange(); o.selectNodeContents(t), n.removeAllRanges(), n.addRange(o), e = n.toString() } return e } }, {}], 7: [function (t, e, n) { function o() { } o.prototype = { on: function (t, e, n) { var o = this.e || (this.e = {}); return (o[t] || (o[t] = [])).push({ fn: e, ctx: n }), this }, once: function (t, e, n) { function o() { r.off(t, o), e.apply(n, arguments) } var r = this; return o._ = e, this.on(t, o, n) }, emit: function (t) { for (var e = [].slice.call(arguments, 1), n = ((this.e || (this.e = {}))[t] || []).slice(), o = 0, r = n.length; r > o; o++)n[o].fn.apply(n[o].ctx, e); return this }, off: function (t, e) { var n = this.e || (this.e = {}), o = n[t], r = []; if (o && e) for (var i = 0, c = o.length; c > i; i++)o[i].fn !== e && o[i].fn._ !== e && r.push(o[i]); return r.length ? n[t] = r : delete n[t], this } }, e.exports = o }, {}], 8: [function (t, e, n) { "use strict"; n.__esModule = !0; var o = function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var o = e[n]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } return function (e, n, o) { return n && t(e.prototype, n), o && t(e, o), e } }(), r = function (t) { return t && t.__esModule ? t : { default: t } }(t("select")), i = function () { function t(e) { (function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") })(this, t), this.resolveOptions(e), this.initSelection() } return t.prototype.resolveOptions = function () { var t = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; this.action = t.action, this.emitter = t.emitter, this.target = t.target, this.text = t.text, this.trigger = t.trigger, this.selectedText = "" }, t.prototype.initSelection = function () { if (this.text && this.target) throw new Error('Multiple attributes declared, use either "target" or "text"'); if (this.text) this.selectFake(); else { if (!this.target) throw new Error('Missing required attributes, use either "target" or "text"'); this.selectTarget() } }, t.prototype.selectFake = function () { var t = this, e = "rtl" == document.documentElement.getAttribute("dir"); this.removeFake(), this.fakeHandler = document.body.addEventListener("click", function () { return t.removeFake() }), this.fakeElem = document.createElement("textarea"), this.fakeElem.style.fontSize = "10pt", this.fakeElem.style.padding = "0", this.fakeElem.style.margin = "0", this.fakeElem.style.position = "absolute", this.fakeElem.style[e ? "right" : "left"] = "-9999px", this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + "px", this.fakeElem.setAttribute("readonly", "false"), this.fakeElem.value = this.text, document.body.appendChild(this.fakeElem), this.selectedText = r.default(this.fakeElem), this.copyText() }, t.prototype.removeFake = function () { this.fakeHandler && (document.body.removeEventListener("click"), this.fakeHandler = null), this.fakeElem && (document.body.removeChild(this.fakeElem), this.fakeElem = null) }, t.prototype.selectTarget = function () { this.selectedText = r.default(this.target), this.copyText() }, t.prototype.copyText = function () { var t = void 0; try { t = document.execCommand(this.action), document.activeElement.blur(); try { document.forms[0].elements[0].focus() } catch (t) { } } catch (e) { t = !1, document.activeElement.blur() } this.handleResult(t) }, t.prototype.handleResult = function (t) { document.activeElement.blur(), t ? this.emitter.emit("success", { action: this.action, text: this.selectedText, trigger: this.trigger, clearSelection: this.clearSelection.bind(this) }) : this.emitter.emit("error", { action: this.action, trigger: this.trigger, clearSelection: this.clearSelection.bind(this) }) }, t.prototype.clearSelection = function () { this.target && this.target.blur(), window.getSelection().removeAllRanges() }, t.prototype.destroy = function () { this.removeFake() }, o(t, [{ key: "action", set: function () { var t = arguments.length <= 0 || void 0 === arguments[0] ? "copy" : arguments[0]; if (this._action = t, "copy" !== this._action && "cut" !== this._action) throw new Error('Invalid "action" value, use either "copy" or "cut"') }, get: function () { return this._action } }, { key: "target", set: function (t) { if (void 0 !== t) { if (!t || "object" != typeof t || 1 !== t.nodeType) throw new Error('Invalid "target" value, use a valid Element'); this._target = t } }, get: function () { return this._target } }]), t }(); n.default = i, e.exports = n.default }, { select: 6 }], 9: [function (t, e, n) { "use strict"; function o(t) { return t && t.__esModule ? t : { default: t } } function r(t, e) { var n = "data-clipboard-" + t; if (e.hasAttribute(n)) return e.getAttribute(n) } n.__esModule = !0; var i = o(t("./clipboard-action")), c = o(t("tiny-emitter")), a = o(t("good-listener")), s = function (t) { function e(n, o) { (function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") })(this, e), t.call(this), this.resolveOptions(o), this.listenClick(n) } return function (t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(e, t), e.prototype.resolveOptions = function () { var t = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; this.action = "function" == typeof t.action ? t.action : this.defaultAction, this.target = "function" == typeof t.target ? t.target : this.defaultTarget, this.text = "function" == typeof t.text ? t.text : this.defaultText }, e.prototype.listenClick = function (t) { var e = this; this.listener = a.default(t, "click", function (t) { return e.onClick(t) }) }, e.prototype.onClick = function (t) { var e = t.delegateTarget || t.currentTarget; this.clipboardAction && (this.clipboardAction = null), this.clipboardAction = new i.default({ action: this.action(e), target: this.target(e), text: this.text(e), trigger: e, emitter: this }) }, e.prototype.defaultAction = function (t) { return r("action", t) }, e.prototype.defaultTarget = function (t) { var e = r("target", t); return e ? document.querySelector(e) : void 0 }, e.prototype.defaultText = function (t) { return r("text", t) }, e.prototype.destroy = function () { this.listener.destroy(), this.clipboardAction && (this.clipboardAction.destroy(), this.clipboardAction = null) }, e }(c.default); n.default = s, e.exports = n.default }, { "./clipboard-action": 8, "good-listener": 4, "tiny-emitter": 7 }] }, {}, [9])(9) });