1import{j as E,Q as T,r as g,o as d,d as n,b as i,a as p,q as f,u as o,e as V,F as C,h as O,n as k,w as B}from"./app-2803dbd2.js";import{s as j}from"./index-5023023c.js";import{s as A}from"./index-708a9388.js";import b from"./GalleryVideoItem-3ae4916e.js";/* empty css */import"./index-53bd1124.js";import"./index-af4fdabb.js";import"./index-53f982d0.js";import"./index-6bddfbc3.js";import"./index-be3c1039.js";import"./index-eabfe630.js";const G={class:""},S={class:"flex flex-col md:flex-row justify-between"},L={class:"form-text"},P={key:0},R={key:1},U={key:0},$={id:"VideoGallery",class:"grid grid-cols-1 md:grid-cols-1 gap-2"},q=["id","onDrop","onDragover","onDragleave"],F={class:"flex gap-2 items-center my-2"},te={__name:"GalleryVideos",props:{gallery:{type:Object,required:!0},videos:{type:Array}},setup(c){const y=c,v=E.useToast(),w=T();let u=g(y.videos);function x(r){r.preventDefault()}function D(r){r.dataTransfer.setData("Text",r.currentTarget.id)}function h(r){let t=r.dataTransfer.getData("Text"),e=document.getElementById(t),l=r.currentTarget,a=document.getElementById("VideoGallery");if(r.preventDefault(),e!=l&&e!=a){let _=e.compareDocumentPosition(l);_&Node.DOCUMENT_POSITION_FOLLOWING?a.insertBefore(e,l.nextSibling):(_&Node.DOCUMENT_POSITION_PRECEDING||console.log("Not preceding nor sibling."),a.insertBefore(e,l))}N()}function N(){window.video_order_controller&&window.video_order_controller.abort(),window.video_order_controller=new AbortController;let r=[];document.querySelectorAll(".video").forEach(function(e,l){r.push({id:e.id.split("-")[1],media_order:parseInt(l)+1})}),axios.post(route("project.gallery.items.arrange",w.props.gallery.project_id),{order:r,gallery_id:y.gallery.id,item_type:"video"},{signal:video_order_controller.signal}).then(function(e){e.data.message&&v.success(e.data.message)}).catch(function(e){e.code!="ERR_CANCELED"&&v.error("Unable to save media order.")})}let s=g(!1),m=g([]),I=["border-2 border-dashed border-green-500"];return(r,t)=>(d(),n("div",G,[i("div",S,[i("p",L,[c.gallery.type&&c.gallery.type=="main_gallery"?(d(),n("span",P,"Add YouTube video links to showcase your project. ")):(d(),n("span",R,"Add YouTube video links to showcase your project updates. ")),t[3]||(t[3]=i("span",{class:"text-xs italic my-1 text-left"},"Example: https://www.youtube.com/watch?v=VIDEO_ID",-1))]),p(o(j),{size:"small",class:"btn btn-primary !mb-4 md:!mb-0",label:"+ New Video",icon:"pi pi-save",onClick:t[0]||(t[0]=e=>f(s)?s.value=!0:s=!0)})]),!o(u)||!o(u).length?(d(),n("div",U,"No videos added.")):V("",!0),i("div",$,[(d(!0),n(C,null,O(o(u),(e,l)=>(d(),n("div",{id:"video-"+e.id,draggable:"true",class:k([{[o(I)]:o(m)[e.id]},"video relative text-center rounded-lg p-1 shadow-sm mb-1"]),onDragstart:D,onDrop:a=>{h(a),o(m)[e.id]=!1},onDragover:a=>{x(a),o(m)[e.id]=!0},onDragleave:a=>o(m)[e.id]=!1,key:e.id},[i("div",F,[t[4]||(t[4]=i("div",null,[i("span",{title:"drag and rearrange "},[i("i",{class:"fa-solid fa-bars cursor-pointer","aria-hidden":"true"})])],-1)),p(b,{class:"w-full",gallery:c.gallery,videoItem:e},null,8,["gallery","videoItem"])])],42,q))),128))]),p(o(A),{visible:o(s),"onUpdate:visible":t[2]||(t[2]=e=>f(s)?s.value=e:s=e),modal:"",header:"Add New Video Item",class:"md:min-w-[768px]"},{default:B(()=>[p(b,{gallery:c.gallery,onItemSaved:t[1]||(t[1]=e=>f(s)?s.value=!1:s=!1),class:"mt-4"},null,8,["gallery"])]),_:1},8,["visible"])]))}};export{te 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.