text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("VueOss",[],t):"object"==typeof exports?exports.VueOss=t():e.VueOss=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";var i=n(5),s=n.n(i);t.a={name:"vueOssUploader",data:()=>({id:"upload-input-file",client:null,localKeySet:{},fileReg:/\.(png|jpe?g|gif|svg|flv|mp4|wav|mp3|pcm)(\?.*)?$/}),props:{debug:{type:Boolean,default:!1},path:{type:String,default:"o2o/"},nameMode:{type:Number,default:1},name:{type:String,default:""},fileType:{type:String,default:"img"},fileSuffix:{type:String,default:""},swidth:{type:Number,default:70},sheight:{type:Number,default:70},keySet:{type:Object,default:()=>({key:"",region:"",secret:"",bucket:""})}},created(){this.id="upload-input-file"+Math.random(),this.LoadJS("js_aliyun_oss","https://gosspublic.alicdn.com/aliyun-oss-sdk-4.10.0.min.js"),this.preInit()},mounted(){this.keySet&&this.keySet.key?this.localKeySet=this.keySet:window._VueOssUploader?this.localKeySet={key:window._VueOssUploader.key,region:window._VueOssUploader.region,secret:window._VueOssUploader.secret,bucket:window._VueOssUploader.bucket}:(console.error("oss配置信息缺失"),this.$emit("error",{msg:"oss配置信息缺失"}))},methods:{preInit(){let e=setInterval(()=>{window.OSS?(this.init(),clearInterval(e),e=null,this.debug&&window.console.log("阿里云oss初始化完成")):this.debug&&window.console.log("阿里云oss初始化中...")},500)},init(){this.localKeySet.bucket?this.localKeySet.secret?this.localKeySet.key?this.localKeySet.region?this.client=new OSS.Wrapper({endpoint:"https://oss-cn-"+this.localKeySet.region+".aliyuncs.com",accessKeyId:this.localKeySet.key,accessKeySecret:this.localKeySet.secret,bucket:this.localKeySet.bucket}):this.$emit("error",{msg:"请设置区域"}):this.$emit("error",{msg:"请设置key"}):this.$emit("error",{msg:"请设置secret"}):this.$emit("error",{msg:"请设置bucket"})},upload(e){if(0===e.target.files.length)return;if(!this.client)return void this.$emit("error",{msg:"oss初始化未完成"});let t=e.target.files[0],n="";if(t)if(e.target.value="",this.fileReg.test(t.name.toLowerCase()))if(""===this.fileSuffix||"."+this.fileSuffix===this.get_suffix(t.name)){if(2===this.nameMode)n=this.path+t.name;else if(3===this.nameMode&&this.name.trim())n=this.path+this.name+this.get_suffix(t.name);else{let e=t.name+t.lastModifiedDate+t.size+t.type;n=this.path+s()(e)+this.get_suffix(t.name)}this.debug&&console.log(t.name+" => "+n),this.client.multipartUpload(n,t).then(e=>{this.debug&&console.log("oss result",e);let t=e.url;t||(t=e.res.requestUrls[0].split("?")[0]),this.$emit("success",{ossPath:n,ossUrl:t})}).catch(e=>{this.debug&&console.log(e),this.$emit("error",e)})}else alert("必须选择类型为的"+this.fileSuffix+"文件");else alert("此组件只支持 png|jpeg|jpg|gif|svg|flv|mp4|wav|mp3|pcm 类型的文件");else alert("您未选择上传文件")},LoadJS(e,t,n){if(!document.querySelector(e)){var i=document.createElement("script");i.src=t,n&&(i.onload=n),i.id=e,document.body.appendChild(i)}},get_suffix(e){var t=e.lastIndexOf("."),n="";return-1!==t&&(n=e.substring(t)),n}},computed:{initSize(){return{width:this.swidth+"px",height:this.sheight+"px",lineHeight:this.sheight-4+"px"}}},watch:{keySet:{handler(e,t){this.preInit()},deep:!0}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2);const s={install:function(e,t){console.log("vueOssUploader, install",t),window._VueOssUploader=t,e.component("vueOssUploader",i.a)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(s),t.default=s},function(e,t,n){"use strict";var i=n(0),s=n(6);var r=function(e){n(3)},o=n(4)(i.a,s.a,!1,r,null,null);t.a=o.exports},function(e,t){},function(e,t){e.exports=function(e,t,n,i,s,r){var o,u=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(o=e,u=e.default);var a,c="function"==typeof u?u.options:u;if(t&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0),n&&(c.functional=!0),s&&(c._scopeId=s),r?(a=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},c._ssrRegister=a):i&&(a=i),a){var f=c.functional,d=f?c.render:c.beforeCreate;f?(c._injectStyles=a,c.render=function(e,t){return a.call(t),d(e,t)}):c.beforeCreate=d?[].concat(d,a):[a]}return{esModule:o,exports:u,options:c}}},function(e,t,n){var i;!function(s){"use strict";function r(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,t,n,i,s,o){return r((u=r(r(t,e),r(i,o)))<<(l=s)|u>>>32-l,n);var u,l}function u(e,t,n,i,s,r,u){return o(t&n|~t&i,e,t,s,r,u)}function l(e,t,n,i,s,r,u){return o(t&i|n&~i,e,t,s,r,u)}function a(e,t,n,i,s,r,u){return o(t^n^i,e,t,s,r,u)}function c(e,t,n,i,s,r,u){return o(n^(t|~i),e,t,s,r,u)}function f(e,t){var n,i,s,o,f;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var d=1732584193,h=-271733879,p=-1732584194,g=271733878;for(n=0;n<e.length;n+=16)i=d,s=h,o=p,f=g,h=c(h=c(h=c(h=c(h=a(h=a(h=a(h=a(h=l(h=l(h=l(h=l(h=u(h=u(h=u(h=u(h,p=u(p,g=u(g,d=u(d,h,p,g,e[n],7,-680876936),h,p,e[n+1],12,-389564586),d,h,e[n+2],17,606105819),g,d,e[n+3],22,-1044525330),p=u(p,g=u(g,d=u(d,h,p,g,e[n+4],7,-176418897),h,p,e[n+5],12,1200080426),d,h,e[n+6],17,-1473231341),g,d,e[n+7],22,-45705983),p=u(p,g=u(g,d=u(d,h,p,g,e[n+8],7,1770035416),h,p,e[n+9],12,-1958414417),d,h,e[n+10],17,-42063),g,d,e[n+11],22,-1990404162),p=u(p,g=u(g,d=u(d,h,p,g,e[n+12],7,1804603682),h,p,e[n+13],12,-40341101),d,h,e[n+14],17,-1502002290),g,d,e[n+15],22,1236535329),p=l(p,g=l(g,d=l(d,h,p,g,e[n+1],5,-165796510),h,p,e[n+6],9,-1069501632),d,h,e[n+11],14,643717713),g,d,e[n],20,-373897302),p=l(p,g=l(g,d=l(d,h,p,g,e[n+5],5,-701558691),h,p,e[n+10],9,38016083),d,h,e[n+15],14,-660478335),g,d,e[n+4],20,-405537848),p=l(p,g=l(g,d=l(d,h,p,g,e[n+9],5,568446438),h,p,e[n+14],9,-1019803690),d,h,e[n+3],14,-187363961),g,d,e[n+8],20,1163531501),p=l(p,g=l(g,d=l(d,h,p,g,e[n+13],5,-1444681467),h,p,e[n+2],9,-51403784),d,h,e[n+7],14,1735328473),g,d,e[n+12],20,-1926607734),p=a(p,g=a(g,d=a(d,h,p,g,e[n+5],4,-378558),h,p,e[n+8],11,-2022574463),d,h,e[n+11],16,1839030562),g,d,e[n+14],23,-35309556),p=a(p,g=a(g,d=a(d,h,p,g,e[n+1],4,-1530992060),h,p,e[n+4],11,1272893353),d,h,e[n+7],16,-155497632),g,d,e[n+10],23,-1094730640),p=a(p,g=a(g,d=a(d,h,p,g,e[n+13],4,681279174),h,p,e[n],11,-358537222),d,h,e[n+3],16,-722521979),g,d,e[n+6],23,76029189),p=a(p,g=a(g,d=a(d,h,p,g,e[n+9],4,-640364487),h,p,e[n+12],11,-421815835),d,h,e[n+15],16,530742520),g,d,e[n+2],23,-995338651),p=c(p,g=c(g,d=c(d,h,p,g,e[n],6,-198630844),h,p,e[n+7],10,1126891415),d,h,e[n+14],15,-1416354905),g,d,e[n+5],21,-57434055),p=c(p,g=c(g,d=c(d,h,p,g,e[n+12],6,1700485571),h,p,e[n+3],10,-1894986606),d,h,e[n+10],15,-1051523),g,d,e[n+1],21,-2054922799),p=c(p,g=c(g,d=c(d,h,p,g,e[n+8],6,1873313359),h,p,e[n+15],10,-30611744),d,h,e[n+6],15,-1560198380),g,d,e[n+13],21,1309151649),p=c(p,g=c(g,d=c(d,h,p,g,e[n+4],6,-145523070),h,p,e[n+11],10,-1120210379),d,h,e[n+2],15,718787259),g,d,e[n+9],21,-343485551),d=r(d,i),h=r(h,s),p=r(p,o),g=r(g,f);return[d,h,p,g]}function d(e){var t,n="",i=32*e.length;for(t=0;t<i;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function h(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var i=8*e.length;for(t=0;t<i;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function p(e){var t,n,i="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),i+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return i}function g(e){return unescape(encodeURIComponent(e))}function m(e){return function(e){return d(f(h(e),8*e.length))}(g(e))}function y(e,t){return function(e,t){var n,i,s=h(e),r=[],o=[];for(r[15]=o[15]=void 0,s.length>16&&(s=f(s,8*e.length)),n=0;n<16;n+=1)r[n]=909522486^s[n],o[n]=1549556828^s[n];return i=f(r.concat(h(t)),512+8*t.length),d(f(o.concat(i),640))}(g(e),g(t))}function v(e,t,n){return t?n?y(t,e):p(y(t,e)):n?m(e):p(m(e))}void 0===(i=function(){return v}.call(t,n,t,e))||(e.exports=i)}()},function(e,t,n){"use strict";var i={render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"vue-oss-upload-input",style:this.initSize},[t("i",[this._v("+")]),this._v(" "),t("input",{attrs:{type:"file",id:this.id},on:{change:this.upload}})])},staticRenderFns:[]};t.a=i}])});
  //# sourceMappingURL=vueoss.min.js.map