PageSourceSearch

https://static.farfor.ru/site-breed/919/_nuxt/B1wCi1I2.js

js farfor.ru collected 2026-09-25 18:41:19 UTC 4,850 bytes, 2 lines download raw bytes

1import{d as q,c as _,b as d,f as y,F as G,r as H,h as x,l as p,e as z,A as L,g as J,B as f,z as P,p as k,o,a0 as D,G as Q,a2 as X}from"./Dk-tXAJL.js";import Y from"./DvOe8o6d.js";import"./56mNwvMl.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},m=new i.Error().stack;m&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[m]="a087e76a-16d9-4820-9fae-df97c2fdc66d",i._sentryDebugIdIdentifier="sentry-dbid-a087e76a-16d9-4820-9fae-df97c2fdc66d")}catch{}})();const g={filesType:"Неверный формат файла",sameFiles:"Нельзя добавлять одинаковые файлы",filesSize:i=>`Превышен лимит размера файлов в ${i} мегабайт`,filesLimit:i=>`Максимальное количество файлов — ${i}`},Z={class:"app-input-file"},ee={key:0,"data-test-id":"input-file-preview",class:"app-input-file__list"},te=["src","alt"],ie={key:1,"data-test-id":"input-file-preview-text"},se={class:"app-input-file__header"},ne={class:"app-input-file__title"},ae={class:"app-input-file__text"},re=["accept","multiple","disabled","aria-disabled"],le=q({__name:"InputFile",props:{label:{},text:{},accept:{},filesLimit:{},filesSize:{},multiple:{type:Boolean},loading:{type:Boolean},disabled:{type:Boolean},preview:{type:Boolean},errorFilesLimit:{},errorFilesSize:{},errorFilesType:{},errorSameFiles:{}},emits:["onChange"],setup(i,{emit:m}){const s=i,w=m,c=_(()=>({default:"",filesLimit:s.errorFilesLimit||g.filesLimit(s.filesLimit),filesSize:s.errorFilesSize||g.filesSize(s.filesSize),filesType:s.errorFilesType||g.filesType,sameFiles:s.errorSameFiles||g.sameFiles})),h=k(""),u=e=>h.value=e,S=k(!1),v=e=>S.value=e,r=k([]),$=_(()=>r.value.length?r.value.reduce((e,{size:t})=>e+t,0):0),I=_(()=>r.value.map(({file:e})=>e)),B=_(()=>["app-input-file__label",{"app-input-file__label--active":S.value,"app-input-file__label--loading":s.loading,"app-input-file__label--disabled":s.disabled,"app-input-file__label--error":h.value}]),T=e=>{v(!1),u(c.value.default),s.multiple||(r.value=[]);const t=e.target,n=e instanceof DragEvent?e.dataTransfer?.files:t.files;!n||N(n)||(Array.from(n).forEach(a=>{r.value.push(R(a))}),w("onChange",I.value),t.value="")},b=e=>{const t=r.value.findIndex(({id:n})=>n===e);r.value.splice(t,1),u(c.value.default),w("onChange",I.value)},R=e=>({file:e,id:W(e),name:e.name,url:URL.createObjectURL(e),size:E(e.size),isImage:A(e)}),A=e=>{const t=e.name.toLocaleLowerCase();return e.type.startsWith("image")||t.endsWith("heic")||t.endsWith("heif")},E=e=>Number((e/1e3/1e3).toFixed(4)),W=e=>`${e.name}-${e.size}-${e.lastModified}-${e.type}`,N=e=>V(e)||K(e)||M(e)||O(e),V=e=>{const t=r.value.length+e.length;if(s.filesLimit&&t>s.filesLimit)return u(c.value.filesLimit)},K=e=>{const t=Array.from(e).reduce((a,{size:F})=>a+E(F),0),n=$.value+t;if(s.filesSize&&n>s.filesSize)return u(c.value.filesSize)},M=e=>{if(Array.from(e).some(({name:n})=>r.value.some(({name:a})=>n===a)))return u(c.value.sameFiles)},O=e=>{if(!s.accept)return;const t=s.accept.split(",");if(!Array.from(e).every(a=>U(a,t)))return u(c.value.filesType)},U=(e,t)=>t.some(n=>{const a=n.trim().toLowerCase();return j(e)||e.type.startsWith(a)||RegExp(a).test(e.type)}),j=e=>{const t=e.name.toLowerCase().trim();return t.endsWith(".heic")||t.endsWith(".heif")};return(e,t)=>{const n=Q,a=X,F=Y;return o(),d("div",Z,[i.preview&&y(r).length?(o(),d("div",ee,[(o(!0),d(G,null,H(y(r),l=>(o(),d("div",{key:l.id,"data-test-id":"input-file-preview-item",class:"app-input-file__item"},[l.isImage?(o(),d("img",{key:0,src:l.url,alt:l.name,"data-test-id":"input-file-preview-image"},null,8,te)):(o(),d("span",ie,L(l.name),1)),z(n,{"data-test-id":"input-file-preview-button",class:"app-input-file__close",name:"fill-cancel-circle",color:"var(--ui-color-sandy-700)",size:"16",clickable:"",tabindex:"0",onClick:C=>b(l.id),onKeydown:[D(f(C=>b(l.id),["prevent"]),["space"]),D(C=>b(l.id),["enter"])]},null,8,["onClick","onKeydown"])]))),128))])):x("",!0),p("label",{class:P(y(B)),"data-test-id":"input-file-label",onDrop:f(T,["prevent"]),onDragenter:t[0]||(t[0]=f(l=>v(!0),["prevent"])),onDragover:t[1]||(t[1]=f(l=>v(!0),["prevent"])),onDragleave:t[2]||(t[2]=f(l=>v(!1),["prevent"]))},[p("span",se,[z(n,{name:"camera",color:"currentColor"}),p("span",ne,L(i.label),1)]),p("span",ae,L(i.text),1),p("input",{"data-test-id":"input-file-field",class:"app-input-file__field ui-visually-hidden",type:"file",accept:i.accept,multiple:i.multiple,disabled:i.disabled,"aria-disabled":i.disabled,onChange:T}
1,null,40,re),i.loading?(o(),J(a,{key:0,color:"var(--ui-color-sandy-950)"})):x("",!0)],34),z(F,{"error-messages":y(h)},null,8,["error-messages"])])}}}),de=Object.assign(le,{__name:"TheInputFile"});export{de as default};
2//# sourceMappingURL=B1wCi1I2.js.map

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.