@directus/sdk
Advanced tools
Comparing version 9.0.0-rc.92 to 9.0.0-rc.93
@@ -24,3 +24,3 @@ import { ID } from './types'; | ||
search?: string; | ||
deep?: Record<string, QueryMany<T>>; | ||
deep?: Record<string, DeepQueryMany<T>>; | ||
export?: 'json' | 'csv' | 'xml'; | ||
@@ -36,2 +36,5 @@ filter?: Filter<T>; | ||
}; | ||
export declare type DeepQueryMany<T> = { | ||
[K in keyof QueryMany<T> as `_${string & K}`]: QueryMany<T>[K]; | ||
}; | ||
export declare type Sort<T> = (`${Extract<keyof T, string>}` | `-${Extract<keyof T, string>}`)[]; | ||
@@ -38,0 +41,0 @@ export declare type FilterOperators = '_eq' | '_neq' | '_contains' | '_ncontains' | '_in' | '_nin' | '_gt' | '_gte' | '_lt' | '_lte' | '_null' | '_nnull' | '_empty' | '_nempty'; |
@@ -15,3 +15,3 @@ /*! ***************************************************************************** | ||
***************************************************************************** */ | ||
function t(t,e,r,s){return new(r||(r=Promise))((function(n,i){function o(t){try{u(s.next(t))}catch(t){i(t)}}function a(t){try{u(s.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((s=s.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,s){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(e)}`,r,{params:s})).data}))}updateMany(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:e,data:r},{params:s})}))}updateByQuery(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:e,data:r},{params:s})}))}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 s extends e{constructor(t){super("directus_activity",t),this._comments=new r(this.transport)}get comments(){return this._comments}}class n{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,s){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${e}`,r,{params:s})).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,s){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${e}/${r}`,s)).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,s){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${e}/${r}`,{params:s})).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,s){return t(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:e,role:r,invite_url:s})}))}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,s){return t(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(e)}`,{item:r,to:s})}))}revert(e){return t(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(e)}`)}))}}var x;!function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(x||(x={}));class b extends Error{constructor(t,e){var r,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.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,b.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 j={exports:{}},R=function(t,e){return function(){for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},$=R,T=Object.prototype.toString;function A(t){return"[object Array]"===T.call(t)}function S(t){return void 0===t}function q(t){return null!==t&&"object"==typeof t}function U(t){if("[object Object]"!==T.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function C(t){return"[object Function]"===T.call(t)}function N(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),A(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var P={isArray:A,isArrayBuffer:function(t){return"[object ArrayBuffer]"===T.call(t)},isBuffer:function(t){return null!==t&&!S(t)&&null!==t.constructor&&!S(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:q,isPlainObject:U,isUndefined:S,isDate:function(t){return"[object Date]"===T.call(t)},isFile:function(t){return"[object File]"===T.call(t)},isBlob:function(t){return"[object Blob]"===T.call(t)},isFunction:C,isStream:function(t){return q(t)&&C(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:N,merge:function t(){var e={};function r(r,s){U(e[s])&&U(r)?e[s]=t(e[s],r):U(r)?e[s]=t({},r):A(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)N(arguments[s],r);return e},extend:function(t,e,r){return N(e,(function(e,s){t[s]=r&&"function"==typeof e?$(e,r):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")},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 s;if(r)s=r(e);else if(B.isURLSearchParams(e))s=e.toString();else{var n=[];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)),n.push(L(e)+"="+L(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t},D=P;function z(){this.handlers=[]}z.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},z.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},z.prototype.forEach=function(t){D.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var M=z,F=P,H=function(t){return!(!t||!t.__CANCEL__)},X=P,J=function(t,e,r,s,n){return t.config=e,r&&(t.code=r),t.request=s,t.response=n,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}},t},V=function(t,e,r,s,n){var i=new Error(t);return J(i,e,r,s,n)},W=V,K=P,G=K.isStandardBrowserEnv()?{write:function(t,e,r,s,n,i){var o=[];o.push(t+"="+encodeURIComponent(e)),K.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),K.isString(s)&&o.push("path="+s),K.isString(n)&&o.push("domain="+n),!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=P,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=P,rt=et.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function s(t){var s=t;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{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=s(window.location.href),function(e){var r=et.isString(e)?s(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},st=P,nt=function(t,e,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?e(W("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},it=G,ot=I,at=function(t,e){return t&&!Q(e)?Y(t,e):e},ut=function(t){var e,r,s,n={};return t?(Z.forEach(t.split("\n"),(function(t){if(s=t.indexOf(":"),e=Z.trim(t.substr(0,s)).toLowerCase(),r=Z.trim(t.substr(s+1)),e){if(n[e]&&tt.indexOf(e)>=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},dt=rt,ht=V,ct=function(t){return new Promise((function(e,r){var s=t.data,n=t.headers;st.isFormData(s)&&delete n["Content-Type"];var i=new XMLHttpRequest;if(t.auth){var o=t.auth.username||"",a=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.Authorization="Basic "+btoa(o+":"+a)}var u=at(t.baseURL,t.url);if(i.open(t.method.toUpperCase(),ot(u,t.params,t.paramsSerializer),!0),i.timeout=t.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var s="getAllResponseHeaders"in i?ut(i.getAllResponseHeaders()):null,n={data:t.responseType&&"text"!==t.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:s,config:t,request:i};nt(e,r,n),i=null}},i.onabort=function(){i&&(r(ht("Request aborted",t,"ECONNABORTED",i)),i=null)},i.onerror=function(){r(ht("Network Error",t,null,i)),i=null},i.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(ht(e,t,"ECONNABORTED",i)),i=null},st.isStandardBrowserEnv()){var d=(t.withCredentials||dt(u))&&t.xsrfCookieName?it.read(t.xsrfCookieName):void 0;d&&(n[t.xsrfHeaderName]=d)}if("setRequestHeader"in i&&st.forEach(n,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete n[e]:i.setRequestHeader(e,t)})),st.isUndefined(t.withCredentials)||(i.withCredentials=!!t.withCredentials),t.responseType)try{i.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&i.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){i&&(i.abort(),r(t),i=null)})),s||(s=null),i.send(s)}))},lt=P,pt=function(t,e){X.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},ft={"Content-Type":"application/x-www-form-urlencoded"};function vt(t,e){!lt.isUndefined(t)&<.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var mt,gt={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(mt=ct),mt),transformRequest:[function(t,e){return pt(e,"Accept"),pt(e,"Content-Type"),lt.isFormData(t)||lt.isArrayBuffer(t)||lt.isBuffer(t)||lt.isStream(t)||lt.isFile(t)||lt.isBlob(t)?t:lt.isArrayBufferView(t)?t.buffer:lt.isURLSearchParams(t)?(vt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):lt.isObject(t)?(vt(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};gt.headers={common:{Accept:"application/json, text/plain, */*"}},lt.forEach(["delete","get","head"],(function(t){gt.headers[t]={}})),lt.forEach(["post","put","patch"],(function(t){gt.headers[t]=lt.merge(ft)}));var yt=gt,_t=P,wt=function(t,e,r){return F.forEach(r,(function(r){t=r(t,e)})),t},xt=H,bt=yt;function kt(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var Ot=P,Et=function(t,e){e=e||{};var r={},s=["url","method","data"],n=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function a(t,e){return Ot.isPlainObject(t)&&Ot.isPlainObject(e)?Ot.merge(t,e):Ot.isPlainObject(e)?Ot.merge({},e):Ot.isArray(e)?e.slice():e}function u(s){Ot.isUndefined(e[s])?Ot.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Ot.forEach(s,(function(t){Ot.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Ot.forEach(n,u),Ot.forEach(i,(function(s){Ot.isUndefined(e[s])?Ot.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Ot.forEach(o,(function(s){s in e?r[s]=a(t[s],e[s]):s in t&&(r[s]=a(void 0,t[s]))}));var d=s.concat(n).concat(i).concat(o),h=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===d.indexOf(t)}));return Ot.forEach(h,u),r},jt=P,Rt=I,$t=M,Tt=function(t){return kt(t),t.headers=t.headers||{},t.data=wt(t.data,t.headers,t.transformRequest),t.headers=_t.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),_t.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||bt.adapter)(t).then((function(e){return kt(t),e.data=wt(e.data,e.headers,t.transformResponse),e}),(function(e){return xt(e)||(kt(t),e&&e.response&&(e.response.data=wt(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},At=Et;function St(t){this.defaults=t,this.interceptors={request:new $t,response:new $t}}St.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=At(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[Tt,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)r=r.then(e.shift(),e.shift());return r},St.prototype.getUri=function(t){return t=At(this.defaults,t),Rt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},jt.forEach(["delete","get","head","options"],(function(t){St.prototype[t]=function(e,r){return this.request(At(r||{},{method:t,url:e,data:(r||{}).data}))}})),jt.forEach(["post","put","patch"],(function(t){St.prototype[t]=function(e,r,s){return this.request(At(s||{},{method:t,url:e,data:r}))}}));var qt=St;function Ut(t){this.message=t}Ut.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ut.prototype.__CANCEL__=!0;var Ct=Ut,Nt=Ct;function Pt(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;t((function(t){r.reason||(r.reason=new Nt(t),e(r.reason))}))}Pt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Pt.source=function(){var t;return{token:new Pt((function(e){t=e})),cancel:t}};var Bt=Pt,Lt=P,It=R,Dt=qt,zt=Et;function Mt(t){var e=new Dt(t),r=It(Dt.prototype.request,e);return Lt.extend(r,Dt.prototype,e),Lt.extend(r,e),r}var Ft=Mt(yt);Ft.Axios=Dt,Ft.create=function(t){return Mt(zt(Ft.defaults,t))},Ft.Cancel=Ct,Ft.CancelToken=Bt,Ft.isCancel=H,Ft.all=function(t){return Promise.all(t)},Ft.spread=function(t){return function(e){return t.apply(null,e)}},Ft.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},j.exports=Ft,j.exports.default=Ft;var Ht=j.exports;class Xt{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=Ht.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,s,n){var i,o,a,u,d,h,c,l,p;return t(this,void 0,void 0,(function*(){try{(n=n||{}).sendAuthorizationHeaders=null===(i=n.sendAuthorizationHeaders)||void 0===i||i,n.refreshTokenIfNeeded=null===(o=n.refreshTokenIfNeeded)||void 0===o||o,n.headers=null!==(a=n.headers)&&void 0!==a?a:{},n.onUploadProgress=null!==(u=n.onUploadProgress)&&void 0!==u?u:void 0,n.refreshTokenIfNeeded&&(yield this._refresh());const t={method:e,url:r,data:s,params:n.params,headers:n.headers,onUploadProgress:n.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;n.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 b(null,p);return p}catch(t){if(!t||t instanceof Error==!1)throw t;if(Ht.isAxiosError(t)){const e=null===(d=t.response)||void 0===d?void 0:d.data;throw new b(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 b(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,s){return t(this,void 0,void 0,(function*(){return yield this.request("delete",e,r,s)}))}put(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.request("put",e,r,s)}))}post(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.request("post",e,r,s)}))}patch(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.request("patch",e,r,s)}))}}class Jt{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 Vt{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 s=[{resolve:t,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((t=>t.resolve(e)))})).catch((e=>{const s=[{resolve:t,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((t=>t.reject(e)))}))})))}))}}class Wt{constructor(t,e,r){var s,n,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!==(n=null===(s=this.options.refresh)||void 0===s?void 0:s.auto)&&void 0!==n&&n,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 Vt(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 Jt(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 s=this.storage.auth_expires;if(null===s)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 n=s-this.options.refresh.time-Date.now();if(n<0){if(s<Date.now())return;n=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),n))}refresh(e=!1){return t(this,void 0,void 0,(function*(){return yield this.refresher.debounce(e)}))}login(e,r){var s;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===(s=t.data)||void 0===s?void 0:s.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 Kt{constructor(t){this.transport=t}request(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.transport.post(e,{query:r,variables:void 0===s?{}:s})}))}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 Gt{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 Xt(e,this._storage,(()=>t(this,void 0,void 0,(function*(){yield this._auth.refresh()})))),this._auth=(null==r?void 0:r.auth)||new Wt(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 n(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 Kt(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{s as ActivityHandler,Wt as Auth,Xt as AxiosTransport,k as BaseStorage,n as CollectionsHandler,r as CommentsHandler,Gt as Directus,i as FieldsHandler,o as FilesHandler,a as FoldersHandler,e as ItemsHandler,E as LocalStorage,O as MemoryStorage,x as Meta,u as PermissionsHandler,d as PresetsHandler,h as RelationsHandler,c as RevisionsHandler,l as RolesHandler,p as ServerHandler,v as SettingsHandler,b as TransportError,_ as UsersHandler,w as UtilsHandler}; | ||
function t(t,e,r,s){return new(r||(r=Promise))((function(n,i){function o(t){try{u(s.next(t))}catch(t){i(t)}}function a(t){try{u(s.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((s=s.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,s){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(e)}`,r,{params:s})).data}))}updateMany(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:e,data:r},{params:s})}))}updateByQuery(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:e,data:r},{params:s})}))}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 s extends e{constructor(t){super("directus_activity",t),this._comments=new r(this.transport)}get comments(){return this._comments}}class n{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,s){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${e}`,r,{params:s})).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,s){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${e}/${r}`,s)).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,s){return t(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${e}/${r}`,{params:s})).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,s){return t(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:e,role:r,invite_url:s})}))}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,s){return t(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(e)}`,{item:r,to:s})}))}revert(e){return t(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(e)}`)}))}}var x;!function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(x||(x={}));class b extends Error{constructor(t,e){var r,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.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,b.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 j 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 O 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 E={exports:{}},T=function(t,e){return function(){for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},S=T,A=Object.prototype.toString;function R(t){return"[object Array]"===A.call(t)}function N(t){return void 0===t}function $(t){return null!==t&&"object"==typeof t}function U(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 C(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),R(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var P={isArray:R,isArrayBuffer:function(t){return"[object ArrayBuffer]"===A.call(t)},isBuffer:function(t){return null!==t&&!N(t)&&null!==t.constructor&&!N(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:$,isPlainObject:U,isUndefined:N,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 $(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,s){U(e[s])&&U(r)?e[s]=t(e[s],r):U(r)?e[s]=t({},r):R(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)C(arguments[s],r);return e},extend:function(t,e,r){return C(e,(function(e,s){t[s]=r&&"function"==typeof e?S(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 I(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var L=function(t,e,r){if(!e)return t;var s;if(r)s=r(e);else if(B.isURLSearchParams(e))s=e.toString();else{var n=[];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)),n.push(I(e)+"="+I(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}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,H=P,F=function(t,e,r,s,n){return t.config=e,r&&(t.code=r),t.request=s,t.response=n,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}},t},J=F,W=function(t,e,r,s,n){var i=new Error(t);return J(i,e,r,s,n)},V=W,X=P,G=X.isStandardBrowserEnv()?{write:function(t,e,r,s,n,i){var o=[];o.push(t+"="+encodeURIComponent(e)),X.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),X.isString(s)&&o.push("path="+s),X.isString(n)&&o.push("domain="+n),!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(){}},K=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},Q=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Z=P,Y=["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 s(t){var s=t;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{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=s(window.location.href),function(e){var r=tt.isString(e)?s(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},rt=P,st=function(t,e,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?e(V("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},nt=G,it=L,ot=function(t,e){return t&&!K(e)?Q(t,e):e},at=function(t){var e,r,s,n={};return t?(Z.forEach(t.split("\n"),(function(t){if(s=t.indexOf(":"),e=Z.trim(t.substr(0,s)).toLowerCase(),r=Z.trim(t.substr(s+1)),e){if(n[e]&&Y.indexOf(e)>=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},ut=et,dt=W,ht=function(t){return new Promise((function(e,r){var s=t.data,n=t.headers,i=t.responseType;rt.isFormData(s)&&delete n["Content-Type"];var o=new XMLHttpRequest;if(t.auth){var a=t.auth.username||"",u=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.Authorization="Basic "+btoa(a+":"+u)}var d=ot(t.baseURL,t.url);function h(){if(o){var s="getAllResponseHeaders"in o?at(o.getAllResponseHeaders()):null,n={data:i&&"text"!==i&&"json"!==i?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:s,config:t,request:o};st(e,r,n),o=null}}if(o.open(t.method.toUpperCase(),it(d,t.params,t.paramsSerializer),!0),o.timeout=t.timeout,"onloadend"in o?o.onloadend=h:o.onreadystatechange=function(){o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))&&setTimeout(h)},o.onabort=function(){o&&(r(dt("Request aborted",t,"ECONNABORTED",o)),o=null)},o.onerror=function(){r(dt("Network Error",t,null,o)),o=null},o.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(dt(e,t,t.transitional&&t.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},rt.isStandardBrowserEnv()){var c=(t.withCredentials||ut(d))&&t.xsrfCookieName?nt.read(t.xsrfCookieName):void 0;c&&(n[t.xsrfHeaderName]=c)}"setRequestHeader"in o&&rt.forEach(n,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete n[e]:o.setRequestHeader(e,t)})),rt.isUndefined(t.withCredentials)||(o.withCredentials=!!t.withCredentials),i&&"json"!==i&&(o.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&o.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){o&&(o.abort(),r(t),o=null)})),s||(s=null),o.send(s)}))},ct=P,lt=function(t,e){H.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},pt=F,ft={"Content-Type":"application/x-www-form-urlencoded"};function vt(t,e){!ct.isUndefined(t)&&ct.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var mt,gt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(mt=ht),mt),transformRequest:[function(t,e){return lt(e,"Accept"),lt(e,"Content-Type"),ct.isFormData(t)||ct.isArrayBuffer(t)||ct.isBuffer(t)||ct.isStream(t)||ct.isFile(t)||ct.isBlob(t)?t:ct.isArrayBufferView(t)?t.buffer:ct.isURLSearchParams(t)?(vt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):ct.isObject(t)||e&&"application/json"===e["Content-Type"]?(vt(e,"application/json"),function(t,e,r){if(ct.isString(t))try{return(e||JSON.parse)(t),ct.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional,r=e&&e.silentJSONParsing,s=e&&e.forcedJSONParsing,n=!r&&"json"===this.responseType;if(n||s&&ct.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw pt(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}};gt.headers={common:{Accept:"application/json, text/plain, */*"}},ct.forEach(["delete","get","head"],(function(t){gt.headers[t]={}})),ct.forEach(["post","put","patch"],(function(t){gt.headers[t]=ct.merge(ft)}));var yt=gt,_t=P,wt=yt,xt=function(t){return!(!t||!t.__CANCEL__)},bt=P,kt=function(t,e,r){var s=this||wt;return _t.forEach(r,(function(r){t=r.call(s,t,e)})),t},jt=xt,Ot=yt;function Et(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var Tt=P,St=function(t,e){e=e||{};var r={},s=["url","method","data"],n=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function a(t,e){return Tt.isPlainObject(t)&&Tt.isPlainObject(e)?Tt.merge(t,e):Tt.isPlainObject(e)?Tt.merge({},e):Tt.isArray(e)?e.slice():e}function u(s){Tt.isUndefined(e[s])?Tt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Tt.forEach(s,(function(t){Tt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Tt.forEach(n,u),Tt.forEach(i,(function(s){Tt.isUndefined(e[s])?Tt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Tt.forEach(o,(function(s){s in e?r[s]=a(t[s],e[s]):s in t&&(r[s]=a(void 0,t[s]))}));var d=s.concat(n).concat(i).concat(o),h=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===d.indexOf(t)}));return Tt.forEach(h,u),r},At={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},Rt={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Rt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var Nt={},$t=At.version.split(".");function Ut(t,e){for(var r=e?e.split("."):$t,s=t.split("."),n=0;n<3;n++){if(r[n]>s[n])return!0;if(r[n]<s[n])return!1}return!1}Rt.transitional=function(t,e,r){var s=e&&Ut(e);function n(t,e){return"[Axios v"+At.version+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,i,o){if(!1===t)throw new Error(n(i," has been removed in "+e));return s&&!Nt[i]&&(Nt[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,o)}};var qt={isOlderVersion:Ut,assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var s=Object.keys(t),n=s.length;n-- >0;){var i=s[n],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:Rt},Ct=P,Pt=L,Bt=z,It=function(t){return Et(t),t.headers=t.headers||{},t.data=kt.call(t,t.data,t.headers,t.transformRequest),t.headers=bt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),bt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||Ot.adapter)(t).then((function(e){return Et(t),e.data=kt.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return jt(e)||(Et(t),e&&e.response&&(e.response.data=kt.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Lt=St,Dt=qt,Mt=Dt.validators;function zt(t){this.defaults=t,this.interceptors={request:new Bt,response:new Bt}}zt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=Lt(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&&Dt.assertOptions(e,{silentJSONParsing:Mt.transitional(Mt.boolean,"1.0.0"),forcedJSONParsing:Mt.transitional(Mt.boolean,"1.0.0"),clarifyTimeoutError:Mt.transitional(Mt.boolean,"1.0.0")},!1);var r=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var n,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!s){var o=[It,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),n=Promise.resolve(t);o.length;)n=n.then(o.shift(),o.shift());return n}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{n=It(a)}catch(t){return Promise.reject(t)}for(;i.length;)n=n.then(i.shift(),i.shift());return n},zt.prototype.getUri=function(t){return t=Lt(this.defaults,t),Pt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Ct.forEach(["delete","get","head","options"],(function(t){zt.prototype[t]=function(e,r){return this.request(Lt(r||{},{method:t,url:e,data:(r||{}).data}))}})),Ct.forEach(["post","put","patch"],(function(t){zt.prototype[t]=function(e,r,s){return this.request(Lt(s||{},{method:t,url:e,data:r}))}}));var Ht=zt;function Ft(t){this.message=t}Ft.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ft.prototype.__CANCEL__=!0;var Jt=Ft,Wt=Jt;function Vt(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;t((function(t){r.reason||(r.reason=new Wt(t),e(r.reason))}))}Vt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Vt.source=function(){var t;return{token:new Vt((function(e){t=e})),cancel:t}};var Xt=Vt,Gt=P,Kt=T,Qt=Ht,Zt=St;function Yt(t){var e=new Qt(t),r=Kt(Qt.prototype.request,e);return Gt.extend(r,Qt.prototype,e),Gt.extend(r,e),r}var te=Yt(yt);te.Axios=Qt,te.create=function(t){return Yt(Zt(te.defaults,t))},te.Cancel=Jt,te.CancelToken=Xt,te.isCancel=xt,te.all=function(t){return Promise.all(t)},te.spread=function(t){return function(e){return t.apply(null,e)}},te.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},E.exports=te,E.exports.default=te;var ee=E.exports;class re{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=ee.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,s,n){var i,o,a,u,d,h,c,l,p;return t(this,void 0,void 0,(function*(){try{(n=n||{}).sendAuthorizationHeaders=null===(i=n.sendAuthorizationHeaders)||void 0===i||i,n.refreshTokenIfNeeded=null===(o=n.refreshTokenIfNeeded)||void 0===o||o,n.headers=null!==(a=n.headers)&&void 0!==a?a:{},n.onUploadProgress=null!==(u=n.onUploadProgress)&&void 0!==u?u:void 0,n.refreshTokenIfNeeded&&(yield this._refresh());const t={method:e,url:r,data:s,params:n.params,headers:n.headers,onUploadProgress:n.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;n.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 b(null,p);return p}catch(t){if(!t||t instanceof Error==!1)throw t;if(ee.isAxiosError(t)){const e=null===(d=t.response)||void 0===d?void 0:d.data;throw new b(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 b(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,s){return t(this,void 0,void 0,(function*(){return yield this.request("delete",e,r,s)}))}put(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.request("put",e,r,s)}))}post(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.request("post",e,r,s)}))}patch(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.request("patch",e,r,s)}))}}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 ne{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 s=[{resolve:t,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((t=>t.resolve(e)))})).catch((e=>{const s=[{resolve:t,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((t=>t.reject(e)))}))})))}))}}class ie{constructor(t,e,r){var s,n,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!==(n=null===(s=this.options.refresh)||void 0===s?void 0:s.auto)&&void 0!==n&&n,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 ne(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 s=this.storage.auth_expires;if(null===s)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 n=s-this.options.refresh.time-Date.now();if(n<0){if(s<Date.now())return;n=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),n))}refresh(e=!1){return t(this,void 0,void 0,(function*(){return yield this.refresher.debounce(e)}))}login(e,r){var s;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===(s=t.data)||void 0===s?void 0:s.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 oe{constructor(t){this.transport=t}request(e,r,s){return t(this,void 0,void 0,(function*(){return yield this.transport.post(e,{query:r,variables:void 0===s?{}:s})}))}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 ae{constructor(e,r){this._storage=(null==r?void 0:r.storage)||("undefined"!=typeof window?new O:new j),this._transport=(null==r?void 0:r.transport)||new re(e,this._storage,(()=>t(this,void 0,void 0,(function*(){yield this._auth.refresh()})))),this._auth=(null==r?void 0:r.auth)||new ie(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 n(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 oe(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{s as ActivityHandler,ie as Auth,re as AxiosTransport,k as BaseStorage,n as CollectionsHandler,r as CommentsHandler,ae as Directus,i as FieldsHandler,o as FilesHandler,a as FoldersHandler,e as ItemsHandler,O as LocalStorage,j as MemoryStorage,x as Meta,u as PermissionsHandler,d as PresetsHandler,h as RelationsHandler,c as RevisionsHandler,l as RolesHandler,p as ServerHandler,v as SettingsHandler,b as TransportError,_ as UsersHandler,w as UtilsHandler}; | ||
//# sourceMappingURL=sdk.esm.min.js.map |
@@ -15,3 +15,3 @@ var Directus=function(t){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function e(t,e,r,s){return new(r||(r=Promise))((function(n,i){function o(t){try{u(s.next(t))}catch(t){i(t)}}function a(t){try{u(s.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((s=s.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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:s})).data}))}updateMany(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:s})}))}updateByQuery(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:s})}))}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 s{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 n extends r{constructor(t){super("directus_activity",t),this._comments=new s(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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:s})).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,s)).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:s})).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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:s})}))}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 x{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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:s})}))}revert(t){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var b;t.Meta=void 0,(b=t.Meta||(t.Meta={})).TOTAL_COUNT="total_count",b.FILTER_COUNT="filter_count";class k extends Error{constructor(t,e){var r,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.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 R 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 j={exports:{}},S=function(t,e){return function(){for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},T=S,A=Object.prototype.toString;function $(t){return"[object Array]"===A.call(t)}function U(t){return void 0===t}function q(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 N(t){return"[object Function]"===A.call(t)}function P(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),$(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var B={isArray:$,isArrayBuffer:function(t){return"[object ArrayBuffer]"===A.call(t)},isBuffer:function(t){return null!==t&&!U(t)&&null!==t.constructor&&!U(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:q,isPlainObject:C,isUndefined:U,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:N,isStream:function(t){return q(t)&&N(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,s){C(e[s])&&C(r)?e[s]=t(e[s],r):C(r)?e[s]=t({},r):$(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)P(arguments[s],r);return e},extend:function(t,e,r){return P(e,(function(e,s){t[s]=r&&"function"==typeof e?T(e,r):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")},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 s;if(r)s=r(e);else if(H.isURLSearchParams(e))s=e.toString();else{var n=[];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)),n.push(L(e)+"="+L(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t},D=B;function M(){this.handlers=[]}M.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),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,X=function(t){return!(!t||!t.__CANCEL__)},J=B,V=function(t,e,r,s,n){return t.config=e,r&&(t.code=r),t.request=s,t.response=n,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}},t},W=function(t,e,r,s,n){var i=new Error(t);return V(i,e,r,s,n)},K=W,G=B,Q=G.isStandardBrowserEnv()?{write:function(t,e,r,s,n,i){var o=[];o.push(t+"="+encodeURIComponent(e)),G.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),G.isString(s)&&o.push("path="+s),G.isString(n)&&o.push("domain="+n),!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(){}},Y=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},Z=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},tt=B,et=["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"],rt=B,st=rt.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function s(t){var s=t;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{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=s(window.location.href),function(e){var r=rt.isString(e)?s(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},nt=B,it=function(t,e,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?e(K("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},ot=Q,at=I,ut=function(t,e){return t&&!Y(e)?Z(t,e):e},dt=function(t){var e,r,s,n={};return t?(tt.forEach(t.split("\n"),(function(t){if(s=t.indexOf(":"),e=tt.trim(t.substr(0,s)).toLowerCase(),r=tt.trim(t.substr(s+1)),e){if(n[e]&&et.indexOf(e)>=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},ht=st,ct=W,lt=function(t){return new Promise((function(e,r){var s=t.data,n=t.headers;nt.isFormData(s)&&delete n["Content-Type"];var i=new XMLHttpRequest;if(t.auth){var o=t.auth.username||"",a=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.Authorization="Basic "+btoa(o+":"+a)}var u=ut(t.baseURL,t.url);if(i.open(t.method.toUpperCase(),at(u,t.params,t.paramsSerializer),!0),i.timeout=t.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var s="getAllResponseHeaders"in i?dt(i.getAllResponseHeaders()):null,n={data:t.responseType&&"text"!==t.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:s,config:t,request:i};it(e,r,n),i=null}},i.onabort=function(){i&&(r(ct("Request aborted",t,"ECONNABORTED",i)),i=null)},i.onerror=function(){r(ct("Network Error",t,null,i)),i=null},i.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(ct(e,t,"ECONNABORTED",i)),i=null},nt.isStandardBrowserEnv()){var d=(t.withCredentials||ht(u))&&t.xsrfCookieName?ot.read(t.xsrfCookieName):void 0;d&&(n[t.xsrfHeaderName]=d)}if("setRequestHeader"in i&&nt.forEach(n,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete n[e]:i.setRequestHeader(e,t)})),nt.isUndefined(t.withCredentials)||(i.withCredentials=!!t.withCredentials),t.responseType)try{i.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&i.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){i&&(i.abort(),r(t),i=null)})),s||(s=null),i.send(s)}))},pt=B,ft=function(t,e){J.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},vt={"Content-Type":"application/x-www-form-urlencoded"};function mt(t,e){!pt.isUndefined(t)&&pt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var gt,yt={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(gt=lt),gt),transformRequest:[function(t,e){return ft(e,"Accept"),ft(e,"Content-Type"),pt.isFormData(t)||pt.isArrayBuffer(t)||pt.isBuffer(t)||pt.isStream(t)||pt.isFile(t)||pt.isBlob(t)?t:pt.isArrayBufferView(t)?t.buffer:pt.isURLSearchParams(t)?(mt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):pt.isObject(t)?(mt(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};yt.headers={common:{Accept:"application/json, text/plain, */*"}},pt.forEach(["delete","get","head"],(function(t){yt.headers[t]={}})),pt.forEach(["post","put","patch"],(function(t){yt.headers[t]=pt.merge(vt)}));var _t=yt,wt=B,xt=function(t,e,r){return z.forEach(r,(function(r){t=r(t,e)})),t},bt=X,kt=_t;function Ot(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var Et=B,Rt=function(t,e){e=e||{};var r={},s=["url","method","data"],n=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function a(t,e){return Et.isPlainObject(t)&&Et.isPlainObject(e)?Et.merge(t,e):Et.isPlainObject(e)?Et.merge({},e):Et.isArray(e)?e.slice():e}function u(s){Et.isUndefined(e[s])?Et.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Et.forEach(s,(function(t){Et.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Et.forEach(n,u),Et.forEach(i,(function(s){Et.isUndefined(e[s])?Et.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Et.forEach(o,(function(s){s in e?r[s]=a(t[s],e[s]):s in t&&(r[s]=a(void 0,t[s]))}));var d=s.concat(n).concat(i).concat(o),h=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===d.indexOf(t)}));return Et.forEach(h,u),r},jt=B,St=I,Tt=F,At=function(t){return Ot(t),t.headers=t.headers||{},t.data=xt(t.data,t.headers,t.transformRequest),t.headers=wt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),wt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||kt.adapter)(t).then((function(e){return Ot(t),e.data=xt(e.data,e.headers,t.transformResponse),e}),(function(e){return bt(e)||(Ot(t),e&&e.response&&(e.response.data=xt(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},$t=Rt;function Ut(t){this.defaults=t,this.interceptors={request:new Tt,response:new Tt}}Ut.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=$t(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[At,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)r=r.then(e.shift(),e.shift());return r},Ut.prototype.getUri=function(t){return t=$t(this.defaults,t),St(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},jt.forEach(["delete","get","head","options"],(function(t){Ut.prototype[t]=function(e,r){return this.request($t(r||{},{method:t,url:e,data:(r||{}).data}))}})),jt.forEach(["post","put","patch"],(function(t){Ut.prototype[t]=function(e,r,s){return this.request($t(s||{},{method:t,url:e,data:r}))}}));var qt=Ut;function Ct(t){this.message=t}Ct.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ct.prototype.__CANCEL__=!0;var Nt=Ct,Pt=Nt;function Bt(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;t((function(t){r.reason||(r.reason=new Pt(t),e(r.reason))}))}Bt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Bt.source=function(){var t;return{token:new Bt((function(e){t=e})),cancel:t}};var Ht=Bt,Lt=B,It=S,Dt=qt,Mt=Rt;function Ft(t){var e=new Dt(t),r=It(Dt.prototype.request,e);return Lt.extend(r,Dt.prototype,e),Lt.extend(r,e),r}var zt=Ft(_t);zt.Axios=Dt,zt.create=function(t){return Ft(Mt(zt.defaults,t))},zt.Cancel=Nt,zt.CancelToken=Ht,zt.isCancel=X,zt.all=function(t){return Promise.all(t)},zt.spread=function(t){return function(e){return t.apply(null,e)}},zt.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},j.exports=zt,j.exports.default=zt;var Xt=j.exports;class Jt{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=Xt.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,s,n){var i,o,a,u,d,h,c,l,p;return e(this,void 0,void 0,(function*(){try{(n=n||{}).sendAuthorizationHeaders=null===(i=n.sendAuthorizationHeaders)||void 0===i||i,n.refreshTokenIfNeeded=null===(o=n.refreshTokenIfNeeded)||void 0===o||o,n.headers=null!==(a=n.headers)&&void 0!==a?a:{},n.onUploadProgress=null!==(u=n.onUploadProgress)&&void 0!==u?u:void 0,n.refreshTokenIfNeeded&&(yield this._refresh());const e={method:t,url:r,data:s,params:n.params,headers:n.headers,onUploadProgress:n.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;n.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(Xt.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,s){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,s)}))}put(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,s)}))}post(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,s)}))}patch(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,s)}))}}class Vt{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 Wt{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 s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.resolve(t)))})).catch((t=>{const s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.reject(t)))}))})))}))}}class Kt{constructor(t,e,r){var s,n,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!==(n=null===(s=this.options.refresh)||void 0===s?void 0:s.auto)&&void 0!==n&&n,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 Wt(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 Vt(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 s=this.storage.auth_expires;if(null===s)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 n=s-this.options.refresh.time-Date.now();if(n<0){if(s<Date.now())return;n=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),n))}refresh(t=!1){return e(this,void 0,void 0,(function*(){return yield this.refresher.debounce(t)}))}login(t,r){var s;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===(s=e.data)||void 0===s?void 0:s.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 Gt{constructor(t){this.transport=t}request(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===s?{}:s})}))}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=n,t.Auth=Kt,t.AxiosTransport=Jt,t.BaseStorage=O,t.CollectionsHandler=i,t.CommentsHandler=s,t.Directus=class{constructor(t,r){this._storage=(null==r?void 0:r.storage)||("undefined"!=typeof window?new R:new E),this._transport=(null==r?void 0:r.transport)||new Jt(t,this._storage,(()=>e(this,void 0,void 0,(function*(){yield this._auth.refresh()})))),this._auth=(null==r?void 0:r.auth)||new Kt(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 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 x(this.transport))}get graphql(){return this._graphql||(this._graphql=new Gt(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=R,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=x,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); | ||
***************************************************************************** */function e(t,e,r,s){return new(r||(r=Promise))((function(n,i){function o(t){try{u(s.next(t))}catch(t){i(t)}}function a(t){try{u(s.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((s=s.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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:s})).data}))}updateMany(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:s})}))}updateByQuery(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:s})}))}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 s{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 n extends r{constructor(t){super("directus_activity",t),this._comments=new s(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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:s})).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,s)).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:s})).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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:s})}))}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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:s})}))}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,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.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 j{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 j{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 j{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),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},A=T,R=Object.prototype.toString;function N(t){return"[object Array]"===R.call(t)}function $(t){return void 0===t}function U(t){return null!==t&&"object"==typeof t}function C(t){if("[object Object]"!==R.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function P(t){return"[object Function]"===R.call(t)}function q(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),N(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var B={isArray:N,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:U,isPlainObject:C,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:P,isStream:function(t){return U(t)&&P(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:q,merge:function t(){var e={};function r(r,s){C(e[s])&&C(r)?e[s]=t(e[s],r):C(r)?e[s]=t({},r):N(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)q(arguments[s],r);return e},extend:function(t,e,r){return q(e,(function(e,s){t[s]=r&&"function"==typeof e?A(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 I(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var L=function(t,e,r){if(!e)return t;var s;if(r)s=r(e);else if(H.isURLSearchParams(e))s=e.toString();else{var n=[];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)),n.push(I(e)+"="+I(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}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,s,n){return t.config=e,r&&(t.code=r),t.request=s,t.response=n,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}},t},W=J,V=function(t,e,r,s,n){var i=new Error(t);return W(i,e,r,s,n)},X=V,G=B,K=G.isStandardBrowserEnv()?{write:function(t,e,r,s,n,i){var o=[];o.push(t+"="+encodeURIComponent(e)),G.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),G.isString(s)&&o.push("path="+s),G.isString(n)&&o.push("domain="+n),!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)},Z=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Y=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 s(t){var s=t;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{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=s(window.location.href),function(e){var r=et.isString(e)?s(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},st=B,nt=function(t,e,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?e(X("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},it=K,ot=L,at=function(t,e){return t&&!Q(e)?Z(t,e):e},ut=function(t){var e,r,s,n={};return t?(Y.forEach(t.split("\n"),(function(t){if(s=t.indexOf(":"),e=Y.trim(t.substr(0,s)).toLowerCase(),r=Y.trim(t.substr(s+1)),e){if(n[e]&&tt.indexOf(e)>=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},dt=rt,ht=V,ct=function(t){return new Promise((function(e,r){var s=t.data,n=t.headers,i=t.responseType;st.isFormData(s)&&delete n["Content-Type"];var o=new XMLHttpRequest;if(t.auth){var a=t.auth.username||"",u=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.Authorization="Basic "+btoa(a+":"+u)}var d=at(t.baseURL,t.url);function h(){if(o){var s="getAllResponseHeaders"in o?ut(o.getAllResponseHeaders()):null,n={data:i&&"text"!==i&&"json"!==i?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:s,config:t,request:o};nt(e,r,n),o=null}}if(o.open(t.method.toUpperCase(),ot(d,t.params,t.paramsSerializer),!0),o.timeout=t.timeout,"onloadend"in o?o.onloadend=h:o.onreadystatechange=function(){o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))&&setTimeout(h)},o.onabort=function(){o&&(r(ht("Request aborted",t,"ECONNABORTED",o)),o=null)},o.onerror=function(){r(ht("Network Error",t,null,o)),o=null},o.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(ht(e,t,t.transitional&&t.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},st.isStandardBrowserEnv()){var c=(t.withCredentials||dt(d))&&t.xsrfCookieName?it.read(t.xsrfCookieName):void 0;c&&(n[t.xsrfHeaderName]=c)}"setRequestHeader"in o&&st.forEach(n,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete n[e]:o.setRequestHeader(e,t)})),st.isUndefined(t.withCredentials)||(o.withCredentials=!!t.withCredentials),i&&"json"!==i&&(o.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&o.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){o&&(o.abort(),r(t),o=null)})),s||(s=null),o.send(s)}))},lt=B,pt=function(t,e){z.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},ft=J,vt={"Content-Type":"application/x-www-form-urlencoded"};function mt(t,e){!lt.isUndefined(t)&<.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var gt,yt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(gt=ct),gt),transformRequest:[function(t,e){return pt(e,"Accept"),pt(e,"Content-Type"),lt.isFormData(t)||lt.isArrayBuffer(t)||lt.isBuffer(t)||lt.isStream(t)||lt.isFile(t)||lt.isBlob(t)?t:lt.isArrayBufferView(t)?t.buffer:lt.isURLSearchParams(t)?(mt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):lt.isObject(t)||e&&"application/json"===e["Content-Type"]?(mt(e,"application/json"),function(t,e,r){if(lt.isString(t))try{return(e||JSON.parse)(t),lt.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional,r=e&&e.silentJSONParsing,s=e&&e.forcedJSONParsing,n=!r&&"json"===this.responseType;if(n||s&<.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw ft(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}};yt.headers={common:{Accept:"application/json, text/plain, */*"}},lt.forEach(["delete","get","head"],(function(t){yt.headers[t]={}})),lt.forEach(["post","put","patch"],(function(t){yt.headers[t]=lt.merge(vt)}));var _t=yt,wt=B,bt=_t,xt=function(t){return!(!t||!t.__CANCEL__)},kt=B,jt=function(t,e,r){var s=this||bt;return wt.forEach(r,(function(r){t=r.call(s,t,e)})),t},Ot=xt,Et=_t;function St(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var Tt=B,At=function(t,e){e=e||{};var r={},s=["url","method","data"],n=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function a(t,e){return Tt.isPlainObject(t)&&Tt.isPlainObject(e)?Tt.merge(t,e):Tt.isPlainObject(e)?Tt.merge({},e):Tt.isArray(e)?e.slice():e}function u(s){Tt.isUndefined(e[s])?Tt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Tt.forEach(s,(function(t){Tt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Tt.forEach(n,u),Tt.forEach(i,(function(s){Tt.isUndefined(e[s])?Tt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Tt.forEach(o,(function(s){s in e?r[s]=a(t[s],e[s]):s in t&&(r[s]=a(void 0,t[s]))}));var d=s.concat(n).concat(i).concat(o),h=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===d.indexOf(t)}));return Tt.forEach(h,u),r},Rt={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},Nt={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Nt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var $t={},Ut=Rt.version.split(".");function Ct(t,e){for(var r=e?e.split("."):Ut,s=t.split("."),n=0;n<3;n++){if(r[n]>s[n])return!0;if(r[n]<s[n])return!1}return!1}Nt.transitional=function(t,e,r){var s=e&&Ct(e);function n(t,e){return"[Axios v"+Rt.version+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,i,o){if(!1===t)throw new Error(n(i," has been removed in "+e));return s&&!$t[i]&&($t[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,o)}};var Pt={isOlderVersion:Ct,assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var s=Object.keys(t),n=s.length;n-- >0;){var i=s[n],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:Nt},qt=B,Bt=L,Ht=F,It=function(t){return St(t),t.headers=t.headers||{},t.data=jt.call(t,t.data,t.headers,t.transformRequest),t.headers=kt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),kt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||Et.adapter)(t).then((function(e){return St(t),e.data=jt.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return Ot(e)||(St(t),e&&e.response&&(e.response.data=jt.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Lt=At,Dt=Pt,Mt=Dt.validators;function Ft(t){this.defaults=t,this.interceptors={request:new Ht,response:new Ht}}Ft.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=Lt(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&&Dt.assertOptions(e,{silentJSONParsing:Mt.transitional(Mt.boolean,"1.0.0"),forcedJSONParsing:Mt.transitional(Mt.boolean,"1.0.0"),clarifyTimeoutError:Mt.transitional(Mt.boolean,"1.0.0")},!1);var r=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var n,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!s){var o=[It,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),n=Promise.resolve(t);o.length;)n=n.then(o.shift(),o.shift());return n}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{n=It(a)}catch(t){return Promise.reject(t)}for(;i.length;)n=n.then(i.shift(),i.shift());return n},Ft.prototype.getUri=function(t){return t=Lt(this.defaults,t),Bt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},qt.forEach(["delete","get","head","options"],(function(t){Ft.prototype[t]=function(e,r){return this.request(Lt(r||{},{method:t,url:e,data:(r||{}).data}))}})),qt.forEach(["post","put","patch"],(function(t){Ft.prototype[t]=function(e,r,s){return this.request(Lt(s||{},{method:t,url:e,data:r}))}}));var zt=Ft;function Jt(t){this.message=t}Jt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Jt.prototype.__CANCEL__=!0;var Wt=Jt,Vt=Wt;function Xt(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;t((function(t){r.reason||(r.reason=new Vt(t),e(r.reason))}))}Xt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Xt.source=function(){var t;return{token:new Xt((function(e){t=e})),cancel:t}};var Gt=Xt,Kt=B,Qt=T,Zt=zt,Yt=At;function te(t){var e=new Zt(t),r=Qt(Zt.prototype.request,e);return Kt.extend(r,Zt.prototype,e),Kt.extend(r,e),r}var ee=te(_t);ee.Axios=Zt,ee.create=function(t){return te(Yt(ee.defaults,t))},ee.Cancel=Wt,ee.CancelToken=Gt,ee.isCancel=xt,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 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=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(t,r,s,n){var i,o,a,u,d,h,c,l,p;return e(this,void 0,void 0,(function*(){try{(n=n||{}).sendAuthorizationHeaders=null===(i=n.sendAuthorizationHeaders)||void 0===i||i,n.refreshTokenIfNeeded=null===(o=n.refreshTokenIfNeeded)||void 0===o||o,n.headers=null!==(a=n.headers)&&void 0!==a?a:{},n.onUploadProgress=null!==(u=n.onUploadProgress)&&void 0!==u?u:void 0,n.refreshTokenIfNeeded&&(yield this._refresh());const e={method:t,url:r,data:s,params:n.params,headers:n.headers,onUploadProgress:n.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;n.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(re.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,s){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,s)}))}put(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,s)}))}post(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,s)}))}patch(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,s)}))}}class ne{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 ie{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 s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.resolve(t)))})).catch((t=>{const s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.reject(t)))}))})))}))}}class oe{constructor(t,e,r){var s,n,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!==(n=null===(s=this.options.refresh)||void 0===s?void 0:s.auto)&&void 0!==n&&n,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 ne(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 s=this.storage.auth_expires;if(null===s)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 n=s-this.options.refresh.time-Date.now();if(n<0){if(s<Date.now())return;n=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),n))}refresh(t=!1){return e(this,void 0,void 0,(function*(){return yield this.refresher.debounce(t)}))}login(t,r){var s;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===(s=e.data)||void 0===s?void 0:s.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 ae{constructor(t){this.transport=t}request(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===s?{}:s})}))}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=n,t.Auth=oe,t.AxiosTransport=se,t.BaseStorage=j,t.CollectionsHandler=i,t.CommentsHandler=s,t.Directus=class{constructor(t,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 se(t,this._storage,(()=>e(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 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 ae(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=E,t.MemoryStorage=O,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}({}); | ||
//# sourceMappingURL=sdk.iife.min.js.map |
@@ -16,3 +16,3 @@ System.register("Directus",[],(function(t){"use strict";return{execute:function(){ | ||
***************************************************************************** */ | ||
function e(t,e,r,s){return new(r||(r=Promise))((function(n,i){function o(t){try{u(s.next(t))}catch(t){i(t)}}function a(t){try{u(s.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((s=s.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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:s})).data}))}updateMany(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:s})}))}updateByQuery(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:s})}))}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 s{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",s);class n extends r{constructor(t){super("directus_activity",t),this._comments=new s(this.transport)}get comments(){return this._comments}}t("ActivityHandler",n);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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:s})).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,s)).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:s})).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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:s})}))}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 x{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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:s})}))}revert(t){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var b;t("UtilsHandler",x),t("Meta",b),function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(b||t("Meta",b={}));class k extends Error{constructor(t,e){var r,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.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 R 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",R);var S={exports:{}},j=function(t,e){return function(){for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},T=j,A=Object.prototype.toString;function $(t){return"[object Array]"===A.call(t)}function U(t){return void 0===t}function q(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 N(t){return"[object Function]"===A.call(t)}function P(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),$(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var B={isArray:$,isArrayBuffer:function(t){return"[object ArrayBuffer]"===A.call(t)},isBuffer:function(t){return null!==t&&!U(t)&&null!==t.constructor&&!U(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:q,isPlainObject:C,isUndefined:U,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:N,isStream:function(t){return q(t)&&N(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,s){C(e[s])&&C(r)?e[s]=t(e[s],r):C(r)?e[s]=t({},r):$(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)P(arguments[s],r);return e},extend:function(t,e,r){return P(e,(function(e,s){t[s]=r&&"function"==typeof e?T(e,r):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")},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 s;if(r)s=r(e);else if(H.isURLSearchParams(e))s=e.toString();else{var n=[];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)),n.push(L(e)+"="+L(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t},D=B;function M(){this.handlers=[]}M.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),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,X=function(t){return!(!t||!t.__CANCEL__)},J=B,V=function(t,e,r,s,n){return t.config=e,r&&(t.code=r),t.request=s,t.response=n,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}},t},W=function(t,e,r,s,n){var i=new Error(t);return V(i,e,r,s,n)},K=W,G=B,Q=G.isStandardBrowserEnv()?{write:function(t,e,r,s,n,i){var o=[];o.push(t+"="+encodeURIComponent(e)),G.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),G.isString(s)&&o.push("path="+s),G.isString(n)&&o.push("domain="+n),!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(){}},Y=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},Z=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},tt=B,et=["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"],rt=B,st=rt.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function s(t){var s=t;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{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=s(window.location.href),function(e){var r=rt.isString(e)?s(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},nt=B,it=function(t,e,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?e(K("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},ot=Q,at=I,ut=function(t,e){return t&&!Y(e)?Z(t,e):e},dt=function(t){var e,r,s,n={};return t?(tt.forEach(t.split("\n"),(function(t){if(s=t.indexOf(":"),e=tt.trim(t.substr(0,s)).toLowerCase(),r=tt.trim(t.substr(s+1)),e){if(n[e]&&et.indexOf(e)>=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},ht=st,ct=W,lt=function(t){return new Promise((function(e,r){var s=t.data,n=t.headers;nt.isFormData(s)&&delete n["Content-Type"];var i=new XMLHttpRequest;if(t.auth){var o=t.auth.username||"",a=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.Authorization="Basic "+btoa(o+":"+a)}var u=ut(t.baseURL,t.url);if(i.open(t.method.toUpperCase(),at(u,t.params,t.paramsSerializer),!0),i.timeout=t.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var s="getAllResponseHeaders"in i?dt(i.getAllResponseHeaders()):null,n={data:t.responseType&&"text"!==t.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:s,config:t,request:i};it(e,r,n),i=null}},i.onabort=function(){i&&(r(ct("Request aborted",t,"ECONNABORTED",i)),i=null)},i.onerror=function(){r(ct("Network Error",t,null,i)),i=null},i.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(ct(e,t,"ECONNABORTED",i)),i=null},nt.isStandardBrowserEnv()){var d=(t.withCredentials||ht(u))&&t.xsrfCookieName?ot.read(t.xsrfCookieName):void 0;d&&(n[t.xsrfHeaderName]=d)}if("setRequestHeader"in i&&nt.forEach(n,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete n[e]:i.setRequestHeader(e,t)})),nt.isUndefined(t.withCredentials)||(i.withCredentials=!!t.withCredentials),t.responseType)try{i.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&i.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){i&&(i.abort(),r(t),i=null)})),s||(s=null),i.send(s)}))},pt=B,ft=function(t,e){J.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},vt={"Content-Type":"application/x-www-form-urlencoded"};function mt(t,e){!pt.isUndefined(t)&&pt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var gt,yt={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(gt=lt),gt),transformRequest:[function(t,e){return ft(e,"Accept"),ft(e,"Content-Type"),pt.isFormData(t)||pt.isArrayBuffer(t)||pt.isBuffer(t)||pt.isStream(t)||pt.isFile(t)||pt.isBlob(t)?t:pt.isArrayBufferView(t)?t.buffer:pt.isURLSearchParams(t)?(mt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):pt.isObject(t)?(mt(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};yt.headers={common:{Accept:"application/json, text/plain, */*"}},pt.forEach(["delete","get","head"],(function(t){yt.headers[t]={}})),pt.forEach(["post","put","patch"],(function(t){yt.headers[t]=pt.merge(vt)}));var _t=yt,wt=B,xt=function(t,e,r){return z.forEach(r,(function(r){t=r(t,e)})),t},bt=X,kt=_t;function Ot(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var Et=B,Rt=function(t,e){e=e||{};var r={},s=["url","method","data"],n=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function a(t,e){return Et.isPlainObject(t)&&Et.isPlainObject(e)?Et.merge(t,e):Et.isPlainObject(e)?Et.merge({},e):Et.isArray(e)?e.slice():e}function u(s){Et.isUndefined(e[s])?Et.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Et.forEach(s,(function(t){Et.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Et.forEach(n,u),Et.forEach(i,(function(s){Et.isUndefined(e[s])?Et.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Et.forEach(o,(function(s){s in e?r[s]=a(t[s],e[s]):s in t&&(r[s]=a(void 0,t[s]))}));var d=s.concat(n).concat(i).concat(o),h=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===d.indexOf(t)}));return Et.forEach(h,u),r},St=B,jt=I,Tt=F,At=function(t){return Ot(t),t.headers=t.headers||{},t.data=xt(t.data,t.headers,t.transformRequest),t.headers=wt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),wt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||kt.adapter)(t).then((function(e){return Ot(t),e.data=xt(e.data,e.headers,t.transformResponse),e}),(function(e){return bt(e)||(Ot(t),e&&e.response&&(e.response.data=xt(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},$t=Rt;function Ut(t){this.defaults=t,this.interceptors={request:new Tt,response:new Tt}}Ut.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=$t(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[At,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)r=r.then(e.shift(),e.shift());return r},Ut.prototype.getUri=function(t){return t=$t(this.defaults,t),jt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},St.forEach(["delete","get","head","options"],(function(t){Ut.prototype[t]=function(e,r){return this.request($t(r||{},{method:t,url:e,data:(r||{}).data}))}})),St.forEach(["post","put","patch"],(function(t){Ut.prototype[t]=function(e,r,s){return this.request($t(s||{},{method:t,url:e,data:r}))}}));var qt=Ut;function Ct(t){this.message=t}Ct.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ct.prototype.__CANCEL__=!0;var Nt=Ct,Pt=Nt;function Bt(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;t((function(t){r.reason||(r.reason=new Pt(t),e(r.reason))}))}Bt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Bt.source=function(){var t;return{token:new Bt((function(e){t=e})),cancel:t}};var Ht=Bt,Lt=B,It=j,Dt=qt,Mt=Rt;function Ft(t){var e=new Dt(t),r=It(Dt.prototype.request,e);return Lt.extend(r,Dt.prototype,e),Lt.extend(r,e),r}var zt=Ft(_t);zt.Axios=Dt,zt.create=function(t){return Ft(Mt(zt.defaults,t))},zt.Cancel=Nt,zt.CancelToken=Ht,zt.isCancel=X,zt.all=function(t){return Promise.all(t)},zt.spread=function(t){return function(e){return t.apply(null,e)}},zt.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},S.exports=zt,S.exports.default=zt;var Xt=S.exports;class Jt{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=Xt.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,s,n){var i,o,a,u,d,h,c,l,p;return e(this,void 0,void 0,(function*(){try{(n=n||{}).sendAuthorizationHeaders=null===(i=n.sendAuthorizationHeaders)||void 0===i||i,n.refreshTokenIfNeeded=null===(o=n.refreshTokenIfNeeded)||void 0===o||o,n.headers=null!==(a=n.headers)&&void 0!==a?a:{},n.onUploadProgress=null!==(u=n.onUploadProgress)&&void 0!==u?u:void 0,n.refreshTokenIfNeeded&&(yield this._refresh());const e={method:t,url:r,data:s,params:n.params,headers:n.headers,onUploadProgress:n.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;n.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(Xt.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,s){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,s)}))}put(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,s)}))}post(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,s)}))}patch(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,s)}))}}t("AxiosTransport",Jt);class Vt{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 Wt{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 s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.resolve(t)))})).catch((t=>{const s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.reject(t)))}))})))}))}}class Kt{constructor(t,e,r){var s,n,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!==(n=null===(s=this.options.refresh)||void 0===s?void 0:s.auto)&&void 0!==n&&n,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 Wt(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 Vt(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 s=this.storage.auth_expires;if(null===s)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 n=s-this.options.refresh.time-Date.now();if(n<0){if(s<Date.now())return;n=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),n))}refresh(t=!1){return e(this,void 0,void 0,(function*(){return yield this.refresher.debounce(t)}))}login(t,r){var s;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===(s=e.data)||void 0===s?void 0:s.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",Kt);class Gt{constructor(t){this.transport=t}request(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===s?{}:s})}))}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 R:new E),this._transport=(null==r?void 0:r.transport)||new Jt(t,this._storage,(()=>e(this,void 0,void 0,(function*(){yield this._auth.refresh()})))),this._auth=(null==r?void 0:r.auth)||new Kt(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 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 x(this.transport))}get graphql(){return this._graphql||(this._graphql=new Gt(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))}})}}})); | ||
function e(t,e,r,s){return new(r||(r=Promise))((function(n,i){function o(t){try{u(s.next(t))}catch(t){i(t)}}function a(t){try{u(s.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((s=s.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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:s})).data}))}updateMany(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:s})}))}updateByQuery(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:s})}))}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 s{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",s);class n extends r{constructor(t){super("directus_activity",t),this._comments=new s(this.transport)}get comments(){return this._comments}}t("ActivityHandler",n);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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:s})).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,s)).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:s})).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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:s})}))}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 x{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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:s})}))}revert(t){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var b;t("UtilsHandler",x),t("Meta",b),function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(b||t("Meta",b={}));class k extends Error{constructor(t,e){var r,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.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 j{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",j);class O extends j{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",O);class E extends j{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",E);var S={exports:{}},T=function(t,e){return function(){for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},A=T,R=Object.prototype.toString;function N(t){return"[object Array]"===R.call(t)}function $(t){return void 0===t}function U(t){return null!==t&&"object"==typeof t}function C(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 P(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),N(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var B={isArray:N,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:U,isPlainObject:C,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 U(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,s){C(e[s])&&C(r)?e[s]=t(e[s],r):C(r)?e[s]=t({},r):N(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)P(arguments[s],r);return e},extend:function(t,e,r){return P(e,(function(e,s){t[s]=r&&"function"==typeof e?A(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 I(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var L=function(t,e,r){if(!e)return t;var s;if(r)s=r(e);else if(H.isURLSearchParams(e))s=e.toString();else{var n=[];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)),n.push(I(e)+"="+I(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}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,s,n){return t.config=e,r&&(t.code=r),t.request=s,t.response=n,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}},t},W=J,V=function(t,e,r,s,n){var i=new Error(t);return W(i,e,r,s,n)},X=V,G=B,K=G.isStandardBrowserEnv()?{write:function(t,e,r,s,n,i){var o=[];o.push(t+"="+encodeURIComponent(e)),G.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),G.isString(s)&&o.push("path="+s),G.isString(n)&&o.push("domain="+n),!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)},Z=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Y=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 s(t){var s=t;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{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=s(window.location.href),function(e){var r=et.isString(e)?s(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},st=B,nt=function(t,e,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?e(X("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},it=K,ot=L,at=function(t,e){return t&&!Q(e)?Z(t,e):e},ut=function(t){var e,r,s,n={};return t?(Y.forEach(t.split("\n"),(function(t){if(s=t.indexOf(":"),e=Y.trim(t.substr(0,s)).toLowerCase(),r=Y.trim(t.substr(s+1)),e){if(n[e]&&tt.indexOf(e)>=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},dt=rt,ht=V,ct=function(t){return new Promise((function(e,r){var s=t.data,n=t.headers,i=t.responseType;st.isFormData(s)&&delete n["Content-Type"];var o=new XMLHttpRequest;if(t.auth){var a=t.auth.username||"",u=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.Authorization="Basic "+btoa(a+":"+u)}var d=at(t.baseURL,t.url);function h(){if(o){var s="getAllResponseHeaders"in o?ut(o.getAllResponseHeaders()):null,n={data:i&&"text"!==i&&"json"!==i?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:s,config:t,request:o};nt(e,r,n),o=null}}if(o.open(t.method.toUpperCase(),ot(d,t.params,t.paramsSerializer),!0),o.timeout=t.timeout,"onloadend"in o?o.onloadend=h:o.onreadystatechange=function(){o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))&&setTimeout(h)},o.onabort=function(){o&&(r(ht("Request aborted",t,"ECONNABORTED",o)),o=null)},o.onerror=function(){r(ht("Network Error",t,null,o)),o=null},o.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(ht(e,t,t.transitional&&t.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},st.isStandardBrowserEnv()){var c=(t.withCredentials||dt(d))&&t.xsrfCookieName?it.read(t.xsrfCookieName):void 0;c&&(n[t.xsrfHeaderName]=c)}"setRequestHeader"in o&&st.forEach(n,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete n[e]:o.setRequestHeader(e,t)})),st.isUndefined(t.withCredentials)||(o.withCredentials=!!t.withCredentials),i&&"json"!==i&&(o.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&o.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){o&&(o.abort(),r(t),o=null)})),s||(s=null),o.send(s)}))},lt=B,pt=function(t,e){z.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},ft=J,vt={"Content-Type":"application/x-www-form-urlencoded"};function mt(t,e){!lt.isUndefined(t)&<.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var gt,yt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(gt=ct),gt),transformRequest:[function(t,e){return pt(e,"Accept"),pt(e,"Content-Type"),lt.isFormData(t)||lt.isArrayBuffer(t)||lt.isBuffer(t)||lt.isStream(t)||lt.isFile(t)||lt.isBlob(t)?t:lt.isArrayBufferView(t)?t.buffer:lt.isURLSearchParams(t)?(mt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):lt.isObject(t)||e&&"application/json"===e["Content-Type"]?(mt(e,"application/json"),function(t,e,r){if(lt.isString(t))try{return(e||JSON.parse)(t),lt.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional,r=e&&e.silentJSONParsing,s=e&&e.forcedJSONParsing,n=!r&&"json"===this.responseType;if(n||s&<.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw ft(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}};yt.headers={common:{Accept:"application/json, text/plain, */*"}},lt.forEach(["delete","get","head"],(function(t){yt.headers[t]={}})),lt.forEach(["post","put","patch"],(function(t){yt.headers[t]=lt.merge(vt)}));var _t=yt,wt=B,xt=_t,bt=function(t){return!(!t||!t.__CANCEL__)},kt=B,jt=function(t,e,r){var s=this||xt;return wt.forEach(r,(function(r){t=r.call(s,t,e)})),t},Ot=bt,Et=_t;function St(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var Tt=B,At=function(t,e){e=e||{};var r={},s=["url","method","data"],n=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function a(t,e){return Tt.isPlainObject(t)&&Tt.isPlainObject(e)?Tt.merge(t,e):Tt.isPlainObject(e)?Tt.merge({},e):Tt.isArray(e)?e.slice():e}function u(s){Tt.isUndefined(e[s])?Tt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Tt.forEach(s,(function(t){Tt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Tt.forEach(n,u),Tt.forEach(i,(function(s){Tt.isUndefined(e[s])?Tt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Tt.forEach(o,(function(s){s in e?r[s]=a(t[s],e[s]):s in t&&(r[s]=a(void 0,t[s]))}));var d=s.concat(n).concat(i).concat(o),h=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===d.indexOf(t)}));return Tt.forEach(h,u),r},Rt={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},Nt={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Nt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var $t={},Ut=Rt.version.split(".");function Ct(t,e){for(var r=e?e.split("."):Ut,s=t.split("."),n=0;n<3;n++){if(r[n]>s[n])return!0;if(r[n]<s[n])return!1}return!1}Nt.transitional=function(t,e,r){var s=e&&Ct(e);function n(t,e){return"[Axios v"+Rt.version+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,i,o){if(!1===t)throw new Error(n(i," has been removed in "+e));return s&&!$t[i]&&($t[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,o)}};var qt={isOlderVersion:Ct,assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var s=Object.keys(t),n=s.length;n-- >0;){var i=s[n],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:Nt},Pt=B,Bt=L,Ht=F,It=function(t){return St(t),t.headers=t.headers||{},t.data=jt.call(t,t.data,t.headers,t.transformRequest),t.headers=kt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),kt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||Et.adapter)(t).then((function(e){return St(t),e.data=jt.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return Ot(e)||(St(t),e&&e.response&&(e.response.data=jt.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Lt=At,Dt=qt,Mt=Dt.validators;function Ft(t){this.defaults=t,this.interceptors={request:new Ht,response:new Ht}}Ft.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=Lt(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&&Dt.assertOptions(e,{silentJSONParsing:Mt.transitional(Mt.boolean,"1.0.0"),forcedJSONParsing:Mt.transitional(Mt.boolean,"1.0.0"),clarifyTimeoutError:Mt.transitional(Mt.boolean,"1.0.0")},!1);var r=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var n,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!s){var o=[It,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),n=Promise.resolve(t);o.length;)n=n.then(o.shift(),o.shift());return n}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{n=It(a)}catch(t){return Promise.reject(t)}for(;i.length;)n=n.then(i.shift(),i.shift());return n},Ft.prototype.getUri=function(t){return t=Lt(this.defaults,t),Bt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Pt.forEach(["delete","get","head","options"],(function(t){Ft.prototype[t]=function(e,r){return this.request(Lt(r||{},{method:t,url:e,data:(r||{}).data}))}})),Pt.forEach(["post","put","patch"],(function(t){Ft.prototype[t]=function(e,r,s){return this.request(Lt(s||{},{method:t,url:e,data:r}))}}));var zt=Ft;function Jt(t){this.message=t}Jt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Jt.prototype.__CANCEL__=!0;var Wt=Jt,Vt=Wt;function Xt(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;t((function(t){r.reason||(r.reason=new Vt(t),e(r.reason))}))}Xt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Xt.source=function(){var t;return{token:new Xt((function(e){t=e})),cancel:t}};var Gt=Xt,Kt=B,Qt=T,Zt=zt,Yt=At;function te(t){var e=new Zt(t),r=Qt(Zt.prototype.request,e);return Kt.extend(r,Zt.prototype,e),Kt.extend(r,e),r}var ee=te(_t);ee.Axios=Zt,ee.create=function(t){return te(Yt(ee.defaults,t))},ee.Cancel=Wt,ee.CancelToken=Gt,ee.isCancel=bt,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 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=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(t,r,s,n){var i,o,a,u,d,h,c,l,p;return e(this,void 0,void 0,(function*(){try{(n=n||{}).sendAuthorizationHeaders=null===(i=n.sendAuthorizationHeaders)||void 0===i||i,n.refreshTokenIfNeeded=null===(o=n.refreshTokenIfNeeded)||void 0===o||o,n.headers=null!==(a=n.headers)&&void 0!==a?a:{},n.onUploadProgress=null!==(u=n.onUploadProgress)&&void 0!==u?u:void 0,n.refreshTokenIfNeeded&&(yield this._refresh());const e={method:t,url:r,data:s,params:n.params,headers:n.headers,onUploadProgress:n.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;n.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(re.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,s){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,s)}))}put(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,s)}))}post(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,s)}))}patch(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,s)}))}}t("AxiosTransport",se);class ne{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 ie{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 s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.resolve(t)))})).catch((t=>{const s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.reject(t)))}))})))}))}}class oe{constructor(t,e,r){var s,n,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!==(n=null===(s=this.options.refresh)||void 0===s?void 0:s.auto)&&void 0!==n&&n,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 ne(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 s=this.storage.auth_expires;if(null===s)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 n=s-this.options.refresh.time-Date.now();if(n<0){if(s<Date.now())return;n=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),n))}refresh(t=!1){return e(this,void 0,void 0,(function*(){return yield this.refresher.debounce(t)}))}login(t,r){var s;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===(s=e.data)||void 0===s?void 0:s.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",oe);class ae{constructor(t){this.transport=t}request(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===s?{}:s})}))}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 E:new O),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 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 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 x(this.transport))}get graphql(){return this._graphql||(this._graphql=new ae(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))}})}}})); | ||
//# sourceMappingURL=sdk.system.min.js.map |
@@ -15,3 +15,3 @@ !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"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function e(t,e,r,s){return new(r||(r=Promise))((function(n,i){function o(t){try{u(s.next(t))}catch(t){i(t)}}function a(t){try{u(s.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((s=s.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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:s})).data}))}updateMany(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:s})}))}updateByQuery(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:s})}))}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 s{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 n extends r{constructor(t){super("directus_activity",t),this._comments=new s(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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:s})).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,s)).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:s})).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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:s})}))}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 x{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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:s})}))}revert(t){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/revert/${encodeURI(t)}`)}))}}var b;t.Meta=void 0,(b=t.Meta||(t.Meta={})).TOTAL_COUNT="total_count",b.FILTER_COUNT="filter_count";class k extends Error{constructor(t,e){var r,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.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 R 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 j={exports:{}},T=function(t,e){return function(){for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},S=T,A=Object.prototype.toString;function $(t){return"[object Array]"===A.call(t)}function U(t){return void 0===t}function q(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 N(t){return"[object Function]"===A.call(t)}function P(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),$(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var B={isArray:$,isArrayBuffer:function(t){return"[object ArrayBuffer]"===A.call(t)},isBuffer:function(t){return null!==t&&!U(t)&&null!==t.constructor&&!U(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:q,isPlainObject:C,isUndefined:U,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:N,isStream:function(t){return q(t)&&N(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,s){C(e[s])&&C(r)?e[s]=t(e[s],r):C(r)?e[s]=t({},r):$(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)P(arguments[s],r);return e},extend:function(t,e,r){return P(e,(function(e,s){t[s]=r&&"function"==typeof e?S(e,r):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")},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 s;if(r)s=r(e);else if(H.isURLSearchParams(e))s=e.toString();else{var n=[];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)),n.push(L(e)+"="+L(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t},D=B;function M(){this.handlers=[]}M.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),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,X=function(t){return!(!t||!t.__CANCEL__)},J=B,V=function(t,e,r,s,n){return t.config=e,r&&(t.code=r),t.request=s,t.response=n,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}},t},W=function(t,e,r,s,n){var i=new Error(t);return V(i,e,r,s,n)},K=W,G=B,Q=G.isStandardBrowserEnv()?{write:function(t,e,r,s,n,i){var o=[];o.push(t+"="+encodeURIComponent(e)),G.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),G.isString(s)&&o.push("path="+s),G.isString(n)&&o.push("domain="+n),!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(){}},Y=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},Z=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},tt=B,et=["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"],rt=B,st=rt.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function s(t){var s=t;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{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=s(window.location.href),function(e){var r=rt.isString(e)?s(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},nt=B,it=function(t,e,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?e(K("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},ot=Q,at=I,ut=function(t,e){return t&&!Y(e)?Z(t,e):e},dt=function(t){var e,r,s,n={};return t?(tt.forEach(t.split("\n"),(function(t){if(s=t.indexOf(":"),e=tt.trim(t.substr(0,s)).toLowerCase(),r=tt.trim(t.substr(s+1)),e){if(n[e]&&et.indexOf(e)>=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},ht=st,ct=W,lt=function(t){return new Promise((function(e,r){var s=t.data,n=t.headers;nt.isFormData(s)&&delete n["Content-Type"];var i=new XMLHttpRequest;if(t.auth){var o=t.auth.username||"",a=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.Authorization="Basic "+btoa(o+":"+a)}var u=ut(t.baseURL,t.url);if(i.open(t.method.toUpperCase(),at(u,t.params,t.paramsSerializer),!0),i.timeout=t.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var s="getAllResponseHeaders"in i?dt(i.getAllResponseHeaders()):null,n={data:t.responseType&&"text"!==t.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:s,config:t,request:i};it(e,r,n),i=null}},i.onabort=function(){i&&(r(ct("Request aborted",t,"ECONNABORTED",i)),i=null)},i.onerror=function(){r(ct("Network Error",t,null,i)),i=null},i.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(ct(e,t,"ECONNABORTED",i)),i=null},nt.isStandardBrowserEnv()){var d=(t.withCredentials||ht(u))&&t.xsrfCookieName?ot.read(t.xsrfCookieName):void 0;d&&(n[t.xsrfHeaderName]=d)}if("setRequestHeader"in i&&nt.forEach(n,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete n[e]:i.setRequestHeader(e,t)})),nt.isUndefined(t.withCredentials)||(i.withCredentials=!!t.withCredentials),t.responseType)try{i.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&i.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){i&&(i.abort(),r(t),i=null)})),s||(s=null),i.send(s)}))},pt=B,ft=function(t,e){J.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},vt={"Content-Type":"application/x-www-form-urlencoded"};function mt(t,e){!pt.isUndefined(t)&&pt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var gt,yt={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(gt=lt),gt),transformRequest:[function(t,e){return ft(e,"Accept"),ft(e,"Content-Type"),pt.isFormData(t)||pt.isArrayBuffer(t)||pt.isBuffer(t)||pt.isStream(t)||pt.isFile(t)||pt.isBlob(t)?t:pt.isArrayBufferView(t)?t.buffer:pt.isURLSearchParams(t)?(mt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):pt.isObject(t)?(mt(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};yt.headers={common:{Accept:"application/json, text/plain, */*"}},pt.forEach(["delete","get","head"],(function(t){yt.headers[t]={}})),pt.forEach(["post","put","patch"],(function(t){yt.headers[t]=pt.merge(vt)}));var _t=yt,wt=B,xt=function(t,e,r){return z.forEach(r,(function(r){t=r(t,e)})),t},bt=X,kt=_t;function Ot(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var Et=B,Rt=function(t,e){e=e||{};var r={},s=["url","method","data"],n=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function a(t,e){return Et.isPlainObject(t)&&Et.isPlainObject(e)?Et.merge(t,e):Et.isPlainObject(e)?Et.merge({},e):Et.isArray(e)?e.slice():e}function u(s){Et.isUndefined(e[s])?Et.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Et.forEach(s,(function(t){Et.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Et.forEach(n,u),Et.forEach(i,(function(s){Et.isUndefined(e[s])?Et.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Et.forEach(o,(function(s){s in e?r[s]=a(t[s],e[s]):s in t&&(r[s]=a(void 0,t[s]))}));var d=s.concat(n).concat(i).concat(o),h=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===d.indexOf(t)}));return Et.forEach(h,u),r},jt=B,Tt=I,St=F,At=function(t){return Ot(t),t.headers=t.headers||{},t.data=xt(t.data,t.headers,t.transformRequest),t.headers=wt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),wt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||kt.adapter)(t).then((function(e){return Ot(t),e.data=xt(e.data,e.headers,t.transformResponse),e}),(function(e){return bt(e)||(Ot(t),e&&e.response&&(e.response.data=xt(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},$t=Rt;function Ut(t){this.defaults=t,this.interceptors={request:new St,response:new St}}Ut.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=$t(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[At,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)r=r.then(e.shift(),e.shift());return r},Ut.prototype.getUri=function(t){return t=$t(this.defaults,t),Tt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},jt.forEach(["delete","get","head","options"],(function(t){Ut.prototype[t]=function(e,r){return this.request($t(r||{},{method:t,url:e,data:(r||{}).data}))}})),jt.forEach(["post","put","patch"],(function(t){Ut.prototype[t]=function(e,r,s){return this.request($t(s||{},{method:t,url:e,data:r}))}}));var qt=Ut;function Ct(t){this.message=t}Ct.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ct.prototype.__CANCEL__=!0;var Nt=Ct,Pt=Nt;function Bt(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;t((function(t){r.reason||(r.reason=new Pt(t),e(r.reason))}))}Bt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Bt.source=function(){var t;return{token:new Bt((function(e){t=e})),cancel:t}};var Ht=Bt,Lt=B,It=T,Dt=qt,Mt=Rt;function Ft(t){var e=new Dt(t),r=It(Dt.prototype.request,e);return Lt.extend(r,Dt.prototype,e),Lt.extend(r,e),r}var zt=Ft(_t);zt.Axios=Dt,zt.create=function(t){return Ft(Mt(zt.defaults,t))},zt.Cancel=Nt,zt.CancelToken=Ht,zt.isCancel=X,zt.all=function(t){return Promise.all(t)},zt.spread=function(t){return function(e){return t.apply(null,e)}},zt.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError},j.exports=zt,j.exports.default=zt;var Xt=j.exports;class Jt{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=Xt.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,s,n){var i,o,a,u,d,h,c,l,p;return e(this,void 0,void 0,(function*(){try{(n=n||{}).sendAuthorizationHeaders=null===(i=n.sendAuthorizationHeaders)||void 0===i||i,n.refreshTokenIfNeeded=null===(o=n.refreshTokenIfNeeded)||void 0===o||o,n.headers=null!==(a=n.headers)&&void 0!==a?a:{},n.onUploadProgress=null!==(u=n.onUploadProgress)&&void 0!==u?u:void 0,n.refreshTokenIfNeeded&&(yield this._refresh());const e={method:t,url:r,data:s,params:n.params,headers:n.headers,onUploadProgress:n.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;n.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(Xt.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,s){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,s)}))}put(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,s)}))}post(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,s)}))}patch(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,s)}))}}class Vt{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 Wt{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 s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.resolve(t)))})).catch((t=>{const s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.reject(t)))}))})))}))}}class Kt{constructor(t,e,r){var s,n,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!==(n=null===(s=this.options.refresh)||void 0===s?void 0:s.auto)&&void 0!==n&&n,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 Wt(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 Vt(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 s=this.storage.auth_expires;if(null===s)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 n=s-this.options.refresh.time-Date.now();if(n<0){if(s<Date.now())return;n=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),n))}refresh(t=!1){return e(this,void 0,void 0,(function*(){return yield this.refresher.debounce(t)}))}login(t,r){var s;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===(s=e.data)||void 0===s?void 0:s.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 Gt{constructor(t){this.transport=t}request(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===s?{}:s})}))}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=n,t.Auth=Kt,t.AxiosTransport=Jt,t.BaseStorage=O,t.CollectionsHandler=i,t.CommentsHandler=s,t.Directus=class{constructor(t,r){this._storage=(null==r?void 0:r.storage)||("undefined"!=typeof window?new R:new E),this._transport=(null==r?void 0:r.transport)||new Jt(t,this._storage,(()=>e(this,void 0,void 0,(function*(){yield this._auth.refresh()})))),this._auth=(null==r?void 0:r.auth)||new Kt(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 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 x(this.transport))}get graphql(){return this._graphql||(this._graphql=new Gt(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=R,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=x,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
***************************************************************************** */function e(t,e,r,s){return new(r||(r=Promise))((function(n,i){function o(t){try{u(s.next(t))}catch(t){i(t)}}function a(t){try{u(s.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}u((s=s.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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,r,{params:s})).data}))}updateMany(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{keys:t,data:r},{params:s})}))}updateByQuery(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.patch(`${this.endpoint}`,{query:t,data:r},{params:s})}))}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 s{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 n extends r{constructor(t){super("directus_activity",t),this._comments=new s(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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/collections/${t}`,r,{params:s})).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/fields/${t}/${r}`,s)).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,s){return e(this,void 0,void 0,(function*(){return(yield this.transport.patch(`/relations/${t}/${r}`,{params:s})).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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post("/users/invite",{email:t,role:r,invite_url:s})}))}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,s){return e(this,void 0,void 0,(function*(){yield this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:r,to:s})}))}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,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.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 j{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 j{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 j{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),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},A=T,R=Object.prototype.toString;function N(t){return"[object Array]"===R.call(t)}function $(t){return void 0===t}function U(t){return null!==t&&"object"==typeof t}function C(t){if("[object Object]"!==R.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function P(t){return"[object Function]"===R.call(t)}function q(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),N(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var B={isArray:N,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:U,isPlainObject:C,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:P,isStream:function(t){return U(t)&&P(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:q,merge:function t(){var e={};function r(r,s){C(e[s])&&C(r)?e[s]=t(e[s],r):C(r)?e[s]=t({},r):N(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)q(arguments[s],r);return e},extend:function(t,e,r){return q(e,(function(e,s){t[s]=r&&"function"==typeof e?A(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 I(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var L=function(t,e,r){if(!e)return t;var s;if(r)s=r(e);else if(H.isURLSearchParams(e))s=e.toString();else{var n=[];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)),n.push(I(e)+"="+I(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}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,s,n){return t.config=e,r&&(t.code=r),t.request=s,t.response=n,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}},t},W=J,V=function(t,e,r,s,n){var i=new Error(t);return W(i,e,r,s,n)},X=V,G=B,K=G.isStandardBrowserEnv()?{write:function(t,e,r,s,n,i){var o=[];o.push(t+"="+encodeURIComponent(e)),G.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),G.isString(s)&&o.push("path="+s),G.isString(n)&&o.push("domain="+n),!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)},Z=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Y=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 s(t){var s=t;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{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=s(window.location.href),function(e){var r=et.isString(e)?s(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},st=B,nt=function(t,e,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?e(X("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)},it=K,ot=L,at=function(t,e){return t&&!Q(e)?Z(t,e):e},ut=function(t){var e,r,s,n={};return t?(Y.forEach(t.split("\n"),(function(t){if(s=t.indexOf(":"),e=Y.trim(t.substr(0,s)).toLowerCase(),r=Y.trim(t.substr(s+1)),e){if(n[e]&&tt.indexOf(e)>=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},dt=rt,ht=V,ct=function(t){return new Promise((function(e,r){var s=t.data,n=t.headers,i=t.responseType;st.isFormData(s)&&delete n["Content-Type"];var o=new XMLHttpRequest;if(t.auth){var a=t.auth.username||"",u=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.Authorization="Basic "+btoa(a+":"+u)}var d=at(t.baseURL,t.url);function h(){if(o){var s="getAllResponseHeaders"in o?ut(o.getAllResponseHeaders()):null,n={data:i&&"text"!==i&&"json"!==i?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:s,config:t,request:o};nt(e,r,n),o=null}}if(o.open(t.method.toUpperCase(),ot(d,t.params,t.paramsSerializer),!0),o.timeout=t.timeout,"onloadend"in o?o.onloadend=h:o.onreadystatechange=function(){o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))&&setTimeout(h)},o.onabort=function(){o&&(r(ht("Request aborted",t,"ECONNABORTED",o)),o=null)},o.onerror=function(){r(ht("Network Error",t,null,o)),o=null},o.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(ht(e,t,t.transitional&&t.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},st.isStandardBrowserEnv()){var c=(t.withCredentials||dt(d))&&t.xsrfCookieName?it.read(t.xsrfCookieName):void 0;c&&(n[t.xsrfHeaderName]=c)}"setRequestHeader"in o&&st.forEach(n,(function(t,e){void 0===s&&"content-type"===e.toLowerCase()?delete n[e]:o.setRequestHeader(e,t)})),st.isUndefined(t.withCredentials)||(o.withCredentials=!!t.withCredentials),i&&"json"!==i&&(o.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&o.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){o&&(o.abort(),r(t),o=null)})),s||(s=null),o.send(s)}))},lt=B,pt=function(t,e){z.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},ft=J,vt={"Content-Type":"application/x-www-form-urlencoded"};function mt(t,e){!lt.isUndefined(t)&<.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var gt,yt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(gt=ct),gt),transformRequest:[function(t,e){return pt(e,"Accept"),pt(e,"Content-Type"),lt.isFormData(t)||lt.isArrayBuffer(t)||lt.isBuffer(t)||lt.isStream(t)||lt.isFile(t)||lt.isBlob(t)?t:lt.isArrayBufferView(t)?t.buffer:lt.isURLSearchParams(t)?(mt(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):lt.isObject(t)||e&&"application/json"===e["Content-Type"]?(mt(e,"application/json"),function(t,e,r){if(lt.isString(t))try{return(e||JSON.parse)(t),lt.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional,r=e&&e.silentJSONParsing,s=e&&e.forcedJSONParsing,n=!r&&"json"===this.responseType;if(n||s&<.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw ft(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}};yt.headers={common:{Accept:"application/json, text/plain, */*"}},lt.forEach(["delete","get","head"],(function(t){yt.headers[t]={}})),lt.forEach(["post","put","patch"],(function(t){yt.headers[t]=lt.merge(vt)}));var _t=yt,wt=B,bt=_t,xt=function(t){return!(!t||!t.__CANCEL__)},kt=B,jt=function(t,e,r){var s=this||bt;return wt.forEach(r,(function(r){t=r.call(s,t,e)})),t},Ot=xt,Et=_t;function St(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var Tt=B,At=function(t,e){e=e||{};var r={},s=["url","method","data"],n=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function a(t,e){return Tt.isPlainObject(t)&&Tt.isPlainObject(e)?Tt.merge(t,e):Tt.isPlainObject(e)?Tt.merge({},e):Tt.isArray(e)?e.slice():e}function u(s){Tt.isUndefined(e[s])?Tt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Tt.forEach(s,(function(t){Tt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Tt.forEach(n,u),Tt.forEach(i,(function(s){Tt.isUndefined(e[s])?Tt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Tt.forEach(o,(function(s){s in e?r[s]=a(t[s],e[s]):s in t&&(r[s]=a(void 0,t[s]))}));var d=s.concat(n).concat(i).concat(o),h=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===d.indexOf(t)}));return Tt.forEach(h,u),r},Rt={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},Nt={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Nt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var $t={},Ut=Rt.version.split(".");function Ct(t,e){for(var r=e?e.split("."):Ut,s=t.split("."),n=0;n<3;n++){if(r[n]>s[n])return!0;if(r[n]<s[n])return!1}return!1}Nt.transitional=function(t,e,r){var s=e&&Ct(e);function n(t,e){return"[Axios v"+Rt.version+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,i,o){if(!1===t)throw new Error(n(i," has been removed in "+e));return s&&!$t[i]&&($t[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,o)}};var Pt={isOlderVersion:Ct,assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var s=Object.keys(t),n=s.length;n-- >0;){var i=s[n],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:Nt},qt=B,Bt=L,Ht=F,It=function(t){return St(t),t.headers=t.headers||{},t.data=jt.call(t,t.data,t.headers,t.transformRequest),t.headers=kt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),kt.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||Et.adapter)(t).then((function(e){return St(t),e.data=jt.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return Ot(e)||(St(t),e&&e.response&&(e.response.data=jt.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Lt=At,Dt=Pt,Mt=Dt.validators;function Ft(t){this.defaults=t,this.interceptors={request:new Ht,response:new Ht}}Ft.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=Lt(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&&Dt.assertOptions(e,{silentJSONParsing:Mt.transitional(Mt.boolean,"1.0.0"),forcedJSONParsing:Mt.transitional(Mt.boolean,"1.0.0"),clarifyTimeoutError:Mt.transitional(Mt.boolean,"1.0.0")},!1);var r=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var n,i=[];if(this.interceptors.response.forEach((function(t){i.push(t.fulfilled,t.rejected)})),!s){var o=[It,void 0];for(Array.prototype.unshift.apply(o,r),o=o.concat(i),n=Promise.resolve(t);o.length;)n=n.then(o.shift(),o.shift());return n}for(var a=t;r.length;){var u=r.shift(),d=r.shift();try{a=u(a)}catch(t){d(t);break}}try{n=It(a)}catch(t){return Promise.reject(t)}for(;i.length;)n=n.then(i.shift(),i.shift());return n},Ft.prototype.getUri=function(t){return t=Lt(this.defaults,t),Bt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},qt.forEach(["delete","get","head","options"],(function(t){Ft.prototype[t]=function(e,r){return this.request(Lt(r||{},{method:t,url:e,data:(r||{}).data}))}})),qt.forEach(["post","put","patch"],(function(t){Ft.prototype[t]=function(e,r,s){return this.request(Lt(s||{},{method:t,url:e,data:r}))}}));var zt=Ft;function Jt(t){this.message=t}Jt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Jt.prototype.__CANCEL__=!0;var Wt=Jt,Vt=Wt;function Xt(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;t((function(t){r.reason||(r.reason=new Vt(t),e(r.reason))}))}Xt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Xt.source=function(){var t;return{token:new Xt((function(e){t=e})),cancel:t}};var Gt=Xt,Kt=B,Qt=T,Zt=zt,Yt=At;function te(t){var e=new Zt(t),r=Qt(Zt.prototype.request,e);return Kt.extend(r,Zt.prototype,e),Kt.extend(r,e),r}var ee=te(_t);ee.Axios=Zt,ee.create=function(t){return te(Yt(ee.defaults,t))},ee.Cancel=Wt,ee.CancelToken=Gt,ee.isCancel=xt,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 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=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(t,r,s,n){var i,o,a,u,d,h,c,l,p;return e(this,void 0,void 0,(function*(){try{(n=n||{}).sendAuthorizationHeaders=null===(i=n.sendAuthorizationHeaders)||void 0===i||i,n.refreshTokenIfNeeded=null===(o=n.refreshTokenIfNeeded)||void 0===o||o,n.headers=null!==(a=n.headers)&&void 0!==a?a:{},n.onUploadProgress=null!==(u=n.onUploadProgress)&&void 0!==u?u:void 0,n.refreshTokenIfNeeded&&(yield this._refresh());const e={method:t,url:r,data:s,params:n.params,headers:n.headers,onUploadProgress:n.onUploadProgress},d=this._storage.auth_token,h=this._storage.auth_expires;n.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(re.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,s){return e(this,void 0,void 0,(function*(){return yield this.request("delete",t,r,s)}))}put(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("put",t,r,s)}))}post(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("post",t,r,s)}))}patch(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.request("patch",t,r,s)}))}}class ne{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 ie{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 s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.resolve(t)))})).catch((t=>{const s=[{resolve:e,reject:r},...this.debounced];this.debounced=[],this.debouncing=!1,s.forEach((e=>e.reject(t)))}))})))}))}}class oe{constructor(t,e,r){var s,n,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!==(n=null===(s=this.options.refresh)||void 0===s?void 0:s.auto)&&void 0!==n&&n,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 ne(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 s=this.storage.auth_expires;if(null===s)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 n=s-this.options.refresh.time-Date.now();if(n<0){if(s<Date.now())return;n=0}this.options.refresh.auto&&(this.timer=setTimeout((()=>{this.refresh().then((()=>{})).catch((()=>{}))}),n))}refresh(t=!1){return e(this,void 0,void 0,(function*(){return yield this.refresher.debounce(t)}))}login(t,r){var s;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===(s=e.data)||void 0===s?void 0:s.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 ae{constructor(t){this.transport=t}request(t,r,s){return e(this,void 0,void 0,(function*(){return yield this.transport.post(t,{query:r,variables:void 0===s?{}:s})}))}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=n,t.Auth=oe,t.AxiosTransport=se,t.BaseStorage=j,t.CollectionsHandler=i,t.CommentsHandler=s,t.Directus=class{constructor(t,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 se(t,this._storage,(()=>e(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 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 ae(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=E,t.MemoryStorage=O,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})})); | ||
//# sourceMappingURL=sdk.umd.min.js.map |
{ | ||
"name": "@directus/sdk", | ||
"version": "9.0.0-rc.92", | ||
"version": "9.0.0-rc.93", | ||
"description": "The official Directus SDK for use in JavaScript!", | ||
@@ -55,4 +55,4 @@ "repository": { | ||
"dotenv": "10.0.0", | ||
"jest": "27.1.0", | ||
"jest-environment-jsdom": "27.1.0", | ||
"jest": "27.2.0", | ||
"jest-environment-jsdom": "27.2.0", | ||
"nock": "13.1.3", | ||
@@ -68,5 +68,5 @@ "npm-run-all": "4.1.5", | ||
"ts-node": "10.2.1", | ||
"typescript": "4.4.2" | ||
"typescript": "4.4.3" | ||
}, | ||
"gitHead": "a6e88183e99847c96c956add94a148965b9e50be" | ||
"gitHead": "61a368523b1fc4968ca456a610bc7de10be46dc1" | ||
} |
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
1483455
13435