diff --git a/main.js b/main.js index 752b3fb..4bdce15 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,5 @@ -var Ir=Object.create,ne=Object.defineProperty,jr=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty,zr=Object.getOwnPropertyNames,Vr=Object.getOwnPropertyDescriptor;var lt=t=>ne(t,"__esModule",{value:!0});var v=(t,e)=>()=>(e||(e={exports:{}},t(e.exports,e)),e.exports),Wr=(t,e)=>{for(var r in e)ne(t,r,{get:e[r],enumerable:!0})},$r=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of zr(e))!Mr.call(t,n)&&n!=="default"&&ne(t,n,{get:()=>e[n],enumerable:!(r=Vr(e,n))||r.enumerable});return t},se=t=>$r(lt(ne(t!=null?Ir(jr(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var xe=v((ys,ct)=>{"use strict";ct.exports=function(e,r){return function(){for(var s=new Array(arguments.length),i=0;i{"use strict";var Jr=xe(),D=Object.prototype.toString;function Re(t){return D.call(t)==="[object Array]"}function _e(t){return typeof t=="undefined"}function Kr(t){return t!==null&&!_e(t)&&t.constructor!==null&&!_e(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Xr(t){return D.call(t)==="[object ArrayBuffer]"}function Gr(t){return typeof FormData!="undefined"&&t instanceof FormData}function Yr(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Zr(t){return typeof t=="string"}function Qr(t){return typeof t=="number"}function ft(t){return t!==null&&typeof t=="object"}function ie(t){if(D.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function en(t){return D.call(t)==="[object Date]"}function tn(t){return D.call(t)==="[object File]"}function rn(t){return D.call(t)==="[object Blob]"}function ht(t){return D.call(t)==="[object Function]"}function nn(t){return ft(t)&&ht(t.pipe)}function sn(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function on(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function an(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function qe(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Re(t))for(var r=0,n=t.length;r{"use strict";var I=S();function mt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}pt.exports=function(e,r,n){if(!r)return e;var s;if(n)s=n(r);else if(I.isURLSearchParams(r))s=r.toString();else{var i=[];I.forEach(r,function(u,g){u===null||typeof u=="undefined"||(I.isArray(u)?g=g+"[]":u=[u],I.forEach(u,function(l){I.isDate(l)?l=l.toISOString():I.isObject(l)&&(l=JSON.stringify(l)),i.push(mt(g)+"="+mt(l))}))}),s=i.join("&")}if(s){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}});var vt=v((bs,gt)=>{"use strict";var cn=S();function ae(){this.handlers=[]}ae.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};ae.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};ae.prototype.forEach=function(e){cn.forEach(this.handlers,function(n){n!==null&&e(n)})};gt.exports=ae});var Ct=v((Es,yt)=>{"use strict";var dn=S();yt.exports=function(e,r){dn.forEach(e,function(s,i){i!==r&&i.toUpperCase()===r.toUpperCase()&&(e[r]=s,delete e[i])})}});var ue=v((xs,wt)=>{"use strict";wt.exports=function(e,r,n,s,i){return e.config=r,n&&(e.code=n),e.request=s,e.response=i,e.isAxiosError=!0,e.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:this.config,code:this.code}},e}});var le=v((Rs,bt)=>{"use strict";var fn=ue();bt.exports=function(e,r,n,s,i){var o=new Error(e);return fn(o,r,n,s,i)}});var Ue=v((_s,Et)=>{"use strict";var hn=le();Et.exports=function(e,r,n){var s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):r(hn("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Rt=v((qs,xt)=>{"use strict";var ce=S();xt.exports=ce.isStandardBrowserEnv()?function(){return{write:function(r,n,s,i,o,d){var u=[];u.push(r+"="+encodeURIComponent(n)),ce.isNumber(s)&&u.push("expires="+new Date(s).toGMTString()),ce.isString(i)&&u.push("path="+i),ce.isString(o)&&u.push("domain="+o),d===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var qt=v((Ss,_t)=>{"use strict";_t.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Ut=v((Us,St)=>{"use strict";St.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Fe=v((Fs,Ft)=>{"use strict";var pn=qt(),mn=Ut();Ft.exports=function(e,r){return e&&!pn(r)?mn(e,r):r}});var Ot=v((Ts,Tt)=>{"use strict";var Te=S(),gn=["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"];Tt.exports=function(e){var r={},n,s,i;return e&&Te.forEach(e.split(` -`),function(d){if(i=d.indexOf(":"),n=Te.trim(d.substr(0,i)).toLowerCase(),s=Te.trim(d.substr(i+1)),n){if(r[n]&&gn.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([s]):r[n]=r[n]?r[n]+", "+s:s}}),r}});var Nt=v((Os,At)=>{"use strict";var Pt=S();At.exports=Pt.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function s(i){var o=i;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(o){var d=Pt.isString(o)?s(o):o;return d.protocol===n.protocol&&d.host===n.host}}():function(){return function(){return!0}}()});var Dt=v((As,Lt)=>{"use strict";var de=S(),vn=Ue(),yn=Rt(),Cn=oe(),wn=Fe(),bn=Ot(),En=Nt(),Oe=le();Lt.exports=function(e){return new Promise(function(n,s){var i=e.data,o=e.headers,d=e.responseType;de.isFormData(i)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var g=e.auth.username||"",a=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(g+":"+a)}var l=wn(e.baseURL,e.url);u.open(e.method.toUpperCase(),Cn(l,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function p(){if(!!u){var E="getAllResponseHeaders"in u?bn(u.getAllResponseHeaders()):null,b=!d||d==="text"||d==="json"?u.responseText:u.response,f={data:b,status:u.status,statusText:u.statusText,headers:E,config:e,request:u};vn(n,s,f),u=null}}if("onloadend"in u?u.onloadend=p:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(p)},u.onabort=function(){!u||(s(Oe("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){s(Oe("Network Error",e,null,u)),u=null},u.ontimeout=function(){var b="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(b=e.timeoutErrorMessage),s(Oe(b,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},de.isStandardBrowserEnv()){var m=(e.withCredentials||En(l))&&e.xsrfCookieName?yn.read(e.xsrfCookieName):void 0;m&&(o[e.xsrfHeaderName]=m)}"setRequestHeader"in u&&de.forEach(o,function(b,f){typeof i=="undefined"&&f.toLowerCase()==="content-type"?delete o[f]:u.setRequestHeader(f,b)}),de.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),d&&d!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(b){!u||(u.abort(),s(b),u=null)}),i||(i=null),u.send(i)})}});var kt=v((Ps,Bt)=>{var j=1e3,M=j*60,z=M*60,B=z*24,xn=B*7,Rn=B*365.25;Bt.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return _n(t);if(r==="number"&&isFinite(t))return e.long?Sn(t):qn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function _n(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!!e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Rn;case"weeks":case"week":case"w":return r*xn;case"days":case"day":case"d":return r*B;case"hours":case"hour":case"hrs":case"hr":case"h":return r*z;case"minutes":case"minute":case"mins":case"min":case"m":return r*M;case"seconds":case"second":case"secs":case"sec":case"s":return r*j;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function qn(t){var e=Math.abs(t);return e>=B?Math.round(t/B)+"d":e>=z?Math.round(t/z)+"h":e>=M?Math.round(t/M)+"m":e>=j?Math.round(t/j)+"s":t+"ms"}function Sn(t){var e=Math.abs(t);return e>=B?fe(t,e,B,"day"):e>=z?fe(t,e,z,"hour"):e>=M?fe(t,e,M,"minute"):e>=j?fe(t,e,j,"second"):t+" ms"}function fe(t,e,r,n){var s=e>=r*1.5;return Math.round(t/r)+" "+n+(s?"s":"")}});var It=v((Ns,Ht)=>{function Un(t){r.debug=r,r.default=r,r.coerce=u,r.disable=i,r.enable=s,r.enabled=o,r.humanize=kt(),r.destroy=g,Object.keys(t).forEach(a=>{r[a]=t[a]}),r.names=[],r.skips=[],r.formatters={};function e(a){let l=0;for(let p=0;p{if(H==="%%")return"%";C++;let P=r.formatters[Z];if(typeof P=="function"){let Q=f[C];H=P.call(c,Q),f.splice(C,1),C--}return H}),r.formatArgs.call(c,f),(c.log||r.log).apply(c,f)}return b.namespace=a,b.useColors=r.useColors(),b.color=r.selectColor(a),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(m!==r.namespaces&&(m=r.namespaces,E=r.enabled(a)),E),set:f=>{p=f}}),typeof r.init=="function"&&r.init(b),b}function n(a,l){let p=r(this.namespace+(typeof l=="undefined"?":":l)+a);return p.log=this.log,p}function s(a){r.save(a),r.namespaces=a,r.names=[],r.skips=[];let l,p=(typeof a=="string"?a:"").split(/[\s,]+/),m=p.length;for(l=0;l"-"+l)].join(",");return r.enable(""),a}function o(a){if(a[a.length-1]==="*")return!0;let l,p;for(l=0,p=r.skips.length;l{T.formatArgs=Fn;T.save=Tn;T.load=On;T.useColors=An;T.storage=Pn();T.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();T.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function An(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Fn(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+he.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(r++,s==="%c"&&(n=r))}),t.splice(n,0,e)}T.log=console.debug||console.log||(()=>{});function Tn(t){try{t?T.storage.setItem("debug",t):T.storage.removeItem("debug")}catch(e){}}function On(){let t;try{t=T.storage.getItem("debug")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Pn(){try{return localStorage}catch(t){}}he.exports=It()(T);var{formatters:Nn}=he.exports;Nn.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var zt=v((Ls,Mt)=>{var W;Mt.exports=function(){if(!W){try{W=jt()("follow-redirects")}catch(t){}typeof W!="function"&&(W=function(){})}W.apply(null,arguments)}});var Ve=v((Ds,Ae)=>{var $=require("url"),J=$.URL,Ln=require("http"),Dn=require("https"),Pe=require("stream").Writable,Ne=require("assert"),Vt=zt(),Le=!1;try{Ne(new J)}catch(t){Le=t.code==="ERR_INVALID_URL"}var Bn=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],De=["abort","aborted","connect","error","socket","timeout"],Be=Object.create(null);De.forEach(function(t){Be[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var ke=K("ERR_INVALID_URL","Invalid URL",TypeError),He=K("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),kn=K("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",He),Hn=K("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),In=K("ERR_STREAM_WRITE_AFTER_END","write after end"),jn=Pe.prototype.destroy||Wt;function U(t,e){Pe.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var r=this;this._onNativeResponse=function(n){try{r._processResponse(n)}catch(s){r.emit("error",s instanceof He?s:new He({cause:s}))}},this._performRequest()}U.prototype=Object.create(Pe.prototype);U.prototype.abort=function(){Ie(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};U.prototype.destroy=function(t){return Ie(this._currentRequest,t),jn.call(this,t),this};U.prototype.write=function(t,e,r){if(this._ending)throw new In;if(!k(t)&&!Mn(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(X(e)&&(r=e,e=null),t.length===0){r&&r();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,r)):(this.emit("error",new Hn),this.abort())};U.prototype.end=function(t,e,r){if(X(t)?(r=t,t=e=null):X(e)&&(r=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,r);else{var n=this,s=this._currentRequest;this.write(t,e,function(){n._ended=!0,s.end(null,null,r)}),this._ending=!0}};U.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)};U.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)};U.prototype.setTimeout=function(t,e){var r=this;function n(o){o.setTimeout(t),o.removeListener("timeout",o.destroy),o.addListener("timeout",o.destroy)}function s(o){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout(function(){r.emit("timeout"),i()},t),n(o)}function i(){r._timeout&&(clearTimeout(r._timeout),r._timeout=null),r.removeListener("abort",i),r.removeListener("error",i),r.removeListener("response",i),r.removeListener("close",i),e&&r.removeListener("timeout",e),r.socket||r._currentRequest.removeListener("socket",s)}return e&&this.on("timeout",e),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",n),this.on("abort",i),this.on("error",i),this.on("response",i),this.on("close",i),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){U.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(U.prototype,t,{get:function(){return this._currentRequest[t]}})});U.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e))}};U.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e)throw new TypeError("Unsupported protocol "+t);if(this._options.agents){var r=t.slice(0,-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);n._redirectable=this;for(var s of De)n.on(s,Be[s]);if(this._currentUrl=/^\//.test(this._options.path)?$.format(this._options):this._options.path,this._isRedirect){var i=0,o=this,d=this._requestBodyBuffers;(function u(g){if(n===o._currentRequest)if(g)o.emit("error",g);else if(i=400){t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[];return}if(Ie(this._currentRequest),t.destroy(),++this._redirectCount>this._options.maxRedirects)throw new kn;var n,s=this._options.beforeRedirect;s&&(n=Object.assign({Host:t.req.getHeader("host")},this._options.headers));var i=this._options.method;((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],ze(/^content-/i,this._options.headers));var o=ze(/^host$/i,this._options.headers),d=je(this._currentUrl),u=o||d.host,g=/^\w+:/.test(r)?this._currentUrl:$.format(Object.assign(d,{host:u})),a=zn(r,g);if(Vt("redirecting to",a.href),this._isRedirect=!0,Me(a,this._options),(a.protocol!==d.protocol&&a.protocol!=="https:"||a.host!==u&&!Vn(a.host,u))&&ze(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),X(s)){var l={headers:t.headers,statusCode:e},p={url:g,method:i,headers:n};s(this._options,l,p),this._sanitizeOptions(this._options)}this._performRequest()};function Jt(t){var e={maxRedirects:21,maxBodyLength:10*1024*1024},r={};return Object.keys(t).forEach(function(n){var s=n+":",i=r[s]=t[n],o=e[n]=Object.create(i);function d(g,a,l){return Wn(g)?g=Me(g):k(g)?g=Me(je(g)):(l=a,a=$t(g),g={protocol:s}),X(a)&&(l=a,a=null),a=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},g,a),a.nativeProtocols=r,!k(a.host)&&!k(a.hostname)&&(a.hostname="::1"),Ne.equal(a.protocol,s,"protocol mismatch"),Vt("options",a),new U(a,l)}function u(g,a,l){var p=o.request(g,a,l);return p.end(),p}Object.defineProperties(o,{request:{value:d,configurable:!0,enumerable:!0,writable:!0},get:{value:u,configurable:!0,enumerable:!0,writable:!0}})}),e}function Wt(){}function je(t){var e;if(Le)e=new J(t);else if(e=$t($.parse(t)),!k(e.protocol))throw new ke({input:t});return e}function zn(t,e){return Le?new J(t,e):je($.resolve(e,t))}function $t(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname))throw new ke({input:t.href||t});if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host))throw new ke({input:t.href||t});return t}function Me(t,e){var r=e||{};for(var n of Bn)r[n]=t[n];return r.hostname.startsWith("[")&&(r.hostname=r.hostname.slice(1,-1)),r.port!==""&&(r.port=Number(r.port)),r.path=r.search?r.pathname+r.search:r.pathname,r}function ze(t,e){var r;for(var n in e)t.test(n)&&(r=e[n],delete e[n]);return r===null||typeof r=="undefined"?void 0:String(r).trim()}function K(t,e,r){function n(s){Error.captureStackTrace(this,this.constructor),Object.assign(this,s||{}),this.code=t,this.message=this.cause?e+": "+this.cause.message:e}return n.prototype=new(r||Error),Object.defineProperties(n.prototype,{constructor:{value:n,enumerable:!1},name:{value:"Error ["+t+"]",enumerable:!1}}),n}function Ie(t,e){for(var r of De)t.removeListener(r,Be[r]);t.on("error",Wt),t.destroy(e)}function Vn(t,e){Ne(k(t)&&k(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}function k(t){return typeof t=="string"||t instanceof String}function X(t){return typeof t=="function"}function Mn(t){return typeof t=="object"&&"length"in t}function Wn(t){return J&&t instanceof J}Ae.exports=Jt({http:Ln,https:Dn});Ae.exports.wrap=Jt});var We=v((Bs,Kt)=>{Kt.exports={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]}});var er=v((ks,Xt)=>{"use strict";var G=S(),Gt=Ue(),$n=Fe(),Jn=oe(),Kn=require("http"),Xn=require("https"),Gn=Ve().http,Yn=Ve().https,Yt=require("url"),Zn=require("zlib"),Qn=We(),pe=le(),$e=ue(),Zt=/https:?/;function Qt(t,e,r){if(t.hostname=e.host,t.host=e.host,t.port=e.port,t.path=r,e.auth){var n=Buffer.from(e.auth.username+":"+e.auth.password,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+n}t.beforeRedirect=function(i){i.headers.host=i.host,Qt(i,e,i.href)}}Xt.exports=function(e){return new Promise(function(n,s){var i=function(w){n(w)},o=function(w){s(w)},d=e.data,u=e.headers;if("User-Agent"in u||"user-agent"in u?!u["User-Agent"]&&!u["user-agent"]&&(delete u["User-Agent"],delete u["user-agent"]):u["User-Agent"]="axios/"+Qn.version,d&&!G.isStream(d)){if(!Buffer.isBuffer(d))if(G.isArrayBuffer(d))d=Buffer.from(new Uint8Array(d));else if(G.isString(d))d=Buffer.from(d,"utf-8");else return o(pe("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));u["Content-Length"]=d.length}var g=void 0;if(e.auth){var a=e.auth.username||"",l=e.auth.password||"";g=a+":"+l}var p=$n(e.baseURL,e.url),m=Yt.parse(p),E=m.protocol||"http:";if(!g&&m.auth){var b=m.auth.split(":"),f=b[0]||"",c=b[1]||"";g=f+":"+c}g&&delete u.Authorization;var h=Zt.test(E),y=h?e.httpsAgent:e.httpAgent,C={path:Jn(m.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:u,agent:y,agents:{http:e.httpAgent,https:e.httpsAgent},auth:g};e.socketPath?C.socketPath=e.socketPath:(C.hostname=m.hostname,C.port=m.port);var _=e.proxy;if(!_&&_!==!1){var H=E.slice(0,-1)+"_proxy",Z=process.env[H]||process.env[H.toUpperCase()];if(Z){var P=Yt.parse(Z),Q=process.env.no_proxy||process.env.NO_PROXY,nt=!0;if(Q){var Hr=Q.split(",").map(function(w){return w.trim()});nt=!Hr.some(function(w){return w?w==="*"||w[0]==="."&&m.hostname.substr(m.hostname.length-w.length)===w?!0:m.hostname===w:!1})}if(nt&&(_={host:P.hostname,port:P.port,protocol:P.protocol},P.auth)){var st=P.auth.split(":");_.auth={username:st[0],password:st[1]}}}}_&&(C.headers.host=m.hostname+(m.port?":"+m.port:""),Qt(C,_,E+"//"+m.hostname+(m.port?":"+m.port:"")+C.path));var ee,it=h&&(_?Zt.test(_.protocol):!0);e.transport?ee=e.transport:e.maxRedirects===0?ee=it?Xn:Kn:(e.maxRedirects&&(C.maxRedirects=e.maxRedirects),ee=it?Yn:Gn),e.maxBodyLength>-1&&(C.maxBodyLength=e.maxBodyLength);var q=ee.request(C,function(w){if(!q.aborted){var L=w,te=w.req||q;if(w.statusCode!==204&&te.method!=="HEAD"&&e.decompress!==!1)switch(w.headers["content-encoding"]){case"gzip":case"compress":case"deflate":L=L.pipe(Zn.createUnzip()),delete w.headers["content-encoding"];break}var re={status:w.statusCode,statusText:w.statusMessage,headers:w.headers,config:e,request:te};if(e.responseType==="stream")re.data=L,Gt(i,o,re);else{var ot=[],at=0;L.on("data",function(A){ot.push(A),at+=A.length,e.maxContentLength>-1&&at>e.maxContentLength&&(L.destroy(),o(pe("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,te)))}),L.on("error",function(A){q.aborted||o($e(A,e,null,te))}),L.on("end",function(){var A=Buffer.concat(ot);e.responseType!=="arraybuffer"&&(A=A.toString(e.responseEncoding),(!e.responseEncoding||e.responseEncoding==="utf8")&&(A=G.stripBOM(A))),re.data=A,Gt(i,o,re)})}}});if(q.on("error",function(w){q.aborted&&w.code!=="ERR_FR_TOO_MANY_REDIRECTS"||o($e(w,e,null,q))}),e.timeout){var Ee=parseInt(e.timeout,10);if(isNaN(Ee)){o(pe("error trying to parse `config.timeout` to int",e,"ERR_PARSE_TIMEOUT",q));return}q.setTimeout(Ee,function(){q.abort(),o(pe("timeout of "+Ee+"ms exceeded",e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",q))})}e.cancelToken&&e.cancelToken.promise.then(function(w){q.aborted||(q.abort(),o(w))}),G.isStream(d)?d.on("error",function(w){o($e(w,e,null,q))}).pipe(q):q.end(d)})}});var ge=v((Hs,tr)=>{"use strict";var x=S(),rr=Ct(),es=ue(),ts={"Content-Type":"application/x-www-form-urlencoded"};function nr(t,e){!x.isUndefined(t)&&x.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function rs(){var t;return typeof XMLHttpRequest!="undefined"?t=Dt():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=er()),t}function ns(t,e,r){if(x.isString(t))try{return(e||JSON.parse)(t),x.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var me={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:rs(),transformRequest:[function(e,r){return rr(r,"Accept"),rr(r,"Content-Type"),x.isFormData(e)||x.isArrayBuffer(e)||x.isBuffer(e)||x.isStream(e)||x.isFile(e)||x.isBlob(e)?e:x.isArrayBufferView(e)?e.buffer:x.isURLSearchParams(e)?(nr(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):x.isObject(e)||r&&r["Content-Type"]==="application/json"?(nr(r,"application/json"),ns(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,s=r&&r.forcedJSONParsing,i=!n&&this.responseType==="json";if(i||s&&x.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(i)throw o.name==="SyntaxError"?es(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};me.headers={common:{Accept:"application/json, text/plain, */*"}};x.forEach(["delete","get","head"],function(e){me.headers[e]={}});x.forEach(["post","put","patch"],function(e){me.headers[e]=x.merge(ts)});tr.exports=me});var ir=v((Is,sr)=>{"use strict";var ss=S(),is=ge();sr.exports=function(e,r,n){var s=this||is;return ss.forEach(n,function(o){e=o.call(s,e,r)}),e}});var Je=v((js,or)=>{"use strict";or.exports=function(e){return!!(e&&e.__CANCEL__)}});var lr=v((Ms,ar)=>{"use strict";var ur=S(),Ke=ir(),os=Je(),as=ge();function Xe(t){t.cancelToken&&t.cancelToken.throwIfRequested()}ar.exports=function(e){Xe(e),e.headers=e.headers||{},e.data=Ke.call(e,e.data,e.headers,e.transformRequest),e.headers=ur.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ur.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var r=e.adapter||as.adapter;return r(e).then(function(s){return Xe(e),s.data=Ke.call(e,s.data,s.headers,e.transformResponse),s},function(s){return os(s)||(Xe(e),s&&s.response&&(s.response.data=Ke.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})}});var Ge=v((zs,cr)=>{"use strict";var R=S();cr.exports=function(e,r){r=r||{};var n={},s=["url","method","data"],i=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],d=["validateStatus"];function u(p,m){return R.isPlainObject(p)&&R.isPlainObject(m)?R.merge(p,m):R.isPlainObject(m)?R.merge({},m):R.isArray(m)?m.slice():m}function g(p){R.isUndefined(r[p])?R.isUndefined(e[p])||(n[p]=u(void 0,e[p])):n[p]=u(e[p],r[p])}R.forEach(s,function(m){R.isUndefined(r[m])||(n[m]=u(void 0,r[m]))}),R.forEach(i,g),R.forEach(o,function(m){R.isUndefined(r[m])?R.isUndefined(e[m])||(n[m]=u(void 0,e[m])):n[m]=u(void 0,r[m])}),R.forEach(d,function(m){m in r?n[m]=u(e[m],r[m]):m in e&&(n[m]=u(void 0,e[m]))});var a=s.concat(i).concat(o).concat(d),l=Object.keys(e).concat(Object.keys(r)).filter(function(m){return a.indexOf(m)===-1});return R.forEach(l,g),n}});var mr=v((Vs,dr)=>{"use strict";var fr=We(),Ye={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Ye[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var hr={},us=fr.version.split(".");function pr(t,e){for(var r=e?e.split("."):us,n=t.split("."),s=0;s<3;s++){if(r[s]>n[s])return!0;if(r[s]0;){var i=n[s],o=e[i];if(o){var d=t[i],u=d===void 0||o(d,i,t);if(u!==!0)throw new TypeError("option "+i+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+i)}}dr.exports={isOlderVersion:pr,assertOptions:ls,validators:Ye}});var br=v((Ws,gr)=>{"use strict";var vr=S(),cs=oe(),yr=vt(),Cr=lr(),ve=Ge(),wr=mr(),V=wr.validators;function Y(t){this.defaults=t,this.interceptors={request:new yr,response:new yr}}Y.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=ve(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&wr.assertOptions(r,{silentJSONParsing:V.transitional(V.boolean,"1.0.0"),forcedJSONParsing:V.transitional(V.boolean,"1.0.0"),clarifyTimeoutError:V.transitional(V.boolean,"1.0.0")},!1);var n=[],s=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(e)===!1||(s=s&&p.synchronous,n.unshift(p.fulfilled,p.rejected))});var i=[];this.interceptors.response.forEach(function(p){i.push(p.fulfilled,p.rejected)});var o;if(!s){var d=[Cr,void 0];for(Array.prototype.unshift.apply(d,n),d=d.concat(i),o=Promise.resolve(e);d.length;)o=o.then(d.shift(),d.shift());return o}for(var u=e;n.length;){var g=n.shift(),a=n.shift();try{u=g(u)}catch(l){a(l);break}}try{o=Cr(u)}catch(l){return Promise.reject(l)}for(;i.length;)o=o.then(i.shift(),i.shift());return o};Y.prototype.getUri=function(e){return e=ve(this.defaults,e),cs(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};vr.forEach(["delete","get","head","options"],function(e){Y.prototype[e]=function(r,n){return this.request(ve(n||{},{method:e,url:r,data:(n||{}).data}))}});vr.forEach(["post","put","patch"],function(e){Y.prototype[e]=function(r,n,s){return this.request(ve(s||{},{method:e,url:r,data:n}))}});gr.exports=Y});var Qe=v(($s,Er)=>{"use strict";function Ze(t){this.message=t}Ze.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Ze.prototype.__CANCEL__=!0;Er.exports=Ze});var Rr=v((Js,xr)=>{"use strict";var ds=Qe();function ye(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var r=this;t(function(s){r.reason||(r.reason=new ds(s),e(r.reason))})}ye.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};ye.source=function(){var e,r=new ye(function(s){e=s});return{token:r,cancel:e}};xr.exports=ye});var qr=v((Ks,_r)=>{"use strict";_r.exports=function(e){return function(n){return e.apply(null,n)}}});var Ur=v((Xs,Sr)=>{"use strict";Sr.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Or=v((Gs,et)=>{"use strict";var Fr=S(),fs=xe(),Ce=br(),hs=Ge(),ps=ge();function Tr(t){var e=new Ce(t),r=fs(Ce.prototype.request,e);return Fr.extend(r,Ce.prototype,e),Fr.extend(r,e),r}var O=Tr(ps);O.Axios=Ce;O.create=function(e){return Tr(hs(O.defaults,e))};O.Cancel=Qe();O.CancelToken=Rr();O.isCancel=Je();O.all=function(e){return Promise.all(e)};O.spread=qr();O.isAxiosError=Ur();et.exports=O;et.exports.default=O});var Pr=v((Ys,Ar)=>{Ar.exports=Or()});var Lr=v((Nr,we)=>{(function(t,e){"use strict";typeof we=="object"&&typeof we.exports=="object"?we.exports=e():typeof define=="function"&&define.amd?define([],e):t.objectPath=e()})(Nr,function(){"use strict";var t=Object.prototype.toString;function e(a,l){return a==null?!1:Object.prototype.hasOwnProperty.call(a,l)}function r(a){if(!a||i(a)&&a.length===0)return!0;if(typeof a!="string"){for(var l in a)if(e(a,l))return!1;return!0}return!1}function n(a){return t.call(a)}function s(a){return typeof a=="object"&&n(a)==="[object Object]"}var i=Array.isArray||function(a){return t.call(a)==="[object Array]"};function o(a){return typeof a=="boolean"||n(a)==="[object Boolean]"}function d(a){var l=parseInt(a);return l.toString()===a?l:a}function u(a){a=a||{};var l=function(f){return Object.keys(l).reduce(function(c,h){return h==="create"||typeof l[h]=="function"&&(c[h]=l[h].bind(l,f)),c},{})},p;a.includeInheritedProps?p=function(){return!0}:p=function(f,c){return typeof c=="number"&&Array.isArray(f)||e(f,c)};function m(f,c){if(p(f,c))return f[c]}var E;a.includeInheritedProps?E=function(f,c){typeof c!="string"&&typeof c!="number"&&(c=String(c));var h=m(f,c);if(c==="__proto__"||c==="prototype"||c==="constructor"&&typeof h=="function")throw new Error("For security reasons, object's magic properties cannot be set");return h}:E=function(f,c){return m(f,c)};function b(f,c,h,y){if(typeof c=="number"&&(c=[c]),!c||c.length===0)return f;if(typeof c=="string")return b(f,c.split(".").map(d),h,y);var C=c[0],_=E(f,C);return c.length===1?((_===void 0||!y)&&(f[C]=h),_):(_===void 0&&(typeof c[1]=="number"?f[C]=[]:f[C]={}),b(f[C],c.slice(1),h,y))}return l.has=function(f,c){if(typeof c=="number"?c=[c]:typeof c=="string"&&(c=c.split(".")),!c||c.length===0)return!!f;for(var h=0;hgs});var be=se(require("obsidian")),Br=se(Pr()),kr=se(Lr());var F=se(require("obsidian")),tt=class extends F.PluginSettingTab{constructor(e,r){super(e,r);this.plugin=r}display(){let{containerEl:e}=this;e.empty(),e.createEl("h3",{text:"Cloudinary Settings"}),new F.Setting(e).setName("Cloud Name").setDesc("The name of your Cloudinary Cloud Account").addText(i=>{i.setPlaceholder("").setValue(this.plugin.settings.cloudName).onChange(async o=>{this.plugin.settings.cloudName=o,await this.plugin.saveSettings()})}),new F.Setting(e).setName("Cloudinary Upload Template").setDesc("Cloudinary Upload Preference string").addText(i=>{i.setPlaceholder("").setValue(this.plugin.settings.uploadPreset).onChange(async o=>{try{this.plugin.settings.uploadPreset=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})}),new F.Setting(e).setName("Cloudinary Upload Folder").setDesc("Folder name to use in Cloudinary. Note, this will be ignored if you have a folder set in your Cloudinary Upload Preset").addText(i=>{i.setPlaceholder("obsidian").setValue(this.plugin.settings.folder).onChange(async o=>{try{this.plugin.settings.folder=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})}),e.createEl("h4",{text:"Paste Behaviour"}),new F.Setting(e).setName("Upload on Clipboard Copy/Paste").setDesc("Upload files on a copy/paste from clipboard").addToggle(i=>{i.setValue(this.plugin.settings.clipboardUpload).onChange(async o=>{try{this.plugin.settings.clipboardUpload=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})}),new F.Setting(e).setName("Upload on Drag/Drop").setDesc("Upload files on a drag/drop").addToggle(i=>{i.setValue(this.plugin.settings.dropUpload).onChange(async o=>{try{this.plugin.settings.dropUpload=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})}),e.createEl("h4",{text:"URL Manipulations / Transformation"});let r=document.createDocumentFragment(),n=document.createElement("a"),s=document.createElement("a");s.text="transformation limits ",s.href="https://cloudinary.com/documentation/transformation_counts",r.append("The settings below are meant for default image transformations. As they only touch the resulting URL, this should not cause any upload errors, however, if syntax is incorrect, your images will not be referenced correctly (won't render). Be mindful of your Cloudinary "),r.append(s),r.append(" and use the "),n.href="https://cloudinary.com/documentation/transformation_reference",n.text=" Cloudinary documentation",r.append(n),r.append(" for guidance."),e.createEl("p",{text:r}),r=document.createDocumentFragment(),n=document.createElement("a"),n.href="https://cloudinary.com/documentation/image_optimization#automatic_format_selection_f_auto",n.text="f_auto option",r.append("Enable the "),r.append(n),r.append(" for uploads"),new F.Setting(e).setName("f_auto Option").setDesc(r).addToggle(i=>{i.setValue(this.plugin.settings.f_auto).onChange(async o=>{try{this.plugin.settings.f_auto=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})}),r=document.createDocumentFragment(),n=document.createElement("a"),n.href="https://cloudinary.com/documentation/transformation_reference",n.text="View Cloudinary's transformation reference for guidance.",r.append("Add a comma-delimited default set of transformations to your uploads. You do NOT need to include f_auto here if already enabled above. "),r.append(n),new F.Setting(e).setName("Default Transformation Parameters").setDesc(r).addText(i=>{i.setPlaceholder("w_150,h_150").setValue(this.plugin.settings.transformParams).onChange(async o=>{try{this.plugin.settings.transformParams=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})}),e.createEl("h4",{text:"Enabled File Types"}),r=document.createDocumentFragment(),r.append("Choose which file types are uploaded to Cloudinary. Disabled types are ignored"),e.createEl("p",{text:r}),new F.Setting(e).setName("Upload Images").addToggle(i=>{i.setValue(this.plugin.settings.imageUpload).onChange(async o=>{try{this.plugin.settings.imageUpload=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})}),new F.Setting(e).setName("Upload Audio").addToggle(i=>{i.setValue(this.plugin.settings.audioUpload).onChange(async o=>{try{this.plugin.settings.audioUpload=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})}),new F.Setting(e).setName("Upload Video").addToggle(i=>{i.setValue(this.plugin.settings.videoUpload).onChange(async o=>{try{this.plugin.settings.videoUpload=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})}),new F.Setting(e).setName("Upload Raw Files").setDesc("Raw files are those files that are not necessarily media files, but Cloudinary will still accept for upload").addToggle(i=>{i.setValue(this.plugin.settings.rawUpload).onChange(async o=>{try{this.plugin.settings.rawUpload=o,await this.plugin.saveSettings()}catch(d){console.log(d)}})})}},Dr=tt;var ms={cloudName:null,uploadPreset:null,folder:null,f_auto:!1,transformParams:null,dropUpload:!1,clipboardUpload:!0,imageUpload:!0,audioUpload:!1,videoUpload:!1,rawUpload:!1},rt=class extends be.Plugin{constructor(){super(...arguments);this.pasteHandler=async(e,r)=>{let{files:n}=e.clipboardData;await this.uploadFiles(n,e,r)};this.dropHandler=async(e,r)=>{let{files:n}=e.dataTransfer;await this.uploadFiles(n,e,r)};this.uploadFiles=async(e,r,n)=>{if(e.length>0&&(this.settings.audioUpload&&e[0].type.startsWith("audio")||this.settings.videoUpload&&e[0].type.startsWith("video")||this.settings.imageUpload&&e[0].type.startsWith("image")||this.settings.rawUpload&&!e[0].type.startsWith("image")&&!e[0].type.startsWith("audio")&&!e[0].type.startsWith("video"))&&(r.preventDefault(),this.settings.cloudName&&this.settings.uploadPreset))for(let s of e){let o=`![uploading...](${(Math.random()*10086).toString(36).substr(0,8)}) -`;n.replaceSelection(o);let d=new FormData;d.append("file",s),d.append("upload_preset",this.settings.uploadPreset),d.append("folder",this.settings.folder),(0,Br.default)({url:`https://api.cloudinary.com/v1_1/${this.settings.cloudName}/auto/upload`,method:"POST",data:d}).then(u=>{console.log(u);let g=kr.default.get(u.data,"secure_url"),a="";if(this.settings.transformParams){let l=g.split("/upload/",2);g=l[0]+="/upload/"+this.settings.transformParams+"/"+l[1],a=`![](${g})`}if(this.settings.f_auto){let l=g.split("/upload/",2);g=l[0]+="/upload/f_auto/"+l[1],a=`![](${g})`}else a=`![](${g})`;e[0].type.startsWith("audio")?a=` +var jr=Object.create,ne=Object.defineProperty,Mr=Object.getPrototypeOf,Vr=Object.prototype.hasOwnProperty,$r=Object.getOwnPropertyNames,zr=Object.getOwnPropertyDescriptor;var lt=t=>ne(t,"__esModule",{value:!0});var v=(t,e)=>()=>(e||(e={exports:{}},t(e.exports,e)),e.exports),Wr=(t,e)=>{for(var r in e)ne(t,r,{get:e[r],enumerable:!0})},Jr=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of $r(e))!Vr.call(t,s)&&s!=="default"&&ne(t,s,{get:()=>e[s],enumerable:!(r=zr(e,s))||r.enumerable});return t},ie=t=>Jr(lt(ne(t!=null?jr(Mr(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var xe=v((yn,dt)=>{"use strict";dt.exports=function(e,r){return function(){for(var n=new Array(arguments.length),i=0;i{"use strict";var Kr=xe(),D=Object.prototype.toString;function Se(t){return D.call(t)==="[object Array]"}function Re(t){return typeof t=="undefined"}function Gr(t){return t!==null&&!Re(t)&&t.constructor!==null&&!Re(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Xr(t){return D.call(t)==="[object ArrayBuffer]"}function Yr(t){return typeof FormData!="undefined"&&t instanceof FormData}function Zr(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Qr(t){return typeof t=="string"}function es(t){return typeof t=="number"}function ft(t){return t!==null&&typeof t=="object"}function oe(t){if(D.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ts(t){return D.call(t)==="[object Date]"}function rs(t){return D.call(t)==="[object File]"}function ss(t){return D.call(t)==="[object Blob]"}function ht(t){return D.call(t)==="[object Function]"}function ns(t){return ft(t)&&ht(t.pipe)}function is(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function os(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function as(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function _e(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Se(t))for(var r=0,s=t.length;r{"use strict";var I=U();function mt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}pt.exports=function(e,r,s){if(!r)return e;var n;if(s)n=s(r);else if(I.isURLSearchParams(r))n=r.toString();else{var i=[];I.forEach(r,function(u,g){u===null||typeof u=="undefined"||(I.isArray(u)?g=g+"[]":u=[u],I.forEach(u,function(l){I.isDate(l)?l=l.toISOString():I.isObject(l)&&(l=JSON.stringify(l)),i.push(mt(g)+"="+mt(l))}))}),n=i.join("&")}if(n){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+n}return e}});var vt=v((bn,gt)=>{"use strict";var ds=U();function ue(){this.handlers=[]}ue.prototype.use=function(e,r,s){return this.handlers.push({fulfilled:e,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1};ue.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};ue.prototype.forEach=function(e){ds.forEach(this.handlers,function(s){s!==null&&e(s)})};gt.exports=ue});var wt=v((En,yt)=>{"use strict";var cs=U();yt.exports=function(e,r){cs.forEach(e,function(n,i){i!==r&&i.toUpperCase()===r.toUpperCase()&&(e[r]=n,delete e[i])})}});var le=v((xn,Ct)=>{"use strict";Ct.exports=function(e,r,s,n,i){return e.config=r,s&&(e.code=s),e.request=n,e.response=i,e.isAxiosError=!0,e.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:this.config,code:this.code}},e}});var de=v((Sn,bt)=>{"use strict";var fs=le();bt.exports=function(e,r,s,n,i){var o=new Error(e);return fs(o,r,s,n,i)}});var Ue=v((Rn,Et)=>{"use strict";var hs=de();Et.exports=function(e,r,s){var n=s.config.validateStatus;!s.status||!n||n(s.status)?e(s):r(hs("Request failed with status code "+s.status,s.config,null,s.request,s))}});var St=v((_n,xt)=>{"use strict";var ce=U();xt.exports=ce.isStandardBrowserEnv()?function(){return{write:function(r,s,n,i,o,c){var u=[];u.push(r+"="+encodeURIComponent(s)),ce.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),ce.isString(i)&&u.push("path="+i),ce.isString(o)&&u.push("domain="+o),c===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var s=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var _t=v((qn,Rt)=>{"use strict";Rt.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Ut=v((Un,qt)=>{"use strict";qt.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Fe=v((Fn,Ft)=>{"use strict";var ps=_t(),ms=Ut();Ft.exports=function(e,r){return e&&!ps(r)?ms(e,r):r}});var At=v((Tn,Tt)=>{"use strict";var Te=U(),gs=["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"];Tt.exports=function(e){var r={},s,n,i;return e&&Te.forEach(e.split(` +`),function(c){if(i=c.indexOf(":"),s=Te.trim(c.substr(0,i)).toLowerCase(),n=Te.trim(c.substr(i+1)),s){if(r[s]&&gs.indexOf(s)>=0)return;s==="set-cookie"?r[s]=(r[s]?r[s]:[]).concat([n]):r[s]=r[s]?r[s]+", "+n:n}}),r}});var Nt=v((An,Ot)=>{"use strict";var Pt=U();Ot.exports=Pt.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),s;function n(i){var o=i;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return s=n(window.location.href),function(o){var c=Pt.isString(o)?n(o):o;return c.protocol===s.protocol&&c.host===s.host}}():function(){return function(){return!0}}()});var Dt=v((On,Lt)=>{"use strict";var fe=U(),vs=Ue(),ys=St(),ws=ae(),Cs=Fe(),bs=At(),Es=Nt(),Ae=de();Lt.exports=function(e){return new Promise(function(s,n){var i=e.data,o=e.headers,c=e.responseType;fe.isFormData(i)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var g=e.auth.username||"",a=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(g+":"+a)}var l=Cs(e.baseURL,e.url);u.open(e.method.toUpperCase(),ws(l,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function p(){if(!!u){var E="getAllResponseHeaders"in u?bs(u.getAllResponseHeaders()):null,b=!c||c==="text"||c==="json"?u.responseText:u.response,f={data:b,status:u.status,statusText:u.statusText,headers:E,config:e,request:u};vs(s,n,f),u=null}}if("onloadend"in u?u.onloadend=p:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(p)},u.onabort=function(){!u||(n(Ae("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){n(Ae("Network Error",e,null,u)),u=null},u.ontimeout=function(){var b="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(b=e.timeoutErrorMessage),n(Ae(b,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},fe.isStandardBrowserEnv()){var m=(e.withCredentials||Es(l))&&e.xsrfCookieName?ys.read(e.xsrfCookieName):void 0;m&&(o[e.xsrfHeaderName]=m)}"setRequestHeader"in u&&fe.forEach(o,function(b,f){typeof i=="undefined"&&f.toLowerCase()==="content-type"?delete o[f]:u.setRequestHeader(f,b)}),fe.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),c&&c!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(b){!u||(u.abort(),n(b),u=null)}),i||(i=null),u.send(i)})}});var kt=v((Pn,Bt)=>{var j=1e3,M=j*60,V=M*60,B=V*24,xs=B*7,Ss=B*365.25;Bt.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Rs(t);if(r==="number"&&isFinite(t))return e.long?qs(t):_s(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Rs(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!!e){var r=parseFloat(e[1]),s=(e[2]||"ms").toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return r*Ss;case"weeks":case"week":case"w":return r*xs;case"days":case"day":case"d":return r*B;case"hours":case"hour":case"hrs":case"hr":case"h":return r*V;case"minutes":case"minute":case"mins":case"min":case"m":return r*M;case"seconds":case"second":case"secs":case"sec":case"s":return r*j;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function _s(t){var e=Math.abs(t);return e>=B?Math.round(t/B)+"d":e>=V?Math.round(t/V)+"h":e>=M?Math.round(t/M)+"m":e>=j?Math.round(t/j)+"s":t+"ms"}function qs(t){var e=Math.abs(t);return e>=B?he(t,e,B,"day"):e>=V?he(t,e,V,"hour"):e>=M?he(t,e,M,"minute"):e>=j?he(t,e,j,"second"):t+" ms"}function he(t,e,r,s){var n=e>=r*1.5;return Math.round(t/r)+" "+s+(n?"s":"")}});var It=v((Nn,Ht)=>{function Us(t){r.debug=r,r.default=r,r.coerce=u,r.disable=i,r.enable=n,r.enabled=o,r.humanize=kt(),r.destroy=g,Object.keys(t).forEach(a=>{r[a]=t[a]}),r.names=[],r.skips=[],r.formatters={};function e(a){let l=0;for(let p=0;p{if(H==="%%")return"%";w++;let P=r.formatters[Q];if(typeof P=="function"){let ee=f[w];H=P.call(d,ee),f.splice(w,1),w--}return H}),r.formatArgs.call(d,f),(d.log||r.log).apply(d,f)}return b.namespace=a,b.useColors=r.useColors(),b.color=r.selectColor(a),b.extend=s,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(m!==r.namespaces&&(m=r.namespaces,E=r.enabled(a)),E),set:f=>{p=f}}),typeof r.init=="function"&&r.init(b),b}function s(a,l){let p=r(this.namespace+(typeof l=="undefined"?":":l)+a);return p.log=this.log,p}function n(a){r.save(a),r.namespaces=a,r.names=[],r.skips=[];let l,p=(typeof a=="string"?a:"").split(/[\s,]+/),m=p.length;for(l=0;l"-"+l)].join(",");return r.enable(""),a}function o(a){if(a[a.length-1]==="*")return!0;let l,p;for(l=0,p=r.skips.length;l{T.formatArgs=Fs;T.save=Ts;T.load=As;T.useColors=Os;T.storage=Ps();T.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();T.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Os(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Fs(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+pe.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(s=r))}),t.splice(s,0,e)}T.log=console.debug||console.log||(()=>{});function Ts(t){try{t?T.storage.setItem("debug",t):T.storage.removeItem("debug")}catch(e){}}function As(){let t;try{t=T.storage.getItem("debug")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Ps(){try{return localStorage}catch(t){}}pe.exports=It()(T);var{formatters:Ns}=pe.exports;Ns.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Vt=v((Ln,Mt)=>{var z;Mt.exports=function(){if(!z){try{z=jt()("follow-redirects")}catch(t){}typeof z!="function"&&(z=function(){})}z.apply(null,arguments)}});var $e=v((Dn,Oe)=>{var W=require("url"),J=W.URL,Ls=require("http"),Ds=require("https"),Pe=require("stream").Writable,Ne=require("assert"),$t=Vt(),Le=!1;try{Ne(new J)}catch(t){Le=t.code==="ERR_INVALID_URL"}var Bs=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],De=["abort","aborted","connect","error","socket","timeout"],Be=Object.create(null);De.forEach(function(t){Be[t]=function(e,r,s){this._redirectable.emit(t,e,r,s)}});var ke=K("ERR_INVALID_URL","Invalid URL",TypeError),He=K("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),ks=K("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",He),Hs=K("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Is=K("ERR_STREAM_WRITE_AFTER_END","write after end"),js=Pe.prototype.destroy||zt;function F(t,e){Pe.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var r=this;this._onNativeResponse=function(s){try{r._processResponse(s)}catch(n){r.emit("error",n instanceof He?n:new He({cause:n}))}},this._performRequest()}F.prototype=Object.create(Pe.prototype);F.prototype.abort=function(){Ie(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};F.prototype.destroy=function(t){return Ie(this._currentRequest,t),js.call(this,t),this};F.prototype.write=function(t,e,r){if(this._ending)throw new Is;if(!k(t)&&!Ms(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(G(e)&&(r=e,e=null),t.length===0){r&&r();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,r)):(this.emit("error",new Hs),this.abort())};F.prototype.end=function(t,e,r){if(G(t)?(r=t,t=e=null):G(e)&&(r=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,r);else{var s=this,n=this._currentRequest;this.write(t,e,function(){s._ended=!0,n.end(null,null,r)}),this._ending=!0}};F.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)};F.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)};F.prototype.setTimeout=function(t,e){var r=this;function s(o){o.setTimeout(t),o.removeListener("timeout",o.destroy),o.addListener("timeout",o.destroy)}function n(o){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout(function(){r.emit("timeout"),i()},t),s(o)}function i(){r._timeout&&(clearTimeout(r._timeout),r._timeout=null),r.removeListener("abort",i),r.removeListener("error",i),r.removeListener("response",i),r.removeListener("close",i),e&&r.removeListener("timeout",e),r.socket||r._currentRequest.removeListener("socket",n)}return e&&this.on("timeout",e),this.socket?n(this.socket):this._currentRequest.once("socket",n),this.on("socket",s),this.on("abort",i),this.on("error",i),this.on("response",i),this.on("close",i),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){F.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(F.prototype,t,{get:function(){return this._currentRequest[t]}})});F.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e))}};F.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e)throw new TypeError("Unsupported protocol "+t);if(this._options.agents){var r=t.slice(0,-1);this._options.agent=this._options.agents[r]}var s=this._currentRequest=e.request(this._options,this._onNativeResponse);s._redirectable=this;for(var n of De)s.on(n,Be[n]);if(this._currentUrl=/^\//.test(this._options.path)?W.format(this._options):this._options.path,this._isRedirect){var i=0,o=this,c=this._requestBodyBuffers;(function u(g){if(s===o._currentRequest)if(g)o.emit("error",g);else if(i=400){t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[];return}if(Ie(this._currentRequest),t.destroy(),++this._redirectCount>this._options.maxRedirects)throw new ks;var s,n=this._options.beforeRedirect;n&&(s=Object.assign({Host:t.req.getHeader("host")},this._options.headers));var i=this._options.method;((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],Ve(/^content-/i,this._options.headers));var o=Ve(/^host$/i,this._options.headers),c=je(this._currentUrl),u=o||c.host,g=/^\w+:/.test(r)?this._currentUrl:W.format(Object.assign(c,{host:u})),a=Vs(r,g);if($t("redirecting to",a.href),this._isRedirect=!0,Me(a,this._options),(a.protocol!==c.protocol&&a.protocol!=="https:"||a.host!==u&&!$s(a.host,u))&&Ve(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),G(n)){var l={headers:t.headers,statusCode:e},p={url:g,method:i,headers:s};n(this._options,l,p),this._sanitizeOptions(this._options)}this._performRequest()};function Jt(t){var e={maxRedirects:21,maxBodyLength:10*1024*1024},r={};return Object.keys(t).forEach(function(s){var n=s+":",i=r[n]=t[s],o=e[s]=Object.create(i);function c(g,a,l){return zs(g)?g=Me(g):k(g)?g=Me(je(g)):(l=a,a=Wt(g),g={protocol:n}),G(a)&&(l=a,a=null),a=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},g,a),a.nativeProtocols=r,!k(a.host)&&!k(a.hostname)&&(a.hostname="::1"),Ne.equal(a.protocol,n,"protocol mismatch"),$t("options",a),new F(a,l)}function u(g,a,l){var p=o.request(g,a,l);return p.end(),p}Object.defineProperties(o,{request:{value:c,configurable:!0,enumerable:!0,writable:!0},get:{value:u,configurable:!0,enumerable:!0,writable:!0}})}),e}function zt(){}function je(t){var e;if(Le)e=new J(t);else if(e=Wt(W.parse(t)),!k(e.protocol))throw new ke({input:t});return e}function Vs(t,e){return Le?new J(t,e):je(W.resolve(e,t))}function Wt(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname))throw new ke({input:t.href||t});if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host))throw new ke({input:t.href||t});return t}function Me(t,e){var r=e||{};for(var s of Bs)r[s]=t[s];return r.hostname.startsWith("[")&&(r.hostname=r.hostname.slice(1,-1)),r.port!==""&&(r.port=Number(r.port)),r.path=r.search?r.pathname+r.search:r.pathname,r}function Ve(t,e){var r;for(var s in e)t.test(s)&&(r=e[s],delete e[s]);return r===null||typeof r=="undefined"?void 0:String(r).trim()}function K(t,e,r){function s(n){Error.captureStackTrace(this,this.constructor),Object.assign(this,n||{}),this.code=t,this.message=this.cause?e+": "+this.cause.message:e}return s.prototype=new(r||Error),Object.defineProperties(s.prototype,{constructor:{value:s,enumerable:!1},name:{value:"Error ["+t+"]",enumerable:!1}}),s}function Ie(t,e){for(var r of De)t.removeListener(r,Be[r]);t.on("error",zt),t.destroy(e)}function $s(t,e){Ne(k(t)&&k(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}function k(t){return typeof t=="string"||t instanceof String}function G(t){return typeof t=="function"}function Ms(t){return typeof t=="object"&&"length"in t}function zs(t){return J&&t instanceof J}Oe.exports=Jt({http:Ls,https:Ds});Oe.exports.wrap=Jt});var ze=v((Bn,Kt)=>{Kt.exports={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]}});var er=v((kn,Gt)=>{"use strict";var X=U(),Xt=Ue(),Ws=Fe(),Js=ae(),Ks=require("http"),Gs=require("https"),Xs=$e().http,Ys=$e().https,Yt=require("url"),Zs=require("zlib"),Qs=ze(),me=de(),We=le(),Zt=/https:?/;function Qt(t,e,r){if(t.hostname=e.host,t.host=e.host,t.port=e.port,t.path=r,e.auth){var s=Buffer.from(e.auth.username+":"+e.auth.password,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+s}t.beforeRedirect=function(i){i.headers.host=i.host,Qt(i,e,i.href)}}Gt.exports=function(e){return new Promise(function(s,n){var i=function(C){s(C)},o=function(C){n(C)},c=e.data,u=e.headers;if("User-Agent"in u||"user-agent"in u?!u["User-Agent"]&&!u["user-agent"]&&(delete u["User-Agent"],delete u["user-agent"]):u["User-Agent"]="axios/"+Qs.version,c&&!X.isStream(c)){if(!Buffer.isBuffer(c))if(X.isArrayBuffer(c))c=Buffer.from(new Uint8Array(c));else if(X.isString(c))c=Buffer.from(c,"utf-8");else return o(me("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));u["Content-Length"]=c.length}var g=void 0;if(e.auth){var a=e.auth.username||"",l=e.auth.password||"";g=a+":"+l}var p=Ws(e.baseURL,e.url),m=Yt.parse(p),E=m.protocol||"http:";if(!g&&m.auth){var b=m.auth.split(":"),f=b[0]||"",d=b[1]||"";g=f+":"+d}g&&delete u.Authorization;var h=Zt.test(E),y=h?e.httpsAgent:e.httpAgent,w={path:Js(m.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:u,agent:y,agents:{http:e.httpAgent,https:e.httpsAgent},auth:g};e.socketPath?w.socketPath=e.socketPath:(w.hostname=m.hostname,w.port=m.port);var _=e.proxy;if(!_&&_!==!1){var H=E.slice(0,-1)+"_proxy",Q=process.env[H]||process.env[H.toUpperCase()];if(Q){var P=Yt.parse(Q),ee=process.env.no_proxy||process.env.NO_PROXY,st=!0;if(ee){var Ir=ee.split(",").map(function(C){return C.trim()});st=!Ir.some(function(C){return C?C==="*"||C[0]==="."&&m.hostname.substr(m.hostname.length-C.length)===C?!0:m.hostname===C:!1})}if(st&&(_={host:P.hostname,port:P.port,protocol:P.protocol},P.auth)){var nt=P.auth.split(":");_.auth={username:nt[0],password:nt[1]}}}}_&&(w.headers.host=m.hostname+(m.port?":"+m.port:""),Qt(w,_,E+"//"+m.hostname+(m.port?":"+m.port:"")+w.path));var te,it=h&&(_?Zt.test(_.protocol):!0);e.transport?te=e.transport:e.maxRedirects===0?te=it?Gs:Ks:(e.maxRedirects&&(w.maxRedirects=e.maxRedirects),te=it?Ys:Xs),e.maxBodyLength>-1&&(w.maxBodyLength=e.maxBodyLength);var q=te.request(w,function(C){if(!q.aborted){var L=C,re=C.req||q;if(C.statusCode!==204&&re.method!=="HEAD"&&e.decompress!==!1)switch(C.headers["content-encoding"]){case"gzip":case"compress":case"deflate":L=L.pipe(Zs.createUnzip()),delete C.headers["content-encoding"];break}var se={status:C.statusCode,statusText:C.statusMessage,headers:C.headers,config:e,request:re};if(e.responseType==="stream")se.data=L,Xt(i,o,se);else{var ot=[],at=0;L.on("data",function(O){ot.push(O),at+=O.length,e.maxContentLength>-1&&at>e.maxContentLength&&(L.destroy(),o(me("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,re)))}),L.on("error",function(O){q.aborted||o(We(O,e,null,re))}),L.on("end",function(){var O=Buffer.concat(ot);e.responseType!=="arraybuffer"&&(O=O.toString(e.responseEncoding),(!e.responseEncoding||e.responseEncoding==="utf8")&&(O=X.stripBOM(O))),se.data=O,Xt(i,o,se)})}}});if(q.on("error",function(C){q.aborted&&C.code!=="ERR_FR_TOO_MANY_REDIRECTS"||o(We(C,e,null,q))}),e.timeout){var Ee=parseInt(e.timeout,10);if(isNaN(Ee)){o(me("error trying to parse `config.timeout` to int",e,"ERR_PARSE_TIMEOUT",q));return}q.setTimeout(Ee,function(){q.abort(),o(me("timeout of "+Ee+"ms exceeded",e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",q))})}e.cancelToken&&e.cancelToken.promise.then(function(C){q.aborted||(q.abort(),o(C))}),X.isStream(c)?c.on("error",function(C){o(We(C,e,null,q))}).pipe(q):q.end(c)})}});var ve=v((Hn,tr)=>{"use strict";var S=U(),rr=wt(),en=le(),tn={"Content-Type":"application/x-www-form-urlencoded"};function sr(t,e){!S.isUndefined(t)&&S.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function rn(){var t;return typeof XMLHttpRequest!="undefined"?t=Dt():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=er()),t}function sn(t,e,r){if(S.isString(t))try{return(e||JSON.parse)(t),S.trim(t)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(t)}var ge={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:rn(),transformRequest:[function(e,r){return rr(r,"Accept"),rr(r,"Content-Type"),S.isFormData(e)||S.isArrayBuffer(e)||S.isBuffer(e)||S.isStream(e)||S.isFile(e)||S.isBlob(e)?e:S.isArrayBufferView(e)?e.buffer:S.isURLSearchParams(e)?(sr(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):S.isObject(e)||r&&r["Content-Type"]==="application/json"?(sr(r,"application/json"),sn(e)):e}],transformResponse:[function(e){var r=this.transitional,s=r&&r.silentJSONParsing,n=r&&r.forcedJSONParsing,i=!s&&this.responseType==="json";if(i||n&&S.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(i)throw o.name==="SyntaxError"?en(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};ge.headers={common:{Accept:"application/json, text/plain, */*"}};S.forEach(["delete","get","head"],function(e){ge.headers[e]={}});S.forEach(["post","put","patch"],function(e){ge.headers[e]=S.merge(tn)});tr.exports=ge});var ir=v((In,nr)=>{"use strict";var nn=U(),on=ve();nr.exports=function(e,r,s){var n=this||on;return nn.forEach(s,function(o){e=o.call(n,e,r)}),e}});var Je=v((jn,or)=>{"use strict";or.exports=function(e){return!!(e&&e.__CANCEL__)}});var lr=v((Mn,ar)=>{"use strict";var ur=U(),Ke=ir(),an=Je(),un=ve();function Ge(t){t.cancelToken&&t.cancelToken.throwIfRequested()}ar.exports=function(e){Ge(e),e.headers=e.headers||{},e.data=Ke.call(e,e.data,e.headers,e.transformRequest),e.headers=ur.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ur.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var r=e.adapter||un.adapter;return r(e).then(function(n){return Ge(e),n.data=Ke.call(e,n.data,n.headers,e.transformResponse),n},function(n){return an(n)||(Ge(e),n&&n.response&&(n.response.data=Ke.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})}});var Xe=v((Vn,dr)=>{"use strict";var R=U();dr.exports=function(e,r){r=r||{};var s={},n=["url","method","data"],i=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],c=["validateStatus"];function u(p,m){return R.isPlainObject(p)&&R.isPlainObject(m)?R.merge(p,m):R.isPlainObject(m)?R.merge({},m):R.isArray(m)?m.slice():m}function g(p){R.isUndefined(r[p])?R.isUndefined(e[p])||(s[p]=u(void 0,e[p])):s[p]=u(e[p],r[p])}R.forEach(n,function(m){R.isUndefined(r[m])||(s[m]=u(void 0,r[m]))}),R.forEach(i,g),R.forEach(o,function(m){R.isUndefined(r[m])?R.isUndefined(e[m])||(s[m]=u(void 0,e[m])):s[m]=u(void 0,r[m])}),R.forEach(c,function(m){m in r?s[m]=u(e[m],r[m]):m in e&&(s[m]=u(void 0,e[m]))});var a=n.concat(i).concat(o).concat(c),l=Object.keys(e).concat(Object.keys(r)).filter(function(m){return a.indexOf(m)===-1});return R.forEach(l,g),s}});var mr=v(($n,cr)=>{"use strict";var fr=ze(),Ye={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Ye[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});var hr={},ln=fr.version.split(".");function pr(t,e){for(var r=e?e.split("."):ln,s=t.split("."),n=0;n<3;n++){if(r[n]>s[n])return!0;if(r[n]0;){var i=s[n],o=e[i];if(o){var c=t[i],u=c===void 0||o(c,i,t);if(u!==!0)throw new TypeError("option "+i+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+i)}}cr.exports={isOlderVersion:pr,assertOptions:dn,validators:Ye}});var br=v((zn,gr)=>{"use strict";var vr=U(),cn=ae(),yr=vt(),wr=lr(),ye=Xe(),Cr=mr(),$=Cr.validators;function Y(t){this.defaults=t,this.interceptors={request:new yr,response:new yr}}Y.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=ye(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&Cr.assertOptions(r,{silentJSONParsing:$.transitional($.boolean,"1.0.0"),forcedJSONParsing:$.transitional($.boolean,"1.0.0"),clarifyTimeoutError:$.transitional($.boolean,"1.0.0")},!1);var s=[],n=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(e)===!1||(n=n&&p.synchronous,s.unshift(p.fulfilled,p.rejected))});var i=[];this.interceptors.response.forEach(function(p){i.push(p.fulfilled,p.rejected)});var o;if(!n){var c=[wr,void 0];for(Array.prototype.unshift.apply(c,s),c=c.concat(i),o=Promise.resolve(e);c.length;)o=o.then(c.shift(),c.shift());return o}for(var u=e;s.length;){var g=s.shift(),a=s.shift();try{u=g(u)}catch(l){a(l);break}}try{o=wr(u)}catch(l){return Promise.reject(l)}for(;i.length;)o=o.then(i.shift(),i.shift());return o};Y.prototype.getUri=function(e){return e=ye(this.defaults,e),cn(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};vr.forEach(["delete","get","head","options"],function(e){Y.prototype[e]=function(r,s){return this.request(ye(s||{},{method:e,url:r,data:(s||{}).data}))}});vr.forEach(["post","put","patch"],function(e){Y.prototype[e]=function(r,s,n){return this.request(ye(n||{},{method:e,url:r,data:s}))}});gr.exports=Y});var Qe=v((Wn,Er)=>{"use strict";function Ze(t){this.message=t}Ze.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Ze.prototype.__CANCEL__=!0;Er.exports=Ze});var Sr=v((Jn,xr)=>{"use strict";var fn=Qe();function we(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(n){e=n});var r=this;t(function(n){r.reason||(r.reason=new fn(n),e(r.reason))})}we.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};we.source=function(){var e,r=new we(function(n){e=n});return{token:r,cancel:e}};xr.exports=we});var _r=v((Kn,Rr)=>{"use strict";Rr.exports=function(e){return function(s){return e.apply(null,s)}}});var Ur=v((Gn,qr)=>{"use strict";qr.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Ar=v((Xn,et)=>{"use strict";var Fr=U(),hn=xe(),Ce=br(),pn=Xe(),mn=ve();function Tr(t){var e=new Ce(t),r=hn(Ce.prototype.request,e);return Fr.extend(r,Ce.prototype,e),Fr.extend(r,e),r}var A=Tr(mn);A.Axios=Ce;A.create=function(e){return Tr(pn(A.defaults,e))};A.Cancel=Qe();A.CancelToken=Sr();A.isCancel=Je();A.all=function(e){return Promise.all(e)};A.spread=_r();A.isAxiosError=Ur();et.exports=A;et.exports.default=A});var Pr=v((Yn,Or)=>{Or.exports=Ar()});var Lr=v((Nr,be)=>{(function(t,e){"use strict";typeof be=="object"&&typeof be.exports=="object"?be.exports=e():typeof define=="function"&&define.amd?define([],e):t.objectPath=e()})(Nr,function(){"use strict";var t=Object.prototype.toString;function e(a,l){return a==null?!1:Object.prototype.hasOwnProperty.call(a,l)}function r(a){if(!a||i(a)&&a.length===0)return!0;if(typeof a!="string"){for(var l in a)if(e(a,l))return!1;return!0}return!1}function s(a){return t.call(a)}function n(a){return typeof a=="object"&&s(a)==="[object Object]"}var i=Array.isArray||function(a){return t.call(a)==="[object Array]"};function o(a){return typeof a=="boolean"||s(a)==="[object Boolean]"}function c(a){var l=parseInt(a);return l.toString()===a?l:a}function u(a){a=a||{};var l=function(f){return Object.keys(l).reduce(function(d,h){return h==="create"||typeof l[h]=="function"&&(d[h]=l[h].bind(l,f)),d},{})},p;a.includeInheritedProps?p=function(){return!0}:p=function(f,d){return typeof d=="number"&&Array.isArray(f)||e(f,d)};function m(f,d){if(p(f,d))return f[d]}var E;a.includeInheritedProps?E=function(f,d){typeof d!="string"&&typeof d!="number"&&(d=String(d));var h=m(f,d);if(d==="__proto__"||d==="prototype"||d==="constructor"&&typeof h=="function")throw new Error("For security reasons, object's magic properties cannot be set");return h}:E=function(f,d){return m(f,d)};function b(f,d,h,y){if(typeof d=="number"&&(d=[d]),!d||d.length===0)return f;if(typeof d=="string")return b(f,d.split(".").map(c),h,y);var w=d[0],_=E(f,w);return d.length===1?((_===void 0||!y)&&(f[w]=h),_):(_===void 0&&(typeof d[1]=="number"?f[w]=[]:f[w]={}),b(f[w],d.slice(1),h,y))}return l.has=function(f,d){if(typeof d=="number"?d=[d]:typeof d=="string"&&(d=d.split(".")),!d||d.length===0)return!!f;for(var h=0;hgn});var Z=ie(require("obsidian")),kr=ie(Pr()),Hr=ie(Lr());var x=ie(require("obsidian")),Dr={cloudName:"",uploadPreset:"",folder:"",f_auto:!1,transformParams:"",dropUpload:!1,clipboardUpload:!0,imageUpload:!0,audioUpload:!1,videoUpload:!1,rawUpload:!1,imageSubfolder:"",audioSubfolder:"",videoSubfolder:"",rawSubfolder:""},tt=class extends x.PluginSettingTab{constructor(e,r){super(e,r);this.plugin=r}display(){let{containerEl:e}=this;e.empty(),e.createEl("h3",{text:"Cloudinary Settings"}),new x.Setting(e).setName("Cloud Name").setDesc("The name of your Cloudinary Cloud Account").addText(i=>{i.setPlaceholder("").setValue(this.plugin.settings.cloudName).onChange(async o=>{this.plugin.settings.cloudName=o,await this.plugin.saveSettings()})}),new x.Setting(e).setName("Cloudinary Upload Template").setDesc("Cloudinary Upload Preference string").addText(i=>{i.setPlaceholder("").setValue(this.plugin.settings.uploadPreset).onChange(async o=>{try{this.plugin.settings.uploadPreset=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),new x.Setting(e).setName("Cloudinary Root Upload Folder").setDesc("Folder name to use in Cloudinary. Note, this will be ignored if you have a folder set in your Cloudinary Upload Preset").addText(i=>{i.setPlaceholder("obsidian").setValue(this.plugin.settings.folder).onChange(async o=>{try{this.plugin.settings.folder=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),e.createEl("h4",{text:"Paste Behaviour"}),new x.Setting(e).setName("Upload on Clipboard Copy/Paste").setDesc("Upload files on a copy/paste from clipboard").addToggle(i=>{i.setValue(this.plugin.settings.clipboardUpload).onChange(async o=>{try{this.plugin.settings.clipboardUpload=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),new x.Setting(e).setName("Upload on Drag/Drop").setDesc("Upload files on a drag/drop").addToggle(i=>{i.setValue(this.plugin.settings.dropUpload).onChange(async o=>{try{this.plugin.settings.dropUpload=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),e.createEl("h4",{text:"URL Manipulations / Transformation"});let r=document.createDocumentFragment(),s=document.createElement("a"),n=document.createElement("a");n.text="transformation limits ",n.href="https://cloudinary.com/documentation/transformation_counts",r.append("The settings below are meant for default image transformations. As they only touch the resulting URL, this should not cause any upload errors, however, if syntax is incorrect, your images will not be referenced correctly (won't render). Be mindful of your Cloudinary "),r.append(n),r.append(" and use the "),s.href="https://cloudinary.com/documentation/transformation_reference",s.text=" Cloudinary documentation",r.append(s),r.append(" for guidance."),e.createEl("p",{text:r}),r=document.createDocumentFragment(),s=document.createElement("a"),s.href="https://cloudinary.com/documentation/image_optimization#automatic_format_selection_f_auto",s.text="f_auto option",r.append("Enable the "),r.append(s),r.append(" for uploads"),new x.Setting(e).setName("f_auto Option").setDesc(r).addToggle(i=>{i.setValue(this.plugin.settings.f_auto).onChange(async o=>{try{this.plugin.settings.f_auto=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),r=document.createDocumentFragment(),s=document.createElement("a"),s.href="https://cloudinary.com/documentation/transformation_reference",s.text="View Cloudinary's transformation reference for guidance.",r.append("Add a comma-delimited default set of transformations to your uploads. You do NOT need to include f_auto here if already enabled above. "),r.append(s),new x.Setting(e).setName("Default Transformation Parameters").setDesc(r).addText(i=>{i.setPlaceholder("w_150,h_150").setValue(this.plugin.settings.transformParams).onChange(async o=>{try{this.plugin.settings.transformParams=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),e.createEl("h4",{text:"Enabled File Types"}),r=document.createDocumentFragment(),r.append("Choose which file types are uploaded to Cloudinary. Disabled types are ignored"),e.createEl("p",{text:r}),new x.Setting(e).setName("Upload Images").addToggle(i=>{i.setValue(this.plugin.settings.imageUpload).onChange(async o=>{try{this.plugin.settings.imageUpload=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),new x.Setting(e).setName("Upload Audio").addToggle(i=>{i.setValue(this.plugin.settings.audioUpload).onChange(async o=>{try{this.plugin.settings.audioUpload=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),new x.Setting(e).setName("Upload Video").addToggle(i=>{i.setValue(this.plugin.settings.videoUpload).onChange(async o=>{try{this.plugin.settings.videoUpload=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),new x.Setting(e).setName("Upload Raw Files").setDesc("Raw files are those files that are not necessarily media files, but Cloudinary will still accept for upload").addToggle(i=>{i.setValue(this.plugin.settings.rawUpload).onChange(async o=>{try{this.plugin.settings.rawUpload=o,await this.plugin.saveSettings()}catch(c){console.log(c)}})}),e.createEl("h4",{text:"File Type Subfolders"}),r=document.createDocumentFragment(),r.append("Choose to add subfolders for different asset types. If not specified, will upload all files in the root folder. As mentioned above, this setting will be ignored if you have a default folder set in Cloudinary's settings for your upload preset"),e.createEl("p",{text:r}),new x.Setting(e).setName("Image Subfolder").setDesc("Subfolder name for image files").addText(i=>{i.setPlaceholder("image").setValue(this.plugin.settings.imageSubfolder).onChange(async o=>{this.plugin.settings.imageSubfolder=o,await this.plugin.saveSettings()})}),new x.Setting(e).setName("Audio Subfolder").setDesc("Subfolder name for audio files").addText(i=>{i.setPlaceholder("audio").setValue(this.plugin.settings.audioSubfolder).onChange(async o=>{this.plugin.settings.audioSubfolder=o,await this.plugin.saveSettings()})}),new x.Setting(e).setName("Video Subfolder").setDesc("Subfolder name for video files").addText(i=>{i.setPlaceholder("video").setValue(this.plugin.settings.videoSubfolder).onChange(async o=>{this.plugin.settings.videoSubfolder=o,await this.plugin.saveSettings()})}),new x.Setting(e).setName("Raw Subfolder").setDesc("Subfolder name for raw files").addText(i=>{i.setPlaceholder("raw").setValue(this.plugin.settings.rawSubfolder).onChange(async o=>{this.plugin.settings.rawSubfolder=o,await this.plugin.saveSettings()})})}},Br=tt;var rt=class extends Z.Plugin{constructor(){super(...arguments);this.pasteHandler=async(e,r)=>{let{files:s}=e.clipboardData;await this.uploadFiles(s,e,r)};this.dropHandler=async(e,r)=>{let{files:s}=e.dataTransfer;await this.uploadFiles(s,e,r)};this.uploadFiles=async(e,r,s)=>{if(e.length>0)if(this.settings.cloudName&&this.settings.uploadPreset){if(this.settings.audioUpload&&e[0].type.startsWith("audio")||this.settings.videoUpload&&e[0].type.startsWith("video")||this.settings.imageUpload&&e[0].type.startsWith("image")||this.settings.rawUpload&&!e[0].type.startsWith("image")&&!e[0].type.startsWith("audio")&&!e[0].type.startsWith("video")){r.preventDefault();for(let n of e){let o=`![uploading...](${(Math.random()*10086).toString(36).substr(0,8)}) +`;s.replaceSelection(o);let c=new FormData;c.append("file",n),c.append("upload_preset",this.settings.uploadPreset),c.append("folder",this.setSubfolder(n)),(0,kr.default)({url:`https://api.cloudinary.com/v1_1/${this.settings.cloudName}/auto/upload`,method:"POST",data:c}).then(u=>{console.log(u);let g=Hr.default.get(u.data,"secure_url"),a="";if(this.settings.transformParams){let l=g.split("/upload/",2);g=l[0]+="/upload/"+this.settings.transformParams+"/"+l[1],a=`![](${g})`}if(this.settings.f_auto){let l=g.split("/upload/",2);g=l[0]+="/upload/f_auto/"+l[1],a=`![](${g})`}else a=`![](${g})`;e[0].type.startsWith("audio")?a=` `:e[0].type.startsWith("video")&&(a=` -`),this.replaceText(n,o,a)},u=>{new be.Notice("There was something wrong with the upload. PLease check your cloud name and template name before trying again "+u,5e3),console.log(u)})}}}clearHandlers(){this.app.workspace.off("editor-paste",this.pasteHandler),this.app.workspace.off("editor-drop",this.dropHandler)}setupHandlers(){this.settings.clipboardUpload?this.registerEvent(this.app.workspace.on("editor-paste",this.pasteHandler)):this.app.workspace.off("editor-paste",this.pasteHandler),this.settings.dropUpload?this.registerEvent(this.app.workspace.on("editor-drop",this.dropHandler)):this.app.workspace.off("editor-drop",this.dropHandler)}replaceText(e,r,n){r=r.trim();let s=[];for(let i=0;i{new Z.Notice("There was something wrong with the upload. PLease check your cloud name and template name before trying again "+u,5e3),console.log(u)})}}}else new Z.Notice("It looks like your Cloudinary Cloud Name or Upload Preset were not defined. Uploads to Cloudinary will fail if these are not set. Please visit plugin settings, or disable plugin to stop this error. Falling back to default paste behaviour",0)}}clearHandlers(){this.app.workspace.off("editor-paste",this.pasteHandler),this.app.workspace.off("editor-drop",this.dropHandler)}setupHandlers(){this.settings.clipboardUpload?this.registerEvent(this.app.workspace.on("editor-paste",this.pasteHandler)):this.app.workspace.off("editor-paste",this.pasteHandler),this.settings.dropUpload?this.registerEvent(this.app.workspace.on("editor-drop",this.dropHandler)):this.app.workspace.off("editor-drop",this.dropHandler)}setSubfolder(e){return e.type.startsWith("image")?`${this.settings.folder}/${this.settings.imageSubfolder}`:e.type.startsWith("audio")?`${this.settings.folder}/${this.settings.audioSubfolder}`:e.type.startsWith("video")?`${this.settings.folder}/${this.settings.videoSubfolder}`:`${this.settings.folder}/${this.settings.rawSubfolder}`}replaceText(e,r,s){r=r.trim();let n=[];for(let i=0;i