1import k from"./WRyiheJW.js";import{d as F,k as f,Q as z,a6 as B,o as p,c as u,J as C,u as i,b as L,G as $,H as S,I as j,a as _,V as r}from"./CRcD7-OL.js";const A=["data-active"],H=["innerHTML"],V={class:"d-flex justify-content-end pt-3"},I=["onClick"],G=F({__name:"DropZone",props:{maxSize:{},fileTypes:{}},emits:["files-dropped"],setup(b,{emit:D}){const v={images:["image/png","image/jpeg","image/jpg","image/gif"]},s=b,M=D,a=f(!1),l=f(!1),m=f([]);let g=null;function h(){a.value=!0,clearTimeout(g)}function c(){g=setTimeout(()=>{a.value=!1},50)}function w(e){const t=[];for(const n of e)v[n]?t.push(...v[n]):t.push(n);return t}function E(e){const t=[],n=[];for(const o of e){if(s.fileTypes!==void 0&&!w(s.fileTypes).includes(o.type)){n.push(`File <b>${o.name}</b> has wrong file type.`);continue}if(s.maxSize!==void 0&&o.size>s.maxSize){n.push(`File <b>${o.name}</b> is too large.`);continue}t.push(o)}return{files:t,errors:n}}function x(e){if(c(),e.dataTransfer){const{files:t,errors:n}=E(e.dataTransfer.files);n.length>0&&(m.value=n,l.value=!0),t.length>0&&M("files-dropped",[...t])}}function y(e){e.preventDefault()}const T=["dragenter","dragover","dragleave","drop"];return z(()=>{T.forEach(e=>{document.body.addEventListener(e,y)})}),B(()=>{T.forEach(e=>{document.body.removeEventListener(e,y)})}),(e,t)=>{const n=k;return p(),u("div",{"data-active":i(a),onDragstart:c,onDragenter:r(h,["prevent"]),onDragover:r(h,["prevent"]),onDragleave:r(c,["prevent"]),onDrop:r(x,["prevent"])},[C(e.$slots,"default",{isDropZoneActive:i(a)}),L(n,{onClose:t[0]||(t[0]=o=>l.value=!1),active:i(l),title:"Error",type:"warning",size:"sm"},{default:$(({close:o})=>[(p(!0),u(S,null,j(i(m),d=>(p(),u("div",{class:"text-danger",key:d,innerHTML:`⢠${d}`},null,8,H))),128)),_("div",V,[_("button",{class:"btn btn-light",onClick:o},"OK",8,I)])]),_:1},8,["active"])],40,A)}}});export{G 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.