import{b as n}from"./CF1ujZlL.js";function l(e){return e.raw_route||e.route}function o(e){const a=e.split("/").filter(Boolean);return a.length<=1?"/":"/"+a.slice(0,-1).join("/")}async function u(e,a="order",t="asc",r,s){const i={children_of:e,sort:a,order:t,per_page:"200"};return r&&(i.lang=r),s&&(i.translations="true"),n.get("/pages",i)}function c(e){const a={};return e.page&&(a.page=String(e.page)),e.per_page&&(a.per_page=String(e.per_page)),e.sort&&(a.sort=e.sort),e.order&&(a.order=e.order),e.published!==void 0&&(a.published=String(e.published)),e.template&&(a.template=e.template),e.routable!==void 0&&(a.routable=String(e.routable)),e.visible!==void 0&&(a.visible=String(e.visible)),e.parent&&(a.parent=e.parent),e.children_of&&(a.children_of=e.children_of),e.root&&(a.root="true"),e.lang&&(a.lang=e.lang),e.translations&&(a.translations="true"),e.search&&(a.search=e.search),a}async function f(e={}){return n.get("/pages",c(e))}async function d(e,a){return n.get("/pages",c({search:e,per_page:a?.per_page??500,lang:a?.lang,translations:a?.translations}))}async function h(e=5){return n.get("/pages",{sort:"modified",order:"desc",per_page:String(e)})}async function p(e,a){const t={};a?.render&&(t.render="true"),a?.summary&&(t.summary="true"),a?.summary_size&&(t.summary_size=String(a.summary_size)),a?.children&&(t.children="true"),a?.children_depth&&(t.children_depth=String(a.children_depth)),a?.translations&&(t.translations="true"),a?.lang&&(t.lang=a.lang);const r=e.startsWith("/")?e.slice(1):e;return n.get(`/pages/${r}`,t)}async function m(e){return n.post("/pages",e)}async function y(e,a,t,r){const s=e.startsWith("/")?e.slice(1):e,i=r?`/pages/${s}?lang=${encodeURIComponent(r)}`:`/pages/${s}`;return n.patch(i,a)}async function _(e,a){const t=e.startsWith("/")?e.slice(1):e,r=[];a?.children!==void 0&&r.push(`children=${a.children}`),a?.lang&&r.push(`lang=${encodeURIComponent(a.lang)}`);const s=r.length?`/pages/${t}?${r.join("&")}`:`/pages/${t}`;return n.delete(s,void 0)}async function P(e,a){const t=e.startsWith("/")?e.slice(1):e;return n.post(`/pages/${t}/move`,a)}async function b(e,a){const t=e.startsWith("/")?e.slice(1):e;return n.post(`/pages/${t}/copy`,{route:a})}async function $(e){return n.post("/pages/reorganize",{operations:e})}export{l as a,f as b,m as c,p as d,_ as e,b as f,u as g,h,P as m,o as p,$ as r,d as s,y as u};
