needle-cloud 0.4.0-alpha.50 → 0.4.0-alpha.52

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/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import e,{Buffer as t}from"buffer";var n={status:"/v1/status",version:"/v1/version",login:"/v1/login",api:"/v1/api",usage:{get:"/v1/usage"},account:{public_key:"/v1/account/public_key",post_machine:"/v1/account/machine",connect:"/v1/account/connect",get_licenses:"/v1/account/get/licenses",set_license_active:"/v1/account/set_license_active",set_licenses_active:"/v1/account/set_licenses_active",buy_licenses:"/v1/account/buy_licenses",update_licenses:"/v1/account/update_licenses",update_payment_method:"/v1/account/update_payment_method",get_billing:"/v1/account/get_billing",resume_subscription:"/v1/account/resume_subscription",cancel_subscription:"/v1/account/cancel_subscription",start_billingportal_session:"/v1/account/start_billingportal_session"},organizations:{get:"/v1/organizations/get",orgs_details:"/v1/organizations/details",licenses:"/v1/organizations/licenses",get_invitations:"/v1/organizations/get_invitations"},events:{get:"/v1/events/get",post:"/v1/events/post",list:"/v1/events/list"},tokens:{create:"/v1/tokens/create",delete:"/v1/tokens/delete",list:"/v1/tokens/list"},get:{jobs:"/v1/list/jobs",uploads:"/v1/list/uploads",deployments:"/v1/list/deployments"},urls:{public:"/v1/public",public_download_urls:"/v1/public/download/urls"},view:{get:"/v1/view",get_public_info:"/v1/view/public/info",post_version:"/v1/view/post_version",update:"/v1/view/update",delete:"/v1/view/delete"},upload:{request:"/v1/upload/request",request_put_url:"/v1/upload/put",update_results:"/v1/upload/results",done:"/v1/upload/done",cancel:"/v1/upload/cancel"},optimize:{get_optimize_id:"/v1/optimize/get_id",request:"/v1/optimize/request"},jobs:{request_start:"/v1/jobs/request_start",request_download_url:"/v1/download/get_presigned_url",request_restart:"/v1/jobs/restart",post_update:"/v1/jobs/update",post_meta:"/v1/jobs/meta",post_results_stats:"/v1/jobs/results_stats",get_status:"/v1/jobs/status",query:"/v1/jobs/query",request_job_that_needs_stats:"/v1/jobs/job_needs_stats"},worker:{ping:"/v1/worker/ping",get_available_count:"/v1/worker/get_available_count",post_available_info:"/v1/worker/post_available_info",get_available_info:"/v1/worker/get_available_info"},local_projects:{get:{user:"/v1/local_projects/user",by_id:"/v1/local_projects/"},post:"/v1/local_projects"}};function r(e){var t={authorization:"Bearer "+e.authToken};return e.org&&(t["x-needle-cloud-org"]=e.org),e.roles&&(t.roles=e.roles.join(",")),e.roles_org&&(t.roles_org=e.roles_org.join(",")),t}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(null,arguments)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function l(){l=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,o){var i=RegExp(e,r);return t.set(i,o||t.get(e)),a(i,n.prototype)}function r(e,n){var r=t.get(n);return Object.keys(r).reduce(function(t,n){var o=r[n];if("number"==typeof o)t[n]=e[o];else{for(var i=0;void 0===e[o[i]]&&i+1<o.length;)i++;t[n]=e[o[i]]}return t},Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);if(n){n.groups=r(n,this);var o=n.indices;o&&(o.groups=r(o,this))}return n},n.prototype[Symbol.replace]=function(n,o){if("string"==typeof o){var i=t.get(this);return e[Symbol.replace].call(this,n,o.replace(/\$<([^>]+)>/g,function(e,t){var n=i[t];return"$"+(Array.isArray(n)?n.join("$"):n)}))}if("function"==typeof o){var s=this;return e[Symbol.replace].call(this,n,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(r(e,s)),o.apply(this,e)})}return e[Symbol.replace].call(this,n,o)},l.apply(this,arguments)}var u={credentials:"omit"};function c(e,t){var r,o,i;void 0===t&&(t=void 0);var s=e.baseUrl+n.urls.public+"/"+e.view_id;return e.job_id&&!0!==(null==(r=t)?void 0:r.latest)?s+="/"+e.job_id:s+="/latest",s+="/",e.filename&&(s+=""+encodeURIComponent(e.filename)),!0===(null==(o=t)?void 0:o.progressive)?s+="?progressive=1":!1===(null==(i=t)?void 0:i.progressive)&&(s+="?progressive=0"),s}function d(e,t){return function(){return e.apply(t,arguments)}}const{toString:f}=Object.prototype,{getPrototypeOf:h}=Object,p=(m=Object.create(null),e=>{const t=f.call(e);return m[t]||(m[t]=t.slice(8,-1).toLowerCase())});var m;const g=e=>(e=e.toLowerCase(),t=>p(t)===e),v=e=>t=>typeof t===e,{isArray:b}=Array,y=v("undefined"),w=g("ArrayBuffer"),_=v("string"),S=v("function"),E=v("number"),x=e=>null!==e&&"object"==typeof e,T=e=>{if("object"!==p(e))return!1;const t=h(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},j=g("Date"),R=g("File"),O=g("Blob"),A=g("FileList"),P=g("URLSearchParams"),[z,U,k,F]=["ReadableStream","Request","Response","Headers"].map(g);function W(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),b(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function C(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,B=e=>!y(e)&&e!==N,L=(D="undefined"!=typeof Uint8Array&&h(Uint8Array),e=>D&&e instanceof D);var D;const M=g("HTMLFormElement"),q=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),I=g("RegExp"),J=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};W(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)},H="abcdefghijklmnopqrstuvwxyz",K="0123456789",V={DIGIT:K,ALPHA:H,ALPHA_DIGIT:H+H.toUpperCase()+K},$=g("AsyncFunction"),G=(X="function"==typeof setImmediate,Q=S(N.postMessage),X?setImmediate:Q?(Y=`axios@${Math.random()}`,Z=[],N.addEventListener("message",({source:e,data:t})=>{e===N&&t===Y&&Z.length&&Z.shift()()},!1),e=>{Z.push(e),N.postMessage(Y,"*")}):e=>setTimeout(e));var X,Q,Y,Z;const ee="undefined"!=typeof queueMicrotask?queueMicrotask.bind(N):"undefined"!=typeof process&&process.nextTick||G;var te={isArray:b,isArrayBuffer:w,isBuffer:function(e){return null!==e&&!y(e)&&null!==e.constructor&&!y(e.constructor)&&S(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||S(e.append)&&("formdata"===(t=p(e))||"object"===t&&S(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&w(e.buffer),t},isString:_,isNumber:E,isBoolean:e=>!0===e||!1===e,isObject:x,isPlainObject:T,isReadableStream:z,isRequest:U,isResponse:k,isHeaders:F,isUndefined:y,isDate:j,isFile:R,isBlob:O,isRegExp:I,isFunction:S,isStream:e=>x(e)&&S(e.pipe),isURLSearchParams:P,isTypedArray:L,isFileList:A,forEach:W,merge:function e(){const{caseless:t}=B(this)&&this||{},n={},r=(r,o)=>{const i=t&&C(n,o)||o;n[i]=T(n[i])&&T(r)?e(n[i],r):T(r)?e({},r):b(r)?r.slice():r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&W(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(W(t,(t,r)=>{e[r]=n&&S(t)?d(t,n):t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,s;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&h(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:p,kindOfTest:g,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length);const r=e.indexOf(t,n-=t.length);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(b(e))return e;let t=e.length;if(!E(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:M,hasOwnProperty:q,hasOwnProp:q,reduceDescriptors:J,freezeMethods:e=>{J(e,(t,n)=>{if(S(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;S(e[n])&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return b(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:C,global:N,isContextDefined:B,ALPHABET:V,generateString:(e=16,t=V.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&S(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(x(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=b(e)?[]:{};return W(e,(e,t)=>{const i=n(e,r+1);!y(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:$,isThenable:e=>e&&(x(e)||S(e))&&S(e.then)&&S(e.catch),setImmediate:G,asap:ee};function ne(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}te.inherits(ne,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:te.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const re=ne.prototype,oe={};function ie(e){return te.isPlainObject(e)||te.isArray(e)}function se(e){return te.endsWith(e,"[]")?e.slice(0,-2):e}function ae(e,t,n){return e?e.concat(t).map(function(e,t){return e=se(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{oe[e]={value:e}}),Object.defineProperties(ne,oe),Object.defineProperty(re,"isAxiosError",{value:!0}),ne.from=(e,t,n,r,o,i)=>{const s=Object.create(re);return te.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),ne.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const le=te.toFlatObject(te,{},null,function(e){return/^is[A-Z]/.test(e)});function ue(e,t,n){if(!te.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=te.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!te.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&te.isSpecCompliantForm(t);if(!te.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(te.isDate(e))return e.toISOString();if(!a&&te.isBlob(e))throw new ne("Blob is not supported. Use a Buffer instead.");return te.isArrayBuffer(e)||te.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(te.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(te.isArray(e)&&function(e){return te.isArray(e)&&!e.some(ie)}(e)||(te.isFileList(e)||te.endsWith(n,"[]"))&&(a=te.toArray(e)))return n=se(n),a.forEach(function(e,r){!te.isUndefined(e)&&null!==e&&t.append(!0===s?ae([n],r,i):null===s?n:n+"[]",l(e))}),!1;return!!ie(e)||(t.append(ae(o,n,i),l(e)),!1)}const c=[],d=Object.assign(le,{defaultVisitor:u,convertValue:l,isVisitable:ie});if(!te.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!te.isUndefined(n)){if(-1!==c.indexOf(n))throw Error("Circular reference detected in "+r.join("."));c.push(n),te.forEach(n,function(n,i){!0===(!(te.isUndefined(n)||null===n)&&o.call(t,n,te.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),c.pop()}}(e),t}function ce(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function de(e,t){this._pairs=[],e&&ue(e,this,t)}const fe=de.prototype;function he(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function pe(e,t,n){if(!t)return e;const r=n&&n.encode||he,o=n&&n.serialize;let i;if(i=o?o(t,n):te.isURLSearchParams(t)?t.toString():new de(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}fe.append=function(e,t){this._pairs.push([e,t])},fe.toString=function(e){const t=e?function(t){return e.call(this,t,ce)}:ce;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var me=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){te.forEach(this.handlers,function(t){null!==t&&e(t)})}},ge={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ve={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:de,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const be="undefined"!=typeof window&&"undefined"!=typeof document,ye=(we="undefined"!=typeof navigator&&navigator.product,be&&["ReactNative","NativeScript","NS"].indexOf(we)<0);var we,_e={__proto__:null,hasBrowserEnv:be,hasStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,hasStandardBrowserEnv:ye,origin:be&&window.location.href||"http://localhost",...ve};function Se(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;return i=!i&&te.isArray(r)?r.length:i,a?(r[i]=te.hasOwnProp(r,i)?[r[i],n]:n,!s):(r[i]&&te.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&te.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s)}if(te.isFormData(e)&&te.isFunction(e.entries)){const n={};return te.forEachEntry(e,(e,r)=>{t(function(e){return te.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Ee={transitional:ge,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=te.isObject(e);if(o&&te.isHTMLForm(e)&&(e=new FormData(e)),te.isFormData(e))return r?JSON.stringify(Se(e)):e;if(te.isArrayBuffer(e)||te.isBuffer(e)||te.isStream(e)||te.isFile(e)||te.isBlob(e)||te.isReadableStream(e))return e;if(te.isArrayBufferView(e))return e.buffer;if(te.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ue(e,new _e.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return _e.isNode&&te.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=te.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ue(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(te.isString(e))try{return(0,JSON.parse)(e),te.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ee.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(te.isResponse(e)||te.isReadableStream(e))return e;if(e&&te.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw ne.from(e,ne.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_e.classes.FormData,Blob:_e.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(["delete","get","head","post","put","patch"],e=>{Ee.headers[e]={}});var xe=Ee;const Te=te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),je=Symbol("internals");function Re(e){return e&&String(e).trim().toLowerCase()}function Oe(e){return!1===e||null==e?e:te.isArray(e)?e.map(Oe):String(e)}function Ae(e,t,n,r,o){return te.isFunction(r)?r.call(this,t,n):(o&&(t=n),te.isString(t)?te.isString(r)?-1!==t.indexOf(r):te.isRegExp(r)?r.test(t):void 0:void 0)}class Pe{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Re(t);if(!o)throw new Error("header name must be a non-empty string");const i=te.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Oe(e))}const i=(e,t)=>te.forEach(e,(e,n)=>o(e,n,t));if(te.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(te.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Te[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(te.isHeaders(e))for(const[t,r]of e.entries())o(r,t,n);else null!=e&&o(t,e,n);return this}get(e,t){if(e=Re(e)){const n=te.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(te.isFunction(t))return t.call(this,e,n);if(te.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Re(e)){const n=te.findKey(this,e);return!(!n||void 0===this[n]||t&&!Ae(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Re(e)){const o=te.findKey(n,e);!o||t&&!Ae(0,n[o],o,t)||(delete n[o],r=!0)}}return te.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Ae(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return te.forEach(this,(r,o)=>{const i=te.findKey(n,o);if(i)return t[i]=Oe(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=Oe(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return te.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&te.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[je]=this[je]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Re(e);t[r]||(function(e,t){const n=te.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return te.isArray(e)?e.forEach(r):r(e),this}}Pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(Pe.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),te.freezeMethods(Pe);var ze=Pe;function Ue(e,t){const n=this||xe,r=t||n,o=ze.from(r.headers);let i=r.data;return te.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ke(e){return!(!e||!e.__CANCEL__)}function Fe(e,t,n){ne.call(this,null==e?"canceled":e,ne.ERR_CANCELED,t,n),this.name="CanceledError"}function We(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ne("Request failed with status code "+n.status,[ne.ERR_BAD_REQUEST,ne.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}te.inherits(Fe,ne,{__CANCEL__:!0});const Ce=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),u=r[s];o||(o=l),n[i]=a,r[i]=l;let c=s,d=0;for(;c!==i;)d+=n[c++],c%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),l-o<t)return;const f=u&&l-u;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n)]}(n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,l=o(a);r=i,e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&i<=s?(s-i)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},Ne=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Be=e=>(...t)=>te.asap(()=>e(...t));var Le=_e.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=te.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0},De=_e.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];te.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),te.isString(r)&&s.push("path="+r),te.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Me(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const qe=e=>e instanceof ze?{...e}:e;function Ie(e,t){t=t||{};const n={};function r(e,t,n){return te.isPlainObject(e)&&te.isPlainObject(t)?te.merge.call({caseless:n},e,t):te.isPlainObject(t)?te.merge({},t):te.isArray(t)?t.slice():t}function o(e,t,n){return te.isUndefined(t)?te.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!te.isUndefined(t))return r(void 0,t)}function s(e,t){return te.isUndefined(t)?te.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const l={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>o(qe(e),qe(t),!0)};return te.forEach(Object.keys(Object.assign({},e,t)),function(r){const i=l[r]||o,s=i(e[r],t[r],r);te.isUndefined(s)&&i!==a||(n[r]=s)}),n}var Je=e=>{const t=Ie({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:l}=t;if(t.headers=a=ze.from(a),t.url=pe(Me(t.baseURL,t.url),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),te.isFormData(r))if(_e.hasStandardBrowserEnv||_e.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map(e=>e.trim()).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(_e.hasStandardBrowserEnv&&(o&&te.isFunction(o)&&(o=o(t)),o||!1!==o&&Le(t.url))){const e=i&&s&&De.read(s);e&&a.set(i,e)}return t},He="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Je(e);let o=r.data;const i=ze.from(r.headers).normalize();let s,a,l,u,c,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){u&&u(),c&&c(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=ze.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());We(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new ne("Request aborted",ne.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new ne("Network Error",ne.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new ne(t,(r.transitional||ge).clarifyTimeoutError?ne.ETIMEDOUT:ne.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&te.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),te.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),h&&([l,c]=Ce(h,!0),m.addEventListener("progress",l)),f&&m.upload&&([a,u]=Ce(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new Fe(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);v&&-1===_e.protocols.indexOf(v)?n(new ne("Unsupported protocol "+v+":",ne.ERR_BAD_REQUEST,e)):m.send(o||null)})},Ke=(e,t)=>{let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof ne?t:new Fe(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{o(new ne(`timeout ${t} of ms exceeded`,ne.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e&&(e.removeEventListener?e.removeEventListener("abort",o):e.unsubscribe(o))}),e=null)};e.forEach(e=>e&&e.addEventListener&&e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=s,[a,()=>{i&&clearTimeout(i),i=null}]};const Ve=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},$e=(e,t,n,r,o)=>{const i=async function*(e,t,n){for await(const r of e)yield*Ve(ArrayBuffer.isView(r)?r:await n(String(r)),t)}(e,t,o);let s,a=0,l=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return l(),void e.close();if(n){let e=a+=r.byteLength;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw l(e),e}},cancel:e=>(l(e),i.return())},{highWaterMark:2})},Ge="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Xe=Ge&&"function"==typeof ReadableStream,Qe=Ge&&("function"==typeof TextEncoder?(Ye=new TextEncoder,e=>Ye.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ye;const Ze=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},et=Xe&&Ze(()=>{let e=!1;const t=new Request(_e.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),tt=Xe&&Ze(()=>te.isReadableStream(new Response("").body)),nt={stream:tt&&(e=>e.body)};var rt;Ge&&(rt=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!nt[e]&&(nt[e]=te.isFunction(rt[e])?t=>t[e]():(t,n)=>{throw new ne(`Response type '${e}' is not supported`,ne.ERR_NOT_SUPPORT,n)})}));const ot={http:null,xhr:He,fetch:Ge&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:i,timeout:s,onDownloadProgress:a,onUploadProgress:l,responseType:u,headers:c,withCredentials:d="same-origin",fetchOptions:f}=Je(e);u=u?(u+"").toLowerCase():"text";let h,p,[m,g]=o||i||s?Ke([o,i],s):[];const v=()=>{!h&&setTimeout(()=>{m&&m.unsubscribe()}),h=!0};let b;try{if(l&&et&&"get"!==n&&"head"!==n&&0!==(b=await(async(e,t)=>{const n=te.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:te.isBlob(e)?e.size:te.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:te.isArrayBufferView(e)||te.isArrayBuffer(e)?e.byteLength:(te.isURLSearchParams(e)&&(e+=""),te.isString(e)?(await Qe(e)).byteLength:void 0))(t):n})(c,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(te.isFormData(r)&&(e=n.headers.get("content-type"))&&c.setContentType(e),n.body){const[e,t]=Ne(b,Ce(Be(l)));r=$e(n.body,65536,e,t,Qe)}}te.isString(d)||(d=d?"include":"omit"),p=new Request(t,{...f,signal:m,method:n.toUpperCase(),headers:c.normalize().toJSON(),body:r,duplex:"half",credentials:d});let o=await fetch(p);const i=tt&&("stream"===u||"response"===u);if(tt&&(a||i)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=o[t]});const t=te.toFiniteNumber(o.headers.get("content-length")),[n,r]=a&&Ne(t,Ce(Be(a),!0))||[];o=new Response($e(o.body,65536,n,()=>{r&&r(),i&&v()},Qe),e)}u=u||"text";let s=await nt[te.findKey(nt,u)||"text"](o,e);return!i&&v(),g&&g(),await new Promise((t,n)=>{We(t,n,{data:s,headers:ze.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:p})})}catch(t){if(v(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new ne("Network Error",ne.ERR_NETWORK,e,p),{cause:t.cause||t});throw ne.from(t,t&&t.code,e,p)}})};te.forEach(ot,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const it=e=>`- ${e}`,st=e=>te.isFunction(e)||null===e||!1===e;var at=e=>{e=te.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){let t;if(n=e[i],r=n,!st(n)&&(r=ot[(t=String(n)).toLowerCase()],void 0===r))throw new ne(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+i]=r}if(!r){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new ne("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(it).join("\n"):" "+it(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function lt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fe(null,e)}function ut(e){return lt(e),e.headers=ze.from(e.headers),e.data=Ue.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),at(e.adapter||xe.adapter)(e).then(function(t){return lt(e),t.data=Ue.call(e,e.transformResponse,t),t.headers=ze.from(t.headers),t},function(t){return ke(t)||(lt(e),t&&t.response&&(t.response.data=Ue.call(e,e.transformResponse,t.response),t.response.headers=ze.from(t.response.headers))),Promise.reject(t)})}const ct={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ct[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const dt={};ct.transitional=function(e,t,n){function r(e,t){return"[Axios v1.7.4] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new ne(r(o," has been removed"+(t?" in "+t:"")),ne.ERR_DEPRECATED);return t&&!dt[o]&&(dt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var ft={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ne("options must be an object",ne.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new ne("option "+i+" must be "+n,ne.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new ne("Unknown option "+i,ne.ERR_BAD_OPTION)}},validators:ct};const ht=ft.validators;class pt{constructor(e){this.defaults=e,this.interceptors={request:new me,response:new me}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ie(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&ft.assertOptions(n,{silentJSONParsing:ht.transitional(ht.boolean),forcedJSONParsing:ht.transitional(ht.boolean),clarifyTimeoutError:ht.transitional(ht.boolean)},!1),null!=r&&(te.isFunction(r)?t.paramsSerializer={serialize:r}:ft.assertOptions(r,{encode:ht.function,serialize:ht.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&te.merge(o.common,o[t.method]);o&&te.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=ze.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const l=[];let u;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let c,d=0;if(!a){const e=[ut.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,l),c=e.length,u=Promise.resolve(t);d<c;)u=u.then(e[d++],e[d++]);return u}c=s.length;let f=t;for(d=0;d<c;){const e=s[d++],t=s[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=ut.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,c=l.length;d<c;)u=u.then(l[d++],l[d++]);return u}getUri(e){return pe(Me((e=Ie(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}te.forEach(["delete","get","head","options"],function(e){pt.prototype[e]=function(t,n){return this.request(Ie(n||{},{method:e,url:t,data:(n||{}).data}))}}),te.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(Ie(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}pt.prototype[e]=t(),pt.prototype[e+"Form"]=t(!0)});var mt=pt;class gt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new Fe(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new gt(function(t){e=t}),cancel:e}}}var vt=gt;const bt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(bt).forEach(([e,t])=>{bt[t]=e});var yt=bt;const wt=function e(t){const n=new mt(t),r=d(mt.prototype.request,n);return te.extend(r,mt.prototype,n,{allOwnKeys:!0}),te.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Ie(t,n))},r}(xe);wt.Axios=mt,wt.CanceledError=Fe,wt.CancelToken=vt,wt.isCancel=ke,wt.VERSION="1.7.4",wt.toFormData=ue,wt.AxiosError=ne,wt.Cancel=wt.CanceledError,wt.all=function(e){return Promise.all(e)},wt.spread=function(e){return function(t){return e.apply(null,t)}},wt.isAxiosError=function(e){return te.isObject(e)&&!0===e.isAxiosError},wt.mergeConfig=Ie,wt.AxiosHeaders=ze,wt.formToJSON=e=>Se(te.isHTMLForm(e)?new FormData(e):e),wt.getAdapter=at,wt.HttpStatusCode=yt,wt.default=wt;var _t=wt;const{CanceledError:St}=_t;var Et,xt,Tt=function(e,t){try{var o=t.baseUrl+n.jobs.post_update,i=s({},r(t),{job_id:e.identifier,status:e.status});return Promise.resolve(fetch(o,s({},u,{method:"POST",headers:i,body:JSON.stringify({status_message:e.status_message,error:e.error,progress:e.progress})})).catch(function(e){return console.error(e),null})).then(function(e){return!!e&&e.ok})}catch(e){return Promise.reject(e)}},jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Rt={__proto__:null,default:{}},Ot=(Et=function(t){!function(){var n="input is invalid type",r="object"==typeof window,o=r?window:{};o.JS_MD5_NO_WINDOW&&(r=!1);var i=!r&&"object"==typeof self,s=!o.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;s?o=jt:i&&(o=self);var a,l=!o.JS_MD5_NO_COMMON_JS&&t.exports,u=!o.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,c="0123456789abcdef".split(""),d=[128,32768,8388608,-2147483648],f=[0,8,16,24],h=["hex","array","digest","buffer","arrayBuffer","base64"],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),m=[];if(u){var g=new ArrayBuffer(68);a=new Uint8Array(g),m=new Uint32Array(g)}var v=Array.isArray;!o.JS_MD5_NO_NODE_JS&&v||(v=function(e){return"[object Array]"===Object.prototype.toString.call(e)});var b=ArrayBuffer.isView;!u||!o.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&b||(b=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var y=function(e){var t=typeof e;if("string"===t)return[e,!0];if("object"!==t||null===e)throw new Error(n);if(u&&e.constructor===ArrayBuffer)return[new Uint8Array(e),!1];if(!v(e)&&!b(e))throw new Error(n);return[e,!1]},w=function(e){return function(t){return new S(!0).update(t)[e]()}},_=function(e){return function(t,n){return new E(t,!0).update(n)[e]()}};function S(e){if(e)m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m,this.buffer8=a;else if(u){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function E(e,t){var n,r=y(e);if(e=r[0],r[1]){var o,i=[],s=e.length,a=0;for(n=0;n<s;++n)(o=e.charCodeAt(n))<128?i[a++]=o:o<2048?(i[a++]=192|o>>>6,i[a++]=128|63&o):o<55296||o>=57344?(i[a++]=224|o>>>12,i[a++]=128|o>>>6&63,i[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),i[a++]=240|o>>>18,i[a++]=128|o>>>12&63,i[a++]=128|o>>>6&63,i[a++]=128|63&o);e=i}e.length>64&&(e=new S(!0).update(e).array());var l=[],u=[];for(n=0;n<64;++n){var c=e[n]||0;l[n]=92^c,u[n]=54^c}S.call(this,t),this.update(u),this.oKeyPad=l,this.inner=!0,this.sharedMemory=t}S.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");for(var t,n,r=y(e),o=r[1],i=0,s=(e=r[0]).length,a=this.blocks,l=this.buffer8;i<s;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),o)if(u)for(n=this.start;i<s&&n<64;++i)(t=e.charCodeAt(i))<128?l[n++]=t:t<2048?(l[n++]=192|t>>>6,l[n++]=128|63&t):t<55296||t>=57344?(l[n++]=224|t>>>12,l[n++]=128|t>>>6&63,l[n++]=128|63&t):(t=65536+((1023&t)<<10|1023&e.charCodeAt(++i)),l[n++]=240|t>>>18,l[n++]=128|t>>>12&63,l[n++]=128|t>>>6&63,l[n++]=128|63&t);else for(n=this.start;i<s&&n<64;++i)(t=e.charCodeAt(i))<128?a[n>>>2]|=t<<f[3&n++]:t<2048?(a[n>>>2]|=(192|t>>>6)<<f[3&n++],a[n>>>2]|=(128|63&t)<<f[3&n++]):t<55296||t>=57344?(a[n>>>2]|=(224|t>>>12)<<f[3&n++],a[n>>>2]|=(128|t>>>6&63)<<f[3&n++],a[n>>>2]|=(128|63&t)<<f[3&n++]):(t=65536+((1023&t)<<10|1023&e.charCodeAt(++i)),a[n>>>2]|=(240|t>>>18)<<f[3&n++],a[n>>>2]|=(128|t>>>12&63)<<f[3&n++],a[n>>>2]|=(128|t>>>6&63)<<f[3&n++],a[n>>>2]|=(128|63&t)<<f[3&n++]);else if(u)for(n=this.start;i<s&&n<64;++i)l[n++]=e[i];else for(n=this.start;i<s&&n<64;++i)a[n>>>2]|=e[i]<<f[3&n++];this.lastByteIndex=n,this.bytes+=n-this.start,n>=64?(this.start=n-64,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},S.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>>2]|=d[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},S.prototype.hash=function(){var e,t,n,r,o,i,s=this.blocks;this.first?t=((t=((e=((e=s[0]-680876937)<<7|e>>>25)-271733879|0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&e)+s[1]-117830708)<<12|r>>>20)+e|0)&(-271733879^e))+s[2]-1126478375)<<17|n>>>15)+r|0)&(r^e))+s[3]-1316259209)<<22|t>>>10)+n|0:(e=this.h0,t=this.h1,t=((t+=((e=((e+=((r=this.h3)^t&((n=this.h2)^r))+s[0]-680876936)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+s[1]-389564586)<<12|r>>>20)+e|0)&(e^t))+s[2]+606105819)<<17|n>>>15)+r|0)&(r^e))+s[3]-1044525330)<<22|t>>>10)+n|0),t=((t+=((e=((e+=(r^t&(n^r))+s[4]-176418897)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+s[5]+1200080426)<<12|r>>>20)+e|0)&(e^t))+s[6]-1473231341)<<17|n>>>15)+r|0)&(r^e))+s[7]-45705983)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+s[8]+1770035416)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+s[9]-1958414417)<<12|r>>>20)+e|0)&(e^t))+s[10]-42063)<<17|n>>>15)+r|0)&(r^e))+s[11]-1990404162)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+s[12]+1804603682)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+s[13]-40341101)<<12|r>>>20)+e|0)&(e^t))+s[14]-1502002290)<<17|n>>>15)+r|0)&(r^e))+s[15]+1236535329)<<22|t>>>10)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+s[1]-165796510)<<5|e>>>27)+t|0)^t))+s[6]-1069501632)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+s[11]+643717713)<<14|n>>>18)+r|0)^r))+s[0]-373897302)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+s[5]-701558691)<<5|e>>>27)+t|0)^t))+s[10]+38016083)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+s[15]-660478335)<<14|n>>>18)+r|0)^r))+s[4]-405537848)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+s[9]+568446438)<<5|e>>>27)+t|0)^t))+s[14]-1019803690)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+s[3]-187363961)<<14|n>>>18)+r|0)^r))+s[8]+1163531501)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+s[13]-1444681467)<<5|e>>>27)+t|0)^t))+s[2]-51403784)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+s[7]+1735328473)<<14|n>>>18)+r|0)^r))+s[12]-1926607734)<<20|t>>>12)+n|0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+s[5]-378558)<<4|e>>>28)+t|0))+s[8]-2022574463)<<11|r>>>21)+e|0)^e)^(n=((n+=(i^t)+s[11]+1839030562)<<16|n>>>16)+r|0))+s[14]-35309556)<<23|t>>>9)+n|0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+s[1]-1530992060)<<4|e>>>28)+t|0))+s[4]+1272893353)<<11|r>>>21)+e|0)^e)^(n=((n+=(i^t)+s[7]-155497632)<<16|n>>>16)+r|0))+s[10]-1094730640)<<23|t>>>9)+n|0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+s[13]+681279174)<<4|e>>>28)+t|0))+s[0]-358537222)<<11|r>>>21)+e|0)^e)^(n=((n+=(i^t)+s[3]-722521979)<<16|n>>>16)+r|0))+s[6]+76029189)<<23|t>>>9)+n|0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+s[9]-640364487)<<4|e>>>28)+t|0))+s[12]-421815835)<<11|r>>>21)+e|0)^e)^(n=((n+=(i^t)+s[15]+530742520)<<16|n>>>16)+r|0))+s[2]-995338651)<<23|t>>>9)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+s[0]-198630844)<<6|e>>>26)+t|0)|~n))+s[7]+1126891415)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+s[14]-1416354905)<<15|n>>>17)+r|0)|~e))+s[5]-57434055)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+s[12]+1700485571)<<6|e>>>26)+t|0)|~n))+s[3]-1894986606)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+s[10]-1051523)<<15|n>>>17)+r|0)|~e))+s[1]-2054922799)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+s[8]+1873313359)<<6|e>>>26)+t|0)|~n))+s[15]-30611744)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+s[6]-1560198380)<<15|n>>>17)+r|0)|~e))+s[13]+1309151649)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+s[4]-145523070)<<6|e>>>26)+t|0)|~n))+s[11]-1120210379)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+s[2]+718787259)<<15|n>>>17)+r|0)|~e))+s[9]-343485551)<<21|t>>>11)+n|0,this.first?(this.h0=e+1732584193|0,this.h1=t-271733879|0,this.h2=n-1732584194|0,this.h3=r+271733878|0,this.first=!1):(this.h0=this.h0+e|0,this.h1=this.h1+t|0,this.h2=this.h2+n|0,this.h3=this.h3+r|0)},S.prototype.toString=S.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return c[e>>>4&15]+c[15&e]+c[e>>>12&15]+c[e>>>8&15]+c[e>>>20&15]+c[e>>>16&15]+c[e>>>28&15]+c[e>>>24&15]+c[t>>>4&15]+c[15&t]+c[t>>>12&15]+c[t>>>8&15]+c[t>>>20&15]+c[t>>>16&15]+c[t>>>28&15]+c[t>>>24&15]+c[n>>>4&15]+c[15&n]+c[n>>>12&15]+c[n>>>8&15]+c[n>>>20&15]+c[n>>>16&15]+c[n>>>28&15]+c[n>>>24&15]+c[r>>>4&15]+c[15&r]+c[r>>>12&15]+c[r>>>8&15]+c[r>>>20&15]+c[r>>>16&15]+c[r>>>28&15]+c[r>>>24&15]},S.prototype.array=S.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&n,n>>>8&255,n>>>16&255,n>>>24&255,255&r,r>>>8&255,r>>>16&255,r>>>24&255]},S.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},S.prototype.buffer=S.prototype.arrayBuffer,S.prototype.base64=function(){for(var e,t,n,r="",o=this.array(),i=0;i<15;)e=o[i++],t=o[i++],n=o[i++],r+=p[e>>>2]+p[63&(e<<4|t>>>4)]+p[63&(t<<2|n>>>6)]+p[63&n];return r+(p[(e=o[i])>>>2]+p[e<<4&63]+"==")},(E.prototype=new S).finalize=function(){if(S.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();S.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),S.prototype.finalize.call(this)}};var x=function(){var t=w("hex");s&&(t=function(t){var r,i=Rt,s=e.Buffer;return r=s.from&&!o.JS_MD5_NO_BUFFER_FROM?s.from:function(e){return new s(e)},function(e){if("string"==typeof e)return i.createHash("md5").update(e,"utf8").digest("hex");if(null==e)throw new Error(n);return e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),v(e)||b(e)||e.constructor===s?i.createHash("md5").update(r(e)).digest("hex"):t(e)}}(t)),t.create=function(){return new S},t.update=function(e){return t.create().update(e)};for(var r=0;r<h.length;++r){var i=h[r];t[i]=w(i)}return t}();x.md5=x,x.md5.hmac=function(){var e=_("hex");e.create=function(e){return new E(e)},e.update=function(t,n){return e.create(t).update(n)};for(var t=0;t<h.length;++t){var n=h[t];e[n]=_(n)}return e}(),l?t.exports=x:o.md5=x}()},Et(xt={exports:{}}),xt.exports);function At(e,t=0){return kt(e,t,2).getUint16(0,!0)}function Pt(e,t=0){return kt(e,t,4).getUint32(0,!0)}function zt(e,t=0,n=e.byteLength){const r=e.slice(t,t+n);return Ft.decode(new Uint8Array(r))}function Ut(e,t,n=0){if(e.length<t.length+n)return!1;for(const[r,o]of t.entries())if(null!==o&&o!==e[r+n])return!1;return!0}function kt(e,t,n){const r=e.slice(t,t+n);return new DataView(new Uint8Array(r).buffer)}const Ft=new TextDecoder("utf8"),Wt=[["db","application/vnd.sqlite3",[83,81,76,105,116,101,32,102,111,114,109,97,116,32,51,0]],["woff","font/woff",[119,79,70,70]],["woff2","font/woff2",[119,79,70,50]],["bmp","image/bmp",[66,77]],["gif","image/gif",[71,73,70,56,55,97]],["gif","image/gif",[71,73,70,56,57,97]],["heic","image/heic",[102,116,121,112,104,101,105],{offset:4}],["heic","image/heic",[102,116,121,112,109],{offset:4}],["ico","image/x-icon",[0,0,1,0]],["jpg","image/jpeg",[255,216,255]],["pdf","application/pdf",[37,80,68,70,45]],["png","image/png",[137,80,78,71,13,10,26,10]],["7z","application/x-7z-compressed",[55,122,188,175,39,28]],["rar","application/x-rar-compressed",[82,97,114,33,26,7,0]],["rar","application/x-rar-compressed",[82,97,114,33,26,7,1,0]],["rtf","application/rtf",[123,92,114,116,102,49]],["bz2","application/x-bzip2",[66,90,104]],["gz","application/gzip",[31,139]],["tar","application/x-tar",[117,115,116,97,114,0,48,48],{offset:257}],["tar","application/x-tar",[117,115,116,97,114,32,32,0],{offset:257}],["tif","image/tiff",[73,73,42,0]],["tiff","image/tiff",[77,77,0,42]],["zip","application/zip",[80,75,3,4],{exact:!1}],["zip","application/zip",[80,75,5,6]],["mp3","audio/mp3",[255,251]],["mp3","audio/mp3",[255,243]],["mp3","audio/mp3",[255,242]],["mp3","audio/mp3",[73,68,51]],["mp4","video/mp4",[102,116,121,112,105,115,111,109],{offset:4}],["avi","video/x-msvideo",[82,73,70,70,null,null,null,null,65,86,73,32]],["wav","audio/wav",[82,73,70,70,null,null,null,null,87,65,86,69]],["ogx","application/ogg",[79,103,103,83],{exact:!1},[["oga","audio/ogg",[127,70,76,65,67],{offset:28}],["ogg","audio/ogg",[1,118,111,114,98,105,115],{offset:28}],["ogm","video/ogg",[1,118,105,100,101,111,0],{offset:28}],["ogv","video/ogg",[128,116,104,101,111,114,97],{offset:28}]]],["webp","image/webp",[82,73,70,70,null,null,null,null,87,69,66,80]],["psd","image/vnd.adobe.photoshop",[56,66,80,83]],["flac","audio/x-flac",[102,76,97,67]],["wasm","application/wasm",[0,97,115,109]],["deb","application/x-deb",[33,60,97,114,99,104,62,10]],["exe","application/x-msdownload",[77,90]],["exe","application/x-msdownload",[90,77]],["class","application/java-vm",[202,254,186,190]]];function Ct(e){return e.flatMap(([e,t,n,r={},o=[]])=>[[e,t,n,r],...o])}function Nt(e,t){const n=At(e,26),r=zt(e,30,n),[o]=r.split("/"),i=r.endsWith(".xml");return"META-INF"===o?{ext:"jar",mime:"application/java-archive"}:"ppt"===o&&i?{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}:"word"===o&&i?{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}:"xl"===o&&i?{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}:"mimetype"===o?function(e,t){const n=Pt(e,18),r=Pt(e,22),o=At(e,28);if(n===r){const r=zt(e,30+t+o,n);if("application/vnd.oasis.opendocument.presentation"===r)return{ext:"odp",mime:r};if("application/vnd.oasis.opendocument.spreadsheet"===r)return{ext:"ods",mime:r};if("application/vnd.oasis.opendocument.text"===r)return{ext:"odt",mime:r};if("application/epub+zip"===r)return{ext:"epub",mime:r}}}(e,n)??t:t}const Bt=function(e){return Ct(e).map(([e,t,n,{offset:r=0}={}])=>n.length+r).reduce((e,t)=>t>e?t:e,0)}(Wt);function Lt(e,t){for(const[n,r,o,{exact:i=!0,offset:s=0}={},a=[]]of t)if(Ut(e,o,s)){if("zip"===n&&!i)return Nt(e.buffer,{ext:n,mime:r});if(!i&&a.length)for(const[t,n,r,{offset:o=0}={}]of a)if(Ut(e,r,o))return{ext:t,mime:n};return{ext:n,mime:r}}}function Dt(e){var t=Ot.md5.create();return t.update(e),t.base64()}function Mt(e,t,n){if(void 0===t&&(t=2),void 0===n&&(n=!0),e>=1099511627776){var r=n?" TB":"";return(e/1099511627776).toFixed(t)+r}if(e>=1073741824){var o=n?" GB":"";return(e/1073741824).toFixed(t)+o}if(e>=1048576){var i=n?" MB":"";return(e/1048576).toFixed(t)+i}if(e>1024){var s=n?" KB":"";return(e/1024).toFixed(t)+s}var a=n?" B":"";return e.toFixed(t)+a}"undefined"==typeof Symbol||Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"));var qt=function(e){try{return Promise.resolve(new Promise(function(t){return setTimeout(t,e)}))}catch(e){return Promise.reject(e)}};function It(e,t,n){if(!e.s){if(n instanceof Jt){if(!n.s)return void(n.o=It.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(It.bind(null,e,t),It.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var Jt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{It(r,1,i(this.v))}catch(e){It(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?It(r,1,t?t(o):o):n?It(r,1,n(o)):It(r,2,o)}catch(e){It(r,2,e)}},r},e}();function Ht(e){return e instanceof Jt&&1&e.s}function Kt(e){for(var t=-1,n=Infinity,r=0;r<e.length;r++){var o=e[r];console.debug(o),o.path.split("/").length<n&&(n=o.path.split("/").length,t=r)}return t<0?null:e[t]}var Vt=/*#__PURE__*/function(){function e(e,t){this.totalFiles=e,this.estimatedTotalSize=t,this.uploadedSize=0,this.startTime=Date.now(),this.lastUpdateTime=this.startTime,this.lastUploadedSize=0,this.speedEMA=null,this.emaFactor=.1,this.smoothedRemainingTime=null,this.recentSpeeds=new Array,this.maxRecentSpeeds=20,this.initialEstimateThreshold=.05}var t=e.prototype;return t.updateProgress=function(e){var t=Date.now(),n=(t-this.lastUpdateTime)/1e3,r=e-this.lastUploadedSize;if(this.uploadedSize=e,n>0&&r>0){this.recentSpeeds.push(r/n),this.recentSpeeds.length>this.maxRecentSpeeds&&this.recentSpeeds.shift();var o=this.recentSpeeds.reduce(function(e,t){return e+t},0)/this.recentSpeeds.length;this.speedEMA=null===this.speedEMA?o:this.emaFactor*o+(1-this.emaFactor)*this.speedEMA}this.lastUpdateTime=t,this.lastUploadedSize=e;var i,s=this.uploadedSize/this.estimatedTotalSize,a=(t-this.startTime)/1e3,l=this.speedEMA&&this.speedEMA>0?this.speedEMA:this.uploadedSize/a;return i=l>0?(this.estimatedTotalSize-this.uploadedSize)/l:Infinity,this.smoothedRemainingTime=s>=this.initialEstimateThreshold?null===this.smoothedRemainingTime?i:.9*this.smoothedRemainingTime+.1*i:a/s-a,this.smoothedRemainingTime=Math.max(this.smoothedRemainingTime,(this.estimatedTotalSize-this.uploadedSize)/l),{progress:100*s,estimatedTimeRemaining:Math.round(this.smoothedRemainingTime),estimatedTimeRemainingString:this.smoothedRemainingTime>3?this.__formatTime(this.smoothedRemainingTime):"few seconds"}},t.__formatTime=function(e){if(!isFinite(e)||e>86400)return"Calculating...";if(e<60)return Math.round(e)+"sec";var t=Math.floor(e/60);return t<60?t+"min":Math.floor(t/60)+"h "+t%60+"min"},e}();function $t(e,t,n){if(!e.s){if(n instanceof Gt){if(!n.s)return void(n.o=$t.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then($t.bind(null,e,t),$t.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Gt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{$t(r,1,i(this.v))}catch(e){$t(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?$t(r,1,t?t(o):o):n?$t(r,1,n(o)):$t(r,2,o)}catch(e){$t(r,2,e)}},r},e}();function Xt(e){return e instanceof Gt&&1&e.s}function Qt(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Xt(a))return void a.then(s,o||(o=$t.bind(null,r=new Gt,2)));a=a.v}r?$t(r,1,a):r=a}catch(e){$t(r||(r=new Gt),2,e)}}(),r}function Yt(e,t,n){for(var r;;){var o=e();if(Xt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!Xt(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!Xt(s)){r=2;break}}}var a=new Gt,l=$t.bind(null,a,2);return(0===r?o.then(c):1===r?i.then(u):s.then(d)).then(void 0,l),a;function u(r){i=r;do{if(t&&(s=t())&&s.then&&!Xt(s))return void s.then(d).then(void 0,l);if(!(o=e())||Xt(o)&&!o.v)return void $t(a,1,i);if(o.then)return void o.then(c).then(void 0,l);Xt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,l)}function c(e){e?(i=n())&&i.then?i.then(u).then(void 0,l):u(i):$t(a,1,i)}function d(){(o=e())?o.then?o.then(c).then(void 0,l):c(o):$t(a,1,i)}}var Zt=[];new Array,"undefined"==typeof Symbol||Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")),globalThis.Buffer=t;var en=function(e){try{return Promise.resolve(function(e){try{var t=new URL((e.endpoint||"https://cloud.needle.tools/api")+n.get.deployments);return t.searchParams.append("offset",e.offset.toString()),t.searchParams.append("limit",e.limit.toString()),e.names&&t.searchParams.append("name",e.names.map(function(e){return e.trim()}).join(",")),Promise.resolve(fetch(t,{method:"GET",headers:s({},r({authToken:e.token,org:e.org}))})).then(function(e){var t;function n(n){return t?n:Promise.resolve(e.json())}var r=function(){if(!e.ok){var n=e.status;return Promise.resolve(e.text()).then(function(e){return t=1,{status:n,error:e}})}}();return r&&r.then?r.then(n):n(r)})}catch(e){return Promise.reject(e)}}({endpoint:e.endpoint||"https://cloud.needle.tools/api",token:e.token,offset:e.offset||0,limit:e.limit||10}).catch(function(e){return e})).then(function(e){return!e||e instanceof Error?[]:e.deployments.map(function(e){return{name:e.name,url:e.url}})})}catch(e){return Promise.reject(e)}};function tn(e,t){var o=e.map(function(e){return function(e,t){var n;void 0===t&&(t=null),"object"==typeof(n=e)&&"string"==typeof n.name&&"string"==typeof n.mimetype&&(e=new File([e.buffer],e.name,{type:e.mimetype}));var r=e;return null==t&&(t=e.webkitRelativePath||""),r.path=t+e.name,r}(e)});return console.debug("Upload",t.name,o),function(e,t,o){void 0===o&&(o=void 0);try{var a=function(e,t,o){void 0===o&&(o=void 0);try{var a,c=t.files,d=(null==(a=o)?void 0:a.loglevel)||"none";if(!c.length)return console.error("No files to upload"),Promise.resolve({success:!1,error:"No files to upload"});if(!t.entrypoint){var f=function(e){var t=null,n="",r=e.filter(function(e){return e.name.endsWith("package.json")});if(1===r.length)return r[0];if(r.length>1)return n="Invalid upload: Multiple package.json files found. This is currently not supported.",console.error(n,r),{error:n};var o=e.filter(function(e){return"index.html"===e.name.toLowerCase()||"index.html.gz"===e.name.toLowerCase()||"index.html.br"===e.name.toLowerCase()});if(1===o.length)return o[0];o.length>1&&console.warn("Multiple index.html files found.");var s=e.filter(function(e){return e.name.toLowerCase().endsWith(".glb")||e.name.toLowerCase().endsWith(".gltf")||e.name.toLowerCase().endsWith(".vrm")});if(s.length>1){var a=function(e){for(var t,n=new Array,r=/(mesh_lod|image)_\d_(.{1,50})/,o=i(e);!(t=o()).done;){var s=t.value;if(!r.test(s.name)){var a=s.name.toLowerCase();(a.endsWith(".gltf")||a.endsWith(".vrm")||a.endsWith(".glb"))&&n.push(s)}}return 1==n.length?n[0]:Kt(n)}(s);return a?t=a:(n="Invalid upload: Multiple glb/glTF/vrm files found. This is currently not supported.",console.error(n,s.map(function(e){return e.path||e.name})),{error:n})}if(1===s.length)return s[0];var l=e.filter(function(e){return e.name.endsWith(".usdz")||e.name.endsWith(".usd")||e.name.endsWith(".usda")||e.name.endsWith(".usdc")});l.length>=1&&(t=Kt(l));var u=e.filter(function(e){return e.name.endsWith(".fbx")});if(u.length>1)return n="Invalid upload: Multiple fbx files found. This is currently not supported.",console.error(n,u),{error:n};if(1===u.length)return u[0];var c=e.filter(function(e){return e.name.endsWith(".obj")});return c.length>1?(n="Invalid upload: Multiple obj files found. This is currently not supported.",console.error(n,c),{error:n}):1===c.length?t=c[0]:t||{error:"No supported file to upload found..."}}(c);if(null==f)return Promise.resolve({success:!1,error:"No entrypoint file found"});if("object"==typeof f&&"error"in f)return Promise.resolve({success:!1,error:f.error});"info"===d&&console.log("Entrypoint: "+f.name),t.entrypoint=f}return t.entrypoint&&!c.includes(t.entrypoint)&&c.push(t.entrypoint),Promise.resolve(function(e){try{var t,n=function(e){return t?e:{success:!0}};if(e.length>1e3)return Promise.resolve({success:!1,error:"Too many files. Maximum filecount is 1000"});var r=0,o=e.length-1,s=function(e,t,n){for(var r;;){var o=e();if(Ht(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!Ht(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!Ht(s)){r=2;break}}}var a=new Jt,l=It.bind(null,a,2);return(0===r?o.then(c):1===r?i.then(u):s.then(d)).then(void 0,l),a;function u(r){i=r;do{if(t&&(s=t())&&s.then&&!Ht(s))return void s.then(d).then(void 0,l);if(!(o=e())||Ht(o)&&!o.v)return void It(a,1,i);if(o.then)return void o.then(c).then(void 0,l);Ht(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,l)}function c(e){e?(i=n())&&i.then?i.then(u).then(void 0,l):u(i):It(a,1,i)}function d(){(o=e())?o.then?o.then(c).then(void 0,l):c(o):It(a,1,i)}}(function(){return!t&&o>=0},function(){return o--},function(){var n=e[o];return(r+=n.size)>157286400?(t=1,{success:!1,error:"Total file size exceeds limit of 150 MB. Please reduce the size of your upload."}):".ds_store"===n.name.toLocaleLowerCase()?(console.log("🚫 Remove .DS_Store file from upload"),void e.splice(o,1)):function(){if(n.name.endsWith(".gltf"))return console.log("Found glTF file "+n.name+". Will check if all dependencies are available\n",e),Promise.resolve(n.text()).then(function(r){var o,s,a=r.matchAll(/*#__PURE__*/l(/"uri"\s*:\s*"(.*?)"/g,{value:1}));if(a){var u=JSON.parse(r);if("2.0"!==u.asset.version)return console.warn("⚠ glTF version is not 2.0. This is currently not supported."),t=1,{success:!1,error:"glTF version "+u.asset.version+" is unsupported.Please use glTF 2.0."};for(var c,d=null==(o=n.path)?void 0:o.split("/"),f=d.splice(0,d.length-1).join("/"),h=i(a);!(c=h()).done;){var p,m=null==(p=c.value.groups)?void 0:p.value;if(m){var g=!1;if(m.startsWith("http://")||m.startsWith("https://")||m.startsWith("www.")){console.log("āœ… Found remote dependency "+m+" ");break}if(m.startsWith("data:")){console.log("āœ… Found embedded dependency "+m+" ");break}var v=(f+"/"+(s=m,s.includes("\\u")?JSON.parse('"'+s+'"'):decodeURIComponent(s))).split("/").reduce(function(e,t){return"."===t||(".."===t?e.pop():null!=t&&t.length&&e.push(t)),e},[]).join("/");console.log('ā“ Check if local dependency exists "'+v+'"');for(var b,y=i(e);!(b=y()).done;){var w=b.value;if(w.webkitRelativePath===v||w.name==v){g=!0,console.log("āœ… Found dependency in name or webkit: "+w.name+" || "+w.webkitRelativePath+" ");break}if(w.path===v){g=!0,console.log("āœ… Found dependency in path: "+w.path+" ");break}}if(!g)return console.warn("⚠ Missing dependency "+m,f),t=1,{success:!1,error:"Missing resource: "+m}}}}})}()});return Promise.resolve(s&&s.then?s.then(n):n(s))}catch(e){return Promise.reject(e)}}(c)).then(function(i){var a,l,f,h,p,m,g,v,b;function y(i){return Promise.resolve(fetch(_+n.upload.request,s({},u,{method:"POST",headers:E,body:JSON.stringify(x)})).catch(function(e){return"fetch failed"==e.message||"Failed to fetch"==e.message?"Network error. Make sure you are connected to the internet and "+_+" is reachable.":(console.error("Failed to begin upload\n",e),null)})).then(function(i){var a;function l(l){return a?l:Promise.resolve(i.json()).then(function(i){var a,l,f;function h(){return Promise.resolve(Promise.all(T).catch(function(e){var t;null!=(t=o)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),j=!0)})).then(function(){var t;function a(a){var l;if(t)return a;function f(t){var o;if(l)return t;function a(){var e;function t(t){return e?t:("none"!=d&&console.log("Upload complete"),Promise.resolve(h.json()).then(function(e){return{success:!0,type:e.type,uploadSkipped:!1,id:e.id,view_id:e.view_id,url:e.url,filesUploaded:c.length,totalSize:p}}))}if(!h)return console.error("Failed to complete upload"),{success:!1,error:"Failed to complete upload"};var n=function(){if(!h.ok)return 524===h.status?(console.error("Failed to complete upload: Gateway Timeout"),e=1,{success:!1,error:"Failed to complete upload: Gateway Timeout"}):Promise.resolve(h.text()).then(function(t){return console.error("Failed to complete upload ("+h.status+"): "+t),e=1,{success:!1,error:"Failed to complete upload"}})}();return n&&n.then?n.then(t):t(n)}v=!0,console.log("Upload Done: All files uploaded to "+i.id);var f=s({},r(e),{id:i.id});"none"!=d&&console.log("Completing upload - notify server");var h=null,m=0,g=Yt(function(){return!o&&m<5},function(){return m++},function(){return Promise.resolve(qt(1e3*m)).then(function(){var e=AbortSignal.timeout(5e3+2e3*m);return Promise.resolve(fetch(_+n.upload.done,s({},u,{method:"POST",headers:f,signal:e})).catch(function(e){return console.error("Failed to complete upload",e.message),null})).then(function(e){var t,n;null!=(t=h=e)&&t.ok?o=1:"none"!=d&&m<4&&console.warn("Failed to complete upload ("+((null==(n=h)?void 0:n.status)||"no status")+"): will retry in 1 second")})})});return g&&g.then?g.then(a):a()}var h=function(t){if(null!=(t=o)&&null!=(t=t.abort)&&t.aborted)return Promise.resolve(Tt({identifier:i.id,status:"canceled",status_message:"Upload aborted",error:"Upload aborted"},e)).then(function(){return l=1,{success:!1,error:"Upload aborted"}})}();return h&&h.then?h.then(f):f(h)}var l=function(){if(j)return Promise.resolve(Tt({identifier:i.id,status:"failed",error:"Failed to upload files"},e)).then(function(){return t=1,{success:!1,error:"Failed to upload files"}})}();return l&&l.then?l.then(a):a(l)})}"debug"===d&&console.debug("BeginResponse",i);var p=c.reduce(function(e,t){return e+t.size},0);if("exists"===i.type)return"none"!=d&&console.log("Upload already exists",i.id),{success:!0,uploadSkipped:!0,id:i.id,type:i.job_type,view_id:i.view_id,filesUploaded:c.length,totalSize:p};var m=t.entrypoint.webkitRelativePath||t.entrypoint.name,g=0;null==(a=o)||null==(a=a.abort)||a.addEventListener("abort",function(){try{return console.log("Upload aborted: Cancelling upload"),Promise.resolve(fetch(_+n.upload.cancel,s({},u,{method:"POST",headers:{authorization:S,id:i.id}}))).then(function(){})}catch(e){return Promise.reject(e)}});var v=!1;function b(t,n,r){if(void 0===r&&(r=!1),!r&&Date.now()-y<1e3)return!1;if(!v||"completed"===n){y=Date.now();var o=Math.floor(g/p*100);return"debug"===d&&console.log("SET STATUS: "+n,t,o),Tt({identifier:i.id,status:n,status_message:t,progress:o},e),!0}"none"!=d&&console.warn("Invalid status update...")}var y=Date.now();null!=(l=o)&&l.onStart&&o.onStart(i.id,i.view_id);var w=Date.now(),E=new Vt(c.length,p/1024/1024),T=new Array,j=!1,R=Qt([].concat(c),function(t){var n;function a(){var e=function(){if(T.length>=10)return Promise.resolve(Promise.race(T)).then(function(){})}();if(e&&e.then)return e.then(function(){})}if(null!=(n=o)&&null!=(n=n.abort)&&n.aborted)return console.debug("Upload aborted"),void(f=1);if(j)return console.debug("Upload failed"),void(f=1);var l=function(){if(T.length<10){console.debug("Uploading file "+t+"/"+c.length+": "+c[t].name);var n=0,a=0,l=x.results.files[t],f=l.filename;return Promise.resolve(c[t].arrayBuffer()).then(function(h){var v=function(e){try{var t,n=function(t){var n;function r(e){var t=function(){if(!a)return console.error("Failed to upload file "+c),Promise.resolve(Tt({identifier:o,status:"failed",status_message:"Failed to upload file "+c,error:"Failed to upload file "+c},b)).then(function(){throw new Error("Failed to upload file "+c)})}();return!t||!t.then||t.then(function(e){return!0})}if(null==E)throw new Error('Failed to get presigned url for "'+c+'" "'+p+'" \n'+x);var i=E.presigned_url,a=!1,h=0,m=Yt(function(){return!n&&h<5},function(){return h++},function(){function t(){var t;if(null!=y&&null!=(t=y.abort)&&t.aborted)throw new St("Upload aborted");var r={"Content-Type":p,"Content-MD5":f};return w&&(r["Content-Encoding"]=w),Promise.resolve(_t.put(i,d,s({},u,{withCredentials:!1,signal:null==y?void 0:y.abort,headers:r,onUploadProgress:function(t){e.onProgress(t)}})).catch(function(e){return e instanceof St||"none"!==v&&console.error("Failed to upload file",e),null})).then(function(e){if(e)return 200!==e.status?void console.debug("Failed ("+e.status+" "+e.status+") to upload file "+l.name+' to "'+E.path+'". Retrying...'):(a=!0,"info"===v?console.log("Uploaded file "+c+' to "'+E.path+'"'):console.debug("Uploaded "+l.name+' to "'+E.path+'"'),void(n=1))})}var r=function(){if(h>0)return Promise.resolve(qt(1e3*h)).then(function(){})}();return r&&r.then?r.then(t):t()});return m&&m.then?m.then(r):r()},o=e.uploadId,i=e.uploadRequestPUTUrl,a=e.entrypointPath,l=e.file,c=e.fileName,d=e.fileBuffer,f=e.fileMd5,h=e.fileSize,p=e.fileType,m=e.fileIndex,g=e.fileCount,v=e.loglevel,b=e.args,y=e.options,w=void 0;l.name.endsWith(".gz")?w="gzip":l.name.endsWith(".br")&&(w="br"),"info"===v&&console.log('Uploading file "'+l.name+'" type='+p+" ("+h+") "+l.type+" with hash "+f);var _=s({},r(b),{"Content-Type":"application/json",org:b.org,job_id:o,filesize:h.toString(),progress:(m/g*100).toFixed(0)}),S=JSON.stringify({filename:c,entrypoint:a,"content-type":p,"content-md5":f,"content-encoding":w}),E=null,x="",T=0,j=Yt(function(){return!t&&T<5},function(){return T++},function(){var e;if(null==E){if(null!=y&&null!=(e=y.abort)&&e.aborted)throw new Error("Upload aborted");return Promise.resolve(qt(200*T)).then(function(){return Promise.resolve(fetch(i,s({},u,{method:"POST",headers:_,body:S})).then(function(e){try{var t,n=function(n){return t?n:Promise.resolve(e.json())},r=function(){if(!e.ok)return Promise.resolve(e.text()).then(function(n){return x=n,console.log(i),console.warn('Failed to get presigned url for "'+c+'" "'+p+'" ('+e.status+").\n→ Retrying..."),t=1,null})}();return Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}).catch(function(e){return x=e.message,console.warn("Failed to get presigned url "+e.message+", retrying..."),null})).then(function(e){E=e})})}t=1});return Promise.resolve(j&&j.then?j.then(n):n())}catch(e){return Promise.reject(e)}}({uploadId:i.id,uploadRequestPUTUrl:i.request_put_url,entrypointPath:m,file:c[t],fileName:f,fileMd5:l.content_md5,fileBuffer:h,fileType:l.content_type,fileSize:l.content_length,fileIndex:t,fileCount:c.length,loglevel:d,args:e,options:o,onProgress:function(e){var r,i=e.progress||0,s=(n=c[t].size*i)-a;if(a=n,g+=s,null!=(r=o)&&r.progress){var l=g/p,u=c.length,d=c[t].size,h=(Date.now()-w)/1e3,m=E.updateProgress(g/1024/1024);o.progress({uploadedBytes:g,totalBytes:p,progress01:l,fileName:c[t].name,fileSize:d,fileProgress01:i,fileIndex:t,totalFiles:u,estimatedTimeLeftDisplay:m.estimatedTimeRemainingString,estimatedTimeLeft:m.estimatedTimeRemaining,elapsedTime:h}),b("Uploading ("+(t+1)+"/"+u+"): "+Mt(n)+" of "+f+" ("+Mt(c[t].size)+")","running",!1)}}}).then(function(e){if(!0!==e)return e;for(var n=T.length-1;n>=0;n--)T[n]===v&&T.splice(n,1);b("Uploaded "+Mt(g)+" of "+Mt(p)+" for "+c[t].name,"running")}).catch(function(e){var t;null!=(t=o)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),j=!0)});T.push(v)})}}();return l&&l.then?l.then(a):a()},function(){return f});return R&&R.then?R.then(h):h()})}if(null===i||"string"==typeof i)return{success:!1,error:i||"Failed to begin upload"};var f=function(){if(!i.ok)return Promise.resolve(i.text()).then(function(e){return"none"!=d&&console.error("Failed to begin upload\n",i.status,e),a=1,{success:!1,error:"Failed to begin upload ("+i.status+"): "+e}})}();return f&&f.then?f.then(l):l(f)})}if("error"in i)return{success:!1,error:i.error||"Failed to validate files"};(null!=(a=t.entrypoint)&&a.name.endsWith(".html")||null!=(l=t.entrypoint)&&l.name.endsWith(".html.gz")||null!=(f=t.entrypoint)&&f.name.endsWith(".html.br"))&&(o||(o={}),o.type="deployment"),c.sort(function(e,t){return e.name.includes(".needle")&&!t.name.includes(".needle")?-1:!e.name.includes(".needle")&&t.name.includes(".needle")?1:0});var w,_=e.baseUrl,S="Bearer "+e.authToken,E=s({},r(e),{triggered_by:t.triggered_by,filename:null==(h=t.entrypoint)?void 0:h.name,"total-files":c.length.toString(),"total-files-size":c.reduce(function(e,t){return e+t.size},0).toString()});null!=(p=o)&&p.view_id&&(E.view_id=o.view_id),null!=(m=o)&&m.type&&(E.type=o.type),null!=(g=o)&&g.name&&(E.name=null==(w=o)?void 0:w.name);var x={results:{entrypoint:(null==(v=t.entrypoint)?void 0:v.path)||(null==(b=t.entrypoint)?void 0:b.name),files:[]}},T=Qt(c,function(e){var t,n=c[e],r=n.path||n.webkitRelativePath||n.name;if(null!=(t=r)&&t.includes(":"))throw new Error("Invalid filename: "+r);return Promise.resolve(n.arrayBuffer()).then(function(e){var t,i,s,a,l,u=n.size,c=n.type;if(null!=(t=c)&&t.length&&"unknown"!==c.toLowerCase()||(c=function(e,t){void 0===t&&(t=void 0);var n=function(e,{extra:t=!1,hint:n}={}){const r=new Uint8Array(e.slice(0,Bt));if(n){const e=function(e,{ext:t,mime:n}){return t||n?Ct(e).filter(e=>e[0]===t||e[1]===n):[]}(Wt,n);if(e.length>0){const t=Lt(r,e);if(void 0!==t)return t}}return Lt(r,Wt)||(t?function(e){return function(e){try{const t=zt(e);if(!function(e){for(let t=0;t<e.length;t++)try{const n=e.charCodeAt(t);if(65533===n||n<=8)return!1}catch{return!1}return!0}(t))return;try{return JSON.parse(t),{ext:"json",mime:"application/json"}}catch{return{ext:"txt",mime:"text/plain"}}}catch{return}}(e)}(e):void 0)}(e);if(n)return n.mime;for(var r=new Uint8Array(e).subarray(0,4),o="",i=0;i<r.length;i++)o+=r[i].toString(16);var s="unknown";switch(o){case"676c5446":s="model/gltf-binary";break;case"89504e47":s="image/png";break;case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":case"ffd8ffe3":case"ffd8ffe8":s="image/jpeg";break;default:s="unknown"}if("unknown"===s&&"string"==typeof t){var a=t.toLowerCase();a.endsWith(".html")||a.endsWith(".html.gz")?s="text/html":a.endsWith(".js")||a.endsWith(".js.gz")?s="application/javascript":a.endsWith(".wasm")?s="application/wasm":a.endsWith(".css")?s="text/css":a.endsWith(".json")?s="application/json":a.endsWith(".txt")?s="text/plain":a.endsWith(".bin")?s="application/octet-stream":a.endsWith(".png")?s="image/png":a.endsWith(".jpg")||a.endsWith(".jpeg")?s="image/jpeg":a.endsWith(".gif")?s="image/gif":a.endsWith(".webp")?s="image/webp":a.endsWith(".svg")?s="image/svg+xml":a.endsWith(".glb")?s="model/gltf-binary":a.endsWith(".gltf")?s="model/gltf+json":a.endsWith(".vrm")?s="model/gltf-binary":a.endsWith(".usdz")?s="model/vnd.usdz+zip":a.endsWith(".usda")?s="model/vnd.usd-usda":a.endsWith(".usdc")?s="model/vnd.usd-usdc":a.endsWith(".usd")?s="model/vnd.usd-usd":a.endsWith(".mtl")?s="model/mtl":a.endsWith(".obj")?s="model/obj":a.endsWith(".fbx")&&(s="model/vnd.autodesk.fbx")}return s}(e,r)),"deployment"===(null==(i=o)?void 0:i.type)){var d=(a=c,l=(s=r).toLowerCase(),"application/gzip"===a||"application/brotli"===a?(l.endsWith(".html.gz")||l.endsWith(".html.br")?(a="text/html",s=s.substring(0,s.length-3)):l.endsWith(".js.gz")||l.endsWith(".js.br")||l.endsWith(".mjs.gz")||l.endsWith(".mjs.br")?(a="application/javascript",s=s.substring(0,s.length-3)):l.endsWith(".css.gz")||l.endsWith(".css.br")?(a="text/css",s=s.substring(0,s.length-3)):l.endsWith(".json.gz")||l.endsWith(".json.br")?(a="text/json",s=s.substring(0,s.length-3)):l.endsWith(".txt.gz")||l.endsWith(".txt.br")?(a="text/plain",s=s.substring(0,s.length-3)):l.endsWith(".wasm.gz")||l.endsWith(".wasm.br")?(a="application/wasm",s=s.substring(0,s.length-3)):l.endsWith(".bin.gz")||l.endsWith(".bin.br")?(a="application/octet-stream",s=s.substring(0,s.length-3)):l.endsWith(".png.gz")||l.endsWith(".png.br")?(a="image/png",s=s.substring(0,s.length-3)):l.endsWith(".jpg.gz")||l.endsWith(".jpg.br")||l.endsWith(".jpeg.gz")||l.endsWith(".jpeg.br")?(a="image/jpeg",s=s.substring(0,s.length-3)):l.endsWith(".gif.gz")||l.endsWith(".gif.br")?(a="image/gif",s=s.substring(0,s.length-3)):l.endsWith(".webp.gz")||l.endsWith(".webp.br")?(a="image/webp",s=s.substring(0,s.length-3)):l.endsWith(".svg.gz")||l.endsWith(".svg.br")?(a="image/svg+xml",s=s.substring(0,s.length-3)):l.endsWith(".ico.gz")||l.endsWith(".ico.br")?(a="image/x-icon",s=s.substring(0,s.length-3)):l.endsWith(".webm.gz")||l.endsWith(".webm.br")?(a="video/webm",s=s.substring(0,s.length-3)):l.endsWith(".mp4.gz")||l.endsWith(".mp4.br")?(a="video/mp4",s=s.substring(0,s.length-3)):l.endsWith(".mov.gz")||l.endsWith(".mov.br")?(a="video/quicktime",s=s.substring(0,s.length-3)):l.endsWith(".mp3.gz")||l.endsWith(".mp3.br")?(a="audio/mpeg",s=s.substring(0,s.length-3)):l.endsWith(".wav.gz")||l.endsWith(".wav.br")?(a="audio/wave",s=s.substring(0,s.length-3)):l.endsWith(".ogg.gz")||l.endsWith(".ogg.br")?(a="audio/ogg",s=s.substring(0,s.length-3)):l.endsWith(".flac.gz")||l.endsWith(".flac.br")?(a="audio/flac",s=s.substring(0,s.length-3)):l.endsWith(".glb.gz")||l.endsWith(".glb.br")?(a="model/gltf-binary",s=s.substring(0,s.length-3)):l.endsWith(".gltf.gz")||l.endsWith(".gltf.br")?(a="model/gltf+json",s=s.substring(0,s.length-3)):l.endsWith(".vrm.gz")||l.endsWith(".vrm.br")?(a="model/gltf-binary",s=s.substring(0,s.length-3)):l.endsWith(".usdz.gz")||l.endsWith(".usdz.br")?(a="model/vnd.usdz+zip",s=s.substring(0,s.length-3)):l.endsWith(".obj.gz")||l.endsWith(".obj.br")?(a="model/obj",s=s.substring(0,s.length-3)):(l.endsWith(".mtl.gz")||l.endsWith(".mtl.br"))&&(a="model/mtl",s=s.substring(0,s.length-3)),{filename:s,mimetype:a}):null);d&&(r=d.filename,c=d.mimetype)}var f=Dt(e);x.results.files.push({filename:r,content_type:c,content_length:u,content_md5:f})})},function(){});return T&&T.then?T.then(y):y()})}catch(e){return Promise.reject(e)}}(e,t,o);return Zt.push(a),Promise.resolve(a.finally(function(){var e=Zt.indexOf(a);e>=0&&Zt.splice(e,1)}))}catch(e){return Promise.reject(e)}}({baseUrl:t.endpoint||"https://cloud.needle.tools/api",authToken:t.token},{triggered_by:"web",entrypoint:void 0,files:o},{name:t.name,abort:t.abort}).then(function(e){return"error"in e?{error:e.error}:{job_id:e.id,view_id:e.view_id,url:e.url,skipped:e.uploadSkipped}})}function nn(e){"limit"in e&&(e.limit=Math.min(100,e.limit));var t="page"in e,o=e.endpoint||"https://cloud.needle.tools/api";return function(e,t){void 0===t&&(t={sort_by_upload:!0,page:1,limit:20,view_id:void 0,type:"upload"});try{if(t.page<=0)throw new Error("Invalid page. Must be greater than 0");var o=e.baseUrl+n.get.uploads,i=s({type:t.type||"upload",max:(t.limit||0).toString(),page:(t.page||1).toString()},r(e));return null!=t.view_id&&(i.view_id=t.view_id),null!=t.view_name&&(i.view_name=t.view_name),Promise.resolve(fetch(o,s({},u,{method:"GET",headers:i})).then(function(e){try{var n=function(n){return void 0===t.sort_by_upload&&(t.sort_by_upload=!0),Promise.resolve(e.json()).then(function(e){return t.sort_by_upload&&e.uploads.sort(function(e,t){return new Date(t.created_time).getTime()-new Date(e.created_time).getTime()}),e})},r=function(){if(!e.ok)return Promise.resolve(e.text()).then(function(t){throw new Error("Failed to list uploads ("+e.status+"): "+t)})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}}({baseUrl:o,authToken:e.token},{view_name:"name"in e?e.name:void 0,view_id:"view_id"in e?e.view_id:void 0,type:"upload",page:t?e.page:1,limit:t?e.limit:100}).then(function(e){return e.uploads.map(function(e){return{name:e.name,created_at:e.created_time,updated_at:e.updated_time,thumbnail_url:e.thumbnail_url,files:e.jobs.map(function(t){return{created_at:t.created_at,updated_at:t.updated_at||t.created_at,type:t.type,status:t.status,name:t.name,url:c({baseUrl:o,view_id:e.view_id,job_id:t.identifier}),size:t.size,additional_size:t.additional_size}})}})})}export{en as getDeployments,nn as getUploads,tn as uploadFiles};
1
+ import e,{Buffer as t}from"buffer";function n(e){var t={authorization:"Bearer "+e.authToken};return e.org&&(t["x-needle-cloud-org"]=e.org),e.roles&&(t.roles=e.roles.join(",")),e.roles_org&&(t.roles_org=e.roles_org.join(",")),t}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(null,arguments)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function a(){a=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,o){var i=RegExp(e,r);return t.set(i,o||t.get(e)),s(i,n.prototype)}function r(e,n){var r=t.get(n);return Object.keys(r).reduce(function(t,n){var o=r[n];if("number"==typeof o)t[n]=e[o];else{for(var i=0;void 0===e[o[i]]&&i+1<o.length;)i++;t[n]=e[o[i]]}return t},Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);if(n){n.groups=r(n,this);var o=n.indices;o&&(o.groups=r(o,this))}return n},n.prototype[Symbol.replace]=function(n,o){if("string"==typeof o){var i=t.get(this);return e[Symbol.replace].call(this,n,o.replace(/\$<([^>]+)>/g,function(e,t){var n=i[t];return"$"+(Array.isArray(n)?n.join("$"):n)}))}if("function"==typeof o){var s=this;return e[Symbol.replace].call(this,n,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(r(e,s)),o.apply(this,e)})}return e[Symbol.replace].call(this,n,o)},a.apply(this,arguments)}var l={credentials:"omit"};function u(e,t){return function(){return e.apply(t,arguments)}}const{toString:c}=Object.prototype,{getPrototypeOf:f}=Object,d=(h=Object.create(null),e=>{const t=c.call(e);return h[t]||(h[t]=t.slice(8,-1).toLowerCase())});var h;const p=e=>(e=e.toLowerCase(),t=>d(t)===e),m=e=>t=>typeof t===e,{isArray:g}=Array,v=m("undefined"),y=p("ArrayBuffer"),b=m("string"),w=m("function"),S=m("number"),E=e=>null!==e&&"object"==typeof e,x=e=>{if("object"!==d(e))return!1;const t=f(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},T=p("Date"),O=p("File"),R=p("Blob"),_=p("FileList"),j=p("URLSearchParams"),[A,P,U,F]=["ReadableStream","Request","Response","Headers"].map(p);function W(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),g(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function z(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,k=e=>!v(e)&&e!==C,N=(B="undefined"!=typeof Uint8Array&&f(Uint8Array),e=>B&&e instanceof B);var B;const L=p("HTMLFormElement"),D=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),M=p("RegExp"),I=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};W(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)},q="abcdefghijklmnopqrstuvwxyz",J="0123456789",H={DIGIT:J,ALPHA:q,ALPHA_DIGIT:q+q.toUpperCase()+J},K=p("AsyncFunction"),V=($="function"==typeof setImmediate,G=w(C.postMessage),$?setImmediate:G?(X=`axios@${Math.random()}`,Q=[],C.addEventListener("message",({source:e,data:t})=>{e===C&&t===X&&Q.length&&Q.shift()()},!1),e=>{Q.push(e),C.postMessage(X,"*")}):e=>setTimeout(e));var $,G,X,Q;const Y="undefined"!=typeof queueMicrotask?queueMicrotask.bind(C):"undefined"!=typeof process&&process.nextTick||V;var Z={isArray:g,isArrayBuffer:y,isBuffer:function(e){return null!==e&&!v(e)&&null!==e.constructor&&!v(e.constructor)&&w(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||w(e.append)&&("formdata"===(t=d(e))||"object"===t&&w(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&y(e.buffer),t},isString:b,isNumber:S,isBoolean:e=>!0===e||!1===e,isObject:E,isPlainObject:x,isReadableStream:A,isRequest:P,isResponse:U,isHeaders:F,isUndefined:v,isDate:T,isFile:O,isBlob:R,isRegExp:M,isFunction:w,isStream:e=>E(e)&&w(e.pipe),isURLSearchParams:j,isTypedArray:N,isFileList:_,forEach:W,merge:function e(){const{caseless:t}=k(this)&&this||{},n={},r=(r,o)=>{const i=t&&z(n,o)||o;n[i]=x(n[i])&&x(r)?e(n[i],r):x(r)?e({},r):g(r)?r.slice():r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&W(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(W(t,(t,r)=>{e[r]=n&&w(t)?u(t,n):t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,s;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&f(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:d,kindOfTest:p,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length);const r=e.indexOf(t,n-=t.length);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(g(e))return e;let t=e.length;if(!S(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:L,hasOwnProperty:D,hasOwnProp:D,reduceDescriptors:I,freezeMethods:e=>{I(e,(t,n)=>{if(w(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;w(e[n])&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return g(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:z,global:C,isContextDefined:k,ALPHABET:H,generateString:(e=16,t=H.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&w(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(E(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=g(e)?[]:{};return W(e,(e,t)=>{const i=n(e,r+1);!v(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:K,isThenable:e=>e&&(E(e)||w(e))&&w(e.then)&&w(e.catch),setImmediate:V,asap:Y};function ee(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}Z.inherits(ee,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Z.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const te=ee.prototype,ne={};function re(e){return Z.isPlainObject(e)||Z.isArray(e)}function oe(e){return Z.endsWith(e,"[]")?e.slice(0,-2):e}function ie(e,t,n){return e?e.concat(t).map(function(e,t){return e=oe(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{ne[e]={value:e}}),Object.defineProperties(ee,ne),Object.defineProperty(te,"isAxiosError",{value:!0}),ee.from=(e,t,n,r,o,i)=>{const s=Object.create(te);return Z.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),ee.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const se=Z.toFlatObject(Z,{},null,function(e){return/^is[A-Z]/.test(e)});function ae(e,t,n){if(!Z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Z.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Z.isSpecCompliantForm(t);if(!Z.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Z.isDate(e))return e.toISOString();if(!a&&Z.isBlob(e))throw new ee("Blob is not supported. Use a Buffer instead.");return Z.isArrayBuffer(e)||Z.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(Z.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Z.isArray(e)&&function(e){return Z.isArray(e)&&!e.some(re)}(e)||(Z.isFileList(e)||Z.endsWith(n,"[]"))&&(a=Z.toArray(e)))return n=oe(n),a.forEach(function(e,r){!Z.isUndefined(e)&&null!==e&&t.append(!0===s?ie([n],r,i):null===s?n:n+"[]",l(e))}),!1;return!!re(e)||(t.append(ie(o,n,i),l(e)),!1)}const c=[],f=Object.assign(se,{defaultVisitor:u,convertValue:l,isVisitable:re});if(!Z.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Z.isUndefined(n)){if(-1!==c.indexOf(n))throw Error("Circular reference detected in "+r.join("."));c.push(n),Z.forEach(n,function(n,i){!0===(!(Z.isUndefined(n)||null===n)&&o.call(t,n,Z.isString(i)?i.trim():i,r,f))&&e(n,r?r.concat(i):[i])}),c.pop()}}(e),t}function le(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ue(e,t){this._pairs=[],e&&ae(e,this,t)}const ce=ue.prototype;function fe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function de(e,t,n){if(!t)return e;const r=n&&n.encode||fe,o=n&&n.serialize;let i;if(i=o?o(t,n):Z.isURLSearchParams(t)?t.toString():new ue(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}ce.append=function(e,t){this._pairs.push([e,t])},ce.toString=function(e){const t=e?function(t){return e.call(this,t,le)}:le;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var he=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Z.forEach(this.handlers,function(t){null!==t&&e(t)})}},pe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},me={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ue,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ge="undefined"!=typeof window&&"undefined"!=typeof document,ve=(ye="undefined"!=typeof navigator&&navigator.product,ge&&["ReactNative","NativeScript","NS"].indexOf(ye)<0);var ye,be={__proto__:null,hasBrowserEnv:ge,hasStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,hasStandardBrowserEnv:ve,origin:ge&&window.location.href||"http://localhost",...me};function we(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;return i=!i&&Z.isArray(r)?r.length:i,a?(r[i]=Z.hasOwnProp(r,i)?[r[i],n]:n,!s):(r[i]&&Z.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&Z.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s)}if(Z.isFormData(e)&&Z.isFunction(e.entries)){const n={};return Z.forEachEntry(e,(e,r)=>{t(function(e){return Z.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Se={transitional:pe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Z.isObject(e);if(o&&Z.isHTMLForm(e)&&(e=new FormData(e)),Z.isFormData(e))return r?JSON.stringify(we(e)):e;if(Z.isArrayBuffer(e)||Z.isBuffer(e)||Z.isStream(e)||Z.isFile(e)||Z.isBlob(e)||Z.isReadableStream(e))return e;if(Z.isArrayBufferView(e))return e.buffer;if(Z.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ae(e,new be.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return be.isNode&&Z.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=Z.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ae(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Z.isString(e))try{return(0,JSON.parse)(e),Z.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Se.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Z.isResponse(e)||Z.isReadableStream(e))return e;if(e&&Z.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw ee.from(e,ee.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:be.classes.FormData,Blob:be.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Z.forEach(["delete","get","head","post","put","patch"],e=>{Se.headers[e]={}});var Ee=Se;const xe=Z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Te=Symbol("internals");function Oe(e){return e&&String(e).trim().toLowerCase()}function Re(e){return!1===e||null==e?e:Z.isArray(e)?e.map(Re):String(e)}function _e(e,t,n,r,o){return Z.isFunction(r)?r.call(this,t,n):(o&&(t=n),Z.isString(t)?Z.isString(r)?-1!==t.indexOf(r):Z.isRegExp(r)?r.test(t):void 0:void 0)}class je{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Oe(t);if(!o)throw new Error("header name must be a non-empty string");const i=Z.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Re(e))}const i=(e,t)=>Z.forEach(e,(e,n)=>o(e,n,t));if(Z.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Z.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&xe[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Z.isHeaders(e))for(const[t,r]of e.entries())o(r,t,n);else null!=e&&o(t,e,n);return this}get(e,t){if(e=Oe(e)){const n=Z.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Z.isFunction(t))return t.call(this,e,n);if(Z.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Oe(e)){const n=Z.findKey(this,e);return!(!n||void 0===this[n]||t&&!_e(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Oe(e)){const o=Z.findKey(n,e);!o||t&&!_e(0,n[o],o,t)||(delete n[o],r=!0)}}return Z.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!_e(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Z.forEach(this,(r,o)=>{const i=Z.findKey(n,o);if(i)return t[i]=Re(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=Re(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Z.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Z.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Te]=this[Te]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Oe(e);t[r]||(function(e,t){const n=Z.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Z.isArray(e)?e.forEach(r):r(e),this}}je.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Z.reduceDescriptors(je.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Z.freezeMethods(je);var Ae=je;function Pe(e,t){const n=this||Ee,r=t||n,o=Ae.from(r.headers);let i=r.data;return Z.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Ue(e){return!(!e||!e.__CANCEL__)}function Fe(e,t,n){ee.call(this,null==e?"canceled":e,ee.ERR_CANCELED,t,n),this.name="CanceledError"}function We(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ee("Request failed with status code "+n.status,[ee.ERR_BAD_REQUEST,ee.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Z.inherits(Fe,ee,{__CANCEL__:!0});const ze=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),u=r[s];o||(o=l),n[i]=a,r[i]=l;let c=s,f=0;for(;c!==i;)f+=n[c++],c%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),l-o<t)return;const d=u&&l-u;return d?Math.round(1e3*f/d):void 0}}(50,250);return function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n)]}(n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,l=o(a);r=i,e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&i<=s?(s-i)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},Ce=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ke=e=>(...t)=>Z.asap(()=>e(...t));var Ne=be.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=Z.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0},Be=be.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];Z.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),Z.isString(r)&&s.push("path="+r),Z.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Le(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const De=e=>e instanceof Ae?{...e}:e;function Me(e,t){t=t||{};const n={};function r(e,t,n){return Z.isPlainObject(e)&&Z.isPlainObject(t)?Z.merge.call({caseless:n},e,t):Z.isPlainObject(t)?Z.merge({},t):Z.isArray(t)?t.slice():t}function o(e,t,n){return Z.isUndefined(t)?Z.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!Z.isUndefined(t))return r(void 0,t)}function s(e,t){return Z.isUndefined(t)?Z.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const l={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>o(De(e),De(t),!0)};return Z.forEach(Object.keys(Object.assign({},e,t)),function(r){const i=l[r]||o,s=i(e[r],t[r],r);Z.isUndefined(s)&&i!==a||(n[r]=s)}),n}var Ie=e=>{const t=Me({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:l}=t;if(t.headers=a=Ae.from(a),t.url=de(Le(t.baseURL,t.url),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),Z.isFormData(r))if(be.hasStandardBrowserEnv||be.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map(e=>e.trim()).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(be.hasStandardBrowserEnv&&(o&&Z.isFunction(o)&&(o=o(t)),o||!1!==o&&Ne(t.url))){const e=i&&s&&Be.read(s);e&&a.set(i,e)}return t},qe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ie(e);let o=r.data;const i=Ae.from(r.headers).normalize();let s,a,l,u,c,{responseType:f,onUploadProgress:d,onDownloadProgress:h}=r;function p(){u&&u(),c&&c(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Ae.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());We(function(e){t(e),p()},function(e){n(e),p()},{data:f&&"text"!==f&&"json"!==f?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new ee("Request aborted",ee.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new ee("Network Error",ee.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new ee(t,(r.transitional||pe).clarifyTimeoutError?ee.ETIMEDOUT:ee.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&Z.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Z.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),f&&"json"!==f&&(m.responseType=r.responseType),h&&([l,c]=ze(h,!0),m.addEventListener("progress",l)),d&&m.upload&&([a,u]=ze(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new Fe(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);v&&-1===be.protocols.indexOf(v)?n(new ee("Unsupported protocol "+v+":",ee.ERR_BAD_REQUEST,e)):m.send(o||null)})},Je=(e,t)=>{let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof ee?t:new Fe(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{o(new ee(`timeout ${t} of ms exceeded`,ee.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e&&(e.removeEventListener?e.removeEventListener("abort",o):e.unsubscribe(o))}),e=null)};e.forEach(e=>e&&e.addEventListener&&e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=s,[a,()=>{i&&clearTimeout(i),i=null}]};const He=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Ke=(e,t,n,r,o)=>{const i=async function*(e,t,n){for await(const r of e)yield*He(ArrayBuffer.isView(r)?r:await n(String(r)),t)}(e,t,o);let s,a=0,l=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return l(),void e.close();if(n){let e=a+=r.byteLength;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw l(e),e}},cancel:e=>(l(e),i.return())},{highWaterMark:2})},Ve="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,$e=Ve&&"function"==typeof ReadableStream,Ge=Ve&&("function"==typeof TextEncoder?(Xe=new TextEncoder,e=>Xe.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Xe;const Qe=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ye=$e&&Qe(()=>{let e=!1;const t=new Request(be.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ze=$e&&Qe(()=>Z.isReadableStream(new Response("").body)),et={stream:Ze&&(e=>e.body)};var tt;Ve&&(tt=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!et[e]&&(et[e]=Z.isFunction(tt[e])?t=>t[e]():(t,n)=>{throw new ee(`Response type '${e}' is not supported`,ee.ERR_NOT_SUPPORT,n)})}));const nt={http:null,xhr:qe,fetch:Ve&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:i,timeout:s,onDownloadProgress:a,onUploadProgress:l,responseType:u,headers:c,withCredentials:f="same-origin",fetchOptions:d}=Ie(e);u=u?(u+"").toLowerCase():"text";let h,p,[m,g]=o||i||s?Je([o,i],s):[];const v=()=>{!h&&setTimeout(()=>{m&&m.unsubscribe()}),h=!0};let y;try{if(l&&Ye&&"get"!==n&&"head"!==n&&0!==(y=await(async(e,t)=>{const n=Z.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:Z.isBlob(e)?e.size:Z.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:Z.isArrayBufferView(e)||Z.isArrayBuffer(e)?e.byteLength:(Z.isURLSearchParams(e)&&(e+=""),Z.isString(e)?(await Ge(e)).byteLength:void 0))(t):n})(c,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(Z.isFormData(r)&&(e=n.headers.get("content-type"))&&c.setContentType(e),n.body){const[e,t]=Ce(y,ze(ke(l)));r=Ke(n.body,65536,e,t,Ge)}}Z.isString(f)||(f=f?"include":"omit"),p=new Request(t,{...d,signal:m,method:n.toUpperCase(),headers:c.normalize().toJSON(),body:r,duplex:"half",credentials:f});let o=await fetch(p);const i=Ze&&("stream"===u||"response"===u);if(Ze&&(a||i)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=o[t]});const t=Z.toFiniteNumber(o.headers.get("content-length")),[n,r]=a&&Ce(t,ze(ke(a),!0))||[];o=new Response(Ke(o.body,65536,n,()=>{r&&r(),i&&v()},Ge),e)}u=u||"text";let s=await et[Z.findKey(et,u)||"text"](o,e);return!i&&v(),g&&g(),await new Promise((t,n)=>{We(t,n,{data:s,headers:Ae.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:p})})}catch(t){if(v(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new ee("Network Error",ee.ERR_NETWORK,e,p),{cause:t.cause||t});throw ee.from(t,t&&t.code,e,p)}})};Z.forEach(nt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const rt=e=>`- ${e}`,ot=e=>Z.isFunction(e)||null===e||!1===e;var it=e=>{e=Z.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){let t;if(n=e[i],r=n,!ot(n)&&(r=nt[(t=String(n)).toLowerCase()],void 0===r))throw new ee(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+i]=r}if(!r){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new ee("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(rt).join("\n"):" "+rt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function st(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fe(null,e)}function at(e){return st(e),e.headers=Ae.from(e.headers),e.data=Pe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),it(e.adapter||Ee.adapter)(e).then(function(t){return st(e),t.data=Pe.call(e,e.transformResponse,t),t.headers=Ae.from(t.headers),t},function(t){return Ue(t)||(st(e),t&&t.response&&(t.response.data=Pe.call(e,e.transformResponse,t.response),t.response.headers=Ae.from(t.response.headers))),Promise.reject(t)})}const lt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{lt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const ut={};lt.transitional=function(e,t,n){function r(e,t){return"[Axios v1.7.4] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new ee(r(o," has been removed"+(t?" in "+t:"")),ee.ERR_DEPRECATED);return t&&!ut[o]&&(ut[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var ct={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ee("options must be an object",ee.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new ee("option "+i+" must be "+n,ee.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new ee("Unknown option "+i,ee.ERR_BAD_OPTION)}},validators:lt};const ft=ct.validators;class dt{constructor(e){this.defaults=e,this.interceptors={request:new he,response:new he}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Me(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&ct.assertOptions(n,{silentJSONParsing:ft.transitional(ft.boolean),forcedJSONParsing:ft.transitional(ft.boolean),clarifyTimeoutError:ft.transitional(ft.boolean)},!1),null!=r&&(Z.isFunction(r)?t.paramsSerializer={serialize:r}:ct.assertOptions(r,{encode:ft.function,serialize:ft.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Z.merge(o.common,o[t.method]);o&&Z.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Ae.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const l=[];let u;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let c,f=0;if(!a){const e=[at.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,l),c=e.length,u=Promise.resolve(t);f<c;)u=u.then(e[f++],e[f++]);return u}c=s.length;let d=t;for(f=0;f<c;){const e=s[f++],t=s[f++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=at.call(this,d)}catch(e){return Promise.reject(e)}for(f=0,c=l.length;f<c;)u=u.then(l[f++],l[f++]);return u}getUri(e){return de(Le((e=Me(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Z.forEach(["delete","get","head","options"],function(e){dt.prototype[e]=function(t,n){return this.request(Me(n||{},{method:e,url:t,data:(n||{}).data}))}}),Z.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(Me(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}dt.prototype[e]=t(),dt.prototype[e+"Form"]=t(!0)});var ht=dt;class pt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new Fe(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new pt(function(t){e=t}),cancel:e}}}var mt=pt;const gt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gt).forEach(([e,t])=>{gt[t]=e});var vt=gt;const yt=function e(t){const n=new ht(t),r=u(ht.prototype.request,n);return Z.extend(r,ht.prototype,n,{allOwnKeys:!0}),Z.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Me(t,n))},r}(Ee);yt.Axios=ht,yt.CanceledError=Fe,yt.CancelToken=mt,yt.isCancel=Ue,yt.VERSION="1.7.4",yt.toFormData=ae,yt.AxiosError=ee,yt.Cancel=yt.CanceledError,yt.all=function(e){return Promise.all(e)},yt.spread=function(e){return function(t){return e.apply(null,t)}},yt.isAxiosError=function(e){return Z.isObject(e)&&!0===e.isAxiosError},yt.mergeConfig=Me,yt.AxiosHeaders=Ae,yt.formToJSON=e=>we(Z.isHTMLForm(e)?new FormData(e):e),yt.getAdapter=it,yt.HttpStatusCode=vt,yt.default=yt;var bt=yt;const{CanceledError:wt}=bt;var St,Et,xt=function(e,t){try{var r=t.baseUrl+"/v1/jobs/update",o=i({},n(t),{job_id:e.identifier,status:e.status});return Promise.resolve(fetch(r,i({},l,{method:"POST",headers:o,body:JSON.stringify({status_message:e.status_message,error:e.error,progress:e.progress})})).catch(function(e){return console.error(e),null})).then(function(e){return!!e&&e.ok})}catch(e){return Promise.reject(e)}},Tt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ot={__proto__:null,default:{}},Rt=(St=function(t){!function(){var n="input is invalid type",r="object"==typeof window,o=r?window:{};o.JS_MD5_NO_WINDOW&&(r=!1);var i=!r&&"object"==typeof self,s=!o.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;s?o=Tt:i&&(o=self);var a,l=!o.JS_MD5_NO_COMMON_JS&&t.exports,u=!o.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,c="0123456789abcdef".split(""),f=[128,32768,8388608,-2147483648],d=[0,8,16,24],h=["hex","array","digest","buffer","arrayBuffer","base64"],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),m=[];if(u){var g=new ArrayBuffer(68);a=new Uint8Array(g),m=new Uint32Array(g)}var v=Array.isArray;!o.JS_MD5_NO_NODE_JS&&v||(v=function(e){return"[object Array]"===Object.prototype.toString.call(e)});var y=ArrayBuffer.isView;!u||!o.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&y||(y=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var b=function(e){var t=typeof e;if("string"===t)return[e,!0];if("object"!==t||null===e)throw new Error(n);if(u&&e.constructor===ArrayBuffer)return[new Uint8Array(e),!1];if(!v(e)&&!y(e))throw new Error(n);return[e,!1]},w=function(e){return function(t){return new E(!0).update(t)[e]()}},S=function(e){return function(t,n){return new x(t,!0).update(n)[e]()}};function E(e){if(e)m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m,this.buffer8=a;else if(u){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function x(e,t){var n,r=b(e);if(e=r[0],r[1]){var o,i=[],s=e.length,a=0;for(n=0;n<s;++n)(o=e.charCodeAt(n))<128?i[a++]=o:o<2048?(i[a++]=192|o>>>6,i[a++]=128|63&o):o<55296||o>=57344?(i[a++]=224|o>>>12,i[a++]=128|o>>>6&63,i[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),i[a++]=240|o>>>18,i[a++]=128|o>>>12&63,i[a++]=128|o>>>6&63,i[a++]=128|63&o);e=i}e.length>64&&(e=new E(!0).update(e).array());var l=[],u=[];for(n=0;n<64;++n){var c=e[n]||0;l[n]=92^c,u[n]=54^c}E.call(this,t),this.update(u),this.oKeyPad=l,this.inner=!0,this.sharedMemory=t}E.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");for(var t,n,r=b(e),o=r[1],i=0,s=(e=r[0]).length,a=this.blocks,l=this.buffer8;i<s;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),o)if(u)for(n=this.start;i<s&&n<64;++i)(t=e.charCodeAt(i))<128?l[n++]=t:t<2048?(l[n++]=192|t>>>6,l[n++]=128|63&t):t<55296||t>=57344?(l[n++]=224|t>>>12,l[n++]=128|t>>>6&63,l[n++]=128|63&t):(t=65536+((1023&t)<<10|1023&e.charCodeAt(++i)),l[n++]=240|t>>>18,l[n++]=128|t>>>12&63,l[n++]=128|t>>>6&63,l[n++]=128|63&t);else for(n=this.start;i<s&&n<64;++i)(t=e.charCodeAt(i))<128?a[n>>>2]|=t<<d[3&n++]:t<2048?(a[n>>>2]|=(192|t>>>6)<<d[3&n++],a[n>>>2]|=(128|63&t)<<d[3&n++]):t<55296||t>=57344?(a[n>>>2]|=(224|t>>>12)<<d[3&n++],a[n>>>2]|=(128|t>>>6&63)<<d[3&n++],a[n>>>2]|=(128|63&t)<<d[3&n++]):(t=65536+((1023&t)<<10|1023&e.charCodeAt(++i)),a[n>>>2]|=(240|t>>>18)<<d[3&n++],a[n>>>2]|=(128|t>>>12&63)<<d[3&n++],a[n>>>2]|=(128|t>>>6&63)<<d[3&n++],a[n>>>2]|=(128|63&t)<<d[3&n++]);else if(u)for(n=this.start;i<s&&n<64;++i)l[n++]=e[i];else for(n=this.start;i<s&&n<64;++i)a[n>>>2]|=e[i]<<d[3&n++];this.lastByteIndex=n,this.bytes+=n-this.start,n>=64?(this.start=n-64,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},E.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>>2]|=f[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},E.prototype.hash=function(){var e,t,n,r,o,i,s=this.blocks;this.first?t=((t=((e=((e=s[0]-680876937)<<7|e>>>25)-271733879|0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&e)+s[1]-117830708)<<12|r>>>20)+e|0)&(-271733879^e))+s[2]-1126478375)<<17|n>>>15)+r|0)&(r^e))+s[3]-1316259209)<<22|t>>>10)+n|0:(e=this.h0,t=this.h1,t=((t+=((e=((e+=((r=this.h3)^t&((n=this.h2)^r))+s[0]-680876936)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+s[1]-389564586)<<12|r>>>20)+e|0)&(e^t))+s[2]+606105819)<<17|n>>>15)+r|0)&(r^e))+s[3]-1044525330)<<22|t>>>10)+n|0),t=((t+=((e=((e+=(r^t&(n^r))+s[4]-176418897)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+s[5]+1200080426)<<12|r>>>20)+e|0)&(e^t))+s[6]-1473231341)<<17|n>>>15)+r|0)&(r^e))+s[7]-45705983)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+s[8]+1770035416)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+s[9]-1958414417)<<12|r>>>20)+e|0)&(e^t))+s[10]-42063)<<17|n>>>15)+r|0)&(r^e))+s[11]-1990404162)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+s[12]+1804603682)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+s[13]-40341101)<<12|r>>>20)+e|0)&(e^t))+s[14]-1502002290)<<17|n>>>15)+r|0)&(r^e))+s[15]+1236535329)<<22|t>>>10)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+s[1]-165796510)<<5|e>>>27)+t|0)^t))+s[6]-1069501632)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+s[11]+643717713)<<14|n>>>18)+r|0)^r))+s[0]-373897302)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+s[5]-701558691)<<5|e>>>27)+t|0)^t))+s[10]+38016083)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+s[15]-660478335)<<14|n>>>18)+r|0)^r))+s[4]-405537848)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+s[9]+568446438)<<5|e>>>27)+t|0)^t))+s[14]-1019803690)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+s[3]-187363961)<<14|n>>>18)+r|0)^r))+s[8]+1163531501)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+s[13]-1444681467)<<5|e>>>27)+t|0)^t))+s[2]-51403784)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+s[7]+1735328473)<<14|n>>>18)+r|0)^r))+s[12]-1926607734)<<20|t>>>12)+n|0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+s[5]-378558)<<4|e>>>28)+t|0))+s[8]-2022574463)<<11|r>>>21)+e|0)^e)^(n=((n+=(i^t)+s[11]+1839030562)<<16|n>>>16)+r|0))+s[14]-35309556)<<23|t>>>9)+n|0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+s[1]-1530992060)<<4|e>>>28)+t|0))+s[4]+1272893353)<<11|r>>>21)+e|0)^e)^(n=((n+=(i^t)+s[7]-155497632)<<16|n>>>16)+r|0))+s[10]-1094730640)<<23|t>>>9)+n|0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+s[13]+681279174)<<4|e>>>28)+t|0))+s[0]-358537222)<<11|r>>>21)+e|0)^e)^(n=((n+=(i^t)+s[3]-722521979)<<16|n>>>16)+r|0))+s[6]+76029189)<<23|t>>>9)+n|0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+s[9]-640364487)<<4|e>>>28)+t|0))+s[12]-421815835)<<11|r>>>21)+e|0)^e)^(n=((n+=(i^t)+s[15]+530742520)<<16|n>>>16)+r|0))+s[2]-995338651)<<23|t>>>9)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+s[0]-198630844)<<6|e>>>26)+t|0)|~n))+s[7]+1126891415)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+s[14]-1416354905)<<15|n>>>17)+r|0)|~e))+s[5]-57434055)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+s[12]+1700485571)<<6|e>>>26)+t|0)|~n))+s[3]-1894986606)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+s[10]-1051523)<<15|n>>>17)+r|0)|~e))+s[1]-2054922799)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+s[8]+1873313359)<<6|e>>>26)+t|0)|~n))+s[15]-30611744)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+s[6]-1560198380)<<15|n>>>17)+r|0)|~e))+s[13]+1309151649)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+s[4]-145523070)<<6|e>>>26)+t|0)|~n))+s[11]-1120210379)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+s[2]+718787259)<<15|n>>>17)+r|0)|~e))+s[9]-343485551)<<21|t>>>11)+n|0,this.first?(this.h0=e+1732584193|0,this.h1=t-271733879|0,this.h2=n-1732584194|0,this.h3=r+271733878|0,this.first=!1):(this.h0=this.h0+e|0,this.h1=this.h1+t|0,this.h2=this.h2+n|0,this.h3=this.h3+r|0)},E.prototype.toString=E.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return c[e>>>4&15]+c[15&e]+c[e>>>12&15]+c[e>>>8&15]+c[e>>>20&15]+c[e>>>16&15]+c[e>>>28&15]+c[e>>>24&15]+c[t>>>4&15]+c[15&t]+c[t>>>12&15]+c[t>>>8&15]+c[t>>>20&15]+c[t>>>16&15]+c[t>>>28&15]+c[t>>>24&15]+c[n>>>4&15]+c[15&n]+c[n>>>12&15]+c[n>>>8&15]+c[n>>>20&15]+c[n>>>16&15]+c[n>>>28&15]+c[n>>>24&15]+c[r>>>4&15]+c[15&r]+c[r>>>12&15]+c[r>>>8&15]+c[r>>>20&15]+c[r>>>16&15]+c[r>>>28&15]+c[r>>>24&15]},E.prototype.array=E.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&n,n>>>8&255,n>>>16&255,n>>>24&255,255&r,r>>>8&255,r>>>16&255,r>>>24&255]},E.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},E.prototype.buffer=E.prototype.arrayBuffer,E.prototype.base64=function(){for(var e,t,n,r="",o=this.array(),i=0;i<15;)e=o[i++],t=o[i++],n=o[i++],r+=p[e>>>2]+p[63&(e<<4|t>>>4)]+p[63&(t<<2|n>>>6)]+p[63&n];return r+(p[(e=o[i])>>>2]+p[e<<4&63]+"==")},(x.prototype=new E).finalize=function(){if(E.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();E.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),E.prototype.finalize.call(this)}};var T=function(){var t=w("hex");s&&(t=function(t){var r,i=Ot,s=e.Buffer;return r=s.from&&!o.JS_MD5_NO_BUFFER_FROM?s.from:function(e){return new s(e)},function(e){if("string"==typeof e)return i.createHash("md5").update(e,"utf8").digest("hex");if(null==e)throw new Error(n);return e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),v(e)||y(e)||e.constructor===s?i.createHash("md5").update(r(e)).digest("hex"):t(e)}}(t)),t.create=function(){return new E},t.update=function(e){return t.create().update(e)};for(var r=0;r<h.length;++r){var i=h[r];t[i]=w(i)}return t}();T.md5=T,T.md5.hmac=function(){var e=S("hex");e.create=function(e){return new x(e)},e.update=function(t,n){return e.create(t).update(n)};for(var t=0;t<h.length;++t){var n=h[t];e[n]=S(n)}return e}(),l?t.exports=T:o.md5=T}()},St(Et={exports:{}}),Et.exports);function _t(e,t=0){return Ut(e,t,2).getUint16(0,!0)}function jt(e,t=0){return Ut(e,t,4).getUint32(0,!0)}function At(e,t=0,n=e.byteLength){const r=e.slice(t,t+n);return Ft.decode(new Uint8Array(r))}function Pt(e,t,n=0){if(e.length<t.length+n)return!1;for(const[r,o]of t.entries())if(null!==o&&o!==e[r+n])return!1;return!0}function Ut(e,t,n){const r=e.slice(t,t+n);return new DataView(new Uint8Array(r).buffer)}const Ft=new TextDecoder("utf8"),Wt=[["db","application/vnd.sqlite3",[83,81,76,105,116,101,32,102,111,114,109,97,116,32,51,0]],["woff","font/woff",[119,79,70,70]],["woff2","font/woff2",[119,79,70,50]],["bmp","image/bmp",[66,77]],["gif","image/gif",[71,73,70,56,55,97]],["gif","image/gif",[71,73,70,56,57,97]],["heic","image/heic",[102,116,121,112,104,101,105],{offset:4}],["heic","image/heic",[102,116,121,112,109],{offset:4}],["ico","image/x-icon",[0,0,1,0]],["jpg","image/jpeg",[255,216,255]],["pdf","application/pdf",[37,80,68,70,45]],["png","image/png",[137,80,78,71,13,10,26,10]],["7z","application/x-7z-compressed",[55,122,188,175,39,28]],["rar","application/x-rar-compressed",[82,97,114,33,26,7,0]],["rar","application/x-rar-compressed",[82,97,114,33,26,7,1,0]],["rtf","application/rtf",[123,92,114,116,102,49]],["bz2","application/x-bzip2",[66,90,104]],["gz","application/gzip",[31,139]],["tar","application/x-tar",[117,115,116,97,114,0,48,48],{offset:257}],["tar","application/x-tar",[117,115,116,97,114,32,32,0],{offset:257}],["tif","image/tiff",[73,73,42,0]],["tiff","image/tiff",[77,77,0,42]],["zip","application/zip",[80,75,3,4],{exact:!1}],["zip","application/zip",[80,75,5,6]],["mp3","audio/mp3",[255,251]],["mp3","audio/mp3",[255,243]],["mp3","audio/mp3",[255,242]],["mp3","audio/mp3",[73,68,51]],["mp4","video/mp4",[102,116,121,112,105,115,111,109],{offset:4}],["avi","video/x-msvideo",[82,73,70,70,null,null,null,null,65,86,73,32]],["wav","audio/wav",[82,73,70,70,null,null,null,null,87,65,86,69]],["ogx","application/ogg",[79,103,103,83],{exact:!1},[["oga","audio/ogg",[127,70,76,65,67],{offset:28}],["ogg","audio/ogg",[1,118,111,114,98,105,115],{offset:28}],["ogm","video/ogg",[1,118,105,100,101,111,0],{offset:28}],["ogv","video/ogg",[128,116,104,101,111,114,97],{offset:28}]]],["webp","image/webp",[82,73,70,70,null,null,null,null,87,69,66,80]],["psd","image/vnd.adobe.photoshop",[56,66,80,83]],["flac","audio/x-flac",[102,76,97,67]],["wasm","application/wasm",[0,97,115,109]],["deb","application/x-deb",[33,60,97,114,99,104,62,10]],["exe","application/x-msdownload",[77,90]],["exe","application/x-msdownload",[90,77]],["class","application/java-vm",[202,254,186,190]]];function zt(e){return e.flatMap(([e,t,n,r={},o=[]])=>[[e,t,n,r],...o])}function Ct(e,t){const n=_t(e,26),r=At(e,30,n),[o]=r.split("/"),i=r.endsWith(".xml");return"META-INF"===o?{ext:"jar",mime:"application/java-archive"}:"ppt"===o&&i?{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}:"word"===o&&i?{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}:"xl"===o&&i?{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}:"mimetype"===o?function(e,t){const n=jt(e,18),r=jt(e,22),o=_t(e,28);if(n===r){const r=At(e,30+t+o,n);if("application/vnd.oasis.opendocument.presentation"===r)return{ext:"odp",mime:r};if("application/vnd.oasis.opendocument.spreadsheet"===r)return{ext:"ods",mime:r};if("application/vnd.oasis.opendocument.text"===r)return{ext:"odt",mime:r};if("application/epub+zip"===r)return{ext:"epub",mime:r}}}(e,n)??t:t}const kt=function(e){return zt(e).map(([e,t,n,{offset:r=0}={}])=>n.length+r).reduce((e,t)=>t>e?t:e,0)}(Wt);function Nt(e,t){for(const[n,r,o,{exact:i=!0,offset:s=0}={},a=[]]of t)if(Pt(e,o,s)){if("zip"===n&&!i)return Ct(e.buffer,{ext:n,mime:r});if(!i&&a.length)for(const[t,n,r,{offset:o=0}={}]of a)if(Pt(e,r,o))return{ext:t,mime:n};return{ext:n,mime:r}}}function Bt(e){var t=Rt.md5.create();return t.update(e),t.base64()}function Lt(e,t,n){if(void 0===t&&(t=2),void 0===n&&(n=!0),e>=1099511627776){var r=n?" TB":"";return(e/1099511627776).toFixed(t)+r}if(e>=1073741824){var o=n?" GB":"";return(e/1073741824).toFixed(t)+o}if(e>=1048576){var i=n?" MB":"";return(e/1048576).toFixed(t)+i}if(e>1024){var s=n?" KB":"";return(e/1024).toFixed(t)+s}var a=n?" B":"";return e.toFixed(t)+a}"undefined"==typeof Symbol||Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"));var Dt=function(e){try{return Promise.resolve(new Promise(function(t){return setTimeout(t,e)}))}catch(e){return Promise.reject(e)}};function Mt(e,t,n){if(!e.s){if(n instanceof It){if(!n.s)return void(n.o=Mt.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Mt.bind(null,e,t),Mt.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var It=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Mt(r,1,i(this.v))}catch(e){Mt(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Mt(r,1,t?t(o):o):n?Mt(r,1,n(o)):Mt(r,2,o)}catch(e){Mt(r,2,e)}},r},e}();function qt(e){return e instanceof It&&1&e.s}function Jt(e){for(var t=-1,n=Infinity,r=0;r<e.length;r++){var o=e[r];console.debug(o),o.path.split("/").length<n&&(n=o.path.split("/").length,t=r)}return t<0?null:e[t]}var Ht=/*#__PURE__*/function(){function e(e,t){this.totalFiles=e,this.estimatedTotalSize=t,this.uploadedSize=0,this.startTime=Date.now(),this.lastUpdateTime=this.startTime,this.lastUploadedSize=0,this.speedEMA=null,this.emaFactor=.1,this.smoothedRemainingTime=null,this.recentSpeeds=new Array,this.maxRecentSpeeds=20,this.initialEstimateThreshold=.05}var t=e.prototype;return t.updateProgress=function(e){var t=Date.now(),n=(t-this.lastUpdateTime)/1e3,r=e-this.lastUploadedSize;if(this.uploadedSize=e,n>0&&r>0){this.recentSpeeds.push(r/n),this.recentSpeeds.length>this.maxRecentSpeeds&&this.recentSpeeds.shift();var o=this.recentSpeeds.reduce(function(e,t){return e+t},0)/this.recentSpeeds.length;this.speedEMA=null===this.speedEMA?o:this.emaFactor*o+(1-this.emaFactor)*this.speedEMA}this.lastUpdateTime=t,this.lastUploadedSize=e;var i,s=this.uploadedSize/this.estimatedTotalSize,a=(t-this.startTime)/1e3,l=this.speedEMA&&this.speedEMA>0?this.speedEMA:this.uploadedSize/a;return i=l>0?(this.estimatedTotalSize-this.uploadedSize)/l:Infinity,this.smoothedRemainingTime=s>=this.initialEstimateThreshold?null===this.smoothedRemainingTime?i:.9*this.smoothedRemainingTime+.1*i:a/s-a,this.smoothedRemainingTime=Math.max(this.smoothedRemainingTime,(this.estimatedTotalSize-this.uploadedSize)/l),{progress:100*s,estimatedTimeRemaining:Math.round(this.smoothedRemainingTime),estimatedTimeRemainingString:this.smoothedRemainingTime>3?this.__formatTime(this.smoothedRemainingTime):"few seconds"}},t.__formatTime=function(e){if(!isFinite(e)||e>86400)return"Calculating...";if(e<60)return Math.round(e)+"sec";var t=Math.floor(e/60);return t<60?t+"min":Math.floor(t/60)+"h "+t%60+"min"},e}();function Kt(e,t,n){if(!e.s){if(n instanceof Vt){if(!n.s)return void(n.o=Kt.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Kt.bind(null,e,t),Kt.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Vt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Kt(r,1,i(this.v))}catch(e){Kt(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Kt(r,1,t?t(o):o):n?Kt(r,1,n(o)):Kt(r,2,o)}catch(e){Kt(r,2,e)}},r},e}();function $t(e){return e instanceof Vt&&1&e.s}function Gt(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!$t(a))return void a.then(s,o||(o=Kt.bind(null,r=new Vt,2)));a=a.v}r?Kt(r,1,a):r=a}catch(e){Kt(r||(r=new Vt),2,e)}}(),r}function Xt(e,t,n){for(var r;;){var o=e();if($t(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!$t(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!$t(s)){r=2;break}}}var a=new Vt,l=Kt.bind(null,a,2);return(0===r?o.then(c):1===r?i.then(u):s.then(f)).then(void 0,l),a;function u(r){i=r;do{if(t&&(s=t())&&s.then&&!$t(s))return void s.then(f).then(void 0,l);if(!(o=e())||$t(o)&&!o.v)return void Kt(a,1,i);if(o.then)return void o.then(c).then(void 0,l);$t(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,l)}function c(e){e?(i=n())&&i.then?i.then(u).then(void 0,l):u(i):Kt(a,1,i)}function f(){(o=e())?o.then?o.then(c).then(void 0,l):c(o):Kt(a,1,i)}}var Qt=[];new Array,"undefined"==typeof Symbol||Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")),globalThis.Buffer=t;var Yt=function(e){try{return Promise.resolve(function(e){try{var t=new URL((e.endpoint||"https://cloud.needle.tools/api")+"/v1/list/deployments");return t.searchParams.append("offset",e.offset.toString()),t.searchParams.append("limit",e.limit.toString()),e.names&&t.searchParams.append("name",e.names.map(function(e){return e.trim()}).join(",")),Promise.resolve(fetch(t,{method:"GET",headers:i({},n({authToken:e.token,org:e.org}))})).then(function(e){var t;function n(n){return t?n:Promise.resolve(e.json())}var r=function(){if(!e.ok){var n=e.status;return Promise.resolve(e.text()).then(function(e){return t=1,{status:n,error:e}})}}();return r&&r.then?r.then(n):n(r)})}catch(e){return Promise.reject(e)}}({endpoint:e.endpoint||"https://cloud.needle.tools/api",token:e.token,offset:e.offset||0,limit:e.limit||10}).catch(function(e){return e})).then(function(e){return!e||e instanceof Error?[]:e.deployments.map(function(e){return{name:e.name,url:e.url}})})}catch(e){return Promise.reject(e)}};function Zt(e,t){var r=e.map(function(e){return function(e,t){var n;void 0===t&&(t=null),"object"==typeof(n=e)&&"string"==typeof n.name&&"string"==typeof n.mimetype&&(e=new File([e.buffer],e.name,{type:e.mimetype}));var r=e;return null==t&&(t=e.webkitRelativePath||""),r.path=t+e.name,r}(e)});return console.debug("Upload",t.name,r),function(e,t,r){void 0===r&&(r=void 0);try{var s=function(e,t,r){void 0===r&&(r=void 0);try{var s,u=t.files,c=(null==(s=r)?void 0:s.loglevel)||"none";if(!u.length)return console.error("No files to upload"),Promise.resolve({success:!1,error:"No files to upload"});if(!t.entrypoint){var f=function(e){var t=null,n="",r=e.filter(function(e){return e.name.endsWith("package.json")});if(1===r.length)return r[0];if(r.length>1)return n="Invalid upload: Multiple package.json files found. This is currently not supported.",console.error(n,r),{error:n};var i=e.filter(function(e){return"index.html"===e.name.toLowerCase()||"index.html.gz"===e.name.toLowerCase()||"index.html.br"===e.name.toLowerCase()});if(1===i.length)return i[0];i.length>1&&console.warn("Multiple index.html files found.");var s=e.filter(function(e){return e.name.toLowerCase().endsWith(".glb")||e.name.toLowerCase().endsWith(".gltf")||e.name.toLowerCase().endsWith(".vrm")});if(s.length>1){var a=function(e){for(var t,n=new Array,r=/(mesh_lod|image)_\d_(.{1,50})/,i=o(e);!(t=i()).done;){var s=t.value;if(!r.test(s.name)){var a=s.name.toLowerCase();(a.endsWith(".gltf")||a.endsWith(".vrm")||a.endsWith(".glb"))&&n.push(s)}}return 1==n.length?n[0]:Jt(n)}(s);return a?t=a:(n="Invalid upload: Multiple glb/glTF/vrm files found. This is currently not supported.",console.error(n,s.map(function(e){return e.path||e.name})),{error:n})}if(1===s.length)return s[0];var l=e.filter(function(e){return e.name.endsWith(".usdz")||e.name.endsWith(".usd")||e.name.endsWith(".usda")||e.name.endsWith(".usdc")});l.length>=1&&(t=Jt(l));var u=e.filter(function(e){return e.name.endsWith(".fbx")});if(u.length>1)return n="Invalid upload: Multiple fbx files found. This is currently not supported.",console.error(n,u),{error:n};if(1===u.length)return u[0];var c=e.filter(function(e){return e.name.endsWith(".obj")});return c.length>1?(n="Invalid upload: Multiple obj files found. This is currently not supported.",console.error(n,c),{error:n}):1===c.length?t=c[0]:t||{error:"No supported file to upload found..."}}(u);if(null==f)return Promise.resolve({success:!1,error:"No entrypoint file found"});if("object"==typeof f&&"error"in f)return Promise.resolve({success:!1,error:f.error});"info"===c&&console.log("Entrypoint: "+f.name),t.entrypoint=f}return t.entrypoint&&!u.includes(t.entrypoint)&&u.push(t.entrypoint),Promise.resolve(function(e){try{var t,n=function(e){return t?e:{success:!0}};if(e.length>1e3)return Promise.resolve({success:!1,error:"Too many files. Maximum filecount is 1000"});var r=0,i=e.length-1,s=function(e,t,n){for(var r;;){var o=e();if(qt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!qt(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!qt(s)){r=2;break}}}var a=new It,l=Mt.bind(null,a,2);return(0===r?o.then(c):1===r?i.then(u):s.then(f)).then(void 0,l),a;function u(r){i=r;do{if(t&&(s=t())&&s.then&&!qt(s))return void s.then(f).then(void 0,l);if(!(o=e())||qt(o)&&!o.v)return void Mt(a,1,i);if(o.then)return void o.then(c).then(void 0,l);qt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,l)}function c(e){e?(i=n())&&i.then?i.then(u).then(void 0,l):u(i):Mt(a,1,i)}function f(){(o=e())?o.then?o.then(c).then(void 0,l):c(o):Mt(a,1,i)}}(function(){return!t&&i>=0},function(){return i--},function(){var n=e[i];return(r+=n.size)>157286400?(t=1,{success:!1,error:"Total file size exceeds limit of 150 MB. Please reduce the size of your upload."}):".ds_store"===n.name.toLocaleLowerCase()?(console.log("🚫 Remove .DS_Store file from upload"),void e.splice(i,1)):function(){if(n.name.endsWith(".gltf"))return console.log("Found glTF file "+n.name+". Will check if all dependencies are available\n",e),Promise.resolve(n.text()).then(function(r){var i,s,l=r.matchAll(/*#__PURE__*/a(/"uri"\s*:\s*"(.*?)"/g,{value:1}));if(l){var u=JSON.parse(r);if("2.0"!==u.asset.version)return console.warn("⚠ glTF version is not 2.0. This is currently not supported."),t=1,{success:!1,error:"glTF version "+u.asset.version+" is unsupported.Please use glTF 2.0."};for(var c,f=null==(i=n.path)?void 0:i.split("/"),d=f.splice(0,f.length-1).join("/"),h=o(l);!(c=h()).done;){var p,m=null==(p=c.value.groups)?void 0:p.value;if(m){var g=!1;if(m.startsWith("http://")||m.startsWith("https://")||m.startsWith("www.")){console.log("āœ… Found remote dependency "+m+" ");break}if(m.startsWith("data:")){console.log("āœ… Found embedded dependency "+m+" ");break}var v=(d+"/"+(s=m,s.includes("\\u")?JSON.parse('"'+s+'"'):decodeURIComponent(s))).split("/").reduce(function(e,t){return"."===t||(".."===t?e.pop():null!=t&&t.length&&e.push(t)),e},[]).join("/");console.log('ā“ Check if local dependency exists "'+v+'"');for(var y,b=o(e);!(y=b()).done;){var w=y.value;if(w.webkitRelativePath===v||w.name==v){g=!0,console.log("āœ… Found dependency in name or webkit: "+w.name+" || "+w.webkitRelativePath+" ");break}if(w.path===v){g=!0,console.log("āœ… Found dependency in path: "+w.path+" ");break}}if(!g)return console.warn("⚠ Missing dependency "+m,d),t=1,{success:!1,error:"Missing resource: "+m}}}}})}()});return Promise.resolve(s&&s.then?s.then(n):n(s))}catch(e){return Promise.reject(e)}}(u)).then(function(o){var s,a,f,d,h,p,m,g,v;function y(o){return Promise.resolve(fetch(w+"/v1/upload/request",i({},l,{method:"POST",headers:E,body:JSON.stringify(x)})).catch(function(e){return"fetch failed"==e.message||"Failed to fetch"==e.message?"Network error. Make sure you are connected to the internet and "+w+" is reachable.":(console.error("Failed to begin upload\n",e),null)})).then(function(o){var s;function a(a){return s?a:Promise.resolve(o.json()).then(function(o){var s,a,f;function d(){return Promise.resolve(Promise.all(T).catch(function(e){var t;null!=(t=r)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),O=!0)})).then(function(){var t;function s(s){var a;if(t)return s;function f(t){var r;if(a)return t;function s(){var e;function t(t){return e?t:("none"!=c&&console.log("Upload complete"),Promise.resolve(d.json()).then(function(e){return{success:!0,type:e.type,uploadSkipped:!1,id:e.id,view_id:e.view_id,url:e.url,filesUploaded:u.length,totalSize:h}}))}if(!d)return console.error("Failed to complete upload"),{success:!1,error:"Failed to complete upload"};var n=function(){if(!d.ok)return 524===d.status?(console.error("Failed to complete upload: Gateway Timeout"),e=1,{success:!1,error:"Failed to complete upload: Gateway Timeout"}):Promise.resolve(d.text()).then(function(t){return console.error("Failed to complete upload ("+d.status+"): "+t),e=1,{success:!1,error:"Failed to complete upload"}})}();return n&&n.then?n.then(t):t(n)}g=!0,console.log("Upload Done: All files uploaded to "+o.id);var f=i({},n(e),{id:o.id});"none"!=c&&console.log("Completing upload - notify server");var d=null,p=0,m=Xt(function(){return!r&&p<5},function(){return p++},function(){return Promise.resolve(Dt(1e3*p)).then(function(){var e=AbortSignal.timeout(1e4+1e3*p);return Promise.resolve(fetch(w+"/v1/upload/done",i({},l,{method:"POST",headers:f,signal:e})).catch(function(e){return console.error("Failed to complete upload",e.message),null})).then(function(e){var t,n;!0!==(null==(t=d=e)?void 0:t.ok)?"none"!=c&&p<4&&console.warn("Failed to complete upload ("+((null==(n=d)?void 0:n.status)||"no status")+"): will retry in 1 second"):r=1})})});return m&&m.then?m.then(s):s()}var d=function(t){if(null!=(t=r)&&null!=(t=t.abort)&&t.aborted)return Promise.resolve(xt({identifier:o.id,status:"canceled",status_message:"Upload aborted",error:"Upload aborted"},e)).then(function(){return a=1,{success:!1,error:"Upload aborted"}})}();return d&&d.then?d.then(f):f(d)}var a=function(){if(O)return Promise.resolve(xt({identifier:o.id,status:"failed",error:"Failed to upload files"},e)).then(function(){return t=1,{success:!1,error:"Failed to upload files"}})}();return a&&a.then?a.then(s):s(a)})}"debug"===c&&console.debug("BeginResponse",o);var h=u.reduce(function(e,t){return e+t.size},0);if("exists"===o.type)return"none"!=c&&console.log("Upload already exists",o.id),{success:!0,uploadSkipped:!0,id:o.id,type:o.job_type,view_id:o.view_id,filesUploaded:u.length,totalSize:h};var p=t.entrypoint.webkitRelativePath||t.entrypoint.name,m=0;null==(s=r)||null==(s=s.abort)||s.addEventListener("abort",function(){try{return console.log("Upload aborted: Cancelling upload"),Promise.resolve(fetch(w+"/v1/upload/cancel",i({},l,{method:"POST",headers:{authorization:S,id:o.id}}))).then(function(){})}catch(e){return Promise.reject(e)}});var g=!1;function v(t,n,r){if(void 0===r&&(r=!1),!r&&Date.now()-y<1e3)return!1;if(!g||"completed"===n){y=Date.now();var i=Math.floor(m/h*100);return"debug"===c&&console.log("SET STATUS: "+n,t,i),xt({identifier:o.id,status:n,status_message:t,progress:i},e),!0}"none"!=c&&console.warn("Invalid status update...")}var y=Date.now();null!=(a=r)&&a.onStart&&r.onStart(o.id,o.view_id);var b=Date.now(),E=new Ht(u.length,h/1024/1024),T=new Array,O=!1,R=Gt([].concat(u),function(t){var s;function a(){var e=function(){if(T.length>=10)return Promise.resolve(Promise.race(T)).then(function(){})}();if(e&&e.then)return e.then(function(){})}if(null!=(s=r)&&null!=(s=s.abort)&&s.aborted)return console.debug("Upload aborted"),void(f=1);if(O)return console.debug("Upload failed"),void(f=1);var d=function(){if(T.length<10){console.debug("Uploading file "+t+"/"+u.length+": "+u[t].name);var s=0,a=0,f=x.results.files[t],d=f.filename;return Promise.resolve(u[t].arrayBuffer()).then(function(g){var y=function(e){try{var t,r=function(t){var n;function r(e){var t=function(){if(!a)return console.error("Failed to upload file "+c),Promise.resolve(xt({identifier:o,status:"failed",status_message:"Failed to upload file "+c,error:"Failed to upload file "+c},y)).then(function(){throw new Error("Failed to upload file "+c)})}();return!t||!t.then||t.then(function(e){return!0})}if(null==x)throw new Error('Failed to get presigned url for "'+c+'" "'+p+'" \n'+T);var s=x.presigned_url,a=!1,h=0,m=Xt(function(){return!n&&h<5},function(){return h++},function(){function t(){var t;if(null!=b&&null!=(t=b.abort)&&t.aborted)throw new wt("Upload aborted");var r={"Content-Type":p,"Content-MD5":d};return w&&(r["Content-Encoding"]=w),Promise.resolve(bt.put(s,f,i({},l,{withCredentials:!1,signal:null==b?void 0:b.abort,headers:r,onUploadProgress:function(t){e.onProgress(t)}})).catch(function(e){return e instanceof wt||"none"!==v&&console.error("Failed to upload file",e),null})).then(function(e){if(e)return 200!==e.status?void console.debug("Failed ("+e.status+" "+e.status+") to upload file "+u.name+' to "'+x.path+'". Retrying...'):(a=!0,"info"===v?console.log("Uploaded file "+c+' to "'+x.path+'"'):console.debug("Uploaded "+u.name+' to "'+x.path+'"'),void(n=1))})}var r=function(){if(h>0)return Promise.resolve(Dt(1e3*h)).then(function(){})}();return r&&r.then?r.then(t):t()});return m&&m.then?m.then(r):r()},o=e.uploadId,s=e.uploadRequestPUTUrl,a=e.entrypointPath,u=e.file,c=e.fileName,f=e.fileBuffer,d=e.fileMd5,h=e.fileSize,p=e.fileType,m=e.fileIndex,g=e.fileCount,v=e.loglevel,y=e.args,b=e.options,w=void 0;u.name.endsWith(".gz")?w="gzip":u.name.endsWith(".br")&&(w="br"),"info"===v&&console.log('Uploading file "'+u.name+'" type='+p+" ("+h+") "+u.type+" with hash "+d);var S=i({},n(y),{"Content-Type":"application/json",org:y.org,job_id:o,filesize:h.toString(),progress:(m/g*100).toFixed(0)}),E=JSON.stringify({filename:c,entrypoint:a,"content-type":p,"content-md5":d,"content-encoding":w}),x=null,T="",O=0,R=Xt(function(){return!t&&O<5},function(){return O++},function(){var e;if(null==x){if(null!=b&&null!=(e=b.abort)&&e.aborted)throw new Error("Upload aborted");return Promise.resolve(Dt(200*O)).then(function(){return Promise.resolve(fetch(s,i({},l,{method:"POST",headers:S,body:E})).then(function(e){try{var t,n=function(n){return t?n:Promise.resolve(e.json())},r=function(){if(!e.ok)return Promise.resolve(e.text()).then(function(n){return T=n,console.log(s),console.warn('Failed to get presigned url for "'+c+'" "'+p+'" ('+e.status+").\n→ Retrying..."),t=1,null})}();return Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}).catch(function(e){return T=e.message,console.warn("Failed to get presigned url "+e.message+", retrying..."),null})).then(function(e){x=e})})}t=1});return Promise.resolve(R&&R.then?R.then(r):r())}catch(e){return Promise.reject(e)}}({uploadId:o.id,uploadRequestPUTUrl:o.request_put_url,entrypointPath:p,file:u[t],fileName:d,fileMd5:f.content_md5,fileBuffer:g,fileType:f.content_type,fileSize:f.content_length,fileIndex:t,fileCount:u.length,loglevel:c,args:e,options:r,onProgress:function(e){var n,o=e.progress||0,i=(s=u[t].size*o)-a;if(a=s,m+=i,null!=(n=r)&&n.progress){var l=m/h,c=u.length,f=u[t].size,p=(Date.now()-b)/1e3,g=E.updateProgress(m/1024/1024);r.progress({uploadedBytes:m,totalBytes:h,progress01:l,fileName:u[t].name,fileSize:f,fileProgress01:o,fileIndex:t,totalFiles:c,estimatedTimeLeftDisplay:g.estimatedTimeRemainingString,estimatedTimeLeft:g.estimatedTimeRemaining,elapsedTime:p}),v("Uploading ("+(t+1)+"/"+c+"): "+Lt(s)+" of "+d+" ("+Lt(u[t].size)+")","running",!1)}}}).then(function(e){if(!0!==e)return e;for(var n=T.length-1;n>=0;n--)T[n]===y&&T.splice(n,1);v("Uploaded "+Lt(m)+" of "+Lt(h)+" for "+u[t].name,"running")}).catch(function(e){var t;null!=(t=r)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),O=!0)});T.push(y)})}}();return d&&d.then?d.then(a):a()},function(){return f});return R&&R.then?R.then(d):d()})}if(null===o||"string"==typeof o)return{success:!1,error:o||"Failed to begin upload"};var f=function(){if(!o.ok)return Promise.resolve(o.text()).then(function(e){if(e.startsWith("{")){var t=JSON.parse(e);if("error"in t)return s=1,{success:!1,status:o.status,error:t.error}}return"none"!=c&&console.error("Failed to begin upload\n",o.status,e),s=1,{success:!1,error:"Failed to begin upload ("+o.status+"): "+e}})}();return f&&f.then?f.then(a):a(f)})}if("error"in o)return{success:!1,error:o.error||"Failed to validate files"};(null!=(s=t.entrypoint)&&s.name.endsWith(".html")||null!=(a=t.entrypoint)&&a.name.endsWith(".html.gz")||null!=(f=t.entrypoint)&&f.name.endsWith(".html.br"))&&(r||(r={}),r.type="deployment"),u.sort(function(e,t){return e.name.includes(".needle")&&!t.name.includes(".needle")?-1:!e.name.includes(".needle")&&t.name.includes(".needle")?1:0});var b,w=e.baseUrl,S="Bearer "+e.authToken,E=i({},n(e),{triggered_by:t.triggered_by,filename:null==(d=t.entrypoint)?void 0:d.name,"total-files":u.length.toString(),"total-files-size":u.reduce(function(e,t){return e+t.size},0).toString()});null!=(h=r)&&h.view_id&&(E.view_id=r.view_id),null!=(p=r)&&p.type&&(E.type=r.type),null!=(m=r)&&m.name&&(E.name=null==(b=r)?void 0:b.name);var x={results:{entrypoint:(null==(g=t.entrypoint)?void 0:g.path)||(null==(v=t.entrypoint)?void 0:v.name),files:[]}},T=Gt(u,function(e){var t,n=u[e],o=n.path||n.webkitRelativePath||n.name;if(null!=(t=o)&&t.includes(":"))throw new Error("Invalid filename: "+o);return Promise.resolve(n.arrayBuffer()).then(function(e){var t,i,s,a,l,u=n.size,c=n.type;if(null!=(t=c)&&t.length&&"unknown"!==c.toLowerCase()||(c=function(e,t){void 0===t&&(t=void 0);var n=function(e,{extra:t=!1,hint:n}={}){const r=new Uint8Array(e.slice(0,kt));if(n){const e=function(e,{ext:t,mime:n}){return t||n?zt(e).filter(e=>e[0]===t||e[1]===n):[]}(Wt,n);if(e.length>0){const t=Nt(r,e);if(void 0!==t)return t}}return Nt(r,Wt)||(t?function(e){return function(e){try{const t=At(e);if(!function(e){for(let t=0;t<e.length;t++)try{const n=e.charCodeAt(t);if(65533===n||n<=8)return!1}catch{return!1}return!0}(t))return;try{return JSON.parse(t),{ext:"json",mime:"application/json"}}catch{return{ext:"txt",mime:"text/plain"}}}catch{return}}(e)}(e):void 0)}(e);if(n)return n.mime;for(var r=new Uint8Array(e).subarray(0,4),o="",i=0;i<r.length;i++)o+=r[i].toString(16);var s="unknown";switch(o){case"676c5446":s="model/gltf-binary";break;case"89504e47":s="image/png";break;case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":case"ffd8ffe3":case"ffd8ffe8":s="image/jpeg";break;default:s="unknown"}if("unknown"===s&&"string"==typeof t){var a=t.toLowerCase();a.endsWith(".html")||a.endsWith(".html.gz")?s="text/html":a.endsWith(".js")||a.endsWith(".js.gz")?s="application/javascript":a.endsWith(".wasm")?s="application/wasm":a.endsWith(".css")?s="text/css":a.endsWith(".json")?s="application/json":a.endsWith(".txt")?s="text/plain":a.endsWith(".bin")?s="application/octet-stream":a.endsWith(".png")?s="image/png":a.endsWith(".jpg")||a.endsWith(".jpeg")?s="image/jpeg":a.endsWith(".gif")?s="image/gif":a.endsWith(".webp")?s="image/webp":a.endsWith(".svg")?s="image/svg+xml":a.endsWith(".glb")?s="model/gltf-binary":a.endsWith(".gltf")?s="model/gltf+json":a.endsWith(".vrm")?s="model/gltf-binary":a.endsWith(".usdz")?s="model/vnd.usdz+zip":a.endsWith(".usda")?s="model/vnd.usd-usda":a.endsWith(".usdc")?s="model/vnd.usd-usdc":a.endsWith(".usd")?s="model/vnd.usd-usd":a.endsWith(".mtl")?s="model/mtl":a.endsWith(".obj")?s="model/obj":a.endsWith(".fbx")&&(s="model/vnd.autodesk.fbx")}return s}(e,o)),"deployment"===(null==(i=r)?void 0:i.type)){var f=(a=c,l=(s=o).toLowerCase(),"application/gzip"===a||"application/brotli"===a?(l.endsWith(".html.gz")||l.endsWith(".html.br")?(a="text/html",s=s.substring(0,s.length-3)):l.endsWith(".js.gz")||l.endsWith(".js.br")||l.endsWith(".mjs.gz")||l.endsWith(".mjs.br")?(a="application/javascript",s=s.substring(0,s.length-3)):l.endsWith(".css.gz")||l.endsWith(".css.br")?(a="text/css",s=s.substring(0,s.length-3)):l.endsWith(".json.gz")||l.endsWith(".json.br")?(a="text/json",s=s.substring(0,s.length-3)):l.endsWith(".txt.gz")||l.endsWith(".txt.br")?(a="text/plain",s=s.substring(0,s.length-3)):l.endsWith(".wasm.gz")||l.endsWith(".wasm.br")?(a="application/wasm",s=s.substring(0,s.length-3)):l.endsWith(".bin.gz")||l.endsWith(".bin.br")?(a="application/octet-stream",s=s.substring(0,s.length-3)):l.endsWith(".png.gz")||l.endsWith(".png.br")?(a="image/png",s=s.substring(0,s.length-3)):l.endsWith(".jpg.gz")||l.endsWith(".jpg.br")||l.endsWith(".jpeg.gz")||l.endsWith(".jpeg.br")?(a="image/jpeg",s=s.substring(0,s.length-3)):l.endsWith(".gif.gz")||l.endsWith(".gif.br")?(a="image/gif",s=s.substring(0,s.length-3)):l.endsWith(".webp.gz")||l.endsWith(".webp.br")?(a="image/webp",s=s.substring(0,s.length-3)):l.endsWith(".svg.gz")||l.endsWith(".svg.br")?(a="image/svg+xml",s=s.substring(0,s.length-3)):l.endsWith(".ico.gz")||l.endsWith(".ico.br")?(a="image/x-icon",s=s.substring(0,s.length-3)):l.endsWith(".webm.gz")||l.endsWith(".webm.br")?(a="video/webm",s=s.substring(0,s.length-3)):l.endsWith(".mp4.gz")||l.endsWith(".mp4.br")?(a="video/mp4",s=s.substring(0,s.length-3)):l.endsWith(".mov.gz")||l.endsWith(".mov.br")?(a="video/quicktime",s=s.substring(0,s.length-3)):l.endsWith(".mp3.gz")||l.endsWith(".mp3.br")?(a="audio/mpeg",s=s.substring(0,s.length-3)):l.endsWith(".wav.gz")||l.endsWith(".wav.br")?(a="audio/wave",s=s.substring(0,s.length-3)):l.endsWith(".ogg.gz")||l.endsWith(".ogg.br")?(a="audio/ogg",s=s.substring(0,s.length-3)):l.endsWith(".flac.gz")||l.endsWith(".flac.br")?(a="audio/flac",s=s.substring(0,s.length-3)):l.endsWith(".glb.gz")||l.endsWith(".glb.br")?(a="model/gltf-binary",s=s.substring(0,s.length-3)):l.endsWith(".gltf.gz")||l.endsWith(".gltf.br")?(a="model/gltf+json",s=s.substring(0,s.length-3)):l.endsWith(".vrm.gz")||l.endsWith(".vrm.br")?(a="model/gltf-binary",s=s.substring(0,s.length-3)):l.endsWith(".usdz.gz")||l.endsWith(".usdz.br")?(a="model/vnd.usdz+zip",s=s.substring(0,s.length-3)):l.endsWith(".obj.gz")||l.endsWith(".obj.br")?(a="model/obj",s=s.substring(0,s.length-3)):(l.endsWith(".mtl.gz")||l.endsWith(".mtl.br"))&&(a="model/mtl",s=s.substring(0,s.length-3)),{filename:s,mimetype:a}):null);f&&(o=f.filename,c=f.mimetype)}var d=Bt(e);x.results.files.push({filename:o,content_type:c,content_length:u,content_md5:d})})},function(){});return T&&T.then?T.then(y):y()})}catch(e){return Promise.reject(e)}}(e,t,r);return Qt.push(s),Promise.resolve(s.finally(function(){var e=Qt.indexOf(s);e>=0&&Qt.splice(e,1)}))}catch(e){return Promise.reject(e)}}({baseUrl:t.endpoint||"https://cloud.needle.tools/api",authToken:t.token},{triggered_by:"web",entrypoint:void 0,files:r},{name:t.name,abort:t.abort}).then(function(e){return"error"in e?{error:e.error}:{job_id:e.id,view_id:e.view_id,url:e.url,skipped:e.uploadSkipped}})}function en(e){"limit"in e&&(e.limit=Math.min(100,e.limit));var t="page"in e;return function(e,t){void 0===t&&(t={sort_by_upload:!0,page:1,limit:20,view_id:void 0,type:"upload"});try{if(t.page<=0)throw new Error("Invalid page. Must be greater than 0");var r=e.baseUrl+"/v1/list/uploads",o=i({type:t.type||"upload",max:(t.limit||0).toString(),page:(t.page||1).toString()},n(e));return null!=t.view_id&&(o.view_id=t.view_id),null!=t.view_name&&(o.view_name=t.view_name),Promise.resolve(fetch(r,i({},l,{method:"GET",headers:o})).then(function(e){try{var n=function(n){return void 0===t.sort_by_upload&&(t.sort_by_upload=!0),Promise.resolve(e.json()).then(function(e){return t.sort_by_upload&&e.uploads.sort(function(e,t){return new Date(t.created_time).getTime()-new Date(e.created_time).getTime()}),e})},r=function(){if(!e.ok)return Promise.resolve(e.text()).then(function(t){throw new Error("Failed to list uploads ("+e.status+"): "+t)})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}}({baseUrl:e.endpoint||"https://cloud.needle.tools/api",authToken:e.token},{view_name:"name"in e?e.name:void 0,view_id:"view_id"in e?e.view_id:void 0,type:"upload",page:t?e.page:1,limit:t?e.limit:100}).then(function(e){return e.uploads.map(function(e){return{name:e.name,created_at:e.created_time,updated_at:e.updated_time,thumbnail_url:e.thumbnail_url,files:e.jobs.map(function(e){return{created_at:e.created_at,updated_at:e.updated_at||e.created_at,type:e.type,status:e.status,name:e.name,url:e.url,size:e.size}})}})})}export{Yt as getDeployments,en as getUploads,Zt as uploadFiles};
2
2
  //# sourceMappingURL=index.esm.js.map