@openeo/js-client 2.0.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/openeo.d.ts +188 -70
- package/openeo.js +4582 -6899
- package/openeo.min.js +1 -1
- package/package.json +8 -7
- package/src/authprovider.js +1 -1
- package/src/baseentity.js +3 -1
- package/src/builder/builder.js +79 -51
- package/src/builder/formula.js +15 -11
- package/src/builder/node.js +13 -4
- package/src/builder/parameter.js +2 -3
- package/src/builder/tapdigit.js +21 -10
- package/src/capabilities.js +1 -1
- package/src/connection.js +137 -40
- package/src/filetypes.js +3 -3
- package/src/job.js +3 -0
- package/src/oidcprovider.js +3 -3
- package/src/openeo.js +14 -7
- package/src/typedefs.js +13 -3
- package/src/userfile.js +3 -2
- package/src/userprocess.js +9 -1
- package/CHANGELOG.md +0 -118
package/openeo.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("axios"),require("Oidc"));else if("function"==typeof define&&define.amd)define(["axios","Oidc"],t);else{var r="object"==typeof exports?t(require("axios"),require("Oidc")):t(e.axios,e.Oidc);for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(window,(function(e,t){return function(e){var t={};function r(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,s){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(r.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(s,n,function(t){return e[t]}.bind(null,n));return s},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=25)}([function(e,t,r){var s=r(26);class n{static isObject(e){return"object"==typeof e&&e===Object(e)&&!Array.isArray(e)}static equals(e,t){return s(e,t)}static pickFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);const r={};return t.forEach(t=>r[t]=e[t]),r}static omitFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);var r=Object.assign({},e);for(let e of t)delete r[e];return r}static mapObject(e,t){const r=Object.keys(e),s=new Array(r.length);return r.forEach((r,n)=>{s[n]=t(e[r],r,e)}),s}static mapObjectValues(e,t){e=Object(e);const r={};return Object.keys(e).forEach(s=>{r[s]=t(e[s],s,e)}),r}static unique(e,t=!1){return t?e.filter((e,t,r)=>r.findIndex(t=>n.equals(e,t))===t):[...new Set(e)]}static size(e){return"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0}static isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}static deepClone(e){return JSON.parse(JSON.stringify(e))}static normalizeUrl(e,t=null){let r=e.replace(/\/$/,"");return"string"==typeof t&&("/"!==t.substr(0,1)&&(t="/"+t),r+=t.replace(/\/$/,"")),r}static replacePlaceholders(e,t={}){if("string"==typeof e&&n.isObject(t))for(var r in t){let s=t[r];e=e.replace("{"+r+"}",Array.isArray(s)?s.join("; "):s)}return e}static compareStringCaseInsensitive(e,t){return"string"!=typeof e&&(e=String(e)),"string"!=typeof t&&(t=String(t)),e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}static prettifyString(e,t="; "){return Array.isArray(e)||(e=[String(e)]),(e=e.map(e=>{if(e.length>=3){const t=(e,t,r)=>t+" "+r.toUpperCase();return(e=e.includes("_")?e.replace(/([a-zA-Z\d])_([a-zA-Z\d])/g,t):e.includes("-")?e.replace(/([a-zA-Z\d])-([a-zA-Z\d])/g,t):e.replace(/([a-z])([A-Z])/g,t)).charAt(0).toUpperCase()+e.substr(1)}return e})).join(t)}static friendlyLinks(e,t=!0,r=["self"]){let s=[];if(!Array.isArray(e))return s;for(let t of e)t=Object.assign({},t),"string"==typeof t.rel&&r.includes(t.rel.toLowerCase())||("string"==typeof t.title&&0!==t.title.length||("string"==typeof t.rel&&t.rel.length>1?t.title=n.prettifyString(t.rel):t.title=t.href.replace(/^https?:\/\/(www.)?/i,"").replace(/\/$/i,"")),s.push(t));return t&&s.sort((e,t)=>n.compareStringCaseInsensitive(e.title,t.title)),s}}e.exports=n},function(e,t){e.exports=class{static getName(){return"Browser"}static getUrl(){return window.location.toString()}static setUrl(e){throw new Error("setUrl is not supported in a browser environment.")}static handleErrorResponse(e){return new Promise((t,r)=>{let s=new FileReader;s.onerror=e=>{s.abort(),r(e.target.error)},s.onload=()=>{let e=s.result instanceof ArrayBuffer?String.fromCharCode.apply(null,new Uint16Array(s.result)):s.result,r="string"==typeof e?JSON.parse(e):e;t(r)},s.readAsText(e.response.data)})}static getResponseType(){return"blob"}static base64encode(e){return btoa(e)}static fileNameForUpload(e){return e.name.split(/(\\|\/)/g).pop()}static dataForUpload(e){return e}static async downloadResults(e,t,r){throw new Error("downloadResults is not supported in a browser environment.")}static saveToFile(e,t){return new Promise((r,s)=>{try{e instanceof Blob||(e=new Blob([e],{type:"application/octet-stream"}));let s=window.URL.createObjectURL(e),n=document.createElement("a");n.style.display="none",n.href=s,n.setAttribute("download",t||"download"),void 0===n.download&&n.setAttribute("target","_blank"),document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(s),r()}catch(e){console.error(e),s(e)}})}}},function(e,t){e.exports=class{constructor(e,t,r){this.id=r.id||null,this.title=r.title||"",this.description=r.description||"",this.type=e,this.connection=t,this.token=null}getId(){let e=this.getType();return this.getProviderId().length>0&&(e+="."+this.getProviderId()),e}getType(){return this.type}getProviderId(){return"string"==typeof this.id?this.id:""}getTitle(){return this.title}getDescription(){return this.description}getToken(){return"string"==typeof this.token?this.getType()+"/"+this.getProviderId()+"/"+this.token:null}setToken(e){this.token=e,this.connection.emit("tokenChanged",e),null!==this.token?this.connection.setAuthProvider(this):this.connection.setAuthProvider(null)}async login(...e){throw new Error("Not implemented.",e)}async logout(){this.setToken(null)}}},function(e,t){e.exports=class{constructor(e,t=[]){this.connection=e,this.apiToClientNames={},this.clientToApiNames={},this.lastRefreshTime=0,this.extra={};for(let e in t){let r,s;Array.isArray(t[e])?(r=t[e][0],s=t[e][1]):(r=t[e],s=t[e]),this.apiToClientNames[r]=s,this.clientToApiNames[s]=r}}toJSON(){let e={};for(let t in this.clientToApiNames){let r=this.clientToApiNames[t];void 0!==this[t]&&(e[r]=this[t])}return Object.assign(e,this.extra)}setAll(e){for(let t in e)void 0===this.apiToClientNames[t]?this.extra[t]=e[t]:this[this.apiToClientNames[t]]=e[t];return this.lastRefreshTime=Date.now(),this}getDataAge(){return(Date.now()-this.lastRefreshTime)/1e3}getAll(){let e={};for(let t in this.apiToClientNames){let r=this.apiToClientNames[t];e[r]=this[r]}return Object.assign(e,this.extra)}get(e){return void 0!==this.extra[e]?this.extra[e]:null}_convertToRequest(e){let t={};for(let r in e)void 0===this.clientToApiNames[r]?t[r]=e[r]:t[this.clientToApiNames[r]]=e[r];return t}_supports(e){return this.connection.capabilities().hasFeature(e)}}},function(e,t,r){const s=r(0),n=r(5);class i{constructor(e,t,r={},n=null){if(this.parent=e,this.spec=this.parent.spec(t),!s.isObject(this.spec))throw new Error("Process doesn't exist: "+t);this.id=e.generateId(t),this.arguments=Array.isArray(r)?this.namedArguments(r):r,this._description=n,this.result=!1,this.addParametersToProcess(this.arguments)}namedArguments(e){if(e.length>(this.spec.parameters||[]).length)throw new Error("More arguments specified than parameters available.");let t={};if(Array.isArray(this.spec.parameters))for(let r=0;r<this.spec.parameters.length;r++)t[this.spec.parameters[r].name]=e[r];return t}addParametersToProcess(e){for(let t in e){let r=e[t];r instanceof n?s.isObject(r.spec.schema)&&this.parent.addParameter(r.spec):r instanceof i?this.addParametersToProcess(r.arguments):(Array.isArray(r)||s.isObject(r))&&this.addParametersToProcess(r)}}description(e){return void 0===e?this._description:(this._description=e,this)}exportArgument(e,t){const o=r(11);if(s.isObject(e)){if(e instanceof i||e instanceof n)return e.ref();if(e instanceof o){let r=this.createBuilder(this,t);return e.setBuilder(r),e.generate(),r.toJSON()}if(e instanceof Date)return e.toISOString();if("function"==typeof e.toJSON)return e.toJSON();{let r={};for(let s in e)void 0!==e[s]&&(r[s]=this.exportArgument(e[s],t));return r}}return Array.isArray(e)?e.map(e=>this.exportArgument(e),t):"function"==typeof e?this.exportCallback(e,t):e}createBuilder(e=null,t=null){let s=new(r(10))(this.parent.processes,this.parent);return null!==e&&null!==t&&s.setParent(e,t),s}exportCallback(e,t){let r=this.createBuilder(this,t),n=r.getParentCallbackParameters(),o=e.bind(r)(...n,r);if(Array.isArray(o)&&r.supports("array_create")?o=r.array_create(o):!s.isObject(o)&&r.supports("constant")&&(o=r.constant(o)),o instanceof i)return o.result=!0,r.toJSON();throw new Error("Callback must return BuilderNode")}toJSON(){let e={process_id:this.spec.id,arguments:{}};for(let t in this.arguments)void 0!==this.arguments[t]&&(e.arguments[t]=this.exportArgument(this.arguments[t],t));return"function"!=typeof this.description?e.description=this.description:"string"==typeof this._description&&(e.description=this._description),this.result&&(e.result=!0),e}ref(){return{from_node:this.id}}}e.exports=i},function(e,t,r){"use strict";class s{static create(e,t){let r=new s(t,null);return"undefined"!=typeof Proxy?new Proxy(r,{nodeCache:{},get(t,s,n){if(!Reflect.has(t,s)){if(!this.nodeCache[s]){let t={data:r};"string"==typeof s&&s.match(/^(0|[1-9]\d*)$/)?t.index=parseInt(s,10):t.label=s,this.nodeCache[s]=e.process("array_element",t)}return this.nodeCache[s]}return Reflect.get(t,s,n)},set:(e,t,r,s)=>(Reflect.has(e,t)||console.warn("Simplified array access is read-only"),Reflect.set(e,t,r,s))}):(console.warn("Simplified array access not supported, use array_element directly"),r)}constructor(e,t={},r="",s){this.name=e,this.spec={name:e,schema:"string"==typeof t?{type:t}:t,description:r},void 0!==s&&(this.spec.optional=!0,this.spec.default=s)}toJSON(){return this.spec}ref(){return{from_parameter:this.name}}}e.exports=s},function(t,r){t.exports=e},function(e,t,r){"use strict";const{TextEncoder:s,TextDecoder:n}=r(33),i=new n,o=new s;e.exports={decodeText:e=>i.decode(e),encodeText:e=>o.encode(e),concat:function(e,t){const r=new Uint8Array(t);let s=0;for(const t of e)r.set(t,s),s+=t.length;return r}}},function(e,t,r){"use strict";const s=new TextDecoder,n=new TextEncoder;e.exports={decodeText:e=>s.decode(e),encodeText:e=>n.encode(e),concat:function(e,t){const r=new Uint8Array(t);let s=0;for(const t of e)r.set(t,s),s+=t.length;return r}}},function(e,t,r){const s=r(0);e.exports=class{constructor(e,t){this.connection=e,this.endpoint=t,this.lastId=""}async nextLogs(e=null){let t=await this.next(e);return Array.isArray(t.logs)?t.logs:[]}async next(e=null){let t={offset:this.lastId};e>0&&(t.limit=e);let r=await this.connection._get(this.endpoint,t);return Array.isArray(r.data.logs)&&r.data.logs.length>0?(r.data.logs=r.data.logs.filter(e=>s.isObject(e)&&"string"==typeof e.id),this.lastId=r.data.logs[r.data.logs.length-1].id):r.data.logs=[],r.data.links=Array.isArray(r.data.links)?r.data.links:[],r.data}}},function(e,t,r){const s=r(4),n=r(5),i=r(6).default,o=r(0),a=r(51),c=["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links"];class l{static async fromVersion(e=null){let t="https://processes.openeo.org/processes.json";return"string"==typeof e&&(t="https://processes.openeo.org/"+e+"/processes.json"),await l.fromURL(t)}static async fromURL(e){let t=await i(e);return new l(t.data)}constructor(e,t=null,r){if(this.processes=[],this.parent=t,this.parentNode=null,this.parentParameter=null,this.nodes={},this.idCounter={},this.callbackParameterCache={},this.parameters=void 0,this.id=r,o.isObject(e)&&Array.isArray(e.processes)&&(e=e.processes),!Array.isArray(e))throw new Error("Processes are invalid; must be array or object according to the API.");for(let t of e)try{this.addProcessSpec(t)}catch(e){console.warn(e)}}addProcessSpec(e){if(!o.isObject(e))throw new Error("Process '"+e.id+"' must be an object.");if(void 0!==this[e.id])throw new Error("Can't create function for process '"+e.id+"'. Already exists in Builder class.");this.processes.push(e),this[e.id]=function(...t){return this.process(e.id,t)}}setParent(e,t){this.parentNode=e,this.parentParameter=t}createCallbackParameter(e){return this.callbackParameterCache[e]||(this.callbackParameterCache[e]=n.create(this,e)),this.callbackParameterCache[e]}getParentCallbackParameters(){let e=[];if(this.parentNode&&this.parentParameter)try{e=a.getCallbackParametersForProcess(this.parentNode.spec,this.parentParameter).map(e=>this.createCallbackParameter(e.name))}catch(e){console.warn(e)}return e}addParameter(e,t=!0){if(void 0!==this.getParentCallbackParameters().find(t=>t.name===e.name))return;let r=this;if(t)for(;r.parent;)r=r.parent;Array.isArray(r.parameters)||(r.parameters=[]);let s=r.parameters.findIndex(t=>t.name===e.name);-1!==s?Object.assign(r.parameters[s],e):r.parameters.push(e)}spec(e){return this.processes.find(t=>t.id===e)}math(e){let t=new(r(11))(e);return t.setBuilder(this),t.generate(!1)}supports(e){return o.isObject(this.spec(e))}process(e,t={},r=null){let n=new s(this,e,t,r);return this.nodes[n.id]=n,n}toJSON(){let e={process_graph:o.mapObjectValues(this.nodes,e=>e.toJSON())};return c.forEach(t=>{void 0!==this[t]&&(e[t]=this[t])}),e}generateId(e=""){return e=e.replace("_","").substr(0,6),this.idCounter[e]?this.idCounter[e]++:this.idCounter[e]=1,e+this.idCounter[e]}}e.exports=l},function(e,t,r){const s=r(50),n=r(5),i=r(4);class o{constructor(e){let t=new s.Parser;this.tree=t.parse(e),this.builder=null}setBuilder(e){this.builder=e}generate(e=!0){let t=this.parseTree(this.tree);if(!(t instanceof i))throw new Error("Invalid formula specified.");return e&&(t.result=!0),t}parseTree(e){let t=Object.keys(e)[0];switch(t){case"Number":return parseFloat(e.Number);case"Identifier":return this.getRef(e.Identifier);case"Expression":return this.parseTree(e.Expression);case"FunctionCall":{let t=[];for(let r in e.FunctionCall.args)t.push(this.parseTree(e.FunctionCall.args[r]));return this.builder.process(e.FunctionCall.name,t)}case"Binary":return this.addOperatorProcess(e.Binary.operator,this.parseTree(e.Binary.left),this.parseTree(e.Binary.right));case"Unary":{let t=this.parseTree(e.Unary.expression);return"-"===e.Unary.operator?"number"==typeof t?-t:this.addOperatorProcess("*",-1,t):t}default:throw new Error("Operation "+t+" not supported.")}}getRef(e){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if("string"==typeof e&&e.startsWith("#")){let t=e.substring(1);if(t in this.builder.nodes)return{from_node:t}}let t=this.builder.getParentCallbackParameters();if("string"==typeof e&&e.startsWith("$")&&t.length>0){let r=e.substring(1);return t[0][r]}{let t=new n(e);return this.builder.addParameter(t),t}}addOperatorProcess(e,t,r){let s=o.operatorMapping[e],n=this.builder.spec(s);if(s&&n){let i={};if(!Array.isArray(n.parameters)||n.parameters.length<2)throw new Error("Process for operator "+e+" must have at least two parameters");return i[n.parameters[0].name||"x"]=t,i[n.parameters[1].name||"y"]=r,this.builder.process(s,i)}throw new Error("Operator "+e+" not supported")}}o.operatorMapping={"-":"subtract","+":"add","/":"divide","*":"multiply","^":"power"},e.exports=o},function(e,t,r){var s,n,i;n=[],void 0===(i="function"==typeof(s=function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(e){var t,r,s=e.replace(/^v/,"").replace(/\+.*$/,""),n=(r="-",-1===(t=s).indexOf(r)?t.length:t.indexOf(r)),i=s.substring(0,n).split(".");return i.push(s.substring(n+1)),i}function r(e){return isNaN(Number(e))?e:Number(e)}function s(t){if("string"!=typeof t)throw new TypeError("Invalid argument expected string");if(!e.test(t))throw new Error("Invalid argument not valid semver ('"+t+"' received)")}function n(e,n){[e,n].forEach(s);for(var i=t(e),o=t(n),a=0;a<Math.max(i.length-1,o.length-1);a++){var c=parseInt(i[a]||0,10),l=parseInt(o[a]||0,10);if(c>l)return 1;if(l>c)return-1}var u=i[i.length-1],d=o[o.length-1];if(u&&d){var p=u.split(".").map(r),h=d.split(".").map(r);for(a=0;a<Math.max(p.length,h.length);a++){if(void 0===p[a]||"string"==typeof h[a]&&"number"==typeof p[a])return-1;if(void 0===h[a]||"string"==typeof p[a]&&"number"==typeof h[a])return 1;if(p[a]>h[a])return 1;if(h[a]>p[a])return-1}}else if(u||d)return u?-1:1;return 0}var i=[">",">=","=","<","<="],o={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]};return n.validate=function(t){return"string"==typeof t&&e.test(t)},n.compare=function(e,t,r){!function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===i.indexOf(e))throw new TypeError("Invalid operator, expected one of "+i.join("|"))}(r);var s=n(e,t);return o[r].indexOf(s)>-1},n})?s.apply(t,n):s)||(e.exports=i)},function(e,t,r){var s=r(12);const n={datacube:"https://stac-extensions.github.io/datacube/v1.0.0/schema.json",eo:"https://stac-extensions.github.io/eo/v1.0.0/schema.json",file:"https://stac-extensions.github.io/file/v1.0.0/schema.json","item-assets":"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json",label:"https://stac-extensions.github.io/label/v1.0.0/schema.json",pointcloud:"https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json",processing:"https://stac-extensions.github.io/processing/v1.0.0/schema.json",projection:"https://stac-extensions.github.io/projection/v1.0.0/schema.json",raster:"https://stac-extensions.github.io/raster/v1.0.0/schema.json",sar:"https://stac-extensions.github.io/sar/v1.0.0/schema.json",sat:"https://stac-extensions.github.io/sat/v1.0.0/schema.json",scientific:"https://stac-extensions.github.io/scientific/v1.0.0/schema.json",timestamps:"https://stac-extensions.github.io/timestamps/v1.0.0/schema.json",version:"https://stac-extensions.github.io/version/v1.0.0/schema.json",view:"https://stac-extensions.github.io/view/v1.0.0/schema.json"},i={itemAndCollection:{"cube:":n.datacube,"eo:":n.eo,"file:":n.file,"label:":n.label,"pc:":n.pointcloud,"processing:":n.processing,"proj:":n.projection,"raster:":n.raster,"sar:":n.sar,"sat:":n.sat,"sci:":n.scientific,"view:":n.view,version:n.version,deprecated:n.version,published:n.timestamps,expires:n.timestamps,unpublished:n.timestamps},catalog:{},collection:{item_assets:n["item-assets"]},item:{}};i.collection=Object.assign(i.collection,i.itemAndCollection),i.item=Object.assign(i.item,i.itemAndCollection);var o={version:"1.0.0",set(e){e||(e="0.6.0"),o.version=e},before:e=>s.compare(o.version,e,"<")},a={type(e){let t=typeof e;if("object"===t){if(null===e)return"null";if(Array.isArray(e))return"array"}return t},is:(e,t)=>a.type(e)===t,isDefined:e=>void 0!==e,isObject:e=>"object"==typeof e&&e===Object(e)&&!Array.isArray(e),rename:(e,t,r)=>void 0!==e[t]&&void 0===e[r]&&(e[r]=e[t],delete e[t],!0),toArray:(e,t)=>void 0!==e[t]&&!Array.isArray(e[t])&&(e[t]=[e[t]],!0),flattenArray(e,t,r,s=!1){if(Array.isArray(e[t])){for(let n in e[t])if("string"==typeof r[n]){let i=e[t][n];e[r[n]]=s?[i]:i}return delete e[t],!0}return!1},flattenOneElementArray:(e,t,r=!1)=>!(!r&&Array.isArray(e[t]))||1===e[t].length&&(e[t]=e[t][0],!0),removeFromArray(e,t,r){if(Array.isArray(e[t])){let s=e[t].indexOf(r);return s>-1&&e[t].splice(s,1),!0}return!1},addToArrayIfNotExists(e,t,r){if(Array.isArray(e[t])){return-1===e[t].indexOf(r)&&e[t].push(r),e[t].sort(),!0}return!1},ensure:(e,t,r)=>(a.type(r)!==a.type(e[t])&&(e[t]=r),!0),addExtension:(e,t)=>!a.isObject(e)||a.addToArrayIfNotExists(e,"stac_extensions",t)&&!0,removeExtension:(e,t)=>!a.isObject(e)||a.removeFromArray(e,"stac_extensions",t)&&!0,migrateExtensionShortnames(e){let t=Object.keys(n),r=Object.values(n);return a.mapValues(e,"stac_extensions",t,r)},populateExtensions(e,t){let r=[];"catalog"!=t&&"collection"!=t||r.push(e),"item"!=t&&"collection"!=t||!a.isObject(e.assets)||(r=r.concat(Object.values(e.assets))),"collection"==t&&a.isObject(e.item_assets)&&(r=r.concat(Object.values(e.item_assets))),"collection"==t&&a.isObject(e.summaries)&&(r=r.concat(Object.values(e.summaries))),"item"==t&&a.isObject(e.properties)&&r.push(e.properties);for(let s of r)Object.keys(s).forEach(r=>{let s=r.match(/^(\w+:|[^:]+$)/i);if(Array.isArray(s)){let r=i[t][s[0]];a.is(r,"string")&&a.addExtension(e,r)}})},mapValues(e,t,r,s){let n=e=>{let t=r.indexOf(e);return t>=0?s[t]:e};return Array.isArray(e[t])?e[t]=e[t].map(n):void 0!==e[t]&&(e[t]=n(e[t])),!0},mapObject(e,t){for(let r in e)e[r]=t(e[r],r)},moveTo:(e,t,r,s=!1,n=!1)=>(condition=s?n?e=>Array.isArray(e):e=>Array.isArray(e)&&1===e.length:a.isDefined,!!condition(e[t])&&(r[t]=s&&!n?e[t][0]:e[t],delete e[t],!0)),runAll(e,t,r=null){for(let s in e)s.startsWith("migrate")||e[s](t,r)},toUTC(e,t){if("string"==typeof e[t])try{return e[t]=this.toISOString(e[t]),!0}catch(e){}return delete e[t],!1},toISOString:e=>(e instanceof Date||(e=new Date(e)),e.toISOString().replace(".000",""))},c={hexToUint8(e){if(0===e.length||e.length%2!=0)throw new Error(`The string "${e}" is not valid hex.`);return new Uint8Array(e.match(/.{1,2}/g).map(e=>parseInt(e,16)))},uint8ToHex:e=>e.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),toMultihash(e,t,s){if(!a.is(e[t],"string"))return!1;try{const n=r(29).encode(c.hexToUint8(e[t]),s);return e[t]=c.uint8ToHex(n),!0}catch(e){return console.warn(e),!1}}},l={migrate(e,t=!0){o.set(e.stac_version),t&&(e.stac_version="1.0.0"),e.type="Catalog",o.before("1.0.0-rc.1")&&a.migrateExtensionShortnames(e),a.ensure(e,"id",""),a.ensure(e,"description",""),a.ensure(e,"links",[]),a.runAll(l,e,e),a.ensure(e,"stac_extensions",[]),o.before("0.8.0")&&a.populateExtensions(e,"catalog")}},u={migrate(e,t=!0){l.migrate(e,t),e.type="Collection",o.before("1.0.0-rc.1")&&a.migrateExtensionShortnames(e),a.ensure(e,"license","proprietary"),a.ensure(e,"extent",{spatial:{interval:[]},temporal:{bbox:[]}}),a.runAll(u,e,e),a.isObject(e.properties)&&(a.removeFromArray(e,"stac_extensions","commons"),delete e.properties),o.before("0.8.0")&&a.populateExtensions(e,"collection"),o.before("1.0.0-beta.1")&&a.mapValues(e,"stac_extensions",["assets"],["item-assets"])},extent(e){if(o.before("0.8.0")&&(Array.isArray(e.extent.spatial)&&(e.extent.spatial={bbox:[e.extent.spatial]}),Array.isArray(e.extent.temporal)&&(e.extent.temporal={interval:[e.extent.temporal]})),o.before("1.0.0-rc.3")){if(Array.isArray(e.extent.temporal.interval)&&e.extent.temporal.interval.length>1){let t,r;for(let s of e.extent.temporal.interval){if(null===s[0])t=null;else if("string"==typeof s[0]&&null!==t)try{let e=new Date(s[0]);(void 0===t||e<t)&&(t=e)}catch(e){}if(null===s[1])r=null;else if("string"==typeof s[1]&&null!==r)try{let e=new Date(s[1]);(void 0===r||e>r)&&(r=e)}catch(e){}}e.extent.temporal.interval.unshift([t?a.toISOString(t):null,r?a.toISOString(r):null])}if(Array.isArray(e.extent.spatial.bbox)&&e.extent.spatial.bbox.length>1){let t=e.extent.spatial.bbox.reduce((e,t)=>Array.isArray(t)?Math.max(t.length,e):e,4);if(t>=4){let r=new Array(t).fill(null),s=t/2;for(let t of e.extent.spatial.bbox){if(!Array.isArray(t)||t.length<4)break;for(let e in t){let n=t[e];null===r[e]?r[e]=n:r[e]=e<s?Math.min(n,r[e]):Math.max(n,r[e])}}-1===r.findIndex(e=>null===e)&&e.extent.spatial.bbox.unshift(r)}}}},collectionAssets(e){o.before("1.0.0-rc.1")&&a.removeExtension(e,"collection-assets"),p.migrateAll(e)},itemAsset(e){o.before("1.0.0-beta.2")&&a.rename(e,"item_assets","assets"),p.migrateAll(e,"item_assets")},summaries(e){if(a.ensure(e,"summaries",{}),o.before("0.8.0")&&a.isObject(e.other_properties)){for(let t in e.other_properties){let r=e.other_properties[t];Array.isArray(r.extent)&&2===r.extent.length?e.summaries[t]={minimum:r.extent[0],maximum:r.extent[1]}:Array.isArray(r.values)&&(r.values.filter(e=>Array.isArray(e)).length===r.values.length?e.summaries[t]=r.values.reduce((e,t)=>e.concat(t),[]):e.summaries[t]=r.values)}delete e.other_properties}if(o.before("1.0.0-beta.1")&&a.isObject(e.properties)&&!e.links.find(e=>["child","item"].includes(e.rel)))for(let t in e.properties){let r=e.properties[t];Array.isArray(r)||(r=[r]),e.summaries[t]=r}o.before("1.0.0-rc.1")&&a.mapObject(e.summaries,e=>(a.rename(e,"min","minimum"),a.rename(e,"max","maximum"),e)),h.migrate(e.summaries),a.moveTo(e.summaries,"sci:doi",e,!0)&&a.addExtension(e,n.scientific),a.moveTo(e.summaries,"sci:publications",e,!0,!0)&&a.addExtension(e,n.scientific),a.moveTo(e.summaries,"sci:citation",e,!0)&&a.addExtension(e,n.scientific),a.moveTo(e.summaries,"cube:dimensions",e,!0)&&a.addExtension(e,n.datacube),0===Object.keys(e.summaries).length&&delete e.summaries}},d={migrate(e,t=null,r=!0){o.set(e.stac_version),r&&(e.stac_version="1.0.0"),o.before("1.0.0-rc.1")&&a.migrateExtensionShortnames(e),a.ensure(e,"id",""),a.ensure(e,"type","Feature"),a.isObject(e.geometry)||(e.geometry=null),null!==e.geometry&&a.ensure(e,"bbox",[]),a.ensure(e,"properties",{}),a.ensure(e,"links",[]),a.ensure(e,"assets",{});let s=!1;a.isObject(t)&&a.isObject(t.properties)&&(a.removeFromArray(e,"stac_extensions","commons"),e.properties=Object.assign({},t.properties,e.properties),s=!0),a.runAll(d,e,e),h.migrate(e.properties,e),p.migrateAll(e),a.ensure(e,"stac_extensions",[]),(o.before("0.8.0")||s)&&a.populateExtensions(e,"item")}},p={migrateAll(e,t="assets"){for(let r in e[t])p.migrate(e[t][r],e)},migrate(e,t){a.runAll(p,e,t),h.migrate(e,t)},mediaTypes(e){a.is(e.type,"string")&&o.before("0.8.0")&&a.mapValues(e,"type",["image/vnd.stac.geotiff","image/vnd.stac.geotiff; cloud-optimized=true"],["image/tiff; application=geotiff","image/tiff; application=geotiff; profile=cloud-optimized"])},eo(e,t){let r=a.isObject(t.properties)&&Array.isArray(t.properties["eo:bands"])?t.properties["eo:bands"]:[];if(Array.isArray(e["eo:bands"]))for(let t in e["eo:bands"]){let s=e["eo:bands"][t];a.is(s,"number")&&a.isObject(r[s])?s=r[s]:a.isObject(s)||(s={}),e["eo:bands"][t]=s}}},h={migrate(e,t){a.runAll(h,e,t)},_commonMetadata(e){o.before("1.0.0-rc.3")&&(a.toUTC(e,"created"),a.toUTC(e,"updated"))},_timestamps(e){a.toUTC(e,"published"),a.toUTC(e,"expires"),a.toUTC(e,"unpublished")},_versioningIndicator(e){},checksum(e,t){o.before("0.9.0")&&(a.rename(e,"checksum:md5","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","md5"),a.rename(e,"checksum:sha1","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha1"),a.rename(e,"checksum:sha2","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha2-256"),a.rename(e,"checksum:sha3","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha3-256")),o.before("1.0.0-rc.1")&&a.rename(e,"checksum:multihash","file:checksum")&&a.addExtension(t,n.file)},cube(){},dtr(e,t){o.before("0.9.0")&&(a.rename(e,"dtr:start_datetime","start_datetime"),a.rename(e,"dtr:end_datetime","end_datetime"),a.removeExtension(t,"datetime-range"))},eo(e,t){o.before("0.9.0")&&(a.rename(e,"eo:epsg","proj:epsg")&&a.addExtension(t,n.projection),a.rename(e,"eo:platform","platform"),a.rename(e,"eo:instrument","instruments")&&a.toArray(e,"instruments"),a.rename(e,"eo:constellation","constellation"),a.rename(e,"eo:off_nadir","view:off_nadir")&&a.addExtension(t,n.view),a.rename(e,"eo:azimuth","view:azimuth")&&a.addExtension(t,n.view),a.rename(e,"eo:incidence_angle","view:incidence_angle")&&a.addExtension(t,n.view),a.rename(e,"eo:sun_azimuth","view:sun_azimuth")&&a.addExtension(t,n.view),a.rename(e,"eo:sun_elevation","view:sun_elevation")&&a.addExtension(t,n.view)),o.before("1.0.0-beta.1")&&a.rename(e,"eo:gsd","gsd")},label(e){o.before("0.8.0")&&(a.rename(e,"label:property","label:properties"),a.rename(e,"label:task","label:tasks"),a.rename(e,"label:overview","label:overviews")&&a.toArray(e,"label:overviews"),a.rename(e,"label:method","label:methods"),a.toArray(e,"label:classes"))},pc(e){o.before("0.8.0")&&a.rename(e,"pc:schema","pc:schemas")},proj(e){},sar(e,t){let r=!t;a.rename(e,"sar:incidence_angle","view:incidence_angle")&&a.addExtension(t,n.view),a.rename(e,"sar:pass_direction","sat:orbit_state")&&a.mapValues(e,"sat:orbit_state",[null],["geostationary"])&&a.addExtension(t,n.sat),o.before("0.7.0")&&(a.flattenArray(e,"sar:resolution",["sar:resolution_range","sar:resolution_azimuth"],r),a.flattenArray(e,"sar:pixel_spacing",["sar:pixel_spacing_range","sar:pixel_spacing_azimuth"],r),a.flattenArray(e,"sar:looks",["sar:looks_range","sar:looks_azimuth","sar:looks_equivalent_number"],r),a.rename(e,"sar:off_nadir","view:off_nadir")&&a.addExtension(t,n.view)),o.before("0.9.0")&&(a.rename(e,"sar:platform","platform"),a.rename(e,"sar:instrument","instruments")&&a.toArray(e,"instruments"),a.rename(e,"sar:constellation","constellation"),a.rename(e,"sar:type","sar:product_type"),a.rename(e,"sar:polarization","sar:polarizations"),a.flattenOneElementArray(e,"sar:absolute_orbit",r)&&a.rename(e,"sar:absolute_orbit","sat:absolute_orbit")&&a.addExtension(t,n.sat),a.flattenOneElementArray(e,"sar:relative_orbit",r)&&a.rename(e,"sar:relative_orbit","sat:relative_orbit")&&a.addExtension(t,n.sat))},sat(e){o.before("0.9.0")&&(a.rename(e,"sat:off_nadir_angle","sat:off_nadir"),a.rename(e,"sat:azimuth_angle","sat:azimuth"),a.rename(e,"sat:sun_azimuth_angle","sat:sun_azimuth"),a.rename(e,"sat:sun_elevation_angle","sat:sun_elevation"))},sci(e){},item(e){o.before("0.8.0")&&(a.rename(e,"item:license","license"),a.rename(e,"item:providers","providers"))},view(e){}},f={item:(e,t=null,r=!0)=>(d.migrate(e,t,r),e),catalog:(e,t=!0)=>(l.migrate(e,t),e),collection:(e,t=!0)=>(u.migrate(e,t),e),stac:(e,t=!0)=>"Feature"===e.type?f.item(e,null,t):"Collection"===e.type||a.isDefined(e.extent)||a.isDefined(e.license)?f.collection(e,t):f.catalog(e,t)};e.exports=f},function(e,t,r){"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var s=0;s<e.length;s++){var n=e.charAt(s),i=n.charCodeAt(0);if(255!==t[i])throw new TypeError(n+" is ambiguous");t[i]=s}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),l=Math.log(256)/Math.log(o);function u(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var r=0;if(" "!==e[r]){for(var s=0,n=0;e[r]===a;)s++,r++;for(var i=(e.length-r)*c+1>>>0,l=new Uint8Array(i);e[r];){var u=t[e.charCodeAt(r)];if(255===u)return;for(var d=0,p=i-1;(0!==u||d<n)&&-1!==p;p--,d++)u+=o*l[p]>>>0,l[p]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");n=d,r++}if(" "!==e[r]){for(var h=i-n;h!==i&&0===l[h];)h++;for(var f=new Uint8Array(s+(i-h)),b=s;h!==i;)f[b++]=l[h++];return f}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,s=0,n=0,i=t.length;n!==i&&0===t[n];)n++,r++;for(var c=(i-n)*l+1>>>0,u=new Uint8Array(c);n!==i;){for(var d=t[n],p=0,h=c-1;(0!==d||p<s)&&-1!==h;h--,p++)d+=256*u[h]>>>0,u[h]=d%o>>>0,d=d/o>>>0;if(0!==d)throw new Error("Non-zero carry");s=p,n++}for(var f=c-s;f!==c&&0===u[f];)f++;for(var b=a.repeat(r);f<c;++f)b+=e.charAt(u[f]);return b},decodeUnsafe:u,decode:function(e){var t=u(e);if(t)return t;throw new Error("Non-base"+o+" character")}}}},function(e,t,r){(function(e){var s=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},s=0;s<t.length;s++)r[t[s]]=Object.getOwnPropertyDescriptor(e,t[s]);return r},n=/%[sdj%]/g;t.format=function(e){if(!y(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(a(arguments[r]));return t.join(" ")}r=1;for(var s=arguments,i=s.length,o=String(e).replace(n,(function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(s[r++]);case"%d":return Number(s[r++]);case"%j":try{return JSON.stringify(s[r++])}catch(e){return"[Circular]"}default:return e}})),c=s[r];r<i;c=s[++r])b(c)||!v(c)?o+=" "+c:o+=" "+a(c);return o},t.deprecate=function(r,s){if(void 0!==e&&!0===e.noDeprecation)return r;if(void 0===e)return function(){return t.deprecate(r,s).apply(this,arguments)};var n=!1;return function(){if(!n){if(e.throwDeprecation)throw new Error(s);e.traceDeprecation?console.trace(s):console.error(s),n=!0}return r.apply(this,arguments)}};var i,o={};function a(e,r){var s={seen:[],stylize:l};return arguments.length>=3&&(s.depth=arguments[2]),arguments.length>=4&&(s.colors=arguments[3]),f(r)?s.showHidden=r:r&&t._extend(s,r),g(s.showHidden)&&(s.showHidden=!1),g(s.depth)&&(s.depth=2),g(s.colors)&&(s.colors=!1),g(s.customInspect)&&(s.customInspect=!0),s.colors&&(s.stylize=c),u(s,e,s.depth)}function c(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function l(e,t){return e}function u(e,r,s){if(e.customInspect&&r&&A(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(s,e);return y(n)||(n=u(e,n,s)),n}var i=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(y(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(m(t))return e.stylize(""+t,"number");if(f(t))return e.stylize(""+t,"boolean");if(b(t))return e.stylize("null","null")}(e,r);if(i)return i;var o=Object.keys(r),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),x(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return d(r);if(0===o.length){if(A(r)){var c=r.name?": "+r.name:"";return e.stylize("[Function"+c+"]","special")}if(k(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(x(r))return d(r)}var l,v="",O=!1,j=["{","}"];(h(r)&&(O=!0,j=["[","]"]),A(r))&&(v=" [Function"+(r.name?": "+r.name:"")+"]");return k(r)&&(v=" "+RegExp.prototype.toString.call(r)),w(r)&&(v=" "+Date.prototype.toUTCString.call(r)),x(r)&&(v=" "+d(r)),0!==o.length||O&&0!=r.length?s<0?k(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),l=O?function(e,t,r,s,n){for(var i=[],o=0,a=t.length;o<a;++o)T(t,String(o))?i.push(p(e,t,r,s,String(o),!0)):i.push("");return n.forEach((function(n){n.match(/^\d+$/)||i.push(p(e,t,r,s,n,!0))})),i}(e,r,s,a,o):o.map((function(t){return p(e,r,s,a,t,O)})),e.seen.pop(),function(e,t,r){if(e.reduce((function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(l,v,j)):j[0]+v+j[1]}function d(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,s,n,i){var o,a,c;if((c=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),T(s,n)||(o="["+n+"]"),a||(e.seen.indexOf(c.value)<0?(a=b(r)?u(e,c.value,null):u(e,c.value,r-1)).indexOf("\n")>-1&&(a=i?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),g(o)){if(i&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function h(e){return Array.isArray(e)}function f(e){return"boolean"==typeof e}function b(e){return null===e}function m(e){return"number"==typeof e}function y(e){return"string"==typeof e}function g(e){return void 0===e}function k(e){return v(e)&&"[object RegExp]"===O(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===O(e)}function x(e){return v(e)&&("[object Error]"===O(e)||e instanceof Error)}function A(e){return"function"==typeof e}function O(e){return Object.prototype.toString.call(e)}function j(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(g(i)&&(i=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!o[r])if(new RegExp("\\b"+r+"\\b","i").test(i)){var s=e.pid;o[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,s,e)}}else o[r]=function(){};return o[r]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=f,t.isNull=b,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=y,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=g,t.isRegExp=k,t.isObject=v,t.isDate=w,t.isError=x,t.isFunction=A,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(35);var _=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),_[e.getMonth()],t].join(" ")}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",E(),t.format.apply(t,arguments))},t.inherits=r(36),t._extend=function(e,t){if(!t||!v(t))return e;for(var r=Object.keys(t),s=r.length;s--;)e[r[s]]=t[r[s]];return e};var S="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function P(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(S&&e[S]){var t;if("function"!=typeof(t=e[S]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,S,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,s=new Promise((function(e,s){t=e,r=s})),n=[],i=0;i<arguments.length;i++)n.push(arguments[i]);n.push((function(e,s){e?r(e):t(s)}));try{e.apply(this,n)}catch(e){r(e)}return s}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),S&&Object.defineProperty(t,S,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,s(e))},t.promisify.custom=S,t.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],s=0;s<arguments.length;s++)r.push(arguments[s]);var n=r.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var i=this,o=function(){return n.apply(i,arguments)};t.apply(this,r).then((function(t){e.nextTick(o,null,t)}),(function(t){e.nextTick(P,t,o)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,s(t)),r}}).call(this,r(34))},function(e,t,r){"use strict";const s=r(44),{encodeText:n,decodeText:i,concat:o}=r(8);function a(e){if(Object.prototype.hasOwnProperty.call(s.names,e))return s.names[e];if(Object.prototype.hasOwnProperty.call(s.codes,e))return s.codes[e];throw new Error("Unsupported encoding: "+e)}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:r,codeBuf:s}=a(e);return function(e,t){a(e).decode(i(t))}(r,t),o([s,t],s.length+t.length)}).encode=function(e,t){const r=a(e),s=n(r.encode(t));return o([r.codeBuf,s],r.codeBuf.length+s.length)},t.decode=function(e){e instanceof Uint8Array&&(e=i(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),a(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=i(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return a(e[0]).name}catch(e){return!1}},t.encoding=a,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=i(e)),a(e[0])};const c=Object.freeze(s.names),l=Object.freeze(s.codes);t.names=c,t.codes=l},function(e,t,r){const s=r(1),n=r(0),i=r(2);e.exports=class extends i{constructor(e){super("basic",e,{id:null,title:"HTTP Basic",description:"Login with username and password using the method HTTP Basic."})}async login(e,t){let r=await this.connection._send({method:"get",responseType:"json",url:"/credentials/basic",headers:{Authorization:"Basic "+s.base64encode(e+":"+t)}});if(!n.isObject(r.data)||"string"!=typeof r.data.access_token)throw new Error("No access_token returned.");this.setToken(r.data.access_token)}}},function(e,t,r){const s=r(0),n=r(2),i=r(1),o=r(49);class a extends n{static isSupported(){return s.isObject(o)&&Boolean(o.UserManager)}static async signinCallback(e=null,t={}){let r=i.getUrl();e||(e=new a(null,{})).setGrant(r.includes("?")?"authorization_code+pkce":"implicit");let s=e.getOptions(t),n=new o.UserManager(s);return await n.signinCallback(r)}constructor(e,t){super("oidc",e,t),this.manager=null,this.listeners={},this.user=null,this.clientId=null,this.grant="authorization_code+pkce",this.issuer=t.issuer||"",this.scopes=Array.isArray(t.scopes)&&t.scopes.length>0?t.scopes:["openid"],this.links=Array.isArray(t.links)?t.links:[],this.defaultClients=Array.isArray(t.default_clients)?t.default_clients:[],this.defaultClient=this.detectDefaultClient()}addListener(e,t,r="default"){this.manager.events["add"+e](t),this.listeners[`${r}:${e}`]=t}removeListener(e,t="default"){this.manager.events["remove"+e](this.listeners[e]),delete this.listeners[`${t}:${e}`]}async login(e={}){if(!this.issuer||"string"!=typeof this.issuer)throw new Error("No Issuer URL available for OpenID Connect");this.manager=new o.UserManager(this.getOptions(e)),this.addListener("UserLoaded",async()=>this.setUser(await this.manager.getUser()),"js-client"),this.addListener("AccessTokenExpired",()=>this.setUser(null),"js-client"),"popup"===a.uiMethod?await this.manager.signinPopup():await this.manager.signinRedirect()}async logout(){if(null!==this.manager){try{"popup"===a.uiMethod?await this.manager.signoutPopup():await this.manager.signoutRedirect({post_logout_redirect_uri:i.getUrl()})}catch(e){console.warn(e)}super.logout(),this.removeListener("UserLoaded","js-client"),this.removeListener("AccessTokenExpired","js-client"),this.manager=null,this.setUser(null)}}getOptions(e={}){let t=this.getResponseType();return Object.assign({client_id:this.clientId,redirect_uri:a.redirectUrl,authority:this.issuer.replace("/.well-known/openid-configuration",""),scope:this.scopes.join(" "),validateSubOnSilentRenew:!0,response_type:t,response_mode:t.includes("code")?"query":"fragment"},e)}getResponseType(){switch(this.grant){case"authorization_code+pkce":return"code";case"implicit":return"token id_token";default:throw new Error("Grant Type not supported")}}setGrant(e){switch(e){case"authorization_code+pkce":case"implicit":this.grant=e;break;default:throw new Error("Grant Type not supported")}}setClientId(e){this.clientId=e}setUser(e){e?(this.user=e,this.setToken(e.access_token)):(this.user=null,this.setToken(null))}detectDefaultClient(){for(let e of a.grants){let t=this.defaultClients.find(t=>Boolean(t.grant_types.includes(e)&&Array.isArray(t.redirect_urls)&&t.redirect_urls.find(e=>e.startsWith(a.redirectUrl))));if(t)return this.setGrant(e),this.setClientId(t.id),this.defaultClient=t,t}return null}}a.uiMethod="redirect",a.redirectUrl=i.getUrl().split("#")[0].split("?")[0].replace(/\/$/,""),a.grants=["authorization_code+pkce","implicit"],e.exports=a},function(e,t,r){const s=r(0);e.exports=class{constructor(e){if(!s.isObject(e))throw new Error("No capabilities retrieved.");if(!e.api_version)throw new Error("Invalid capabilities: No API version retrieved");if(!Array.isArray(e.endpoints))throw new Error("Invalid capabilities: No endpoints retrieved");this.data=e,this.features=this.data.endpoints.map(e=>e.methods.map(t=>(t+" "+e.path).toLowerCase())).reduce((e,t)=>e.concat(t),[]),this.featureMap={capabilities:!0,listFileTypes:"get /file_formats",listServiceTypes:"get /service_types",listUdfRuntimes:"get /udf_runtimes",listCollections:"get /collections",describeCollection:"get /collections/{collection_id}",listCollectionItems:"get /collections/{collection_id}/items",listProcesses:"get /processes",describeProcess:"get /processes",listAuthProviders:!0,authenticateOIDC:"get /credentials/oidc",authenticateBasic:"get /credentials/basic",describeAccount:"get /me",listFiles:"get /files",getFile:"get /files",uploadFile:"put /files/{path}",downloadFile:"get /files/{path}",deleteFile:"delete /files/{path}",validateProcess:"post /validation",listUserProcesses:"get /process_graphs",describeUserProcess:"get /process_graphs/{process_graph_id}",getUserProcess:"get /process_graphs/{process_graph_id}",setUserProcess:"put /process_graphs/{process_graph_id}",replaceUserProcess:"put /process_graphs/{process_graph_id}",deleteUserProcess:"delete /process_graphs/{process_graph_id}",computeResult:"post /result",listJobs:"get /jobs",createJob:"post /jobs",listServices:"get /services",createService:"post /services",getJob:"get /jobs/{job_id}",describeJob:"get /jobs/{job_id}",updateJob:"patch /jobs/{job_id}",deleteJob:"delete /jobs/{job_id}",estimateJob:"get /jobs/{job_id}/estimate",debugJob:"get /jobs/{job_id}/logs",startJob:"post /jobs/{job_id}/results",stopJob:"delete /jobs/{job_id}/results",listResults:"get /jobs/{job_id}/results",downloadResults:"get /jobs/{job_id}/results",describeService:"get /services/{service_id}",getService:"get /services/{service_id}",updateService:"patch /services/{service_id}",deleteService:"delete /services/{service_id}",debugService:"get /services/{service_id}/logs"}}toJSON(){return this.data}apiVersion(){return this.data.api_version}backendVersion(){return this.data.backend_version}title(){return"string"==typeof this.data.title?this.data.title:""}description(){return"string"==typeof this.data.description?this.data.description:""}isStable(){return!0===this.data.production}links(){return Array.isArray(this.data.links)?this.data.links:[]}listFeatures(){let e=[];for(let t in this.featureMap)(!0===this.featureMap[t]||this.features.includes(this.featureMap[t]))&&e.push(t);return e.sort()}hasFeature(e){return!0===this.featureMap[e]||this.features.some(t=>t===this.featureMap[e])}currency(){return s.isObject(this.data.billing)&&"string"==typeof this.data.billing.currency?this.data.billing.currency:null}listPlans(){if(s.isObject(this.data.billing)&&Array.isArray(this.data.billing.plans)){let e="string"==typeof this.data.billing.default_plan?this.data.billing.default_plan.toLowerCase():null;return this.data.billing.plans.map(t=>{let r={default:e===t.name.toLowerCase()};return Object.assign({},t,r)})}return[]}}},function(e,t,r){const s=r(0);e.exports=class{constructor(e){if(this.data={input:{},output:{}},s.isObject(e))for(let t of["input","output"])for(let r in e[t])s.isObject(e[t])&&(this.data[t][r.toUpperCase()]=e[t][r])}toJSON(){return this.data}getInputTypes(){return this.data.input}getOutputTypes(){return this.data.output}getInputType(e){return this._findType(e,"input")}getOutputType(e){return this._findType(e,"output")}_findType(e,t){return(e=e.toUpperCase())in this.data[t]?this.data[t][e]:null}}},function(e,t,r){const s=r(1),n=r(3);e.exports=class extends n{constructor(e,t){super(e,["path","size","modified"]),this.path=t,this.size=void 0,this.modified=void 0}async retrieveFile(){return await this.connection.download("/files/"+this.path,!0)}async downloadFile(e){let t=await this.connection.download("/files/"+this.path,!0);return await s.saveToFile(t,e)}async uploadFile(e,t=null){let r={method:"put",url:"/files/"+this.path,data:s.dataForUpload(e),headers:{"Content-Type":"application/octet-stream"}};"function"==typeof t&&(r.onUploadProgress=e=>{let r=Math.round(100*e.loaded/e.total);t(r,this)});let n=await this.connection._send(r);return this.setAll(n.data)}async deleteFile(){await this.connection._delete("/files/"+this.path)}}},function(e,t,r){const s=r(1),n=r(3),i=r(9),o=r(0),a=r(13),c=["finished","canceled","error"];e.exports=class extends n{constructor(e,t){super(e,["id","title","description","process","status","progress","created","updated","plan","costs","budget"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.status=void 0,this.progress=void 0,this.created=void 0,this.updated=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeJob(){let e=await this.connection._get("/jobs/"+this.id);return this.setAll(e.data)}async updateJob(e){return await this.connection._patch("/jobs/"+this.id,this._convertToRequest(e)),this._supports("describeJob")?await this.describeJob():this.setAll(e)}async deleteJob(){await this.connection._delete("/jobs/"+this.id)}async estimateJob(){return(await this.connection._get("/jobs/"+this.id+"/estimate")).data}debugJob(){return new i(this.connection,"/jobs/"+this.id+"/logs")}monitorJob(e,t=60,r=!0){if("function"!=typeof e||t<1)return;let s=this.connection.capabilities();if(!s.hasFeature("describeJob"))throw new Error("Monitoring Jobs not supported by the back-end.");let n=this.status,i=null,o=null;s.hasFeature("debugJob")&&r&&(o=this.debugJob());let a=async()=>{this.getDataAge()>1&&await this.describeJob();let t=o?await o.nextLogs():[];(n!==this.status||t.length>0)&&e(this,t),n=this.status,c.includes(this.status)&&l()};setTimeout(a,0),i=setInterval(a,1e3*t);let l=()=>{i&&(clearInterval(i),i=null)};return l}async startJob(){return await this.connection._post("/jobs/"+this.id+"/results",{}),this._supports("describeJob")?await this.describeJob():this}async stopJob(){return await this.connection._delete("/jobs/"+this.id+"/results"),this._supports("describeJob")?await this.describeJob():this}async getResultsAsStac(){let e=await this.connection._get("/jobs/"+this.id+"/results"),t=a.stac(e.data);return o.isObject(t.assets)||(t.assets={}),"Feature"===t.type?"number"==typeof e.headers["openeo-costs"]&&(t.properties.costs=e.headers["openeo-costs"]):"number"==typeof e.headers["openeo-costs"]&&(t.costs=e.headers["openeo-costs"]),t}async listResults(){let e=await this.getResultsAsStac();return o.isObject(e.assets)?Object.values(e.assets):[]}async downloadResults(e){let t=await this.listResults();return await s.downloadResults(this.connection,t,e)}}},function(e,t,r){const s=r(3);e.exports=class extends s{constructor(e,t){super(e,["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links",["process_graph","processGraph"]]),this.id=t,this.summary=void 0,this.description=void 0,this.categories=void 0,this.parameters=void 0,this.returns=void 0,this.deprecated=void 0,this.experimental=void 0,this.exceptions=void 0,this.examples=void 0,this.links=void 0,this.processGraph=void 0}async describeUserProcess(){let e=await this.connection._get("/process_graphs/"+this.id);return this.setAll(e.data)}async replaceUserProcess(e){return await this.connection._put("/process_graphs/"+this.id,this._convertToRequest(e)),this._supports("describeUserProcess")?this.describeUserProcess():this.setAll(e)}async deleteUserProcess(){await this.connection._delete("/process_graphs/"+this.id)}}},function(e,t,r){const s=r(3),n=r(9);e.exports=class extends s{constructor(e,t){super(e,["id","title","description","process","url","type","enabled","configuration","attributes","created","plan","costs","budget"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.url=void 0,this.type=void 0,this.enabled=void 0,this.configuration=void 0,this.attributes=void 0,this.created=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeService(){let e=await this.connection._get("/services/"+this.id);return this.setAll(e.data)}async updateService(e){return await this.connection._patch("/services/"+this.id,this._convertToRequest(e)),this._supports("describeService")?await this.describeService():this.setAll(e)}async deleteService(){await this.connection._delete("/services/"+this.id)}debugService(){return new n(this.connection,"/services/"+this.id+"/logs")}monitorService(e,t=60,r=!0){if("function"!=typeof e||t<1)return;let s=this.connection.capabilities();if(!s.hasFeature("describeService"))throw new Error("Monitoring Services not supported by the back-end.");let n=this.enabled,i=null,o=null;s.hasFeature("debugService")&&r&&(o=this.debugService());let a=async()=>{this.getDataAge()>1&&await this.describeService();let t=o?await o.nextLogs():[];(n!==this.enabled||t.length>0)&&e(this,t),n=this.enabled};setTimeout(a,0),i=setInterval(a,1e3*t);return()=>{i&&(clearInterval(i),i=null)}}}},function(e,t,r){const s=r(6).default,n=r(0),i=r(27),o=r(28),a=r(22),c=r(9),l=r(21),u=r(23),d=r(24),p=r(2),h=r(17),f=r(18),b=r(19),m=r(20),y=r(10),g=r(4),k=r(5),v=r(11);class w{static async connect(e){let t=n.normalizeUrl(e,"/.well-known/openeo"),r=null;try{if(r=await s.get(t),!n.isObject(r.data)||!Array.isArray(r.data.versions))throw new Error("Well-Known Document doesn't list any versions.")}catch(e){console.warn("Can't read well-known document, connecting directly to the specified URL as fallback mechanism. Reason: "+e.message)}if(n.isObject(r)){let t=i.findLatest(r.data.versions,!0,"1.0.0-rc.2","1.x.x");if(null===t)throw new Error("Server not supported. Client only supports the API versions between 1.0.0-rc.2 and 1.x.x");e=t.url}return await w.connectDirect(e)}static async connectDirect(e){let t=new o(e),r=await t.init();if(i.compare(r.apiVersion(),"1.0.0-rc.2","<")||i.compare(r.apiVersion(),"1.x.x",">"))throw new Error("Client only supports the API versions between 1.0.0-rc.2 and 1.x.x");return t}static clientVersion(){return"2.0.0"}}w.Environment=r(1),e.exports={AuthProvider:p,BasicProvider:h,Capabilities:b,Connection:o,FileTypes:m,Job:a,Logs:c,OidcProvider:f,OpenEO:w,Service:d,UserFile:l,UserProcess:u,Builder:y,BuilderNode:g,Parameter:k,Formula:v}},function(e,t,r){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var s,n,i;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(n=s;0!=n--;)if(!e(t[n],r[n]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;for(n of t.entries())if(!e(n[1],r.get(n[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((s=t.length)!=r.length)return!1;for(n=s;0!=n--;)if(t[n]!==r[n])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=s;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=s;0!=n--;){var o=i[n];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}},function(e,t,r){const s=r(12);class n{static compare(e,t,r=null){return null!==r?s.compare(e,t,r):s(e,t)}static validate(e){return s.validate(e)}static findCompatible(e,t=!0,r=null,s=null){if(!Array.isArray(e)||0===e.length)return[];let i=e.filter(e=>{if("string"==typeof e.url&&n.validate(e.api_version)){let t=n.validate(r),i=n.validate(s);return t&&i?n.compare(e.api_version,r,">=")&&n.compare(e.api_version,s,"<="):t?n.compare(e.api_version,r,">="):!i||n.compare(e.api_version,s,"<=")}return!1});return 0===i.length?[]:i.sort((e,r)=>{let s=!0===e.production,i=!0===r.production;return t&&s!==i?s?-1:1:-1*n.compare(e.api_version,r.api_version)})}static findLatest(e,t=!0,r=null,s=null){let i=n.findCompatible(e,t,r,s);return i.length>0?i[0]:null}}e.exports=n},function(e,t,r){const s=r(1),n=r(0),i=r(6).default,o=r(13),a=r(2),c=r(17),l=r(18),u=r(19),d=r(20),p=r(21),h=r(22),f=r(23),b=r(24),m=r(10),y=r(4);e.exports=class{constructor(e){this.baseUrl=n.normalizeUrl(e),this.authProviderList=null,this.authProvider=null,this.capabilitiesObject=null,this.processes=null,this.listeners={}}async init(){let e=await this._get("/");return this.capabilitiesObject=new u(e.data),this.capabilitiesObject}getBaseUrl(){return this.baseUrl}capabilities(){return this.capabilitiesObject}async listFileTypes(){let e=await this._get("/file_formats");return new d(e.data)}async listServiceTypes(){return(await this._get("/service_types")).data}async listUdfRuntimes(){return(await this._get("/udf_runtimes")).data}async listCollections(){let e=await this._get("/collections");return n.isObject(e.data)&&Array.isArray(e.data.collections)&&(e.data.collections=e.data.collections.map(e=>o.collection(e))),e.data}async describeCollection(e){let t=await this._get("/collections/"+e);return o.collection(t.data)}async*listCollectionItems(e,t=null,r=null,s=null){let i=1,a="/collections/"+e+"/items";for(;a;){let e={};1===i&&(Array.isArray(t)&&(e.bbox=t.join(",")),Array.isArray(r)&&(e.datetime=r.map(e=>e instanceof Date?e.toISOString():"string"==typeof e?e:"..").join("/")),s>0&&(e.limit=s));let c=await this._get(a,e);n.isObject(c.data)&&Array.isArray(c.data.features)&&(c.data.features=c.data.features.map(e=>o.item(e))),yield c.data,i++,a=this._getLinkHref(c.data.links)}}async listProcesses(){if(null===this.processes){let e=await this._get("/processes");this.processes=e.data}return this.processes}async describeProcess(e){let t=await this.listProcesses();return Array.isArray(t.processes)&&t.processes.find(t=>n.isObject(t)&&t.id===e)||null}async buildProcess(e){let t=await this.listProcesses();return new m(t.processes,null,e)}async listAuthProviders(){if(null!==this.authProviderList)return this.authProviderList;this.authProviderList=[];let e=this.capabilities();if(e.hasFeature("authenticateOIDC")){let e=await this._get("/credentials/oidc"),t=this.getOidcProviderFactory();if(n.isObject(e.data)&&Array.isArray(e.data.providers)&&"function"==typeof t)for(let r in e.data.providers){let s=t(e.data.providers[r]);s instanceof a&&this.authProviderList.push(s)}}return e.hasFeature("authenticateBasic")&&this.authProviderList.push(new c(this)),this.authProviderList}setOidcProviderFactory(e){this.oidcProviderFactory=e}getOidcProviderFactory(){return"function"==typeof this.oidcProviderFactory?this.oidcProviderFactory:l.isSupported()?e=>new l(this,e):null}async authenticateBasic(e,t){let r=new c(this);await r.login(e,t)}isAuthenticated(){return null!==this.authProvider}emit(e,...t){"function"==typeof this.listeners[e]&&this.listeners[e](...t)}on(e,t){this.listeners[e]=t}off(e){delete this.listeners[e]}getAuthProvider(){return this.authProvider}setAuthProvider(e){e!==this.authProvider&&(this.authProvider=e instanceof a?e:null,this.emit("authProviderChanged",this.authProvider))}setAuthToken(e,t,r){let s=new a(e,this,{id:t,title:"Custom",description:""});return s.setToken(r),this.setAuthProvider(s),s}async describeAccount(){return(await this._get("/me")).data}async listFiles(){return(await this._get("/files")).data.files.map(e=>new p(this,e.path).setAll(e))}async uploadFile(e,t=null,r=null){null===t&&(t=s.fileNameForUpload(e));let n=await this.getFile(t);return await n.uploadFile(e,r)}async getFile(e){return new p(this,e)}_normalizeUserProcess(e,t={}){return e instanceof f?e=e.toJSON():e instanceof y?(e.result=!0,e=e.parent.toJSON()):n.isObject(e)&&!n.isObject(e.process_graph)&&(e={process_graph:e}),Object.assign({},t,{process:e})}async validateProcess(e){let t=await this._post("/validation",this._normalizeUserProcess(e).process);if(Array.isArray(t.data.errors))return t.data.errors;throw new Error("Invalid validation response received.")}async listUserProcesses(){return(await this._get("/process_graphs")).data.processes.map(e=>new f(this,e.id).setAll(e))}async setUserProcess(e,t){let r=new f(this,e);return await r.replaceUserProcess(t)}async getUserProcess(e){let t=new f(this,e);return await t.describeUserProcess()}async computeResult(e,t=null,r=null){let i=this._normalizeUserProcess(e,{plan:t,budget:r}),o=await this._post("/result",i,s.getResponseType()),a={data:o.data,costs:null,type:null,logs:[]};"number"==typeof o.headers["openeo-costs"]&&(a.costs=o.headers["openeo-costs"]),"string"==typeof o.headers["content-type"]&&(a.type=o.headers["content-type"]);let c=Array.isArray(o.headers.link)?o.headers.link:[o.headers.link];for(let e of c){if("string"!=typeof e)continue;let t=e.match(/^<([^>]+)>;\s?rel="monitor"/i);if(Array.isArray(t)&&t.length>1)try{let e=await this._get(t[1]);n.isObject(e.data)&&Array.isArray(e.data.logs)&&(a.logs=e.data.logs)}catch(e){console.warn(e)}}return a}async downloadResult(e,t,r=null,n=null){let i=await this.computeResult(e,r,n);await s.saveToFile(i.data,t)}async listJobs(){return(await this._get("/jobs")).data.jobs.map(e=>new h(this,e.id).setAll(e))}async createJob(e,t=null,r=null,s=null,n=null,i={}){i=Object.assign({},i,{title:t,description:r,plan:s,budget:n});let o=this._normalizeUserProcess(e,i),a=await this._post("/jobs",o);if("string"!=typeof a.headers["openeo-identifier"])throw new Error("Response did not contain a Job ID. Job has likely been created, but may not show up yet.");let c=new h(this,a.headers["openeo-identifier"]).setAll(o);return this.capabilitiesObject.hasFeature("describeJob")?await c.describeJob():c}async getJob(e){let t=new h(this,e);return await t.describeJob()}async listServices(){return(await this._get("/services")).data.services.map(e=>new b(this,e.id).setAll(e))}async createService(e,t,r=null,s=null,n=!0,i={},o=null,a=null,c={}){let l=this._normalizeUserProcess(e,Object.assign({title:r,description:s,type:t,enabled:n,configuration:i,plan:o,budget:a},c)),u=await this._post("/services",l);if("string"!=typeof u.headers["openeo-identifier"])throw new Error("Response did not contain a Service ID. Service has likely been created, but may not show up yet.");let d=new b(this,u.headers["openeo-identifier"]).setAll(l);return this.capabilitiesObject.hasFeature("describeService")?d.describeService():d}async getService(e){let t=new b(this,e);return await t.describeService()}_getLinkHref(e,t="next"){if(Array.isArray(e)){let r=e.find(e=>n.isObject(e)&&e.rel===t&&"string"==typeof e.href);if(r)return r.href}return null}async _get(e,t,r){return await this._send({method:"get",responseType:r,url:e,timeout:"/"===e?3e3:0,params:t})}async _post(e,t,r){return await this._send({method:"post",responseType:r,url:e,data:t})}async _put(e,t){return await this._send({method:"put",url:e,data:t})}async _patch(e,t){return await this._send({method:"patch",url:e,data:t})}async _delete(e){return await this._send({method:"delete",url:e})}async download(e,t){return(await this._send({method:"get",responseType:s.getResponseType(),url:e,authorization:t})).data}async _send(e){e.baseURL=this.baseUrl,!this.isAuthenticated()||void 0!==e.authorization&&!0!==e.authorization||(e.headers||(e.headers={}),e.headers.Authorization="Bearer "+this.authProvider.getToken()),e.responseType||(e.responseType="json");try{return await i(e)}catch(t){const r=e=>"string"==typeof e&&-1!==e.indexOf("/json"),i=(e,t)=>("string"==typeof t.message&&(e.message=t.message),e.code="string"==typeof t.code?t.code:"",e.id=t.id,e.links=Array.isArray(t.links)?t.links:[],e);if(n.isObject(t.response)&&n.isObject(t.response.data)&&(r(t.response.data.type)||n.isObject(t.response.headers)&&r(t.response.headers["content-type"]))){if(e.responseType!==s.getResponseType())throw i(t,t.response.data);try{throw i(t,await s.handleErrorResponse(t))}catch(e){console.error(e)}}throw t}}}},function(e,t,r){"use strict";const s=r(30),n=r(38),{names:i}=r(42),o=r(43),a=r(47),c=r(48),l={};for(const e in i){const t=e;l[i[t]]=t}function u(e){if(!(e instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(e.length<2)throw new Error("multihash too short. must be > 2 bytes.");const t=n.decode(e);if(!h(t))throw new Error("multihash unknown function code: 0x"+t.toString(16));e=e.slice(n.decode.bytes);const r=n.decode(e);if(r<0)throw new Error("multihash invalid length: "+r);if((e=e.slice(n.decode.bytes)).length!==r)throw new Error("multihash length inconsistent: 0x"+o(e,"base16"));return{code:t,name:l[t],length:r,digest:e}}function d(e){let t=e;if("string"==typeof e){if(void 0===i[e])throw new Error("Unrecognized hash function named: "+e);t=i[e]}if("number"!=typeof t)throw new Error("Hash function code should be a number. Got: "+t);if(void 0===l[t]&&!p(t))throw new Error("Unrecognized function code: "+t);return t}function p(e){return e>0&&e<16}function h(e){return!!p(e)||!!l[e]}function f(e){u(e)}e.exports={names:i,codes:Object.freeze(l),toHexString:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(e,"base16")},fromHexString:function(e){return a(e,"base16")},toB58String:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(s.encode("base58btc",e)).slice(1)},fromB58String:function(e){const t=e instanceof Uint8Array?o(e):e;return s.decode("z"+t)},decode:u,encode:function(e,t,r){if(!e||void 0===t)throw new Error("multihash encode requires at least two args: digest, code");const s=d(t);if(!(e instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==r&&(r=e.length),r&&e.length!==r)throw new Error("digest length should be equal to specified length.");const i=n.encode(s),o=n.encode(r);return c([i,o,e],i.length+o.length+e.length)},coerceCode:d,isAppCode:p,validate:f,prefix:function(e){return f(e),e.subarray(0,2)},isValidCode:h}},function(e,t,r){"use strict";const s=r(31),{encodeText:n,decodeText:i,concat:o}=r(7);function a(e){if(Object.prototype.hasOwnProperty.call(s.names,e))return s.names[e];if(Object.prototype.hasOwnProperty.call(s.codes,e))return s.codes[e];throw new Error("Unsupported encoding: "+e)}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:r,codeBuf:s}=a(e);return function(e,t){a(e).decode(i(t))}(r,t),o([s,t],s.length+t.length)}).encode=function(e,t){const r=a(e),s=n(r.encode(t));return o([r.codeBuf,s],r.codeBuf.length+s.length)},t.decode=function(e){e instanceof Uint8Array&&(e=i(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),a(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=i(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return a(e[0]).name}catch(e){return!1}},t.encoding=a,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=i(e)),a(e[0])},t.names=Object.freeze(s.names),t.codes=Object.freeze(s.codes)},function(e,t,r){"use strict";const s=r(14),n=r(32),{rfc4648:i}=r(37),{decodeText:o,encodeText:a}=r(7),c=[["identity","\0",()=>({encode:o,decode:a}),""],["base2","0",i(1),"01"],["base8","7",i(3),"01234567"],["base10","9",s,"0123456789"],["base16","f",i(4),"0123456789abcdef"],["base16upper","F",i(4),"0123456789ABCDEF"],["base32hex","v",i(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",i(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",i(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",i(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",i(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",s,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",s,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",s,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",s,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],l=c.reduce((e,t)=>(e[t[0]]=new n(t[0],t[1],t[2],t[3]),e),{}),u=c.reduce((e,t)=>(e[t[1]]=l[t[0]],e),{});e.exports={names:l,codes:u}},function(e,t,r){"use strict";const{encodeText:s}=r(7);e.exports=class{constructor(e,t,r,n){this.name=e,this.code=t,this.codeBuf=s(this.code),this.alphabet=n,this.codec=r(n)}encode(e){return this.codec.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}}},function(e,t,r){"use strict";t.TextEncoder="undefined"!=typeof TextEncoder?TextEncoder:r(15).TextEncoder,t.TextDecoder="undefined"!=typeof TextDecoder?TextDecoder:r(15).TextDecoder},function(e,t){var r,s,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{s="function"==typeof clearTimeout?clearTimeout:o}catch(e){s=o}}();var c,l=[],u=!1,d=-1;function p(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&h())}function h(){if(!u){var e=a(p);u=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,u=!1,function(e){if(s===clearTimeout)return clearTimeout(e);if((s===o||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function b(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new f(e,t)),1!==l.length||u||a(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=b,n.addListener=b,n.once=b,n.off=b,n.removeListener=b,n.removeAllListeners=b,n.emit=b,n.prependListener=b,n.prependOnceListener=b,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";e.exports={rfc4648:e=>t=>({encode:r=>((e,t,r)=>{const s="="===t[t.length-1],n=(1<<r)-1;let i="",o=0,a=0;for(let s=0;s<e.length;++s)for(a=a<<8|e[s],o+=8;o>r;)o-=r,i+=t[n&a>>o];if(o&&(i+=t[n&a<<r-o]),s)for(;i.length*r&7;)i+="=";return i})(r,t,e),decode:r=>((e,t,r)=>{const s={};for(let e=0;e<t.length;++e)s[t[e]]=e;let n=e.length;for(;"="===e[n-1];)--n;const i=new Uint8Array(n*r/8|0);let o=0,a=0,c=0;for(let t=0;t<n;++t){const n=s[e[t]];if(void 0===n)throw new SyntaxError("Invalid character "+e[t]);a=a<<r|n,o+=r,o>=8&&(o-=8,i[c++]=255&a>>o)}if(o>=r||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return i})(r,t,e)})}},function(e,t,r){e.exports={encode:r(39),decode:r(40),encodingLength:r(41)}},function(e,t){e.exports=function e(t,s,n){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");s=s||[];var i=n=n||0;for(;t>=r;)s[n++]=255&t|128,t/=128;for(;-128&t;)s[n++]=255&t|128,t>>>=7;return s[n]=0|t,e.bytes=n-i+1,s};var r=Math.pow(2,31)},function(e,t){e.exports=function e(t,r){var s,n=0,i=0,o=r=r||0,a=t.length;do{if(o>=a||i>49)throw e.bytes=0,new RangeError("Could not decode varint");s=t[o++],n+=i<28?(127&s)<<i:(127&s)*Math.pow(2,i),i+=7}while(s>=128);return e.bytes=o-r,n}},function(e,t){var r=Math.pow(2,7),s=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),a=Math.pow(2,42),c=Math.pow(2,49),l=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e<r?1:e<s?2:e<n?3:e<i?4:e<o?5:e<a?6:e<c?7:e<l?8:e<u?9:10}},function(e,t,r){"use strict";const s=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:s}},function(e,t,r){"use strict";const{encoding:s}=r(16),n=new TextDecoder("utf8");e.exports=function(e,t="utf8"){return"utf8"===t||"utf-8"===t?n.decode(e):"ascii"===t?function(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}(e):s(t).encode(e)}},function(e,t,r){"use strict";const s=r(14),n=r(45),{rfc4648:i}=r(46),{decodeText:o,encodeText:a}=r(8),c=[["identity","\0",()=>({encode:o,decode:a}),""],["base2","0",i(1),"01"],["base8","7",i(3),"01234567"],["base10","9",s,"0123456789"],["base16","f",i(4),"0123456789abcdef"],["base16upper","F",i(4),"0123456789ABCDEF"],["base32hex","v",i(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",i(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",i(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",i(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",i(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",s,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",s,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",s,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",s,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],l=c.reduce((e,t)=>(e[t[0]]=new n(t[0],t[1],t[2],t[3]),e),{}),u=c.reduce((e,t)=>(e[t[1]]=l[t[0]],e),{});e.exports={names:l,codes:u}},function(e,t,r){"use strict";const{encodeText:s}=r(8);e.exports=class{constructor(e,t,r,n){this.name=e,this.code=t,this.codeBuf=s(this.code),this.alphabet=n,this.codec=r(n)}encode(e){return this.codec.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}}},function(e,t,r){"use strict";e.exports={rfc4648:e=>t=>({encode:r=>((e,t,r)=>{const s="="===t[t.length-1],n=(1<<r)-1;let i="",o=0,a=0;for(let s=0;s<e.length;++s)for(a=a<<8|e[s],o+=8;o>r;)o-=r,i+=t[n&a>>o];if(o&&(i+=t[n&a<<r-o]),s)for(;i.length*r&7;)i+="=";return i})(r,t,e),decode:r=>((e,t,r)=>{const s={};for(let e=0;e<t.length;++e)s[t[e]]=e;let n=e.length;for(;"="===e[n-1];)--n;const i=new Uint8Array(n*r/8|0);let o=0,a=0,c=0;for(let t=0;t<n;++t){const n=s[e[t]];if(void 0===n)throw new SyntaxError("Invalid character "+e[t]);a=a<<r|n,o+=r,o>=8&&(o-=8,i[c++]=255&a>>o)}if(o>=r||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return i})(r,t,e)})}},function(e,t,r){"use strict";const{encoding:s}=r(16),n=new TextEncoder;e.exports=function(e,t="utf8"){return"utf8"===t||"utf-8"===t?n.encode(e):"ascii"===t?function(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}(e):s(t).decode(e)}},function(e,t,r){"use strict";e.exports=function(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));const r=new Uint8Array(t);let s=0;for(const t of e)r.set(t,s),s+=t.length;return r}},function(e,r){e.exports=t},function(e,t){let r={Token:{Operator:"Operator",Identifier:"Identifier",Number:"Number"}};const s={"⁰":0,"¹":1,"²":2,"³":3,"⁴":4,"⁵":5,"⁶":6,"⁷":7,"⁸":8,"⁹":9},n=Object.keys(s).join("");r.Lexer=function(){let e="",t=0,s=0,i=0,o=r.Token;function a(){let r=s;return r<t?e.charAt(r):"\0"}function c(){let r="\0",n=s;return n<t&&(r=e.charAt(n),s+=1),r}function l(e){return"\t"===e||" "===e||" "===e}function u(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function d(e){return e>="0"&&e<="9"}function p(e,t){return{type:e,value:t,start:i,end:s-1}}function h(e){return"_"===e||u(e)||d(e)}function f(){let e,t;if(e=a(),function(e){return"_"===e||"#"===e||"$"===e||u(e)}(e)){for(t=c();e=a(),h(e);)t+=c();return p(o.Identifier,t)}}function b(){let e;if(function(){let e;for(;s<t&&(e=a(),l(e));)c()}(),!(s>=t)){if(i=s,e=function(){let e,r;if(e=a(),d(e)||"."===e){if(r="","."!==e)for(r=c();e=a(),d(e);)r+=c();if("."===e)for(r+=c();e=a(),d(e);)r+=c();if("e"===e||"E"===e){if(r+=c(),e=a(),"+"!==e&&"-"!==e&&!d(e))throw e="character "+e,s>=t&&(e="<end>"),new SyntaxError("Unexpected "+e+" after the exponent sign");for(r+=c();e=a(),d(e);)r+=c()}if("."===r)throw new SyntaxError("Expecting decimal digits after the dot sign");return p(o.Number,r)}}(),void 0!==e)return e;if(e=function(){let e=a();if(("+-*/()^,"+n).indexOf(e)>=0)return p(o.Operator,c())}(),void 0!==e)return e;if(e=f(),void 0!==e)return e;throw new SyntaxError("Unknown token from character "+a())}}return{reset:function(r){e=r,t=r.length,s=0},next:b,peek:function(){let e,t=s;try{e=b(),delete e.start,delete e.end}catch(t){e=void 0}return s=t,e}}},r.Parser=function(){let e=new r.Lexer,t=r.Token;function i(e,r){return void 0!==e&&e.type===t.Operator&&r.includes(e.value)}function o(t){let r=[],s=e.next();if(!i(s,"("))throw new SyntaxError('Expecting ( in a function call "'+t+'"');if(s=e.peek(),i(s,")")||(r=function(){let t,r,s=[];for(;r=u(),void 0!==r&&(s.push(r),t=e.peek(),i(t,","));)e.next();return s}()),s=e.next(),!i(s,")"))throw new SyntaxError('Expecting ) in a function call "'+t+'"');return{FunctionCall:{name:t,args:r}}}function a(){let r,s=e.peek();return i(s,"-+")?(s=e.next(),r=a(),{Unary:{operator:s.value,expression:r}}):function(){let r,s=e.peek();if(void 0===s)throw new SyntaxError("Unexpected termination of expression");if(s.type===t.Identifier)return s=e.next(),i(e.peek(),"(")?o(s.value):{Identifier:s.value};if(s.type===t.Number)return s=e.next(),{Number:s.value};if(i(s,"(")){if(e.next(),r=u(),s=e.next(),!i(s,")"))throw new SyntaxError("Expecting )");return{Expression:r}}throw new SyntaxError("Parse error, can not process token "+s.value)}()}function c(){let t=a(),r=e.peek();for(;i(r,"^"+n);)r=e.next(),t={Binary:{operator:"^",left:t,right:"^"!==r.value?(o=r.value,"number"==typeof s[o]?{Number:s[o]}:null):a()}},r=e.peek();var o;return t}function l(){let t=c(),r=e.peek();for(;i(r,"*/");)r=e.next(),t={Binary:{operator:r.value,left:t,right:c()}},r=e.peek();return t}function u(){return function(){let t=l(),r=e.peek();for(;i(r,"+-");)r=e.next(),t={Binary:{operator:r.value,left:t,right:l()}},r=e.peek();return t}()}return{parse:function(t){e.reset(t);let r=u(),s=e.next();if(void 0!==s)throw new SyntaxError("Unexpected token "+s.value);return{Expression:r}}}},e.exports=r},function(e,t,r){const s=r(0);class n{static normalizeJsonSchema(e,t=!1){e=s.isObject(e)?[e]:Array.isArray(e)?e:[];let r=[];for(let t of e)if(Array.isArray(t.allOf))r.push(Object.assign({},...t.allOf));else if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let e=s.omitFromObject(t,["oneOf","anyOf"]),n=t.oneOf||t.anyOf;for(let t of n)r.push(Object.assign({},e,t))}else r.push(t);if(!t)return r;e=[];for(let t of r)Array.isArray(t.type)?e=e.concat(t.type.map(e=>Object.assign({},t,{type:e}))):e.push(t);return e}static getCallbackParameters(e,t=[]){if(!s.isObject(e)||!e.schema)return[];let r,i=n.normalizeJsonSchema(e.schema);for(;r=t.shift();)i=i.map(e=>n.normalizeJsonSchema(n.getElementJsonSchema(e,r))),i=i.concat(...i);let o=[];for(let e of i)if(Array.isArray(e.parameters)){if(o.length>0&&!s.equals(o,e.parameters))throw new Error("Multiple schemas with different callback parameters found.");o=e.parameters}return o}static getCallbackParametersForProcess(e,t,r=[]){if(!s.isObject(e)||!Array.isArray(e.parameters))return[];let i=e.parameters.find(e=>e.name===t);return n.getCallbackParameters(i,r)}static getNativeTypesForJsonSchema(e,t=!1){if(s.isObject(e)&&Array.isArray(e.type)){let r=s.unique(e.type).filter(e=>n.JSON_SCHEMA_TYPES.includes(e));return r.length>0&&r.length<n.JSON_SCHEMA_TYPES.length?r:t?[]:n.JSON_SCHEMA_TYPES}return s.isObject(e)&&"string"==typeof e.type&&n.JSON_SCHEMA_TYPES.includes(e.type)?[e.type]:t?[]:n.JSON_SCHEMA_TYPES}static getElementJsonSchema(e,t=null){let r=n.getNativeTypesForJsonSchema(e);if(s.isObject(e)&&r.includes("array")&&"string"!=typeof t){if(s.isObject(e.items))return e.items;if(Array.isArray(e.items)){if(null!==t&&s.isObject(e.items[t]))return e.items[t];if(s.isObject(e.additionalItems))return e.additionalItems}}if(s.isObject(e)&&r.includes("object")){if(null!==t&&s.isObject(e.properties)&&s.isObject(e.properties[t]))return e.properties[t];if(s.isObject(e.additionalProperties))return e.additionalProperties}return{}}}n.JSON_SCHEMA_TYPES=["string","number","integer","boolean","array","object","null"],e.exports=n}])}));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("Oidc"),require("axios"),function(){try{return require("multihashes")}catch(e){}}());else if("function"==typeof define&&define.amd)define(["Oidc","axios","multihashes"],t);else{var s="object"==typeof exports?t(require("Oidc"),require("axios"),function(){try{return require("multihashes")}catch(e){}}()):t(e.Oidc,e.axios,e.multihashes);for(var r in s)("object"==typeof exports?exports:e)[r]=s[r]}}(self,(function(e,t,s){return r={545:(e,t,s)=>{const r=s(480);class i{constructor(e=[],t=!1){if(this.listeners=[],this.processes={},this.addNamespace=t,e instanceof i)for(let t in e.processes)this.addAll(e.processes[t]);else this.addAll(e)}onChange(e,t,s){for(let r of this.listeners)r(e,t,s)}addAll(e,t="backend"){for(var s in e)this.add(e[s],t,!1);this.onChange("addAll",e,t)}add(e,t="backend",s=!0){if(!r.isObject(e))throw new Error("Invalid process; not an object.");if("string"!=typeof e.id)throw new Error("Invalid process; no id specified.");if("string"!=typeof t)throw new Error("Invalid namespace; not a string.");this.processes[t]||(this.processes[t]={}),e=Object.assign(this.addNamespace?{namespace:t}:{},e),this.processes[t][e.id]=e,s&&this.onChange("add",e,t)}count(){return r.size(this.all())}all(){let e=[];for(let t in this.processes)e=e.concat(Object.values(this.processes[t]));return e}hasNamespace(e){return"string"==typeof e&&Boolean(this.processes[e])}namespaces(){return Object.keys(this.processes).sort()}namespace(e){if("string"!=typeof e)return[];let t=this.processes[e];return t?Object.values(t):[]}has(e,t=null){return Boolean(this.get(e,t))}get(e,t=null){return"string"!=typeof e?null:null===t?this.get(e,"user")||this.get(e,"backend"):this.processes[t]&&this.processes[t][e]||null}remove(e=null,t="user"){if("string"!=typeof t)return!1;if(this.processes[t]){if("string"!=typeof e)return delete this.processes[t],this.onChange("remove",null,t),!0;if(this.processes[t][e]){let s=this.processes[t][e];return delete this.processes[t][e],0===r.size(this.processes[t])&&delete this.processes[t],this.onChange("remove",s,t),!0}}return!1}}e.exports=i},905:(e,t,s)=>{const r=s(480);class i{static normalizeJsonSchema(e,t=!1){e=r.isObject(e)?[e]:Array.isArray(e)?e:[];let s=[];for(let t of e)if(Array.isArray(t.allOf))s.push(Object.assign({},...t.allOf));else if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let e=r.omitFromObject(t,["oneOf","anyOf"]),i=t.oneOf||t.anyOf;for(let t of i)s.push(Object.assign({},e,t))}else s.push(t);if(!t)return s;e=[];for(let t of s)Array.isArray(t.type)?e=e.concat(t.type.map((e=>Object.assign({},t,{type:e})))):e.push(t);return e}static getCallbackParameters(e,t=[]){if(!r.isObject(e)||!e.schema)return[];let s,n=i.normalizeJsonSchema(e.schema);for(;s=t.shift();)n=n.map((e=>i.normalizeJsonSchema(i.getElementJsonSchema(e,s)))),n=n.concat(...n);let a=[];for(let e of n)if(Array.isArray(e.parameters)){if(a.length>0&&!r.equals(a,e.parameters))throw new Error("Multiple schemas with different callback parameters found.");a=e.parameters}return a}static getCallbackParametersForProcess(e,t,s=[]){if(!r.isObject(e)||!Array.isArray(e.parameters))return[];let n=e.parameters.find((e=>e.name===t));return i.getCallbackParameters(n,s)}static getNativeTypesForJsonSchema(e,t=!1){if(r.isObject(e)&&Array.isArray(e.type)){let s=r.unique(e.type).filter((e=>i.JSON_SCHEMA_TYPES.includes(e)));return s.length>0&&s.length<i.JSON_SCHEMA_TYPES.length?s:t?[]:i.JSON_SCHEMA_TYPES}return r.isObject(e)&&"string"==typeof e.type&&i.JSON_SCHEMA_TYPES.includes(e.type)?[e.type]:t?[]:i.JSON_SCHEMA_TYPES}static getElementJsonSchema(e,t=null){let s=i.getNativeTypesForJsonSchema(e);if(r.isObject(e)&&s.includes("array")&&"string"!=typeof t){if(r.isObject(e.items))return e.items;if(Array.isArray(e.items)){if(null!==t&&r.isObject(e.items[t]))return e.items[t];if(r.isObject(e.additionalItems))return e.additionalItems}}if(r.isObject(e)&&s.includes("object")){if(null!==t&&r.isObject(e.properties)&&r.isObject(e.properties[t]))return e.properties[t];if(r.isObject(e.additionalProperties))return e.additionalProperties}return{}}}i.JSON_SCHEMA_TYPES=["string","number","integer","boolean","array","object","null"],e.exports=i},480:(e,t,s)=>{var r=s(991);class i{static isObject(e){return"object"==typeof e&&e===Object(e)&&!Array.isArray(e)}static hasText(e){return"string"==typeof e&&e.length>0}static equals(e,t){return r(e,t)}static pickFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);const s={};return t.forEach((t=>s[t]=e[t])),s}static omitFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);var s=Object.assign({},e);for(let e of t)delete s[e];return s}static mapObject(e,t){const s=Object.keys(e),r=new Array(s.length);return s.forEach(((s,i)=>{r[i]=t(e[s],s,e)})),r}static mapObjectValues(e,t){e=Object(e);const s={};return Object.keys(e).forEach((r=>{s[r]=t(e[r],r,e)})),s}static unique(e,t=!1){return t?e.filter(((e,t,s)=>s.findIndex((t=>i.equals(e,t)))===t)):[...new Set(e)]}static size(e){return"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0}static isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}static deepClone(e){return JSON.parse(JSON.stringify(e))}static normalizeUrl(e,t=null){let s=e.replace(/\/$/,"");return"string"==typeof t&&("/"!==t.substr(0,1)&&(t="/"+t),s+=t.replace(/\/$/,"")),s}static replacePlaceholders(e,t={}){if("string"==typeof e&&i.isObject(t))for(var s in t){let r=t[s];e=e.replace("{"+s+"}",Array.isArray(r)?r.join("; "):r)}return e}static compareStringCaseInsensitive(e,t){return"string"!=typeof e&&(e=String(e)),"string"!=typeof t&&(t=String(t)),e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}static prettifyString(e,t="; "){return Array.isArray(e)||(e=[String(e)]),(e=e.map((e=>{if(e.length>=3){const t=(e,t,s)=>t+" "+s.toUpperCase();return(e=e.includes("_")?e.replace(/([a-zA-Z\d])_([a-zA-Z\d])/g,t):e.includes("-")?e.replace(/([a-zA-Z\d])-([a-zA-Z\d])/g,t):e.replace(/([a-z])([A-Z])/g,t)).charAt(0).toUpperCase()+e.substr(1)}return e}))).join(t)}static friendlyLinks(e,t=!0,s=["self"]){let r=[];if(!Array.isArray(e))return r;for(let t of e)t=Object.assign({},t),"string"==typeof t.rel&&s.includes(t.rel.toLowerCase())||("string"==typeof t.title&&0!==t.title.length||("string"==typeof t.rel&&t.rel.length>1?t.title=i.prettifyString(t.rel):t.title=t.href.replace(/^https?:\/\/(www.)?/i,"").replace(/\/$/i,"")),r.push(t));return t&&r.sort(((e,t)=>i.compareStringCaseInsensitive(e.title,t.title))),r}}e.exports=i},956:(e,t,s)=>{const r=s(247);class i{static compare(e,t,s=null){return null!==s?r.compare(e,t,s):r(e,t)}static validate(e){return r.validate(e)}static findCompatible(e,t=!0,s=null,r=null){if(!Array.isArray(e)||0===e.length)return[];let n=e.filter((e=>{if("string"==typeof e.url&&i.validate(e.api_version)){let t=i.validate(s),n=i.validate(r);return t&&n?i.compare(e.api_version,s,">=")&&i.compare(e.api_version,r,"<="):t?i.compare(e.api_version,s,">="):!n||i.compare(e.api_version,r,"<=")}return!1}));return 0===n.length?[]:n.sort(((e,s)=>{let r=!0===e.production,n=!0===s.production;return t&&r!==n?r?-1:1:-1*i.compare(e.api_version,s.api_version)}))}static findLatest(e,t=!0,s=null,r=null){let n=i.findCompatible(e,t,s,r);return n.length>0?n[0]:null}}e.exports=i},19:(e,t,s)=>{var r=s(247);const i="1.0.0",n={datacube:"https://stac-extensions.github.io/datacube/v1.0.0/schema.json",eo:"https://stac-extensions.github.io/eo/v1.0.0/schema.json",file:"https://stac-extensions.github.io/file/v1.0.0/schema.json","item-assets":"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json",label:"https://stac-extensions.github.io/label/v1.0.0/schema.json",pointcloud:"https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json",processing:"https://stac-extensions.github.io/processing/v1.0.0/schema.json",projection:"https://stac-extensions.github.io/projection/v1.0.0/schema.json",raster:"https://stac-extensions.github.io/raster/v1.0.0/schema.json",sar:"https://stac-extensions.github.io/sar/v1.0.0/schema.json",sat:"https://stac-extensions.github.io/sat/v1.0.0/schema.json",scientific:"https://stac-extensions.github.io/scientific/v1.0.0/schema.json",timestamps:"https://stac-extensions.github.io/timestamps/v1.0.0/schema.json",version:"https://stac-extensions.github.io/version/v1.0.0/schema.json",view:"https://stac-extensions.github.io/view/v1.0.0/schema.json"},a={itemAndCollection:{"cube:":n.datacube,"eo:":n.eo,"file:":n.file,"label:":n.label,"pc:":n.pointcloud,"processing:":n.processing,"proj:":n.projection,"raster:":n.raster,"sar:":n.sar,"sat:":n.sat,"sci:":n.scientific,"view:":n.view,version:n.version,deprecated:n.version,published:n.timestamps,expires:n.timestamps,unpublished:n.timestamps},catalog:{},collection:{item_assets:n["item-assets"]},item:{}};a.collection=Object.assign(a.collection,a.itemAndCollection),a.item=Object.assign(a.item,a.itemAndCollection);var o={version:i,set(e){e||(e="0.6.0"),o.version=e},before:e=>r.compare(o.version,e,"<")},l={type(e){let t=typeof e;if("object"===t){if(null===e)return"null";if(Array.isArray(e))return"array"}return t},is:(e,t)=>l.type(e)===t,isDefined:e=>void 0!==e,isObject:e=>"object"==typeof e&&e===Object(e)&&!Array.isArray(e),rename:(e,t,s)=>void 0!==e[t]&&void 0===e[s]&&(e[s]=e[t],delete e[t],!0),toArray:(e,t)=>void 0!==e[t]&&!Array.isArray(e[t])&&(e[t]=[e[t]],!0),flattenArray(e,t,s,r=!1){if(Array.isArray(e[t])){for(let i in e[t])if("string"==typeof s[i]){let n=e[t][i];e[s[i]]=r?[n]:n}return delete e[t],!0}return!1},flattenOneElementArray:(e,t,s=!1)=>!(!s&&Array.isArray(e[t]))||1===e[t].length&&(e[t]=e[t][0],!0),removeFromArray(e,t,s){if(Array.isArray(e[t])){let r=e[t].indexOf(s);return r>-1&&e[t].splice(r,1),!0}return!1},addToArrayIfNotExists:(e,t,s)=>!!Array.isArray(e[t])&&(-1===e[t].indexOf(s)&&e[t].push(s),e[t].sort(),!0),ensure:(e,t,s)=>(l.type(s)!==l.type(e[t])&&(e[t]=s),!0),addExtension:(e,t)=>!l.isObject(e)||l.addToArrayIfNotExists(e,"stac_extensions",t)&&true,removeExtension:(e,t)=>!l.isObject(e)||l.removeFromArray(e,"stac_extensions",t)&&true,migrateExtensionShortnames(e){let t=Object.keys(n),s=Object.values(n);return l.mapValues(e,"stac_extensions",t,s)},populateExtensions(e,t){let s=[];"catalog"!=t&&"collection"!=t||s.push(e),"item"!=t&&"collection"!=t||!l.isObject(e.assets)||(s=s.concat(Object.values(e.assets))),"collection"==t&&l.isObject(e.item_assets)&&(s=s.concat(Object.values(e.item_assets))),"collection"==t&&l.isObject(e.summaries)&&(s=s.concat(Object.values(e.summaries))),"item"==t&&l.isObject(e.properties)&&s.push(e.properties);for(let r of s)Object.keys(r).forEach((s=>{let r=s.match(/^(\w+:|[^:]+$)/i);if(Array.isArray(r)){let s=a[t][r[0]];l.is(s,"string")&&l.addExtension(e,s)}}))},mapValues(e,t,s,r){let i=e=>{let t=s.indexOf(e);return t>=0?r[t]:e};return Array.isArray(e[t])?e[t]=e[t].map(i):void 0!==e[t]&&(e[t]=i(e[t])),!0},mapObject(e,t){for(let s in e)e[s]=t(e[s],s)},moveTo:(e,t,s,r=!1,i=!1)=>(condition=r?i?e=>Array.isArray(e):e=>Array.isArray(e)&&1===e.length:l.isDefined,!!condition(e[t])&&(s[t]=r&&!i?e[t][0]:e[t],delete e[t],!0)),runAll(e,t,s=null){for(let r in e)r.startsWith("migrate")||e[r](t,s)},toUTC(e,t){if("string"==typeof e[t])try{return e[t]=this.toISOString(e[t]),!0}catch(e){}return delete e[t],!1},toISOString:e=>(e instanceof Date||(e=new Date(e)),e.toISOString().replace(".000",""))},c={hexToUint8(e){if(0===e.length||e.length%2!=0)throw new Error(`The string "${e}" is not valid hex.`);return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},uint8ToHex:e=>e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""),toMultihash(e,t,r){if(!l.is(e[t],"string"))return!1;try{const i=s(263).encode(c.hexToUint8(e[t]),r);return e[t]=c.uint8ToHex(i),!0}catch(e){return console.warn(e),!1}}},u={migrate(e,t=!0){o.set(e.stac_version),t&&(e.stac_version=i),e.type="Catalog",o.before("1.0.0-rc.1")&&l.migrateExtensionShortnames(e),l.ensure(e,"id",""),l.ensure(e,"description",""),l.ensure(e,"links",[]),l.runAll(u,e,e),l.ensure(e,"stac_extensions",[]),o.before("0.8.0")&&l.populateExtensions(e,"catalog")}},d={migrate(e,t=!0){u.migrate(e,t),e.type="Collection",o.before("1.0.0-rc.1")&&l.migrateExtensionShortnames(e),l.ensure(e,"license","proprietary"),l.ensure(e,"extent",{spatial:{bbox:[]},temporal:{interval:[]}}),l.runAll(d,e,e),l.isObject(e.properties)&&(l.removeFromArray(e,"stac_extensions","commons"),delete e.properties),o.before("0.8.0")&&l.populateExtensions(e,"collection"),o.before("1.0.0-beta.1")&&l.mapValues(e,"stac_extensions",["assets"],["item-assets"])},extent(e){if(o.before("0.8.0")&&(Array.isArray(e.extent.spatial)&&(e.extent.spatial={bbox:[e.extent.spatial]}),Array.isArray(e.extent.temporal)&&(e.extent.temporal={interval:[e.extent.temporal]})),o.before("1.0.0-rc.3")){if(Array.isArray(e.extent.temporal.interval)&&e.extent.temporal.interval.length>1){let t,s;for(let r of e.extent.temporal.interval){if(null===r[0])t=null;else if("string"==typeof r[0]&&null!==t)try{let e=new Date(r[0]);(void 0===t||e<t)&&(t=e)}catch(e){}if(null===r[1])s=null;else if("string"==typeof r[1]&&null!==s)try{let e=new Date(r[1]);(void 0===s||e>s)&&(s=e)}catch(e){}}e.extent.temporal.interval.unshift([t?l.toISOString(t):null,s?l.toISOString(s):null])}if(Array.isArray(e.extent.spatial.bbox)&&e.extent.spatial.bbox.length>1){let t=e.extent.spatial.bbox.reduce(((e,t)=>Array.isArray(t)?Math.max(t.length,e):e),4);if(t>=4){let s=new Array(t).fill(null),r=t/2;for(let t of e.extent.spatial.bbox){if(!Array.isArray(t)||t.length<4)break;for(let e in t){let i=t[e];null===s[e]?s[e]=i:s[e]=e<r?Math.min(i,s[e]):Math.max(i,s[e])}}-1===s.findIndex((e=>null===e))&&e.extent.spatial.bbox.unshift(s)}}}},collectionAssets(e){o.before("1.0.0-rc.1")&&l.removeExtension(e,"collection-assets"),p.migrateAll(e)},itemAsset(e){o.before("1.0.0-beta.2")&&l.rename(e,"item_assets","assets"),p.migrateAll(e,"item_assets")},summaries(e){if(l.ensure(e,"summaries",{}),o.before("0.8.0")&&l.isObject(e.other_properties)){for(let t in e.other_properties){let s=e.other_properties[t];Array.isArray(s.extent)&&2===s.extent.length?e.summaries[t]={minimum:s.extent[0],maximum:s.extent[1]}:Array.isArray(s.values)&&(s.values.filter((e=>Array.isArray(e))).length===s.values.length?e.summaries[t]=s.values.reduce(((e,t)=>e.concat(t)),[]):e.summaries[t]=s.values)}delete e.other_properties}if(o.before("1.0.0-beta.1")&&l.isObject(e.properties)&&!e.links.find((e=>["child","item"].includes(e.rel))))for(let t in e.properties){let s=e.properties[t];Array.isArray(s)||(s=[s]),e.summaries[t]=s}o.before("1.0.0-rc.1")&&l.mapObject(e.summaries,(e=>(l.rename(e,"min","minimum"),l.rename(e,"max","maximum"),e))),f.migrate(e.summaries),l.moveTo(e.summaries,"sci:doi",e,!0)&&l.addExtension(e,n.scientific),l.moveTo(e.summaries,"sci:publications",e,!0,!0)&&l.addExtension(e,n.scientific),l.moveTo(e.summaries,"sci:citation",e,!0)&&l.addExtension(e,n.scientific),l.moveTo(e.summaries,"cube:dimensions",e,!0)&&l.addExtension(e,n.datacube),0===Object.keys(e.summaries).length&&delete e.summaries}},h={migrate(e,t=null,s=!0){o.set(e.stac_version),s&&(e.stac_version=i),o.before("1.0.0-rc.1")&&l.migrateExtensionShortnames(e),l.ensure(e,"id",""),l.ensure(e,"type","Feature"),l.isObject(e.geometry)||(e.geometry=null),null!==e.geometry&&l.ensure(e,"bbox",[]),l.ensure(e,"properties",{}),l.ensure(e,"links",[]),l.ensure(e,"assets",{});let r=!1;l.isObject(t)&&l.isObject(t.properties)&&(l.removeFromArray(e,"stac_extensions","commons"),e.properties=Object.assign({},t.properties,e.properties),r=!0),l.runAll(h,e,e),f.migrate(e.properties,e),p.migrateAll(e),l.ensure(e,"stac_extensions",[]),(o.before("0.8.0")||r)&&l.populateExtensions(e,"item")}},p={migrateAll(e,t="assets"){for(let s in e[t])p.migrate(e[t][s],e)},migrate(e,t){l.runAll(p,e,t),f.migrate(e,t)},mediaTypes(e){l.is(e.type,"string")&&l.mapValues(e,"type",["image/vnd.stac.geotiff","image/vnd.stac.geotiff; cloud-optimized=true"],["image/tiff; application=geotiff","image/tiff; application=geotiff; profile=cloud-optimized"])},eo(e,t){let s=l.isObject(t.properties)&&Array.isArray(t.properties["eo:bands"])?t.properties["eo:bands"]:[];if(Array.isArray(e["eo:bands"]))for(let t in e["eo:bands"]){let r=e["eo:bands"][t];l.is(r,"number")&&l.isObject(s[r])?r=s[r]:l.isObject(r)||(r={}),e["eo:bands"][t]=r}}},f={migrate(e,t){l.runAll(f,e,t)},_commonMetadata(e){o.before("1.0.0-rc.3")&&(l.toUTC(e,"created"),l.toUTC(e,"updated"))},_timestamps(e){l.toUTC(e,"published"),l.toUTC(e,"expires"),l.toUTC(e,"unpublished")},_versioningIndicator(e){},checksum(e,t){o.before("0.9.0")&&(l.rename(e,"checksum:md5","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","md5"),l.rename(e,"checksum:sha1","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha1"),l.rename(e,"checksum:sha2","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha2-256"),l.rename(e,"checksum:sha3","checksum:multihash")&&c.toMultihash(e,"checksum:multihash","sha3-256")),o.before("1.0.0-rc.1")&&l.rename(e,"checksum:multihash","file:checksum")&&l.addExtension(t,n.file)},cube(){},dtr(e,t){o.before("0.9.0")&&(l.rename(e,"dtr:start_datetime","start_datetime"),l.rename(e,"dtr:end_datetime","end_datetime"),l.removeExtension(t,"datetime-range"))},eo(e,t){o.before("0.9.0")&&(l.rename(e,"eo:epsg","proj:epsg")&&l.addExtension(t,n.projection),l.rename(e,"eo:platform","platform"),l.rename(e,"eo:instrument","instruments")&&l.toArray(e,"instruments"),l.rename(e,"eo:constellation","constellation"),l.rename(e,"eo:off_nadir","view:off_nadir")&&l.addExtension(t,n.view),l.rename(e,"eo:azimuth","view:azimuth")&&l.addExtension(t,n.view),l.rename(e,"eo:incidence_angle","view:incidence_angle")&&l.addExtension(t,n.view),l.rename(e,"eo:sun_azimuth","view:sun_azimuth")&&l.addExtension(t,n.view),l.rename(e,"eo:sun_elevation","view:sun_elevation")&&l.addExtension(t,n.view)),o.before("1.0.0-beta.1")&&l.rename(e,"eo:gsd","gsd")},label(e){o.before("0.8.0")&&(l.rename(e,"label:property","label:properties"),l.rename(e,"label:task","label:tasks"),l.rename(e,"label:overview","label:overviews")&&l.toArray(e,"label:overviews"),l.rename(e,"label:method","label:methods"),l.toArray(e,"label:classes"))},pc(e){o.before("0.8.0")&&l.rename(e,"pc:schema","pc:schemas")},proj(e){},sar(e,t){let s=!t;l.rename(e,"sar:incidence_angle","view:incidence_angle")&&l.addExtension(t,n.view),l.rename(e,"sar:pass_direction","sat:orbit_state")&&l.mapValues(e,"sat:orbit_state",[null],["geostationary"])&&l.addExtension(t,n.sat),o.before("0.7.0")&&(l.flattenArray(e,"sar:resolution",["sar:resolution_range","sar:resolution_azimuth"],s),l.flattenArray(e,"sar:pixel_spacing",["sar:pixel_spacing_range","sar:pixel_spacing_azimuth"],s),l.flattenArray(e,"sar:looks",["sar:looks_range","sar:looks_azimuth","sar:looks_equivalent_number"],s),l.rename(e,"sar:off_nadir","view:off_nadir")&&l.addExtension(t,n.view)),o.before("0.9.0")&&(l.rename(e,"sar:platform","platform"),l.rename(e,"sar:instrument","instruments")&&l.toArray(e,"instruments"),l.rename(e,"sar:constellation","constellation"),l.rename(e,"sar:type","sar:product_type"),l.rename(e,"sar:polarization","sar:polarizations"),l.flattenOneElementArray(e,"sar:absolute_orbit",s)&&l.rename(e,"sar:absolute_orbit","sat:absolute_orbit")&&l.addExtension(t,n.sat),l.flattenOneElementArray(e,"sar:relative_orbit",s)&&l.rename(e,"sar:relative_orbit","sat:relative_orbit")&&l.addExtension(t,n.sat))},sat(e){o.before("0.9.0")&&(l.rename(e,"sat:off_nadir_angle","sat:off_nadir"),l.rename(e,"sat:azimuth_angle","sat:azimuth"),l.rename(e,"sat:sun_azimuth_angle","sat:sun_azimuth"),l.rename(e,"sat:sun_elevation_angle","sat:sun_elevation"))},sci(e){},item(e){o.before("0.8.0")&&(l.rename(e,"item:license","license"),l.rename(e,"item:providers","providers"))},view(e){}},m={item:(e,t=null,s=!0)=>(h.migrate(e,t,s),e),catalog:(e,t=!0)=>(u.migrate(e,t),e),collection:(e,t=!0)=>(d.migrate(e,t),e),stac:(e,t=!0)=>"Feature"===e.type?m.item(e,null,t):"Collection"===e.type||l.isDefined(e.extent)||l.isDefined(e.license)?m.collection(e,t):m.catalog(e,t)};e.exports=m},439:e=>{e.exports=class{constructor(e,t,s){this.id=s.id||null,this.title=s.title||"",this.description=s.description||"",this.type=e,this.connection=t,this.token=null}getId(){let e=this.getType();return this.getProviderId().length>0&&(e+="."+this.getProviderId()),e}getType(){return this.type}getProviderId(){return"string"==typeof this.id?this.id:""}getTitle(){return this.title}getDescription(){return this.description}getToken(){return"string"==typeof this.token?this.getType()+"/"+this.getProviderId()+"/"+this.token:null}setToken(e){this.token=e,this.connection.emit("tokenChanged",e),null!==this.token?this.connection.setAuthProvider(this):this.connection.setAuthProvider(null)}async login(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];throw new Error("Not implemented.",t)}async logout(){this.setToken(null)}}},337:e=>{e.exports=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.connection=e,this.apiToClientNames={},this.clientToApiNames={},this.lastRefreshTime=0,this.extra={};for(let e in t){let s,r;Array.isArray(t[e])?(s=t[e][0],r=t[e][1]):(s=t[e],r=t[e]),this.apiToClientNames[s]=r,this.clientToApiNames[r]=s}}toJSON(){let e={};for(let t in this.clientToApiNames){let s=this.clientToApiNames[t];void 0!==this[t]&&(e[s]=this[t])}return Object.assign(e,this.extra)}setAll(e){for(let t in e)void 0===this.apiToClientNames[t]?this.extra[t]=e[t]:this[this.apiToClientNames[t]]=e[t];return this.lastRefreshTime=Date.now(),this}getDataAge(){return(Date.now()-this.lastRefreshTime)/1e3}getAll(){let e={};for(let t in this.apiToClientNames){let s=this.apiToClientNames[t];void 0!==this[s]&&(e[s]=this[s])}return Object.assign(e,this.extra)}get(e){return void 0!==this.extra[e]?this.extra[e]:null}_convertToRequest(e){let t={};for(let s in e)void 0===this.clientToApiNames[s]?t[s]=e[s]:t[this.clientToApiNames[s]]=e[s];return t}_supports(e){return this.connection.capabilities().hasFeature(e)}}},112:(e,t,s)=>{const r=s(56),i=s(480),n=s(439);e.exports=class extends n{constructor(e){super("basic",e,{id:null,title:"HTTP Basic",description:"Login with username and password using the method HTTP Basic."})}async login(e,t){let s=await this.connection._send({method:"get",responseType:"json",url:"/credentials/basic",headers:{Authorization:"Basic "+r.base64encode(e+":"+t)}});if(!i.isObject(s.data)||"string"!=typeof s.data.access_token)throw new Error("No access_token returned.");this.setToken(s.data.access_token)}}},56:e=>{e.exports=class{static getName(){return"Browser"}static getUrl(){return window.location.toString()}static setUrl(e){throw new Error("setUrl is not supported in a browser environment.")}static handleErrorResponse(e){return new Promise(((t,s)=>{let r=new FileReader;r.onerror=e=>{r.abort(),s(e.target.error)},r.onload=()=>{let e=r.result instanceof ArrayBuffer?String.fromCharCode.apply(null,new Uint16Array(r.result)):r.result,s="string"==typeof e?JSON.parse(e):e;t(s)},r.readAsText(e.response.data)}))}static getResponseType(){return"blob"}static base64encode(e){return btoa(e)}static fileNameForUpload(e){return e.name.split(/(\\|\/)/g).pop()}static dataForUpload(e){return e}static async downloadResults(e,t,s){throw new Error("downloadResults is not supported in a browser environment.")}static saveToFile(e,t){return new Promise(((s,r)=>{try{e instanceof Blob||(e=new Blob([e],{type:"application/octet-stream"}));let r=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=r,i.setAttribute("download",t||"download"),void 0===i.download&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r),s()}catch(e){console.error(e),r(e)}}))}}},966:(e,t,s)=>{const r=s(985),i=s(917),n=s(300).default,a=s(480),o=s(905),l=s(545),c=["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links"];class u{static async fromVersion(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t="https://processes.openeo.org/processes.json";return"string"==typeof e&&(t="https://processes.openeo.org/"+e+"/processes.json"),await u.fromURL(t)}static async fromURL(e){let t=await n(e);return new u(t.data)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(this.id=s,this.parent=t,this.parentNode=null,this.parentParameter=null,this.nodes={},this.idCounter={},this.callbackParameterCache={},this.parameters=void 0,this.processes=null,e instanceof l)this.processes=e;else if(a.isObject(e)&&Array.isArray(e.processes))this.processes=new l(e.processes);else{if(!Array.isArray(e))throw new Error("Processes are invalid; must be array or object according to the API.");this.processes=new l(e)}this.processes.all().forEach((e=>this.createFunction(e)))}createFunction(e){if(void 0!==this[e.id])throw new Error("Can't create function for process '"+e.id+"'. Already exists in Builder class.");this[e.id]=function(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return this.process(e.id,s)}}addProcessSpec(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!a.isObject(e))throw new Error("Process '"+e.id+"' must be an object.");t||(t="backend"),this.processes.add(e,t),"backend"===t&&this.createFunction(e)}setParent(e,t){this.parentNode=e,this.parentParameter=t}createCallbackParameter(e){return this.callbackParameterCache[e]||(this.callbackParameterCache[e]=i.create(this,e)),this.callbackParameterCache[e]}getParentCallbackParameters(){let e=[];if(this.parentNode&&this.parentParameter)try{e=o.getCallbackParametersForProcess(this.parentNode.spec,this.parentParameter).map((e=>this.createCallbackParameter(e.name)))}catch(e){console.warn(e)}return e}addParameter(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0!==this.getParentCallbackParameters().find((t=>t.name===e.name)))return;let s=this;if(t)for(;s.parent;)s=s.parent;Array.isArray(s.parameters)||(s.parameters=[]);let r=s.parameters.findIndex((t=>t.name===e.name));-1!==r?Object.assign(s.parameters[r],e):s.parameters.push(e)}spec(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.processes.get(e,t)}math(e){let t=new(s(456))(e);return t.setBuilder(this),t.generate(!1)}supports(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Boolean(this.spec(e,t))}process(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=null;if(e.includes("@")){let t;[e,...t]=e.split("@"),i=t.join("@")}let n=new r(this,e,t,s,i);return this.nodes[n.id]=n,n}toJSON(){let e={process_graph:a.mapObjectValues(this.nodes,(e=>e.toJSON()))};return c.forEach((t=>{void 0!==this[t]&&(e[t]=this[t])})),e}generateId(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.replace("_","").substr(0,6),this.idCounter[e]?this.idCounter[e]++:this.idCounter[e]=1,e+this.idCounter[e]}}e.exports=u},456:(e,t,s)=>{const r=s(126),i=s(917),n=s(985);class a{constructor(e){let t=new r.Parser;this.tree=t.parse(e),this.builder=null}setBuilder(e){this.builder=e}generate(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.parseTree(this.tree);if(!(t instanceof n))throw new Error("Invalid formula specified.");return e&&(t.result=!0),t}parseTree(e){let t=Object.keys(e)[0];switch(t){case"Number":return parseFloat(e.Number);case"Identifier":return this.getRef(e.Identifier);case"Expression":return this.parseTree(e.Expression);case"FunctionCall":{let t=[];for(let s in e.FunctionCall.args)t.push(this.parseTree(e.FunctionCall.args[s]));return this.builder.process(e.FunctionCall.name,t)}case"Binary":return this.addOperatorProcess(e.Binary.operator,this.parseTree(e.Binary.left),this.parseTree(e.Binary.right));case"Unary":{let t=this.parseTree(e.Unary.expression);return"-"===e.Unary.operator?"number"==typeof t?-t:this.addOperatorProcess("*",-1,t):t}default:throw new Error("Operation "+t+" not supported.")}}getRef(e){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if("string"==typeof e&&e.startsWith("#")){let t=e.substring(1);if(t in this.builder.nodes)return{from_node:t}}let t=this.builder.getParentCallbackParameters();if("string"==typeof e&&t.length>0){let s=e.match(/^\$+/),r=s?s[0].length:0;if(r>0&&t.length>=r){let s=e.substring(r);return t[r-1][s]}}let s=new i(e);return this.builder.addParameter(s),s}addOperatorProcess(e,t,s){let r=a.operatorMapping[e],i=this.builder.spec(r);if(r&&i){let n={};if(!Array.isArray(i.parameters)||i.parameters.length<2)throw new Error("Process for operator "+e+" must have at least two parameters");return n[i.parameters[0].name||"x"]=t,n[i.parameters[1].name||"y"]=s,this.builder.process(r,n)}throw new Error("Operator "+e+" not supported")}}a.operatorMapping={"-":"subtract","+":"add","/":"divide","*":"multiply","^":"power"},e.exports=a},985:(e,t,s)=>{const r=s(480),i=s(917);class n{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(this.parent=e,this.spec=this.parent.spec(t,i),!this.spec)throw new Error("Process doesn't exist: "+t);this.id=e.generateId(t),this.namespace=i,this.arguments=Array.isArray(s)?this.namedArguments(s):s,this._description=r,this.result=!1,this.addParametersToProcess(this.arguments)}namedArguments(e){if(e.length>(this.spec.parameters||[]).length)throw new Error("More arguments specified than parameters available.");let t={};if(Array.isArray(this.spec.parameters))for(let s=0;s<this.spec.parameters.length;s++)t[this.spec.parameters[s].name]=e[s];return t}addParametersToProcess(e){for(let t in e){let s=e[t];s instanceof i?r.isObject(s.spec.schema)&&this.parent.addParameter(s.spec):s instanceof n?this.addParametersToProcess(s.arguments):(Array.isArray(s)||r.isObject(s))&&this.addParametersToProcess(s)}}description(e){return void 0===e?this._description:(this._description=e,this)}exportArgument(e,t){const a=s(456);if(r.isObject(e)){if(e instanceof n||e instanceof i)return e.ref();if(e instanceof a){let s=this.createBuilder(this,t);return e.setBuilder(s),e.generate(),s.toJSON()}if(e instanceof Date)return e.toISOString();if("function"==typeof e.toJSON)return e.toJSON();{let s={};for(let r in e)void 0!==e[r]&&(s[r]=this.exportArgument(e[r],t));return s}}return Array.isArray(e)?e.map((e=>this.exportArgument(e)),t):"function"==typeof e?this.exportCallback(e,t):e}createBuilder(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=new(s(966))(this.parent.processes,this.parent);return null!==e&&null!==t&&r.setParent(e,t),r}exportCallback(e,t){let s=this.createBuilder(this,t),i=s.getParentCallbackParameters(),a=e.bind(s)(...i,s);if(Array.isArray(a)&&s.supports("array_create")?a=s.array_create(a):!r.isObject(a)&&s.supports("constant")&&(a=s.constant(a)),a instanceof n)return a.result=!0,s.toJSON();throw new Error("Callback must return BuilderNode")}toJSON(){let e={process_id:this.spec.id,arguments:{}};this.namespace&&(e.namespace=this.namespace);for(let t in this.arguments)void 0!==this.arguments[t]&&(e.arguments[t]=this.exportArgument(this.arguments[t],t));return"function"!=typeof this.description?e.description=this.description:"string"==typeof this._description&&(e.description=this._description),this.result&&(e.result=!0),e}ref(){return{from_node:this.id}}}e.exports=n},917:e=>{"use strict";class t{static create(e,s){let r=new t(s,null);if("undefined"!=typeof Proxy)return new Proxy(r,{nodeCache:{},get(t,s,i){if(!Reflect.has(t,s)){if(!this.nodeCache[s]){let t={data:r};"string"==typeof s&&s.match(/^(0|[1-9]\d*)$/)?t.index=parseInt(s,10):t.label=s,this.nodeCache[s]=e.process("array_element",t)}return this.nodeCache[s]}return Reflect.get(t,s,i)},set(e,t,s,r){if(!Reflect.has(e,t))throw new Error("Simplified array access is read-only");return Reflect.set(e,t,s,r)}});throw new Error("Simplified array access not supported, use array_element directly")}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;this.name=e,this.spec={name:e,schema:"string"==typeof t?{type:t}:t,description:s},void 0!==r&&(this.spec.optional=!0,this.spec.default=r)}toJSON(){return this.spec}ref(){return{from_parameter:this.name}}}e.exports=t},126:e=>{let t={Token:{Operator:"Operator",Identifier:"Identifier",Number:"Number"}};const s={"⁰":0,"¹":1,"²":2,"³":3,"⁴":4,"⁵":5,"⁶":6,"⁷":7,"⁸":8,"⁹":9},r=Object.keys(s).join("");t.Lexer=function(){let e="",s=0,i=0,n=0,a=t.Token;function o(){let t=i;return t<s?e.charAt(t):"\0"}function l(){let t="\0",r=i;return r<s&&(t=e.charAt(r),i+=1),t}function c(e){return"\t"===e||" "===e||" "===e}function u(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function d(e){return e>="0"&&e<="9"}function h(e,t){return{type:e,value:t,start:n,end:i-1}}function p(e){return"-"===e||"."===e||"~"===e||"@"===e}function f(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"_"===e||u(e)||d(e)||t&&p(e)}function m(){let e;if(function(){let e;for(;i<s&&(e=o(),c(e));)l()}(),!(i>=s)){if(n=i,e=function(){let e,t;if(e=o(),d(e)||"."===e){if(t="","."!==e)for(t=l();e=o(),d(e);)t+=l();if("."===e)for(t+=l();e=o(),d(e);)t+=l();if("e"===e||"E"===e){if(t+=l(),e=o(),"+"!==e&&"-"!==e&&!d(e))throw e="character "+e,i>=s&&(e="<end>"),new SyntaxError("Unexpected "+e+" after the exponent sign");for(t+=l();e=o(),d(e);)t+=l()}if("."===t)throw new SyntaxError("Expecting decimal digits after the dot sign");return h(a.Number,t)}}(),void 0!==e)return e;if(e=function(){let e=o();if(("+-*/()^,"+r).indexOf(e)>=0)return h(a.Operator,l())}(),void 0!==e)return e;if(e=function(){let e=o();if("_"!==(t=e)&&"#"!==t&&"$"!==t&&!u(t))return;var t;let s=l(),r=!1;for(;;){let t=o();if("$"===e)"$"!==t&&(e="");else if("@"===t)r=!0;else if(!f(t,r))break;s+=l()}return h(a.Identifier,s)}(),void 0!==e)return e;throw new SyntaxError("Unknown token from character "+o())}}return{reset:function(t){e=t,s=t.length,i=0},next:m,peek:function(){let e,t=i;try{e=m(),delete e.start,delete e.end}catch(t){e=void 0}return i=t,e}}},t.Parser=function(){let e=new t.Lexer,i=t.Token;function n(e,t){return void 0!==e&&e.type===i.Operator&&t.includes(e.value)}function a(){let t,s=e.peek();return n(s,"-+")?(s=e.next(),t=a(),{Unary:{operator:s.value,expression:t}}):function(){let t,s=e.peek();if(void 0===s)throw new SyntaxError("Unexpected termination of expression");if(s.type===i.Identifier)return s=e.next(),n(e.peek(),"(")?function(t){let s=[],r=e.next();if(!n(r,"("))throw new SyntaxError('Expecting ( in a function call "'+t+'"');if(r=e.peek(),n(r,")")||(s=function(){let t,s,r=[];for(;s=c(),void 0!==s&&(r.push(s),t=e.peek(),n(t,","));)e.next();return r}()),r=e.next(),!n(r,")"))throw new SyntaxError('Expecting ) in a function call "'+t+'"');return{FunctionCall:{name:t,args:s}}}(s.value):{Identifier:s.value};if(s.type===i.Number)return s=e.next(),{Number:s.value};if(n(s,"(")){if(e.next(),t=c(),s=e.next(),!n(s,")"))throw new SyntaxError("Expecting )");return{Expression:t}}throw new SyntaxError("Parse error, can not process token "+s.value)}()}function o(){let t=a(),i=e.peek();for(;n(i,"^"+r);)i=e.next(),t={Binary:{operator:"^",left:t,right:"^"!==i.value?(o=i.value,"number"==typeof s[o]?{Number:s[o]}:null):a()}},i=e.peek();var o;return t}function l(){let t=o(),s=e.peek();for(;n(s,"*/");)s=e.next(),t={Binary:{operator:s.value,left:t,right:o()}},s=e.peek();return t}function c(){return function(){let t=l(),s=e.peek();for(;n(s,"+-");)s=e.next(),t={Binary:{operator:s.value,left:t,right:l()}},s=e.peek();return t}()}return{parse:function(t){e.reset(t);let s=c(),r=e.next();if(void 0!==r)throw new SyntaxError("Unexpected token "+r.value);return{Expression:s}}}},e.exports=t},11:(e,t,s)=>{const r=s(480);e.exports=class{constructor(e){if(!r.isObject(e))throw new Error("No capabilities retrieved.");if(!e.api_version)throw new Error("Invalid capabilities: No API version retrieved");if(!Array.isArray(e.endpoints))throw new Error("Invalid capabilities: No endpoints retrieved");this.data=e,this.features=this.data.endpoints.map((e=>e.methods.map((t=>(t+" "+e.path).toLowerCase())))).reduce(((e,t)=>e.concat(t)),[]),this.featureMap={capabilities:!0,listFileTypes:"get /file_formats",listServiceTypes:"get /service_types",listUdfRuntimes:"get /udf_runtimes",listCollections:"get /collections",describeCollection:"get /collections/{collection_id}",listCollectionItems:"get /collections/{collection_id}/items",listProcesses:"get /processes",describeProcess:"get /processes",listAuthProviders:!0,authenticateOIDC:"get /credentials/oidc",authenticateBasic:"get /credentials/basic",describeAccount:"get /me",listFiles:"get /files",getFile:"get /files",uploadFile:"put /files/{path}",downloadFile:"get /files/{path}",deleteFile:"delete /files/{path}",validateProcess:"post /validation",listUserProcesses:"get /process_graphs",describeUserProcess:"get /process_graphs/{process_graph_id}",getUserProcess:"get /process_graphs/{process_graph_id}",setUserProcess:"put /process_graphs/{process_graph_id}",replaceUserProcess:"put /process_graphs/{process_graph_id}",deleteUserProcess:"delete /process_graphs/{process_graph_id}",computeResult:"post /result",listJobs:"get /jobs",createJob:"post /jobs",listServices:"get /services",createService:"post /services",getJob:"get /jobs/{job_id}",describeJob:"get /jobs/{job_id}",updateJob:"patch /jobs/{job_id}",deleteJob:"delete /jobs/{job_id}",estimateJob:"get /jobs/{job_id}/estimate",debugJob:"get /jobs/{job_id}/logs",startJob:"post /jobs/{job_id}/results",stopJob:"delete /jobs/{job_id}/results",listResults:"get /jobs/{job_id}/results",downloadResults:"get /jobs/{job_id}/results",describeService:"get /services/{service_id}",getService:"get /services/{service_id}",updateService:"patch /services/{service_id}",deleteService:"delete /services/{service_id}",debugService:"get /services/{service_id}/logs"}}toJSON(){return this.data}apiVersion(){return this.data.api_version}backendVersion(){return this.data.backend_version}title(){return"string"==typeof this.data.title?this.data.title:""}description(){return"string"==typeof this.data.description?this.data.description:""}isStable(){return!0===this.data.production}links(){return Array.isArray(this.data.links)?this.data.links:[]}listFeatures(){let e=[];for(let t in this.featureMap)(!0===this.featureMap[t]||this.features.includes(this.featureMap[t]))&&e.push(t);return e.sort()}hasFeature(e){return!0===this.featureMap[e]||this.features.some((t=>t===this.featureMap[e]))}currency(){return r.isObject(this.data.billing)&&"string"==typeof this.data.billing.currency?this.data.billing.currency:null}listPlans(){if(r.isObject(this.data.billing)&&Array.isArray(this.data.billing.plans)){let e="string"==typeof this.data.billing.default_plan?this.data.billing.default_plan.toLowerCase():null;return this.data.billing.plans.map((t=>{let s={default:e===t.name.toLowerCase()};return Object.assign({},t,s)}))}return[]}}},398:(e,t,s)=>{const r=s(56),i=s(480),n=s(545),a=s(300).default,o=s(19),l=s(439),c=s(112),u=s(833),d=s(11),h=s(113),p=s(291),f=s(512),m=s(49),g=s(295),b=s(966),y=s(985);e.exports=class{constructor(e){var t=this;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.url=r,this.baseUrl=i.normalizeUrl(e),this.authProviderList=null,this.authProvider=null,this.capabilitiesObject=null,this.processes=new n([],Boolean(s.addNamespaceToProcess)),this.processes.listeners.push((function(){for(var e=arguments.length,s=new Array(e),r=0;r<e;r++)s[r]=arguments[r];return t.emit("processesChanged",...s)})),this.listeners={},this.options=s}async init(){let e=await this._get("/");return this.capabilitiesObject=new d(e.data),this.capabilitiesObject}getBaseUrl(){return this.baseUrl}getUrl(){return this.url||this.baseUrl}capabilities(){return this.capabilitiesObject}async listFileTypes(){let e=await this._get("/file_formats");return new h(e.data)}async listServiceTypes(){return(await this._get("/service_types")).data}async listUdfRuntimes(){return(await this._get("/udf_runtimes")).data}async listCollections(){let e=await this._get("/collections");return i.isObject(e.data)&&Array.isArray(e.data.collections)&&(e.data.collections=e.data.collections.map((e=>o.collection(e)))),e.data}async describeCollection(e){let t=await this._get("/collections/"+e);return o.collection(t.data)}async*listCollectionItems(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=1,a="/collections/"+e+"/items";for(;a;){let e={};1===n&&(Array.isArray(t)&&(e.bbox=t.join(",")),Array.isArray(s)&&(e.datetime=s.map((e=>e instanceof Date?e.toISOString():"string"==typeof e?e:"..")).join("/")),r>0&&(e.limit=r));let l=await this._get(a,e);i.isObject(l.data)&&Array.isArray(l.data.features)&&(l.data.features=l.data.features.map((e=>o.item(e)))),yield l.data,n++,a=this._getLinkHref(l.data.links)}}async listProcesses(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e||(e="backend");let t="backend"===e?"/processes":`/processes/${e}`,s=await this._get(t);if(!i.isObject(s.data)||!Array.isArray(s.data.processes))throw new Error("Invalid response received for processes");return this.processes.remove(null,e),this.processes.addAll(s.data.processes,e),Object.assign(s.data,{processes:this.processes.namespace(e)})}async describeProcess(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t||(t="backend"),"backend"===t)await this.listProcesses();else{let s=await this._get(`/processes/${t}/${e}`);if(!i.isObject(s.data)||"string"!=typeof s.data.id)throw new Error("Invalid response received for process");this.processes.add(s.data,t)}return this.processes.get(e,t)}async buildProcess(e){return await this.listProcesses(),new b(this.processes,null,e)}async listAuthProviders(){if(null!==this.authProviderList)return this.authProviderList;this.authProviderList=[];let e=this.capabilities();if(e.hasFeature("authenticateOIDC")){let e=await this._get("/credentials/oidc"),t=this.getOidcProviderFactory();if(i.isObject(e.data)&&Array.isArray(e.data.providers)&&"function"==typeof t)for(let s in e.data.providers){let r=t(e.data.providers[s]);r instanceof l&&this.authProviderList.push(r)}}return e.hasFeature("authenticateBasic")&&this.authProviderList.push(new c(this)),this.authProviderList}setOidcProviderFactory(e){this.oidcProviderFactory=e}getOidcProviderFactory(){return"function"==typeof this.oidcProviderFactory?this.oidcProviderFactory:u.isSupported()?e=>new u(this,e):null}async authenticateBasic(e,t){let s=new c(this);await s.login(e,t)}isAuthenticated(){return null!==this.authProvider}emit(e){if("function"==typeof this.listeners[e]){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r<t;r++)s[r-1]=arguments[r];this.listeners[e](...s)}}on(e,t){this.listeners[e]=t}off(e){delete this.listeners[e]}getAuthProvider(){return this.authProvider}setAuthProvider(e){e!==this.authProvider&&(this.authProvider=e instanceof l?e:null,this.emit("authProviderChanged",this.authProvider))}setAuthToken(e,t,s){let r=new l(e,this,{id:t,title:"Custom",description:""});return r.setToken(s),this.setAuthProvider(r),r}async describeAccount(){return(await this._get("/me")).data}async listFiles(){return(await this._get("/files")).data.files.map((e=>new p(this,e.path).setAll(e)))}async uploadFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;null===t&&(t=r.fileNameForUpload(e));let n=await this.getFile(t);return await n.uploadFile(e,s,i)}async getFile(e){return new p(this,e)}_normalizeUserProcess(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e instanceof m?e=e.toJSON():e instanceof y?(e.result=!0,e=e.parent.toJSON()):i.isObject(e)&&!i.isObject(e.process_graph)&&(e={process_graph:e}),Object.assign({},t,{process:e})}async validateProcess(e){let t=await this._post("/validation",this._normalizeUserProcess(e).process);if(Array.isArray(t.data.errors))return t.data.errors;throw new Error("Invalid validation response received.")}async listUserProcesses(){let e=await this._get("/process_graphs");if(!i.isObject(e.data)||!Array.isArray(e.data.processes))throw new Error("Invalid response received for processes");return this.processes.remove(null,"user"),this.processes.addAll(e.data.processes,"user"),e.data.processes.map((e=>new m(this,e.id).setAll(e)))}async setUserProcess(e,t){let s=new m(this,e);return await s.replaceUserProcess(t)}async getUserProcess(e){let t=new m(this,e);return await t.describeUserProcess()}async computeResult(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=this._normalizeUserProcess(e,{plan:t,budget:s}),o=await this._post("/result",a,r.getResponseType(),n),l={data:o.data,costs:null,type:null,logs:[]};"number"==typeof o.headers["openeo-costs"]&&(l.costs=o.headers["openeo-costs"]),"string"==typeof o.headers["content-type"]&&(l.type=o.headers["content-type"]);let c=Array.isArray(o.headers.link)?o.headers.link:[o.headers.link];for(let e of c){if("string"!=typeof e)continue;let t=e.match(/^<([^>]+)>;\s?rel="monitor"/i);if(Array.isArray(t)&&t.length>1)try{let e=await this._get(t[1]);i.isObject(e.data)&&Array.isArray(e.data.logs)&&(l.logs=e.data.logs)}catch(e){console.warn(e)}}return l}async downloadResult(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=await this.computeResult(e,s,i,n);await r.saveToFile(a.data,t)}async listJobs(){return(await this._get("/jobs")).data.jobs.map((e=>new f(this,e.id).setAll(e)))}async createJob(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};n=Object.assign({},n,{title:t,description:s,plan:r,budget:i});let a=this._normalizeUserProcess(e,n),o=await this._post("/jobs",a);if("string"!=typeof o.headers["openeo-identifier"])throw new Error("Response did not contain a Job ID. Job has likely been created, but may not show up yet.");let l=new f(this,o.headers["openeo-identifier"]).setAll(a);return this.capabilitiesObject.hasFeature("describeJob")?await l.describeJob():l}async getJob(e){let t=new f(this,e);return await t.describeJob()}async listServices(){return(await this._get("/services")).data.services.map((e=>new g(this,e.id).setAll(e)))}async createService(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{},c=this._normalizeUserProcess(e,Object.assign({title:s,description:r,type:t,enabled:i,configuration:n,plan:a,budget:o},l)),u=await this._post("/services",c);if("string"!=typeof u.headers["openeo-identifier"])throw new Error("Response did not contain a Service ID. Service has likely been created, but may not show up yet.");let d=new g(this,u.headers["openeo-identifier"]).setAll(c);return this.capabilitiesObject.hasFeature("describeService")?d.describeService():d}async getService(e){let t=new g(this,e);return await t.describeService()}_getLinkHref(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"next";if(Array.isArray(e)){let s=e.find((e=>i.isObject(e)&&e.rel===t&&"string"==typeof e.href));if(s)return s.href}return null}async _get(e,t,s){return await this._send({method:"get",responseType:s,url:e,timeout:"/"===e?5e3:0,params:t})}async _post(e,t,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i={method:"post",responseType:s,url:e,data:t};return await this._send(i,r)}async _put(e,t){return await this._send({method:"put",url:e,data:t})}async _patch(e,t){return await this._send({method:"patch",url:e,data:t})}async _delete(e){return await this._send({method:"delete",url:e})}async download(e,t){return(await this._send({method:"get",responseType:r.getResponseType(),url:e,authorization:t})).data}async _send(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e.baseURL=this.baseUrl,!this.isAuthenticated()||void 0!==e.authorization&&!0!==e.authorization||(e.headers||(e.headers={}),e.headers.Authorization="Bearer "+this.authProvider.getToken()),e.responseType||(e.responseType="json"),t&&(e.signal=t.signal);try{return await a(e)}catch(t){const s=e=>"string"==typeof e&&-1!==e.indexOf("/json"),n=(e,t)=>("string"==typeof t.message&&(e.message=t.message),e.code="string"==typeof t.code?t.code:"",e.id=t.id,e.links=Array.isArray(t.links)?t.links:[],e);if(i.isObject(t.response)&&i.isObject(t.response.data)&&(s(t.response.data.type)||i.isObject(t.response.headers)&&s(t.response.headers["content-type"]))){if(e.responseType!==r.getResponseType())throw n(t,t.response.data);try{throw n(t,await r.handleErrorResponse(t))}catch(e){console.error(e)}}throw t}}}},113:(e,t,s)=>{const r=s(480);e.exports=class{constructor(e){if(this.data={input:{},output:{}},r.isObject(e))for(let t of["input","output"])for(let s in e[t])r.isObject(e[t])&&(this.data[t][s.toUpperCase()]=e[t][s])}toJSON(){return this.data}getInputTypes(){return this.data.input}getOutputTypes(){return this.data.output}getInputType(e){return this._findType(e,"input")}getOutputType(e){return this._findType(e,"output")}_findType(e,t){return(e=e.toUpperCase())in this.data[t]?this.data[t][e]:null}}},512:(e,t,s)=>{const r=s(56),i=s(337),n=s(345),a=s(480),o=s(19),l=["finished","canceled","error"];e.exports=class extends i{constructor(e,t){super(e,["id","title","description","process","status","progress","created","updated","plan","costs","budget"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.status=void 0,this.progress=void 0,this.created=void 0,this.updated=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeJob(){let e=await this.connection._get("/jobs/"+this.id);return this.setAll(e.data)}async updateJob(e){return await this.connection._patch("/jobs/"+this.id,this._convertToRequest(e)),this._supports("describeJob")?await this.describeJob():this.setAll(e)}async deleteJob(){await this.connection._delete("/jobs/"+this.id)}async estimateJob(){return(await this.connection._get("/jobs/"+this.id+"/estimate")).data}debugJob(){return new n(this.connection,"/jobs/"+this.id+"/logs")}monitorJob(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeJob"))throw new Error("Monitoring Jobs not supported by the back-end.");let i=this.status,n=null,a=null;r.hasFeature("debugJob")&&s&&(a=this.debugJob());let o=async()=>{this.getDataAge()>1&&await this.describeJob();let t=a?await a.nextLogs():[];(i!==this.status||t.length>0)&&e(this,t),i=this.status,l.includes(this.status)&&c()};setTimeout(o,0),n=setInterval(o,1e3*t);let c=()=>{n&&(clearInterval(n),n=null)};return c}async startJob(){return await this.connection._post("/jobs/"+this.id+"/results",{}),this._supports("describeJob")?await this.describeJob():this}async stopJob(){return await this.connection._delete("/jobs/"+this.id+"/results"),this._supports("describeJob")?await this.describeJob():this}async getResultsAsStac(){let e=await this.connection._get("/jobs/"+this.id+"/results");if(!a.isObject(e)||!a.isObject(e.data))throw new Error("Results received from the back-end are invalid");let t=o.stac(e.data);return a.isObject(t.assets)||(t.assets={}),"Feature"===t.type?"number"==typeof e.headers["openeo-costs"]&&(t.properties.costs=e.headers["openeo-costs"]):"number"==typeof e.headers["openeo-costs"]&&(t.costs=e.headers["openeo-costs"]),t}async listResults(){let e=await this.getResultsAsStac();return a.isObject(e.assets)?Object.values(e.assets):[]}async downloadResults(e){let t=await this.listResults();return await r.downloadResults(this.connection,t,e)}}},345:(e,t,s)=>{const r=s(480);e.exports=class{constructor(e,t){this.connection=e,this.endpoint=t,this.lastId=""}async nextLogs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=await this.next(e);return Array.isArray(t.logs)?t.logs:[]}async next(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t={offset:this.lastId};e>0&&(t.limit=e);let s=await this.connection._get(this.endpoint,t);return Array.isArray(s.data.logs)&&s.data.logs.length>0?(s.data.logs=s.data.logs.filter((e=>r.isObject(e)&&"string"==typeof e.id)),this.lastId=s.data.logs[s.data.logs.length-1].id):s.data.logs=[],s.data.links=Array.isArray(s.data.links)?s.data.links:[],s.data}}},833:(e,t,s)=>{const r=s(480),i=s(439),n=s(56),a=s(6);class o extends i{static isSupported(){return r.isObject(a)&&Boolean(a.UserManager)}static async signinCallback(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=n.getUrl();e||(e=new o(null,{}),e.setGrant(s.includes("?")?"authorization_code+pkce":"implicit"));let r=e.getOptions(t),i=new a.UserManager(r);return await i.signinCallback(s)}constructor(e,t){super("oidc",e,t),this.manager=null,this.listeners={},this.user=null,this.clientId=null,this.grant="authorization_code+pkce",this.issuer=t.issuer||"",this.scopes=Array.isArray(t.scopes)&&t.scopes.length>0?t.scopes:["openid"],this.links=Array.isArray(t.links)?t.links:[],this.defaultClients=Array.isArray(t.default_clients)?t.default_clients:[],this.defaultClient=this.detectDefaultClient()}addListener(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";this.manager.events[`add${e}`](t),this.listeners[`${s}:${e}`]=t}removeListener(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";this.manager.events[`remove${e}`](this.listeners[e]),delete this.listeners[`${t}:${e}`]}async login(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.issuer||"string"!=typeof this.issuer)throw new Error("No Issuer URL available for OpenID Connect");this.manager=new a.UserManager(this.getOptions(e)),this.addListener("UserLoaded",(async()=>this.setUser(await this.manager.getUser())),"js-client"),this.addListener("AccessTokenExpired",(()=>this.setUser(null)),"js-client"),"popup"===o.uiMethod?await this.manager.signinPopup():await this.manager.signinRedirect()}async logout(){if(null!==this.manager){try{"popup"===o.uiMethod?await this.manager.signoutPopup():await this.manager.signoutRedirect({post_logout_redirect_uri:n.getUrl()})}catch(e){console.warn(e)}super.logout(),this.removeListener("UserLoaded","js-client"),this.removeListener("AccessTokenExpired","js-client"),this.manager=null,this.setUser(null)}}getOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.getResponseType();return Object.assign({client_id:this.clientId,redirect_uri:o.redirectUrl,authority:this.issuer.replace("/.well-known/openid-configuration",""),scope:this.scopes.join(" "),validateSubOnSilentRenew:!0,response_type:t,response_mode:t.includes("code")?"query":"fragment"},e)}getResponseType(){switch(this.grant){case"authorization_code+pkce":return"code";case"implicit":return"token id_token";default:throw new Error("Grant Type not supported")}}setGrant(e){switch(e){case"authorization_code+pkce":case"implicit":this.grant=e;break;default:throw new Error("Grant Type not supported")}}setClientId(e){this.clientId=e}setUser(e){e?(this.user=e,this.setToken(e.access_token)):(this.user=null,this.setToken(null))}detectDefaultClient(){for(let e of o.grants){let t=this.defaultClients.find((t=>Boolean(t.grant_types.includes(e)&&Array.isArray(t.redirect_urls)&&t.redirect_urls.find((e=>e.startsWith(o.redirectUrl))))));if(t)return this.setGrant(e),this.setClientId(t.id),this.defaultClient=t,t}return null}}o.uiMethod="redirect",o.redirectUrl=n.getUrl().split("#")[0].split("?")[0].replace(/\/$/,""),o.grants=["authorization_code+pkce","implicit"],e.exports=o},213:(e,t,s)=>{const r=s(300).default,{AbortController:i}=s(779),n=s(480),a=s(956),o=s(398),l=s(512),c=s(345),u=s(291),d=s(49),h=s(295),p=s(439),f=s(112),m=s(833),g=s(11),b=s(113),y=s(966),v=s(985),w=s(917),A=s(456),_="1.0.0-rc.2",x="1.x.x";class j{static async connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=n.normalizeUrl(e,"/.well-known/openeo"),i=e,o=null;try{if(o=await r.get(s,{timeout:5e3}),!n.isObject(o.data)||!Array.isArray(o.data.versions))throw new Error("Well-Known Document doesn't list any versions.")}catch(e){console.warn("Can't read well-known document, connecting directly to the specified URL as fallback mechanism. Reason: "+e.message)}if(n.isObject(o)){let e=a.findLatest(o.data.versions,!0,_,x);if(null===e)throw new Error("Server not supported. Client only supports the API versions between 1.0.0-rc.2 and 1.x.x");i=e.url}let l=await j.connectDirect(i,t);return l.url=e,l}static async connectDirect(e){let t=new o(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),s=await t.init();if(a.compare(s.apiVersion(),_,"<")||a.compare(s.apiVersion(),x,">"))throw new Error("Client only supports the API versions between 1.0.0-rc.2 and 1.x.x");return t}static clientVersion(){return"2.2.0"}}j.Environment=s(56),e.exports={AbortController:i,AuthProvider:p,BasicProvider:f,Capabilities:g,Connection:o,FileTypes:b,Job:l,Logs:c,OidcProvider:m,OpenEO:j,Service:h,UserFile:u,UserProcess:d,Builder:y,BuilderNode:v,Parameter:w,Formula:A}},295:(e,t,s)=>{const r=s(337),i=s(345);e.exports=class extends r{constructor(e,t){super(e,["id","title","description","process","url","type","enabled","configuration","attributes","created","plan","costs","budget"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.url=void 0,this.type=void 0,this.enabled=void 0,this.configuration=void 0,this.attributes=void 0,this.created=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeService(){let e=await this.connection._get("/services/"+this.id);return this.setAll(e.data)}async updateService(e){return await this.connection._patch("/services/"+this.id,this._convertToRequest(e)),this._supports("describeService")?await this.describeService():this.setAll(e)}async deleteService(){await this.connection._delete("/services/"+this.id)}debugService(){return new i(this.connection,"/services/"+this.id+"/logs")}monitorService(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeService"))throw new Error("Monitoring Services not supported by the back-end.");let i=this.enabled,n=null,a=null;r.hasFeature("debugService")&&s&&(a=this.debugService());let o=async()=>{this.getDataAge()>1&&await this.describeService();let t=a?await a.nextLogs():[];(i!==this.enabled||t.length>0)&&e(this,t),i=this.enabled};return setTimeout(o,0),n=setInterval(o,1e3*t),()=>{n&&(clearInterval(n),n=null)}}}},291:(e,t,s)=>{const r=s(56),i=s(337);e.exports=class extends i{constructor(e,t){super(e,["path","size","modified"]),this.path=t,this.size=void 0,this.modified=void 0}async retrieveFile(){return await this.connection.download("/files/"+this.path,!0)}async downloadFile(e){let t=await this.connection.download("/files/"+this.path,!0);return await r.saveToFile(t,e)}async uploadFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i={method:"put",url:"/files/"+this.path,data:r.dataForUpload(e),headers:{"Content-Type":"application/octet-stream"}};"function"==typeof t&&(i.onUploadProgress=e=>{let s=Math.round(100*e.loaded/e.total);t(s,this)});let n=await this.connection._send(i,s);return this.setAll(n.data)}async deleteFile(){await this.connection._delete("/files/"+this.path)}}},49:(e,t,s)=>{const r=s(337),i=s(480);e.exports=class extends r{constructor(e,t){super(e,["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links",["process_graph","processGraph"]]),this.id=t,this.summary=void 0,this.description=void 0,this.categories=void 0,this.parameters=void 0,this.returns=void 0,this.deprecated=void 0,this.experimental=void 0,this.exceptions=void 0,this.examples=void 0,this.links=void 0,this.processGraph=void 0}async describeUserProcess(){let e=await this.connection._get("/process_graphs/"+this.id);if(!i.isObject(e.data)||"string"!=typeof e.data.id)throw new Error("Invalid response received for user process");return this.connection.processes.add(e.data,"user"),this.setAll(e.data)}async replaceUserProcess(e){if(await this.connection._put("/process_graphs/"+this.id,this._convertToRequest(e)),this._supports("describeUserProcess"))return this.describeUserProcess();{let t=this.setAll(e);return this.connection.processes.add(t.toJSON(),"user"),t}}async deleteUserProcess(){await this.connection._delete("/process_graphs/"+this.id),this.connection.processes.remove(this.id,"user")}}},247:function(e,t){var s,r;void 0===(r="function"==typeof(s=function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(e){var t,s,r=e.replace(/^v/,"").replace(/\+.*$/,""),i=(s="-",-1===(t=r).indexOf(s)?t.length:t.indexOf(s)),n=r.substring(0,i).split(".");return n.push(r.substring(i+1)),n}function s(e){return isNaN(Number(e))?e:Number(e)}function r(t){if("string"!=typeof t)throw new TypeError("Invalid argument expected string");if(!e.test(t))throw new Error("Invalid argument not valid semver ('"+t+"' received)")}function i(e,i){[e,i].forEach(r);for(var n=t(e),a=t(i),o=0;o<Math.max(n.length-1,a.length-1);o++){var l=parseInt(n[o]||0,10),c=parseInt(a[o]||0,10);if(l>c)return 1;if(c>l)return-1}var u=n[n.length-1],d=a[a.length-1];if(u&&d){var h=u.split(".").map(s),p=d.split(".").map(s);for(o=0;o<Math.max(h.length,p.length);o++){if(void 0===h[o]||"string"==typeof p[o]&&"number"==typeof h[o])return-1;if(void 0===p[o]||"string"==typeof h[o]&&"number"==typeof p[o])return 1;if(h[o]>p[o])return 1;if(p[o]>h[o])return-1}}else if(u||d)return u?-1:1;return 0}var n=[">",">=","=","<","<="],a={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]};return i.validate=function(t){return"string"==typeof t&&e.test(t)},i.compare=function(e,t,s){!function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===n.indexOf(e))throw new TypeError("Invalid operator, expected one of "+n.join("|"))}(s);var r=i(e,t);return a[s].indexOf(r)>-1},i})?s.apply(t,[]):s)||(e.exports=r)},991:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var r,i,n;if(Array.isArray(t)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(!e(t[i],s[i]))return!1;return!0}if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],s.get(i[0])))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(s)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(t[i]!==s[i])return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((r=(n=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(s,n[i]))return!1;for(i=r;0!=i--;){var a=n[i];if(!e(t[a],s[a]))return!1}return!0}return t!=t&&s!=s}},779:e=>{"use strict";const t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;if(!t)throw new Error("Unable to find global scope. Are you sure this is running in the browser?");if(!t.AbortController)throw new Error('Could not find "AbortController" in the global scope. You need to polyfill it first');e.exports.AbortController=t.AbortController},6:t=>{"use strict";t.exports=e},300:e=>{"use strict";e.exports=t},263:e=>{"use strict";if(void 0===s){var t=new Error("Cannot find module 'multihashes'");throw t.code="MODULE_NOT_FOUND",t}e.exports=s}},i={},function e(t){var s=i[t];if(void 0!==s)return s.exports;var n=i[t]={exports:{}};return r[t].call(n.exports,n,n.exports,e),n.exports}(213);var r,i}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openeo/js-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"author": "openEO Consortium",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
@@ -38,20 +38,21 @@
|
|
|
38
38
|
"babel-loader": "^8.2.2",
|
|
39
39
|
"eslint": "^7.14.0",
|
|
40
40
|
"eslint-plugin-jsdoc": "^30.7.8",
|
|
41
|
-
"jest": "^
|
|
41
|
+
"jest": "^27.4.4",
|
|
42
42
|
"jest-html-reporter": "^3.3.0",
|
|
43
43
|
"jsdoc": "^3.6.6",
|
|
44
44
|
"typescript": "^4.1.2",
|
|
45
|
-
"unminified-webpack-plugin": "^
|
|
45
|
+
"unminified-webpack-plugin": "^3.0.0",
|
|
46
46
|
"wait-for-expect": "^1.3.0",
|
|
47
|
-
"webpack": "^
|
|
47
|
+
"webpack": "^5.65.0",
|
|
48
48
|
"webpack-bundle-analyzer": "^3.9.0",
|
|
49
|
-
"webpack-cli": "^
|
|
49
|
+
"webpack-cli": "^4.9.1"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@openeo/js-commons": "^1.
|
|
52
|
+
"@openeo/js-commons": "^1.4.0",
|
|
53
53
|
"@radiantearth/stac-migrate": "^1.0.0",
|
|
54
|
-
"axios": "^0.
|
|
54
|
+
"axios": "^0.24.0",
|
|
55
|
+
"node-abort-controller": "^3.0.1",
|
|
55
56
|
"oidc-client": "^1.11.5"
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|
package/src/authprovider.js
CHANGED
package/src/baseentity.js
CHANGED
|
@@ -108,7 +108,9 @@ class BaseEntity {
|
|
|
108
108
|
let obj = {};
|
|
109
109
|
for(let backend in this.apiToClientNames) {
|
|
110
110
|
let client = this.apiToClientNames[backend];
|
|
111
|
-
|
|
111
|
+
if (typeof this[client] !== 'undefined') {
|
|
112
|
+
obj[client] = this[client];
|
|
113
|
+
}
|
|
112
114
|
}
|
|
113
115
|
return Object.assign(obj, this.extra);
|
|
114
116
|
}
|