1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0f0eb-c3cd-7b93-b576-2122f1ab38de")}catch(e){}}();import{t as e}from"./tTLloQxU.js";import{t}from"./CEkn3d8o2.js";import{t as n}from"./CrpOy2QQ2.js";import{t as r}from"./DSYjCsgt2.js";function i(){return{url:e.getDirectusApiUrl(),apiKey:e.getDirectusApiKey()}}var a=e=>{let t=(e,n=[])=>{if(typeof e==`object`){let r=[];for(let i in e){let a=e[i]??[];if(Array.isArray(a))for(let e of a)r.push(t(e,[...n,i]));else if(typeof a==`object`)for(let e of Object.keys(a)){let o=a[e];for(let a of o)r.push(t(a,[...n,`${i}:${e}`]))}}return r.flatMap(e=>e)}return[...n,String(e)].join(`.`)};return e.flatMap(e=>t(e))},o=[`fields`,`filter`,`search`,`sort`,`limit`,`offset`,`page`,`deep`,`backlink`,`alias`,`aggregate`,`groupBy`,`version`,`versionRaw`],s=e=>typeof e==`boolean`,c=e=>typeof e==`string`&&!!e,l=e=>typeof e==`number`,u=e=>Array.isArray(e)&&e.length>0,d=e=>typeof e==`object`&&!!e&&!u(e)&&Object.keys(e).length>0,f=e=>{let t={};e.fields&&(u(e.fields)&&(t.fields=a(e.fields).join(`,`)),c(e.fields)&&(t.fields=e.fields)),d(e.filter)&&(t.filter=JSON.stringify(e.filter)),c(e.search)&&(t.search=e.search),e.sort&&(u(e.sort)&&(t.sort=e.sort.join(`,`)),c(e.sort)&&(t.sort=e.sort)),`limit`in e&&(l(e.limit)&&e.limit>=-1&&(t.limit=String(e.limit)),c(e.limit)&&(t.limit=e.limit)),`offset`in e&&(l(e.offset)&&e.offset>=0&&(t.offset=String(e.offset)),c(e.offset)&&(t.offset=e.offset)),`page`in e&&(l(e.page)&&e.page>=1&&(t.page=String(e.page)),c(e.page)&&(t.page=e.page)),d(e.deep)&&(t.deep=JSON.stringify(e.deep)),d(e.alias)&&(t.alias=JSON.stringify(e.alias)),d(e.aggregate)&&(t.aggregate=JSON.stringify(e.aggregate)),e.groupBy&&(u(e.groupBy)&&(t.groupBy=e.groupBy.join(`,`)),c(e.groupBy)&&(t.groupBy=e.groupBy)),c(e.version)&&(t.version=e.version),e.versionRaw&&(s(e.versionRaw)&&(t.versionRaw=String(e.versionRaw)),c(e.versionRaw)&&(t.versionRaw=e.versionRaw));for(let[n,r]of Object.entries(e)){if(o.includes(n))continue;let e;e=typeof r==`string`?r:JSON.stringify(r),e&&(t[n]=e)}return t},p=(e,t)=>(e.endsWith(`/`)&&(e=e.slice(0,-1)),t.startsWith(`/`)||(t=`/`+t),e+t),m=(e,t,n)=>{let r=e.pathname===`/`?t:p(e.pathname,t),i=new globalThis.URL(r,e);if(n)for(let[e,t]of Object.entries(f(n)))if(t&&typeof t==`object`&&!Array.isArray(t))for(let[n,r]of Object.entries(t))i.searchParams.set(`${e}[${n}]`,String(r));else i.searchParams.set(e,t);return i},h=class extends Error{name=`RequestError`;response;errors;data;constructor(e,t){super(e),this.response=t.response,this.errors=t.errors,t.data!==void 0&&(this.data=t.data)}};function g(e){return typeof e!=`object`||!e?!1:`headers`in e&&`ok`in e&&`json`in e&&typeof e.json==`function`&&`text`in e&&typeof e.json==`function`}async function _(e){if(!(typeof e!=`object`||!e)){if(g(e)){let t=e.headers.get(`Content-Type`)?.toLowerCase();if(t?.startsWith(`application/json`)||t?.startsWith(`application/health+json`)){let t=await e.json();if(!e.ok||`errors`in t)throw t;return`data`in t?t.data:t}if(t?.startsWith(`text/html`)||t?.startsWith(`text/plain`)){let t=await e.text();if(!e.ok)throw t;return t}return e.status===204?null:e}if(`errors`in e)throw e;return`data`in e?e.data:e}}var v=async(e,t,n=globalThis.fetch)=>(t.headers=typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:{},n(e,t).then(e=>_(e).catch(t=>{let n={message:``,errors:t&&typeof t==`object`&&`errors`in t?t.errors:t,response:e};return t&&typeof t==`object`&&`data`in t&&(n.data=t.data),Array.isArray(n.errors)&&n.errors[0]?.message&&(n.message=n.errors[0].message),Promise.reject(new h(n.message,{response:n.response,errors:n.errors,data:n.data}))}))),y=e=>t=>{let n=e??null;return{async getToken(){return n},async setToken(e){n=e}}},b={fetch:globalThis.fetch,WebSocket:globalThis.WebSocket,URL:globalThis.URL,logger:globalThis.console},x=(e,t={})=>{let n=t.globals?{...b,...t.globals}:b;return{globals:n,url:new n.URL(e),with(e){return{...this,...e(this)}}}},S=(e,t)=>{if(e.length===0)throw Error(t)};function C(e){return`directus_access.directus_activity.directus_collections.directus_comments.directus_fields.directus_files.directus_folders.directus_migrations.directus_permissions.directus_policies.directus_presets.directus_relations.directus_revisions.directus_roles.directus_sessions.directus_settings.directus_users.directus_dashboards.directus_panels.directus_notifications.directus_shares.directus_flows.directus_operations.directus_translations.directus_versions.directus_extensions.directus_deployments.directus_deployment_projects.directus_deployment_runs.directus_oauth_clients.directus_oauth_codes.directus_oauth_consents.directus_oauth_tokens`.split(`.`).includes(e)}var w=(e,t)=>{if(C(String(e)))throw Error(t)},T={},E=(e={})=>t=>{let n={...T,...e};return{async request(r){let i=r();if(i.headers||={}
1,`Content-Type`in i.headers?i.headers[`Content-Type`]===`multipart/form-data`&&delete i.headers[`Content-Type`]:i.headers[`Content-Type`]=`application/json`,`getToken`in this&&!(`Authorization`in i.headers)){let e=await this.getToken();e&&(i.headers.Authorization=`Bearer ${e}`)}let a=m(t.url,i.path,i.params),o={method:i.method??`GET`,headers:i.headers??{}};`credentials`in n&&(o.credentials=n.credentials),i.body&&(o.body=i.body),i.onRequest&&(o=await i.onRequest(o)),n.onRequest&&(o=await n.onRequest(o));let s=await v(a.toString(),o,t.globals.fetch);return`onResponse`in i&&(s=await i.onResponse(s,o)),`onResponse`in e&&(s=await e.onResponse(s,o)),s}}};function D(){let{url:e,apiKey:t}=i();return x(e).with(y(t)).with(E())}function O(e){return Array.isArray(e)}function k({query:e}){let n=t.language;if(n===``)return{enhancedQuery:e,isLanguageFiltering:!1,language:n};let i=r([n,...t.fallbackLanguages]),a=``;Array.isArray(e.fields)?a=e.fields.join(`,`):typeof e.fields==`string`&&(a=e.fields);let o=a.length>0&&!a.includes(`*.*`)&&!a.includes(`translations.*`),s=e.fields;return o&&(Array.isArray(e.fields)?s=[...e.fields,`translations.*`]:typeof e.fields==`string`&&(s=`${e.fields},translations.*`)),{enhancedQuery:{...e,fields:s,deep:{...e.deep,translations:{_filter:{_and:[{languages_code:{_in:i}}]}}}},isLanguageFiltering:!0,language:n}}function A(e,r){let i;[r,...t.fallbackLanguages].forEach(t=>{!i&&e.translations&&(i=e.translations.find(e=>{let n=e.languages_code;return typeof n==`string`?n===t:n?.code===t}))});let a=structuredClone(e),o=a;if(i){let e=i;Object.keys(e).filter(e=>![`id`,`languages_code`].includes(e)).forEach(t=>{let n=e[t];n!==null&&(o[t]=n)})}return Object.entries(e).forEach(([e,t])=>{O(t)?o[e]=t.map(e=>n(e)&&e!==null?A(e,r):e):n(t)&&t!==null&&(o[e]=A(t,r))}),a}export{S as a,w as i,k as n,D as r,A as t}; 2//# chunkId=01a0f0eb-c3cd-7b93-b576-2122f1ab38de
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.