UNPKG

@directus/sdk-js

Version:

Directus SDK for JavaScript (Node and Browser)

9 lines 45.4 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("DirectusSDK",[],e):"object"==typeof exports?exports.DirectusSDK=e():t.DirectusSDK=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=9)}([function(t,e,r){"use strict";var n=r(2),o=r(12),i=Object.prototype.toString;function s(t){return"[object Array]"===i.call(t)}function a(t){return null!==t&&"object"==typeof t}function c(t){return"[object Function]"===i.call(t)}function u(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),s(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}t.exports={isArray:s,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:o,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:a,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:c,isStream:function(t){return a(t)&&c(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:u,merge:function t(){var e={};function r(r,n){"object"==typeof e[n]&&"object"==typeof r?e[n]=t(e[n],r):e[n]=r}for(var n=0,o=arguments.length;n<o;n++)u(arguments[n],r);return e},extend:function(t,e,r){return u(e,function(e,o){t[o]=r&&"function"==typeof e?n(e,r):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,r){"use strict";(function(e){var n=r(0),o=r(15),i={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!n.isUndefined(t)&&n.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,c={adapter:("undefined"!=typeof XMLHttpRequest?a=r(3):void 0!==e&&(a=r(3)),a),transformRequest:[function(t,e){return o(e,"Content-Type"),n.isFormData(t)||n.isArrayBuffer(t)||n.isBuffer(t)||n.isStream(t)||n.isFile(t)||n.isBlob(t)?t:n.isArrayBufferView(t)?t.buffer:n.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):n.isObject(t)?(s(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,validateStatus:function(t){return t>=200&&t<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],function(t){c.headers[t]={}}),n.forEach(["post","put","patch"],function(t){c.headers[t]=n.merge(i)}),t.exports=c}).call(this,r(14))},function(t,e,r){"use strict";t.exports=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}}},function(t,e,r){"use strict";var n=r(0),o=r(16),i=r(18),s=r(19),a=r(20),c=r(4),u="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||r(21);t.exports=function(t){return new Promise(function(e,l){var f=t.data,p=t.headers;n.isFormData(f)&&delete p["Content-Type"];var d=new XMLHttpRequest,h="onreadystatechange",y=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in d||a(t.url)||(d=new window.XDomainRequest,h="onload",y=!0,d.onprogress=function(){},d.ontimeout=function(){}),t.auth){var m=t.auth.username||"",g=t.auth.password||"";p.Authorization="Basic "+u(m+":"+g)}if(d.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),d.timeout=t.timeout,d[h]=function(){if(d&&(4===d.readyState||y)&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in d?s(d.getAllResponseHeaders()):null,n={data:t.responseType&&"text"!==t.responseType?d.response:d.responseText,status:1223===d.status?204:d.status,statusText:1223===d.status?"No Content":d.statusText,headers:r,config:t,request:d};o(e,l,n),d=null}},d.onerror=function(){l(c("Network Error",t,null,d)),d=null},d.ontimeout=function(){l(c("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",d)),d=null},n.isStandardBrowserEnv()){var v=r(22),b=(t.withCredentials||a(t.url))&&t.xsrfCookieName?v.read(t.xsrfCookieName):void 0;b&&(p[t.xsrfHeaderName]=b)}if("setRequestHeader"in d&&n.forEach(p,function(t,e){void 0===f&&"content-type"===e.toLowerCase()?delete p[e]:d.setRequestHeader(e,t)}),t.withCredentials&&(d.withCredentials=!0),t.responseType)try{d.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&d.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){d&&(d.abort(),l(t),d=null)}),void 0===f&&(f=null),d.send(f)})}},function(t,e,r){"use strict";var n=r(17);t.exports=function(t,e,r,o,i){var s=new Error(t);return n(s,e,r,o,i)}},function(t,e,r){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,r){"use strict";function n(t){this.message=t}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,t.exports=n},function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,o=Array.isArray,i=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),s=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)void 0!==t[n]&&(r[n]=t[n]);return r};t.exports={arrayToObject:s,assign:function(t,e){return Object.keys(e).reduce(function(t,r){return t[r]=e[r],t},t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var i=e[n],s=i.obj[i.prop],a=Object.keys(s),c=0;c<a.length;++c){var u=a[c],l=s[u];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(e.push({obj:s,prop:u}),r.push(l))}return function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(o(r)){for(var n=[],i=0;i<r.length;++i)void 0!==r[i]&&n.push(r[i]);e.obj[e.prop]=n}}}(e),t},decode:function(t,e,r){var n=t.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(t){return n}},encode:function(t,e,r){if(0===t.length)return t;var n="string"==typeof t?t:String(t);if("iso-8859-1"===r)return escape(n).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var o="",s=0;s<n.length;++s){var a=n.charCodeAt(s);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?o+=n.charAt(s):a<128?o+=i[a]:a<2048?o+=i[192|a>>6]+i[128|63&a]:a<55296||a>=57344?o+=i[224|a>>12]+i[128|a>>6&63]+i[128|63&a]:(s+=1,a=65536+((1023&a)<<10|1023&n.charCodeAt(s)),o+=i[240|a>>18]+i[128|a>>12&63]+i[128|a>>6&63]+i[128|63&a])}return o},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},merge:function t(e,r,i){if(!r)return e;if("object"!=typeof r){if(o(e))e.push(r);else{if(!e||"object"!=typeof e)return[e,r];(i&&(i.plainObjects||i.allowPrototypes)||!n.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(r);var a=e;return o(e)&&!o(r)&&(a=s(e,i)),o(e)&&o(r)?(r.forEach(function(r,o){if(n.call(e,o)){var s=e[o];s&&"object"==typeof s&&r&&"object"==typeof r?e[o]=t(s,r,i):e.push(r)}else e[o]=r}),e):Object.keys(r).reduce(function(e,o){var s=r[o];return n.call(e,o)?e[o]=t(e[o],s,i):e[o]=s,e},a)}}},function(t,e,r){"use strict";var n=String.prototype.replace,o=/%20/g;t.exports={default:"RFC3986",formatters:{RFC1738:function(t){return n.call(t,o,"+")},RFC3986:function(t){return t}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(t,e,r){function n(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=r(10),a=r(30),c=r(33),u=r(36);function l(t){var e=t.split(".")[1].replace("-","+").replace("_","/"),r=a.decode(e),n=JSON.parse(r);return u.isNumber(n.exp)&&(n.exp=new Date(1e3*n.exp)),n}function f(){var t,e,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},f="_",p=5;if(a.storage){var d=a.storage.getItem("directus-sdk-js");d&&(t=(d=JSON.parse(d)).token,e=d.url,f=d.project,r=d.localExp)}a.token&&(t=a.token),a.url&&(e=a.url),a.project&&(f=a.project),a.localExp&&(r=a.localExp),a.tokenExpiryTime&&(p=a.tokenExpiryTime);var h={url:e,token:t,project:f,localExp:r,axios:s.create({paramsSerializer:c.stringify,timeout:6e5}),refreshInterval:null,onAutoRefreshError:null,onAutoRefreshSuccess:null,storage:a.storage||null,tokenExpiryTime:p,get payload(){return u.isString(this.token)?l(this.token):null},get loggedIn(){return!!(u.isString(this.token)&&u.isString(this.url)&&u.isString(this.project)&&u.isObject(this.payload)&&this.localExp>Date.now())},request:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];u.string(t,"method"),u.string(e,"endpoint"),u.objectOrEmpty(r,"params"),Array.isArray(n)?u.arrayOrEmpty(n,"data"):u.objectOrEmpty(n,"data"),u.string(this.url,"this.url");var c="".concat(this.url,"/");!1===o&&(c+="".concat(this.project,"/"));var l={url:e,method:t,baseURL:c,params:r,data:n};return this.token&&"string"==typeof this.token&&this.token.length>0&&(l.headers=s,l.headers.Authorization="Bearer ".concat(this.token)),this.axios.request(l).then(function(t){return t.data}).then(function(t){if(!t||0===t.length)return t;if(a)return t;if("object"!==i(t))try{return JSON.parse(t)}catch(e){throw{json:!0,error:e,data:t}}return t}).catch(function(t){throw t.response?t.response.data.error:!0===t.json?{code:-2,message:"API returned invalid JSON",error:t.error,data:t.data}:{code:-1,message:"Network Error",error:t}})},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.string(t,"endpoint"),u.objectOrEmpty(e,"params"),this.request("get",t,e)},post:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u.string(t,"endpoint"),Array.isArray(e)?u.arrayOrEmpty(e,"body"):u.objectOrEmpty(e,"body"),this.request("post",t,r,e)},patch:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u.string(t,"endpoint"),Array.isArray(e)?u.arrayOrEmpty(e,"body"):u.objectOrEmpty(e,"body"),this.request("patch",t,r,e)},put:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u.string(t,"endpoint"),Array.isArray(e)?u.arrayOrEmpty(e,"body"):u.objectOrEmpty(e,"body"),this.request("put",t,r,e)},delete:function(t){return u.string(t,"endpoint"),this.request("delete",t)},login:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{persist:!0};return u.object(t,"credentials"),u.keysWithString(t,["email","password"],"credentials"),this.token=null,u.hasKeysWithString(t,["url"])&&(this.url=t.url),u.hasKeysWithString(t,["project"])&&(this.project=t.project),(t.persist||r.persist)&&this.startInterval(),new Promise(function(r,n){e.post("/auth/authenticate",{email:t.email,password:t.password,otp:t.otp}).then(function(t){return t.data.token}).then(function(t){e.token=t,e.localExp=new Date(Date.now()+6e4*e.tokenExpiryTime).getTime(),e.storage&&e.storage.setItem("directus-sdk-js",JSON.stringify({token:e.token,url:e.url,project:e.project,localExp:e.localExp})),r({url:e.url,project:e.project,token:e.token,localExp:e.localExp})}).catch(n)})},logout:function(){this.token=null,this.refreshInterval&&this.stopInterval(),this.storage&&this.storage.removeItem("directus-sdk-js")},reset:function(){this.logout(),this.url=null,this.project=null},startInterval:function(t){t&&this.refreshIfNeeded(),this.refreshInterval=setInterval(this.refreshIfNeeded.bind(this),1e4)},stopInterval:function(){clearInterval(this.refreshInterval),this.refreshInterval=null},refreshIfNeeded:function(){var t=this;if(u.hasStringKeys(this,["token","url","project"])&&this.payload&&this.payload.exp){var e=this.localExp-Date.now();e<=0?u.isFunction(this.onAutoRefreshError)&&this.onAutoRefreshError({message:"auth_expired_token",code:102}):e<3e4&&this.refresh(this.token).then(function(e){t.token=e.data.token,t.localExp=new Date(Date.now()+6e4*t.tokenExpiryTime).getTime(),u.isFunction(t.onAutoRefreshSuccess)&&t.onAutoRefreshSuccess({url:t.url,project:t.project,token:t.token,localExp:t.localExp}),t.storage&&t.storage.setItem("directus-sdk-js",JSON.stringify({token:t.token,url:t.url,project:t.project,localExp:t.localExp}))}).catch(function(e){u.isFunction(t.onAutoRefreshError)&&t.onAutoRefreshError(e)})}},refresh:function(t){return u.string(t,"token"),this.post("/auth/refresh",{token:t})},requestPasswordReset:function(t){return u.string(t,"email"),this.post("/auth/password/request",{email:t})},getActivity:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/activity",t)},getMyBookmarks:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.string(this.token,"this.token"),u.objectOrEmpty(t),Promise.all([this.get("/collection_presets",{"filter[title][nnull]":1,"filter[user][eq]":this.payload.id}),this.get("/collection_presets",{"filter[title][nnull]":1,"filter[role][eq]":this.payload.role,"filter[user][null]":1})]).then(function(t){var e=o(t,2),r=e[0],i=e[1];return[].concat(n(r.data),n(i.data))})},getCollections:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/collections",t)},getCollection:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.string(t,"collection"),u.objectOrEmpty(e,"params"),this.get("/collections/".concat(t),e)},createCollection:function(t){return u.object(t,"data"),this.post("/collections",t)},updateCollection:function(t,e){return u.string(t,"collection"),u.object(e,"data"),this.patch("/collections/".concat(t),e)},deleteCollection:function(t){return u.string(t,"collection"),this.delete("/collections/".concat(t))},createCollectionPreset:function(t){return u.object(t),this.post("/collection_presets",t)},updateCollectionPreset:function(t,e){return u.notNull(t,"primaryKey"),u.object(e,"data"),this.patch("/collection_presets/".concat(t),e)},deleteCollectionPreset:function(t){return u.notNull(t,"primaryKey"),this.delete("/collection_presets/".concat(t))},updateDatabase:function(){return this.post("/update")},getInterfaces:function(){return this.request("get","/interfaces",{},{},!0)},getLayouts:function(){return this.request("get","/layouts",{},{},!0)},getPages:function(){return this.request("get","/pages",{},{},!0)},getAllFields:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/fields",t)},getFields:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.string(t,"collection"),u.objectOrEmpty(e,"params"),this.get("/fields/".concat(t),e)},getField:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u.string(t,"collection"),u.string(e,"fieldName"),u.objectOrEmpty(r,"params"),this.get("/fields/".concat(t,"/").concat(e),r)},createField:function(t,e){return u.string(t,"collection"),u.object(e,"fieldInfo"),this.post("/fields/".concat(t),e)},updateField:function(t,e,r){return u.string(t,"collection"),u.string(e,"fieldName"),u.object(r,"fieldInfo"),this.patch("/fields/".concat(t,"/").concat(e),r)},updateFields:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return u.string(t,"collection"),u.array(e,"fieldsInfoOrFieldNames"),r&&u.object(r),r?this.patch("/fields/".concat(t,"/").concat(e.join(",")),r):this.patch("/fields/".concat(t),e)},deleteField:function(t,e){return u.string(t,"collection"),u.string(e,"fieldName"),this.delete("/fields/".concat(t,"/").concat(e))},getFiles:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/files",t)},uploadFiles:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={"Content-Type":"multipart/form-data",Authorization:"Bearer ".concat(this.token)};return r&&Object.keys(r).forEach(function(t){n[t]=r[t]}),this.axios.post("".concat(this.url,"/").concat(this.project,"/files"),t,{headers:n,onUploadProgress:e}).then(function(t){return t.data}).catch(function(t){throw t.response?t.response.data.error:{code:-1,message:"Network Error",error:t}})},updateItem:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return u.string(t,"collection"),u.notNull(e,"primaryKey"),u.object(r,"body"),t.startsWith("directus_")?this.patch("/".concat(t.substring(9),"/").concat(e),r,n):this.patch("/items/".concat(t,"/").concat(e),r,n)},updateItems:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u.string(t,"collection"),u.array(e,"body"),t.startsWith("directus_")?this.patch("/".concat(t.substring(9)),e,r):this.patch("/items/".concat(t),e,r)},createItem:function(t,e){return u.string(t,"collection"),u.object(e,"body"),t.startsWith("directus_")?this.post("/".concat(t.substring(9)),e):this.post("/items/".concat(t),e)},createItems:function(t,e){return u.string(t,"collection"),u.array(e,"body"),t.startsWith("directus_")?this.post("/".concat(t.substring(9)),e):this.post("/items/".concat(t),e)},getItems:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.string(t,"collection"),u.objectOrEmpty(e,"params"),t.startsWith("directus_")?this.get("/".concat(t.substring(9)),e):this.get("/items/".concat(t),e)},getItem:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u.string(t,"collection"),u.notNull(e,"primaryKey"),u.objectOrEmpty(r,"params"),t.startsWith("directus_")?this.get("/".concat(t.substring(9),"/").concat(e),r):this.get("/items/".concat(t,"/").concat(e),r)},deleteItem:function(t,e){return u.string(t,"collection"),u.notNull(e,"primaryKey"),t.startsWith("directus_")?this.delete("/".concat(t.substring(9),"/").concat(e)):this.delete("/items/".concat(t,"/").concat(e))},deleteItems:function(t,e){return u.string(t,"collection"),u.array(e,"primaryKeys"),t.startsWith("directus_")?this.delete("/".concat(t.substring(9),"/").concat(e.join())):this.delete("/items/".concat(t,"/").concat(e.join()))},getMyListingPreferences:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.string(this.token,"this.token"),u.objectOrEmpty(e,"params"),Promise.all([this.get("/collection_presets",{limit:1,"filter[title][null]":1,"filter[collection][eq]":t,"filter[role][null]":1,"filter[user][null]":1,sort:"-id"}),this.get("/collection_presets",{limit:1,"filter[title][null]":1,"filter[collection][eq]":t,"filter[role][eq]":this.payload.role,"filter[user][null]":1,sort:"-id"}),this.get("/collection_presets",{limit:1,"filter[title][null]":1,"filter[collection][eq]":t,"filter[role][eq]":this.payload.role,"filter[user][eq]":this.payload.id,sort:"-id"})]).then(function(t){var e=o(t,3),r=e[0],n=e[1],i=e[2];return i.data&&i.data.length>0?i.data[0]:n.data&&n.data.length>0?n.data[0]:r.data&&r.data.length>0?r.data[0]:{}})},getPermissions:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.getItems("directus_permissions",t)},getMyPermissions:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/permissions/me",t)},createPermissions:function(t){return u.array(t),this.post("/permissions",t)},updatePermissions:function(t){return u.array(t),this.patch("/permissions",t)},getRelations:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t),this.get("/relations",t)},createRelation:function(t){return this.post("/relations",t)},updateRelation:function(t,e){return this.patch("/relations/".concat(t),e)},getCollectionRelations:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.string(t,"collection"),u.objectOrEmpty(e),Promise.all([this.get("/relations",{"filter[collection_a][eq]":t}),this.get("/relations",{"filter[collection_b][eq]":t})])},getItemRevisions:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u.string(t,"collection"),u.notNull(e,"primaryKey"),u.objectOrEmpty(r,"params"),t.startsWith("directus_")?this.get("/".concat(t.substring(9),"/").concat(e,"/revisions"),r):this.get("/items/".concat(t,"/").concat(e,"/revisions"),r)},revert:function(t,e,r){return u.string(t,"collection"),u.notNull(e,"primaryKey"),u.number(r,"revisionID"),t.startsWith("directus_")?this.patch("/".concat(t.substring(9),"/").concat(e,"/revert/").concat(r)):this.patch("/items/".concat(t,"/").concat(e,"/revert/").concat(r))},getRole:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.number(t,"primaryKey"),u.objectOrEmpty(e,"params"),this.get("/roles/".concat(t),e)},getRoles:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/roles",t)},updateRole:function(t,e){return u.notNull(t,"primaryKey"),u.object(e,"body"),this.updateItem("directus_roles",t,e)},createRole:function(t){return u.object(t,"body"),this.createItem("directus_roles",t)},deleteRole:function(t){return u.notNull(t,"primaryKey"),this.deleteItem("directus_roles",t)},getSettings:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/settings",t)},getSettingsFields:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/settings/fields",t)},getUsers:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/users",t)},getUser:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.notNull(t,"primaryKey"),u.objectOrEmpty(e,"params"),this.get("/users/".concat(t),e)},getMe:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u.objectOrEmpty(t,"params"),this.get("/users/me",t)},updateUser:function(t,e){return u.notNull(t,"primaryKey"),u.object(e,"body"),this.updateItem("directus_users",t,e)},ping:function(){return this.request("get","/server/ping",{},{},!0,{},!0)},serverInfo:function(){return this.request("get","/",{},{},!0)},projectInfo:function(){return this.request("get","/")},getThirdPartyAuthProviders:function(){return this.get("/auth/sso")}};return h.token&&h.token.includes(".")&&h.startInterval(!0),h}f.getPayload=l,t.exports=f},function(t,e,r){t.exports=r(11)},function(t,e,r){"use strict";var n=r(0),o=r(2),i=r(13),s=r(1);function a(t){var e=new i(t),r=o(i.prototype.request,e);return n.extend(r,i.prototype,e),n.extend(r,e),r}var c=a(s);c.Axios=i,c.create=function(t){return a(n.merge(s,t))},c.Cancel=r(6),c.CancelToken=r(28),c.isCancel=r(5),c.all=function(t){return Promise.all(t)},c.spread=r(29),t.exports=c,t.exports.default=c},function(t,e){function r(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)} /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ t.exports=function(t){return null!=t&&(r(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,r){"use strict";var n=r(1),o=r(0),i=r(23),s=r(24);function a(t){this.defaults=t,this.interceptors={request:new i,response:new i}}a.prototype.request=function(t){"string"==typeof t&&(t=o.merge({url:arguments[0]},arguments[1])),(t=o.merge(n,{method:"get"},this.defaults,t)).method=t.method.toLowerCase();var e=[s,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},o.forEach(["delete","get","head","options"],function(t){a.prototype[t]=function(e,r){return this.request(o.merge(r||{},{method:t,url:e}))}}),o.forEach(["post","put","patch"],function(t){a.prototype[t]=function(e,r,n){return this.request(o.merge(n||{},{method:t,url:e,data:r}))}}),t.exports=a},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],l=!1,f=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&d())}function d(){if(!l){var t=a(p);l=!0;for(var e=u.length;e;){for(c=u,u=[];++f<e;)c&&c[f].run();f=-1,e=u.length}c=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new h(t,e)),1!==u.length||l||a(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){"use strict";var n=r(0);t.exports=function(t,e){n.forEach(t,function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])})}},function(t,e,r){"use strict";var n=r(4);t.exports=function(t,e,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?e(n("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)}},function(t,e,r){"use strict";t.exports=function(t,e,r,n,o){return t.config=e,r&&(t.code=r),t.request=n,t.response=o,t}},function(t,e,r){"use strict";var n=r(0);function o(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,r){if(!e)return t;var i;if(r)i=r(e);else if(n.isURLSearchParams(e))i=e.toString();else{var s=[];n.forEach(e,function(t,e){null!=t&&(n.isArray(t)?e+="[]":t=[t],n.forEach(t,function(t){n.isDate(t)?t=t.toISOString():n.isObject(t)&&(t=JSON.stringify(t)),s.push(o(e)+"="+o(t))}))}),i=s.join("&")}return i&&(t+=(-1===t.indexOf("?")?"?":"&")+i),t}},function(t,e,r){"use strict";var n=r(0),o=["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"];t.exports=function(t){var e,r,i,s={};return t?(n.forEach(t.split("\n"),function(t){if(i=t.indexOf(":"),e=n.trim(t.substr(0,i)).toLowerCase(),r=n.trim(t.substr(i+1)),e){if(s[e]&&o.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}}),s):s}},function(t,e,r){"use strict";var n=r(0);t.exports=n.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=o(window.location.href),function(e){var r=n.isString(e)?o(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0}},function(t,e,r){"use strict";var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function o(){this.message="String contains an invalid character"}o.prototype=new Error,o.prototype.code=5,o.prototype.name="InvalidCharacterError",t.exports=function(t){for(var e,r,i=String(t),s="",a=0,c=n;i.charAt(0|a)||(c="=",a%1);s+=c.charAt(63&e>>8-a%1*8)){if((r=i.charCodeAt(a+=.75))>255)throw new o;e=e<<8|r}return s}},function(t,e,r){"use strict";var n=r(0);t.exports=n.isStandardBrowserEnv()?{write:function(t,e,r,o,i,s){var a=[];a.push(t+"="+encodeURIComponent(e)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.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(){}}},function(t,e,r){"use strict";var n=r(0);function o(){this.handlers=[]}o.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},o.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},o.prototype.forEach=function(t){n.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=o},function(t,e,r){"use strict";var n=r(0),o=r(25),i=r(5),s=r(1),a=r(26),c=r(27);function u(t){t.cancelToken&&t.cancelToken.throwIfRequested()}t.exports=function(t){return u(t),t.baseURL&&!a(t.url)&&(t.url=c(t.baseURL,t.url)),t.headers=t.headers||{},t.data=o(t.data,t.headers,t.transformRequest),t.headers=n.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||s.adapter)(t).then(function(e){return u(t),e.data=o(e.data,e.headers,t.transformResponse),e},function(e){return i(e)||(u(t),e&&e.response&&(e.response.data=o(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}},function(t,e,r){"use strict";var n=r(0);t.exports=function(t,e,r){return n.forEach(r,function(r){t=r(t,e)}),t}},function(t,e,r){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,r){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,r){"use strict";var n=r(6);function o(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 n(t),e(r.reason))})}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var t;return{token:new o(function(e){t=e}),cancel:t}},t.exports=o},function(t,e,r){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,r){(function(t,n){var o;/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */!function(i){var s=e,a=(t&&t.exports,"object"==typeof n&&n);a.global!==a&&a.window;var c=function(t){this.message=t};(c.prototype=new Error).name="InvalidCharacterError";var u=function(t){throw new c(t)},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=/[\t\n\f\r ]/g,p={encode:function(t){t=String(t),/[^\0-\xFF]/.test(t)&&u("The string to be encoded contains characters outside of the Latin1 range.");for(var e,r,n,o,i=t.length%3,s="",a=-1,c=t.length-i;++a<c;)e=t.charCodeAt(a)<<16,r=t.charCodeAt(++a)<<8,n=t.charCodeAt(++a),s+=l.charAt((o=e+r+n)>>18&63)+l.charAt(o>>12&63)+l.charAt(o>>6&63)+l.charAt(63&o);return 2==i?(e=t.charCodeAt(a)<<8,r=t.charCodeAt(++a),s+=l.charAt((o=e+r)>>10)+l.charAt(o>>4&63)+l.charAt(o<<2&63)+"="):1==i&&(o=t.charCodeAt(a),s+=l.charAt(o>>2)+l.charAt(o<<4&63)+"=="),s},decode:function(t){var e=(t=String(t).replace(f,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).length),(e%4==1||/[^+a-zA-Z0-9\/]/.test(t))&&u("Invalid character: the string to be decoded is not correctly encoded.");for(var r,n,o=0,i="",s=-1;++s<e;)n=l.indexOf(t.charAt(s)),r=o%4?64*r+n:n,o++%4&&(i+=String.fromCharCode(255&r>>(-2*o&6)));return i},version:"0.1.0"};void 0===(o=function(){return p}.call(e,r,e,t))||(t.exports=o)}()}).call(this,r(31)(t),r(32))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=r(34),o=r(35),i=r(8);t.exports={formats:i,parse:o,stringify:n}},function(t,e,r){"use strict";var n=r(7),o=r(8),i=Object.prototype.hasOwnProperty,s={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},a=Array.isArray,c=Array.prototype.push,u=function(t,e){c.apply(t,a(e)?e:[e])},l=Date.prototype.toISOString,f={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,formatter:o.formatters[o.default],indices:!1,serializeDate:function(t){return l.call(t)},skipNulls:!1,strictNullHandling:!1},p=function t(e,r,o,i,s,c,l,p,d,h,y,m,g){var v=e;if("function"==typeof l?v=l(r,v):v instanceof Date?v=h(v):"comma"===o&&a(v)&&(v=v.join(",")),null===v){if(i)return c&&!m?c(r,f.encoder,g):r;v=""}if("string"==typeof v||"number"==typeof v||"boolean"==typeof v||n.isBuffer(v))return c?[y(m?r:c(r,f.encoder,g))+"="+y(c(v,f.encoder,g))]:[y(r)+"="+y(String(v))];var b,j=[];if(void 0===v)return j;if(a(l))b=l;else{var w=Object.keys(v);b=p?w.sort(p):w}for(var O=0;O<b.length;++O){var E=b[O];s&&null===v[E]||(a(v)?u(j,t(v[E],"function"==typeof o?o(r,E):r,o,i,s,c,l,p,d,h,y,m,g)):u(j,t(v[E],r+(d?"."+E:"["+E+"]"),o,i,s,c,l,p,d,h,y,m,g)))}return j};t.exports=function(t,e){var r,n=t,c=function(t){if(!t)return f;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||f.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=o.default;if(void 0!==t.format){if(!i.call(o.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n=o.formatters[r],s=f.filter;return("function"==typeof t.filter||a(t.filter))&&(s=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:f.addQueryPrefix,allowDots:void 0===t.allowDots?f.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:f.charsetSentinel,delimiter:void 0===t.delimiter?f.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:f.encode,encoder:"function"==typeof t.encoder?t.encoder:f.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:f.encodeValuesOnly,filter:s,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:f.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:f.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:f.strictNullHandling}}(e);"function"==typeof c.filter?n=(0,c.filter)("",n):a(c.filter)&&(r=c.filter);var l,d=[];if("object"!=typeof n||null===n)return"";l=e&&e.arrayFormat in s?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var h=s[l];r||(r=Object.keys(n)),c.sort&&r.sort(c.sort);for(var y=0;y<r.length;++y){var m=r[y];c.skipNulls&&null===n[m]||u(d,p(n[m],m,h,c.strictNullHandling,c.skipNulls,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.formatter,c.encodeValuesOnly,c.charset))}var g=d.join(c.delimiter),v=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?v+="utf8=%26%2310003%3B&":v+="utf8=%E2%9C%93&"),g.length>0?v+g:""}},function(t,e,r){"use strict";var n=r(7),o=Object.prototype.hasOwnProperty,i={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},s=function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},a=function(t,e,r){if(t){var n=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,s=/(\[[^[\]]*])/.exec(n),a=s?n.slice(0,s.index):n,c=[];if(a){if(!r.plainObjects&&o.call(Object.prototype,a)&&!r.allowPrototypes)return;c.push(a)}for(var u=0;null!==(s=i.exec(n))&&u<r.depth;){if(u+=1,!r.plainObjects&&o.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(s[1])}return s&&c.push("["+n.slice(s.index)+"]"),function(t,e,r){for(var n=e,o=t.length-1;o>=0;--o){var i,s=t[o];if("[]"===s&&r.parseArrays)i=[].concat(n);else{i=r.plainObjects?Object.create(null):{};var a="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,c=parseInt(a,10);r.parseArrays||""!==a?!isNaN(c)&&s!==a&&String(c)===a&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(i=[])[c]=n:i[a]=n:i={0:n}}n=i}return n}(c,e,r)}};t.exports=function(t,e){var r=function(t){if(!t)return i;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new Error("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?i.charset:t.charset;return{allowDots:void 0===t.allowDots?i.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:i.allowPrototypes,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:i.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:i.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:i.comma,decoder:"function"==typeof t.decoder?t.decoder:i.decoder,delimiter:"string"==typeof t.delimiter||n.isRegExp(t.delimiter)?t.delimiter:i.delimiter,depth:"number"==typeof t.depth?t.depth:i.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:i.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:i.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:i.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:i.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var c="string"==typeof t?function(t,e){var r,a={},c=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,u=e.parameterLimit===1/0?void 0:e.parameterLimit,l=c.split(e.delimiter,u),f=-1,p=e.charset;if(e.charsetSentinel)for(r=0;r<l.length;++r)0===l[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===l[r]?p="utf-8":"utf8=%26%2310003%3B"===l[r]&&(p="iso-8859-1"),f=r,r=l.length);for(r=0;r<l.length;++r)if(r!==f){var d,h,y=l[r],m=y.indexOf("]="),g=-1===m?y.indexOf("="):m+1;-1===g?(d=e.decoder(y,i.decoder,p),h=e.strictNullHandling?null:""):(d=e.decoder(y.slice(0,g),i.decoder,p),h=e.decoder(y.slice(g+1),i.decoder,p)),h&&e.interpretNumericEntities&&"iso-8859-1"===p&&(h=s(h)),h&&e.comma&&h.indexOf(",")>-1&&(h=h.split(",")),o.call(a,d)?a[d]=n.combine(a[d],h):a[d]=h}return a}(t,r):t,u=r.plainObjects?Object.create(null):{},l=Object.keys(c),f=0;f<l.length;++f){var p=l[f],d=a(p,c[p],r);u=n.merge(u,d,r)}return n.compact(u)}},function(t,e,r){(function(){var e={};t.exports?t.exports=e:this.ArgumentValidator=e;var r=function(t,r){return function(n){if(r.apply(e,arguments))return!0;var o=null;if(arguments.length>1)o=Array.prototype.slice.call(arguments,-1)[0];e.isJson(n)&&(n=JSON.stringify(n));var i="Invalid "+t+" value: "+n;throw e.isString(o)&&(i+="\nArgument Name: "+o),e.isArray(arguments[1])&&(i+="\nKeys: "+arguments[1].join(", ")),new Error(i)}},n=function(t){for(var e=["is","has"],r=null,n=0;n<e.length&&(r=e[n].length,t.slice(0,r)!==e[n]);n++);var o=t.slice(r+1);return t.slice(r,r+1).toLowerCase()+o},o=function(t,r,n){if(!e.isObjectOrEmpty(r)||!e.isArrayOrEmpty(n))return!1;for(var o=n.length,i=0;i<o;i++){if(!Object.prototype.hasOwnProperty.call(r,n[i]))return!1;if(!t(r[n[i]]))return!1}return!0},i=function(t,r){if(!e.isArray(r))return!1;for(var n=r.length,o=0;o<n;o++)if(!t(r[o]))return!1;return!0};for(var s in e.isNotNull=function(t){return null!=t},e.isInstanceOf=function(t,e){return e instanceof t},e.isType=function(t,e){return Object.prototype.toString.call(e)==="[object "+t+"]"},e.isBoolean=function(t){return[1,0,!0,!1].indexOf(t)>-1},e.isStringOrEmpty=function(t){return e.isType("String",t)},e.isString=function(t){return!!e.isStringOrEmpty(t)&&/\S/.test(t)},e.isNumber=function(t){return!!e.isType("Number",t)&&(isFinite(t)&&!isNaN(parseFloat(t)))},e.isArrayOrEmpty=function(t){return e.isType("Array",t)},e.isArray=function(t){return!!e.isArrayOrEmpty(t)&&t.length>0},e.isArrayOfNumbers=function(t){return i(e.isNumber,t)},e.isArrayOfObjects=function(t){return i(e.isObject,t)},e.isObjectOrEmpty=function(t){return e.isType("Object",t)},e.isObject=function(t){if(!e.isObjectOrEmpty(t))return!1;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))return!0;return!1},e.isJson=function(t){if(!e.isObjectOrEmpty(t))return!1;try{JSON.stringify(t)}catch(t){return!1}return!0},e.isJsonString=function(t){if(!e.isString(t))return!1;try{JSON.parse(t)}catch(t){return!1}return!0},e.hasKeys=function(t,r){return o(e.isNotNull,t,r)},e.hasKeysWithNumber=e.hasNumberKeys=function(t,r){return o(e.isNumber,t,r)},e.hasKeysWithString=e.hasStringKeys=function(t,r){return o(e.isString,t,r)},e.hasKeysWithObject=e.hasObjectKeys=function(t,r){return o(e.isObject,t,r)},e.hasKeysWithStringOrEmpty=e.hasStringOrEmptyKeys=function(t,r){return o(e.isStringOrEmpty,t,r)},e.hasKeysWithObjectOrEmpty=e.hasObjectOrEmptyKeys=function(t,r){return o(e.isObjectOrEmpty,t,r)},e.isFunction=function(t){return e.isInstanceOf(Function,t)},e){var a=n(s);e[a]=r(a,e[s])}}).call(this)}])}); //# sourceMappingURL=directus-sdk.umd.min.js.map