(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[4822],{13574:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>o});vari=a(24786),s=a(91584),r=(a(77333),a(74692));consto={components:{VueCropper:s.default,VueTimeago:i.default},props:["profile-id"],data:function(){return{loaded:!1,config:window.App.config,mimes:["image/jpeg","image/png"],page:"landing",pages:["landing","crop","edit","confirm","error","uploading"],uploading:!1,uploadProgress:0,cropper:{aspectRatio:9/16,viewMode:2,zoomable:!0,zoom:null},mediaUrl:null,mediaId:null,stories:[],lightboxMedia:!1,duration:3}},mounted:function(){vart=this;r("body").addClass("bg-black"),this.mediaWatcher(),axios.get("/api/stories/v0/fetch/"+this.profileId).then((function(e){t.stories=e.data.map((function(t){returnt.showViewers=!1,t.viewers=[],t})),t.loaded=!0}))},methods:{upload:function(){r('.file-input[name="media"]').trigger("click")},mediaWatcher:function(){vart=this;r(document).on("change","#pf-dz",(function(e){t.triggerUpload()}))},triggerUpload:function(){vart=this;t.uploading=!0;vare=document.querySelector("#pf-dz");t.page="uploading",Array.prototype.forEach.call(e.files,(function(e,a){if(t.media&&t.media.length+a>=t.config.uploader.album_limit)returnswal("Error","You can only upload "+t.config.uploader.album_limit+" photos per album","error"),t.uploading=!1,void(t.page=2);vari=e.type;if(-1==r.inArray(i,t.mimes))returnswal("Invalid File Type","The file you are trying to add is not a valid mime type. Please upload a "+t.mimes+" only.","error"),t.uploading=!1,void(t.page="error");vars=newFormData;s.append("file",e);varo={onUploadProgress:function(e){vara=Math.floor(100*e.loaded/e.total);t.uploadProgress=a}};e.value=null,axios.post("/api/stories/v0/add",s,o).then((function(e){t.uploadProgress=100,t.uploading=!1,t.mediaUrl=e.data.media_url,t.mediaId=e.data.media_id,t.page="video"===e.data.media_type?"preview":"crop"})).catch((function(a){t.uploading=!1,e.value=null;vari=a.response.data.message?a.response.data.message:"Something went wrong.";swal("Oops!",i,"warning"),t.page="error"})),t.uploadProgress=0}))},expiresTimestamp:function(t){return(t=newDate(1e3*t)).toDateString()+" "+t.toLocaleTimeString()},edit:function(){this.page="edit"},showLightbox:function(t){this.lightboxMedia={url:t.src},this.$refs.lightboxModal.show()},deleteStory:function(t,e){vara=this;1==window.confirm("Are you sure you want to delete this Story?")&&axios.delete("/api/stories/v0/delete/"+t.id).then((function(t){a.stories.splice(e,1),0==a.stories.length&&(window.location.href="/i/stories/new")}))},navigateTo:function(){vart=arguments.length>0&&void0!==arguments[0]?arguments[0]:"/";window.location.href=t},goBack:function(){this.page="landing"},performCrop:function(){vart=this;this.page="cropping";vare=this.$refs.croppa.getData();axios.post("/api/stories/v0/crop",{media_id:this.mediaId,width:e.width,height:e.height,x:e.x,y:e.y}).then((function(e){t.page="preview"}))},deleteCurrentStory:function(){vart={id:this.mediaId};this.deleteStory(t),this.page="landing"},shareStoryToFollowers:function(){vart=this;axios.post("/api/stories/v0/publish",{media_id:this.mediaId,duration:this.duration}).then((function(e){window.location.href="/i/my/story?id="+t.mediaId}))},viewMyStory:function(){window.location.href="/i/my/story"},toggleShowViewers:function(t){this.stories[t].showViewers=!this.stories[t].showViewers}}}},74414:(t,e,a)=>{"use strict";a.r(e),a.d(e,{render:()=>i,staticRenderFns:()=>s});vari=function(){vart=this,e=t._self._c;returne("div",{staticClass:"container mt-2 mt-md-5 bg-black"},[e("input",{staticClass:"d-none file-input",attrs:{type:"file",id:"pf-dz",name:"media",accept:t.config.mimes}}),t._v(" "),e("span",{staticClass:"fixed-top text-right m-3 cursor-pointer",on:{click:function(e){returnt.navigateTo()}}},[e("i",{staticClass:"fas fa-times fa-lg text-white"})]),t._v(" "),t.loaded?e("div",{staticClass:"row"},[e("div",{staticClass:"col-12 col-md-6 offset-md-3 bg-dark rounded-lg"},["landing"==t.page?e("div",{staticClass:"cardcard-bodybg-transparentborder-0shadow-non