needle-cloud 1.1.0-alpha ā 1.1.0-alpha.1
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 from"@logto/browser";import t,{Buffer as n}from"buffer";var r={};r.baseUrl=window.location.origin,r.redirectUri=""+r.baseUrl,r.postSignOutRedirectUri=""+r.baseUrl;var o,i="https://cloud.needle.tools/api",s=null,a=null;r.ready=function(){return a?a.then(function(){return!0}):Promise.reject(new Error("Auth not initialized"))},r.init=function(e){return a||(a=function(e){try{var t=function(){var e=d(!0);if(!e)return l().then(function(e){return!e||c().then(function(){return!0})});var t=new URL(window.location.href);return t.search=e,window.history.replaceState({},"",t.href),Promise.resolve(!0)};null!=e&&e.resource&&(i=e.resource);var n=function(){var e,t=new URL(window.location.href);if(t.searchParams.has("code")&&t.searchParams.has("state")&&null!=(e=t.searchParams.get("iss"))&&e.includes("https://auth.needle.tools/"))return p().handleSignInCallback(t.href).then(function(){var e=new URL(window.location.href);e.pathname=e.pathname.replace("callback",""),e.searchParams.delete("code"),e.searchParams.delete("state"),e.searchParams.delete("iss");var t=d();t&&(console.log("Restore query before login",t,"Current:",e.search),e.search=t),window.history.replaceState({},"",e.href)}).catch(function(e){console.error(e)})}(),r=function(){if(n instanceof Promise)return Promise.resolve(n.then(function(e){return!0})).then(function(){})}();return Promise.resolve(r&&r.then?r.then(t):t())}catch(e){return Promise.reject(e)}}(e))},r.isAuthenticated=function(){return o},r.checkIsAuthenticated=function(){return p().isAuthenticated().then(function(e){return o=e,e})};var l=r.checkIsAuthenticated;r.getUserInfo=function(){return s},r.getUserId=function(){return s?s.sub:null},r.getName=function(){return s?s.username?s.username:s.name?s.name:s.email?s.email.split("@")[0]:null:null};var u=null;r.requestUserInfo=function(){return u||(u=l().then(function(e){return e?p().fetchUserInfo().then(function(e){var t;return(null==e?void 0:e.sub)!=(null==(t=s)?void 0:t.sub)&&console.debug("Userinfo",e),s=e,e}):(s=null,null)}))};var c=r.requestUserInfo;function f(){sessionStorage.setItem("needle-auth:query",window.location.search)}function d(e){void 0===e&&(e=!0);var t=sessionStorage.getItem("needle-auth:query");return t?(e&&sessionStorage.removeItem("needle-auth:query"),t):""}r.requestAccessToken=function(){return p().getAccessToken(i)},r.signIn=function(){l().then(function(e){0==e&&(f(),p().signIn(r.redirectUri))})},r.signOut=function(){u=null,l().then(function(e){1==e&&(f(),p().signOut(r.postSignOutRedirectUri))})};var h=null;function p(){return h||(h=new e({endpoint:"https://auth.needle.tools/",appId:"2x82zzh5xuudmiotdy2ux",scopes:["read","write"],resources:[i]})),h}function m(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 g(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 v(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 g(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)?g(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 y(){return y=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},y.apply(null,arguments)}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function w(){w=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)),b(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&&b(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)},w.apply(this,arguments)}r.init().catch(function(e){console.error("Auth failed: "+e.message)});var S={credentials:"omit"};function E(e,t){return function(){return e.apply(t,arguments)}}const{toString:x}=Object.prototype,{getPrototypeOf:T}=Object,_=(R=Object.create(null),e=>{const t=x.call(e);return R[t]||(R[t]=t.slice(8,-1).toLowerCase())});var R;const O=e=>(e=e.toLowerCase(),t=>_(t)===e),P=e=>t=>typeof t===e,{isArray:j}=Array,A=P("undefined"),U=O("ArrayBuffer"),W=P("string"),C=P("function"),z=P("number"),F=e=>null!==e&&"object"==typeof e,k=e=>{if("object"!==_(e))return!1;const t=T(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},N=O("Date"),B=O("File"),L=O("Blob"),D=O("FileList"),M=O("URLSearchParams"),[I,q,J,H]=["ReadableStream","Request","Response","Headers"].map(O);function K(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),j(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 V(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 G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,$=e=>!A(e)&&e!==G,X=(Z="undefined"!=typeof Uint8Array&&T(Uint8Array),e=>Z&&e instanceof Z);var Z;const Q=O("HTMLFormElement"),Y=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ee=O("RegExp"),te=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};K(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)},ne="abcdefghijklmnopqrstuvwxyz",re="0123456789",oe={DIGIT:re,ALPHA:ne,ALPHA_DIGIT:ne+ne.toUpperCase()+re},ie=O("AsyncFunction"),se=(ae="function"==typeof setImmediate,le=C(G.postMessage),ae?setImmediate:le?(ue=`axios@${Math.random()}`,ce=[],G.addEventListener("message",({source:e,data:t})=>{e===G&&t===ue&&ce.length&&ce.shift()()},!1),e=>{ce.push(e),G.postMessage(ue,"*")}):e=>setTimeout(e));var ae,le,ue,ce;const fe="undefined"!=typeof queueMicrotask?queueMicrotask.bind(G):"undefined"!=typeof process&&process.nextTick||se;var de={isArray:j,isArrayBuffer:U,isBuffer:function(e){return null!==e&&!A(e)&&null!==e.constructor&&!A(e.constructor)&&C(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||C(e.append)&&("formdata"===(t=_(e))||"object"===t&&C(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&U(e.buffer),t},isString:W,isNumber:z,isBoolean:e=>!0===e||!1===e,isObject:F,isPlainObject:k,isReadableStream:I,isRequest:q,isResponse:J,isHeaders:H,isUndefined:A,isDate:N,isFile:B,isBlob:L,isRegExp:ee,isFunction:C,isStream:e=>F(e)&&C(e.pipe),isURLSearchParams:M,isTypedArray:X,isFileList:D,forEach:K,merge:function e(){const{caseless:t}=$(this)&&this||{},n={},r=(r,o)=>{const i=t&&V(n,o)||o;n[i]=k(n[i])&&k(r)?e(n[i],r):k(r)?e({},r):j(r)?r.slice():r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&K(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(K(t,(t,r)=>{e[r]=n&&C(t)?E(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&&T(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:_,kindOfTest:O,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(j(e))return e;let t=e.length;if(!z(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:Q,hasOwnProperty:Y,hasOwnProp:Y,reduceDescriptors:te,freezeMethods:e=>{te(e,(t,n)=>{if(C(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;C(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 j(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:V,global:G,isContextDefined:$,ALPHABET:oe,generateString:(e=16,t=oe.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&C(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(F(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=j(e)?[]:{};return K(e,(e,t)=>{const i=n(e,r+1);!A(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:ie,isThenable:e=>e&&(F(e)||C(e))&&C(e.then)&&C(e.catch),setImmediate:se,asap:fe};function he(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)}de.inherits(he,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:de.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const pe=he.prototype,me={};function ge(e){return de.isPlainObject(e)||de.isArray(e)}function ve(e){return de.endsWith(e,"[]")?e.slice(0,-2):e}function ye(e,t,n){return e?e.concat(t).map(function(e,t){return e=ve(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=>{me[e]={value:e}}),Object.defineProperties(he,me),Object.defineProperty(pe,"isAxiosError",{value:!0}),he.from=(e,t,n,r,o,i)=>{const s=Object.create(pe);return de.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),he.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const be=de.toFlatObject(de,{},null,function(e){return/^is[A-Z]/.test(e)});function we(e,t,n){if(!de.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=de.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!de.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&de.isSpecCompliantForm(t);if(!de.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(de.isDate(e))return e.toISOString();if(!a&&de.isBlob(e))throw new he("Blob is not supported. Use a Buffer instead.");return de.isArrayBuffer(e)||de.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(de.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(de.isArray(e)&&function(e){return de.isArray(e)&&!e.some(ge)}(e)||(de.isFileList(e)||de.endsWith(n,"[]"))&&(a=de.toArray(e)))return n=ve(n),a.forEach(function(e,r){!de.isUndefined(e)&&null!==e&&t.append(!0===s?ye([n],r,i):null===s?n:n+"[]",l(e))}),!1;return!!ge(e)||(t.append(ye(o,n,i),l(e)),!1)}const c=[],f=Object.assign(be,{defaultVisitor:u,convertValue:l,isVisitable:ge});if(!de.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!de.isUndefined(n)){if(-1!==c.indexOf(n))throw Error("Circular reference detected in "+r.join("."));c.push(n),de.forEach(n,function(n,i){!0===(!(de.isUndefined(n)||null===n)&&o.call(t,n,de.isString(i)?i.trim():i,r,f))&&e(n,r?r.concat(i):[i])}),c.pop()}}(e),t}function Se(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Ee(e,t){this._pairs=[],e&&we(e,this,t)}const xe=Ee.prototype;function Te(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _e(e,t,n){if(!t)return e;const r=n&&n.encode||Te,o=n&&n.serialize;let i;if(i=o?o(t,n):de.isURLSearchParams(t)?t.toString():new Ee(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}xe.append=function(e,t){this._pairs.push([e,t])},xe.toString=function(e){const t=e?function(t){return e.call(this,t,Se)}:Se;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var Re=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){de.forEach(this.handlers,function(t){null!==t&&e(t)})}},Oe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Pe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const je="undefined"!=typeof window&&"undefined"!=typeof document,Ae=(Ue="undefined"!=typeof navigator&&navigator.product,je&&["ReactNative","NativeScript","NS"].indexOf(Ue)<0);var Ue,We={__proto__:null,hasBrowserEnv:je,hasStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,hasStandardBrowserEnv:Ae,origin:je&&window.location.href||"http://localhost",...Pe};function Ce(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&&de.isArray(r)?r.length:i,a?(r[i]=de.hasOwnProp(r,i)?[r[i],n]:n,!s):(r[i]&&de.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&de.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(de.isFormData(e)&&de.isFunction(e.entries)){const n={};return de.forEachEntry(e,(e,r)=>{t(function(e){return de.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const ze={transitional:Oe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=de.isObject(e);if(o&&de.isHTMLForm(e)&&(e=new FormData(e)),de.isFormData(e))return r?JSON.stringify(Ce(e)):e;if(de.isArrayBuffer(e)||de.isBuffer(e)||de.isStream(e)||de.isFile(e)||de.isBlob(e)||de.isReadableStream(e))return e;if(de.isArrayBufferView(e))return e.buffer;if(de.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 we(e,new We.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return We.isNode&&de.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=de.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return we(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(de.isString(e))try{return(0,JSON.parse)(e),de.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ze.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(de.isResponse(e)||de.isReadableStream(e))return e;if(e&&de.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 he.from(e,he.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:We.classes.FormData,Blob:We.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};de.forEach(["delete","get","head","post","put","patch"],e=>{ze.headers[e]={}});var Fe=ze;const ke=de.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"]),Ne=Symbol("internals");function Be(e){return e&&String(e).trim().toLowerCase()}function Le(e){return!1===e||null==e?e:de.isArray(e)?e.map(Le):String(e)}function De(e,t,n,r,o){return de.isFunction(r)?r.call(this,t,n):(o&&(t=n),de.isString(t)?de.isString(r)?-1!==t.indexOf(r):de.isRegExp(r)?r.test(t):void 0:void 0)}class Me{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Be(t);if(!o)throw new Error("header name must be a non-empty string");const i=de.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Le(e))}const i=(e,t)=>de.forEach(e,(e,n)=>o(e,n,t));if(de.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(de.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]&&ke[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(de.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=Be(e)){const n=de.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(de.isFunction(t))return t.call(this,e,n);if(de.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Be(e)){const n=de.findKey(this,e);return!(!n||void 0===this[n]||t&&!De(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Be(e)){const o=de.findKey(n,e);!o||t&&!De(0,n[o],o,t)||(delete n[o],r=!0)}}return de.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&&!De(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return de.forEach(this,(r,o)=>{const i=de.findKey(n,o);if(i)return t[i]=Le(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]=Le(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return de.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&de.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[Ne]=this[Ne]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Be(e);t[r]||(function(e,t){const n=de.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 de.isArray(e)?e.forEach(r):r(e),this}}Me.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),de.reduceDescriptors(Me.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),de.freezeMethods(Me);var Ie=Me;function qe(e,t){const n=this||Fe,r=t||n,o=Ie.from(r.headers);let i=r.data;return de.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Je(e){return!(!e||!e.__CANCEL__)}function He(e,t,n){he.call(this,null==e?"canceled":e,he.ERR_CANCELED,t,n),this.name="CanceledError"}function Ke(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new he("Request failed with status code "+n.status,[he.ERR_BAD_REQUEST,he.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}de.inherits(He,he,{__CANCEL__:!0});const Ve=(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)},Ge=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},$e=e=>(...t)=>de.asap(()=>e(...t));var Xe=We.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=de.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0},Ze=We.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];de.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),de.isString(r)&&s.push("path="+r),de.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 Qe(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 Ye=e=>e instanceof Ie?{...e}:e;function et(e,t){t=t||{};const n={};function r(e,t,n){return de.isPlainObject(e)&&de.isPlainObject(t)?de.merge.call({caseless:n},e,t):de.isPlainObject(t)?de.merge({},t):de.isArray(t)?t.slice():t}function o(e,t,n){return de.isUndefined(t)?de.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!de.isUndefined(t))return r(void 0,t)}function s(e,t){return de.isUndefined(t)?de.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(Ye(e),Ye(t),!0)};return de.forEach(Object.keys(Object.assign({},e,t)),function(r){const i=l[r]||o,s=i(e[r],t[r],r);de.isUndefined(s)&&i!==a||(n[r]=s)}),n}var tt=e=>{const t=et({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:l}=t;if(t.headers=a=Ie.from(a),t.url=_e(Qe(t.baseURL,t.url),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),de.isFormData(r))if(We.hasStandardBrowserEnv||We.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(We.hasStandardBrowserEnv&&(o&&de.isFunction(o)&&(o=o(t)),o||!1!==o&&Xe(t.url))){const e=i&&s&&Ze.read(s);e&&a.set(i,e)}return t},nt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=tt(e);let o=r.data;const i=Ie.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=Ie.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ke(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 he("Request aborted",he.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new he("Network Error",he.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 he(t,(r.transitional||Oe).clarifyTimeoutError?he.ETIMEDOUT:he.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&de.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),de.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),f&&"json"!==f&&(m.responseType=r.responseType),h&&([l,c]=Ve(h,!0),m.addEventListener("progress",l)),d&&m.upload&&([a,u]=Ve(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new He(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===We.protocols.indexOf(v)?n(new he("Unsupported protocol "+v+":",he.ERR_BAD_REQUEST,e)):m.send(o||null)})},rt=(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 he?t:new He(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{o(new he(`timeout ${t} of ms exceeded`,he.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 ot=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},it=(e,t,n,r,o)=>{const i=async function*(e,t,n){for await(const r of e)yield*ot(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})},st="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,at=st&&"function"==typeof ReadableStream,lt=st&&("function"==typeof TextEncoder?(ut=new TextEncoder,e=>ut.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var ut;const ct=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},ft=at&&ct(()=>{let e=!1;const t=new Request(We.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),dt=at&&ct(()=>de.isReadableStream(new Response("").body)),ht={stream:dt&&(e=>e.body)};var pt;st&&(pt=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!ht[e]&&(ht[e]=de.isFunction(pt[e])?t=>t[e]():(t,n)=>{throw new he(`Response type '${e}' is not supported`,he.ERR_NOT_SUPPORT,n)})}));const mt={http:null,xhr:nt,fetch:st&&(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}=tt(e);u=u?(u+"").toLowerCase():"text";let h,p,[m,g]=o||i||s?rt([o,i],s):[];const v=()=>{!h&&setTimeout(()=>{m&&m.unsubscribe()}),h=!0};let y;try{if(l&&ft&&"get"!==n&&"head"!==n&&0!==(y=await(async(e,t)=>{const n=de.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:de.isBlob(e)?e.size:de.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:de.isArrayBufferView(e)||de.isArrayBuffer(e)?e.byteLength:(de.isURLSearchParams(e)&&(e+=""),de.isString(e)?(await lt(e)).byteLength:void 0))(t):n})(c,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(de.isFormData(r)&&(e=n.headers.get("content-type"))&&c.setContentType(e),n.body){const[e,t]=Ge(y,Ve($e(l)));r=it(n.body,65536,e,t,lt)}}de.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=dt&&("stream"===u||"response"===u);if(dt&&(a||i)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=o[t]});const t=de.toFiniteNumber(o.headers.get("content-length")),[n,r]=a&&Ge(t,Ve($e(a),!0))||[];o=new Response(it(o.body,65536,n,()=>{r&&r(),i&&v()},lt),e)}u=u||"text";let s=await ht[de.findKey(ht,u)||"text"](o,e);return!i&&v(),g&&g(),await new Promise((t,n)=>{Ke(t,n,{data:s,headers:Ie.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 he("Network Error",he.ERR_NETWORK,e,p),{cause:t.cause||t});throw he.from(t,t&&t.code,e,p)}})};de.forEach(mt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const gt=e=>`- ${e}`,vt=e=>de.isFunction(e)||null===e||!1===e;var yt=e=>{e=de.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,!vt(n)&&(r=mt[(t=String(n)).toLowerCase()],void 0===r))throw new he(`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 he("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(gt).join("\n"):" "+gt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function bt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new He(null,e)}function wt(e){return bt(e),e.headers=Ie.from(e.headers),e.data=qe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),yt(e.adapter||Fe.adapter)(e).then(function(t){return bt(e),t.data=qe.call(e,e.transformResponse,t),t.headers=Ie.from(t.headers),t},function(t){return Je(t)||(bt(e),t&&t.response&&(t.response.data=qe.call(e,e.transformResponse,t.response),t.response.headers=Ie.from(t.response.headers))),Promise.reject(t)})}const St={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{St[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Et={};St.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 he(r(o," has been removed"+(t?" in "+t:"")),he.ERR_DEPRECATED);return t&&!Et[o]&&(Et[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 xt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new he("options must be an object",he.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 he("option "+i+" must be "+n,he.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new he("Unknown option "+i,he.ERR_BAD_OPTION)}},validators:St};const Tt=xt.validators;class _t{constructor(e){this.defaults=e,this.interceptors={request:new Re,response:new Re}}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=et(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&xt.assertOptions(n,{silentJSONParsing:Tt.transitional(Tt.boolean),forcedJSONParsing:Tt.transitional(Tt.boolean),clarifyTimeoutError:Tt.transitional(Tt.boolean)},!1),null!=r&&(de.isFunction(r)?t.paramsSerializer={serialize:r}:xt.assertOptions(r,{encode:Tt.function,serialize:Tt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&de.merge(o.common,o[t.method]);o&&de.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Ie.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=[wt.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=wt.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 _e(Qe((e=et(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}de.forEach(["delete","get","head","options"],function(e){_t.prototype[e]=function(t,n){return this.request(et(n||{},{method:e,url:t,data:(n||{}).data}))}}),de.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(et(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}_t.prototype[e]=t(),_t.prototype[e+"Form"]=t(!0)});var Rt=_t;class Ot{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 He(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 Ot(function(t){e=t}),cancel:e}}}var Pt=Ot;const jt={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(jt).forEach(([e,t])=>{jt[t]=e});var At=jt;const Ut=function e(t){const n=new Rt(t),r=E(Rt.prototype.request,n);return de.extend(r,Rt.prototype,n,{allOwnKeys:!0}),de.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(et(t,n))},r}(Fe);Ut.Axios=Rt,Ut.CanceledError=He,Ut.CancelToken=Pt,Ut.isCancel=Je,Ut.VERSION="1.7.4",Ut.toFormData=we,Ut.AxiosError=he,Ut.Cancel=Ut.CanceledError,Ut.all=function(e){return Promise.all(e)},Ut.spread=function(e){return function(t){return e.apply(null,t)}},Ut.isAxiosError=function(e){return de.isObject(e)&&!0===e.isAxiosError},Ut.mergeConfig=et,Ut.AxiosHeaders=Ie,Ut.formToJSON=e=>Ce(de.isHTMLForm(e)?new FormData(e):e),Ut.getAdapter=yt,Ut.HttpStatusCode=At,Ut.default=Ut;var Wt=Ut;const{CanceledError:Ct}=Wt;var zt,Ft,kt=function(e,t){try{var n=t.baseUrl+"/v1/jobs/update",r=y({},m(t),{job_id:e.identifier,status:e.status});return Promise.resolve(fetch(n,y({},S,{method:"POST",headers:r,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)}},Nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Bt={__proto__:null,default:{}},Lt=(zt=function(e){!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=Nt:i&&(o=self);var a,l=!o.JS_MD5_NO_COMMON_JS&&e.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 e=w("hex");s&&(e=function(e){var r,i=Bt,s=t.Buffer;return r=s.from&&!o.JS_MD5_NO_BUFFER_FROM?s.from:function(e){return new s(e)},function(t){if("string"==typeof t)return i.createHash("md5").update(t,"utf8").digest("hex");if(null==t)throw new Error(n);return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),v(t)||y(t)||t.constructor===s?i.createHash("md5").update(r(t)).digest("hex"):e(t)}}(e)),e.create=function(){return new E},e.update=function(t){return e.create().update(t)};for(var r=0;r<h.length;++r){var i=h[r];e[i]=w(i)}return e}();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?e.exports=T:o.md5=T}()},zt(Ft={exports:{}}),Ft.exports);function Dt(e,t=0){return Jt(e,t,2).getUint16(0,!0)}function Mt(e,t=0){return Jt(e,t,4).getUint32(0,!0)}function It(e,t=0,n=e.byteLength){const r=e.slice(t,t+n);return Ht.decode(new Uint8Array(r))}function qt(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 Jt(e,t,n){const r=e.slice(t,t+n);return new DataView(new Uint8Array(r).buffer)}const Ht=new TextDecoder("utf8"),Kt=[["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 Vt(e){return e.flatMap(([e,t,n,r={},o=[]])=>[[e,t,n,r],...o])}function Gt(e,t){const n=Dt(e,26),r=It(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=Mt(e,18),r=Mt(e,22),o=Dt(e,28);if(n===r){const r=It(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 $t=function(e){return Vt(e).map(([e,t,n,{offset:r=0}={}])=>n.length+r).reduce((e,t)=>t>e?t:e,0)}(Kt);function Xt(e,t){for(const[n,r,o,{exact:i=!0,offset:s=0}={},a=[]]of t)if(qt(e,o,s)){if("zip"===n&&!i)return Gt(e.buffer,{ext:n,mime:r});if(!i&&a.length)for(const[t,n,r,{offset:o=0}={}]of a)if(qt(e,r,o))return{ext:t,mime:n};return{ext:n,mime:r}}}function Zt(e){var t=Lt.md5.create();return t.update(e),t.base64()}function Qt(e,t){void 0===t&&(t=void 0);var n=function(e,{extra:t=!1,hint:n}={}){const r=new Uint8Array(e.slice(0,$t));if(n){const e=function(e,{ext:t,mime:n}){return t||n?Vt(e).filter(e=>e[0]===t||e[1]===n):[]}(Kt,n);if(e.length>0){const t=Xt(r,e);if(void 0!==t)return t}}return Xt(r,Kt)||(t?function(e){return function(e){try{const t=It(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"}return"unknown"===s&&"string"==typeof t&&(s=Yt(t)),s}function Yt(e){var t=e.toLowerCase(),n="";return t.endsWith(".html")||t.endsWith(".html.gz")?n="text/html":t.endsWith(".js")||t.endsWith(".js.gz")?n="application/javascript":t.endsWith(".wasm")?n="application/wasm":t.endsWith(".css")?n="text/css":t.endsWith(".json")?n="application/json":t.endsWith(".txt")?n="text/plain":t.endsWith(".bin")?n="application/octet-stream":t.endsWith(".png")?n="image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?n="image/jpeg":t.endsWith(".gif")?n="image/gif":t.endsWith(".webp")?n="image/webp":t.endsWith(".svg")?n="image/svg+xml":t.endsWith(".glb")?n="model/gltf-binary":t.endsWith(".gltf")?n="model/gltf+json":t.endsWith(".vrm")?n="model/gltf-binary":t.endsWith(".usdz")?n="model/vnd.usdz+zip":t.endsWith(".usda")?n="model/vnd.usd-usda":t.endsWith(".usdc")?n="model/vnd.usd-usdc":t.endsWith(".usd")?n="model/vnd.usd-usd":t.endsWith(".mtl")?n="model/mtl":t.endsWith(".obj")?n="model/obj":t.endsWith(".fbx")?n="model/vnd.autodesk.fbx":t.endsWith(".stl")&&(n="model/stl"),n}function en(e,t,n){void 0===t&&(t=void 0),void 0===n&&(n=!0);var r=Math.abs(e);if(r>=1099511627776){var o=n?" TB":"";return(e/1099511627776).toFixed(void 0===t?2:t)+o}if(r>=1073741824){var i=n?" GB":"";return(e/1073741824).toFixed(void 0===t?2:t)+i}if(r>=1048576){var s=n?" MB":"";return(e/1048576).toFixed(void 0===t?1:t)+s}if(r>=1024){var a=n?" KB":"";return(e/1024).toFixed(void 0===t?0:t)+a}var l=n?" B":"";return e.toFixed(0)+l}"undefined"==typeof Symbol||Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"));var tn=function(e){try{return Promise.resolve(new Promise(function(t){return setTimeout(t,e)}))}catch(e){return Promise.reject(e)}},nn=/*#__PURE__*/w(/^image_(\d+)_|^mesh_lod_(\d+)_/,{image_lod:1,mesh_lod:2});function rn(e,t,n){if(!e.s){if(n instanceof on){if(!n.s)return void(n.o=rn.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(rn.bind(null,e,t),rn.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var on=/*#__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{rn(r,1,i(this.v))}catch(e){rn(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?rn(r,1,t?t(o):o):n?rn(r,1,n(o)):rn(r,2,o)}catch(e){rn(r,2,e)}},r},e}();function sn(e){return e instanceof on&&1&e.s}function an(e){return e.includes("\\u")?JSON.parse('"'+e+'"'):decodeURIComponent(e)}function ln(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 un=/*#__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 cn(e,t,n){if(!e.s){if(n instanceof fn){if(!n.s)return void(n.o=cn.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(cn.bind(null,e,t),cn.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}"undefined"==typeof Symbol||Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"));var fn=/*#__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{cn(r,1,i(this.v))}catch(e){cn(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?cn(r,1,t?t(o):o):n?cn(r,1,n(o)):cn(r,2,o)}catch(e){cn(r,2,e)}},r},e}();function dn(e){return e instanceof fn&&1&e.s}function hn(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(!dn(a))return void a.then(s,o||(o=cn.bind(null,r=new fn,2)));a=a.v}r?cn(r,1,a):r=a}catch(e){cn(r||(r=new fn),2,e)}}(),r}function pn(e,t,n){for(var r;;){var o=e();if(dn(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!dn(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!dn(s)){r=2;break}}}var a=new fn,l=cn.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&&!dn(s))return void s.then(f).then(void 0,l);if(!(o=e())||dn(o)&&!o.v)return void cn(a,1,i);if(o.then)return void o.then(c).then(void 0,l);dn(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):cn(a,1,i)}function f(){(o=e())?o.then?o.then(c).then(void 0,l):c(o):cn(a,1,i)}}var mn=[];new Array,globalThis.Buffer=n;var gn=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:y({},m({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 vn(e,t){var n=e.map(function(e){return function(e,t){if(void 0===t&&(t=null),"object"==typeof(r=e)&&"string"==typeof r.name&&"string"==typeof r.mimetype){var n=e.mimetype||Yt(e.name);e=new File([e.buffer],e.name,{type:n})}else e.type||(e=new File([e],e.name,{type:Yt(e.name)}));var r,o=e;return null==t&&(t=e.webkitRelativePath||""),o.path=t+e.name,o}(e)});return console.debug("Upload",t.name,n),function(e,t,n){void 0===n&&(n=void 0);try{var r=function(e,t,n){void 0===n&&(n=void 0);try{var r,o=t.files,i=(null==(r=n)?void 0:r.loglevel)||"none";if(!o.length)return"none"!=i&&console.error("No files to upload"),Promise.resolve({success:!1,error:"No files to upload"});if(!t.entrypoint){var s=function(e){var t=null,n="",r=e.filter(function(e){return"index.html"===e.name.toLowerCase()||"index.html.gz"===e.name.toLowerCase()||"index.html.br"===e.name.toLowerCase()});if(1===r.length)return r[0];r.length>1&&console.warn("Multiple index.html files found...");var o=e.filter(function(e){return e.name.toLowerCase().endsWith(".glb")||e.name.toLowerCase().endsWith(".gltf")||e.name.toLowerCase().endsWith(".vrm")});if(o.length>1){var i=function(e){for(var t,n=new Array,r=/(mesh_lod|image)_\d_(.{1,50})/,o=v(e);!(t=o()).done;){var i=t.value;if(!r.test(i.name)){var s=i.name.toLowerCase();(s.endsWith(".gltf")||s.endsWith(".vrm")||s.endsWith(".glb"))&&n.push(i)}}return 1==n.length?n[0]:ln(n)}(o);return i?t=i:(n="Invalid upload: Multiple glb/glTF/vrm files found. This is currently not supported.",console.error(n,o.map(function(e){return e.path||e.name})),{error:n})}if(1===o.length)return o[0];var s=e.filter(function(e){return e.name.toLowerCase().endsWith(".usdz")||e.name.toLowerCase().endsWith(".usd")||e.name.toLowerCase().endsWith(".usda")||e.name.toLowerCase().endsWith(".usdc")});s.length>=1&&(t=ln(s));var a=e.filter(function(e){return e.name.toLowerCase().endsWith(".fbx")});if(a.length>1)return n="Invalid upload: Multiple fbx files found. This is currently not supported.",console.error(n,a),{error:n};if(1===a.length)return a[0];var l=e.filter(function(e){return e.name.toLowerCase().endsWith(".obj")});if(l.length>1)return n="Invalid upload: Multiple obj files found. This is currently not supported.",console.error(n,l),{error:n};if(1===l.length)return l[0];var u=e.filter(function(e){return e.name.toLowerCase().endsWith(".stl")});if(u.length>1)return n="Invalid upload: Multiple stl files found. This is currently not supported.",console.error(n,u),{error:n};if(1===u.length)return u[0];if(1===e.length&&!e[0].arrayBuffer&&e[0].path.toLowerCase().startsWith("http"))return e[0];var c=e.filter(function(e){return e.name.toLowerCase().endsWith("package.json")});return 1===c.length?t=c[0]:c.length>1?(n="Invalid upload: Multiple package.json files found. This is currently not supported.",console.error(n,c),{error:n}):t||{error:"No supported file to upload found..."}}(o);if(null==s)return Promise.resolve({success:!1,error:"No entrypoint file found"});if("object"==typeof s&&"error"in s)return Promise.resolve({success:!1,error:s.error});"info"===i&&console.log("Entrypoint: "+s.name),t.entrypoint=s}return t.entrypoint&&!o.includes(t.entrypoint)&&o.push(t.entrypoint),Promise.resolve(function(e){try{var t,n=function(e){return t?e:{success:!0,vrm_count:o,gltf_count:i,glb_count:s}};if(e.length>5e3)return Promise.resolve({success:!1,error:"Too many files. Maximum filecount is 5000"});var r=0,o=0,i=0,s=0,a=e.length-1,l=function(e,t,n){for(var r;;){var o=e();if(sn(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!sn(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!sn(s)){r=2;break}}}var a=new on,l=rn.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&&!sn(s))return void s.then(f).then(void 0,l);if(!(o=e())||sn(o)&&!o.v)return void rn(a,1,i);if(o.then)return void o.then(c).then(void 0,l);sn(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):rn(a,1,i)}function f(){(o=e())?o.then?o.then(c).then(void 0,l):c(o):rn(a,1,i)}}(function(){return!t&&a>=0},function(){return a--},function(){var n=e[a];if((r+=n.size)>1073741824){var l={success:!1,error:"Total file size exceeds limit of "+1024..toFixed(0)+" MB. Please reduce the size of your upload."};return t=1,l}var u,c=n.name.toLocaleLowerCase();return".ds_store"===c?(console.log("š« Remove .DS_Store file from upload"),void e.splice(a,1)):(c.endsWith(".gltf")?i++:c.endsWith(".glb")?(u=c)&&nn.test(u)||s++:c.endsWith(".vrm")&&o++,function(){if(c.endsWith(".gltf"))return i+=1,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,i=r.matchAll(/*#__PURE__*/w(/"uri"\s*:\s*"(.*?)"/g,{value:1}));if(i){var s=JSON.parse(r);if("2.0"!==s.asset.version)return console.warn("ā glTF version is not 2.0. This is currently not supported."),t=1,{success:!1,error:"glTF version "+s.asset.version+" is unsupported.Please use glTF 2.0."};for(var a,l=null==(o=n.path)?void 0:o.split("/"),u=l.splice(0,l.length-1).join("/"),c=v(i);!(a=c()).done;){var f,d=null==(f=a.value.groups)?void 0:f.value;if(d){var h=!1;if(d.startsWith("http://")||d.startsWith("https://")||d.startsWith("www.")){console.log("ā
Found remote dependency "+d+" ");break}if(d.startsWith("data:")){console.log("ā
Found embedded dependency "+d+" ");break}var p=(u+"/"+an(d)).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 "'+p+'"');for(var m,g=v(e);!(m=g()).done;){var y=m.value;if(y.webkitRelativePath===p||y.name==p){h=!0,console.log("ā
Found dependency in name or webkit: "+y.name+" || "+y.webkitRelativePath+" ");break}if(y.path===p){h=!0,console.log("ā
Found dependency in path: "+y.path+" ");break}}if(!h)return console.warn("ā Missing dependency "+d,u),t=1,{success:!1,error:"Missing resource: "+d}}}}})}())});return Promise.resolve(l&&l.then?l.then(n):n(l))}catch(e){return Promise.reject(e)}}(o)).then(function(r){var s,a,l,u,c;function f(r){var s,a,l,u,f,d;if(c)return r;function h(r){return Promise.resolve(fetch(p+"/v1/upload/request",y({},S,{method:"POST",headers:v,body:JSON.stringify(b)})).catch(function(e){return"fetch failed"==e.message||"Failed to fetch"==e.message?"Network error. Make sure you are connected to the internet and "+p+" is reachable.":(console.error("Failed to begin upload\n",e),null)})).then(function(r){var s;function a(a){return s?a:Promise.resolve(r.json()).then(function(r){var s,a,l;function u(){return Promise.resolve(Promise.all(T).catch(function(e){var t;null!=(t=n)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),_=!0)})).then(function(){var t;function s(s){var a;if(t)return s;function l(t){var n;if(a)return t;function s(){var e;function t(t){return e?t:("none"!=i&&console.log("Upload complete"),Promise.resolve(u.json()).then(function(e){return{success:!0,type:e.type,uploadSkipped:!1,id:e.id,view_id:e.view_id,url:e.url,filesUploaded:o.length,totalSize:c}}))}if(!u)return console.error("Failed to complete upload"),{success:!1,error:"Failed to complete upload"};var n=function(){if(!u.ok)return 524===u.status?(console.error("Failed to complete upload: Gateway Timeout"),e=1,{success:!1,error:"Failed to complete upload: Gateway Timeout"}):Promise.resolve(u.text()).then(function(t){return console.error("Failed to complete upload ("+u.status+"): "+t),e=1,{success:!1,error:"Failed to complete upload"}})}();return n&&n.then?n.then(t):t(n)}h=!0,console.log("Upload Done: All files uploaded to "+r.id);var l=y({},m(e),{id:r.id});"none"!=i&&console.log("Completing upload - notify server");var u=null,f=0,d=pn(function(){return!n&&f<5},function(){return f++},function(){return Promise.resolve(tn(1e3*f)).then(function(){var e=AbortSignal.timeout(2e4+1e3*f);return Promise.resolve(fetch(p+"/v1/upload/done",y({},S,{method:"POST",headers:l,signal:e})).catch(function(e){return console.error("Failed to complete upload ("+(f+1)+" / 5)",e.message),null})).then(function(e){var t,r;!0!==(null==(t=u=e)?void 0:t.ok)?"none"!=i&&f<4&&console.warn("Failed to complete upload ("+((null==(r=u)?void 0:r.status)||"no status")+"): will retry in 1 second"):n=1})})});return d&&d.then?d.then(s):s()}var u=function(t){if(null!=(t=n)&&null!=(t=t.abort)&&t.aborted)return Promise.resolve(kt({identifier:r.id,status:"canceled",status_message:"Upload aborted",error:"Upload aborted"},e)).then(function(){return a=1,{success:!1,error:"Upload aborted"}})}();return u&&u.then?u.then(l):l(u)}var a=function(){if(_)return Promise.resolve(kt({identifier:r.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"===i&&console.debug("BeginResponse",r);var c=o.reduce(function(e,t){return e+t.size},0);if("exists"===r.type)return"none"!=i&&console.log("Upload already exists",r.id),{success:!0,uploadSkipped:!0,id:r.id,type:r.job_type,view_id:r.view_id,filesUploaded:o.length,totalSize:c,url:r.url};var f=t.entrypoint.webkitRelativePath||t.entrypoint.name,d=0;null==(s=n)||null==(s=s.abort)||s.addEventListener("abort",function(){try{return console.log("Upload aborted: Cancelling upload"),Promise.resolve(fetch(p+"/v1/upload/cancel",y({},S,{method:"POST",headers:{authorization:g,id:r.id}}))).then(function(){})}catch(e){return Promise.reject(e)}});var h=!1;function v(t,n,o){if(void 0===o&&(o=!1),!o&&Date.now()-w<1e3)return!1;if(!h||"completed"===n){w=Date.now();var s=Math.floor(d/c*100);return"debug"===i&&console.log("SET STATUS: "+n,t,s),kt({identifier:r.id,status:n,status_message:t,progress:s},e),!0}"none"!=i&&console.warn("Invalid status update...")}var w=Date.now();null!=(a=n)&&a.onStart&&n.onStart(r.id,r.view_id);var E=Date.now(),x=new un(o.length,c/1024/1024),T=new Array,_=!1,R=[].concat(o),O=o.length,P=hn(R,function(s){var a;function u(){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!=(a=n)&&null!=(a=a.abort)&&a.aborted)return console.debug("Upload aborted"),void(l=1);if(_)return console.debug("Upload failed"),void(l=1);var h=function(){if(T.length<10){console.debug("Uploading file "+s+"/"+o.length+": "+o[s].name);var a=0,l=0,u=b.results.files[s],h=u.filename;return Promise.resolve(o[s].arrayBuffer()).then(function(p){var g=u.content_length,b=u.content_type,w=o[s],R=w.name.endsWith(".gz")?"gzip":w.name.endsWith(".br")?"br":void 0,P=function(e){try{var t,n=function(t){var n;function o(e){var t=function(){if(!h)return console.error("Failed to upload file "+a),Promise.resolve(kt({identifier:r,status:"failed",status_message:"Failed to upload file "+a,error:"Failed to upload file "+a},b)).then(function(){throw new Error("Failed to upload file "+a)})}();return!t||!t.then||t.then(function(e){return!0})}if(null==_)throw new Error('Failed to get presigned url for "'+a+'" "'+f+'" \n'+R);var i=_.presigned_url,h=!1,m=0,x=pn(function(){return!n&&m<5},function(){return m++},function(){function t(){var t;if(null!=w&&null!=(t=w.abort)&&t.aborted)throw new Ct("Upload aborted");var r={"Content-Type":f,"Content-MD5":u};return E&&(r["Content-Length"]=c.toString()),d&&(r["Content-Encoding"]=d),0===m&&("none"!=v?console.log("Uploading file "+p+"/"+g+": "+a):console.debug("Uploading file "+p+"/"+g+": "+a)),Promise.resolve(Wt.put(i,l,y({},S,{withCredentials:!1,signal:null==w?void 0:w.abort,headers:r,onUploadProgress:function(t){e.onProgress(t)}})).catch(function(e){return e instanceof Ct||("none"!==v&&console.error("Failed to upload file (PUT) ("+p+", "+a+') "'+e.message+'"'),"debug"===v&&(console.log(r,{fileSize:c}),e.response?console.debug(e.response):console.debug(e))),null})).then(function(e){if(e)return 200!==e.status?void console.debug("Failed ("+e.status+" "+e.status+") to upload file "+s.name+' to "'+_.path+'". Retrying...'):(h=!0,"info"===v?console.log("Uploaded file "+p+"/"+g+' "'+a+'" ('+f+", "+en(c)+")"):console.debug("Uploaded file "+p+"/"+g+' "'+a+'" ('+f+", "+en(c)+")"),void(n=1))})}var r=function(){if(m>0)return"none"!==v&&console.log("Retry PUT #"+m+" for file "+a),Promise.resolve(tn(1e3*m)).then(function(){})}();return r&&r.then?r.then(t):t()});return x&&x.then?x.then(o):o()},r=e.uploadId,o=e.uploadRequestPUTUrl,i=e.entrypointPath,s=e.file,a=e.fileName,l=e.fileBuffer,u=e.fileMd5,c=e.fileSize,f=e.fileType,d=e.content_encoding,h=e.fileIndex,p=e.fileNumber,g=e.fileCount,v=e.loglevel,b=e.args,w=e.options,E=e.experimental;"info"===v&&console.log('Uploading file "'+s.name+'" type='+f+" ("+c+") "+s.type+" with hash "+u);var x=y({},m(b),{"Content-Type":"application/json",org:b.org,job_id:r,filesize:c.toString(),progress:(h/g*100).toFixed(0)}),T=JSON.stringify({filename:a,entrypoint:i,"content-type":f,"content-md5":u,"content-encoding":d}),_=null,R="",O=0,P=pn(function(){return!t&&O<5},function(){return O++},function(){var e;if(null==_){if(null!=w&&null!=(e=w.abort)&&e.aborted)throw new Error("Upload aborted");return Promise.resolve(tn(200*O)).then(function(){return Promise.resolve(fetch(o,y({},S,{method:"POST",headers:x,body:T})).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 R=n,console.log(o),console.warn('Failed to get presigned url for "'+a+'" "'+f+'" ('+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 R=e.message,console.warn("Failed to get presigned url "+e.message+", retrying..."),null})).then(function(e){_=e})})}t=1});return Promise.resolve(P&&P.then?P.then(n):n())}catch(e){return Promise.reject(e)}}({uploadId:r.id,uploadRequestPUTUrl:r.request_put_url,entrypointPath:f,file:o[s],fileName:h,fileMd5:u.content_md5,fileBuffer:p,fileType:b,content_encoding:R,fileSize:g,fileIndex:s,fileNumber:s+1,fileCount:O,loglevel:i,experimental:t.experimental,args:e,options:n,onProgress:function(e){var t,r=e.progress||0,i=(a=o[s].size*r)-l;if(l=a,d+=i,null!=(t=n)&&t.progress){var u=d/c,f=o.length,p=o[s].size,m=(Date.now()-E)/1e3,g=x.updateProgress(d/1024/1024);n.progress({uploadedBytes:d,totalBytes:c,progress01:u,fileName:o[s].name,fileSize:p,fileProgress01:r,fileIndex:s,totalFiles:f,estimatedTimeLeftDisplay:g.estimatedTimeRemainingString,estimatedTimeLeft:g.estimatedTimeRemaining,elapsedTime:m}),v("Uploading file "+(s+1)+"/"+f+" ("+h+"): "+(100*r).toFixed(0)+"% of "+en(c)+". Finished in approx. "+g.estimatedTimeRemainingString,"running",!1)}}}).then(function(e){if(!0!==e)return e;for(var t=T.length-1;t>=0;t--)T[t]===P&&T.splice(t,1);v("Uploaded "+en(d)+" of "+en(c)+" for "+o[s].name,"running")}).catch(function(e){var t;null!=(t=n)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),_=!0)});T.push(P)})}}();return h&&h.then?h.then(u):u()},function(){return l});return P&&P.then?P.then(u):u()})}if(null===r||"string"==typeof r)return{success:!1,error:r||"Failed to begin upload"};var l=function(){if(!r.ok)return Promise.resolve(r.text()).then(function(e){if(e.startsWith("{")){var t=JSON.parse(e);if("error"in t)return s=1,{success:!1,status:r.status,error:t.error}}return"none"!=i&&console.error("Failed to begin upload\n",r.status,e),s=1,{success:!1,status:r.status,error:""+e}})}();return l&&l.then?l.then(a):a(l)})}o.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 p=e.baseUrl,g="Bearer "+e.authToken,v=y({},m(e),{triggered_by:t.triggered_by,filename:""+encodeURIComponent(t.entrypoint.name),"total-files":o.length.toString(),"total-files-size":o.reduce(function(e,t){return e+t.size},0).toString()});null!=(s=n)&&s.view_id&&(v.view_id=n.view_id),null!=(a=n)&&a.type&&(v.type=n.type),null!=(l=n)&&l.name&&(v.name=encodeURIComponent(n.name)),null!=(u=n)&&u.parent_job_id&&(v.parent_job_id=n.parent_job_id);var b={results:{entrypoint:(null==(f=t.entrypoint)?void 0:f.path)||(null==(d=t.entrypoint)?void 0:d.name),files:[]}},w=hn(o,function(e){var t,r=o[e],i=r.path||r.webkitRelativePath||r.name;if(null!=(t=i)&&t.includes(":"))throw new Error("Invalid filename: "+i);return Promise.resolve(r.arrayBuffer()).then(function(e){var t,o,s,a,l,u=r.size,c=r.type;if(null!=(t=c)&&t.length&&"unknown"!==c.toLowerCase()||(c=Qt(e,i)),"deployment"===(null==(o=n)?void 0:o.type)){var f=(a=c,l=(s=i).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")||l.endsWith(".cjs.gz")||l.endsWith(".cjs.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&&(i=f.filename,c=f.mimetype)}var d=Zt(e);b.results.files.push({filename:i,content_type:c,content_length:u,content_md5:d})})},function(){});return w&&w.then?w.then(h):h()}if("error"in r)return{success:!1,error:r.error||"Failed to validate files"};if(null!=(s=t.entrypoint)&&s.name.endsWith(".htm")||null!=(a=t.entrypoint)&&a.name.endsWith(".html")||null!=(l=t.entrypoint)&&l.name.endsWith(".html.gz")||null!=(u=t.entrypoint)&&u.name.endsWith(".html.br"))n||(n={}),n.type="deployment";else if(r.vrm_count>10)return{success:!1,error:"Multiple model files found - this is not supported for asset uploads. Please upload a single model file only."};var d=function(){if(!t.raw)return hn(o,function(e){var r=o[e],i=r.name.toLowerCase();return function(){var s;if(i.endsWith(".html")||i.endsWith(".js")||i.endsWith(".css"))return"none"!==(null==(s=n)?void 0:s.loglevel)&&console.log("gZip compressing file: "+r.name),Promise.resolve(function(e){try{return Promise.resolve(import("./pako.esm-01431bd2.js")).then(function(t){return Promise.resolve(e.arrayBuffer()).then(function(n){var r=t.gzip(new Uint8Array(n)).buffer.slice(0);if(r.byteLength>51200&&r.byteLength>=n.byteLength){if(n.byteLength>0)return null}else if(!(r instanceof ArrayBuffer))return console.error("gzipCompress: Invalid ArrayBuffer"),{error:'Gzip compressing failed for "'+e.name+'" (unexpected result)'};return function(e,t,n){var r;void 0===n&&(n=void 0);var o=function(e,t,n){for(var r=0;;){var o=e.indexOf("\\",r);if(-1===o)break;r=o+1,e=e.replace("\\","/")}return e}(e).split("/").pop()||e,i=(null==(r=n)?void 0:r.type)||Qt(t,e),s=new File([t],o,{type:i});return s.path=e,s}(("path"in e?e.path:e.name)+".gz",r,{type:"application/gzip"})})})}catch(e){return Promise.reject(e)}}(r).catch(function(e){return{error:"Error compressing "+r.name+": "+e.message}})).then(function(i){var s;if(null!==i){if("error"in i)return c=1,{success:!1,error:i.error,status:500};if(!i)return c=1,{success:!1,error:"Failed to compress "+r.name,status:500};var a=t.entrypoint===r;o[e]=i,a&&(t.entrypoint=i),"none"!==(null==(s=n)?void 0:s.loglevel)&&console.log("gZip compressed file: "+r.name+" "+(a?"(entrypoint)":""))}else{var l;"none"!==(null==(l=n)?void 0:l.loglevel)&&console.error("Did not compress file: "+r.name)}})}()},function(){return c});"none"!=i&&console.warn("Raw upload - skipping gzip compression of files")}();return d&&d.then?d.then(f):f(d)})}catch(e){return Promise.reject(e)}}(e,t,n);return mn.push(r),Promise.resolve(r.finally(function(){var e=mn.indexOf(r);e>=0&&mn.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:n},{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 yn(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 n=e.baseUrl+"/v1/list/uploads",r=y({type:t.type||"upload",max:(t.limit||0).toString(),page:(t.page||1).toString()},m(e));return null!=t.view_id&&(r.view_id=t.view_id),null!=t.view_name&&(r.view_name=t.view_name),Promise.resolve(fetch(n,y({},S,{method:"GET",headers:r})).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.updated_time).getTime()-new Date(e.updated_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{r as Auth,gn as getDeployments,yn as getUploads,vn as uploadFiles};
|
|
1
|
+
import e,{Buffer as t}from"buffer";import n from"@logto/browser";globalThis.Buffer=t;var r,o="https://cloud.needle.tools/api",i=null,s=null,a=null,l=null,u={baseUrl:window.location.origin,redirectUri:window.location.origin,postSignOutRedirectUri:window.location.origin,ready:function(){return s?s.then(function(){return!0}):Promise.reject(new Error("Auth not initialized"))},init:function(e){return s||(s=function(e){try{var t=function(){var e=f(!0);if(!e)return u.checkIsAuthenticated().then(function(e){return!e||u.requestUserInfo().then(function(){return!0})});var t=new URL(window.location.href);return t.search=e,window.history.replaceState({},"",t.href),Promise.resolve(!0)};null!=e&&e.resource&&(o=e.resource);var n=function(){var e,t=new URL(window.location.href);if(t.searchParams.has("code")&&t.searchParams.has("state")&&null!=(e=t.searchParams.get("iss"))&&e.includes("https://auth.needle.tools/"))return d().handleSignInCallback(t.href).then(function(){var e=new URL(window.location.href);e.pathname=e.pathname.replace("callback",""),e.searchParams.delete("code"),e.searchParams.delete("state"),e.searchParams.delete("iss");var t=f();t&&(console.log("Restore query before login",t,"Current:",e.search),e.search=t),window.history.replaceState({},"",e.href)}).catch(function(e){console.error(e)})}(),r=function(){if(n instanceof Promise)return Promise.resolve(n.then(function(e){return!0})).then(function(){})}();return Promise.resolve(r&&r.then?r.then(t):t())}catch(e){return Promise.reject(e)}}(e))},isAuthenticated:function(){return r},checkIsAuthenticated:function(){return d().isAuthenticated().then(function(e){return r=e,e})},getUserInfo:function(){return i},getUserId:function(){return i?i.sub:null},getName:function(){return i?i.username?i.username:i.name?i.name:i.email?i.email.split("@")[0]:null:null},requestUserInfo:function(){return a||(a=u.checkIsAuthenticated().then(function(e){return e?d().fetchUserInfo().then(function(e){var t;return"undefined"!=typeof window&&"localhost"===window.location.hostname&&(null==e?void 0:e.sub)!=(null==(t=i)?void 0:t.sub)&&console.debug(e),i=e,e}):(i=null,null)}))},requestAccessToken:function(){return d().getAccessToken(o)},signIn:function(){u.checkIsAuthenticated().then(function(e){0==e&&(c(),d().signIn(u.redirectUri))})},signOut:function(){a=null,u.checkIsAuthenticated().then(function(e){1==e&&(c(),d().signOut(u.postSignOutRedirectUri))})}};function c(){sessionStorage.setItem("needle-auth:query",window.location.search)}function f(e){void 0===e&&(e=!0);var t=sessionStorage.getItem("needle-auth:query");return t?(e&&sessionStorage.removeItem("needle-auth:query"),t):""}function d(){return l||(l=new n({endpoint:"https://auth.needle.tools/",appId:"2x82zzh5xuudmiotdy2ux",scopes:["read","write"],resources:[o]})),l}function h(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 p(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 m(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 p(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)?p(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 g(){return g=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},g.apply(null,arguments)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function y(){y=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)),v(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&&v(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)},y.apply(this,arguments)}var b={credentials:"omit"};function w(e,t){return function(){return e.apply(t,arguments)}}const{toString:S}=Object.prototype,{getPrototypeOf:E}=Object,x=(T=Object.create(null),e=>{const t=S.call(e);return T[t]||(T[t]=t.slice(8,-1).toLowerCase())});var T;const _=e=>(e=e.toLowerCase(),t=>x(t)===e),R=e=>t=>typeof t===e,{isArray:O}=Array,P=R("undefined"),j=_("ArrayBuffer"),A=R("string"),U=R("function"),W=R("number"),C=e=>null!==e&&"object"==typeof e,z=e=>{if("object"!==x(e))return!1;const t=E(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},F=_("Date"),k=_("File"),N=_("Blob"),B=_("FileList"),L=_("URLSearchParams"),[D,M,I,q]=["ReadableStream","Request","Response","Headers"].map(_);function J(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),O(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 H(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 K="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,V=e=>!P(e)&&e!==K,G=($="undefined"!=typeof Uint8Array&&E(Uint8Array),e=>$&&e instanceof $);var $;const X=_("HTMLFormElement"),Z=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Q=_("RegExp"),Y=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};J(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)},ee="abcdefghijklmnopqrstuvwxyz",te="0123456789",ne={DIGIT:te,ALPHA:ee,ALPHA_DIGIT:ee+ee.toUpperCase()+te},re=_("AsyncFunction"),oe=(ie="function"==typeof setImmediate,se=U(K.postMessage),ie?setImmediate:se?(ae=`axios@${Math.random()}`,le=[],K.addEventListener("message",({source:e,data:t})=>{e===K&&t===ae&&le.length&&le.shift()()},!1),e=>{le.push(e),K.postMessage(ae,"*")}):e=>setTimeout(e));var ie,se,ae,le;const ue="undefined"!=typeof queueMicrotask?queueMicrotask.bind(K):"undefined"!=typeof process&&process.nextTick||oe;var ce={isArray:O,isArrayBuffer:j,isBuffer:function(e){return null!==e&&!P(e)&&null!==e.constructor&&!P(e.constructor)&&U(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||U(e.append)&&("formdata"===(t=x(e))||"object"===t&&U(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&j(e.buffer),t},isString:A,isNumber:W,isBoolean:e=>!0===e||!1===e,isObject:C,isPlainObject:z,isReadableStream:D,isRequest:M,isResponse:I,isHeaders:q,isUndefined:P,isDate:F,isFile:k,isBlob:N,isRegExp:Q,isFunction:U,isStream:e=>C(e)&&U(e.pipe),isURLSearchParams:L,isTypedArray:G,isFileList:B,forEach:J,merge:function e(){const{caseless:t}=V(this)&&this||{},n={},r=(r,o)=>{const i=t&&H(n,o)||o;n[i]=z(n[i])&&z(r)?e(n[i],r):z(r)?e({},r):O(r)?r.slice():r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&J(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(J(t,(t,r)=>{e[r]=n&&U(t)?w(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&&E(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:x,kindOfTest:_,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(O(e))return e;let t=e.length;if(!W(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:X,hasOwnProperty:Z,hasOwnProp:Z,reduceDescriptors:Y,freezeMethods:e=>{Y(e,(t,n)=>{if(U(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;U(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 O(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:H,global:K,isContextDefined:V,ALPHABET:ne,generateString:(e=16,t=ne.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&U(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(C(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=O(e)?[]:{};return J(e,(e,t)=>{const i=n(e,r+1);!P(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:re,isThenable:e=>e&&(C(e)||U(e))&&U(e.then)&&U(e.catch),setImmediate:oe,asap:ue};function fe(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)}ce.inherits(fe,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:ce.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const de=fe.prototype,he={};function pe(e){return ce.isPlainObject(e)||ce.isArray(e)}function me(e){return ce.endsWith(e,"[]")?e.slice(0,-2):e}function ge(e,t,n){return e?e.concat(t).map(function(e,t){return e=me(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=>{he[e]={value:e}}),Object.defineProperties(fe,he),Object.defineProperty(de,"isAxiosError",{value:!0}),fe.from=(e,t,n,r,o,i)=>{const s=Object.create(de);return ce.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),fe.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const ve=ce.toFlatObject(ce,{},null,function(e){return/^is[A-Z]/.test(e)});function ye(e,t,n){if(!ce.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=ce.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ce.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&ce.isSpecCompliantForm(t);if(!ce.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(ce.isDate(e))return e.toISOString();if(!a&&ce.isBlob(e))throw new fe("Blob is not supported. Use a Buffer instead.");return ce.isArrayBuffer(e)||ce.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(ce.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(ce.isArray(e)&&function(e){return ce.isArray(e)&&!e.some(pe)}(e)||(ce.isFileList(e)||ce.endsWith(n,"[]"))&&(a=ce.toArray(e)))return n=me(n),a.forEach(function(e,r){!ce.isUndefined(e)&&null!==e&&t.append(!0===s?ge([n],r,i):null===s?n:n+"[]",l(e))}),!1;return!!pe(e)||(t.append(ge(o,n,i),l(e)),!1)}const c=[],f=Object.assign(ve,{defaultVisitor:u,convertValue:l,isVisitable:pe});if(!ce.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!ce.isUndefined(n)){if(-1!==c.indexOf(n))throw Error("Circular reference detected in "+r.join("."));c.push(n),ce.forEach(n,function(n,i){!0===(!(ce.isUndefined(n)||null===n)&&o.call(t,n,ce.isString(i)?i.trim():i,r,f))&&e(n,r?r.concat(i):[i])}),c.pop()}}(e),t}function be(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function we(e,t){this._pairs=[],e&&ye(e,this,t)}const Se=we.prototype;function Ee(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function xe(e,t,n){if(!t)return e;const r=n&&n.encode||Ee,o=n&&n.serialize;let i;if(i=o?o(t,n):ce.isURLSearchParams(t)?t.toString():new we(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}Se.append=function(e,t){this._pairs.push([e,t])},Se.toString=function(e){const t=e?function(t){return e.call(this,t,be)}:be;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var Te=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){ce.forEach(this.handlers,function(t){null!==t&&e(t)})}},_e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Re={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:we,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Oe="undefined"!=typeof window&&"undefined"!=typeof document,Pe=(je="undefined"!=typeof navigator&&navigator.product,Oe&&["ReactNative","NativeScript","NS"].indexOf(je)<0);var je,Ae={__proto__:null,hasBrowserEnv:Oe,hasStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,hasStandardBrowserEnv:Pe,origin:Oe&&window.location.href||"http://localhost",...Re};function Ue(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&&ce.isArray(r)?r.length:i,a?(r[i]=ce.hasOwnProp(r,i)?[r[i],n]:n,!s):(r[i]&&ce.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&ce.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(ce.isFormData(e)&&ce.isFunction(e.entries)){const n={};return ce.forEachEntry(e,(e,r)=>{t(function(e){return ce.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const We={transitional:_e,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=ce.isObject(e);if(o&&ce.isHTMLForm(e)&&(e=new FormData(e)),ce.isFormData(e))return r?JSON.stringify(Ue(e)):e;if(ce.isArrayBuffer(e)||ce.isBuffer(e)||ce.isStream(e)||ce.isFile(e)||ce.isBlob(e)||ce.isReadableStream(e))return e;if(ce.isArrayBufferView(e))return e.buffer;if(ce.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 ye(e,new Ae.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return Ae.isNode&&ce.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=ce.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ye(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(ce.isString(e))try{return(0,JSON.parse)(e),ce.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||We.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(ce.isResponse(e)||ce.isReadableStream(e))return e;if(e&&ce.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 fe.from(e,fe.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:Ae.classes.FormData,Blob:Ae.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ce.forEach(["delete","get","head","post","put","patch"],e=>{We.headers[e]={}});var Ce=We;const ze=ce.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"]),Fe=Symbol("internals");function ke(e){return e&&String(e).trim().toLowerCase()}function Ne(e){return!1===e||null==e?e:ce.isArray(e)?e.map(Ne):String(e)}function Be(e,t,n,r,o){return ce.isFunction(r)?r.call(this,t,n):(o&&(t=n),ce.isString(t)?ce.isString(r)?-1!==t.indexOf(r):ce.isRegExp(r)?r.test(t):void 0:void 0)}class Le{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ke(t);if(!o)throw new Error("header name must be a non-empty string");const i=ce.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Ne(e))}const i=(e,t)=>ce.forEach(e,(e,n)=>o(e,n,t));if(ce.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ce.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]&&ze[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(ce.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=ke(e)){const n=ce.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(ce.isFunction(t))return t.call(this,e,n);if(ce.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ke(e)){const n=ce.findKey(this,e);return!(!n||void 0===this[n]||t&&!Be(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ke(e)){const o=ce.findKey(n,e);!o||t&&!Be(0,n[o],o,t)||(delete n[o],r=!0)}}return ce.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&&!Be(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return ce.forEach(this,(r,o)=>{const i=ce.findKey(n,o);if(i)return t[i]=Ne(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]=Ne(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ce.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&ce.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[Fe]=this[Fe]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ke(e);t[r]||(function(e,t){const n=ce.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 ce.isArray(e)?e.forEach(r):r(e),this}}Le.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ce.reduceDescriptors(Le.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),ce.freezeMethods(Le);var De=Le;function Me(e,t){const n=this||Ce,r=t||n,o=De.from(r.headers);let i=r.data;return ce.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Ie(e){return!(!e||!e.__CANCEL__)}function qe(e,t,n){fe.call(this,null==e?"canceled":e,fe.ERR_CANCELED,t,n),this.name="CanceledError"}function Je(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new fe("Request failed with status code "+n.status,[fe.ERR_BAD_REQUEST,fe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}ce.inherits(qe,fe,{__CANCEL__:!0});const He=(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)},Ke=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ve=e=>(...t)=>ce.asap(()=>e(...t));var Ge=Ae.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=ce.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0},$e=Ae.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];ce.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ce.isString(r)&&s.push("path="+r),ce.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 Xe(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 Ze=e=>e instanceof De?{...e}:e;function Qe(e,t){t=t||{};const n={};function r(e,t,n){return ce.isPlainObject(e)&&ce.isPlainObject(t)?ce.merge.call({caseless:n},e,t):ce.isPlainObject(t)?ce.merge({},t):ce.isArray(t)?t.slice():t}function o(e,t,n){return ce.isUndefined(t)?ce.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!ce.isUndefined(t))return r(void 0,t)}function s(e,t){return ce.isUndefined(t)?ce.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(Ze(e),Ze(t),!0)};return ce.forEach(Object.keys(Object.assign({},e,t)),function(r){const i=l[r]||o,s=i(e[r],t[r],r);ce.isUndefined(s)&&i!==a||(n[r]=s)}),n}var Ye=e=>{const t=Qe({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:l}=t;if(t.headers=a=De.from(a),t.url=xe(Xe(t.baseURL,t.url),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),ce.isFormData(r))if(Ae.hasStandardBrowserEnv||Ae.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(Ae.hasStandardBrowserEnv&&(o&&ce.isFunction(o)&&(o=o(t)),o||!1!==o&&Ge(t.url))){const e=i&&s&&$e.read(s);e&&a.set(i,e)}return t},et="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ye(e);let o=r.data;const i=De.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=De.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Je(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 fe("Request aborted",fe.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new fe("Network Error",fe.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 fe(t,(r.transitional||_e).clarifyTimeoutError?fe.ETIMEDOUT:fe.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&ce.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),ce.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),f&&"json"!==f&&(m.responseType=r.responseType),h&&([l,c]=He(h,!0),m.addEventListener("progress",l)),d&&m.upload&&([a,u]=He(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new qe(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===Ae.protocols.indexOf(v)?n(new fe("Unsupported protocol "+v+":",fe.ERR_BAD_REQUEST,e)):m.send(o||null)})},tt=(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 fe?t:new qe(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{o(new fe(`timeout ${t} of ms exceeded`,fe.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 nt=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},rt=(e,t,n,r,o)=>{const i=async function*(e,t,n){for await(const r of e)yield*nt(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})},ot="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,it=ot&&"function"==typeof ReadableStream,st=ot&&("function"==typeof TextEncoder?(at=new TextEncoder,e=>at.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var at;const lt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},ut=it&<(()=>{let e=!1;const t=new Request(Ae.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),ct=it&<(()=>ce.isReadableStream(new Response("").body)),ft={stream:ct&&(e=>e.body)};var dt;ot&&(dt=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!ft[e]&&(ft[e]=ce.isFunction(dt[e])?t=>t[e]():(t,n)=>{throw new fe(`Response type '${e}' is not supported`,fe.ERR_NOT_SUPPORT,n)})}));const ht={http:null,xhr:et,fetch:ot&&(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}=Ye(e);u=u?(u+"").toLowerCase():"text";let h,p,[m,g]=o||i||s?tt([o,i],s):[];const v=()=>{!h&&setTimeout(()=>{m&&m.unsubscribe()}),h=!0};let y;try{if(l&&ut&&"get"!==n&&"head"!==n&&0!==(y=await(async(e,t)=>{const n=ce.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:ce.isBlob(e)?e.size:ce.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:ce.isArrayBufferView(e)||ce.isArrayBuffer(e)?e.byteLength:(ce.isURLSearchParams(e)&&(e+=""),ce.isString(e)?(await st(e)).byteLength:void 0))(t):n})(c,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(ce.isFormData(r)&&(e=n.headers.get("content-type"))&&c.setContentType(e),n.body){const[e,t]=Ke(y,He(Ve(l)));r=rt(n.body,65536,e,t,st)}}ce.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=ct&&("stream"===u||"response"===u);if(ct&&(a||i)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=o[t]});const t=ce.toFiniteNumber(o.headers.get("content-length")),[n,r]=a&&Ke(t,He(Ve(a),!0))||[];o=new Response(rt(o.body,65536,n,()=>{r&&r(),i&&v()},st),e)}u=u||"text";let s=await ft[ce.findKey(ft,u)||"text"](o,e);return!i&&v(),g&&g(),await new Promise((t,n)=>{Je(t,n,{data:s,headers:De.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 fe("Network Error",fe.ERR_NETWORK,e,p),{cause:t.cause||t});throw fe.from(t,t&&t.code,e,p)}})};ce.forEach(ht,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const pt=e=>`- ${e}`,mt=e=>ce.isFunction(e)||null===e||!1===e;var gt=e=>{e=ce.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,!mt(n)&&(r=ht[(t=String(n)).toLowerCase()],void 0===r))throw new fe(`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 fe("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(pt).join("\n"):" "+pt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function vt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new qe(null,e)}function yt(e){return vt(e),e.headers=De.from(e.headers),e.data=Me.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),gt(e.adapter||Ce.adapter)(e).then(function(t){return vt(e),t.data=Me.call(e,e.transformResponse,t),t.headers=De.from(t.headers),t},function(t){return Ie(t)||(vt(e),t&&t.response&&(t.response.data=Me.call(e,e.transformResponse,t.response),t.response.headers=De.from(t.response.headers))),Promise.reject(t)})}const bt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{bt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const wt={};bt.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 fe(r(o," has been removed"+(t?" in "+t:"")),fe.ERR_DEPRECATED);return t&&!wt[o]&&(wt[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 St={assertOptions:function(e,t,n){if("object"!=typeof e)throw new fe("options must be an object",fe.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 fe("option "+i+" must be "+n,fe.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new fe("Unknown option "+i,fe.ERR_BAD_OPTION)}},validators:bt};const Et=St.validators;class xt{constructor(e){this.defaults=e,this.interceptors={request:new Te,response:new Te}}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=Qe(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&St.assertOptions(n,{silentJSONParsing:Et.transitional(Et.boolean),forcedJSONParsing:Et.transitional(Et.boolean),clarifyTimeoutError:Et.transitional(Et.boolean)},!1),null!=r&&(ce.isFunction(r)?t.paramsSerializer={serialize:r}:St.assertOptions(r,{encode:Et.function,serialize:Et.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&ce.merge(o.common,o[t.method]);o&&ce.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=De.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=[yt.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=yt.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 xe(Xe((e=Qe(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}ce.forEach(["delete","get","head","options"],function(e){xt.prototype[e]=function(t,n){return this.request(Qe(n||{},{method:e,url:t,data:(n||{}).data}))}}),ce.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(Qe(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}xt.prototype[e]=t(),xt.prototype[e+"Form"]=t(!0)});var Tt=xt;class _t{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 qe(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 _t(function(t){e=t}),cancel:e}}}var Rt=_t;const Ot={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(Ot).forEach(([e,t])=>{Ot[t]=e});var Pt=Ot;const jt=function e(t){const n=new Tt(t),r=w(Tt.prototype.request,n);return ce.extend(r,Tt.prototype,n,{allOwnKeys:!0}),ce.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Qe(t,n))},r}(Ce);jt.Axios=Tt,jt.CanceledError=qe,jt.CancelToken=Rt,jt.isCancel=Ie,jt.VERSION="1.7.4",jt.toFormData=ye,jt.AxiosError=fe,jt.Cancel=jt.CanceledError,jt.all=function(e){return Promise.all(e)},jt.spread=function(e){return function(t){return e.apply(null,t)}},jt.isAxiosError=function(e){return ce.isObject(e)&&!0===e.isAxiosError},jt.mergeConfig=Qe,jt.AxiosHeaders=De,jt.formToJSON=e=>Ue(ce.isHTMLForm(e)?new FormData(e):e),jt.getAdapter=gt,jt.HttpStatusCode=Pt,jt.default=jt;var At=jt;const{CanceledError:Ut}=At;var Wt,Ct,zt=function(e,t){try{var n=t.baseUrl+"/v1/jobs/update",r=g({},h(t),{job_id:e.identifier,status:e.status});return Promise.resolve(fetch(n,g({},b,{method:"POST",headers:r,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)}},Ft="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},kt={__proto__:null,default:{}},Nt=(Wt=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=Ft: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=kt,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}()},Wt(Ct={exports:{}}),Ct.exports);function Bt(e,t=0){return It(e,t,2).getUint16(0,!0)}function Lt(e,t=0){return It(e,t,4).getUint32(0,!0)}function Dt(e,t=0,n=e.byteLength){const r=e.slice(t,t+n);return qt.decode(new Uint8Array(r))}function Mt(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 It(e,t,n){const r=e.slice(t,t+n);return new DataView(new Uint8Array(r).buffer)}const qt=new TextDecoder("utf8"),Jt=[["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 Ht(e){return e.flatMap(([e,t,n,r={},o=[]])=>[[e,t,n,r],...o])}function Kt(e,t){const n=Bt(e,26),r=Dt(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=Lt(e,18),r=Lt(e,22),o=Bt(e,28);if(n===r){const r=Dt(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 Vt=function(e){return Ht(e).map(([e,t,n,{offset:r=0}={}])=>n.length+r).reduce((e,t)=>t>e?t:e,0)}(Jt);function Gt(e,t){for(const[n,r,o,{exact:i=!0,offset:s=0}={},a=[]]of t)if(Mt(e,o,s)){if("zip"===n&&!i)return Kt(e.buffer,{ext:n,mime:r});if(!i&&a.length)for(const[t,n,r,{offset:o=0}={}]of a)if(Mt(e,r,o))return{ext:t,mime:n};return{ext:n,mime:r}}}function $t(e){var t=Nt.md5.create();return t.update(e),t.base64()}function Xt(e,t){void 0===t&&(t=void 0);var n=function(e,{extra:t=!1,hint:n}={}){const r=new Uint8Array(e.slice(0,Vt));if(n){const e=function(e,{ext:t,mime:n}){return t||n?Ht(e).filter(e=>e[0]===t||e[1]===n):[]}(Jt,n);if(e.length>0){const t=Gt(r,e);if(void 0!==t)return t}}return Gt(r,Jt)||(t?function(e){return function(e){try{const t=Dt(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"}return"unknown"===s&&"string"==typeof t&&(s=Zt(t)),s}function Zt(e){var t=e.toLowerCase(),n="";return t.endsWith(".html")||t.endsWith(".html.gz")?n="text/html":t.endsWith(".js")||t.endsWith(".js.gz")?n="application/javascript":t.endsWith(".wasm")?n="application/wasm":t.endsWith(".css")?n="text/css":t.endsWith(".json")?n="application/json":t.endsWith(".txt")?n="text/plain":t.endsWith(".bin")?n="application/octet-stream":t.endsWith(".png")?n="image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?n="image/jpeg":t.endsWith(".gif")?n="image/gif":t.endsWith(".webp")?n="image/webp":t.endsWith(".svg")?n="image/svg+xml":t.endsWith(".glb")?n="model/gltf-binary":t.endsWith(".gltf")?n="model/gltf+json":t.endsWith(".vrm")?n="model/gltf-binary":t.endsWith(".usdz")?n="model/vnd.usdz+zip":t.endsWith(".usda")?n="model/vnd.usd-usda":t.endsWith(".usdc")?n="model/vnd.usd-usdc":t.endsWith(".usd")?n="model/vnd.usd-usd":t.endsWith(".mtl")?n="model/mtl":t.endsWith(".obj")?n="model/obj":t.endsWith(".fbx")?n="model/vnd.autodesk.fbx":t.endsWith(".stl")&&(n="model/stl"),n}function Qt(e,t,n){void 0===t&&(t=void 0),void 0===n&&(n=!0);var r=Math.abs(e);if(r>=1099511627776){var o=n?" TB":"";return(e/1099511627776).toFixed(void 0===t?2:t)+o}if(r>=1073741824){var i=n?" GB":"";return(e/1073741824).toFixed(void 0===t?2:t)+i}if(r>=1048576){var s=n?" MB":"";return(e/1048576).toFixed(void 0===t?1:t)+s}if(r>=1024){var a=n?" KB":"";return(e/1024).toFixed(void 0===t?0:t)+a}var l=n?" B":"";return e.toFixed(0)+l}"undefined"==typeof Symbol||Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"));var Yt=function(e){try{return Promise.resolve(new Promise(function(t){return setTimeout(t,e)}))}catch(e){return Promise.reject(e)}},en=/*#__PURE__*/y(/^image_(\d+)_|^mesh_lod_(\d+)_/,{image_lod:1,mesh_lod:2});function tn(e,t,n){if(!e.s){if(n instanceof nn){if(!n.s)return void(n.o=tn.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(tn.bind(null,e,t),tn.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var nn=/*#__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{tn(r,1,i(this.v))}catch(e){tn(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?tn(r,1,t?t(o):o):n?tn(r,1,n(o)):tn(r,2,o)}catch(e){tn(r,2,e)}},r},e}();function rn(e){return e instanceof nn&&1&e.s}function on(e){return e.includes("\\u")?JSON.parse('"'+e+'"'):decodeURIComponent(e)}function sn(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 an=/*#__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 ln(e,t,n){if(!e.s){if(n instanceof un){if(!n.s)return void(n.o=ln.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ln.bind(null,e,t),ln.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}"undefined"==typeof Symbol||Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"));var un=/*#__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{ln(r,1,i(this.v))}catch(e){ln(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?ln(r,1,t?t(o):o):n?ln(r,1,n(o)):ln(r,2,o)}catch(e){ln(r,2,e)}},r},e}();function cn(e){return e instanceof un&&1&e.s}function fn(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(!cn(a))return void a.then(s,o||(o=ln.bind(null,r=new un,2)));a=a.v}r?ln(r,1,a):r=a}catch(e){ln(r||(r=new un),2,e)}}(),r}function dn(e,t,n){for(var r;;){var o=e();if(cn(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!cn(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!cn(s)){r=2;break}}}var a=new un,l=ln.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&&!cn(s))return void s.then(f).then(void 0,l);if(!(o=e())||cn(o)&&!o.v)return void ln(a,1,i);if(o.then)return void o.then(c).then(void 0,l);cn(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):ln(a,1,i)}function f(){(o=e())?o.then?o.then(c).then(void 0,l):c(o):ln(a,1,i)}}var hn=[];new Array;var pn=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:g({},h({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 mn(e,t){var n=e.map(function(e){return function(e,t){if(void 0===t&&(t=null),"object"==typeof(r=e)&&"string"==typeof r.name&&"string"==typeof r.mimetype){var n=e.mimetype||Zt(e.name);e=new File([e.buffer],e.name,{type:n})}else e.type||(e=new File([e],e.name,{type:Zt(e.name)}));var r,o=e;return null==t&&(t=e.webkitRelativePath||""),o.path=t+e.name,o}(e)});return console.debug("Upload",t.name,n),function(e,t,n){void 0===n&&(n=void 0);try{var r=function(e,t,n){void 0===n&&(n=void 0);try{var r,o=t.files,i=(null==(r=n)?void 0:r.loglevel)||"none";if(!o.length)return"none"!=i&&console.error("No files to upload"),Promise.resolve({success:!1,error:"No files to upload"});if(!t.entrypoint){var s=function(e){var t=null,n="",r=e.filter(function(e){return"index.html"===e.name.toLowerCase()||"index.html.gz"===e.name.toLowerCase()||"index.html.br"===e.name.toLowerCase()});if(1===r.length)return r[0];r.length>1&&console.warn("Multiple index.html files found...");var o=e.filter(function(e){return e.name.toLowerCase().endsWith(".glb")||e.name.toLowerCase().endsWith(".gltf")||e.name.toLowerCase().endsWith(".vrm")});if(o.length>1){var i=function(e){for(var t,n=new Array,r=/(mesh_lod|image)_\d_(.{1,50})/,o=m(e);!(t=o()).done;){var i=t.value;if(!r.test(i.name)){var s=i.name.toLowerCase();(s.endsWith(".gltf")||s.endsWith(".vrm")||s.endsWith(".glb"))&&n.push(i)}}return 1==n.length?n[0]:sn(n)}(o);return i?t=i:(n="Invalid upload: Multiple glb/glTF/vrm files found. This is currently not supported.",console.error(n,o.map(function(e){return e.path||e.name})),{error:n})}if(1===o.length)return o[0];var s=e.filter(function(e){return e.name.toLowerCase().endsWith(".usdz")||e.name.toLowerCase().endsWith(".usd")||e.name.toLowerCase().endsWith(".usda")||e.name.toLowerCase().endsWith(".usdc")});s.length>=1&&(t=sn(s));var a=e.filter(function(e){return e.name.toLowerCase().endsWith(".fbx")});if(a.length>1)return n="Invalid upload: Multiple fbx files found. This is currently not supported.",console.error(n,a),{error:n};if(1===a.length)return a[0];var l=e.filter(function(e){return e.name.toLowerCase().endsWith(".obj")});if(l.length>1)return n="Invalid upload: Multiple obj files found. This is currently not supported.",console.error(n,l),{error:n};if(1===l.length)return l[0];var u=e.filter(function(e){return e.name.toLowerCase().endsWith(".stl")});if(u.length>1)return n="Invalid upload: Multiple stl files found. This is currently not supported.",console.error(n,u),{error:n};if(1===u.length)return u[0];if(1===e.length&&!e[0].arrayBuffer&&e[0].path.toLowerCase().startsWith("http"))return e[0];var c=e.filter(function(e){return e.name.toLowerCase().endsWith("package.json")});return 1===c.length?t=c[0]:c.length>1?(n="Invalid upload: Multiple package.json files found. This is currently not supported.",console.error(n,c),{error:n}):t||{error:"No supported file to upload found..."}}(o);if(null==s)return Promise.resolve({success:!1,error:"No entrypoint file found"});if("object"==typeof s&&"error"in s)return Promise.resolve({success:!1,error:s.error});"info"===i&&console.log("Entrypoint: "+s.name),t.entrypoint=s}return t.entrypoint&&!o.includes(t.entrypoint)&&o.push(t.entrypoint),Promise.resolve(function(e){try{var t,n=function(e){return t?e:{success:!0,vrm_count:o,gltf_count:i,glb_count:s}};if(e.length>5e3)return Promise.resolve({success:!1,error:"Too many files. Maximum filecount is 5000"});var r=0,o=0,i=0,s=0,a=e.length-1,l=function(e,t,n){for(var r;;){var o=e();if(rn(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!rn(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!rn(s)){r=2;break}}}var a=new nn,l=tn.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&&!rn(s))return void s.then(f).then(void 0,l);if(!(o=e())||rn(o)&&!o.v)return void tn(a,1,i);if(o.then)return void o.then(c).then(void 0,l);rn(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):tn(a,1,i)}function f(){(o=e())?o.then?o.then(c).then(void 0,l):c(o):tn(a,1,i)}}(function(){return!t&&a>=0},function(){return a--},function(){var n=e[a];if((r+=n.size)>1073741824){var l={success:!1,error:"Total file size exceeds limit of "+1024..toFixed(0)+" MB. Please reduce the size of your upload."};return t=1,l}var u,c=n.name.toLocaleLowerCase();return".ds_store"===c?(console.log("š« Remove .DS_Store file from upload"),void e.splice(a,1)):(c.endsWith(".gltf")?i++:c.endsWith(".glb")?(u=c)&&en.test(u)||s++:c.endsWith(".vrm")&&o++,function(){if(c.endsWith(".gltf"))return i+=1,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,i=r.matchAll(/*#__PURE__*/y(/"uri"\s*:\s*"(.*?)"/g,{value:1}));if(i){var s=JSON.parse(r);if("2.0"!==s.asset.version)return console.warn("ā glTF version is not 2.0. This is currently not supported."),t=1,{success:!1,error:"glTF version "+s.asset.version+" is unsupported.Please use glTF 2.0."};for(var a,l=null==(o=n.path)?void 0:o.split("/"),u=l.splice(0,l.length-1).join("/"),c=m(i);!(a=c()).done;){var f,d=null==(f=a.value.groups)?void 0:f.value;if(d){var h=!1;if(d.startsWith("http://")||d.startsWith("https://")||d.startsWith("www.")){console.log("ā
Found remote dependency "+d+" ");break}if(d.startsWith("data:")){console.log("ā
Found embedded dependency "+d+" ");break}var p=(u+"/"+on(d)).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 "'+p+'"');for(var g,v=m(e);!(g=v()).done;){var b=g.value;if(b.webkitRelativePath===p||b.name==p){h=!0,console.log("ā
Found dependency in name or webkit: "+b.name+" || "+b.webkitRelativePath+" ");break}if(b.path===p){h=!0,console.log("ā
Found dependency in path: "+b.path+" ");break}}if(!h)return console.warn("ā Missing dependency "+d,u),t=1,{success:!1,error:"Missing resource: "+d}}}}})}())});return Promise.resolve(l&&l.then?l.then(n):n(l))}catch(e){return Promise.reject(e)}}(o)).then(function(r){var s,a,l,u,c;function f(r){var s,a,l,u,f,d;if(c)return r;function p(r){return Promise.resolve(fetch(m+"/v1/upload/request",g({},b,{method:"POST",headers:y,body:JSON.stringify(w)})).catch(function(e){return"fetch failed"==e.message||"Failed to fetch"==e.message?"Network error. Make sure you are connected to the internet and "+m+" is reachable.":(console.error("Failed to begin upload\n",e),null)})).then(function(r){var s;function a(a){return s?a:Promise.resolve(r.json()).then(function(r){var s,a,l;function u(){return Promise.resolve(Promise.all(T).catch(function(e){var t;null!=(t=n)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),_=!0)})).then(function(){var t;function s(s){var a;if(t)return s;function l(t){var n;if(a)return t;function s(){var e;function t(t){return e?t:("none"!=i&&console.log("Upload complete"),Promise.resolve(u.json()).then(function(e){return{success:!0,type:e.type,uploadSkipped:!1,id:e.id,view_id:e.view_id,url:e.url,filesUploaded:o.length,totalSize:c}}))}if(!u)return console.error("Failed to complete upload"),{success:!1,error:"Failed to complete upload"};var n=function(){if(!u.ok)return 524===u.status?(console.error("Failed to complete upload: Gateway Timeout"),e=1,{success:!1,error:"Failed to complete upload: Gateway Timeout"}):Promise.resolve(u.text()).then(function(t){return console.error("Failed to complete upload ("+u.status+"): "+t),e=1,{success:!1,error:"Failed to complete upload"}})}();return n&&n.then?n.then(t):t(n)}p=!0,console.log("Upload Done: All files uploaded to "+r.id);var l=g({},h(e),{id:r.id});"none"!=i&&console.log("Completing upload - notify server");var u=null,f=0,d=dn(function(){return!n&&f<5},function(){return f++},function(){return Promise.resolve(Yt(1e3*f)).then(function(){var e=AbortSignal.timeout(2e4+1e3*f);return Promise.resolve(fetch(m+"/v1/upload/done",g({},b,{method:"POST",headers:l,signal:e})).catch(function(e){return console.error("Failed to complete upload ("+(f+1)+" / 5)",e.message),null})).then(function(e){var t,r;!0!==(null==(t=u=e)?void 0:t.ok)?"none"!=i&&f<4&&console.warn("Failed to complete upload ("+((null==(r=u)?void 0:r.status)||"no status")+"): will retry in 1 second"):n=1})})});return d&&d.then?d.then(s):s()}var u=function(t){if(null!=(t=n)&&null!=(t=t.abort)&&t.aborted)return Promise.resolve(zt({identifier:r.id,status:"canceled",status_message:"Upload aborted",error:"Upload aborted"},e)).then(function(){return a=1,{success:!1,error:"Upload aborted"}})}();return u&&u.then?u.then(l):l(u)}var a=function(){if(_)return Promise.resolve(zt({identifier:r.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"===i&&console.debug("BeginResponse",r);var c=o.reduce(function(e,t){return e+t.size},0);if("exists"===r.type)return"none"!=i&&console.log("Upload already exists",r.id),{success:!0,uploadSkipped:!0,id:r.id,type:r.job_type,view_id:r.view_id,filesUploaded:o.length,totalSize:c,url:r.url};var f=t.entrypoint.webkitRelativePath||t.entrypoint.name,d=0;null==(s=n)||null==(s=s.abort)||s.addEventListener("abort",function(){try{return console.log("Upload aborted: Cancelling upload"),Promise.resolve(fetch(m+"/v1/upload/cancel",g({},b,{method:"POST",headers:{authorization:v,id:r.id}}))).then(function(){})}catch(e){return Promise.reject(e)}});var p=!1;function y(t,n,o){if(void 0===o&&(o=!1),!o&&Date.now()-S<1e3)return!1;if(!p||"completed"===n){S=Date.now();var s=Math.floor(d/c*100);return"debug"===i&&console.log("SET STATUS: "+n,t,s),zt({identifier:r.id,status:n,status_message:t,progress:s},e),!0}"none"!=i&&console.warn("Invalid status update...")}var S=Date.now();null!=(a=n)&&a.onStart&&n.onStart(r.id,r.view_id);var E=Date.now(),x=new an(o.length,c/1024/1024),T=new Array,_=!1,R=[].concat(o),O=o.length,P=fn(R,function(s){var a;function u(){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!=(a=n)&&null!=(a=a.abort)&&a.aborted)return console.debug("Upload aborted"),void(l=1);if(_)return console.debug("Upload failed"),void(l=1);var p=function(){if(T.length<10){console.debug("Uploading file "+s+"/"+o.length+": "+o[s].name);var a=0,l=0,u=w.results.files[s],p=u.filename;return Promise.resolve(o[s].arrayBuffer()).then(function(m){var v=u.content_length,w=u.content_type,S=o[s],R=S.name.endsWith(".gz")?"gzip":S.name.endsWith(".br")?"br":void 0,P=function(e){try{var t,n=function(t){var n;function o(e){var t=function(){if(!h)return console.error("Failed to upload file "+a),Promise.resolve(zt({identifier:r,status:"failed",status_message:"Failed to upload file "+a,error:"Failed to upload file "+a},w)).then(function(){throw new Error("Failed to upload file "+a)})}();return!t||!t.then||t.then(function(e){return!0})}if(null==_)throw new Error('Failed to get presigned url for "'+a+'" "'+f+'" \n'+R);var i=_.presigned_url,h=!1,p=0,x=dn(function(){return!n&&p<5},function(){return p++},function(){function t(){var t;if(null!=S&&null!=(t=S.abort)&&t.aborted)throw new Ut("Upload aborted");var r={"Content-Type":f,"Content-MD5":u};return E&&(r["Content-Length"]=c.toString()),d&&(r["Content-Encoding"]=d),0===p&&("none"!=y?console.log("Uploading file "+m+"/"+v+": "+a):console.debug("Uploading file "+m+"/"+v+": "+a)),Promise.resolve(At.put(i,l,g({},b,{withCredentials:!1,signal:null==S?void 0:S.abort,headers:r,onUploadProgress:function(t){e.onProgress(t)}})).catch(function(e){return e instanceof Ut||("none"!==y&&console.error("Failed to upload file (PUT) ("+m+", "+a+') "'+e.message+'"'),"debug"===y&&(console.log(r,{fileSize:c}),e.response?console.debug(e.response):console.debug(e))),null})).then(function(e){if(e)return 200!==e.status?void console.debug("Failed ("+e.status+" "+e.status+") to upload file "+s.name+' to "'+_.path+'". Retrying...'):(h=!0,"info"===y?console.log("Uploaded file "+m+"/"+v+' "'+a+'" ('+f+", "+Qt(c)+")"):console.debug("Uploaded file "+m+"/"+v+' "'+a+'" ('+f+", "+Qt(c)+")"),void(n=1))})}var r=function(){if(p>0)return"none"!==y&&console.log("Retry PUT #"+p+" for file "+a),Promise.resolve(Yt(1e3*p)).then(function(){})}();return r&&r.then?r.then(t):t()});return x&&x.then?x.then(o):o()},r=e.uploadId,o=e.uploadRequestPUTUrl,i=e.entrypointPath,s=e.file,a=e.fileName,l=e.fileBuffer,u=e.fileMd5,c=e.fileSize,f=e.fileType,d=e.content_encoding,p=e.fileIndex,m=e.fileNumber,v=e.fileCount,y=e.loglevel,w=e.args,S=e.options,E=e.experimental;"info"===y&&console.log('Uploading file "'+s.name+'" type='+f+" ("+c+") "+s.type+" with hash "+u);var x=g({},h(w),{"Content-Type":"application/json",org:w.org,job_id:r,filesize:c.toString(),progress:(p/v*100).toFixed(0)}),T=JSON.stringify({filename:a,entrypoint:i,"content-type":f,"content-md5":u,"content-encoding":d}),_=null,R="",O=0,P=dn(function(){return!t&&O<5},function(){return O++},function(){var e;if(null==_){if(null!=S&&null!=(e=S.abort)&&e.aborted)throw new Error("Upload aborted");return Promise.resolve(Yt(200*O)).then(function(){return Promise.resolve(fetch(o,g({},b,{method:"POST",headers:x,body:T})).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 R=n,console.log(o),console.warn('Failed to get presigned url for "'+a+'" "'+f+'" ('+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 R=e.message,console.warn("Failed to get presigned url "+e.message+", retrying..."),null})).then(function(e){_=e})})}t=1});return Promise.resolve(P&&P.then?P.then(n):n())}catch(e){return Promise.reject(e)}}({uploadId:r.id,uploadRequestPUTUrl:r.request_put_url,entrypointPath:f,file:o[s],fileName:p,fileMd5:u.content_md5,fileBuffer:m,fileType:w,content_encoding:R,fileSize:v,fileIndex:s,fileNumber:s+1,fileCount:O,loglevel:i,experimental:t.experimental,args:e,options:n,onProgress:function(e){var t,r=e.progress||0,i=(a=o[s].size*r)-l;if(l=a,d+=i,null!=(t=n)&&t.progress){var u=d/c,f=o.length,h=o[s].size,m=(Date.now()-E)/1e3,g=x.updateProgress(d/1024/1024);n.progress({uploadedBytes:d,totalBytes:c,progress01:u,fileName:o[s].name,fileSize:h,fileProgress01:r,fileIndex:s,totalFiles:f,estimatedTimeLeftDisplay:g.estimatedTimeRemainingString,estimatedTimeLeft:g.estimatedTimeRemaining,elapsedTime:m}),y("Uploading file "+(s+1)+"/"+f+" ("+p+"): "+(100*r).toFixed(0)+"% of "+Qt(c)+". Finished in approx. "+g.estimatedTimeRemainingString,"running",!1)}}}).then(function(e){if(!0!==e)return e;for(var t=T.length-1;t>=0;t--)T[t]===P&&T.splice(t,1);y("Uploaded "+Qt(d)+" of "+Qt(c)+" for "+o[s].name,"running")}).catch(function(e){var t;null!=(t=n)&&null!=(t=t.abort)&&t.aborted?console.warn("Upload aborted"):(console.error(e.message),_=!0)});T.push(P)})}}();return p&&p.then?p.then(u):u()},function(){return l});return P&&P.then?P.then(u):u()})}if(null===r||"string"==typeof r)return{success:!1,error:r||"Failed to begin upload"};var l=function(){if(!r.ok)return Promise.resolve(r.text()).then(function(e){if(e.startsWith("{")){var t=JSON.parse(e);if("error"in t)return s=1,{success:!1,status:r.status,error:t.error}}return"none"!=i&&console.error("Failed to begin upload\n",r.status,e),s=1,{success:!1,status:r.status,error:""+e}})}();return l&&l.then?l.then(a):a(l)})}o.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 m=e.baseUrl,v="Bearer "+e.authToken,y=g({},h(e),{triggered_by:t.triggered_by,filename:""+encodeURIComponent(t.entrypoint.name),"total-files":o.length.toString(),"total-files-size":o.reduce(function(e,t){return e+t.size},0).toString()});null!=(s=n)&&s.view_id&&(y.view_id=n.view_id),null!=(a=n)&&a.type&&(y.type=n.type),null!=(l=n)&&l.name&&(y.name=encodeURIComponent(n.name)),null!=(u=n)&&u.parent_job_id&&(y.parent_job_id=n.parent_job_id);var w={results:{entrypoint:(null==(f=t.entrypoint)?void 0:f.path)||(null==(d=t.entrypoint)?void 0:d.name),files:[]}},S=fn(o,function(e){var t,r=o[e],i=r.path||r.webkitRelativePath||r.name;if(null!=(t=i)&&t.includes(":"))throw new Error("Invalid filename: "+i);return Promise.resolve(r.arrayBuffer()).then(function(e){var t,o,s,a,l,u=r.size,c=r.type;if(null!=(t=c)&&t.length&&"unknown"!==c.toLowerCase()||(c=Xt(e,i)),"deployment"===(null==(o=n)?void 0:o.type)){var f=(a=c,l=(s=i).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")||l.endsWith(".cjs.gz")||l.endsWith(".cjs.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&&(i=f.filename,c=f.mimetype)}var d=$t(e);w.results.files.push({filename:i,content_type:c,content_length:u,content_md5:d})})},function(){});return S&&S.then?S.then(p):p()}if("error"in r)return{success:!1,error:r.error||"Failed to validate files"};if(null!=(s=t.entrypoint)&&s.name.endsWith(".htm")||null!=(a=t.entrypoint)&&a.name.endsWith(".html")||null!=(l=t.entrypoint)&&l.name.endsWith(".html.gz")||null!=(u=t.entrypoint)&&u.name.endsWith(".html.br"))n||(n={}),n.type="deployment";else if(r.vrm_count>10)return{success:!1,error:"Multiple model files found - this is not supported for asset uploads. Please upload a single model file only."};var d=function(){if(!t.raw)return fn(o,function(e){var r=o[e],i=r.name.toLowerCase();return function(){var s;if(i.endsWith(".html")||i.endsWith(".js")||i.endsWith(".css"))return"none"!==(null==(s=n)?void 0:s.loglevel)&&console.log("gZip compressing file: "+r.name),Promise.resolve(function(e){try{return Promise.resolve(import("./pako.esm-01431bd2.js")).then(function(t){return Promise.resolve(e.arrayBuffer()).then(function(n){var r=t.gzip(new Uint8Array(n)).buffer.slice(0);if(r.byteLength>51200&&r.byteLength>=n.byteLength){if(n.byteLength>0)return null}else if(!(r instanceof ArrayBuffer))return console.error("gzipCompress: Invalid ArrayBuffer"),{error:'Gzip compressing failed for "'+e.name+'" (unexpected result)'};return function(e,t,n){var r;void 0===n&&(n=void 0);var o=function(e,t,n){for(var r=0;;){var o=e.indexOf("\\",r);if(-1===o)break;r=o+1,e=e.replace("\\","/")}return e}(e).split("/").pop()||e,i=(null==(r=n)?void 0:r.type)||Xt(t,e),s=new File([t],o,{type:i});return s.path=e,s}(("path"in e?e.path:e.name)+".gz",r,{type:"application/gzip"})})})}catch(e){return Promise.reject(e)}}(r).catch(function(e){return{error:"Error compressing "+r.name+": "+e.message}})).then(function(i){var s;if(null!==i){if("error"in i)return c=1,{success:!1,error:i.error,status:500};if(!i)return c=1,{success:!1,error:"Failed to compress "+r.name,status:500};var a=t.entrypoint===r;o[e]=i,a&&(t.entrypoint=i),"none"!==(null==(s=n)?void 0:s.loglevel)&&console.log("gZip compressed file: "+r.name+" "+(a?"(entrypoint)":""))}else{var l;"none"!==(null==(l=n)?void 0:l.loglevel)&&console.error("Did not compress file: "+r.name)}})}()},function(){return c});"none"!=i&&console.warn("Raw upload - skipping gzip compression of files")}();return d&&d.then?d.then(f):f(d)})}catch(e){return Promise.reject(e)}}(e,t,n);return hn.push(r),Promise.resolve(r.finally(function(){var e=hn.indexOf(r);e>=0&&hn.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:n},{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 gn(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 n=e.baseUrl+"/v1/list/uploads",r=g({type:t.type||"upload",max:(t.limit||0).toString(),page:(t.page||1).toString()},h(e));return null!=t.view_id&&(r.view_id=t.view_id),null!=t.view_name&&(r.view_name=t.view_name),Promise.resolve(fetch(n,g({},b,{method:"GET",headers:r})).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.updated_time).getTime()-new Date(e.updated_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{u as Auth,pn as getDeployments,gn as getUploads,mn as uploadFiles};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|