@directus/sdk
Advanced tools
Comparing version 9.0.0-rc.90 to 9.0.0-rc.91
@@ -45,3 +45,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.transport.patch(`/fields/${collection}/${field}}`, item)).data; | ||
return (yield this.transport.patch(`/fields/${collection}/${field}`, item)).data; | ||
}); | ||
@@ -48,0 +48,0 @@ } |
@@ -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(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 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(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}; | ||
//# 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 R 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 E 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 Rt=B,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 Rt.isPlainObject(t)&&Rt.isPlainObject(e)?Rt.merge(t,e):Rt.isPlainObject(e)?Rt.merge({},e):Rt.isArray(e)?e.slice():e}function u(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Rt.forEach(s,(function(t){Rt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Rt.forEach(n,u),Rt.forEach(i,(function(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Rt.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 Rt.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=Et;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=Et;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(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 E:new R),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=E,t.MemoryStorage=R,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 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 R 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 E 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 Rt=B,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 Rt.isPlainObject(t)&&Rt.isPlainObject(e)?Rt.merge(t,e):Rt.isPlainObject(e)?Rt.merge({},e):Rt.isArray(e)?e.slice():e}function u(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Rt.forEach(s,(function(t){Rt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Rt.forEach(n,u),Rt.forEach(i,(function(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Rt.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 Rt.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=Et;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=Et;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(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 E:new R),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=E,t.MemoryStorage=R,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}({}); | ||
//# 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 R 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",R);class E 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",E);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 Rt=B,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 Rt.isPlainObject(t)&&Rt.isPlainObject(e)?Rt.merge(t,e):Rt.isPlainObject(e)?Rt.merge({},e):Rt.isArray(e)?e.slice():e}function u(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Rt.forEach(s,(function(t){Rt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Rt.forEach(n,u),Rt.forEach(i,(function(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Rt.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 Rt.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=Et;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=Et;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(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 E:new R),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 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 R 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",R);class E 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",E);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 Rt=B,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 Rt.isPlainObject(t)&&Rt.isPlainObject(e)?Rt.merge(t,e):Rt.isPlainObject(e)?Rt.merge({},e):Rt.isArray(e)?e.slice():e}function u(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Rt.forEach(s,(function(t){Rt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Rt.forEach(n,u),Rt.forEach(i,(function(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Rt.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 Rt.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=Et;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=Et;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(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 E:new R),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))}})}}})); | ||
//# 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 R 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 j 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 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 $(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 Rt=B,jt=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 Rt.isPlainObject(t)&&Rt.isPlainObject(e)?Rt.merge(t,e):Rt.isPlainObject(e)?Rt.merge({},e):Rt.isArray(e)?e.slice():e}function u(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Rt.forEach(s,(function(t){Rt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Rt.forEach(n,u),Rt.forEach(i,(function(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Rt.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 Rt.forEach(h,u),r},Et=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=jt;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(/^\?/,"")},Et.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}))}})),Et.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=jt;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},E.exports=zt,E.exports.default=zt;var Xt=E.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(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 j:new R),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=j,t.MemoryStorage=R,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 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 R 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 j 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 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 $(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 Rt=B,jt=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 Rt.isPlainObject(t)&&Rt.isPlainObject(e)?Rt.merge(t,e):Rt.isPlainObject(e)?Rt.merge({},e):Rt.isArray(e)?e.slice():e}function u(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(t[s],e[s])}Rt.forEach(s,(function(t){Rt.isUndefined(e[t])||(r[t]=a(void 0,e[t]))})),Rt.forEach(n,u),Rt.forEach(i,(function(s){Rt.isUndefined(e[s])?Rt.isUndefined(t[s])||(r[s]=a(void 0,t[s])):r[s]=a(void 0,e[s])})),Rt.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 Rt.forEach(h,u),r},Et=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=jt;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(/^\?/,"")},Et.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}))}})),Et.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=jt;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},E.exports=zt,E.exports.default=zt;var Xt=E.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(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 j:new R),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=j,t.MemoryStorage=R,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})})); | ||
//# sourceMappingURL=sdk.umd.min.js.map |
{ | ||
"name": "@directus/sdk", | ||
"version": "9.0.0-rc.90", | ||
"version": "9.0.0-rc.91", | ||
"description": "The official Directus SDK for use in JavaScript!", | ||
@@ -52,12 +52,11 @@ "repository": { | ||
"@rollup/plugin-node-resolve": "13.0.4", | ||
"@types/jest": "26.0.24", | ||
"@types/jest": "27.0.1", | ||
"argon2": "0.28.2", | ||
"dotenv": "10.0.0", | ||
"jest": "27.0.6", | ||
"jest-environment-jsdom-global": "2.0.4", | ||
"mockdate": "3.0.5", | ||
"nock": "13.1.1", | ||
"jest-environment-jsdom": "27.0.6", | ||
"nock": "13.1.2", | ||
"npm-run-all": "4.1.5", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.56.2", | ||
"rollup": "2.56.3", | ||
"rollup-plugin-copy": "3.4.0", | ||
@@ -67,7 +66,7 @@ "rollup-plugin-sourcemaps": "0.6.3", | ||
"rollup-plugin-typescript2": "0.30.0", | ||
"ts-jest": "27.0.4", | ||
"ts-node": "10.2.0", | ||
"ts-jest": "27.0.5", | ||
"ts-node": "10.2.1", | ||
"typescript": "4.3.5" | ||
}, | ||
"gitHead": "9f4e855826860f91eb4c2497783268d757ebf879" | ||
"gitHead": "8f943a34f9de168371b520bf3c6e9992c827936e" | ||
} |
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 too big to display
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 too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19
1337823