PageSourceSearch

https://podster.fm/build/assets/PodcastPlatformsManager-c03839c4.js

js podster.fm collected 2026-09-24 08:53:40 UTC 8,733 bytes, 1 lines download raw bytes

1import{o as d,c as i,b as s,s as S,u,e as L,q as f,z as O,f as w,a as B,w as D,y as j,d as V,m as k,G as m,g as v,v as K,t as U,h as P,k as Z,J as q}from"./app-f96b9a38.js";import{d as F}from"./vuedraggable.umd-2c918f95.js";import{A as Y,R as G,S as H,Y as J,C as Q,P as W,_ as X,O as ee,a as te,b as ae,c as se,I as ne,d as re,L as oe,Z as le}from"./ApplePodcastsIcon-577560be.js";import{_ as de}from"./VKIcon-293b1bd0.js";import{_ as ce}from"./_plugin-vue_export-helper-c27b6911.js";import"./vue.runtime.esm-bundler-cbd40ca6.js";const ie={},ue={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"0.8","stroke-linecap":"round","stroke-linejoin":"round",xmlns:"http://www.w3.org/2000/svg"},he=s("circle",{cx:"12",cy:"12",r:"10"},null,-1),be=s("circle",{cx:"12",cy:"12",r:"4"},null,-1),_e=s("path",{d:"M10.8 10.5 L14.4 12 L10.8 13.5 Z"},null,-1),ye=[he,be,_e];function me(c,r){return d(),i("svg",ue,ye)}const pe=ce(ie,[["render",me]]),ge=["src","alt"],ke=["aria-label"],xe={__name:"PodcastPlatformIcon",props:{slug:{type:String,default:null},iconUrl:{type:String,default:null},alt:{type:String,default:""},size:{type:String,default:"md"},sizeClass:{type:String,default:""}},setup(c){const r=c,o={apple_podcasts:Y,rss:G,spotify:H,yandex_music:J,castbox:Q,pocket_casts:W,vk:de,youtube_music:pe,youtube:X,overcast:ee,castro:te,sound_stream:ae,radio_public:se,i_heart:ne,player_fm:re,litres:oe,zvuk:le},_={sm:"h-5 w-5",md:"h-6 w-6",lg:"h-8 w-8"};let y=S(()=>r.slug?o[r.slug]??null:null),h=S(()=>r.sizeClass||_[r.size]||_.md);return(p,b)=>u(y)?(d(),L(O(u(y)),{key:0,class:f(["shrink-0",u(h)])},null,8,["class"])):c.iconUrl?(d(),i("img",{key:1,src:c.iconUrl,alt:c.alt,class:f(["shrink-0 rounded-md object-contain",u(h)])},null,10,ge)):(d(),i("span",{key:2,class:f(["inline-block shrink-0 rounded-full bg-brand-100 dark:bg-neutral-500",u(h)]),"aria-label":c.alt},null,10,ke))}},fe={class:"space-y-3"},we={class:"flex flex-wrap items-center gap-2 rounded-lg border border-brand-gray-300 bg-white p-2 dark:border-neutral-700 dark:bg-neutral-800 sm:flex-nowrap sm:gap-3 sm:p-3"},ve=["aria-label","title"],Ce=s("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor"},[s("circle",{cx:"5",cy:"3",r:"1.2"}),s("circle",{cx:"5",cy:"8",r:"1.2"}),s("circle",{cx:"5",cy:"13",r:"1.2"}),s("circle",{cx:"11",cy:"3",r:"1.2"}),s("circle",{cx:"11",cy:"8",r:"1.2"}),s("circle",{cx:"11",cy:"13",r:"1.2"})],-1),$e=[Ce],Ie={class:"shrink-0"},Se={class:"min-w-0 flex-1 sm:w-40 sm:flex-initial"},Be=["onUpdate:modelValue","disabled","onBlur"],Ve={key:1,class:"truncate text-sm font-medium text-brand-300 dark:text-neutral-100"},Ke={class:"min-w-0 flex-1"},Ue=["onUpdate:modelValue","disabled","onBlur"],Pe=["title"],Me=["onChange"],ze={class:"inline-flex shrink-0 cursor-pointer items-center gap-2"},Re=["onUpdate:modelValue","disabled","onChange"],Te={class:"text-xs text-brand-100 dark:text-neutral-400"},Ae=["aria-label","title","disabled","onClick"],Ee=s("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[s("path",{d:"m4 4 8 8M12 4l-8 8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1),Ne=[Ee],Le={class:"pt-2"},Oe=["disabled"],De=s("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},[s("path",{d:"M6 1.5v9M1.5 6h9",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1),He={__name:"PodcastPlatformsManager",props:{podcast:{type:Object,required:!0},platformsInitial:{type:Array,required:!0}},setup(c){const r=c;let o=w(r.platformsInitial.map(e=>({...e,rowKey:h(e)}))),_=w(new Set),y=w(!1);function h(e){return e.id??`slug:${e.slug??e.name}`}function p(e){return _.value.has(e.rowKey)}function b(e,a){a?_.value.add(e):_.value.delete(e)}function C(e,a){o.value.splice(e,1,{...a,rowKey:h(a)})}async function x(e,a,t){const l=e.id?`/my/podcasts/${r.podcast.id}/platforms/${e.id}`:`/my/podcasts/${r.podcast.id}/platforms`,n=e.id?t:{...t,slug:e.slug};b(e.rowKey,!0);try{const g=await k.patch(l,n);C(a,g.data.platform)}catch(g){throw m("Не удалось сохранить площадку"),g}finally{b(e.rowKey,!1)}}async function M(e,a){await x(e,a,{is_active:e.is_active})}async function z(e,a){var t;e.url!==(((t=r.platformsInitial[a])==null?void 0:t.url)??null)&&await x(e,a,{url:e.url||null})}async function R(e,a){if(e.is_custom){if(!e.name||e.name.trim().length===0){m("Введите название площадки");return}await x(e,a,{name:e.name})}}async function T(e,a,t){var $;const l=($=e.target.files)==null?void 0:$[0];if(!l)return;const n=new FormData;n.append("icon",l),n.append("_method","PATCH");const g=a.id?`/my/podcasts/${r.podcast.id}/platforms/${a.id}`:`/my/podcasts/${r.podcast.id}/platforms`;a.id||n.append("slug",a.slug),b(a.rowKey,!0);try{const I=await k.post(g,n,{headers:{"Content-Type":"multipart/form-data"}});C(t,I.data.platform),q("Иконка загружена")}catch{m("Не удалось загрузить иконку")}finally{b(a.rowKey,!1),e.target.value=""}}async function A(){y.value=!0;try{const e=await k.post(`/my/podcasts/${r.podcast.id}/platforms`,{name:"Новая площадка"});o.value.push({...e.data.platform,rowKey:h(e.data.platform)})}catch{m("Не удалось добавить площадку")}finally{y.value=!1}}async function E(e,a){if(!e.id){o.value.splice(a,1);return}if(confirm(`Удалить площадку "${e.name}"?`)){b(e.rowKey,!0);try{await k.delete(`/my/podcasts/${r.podcast.id}/platforms/${e.id}`),o.value.splice(a,1)}catch{m("Не удалось удалить площадку")}finally{b(e.rowKey,!1)}}}async function N(){const e=o.value.map(a=>a.id).filter(a=>a!=null);if(e.length!==0)try{await k.post(`/my/podcasts/${r.podcast.id}/platforms/reorder`,{order:e})}catch{m("Не удалось сохранить порядок")}}return(e,a)=>(d(),i("div",fe,[B(u(F),{modelValue:u(o),"onUpdate:modelValue":a[0]||(a[0]=t=>j(o)?o.value=t:o=t),tag:"ul",handle:".platform-row__drag-handle","
1item-key":"rowKey",class:"space-y-2",onEnd:N},{item:D(({element:t,index:l})=>[s("li",we,[s("button",{type:"button",class:"platform-row__drag-handle cursor-grab text-brand-100 hover:text-brand-300 dark:text-neutral-400 dark:hover:text-neutral-100","aria-label":`Перетащить ${t.name}`,title:`Перетащить ${t.name}`},$e,8,ve),s("div",Ie,[B(xe,{slug:t.slug,"icon-url":t.icon_url,alt:t.name,size:"lg"},null,8,["slug","icon-url","alt"])]),s("div",Se,[t.is_custom?v((d(),i("input",{key:0,"onUpdate:modelValue":n=>t.name=n,type:"text",class:"block w-full rounded-md border-brand-gray-300 bg-white text-sm text-brand-300 placeholder:text-brand-100 focus:border-brand-200 focus:ring-brand-200 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100 dark:placeholder:text-neutral-400",placeholder:"Название площадки",disabled:p(t),onBlur:n=>R(t,l)},null,40,Be)),[[K,t.name]]):(d(),i("p",Ve,U(t.name),1))]),s("div",Ke,[v(s("input",{"onUpdate:modelValue":n=>t.url=n,type:"url",class:"block w-full rounded-md border-brand-gray-300 bg-white text-sm text-brand-300 placeholder:text-brand-100 focus:border-brand-200 focus:ring-brand-200 dark:border-neutral-600 dar
1k:bg-neutral-700 dark:text-neutral-100 dark:placeholder:text-neutral-400",placeholder:"https://…",disabled:p(t),onBlur:n=>z(t,l)},null,40,Ue),[[K,t.url]])]),t.is_custom?(d(),i("label",{key:0,class:"shrink-0 cursor-pointer rounded-md border border-brand-gray-300 px-2 py-1 text-xs text-brand-300 hover:bg-brand-gray-300 dark:border-neutral-600 dark:text-neutral-100 dark:hover:bg-neutral-700",title:`Загрузить иконку для ${t.name}`},[s("input",{type:"file",accept:"image/png,image/jpeg,image/svg+xml",class:"sr-only",onChange:n=>T(n,t,l)},null,40,Me),V(" Иконка ")],8,Pe)):P("",!0),s("label",ze,[v(s("input",{"onUpdate:modelValue":n=>t.is_active=n,type:"checkbox",class:"h-4 w-4 rounded border-brand-gray-300 text-brand-300 focus:ring-brand-200 dark:border-neutral-600 dark:bg-neutral-700",disabled:p(t),onChange:n=>M(t,l)},null,40,Re),[[Z,t.is_active]]),s("span",Te,U(t.is_active?"Вкл":"Выкл"),1)]),t.is_custom?(d(),i("button",{key:1,type:"button",class:"shrink-0 rounded-md p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20","aria-label":`Удалить ${t.name}`,title:`Удалить ${t.name}`,disabled:p(t),onClick:n=>E(t,l)},Ne,8,Ae)):P("",!0)])]),_:1},8,["modelValue"]),s("div",Le,[s("button",{type:"button",class:"inline-flex items-center gap-1 rounded-md border border-brand-200 px-3 py-1.5 text-sm font-medium text-brand-300 hover:bg-brand-gray-300 dark:border-neutral-500 dark:text-neutral-100 dark:hover:bg-neutral-700",disabled:u(y),onClick:A},[De,V(" Добавить площадку ")],8,Oe)])]))}};export{He as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.