(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[597],{30323:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>s});consts={props:["collection-id","profile-id"],data:function(){return{config:window.App.config,loaded:!1,limit:8,step:1,title:"",description:"",visibility:"private",collection:{title:"",description:"",visibility:"public"},id:"",posts:[],tab:"add",tabs:["all","add","order"],recentPosts:[],selectedPost:""}},beforeMount:function(){vart=this;axios.get("/api/local/collection/"+this.collectionId).then((function(i){t.collection=i.data}))},mounted:function(){this.fetchRecentPosts(),this.fetchItems(),axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(t){window._sharedData.curUser=t.data,window.App.util.navatar()}))},methods:{addToIds:function(t){vari=this;axios.post("/api/local/collection/item",{collection_id:this.collectionId,post_id:t}).then((function(t){i.fetchItems(),i.fetchRecentPosts(),i.tab="all",i.id=""})).catch((function(t){swal("Invalid URL","The post you entered was invalid","error"),i.id=""}))},fetchItems:function(){vart=this;axios.get("/api/local/collection/items/"+this.collectionId).then((function(i){t.posts=i.data,t.loaded=!0}))},addId:function(){vart=this.config.uploader.max_collection_length;if(this.posts.length>=t)swal("Error","You can only add "+t+" posts per collection","error");else{vari=this.id,e=window.location.origin,s=i.split("/");i.slice(0,e.length)!==e&&(swal("Invalid URL","You can only add posts from this instance","error"),this.id=""),i.slice(0,e.length+3)===e+"/p/"&&6===s.length||(swal("Invalid URL","Invalid URL","error"),this.id=""),this.addToIds(s[5])}},previewUrl:function(t){returnt.sensitive?"/storage/no-preview.png?v="+(newDate).getTime():t.media_attachments[0].preview_url},previewBackground:function(t){return"background-image: url("+this.previewUrl(t)+");background-size:cover;"},fetchRecentPosts:function(){vart=this;axios.get("/api/pixelfed/v1/accounts/"+this.profileId+"/statuses",{params:{only_media:!0,min_id:1}}).then((function(i){t.recentPosts=i.data.filter((function(i){vare=t.posts.map((function(t){returnt.id}));return"public"==i.visibility&&0==i.sensitive&&-1==e.indexOf(i.id)})).slice(0,3)}))},selectPost:function(t){this.selectedPost=t.id,this.id=t.url},publish:function(){0!=this.posts.length?axios.post("/api/local/collection/"+this.collectionId+"/publish",{title:this.collection.title,description:this.collection.description,visibility:this.collection.visibility}).then((function(t){window.location.href=t.data})).catch((function(t){swal("Something went wrong","There was a problem with your request, please try again later.","error")})):swal("Error","You cannot publish an empty collection")},save:function(){axios.post("/api/local/collection/"+this.collectionId,{title:this.collection.title,description:this.collection.description,visibility:this.collection.visibility}).then((function(t){swal("Saved!","You have successfully saved this collection.","success")}))},deleteCollection:function(){window.confirm("Are you sure you want to delete this collection?")&&axios.delete("/api/local/collection/"+this.collectionId).then((function(t){window.location.href="/"}))}}}},19860:(t,i,e)=>{Vue.component("collection-compose",e(95277).default)},95277:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>a});vars=e(85419),o=e(57725),l={};for(consttino)"default"!==t&&(l[t]=()=>o[t]);e.d(i,l);consta=(0,e(51900).default)(o.default,s.render,s.staticRenderFns,!1,null,null,null).exports},57725:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>l});vars=e(30323),o={};for(consttins)"default"!==t&&(o[t]=()=>s[t]);e.d(i,o);constl=s.default},85419:(t,i,e)=>{"use strict";e.r(i);vars=e(98075),o={};for(consttins)"default"!==t&&(o[t]=()=>s[t]);e.d(i,o)},98075:(t,i,e)=>{"use strict";e.r(i),e.d(i,{render:()=>s,staticRenderFns:()=>o});vars=function(){vart=this,i=t.$createElement,e=t._self._c||i;returne("div",{staticClass:"container"},[t.loaded?e("div",{staticClass:"row"},[t._m(0),t._v(" "),e("div",{staticClass:"col-12 col-md-4 pt-3"},[e("div",{staticClass:"card