/*! * clipboard.js v1.6.1 * https://zenorocha.github.io/clipboard.js * * licensed mit © zeno rocha */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.clipboard=e()}}(function(){var e,t,n;return function e(t,n,o){function i(a,c){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var u=new error("cannot find module '"+a+"'");throw u.code="module_not_found",u}var s=n[a]={exports:{}};t[a][0].call(s.exports,function(e){var n=t[a][1][e];return i(n?n:e)},s,s.exports,e,t,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a0&&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=""}},{key:"initselection",value:function e(){this.text?this.selectfake():this.target&&this.selecttarget()}},{key:"selectfake",value:function e(){var t=this,n="rtl"==document.documentelement.getattribute("dir");this.removefake(),this.fakehandlercallback=function(){return t.removefake()},this.fakehandler=document.body.addeventlistener("click",this.fakehandlercallback)||!0,this.fakeelem=document.createelement("textarea"),this.fakeelem.style.fontsize="12pt",this.fakeelem.style.border="0",this.fakeelem.style.padding="0",this.fakeelem.style.margin="0",this.fakeelem.style.position="absolute",this.fakeelem.style[n?"right":"left"]="-9999px";var o=window.pageyoffset||document.documentelement.scrolltop;this.fakeelem.style.top=o+"px",this.fakeelem.setattribute("readonly",""),this.fakeelem.value=this.text,document.body.appendchild(this.fakeelem),this.selectedtext=(0,i.default)(this.fakeelem),this.copytext()}},{key:"removefake",value:function e(){this.fakehandler&&(document.body.removeeventlistener("click",this.fakehandlercallback),this.fakehandler=null,this.fakehandlercallback=null),this.fakeelem&&(document.body.removechild(this.fakeelem),this.fakeelem=null)}},{key:"selecttarget",value:function e(){this.selectedtext=(0,i.default)(this.target),this.copytext()}},{key:"copytext",value:function e(){var t=void 0;try{t=document.execcommand(this.action)}catch(e){t=!1}this.handleresult(t)}},{key:"handleresult",value:function e(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedtext,trigger:this.trigger,clearselection:this.clearselection.bind(this)})}},{key:"clearselection",value:function e(){this.target&&this.target.blur(),window.getselection().removeallranges()}},{key:"destroy",value:function e(){this.removefake()}},{key:"action",set:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new error('invalid "action" value, use either "copy" or "cut"')},get:function e(){return this._action}},{key:"target",set:function e(t){if(void 0!==t){if(!t||"object"!==("undefined"==typeof t?"undefined":r(t))||1!==t.nodetype)throw new error('invalid "target" value, use a valid element');if("copy"===this.action&&t.hasattribute("disabled"))throw new error('invalid "target" attribute. please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasattribute("readonly")||t.hasattribute("disabled")))throw new error('invalid "target" attribute. you can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function e(){return this._target}}]),e}();e.exports=c})},{select:5}],8:[function(t,n,o){!function(i,r){if("function"==typeof e&&e.amd)e(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if("undefined"!=typeof o)r(n,t("./clipboard-action"),t("tiny-emitter"),t("good-listener"));else{var a={exports:{}};r(a,i.clipboardaction,i.tinyemitter,i.goodlistener),i.clipboard=a.exports}}(this,function(e,t,n,o){"use strict";function i(e){return e&&e.__esmodule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function a(e,t){if(!e)throw new referenceerror("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.setprototypeof?object.setprototypeof(e,t):e.__proto__=t)}function l(e,t){var n="data-clipboard-"+e;if(t.hasattribute(n))return t.getattribute(n)}var u=i(t),s=i(n),f=i(o),d=function(){function e(e,t){for(var n=0;n0&&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}},{key:"listenclick",value:function e(t){var n=this;this.listener=(0,f.default)(t,"click",function(e){return n.onclick(e)})}},{key:"onclick",value:function e(t){var n=t.delegatetarget||t.currenttarget;this.clipboardaction&&(this.clipboardaction=null),this.clipboardaction=new u.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})}},{key:"defaultaction",value:function e(t){return l("action",t)}},{key:"defaulttarget",value:function e(t){var n=l("target",t);if(n)return document.queryselector(n)}},{key:"defaulttext",value:function e(t){return l("text",t)}},{key:"destroy",value:function e(){this.listener.destroy(),this.clipboardaction&&(this.clipboardaction.destroy(),this.clipboardaction=null)}}],[{key:"issupported",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],n="string"==typeof t?[t]:t,o=!!document.querycommandsupported;return n.foreach(function(e){o=o&&!!document.querycommandsupported(e)}),o}}]),t}(s.default);e.exports=h})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)});