!function(a){if("object"==typeofexports&&"undefined"!=typeofmodule)module.exports=a();elseif("function"==typeofdefine&&define.amd)define([],a);else{varb;b="undefined"!=typeofwindow?window:"undefined"!=typeofglobal?global:"undefined"!=typeofself?self:this,b.Clipboard=a()}}(function(){returnfunctiona(b,c,d){functione(g,h){if(!c[g]){if(!b[g]){vari="function"==typeofrequire&&require;if(!h&&i)returni(g,!0);if(f)returnf(g,!0);varj=newError("Cannot find module '"+g+"'");throwj.code="MODULE_NOT_FOUND",j}vark=c[g]={exports:{}};b[g][0].call(k.exports,function(a){varc=b[g][1][a];returne(c?c:a)},k,k.exports,a,b,c,d)}returnc[g].exports}for(varf="function"==typeofrequire&&require,g=0;g<d.length;g++)e(d[g]);returne}({1:[function(a,b,c){vard=a("closest"),e=a("component-event"),f=["focus","blur"];c.bind=function(a,b,c,g,h){return-1!==f.indexOf(c)&&(h=!0),e.bind(a,c,function(c){vare=c.target||c.srcElement;c.delegateTarget=d(e,b,!0,a),c.delegateTarget&&g.call(a,c)},h)},c.unbind=function(a,b,c,d){-1!==f.indexOf(b)&&(d=!0),e.unbind(a,b,c,d)}},{closest:2,"component-event":4}],2:[function(a,b,c){vard=a("matches-selector");b.exports=function(a,b,c){for(vare=c?a:a.parentNode;e&&e!==document;){if(d(e,b))returne;e=e.parentNode}}},{"matches-selector":3}],3:[function(a,b,c){functiond(a,b){if(f)returnf.call(a,b);for(varc=a.parentNode.querySelectorAll(b),d=0;d<c.length;++d)if(c[d]==a)return!0;return!1}vare=Element.prototype,f=e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector;b.exports=d},{}],4:[function(a,b,c){vard=window.addEventListener?"addEventListener":"attachEvent",e=window.removeEventListener?"removeEventListener":"detachEvent",f="addEventListener"!==d?"on":"";c.bind=function(a,b,c,e){returna[d](f+b,c,e||!1),c},c.unbind=function(a,b,c,d){returna[e](f+b,c,d||!1),c}},{}],5:[function(a,b,c){functiond(){}d.prototype={on:function(a,b,c){vard=this.e||(this.e={});return(d[a]||(d[a]=[])).push({fn:b,ctx:c}),this},once:function(a,b,c){vard=this,e=function(){d.off(a,e),b.apply(c,arguments)};returnthis.on(a,e,c)},emit:function(a){varb=[].slice.call(arguments,1),c=((this.e||(this.e={}))[a]||[]).slice(),d=0,e=c.length;for(d;e>d;d++)c[d].fn.apply(c[d].ctx,b);returnthis},off:function(a,b){varc=this.e||(this.e={}),d=c[a],e=[];if(d&&b)for(varf=0,g=d.length;g>f;f++)d[f].fn!==b&&e.push(d[f]);returne.length?c[a]=e:deletec[a],this}},b.exports=d},{}],6:[function(a,b,c){"use strict";functiond(a,b){if(!(ainstanceofb))thrownewTypeError("Cannot call a class as a function")}c.__esModule=!0;vare=function(){functiona(a,b){for(varc=0;c<b.length;c++){vard=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"ind&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}returnfunction(b,c,d){returnc&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){functiona(b){d(this,a),this.resolveOptions(b),this.initSelection()}returna.prototype.resolveOptions=function(){vara=arguments.length<=0||void0===arguments[0]?{}:arguments[0];this.action=a.action,this.emitter=a.emitter,this.target=a.target,this.text=a.text,this.trigger=a.trigger,this.selectedText=""},a.prototype.initSelection=function(){if(this.text&&this.target)thrownewError('Multiple attributes declared, use either "target" or "text"');if(this.text)this.selectFake();else{if(!this.target)thrownewError('Missing required attributes, use either "target" or "text"');this.selectTarget()}},a.prototype.selectFake=function(){vara=this;this.removeFake(),this.fakeHandler=document.body.addEventListener("click",function(){returna.removeFake()}),this.fakeElem=document.createElement("input"),this.fakeElem.style.position="absolute",this.fakeElem.style.left="-9999px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.selectedText=this.text,document.body.appendChild(this.fakeElem),this.fakeElem.select(),this.copyText()},a.prototype.removeFake=function(){this.fakeHandler&&(document.body.removeEventListener("click"),this.fakeHandler=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},a.prototype.selectTarget=function(){if("INPUT"===this.target.nodeName||"TEXTAREA"===this.target.nodeName)this.target.select(),this.selectedText=this.target.value;else{vara=document.createRange(),b=window.getSelection();a.selectNodeContents(this.target),b.addRange(a),this.selectedText=b.toString()}this.copyText()},a.prototype.copyText=function(){vara=void0;try{a=document.execCommand(this.action)}catch(b){a=!1}this.handleResult(a)},a.prototype.handleResult=function(a){a?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)})},a.prototype.clearSelection=function(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},e(a,[{key:"action",set:function(){vara=arguments.length<=0||void0===arguments[0]?"copy":arguments[0];if(this._action=a,"copy"!==this._action&&"cut"!==this._action)thrownewError('Invalid "action" value, use either "copy" or "cut"')},get:function(){returnthis._action}},{key:"target",set:function(a){if(void0!==a){if(!a||"object"!=typeofa||1!==a.nodeType)thrownewError('Invalid "target" value, use a valid Element');this._target=a}},get:function(){returnthis._target}}]),a}();c["default"]=f,b.exports=c["default"]},{}],7:[function(a,b,c){"use strict";functiond(a){returna&&a.__esModule?a:{"default":a}}functione(a,b){if(!(ainstanceofb))thrownewTypeError("Cannot call a class as a function")}functionf(a,b){if("function"!=typeofb&&null!==b)thrownewTypeError("Super expression must either be null or a function, not "+typeofb);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.__esModule=!0;varg=a("./clipboard-action"),h=d(g),i=a("delegate-events"),j=d(i),k=a("tiny-emitter"),l=d(k),m="data-clipboard-",n=function(a){functionb(c,d){e(this,b),a.call(this),this.resolveOptions(d),this.delegateClick(c)}returnf(b,a),b.prototype.resolveOptions=function(){vara=arguments.length<=0||void0===arguments[0]?{}:arguments[0];this.action="function"==typeofa.action?a.action:this.setAction,this.target="function"==typeofa.target?a.target:this.setTarget,this.text="function"==typeofa.text?a.text:this.setText},b.prototype.delegateClick=function(a){varb=this;j["default"].bind(document.body,a,"click",function(a){returnb.initialize(a)})},b.prototype.initialize=function(a){this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=newh["default"]({action:this.action(a.delegateTarget),target:this.target(a.delegateTarget),text:this.text(a.delegateTarget),trigger:a.delegateTarget,emitter:this})},b.prototype.setAction=function(a){returna.hasAttribute(m+"action")?a.getAttribute(m+"action"):void0},b.prototype.setTarget=function(a){if(a.hasAttribute(m+"target")){varb=a.getAttribute(m+"target");returndocument.querySelector(b)}},b.prototype.setText=function(a){returna.hasAttribute(m+"text")?a.getAttribute(m+"text"):void0},b}(l["default"]);c["default"]=n,b.exports=c["default"]},{"./clipboard-action":6,"delegate-events":1,"tiny-emitter":5}]},{},[7])(7)});