(window.webpackJsonp=window.webpackJsonp||[]).push([[121],{745:function(t,e,n){"use strict";n.r(e);n(17);var o={props:{libraryItemId:String,showFullPath:Boolean,track:{type:Object,default:function(){}}},data:function(){return{}},computed:{userToken:function(){return this.$store.getters["user/getToken"]},userCanDownload:function(){return this.$store.getters["user/getUserCanDownload"]},userCanDelete:function(){return this.$store.getters["user/getUserCanDelete"]},userIsAdmin:function(){return this.$store.getters["user/getIsAdminOrUp"]},contextMenuItems:function(){var t=[];return this.userCanDownload&&t.push({text:this.$strings.LabelDownload,action:"download"}),this.userCanDelete&&t.push({text:this.$strings.ButtonDelete,action:"delete"}),this.userIsAdmin&&t.push({text:this.$strings.LabelMoreInfo,action:"more"}),t},downloadUrl:function(){return"".concat("/audiobookshelf","/api/items/").concat(this.libraryItemId,"/file/").concat(this.track.audioFile.ino,"/download?token=").concat(this.userToken)}},methods:{contextMenuAction:function(t){var e=t.action;"delete"===e?this.deleteLibraryFile():"download"===e?this.downloadLibraryFile():"more"===e&&this.$emit("showMore",this.track.audioFile)},deleteLibraryFile:function(){var t=this,e={message:this.$strings.MessageConfirmDeleteFile,callback:function(e){e&&t.$axios.$delete("/api/items/".concat(t.libraryItemId,"/file/").concat(t.track.audioFile.ino)).then((function(){t.$toast.success(t.$strings.ToastDeleteFileSuccess)})).catch((function(e){console.error("Failed to delete file",e),t.$toast.error(t.$strings.ToastDeleteFileFailed)}))},type:"yesNo"};this.$store.commit("globals/setConfirmPrompt",e)},downloadLibraryFile:function(){this.$downloadFile(this.downloadUrl,this.track.metadata.filename)}},mounted:function(){}},r=n(4),component=Object(r.a)(o,(function(){var t=this,e=t._self._c;return e("tr",[e("td",{staticClass:"text-center"},[e("p",[t._v(t._s(t.track.index))])]),t._v(" "),e("td",{staticClass:"font-sans"},[t._v(t._s(t.showFullPath?t.track.metadata.path:t.track.metadata.filename))]),t._v(" "),t.showFullPath?t._e():e("td",{staticClass:"hidden lg:table-cell"},[t._v("\n    "+t._s(t.track.audioFile.codec||"")+"\n  ")]),t._v(" "),t.showFullPath?t._e():e("td",{staticClass:"hidden xl:table-cell"},[t._v("\n    "+t._s(t.$bytesPretty(t.track.audioFile.bitRate||0,0))+"\n  ")]),t._v(" "),e("td",{staticClass:"hidden md:table-cell"},[t._v("\n    "+t._s(t.$bytesPretty(t.track.metadata.size))+"\n  ")]),t._v(" "),e("td",{staticClass:"hidden sm:table-cell"},[t._v("\n    "+t._s(t.$secondsToTimestamp(t.track.duration))+"\n  ")]),t._v(" "),t.contextMenuItems.length?e("td",{staticClass:"text-center"},[e("ui-context-menu-dropdown",{attrs:{items:t.contextMenuItems,"menu-width":110},on:{action:t.contextMenuAction}})],1):t._e()])}),[],!1,null,null,null);e.default=component.exports;installComponents(component,{UiContextMenuDropdown:n(349).default})}}]);