PageSourceSearch

https://www.allampapir.hu/_app/immutable/chunks/BpDRo4U9.js

js allampapir.hu collected 2026-09-25 05:47:56 UTC 6,415 bytes, 1 lines download raw bytes

1import{b as u}from"./Cr8uhE-Z.js";import{d as O,w as U}from"./DHWOZ-PC.js";import"./BIh9eoKV.js";const x=!0,P="/api/",X="https://captcha.digitalwave.hu/c/cap_4cbdb0a2c0bf4c7471c6bceb9468e087",R={id:"",username:"",name:"",email:"",fullname:"",logged_in:!1,auth:""},j=U(R),Q=O(j,e=>e?.logged_in),I=()=>{j.set(R)};function z(e,t){t!==void 0?console.error(`[DEBUG ERROR] ${e}`,t):console.error(`[DEBUG ERROR] ${e}`)}const E="X-CSRF-TOKEN";let b=null,w=null;function F(){return P.replace(/\/+$/g,"")+"/csrf"}async function H(e){const t=e??fetch;if(!t)throw new Error("CSRF token fetch is only available in the browser");const r=await t(F(),{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`CSRF token fetch failed: HTTP ${r.status}`);const n=(await r.json())?.data?.token;if(!n||typeof n!="string")throw new Error("CSRF token missing from API response");return b=n,n}async function T(e){return b||(w||(w=H(e).finally(()=>{w=null})),w)}async function N(e){return b=null,w=null,T(e)}let _=typeof fetch>"u"?null:fetch;function $(){return _||fetch}const q=e=>{_=e};
1class h extends Error{code;data;constructor(t,r,o=null){super(t),this.name="ApiError",this.code=r,this.data=o}}class v extends Error{constructor(t="Network error occurred"){super(t),this.name="NetworkError"}}class y extends Error{constructor(t){super(`Request timed out after ${t}ms`),this.name="TimeoutError"}}function B(e){return e.replace(/\/+$/g,"")}function K(e){return e.replace(/^\/+/g,"")}const A=e=>B(P)+"/"+K(e);function L(e,t=!0){if(z("API error",e),t){const r=e?.message||"Ismeretlen hiba történt";u(r)}}function D(e){return new Promise((t,r)=>{setTimeout(()=>r(new y(e)),e)})}async function k(e,t,r){return t?{method:"POST",credentials:"include",mode:"cors",headers:{Accept:"application/json",[E]:r},body:e}:{method:"POST",credentials:"include",mode:"cors",headers:{"Content-Type":"application/json",Accept:"application/json",[E]:r},body:e?JSON.stringify(e):null}}async function C(e,t=null,r={}){const{withFile:o=!1,timeout:n=3e4,showErrorToasts:i=!0}=r,f=$(),m=await T(f);let s=await k(t,o,m);try{const l=D(n);let c=await Promise.race([f(e,s),l]);if(c.status===403)try{if((await c.clone().json())?.message==="csrf_failed"){const g=await N(f);s=await k(t,o,g),c=await Promise.race([f(e,s),l])}}catch{}if(!c.ok){let a=null;try{a=await c.json()}catch{a={message:`HTTP ${c.status}: ${c.statusText}`}}if(i&&a?.message!=="validation_error"&&a?.message!=="failed"){const g=a?.message||`HTTP ${c.status}: ${c.statusText}`;u(g)}return a&&typeof a=="object"&&"message"in a&&"code"in a?a:{message:a?.message||`HTTP ${c.status}: ${c.statusText}`,code:c.status,data:a?.data||a}}let d;try{d=await c.json()}catch{throw new h("Invalid JSON response from server",500,null)}if(!d||typeof d!="object")throw new h("Invalid response format from server",500,null);if(x){const a=c.headers.get("Accept-Language");if(a){const p=G(a,["en","hu","cs","pl"]);p&&window.__apiLanguage!==p&&(window.__apiLanguage=p,document.cookie=`PARAGLIDE_LOCALE=${p}; path=/; max-age=31536000`)}}return d.code>=400&&i&&u(d.message||"Szerver hiba"),d}catch(l){if(l instanceof h)throw l;if(l instanceof y)throw i&&u("A kérés túllépte az időkorlátot"),l;if(l instanceof TypeError&&l.message.includes("fetch")){const a=new v("Hálózati hiba");throw i&&u(a.message),a}const c=l instanceof Error?l.message:"Ismeretlen hiba történt",d=new Error(c);throw L(d,i),d}}function S(e,t){if(!t)return e;try{if(!e?.data)throw new h("No data available in response",500,null);if(Array.isArray(t)){const r={};for(const o of t)e&&e.data&&typeof e.data=="object"&&o in e.data?r[o]=e.data[o]:(console.warn(`Key '${o}' not found in response data`),r[o]=null);return r}}catch(r){throw console.error("Error getting response data:",r),new h("Error getting response data",500,null)}return typeof t=="string"?e.data&&typeof e.data=="object"&&t in e.data?e.data[t]:(console.warn(`Key '${t}' not found in response data`),null):e}async function V(e,t,r=null,o={}){const{fetchLib:n=null,timeout:i=3e4,showErrorToasts:f=!0,handleAuth:m=!0}=o;n&&q(n);try{const s=await C(A(e),t,{timeout:i,showErrorToasts:f});if(m&&s.code===401)throw f&&u("Hitelesítés szükséges"),await new Promise(l=>setTimeout(l,1e3)),I(),document.location.href="/admin/login",new h("Authentication required",401,null);if(s.code>=400&&s.code<500&&f)if(s.message==="validation_error"){const l=s.data;(!l?.errors||Object.keys(l.errors).length===0)&&u("Kérjük, ellenőrizze az adatokat")}else u(s.message);return S(s,r)}catch(s){if(s instanceof h)throw s;if(s instanceof y)throw f&&u("A kérés túllépte az időkorlátot"),s;if(s instanceof v)throw f&&u(s.message),s;const l=s?.message||"Ismeretlen hiba történt";if(L(s,f),r){if(typeof r=="string")return null;if(Array.isArray(r)){const c={};for(const d of r)c[d]=null;return c}}throw new h(l,500,null)}}async function Y(e,t=null,r=null,o={}){try{const n=await C(A(e),t,{withFile:!0,timeout:o.timeout||3e4,showErrorToasts:o.showErrorToasts!==!1});if(n.code>=400&&n.code<500&&o.showErrorToasts!==!1)if(n.message==="validation_error"){const i=n.data;(!i?.errors||Object.keys(i.errors).length===0)&&u("Kérjük, ellenőrizze az adatokat")}else u(n?.message||"Hiba történt");return S(n,r)}catch(n){return L(n,o.showErrorToasts!==!1),null}}function G(e,t){const r=e.split(",").map(o=>{const n=o.trim().split(";"),i=n[0].trim(),f=n[1]?parseFloat(n[1].split("=")[1]):1;
1return{code:i,quality:f}}).sort((o,n)=>n.quality-o.quality);for(const o of r){if(t.includes(o.code))return o.code;const n=o.code.split("-")[0];if(t.includes(n))return n}return"en"}async function Z(e,t){const r=A(e),o=$(),n=await T(o);try{const i=await o(r,{method:"POST",credentials:"include",mode:"cors",headers:{"Content-Type":"application/json",Accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",[E]:n},body:JSON.stringify({data:t})});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);const f=await i.blob(),m=window.URL.createObjectURL(new Blob([f],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})),s=document.createElement("a");s.href=m,s.target="_blank",s.setAttribute("download",`${t.filename}.xlsx`),s.click(),s.remove(),window.URL.revokeObjectURL(m)}catch(i){throw console.error("Download error:",i),u("Hiba történt a letöltés során"),i}}export{X as P,Y as a,I as b,Z as d,V as f,Q as l,j as u};

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.