text: (function(t){function e(e){for(var o,i,s=e[0],l=e[1],c=e[2],d=0,p=[];d<s.length;d++)i=s[d],Object.prototype.hasOwnProperty.call(a,i)&&a[i]&&p.push(a[i][0]),a[i]=0;for(o in l)Object.prototype.hasOwnProperty.call(l,o)&&(t[o]=l[o]);u&&u(e);while(p.length)p.shift()();return r.push.apply(r,c||[]),n()}function n(){for(var t,e=0;e<r.length;e++){for(var n=r[e],o=!0,s=1;s<n.length;s++){var l=n[s];0!==a[l]&&(o=!1)}o&&(r.splice(e--,1),t=i(i.s=n[0]))}return t}var o={},a={app:0},r=[];function i(e){if(o[e])return o[e].exports;var n=o[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=o,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],l=s.push.bind(s);s.push=e,s=s.slice();for(var c=0;c<s.length;c++)e(s[c]);var u=l;r.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"38c3":function(t,e,n){},"452c":function(t,e,n){},"4a28":function(t,e,n){"use strict";n("38c3")},"56d7":function(t,e,n){"use strict";n.r(e);n("e260"),n("e6cf"),n("cca6"),n("a79d");var o=n("2b0e"),a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("v-app",[n("v-app-bar",{attrs:{app:"",color:"primary",dark:""}},[n("v-icon",[t._v("mdi-share-variant")]),n("v-app-bar-title",{staticClass:"app-title"},[t._v("爱分享，我的分享")]),n("v-spacer"),t.allowUpload?n("v-btn",{attrs:{text:""},on:{click:t.uploadFile}},[n("v-icon",[t._v("mdi-cloud-upload")])],1):t._e(),n("v-btn",{attrs:{text:""},on:{click:t.copyAllDownloadUrl}},[n("v-icon",[t._v("mdi-content-copy")])],1)],1),n("v-main",[n("ShareList",{ref:"shareList"}),n("file-upload",{ref:"fileUpload"})],1)],1)},r=[],i=(n("a15b"),function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("v-list",[n("v-list-item-group",{attrs:{color:"primary"}},t._l(t.items,(function(e,o){return n("div",{key:o},[n("v-list-item",{on:{click:function(){return t.download(e.url)}}},[n("v-list-item-icon",[n("v-icon",{domProps:{textContent:t._s(e.icon)}})],1),n("v-list-item-content",[n("v-list-item-title",{domProps:{textContent:t._s(e.fileName)}})],1),n("v-list-item-action",[n("v-icon",[t._v("mdi-download")])],1)],1),n("v-divider")],1)})),0)],1)],1)}),s=[],l=(n("d81d"),n("d3b7"),n("2ca0"),n("bc3a")),c=n.n(l);c.a.defaults.baseURL=window.location.origin,c.a.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded";var u=c.a;function d(t){return new Promise((function(e,n){var o={headers:{token:btoa(t)}};u.post("/shares",{},o).then((function(t){if(200!==t.status)n(new Error(t.statusText));else{var o=t.data;e(o)}})).catch(n)}))}function p(){return new Promise((function(t,e){u.get("/auth/auth-config").then((function(n){if(200!==n.status)e(new Error(n.statusText));else{var o=n.data;t(o.requireAuth)}})).catch(e)}))}function f(){return new Promise((function(t,e){u.get("/auth/allow-upload").then((function(n){if(200!==n.status)e(new Error(n.statusText));else{var o=n.data;t(o.allowUpload)}})).catch(e)}))}function h(t){return new Promise((function(e,n){u.post("/auth/validate",{},{headers:{token:btoa(t)}}).then(e).catch((function(t){if(403!==t.response.status)n(new Error(t.message));else{var e=t.message+". wrong password!";n(new Error(e))}}))}))}var v={name:"ShareList",data:function(){return{items:[]}},created:function(){this.loadData()},methods:{loadData:function(){var t=this;p().then((function(e){return e?sessionStorage.getItem("password")?Promise.resolve(sessionStorage.getItem("password")):t.$requirePassword():Promise.resolve()})).catch((function(t){console.log(t.message)})).then((function(t){return sessionStorage.setItem("password",t),d(t)})).then((function(e){t.$data.items=e})).catch((function(e){sessionStorage.setItem("password",""),t.$showError(e.message)}))},download:function(t){window.open(t)},getAllDownloadUrl:function(){for(var t=this.items.map((function(t){return t.url})),e=0;e<t.length;++e){var n=t[e];if(!n.startsWith("http://")){var o=window.location.origin;t[e]=o+n}}return t}}},m=v,w=n("2877"),g=n("6544"),b=n.n(g),y=n("ce7e"),T=n("132d"),x=n("8860"),_=n("da13"),k=n("1800"),C=n("5d23"),V=n("1baa"),P=n("34c3"),O=Object(w["a"])(m,i,s,!1,null,null,null),E=O.exports;b()(O,{VDivider:y["a"],VIcon:T["a"],VList:x["a"],VListItem:_["a"],VListItemAction:k["a"],VListItemContent:C["a"],VListItemGroup:V["a"],VListItemIcon:P["a"],VListItemTitle:C["c"]});var I=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("input",{ref:"fileInput",staticClass:"hidden-input",attrs:{type:"file",multiple:""}}),t.upload.displayDialog?t._e():n("v-btn",{staticClass:"floating-button",attrs:{color:"pink",dark:"",small:"",absolute:"",bottom:"",right:"",fab:""},on:{click:function(e){t.upload.displayDialog=!0}}},[n("v-icon",[t._v("mdi-water")])],1),n("v-dialog",{attrs:{width:"600",persistent:!0},model:{value:t.upload.displayDialog,callback:function(e){t.$set(t.upload,"displayDialog",e)},expression:"upload.displayDialog"}},[n("v-card",[n("v-card-title",{staticClass:"headline grey lighten-2",attrs:{"primary-title":""}},[t._v(" 文件上传 ")]),0===t.upload.items.length?n("v-card-text",{staticClass:"no-content-text"},[t._v("no content")]):t._e(),n("v-card-text",{staticClass:"no-padding"},[n("v-list",t._l(t.upload.items,(function(e,o){return n("div",{key:o},[n("v-progress-linear",{staticClass:"list-item-progress-bar",attrs:{"background-opacity":"0",color:"rgba(200,200,200,0.4)",height:"45",value:e.uploadProgress}},[n("v-list-item",{key:e.fileName,staticClass:"list-item"},[n("v-list-item-avatar",[n("v-icon",{domProps:{textContent:t._s(e.icon)}})],1),n("v-list-item-content",{staticClass:"list-item-content"},[n("v-list-item-title",{domProps:{innerHTML:t._s(e.fileName)}}),n("v-list-item-subtitle",{domProps:{innerHTML:t._s(e.uploadProgressText)}})],1),n("v-list-item-action",[t.isUploadFinished(e)?n("v-icon",{attrs:{color:"green",dense:!0}},[t._v("mdi-checkbox-marked-circle")]):t._e(),t.isUploadAbort(e)?n("v-icon",{attrs:{color:"red",dense:!0}},[t._v("mdi-alert-circle")]):t._e()],1)],1)],1)],1)})),0)],1),n("v-divider"),n("v-card-actions",[n("v-spacer"),n("v-btn",{attrs:{color:"primary",text:""},on:{click:t.cancel}},[t._v(" Cancel ")]),n("v-btn",{attrs:{color:"primary",text:""},on:{click:function(e){t.upload.displayDialog=!1}}},[t._v(" Hide ")])],1)],1)],1)],1)},S=[],$=(n("99af"),n("b0c0"),n("d4ec")),D=n("bee2"),B={NOT_YET_START:"待上传",UPLOADING:"上传中",ABORTED:"已终止",FINISHED:"已完成"},A=function(){function t(){Object($["a"])(this,t),this.status=B.NOT_YET_START,this.onUploadProgress=null,this.password=null,this.source=u.CancelToken.source()}return Object(D["a"])(t,[{key:"upload",value:function(t){var e=new FormData;return e.append("file",t),u.put("/files",e,{headers:{token:btoa(this.password)},onUploadProgress:this.onUploadProgress})}},{key:"cancel",value:function(){this.source.cancel("用户取消上传")}}]),t}(),F=(n("b680"),n("4128")),L=n.n(F),U=new L.a("1024"),j=new L.a("1048576"),N=new L.a("1073741824"),M=new L.a("1099511627776");function q(t){return new L.a(t).div(U)}function H(t){return new L.a(t).div(j)}function R(t){return new L.a(t).div(N)}function G(t){return new L.a(t).div(M)}function K(t){return t=new L.a(t),t.lessThan(U)?"Byte":t.greaterThanOrEqualTo(U)&&t.lessThan(j)?"KB":t.greaterThanOrEqualTo(j)&&t.lessThan(N)?"MB":t.greaterThanOrEqualTo(N)?"GB":"TB"}function W(t){return t=new L.a(t),t.lessThan(U)?"".concat(t,"Byte"):t.greaterThanOrEqualTo(U)&&t.lessThan(j)?"".concat(q(t).toFixed(2),"KB"):t.greaterThanOrEqualTo(j)&&t.lessThan(N)?"".concat(H(t).toFixed(2),"MB"):t.greaterThanOrEqualTo(N)?"".concat(R(t).toFixed(2),"GB"):"".concat(G(t).toFixed(2),"TB")}var Y={chooseTheMostSuitableUnit:K,toHumanFriendlyFormat:W,toGB:R,toMB:H,toKB:q},z={name:"FileUpload",data:function(){return{upload:{displayDialog:!1,items:[],password:""}}},methods:{selectFiles:function(){var t=this.$refs.fileInput,e=this;return new Promise((function(n){t.value="",t.click(),t.addEventListener("change",(function(){e.appendItems(t.files),t.value="",n(e.upload.items)}))}))},appendItems:function(t){for(var e=0;e<t.length;++e){var n=this.getProgressText(0,t[e].size);this.upload.items.push({file:t[e],icon:"mdi-file",fileName:t[e].name,size:t[e].size,uploadProgressText:n,uploadProgress:0,uploader:null,status:B.NOT_YET_START})}},uploadFiles:function(){var t=this,e=this;p().then((function(t){return t&&!sessionStorage.getItem("password")?e.$requirePassword():Promise.resolve(sessionStorage.getItem("password"))})).then((function(t){return sessionStorage.setItem("password",t),e.upload.password=t,Promise.resolve(t)})).then((function(t){return h(t)})).catch((function(t){return e.upload.items=[],sessionStorage.setItem("password",""),Promise.reject(t)})).then((function(){e.upload.displayDialog=!0;for(var n=0;n<t.upload.items.length;++n){var o=t.upload.items[n];o.status===B.NOT_YET_START&&t.uploadFile(n)}})).catch((function(t){e.$showError(t.message)}))},uploadFile:function(t){var e=this.upload.items[t];e.status=B.UPLOADING,e.uploader=new A;var n=this;e.uploader.onUploadProgress=function(t){if(t.lengthComputable){var o=new L.a(t.loaded),a=new L.a(t.total);e.uploadProgressText=n.getProgressText(t.loaded,t.total),e.uploadProgress=o.div(a).mul(100).toNumber(),o.equals(a)&&(e.status=B.FINISHED)}},e.uploader.password=n.upload.password,e.uploader.upload(e.file).catch((function(t){n.$showError(t.message),e.status=B.ABORTED}))},cancel:function(){for(var t=0;t<this.upload.items.length;++t){var e=this.upload.items[t];e.status===B.UPLOADING&&(e.uploader.cancel(),e.status=B.ABORTED)}this.upload.items=[],this.upload.displayDialog=!1},getProgressText:function(t,e){var n=Y.toHumanFriendlyFormat(t),o=Y.toHumanFriendlyFormat(e);return"".concat(n,"/").concat(o)},isUploadFinished:function(t){return t.status===B.FINISHED},isUploadAbort:function(t){return t.status===B.ABORTED}}},J=z,Q=(n("4a28"),n("8336")),X=n("b0af"),Z=n("99d9"),tt=n("169a"),et=n("8270"),nt=n("8e36"),ot=n("2fa4"),at=Object(w["a"])(J,I,S,!1,null,"8659869c",null),rt=at.exports;b()(at,{VBtn:Q["a"],VCard:X["a"],VCardActions:Z["a"],VCardText:Z["b"],VCardTitle:Z["c"],VDialog:tt["a"],VDivider:y["a"],VIcon:T["a"],VList:x["a"],VListItem:_["a"],VListItemAction:k["a"],VListItemAvatar:et["a"],VListItemContent:C["a"],VListItemSubtitle:C["b"],VListItemTitle:C["c"],VProgressLinear:nt["a"],VSpacer:ot["a"]});var it=n("d576"),st={name:"App",components:{ShareList:E,FileUpload:rt},data:function(){return{allowUpload:!1}},created:function(){this.initData()},methods:{initData:function(){var t=this;f().then((function(e){t.allowUpload=e})).catch((function(e){t.$showError(e.message)}))},uploadFile:function(){var t=this.$refs.fileUpload;t.selectFiles().then((function(){t.uploadFiles()}))},copyAllDownloadUrl:function(){var t=this,e=this.$refs.shareList.getAllDownloadUrl();if(e.length>0){var n=e.join("\n");it["a"](n).then((function(){t.$showSuccess("The download link has been copied to the clipboard")}),(function(){t.$showSuccess("Unable to copy the download link to the clipboard")}))}else t.$showWarning("nothing copied")}}},lt=st,ct=(n("b89c"),n("b0a0"),n("7496")),ut=n("40dc"),dt=n("bb78"),pt=n("f6c4"),ft=Object(w["a"])(lt,a,r,!1,null,"3ea34242",null),ht=ft.exports;b()(ft,{VApp:ct["a"],VAppBar:ut["a"],VAppBarTitle:dt["a"],VBtn:Q["a"],VIcon:T["a"],VMain:pt["a"],VSpacer:ot["a"]});var vt=n("f309");o["a"].use(vt["a"]);var mt=new vt["a"]({theme:{themes:{light:{primary:"#3f51b5",secondary:"#b0bec5",accent:"#8c9eff",error:"#b71c1c"}}}}),wt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("v-dialog",{attrs:{width:"500",persistent:!0},model:{value:t.open,callback:function(e){t.open=e},expression:"open"}},[n("v-card",[n("v-card-title",{staticClass:"headline grey lighten-2",attrs:{"primary-title":""}},[t._v(" 需要密码 ")]),n("v-card-text",{staticClass:"bottom-no-padding"},[n("v-text-field",{attrs:{autofocus:!0,placeholder:"请输入密码"},on:{keyup:t.handleKeyboardEvent},model:{value:t.password,callback:function(e){t.password=e},expression:"password"}})],1),n("v-divider"),n("v-card-actions",[n("v-spacer"),n("v-btn",{attrs:{color:"primary",text:""},on:{click:t.handleCancelButtonClick}},[t._v(" Cancel ")]),n("v-btn",{attrs:{color:"primary",text:""},on:{click:t.handleOkButtonClick}},[t._v(" OK ")])],1)],1)],1)},gt=[],bt={name:"AuthDialog",props:{open:Boolean},data:function(){return{password:""}},methods:{handleCancelButtonClick:function(){this.$emit("cancel")},handleOkButtonClick:function(){this.$emit("ok",this.password)},handleKeyboardEvent:function(t){13!==t.keyCode?27===t.keyCode&&this.handleCancelButtonClick():this.handleOkButtonClick()}}},yt=bt,Tt=(n("f13f"),n("8654")),xt=Object(w["a"])(yt,wt,gt,!1,null,"67579d8a",null),_t=xt.exports;b()(xt,{VBtn:Q["a"],VCard:X["a"],VCardActions:Z["a"],VCardText:Z["b"],VCardTitle:Z["c"],VDialog:tt["a"],VDivider:y["a"],VSpacer:ot["a"],VTextField:Tt["a"]});var kt=o["a"].extend(_t),Ct=function(){var t=new kt({vuetify:mt});return t.$mount(),document.body.appendChild(t.$el),t},Vt={install:function(t,e){t.prototype.$requirePassword=function(){return new Promise((function(t,e){var n=Ct();n.open=!0,n.$on("cancel",(function(){n.open=!1,document.body.removeChild(n.$el),e(new Error("user cancel"))})),n.$on("ok",(function(){n.open=!1,document.body.removeChild(n.$el),t(n.password)}))}))}}},Pt=Vt,Ot=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("v-snackbar",{attrs:{timeout:t.timeout,color:t.color,top:!0},scopedSlots:t._u([{key:"action",fn:function(e){var o=e.attrs;return[n("v-btn",t._b({attrs:{text:""},on:{click:function(e){t.display=!1}}},"v-btn",o,!1),[t._v(" Close ")])]}}]),model:{value:t.display,callback:function(e){t.display=e},expression:"display"}},[t._v(" "+t._s(t.text)+" ")])},Et=[],It={name:"Toast",data:function(){return{display:this.show,text:"",color:"#2196f3",timeout:6e3}},methods:{showMessage:function(t){this.text=t,this.color="#2196f3",this.display=!0},showSuccess:function(t){this.text=t,this.color="#4caf50",this.display=!0},showWarning:function(t){this.text=t,this.color="#ff9800",this.display=!0},showError:function(t){this.text=t,this.color="#f44336",this.display=!0}}},St=It,$t=n("2db4"),Dt=Object(w["a"])(St,Ot,Et,!1,null,"ad883c22",null),Bt=Dt.exports;b()(Dt,{VBtn:Q["a"],VSnackbar:$t["a"]});var At=o["a"].extend(Bt),Ft=function(){var t=new At({vuetify:mt});return t.$mount(),document.body.appendChild(t.$el),t},Lt={install:function(t,e){if(!this.installed){this.installed=!0;var n=Ft();t.prototype.$showMessage=function(t){n.showMessage(t)},t.prototype.$showSuccess=function(t){n.showSuccess(t)},t.prototype.$showWarning=function(t){n.showWarning(t)},t.prototype.$showError=function(t){n.showError(t)}}}};o["a"].config.productionTip=!1,o["a"].use(Pt),o["a"].use(Lt),new o["a"]({vuetify:mt,render:function(t){return t(ht)}}).$mount("#app")},"89f0":function(t,e,n){},b0a0:function(t,e,n){"use strict";n("452c")},b89c:function(t,e,n){"use strict";n("89f0")},c713:function(t,e,n){},f13f:function(t,e,n){"use strict";n("c713")}});
  //# sourceMappingURL=app.adaa04bd.js.map