PageSourceSearch

https://static.remove.bg/remove-bg-web/dbfaec02d1e8bd04f1f132c4a92e4623d49a47a7/vite/assets/index-198500b1.js

js remove.bg collected 2026-10-01 08:09:26 UTC 32,549 bytes, 4 lines download raw bytes

1import{c as W,g as ve}from"./index-7709b348.js";import{n as ye,l as ge,f as _e,a as we,c as be,T as Re}from"./index-75777847.js";function Oe(o,r){for(var i=0;i<r.length;i++){const t=r[i];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in o)){const n=Object.getOwnPropertyDescriptor(t,e);n&&Object.defineProperty(o,e,n.get?n:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}function Pe(o,r){o.prototype=Object.create(r.prototype),o.prototype.constructor=o,U(o,r)}function x(o){var r=typeof Map=="function"?new Map:void 0;return x=function(t){if(t===null||!Ue(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r<"u"){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return S(t,arguments,H(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),U(e,t)},x(o)}function S(o,r,i){return Ee()?S=Reflect.construct:S=function(e,n,a){var s=[null];s.push.apply(s,n);var u=Function.bind.apply(e,s),h=new u;return a&&U(h,a.prototype),h},S.apply(null,arguments)}function Ee(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ue(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function U(o,r){return U=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},U(o,r)}function H(o){return H=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},H(o)}var qe=function(o){Pe(r,o);function r(){var i;return i=o.call(this,"Authorization required")||this,i.name="AuthError",i.isAuthError=!0,i}return r}(x(Error)),Se=qe;function Te(o,r){o.prototype=Object.create(r.prototype),o.prototype.constructor=o,q(o,r)}function I(o){var r=typeof Map=="function"?new Map:void 0;return I=function(t){if(t===null||!Ae(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r<"u"){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return T(t,arguments,F(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),q(e,t)},I(o)}function T(o,r,i){return ke()?T=Reflect.construct:T=function(e,n,a){var s=[null];s.push.apply(s,n);var u=Function.bind.apply(e,s),h=new u;return a&&q(h,a.prototype),h},T.apply(null,arguments)}function ke(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ae(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function q(o,r){return q=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},q(o,r)}function F(o){return F=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},F(o)}var Ne=function(o){Te(r,o);function r(i,t){var e;return t===void 0&&(t=null),e=o.call(this,`This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.
2
3Source error: [`+i+"]")||this,e.isNetworkError=!0,e.request=t,e}return r}(I(Error)),ae=Ne,$e=ae,je=function(){return fetch.apply(void 0,arguments).catch(function(r){throw r.name==="AbortError"?r:new $e(r)})},J,V;function k(){return k=Object.assign||function(o){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(o[t]=i[t])}return o},k.apply(this,arguments)}function Q(o,r){for(var i=0;i<r.length;i++){var t=r[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(o,t.key,t)}}function xe(o,r,i){return r&&Q(o.prototype,r),i&&Q(o,i),o}var He=Se,j=je;function Ie(o){return o.replace(/\/$/,"")}var B=(V=J=function(){function o(i,t){this.uppy=i,this.opts=t,this.onReceiveResponse=this.onReceiveResponse.bind(this),this.allowedHeaders=["accept","content-type","uppy-auth-token"],this.preflightDone=!1}var r=o.prototype;return r.headers=function(){var t=this.opts.companionHeaders||this.opts.serverHeaders||{};return Promise.resolve(k({},this.defaultHeaders,t))}
3,r._getPostResponseFunc=function(t){var e=this;return function(n){return t?n:e.onReceiveResponse(n)}},r.onReceiveResponse=function(t){var e=this.uppy.getState(),n=e.companion||{},a=this.opts.companionUrl,s=t.headers;if(s.has("i-am")&&s.get("i-am")!==n[a]){var u;this.uppy.setState({companion:k({},n,(u={},u[a]=s.get("i-am"),u))})}return t},r._getUrl=function(t){return/^(https?:|)\/\//.test(t)?t:this.hostname+"/"+t},r._json=function(t){if(t.status===401)throw new He;if(t.status<200||t.status>300){var e="Failed request with status: "+t.status+". "+t.statusText;return t.json().then(function(n){throw e=n.message?e+" message: "+n.message:e,e=n.requestId?e+" request-Id: "+n.requestId:e,new Error(e)}).catch(function(){throw new Error(e)})}return t.json()},r.preflight=function(t){var e=this;return this.preflightDone?Promise.resolve(this.allowedHeaders.slice()):fetch(this._getUrl(t),{method:"OPTIONS"}).then(function(n){return n.headers.has("access-control-allow-headers")&&(e.allowedHeaders=n.headers.get("access-control-allow-headers").split(",").map(function(a){return a.trim().toLowerCase()})),e.preflightDone=!0,e.allowedHeaders.slice()}).catch(function(n){return e.uppy.log("[CompanionClient] unable to make preflight request "+n,"warning"),e.preflightDone=!0,e.allowedHeaders.slice()})},r.preflightAndHeaders=function(t){var e=this;return Promise.all([this.preflight(t),this.headers()]).then(function(n){var a=n[0],s=n[1];return Object.keys(s).forEach(function(u){a.indexOf(u.toLowerCase())===-1&&(e.uppy.log("[CompanionClient] excluding unallowed header "+u),delete s[u])}),s})},r.get=function(t,e){var n=this;return this.preflightAndHeaders(t).then(function(a){return j(n._getUrl(t),{method:"get",headers:a,credentials:n.opts.companionCookiesRule||"same-origin"})}).then(this._getPostResponseFunc(e)).then(function(a){return n._json(a)}).catch(function(a){return a.isAuthError||(a.message="Could not get "+n._getUrl(t)+". "+a.message),Promise.reject(a)})},r.post=function(t,e,n){var a=this;return this.preflightAndHeaders(t).then(function(s){return j(a._getUrl(t),{method:"post",headers:s,credentials:a.opts.companionCookiesRule||"same-origin",body:JSON.stringify(e)})}).then(this._getPostResponseFunc(n)).then(function(s){return a._json(s)}).catch(function(s){return s.isAuthError||(s.message="Could not post "+a._getUrl(t)+". "+s.message),Promise.reject(s)})},r.delete=function(t,e,n){var a=this;return this.preflightAndHeaders(t).then(function(s){return j(a.hostname+"/"+t,{method:"delete",headers:s,credentials:a.opts.companionCookiesRule||"same-origin",body:e?JSON.stringify(e):null})}).then(this._getPostResponseFunc(n)).then(function(s){return a._json(s)}).catch(function(s){return s.isAuthError||(s.message="Could not delete "+a._getUrl(t)+". "+s.message),Promise.reject(s)})},xe(o,[{key:"hostname",get:function(){var t=this.uppy.getState(),e=t.companion,n=this.opts.companionUrl;return Ie(e&&e[n]?e[n]:n)}},{key:"defaultHeaders",get:function(){return{Accept:"application/json","Content-Type":"application/json","Uppy-Versions":"@uppy/companion-client="+o.VERSION}}}]),o}(),J.VERSION="1.10.2",V),Fe=Object.prototype.hasOwnProperty,Ce=function o(r,i){var t=[];for(var e in r)if(Fe.call(r,e)){var n=r[e],a=encodeURIComponent(e),s;typeof n=="object"?s=o(n,i?i+"["+a+"]":a):s=(i?i+"["+a+"]":a)+"="+encodeURIComponent(n),t.push(s)}return t.join("&")},Le=function(r,i){if(i=i.split(":")[0],r=+r,!r)return!1;switch(i){case"http":case"ws":return r!==80;case"https":case"wss":return r!==443;case"ftp":return r!==21;case"gopher":return r!==70;case"file":return!1}return r!==0},X={},De=Object.prototype.hasOwnProperty,ze;function Z(o){try{return decodeURIComponent(o.replace(/\+/g," "))}catch{return null}}function G(o){try{return encodeURIComponent(o)}catch{return null}}function Be(o){for(var r=/([^=?#&]+)=?([^&]*)/g,i={},t;t=r.exec(o);){var e=Z(t[1]),n=Z(t[2]);e===null||n===null||e in i||(i[e]=n)}return i}function Xe(o,r){r=r||"";var i=[],t,e;typeof r!="string"&&(r="?");for(e in o)if(De.call(o,e)){if(t=o[e],!t&&(t===null||t===ze||isNaN(t))&&(t=""),e=G(e),t=G(t),e===null||t===null)continue;i.push(e+"="+t)}
vendor: 1,839 bytes, line 3
3return i.length?r+i.join("&"):""}X.stringify=Xe;X.parse=Be;var ue=Le,N=X,pe=/[\n\r\t]/g,Me=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Ke=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,We=/^[a-zA-Z]:/,Je=/^[ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function M(o){return(o||"").toString().replace(Je,"")}var C=[["#","hash"],["?","query"],function(r,i){return O(i.protocol)?r.replace(/\\/g,"/"):r},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Y={hash:1,query:1};function ce(o){var r;typeof window<"u"?r=window:typeof W<"u"?r=W:typeof self<"u"?r=self:r={};var i=r.location||{};o=o||i;var t={},e=typeof o,n;if(o.protocol==="blob:")t=new b(unescape(o.pathname),{});else if(e==="string"){t=new b(o,{});for(n in Y)delete t[n]}else if(e==="object"){for(n in o)n in Y||(t[n]=o[n]);t.slashes===void 0&&(t.slashes=Me.test(o.href))}return t}function O(o){return o==="file:"||o==="ftp:"||o==="http:"||o==="https:"||o==="ws:"||o==="wss:"}function le(o,r){o=M(o),o=o.replace(pe,""),r=r||{};var i=Ke.exec(o),t=i[1]?i[1].toLowerCase():"",e=!!i[2],n=!!i[3],a=0,s;return e?n?(s=i[2]+i[3]+i[4],a=i[2].length+i[3].length):(s=i[2]+i[4],a=i[2].length):n?(s=i[3]+i[4],a=i[3].length):s=i[4],t==="file:"?a>=2&&(s=s.slice(2)):O(t)?s=i[4]:t?e&&(s=s.slice(2)):a>=2&&O(r.protocol)&&(s=i[4]),{protocol:t,slashes:e||O(t),slashesCount:a,rest:s}}function Ve(o,r){if(o==="")return r;for(var i=(r||"/").split("/").slice(0,-1).concat(o.split("/")),t=i.length,e=i[t-1],n=!1,a=0;t--;)i[t]==="."?i.splice(t,1):i[t]===".."?(i.splice(t,1),a++):a&&(t===0&&(n=!0),i.splice(t,1),a--);return n&&i.unshift(""),(e==="."||e==="..")&&i.push(""),i.join("/")}function b(o,r,i){if(o=M(o),o=o.replace(pe,""),!(this instanceof b))return new b(o,r,i);var t,e,n,a,s,u,h=C.slice(),d=typeof r,p=this,c=0;
3for(d!=="object"&&d!=="string"&&(i=r,r=null),i&&typeof i!="function"&&(i=N.parse),r=ce(r),e=le(o||"",r),t=!e.protocol&&!e.slashes,p.slashes=e.slashes||t&&r.slashes,p.protocol=e.protocol||r.protocol||"",o=e.rest,(e.protocol==="file:"&&(e.slashesCount!==2||We.test(o))||!e.slashes&&(e.protocol||e.slashesCount<2||!O(p.protocol)))&&(h[3]=[/(.*)/,"pathname"]);c<h.length;c++){if(a=h[c],typeof a=="function"){o=a(o,p);continue}n=a[0],u=a[1],n!==n?p[u]=o:typeof n=="string"?(s=n==="@"?o.lastIndexOf(n):o.indexOf(n),~s&&(typeof a[2]=="number"?(p[u]=o.slice(0,s),o=o.slice(s+a[2])):(p[u]=o.slice(s),o=o.slice(0,s)))):(s=n.exec(o))&&(p[u]=s[1],o=o.slice(0,s.index)),p[u]=p[u]||t&&a[3]&&r[u]||"",a[4]&&(p[u]=p[u].toLowerCase())}i&&(p.query=i(p.query)),t&&r.slashes&&p.pathname.charAt(0)!=="/"&&(p.pathname!==""||r.pathname!=="")&&(p.pathname=Ve(p.pathname,r.pathname)),p.pathname.charAt(0)!=="/"&&O(p.protocol)&&(p.pathname="/"+p.pathname),ue(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(s=p.auth.indexOf(":"),~s?(p.username=p.auth.slice(0,s),p.username=encodeURIComponent(decodeURIComponent(p.username)),p.password=p.auth.slice(s+1),p.password=encodeURIComponent(decodeURIComponent(p.password))):p.username=encodeURIComponent(decodeURIComponent(p.auth)),p.auth=p.password?p.username+":"+p.password:p.username),p.origin=p.protocol!=="file:"&&O(p.protocol)&&p.host?p.protocol+"//"+p.host:"null",p.href=p.toString()}function Qe(o,r,i){var t=this;switch(o){case"query":typeof r=="string"&&r.length&&(r=(i||N.parse)(r)),t[o]=r;break;case"port":t[o]=r,ue(r,t.protocol)?r&&(t.host=t.hostname+":"+r):(t.host=t.hostname,t[o]="");break;case"hostname":t[o]=r,t.port&&(r+=":"+t.port),t.host=r;break;case"host":t[o]=r,/:\d+$/.test(r)?(r=r.split(":"),t.port=r.pop(),t.hostname=r.join(":")):(t.hostname=r,t.port="");break;case"protocol":t.protocol=r.toLowerCase(),t.slashes=!i;break;case"pathname":case"hash":if(r){var e=o==="pathname"?"/":"#";t[o]=r.charAt(0)!==e?e+r:r}else t[o]=r;break;case"username":case"password":t[o]=encodeURIComponent(r);break;case"auth":var n=r.indexOf(":");~n?(t.username=r.slice(0,n),t.username=encodeURIComponent(decodeURIComponent(t.username)),t.password=r.slice(n+1),t.password=encodeURIComponent(decodeURIComponent(t.password))):t.username=encodeURIComponent(decodeURIComponent(r))}for(var a=0;a<C.length;a++){var s=C[a];s[4]&&(t[s[1]]=t[s[1]].toLowerCase())}return t.auth=t.password?t.username+":"+t.password:t.username,t.origin=t.protocol!=="file:"&&O(t.protocol)&&t.host?t.protocol+"//"+t.host:"null",t.href=t.toString(),t}function Ze(o){(!o||typeof o!="function")&&(o=N.stringify);var r,i=this,t=i.protocol;t&&t.charAt(t.length-1)!==":"&&(t+=":");var e=t+(i.protocol&&i.slashes||O(i.protocol)?"//":"");return i.username?(e+=i.username,i.password&&(e+=":"+i.password),e+="@"):i.password&&(e+=":"+i.password,e+="@"),e+=i.host+i.pathname,r=typeof i.query=="object"?o(i.query):i.query,r&&(e+=r.charAt(0)!=="?"?"?"+r:r),i.hash&&(e+=i.hash),e}b.prototype={set:Qe,toString:Ze};b.extractProtocol=le;b.location=ce;b.trimLeft=M;b.qs=N;var Ge=b,$={};$.setItem=function(o,r){return new Promise(function(i){localStorage.setItem(o,r),i()})};$.getItem=function(o){return Promise.resolve(localStorage.getItem(o))};$.removeItem=function(o){return new Promise(function(r){localStorage.removeItem(o),r()})};function A(){return A=Object.assign||function(o){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(o[t]=i[t])}return o},A.apply(this,arguments)}function Ye(o,r){o.prototype=Object.create(r.prototype),o.prototype.constructor=o,L(o,r)}
3function L(o,r){return L=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},L(o,r)}var et=Ce,tt=Ge,rt=B,nt=$,ot=function(r){return r.split("-").map(function(i){return i.charAt(0).toUpperCase()+i.slice(1)}).join(" ")},it=function(o){Ye(r,o);function r(t,e){var n;return n=o.call(this,t,e)||this,n.provider=e.provider,n.id=n.provider,n.name=n.opts.name||ot(n.id),n.pluginId=n.opts.pluginId,n.tokenKey="companion-"+n.pluginId+"-auth-token",n.companionKeysParams=n.opts.companionKeysParams,n.preAuthToken=null,n}var i=r.prototype;return i.headers=function(){var e=this;return Promise.all([o.prototype.headers.call(this),this.getAuthToken()]).then(function(n){var a=n[0],s=n[1],u={};return s&&(u["uppy-auth-token"]=s),e.companionKeysParams&&(u["uppy-credentials-params"]=btoa(JSON.stringify({params:e.companionKeysParams}))),A({},a,u)})},i.onReceiveResponse=function(e){e=o.prototype.onReceiveResponse.call(this,e);var n=this.uppy.getPlugin(this.pluginId),a=n.getPluginState().authenticated,s=a?e.status!==401:e.status<400;return n.setPluginState({authenticated:s}),e}
3,i.setAuthToken=function(e){return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey,e)},i.getAuthToken=function(){return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey)},i.authUrl=function(e){e===void 0&&(e={}),this.preAuthToken&&(e.uppyPreAuthToken=this.preAuthToken);var n=et(e);return n=n&&"?"+n,this.hostname+"/"+this.id+"/connect"+n},i.fileUrl=function(e){return this.hostname+"/"+this.id+"/get/"+e},i.fetchPreAuthToken=function(){var e=this;return this.companionKeysParams?this.post(this.id+"/preauth/",{params:this.companionKeysParams}).then(function(n){e.preAuthToken=n.token}).catch(function(n){e.uppy.log("[CompanionClient] unable to fetch preAuthToken "+n,"warning")}):Promise.resolve()},i.list=function(e){return this.get(this.id+"/list/"+(e||""))},i.logout=function(){var e=this;return this.get(this.id+"/logout").then(function(n){return Promise.all([n,e.uppy.getPlugin(e.pluginId).storage.removeItem(e.tokenKey)])}).then(function(n){var a=n[0];return a})},r.initPlugin=function(e,n,a){if(e.type="acquirer",e.files=[],a&&(e.opts=A({},a,n)),n.serverUrl||n.serverPattern)throw new Error("`serverUrl` and `serverPattern` have been renamed to `companionUrl` and `companionAllowedHosts` respectively in the 0.30.5 release. Please consult the docs (for example, https://uppy.io/docs/instagram/ for the Instagram plugin) and use the updated options.`");if(n.companionAllowedHosts){var s=n.companionAllowedHosts;if(typeof s!="string"&&!Array.isArray(s)&&!(s instanceof RegExp))throw new TypeError(e.id+': the option "companionAllowedHosts" must be one of string, Array, RegExp');e.opts.companionAllowedHosts=s}else/^(?!https?:\/\/).*$/i.test(n.companionUrl)?e.opts.companionAllowedHosts="https://"+n.companionUrl.replace(/^\/\//,""):e.opts.companionAllowedHosts=new tt(n.companionUrl).origin;e.storage=e.opts.storage||nt},r}(rt);function st(o,r){o.prototype=Object.create(r.prototype),o.prototype.constructor=o,D(o,r)}function D(o,r){return D=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},D(o,r)}var at=B,ut=function(r){return r.split("-").map(function(i){return i.charAt(0).toUpperCase()+i.slice(1)}).join(" ")},pt=function(o){st(r,o);function r(t,e){var n;return n=o.call(this,t,e)||this,n.provider=e.provider,n.id=n.provider,n.name=n.opts.name||ut(n.id),n.pluginId=n.opts.pluginId,n}var i=r.prototype;return i.fileUrl=function(e){return this.hostname+"/search/"+this.id+"/get/"+e},i.search=function(e,n){return n=n?"&"+n:"",this.get("search/"+this.id+"/list?q="+encodeURIComponent(e)+n)},r}(at),ct=ye,lt=function(){function o(i){this.opts=i,this._queued=[],this.isOpen=!1,this.emitter=ct(),this._handleMessage=this._handleMessage.bind(this),this.close=this.close.bind(this),this.emit=this.emit.bind(this),this.on=this.on.bind(this),this.once=this.once.bind(this),this.send=this.send.bind(this),(!i||i.autoOpen!==!1)&&this.open()}var r=o.prototype;return r.open=function(){var t=this;this.socket=new WebSocket(this.opts.target),this.socket.onopen=function(e){for(t.isOpen=!0;t._queued.length>0&&t.isOpen;){var n=t._queued[0];t.send(n.action,n.payload),t._queued=t._queued.slice(1)}},this.socket.onclose=function(e){t.isOpen=!1},this.socket.onmessage=this._handleMessage},r.close=function(){this.socket&&this.socket.close()},r.send=function(t,e){if(!this.isOpen){this._queued.push({action:t,payload:e});return}this.socket.send(JSON.stringify({action:t,payload:e}))},r.on=function(t,e){this.emitter.on(t,e)},r.emit=function(t,e){this.emitter.emit(t,e)},r.once=function(t,e){this.emitter.once(t,e)},r._handleMessage=function(t){try{var e=JSON.parse(t.data);this.emit(e.action,e.payload)}catch(n){console.log(n)}},o}(),ht=B,dt=it,ft=pt,mt=lt,vt={RequestClient:ht,Provider:dt,SearchProvider:ft,Socket:mt},yt=ge;function gt(o,r,i){var t=r.progress,e=r.bytesUploaded,n=r.bytesTotal;t&&(o.uppy.log("Upload progress: "+t),o.uppy.emit("upload-progress",i,{uploader:o,bytesUploaded:e,bytesTotal:n}))}var _t=yt(gt,300,{leading:!0,trailing:!0}),wt=function(r){var i=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i,t=i.exec(r)[1],e=/^http:\/\//i.test(r)?"ws":"wss";return e+"://"+t},bt=function(r){var i=[],t=[];function e(s){i.push(s)}function n(s){t.push(s)}var a=Promise.all(r.map(function(s){return s.then(e,n)}));return a.then(function(){return{successful:i,failed:t}})},Rt=function(){function o(i){this._events=[],this._emitter=i}var r=o.prototype;return r.on=function(t,e){return this._events.push([t,e]),this._emitter.on(t,e)},r.remove=function(){var t=this;
3this._events.forEach(function(e){var n=e[0],a=e[1];t._emitter.off(n,a)})},o}(),Ot=function(){function o(i,t){this._timeout=i,this._onTimedOut=t,this._isDone=!1,this._aliveTimer=null,this._onTimedOut=this._onTimedOut.bind(this)}var r=o.prototype;return r.progress=function(){this._isDone||this._timeout>0&&(this._aliveTimer&&clearTimeout(this._aliveTimer),this._aliveTimer=setTimeout(this._onTimedOut,this._timeout))},r.done=function(){this._aliveTimer&&(clearTimeout(this._aliveTimer),this._aliveTimer=null),this._isDone=!0},o}(),Pt=Ot,Et=_e;function Ut(){return new Error("Cancelled")}var qt=function(){function o(i){typeof i!="number"||i===0?this.limit=1/0:this.limit=i,this.activeRequests=0,this.queuedHandlers=[]}var r=o.prototype;return r._call=function(t){var e=this;this.activeRequests+=1;var n=!1,a;try{a=t()}catch(s){throw this.activeRequests-=1,s}return{abort:function(){n||(n=!0,e.activeRequests-=1,a(),e._queueNext())},done:function(){n||(n=!0,e.activeRequests-=1,e._queueNext())}}},r._queueNext=function(){var t=this;Promise.resolve().then(function(){t._next()})},r._next=function(){if(!(this.activeRequests>=this.limit)&&this.queuedHandlers.length!==0){var t=this.queuedHandlers.shift(),e=this._call(t.fn);t.abort=e.abort,t.done=e.done}},r._queue=function(t,e){var n=this;e===void 0&&(e={});var a={fn:t,priority:e.priority||0,abort:function(){n._dequeue(a)},done:function(){throw new Error("Cannot mark a queued request as done: this indicates a bug")}},s=Et(this.queuedHandlers,function(u){return a.priority>u.priority});return s===-1?this.queuedHandlers.push(a):this.queuedHandlers.splice(s,0,a),a},r._dequeue=function(t){var e=this.queuedHandlers.indexOf(t);e!==-1&&this.queuedHandlers.splice(e,1)},r.run=function(t,e){return this.activeRequests<this.limit?this._call(t):this._queue(t,e)},r.wrapPromiseFunction=function(t,e){var n=this;return function(){for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];var h,d=new Promise(function(p,c){h=n.run(function(){var v,y;try{y=Promise.resolve(t.apply(void 0,s))}catch(l){y=Promise.reject(l)}return y.then(function(l){v?c(v):(h.done(),p(l))},function(l){v?c(v):(h.done(),c(l))}),function(){v=Ut()}},e)});return d.abort=function(){h.abort()},d}},o}();function St(o){return o?o.readyState!==0&&o.readyState!==4||o.status===0:!1}var Tt=St,ee,te;function kt(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function At(o,r){o.prototype=Object.create(r.prototype),o.prototype.constructor=o,z(o,r)}function z(o,r){return z=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},z(o,r)}function _(){return _=Object.assign||function(o){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(o[t]=i[t])}return o},_.apply(this,arguments)}var Nt=we,$t=Nt.Plugin,jt=be,xt=Re,K=vt,Ht=K.Provider,It=K.RequestClient,Ft=K.Socket,Ct=_t,Lt=wt,Dt=bt,re=Rt,ne=Pt,oe=qt,he=ae,de=Tt;function ie(o,r){return r||(r=new Error("Upload error")),typeof r=="string"&&(r=new Error(r)),r instanceof Error||(r=_(new Error("Upload error"),{data:r})),de(o)?(r=new he(r,o),r):(r.request=o,r)}function se(o){var r=o.data.slice(0,o.data.size,o.meta.type);return r}var fe=(te=ee=function(o){At(r,o);function r(t,e){var n;n=o.call(this,t,e)||this,n.type="uploader",n.id=n.opts.id||"XHRUpload",n.title="XHRUpload",n.defaultLocale={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}};var a={formData:!0,fieldName:"files[]",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},timeout:30*1e3,limit:0,withCredentials:!1,responseType:"",getResponseData:function(u,h){var d={};try{d=JSON.parse(u)}catch(p){console.log(p)}return d},getResponseError:function(u,h){var d=new Error("Upload error");return de(h)&&(d=new he(d,h)),d},validateStatus:function(u,h,d){return u>=200&&u<300}};if(n.opts=_({},a,e),n.i18nInit(),n.handleUpload=n.handleUpload.bind(kt(n)),n.opts.__queue instanceof oe?n.requests=n.opts.__queue:n.requests=new oe(n.opts.limit),n.opts.bundle&&!n.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");return n.uploaderEvents=Object.create(null),n}var i=r.prototype;return i.setOptions=function(e){o.prototype.setOptions.call(this,e),this.i18nInit()},i.i18nInit=function(){this.translator=new xt([this.defaultLocale,this.up
3py.locale,this.opts.locale]),this.i18n=this.translator.translate.bind(this.translator),this.setPluginState()},i.getOptions=function(e){var n=this.uppy.getState().xhrUpload,a=this.opts.headers,s=_({},this.opts,n||{},e.xhrUpload||{},{headers:{}});return typeof a=="function"?s.headers=a(e):_(s.headers,this.opts.headers),n&&_(s.headers,n.headers),e.xhrUpload&&_(s.headers,e.xhrUpload.headers),s},i.addMetadata=function(e,n,a){var s=Array.isArray(a.metaFields)?a.metaFields:Object.keys(n);s.forEach(function(u){e.append(u,n[u])})},i.createFormDataUpload=function(e,n){var a=new FormData;this.addMetadata(a,e.meta,n);var s=se(e);return e.name?a.append(n.fieldName,s,e.meta.name):a.append(n.fieldName,s),a},i.createBundledUpload=function(e,n){var a=this,s=new FormData,u=this.uppy.getState(),h=u.meta;return this.addMetadata(s,h,n),e.forEach(function(d){var p=a.getOptions(d),c=se(d);d.name?s.append(p.fieldName,c,d.name):s.append(p.fieldName,c)}),s},i.createBareUpload=function(e,n){return e.data},i.upload=function(e,n,a){var s=this,u=this.getOptions(e);
3return this.uppy.log("uploading "+n+" of "+a),new Promise(function(h,d){s.uppy.emit("upload-started",e);var p=u.formData?s.createFormDataUpload(e,u):s.createBareUpload(e,u),c=new XMLHttpRequest;s.uploaderEvents[e.id]=new re(s.uppy);var v=new ne(u.timeout,function(){c.abort(),l.done();var f=new Error(s.i18n("timedOut",{seconds:Math.ceil(u.timeout/1e3)}));s.uppy.emit("upload-error",e,f),d(f)}),y=jt();c.upload.addEventListener("loadstart",function(f){s.uppy.log("[XHRUpload] "+y+" started")}),c.upload.addEventListener("progress",function(f){s.uppy.log("[XHRUpload] "+y+" progress: "+f.loaded+" / "+f.total),v.progress(),f.lengthComputable&&s.uppy.emit("upload-progress",e,{uploader:s,bytesUploaded:f.loaded,bytesTotal:f.total})}),c.addEventListener("load",function(f){if(s.uppy.log("[XHRUpload] "+y+" finished"),v.done(),l.done(),s.uploaderEvents[e.id]&&(s.uploaderEvents[e.id].remove(),s.uploaderEvents[e.id]=null),u.validateStatus(f.target.status,c.responseText,c)){var g=u.getResponseData(c.responseText,c),m=g[u.responseUrlFieldName],P={status:f.target.status,body:g,uploadURL:m};return s.uppy.emit("upload-success",e,P),m&&s.uppy.log("Download "+e.name+" from "+m),h(e)}var w=u.getResponseData(c.responseText,c),R=ie(c,u.getResponseError(c.responseText,c)),E={status:f.target.status,body:w};return s.uppy.emit("upload-error",e,R,E),d(R)}),c.addEventListener("error",function(f){s.uppy.log("[XHRUpload] "+y+" errored"),v.done(),l.done(),s.uploaderEvents[e.id]&&(s.uploaderEvents[e.id].remove(),s.uploaderEvents[e.id]=null);var g=ie(c,u.getResponseError(c.responseText,c));return s.uppy.emit("upload-error",e,g),d(g)}),c.open(u.method.toUpperCase(),u.endpoint,!0),c.withCredentials=u.withCredentials,u.responseType!==""&&(c.responseType=u.responseType);var l=s.requests.run(function(){var f=s.getOptions(e);return Object.keys(f.headers).forEach(function(g){c.setRequestHeader(g,f.headers[g])}),c.send(p),function(){v.done(),c.abort()}});s.onFileRemove(e.id,function(){l.abort(),d(new Error("File removed"))}),s.onCancelAll(e.id,function(){l.abort(),d(new Error("Upload cancelled"))})})},i.uploadRemote=function(e,n,a){var s=this,u=this.getOptions(e);return new Promise(function(h,d){s.uppy.emit("upload-started",e);var p={},c=Array.isArray(u.metaFields)?u.metaFields:Object.keys(e.meta);c.forEach(function(l){p[l]=e.meta[l]});var v=e.remote.providerOptions.provider?Ht:It,y=new v(s.uppy,e.remote.providerOptions);y.post(e.remote.url,_({},e.remote.body,{endpoint:u.endpoint,size:e.data.size,fieldname:u.fieldName,metadata:p,httpMethod:u.method,useFormData:u.formData,headers:u.headers})).then(function(l){var f=l.token,g=Lt(e.remote.companionUrl),m=new Ft({target:g+"/api/"+f,autoOpen:!1});s.uploaderEvents[e.id]=new re(s.uppy),s.onFileRemove(e.id,function(){m.send("pause",{}),P.abort(),h("upload "+e.id+" was removed")}),s.onCancelAll(e.id,function(){m.send("pause",{}),P.abort(),h("upload "+e.id+" was canceled")}),s.onRetry(e.id,function(){m.send("pause",{}),m.send("resume",{})}),s.onRetryAll(e.id,function(){m.send("pause",{}),m.send("resume",{})}),m.on("progress",function(w){return Ct(s,w,e)}),m.on("success",function(w){var R=u.getResponseData(w.response.responseText,w.response),E=R[u.responseUrlFieldName],me={status:w.response.status,body:R,uploadURL:E};return s.uppy.emit("upload-success",e,me),P.done(),s.uploaderEvents[e.id]&&(s.uploaderEvents[e.id].remove(),s.uploaderEvents[e.id]=null),h()}),m.on("error",function(w){var R=w.response,E=R?u.getResponseError(R.responseText,R):_(new Error(w.error.message),{cause:w.error});s.uppy.emit("upload-error",e,E),P.done(),s.uploaderEvents[e.id]&&(s.uploaderEvents[e.id].remove(),s.uploaderEvents[e.id]=null),d(E)});
3var P=s.requests.run(function(){return m.open(),e.isPaused&&m.send("pause",{}),function(){return m.close()}})}).catch(function(l){s.uppy.emit("upload-error",e,l),d(l)})})},i.uploadBundle=function(e){var n=this;return new Promise(function(a,s){var u=n.opts.endpoint,h=n.opts.method,d=n.uppy.getState().xhrUpload,p=n.createBundledUpload(e,_({},n.opts,d||{})),c=new XMLHttpRequest,v=new ne(n.opts.timeout,function(){c.abort();var l=new Error(n.i18n("timedOut",{seconds:Math.ceil(n.opts.timeout/1e3)}));y(l),s(l)}),y=function(f){e.forEach(function(g){n.uppy.emit("upload-error",g,f)})};c.upload.addEventListener("loadstart",function(l){n.uppy.log("[XHRUpload] started uploading bundle"),v.progress()}),c.upload.addEventListener("progress",function(l){v.progress(),l.lengthComputable&&e.forEach(function(f){n.uppy.emit("upload-progress",f,{uploader:n,bytesUploaded:l.loaded/l.total*f.size,bytesTotal:f.size})})}),c.addEventListener("load",function(l){if(v.done(),n.opts.validateStatus(l.target.status,c.responseText,c)){var f=n.opts.getResponseData(c.responseText,c),g={status:l.target.status,body:f};return e.forEach(function(P){n.uppy.emit("upload-success",P,g)}),a()}var m=n.opts.getResponseError(c.responseText,c)||new Error("Upload error");return m.request=c,y(m),s(m)}),c.addEventListener("error",function(l){v.done();var f=n.opts.getResponseError(c.responseText,c)||new Error("Upload error");return y(f),s(f)}),n.uppy.on("cancel-all",function(){v.done(),c.abort()}),c.open(h.toUpperCase(),u,!0),c.withCredentials=n.opts.withCredentials,n.opts.responseType!==""&&(c.responseType=n.opts.responseType),Object.keys(n.opts.headers).forEach(function(l){c.setRequestHeader(l,n.opts.headers[l])}),c.send(p),e.forEach(function(l){n.uppy.emit("upload-started",l)})})},i.uploadFiles=function(e){var n=this,a=e.map(function(s,u){var h=parseInt(u,10)+1,d=e.length;return s.error?Promise.reject(new Error(s.error)):s.isRemote?n.uploadRemote(s,h,d):n.upload(s,h,d)});return Dt(a)},i.onFileRemove=function(e,n){this.uploaderEvents[e].on("file-removed",function(a){e===a.id&&n(a.id)})},i.onRetry=function(e,n){this.uploaderEvents[e].on("upload-retry",function(a){e===a&&n()})},i.onRetryAll=function(e,n){var a=this;this.uploaderEvents[e].on("retry-all",function(s){a.uppy.getFile(e)&&n()})},i.onCancelAll=function(e,n){var a=this;this.uploaderEvents[e].on("cancel-all",function(){a.uppy.getFile(e)&&n()})},i.handleUpload=function(e){var n=this;
3if(e.length===0)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();this.opts.limit===0&&!this.opts.__queue&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");var a=e.map(function(u){return n.uppy.getFile(u)});if(this.opts.bundle){var s=a.some(function(u){return u.isRemote});if(s)throw new Error("Can’t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");return this.uploadBundle(a)}return this.uploadFiles(a).then(function(){return null})},i.install=function(){if(this.opts.bundle){var e=this.uppy.getState(),n=e.capabilities;this.uppy.setState({capabilities:_({},n,{individualCancellation:!1})})}this.uppy.addUploader(this.handleUpload)},i.uninstall=function(){if(this.opts.bundle){var e=this.uppy.getState(),n=e.capabilities;this.uppy.setState({capabilities:_({},n,{individualCancellation:!0})})}this.uppy.removeUploader(this.handleUpload)},r}($t),ee.VERSION="1.7.5",te);const zt=ve(fe),Mt=Oe({__proto__:null,default:zt},[fe]);export{Mt as i};
4//# sourceMappingURL=index-198500b1.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.