1import{e as m,b as g}from"./index-jhxFnEvR.js";const R="/api/front/v1".replace(/\/$/,"");function h(t,r){const n=new URL(`${R}${t}`,window.location.origin),a=String(r||g()).trim();return a&&n.searchParams.set("language",a),n}async function y(t,{payload:r=null,files:n={},intent:a="draft",language:c,method:d="POST"}={}){const p=await m(c),e=new FormData;a&&e.append("intent",a),r&&e.append("payload",JSON.stringify(r||{})),Object.entries(n||{}).forEach(([f,l])=>{l instanceof File&&e.append(`files[${f}]`,l)});const i=h(t,c).toString(),s=await fetch(i,{method:d,credentials:"same-origin",headers:{Accept:"application/json",...p?{"X-CSRF-TOKEN":p}:{}},body:e}),o=await s.json().catch(()=>({}));if(!s.ok||o.error){const f=new Error(o.message||"Failed to save repository record.");throw f.status=s.status,f.details=o.errors||o.data||null,f}return o}async function u(t,{method:r="GET",payload:n=null,language:a}={}){const c=await m(a),d=h(t,a).toString(),p={Accept:"application/json",...c?{"X-CSRF-TOKEN":c}:{}},e={method:r,credentials:"same-origin",headers:p};n&&r!=="GET"&&(p["Content-Type"]="application/json",e.body=JSON.stringify(n));const i=await fetch(d,e),s=await i.json().catch(()=>({}));if(!i.ok||s.error){const o=new Error(s.message||"Repository request failed.");throw o.status=i.status,o.details=s.errors||s.data||null,o}return s}async function S(t,r={}){return u(`/repository/catalog/${encodeURIComponent(t)}`,{...r,method:"GET"})}async function w(t,r={}){return y("/repository/records",{...r,payload:t})}async function T(t,r={}){return y("/repository/records/reserve-doi",{...r,payload:t,intent:"draft"})}async function b(t,r={}){return y("/repository/records/publish",{...r,payload:t,intent:"publish"})}async function P(t,r={}){return y(`/repository/records/${t}/release-doi`,{...r,payload:null,intent:null})}async function D(t={}){return u("/repository/drafts",{...t,method:"GET"})}async function $(t,r={}){return u(`/repository/drafts/${t}`,{...r,method:"GET"})}async function j(t,r,n={}){return u(`/repository/drafts/${t}/archive`,{...n,method:r?"POST":"DELETE"})}async function C(t,r={}){return u(`/repository/drafts/${t}`,{...r,method:"DELETE"})}async function v({query:t="",scope:r="",type:n="",journalFilters:a={},page:c=1,perPage:d=12,language:p}={}){const e=h("/repository/public-records",p);t&&e.searchParams.set("q",String(t).trim()),r&&String(r).trim()&&String(r).trim()!=="all"&&e.searchParams.set("scope",String(r).trim()),n&&e.searchParams.set("type",String(n).trim()),Object.entries(a||{}).forEach(([o,f])=>{const l=String(f||"").trim();l&&e.searchParams.set(o,l)}),e.searchParams.set("page",String(c)),e.searchParams.set("per_page",String(d));const i=await fetch(e.toString(),{method:"GET",credentials:"same-origin",headers:{Accept:"application/json"}}),s=await i.json().catch(()=>({}));if(!i.ok){const o=new Error(s.message||"Failed to load repository records.");throw o.status=i.status,o.details=s.errors||s.data||null,o}return s}async function O(t,r={}){return u(`/repository/public-records/${encodeURIComponent(t)}`,{...r,method:"GET"})}export{S as a,$ as b,T as c,D as d,j as e,v as f,C as g,O as h,b as p,P as r,w as s};
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.