@directus/sdk
Advanced tools
Comparing version 9.0.0-rc.101 to 9.0.0
@@ -0,1 +1,3 @@ | ||
import { IStorage } from './storage'; | ||
import { ITransport } from './transport'; | ||
import { PasswordsHandler } from './handlers/passwords'; | ||
@@ -8,23 +10,26 @@ export declare type AuthCredentials = { | ||
export declare type AuthToken = string; | ||
export declare type AuthTokenType = 'DynamicToken' | 'StaticToken' | null; | ||
export declare type AuthResult = { | ||
access_token: string; | ||
expires: number; | ||
refresh_token?: string | null; | ||
refresh_token?: string; | ||
}; | ||
export declare type AuthLoginOptions = { | ||
refresh?: AuthRefreshOptions; | ||
export declare type AuthMode = 'json' | 'cookie'; | ||
export declare type AuthOptions = { | ||
mode?: AuthMode; | ||
autoRefresh?: boolean; | ||
msRefreshBeforeExpires?: number; | ||
staticToken?: string; | ||
transport: ITransport; | ||
storage: IStorage; | ||
}; | ||
export declare type AuthRefreshOptions = { | ||
auto?: boolean; | ||
time?: number; | ||
}; | ||
export interface IAuth { | ||
readonly token: string | null; | ||
readonly password: PasswordsHandler; | ||
readonly expiring: boolean; | ||
login(credentials: AuthCredentials, options?: AuthLoginOptions): Promise<AuthResult>; | ||
refresh(force?: boolean): Promise<AuthResult | false>; | ||
static(token: AuthToken): Promise<boolean>; | ||
logout(): Promise<void>; | ||
export declare abstract class IAuth { | ||
mode: AuthMode; | ||
abstract readonly token: string | null; | ||
abstract readonly password: PasswordsHandler; | ||
abstract login(credentials: AuthCredentials): Promise<AuthResult>; | ||
abstract refresh(): Promise<AuthResult | false>; | ||
abstract static(token: AuthToken): Promise<boolean>; | ||
abstract logout(): Promise<void>; | ||
} | ||
//# sourceMappingURL=auth.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IAuth = void 0; | ||
class IAuth { | ||
constructor() { | ||
this.mode = (typeof window === 'undefined' ? 'json' : 'cookie'); | ||
} | ||
} | ||
exports.IAuth = IAuth; |
@@ -1,25 +0,27 @@ | ||
import { AuthCredentials, AuthLoginOptions, AuthRefreshOptions, AuthResult, AuthToken, IAuth } from '../auth'; | ||
import { IAuth, AuthCredentials, AuthResult, AuthToken, AuthOptions, AuthTokenType } from '../auth'; | ||
import { PasswordsHandler } from '../handlers/passwords'; | ||
import { IStorage } from '../storage'; | ||
import { ITransport } from '../transport'; | ||
export declare type AuthOptions = { | ||
mode?: 'json' | 'cookie'; | ||
refresh?: AuthRefreshOptions; | ||
export declare type AuthStorage<T extends AuthTokenType = 'DynamicToken'> = { | ||
access_token: T extends 'DynamicToken' | 'StaticToken' ? string : null; | ||
expires: T extends 'DynamicToken' ? number : null; | ||
refresh_token?: T extends 'DynamicToken' ? string : null; | ||
}; | ||
export declare class Auth implements IAuth { | ||
readonly options: AuthOptions; | ||
private transport; | ||
private storage; | ||
export declare class Auth extends IAuth { | ||
autoRefresh: boolean; | ||
msRefreshBeforeExpires: number; | ||
staticToken: string; | ||
private _storage; | ||
private _transport; | ||
private timer; | ||
private passwords?; | ||
private refresher; | ||
constructor(transport: ITransport, storage: IStorage, options?: AuthOptions); | ||
constructor(options: AuthOptions); | ||
get storage(): IStorage; | ||
get transport(): ITransport; | ||
get token(): string | null; | ||
get password(): PasswordsHandler; | ||
get expiring(): boolean; | ||
private refreshToken; | ||
private updateStorage; | ||
private updateRefresh; | ||
refresh(force?: boolean): Promise<AuthResult | false>; | ||
login(credentials: AuthCredentials, options?: Partial<AuthLoginOptions>): Promise<AuthResult>; | ||
private autoRefreshJob; | ||
refresh(): Promise<AuthResult | false>; | ||
login(credentials: AuthCredentials): Promise<AuthResult>; | ||
static(token: AuthToken): Promise<boolean>; | ||
@@ -26,0 +28,0 @@ logout(): Promise<void>; |
@@ -13,52 +13,60 @@ "use strict"; | ||
exports.Auth = void 0; | ||
const auth_1 = require("../auth"); | ||
const passwords_1 = require("../handlers/passwords"); | ||
const utils_1 = require("../utils"); | ||
const DefaultExpirationTime = 30000; | ||
class Auth { | ||
constructor(transport, storage, options) { | ||
var _a, _b, _c, _d, _e; | ||
this.options = options || {}; | ||
this.options.mode = (options === null || options === void 0 ? void 0 : options.mode) || (typeof window !== 'undefined' ? 'cookie' : 'json'); | ||
this.options.refresh = (options === null || options === void 0 ? void 0 : options.refresh) || { auto: false, time: DefaultExpirationTime }; | ||
this.options.refresh.auto = (_b = (_a = this.options.refresh) === null || _a === void 0 ? void 0 : _a.auto) !== null && _b !== void 0 ? _b : false; | ||
this.options.refresh.time = (_d = (_c = this.options.refresh) === null || _c === void 0 ? void 0 : _c.time) !== null && _d !== void 0 ? _d : DefaultExpirationTime; | ||
this.transport = transport; | ||
this.storage = storage; | ||
class Auth extends auth_1.IAuth { | ||
constructor(options) { | ||
var _a, _b, _c; | ||
super(); | ||
this.autoRefresh = true; | ||
this.msRefreshBeforeExpires = 30000; | ||
this.staticToken = ''; | ||
this._transport = options.transport; | ||
this._storage = options.storage; | ||
this.autoRefresh = (_a = options === null || options === void 0 ? void 0 : options.autoRefresh) !== null && _a !== void 0 ? _a : this.autoRefresh; | ||
this.mode = (_b = options === null || options === void 0 ? void 0 : options.mode) !== null && _b !== void 0 ? _b : this.mode; | ||
this.msRefreshBeforeExpires = (_c = options === null || options === void 0 ? void 0 : options.msRefreshBeforeExpires) !== null && _c !== void 0 ? _c : this.msRefreshBeforeExpires; | ||
if (options === null || options === void 0 ? void 0 : options.staticToken) { | ||
this.staticToken = options === null || options === void 0 ? void 0 : options.staticToken; | ||
this.updateStorage({ access_token: this.staticToken, expires: null, refresh_token: null }); | ||
} | ||
this.timer = false; | ||
this.refresher = new utils_1.Debouncer(this.refreshToken.bind(this)); | ||
try { | ||
this.updateRefresh((_e = this.options) === null || _e === void 0 ? void 0 : _e.refresh); | ||
} | ||
catch (_f) { | ||
// Ignore error | ||
} | ||
} | ||
get storage() { | ||
return this._storage; | ||
} | ||
get transport() { | ||
return this._transport; | ||
} | ||
get token() { | ||
return this.storage.auth_token; | ||
return this._storage.auth_token; | ||
} | ||
get password() { | ||
return (this.passwords = this.passwords || new passwords_1.PasswordsHandler(this.transport)); | ||
return (this.passwords = this.passwords || new passwords_1.PasswordsHandler(this._transport)); | ||
} | ||
get expiring() { | ||
updateStorage(result) { | ||
var _a, _b; | ||
const expiration = this.storage.auth_expires; | ||
if (expiration === null) { | ||
return false; | ||
} | ||
const expiringAfter = expiration - ((_b = (_a = this.options.refresh) === null || _a === void 0 ? void 0 : _a.time) !== null && _b !== void 0 ? _b : 0); | ||
return expiringAfter <= Date.now(); | ||
this._storage.auth_token = result.access_token; | ||
this._storage.auth_refresh_token = (_a = result.refresh_token) !== null && _a !== void 0 ? _a : null; | ||
this._storage.auth_expires = (_b = result.expires) !== null && _b !== void 0 ? _b : null; | ||
} | ||
refreshToken(force = false) { | ||
autoRefreshJob() { | ||
if (!this.autoRefresh) | ||
return; | ||
if (!this._storage.auth_expires) | ||
return; | ||
const msWaitUntilRefresh = this._storage.auth_expires - this.msRefreshBeforeExpires; | ||
this.timer = setTimeout(() => __awaiter(this, void 0, void 0, function* () { | ||
yield this.refresh().catch(() => { | ||
/*do nothing*/ | ||
}); | ||
this.autoRefreshJob(); | ||
}), msWaitUntilRefresh); | ||
} | ||
refresh() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!force && !this.expiring) { | ||
return false; | ||
} | ||
const response = yield this.transport.post('/auth/refresh', { | ||
refresh_token: this.options.mode === 'json' ? this.storage.auth_refresh_token : undefined, | ||
}, { | ||
refreshTokenIfNeeded: false, | ||
const response = yield this._transport.post('/auth/refresh', { | ||
refresh_token: this.mode === 'json' ? this._storage.auth_refresh_token : undefined, | ||
}); | ||
this.updateStorage(response.data); | ||
this.updateRefresh(); | ||
return { | ||
@@ -71,62 +79,9 @@ access_token: response.data.access_token, | ||
} | ||
updateStorage(result) { | ||
login(credentials) { | ||
var _a; | ||
this.storage.auth_token = result.access_token; | ||
this.storage.auth_refresh_token = (_a = result.refresh_token) !== null && _a !== void 0 ? _a : null; | ||
if (result.expires) { | ||
this.storage.auth_expires = Date.now() + result.expires; | ||
} | ||
else { | ||
this.storage.auth_expires = null; | ||
} | ||
} | ||
updateRefresh(options) { | ||
var _a, _b; | ||
const expiration = this.storage.auth_expires; | ||
if (expiration === null) { | ||
clearTimeout(this.timer); | ||
return; // Don't auto refresh if there's no expiration time (token auth) | ||
} | ||
if (options) { | ||
this.options.refresh.auto = (_a = options.auto) !== null && _a !== void 0 ? _a : this.options.refresh.auto; | ||
this.options.refresh.time = (_b = options.time) !== null && _b !== void 0 ? _b : this.options.refresh.time; | ||
} | ||
clearTimeout(this.timer); | ||
let remaining = expiration - this.options.refresh.time - Date.now(); | ||
if (remaining < 0) { | ||
// It's already expired, try a refresh | ||
if (expiration < Date.now()) { | ||
return; // Don't set auto refresh | ||
} | ||
else { | ||
remaining = 0; | ||
} | ||
} | ||
if (this.options.refresh.auto) { | ||
this.timer = setTimeout(() => { | ||
this.refresh() | ||
.then(() => { | ||
// Do nothing | ||
}) | ||
.catch(() => { | ||
// Do nothing | ||
}); | ||
}, remaining); | ||
} | ||
} | ||
refresh(force = false) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.refresher.debounce(force); | ||
}); | ||
} | ||
login(credentials, options) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
options = options || {}; | ||
const response = yield this.transport.post('/auth/login', Object.assign({ mode: this.options.mode }, credentials), { | ||
refreshTokenIfNeeded: false, | ||
sendAuthorizationHeaders: false, | ||
}); | ||
const response = yield this._transport.post('/auth/login', Object.assign({ mode: this.mode }, credentials), { headers: { Authorization: null } }); | ||
this.updateStorage(response.data); | ||
this.updateRefresh(options.refresh); | ||
if (this.autoRefresh) | ||
this.autoRefreshJob(); | ||
return { | ||
@@ -141,10 +96,4 @@ access_token: response.data.access_token, | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.transport.get('/users/me', { | ||
params: { | ||
access_token: token, | ||
}, | ||
}); | ||
this.storage.auth_token = token; | ||
this.storage.auth_expires = null; | ||
this.storage.auth_refresh_token = null; | ||
yield this._transport.get('/users/me', { params: { access_token: token }, headers: { Authorization: null } }); | ||
this.updateStorage({ access_token: token, expires: null, refresh_token: null }); | ||
return true; | ||
@@ -156,13 +105,7 @@ }); | ||
let refresh_token; | ||
if (this.options.mode === 'json') { | ||
refresh_token = this.storage.auth_refresh_token || undefined; | ||
if (this.mode === 'json') { | ||
refresh_token = this._storage.auth_refresh_token || undefined; | ||
} | ||
yield this.transport.post('/auth/logout', { | ||
refresh_token, | ||
}, { | ||
refreshTokenIfNeeded: false, | ||
}); | ||
this.storage.auth_token = null; | ||
this.storage.auth_expires = null; | ||
this.storage.auth_refresh_token = null; | ||
yield this._transport.post('/auth/logout', { refresh_token }); | ||
this.updateStorage({ access_token: null, expires: null, refresh_token: null }); | ||
clearTimeout(this.timer); | ||
@@ -169,0 +112,0 @@ }); |
@@ -1,16 +0,22 @@ | ||
import { IAuth } from '../auth'; | ||
import { IAuth, AuthOptions } from '../auth'; | ||
import { IDirectus } from '../directus'; | ||
import { ActivityHandler, CollectionsHandler, FieldsHandler, FilesHandler, FoldersHandler, PermissionsHandler, PresetsHandler, RelationsHandler, RevisionsHandler, RolesHandler, ServerHandler, SettingsHandler, UsersHandler, UtilsHandler } from '../handlers'; | ||
import { IItems } from '../items'; | ||
import { ITransport } from '../transport'; | ||
import { ITransport, TransportOptions } from '../transport'; | ||
import { IStorage } from '../storage'; | ||
import { TypeMap, TypeOf } from '../types'; | ||
import { StorageOptions } from './storage'; | ||
import { TypeMap, TypeOf, PartialBy } from '../types'; | ||
import { GraphQLHandler } from '../handlers/graphql'; | ||
import { ISingleton } from '../singleton'; | ||
export declare type DirectusStorageOptions = StorageOptions & { | ||
mode?: 'LocalStorage' | 'MemoryStorage'; | ||
}; | ||
export declare type DirectusOptions = { | ||
auth?: IAuth; | ||
transport?: ITransport; | ||
storage?: IStorage; | ||
auth?: IAuth | PartialBy<AuthOptions, 'transport' | 'storage'>; | ||
transport?: ITransport | TransportOptions; | ||
storage?: IStorage | DirectusStorageOptions; | ||
}; | ||
export declare class Directus<T extends TypeMap> implements IDirectus<T> { | ||
private _url; | ||
private _options?; | ||
private _auth; | ||
@@ -37,2 +43,3 @@ private _transport; | ||
constructor(url: string, options?: DirectusOptions); | ||
get url(): string; | ||
get auth(): IAuth; | ||
@@ -39,0 +46,0 @@ get storage(): IStorage; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Directus = void 0; | ||
const auth_1 = require("../auth"); | ||
const handlers_1 = require("../handlers"); | ||
const transport_1 = require("../transport"); | ||
const items_1 = require("./items"); | ||
const transport_1 = require("./transport"); | ||
const auth_1 = require("./auth"); | ||
const storage_1 = require("./storage"); | ||
const transport_2 = require("./transport"); | ||
const auth_2 = require("./auth"); | ||
const storage_1 = require("../storage"); | ||
const storage_2 = require("./storage"); | ||
const graphql_1 = require("../handlers/graphql"); | ||
@@ -22,12 +27,43 @@ const singleton_1 = require("../handlers/singleton"); | ||
constructor(url, options) { | ||
this._storage = (options === null || options === void 0 ? void 0 : options.storage) || (typeof window !== 'undefined' ? new storage_1.LocalStorage() : new storage_1.MemoryStorage()); | ||
this._transport = | ||
(options === null || options === void 0 ? void 0 : options.transport) || | ||
new transport_1.AxiosTransport(url, this._storage, () => __awaiter(this, void 0, void 0, function* () { | ||
yield this._auth.refresh(); | ||
})); | ||
this._auth = (options === null || options === void 0 ? void 0 : options.auth) || new auth_1.Auth(this._transport, this._storage); | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
this._url = url; | ||
this._options = options; | ||
this._items = {}; | ||
this._singletons = {}; | ||
if (((_a = this._options) === null || _a === void 0 ? void 0 : _a.storage) && ((_b = this._options) === null || _b === void 0 ? void 0 : _b.storage) instanceof storage_1.IStorage) | ||
this._storage = this._options.storage; | ||
else { | ||
const directusStorageOptions = (_c = this._options) === null || _c === void 0 ? void 0 : _c.storage; | ||
const _j = directusStorageOptions !== null && directusStorageOptions !== void 0 ? directusStorageOptions : {}, { mode } = _j, storageOptions = __rest(_j, ["mode"]); | ||
if (mode === 'MemoryStorage' || typeof window === 'undefined') { | ||
this._storage = new storage_2.MemoryStorage(storageOptions); | ||
} | ||
else { | ||
this._storage = new storage_2.LocalStorage(storageOptions); | ||
} | ||
} | ||
if (((_d = this._options) === null || _d === void 0 ? void 0 : _d.transport) && ((_e = this._options) === null || _e === void 0 ? void 0 : _e.transport) instanceof transport_1.ITransport) | ||
this._transport = this._options.transport; | ||
else { | ||
this._transport = new transport_2.Transport({ | ||
url: this.url, | ||
beforeRequest: (config) => { | ||
const token = this.storage.auth_token; | ||
const bearer = token | ||
? token.startsWith(`Bearer `) | ||
? String(this.storage.auth_token) | ||
: `Bearer ${this.storage.auth_token}` | ||
: ''; | ||
return Object.assign(Object.assign({}, config), { headers: Object.assign({ Authorization: bearer }, config.headers) }); | ||
}, | ||
}); | ||
} | ||
if (((_f = this._options) === null || _f === void 0 ? void 0 : _f.auth) && ((_g = this._options) === null || _g === void 0 ? void 0 : _g.auth) instanceof auth_1.IAuth) | ||
this._auth = this._options.auth; | ||
else | ||
this._auth = new auth_2.Auth(Object.assign({ transport: this._transport, storage: this._storage }, (_h = this._options) === null || _h === void 0 ? void 0 : _h.auth)); | ||
} | ||
get url() { | ||
return this._url; | ||
} | ||
get auth() { | ||
@@ -34,0 +70,0 @@ return this._auth; |
import { IStorage } from '../../storage'; | ||
export declare abstract class BaseStorage implements IStorage { | ||
export declare type StorageOptions = { | ||
prefix?: string; | ||
}; | ||
export declare abstract class BaseStorage extends IStorage { | ||
protected prefix: string; | ||
get auth_token(): string | null; | ||
@@ -12,3 +16,4 @@ set auth_token(value: string | null); | ||
abstract delete(key: string): string | null; | ||
constructor(options?: StorageOptions); | ||
} | ||
//# sourceMappingURL=base.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BaseStorage = void 0; | ||
class BaseStorage { | ||
const storage_1 = require("../../storage"); | ||
class BaseStorage extends storage_1.IStorage { | ||
constructor(options) { | ||
var _a; | ||
super(); | ||
this.prefix = (_a = options === null || options === void 0 ? void 0 : options.prefix) !== null && _a !== void 0 ? _a : ''; | ||
} | ||
get auth_token() { | ||
@@ -6,0 +12,0 @@ return this.get('auth_token'); |
import { BaseStorage } from './base'; | ||
export declare class LocalStorage extends BaseStorage { | ||
private prefix; | ||
constructor(prefix?: string); | ||
get(key: string): string | null; | ||
@@ -6,0 +4,0 @@ set(key: string, value: string): string; |
@@ -6,6 +6,2 @@ "use strict"; | ||
class LocalStorage extends base_1.BaseStorage { | ||
constructor(prefix = '') { | ||
super(); | ||
this.prefix = prefix; | ||
} | ||
get(key) { | ||
@@ -12,0 +8,0 @@ const value = localStorage.getItem(this.key(key)); |
import { BaseStorage } from './base'; | ||
export declare class MemoryStorage extends BaseStorage { | ||
private prefix; | ||
private values; | ||
constructor(prefix?: string); | ||
get(key: string): string | null; | ||
@@ -7,0 +5,0 @@ set(key: string, value: string): string; |
@@ -6,6 +6,5 @@ "use strict"; | ||
class MemoryStorage extends base_1.BaseStorage { | ||
constructor(prefix = '') { | ||
super(); | ||
constructor() { | ||
super(...arguments); | ||
this.values = {}; | ||
this.prefix = prefix; | ||
} | ||
@@ -12,0 +11,0 @@ get(key) { |
@@ -24,6 +24,12 @@ import { IAuth } from './auth'; | ||
}; | ||
export interface IDirectus<T extends TypeMap> { | ||
export interface IDirectusBase { | ||
readonly url: string; | ||
readonly auth: IAuth; | ||
readonly storage: IStorage; | ||
readonly transport: ITransport; | ||
readonly server: ServerHandler; | ||
readonly utils: UtilsHandler; | ||
readonly graphql: GraphQLHandler; | ||
} | ||
export interface IDirectus<T extends TypeMap> extends IDirectusBase { | ||
readonly activity: ActivityHandler<TypeOf<T, 'directus_activity'>>; | ||
@@ -41,5 +47,2 @@ readonly collections: CollectionsHandler<TypeOf<T, 'directus_collections'>>; | ||
readonly settings: SettingsHandler<TypeOf<T, 'directus_settings'>>; | ||
readonly server: ServerHandler; | ||
readonly utils: UtilsHandler; | ||
readonly graphql: GraphQLHandler; | ||
items<C extends string, I = TypeOf<T, C>>(collection: C): IItems<I>; | ||
@@ -46,0 +49,0 @@ singleton<C extends string, I = TypeOf<T, C>>(collection: C): ISingleton<I>; |
@@ -8,4 +8,2 @@ /** | ||
private transport; | ||
get url(): string; | ||
set url(value: string); | ||
constructor(transport: ITransport, name: string); | ||
@@ -12,0 +10,0 @@ private endpoint; |
@@ -12,8 +12,2 @@ "use strict"; | ||
} | ||
get url() { | ||
return this.transport.url; | ||
} | ||
set url(value) { | ||
this.transport.url = value; | ||
} | ||
endpoint(path) { | ||
@@ -20,0 +14,0 @@ if (path.startsWith('/')) { |
@@ -0,1 +1,2 @@ | ||
class t{constructor(){this.mode="undefined"==typeof window?"json":"cookie"}} | ||
/*! ***************************************************************************** | ||
@@ -14,4 +15,3 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function t(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((n=n.apply(t,e||[])).next())}))}class e{constructor(t,e){this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}readOne(e,r){return t(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}/${encodeURI(e)}`,{params:r})).data}))}readMany(e){return t(this,void 0,void 0,(function*(){const{data:t,meta:r}=yield this.transport.get(`${this.endpoint}`,{params:e});return{data:t,meta:r}}))}createOne(e,r){return t(this,void 0,void 0,(function*(){return(yield this.transport.post(`${this.endpoint}`,e,{params:r})).data}))}createMany(e,r){return t(this,void 0,void 0,(function*(){return yield this.transport.post(`${this.endpoint}`,e,{params:r})}))}updateOne(e,r,n){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(e)}`,r,{params:n})).data}))}updateMany(e,r,n){return t(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:e,data:r},{params:n})}))}updateByQuery(e,r,n){return t(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:e,data:r},{params:n})}))}deleteOne(e){return t(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}/${encodeURI(e)}`)}))}deleteMany(e){return t(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}`,e)}))}}class r{constructor(t){this.transport=t}create(e){return t(this,void 0,void 0,(function*(){return(yield this.transport.post("/activity/comment",e)).data}))}update(e,r){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/activity/comment/${encodeURI(e)}`,{comment:r})).data}))}delete(e){return t(this,void 0,void 0,(function*(){yield this.transport.delete(`/activity/comment/${encodeURI(e)}`)}))}}class n extends e{constructor(t){super("directus_activity",t),this._comments=new r(this.transport)}get comments(){return this._comments}}class s{constructor(t){this.transport=t}readOne(e){return t(this,void 0,void 0,(function*(){return(yield this.transport.get(`/collections/${e}`)).data}))}readAll(){return t(this,void 0,void 0,(function*(){const{data:t,meta:e}=yield this.transport.get("/collections");return{data:t,meta:e}}))}createOne(e){return t(this,void 0,void 0,(function*(){return(yield this.transport.post("/collections",e)).data}))}createMany(e){return t(this,void 0,void 0,(function*(){const{data:t,meta:r}=yield this.transport.post("/collections",e);return{data:t,meta:r}}))}updateOne(e,r,n){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${e}`,r,{params:n})).data}))}deleteOne(e){return t(this,void 0,void 0,(function*(){yield this.transport.delete(`/collections/${e}`)}))}}class i{constructor(t){this.transport=t}readOne(e,r){return t(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${e}/${r}`)).data}))}readMany(e){return t(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${e}`)).data}))}readAll(){return t(this,void 0,void 0,(function*(){return(yield this.transport.get("/fields")).data}))}createOne(e,r){return t(this,void 0,void 0,(function*(){return(yield this.transport.post(`/fields/${e}`,r)).data}))}updateOne(e,r,n){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${e}/${r}`,n)).data}))}deleteOne(e,r){return t(this,void 0,void 0,(function*(){yield this.transport.delete(`/fields/${e}/${r}`)}))}}class o extends e{constructor(t){super("directus_files",t)}}class a extends e{constructor(t){super("directus_folders",t)}}class u extends e{constructor(t){super("directus_permissions",t)}}class d extends e{constructor(t){super("directus_presets",t)}}class h{constructor(t){this.transport=t}readOne(e,r){return t(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${e}/${r}`)).data}))}readMany(e){return t(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${e}`)).data}))}readAll(){return t(this,void 0,void 0,(function*(){return(yield this.transport.get("/relations")).data}))}createOne(e){return t(this,void 0,void 0,(function*(){return(yield this.transport.post("/relations",e)).data}))}updateOne(e,r,n){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${e}/${r}`,{params:n})).data}))}deleteOne(e,r){return t(this,void 0,void 0,(function*(){yield this.transport.delete(`/relations/${e}/${r}`)}))}}class c extends e{constructor(t){super("directus_revisions",t)}}class l extends e{constructor(t){super("directus_roles",t)}}class p{constructor(t){this.transport=t}ping(){return t(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/ping")).raw}))}info(){return t(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/info")).data}))}}class f{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}read(e){return t(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}`,{params:e})).data}))}update(e,r){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}`,e,{params:r})).data}))}}class v extends f{constructor(t){super("directus_settings",t)}}class m{constructor(t){this.transport=t}send(e,r,n){return t(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:e,role:r,invite_url:n})}))}accept(e,r){return t(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite/accept",{token:e,password:r})}))}}class g{constructor(t){this.transport=t}generate(e){return t(this,void 0,void 0,(function*(){return(yield this.transport.post("/users/me/tfa/generate",{password:e})).data}))}enable(e,r){return t(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/enable",{secret:e,otp:r})}))}disable(e){return t(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/disable",{otp:e})}))}}class y{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new g(this._transport))}read(e){return t(this,void 0,void 0,(function*(){return(yield this._transport.get("/users/me",{params:e})).data}))}update(e,r){return t(this,void 0,void 0,(function*(){return(yield this._transport.patch("/users/me",e,{params:r})).data}))}}class _ extends e{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new m(this.transport))}get me(){return this._me||(this._me=new y(this.transport))}}class w{constructor(e){this.random={string:(e=32)=>t(this,void 0,void 0,(function*(){return(yield this.transport.get("/utils/random/string",{params:{length:e}})).data}))},this.hash={generate:e=>t(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/generate",{string:e})).data})),verify:(e,r)=>t(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/verify",{string:e,hash:r})).data}))},this.transport=e}sort(e,r,n){return t(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(e)}`,{item:r,to:n})}))}revert(e){return t(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(e)}`)}))}}var b;!function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(b||(b={}));class x extends Error{constructor(t,e){var r,n;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(n=null==e?void 0:e.errors[0])||void 0===n?void 0:n.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,x.prototype)}}class k{get auth_token(){return this.get("auth_token")}set auth_token(t){null===t?this.delete("auth_token"):this.set("auth_token",t)}get auth_expires(){const t=this.get("auth_expires");return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete("auth_expires"):this.set("auth_expires",t.toString())}get auth_refresh_token(){return this.get("auth_refresh_token")}set auth_refresh_token(t){null===t?this.delete("auth_refresh_token"):this.set("auth_refresh_token",t)}}class O extends k{constructor(t=""){super(),this.values={},this.prefix=t}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}class E extends k{constructor(t=""){super(),this.prefix=t}get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}var S={exports:{}},T=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},j=T,R=Object.prototype.toString;function A(t){return"[object Array]"===R.call(t)}function $(t){return void 0===t}function N(t){return null!==t&&"object"==typeof t}function U(t){if("[object Object]"!==R.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function q(t){return"[object Function]"===R.call(t)}function C(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),A(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}var P={isArray:A,isArrayBuffer:function(t){return"[object ArrayBuffer]"===R.call(t)},isBuffer:function(t){return null!==t&&!$(t)&&null!==t.constructor&&!$(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:N,isPlainObject:U,isUndefined:$,isDate:function(t){return"[object Date]"===R.call(t)},isFile:function(t){return"[object File]"===R.call(t)},isBlob:function(t){return"[object Blob]"===R.call(t)},isFunction:q,isStream:function(t){return N(t)&&q(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:C,merge:function t(){var e={};function r(r,n){U(e[n])&&U(r)?e[n]=t(e[n],r):U(r)?e[n]=t({},r):A(r)?e[n]=r.slice():e[n]=r}for(var n=0,s=arguments.length;n<s;n++)C(arguments[n],r);return e},extend:function(t,e,r){return C(e,(function(e,n){t[n]=r&&"function"==typeof e?j(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},B=P;function L(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var I=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if(B.isURLSearchParams(e))n=e.toString();else{var s=[];B.forEach(e,(function(t,e){null!=t&&(B.isArray(t)?e+="[]":t=[t],B.forEach(t,(function(t){B.isDate(t)?t=t.toISOString():B.isObject(t)&&(t=JSON.stringify(t)),s.push(L(e)+"="+L(t))})))})),n=s.join("&")}if(n){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},D=P;function M(){this.handlers=[]}M.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},M.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},M.prototype.forEach=function(t){D.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var z=M,F=P,H=function(t,e,r,n,s){return t.config=e,r&&(t.code=r),t.request=n,t.response=s,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},J=H,W=function(t,e,r,n,s){var i=new Error(t);return J(i,e,r,n,s)},V=W,X=P,K=X.isStandardBrowserEnv()?{write:function(t,e,r,n,s,i){var o=[];o.push(t+"="+encodeURIComponent(e)),X.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),X.isString(n)&&o.push("path="+n),X.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},G=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},Q=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Y=P,Z=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],tt=P,et=tt.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=n(window.location.href),function(e){var r=tt.isString(e)?n(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0};function rt(t){this.message=t}rt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},rt.prototype.__CANCEL__=!0;var nt=rt,st=P,it=function(t,e,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(V("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},ot=K,at=I,ut=function(t,e){return t&&!G(e)?Q(t,e):e},dt=function(t){var e,r,n,s={};return t?(Y.forEach(t.split("\n"),(function(t){if(n=t.indexOf(":"),e=Y.trim(t.substr(0,n)).toLowerCase(),r=Y.trim(t.substr(n+1)),e){if(s[e]&&Z.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s},ht=et,ct=W,lt=xt,pt=nt,ft=function(t){return new Promise((function(e,r){var n,s=t.data,i=t.headers,o=t.responseType;function a(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}st.isFormData(s)&&delete i["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",h=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+h)}var c=ut(t.baseURL,t.url);function l(){if(u){var n="getAllResponseHeaders"in u?dt(u.getAllResponseHeaders()):null,s={data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u};it((function(t){e(t),a()}),(function(t){r(t),a()}),s),u=null}}if(u.open(t.method.toUpperCase(),at(c,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(r(ct("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(ct("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||lt.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(ct(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},st.isStandardBrowserEnv()){var p=(t.withCredentials||ht(c))&&t.xsrfCookieName?ot.read(t.xsrfCookieName):void 0;p&&(i[t.xsrfHeaderName]=p)}"setRequestHeader"in u&&st.forEach(i,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete i[e]:u.setRequestHeader(e,t)})),st.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),o&&"json"!==o&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){u&&(r(!t||t&&t.type?new pt("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),s||(s=null),u.send(s)}))},vt=P,mt=function(t,e){F.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))},gt=H,yt={"Content-Type":"application/x-www-form-urlencoded"};function _t(t,e){!vt.isUndefined(t)&&vt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var wt,bt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(wt=ft),wt),transformRequest:[function(t,e){return mt(e,"Accept"),mt(e,"Content-Type"),vt.isFormData(t)||vt.isArrayBuffer(t)||vt.isBuffer(t)||vt.isStream(t)||vt.isFile(t)||vt.isBlob(t)?t:vt.isArrayBufferView(t)?t.buffer:vt.isURLSearchParams(t)?(_t(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):vt.isObject(t)||e&&"application/json"===e["Content-Type"]?(_t(e,"application/json"),function(t,e,r){if(vt.isString(t))try{return(e||JSON.parse)(t),vt.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||bt.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||n&&vt.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw gt(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};vt.forEach(["delete","get","head"],(function(t){bt.headers[t]={}})),vt.forEach(["post","put","patch"],(function(t){bt.headers[t]=vt.merge(yt)}));var xt=bt,kt=P,Ot=xt,Et=function(t){return!(!t||!t.__CANCEL__)},St=P,Tt=function(t,e,r){var n=this||Ot;return kt.forEach(r,(function(r){t=r.call(n,t,e)})),t},jt=Et,Rt=xt,At=nt;function $t(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new At("canceled")}var Nt=P,Ut=function(t,e){e=e||{};var r={};function n(t,e){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge(t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function s(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(t[r],e[r])}function i(t){if(!Nt.isUndefined(e[t]))return n(void 0,e[t])}function o(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(void 0,e[r])}function a(r){return r in e?n(t[r],e[r]):r in t?n(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return Nt.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||s,n=e(t);Nt.isUndefined(n)&&e!==a||(r[t]=n)})),r},qt="0.24.0",Ct=qt,Pt={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Pt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var Bt={};Pt.transitional=function(t,e,r){function n(t,e){return"[Axios v"+Ct+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,s,i){if(!1===t)throw new Error(n(s," has been removed"+(e?" in "+e:"")));return e&&!Bt[s]&&(Bt[s]=!0,console.warn(n(s," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,s,i)}};var Lt={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:Pt},It=P,Dt=I,Mt=z,zt=function(t){return $t(t),t.headers=t.headers||{},t.data=Tt.call(t,t.data,t.headers,t.transformRequest),t.headers=St.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),St.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||Rt.adapter)(t).then((function(e){return $t(t),e.data=Tt.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return jt(e)||($t(t),e&&e.response&&(e.response.data=Tt.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Ft=Ut,Ht=Lt,Jt=Ht.validators;function Wt(t){this.defaults=t,this.interceptors={request:new Mt,response:new Mt}}Wt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=Ft(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&Ht.assertOptions(e,{silentJSONParsing:Jt.transitional(Jt.boolean),forcedJSONParsing:Jt.transitional(Jt.boolean),clarifyTimeoutError:Jt.transitional(Jt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!n){var o=[zt,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{s=zt(a)}catch(t){return Promise.reject(t)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},Wt.prototype.getUri=function(t){return t=Ft(this.defaults,t),Dt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},It.forEach(["delete","get","head","options"],(function(t){Wt.prototype[t]=function(e,r){return this.request(Ft(r||{},{method:t,url:e,data:(r||{}).data}))}})),It.forEach(["post","put","patch"],(function(t){Wt.prototype[t]=function(e,r,n){return this.request(Ft(n||{},{method:t,url:e,data:r}))}}));var Vt=Wt,Xt=nt;function Kt(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,n=r._listeners.length;for(e=0;e<n;e++)r._listeners[e](t);r._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t){r.reason||(r.reason=new Xt(t),e(r.reason))}))}Kt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Kt.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Kt.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Kt.source=function(){var t;return{token:new Kt((function(e){t=e})),cancel:t}};var Gt=Kt,Qt=P,Yt=T,Zt=Vt,te=Ut;var ee=function t(e){var r=new Zt(e),n=Yt(Zt.prototype.request,r);return Qt.extend(n,Zt.prototype,r),Qt.extend(n,r),n.create=function(r){return t(te(e,r))},n}(xt);ee.Axios=Zt,ee.Cancel=nt,ee.CancelToken=Gt,ee.isCancel=Et,ee.VERSION=qt,ee.all=function(t){return Promise.all(t)},ee.spread=function(t){return function(e){return t.apply(null,e)}},ee.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},S.exports=ee,S.exports.default=ee;var re=S.exports;class ne{constructor(t,e,r=(()=>Promise.resolve())){this._url=t,this._storage=e,this._axios=null,this._refresh=r,this.url=t}get url(){return this._url}set url(t){this._url=t,this._axios=re.create({baseURL:t,withCredentials:!0})}get axios(){return this._axios}get requests(){return{intercept:(t,e)=>{const r=this._axios.interceptors.request.use(t,e);return{eject:()=>{this._axios.interceptors.request.eject(r)}}}}}get responses(){return{intercept:(t,e)=>{const r=this._axios.interceptors.response.use(t,e);return{eject:()=>{this._axios.interceptors.response.eject(r)}}}}}request(e,r,n,s){var i,o,a,u,d,h,c,l,p;return t(this,void 0,void 0,(function*(){try{(s=s||{}).sendAuthorizationHeaders=null===(i=s.sendAuthorizationHeaders)||void 0===i||i,s.refreshTokenIfNeeded=null===(o=s.refreshTokenIfNeeded)||void 0===o||o,s.headers=null!==(a=s.headers)&&void 0!==a?a:{},s.onUploadProgress=null!==(u=s.onUploadProgress)&&void 0!==u?u:void 0,s.refreshTokenIfNeeded&&(yield this._refresh());const t={method:e,url:r,data:n,params:s.params,headers:s.headers,onUploadProgress:s.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;s.sendAuthorizationHeaders&&d&&(null!==h&&h>Date.now()||null===h)&&(d.startsWith("Bearer ")?t.headers.Authorization=d:t.headers.Authorization=`Bearer ${d}`);const c=yield this.axios.request(t),l=c.data,p={raw:c.data,status:c.status,statusText:c.statusText,headers:c.headers,data:l.data,meta:l.meta,errors:l.errors};if(l.errors)throw new x(null,p);return p}catch(t){if(!t||t instanceof Error==!1)throw t;if(re.isAxiosError(t)){const e=null===(d=t.response)||void 0===d?void 0:d.data;throw new x(t,{raw:null===(h=t.response)||void 0===h?void 0:h.data,status:null===(c=t.response)||void 0===c?void 0:c.status,statusText:null===(l=t.response)||void 0===l?void 0:l.statusText,headers:null===(p=t.response)||void 0===p?void 0:p.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new x(t)}}))}get(e,r){return t(this,void 0,void 0,(function*(){return yield this.request("get",e,void 0,r)}))}head(e,r){return t(this,void 0,void 0,(function*(){return yield this.request("head",e,void 0,r)}))}options(e,r){return t(this,void 0,void 0,(function*(){return yield this.request("options",e,void 0,r)}))}delete(e,r,n){return t(this,void 0,void 0,(function*(){return yield this.request("delete",e,r,n)}))}put(e,r,n){return t(this,void 0,void 0,(function*(){return yield this.request("put",e,r,n)}))}post(e,r,n){return t(this,void 0,void 0,(function*(){return yield this.request("post",e,r,n)}))}patch(e,r,n){return t(this,void 0,void 0,(function*(){return yield this.request("patch",e,r,n)}))}}class se{constructor(t){this.transport=t}request(e,r){return t(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/request",{email:e,reset_url:r})}))}reset(e,r){return t(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/reset",{token:e,password:r})}))}}class ie{constructor(t){this.func=t,this.debounced=[],this.debouncing=!1}debounce(...e){return t(this,void 0,void 0,(function*(){return this.debouncing?yield new Promise(((t,e)=>{this.debounced.push({resolve:e=>t(e),reject:t=>e(t)})})):(this.debouncing=!0,new Promise(((t,r)=>{this.func(...e).then((e=>{const n=[{resolve:t,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,n.forEach((t=>t.resolve(e)))})).catch((e=>{const n=[{resolve:t,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,n.forEach((t=>t.reject(e)))}))})))}))}}class oe{constructor(t,e,r){var n,s,i,o,a;this.options=r||{},this.options.mode=(null==r?void 0:r.mode)||("undefined"!=typeof window?"cookie":"json"),this.options.refresh=(null==r?void 0:r.refresh)||{auto:!1,time:3e4},this.options.refresh.auto=null!==(s=null===(n=this.options.refresh)||void 0===n?void 0:n.auto)&&void 0!==s&&s,this.options.refresh.time=null!==(o=null===(i=this.options.refresh)||void 0===i?void 0:i.time)&&void 0!==o?o:3e4,this.transport=t,this.storage=e,this.timer=!1,this.refresher=new ie(this.refreshToken.bind(this));try{this.updateRefresh(null===(a=this.options)||void 0===a?void 0:a.refresh)}catch(t){}}get token(){return this.storage.auth_token}get password(){return this.passwords=this.passwords||new se(this.transport)}get expiring(){var t,e;const r=this.storage.auth_expires;if(null===r)return!1;return r-(null!==(e=null===(t=this.options.refresh)||void 0===t?void 0:t.time)&&void 0!==e?e:0)<=Date.now()}refreshToken(e=!1){var r;return t(this,void 0,void 0,(function*(){if(!e&&!this.expiring)return!1;const t=yield this.transport.post("/auth/refresh",{refresh_token:"json"===this.options.mode?this.storage.auth_refresh_token:void 0},{refreshTokenIfNeeded:!1});return this.updateStorage(t.data),this.updateRefresh(),{access_token:t.data.access_token,refresh_token:null===(r=t.data)||void 0===r?void 0:r.refresh_token,expires:t.data.expires}}))}updateStorage(t){var e;this.storage.auth_token=t.access_token,this.storage.auth_refresh_token=null!==(e=t.refresh_token)&&void 0!==e?e:null,t.expires?this.storage.auth_expires=Date.now()+t.expires:this.storage.auth_expires=null}updateRefresh(t){var e,r;const n=this.storage.auth_expires;if(null===n)return void clearTimeout(this.timer);t&&(this.options.refresh.auto=null!==(e=t.auto)&&void 0!==e?e:this.options.refresh.auto,this.options.refresh.time=null!==(r=t.time)&&void 0!==r?r:this.options.refresh.time),clearTimeout(this.timer);let s=n-this.options.refresh.time-Date.now();if(s<0){if(n<Date.now())return;s=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),s))}refresh(e=!1){return t(this,void 0,void 0,(function*(){return yield this.refresher.debounce(e)}))}login(e,r){var n;return t(this,void 0,void 0,(function*(){r=r||{};const t=yield this.transport.post("/auth/login",Object.assign({mode:this.options.mode},e),{refreshTokenIfNeeded:!1,sendAuthorizationHeaders:!1});return this.updateStorage(t.data),this.updateRefresh(r.refresh),{access_token:t.data.access_token,refresh_token:null===(n=t.data)||void 0===n?void 0:n.refresh_token,expires:t.data.expires}}))}static(e){return t(this,void 0,void 0,(function*(){return yield this.transport.get("/users/me",{params:{access_token:e}}),this.storage.auth_token=e,this.storage.auth_expires=null,this.storage.auth_refresh_token=null,!0}))}logout(){return t(this,void 0,void 0,(function*(){let t;"json"===this.options.mode&&(t=this.storage.auth_refresh_token||void 0),yield this.transport.post("/auth/logout",{refresh_token:t},{refreshTokenIfNeeded:!1}),this.storage.auth_token=null,this.storage.auth_expires=null,this.storage.auth_refresh_token=null,clearTimeout(this.timer)}))}}class ae{constructor(t){this.transport=t}request(e,r,n){return t(this,void 0,void 0,(function*(){return yield this.transport.post(e,{query:r,variables:void 0===n?{}:n})}))}items(e,r){return t(this,void 0,void 0,(function*(){return yield this.request("/graphql",e,r)}))}system(e,r){return t(this,void 0,void 0,(function*(){return yield this.request("/graphql/system",e,r)}))}}class ue{constructor(e,r){this._storage=(null==r?void 0:r.storage)||("undefined"!=typeof window?new E:new O),this._transport=(null==r?void 0:r.transport)||new ne(e,this._storage,(()=>t(this,void 0,void 0,(function*(){yield this._auth.refresh()})))),this._auth=(null==r?void 0:r.auth)||new oe(this._transport,this._storage),this._items={},this._singletons={}}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new n(this.transport))}get collections(){return this._collections||(this._collections=new s(this.transport))}get fields(){return this._fields||(this._fields=new i(this.transport))}get files(){return this._files||(this._files=new o(this.transport))}get folders(){return this._folders||(this._folders=new a(this.transport))}get permissions(){return this._permissions||(this._permissions=new u(this.transport))}get presets(){return this._presets||(this._presets=new d(this.transport))}get relations(){return this._relations||(this._relations=new h(this.transport))}get revisions(){return this._revisions||(this._revisions=new c(this.transport))}get roles(){return this._roles||(this._roles=new l(this.transport))}get users(){return this._users||(this._users=new _(this.transport))}get settings(){return this._settings||(this._settings=new v(this.transport))}get server(){return this._server||(this._server=new p(this.transport))}get utils(){return this._utils||(this._utils=new w(this.transport))}get graphql(){return this._graphql||(this._graphql=new ae(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new f(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new e(t,this.transport))}}export{n as ActivityHandler,oe as Auth,ne as AxiosTransport,k as BaseStorage,s as CollectionsHandler,r as CommentsHandler,ue as Directus,i as FieldsHandler,o as FilesHandler,a as FoldersHandler,e as ItemsHandler,E as LocalStorage,O as MemoryStorage,b as Meta,u as PermissionsHandler,d as PresetsHandler,h as RelationsHandler,c as RevisionsHandler,l as RolesHandler,p as ServerHandler,v as SettingsHandler,x as TransportError,_ as UsersHandler,w as UtilsHandler}; | ||
***************************************************************************** */function e(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((n=n.apply(t,e||[])).next())}))}class r{constructor(t,e){this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}/${encodeURI(t)}`,{params:r})).data}))}readMany(t){return e(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.get(`${this.endpoint}`,{params:t});return{data:e,meta:r}}))}createOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.post(`${this.endpoint}`,t,{params:r})).data}))}createMany(t,r){return e(this,void 0,void 0,(function*(){return yield this.transport.post(`${this.endpoint}`,t,{params:r})}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:n})).data}))}updateMany(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:n})}))}updateByQuery(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:n})}))}deleteOne(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}/${encodeURI(t)}`)}))}deleteMany(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}`,t)}))}}class n{constructor(t){this.transport=t}create(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/activity/comment",t)).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/activity/comment/${encodeURI(t)}`,{comment:r})).data}))}delete(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/activity/comment/${encodeURI(t)}`)}))}}class s extends r{constructor(t){super("directus_activity",t),this._comments=new n(this.transport)}get comments(){return this._comments}}class i{constructor(t){this.transport=t}readOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/collections/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){const{data:t,meta:e}=yield this.transport.get("/collections");return{data:t,meta:e}}))}createOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/collections",t)).data}))}createMany(t){return e(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.post("/collections",t);return{data:e,meta:r}}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:n})).data}))}deleteOne(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/collections/${t}`)}))}}class o{constructor(t){this.transport=t}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}/${r}`)).data}))}readMany(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/fields")).data}))}createOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.post(`/fields/${t}`,r)).data}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,n)).data}))}deleteOne(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/fields/${t}/${r}`)}))}}class a extends r{constructor(t){super("directus_files",t)}}class u extends r{constructor(t){super("directus_folders",t)}}class d extends r{constructor(t){super("directus_permissions",t)}}class c extends r{constructor(t){super("directus_presets",t)}}class h{constructor(t){this.transport=t}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}/${r}`)).data}))}readMany(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/relations")).data}))}createOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/relations",t)).data}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:n})).data}))}deleteOne(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/relations/${t}/${r}`)}))}}class l extends r{constructor(t){super("directus_revisions",t)}}class p extends r{constructor(t){super("directus_roles",t)}}class f{constructor(t){this.transport=t}ping(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/ping")).raw}))}info(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/info")).data}))}}class v{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}read(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}`,{params:t})).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}`,t,{params:r})).data}))}}class m extends v{constructor(t){super("directus_settings",t)}}class g{constructor(t){this.transport=t}send(t,r,n){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:n})}))}accept(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite/accept",{token:t,password:r})}))}}class y{constructor(t){this.transport=t}generate(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/users/me/tfa/generate",{password:t})).data}))}enable(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/enable",{secret:t,otp:r})}))}disable(t){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/disable",{otp:t})}))}}class _{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new y(this._transport))}read(t){return e(this,void 0,void 0,(function*(){return(yield this._transport.get("/users/me",{params:t})).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this._transport.patch("/users/me",t,{params:r})).data}))}}class w extends r{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new g(this.transport))}get me(){return this._me||(this._me=new _(this.transport))}}class b{constructor(t){this.random={string:(t=32)=>e(this,void 0,void 0,(function*(){return(yield this.transport.get("/utils/random/string",{params:{length:t}})).data}))},this.hash={generate:t=>e(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/generate",{string:t})).data})),verify:(t,r)=>e(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/verify",{string:t,hash:r})).data}))},this.transport=t}sort(t,r,n){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:n})}))}revert(t){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var x;!function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(x||(x={}));class O{}class k{}class E extends Error{constructor(t,e){var r,n;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(n=null==e?void 0:e.errors[0])||void 0===n?void 0:n.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,E.prototype)}}class R extends O{constructor(t){var e;super(),this.prefix=null!==(e=null==t?void 0:t.prefix)&&void 0!==e?e:""}get auth_token(){return this.get("auth_token")}set auth_token(t){null===t?this.delete("auth_token"):this.set("auth_token",t)}get auth_expires(){const t=this.get("auth_expires");return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete("auth_expires"):this.set("auth_expires",t.toString())}get auth_refresh_token(){return this.get("auth_refresh_token")}set auth_refresh_token(t){null===t?this.delete("auth_refresh_token"):this.set("auth_refresh_token",t)}}class S extends R{constructor(){super(...arguments),this.values={}}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}class j extends R{get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}var T={exports:{}},$=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},q=$,U=Object.prototype.toString;function A(t){return"[object Array]"===U.call(t)}function C(t){return void 0===t}function N(t){return null!==t&&"object"==typeof t}function P(t){if("[object Object]"!==U.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function B(t){return"[object Function]"===U.call(t)}function L(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),A(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}var I={isArray:A,isArrayBuffer:function(t){return"[object ArrayBuffer]"===U.call(t)},isBuffer:function(t){return null!==t&&!C(t)&&null!==t.constructor&&!C(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:N,isPlainObject:P,isUndefined:C,isDate:function(t){return"[object Date]"===U.call(t)},isFile:function(t){return"[object File]"===U.call(t)},isBlob:function(t){return"[object Blob]"===U.call(t)},isFunction:B,isStream:function(t){return N(t)&&B(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:L,merge:function t(){var e={};function r(r,n){P(e[n])&&P(r)?e[n]=t(e[n],r):P(r)?e[n]=t({},r):A(r)?e[n]=r.slice():e[n]=r}for(var n=0,s=arguments.length;n<s;n++)L(arguments[n],r);return e},extend:function(t,e,r){return L(e,(function(e,n){t[n]=r&&"function"==typeof e?q(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},D=I;function M(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var J=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if(D.isURLSearchParams(e))n=e.toString();else{var s=[];D.forEach(e,(function(t,e){null!=t&&(D.isArray(t)?e+="[]":t=[t],D.forEach(t,(function(t){D.isDate(t)?t=t.toISOString():D.isObject(t)&&(t=JSON.stringify(t)),s.push(M(e)+"="+M(t))})))})),n=s.join("&")}if(n){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},F=I;function z(){this.handlers=[]}z.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},z.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},z.prototype.forEach=function(t){F.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var H=z,W=I,V=function(t,e,r,n,s){return t.config=e,r&&(t.code=r),t.request=n,t.response=s,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},X=V,K=function(t,e,r,n,s){var i=new Error(t);return X(i,e,r,n,s)},G=K,Q=I,Y=Q.isStandardBrowserEnv()?{write:function(t,e,r,n,s,i){var o=[];o.push(t+"="+encodeURIComponent(e)),Q.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Q.isString(n)&&o.push("path="+n),Q.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Z=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},tt=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},et=I,rt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],nt=I,st=nt.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=n(window.location.href),function(e){var r=nt.isString(e)?n(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0};function it(t){this.message=t}it.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},it.prototype.__CANCEL__=!0;var ot=it,at=I,ut=function(t,e,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(G("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},dt=Y,ct=J,ht=function(t,e){return t&&!Z(e)?tt(t,e):e},lt=function(t){var e,r,n,s={};return t?(et.forEach(t.split("\n"),(function(t){if(n=t.indexOf(":"),e=et.trim(t.substr(0,n)).toLowerCase(),r=et.trim(t.substr(n+1)),e){if(s[e]&&rt.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s},pt=st,ft=K,vt=Et,mt=ot,gt=function(t){return new Promise((function(e,r){var n,s=t.data,i=t.headers,o=t.responseType;function a(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}at.isFormData(s)&&delete i["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",c=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+c)}var h=ht(t.baseURL,t.url);function l(){if(u){var n="getAllResponseHeaders"in u?lt(u.getAllResponseHeaders()):null,s={data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u};ut((function(t){e(t),a()}),(function(t){r(t),a()}),s),u=null}}if(u.open(t.method.toUpperCase(),ct(h,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(r(ft("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(ft("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||vt.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(ft(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},at.isStandardBrowserEnv()){var p=(t.withCredentials||pt(h))&&t.xsrfCookieName?dt.read(t.xsrfCookieName):void 0;p&&(i[t.xsrfHeaderName]=p)}"setRequestHeader"in u&&at.forEach(i,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete i[e]:u.setRequestHeader(e,t)})),at.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),o&&"json"!==o&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){u&&(r(!t||t&&t.type?new mt("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),s||(s=null),u.send(s)}))},yt=I,_t=function(t,e){W.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))},wt=V,bt={"Content-Type":"application/x-www-form-urlencoded"};function xt(t,e){!yt.isUndefined(t)&&yt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var Ot,kt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(Ot=gt),Ot),transformRequest:[function(t,e){return _t(e,"Accept"),_t(e,"Content-Type"),yt.isFormData(t)||yt.isArrayBuffer(t)||yt.isBuffer(t)||yt.isStream(t)||yt.isFile(t)||yt.isBlob(t)?t:yt.isArrayBufferView(t)?t.buffer:yt.isURLSearchParams(t)?(xt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):yt.isObject(t)||e&&"application/json"===e["Content-Type"]?(xt(e,"application/json"),function(t,e,r){if(yt.isString(t))try{return(e||JSON.parse)(t),yt.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||kt.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||n&&yt.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw wt(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};yt.forEach(["delete","get","head"],(function(t){kt.headers[t]={}})),yt.forEach(["post","put","patch"],(function(t){kt.headers[t]=yt.merge(bt)}));var Et=kt,Rt=I,St=Et,jt=function(t){return!(!t||!t.__CANCEL__)},Tt=I,$t=function(t,e,r){var n=this||St;return Rt.forEach(r,(function(r){t=r.call(n,t,e)})),t},qt=jt,Ut=Et,At=ot;function Ct(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new At("canceled")}var Nt=I,Pt=function(t,e){e=e||{};var r={};function n(t,e){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge(t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function s(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(t[r],e[r])}function i(t){if(!Nt.isUndefined(e[t]))return n(void 0,e[t])}function o(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(void 0,e[r])}function a(r){return r in e?n(t[r],e[r]):r in t?n(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return Nt.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||s,n=e(t);Nt.isUndefined(n)&&e!==a||(r[t]=n)})),r},Bt="0.24.0",Lt=Bt,It={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){It[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var Dt={};It.transitional=function(t,e,r){function n(t,e){return"[Axios v"+Lt+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,s,i){if(!1===t)throw new Error(n(s," has been removed"+(e?" in "+e:"")));return e&&!Dt[s]&&(Dt[s]=!0,console.warn(n(s," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,s,i)}};var Mt={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:It},Jt=I,Ft=J,zt=H,Ht=function(t){return Ct(t),t.headers=t.headers||{},t.data=$t.call(t,t.data,t.headers,t.transformRequest),t.headers=Tt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Tt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||Ut.adapter)(t).then((function(e){return Ct(t),e.data=$t.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return qt(e)||(Ct(t),e&&e.response&&(e.response.data=$t.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Wt=Pt,Vt=Mt,Xt=Vt.validators;function Kt(t){this.defaults=t,this.interceptors={request:new zt,response:new zt}}Kt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=Wt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&Vt.assertOptions(e,{silentJSONParsing:Xt.transitional(Xt.boolean),forcedJSONParsing:Xt.transitional(Xt.boolean),clarifyTimeoutError:Xt.transitional(Xt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!n){var o=[Ht,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{s=Ht(a)}catch(t){return Promise.reject(t)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},Kt.prototype.getUri=function(t){return t=Wt(this.defaults,t),Ft(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Jt.forEach(["delete","get","head","options"],(function(t){Kt.prototype[t]=function(e,r){return this.request(Wt(r||{},{method:t,url:e,data:(r||{}).data}))}})),Jt.forEach(["post","put","patch"],(function(t){Kt.prototype[t]=function(e,r,n){return this.request(Wt(n||{},{method:t,url:e,data:r}))}}));var Gt=Kt,Qt=ot;function Yt(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,n=r._listeners.length;for(e=0;e<n;e++)r._listeners[e](t);r._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t){r.reason||(r.reason=new Qt(t),e(r.reason))}))}Yt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Yt.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Yt.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Yt.source=function(){var t;return{token:new Yt((function(e){t=e})),cancel:t}};var Zt=Yt,te=I,ee=$,re=Gt,ne=Pt;var se=function t(e){var r=new re(e),n=ee(re.prototype.request,r);return te.extend(n,re.prototype,r),te.extend(n,r),n.create=function(r){return t(ne(e,r))},n}(Et);se.Axios=re,se.Cancel=ot,se.CancelToken=Zt,se.isCancel=jt,se.VERSION=Bt,se.all=function(t){return Promise.all(t)},se.spread=function(t){return function(e){return t.apply(null,e)}},se.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},T.exports=se,T.exports.default=se;var ie=T.exports;class oe extends k{constructor(t){var e;super(),this.config=t,this.axios=ie.create({baseURL:this.config.url,params:this.config.params,headers:this.config.headers,onUploadProgress:this.config.onUploadProgress,withCredentials:!0}),(null===(e=this.config)||void 0===e?void 0:e.beforeRequest)&&(this.beforeRequest=this.config.beforeRequest)}beforeRequest(t){return t}get url(){return this.config.url}request(t,r,n,s){var i,o,a,u,d;return e(this,void 0,void 0,(function*(){try{let e={method:t,url:r,data:n,params:null==s?void 0:s.params,headers:null==s?void 0:s.headers,onUploadProgress:null==s?void 0:s.onUploadProgress};e=this.beforeRequest(e);const i=yield this.axios.request(e),o={raw:i.data,status:i.status,statusText:i.statusText,headers:i.headers,data:i.data.data,meta:i.data.meta,errors:i.data.errors};if(i.data.errors)throw new E(null,o);return o}catch(t){if(!t||t instanceof Error==!1)throw t;if(ie.isAxiosError(t)){const e=null===(i=t.response)||void 0===i?void 0:i.data;throw new E(t,{raw:null===(o=t.response)||void 0===o?void 0:o.data,status:null===(a=t.response)||void 0===a?void 0:a.status,statusText:null===(u=t.response)||void 0===u?void 0:u.statusText,headers:null===(d=t.response)||void 0===d?void 0:d.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new E(t)}}))}get(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("get",t,void 0,r)}))}head(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("head",t,void 0,r)}))}options(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("options",t,void 0,r)}))}delete(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,n)}))}put(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,n)}))}post(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,n)}))}patch(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,n)}))}}class ae{constructor(t){this.transport=t}request(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/request",{email:t,reset_url:r})}))}reset(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/reset",{token:t,password:r})}))}}class ue extends t{constructor(t){var e,r,n;super(),this.autoRefresh=!0,this.msRefreshBeforeExpires=3e4,this.staticToken="",this._transport=t.transport,this._storage=t.storage,this.autoRefresh=null!==(e=null==t?void 0:t.autoRefresh)&&void 0!==e?e:this.autoRefresh,this.mode=null!==(r=null==t?void 0:t.mode)&&void 0!==r?r:this.mode,this.msRefreshBeforeExpires=null!==(n=null==t?void 0:t.msRefreshBeforeExpires)&&void 0!==n?n:this.msRefreshBeforeExpires,(null==t?void 0:t.staticToken)&&(this.staticToken=null==t?void 0:t.staticToken,this.updateStorage({access_token:this.staticToken,expires:null,refresh_token:null})),this.timer=!1}get storage(){return this._storage}get transport(){return this._transport}get token(){return this._storage.auth_token}get password(){return this.passwords=this.passwords||new ae(this._transport)}updateStorage(t){var e,r;this._storage.auth_token=t.access_token,this._storage.auth_refresh_token=null!==(e=t.refresh_token)&&void 0!==e?e:null,this._storage.auth_expires=null!==(r=t.expires)&&void 0!==r?r:null}autoRefreshJob(){if(!this.autoRefresh)return;if(!this._storage.auth_expires)return;const t=this._storage.auth_expires-this.msRefreshBeforeExpires;this.timer=setTimeout((()=>e(this,void 0,void 0,(function*(){yield this.refresh().catch((()=>{})),this.autoRefreshJob()}))),t)}refresh(){var t;return e(this,void 0,void 0,(function*(){const e=yield this._transport.post("/auth/refresh",{refresh_token:"json"===this.mode?this._storage.auth_refresh_token:void 0});return this.updateStorage(e.data),{access_token:e.data.access_token,refresh_token:null===(t=e.data)||void 0===t?void 0:t.refresh_token,expires:e.data.expires}}))}login(t){var r;return e(this,void 0,void 0,(function*(){const e=yield this._transport.post("/auth/login",Object.assign({mode:this.mode},t),{headers:{Authorization:null}});return this.updateStorage(e.data),this.autoRefresh&&this.autoRefreshJob(),{access_token:e.data.access_token,refresh_token:null===(r=e.data)||void 0===r?void 0:r.refresh_token,expires:e.data.expires}}))}static(t){return e(this,void 0,void 0,(function*(){return yield this._transport.get("/users/me",{params:{access_token:t},headers:{Authorization:null}}),this.updateStorage({access_token:t,expires:null,refresh_token:null}),!0}))}logout(){return e(this,void 0,void 0,(function*(){let t;"json"===this.mode&&(t=this._storage.auth_refresh_token||void 0),yield this._transport.post("/auth/logout",{refresh_token:t}),this.updateStorage({access_token:null,expires:null,refresh_token:null}),clearTimeout(this.timer)}))}}class de{constructor(t){this.transport=t}request(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===n?{}:n})}))}items(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("/graphql",t,r)}))}system(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("/graphql/system",t,r)}))}}class ce{constructor(e,r){var n,s,i,o,a,u,d,c;if(this._url=e,this._options=r,this._items={},this._singletons={},(null===(n=this._options)||void 0===n?void 0:n.storage)&&(null===(s=this._options)||void 0===s?void 0:s.storage)instanceof O)this._storage=this._options.storage;else{const t=null===(i=this._options)||void 0===i?void 0:i.storage,e=null!=t?t:{},{mode:r}=e,n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]])}return r}(e,["mode"]);"MemoryStorage"===r||"undefined"==typeof window?this._storage=new S(n):this._storage=new j(n)}(null===(o=this._options)||void 0===o?void 0:o.transport)&&(null===(a=this._options)||void 0===a?void 0:a.transport)instanceof k?this._transport=this._options.transport:this._transport=new oe({url:this.url,beforeRequest:t=>{const e=this.storage.auth_token,r=e?e.startsWith("Bearer ")?String(this.storage.auth_token):`Bearer ${this.storage.auth_token}`:"";return Object.assign(Object.assign({},t),{headers:Object.assign({Authorization:r},t.headers)})}}),(null===(u=this._options)||void 0===u?void 0:u.auth)&&(null===(d=this._options)||void 0===d?void 0:d.auth)instanceof t?this._auth=this._options.auth:this._auth=new ue(Object.assign({transport:this._transport,storage:this._storage},null===(c=this._options)||void 0===c?void 0:c.auth))}get url(){return this._url}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new s(this.transport))}get collections(){return this._collections||(this._collections=new i(this.transport))}get fields(){return this._fields||(this._fields=new o(this.transport))}get files(){return this._files||(this._files=new a(this.transport))}get folders(){return this._folders||(this._folders=new u(this.transport))}get permissions(){return this._permissions||(this._permissions=new d(this.transport))}get presets(){return this._presets||(this._presets=new c(this.transport))}get relations(){return this._relations||(this._relations=new h(this.transport))}get revisions(){return this._revisions||(this._revisions=new l(this.transport))}get roles(){return this._roles||(this._roles=new p(this.transport))}get users(){return this._users||(this._users=new w(this.transport))}get settings(){return this._settings||(this._settings=new m(this.transport))}get server(){return this._server||(this._server=new f(this.transport))}get utils(){return this._utils||(this._utils=new b(this.transport))}get graphql(){return this._graphql||(this._graphql=new de(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new v(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new r(t,this.transport))}}export{s as ActivityHandler,ue as Auth,R as BaseStorage,i as CollectionsHandler,n as CommentsHandler,ce as Directus,o as FieldsHandler,a as FilesHandler,u as FoldersHandler,t as IAuth,O as IStorage,k as ITransport,r as ItemsHandler,j as LocalStorage,S as MemoryStorage,x as Meta,d as PermissionsHandler,c as PresetsHandler,h as RelationsHandler,l as RevisionsHandler,p as RolesHandler,f as ServerHandler,m as SettingsHandler,oe as Transport,E as TransportError,w as UsersHandler,b as UtilsHandler}; | ||
//# sourceMappingURL=sdk.esm.min.js.map |
@@ -1,16 +0,16 @@ | ||
var Directus=function(t){"use strict"; | ||
var Directus=function(t){"use strict";class e{constructor(){this.mode="undefined"==typeof window?"json":"cookie"}} | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function e(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((n=n.apply(t,e||[])).next())}))}class r{constructor(t,e){this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}/${encodeURI(t)}`,{params:r})).data}))}readMany(t){return e(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.get(`${this.endpoint}`,{params:t});return{data:e,meta:r}}))}createOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.post(`${this.endpoint}`,t,{params:r})).data}))}createMany(t,r){return e(this,void 0,void 0,(function*(){return yield this.transport.post(`${this.endpoint}`,t,{params:r})}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:n})).data}))}updateMany(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:n})}))}updateByQuery(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:n})}))}deleteOne(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}/${encodeURI(t)}`)}))}deleteMany(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}`,t)}))}}class n{constructor(t){this.transport=t}create(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/activity/comment",t)).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/activity/comment/${encodeURI(t)}`,{comment:r})).data}))}delete(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/activity/comment/${encodeURI(t)}`)}))}}class s extends r{constructor(t){super("directus_activity",t),this._comments=new n(this.transport)}get comments(){return this._comments}}class i{constructor(t){this.transport=t}readOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/collections/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){const{data:t,meta:e}=yield this.transport.get("/collections");return{data:t,meta:e}}))}createOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/collections",t)).data}))}createMany(t){return e(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.post("/collections",t);return{data:e,meta:r}}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:n})).data}))}deleteOne(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/collections/${t}`)}))}}class o{constructor(t){this.transport=t}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}/${r}`)).data}))}readMany(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/fields")).data}))}createOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.post(`/fields/${t}`,r)).data}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,n)).data}))}deleteOne(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/fields/${t}/${r}`)}))}}class a extends r{constructor(t){super("directus_files",t)}}class u extends r{constructor(t){super("directus_folders",t)}}class d extends r{constructor(t){super("directus_permissions",t)}}class h extends r{constructor(t){super("directus_presets",t)}}class c{constructor(t){this.transport=t}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}/${r}`)).data}))}readMany(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/relations")).data}))}createOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/relations",t)).data}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:n})).data}))}deleteOne(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/relations/${t}/${r}`)}))}}class l extends r{constructor(t){super("directus_revisions",t)}}class p extends r{constructor(t){super("directus_roles",t)}}class f{constructor(t){this.transport=t}ping(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/ping")).raw}))}info(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/info")).data}))}}class v{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}read(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}`,{params:t})).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}`,t,{params:r})).data}))}}class m extends v{constructor(t){super("directus_settings",t)}}class g{constructor(t){this.transport=t}send(t,r,n){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:n})}))}accept(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite/accept",{token:t,password:r})}))}}class y{constructor(t){this.transport=t}generate(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/users/me/tfa/generate",{password:t})).data}))}enable(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/enable",{secret:t,otp:r})}))}disable(t){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/disable",{otp:t})}))}}class _{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new y(this._transport))}read(t){return e(this,void 0,void 0,(function*(){return(yield this._transport.get("/users/me",{params:t})).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this._transport.patch("/users/me",t,{params:r})).data}))}}class w extends r{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new g(this.transport))}get me(){return this._me||(this._me=new _(this.transport))}}class b{constructor(t){this.random={string:(t=32)=>e(this,void 0,void 0,(function*(){return(yield this.transport.get("/utils/random/string",{params:{length:t}})).data}))},this.hash={generate:t=>e(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/generate",{string:t})).data})),verify:(t,r)=>e(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/verify",{string:t,hash:r})).data}))},this.transport=t}sort(t,r,n){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:n})}))}revert(t){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var x;t.Meta=void 0,(x=t.Meta||(t.Meta={})).TOTAL_COUNT="total_count",x.FILTER_COUNT="filter_count";class k extends Error{constructor(t,e){var r,n;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(n=null==e?void 0:e.errors[0])||void 0===n?void 0:n.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,k.prototype)}}class O{get auth_token(){return this.get("auth_token")}set auth_token(t){null===t?this.delete("auth_token"):this.set("auth_token",t)}get auth_expires(){const t=this.get("auth_expires");return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete("auth_expires"):this.set("auth_expires",t.toString())}get auth_refresh_token(){return this.get("auth_refresh_token")}set auth_refresh_token(t){null===t?this.delete("auth_refresh_token"):this.set("auth_refresh_token",t)}}class E extends O{constructor(t=""){super(),this.values={},this.prefix=t}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}class S extends O{constructor(t=""){super(),this.prefix=t}get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}var T={exports:{}},j=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},R=j,A=Object.prototype.toString;function U(t){return"[object Array]"===A.call(t)}function $(t){return void 0===t}function N(t){return null!==t&&"object"==typeof t}function C(t){if("[object Object]"!==A.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function q(t){return"[object Function]"===A.call(t)}function P(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),U(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}var B={isArray:U,isArrayBuffer:function(t){return"[object ArrayBuffer]"===A.call(t)},isBuffer:function(t){return null!==t&&!$(t)&&null!==t.constructor&&!$(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:N,isPlainObject:C,isUndefined:$,isDate:function(t){return"[object Date]"===A.call(t)},isFile:function(t){return"[object File]"===A.call(t)},isBlob:function(t){return"[object Blob]"===A.call(t)},isFunction:q,isStream:function(t){return N(t)&&q(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:P,merge:function t(){var e={};function r(r,n){C(e[n])&&C(r)?e[n]=t(e[n],r):C(r)?e[n]=t({},r):U(r)?e[n]=r.slice():e[n]=r}for(var n=0,s=arguments.length;n<s;n++)P(arguments[n],r);return e},extend:function(t,e,r){return P(e,(function(e,n){t[n]=r&&"function"==typeof e?R(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},H=B;function L(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var I=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if(H.isURLSearchParams(e))n=e.toString();else{var s=[];H.forEach(e,(function(t,e){null!=t&&(H.isArray(t)?e+="[]":t=[t],H.forEach(t,(function(t){H.isDate(t)?t=t.toISOString():H.isObject(t)&&(t=JSON.stringify(t)),s.push(L(e)+"="+L(t))})))})),n=s.join("&")}if(n){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},D=B;function M(){this.handlers=[]}M.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},M.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},M.prototype.forEach=function(t){D.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var F=M,z=B,J=function(t,e,r,n,s){return t.config=e,r&&(t.code=r),t.request=n,t.response=s,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},W=J,V=function(t,e,r,n,s){var i=new Error(t);return W(i,e,r,n,s)},X=V,K=B,G=K.isStandardBrowserEnv()?{write:function(t,e,r,n,s,i){var o=[];o.push(t+"="+encodeURIComponent(e)),K.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),K.isString(n)&&o.push("path="+n),K.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Q=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},Y=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Z=B,tt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],et=B,rt=et.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=n(window.location.href),function(e){var r=et.isString(e)?n(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0};function nt(t){this.message=t}nt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},nt.prototype.__CANCEL__=!0;var st=nt,it=B,ot=function(t,e,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(X("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},at=G,ut=I,dt=function(t,e){return t&&!Q(e)?Y(t,e):e},ht=function(t){var e,r,n,s={};return t?(Z.forEach(t.split("\n"),(function(t){if(n=t.indexOf(":"),e=Z.trim(t.substr(0,n)).toLowerCase(),r=Z.trim(t.substr(n+1)),e){if(s[e]&&tt.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s},ct=rt,lt=V,pt=kt,ft=st,vt=function(t){return new Promise((function(e,r){var n,s=t.data,i=t.headers,o=t.responseType;function a(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}it.isFormData(s)&&delete i["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",h=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+h)}var c=dt(t.baseURL,t.url);function l(){if(u){var n="getAllResponseHeaders"in u?ht(u.getAllResponseHeaders()):null,s={data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u};ot((function(t){e(t),a()}),(function(t){r(t),a()}),s),u=null}}if(u.open(t.method.toUpperCase(),ut(c,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(r(lt("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(lt("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||pt.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(lt(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},it.isStandardBrowserEnv()){var p=(t.withCredentials||ct(c))&&t.xsrfCookieName?at.read(t.xsrfCookieName):void 0;p&&(i[t.xsrfHeaderName]=p)}"setRequestHeader"in u&&it.forEach(i,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete i[e]:u.setRequestHeader(e,t)})),it.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),o&&"json"!==o&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){u&&(r(!t||t&&t.type?new ft("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),s||(s=null),u.send(s)}))},mt=B,gt=function(t,e){z.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))},yt=J,_t={"Content-Type":"application/x-www-form-urlencoded"};function wt(t,e){!mt.isUndefined(t)&&mt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var bt,xt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(bt=vt),bt),transformRequest:[function(t,e){return gt(e,"Accept"),gt(e,"Content-Type"),mt.isFormData(t)||mt.isArrayBuffer(t)||mt.isBuffer(t)||mt.isStream(t)||mt.isFile(t)||mt.isBlob(t)?t:mt.isArrayBufferView(t)?t.buffer:mt.isURLSearchParams(t)?(wt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):mt.isObject(t)||e&&"application/json"===e["Content-Type"]?(wt(e,"application/json"),function(t,e,r){if(mt.isString(t))try{return(e||JSON.parse)(t),mt.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||xt.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||n&&mt.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw yt(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};mt.forEach(["delete","get","head"],(function(t){xt.headers[t]={}})),mt.forEach(["post","put","patch"],(function(t){xt.headers[t]=mt.merge(_t)}));var kt=xt,Ot=B,Et=kt,St=function(t){return!(!t||!t.__CANCEL__)},Tt=B,jt=function(t,e,r){var n=this||Et;return Ot.forEach(r,(function(r){t=r.call(n,t,e)})),t},Rt=St,At=kt,Ut=st;function $t(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ut("canceled")}var Nt=B,Ct=function(t,e){e=e||{};var r={};function n(t,e){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge(t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function s(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(t[r],e[r])}function i(t){if(!Nt.isUndefined(e[t]))return n(void 0,e[t])}function o(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(void 0,e[r])}function a(r){return r in e?n(t[r],e[r]):r in t?n(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return Nt.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||s,n=e(t);Nt.isUndefined(n)&&e!==a||(r[t]=n)})),r},qt="0.24.0",Pt=qt,Bt={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Bt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var Ht={};Bt.transitional=function(t,e,r){function n(t,e){return"[Axios v"+Pt+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,s,i){if(!1===t)throw new Error(n(s," has been removed"+(e?" in "+e:"")));return e&&!Ht[s]&&(Ht[s]=!0,console.warn(n(s," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,s,i)}};var Lt={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:Bt},It=B,Dt=I,Mt=F,Ft=function(t){return $t(t),t.headers=t.headers||{},t.data=jt.call(t,t.data,t.headers,t.transformRequest),t.headers=Tt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Tt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||At.adapter)(t).then((function(e){return $t(t),e.data=jt.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return Rt(e)||($t(t),e&&e.response&&(e.response.data=jt.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},zt=Ct,Jt=Lt,Wt=Jt.validators;function Vt(t){this.defaults=t,this.interceptors={request:new Mt,response:new Mt}}Vt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=zt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&Jt.assertOptions(e,{silentJSONParsing:Wt.transitional(Wt.boolean),forcedJSONParsing:Wt.transitional(Wt.boolean),clarifyTimeoutError:Wt.transitional(Wt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!n){var o=[Ft,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{s=Ft(a)}catch(t){return Promise.reject(t)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},Vt.prototype.getUri=function(t){return t=zt(this.defaults,t),Dt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},It.forEach(["delete","get","head","options"],(function(t){Vt.prototype[t]=function(e,r){return this.request(zt(r||{},{method:t,url:e,data:(r||{}).data}))}})),It.forEach(["post","put","patch"],(function(t){Vt.prototype[t]=function(e,r,n){return this.request(zt(n||{},{method:t,url:e,data:r}))}}));var Xt=Vt,Kt=st;function Gt(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,n=r._listeners.length;for(e=0;e<n;e++)r._listeners[e](t);r._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t){r.reason||(r.reason=new Kt(t),e(r.reason))}))}Gt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Gt.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Gt.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Gt.source=function(){var t;return{token:new Gt((function(e){t=e})),cancel:t}};var Qt=Gt,Yt=B,Zt=j,te=Xt,ee=Ct;var re=function t(e){var r=new te(e),n=Zt(te.prototype.request,r);return Yt.extend(n,te.prototype,r),Yt.extend(n,r),n.create=function(r){return t(ee(e,r))},n}(kt);re.Axios=te,re.Cancel=st,re.CancelToken=Qt,re.isCancel=St,re.VERSION=qt,re.all=function(t){return Promise.all(t)},re.spread=function(t){return function(e){return t.apply(null,e)}},re.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},T.exports=re,T.exports.default=re;var ne=T.exports;class se{constructor(t,e,r=(()=>Promise.resolve())){this._url=t,this._storage=e,this._axios=null,this._refresh=r,this.url=t}get url(){return this._url}set url(t){this._url=t,this._axios=ne.create({baseURL:t,withCredentials:!0})}get axios(){return this._axios}get requests(){return{intercept:(t,e)=>{const r=this._axios.interceptors.request.use(t,e);return{eject:()=>{this._axios.interceptors.request.eject(r)}}}}}get responses(){return{intercept:(t,e)=>{const r=this._axios.interceptors.response.use(t,e);return{eject:()=>{this._axios.interceptors.response.eject(r)}}}}}request(t,r,n,s){var i,o,a,u,d,h,c,l,p;return e(this,void 0,void 0,(function*(){try{(s=s||{}).sendAuthorizationHeaders=null===(i=s.sendAuthorizationHeaders)||void 0===i||i,s.refreshTokenIfNeeded=null===(o=s.refreshTokenIfNeeded)||void 0===o||o,s.headers=null!==(a=s.headers)&&void 0!==a?a:{},s.onUploadProgress=null!==(u=s.onUploadProgress)&&void 0!==u?u:void 0,s.refreshTokenIfNeeded&&(yield this._refresh());const e={method:t,url:r,data:n,params:s.params,headers:s.headers,onUploadProgress:s.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;s.sendAuthorizationHeaders&&d&&(null!==h&&h>Date.now()||null===h)&&(d.startsWith("Bearer ")?e.headers.Authorization=d:e.headers.Authorization=`Bearer ${d}`);const c=yield this.axios.request(e),l=c.data,p={raw:c.data,status:c.status,statusText:c.statusText,headers:c.headers,data:l.data,meta:l.meta,errors:l.errors};if(l.errors)throw new k(null,p);return p}catch(t){if(!t||t instanceof Error==!1)throw t;if(ne.isAxiosError(t)){const e=null===(d=t.response)||void 0===d?void 0:d.data;throw new k(t,{raw:null===(h=t.response)||void 0===h?void 0:h.data,status:null===(c=t.response)||void 0===c?void 0:c.status,statusText:null===(l=t.response)||void 0===l?void 0:l.statusText,headers:null===(p=t.response)||void 0===p?void 0:p.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new k(t)}}))}get(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("get",t,void 0,r)}))}head(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("head",t,void 0,r)}))}options(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("options",t,void 0,r)}))}delete(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,n)}))}put(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,n)}))}post(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,n)}))}patch(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,n)}))}}class ie{constructor(t){this.transport=t}request(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/request",{email:t,reset_url:r})}))}reset(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/reset",{token:t,password:r})}))}}class oe{constructor(t){this.func=t,this.debounced=[],this.debouncing=!1}debounce(...t){return e(this,void 0,void 0,(function*(){return this.debouncing?yield new Promise(((t,e)=>{this.debounced.push({resolve:e=>t(e),reject:t=>e(t)})})):(this.debouncing=!0,new Promise(((e,r)=>{this.func(...t).then((t=>{const n=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,n.forEach((e=>e.resolve(t)))})).catch((t=>{const n=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,n.forEach((e=>e.reject(t)))}))})))}))}}class ae{constructor(t,e,r){var n,s,i,o,a;this.options=r||{},this.options.mode=(null==r?void 0:r.mode)||("undefined"!=typeof window?"cookie":"json"),this.options.refresh=(null==r?void 0:r.refresh)||{auto:!1,time:3e4},this.options.refresh.auto=null!==(s=null===(n=this.options.refresh)||void 0===n?void 0:n.auto)&&void 0!==s&&s,this.options.refresh.time=null!==(o=null===(i=this.options.refresh)||void 0===i?void 0:i.time)&&void 0!==o?o:3e4,this.transport=t,this.storage=e,this.timer=!1,this.refresher=new oe(this.refreshToken.bind(this));try{this.updateRefresh(null===(a=this.options)||void 0===a?void 0:a.refresh)}catch(t){}}get token(){return this.storage.auth_token}get password(){return this.passwords=this.passwords||new ie(this.transport)}get expiring(){var t,e;const r=this.storage.auth_expires;if(null===r)return!1;return r-(null!==(e=null===(t=this.options.refresh)||void 0===t?void 0:t.time)&&void 0!==e?e:0)<=Date.now()}refreshToken(t=!1){var r;return e(this,void 0,void 0,(function*(){if(!t&&!this.expiring)return!1;const e=yield this.transport.post("/auth/refresh",{refresh_token:"json"===this.options.mode?this.storage.auth_refresh_token:void 0},{refreshTokenIfNeeded:!1});return this.updateStorage(e.data),this.updateRefresh(),{access_token:e.data.access_token,refresh_token:null===(r=e.data)||void 0===r?void 0:r.refresh_token,expires:e.data.expires}}))}updateStorage(t){var e;this.storage.auth_token=t.access_token,this.storage.auth_refresh_token=null!==(e=t.refresh_token)&&void 0!==e?e:null,t.expires?this.storage.auth_expires=Date.now()+t.expires:this.storage.auth_expires=null}updateRefresh(t){var e,r;const n=this.storage.auth_expires;if(null===n)return void clearTimeout(this.timer);t&&(this.options.refresh.auto=null!==(e=t.auto)&&void 0!==e?e:this.options.refresh.auto,this.options.refresh.time=null!==(r=t.time)&&void 0!==r?r:this.options.refresh.time),clearTimeout(this.timer);let s=n-this.options.refresh.time-Date.now();if(s<0){if(n<Date.now())return;s=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),s))}refresh(t=!1){return e(this,void 0,void 0,(function*(){return yield this.refresher.debounce(t)}))}login(t,r){var n;return e(this,void 0,void 0,(function*(){r=r||{};const e=yield this.transport.post("/auth/login",Object.assign({mode:this.options.mode},t),{refreshTokenIfNeeded:!1,sendAuthorizationHeaders:!1});return this.updateStorage(e.data),this.updateRefresh(r.refresh),{access_token:e.data.access_token,refresh_token:null===(n=e.data)||void 0===n?void 0:n.refresh_token,expires:e.data.expires}}))}static(t){return e(this,void 0,void 0,(function*(){return yield this.transport.get("/users/me",{params:{access_token:t}}),this.storage.auth_token=t,this.storage.auth_expires=null,this.storage.auth_refresh_token=null,!0}))}logout(){return e(this,void 0,void 0,(function*(){let t;"json"===this.options.mode&&(t=this.storage.auth_refresh_token||void 0),yield this.transport.post("/auth/logout",{refresh_token:t},{refreshTokenIfNeeded:!1}),this.storage.auth_token=null,this.storage.auth_expires=null,this.storage.auth_refresh_token=null,clearTimeout(this.timer)}))}}class ue{constructor(t){this.transport=t}request(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===n?{}:n})}))}items(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("/graphql",t,r)}))}system(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("/graphql/system",t,r)}))}}return t.ActivityHandler=s,t.Auth=ae,t.AxiosTransport=se,t.BaseStorage=O,t.CollectionsHandler=i,t.CommentsHandler=n,t.Directus=class{constructor(t,r){this._storage=(null==r?void 0:r.storage)||("undefined"!=typeof window?new S:new E),this._transport=(null==r?void 0:r.transport)||new se(t,this._storage,(()=>e(this,void 0,void 0,(function*(){yield this._auth.refresh()})))),this._auth=(null==r?void 0:r.auth)||new ae(this._transport,this._storage),this._items={},this._singletons={}}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new s(this.transport))}get collections(){return this._collections||(this._collections=new i(this.transport))}get fields(){return this._fields||(this._fields=new o(this.transport))}get files(){return this._files||(this._files=new a(this.transport))}get folders(){return this._folders||(this._folders=new u(this.transport))}get permissions(){return this._permissions||(this._permissions=new d(this.transport))}get presets(){return this._presets||(this._presets=new h(this.transport))}get relations(){return this._relations||(this._relations=new c(this.transport))}get revisions(){return this._revisions||(this._revisions=new l(this.transport))}get roles(){return this._roles||(this._roles=new p(this.transport))}get users(){return this._users||(this._users=new w(this.transport))}get settings(){return this._settings||(this._settings=new m(this.transport))}get server(){return this._server||(this._server=new f(this.transport))}get utils(){return this._utils||(this._utils=new b(this.transport))}get graphql(){return this._graphql||(this._graphql=new ue(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new v(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new r(t,this.transport))}},t.FieldsHandler=o,t.FilesHandler=a,t.FoldersHandler=u,t.ItemsHandler=r,t.LocalStorage=S,t.MemoryStorage=E,t.PermissionsHandler=d,t.PresetsHandler=h,t.RelationsHandler=c,t.RevisionsHandler=l,t.RolesHandler=p,t.ServerHandler=f,t.SettingsHandler=m,t.TransportError=k,t.UsersHandler=w,t.UtilsHandler=b,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function r(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((n=n.apply(t,e||[])).next())}))}class n{constructor(t,e){this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}readOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}/${encodeURI(t)}`,{params:e})).data}))}readMany(t){return r(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.get(`${this.endpoint}`,{params:t});return{data:e,meta:r}}))}createOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.post(`${this.endpoint}`,t,{params:e})).data}))}createMany(t,e){return r(this,void 0,void 0,(function*(){return yield this.transport.post(`${this.endpoint}`,t,{params:e})}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,e,{params:n})).data}))}updateMany(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:e},{params:n})}))}updateByQuery(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:e},{params:n})}))}deleteOne(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}/${encodeURI(t)}`)}))}deleteMany(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}`,t)}))}}class s{constructor(t){this.transport=t}create(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/activity/comment",t)).data}))}update(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/activity/comment/${encodeURI(t)}`,{comment:e})).data}))}delete(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/activity/comment/${encodeURI(t)}`)}))}}class i extends n{constructor(t){super("directus_activity",t),this._comments=new s(this.transport)}get comments(){return this._comments}}class o{constructor(t){this.transport=t}readOne(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/collections/${t}`)).data}))}readAll(){return r(this,void 0,void 0,(function*(){const{data:t,meta:e}=yield this.transport.get("/collections");return{data:t,meta:e}}))}createOne(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/collections",t)).data}))}createMany(t){return r(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.post("/collections",t);return{data:e,meta:r}}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,e,{params:n})).data}))}deleteOne(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/collections/${t}`)}))}}class a{constructor(t){this.transport=t}readOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}/${e}`)).data}))}readMany(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}`)).data}))}readAll(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/fields")).data}))}createOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.post(`/fields/${t}`,e)).data}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${e}`,n)).data}))}deleteOne(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/fields/${t}/${e}`)}))}}class u extends n{constructor(t){super("directus_files",t)}}class d extends n{constructor(t){super("directus_folders",t)}}class c extends n{constructor(t){super("directus_permissions",t)}}class h extends n{constructor(t){super("directus_presets",t)}}class l{constructor(t){this.transport=t}readOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}/${e}`)).data}))}readMany(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}`)).data}))}readAll(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/relations")).data}))}createOne(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/relations",t)).data}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${e}`,{params:n})).data}))}deleteOne(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/relations/${t}/${e}`)}))}}class p extends n{constructor(t){super("directus_revisions",t)}}class f extends n{constructor(t){super("directus_roles",t)}}class v{constructor(t){this.transport=t}ping(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/ping")).raw}))}info(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/info")).data}))}}class m{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}read(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}`,{params:t})).data}))}update(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}`,t,{params:e})).data}))}}class g extends m{constructor(t){super("directus_settings",t)}}class y{constructor(t){this.transport=t}send(t,e,n){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:e,invite_url:n})}))}accept(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite/accept",{token:t,password:e})}))}}class _{constructor(t){this.transport=t}generate(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/users/me/tfa/generate",{password:t})).data}))}enable(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/enable",{secret:t,otp:e})}))}disable(t){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/disable",{otp:t})}))}}class w{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new _(this._transport))}read(t){return r(this,void 0,void 0,(function*(){return(yield this._transport.get("/users/me",{params:t})).data}))}update(t,e){return r(this,void 0,void 0,(function*(){return(yield this._transport.patch("/users/me",t,{params:e})).data}))}}class b extends n{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new y(this.transport))}get me(){return this._me||(this._me=new w(this.transport))}}class x{constructor(t){this.random={string:(t=32)=>r(this,void 0,void 0,(function*(){return(yield this.transport.get("/utils/random/string",{params:{length:t}})).data}))},this.hash={generate:t=>r(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/generate",{string:t})).data})),verify:(t,e)=>r(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/verify",{string:t,hash:e})).data}))},this.transport=t}sort(t,e,n){return r(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:e,to:n})}))}revert(t){return r(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var O;t.Meta=void 0,(O=t.Meta||(t.Meta={})).TOTAL_COUNT="total_count",O.FILTER_COUNT="filter_count";class k{}class S{}class E extends Error{constructor(t,e){var r,n;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(n=null==e?void 0:e.errors[0])||void 0===n?void 0:n.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,E.prototype)}}class R extends k{constructor(t){var e;super(),this.prefix=null!==(e=null==t?void 0:t.prefix)&&void 0!==e?e:""}get auth_token(){return this.get("auth_token")}set auth_token(t){null===t?this.delete("auth_token"):this.set("auth_token",t)}get auth_expires(){const t=this.get("auth_expires");return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete("auth_expires"):this.set("auth_expires",t.toString())}get auth_refresh_token(){return this.get("auth_refresh_token")}set auth_refresh_token(t){null===t?this.delete("auth_refresh_token"):this.set("auth_refresh_token",t)}}class j extends R{constructor(){super(...arguments),this.values={}}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}class T extends R{get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}var A={exports:{}},U=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},$=U,q=Object.prototype.toString;function C(t){return"[object Array]"===q.call(t)}function P(t){return void 0===t}function N(t){return null!==t&&"object"==typeof t}function B(t){if("[object Object]"!==q.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function L(t){return"[object Function]"===q.call(t)}function I(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),C(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}var H={isArray:C,isArrayBuffer:function(t){return"[object ArrayBuffer]"===q.call(t)},isBuffer:function(t){return null!==t&&!P(t)&&null!==t.constructor&&!P(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:N,isPlainObject:B,isUndefined:P,isDate:function(t){return"[object Date]"===q.call(t)},isFile:function(t){return"[object File]"===q.call(t)},isBlob:function(t){return"[object Blob]"===q.call(t)},isFunction:L,isStream:function(t){return N(t)&&L(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:I,merge:function t(){var e={};function r(r,n){B(e[n])&&B(r)?e[n]=t(e[n],r):B(r)?e[n]=t({},r):C(r)?e[n]=r.slice():e[n]=r}for(var n=0,s=arguments.length;n<s;n++)I(arguments[n],r);return e},extend:function(t,e,r){return I(e,(function(e,n){t[n]=r&&"function"==typeof e?$(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},M=H;function D(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var F=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if(M.isURLSearchParams(e))n=e.toString();else{var s=[];M.forEach(e,(function(t,e){null!=t&&(M.isArray(t)?e+="[]":t=[t],M.forEach(t,(function(t){M.isDate(t)?t=t.toISOString():M.isObject(t)&&(t=JSON.stringify(t)),s.push(D(e)+"="+D(t))})))})),n=s.join("&")}if(n){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},J=H;function z(){this.handlers=[]}z.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},z.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},z.prototype.forEach=function(t){J.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var W=z,V=H,X=function(t,e,r,n,s){return t.config=e,r&&(t.code=r),t.request=n,t.response=s,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},K=X,G=function(t,e,r,n,s){var i=new Error(t);return K(i,e,r,n,s)},Q=G,Y=H,Z=Y.isStandardBrowserEnv()?{write:function(t,e,r,n,s,i){var o=[];o.push(t+"="+encodeURIComponent(e)),Y.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&o.push("path="+n),Y.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},tt=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},et=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},rt=H,nt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],st=H,it=st.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=n(window.location.href),function(e){var r=st.isString(e)?n(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0};function ot(t){this.message=t}ot.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},ot.prototype.__CANCEL__=!0;var at=ot,ut=H,dt=function(t,e,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(Q("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},ct=Z,ht=F,lt=function(t,e){return t&&!tt(e)?et(t,e):e},pt=function(t){var e,r,n,s={};return t?(rt.forEach(t.split("\n"),(function(t){if(n=t.indexOf(":"),e=rt.trim(t.substr(0,n)).toLowerCase(),r=rt.trim(t.substr(n+1)),e){if(s[e]&&nt.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s},ft=it,vt=G,mt=Et,gt=at,yt=function(t){return new Promise((function(e,r){var n,s=t.data,i=t.headers,o=t.responseType;function a(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}ut.isFormData(s)&&delete i["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",c=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+c)}var h=lt(t.baseURL,t.url);function l(){if(u){var n="getAllResponseHeaders"in u?pt(u.getAllResponseHeaders()):null,s={data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u};dt((function(t){e(t),a()}),(function(t){r(t),a()}),s),u=null}}if(u.open(t.method.toUpperCase(),ht(h,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(r(vt("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(vt("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||mt.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(vt(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},ut.isStandardBrowserEnv()){var p=(t.withCredentials||ft(h))&&t.xsrfCookieName?ct.read(t.xsrfCookieName):void 0;p&&(i[t.xsrfHeaderName]=p)}"setRequestHeader"in u&&ut.forEach(i,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete i[e]:u.setRequestHeader(e,t)})),ut.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),o&&"json"!==o&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){u&&(r(!t||t&&t.type?new gt("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),s||(s=null),u.send(s)}))},_t=H,wt=function(t,e){V.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))},bt=X,xt={"Content-Type":"application/x-www-form-urlencoded"};function Ot(t,e){!_t.isUndefined(t)&&_t.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var kt,St={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(kt=yt),kt),transformRequest:[function(t,e){return wt(e,"Accept"),wt(e,"Content-Type"),_t.isFormData(t)||_t.isArrayBuffer(t)||_t.isBuffer(t)||_t.isStream(t)||_t.isFile(t)||_t.isBlob(t)?t:_t.isArrayBufferView(t)?t.buffer:_t.isURLSearchParams(t)?(Ot(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):_t.isObject(t)||e&&"application/json"===e["Content-Type"]?(Ot(e,"application/json"),function(t,e,r){if(_t.isString(t))try{return(e||JSON.parse)(t),_t.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||St.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||n&&_t.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw bt(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};_t.forEach(["delete","get","head"],(function(t){St.headers[t]={}})),_t.forEach(["post","put","patch"],(function(t){St.headers[t]=_t.merge(xt)}));var Et=St,Rt=H,jt=Et,Tt=function(t){return!(!t||!t.__CANCEL__)},At=H,Ut=function(t,e,r){var n=this||jt;return Rt.forEach(r,(function(r){t=r.call(n,t,e)})),t},$t=Tt,qt=Et,Ct=at;function Pt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ct("canceled")}var Nt=H,Bt=function(t,e){e=e||{};var r={};function n(t,e){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge(t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function s(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(t[r],e[r])}function i(t){if(!Nt.isUndefined(e[t]))return n(void 0,e[t])}function o(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(void 0,e[r])}function a(r){return r in e?n(t[r],e[r]):r in t?n(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return Nt.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||s,n=e(t);Nt.isUndefined(n)&&e!==a||(r[t]=n)})),r},Lt="0.24.0",It=Lt,Ht={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Ht[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var Mt={};Ht.transitional=function(t,e,r){function n(t,e){return"[Axios v"+It+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,s,i){if(!1===t)throw new Error(n(s," has been removed"+(e?" in "+e:"")));return e&&!Mt[s]&&(Mt[s]=!0,console.warn(n(s," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,s,i)}};var Dt={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:Ht},Ft=H,Jt=F,zt=W,Wt=function(t){return Pt(t),t.headers=t.headers||{},t.data=Ut.call(t,t.data,t.headers,t.transformRequest),t.headers=At.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),At.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||qt.adapter)(t).then((function(e){return Pt(t),e.data=Ut.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return $t(e)||(Pt(t),e&&e.response&&(e.response.data=Ut.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Vt=Bt,Xt=Dt,Kt=Xt.validators;function Gt(t){this.defaults=t,this.interceptors={request:new zt,response:new zt}}Gt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=Vt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&Xt.assertOptions(e,{silentJSONParsing:Kt.transitional(Kt.boolean),forcedJSONParsing:Kt.transitional(Kt.boolean),clarifyTimeoutError:Kt.transitional(Kt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!n){var o=[Wt,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{s=Wt(a)}catch(t){return Promise.reject(t)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},Gt.prototype.getUri=function(t){return t=Vt(this.defaults,t),Jt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Ft.forEach(["delete","get","head","options"],(function(t){Gt.prototype[t]=function(e,r){return this.request(Vt(r||{},{method:t,url:e,data:(r||{}).data}))}})),Ft.forEach(["post","put","patch"],(function(t){Gt.prototype[t]=function(e,r,n){return this.request(Vt(n||{},{method:t,url:e,data:r}))}}));var Qt=Gt,Yt=at;function Zt(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,n=r._listeners.length;for(e=0;e<n;e++)r._listeners[e](t);r._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t){r.reason||(r.reason=new Yt(t),e(r.reason))}))}Zt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Zt.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Zt.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Zt.source=function(){var t;return{token:new Zt((function(e){t=e})),cancel:t}};var te=Zt,ee=H,re=U,ne=Qt,se=Bt;var ie=function t(e){var r=new ne(e),n=re(ne.prototype.request,r);return ee.extend(n,ne.prototype,r),ee.extend(n,r),n.create=function(r){return t(se(e,r))},n}(Et);ie.Axios=ne,ie.Cancel=at,ie.CancelToken=te,ie.isCancel=Tt,ie.VERSION=Lt,ie.all=function(t){return Promise.all(t)},ie.spread=function(t){return function(e){return t.apply(null,e)}},ie.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},A.exports=ie,A.exports.default=ie;var oe=A.exports;class ae extends S{constructor(t){var e;super(),this.config=t,this.axios=oe.create({baseURL:this.config.url,params:this.config.params,headers:this.config.headers,onUploadProgress:this.config.onUploadProgress,withCredentials:!0}),(null===(e=this.config)||void 0===e?void 0:e.beforeRequest)&&(this.beforeRequest=this.config.beforeRequest)}beforeRequest(t){return t}get url(){return this.config.url}request(t,e,n,s){var i,o,a,u,d;return r(this,void 0,void 0,(function*(){try{let r={method:t,url:e,data:n,params:null==s?void 0:s.params,headers:null==s?void 0:s.headers,onUploadProgress:null==s?void 0:s.onUploadProgress};r=this.beforeRequest(r);const i=yield this.axios.request(r),o={raw:i.data,status:i.status,statusText:i.statusText,headers:i.headers,data:i.data.data,meta:i.data.meta,errors:i.data.errors};if(i.data.errors)throw new E(null,o);return o}catch(t){if(!t||t instanceof Error==!1)throw t;if(oe.isAxiosError(t)){const e=null===(i=t.response)||void 0===i?void 0:i.data;throw new E(t,{raw:null===(o=t.response)||void 0===o?void 0:o.data,status:null===(a=t.response)||void 0===a?void 0:a.status,statusText:null===(u=t.response)||void 0===u?void 0:u.statusText,headers:null===(d=t.response)||void 0===d?void 0:d.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new E(t)}}))}get(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("get",t,void 0,e)}))}head(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("head",t,void 0,e)}))}options(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("options",t,void 0,e)}))}delete(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("delete",t,e,n)}))}put(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("put",t,e,n)}))}post(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("post",t,e,n)}))}patch(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("patch",t,e,n)}))}}class ue{constructor(t){this.transport=t}request(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/request",{email:t,reset_url:e})}))}reset(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/reset",{token:t,password:e})}))}}class de extends e{constructor(t){var e,r,n;super(),this.autoRefresh=!0,this.msRefreshBeforeExpires=3e4,this.staticToken="",this._transport=t.transport,this._storage=t.storage,this.autoRefresh=null!==(e=null==t?void 0:t.autoRefresh)&&void 0!==e?e:this.autoRefresh,this.mode=null!==(r=null==t?void 0:t.mode)&&void 0!==r?r:this.mode,this.msRefreshBeforeExpires=null!==(n=null==t?void 0:t.msRefreshBeforeExpires)&&void 0!==n?n:this.msRefreshBeforeExpires,(null==t?void 0:t.staticToken)&&(this.staticToken=null==t?void 0:t.staticToken,this.updateStorage({access_token:this.staticToken,expires:null,refresh_token:null})),this.timer=!1}get storage(){return this._storage}get transport(){return this._transport}get token(){return this._storage.auth_token}get password(){return this.passwords=this.passwords||new ue(this._transport)}updateStorage(t){var e,r;this._storage.auth_token=t.access_token,this._storage.auth_refresh_token=null!==(e=t.refresh_token)&&void 0!==e?e:null,this._storage.auth_expires=null!==(r=t.expires)&&void 0!==r?r:null}autoRefreshJob(){if(!this.autoRefresh)return;if(!this._storage.auth_expires)return;const t=this._storage.auth_expires-this.msRefreshBeforeExpires;this.timer=setTimeout((()=>r(this,void 0,void 0,(function*(){yield this.refresh().catch((()=>{})),this.autoRefreshJob()}))),t)}refresh(){var t;return r(this,void 0,void 0,(function*(){const e=yield this._transport.post("/auth/refresh",{refresh_token:"json"===this.mode?this._storage.auth_refresh_token:void 0});return this.updateStorage(e.data),{access_token:e.data.access_token,refresh_token:null===(t=e.data)||void 0===t?void 0:t.refresh_token,expires:e.data.expires}}))}login(t){var e;return r(this,void 0,void 0,(function*(){const r=yield this._transport.post("/auth/login",Object.assign({mode:this.mode},t),{headers:{Authorization:null}});return this.updateStorage(r.data),this.autoRefresh&&this.autoRefreshJob(),{access_token:r.data.access_token,refresh_token:null===(e=r.data)||void 0===e?void 0:e.refresh_token,expires:r.data.expires}}))}static(t){return r(this,void 0,void 0,(function*(){return yield this._transport.get("/users/me",{params:{access_token:t},headers:{Authorization:null}}),this.updateStorage({access_token:t,expires:null,refresh_token:null}),!0}))}logout(){return r(this,void 0,void 0,(function*(){let t;"json"===this.mode&&(t=this._storage.auth_refresh_token||void 0),yield this._transport.post("/auth/logout",{refresh_token:t}),this.updateStorage({access_token:null,expires:null,refresh_token:null}),clearTimeout(this.timer)}))}}class ce{constructor(t){this.transport=t}request(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:e,variables:void 0===n?{}:n})}))}items(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("/graphql",t,e)}))}system(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("/graphql/system",t,e)}))}}return t.ActivityHandler=i,t.Auth=de,t.BaseStorage=R,t.CollectionsHandler=o,t.CommentsHandler=s,t.Directus=class{constructor(t,r){var n,s,i,o,a,u,d,c;if(this._url=t,this._options=r,this._items={},this._singletons={},(null===(n=this._options)||void 0===n?void 0:n.storage)&&(null===(s=this._options)||void 0===s?void 0:s.storage)instanceof k)this._storage=this._options.storage;else{const t=null===(i=this._options)||void 0===i?void 0:i.storage,e=null!=t?t:{},{mode:r}=e,n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]])}return r}(e,["mode"]);"MemoryStorage"===r||"undefined"==typeof window?this._storage=new j(n):this._storage=new T(n)}(null===(o=this._options)||void 0===o?void 0:o.transport)&&(null===(a=this._options)||void 0===a?void 0:a.transport)instanceof S?this._transport=this._options.transport:this._transport=new ae({url:this.url,beforeRequest:t=>{const e=this.storage.auth_token,r=e?e.startsWith("Bearer ")?String(this.storage.auth_token):`Bearer ${this.storage.auth_token}`:"";return Object.assign(Object.assign({},t),{headers:Object.assign({Authorization:r},t.headers)})}}),(null===(u=this._options)||void 0===u?void 0:u.auth)&&(null===(d=this._options)||void 0===d?void 0:d.auth)instanceof e?this._auth=this._options.auth:this._auth=new de(Object.assign({transport:this._transport,storage:this._storage},null===(c=this._options)||void 0===c?void 0:c.auth))}get url(){return this._url}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new i(this.transport))}get collections(){return this._collections||(this._collections=new o(this.transport))}get fields(){return this._fields||(this._fields=new a(this.transport))}get files(){return this._files||(this._files=new u(this.transport))}get folders(){return this._folders||(this._folders=new d(this.transport))}get permissions(){return this._permissions||(this._permissions=new c(this.transport))}get presets(){return this._presets||(this._presets=new h(this.transport))}get relations(){return this._relations||(this._relations=new l(this.transport))}get revisions(){return this._revisions||(this._revisions=new p(this.transport))}get roles(){return this._roles||(this._roles=new f(this.transport))}get users(){return this._users||(this._users=new b(this.transport))}get settings(){return this._settings||(this._settings=new g(this.transport))}get server(){return this._server||(this._server=new v(this.transport))}get utils(){return this._utils||(this._utils=new x(this.transport))}get graphql(){return this._graphql||(this._graphql=new ce(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new m(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new n(t,this.transport))}},t.FieldsHandler=a,t.FilesHandler=u,t.FoldersHandler=d,t.IAuth=e,t.IStorage=k,t.ITransport=S,t.ItemsHandler=n,t.LocalStorage=T,t.MemoryStorage=j,t.PermissionsHandler=c,t.PresetsHandler=h,t.RelationsHandler=l,t.RevisionsHandler=p,t.RolesHandler=f,t.ServerHandler=v,t.SettingsHandler=g,t.Transport=ae,t.TransportError=E,t.UsersHandler=b,t.UtilsHandler=x,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); | ||
//# sourceMappingURL=sdk.iife.min.js.map |
@@ -1,17 +0,17 @@ | ||
System.register("Directus",[],(function(t){"use strict";return{execute:function(){ | ||
System.register("Directus",[],(function(t){"use strict";return{execute:function(){class e{constructor(){this.mode="undefined"==typeof window?"json":"cookie"}}function r(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((n=n.apply(t,e||[])).next())}))}t("IAuth",e);class n{constructor(t,e){this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}readOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}/${encodeURI(t)}`,{params:e})).data}))}readMany(t){return r(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.get(`${this.endpoint}`,{params:t});return{data:e,meta:r}}))}createOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.post(`${this.endpoint}`,t,{params:e})).data}))}createMany(t,e){return r(this,void 0,void 0,(function*(){return yield this.transport.post(`${this.endpoint}`,t,{params:e})}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,e,{params:n})).data}))}updateMany(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:e},{params:n})}))}updateByQuery(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:e},{params:n})}))}deleteOne(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}/${encodeURI(t)}`)}))}deleteMany(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}`,t)}))}}t("ItemsHandler",n);class s{constructor(t){this.transport=t}create(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/activity/comment",t)).data}))}update(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/activity/comment/${encodeURI(t)}`,{comment:e})).data}))}delete(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/activity/comment/${encodeURI(t)}`)}))}}t("CommentsHandler",s);class i extends n{constructor(t){super("directus_activity",t),this._comments=new s(this.transport)}get comments(){return this._comments}}t("ActivityHandler",i);class o{constructor(t){this.transport=t}readOne(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/collections/${t}`)).data}))}readAll(){return r(this,void 0,void 0,(function*(){const{data:t,meta:e}=yield this.transport.get("/collections");return{data:t,meta:e}}))}createOne(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/collections",t)).data}))}createMany(t){return r(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.post("/collections",t);return{data:e,meta:r}}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,e,{params:n})).data}))}deleteOne(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/collections/${t}`)}))}}t("CollectionsHandler",o);class a{constructor(t){this.transport=t}readOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}/${e}`)).data}))}readMany(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}`)).data}))}readAll(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/fields")).data}))}createOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.post(`/fields/${t}`,e)).data}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${e}`,n)).data}))}deleteOne(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/fields/${t}/${e}`)}))}}t("FieldsHandler",a);class u extends n{constructor(t){super("directus_files",t)}}t("FilesHandler",u);class d extends n{constructor(t){super("directus_folders",t)}}t("FoldersHandler",d);class c extends n{constructor(t){super("directus_permissions",t)}}t("PermissionsHandler",c);class h extends n{constructor(t){super("directus_presets",t)}}t("PresetsHandler",h);class l{constructor(t){this.transport=t}readOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}/${e}`)).data}))}readMany(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}`)).data}))}readAll(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/relations")).data}))}createOne(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/relations",t)).data}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${e}`,{params:n})).data}))}deleteOne(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/relations/${t}/${e}`)}))}}t("RelationsHandler",l);class p extends n{constructor(t){super("directus_revisions",t)}}t("RevisionsHandler",p);class f extends n{constructor(t){super("directus_roles",t)}}t("RolesHandler",f);class v{constructor(t){this.transport=t}ping(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/ping")).raw}))}info(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/info")).data}))}}t("ServerHandler",v);class m{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}read(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}`,{params:t})).data}))}update(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}`,t,{params:e})).data}))}}class g extends m{constructor(t){super("directus_settings",t)}}t("SettingsHandler",g);class y{constructor(t){this.transport=t}send(t,e,n){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:e,invite_url:n})}))}accept(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite/accept",{token:t,password:e})}))}}class _{constructor(t){this.transport=t}generate(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/users/me/tfa/generate",{password:t})).data}))}enable(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/enable",{secret:t,otp:e})}))}disable(t){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/disable",{otp:t})}))}}class w{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new _(this._transport))}read(t){return r(this,void 0,void 0,(function*(){return(yield this._transport.get("/users/me",{params:t})).data}))}update(t,e){return r(this,void 0,void 0,(function*(){return(yield this._transport.patch("/users/me",t,{params:e})).data}))}}class b extends n{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new y(this.transport))}get me(){return this._me||(this._me=new w(this.transport))}}t("UsersHandler",b);class x{constructor(t){this.random={string:(t=32)=>r(this,void 0,void 0,(function*(){return(yield this.transport.get("/utils/random/string",{params:{length:t}})).data}))},this.hash={generate:t=>r(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/generate",{string:t})).data})),verify:(t,e)=>r(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/verify",{string:t,hash:e})).data}))},this.transport=t}sort(t,e,n){return r(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:e,to:n})}))}revert(t){return r(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var O;t("UtilsHandler",x),t("Meta",O),function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(O||t("Meta",O={}));class k{}t("IStorage",k);class S{}t("ITransport",S);class E extends Error{constructor(t,e){var r,n;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(n=null==e?void 0:e.errors[0])||void 0===n?void 0:n.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,E.prototype)}}t("TransportError",E);class R extends k{constructor(t){var e;super(),this.prefix=null!==(e=null==t?void 0:t.prefix)&&void 0!==e?e:""}get auth_token(){return this.get("auth_token")}set auth_token(t){null===t?this.delete("auth_token"):this.set("auth_token",t)}get auth_expires(){const t=this.get("auth_expires");return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete("auth_expires"):this.set("auth_expires",t.toString())}get auth_refresh_token(){return this.get("auth_refresh_token")}set auth_refresh_token(t){null===t?this.delete("auth_refresh_token"):this.set("auth_refresh_token",t)}}t("BaseStorage",R);class j extends R{constructor(){super(...arguments),this.values={}}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}t("MemoryStorage",j);class T extends R{get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}t("LocalStorage",T);var A={exports:{}},U=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},$=U,q=Object.prototype.toString;function C(t){return"[object Array]"===q.call(t)}function P(t){return void 0===t}function N(t){return null!==t&&"object"==typeof t}function B(t){if("[object Object]"!==q.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function L(t){return"[object Function]"===q.call(t)}function I(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),C(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}var H={isArray:C,isArrayBuffer:function(t){return"[object ArrayBuffer]"===q.call(t)},isBuffer:function(t){return null!==t&&!P(t)&&null!==t.constructor&&!P(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:N,isPlainObject:B,isUndefined:P,isDate:function(t){return"[object Date]"===q.call(t)},isFile:function(t){return"[object File]"===q.call(t)},isBlob:function(t){return"[object Blob]"===q.call(t)},isFunction:L,isStream:function(t){return N(t)&&L(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:I,merge:function t(){var e={};function r(r,n){B(e[n])&&B(r)?e[n]=t(e[n],r):B(r)?e[n]=t({},r):C(r)?e[n]=r.slice():e[n]=r}for(var n=0,s=arguments.length;n<s;n++)I(arguments[n],r);return e},extend:function(t,e,r){return I(e,(function(e,n){t[n]=r&&"function"==typeof e?$(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},D=H;function M(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var F=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if(D.isURLSearchParams(e))n=e.toString();else{var s=[];D.forEach(e,(function(t,e){null!=t&&(D.isArray(t)?e+="[]":t=[t],D.forEach(t,(function(t){D.isDate(t)?t=t.toISOString():D.isObject(t)&&(t=JSON.stringify(t)),s.push(M(e)+"="+M(t))})))})),n=s.join("&")}if(n){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},J=H;function z(){this.handlers=[]}z.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},z.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},z.prototype.forEach=function(t){J.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var W=z,V=H,X=function(t,e,r,n,s){return t.config=e,r&&(t.code=r),t.request=n,t.response=s,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},K=X,G=function(t,e,r,n,s){var i=new Error(t);return K(i,e,r,n,s)},Q=G,Y=H,Z=Y.isStandardBrowserEnv()?{write:function(t,e,r,n,s,i){var o=[];o.push(t+"="+encodeURIComponent(e)),Y.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&o.push("path="+n),Y.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},tt=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},et=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},rt=H,nt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],st=H,it=st.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=n(window.location.href),function(e){var r=st.isString(e)?n(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0};function ot(t){this.message=t}ot.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},ot.prototype.__CANCEL__=!0;var at=ot,ut=H,dt=function(t,e,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(Q("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},ct=Z,ht=F,lt=function(t,e){return t&&!tt(e)?et(t,e):e},pt=function(t){var e,r,n,s={};return t?(rt.forEach(t.split("\n"),(function(t){if(n=t.indexOf(":"),e=rt.trim(t.substr(0,n)).toLowerCase(),r=rt.trim(t.substr(n+1)),e){if(s[e]&&nt.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s},ft=it,vt=G,mt=Et,gt=at,yt=function(t){return new Promise((function(e,r){var n,s=t.data,i=t.headers,o=t.responseType;function a(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}ut.isFormData(s)&&delete i["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",c=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+c)}var h=lt(t.baseURL,t.url);function l(){if(u){var n="getAllResponseHeaders"in u?pt(u.getAllResponseHeaders()):null,s={data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u};dt((function(t){e(t),a()}),(function(t){r(t),a()}),s),u=null}}if(u.open(t.method.toUpperCase(),ht(h,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(r(vt("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(vt("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||mt.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(vt(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},ut.isStandardBrowserEnv()){var p=(t.withCredentials||ft(h))&&t.xsrfCookieName?ct.read(t.xsrfCookieName):void 0;p&&(i[t.xsrfHeaderName]=p)}"setRequestHeader"in u&&ut.forEach(i,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete i[e]:u.setRequestHeader(e,t)})),ut.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),o&&"json"!==o&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){u&&(r(!t||t&&t.type?new gt("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),s||(s=null),u.send(s)}))},_t=H,wt=function(t,e){V.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))},bt=X,xt={"Content-Type":"application/x-www-form-urlencoded"};function Ot(t,e){!_t.isUndefined(t)&&_t.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var kt,St={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(kt=yt),kt),transformRequest:[function(t,e){return wt(e,"Accept"),wt(e,"Content-Type"),_t.isFormData(t)||_t.isArrayBuffer(t)||_t.isBuffer(t)||_t.isStream(t)||_t.isFile(t)||_t.isBlob(t)?t:_t.isArrayBufferView(t)?t.buffer:_t.isURLSearchParams(t)?(Ot(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):_t.isObject(t)||e&&"application/json"===e["Content-Type"]?(Ot(e,"application/json"),function(t,e,r){if(_t.isString(t))try{return(e||JSON.parse)(t),_t.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||St.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||n&&_t.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw bt(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};_t.forEach(["delete","get","head"],(function(t){St.headers[t]={}})),_t.forEach(["post","put","patch"],(function(t){St.headers[t]=_t.merge(xt)}));var Et=St,Rt=H,jt=Et,Tt=function(t){return!(!t||!t.__CANCEL__)},At=H,Ut=function(t,e,r){var n=this||jt;return Rt.forEach(r,(function(r){t=r.call(n,t,e)})),t},$t=Tt,qt=Et,Ct=at;function Pt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ct("canceled")}var Nt=H,Bt=function(t,e){e=e||{};var r={};function n(t,e){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge(t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function s(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(t[r],e[r])}function i(t){if(!Nt.isUndefined(e[t]))return n(void 0,e[t])}function o(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(void 0,e[r])}function a(r){return r in e?n(t[r],e[r]):r in t?n(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return Nt.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||s,n=e(t);Nt.isUndefined(n)&&e!==a||(r[t]=n)})),r},Lt="0.24.0",It=Lt,Ht={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Ht[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var Dt={};Ht.transitional=function(t,e,r){function n(t,e){return"[Axios v"+It+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,s,i){if(!1===t)throw new Error(n(s," has been removed"+(e?" in "+e:"")));return e&&!Dt[s]&&(Dt[s]=!0,console.warn(n(s," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,s,i)}};var Mt={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:Ht},Ft=H,Jt=F,zt=W,Wt=function(t){return Pt(t),t.headers=t.headers||{},t.data=Ut.call(t,t.data,t.headers,t.transformRequest),t.headers=At.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),At.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||qt.adapter)(t).then((function(e){return Pt(t),e.data=Ut.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return $t(e)||(Pt(t),e&&e.response&&(e.response.data=Ut.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Vt=Bt,Xt=Mt,Kt=Xt.validators;function Gt(t){this.defaults=t,this.interceptors={request:new zt,response:new zt}}Gt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=Vt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&Xt.assertOptions(e,{silentJSONParsing:Kt.transitional(Kt.boolean),forcedJSONParsing:Kt.transitional(Kt.boolean),clarifyTimeoutError:Kt.transitional(Kt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!n){var o=[Wt,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{s=Wt(a)}catch(t){return Promise.reject(t)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},Gt.prototype.getUri=function(t){return t=Vt(this.defaults,t),Jt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Ft.forEach(["delete","get","head","options"],(function(t){Gt.prototype[t]=function(e,r){return this.request(Vt(r||{},{method:t,url:e,data:(r||{}).data}))}})),Ft.forEach(["post","put","patch"],(function(t){Gt.prototype[t]=function(e,r,n){return this.request(Vt(n||{},{method:t,url:e,data:r}))}}));var Qt=Gt,Yt=at;function Zt(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,n=r._listeners.length;for(e=0;e<n;e++)r._listeners[e](t);r._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t){r.reason||(r.reason=new Yt(t),e(r.reason))}))}Zt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Zt.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Zt.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Zt.source=function(){var t;return{token:new Zt((function(e){t=e})),cancel:t}};var te=Zt,ee=H,re=U,ne=Qt,se=Bt;var ie=function t(e){var r=new ne(e),n=re(ne.prototype.request,r);return ee.extend(n,ne.prototype,r),ee.extend(n,r),n.create=function(r){return t(se(e,r))},n}(Et);ie.Axios=ne,ie.Cancel=at,ie.CancelToken=te,ie.isCancel=Tt,ie.VERSION=Lt,ie.all=function(t){return Promise.all(t)},ie.spread=function(t){return function(e){return t.apply(null,e)}},ie.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},A.exports=ie,A.exports.default=ie;var oe=A.exports;class ae extends S{constructor(t){var e;super(),this.config=t,this.axios=oe.create({baseURL:this.config.url,params:this.config.params,headers:this.config.headers,onUploadProgress:this.config.onUploadProgress,withCredentials:!0}),(null===(e=this.config)||void 0===e?void 0:e.beforeRequest)&&(this.beforeRequest=this.config.beforeRequest)}beforeRequest(t){return t}get url(){return this.config.url}request(t,e,n,s){var i,o,a,u,d;return r(this,void 0,void 0,(function*(){try{let r={method:t,url:e,data:n,params:null==s?void 0:s.params,headers:null==s?void 0:s.headers,onUploadProgress:null==s?void 0:s.onUploadProgress};r=this.beforeRequest(r);const i=yield this.axios.request(r),o={raw:i.data,status:i.status,statusText:i.statusText,headers:i.headers,data:i.data.data,meta:i.data.meta,errors:i.data.errors};if(i.data.errors)throw new E(null,o);return o}catch(t){if(!t||t instanceof Error==!1)throw t;if(oe.isAxiosError(t)){const e=null===(i=t.response)||void 0===i?void 0:i.data;throw new E(t,{raw:null===(o=t.response)||void 0===o?void 0:o.data,status:null===(a=t.response)||void 0===a?void 0:a.status,statusText:null===(u=t.response)||void 0===u?void 0:u.statusText,headers:null===(d=t.response)||void 0===d?void 0:d.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new E(t)}}))}get(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("get",t,void 0,e)}))}head(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("head",t,void 0,e)}))}options(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("options",t,void 0,e)}))}delete(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("delete",t,e,n)}))}put(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("put",t,e,n)}))}post(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("post",t,e,n)}))}patch(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("patch",t,e,n)}))}}t("Transport",ae);class ue{constructor(t){this.transport=t}request(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/request",{email:t,reset_url:e})}))}reset(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/reset",{token:t,password:e})}))}}class de extends e{constructor(t){var e,r,n;super(),this.autoRefresh=!0,this.msRefreshBeforeExpires=3e4,this.staticToken="",this._transport=t.transport,this._storage=t.storage,this.autoRefresh=null!==(e=null==t?void 0:t.autoRefresh)&&void 0!==e?e:this.autoRefresh,this.mode=null!==(r=null==t?void 0:t.mode)&&void 0!==r?r:this.mode,this.msRefreshBeforeExpires=null!==(n=null==t?void 0:t.msRefreshBeforeExpires)&&void 0!==n?n:this.msRefreshBeforeExpires,(null==t?void 0:t.staticToken)&&(this.staticToken=null==t?void 0:t.staticToken,this.updateStorage({access_token:this.staticToken,expires:null,refresh_token:null})),this.timer=!1}get storage(){return this._storage}get transport(){return this._transport}get token(){return this._storage.auth_token}get password(){return this.passwords=this.passwords||new ue(this._transport)}updateStorage(t){var e,r;this._storage.auth_token=t.access_token,this._storage.auth_refresh_token=null!==(e=t.refresh_token)&&void 0!==e?e:null,this._storage.auth_expires=null!==(r=t.expires)&&void 0!==r?r:null}autoRefreshJob(){if(!this.autoRefresh)return;if(!this._storage.auth_expires)return;const t=this._storage.auth_expires-this.msRefreshBeforeExpires;this.timer=setTimeout((()=>r(this,void 0,void 0,(function*(){yield this.refresh().catch((()=>{})),this.autoRefreshJob()}))),t)}refresh(){var t;return r(this,void 0,void 0,(function*(){const e=yield this._transport.post("/auth/refresh",{refresh_token:"json"===this.mode?this._storage.auth_refresh_token:void 0});return this.updateStorage(e.data),{access_token:e.data.access_token,refresh_token:null===(t=e.data)||void 0===t?void 0:t.refresh_token,expires:e.data.expires}}))}login(t){var e;return r(this,void 0,void 0,(function*(){const r=yield this._transport.post("/auth/login",Object.assign({mode:this.mode},t),{headers:{Authorization:null}});return this.updateStorage(r.data),this.autoRefresh&&this.autoRefreshJob(),{access_token:r.data.access_token,refresh_token:null===(e=r.data)||void 0===e?void 0:e.refresh_token,expires:r.data.expires}}))}static(t){return r(this,void 0,void 0,(function*(){return yield this._transport.get("/users/me",{params:{access_token:t},headers:{Authorization:null}}),this.updateStorage({access_token:t,expires:null,refresh_token:null}),!0}))}logout(){return r(this,void 0,void 0,(function*(){let t;"json"===this.mode&&(t=this._storage.auth_refresh_token||void 0),yield this._transport.post("/auth/logout",{refresh_token:t}),this.updateStorage({access_token:null,expires:null,refresh_token:null}),clearTimeout(this.timer)}))}}t("Auth",de);class ce{constructor(t){this.transport=t}request(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:e,variables:void 0===n?{}:n})}))}items(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("/graphql",t,e)}))}system(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("/graphql/system",t,e)}))}}t("Directus",class{constructor(t,r){var n,s,i,o,a,u,d,c;if(this._url=t,this._options=r,this._items={},this._singletons={},(null===(n=this._options)||void 0===n?void 0:n.storage)&&(null===(s=this._options)||void 0===s?void 0:s.storage)instanceof k)this._storage=this._options.storage;else{const t=null===(i=this._options)||void 0===i?void 0:i.storage,e=null!=t?t:{},{mode:r}=e,n= | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function e(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((n=n.apply(t,e||[])).next())}))}class r{constructor(t,e){this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}/${encodeURI(t)}`,{params:r})).data}))}readMany(t){return e(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.get(`${this.endpoint}`,{params:t});return{data:e,meta:r}}))}createOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.post(`${this.endpoint}`,t,{params:r})).data}))}createMany(t,r){return e(this,void 0,void 0,(function*(){return yield this.transport.post(`${this.endpoint}`,t,{params:r})}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:n})).data}))}updateMany(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:n})}))}updateByQuery(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:n})}))}deleteOne(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}/${encodeURI(t)}`)}))}deleteMany(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}`,t)}))}}t("ItemsHandler",r);class n{constructor(t){this.transport=t}create(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/activity/comment",t)).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/activity/comment/${encodeURI(t)}`,{comment:r})).data}))}delete(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/activity/comment/${encodeURI(t)}`)}))}}t("CommentsHandler",n);class s extends r{constructor(t){super("directus_activity",t),this._comments=new n(this.transport)}get comments(){return this._comments}}t("ActivityHandler",s);class i{constructor(t){this.transport=t}readOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/collections/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){const{data:t,meta:e}=yield this.transport.get("/collections");return{data:t,meta:e}}))}createOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/collections",t)).data}))}createMany(t){return e(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.post("/collections",t);return{data:e,meta:r}}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:n})).data}))}deleteOne(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/collections/${t}`)}))}}t("CollectionsHandler",i);class o{constructor(t){this.transport=t}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}/${r}`)).data}))}readMany(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/fields")).data}))}createOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.post(`/fields/${t}`,r)).data}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,n)).data}))}deleteOne(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/fields/${t}/${r}`)}))}}t("FieldsHandler",o);class a extends r{constructor(t){super("directus_files",t)}}t("FilesHandler",a);class u extends r{constructor(t){super("directus_folders",t)}}t("FoldersHandler",u);class d extends r{constructor(t){super("directus_permissions",t)}}t("PermissionsHandler",d);class h extends r{constructor(t){super("directus_presets",t)}}t("PresetsHandler",h);class c{constructor(t){this.transport=t}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}/${r}`)).data}))}readMany(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/relations")).data}))}createOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/relations",t)).data}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:n})).data}))}deleteOne(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/relations/${t}/${r}`)}))}}t("RelationsHandler",c);class l extends r{constructor(t){super("directus_revisions",t)}}t("RevisionsHandler",l);class p extends r{constructor(t){super("directus_roles",t)}}t("RolesHandler",p);class f{constructor(t){this.transport=t}ping(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/ping")).raw}))}info(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/info")).data}))}}t("ServerHandler",f);class v{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}read(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}`,{params:t})).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}`,t,{params:r})).data}))}}class m extends v{constructor(t){super("directus_settings",t)}}t("SettingsHandler",m);class g{constructor(t){this.transport=t}send(t,r,n){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:n})}))}accept(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite/accept",{token:t,password:r})}))}}class y{constructor(t){this.transport=t}generate(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/users/me/tfa/generate",{password:t})).data}))}enable(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/enable",{secret:t,otp:r})}))}disable(t){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/disable",{otp:t})}))}}class _{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new y(this._transport))}read(t){return e(this,void 0,void 0,(function*(){return(yield this._transport.get("/users/me",{params:t})).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this._transport.patch("/users/me",t,{params:r})).data}))}}class w extends r{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new g(this.transport))}get me(){return this._me||(this._me=new _(this.transport))}}t("UsersHandler",w);class b{constructor(t){this.random={string:(t=32)=>e(this,void 0,void 0,(function*(){return(yield this.transport.get("/utils/random/string",{params:{length:t}})).data}))},this.hash={generate:t=>e(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/generate",{string:t})).data})),verify:(t,r)=>e(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/verify",{string:t,hash:r})).data}))},this.transport=t}sort(t,r,n){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:n})}))}revert(t){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var x;t("UtilsHandler",b),t("Meta",x),function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(x||t("Meta",x={}));class k extends Error{constructor(t,e){var r,n;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(n=null==e?void 0:e.errors[0])||void 0===n?void 0:n.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,k.prototype)}}t("TransportError",k);class O{get auth_token(){return this.get("auth_token")}set auth_token(t){null===t?this.delete("auth_token"):this.set("auth_token",t)}get auth_expires(){const t=this.get("auth_expires");return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete("auth_expires"):this.set("auth_expires",t.toString())}get auth_refresh_token(){return this.get("auth_refresh_token")}set auth_refresh_token(t){null===t?this.delete("auth_refresh_token"):this.set("auth_refresh_token",t)}}t("BaseStorage",O);class E extends O{constructor(t=""){super(),this.values={},this.prefix=t}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}t("MemoryStorage",E);class S extends O{constructor(t=""){super(),this.prefix=t}get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}t("LocalStorage",S);var T={exports:{}},j=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},R=j,A=Object.prototype.toString;function U(t){return"[object Array]"===A.call(t)}function $(t){return void 0===t}function N(t){return null!==t&&"object"==typeof t}function C(t){if("[object Object]"!==A.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function q(t){return"[object Function]"===A.call(t)}function P(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),U(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}var B={isArray:U,isArrayBuffer:function(t){return"[object ArrayBuffer]"===A.call(t)},isBuffer:function(t){return null!==t&&!$(t)&&null!==t.constructor&&!$(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:N,isPlainObject:C,isUndefined:$,isDate:function(t){return"[object Date]"===A.call(t)},isFile:function(t){return"[object File]"===A.call(t)},isBlob:function(t){return"[object Blob]"===A.call(t)},isFunction:q,isStream:function(t){return N(t)&&q(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:P,merge:function t(){var e={};function r(r,n){C(e[n])&&C(r)?e[n]=t(e[n],r):C(r)?e[n]=t({},r):U(r)?e[n]=r.slice():e[n]=r}for(var n=0,s=arguments.length;n<s;n++)P(arguments[n],r);return e},extend:function(t,e,r){return P(e,(function(e,n){t[n]=r&&"function"==typeof e?R(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},H=B;function L(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var I=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if(H.isURLSearchParams(e))n=e.toString();else{var s=[];H.forEach(e,(function(t,e){null!=t&&(H.isArray(t)?e+="[]":t=[t],H.forEach(t,(function(t){H.isDate(t)?t=t.toISOString():H.isObject(t)&&(t=JSON.stringify(t)),s.push(L(e)+"="+L(t))})))})),n=s.join("&")}if(n){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},D=B;function M(){this.handlers=[]}M.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},M.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},M.prototype.forEach=function(t){D.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var F=M,z=B,J=function(t,e,r,n,s){return t.config=e,r&&(t.code=r),t.request=n,t.response=s,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},W=J,V=function(t,e,r,n,s){var i=new Error(t);return W(i,e,r,n,s)},X=V,K=B,G=K.isStandardBrowserEnv()?{write:function(t,e,r,n,s,i){var o=[];o.push(t+"="+encodeURIComponent(e)),K.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),K.isString(n)&&o.push("path="+n),K.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Q=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},Y=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Z=B,tt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],et=B,rt=et.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=n(window.location.href),function(e){var r=et.isString(e)?n(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0};function nt(t){this.message=t}nt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},nt.prototype.__CANCEL__=!0;var st=nt,it=B,ot=function(t,e,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(X("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},at=G,ut=I,dt=function(t,e){return t&&!Q(e)?Y(t,e):e},ht=function(t){var e,r,n,s={};return t?(Z.forEach(t.split("\n"),(function(t){if(n=t.indexOf(":"),e=Z.trim(t.substr(0,n)).toLowerCase(),r=Z.trim(t.substr(n+1)),e){if(s[e]&&tt.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s},ct=rt,lt=V,pt=kt,ft=st,vt=function(t){return new Promise((function(e,r){var n,s=t.data,i=t.headers,o=t.responseType;function a(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}it.isFormData(s)&&delete i["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",h=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+h)}var c=dt(t.baseURL,t.url);function l(){if(u){var n="getAllResponseHeaders"in u?ht(u.getAllResponseHeaders()):null,s={data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u};ot((function(t){e(t),a()}),(function(t){r(t),a()}),s),u=null}}if(u.open(t.method.toUpperCase(),ut(c,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(r(lt("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(lt("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||pt.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(lt(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},it.isStandardBrowserEnv()){var p=(t.withCredentials||ct(c))&&t.xsrfCookieName?at.read(t.xsrfCookieName):void 0;p&&(i[t.xsrfHeaderName]=p)}"setRequestHeader"in u&&it.forEach(i,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete i[e]:u.setRequestHeader(e,t)})),it.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),o&&"json"!==o&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){u&&(r(!t||t&&t.type?new ft("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),s||(s=null),u.send(s)}))},mt=B,gt=function(t,e){z.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))},yt=J,_t={"Content-Type":"application/x-www-form-urlencoded"};function wt(t,e){!mt.isUndefined(t)&&mt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var bt,xt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(bt=vt),bt),transformRequest:[function(t,e){return gt(e,"Accept"),gt(e,"Content-Type"),mt.isFormData(t)||mt.isArrayBuffer(t)||mt.isBuffer(t)||mt.isStream(t)||mt.isFile(t)||mt.isBlob(t)?t:mt.isArrayBufferView(t)?t.buffer:mt.isURLSearchParams(t)?(wt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):mt.isObject(t)||e&&"application/json"===e["Content-Type"]?(wt(e,"application/json"),function(t,e,r){if(mt.isString(t))try{return(e||JSON.parse)(t),mt.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||xt.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||n&&mt.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw yt(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};mt.forEach(["delete","get","head"],(function(t){xt.headers[t]={}})),mt.forEach(["post","put","patch"],(function(t){xt.headers[t]=mt.merge(_t)}));var kt=xt,Ot=B,Et=kt,St=function(t){return!(!t||!t.__CANCEL__)},Tt=B,jt=function(t,e,r){var n=this||Et;return Ot.forEach(r,(function(r){t=r.call(n,t,e)})),t},Rt=St,At=kt,Ut=st;function $t(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ut("canceled")}var Nt=B,Ct=function(t,e){e=e||{};var r={};function n(t,e){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge(t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function s(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(t[r],e[r])}function i(t){if(!Nt.isUndefined(e[t]))return n(void 0,e[t])}function o(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(void 0,e[r])}function a(r){return r in e?n(t[r],e[r]):r in t?n(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return Nt.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||s,n=e(t);Nt.isUndefined(n)&&e!==a||(r[t]=n)})),r},qt="0.24.0",Pt=qt,Bt={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Bt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var Ht={};Bt.transitional=function(t,e,r){function n(t,e){return"[Axios v"+Pt+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,s,i){if(!1===t)throw new Error(n(s," has been removed"+(e?" in "+e:"")));return e&&!Ht[s]&&(Ht[s]=!0,console.warn(n(s," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,s,i)}};var Lt={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:Bt},It=B,Dt=I,Mt=F,Ft=function(t){return $t(t),t.headers=t.headers||{},t.data=jt.call(t,t.data,t.headers,t.transformRequest),t.headers=Tt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Tt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||At.adapter)(t).then((function(e){return $t(t),e.data=jt.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return Rt(e)||($t(t),e&&e.response&&(e.response.data=jt.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},zt=Ct,Jt=Lt,Wt=Jt.validators;function Vt(t){this.defaults=t,this.interceptors={request:new Mt,response:new Mt}}Vt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=zt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&Jt.assertOptions(e,{silentJSONParsing:Wt.transitional(Wt.boolean),forcedJSONParsing:Wt.transitional(Wt.boolean),clarifyTimeoutError:Wt.transitional(Wt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!n){var o=[Ft,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{s=Ft(a)}catch(t){return Promise.reject(t)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},Vt.prototype.getUri=function(t){return t=zt(this.defaults,t),Dt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},It.forEach(["delete","get","head","options"],(function(t){Vt.prototype[t]=function(e,r){return this.request(zt(r||{},{method:t,url:e,data:(r||{}).data}))}})),It.forEach(["post","put","patch"],(function(t){Vt.prototype[t]=function(e,r,n){return this.request(zt(n||{},{method:t,url:e,data:r}))}}));var Xt=Vt,Kt=st;function Gt(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,n=r._listeners.length;for(e=0;e<n;e++)r._listeners[e](t);r._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t){r.reason||(r.reason=new Kt(t),e(r.reason))}))}Gt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Gt.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Gt.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Gt.source=function(){var t;return{token:new Gt((function(e){t=e})),cancel:t}};var Qt=Gt,Yt=B,Zt=j,te=Xt,ee=Ct;var re=function t(e){var r=new te(e),n=Zt(te.prototype.request,r);return Yt.extend(n,te.prototype,r),Yt.extend(n,r),n.create=function(r){return t(ee(e,r))},n}(kt);re.Axios=te,re.Cancel=st,re.CancelToken=Qt,re.isCancel=St,re.VERSION=qt,re.all=function(t){return Promise.all(t)},re.spread=function(t){return function(e){return t.apply(null,e)}},re.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},T.exports=re,T.exports.default=re;var ne=T.exports;class se{constructor(t,e,r=(()=>Promise.resolve())){this._url=t,this._storage=e,this._axios=null,this._refresh=r,this.url=t}get url(){return this._url}set url(t){this._url=t,this._axios=ne.create({baseURL:t,withCredentials:!0})}get axios(){return this._axios}get requests(){return{intercept:(t,e)=>{const r=this._axios.interceptors.request.use(t,e);return{eject:()=>{this._axios.interceptors.request.eject(r)}}}}}get responses(){return{intercept:(t,e)=>{const r=this._axios.interceptors.response.use(t,e);return{eject:()=>{this._axios.interceptors.response.eject(r)}}}}}request(t,r,n,s){var i,o,a,u,d,h,c,l,p;return e(this,void 0,void 0,(function*(){try{(s=s||{}).sendAuthorizationHeaders=null===(i=s.sendAuthorizationHeaders)||void 0===i||i,s.refreshTokenIfNeeded=null===(o=s.refreshTokenIfNeeded)||void 0===o||o,s.headers=null!==(a=s.headers)&&void 0!==a?a:{},s.onUploadProgress=null!==(u=s.onUploadProgress)&&void 0!==u?u:void 0,s.refreshTokenIfNeeded&&(yield this._refresh());const e={method:t,url:r,data:n,params:s.params,headers:s.headers,onUploadProgress:s.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;s.sendAuthorizationHeaders&&d&&(null!==h&&h>Date.now()||null===h)&&(d.startsWith("Bearer ")?e.headers.Authorization=d:e.headers.Authorization=`Bearer ${d}`);const c=yield this.axios.request(e),l=c.data,p={raw:c.data,status:c.status,statusText:c.statusText,headers:c.headers,data:l.data,meta:l.meta,errors:l.errors};if(l.errors)throw new k(null,p);return p}catch(t){if(!t||t instanceof Error==!1)throw t;if(ne.isAxiosError(t)){const e=null===(d=t.response)||void 0===d?void 0:d.data;throw new k(t,{raw:null===(h=t.response)||void 0===h?void 0:h.data,status:null===(c=t.response)||void 0===c?void 0:c.status,statusText:null===(l=t.response)||void 0===l?void 0:l.statusText,headers:null===(p=t.response)||void 0===p?void 0:p.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new k(t)}}))}get(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("get",t,void 0,r)}))}head(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("head",t,void 0,r)}))}options(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("options",t,void 0,r)}))}delete(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,n)}))}put(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,n)}))}post(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,n)}))}patch(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,n)}))}}t("AxiosTransport",se);class ie{constructor(t){this.transport=t}request(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/request",{email:t,reset_url:r})}))}reset(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/reset",{token:t,password:r})}))}}class oe{constructor(t){this.func=t,this.debounced=[],this.debouncing=!1}debounce(...t){return e(this,void 0,void 0,(function*(){return this.debouncing?yield new Promise(((t,e)=>{this.debounced.push({resolve:e=>t(e),reject:t=>e(t)})})):(this.debouncing=!0,new Promise(((e,r)=>{this.func(...t).then((t=>{const n=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,n.forEach((e=>e.resolve(t)))})).catch((t=>{const n=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,n.forEach((e=>e.reject(t)))}))})))}))}}class ae{constructor(t,e,r){var n,s,i,o,a;this.options=r||{},this.options.mode=(null==r?void 0:r.mode)||("undefined"!=typeof window?"cookie":"json"),this.options.refresh=(null==r?void 0:r.refresh)||{auto:!1,time:3e4},this.options.refresh.auto=null!==(s=null===(n=this.options.refresh)||void 0===n?void 0:n.auto)&&void 0!==s&&s,this.options.refresh.time=null!==(o=null===(i=this.options.refresh)||void 0===i?void 0:i.time)&&void 0!==o?o:3e4,this.transport=t,this.storage=e,this.timer=!1,this.refresher=new oe(this.refreshToken.bind(this));try{this.updateRefresh(null===(a=this.options)||void 0===a?void 0:a.refresh)}catch(t){}}get token(){return this.storage.auth_token}get password(){return this.passwords=this.passwords||new ie(this.transport)}get expiring(){var t,e;const r=this.storage.auth_expires;if(null===r)return!1;return r-(null!==(e=null===(t=this.options.refresh)||void 0===t?void 0:t.time)&&void 0!==e?e:0)<=Date.now()}refreshToken(t=!1){var r;return e(this,void 0,void 0,(function*(){if(!t&&!this.expiring)return!1;const e=yield this.transport.post("/auth/refresh",{refresh_token:"json"===this.options.mode?this.storage.auth_refresh_token:void 0},{refreshTokenIfNeeded:!1});return this.updateStorage(e.data),this.updateRefresh(),{access_token:e.data.access_token,refresh_token:null===(r=e.data)||void 0===r?void 0:r.refresh_token,expires:e.data.expires}}))}updateStorage(t){var e;this.storage.auth_token=t.access_token,this.storage.auth_refresh_token=null!==(e=t.refresh_token)&&void 0!==e?e:null,t.expires?this.storage.auth_expires=Date.now()+t.expires:this.storage.auth_expires=null}updateRefresh(t){var e,r;const n=this.storage.auth_expires;if(null===n)return void clearTimeout(this.timer);t&&(this.options.refresh.auto=null!==(e=t.auto)&&void 0!==e?e:this.options.refresh.auto,this.options.refresh.time=null!==(r=t.time)&&void 0!==r?r:this.options.refresh.time),clearTimeout(this.timer);let s=n-this.options.refresh.time-Date.now();if(s<0){if(n<Date.now())return;s=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),s))}refresh(t=!1){return e(this,void 0,void 0,(function*(){return yield this.refresher.debounce(t)}))}login(t,r){var n;return e(this,void 0,void 0,(function*(){r=r||{};const e=yield this.transport.post("/auth/login",Object.assign({mode:this.options.mode},t),{refreshTokenIfNeeded:!1,sendAuthorizationHeaders:!1});return this.updateStorage(e.data),this.updateRefresh(r.refresh),{access_token:e.data.access_token,refresh_token:null===(n=e.data)||void 0===n?void 0:n.refresh_token,expires:e.data.expires}}))}static(t){return e(this,void 0,void 0,(function*(){return yield this.transport.get("/users/me",{params:{access_token:t}}),this.storage.auth_token=t,this.storage.auth_expires=null,this.storage.auth_refresh_token=null,!0}))}logout(){return e(this,void 0,void 0,(function*(){let t;"json"===this.options.mode&&(t=this.storage.auth_refresh_token||void 0),yield this.transport.post("/auth/logout",{refresh_token:t},{refreshTokenIfNeeded:!1}),this.storage.auth_token=null,this.storage.auth_expires=null,this.storage.auth_refresh_token=null,clearTimeout(this.timer)}))}}t("Auth",ae);class ue{constructor(t){this.transport=t}request(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===n?{}:n})}))}items(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("/graphql",t,r)}))}system(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("/graphql/system",t,r)}))}}t("Directus",class{constructor(t,r){this._storage=(null==r?void 0:r.storage)||("undefined"!=typeof window?new S:new E),this._transport=(null==r?void 0:r.transport)||new se(t,this._storage,(()=>e(this,void 0,void 0,(function*(){yield this._auth.refresh()})))),this._auth=(null==r?void 0:r.auth)||new ae(this._transport,this._storage),this._items={},this._singletons={}}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new s(this.transport))}get collections(){return this._collections||(this._collections=new i(this.transport))}get fields(){return this._fields||(this._fields=new o(this.transport))}get files(){return this._files||(this._files=new a(this.transport))}get folders(){return this._folders||(this._folders=new u(this.transport))}get permissions(){return this._permissions||(this._permissions=new d(this.transport))}get presets(){return this._presets||(this._presets=new h(this.transport))}get relations(){return this._relations||(this._relations=new c(this.transport))}get revisions(){return this._revisions||(this._revisions=new l(this.transport))}get roles(){return this._roles||(this._roles=new p(this.transport))}get users(){return this._users||(this._users=new w(this.transport))}get settings(){return this._settings||(this._settings=new m(this.transport))}get server(){return this._server||(this._server=new f(this.transport))}get utils(){return this._utils||(this._utils=new b(this.transport))}get graphql(){return this._graphql||(this._graphql=new ue(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new v(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new r(t,this.transport))}})}}})); | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]])}return r}(e,["mode"]);"MemoryStorage"===r||"undefined"==typeof window?this._storage=new j(n):this._storage=new T(n)}(null===(o=this._options)||void 0===o?void 0:o.transport)&&(null===(a=this._options)||void 0===a?void 0:a.transport)instanceof S?this._transport=this._options.transport:this._transport=new ae({url:this.url,beforeRequest:t=>{const e=this.storage.auth_token,r=e?e.startsWith("Bearer ")?String(this.storage.auth_token):`Bearer ${this.storage.auth_token}`:"";return Object.assign(Object.assign({},t),{headers:Object.assign({Authorization:r},t.headers)})}}),(null===(u=this._options)||void 0===u?void 0:u.auth)&&(null===(d=this._options)||void 0===d?void 0:d.auth)instanceof e?this._auth=this._options.auth:this._auth=new de(Object.assign({transport:this._transport,storage:this._storage},null===(c=this._options)||void 0===c?void 0:c.auth))}get url(){return this._url}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new i(this.transport))}get collections(){return this._collections||(this._collections=new o(this.transport))}get fields(){return this._fields||(this._fields=new a(this.transport))}get files(){return this._files||(this._files=new u(this.transport))}get folders(){return this._folders||(this._folders=new d(this.transport))}get permissions(){return this._permissions||(this._permissions=new c(this.transport))}get presets(){return this._presets||(this._presets=new h(this.transport))}get relations(){return this._relations||(this._relations=new l(this.transport))}get revisions(){return this._revisions||(this._revisions=new p(this.transport))}get roles(){return this._roles||(this._roles=new f(this.transport))}get users(){return this._users||(this._users=new b(this.transport))}get settings(){return this._settings||(this._settings=new g(this.transport))}get server(){return this._server||(this._server=new v(this.transport))}get utils(){return this._utils||(this._utils=new x(this.transport))}get graphql(){return this._graphql||(this._graphql=new ce(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new m(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new n(t,this.transport))}})}}})); | ||
//# sourceMappingURL=sdk.system.min.js.map |
@@ -1,16 +0,16 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Directus={})}(this,(function(t){"use strict"; | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Directus={})}(this,(function(t){"use strict";class e{constructor(){this.mode="undefined"==typeof window?"json":"cookie"}} | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function e(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((n=n.apply(t,e||[])).next())}))}class r{constructor(t,e){this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}/${encodeURI(t)}`,{params:r})).data}))}readMany(t){return e(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.get(`${this.endpoint}`,{params:t});return{data:e,meta:r}}))}createOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.post(`${this.endpoint}`,t,{params:r})).data}))}createMany(t,r){return e(this,void 0,void 0,(function*(){return yield this.transport.post(`${this.endpoint}`,t,{params:r})}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:n})).data}))}updateMany(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:n})}))}updateByQuery(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:n})}))}deleteOne(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}/${encodeURI(t)}`)}))}deleteMany(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}`,t)}))}}class n{constructor(t){this.transport=t}create(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/activity/comment",t)).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/activity/comment/${encodeURI(t)}`,{comment:r})).data}))}delete(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/activity/comment/${encodeURI(t)}`)}))}}class s extends r{constructor(t){super("directus_activity",t),this._comments=new n(this.transport)}get comments(){return this._comments}}class i{constructor(t){this.transport=t}readOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/collections/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){const{data:t,meta:e}=yield this.transport.get("/collections");return{data:t,meta:e}}))}createOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/collections",t)).data}))}createMany(t){return e(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.post("/collections",t);return{data:e,meta:r}}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:n})).data}))}deleteOne(t){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/collections/${t}`)}))}}class o{constructor(t){this.transport=t}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}/${r}`)).data}))}readMany(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/fields")).data}))}createOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.post(`/fields/${t}`,r)).data}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,n)).data}))}deleteOne(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/fields/${t}/${r}`)}))}}class a extends r{constructor(t){super("directus_files",t)}}class u extends r{constructor(t){super("directus_folders",t)}}class d extends r{constructor(t){super("directus_permissions",t)}}class h extends r{constructor(t){super("directus_presets",t)}}class c{constructor(t){this.transport=t}readOne(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}/${r}`)).data}))}readMany(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}`)).data}))}readAll(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/relations")).data}))}createOne(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/relations",t)).data}))}updateOne(t,r,n){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:n})).data}))}deleteOne(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.delete(`/relations/${t}/${r}`)}))}}class l extends r{constructor(t){super("directus_revisions",t)}}class p extends r{constructor(t){super("directus_roles",t)}}class f{constructor(t){this.transport=t}ping(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/ping")).raw}))}info(){return e(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/info")).data}))}}class v{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}read(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}`,{params:t})).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}`,t,{params:r})).data}))}}class m extends v{constructor(t){super("directus_settings",t)}}class g{constructor(t){this.transport=t}send(t,r,n){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:n})}))}accept(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite/accept",{token:t,password:r})}))}}class y{constructor(t){this.transport=t}generate(t){return e(this,void 0,void 0,(function*(){return(yield this.transport.post("/users/me/tfa/generate",{password:t})).data}))}enable(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/enable",{secret:t,otp:r})}))}disable(t){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/disable",{otp:t})}))}}class _{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new y(this._transport))}read(t){return e(this,void 0,void 0,(function*(){return(yield this._transport.get("/users/me",{params:t})).data}))}update(t,r){return e(this,void 0,void 0,(function*(){return(yield this._transport.patch("/users/me",t,{params:r})).data}))}}class w extends r{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new g(this.transport))}get me(){return this._me||(this._me=new _(this.transport))}}class b{constructor(t){this.random={string:(t=32)=>e(this,void 0,void 0,(function*(){return(yield this.transport.get("/utils/random/string",{params:{length:t}})).data}))},this.hash={generate:t=>e(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/generate",{string:t})).data})),verify:(t,r)=>e(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/verify",{string:t,hash:r})).data}))},this.transport=t}sort(t,r,n){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:n})}))}revert(t){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var x;t.Meta=void 0,(x=t.Meta||(t.Meta={})).TOTAL_COUNT="total_count",x.FILTER_COUNT="filter_count";class k extends Error{constructor(t,e){var r,n;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(n=null==e?void 0:e.errors[0])||void 0===n?void 0:n.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,k.prototype)}}class O{get auth_token(){return this.get("auth_token")}set auth_token(t){null===t?this.delete("auth_token"):this.set("auth_token",t)}get auth_expires(){const t=this.get("auth_expires");return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete("auth_expires"):this.set("auth_expires",t.toString())}get auth_refresh_token(){return this.get("auth_refresh_token")}set auth_refresh_token(t){null===t?this.delete("auth_refresh_token"):this.set("auth_refresh_token",t)}}class E extends O{constructor(t=""){super(),this.values={},this.prefix=t}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}class S extends O{constructor(t=""){super(),this.prefix=t}get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}var T={exports:{}},j=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},R=j,A=Object.prototype.toString;function U(t){return"[object Array]"===A.call(t)}function $(t){return void 0===t}function N(t){return null!==t&&"object"==typeof t}function C(t){if("[object Object]"!==A.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function q(t){return"[object Function]"===A.call(t)}function P(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),U(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}var B={isArray:U,isArrayBuffer:function(t){return"[object ArrayBuffer]"===A.call(t)},isBuffer:function(t){return null!==t&&!$(t)&&null!==t.constructor&&!$(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:N,isPlainObject:C,isUndefined:$,isDate:function(t){return"[object Date]"===A.call(t)},isFile:function(t){return"[object File]"===A.call(t)},isBlob:function(t){return"[object Blob]"===A.call(t)},isFunction:q,isStream:function(t){return N(t)&&q(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:P,merge:function t(){var e={};function r(r,n){C(e[n])&&C(r)?e[n]=t(e[n],r):C(r)?e[n]=t({},r):U(r)?e[n]=r.slice():e[n]=r}for(var n=0,s=arguments.length;n<s;n++)P(arguments[n],r);return e},extend:function(t,e,r){return P(e,(function(e,n){t[n]=r&&"function"==typeof e?R(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},H=B;function L(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var I=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if(H.isURLSearchParams(e))n=e.toString();else{var s=[];H.forEach(e,(function(t,e){null!=t&&(H.isArray(t)?e+="[]":t=[t],H.forEach(t,(function(t){H.isDate(t)?t=t.toISOString():H.isObject(t)&&(t=JSON.stringify(t)),s.push(L(e)+"="+L(t))})))})),n=s.join("&")}if(n){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},D=B;function M(){this.handlers=[]}M.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},M.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},M.prototype.forEach=function(t){D.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var F=M,z=B,J=function(t,e,r,n,s){return t.config=e,r&&(t.code=r),t.request=n,t.response=s,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},W=J,V=function(t,e,r,n,s){var i=new Error(t);return W(i,e,r,n,s)},X=V,K=B,G=K.isStandardBrowserEnv()?{write:function(t,e,r,n,s,i){var o=[];o.push(t+"="+encodeURIComponent(e)),K.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),K.isString(n)&&o.push("path="+n),K.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Q=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},Y=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Z=B,tt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],et=B,rt=et.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=n(window.location.href),function(e){var r=et.isString(e)?n(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0};function nt(t){this.message=t}nt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},nt.prototype.__CANCEL__=!0;var st=nt,it=B,ot=function(t,e,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(X("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},at=G,ut=I,dt=function(t,e){return t&&!Q(e)?Y(t,e):e},ht=function(t){var e,r,n,s={};return t?(Z.forEach(t.split("\n"),(function(t){if(n=t.indexOf(":"),e=Z.trim(t.substr(0,n)).toLowerCase(),r=Z.trim(t.substr(n+1)),e){if(s[e]&&tt.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s},ct=rt,lt=V,pt=kt,ft=st,vt=function(t){return new Promise((function(e,r){var n,s=t.data,i=t.headers,o=t.responseType;function a(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}it.isFormData(s)&&delete i["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",h=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+h)}var c=dt(t.baseURL,t.url);function l(){if(u){var n="getAllResponseHeaders"in u?ht(u.getAllResponseHeaders()):null,s={data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u};ot((function(t){e(t),a()}),(function(t){r(t),a()}),s),u=null}}if(u.open(t.method.toUpperCase(),ut(c,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(r(lt("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(lt("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||pt.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(lt(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},it.isStandardBrowserEnv()){var p=(t.withCredentials||ct(c))&&t.xsrfCookieName?at.read(t.xsrfCookieName):void 0;p&&(i[t.xsrfHeaderName]=p)}"setRequestHeader"in u&&it.forEach(i,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete i[e]:u.setRequestHeader(e,t)})),it.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),o&&"json"!==o&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){u&&(r(!t||t&&t.type?new ft("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),s||(s=null),u.send(s)}))},mt=B,gt=function(t,e){z.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))},yt=J,_t={"Content-Type":"application/x-www-form-urlencoded"};function wt(t,e){!mt.isUndefined(t)&&mt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var bt,xt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(bt=vt),bt),transformRequest:[function(t,e){return gt(e,"Accept"),gt(e,"Content-Type"),mt.isFormData(t)||mt.isArrayBuffer(t)||mt.isBuffer(t)||mt.isStream(t)||mt.isFile(t)||mt.isBlob(t)?t:mt.isArrayBufferView(t)?t.buffer:mt.isURLSearchParams(t)?(wt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):mt.isObject(t)||e&&"application/json"===e["Content-Type"]?(wt(e,"application/json"),function(t,e,r){if(mt.isString(t))try{return(e||JSON.parse)(t),mt.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||xt.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||n&&mt.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw yt(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};mt.forEach(["delete","get","head"],(function(t){xt.headers[t]={}})),mt.forEach(["post","put","patch"],(function(t){xt.headers[t]=mt.merge(_t)}));var kt=xt,Ot=B,Et=kt,St=function(t){return!(!t||!t.__CANCEL__)},Tt=B,jt=function(t,e,r){var n=this||Et;return Ot.forEach(r,(function(r){t=r.call(n,t,e)})),t},Rt=St,At=kt,Ut=st;function $t(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ut("canceled")}var Nt=B,Ct=function(t,e){e=e||{};var r={};function n(t,e){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge(t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function s(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(t[r],e[r])}function i(t){if(!Nt.isUndefined(e[t]))return n(void 0,e[t])}function o(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(void 0,e[r])}function a(r){return r in e?n(t[r],e[r]):r in t?n(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return Nt.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||s,n=e(t);Nt.isUndefined(n)&&e!==a||(r[t]=n)})),r},qt="0.24.0",Pt=qt,Bt={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Bt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var Ht={};Bt.transitional=function(t,e,r){function n(t,e){return"[Axios v"+Pt+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,s,i){if(!1===t)throw new Error(n(s," has been removed"+(e?" in "+e:"")));return e&&!Ht[s]&&(Ht[s]=!0,console.warn(n(s," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,s,i)}};var Lt={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:Bt},It=B,Dt=I,Mt=F,Ft=function(t){return $t(t),t.headers=t.headers||{},t.data=jt.call(t,t.data,t.headers,t.transformRequest),t.headers=Tt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Tt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||At.adapter)(t).then((function(e){return $t(t),e.data=jt.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return Rt(e)||($t(t),e&&e.response&&(e.response.data=jt.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},zt=Ct,Jt=Lt,Wt=Jt.validators;function Vt(t){this.defaults=t,this.interceptors={request:new Mt,response:new Mt}}Vt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=zt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&Jt.assertOptions(e,{silentJSONParsing:Wt.transitional(Wt.boolean),forcedJSONParsing:Wt.transitional(Wt.boolean),clarifyTimeoutError:Wt.transitional(Wt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!n){var o=[Ft,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{s=Ft(a)}catch(t){return Promise.reject(t)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},Vt.prototype.getUri=function(t){return t=zt(this.defaults,t),Dt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},It.forEach(["delete","get","head","options"],(function(t){Vt.prototype[t]=function(e,r){return this.request(zt(r||{},{method:t,url:e,data:(r||{}).data}))}})),It.forEach(["post","put","patch"],(function(t){Vt.prototype[t]=function(e,r,n){return this.request(zt(n||{},{method:t,url:e,data:r}))}}));var Xt=Vt,Kt=st;function Gt(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,n=r._listeners.length;for(e=0;e<n;e++)r._listeners[e](t);r._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t){r.reason||(r.reason=new Kt(t),e(r.reason))}))}Gt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Gt.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Gt.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Gt.source=function(){var t;return{token:new Gt((function(e){t=e})),cancel:t}};var Qt=Gt,Yt=B,Zt=j,te=Xt,ee=Ct;var re=function t(e){var r=new te(e),n=Zt(te.prototype.request,r);return Yt.extend(n,te.prototype,r),Yt.extend(n,r),n.create=function(r){return t(ee(e,r))},n}(kt);re.Axios=te,re.Cancel=st,re.CancelToken=Qt,re.isCancel=St,re.VERSION=qt,re.all=function(t){return Promise.all(t)},re.spread=function(t){return function(e){return t.apply(null,e)}},re.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},T.exports=re,T.exports.default=re;var ne=T.exports;class se{constructor(t,e,r=(()=>Promise.resolve())){this._url=t,this._storage=e,this._axios=null,this._refresh=r,this.url=t}get url(){return this._url}set url(t){this._url=t,this._axios=ne.create({baseURL:t,withCredentials:!0})}get axios(){return this._axios}get requests(){return{intercept:(t,e)=>{const r=this._axios.interceptors.request.use(t,e);return{eject:()=>{this._axios.interceptors.request.eject(r)}}}}}get responses(){return{intercept:(t,e)=>{const r=this._axios.interceptors.response.use(t,e);return{eject:()=>{this._axios.interceptors.response.eject(r)}}}}}request(t,r,n,s){var i,o,a,u,d,h,c,l,p;return e(this,void 0,void 0,(function*(){try{(s=s||{}).sendAuthorizationHeaders=null===(i=s.sendAuthorizationHeaders)||void 0===i||i,s.refreshTokenIfNeeded=null===(o=s.refreshTokenIfNeeded)||void 0===o||o,s.headers=null!==(a=s.headers)&&void 0!==a?a:{},s.onUploadProgress=null!==(u=s.onUploadProgress)&&void 0!==u?u:void 0,s.refreshTokenIfNeeded&&(yield this._refresh());const e={method:t,url:r,data:n,params:s.params,headers:s.headers,onUploadProgress:s.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;s.sendAuthorizationHeaders&&d&&(null!==h&&h>Date.now()||null===h)&&(d.startsWith("Bearer ")?e.headers.Authorization=d:e.headers.Authorization=`Bearer ${d}`);const c=yield this.axios.request(e),l=c.data,p={raw:c.data,status:c.status,statusText:c.statusText,headers:c.headers,data:l.data,meta:l.meta,errors:l.errors};if(l.errors)throw new k(null,p);return p}catch(t){if(!t||t instanceof Error==!1)throw t;if(ne.isAxiosError(t)){const e=null===(d=t.response)||void 0===d?void 0:d.data;throw new k(t,{raw:null===(h=t.response)||void 0===h?void 0:h.data,status:null===(c=t.response)||void 0===c?void 0:c.status,statusText:null===(l=t.response)||void 0===l?void 0:l.statusText,headers:null===(p=t.response)||void 0===p?void 0:p.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new k(t)}}))}get(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("get",t,void 0,r)}))}head(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("head",t,void 0,r)}))}options(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("options",t,void 0,r)}))}delete(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,n)}))}put(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,n)}))}post(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,n)}))}patch(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,n)}))}}class ie{constructor(t){this.transport=t}request(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/request",{email:t,reset_url:r})}))}reset(t,r){return e(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/reset",{token:t,password:r})}))}}class oe{constructor(t){this.func=t,this.debounced=[],this.debouncing=!1}debounce(...t){return e(this,void 0,void 0,(function*(){return this.debouncing?yield new Promise(((t,e)=>{this.debounced.push({resolve:e=>t(e),reject:t=>e(t)})})):(this.debouncing=!0,new Promise(((e,r)=>{this.func(...t).then((t=>{const n=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,n.forEach((e=>e.resolve(t)))})).catch((t=>{const n=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,n.forEach((e=>e.reject(t)))}))})))}))}}class ae{constructor(t,e,r){var n,s,i,o,a;this.options=r||{},this.options.mode=(null==r?void 0:r.mode)||("undefined"!=typeof window?"cookie":"json"),this.options.refresh=(null==r?void 0:r.refresh)||{auto:!1,time:3e4},this.options.refresh.auto=null!==(s=null===(n=this.options.refresh)||void 0===n?void 0:n.auto)&&void 0!==s&&s,this.options.refresh.time=null!==(o=null===(i=this.options.refresh)||void 0===i?void 0:i.time)&&void 0!==o?o:3e4,this.transport=t,this.storage=e,this.timer=!1,this.refresher=new oe(this.refreshToken.bind(this));try{this.updateRefresh(null===(a=this.options)||void 0===a?void 0:a.refresh)}catch(t){}}get token(){return this.storage.auth_token}get password(){return this.passwords=this.passwords||new ie(this.transport)}get expiring(){var t,e;const r=this.storage.auth_expires;if(null===r)return!1;return r-(null!==(e=null===(t=this.options.refresh)||void 0===t?void 0:t.time)&&void 0!==e?e:0)<=Date.now()}refreshToken(t=!1){var r;return e(this,void 0,void 0,(function*(){if(!t&&!this.expiring)return!1;const e=yield this.transport.post("/auth/refresh",{refresh_token:"json"===this.options.mode?this.storage.auth_refresh_token:void 0},{refreshTokenIfNeeded:!1});return this.updateStorage(e.data),this.updateRefresh(),{access_token:e.data.access_token,refresh_token:null===(r=e.data)||void 0===r?void 0:r.refresh_token,expires:e.data.expires}}))}updateStorage(t){var e;this.storage.auth_token=t.access_token,this.storage.auth_refresh_token=null!==(e=t.refresh_token)&&void 0!==e?e:null,t.expires?this.storage.auth_expires=Date.now()+t.expires:this.storage.auth_expires=null}updateRefresh(t){var e,r;const n=this.storage.auth_expires;if(null===n)return void clearTimeout(this.timer);t&&(this.options.refresh.auto=null!==(e=t.auto)&&void 0!==e?e:this.options.refresh.auto,this.options.refresh.time=null!==(r=t.time)&&void 0!==r?r:this.options.refresh.time),clearTimeout(this.timer);let s=n-this.options.refresh.time-Date.now();if(s<0){if(n<Date.now())return;s=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),s))}refresh(t=!1){return e(this,void 0,void 0,(function*(){return yield this.refresher.debounce(t)}))}login(t,r){var n;return e(this,void 0,void 0,(function*(){r=r||{};const e=yield this.transport.post("/auth/login",Object.assign({mode:this.options.mode},t),{refreshTokenIfNeeded:!1,sendAuthorizationHeaders:!1});return this.updateStorage(e.data),this.updateRefresh(r.refresh),{access_token:e.data.access_token,refresh_token:null===(n=e.data)||void 0===n?void 0:n.refresh_token,expires:e.data.expires}}))}static(t){return e(this,void 0,void 0,(function*(){return yield this.transport.get("/users/me",{params:{access_token:t}}),this.storage.auth_token=t,this.storage.auth_expires=null,this.storage.auth_refresh_token=null,!0}))}logout(){return e(this,void 0,void 0,(function*(){let t;"json"===this.options.mode&&(t=this.storage.auth_refresh_token||void 0),yield this.transport.post("/auth/logout",{refresh_token:t},{refreshTokenIfNeeded:!1}),this.storage.auth_token=null,this.storage.auth_expires=null,this.storage.auth_refresh_token=null,clearTimeout(this.timer)}))}}class ue{constructor(t){this.transport=t}request(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===n?{}:n})}))}items(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("/graphql",t,r)}))}system(t,r){return e(this,void 0,void 0,(function*(){return yield this.request("/graphql/system",t,r)}))}}t.ActivityHandler=s,t.Auth=ae,t.AxiosTransport=se,t.BaseStorage=O,t.CollectionsHandler=i,t.CommentsHandler=n,t.Directus=class{constructor(t,r){this._storage=(null==r?void 0:r.storage)||("undefined"!=typeof window?new S:new E),this._transport=(null==r?void 0:r.transport)||new se(t,this._storage,(()=>e(this,void 0,void 0,(function*(){yield this._auth.refresh()})))),this._auth=(null==r?void 0:r.auth)||new ae(this._transport,this._storage),this._items={},this._singletons={}}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new s(this.transport))}get collections(){return this._collections||(this._collections=new i(this.transport))}get fields(){return this._fields||(this._fields=new o(this.transport))}get files(){return this._files||(this._files=new a(this.transport))}get folders(){return this._folders||(this._folders=new u(this.transport))}get permissions(){return this._permissions||(this._permissions=new d(this.transport))}get presets(){return this._presets||(this._presets=new h(this.transport))}get relations(){return this._relations||(this._relations=new c(this.transport))}get revisions(){return this._revisions||(this._revisions=new l(this.transport))}get roles(){return this._roles||(this._roles=new p(this.transport))}get users(){return this._users||(this._users=new w(this.transport))}get settings(){return this._settings||(this._settings=new m(this.transport))}get server(){return this._server||(this._server=new f(this.transport))}get utils(){return this._utils||(this._utils=new b(this.transport))}get graphql(){return this._graphql||(this._graphql=new ue(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new v(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new r(t,this.transport))}},t.FieldsHandler=o,t.FilesHandler=a,t.FoldersHandler=u,t.ItemsHandler=r,t.LocalStorage=S,t.MemoryStorage=E,t.PermissionsHandler=d,t.PresetsHandler=h,t.RelationsHandler=c,t.RevisionsHandler=l,t.RolesHandler=p,t.ServerHandler=f,t.SettingsHandler=m,t.TransportError=k,t.UsersHandler=w,t.UtilsHandler=b,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function r(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((n=n.apply(t,e||[])).next())}))}class n{constructor(t,e){this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}readOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}/${encodeURI(t)}`,{params:e})).data}))}readMany(t){return r(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.get(`${this.endpoint}`,{params:t});return{data:e,meta:r}}))}createOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.post(`${this.endpoint}`,t,{params:e})).data}))}createMany(t,e){return r(this,void 0,void 0,(function*(){return yield this.transport.post(`${this.endpoint}`,t,{params:e})}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,e,{params:n})).data}))}updateMany(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:e},{params:n})}))}updateByQuery(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:e},{params:n})}))}deleteOne(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}/${encodeURI(t)}`)}))}deleteMany(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`${this.endpoint}`,t)}))}}class s{constructor(t){this.transport=t}create(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/activity/comment",t)).data}))}update(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/activity/comment/${encodeURI(t)}`,{comment:e})).data}))}delete(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/activity/comment/${encodeURI(t)}`)}))}}class i extends n{constructor(t){super("directus_activity",t),this._comments=new s(this.transport)}get comments(){return this._comments}}class o{constructor(t){this.transport=t}readOne(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/collections/${t}`)).data}))}readAll(){return r(this,void 0,void 0,(function*(){const{data:t,meta:e}=yield this.transport.get("/collections");return{data:t,meta:e}}))}createOne(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/collections",t)).data}))}createMany(t){return r(this,void 0,void 0,(function*(){const{data:e,meta:r}=yield this.transport.post("/collections",t);return{data:e,meta:r}}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,e,{params:n})).data}))}deleteOne(t){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/collections/${t}`)}))}}class a{constructor(t){this.transport=t}readOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}/${e}`)).data}))}readMany(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/fields/${t}`)).data}))}readAll(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/fields")).data}))}createOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.post(`/fields/${t}`,e)).data}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${e}`,n)).data}))}deleteOne(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/fields/${t}/${e}`)}))}}class u extends n{constructor(t){super("directus_files",t)}}class d extends n{constructor(t){super("directus_folders",t)}}class c extends n{constructor(t){super("directus_permissions",t)}}class h extends n{constructor(t){super("directus_presets",t)}}class l{constructor(t){this.transport=t}readOne(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}/${e}`)).data}))}readMany(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`/relations/${t}`)).data}))}readAll(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/relations")).data}))}createOne(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/relations",t)).data}))}updateOne(t,e,n){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${e}`,{params:n})).data}))}deleteOne(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.delete(`/relations/${t}/${e}`)}))}}class p extends n{constructor(t){super("directus_revisions",t)}}class f extends n{constructor(t){super("directus_roles",t)}}class v{constructor(t){this.transport=t}ping(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/ping")).raw}))}info(){return r(this,void 0,void 0,(function*(){return(yield this.transport.get("/server/info")).data}))}}class m{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}read(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.get(`${this.endpoint}`,{params:t})).data}))}update(t,e){return r(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}`,t,{params:e})).data}))}}class g extends m{constructor(t){super("directus_settings",t)}}class y{constructor(t){this.transport=t}send(t,e,n){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:e,invite_url:n})}))}accept(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite/accept",{token:t,password:e})}))}}class _{constructor(t){this.transport=t}generate(t){return r(this,void 0,void 0,(function*(){return(yield this.transport.post("/users/me/tfa/generate",{password:t})).data}))}enable(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/enable",{secret:t,otp:e})}))}disable(t){return r(this,void 0,void 0,(function*(){yield this.transport.post("/users/me/tfa/disable",{otp:t})}))}}class w{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new _(this._transport))}read(t){return r(this,void 0,void 0,(function*(){return(yield this._transport.get("/users/me",{params:t})).data}))}update(t,e){return r(this,void 0,void 0,(function*(){return(yield this._transport.patch("/users/me",t,{params:e})).data}))}}class b extends n{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new y(this.transport))}get me(){return this._me||(this._me=new w(this.transport))}}class x{constructor(t){this.random={string:(t=32)=>r(this,void 0,void 0,(function*(){return(yield this.transport.get("/utils/random/string",{params:{length:t}})).data}))},this.hash={generate:t=>r(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/generate",{string:t})).data})),verify:(t,e)=>r(this,void 0,void 0,(function*(){return(yield this.transport.post("/utils/hash/verify",{string:t,hash:e})).data}))},this.transport=t}sort(t,e,n){return r(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:e,to:n})}))}revert(t){return r(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var O;t.Meta=void 0,(O=t.Meta||(t.Meta={})).TOTAL_COUNT="total_count",O.FILTER_COUNT="filter_count";class k{}class S{}class E extends Error{constructor(t,e){var r,n;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(n=null==e?void 0:e.errors[0])||void 0===n?void 0:n.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,E.prototype)}}class R extends k{constructor(t){var e;super(),this.prefix=null!==(e=null==t?void 0:t.prefix)&&void 0!==e?e:""}get auth_token(){return this.get("auth_token")}set auth_token(t){null===t?this.delete("auth_token"):this.set("auth_token",t)}get auth_expires(){const t=this.get("auth_expires");return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete("auth_expires"):this.set("auth_expires",t.toString())}get auth_refresh_token(){return this.get("auth_refresh_token")}set auth_refresh_token(t){null===t?this.delete("auth_refresh_token"):this.set("auth_refresh_token",t)}}class j extends R{constructor(){super(...arguments),this.values={}}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}class T extends R{get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}var A={exports:{}},U=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},$=U,q=Object.prototype.toString;function C(t){return"[object Array]"===q.call(t)}function P(t){return void 0===t}function N(t){return null!==t&&"object"==typeof t}function B(t){if("[object Object]"!==q.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function L(t){return"[object Function]"===q.call(t)}function I(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),C(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}var H={isArray:C,isArrayBuffer:function(t){return"[object ArrayBuffer]"===q.call(t)},isBuffer:function(t){return null!==t&&!P(t)&&null!==t.constructor&&!P(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:N,isPlainObject:B,isUndefined:P,isDate:function(t){return"[object Date]"===q.call(t)},isFile:function(t){return"[object File]"===q.call(t)},isBlob:function(t){return"[object Blob]"===q.call(t)},isFunction:L,isStream:function(t){return N(t)&&L(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:I,merge:function t(){var e={};function r(r,n){B(e[n])&&B(r)?e[n]=t(e[n],r):B(r)?e[n]=t({},r):C(r)?e[n]=r.slice():e[n]=r}for(var n=0,s=arguments.length;n<s;n++)I(arguments[n],r);return e},extend:function(t,e,r){return I(e,(function(e,n){t[n]=r&&"function"==typeof e?$(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},M=H;function D(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var F=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if(M.isURLSearchParams(e))n=e.toString();else{var s=[];M.forEach(e,(function(t,e){null!=t&&(M.isArray(t)?e+="[]":t=[t],M.forEach(t,(function(t){M.isDate(t)?t=t.toISOString():M.isObject(t)&&(t=JSON.stringify(t)),s.push(D(e)+"="+D(t))})))})),n=s.join("&")}if(n){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},J=H;function z(){this.handlers=[]}z.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},z.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},z.prototype.forEach=function(t){J.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var W=z,V=H,X=function(t,e,r,n,s){return t.config=e,r&&(t.code=r),t.request=n,t.response=s,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},K=X,G=function(t,e,r,n,s){var i=new Error(t);return K(i,e,r,n,s)},Q=G,Y=H,Z=Y.isStandardBrowserEnv()?{write:function(t,e,r,n,s,i){var o=[];o.push(t+"="+encodeURIComponent(e)),Y.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&o.push("path="+n),Y.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},tt=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},et=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},rt=H,nt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],st=H,it=st.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=n(window.location.href),function(e){var r=st.isString(e)?n(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0};function ot(t){this.message=t}ot.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},ot.prototype.__CANCEL__=!0;var at=ot,ut=H,dt=function(t,e,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(Q("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},ct=Z,ht=F,lt=function(t,e){return t&&!tt(e)?et(t,e):e},pt=function(t){var e,r,n,s={};return t?(rt.forEach(t.split("\n"),(function(t){if(n=t.indexOf(":"),e=rt.trim(t.substr(0,n)).toLowerCase(),r=rt.trim(t.substr(n+1)),e){if(s[e]&&nt.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s},ft=it,vt=G,mt=Et,gt=at,yt=function(t){return new Promise((function(e,r){var n,s=t.data,i=t.headers,o=t.responseType;function a(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}ut.isFormData(s)&&delete i["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",c=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+c)}var h=lt(t.baseURL,t.url);function l(){if(u){var n="getAllResponseHeaders"in u?pt(u.getAllResponseHeaders()):null,s={data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u};dt((function(t){e(t),a()}),(function(t){r(t),a()}),s),u=null}}if(u.open(t.method.toUpperCase(),ht(h,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(r(vt("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(vt("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||mt.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(vt(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},ut.isStandardBrowserEnv()){var p=(t.withCredentials||ft(h))&&t.xsrfCookieName?ct.read(t.xsrfCookieName):void 0;p&&(i[t.xsrfHeaderName]=p)}"setRequestHeader"in u&&ut.forEach(i,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete i[e]:u.setRequestHeader(e,t)})),ut.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),o&&"json"!==o&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){u&&(r(!t||t&&t.type?new gt("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),s||(s=null),u.send(s)}))},_t=H,wt=function(t,e){V.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))},bt=X,xt={"Content-Type":"application/x-www-form-urlencoded"};function Ot(t,e){!_t.isUndefined(t)&&_t.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var kt,St={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(kt=yt),kt),transformRequest:[function(t,e){return wt(e,"Accept"),wt(e,"Content-Type"),_t.isFormData(t)||_t.isArrayBuffer(t)||_t.isBuffer(t)||_t.isStream(t)||_t.isFile(t)||_t.isBlob(t)?t:_t.isArrayBufferView(t)?t.buffer:_t.isURLSearchParams(t)?(Ot(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):_t.isObject(t)||e&&"application/json"===e["Content-Type"]?(Ot(e,"application/json"),function(t,e,r){if(_t.isString(t))try{return(e||JSON.parse)(t),_t.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||St.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||n&&_t.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw bt(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};_t.forEach(["delete","get","head"],(function(t){St.headers[t]={}})),_t.forEach(["post","put","patch"],(function(t){St.headers[t]=_t.merge(xt)}));var Et=St,Rt=H,jt=Et,Tt=function(t){return!(!t||!t.__CANCEL__)},At=H,Ut=function(t,e,r){var n=this||jt;return Rt.forEach(r,(function(r){t=r.call(n,t,e)})),t},$t=Tt,qt=Et,Ct=at;function Pt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ct("canceled")}var Nt=H,Bt=function(t,e){e=e||{};var r={};function n(t,e){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge(t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function s(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(t[r],e[r])}function i(t){if(!Nt.isUndefined(e[t]))return n(void 0,e[t])}function o(r){return Nt.isUndefined(e[r])?Nt.isUndefined(t[r])?void 0:n(void 0,t[r]):n(void 0,e[r])}function a(r){return r in e?n(t[r],e[r]):r in t?n(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return Nt.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||s,n=e(t);Nt.isUndefined(n)&&e!==a||(r[t]=n)})),r},Lt="0.24.0",It=Lt,Ht={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Ht[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var Mt={};Ht.transitional=function(t,e,r){function n(t,e){return"[Axios v"+It+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,s,i){if(!1===t)throw new Error(n(s," has been removed"+(e?" in "+e:"")));return e&&!Mt[s]&&(Mt[s]=!0,console.warn(n(s," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,s,i)}};var Dt={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:Ht},Ft=H,Jt=F,zt=W,Wt=function(t){return Pt(t),t.headers=t.headers||{},t.data=Ut.call(t,t.data,t.headers,t.transformRequest),t.headers=At.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),At.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||qt.adapter)(t).then((function(e){return Pt(t),e.data=Ut.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return $t(e)||(Pt(t),e&&e.response&&(e.response.data=Ut.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Vt=Bt,Xt=Dt,Kt=Xt.validators;function Gt(t){this.defaults=t,this.interceptors={request:new zt,response:new zt}}Gt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=Vt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&Xt.assertOptions(e,{silentJSONParsing:Kt.transitional(Kt.boolean),forcedJSONParsing:Kt.transitional(Kt.boolean),clarifyTimeoutError:Kt.transitional(Kt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!n){var o=[Wt,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{s=Wt(a)}catch(t){return Promise.reject(t)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},Gt.prototype.getUri=function(t){return t=Vt(this.defaults,t),Jt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Ft.forEach(["delete","get","head","options"],(function(t){Gt.prototype[t]=function(e,r){return this.request(Vt(r||{},{method:t,url:e,data:(r||{}).data}))}})),Ft.forEach(["post","put","patch"],(function(t){Gt.prototype[t]=function(e,r,n){return this.request(Vt(n||{},{method:t,url:e,data:r}))}}));var Qt=Gt,Yt=at;function Zt(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,n=r._listeners.length;for(e=0;e<n;e++)r._listeners[e](t);r._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t){r.reason||(r.reason=new Yt(t),e(r.reason))}))}Zt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Zt.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Zt.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Zt.source=function(){var t;return{token:new Zt((function(e){t=e})),cancel:t}};var te=Zt,ee=H,re=U,ne=Qt,se=Bt;var ie=function t(e){var r=new ne(e),n=re(ne.prototype.request,r);return ee.extend(n,ne.prototype,r),ee.extend(n,r),n.create=function(r){return t(se(e,r))},n}(Et);ie.Axios=ne,ie.Cancel=at,ie.CancelToken=te,ie.isCancel=Tt,ie.VERSION=Lt,ie.all=function(t){return Promise.all(t)},ie.spread=function(t){return function(e){return t.apply(null,e)}},ie.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},A.exports=ie,A.exports.default=ie;var oe=A.exports;class ae extends S{constructor(t){var e;super(),this.config=t,this.axios=oe.create({baseURL:this.config.url,params:this.config.params,headers:this.config.headers,onUploadProgress:this.config.onUploadProgress,withCredentials:!0}),(null===(e=this.config)||void 0===e?void 0:e.beforeRequest)&&(this.beforeRequest=this.config.beforeRequest)}beforeRequest(t){return t}get url(){return this.config.url}request(t,e,n,s){var i,o,a,u,d;return r(this,void 0,void 0,(function*(){try{let r={method:t,url:e,data:n,params:null==s?void 0:s.params,headers:null==s?void 0:s.headers,onUploadProgress:null==s?void 0:s.onUploadProgress};r=this.beforeRequest(r);const i=yield this.axios.request(r),o={raw:i.data,status:i.status,statusText:i.statusText,headers:i.headers,data:i.data.data,meta:i.data.meta,errors:i.data.errors};if(i.data.errors)throw new E(null,o);return o}catch(t){if(!t||t instanceof Error==!1)throw t;if(oe.isAxiosError(t)){const e=null===(i=t.response)||void 0===i?void 0:i.data;throw new E(t,{raw:null===(o=t.response)||void 0===o?void 0:o.data,status:null===(a=t.response)||void 0===a?void 0:a.status,statusText:null===(u=t.response)||void 0===u?void 0:u.statusText,headers:null===(d=t.response)||void 0===d?void 0:d.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new E(t)}}))}get(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("get",t,void 0,e)}))}head(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("head",t,void 0,e)}))}options(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("options",t,void 0,e)}))}delete(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("delete",t,e,n)}))}put(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("put",t,e,n)}))}post(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("post",t,e,n)}))}patch(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.request("patch",t,e,n)}))}}class ue{constructor(t){this.transport=t}request(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/request",{email:t,reset_url:e})}))}reset(t,e){return r(this,void 0,void 0,(function*(){yield this.transport.post("/auth/password/reset",{token:t,password:e})}))}}class de extends e{constructor(t){var e,r,n;super(),this.autoRefresh=!0,this.msRefreshBeforeExpires=3e4,this.staticToken="",this._transport=t.transport,this._storage=t.storage,this.autoRefresh=null!==(e=null==t?void 0:t.autoRefresh)&&void 0!==e?e:this.autoRefresh,this.mode=null!==(r=null==t?void 0:t.mode)&&void 0!==r?r:this.mode,this.msRefreshBeforeExpires=null!==(n=null==t?void 0:t.msRefreshBeforeExpires)&&void 0!==n?n:this.msRefreshBeforeExpires,(null==t?void 0:t.staticToken)&&(this.staticToken=null==t?void 0:t.staticToken,this.updateStorage({access_token:this.staticToken,expires:null,refresh_token:null})),this.timer=!1}get storage(){return this._storage}get transport(){return this._transport}get token(){return this._storage.auth_token}get password(){return this.passwords=this.passwords||new ue(this._transport)}updateStorage(t){var e,r;this._storage.auth_token=t.access_token,this._storage.auth_refresh_token=null!==(e=t.refresh_token)&&void 0!==e?e:null,this._storage.auth_expires=null!==(r=t.expires)&&void 0!==r?r:null}autoRefreshJob(){if(!this.autoRefresh)return;if(!this._storage.auth_expires)return;const t=this._storage.auth_expires-this.msRefreshBeforeExpires;this.timer=setTimeout((()=>r(this,void 0,void 0,(function*(){yield this.refresh().catch((()=>{})),this.autoRefreshJob()}))),t)}refresh(){var t;return r(this,void 0,void 0,(function*(){const e=yield this._transport.post("/auth/refresh",{refresh_token:"json"===this.mode?this._storage.auth_refresh_token:void 0});return this.updateStorage(e.data),{access_token:e.data.access_token,refresh_token:null===(t=e.data)||void 0===t?void 0:t.refresh_token,expires:e.data.expires}}))}login(t){var e;return r(this,void 0,void 0,(function*(){const r=yield this._transport.post("/auth/login",Object.assign({mode:this.mode},t),{headers:{Authorization:null}});return this.updateStorage(r.data),this.autoRefresh&&this.autoRefreshJob(),{access_token:r.data.access_token,refresh_token:null===(e=r.data)||void 0===e?void 0:e.refresh_token,expires:r.data.expires}}))}static(t){return r(this,void 0,void 0,(function*(){return yield this._transport.get("/users/me",{params:{access_token:t},headers:{Authorization:null}}),this.updateStorage({access_token:t,expires:null,refresh_token:null}),!0}))}logout(){return r(this,void 0,void 0,(function*(){let t;"json"===this.mode&&(t=this._storage.auth_refresh_token||void 0),yield this._transport.post("/auth/logout",{refresh_token:t}),this.updateStorage({access_token:null,expires:null,refresh_token:null}),clearTimeout(this.timer)}))}}class ce{constructor(t){this.transport=t}request(t,e,n){return r(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:e,variables:void 0===n?{}:n})}))}items(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("/graphql",t,e)}))}system(t,e){return r(this,void 0,void 0,(function*(){return yield this.request("/graphql/system",t,e)}))}}t.ActivityHandler=i,t.Auth=de,t.BaseStorage=R,t.CollectionsHandler=o,t.CommentsHandler=s,t.Directus=class{constructor(t,r){var n,s,i,o,a,u,d,c;if(this._url=t,this._options=r,this._items={},this._singletons={},(null===(n=this._options)||void 0===n?void 0:n.storage)&&(null===(s=this._options)||void 0===s?void 0:s.storage)instanceof k)this._storage=this._options.storage;else{const t=null===(i=this._options)||void 0===i?void 0:i.storage,e=null!=t?t:{},{mode:r}=e,n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]])}return r}(e,["mode"]);"MemoryStorage"===r||"undefined"==typeof window?this._storage=new j(n):this._storage=new T(n)}(null===(o=this._options)||void 0===o?void 0:o.transport)&&(null===(a=this._options)||void 0===a?void 0:a.transport)instanceof S?this._transport=this._options.transport:this._transport=new ae({url:this.url,beforeRequest:t=>{const e=this.storage.auth_token,r=e?e.startsWith("Bearer ")?String(this.storage.auth_token):`Bearer ${this.storage.auth_token}`:"";return Object.assign(Object.assign({},t),{headers:Object.assign({Authorization:r},t.headers)})}}),(null===(u=this._options)||void 0===u?void 0:u.auth)&&(null===(d=this._options)||void 0===d?void 0:d.auth)instanceof e?this._auth=this._options.auth:this._auth=new de(Object.assign({transport:this._transport,storage:this._storage},null===(c=this._options)||void 0===c?void 0:c.auth))}get url(){return this._url}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new i(this.transport))}get collections(){return this._collections||(this._collections=new o(this.transport))}get fields(){return this._fields||(this._fields=new a(this.transport))}get files(){return this._files||(this._files=new u(this.transport))}get folders(){return this._folders||(this._folders=new d(this.transport))}get permissions(){return this._permissions||(this._permissions=new c(this.transport))}get presets(){return this._presets||(this._presets=new h(this.transport))}get relations(){return this._relations||(this._relations=new l(this.transport))}get revisions(){return this._revisions||(this._revisions=new p(this.transport))}get roles(){return this._roles||(this._roles=new f(this.transport))}get users(){return this._users||(this._users=new b(this.transport))}get settings(){return this._settings||(this._settings=new g(this.transport))}get server(){return this._server||(this._server=new v(this.transport))}get utils(){return this._utils||(this._utils=new x(this.transport))}get graphql(){return this._graphql||(this._graphql=new ce(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new m(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new n(t,this.transport))}},t.FieldsHandler=a,t.FilesHandler=u,t.FoldersHandler=d,t.IAuth=e,t.IStorage=k,t.ITransport=S,t.ItemsHandler=n,t.LocalStorage=T,t.MemoryStorage=j,t.PermissionsHandler=c,t.PresetsHandler=h,t.RelationsHandler=l,t.RevisionsHandler=p,t.RolesHandler=f,t.ServerHandler=v,t.SettingsHandler=g,t.Transport=ae,t.TransportError=E,t.UsersHandler=b,t.UtilsHandler=x,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=sdk.umd.min.js.map |
@@ -1,9 +0,9 @@ | ||
export interface IStorage { | ||
auth_token: string | null; | ||
auth_expires: number | null; | ||
auth_refresh_token: string | null; | ||
get(key: string): string | null; | ||
set(key: string, value: string): string; | ||
delete(key: string): string | null; | ||
export declare abstract class IStorage { | ||
abstract auth_token: string | null; | ||
abstract auth_expires: number | null; | ||
abstract auth_refresh_token: string | null; | ||
abstract get(key: string): string | null; | ||
abstract set(key: string, value: string): string; | ||
abstract delete(key: string): string | null; | ||
} | ||
//# sourceMappingURL=storage.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IStorage = void 0; | ||
class IStorage { | ||
} | ||
exports.IStorage = IStorage; |
@@ -0,1 +1,2 @@ | ||
import { AxiosRequestConfig } from 'axios'; | ||
import { ItemMetadata } from './items'; | ||
@@ -18,18 +19,19 @@ export declare type TransportErrorDescription = { | ||
export declare type TransportMethods = 'get' | 'delete' | 'head' | 'options' | 'post' | 'put' | 'patch'; | ||
export declare type TransportOptions = { | ||
export declare type TransportRequestOptions = { | ||
params?: any; | ||
headers?: any; | ||
refreshTokenIfNeeded?: boolean; | ||
sendAuthorizationHeaders?: boolean; | ||
onUploadProgress?: ((progressEvent: any) => void) | undefined; | ||
}; | ||
export interface ITransport { | ||
export declare type TransportOptions = TransportRequestOptions & { | ||
url: string; | ||
get<T = any, R = any>(path: string, options?: TransportOptions): Promise<TransportResponse<T, R>>; | ||
head<T = any, R = any>(path: string, options?: TransportOptions): Promise<TransportResponse<T, R>>; | ||
options<T = any, R = any>(path: string, options?: TransportOptions): Promise<TransportResponse<T, R>>; | ||
delete<T = any, P = any, R = any>(path: string, data?: P, options?: TransportOptions): Promise<TransportResponse<T, R>>; | ||
post<T = any, P = any, R = any>(path: string, data?: P, options?: TransportOptions): Promise<TransportResponse<T, R>>; | ||
put<T = any, P = any, R = any>(path: string, data?: P, options?: TransportOptions): Promise<TransportResponse<T, R>>; | ||
patch<T = any, P = any, R = any>(path: string, data?: P, options?: TransportOptions): Promise<TransportResponse<T, R>>; | ||
beforeRequest?: (config: AxiosRequestConfig) => AxiosRequestConfig; | ||
}; | ||
export declare abstract class ITransport { | ||
abstract get<T = any, R = any>(path: string, options?: TransportRequestOptions): Promise<TransportResponse<T, R>>; | ||
abstract head<T = any, R = any>(path: string, options?: TransportRequestOptions): Promise<TransportResponse<T, R>>; | ||
abstract options<T = any, R = any>(path: string, options?: TransportRequestOptions): Promise<TransportResponse<T, R>>; | ||
abstract delete<T = any, P = any, R = any>(path: string, data?: P, options?: TransportRequestOptions): Promise<TransportResponse<T, R>>; | ||
abstract post<T = any, P = any, R = any>(path: string, data?: P, options?: TransportRequestOptions): Promise<TransportResponse<T, R>>; | ||
abstract put<T = any, P = any, R = any>(path: string, data?: P, options?: TransportRequestOptions): Promise<TransportResponse<T, R>>; | ||
abstract patch<T = any, P = any, R = any>(path: string, data?: P, options?: TransportRequestOptions): Promise<TransportResponse<T, R>>; | ||
} | ||
@@ -36,0 +38,0 @@ export declare class TransportError<T = any, R = any> extends Error { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TransportError = void 0; | ||
exports.TransportError = exports.ITransport = void 0; | ||
class ITransport { | ||
} | ||
exports.ITransport = ITransport; | ||
class TransportError extends Error { | ||
@@ -5,0 +8,0 @@ constructor(parent, response) { |
@@ -10,2 +10,4 @@ export declare type ID = string | number; | ||
export declare type TypeOf<T extends TypeMap, K extends keyof T> = T[K] extends undefined ? DefaultType : T[K]; | ||
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
export declare type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; | ||
export declare type ActivityType = SystemType<{ | ||
@@ -12,0 +14,0 @@ action: string; |
{ | ||
"name": "@directus/sdk", | ||
"version": "9.0.0-rc.101", | ||
"version": "9.0.0", | ||
"description": "The official Directus SDK for use in JavaScript!", | ||
@@ -12,3 +12,6 @@ "repository": { | ||
".": { | ||
"import": "./dist/sdk.esm.js", | ||
"import": { | ||
"node": "./index.mjs", | ||
"default": "./dist/sdk.esm.js" | ||
}, | ||
"require": "./dist/index.js" | ||
@@ -74,3 +77,3 @@ }, | ||
}, | ||
"gitHead": "37cf80e0fe1320610ffc0b4da9411ef51bd46afb" | ||
"gitHead": "c95add08ef1386cab6e54546f03d541d889148ed" | ||
} |
@@ -14,3 +14,3 @@ # Directus JS SDK | ||
const directus = new Directus('https://api.example.com/'); | ||
const directus = new Directus('http://directus.example.com'); | ||
@@ -24,3 +24,3 @@ const items = await directus.items('articles').readOne(15); | ||
const directus = new Directus('https://api.example.com/'); | ||
const directus = new Directus('http://directus.example.com'); | ||
@@ -27,0 +27,0 @@ directus |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
1455881
139
12845