1(function(){document.querySelector("#quality-description-input").addEventListener("input",function(e){document.querySelector("#count-quality-description-input").innerHTML=e.target.value.length});const u=document.getElementById("add-quality-btn"),m=document.querySelector("#quality-application-form");if(!u)return;const t={name:document.getElementById("quality-name-input"),application_number:document.getElementById("quality-application-number-input"),description:document.getElementById("quality-description-input"),photos:document.querySelectorAll('input[type="file"][id^="quality-photo-input"]'),file:document.getElementById("quality-file-input"),email:document.getElementById("quality-email-input"),phone:document.getElementById("quality-number-phone-input"),agreement:document.getElementById("quality-agreement-input")};t.photos&&t.photos.length&&t.photos.forEach(e=>{const l=document.querySelector(`label[for="${e.id}"]`)?.querySelector(".photo-preview-container"),o=l?.querySelector(".photo-preview-img"),s=l?.querySelector(".photo-placeholder-icon"),c=l?.querySelector(".remove-photo-btn");e.addEventListener("change",function(){if(e.files&&e.files[0]){const a=new FileReader;a.onload=function(i){o.src=i.target.result,o.classList.remove("hidden"),s.classList.add("hidden"),c.classList.remove("hidden")},a.readAsDataURL(e.files[0])}else s.classList.remove("hidden"),o.classList.add("hidden"),c.classList.add("hidden")}),c.addEventListener("click",function(a){a.preventDefault(),e.value="",s.classList.remove("hidden"),o.classList.add("hidden"),c.classList.add("hidden")})});const y=5e3,f=5,E=["image/jpeg","image/png"],b=["application/pdf","application/x-pdf","application/acrobat","applications/vnd.pdf","text/pdf","text/x-pdf"],r=(e,n)=>{toastr.error(e),n&&(n.classList.add("border-secondary"),n.nextElementSibling&&n.nextElementSibling.classList.remove("hidden"))},v=e=>{e&&(e.classList.remove("border-secondary"),e.nextElementSibling&&e.nextElementSibling.classList.add("hidden"))},q=e=>!e||e.length>254?!1:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);function L(e){return/^[\d\s()+-]{10,}$/.test(e)}const h=(e,n,l)=>{for(const o of e){const s=o.name.split(".").pop().toLowerCase();if(!n.includes(o.type.trim())&&s!=="pdf")return`ÐедопÑÑÑимÑй Ñип Ñайла: ${o.name} (${o.type})`;if(o.size>l*1024*1024)return`Файл ${o.name} болÑÑе ${l} ÐÐ`}return""};(()=>{if(!t.file)return;const e=document.querySelector(`label[for="${t.file.id}"] p`);let n=null;function l(){t.file.value="",e&&(e.textContent=`ÐеÑеÑаÑиÑе ÑÐ°Ð¹Ð»Ñ Ð² ÑÑÑ Ð¾Ð±Ð»Ð°ÑÑÑ 2 или нажмиÑе, ÑÑÐ¾Ð±Ñ Ð·Ð°Ð³ÑÑзиÑÑ`),n&&n.parentNode&&n.parentNode.removeChild(n),n=null}t.file.addEventListener("change",()=>{e&&(t.file.files.length?(e.textContent=t.file.files[0].name,n||(n=document.createElement("button"),n.type="button",n.innerHTML="Ã",n.className="absolute right-[-30px] top-1/2 -translate-y-1/2 bg-gray-200 rounded-full w-6 h-6 text-lg flex items-center justify-center",n.onclick=l,e.appendChild(n),e.style.position="relative")):l())})})(),u.addEventListener("click",async()=>{Object.keys(t).forEach(i=>{const d=t[i];i!=="agreement"&&d instanceof HTMLElement&&v(d)});const e={name:t.name?.value?.trim()||"",application_number:t.application_number?.value?.trim()||"",description:t.description?.value?.trim()||"",email:t.email?.value?.trim()||"",phone:t.phone?.value?.trim()||"",agreement:t.agreement?.checked||!1};if(!e.name)return r("ÐведиÑе имÑ.",t.name);if(!e.application_number)return r("ÐведиÑе Ð½Ð¾Ð¼ÐµÑ Ð·Ð°Ñвки.",t.application_number);if(!e.email)return r("ÐведиÑе email.",t.email);if(!q(e.email))return r("ÐевеÑнÑй email.",t.email);if(!e.phone)return r("ÐожалÑйÑÑа, введиÑе Ð½Ð¾Ð¼ÐµÑ ÑелеÑона.",t.phone);if(!L(e.phone))return r("ÐекоÑÑекÑнÑй ÑоÑÐ¼Ð°Ñ ÑелеÑона.",t.phone);if(!e.description)return r("ÐведиÑе опиÑание.",t.description);if(e.description.length>y)return r("ÐпиÑание пÑевÑÑÐ°ÐµÑ 5000 Ñимволов.",t.description);if(!e.agreement)return r("ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑоглаÑие на обÑабоÑÐºÑ Ð¿ÐµÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ .");const n=[];if(t.photos&&t.photos.length&&t.photos.forEach(i=>
2{i.files&&i.files.length&&n.push(...Array.from(i.files))}),n.length>5)return r("Ðожно добавиÑÑ Ð½Ðµ более 5 ÑоÑогÑаÑий.");const l=h(n,E,f);if(l)return r(l);const o=t.file&&t.file.files?Array.from(t.file.files):[],s=h(o,b,f);if(s)return r(s);let c="";try{if(c=grecaptcha.getResponse(),!c)return r("ÐожалÑйÑÑа, пÑойдиÑе пÑовеÑÐºÑ reCAPTCHA.")}catch(i){return console.error("ÐÑибка полÑÑÐµÐ½Ð¸Ñ Ñокена reCAPTCHA:",i),r("ÐÑибка пÑовеÑки reCAPTCHA. ÐожалÑйÑÑа, обновиÑе ÑÑÑаниÑÑ.")}console.log(e);const a=new FormData;a.append("name",e.name),a.append("application_number",e.application_number),a.append("description",e.description),a.append("email",e.email),a.append("phone",e.phone),n.length&&n.forEach((i,d)=>a.append(`photos[${d}]`,i)),o.length&&a.append("file",o[0]),a.append("captcha",c);try{const i=document.querySelector('meta[name="csrf-token"]')?.getAttribute("content"),d={Accept:"application/json",...i&&{"X-CSRF-TOKEN":i}},g=await fetch("/api/quality-control-requests",{method:"POST",headers:d,body:a});if(!g.ok){const p=await g.json().catch(()=>({}));if(p.errors&&p.errors.captcha)try{grecaptcha.reset()}catch(A){console.error("ÐÑибка ÑбÑоÑа reCAPTCHA:",A)}const S=p.errors?.captcha?.[0]||p.message||"ÐÑибка пÑи оÑпÑавке оÑзÑва.";throw new Error(S)}toastr.success("ÐÑзÑв ÑÑпеÑно оÑпÑавлен!");try{grecaptcha.reset()}catch(p){console.error("ÐÑибка ÑбÑоÑа reCAPTCHA:",p)}m&&m.reset()}catch(i){r(i.message||"ÐÑибка пÑи оÑпÑавке оÑзÑва.")}})})();
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.