forked from Moonvy/Figma-All-Backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
moonvy-figma-backup.js
29 lines (28 loc) · 21.3 KB
/
moonvy-figma-backup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(()=>{var yr=Object.create;var I=Object.defineProperty;var Er=Object.getOwnPropertyDescriptor;var gr=Object.getOwnPropertyNames;var qr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var Rr=r=>I(r,"__esModule",{value:!0});var c=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Or=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of gr(e))!Sr.call(r,n)&&(t||n!=="default")&&I(r,n,{get:()=>e[n],enumerable:!(o=Er(e,n))||o.enumerable});return r},Cr=(r,e)=>Or(Rr(I(r!=null?yr(qr(r)):{},"default",!e&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var M=c((Ct,ce)=>{"use strict";ce.exports=function(e,t){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return e.apply(t,n)}}});var h=c((At,me)=>{"use strict";var Ar=M(),E=Object.prototype.toString;function z(r){return Array.isArray(r)}function $(r){return typeof r>"u"}function Tr(r){return r!==null&&!$(r)&&r.constructor!==null&&!$(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function le(r){return E.call(r)==="[object ArrayBuffer]"}function Nr(r){return E.call(r)==="[object FormData]"}function Pr(r){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&le(r.buffer),e}function Ur(r){return typeof r=="string"}function jr(r){return typeof r=="number"}function pe(r){return r!==null&&typeof r=="object"}function P(r){if(E.call(r)!=="[object Object]")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function Br(r){return E.call(r)==="[object Date]"}function kr(r){return E.call(r)==="[object File]"}function Dr(r){return E.call(r)==="[object Blob]"}function de(r){return E.call(r)==="[object Function]"}function Lr(r){return pe(r)&&de(r.pipe)}function Fr(r){return E.call(r)==="[object URLSearchParams]"}function _r(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Ir(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function J(r,e){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),z(r))for(var t=0,o=r.length;t<o;t++)e.call(null,r[t],t,r);else for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.call(null,r[n],n,r)}function H(){var r={};function e(n,i){P(r[i])&&P(n)?r[i]=H(r[i],n):P(n)?r[i]=H({},n):z(n)?r[i]=n.slice():r[i]=n}for(var t=0,o=arguments.length;t<o;t++)J(arguments[t],e);return r}function Mr(r,e,t){return J(e,function(n,i){t&&typeof n=="function"?r[i]=Ar(n,t):r[i]=n}),r}function $r(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}me.exports={isArray:z,isArrayBuffer:le,isBuffer:Tr,isFormData:Nr,isArrayBufferView:Pr,isString:Ur,isNumber:jr,isObject:pe,isPlainObject:P,isUndefined:$,isDate:Br,isFile:kr,isBlob:Dr,isFunction:de,isStream:Lr,isURLSearchParams:Fr,isStandardBrowserEnv:Ir,forEach:J,merge:H,extend:Mr,trim:_r,stripBOM:$r}});var V=c((Tt,xe)=>{"use strict";var S=h();function he(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}xe.exports=function(e,t,o){if(!t)return e;var n;if(o)n=o(t);else if(S.isURLSearchParams(t))n=t.toString();else{var i=[];S.forEach(t,function(f,p){f===null||typeof f>"u"||(S.isArray(f)?p=p+"[]":f=[f],S.forEach(f,function(l){S.isDate(l)?l=l.toISOString():S.isObject(l)&&(l=JSON.stringify(l)),i.push(he(p)+"="+he(l))}))}),n=i.join("&")}if(n){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+n}return e}});var be=c((Nt,ve)=>{"use strict";var Hr=h();function U(){this.handlers=[]}U.prototype.use=function(e,t,o){return this.handlers.push({fulfilled:e,rejected:t,synchronous:o?o.synchronous:!1,runWhen:o?o.runWhen:null}),this.handlers.length-1};U.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};U.prototype.forEach=function(e){Hr.forEach(this.handlers,function(o){o!==null&&e(o)})};ve.exports=U});var ye=c((Pt,we)=>{"use strict";var zr=h();we.exports=function(e,t){zr.forEach(e,function(n,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[i])})}});var W=c((Ut,Ee)=>{"use strict";Ee.exports=function(e,t,o,n,i){return e.config=t,o&&(e.code=o),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,status:this.response&&this.response.status?this.response.status:null}},e}});var X=c((jt,ge)=>{"use strict";ge.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var K=c((Bt,qe)=>{"use strict";var Jr=W();qe.exports=function(e,t,o,n,i){var a=new Error(e);return Jr(a,t,o,n,i)}});var Re=c((kt,Se)=>{"use strict";var Vr=K();Se.exports=function(e,t,o){var n=o.config.validateStatus;!o.status||!n||n(o.status)?e(o):t(Vr("Request failed with status code "+o.status,o.config,null,o.request,o))}});var Ce=c((Dt,Oe)=>{"use strict";var j=h();Oe.exports=j.isStandardBrowserEnv()?function(){return{write:function(t,o,n,i,a,u){var f=[];f.push(t+"="+encodeURIComponent(o)),j.isNumber(n)&&f.push("expires="+new Date(n).toGMTString()),j.isString(i)&&f.push("path="+i),j.isString(a)&&f.push("domain="+a),u===!0&&f.push("secure"),document.cookie=f.join("; ")},read:function(t){var o=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return o?decodeURIComponent(o[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Te=c((Lt,Ae)=>{"use strict";Ae.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var Pe=c((Ft,Ne)=>{"use strict";Ne.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var je=c((_t,Ue)=>{"use strict";var Wr=Te(),Xr=Pe();Ue.exports=function(e,t){return e&&!Wr(t)?Xr(e,t):t}});var ke=c((It,Be)=>{"use strict";var G=h(),Kr=["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"];Be.exports=function(e){var t={},o,n,i;return e&&G.forEach(e.split(`
`),function(u){if(i=u.indexOf(":"),o=G.trim(u.substr(0,i)).toLowerCase(),n=G.trim(u.substr(i+1)),o){if(t[o]&&Kr.indexOf(o)>=0)return;o==="set-cookie"?t[o]=(t[o]?t[o]:[]).concat([n]):t[o]=t[o]?t[o]+", "+n:n}}),t}});var Fe=c((Mt,Le)=>{"use strict";var De=h();Le.exports=De.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),o;function n(i){var a=i;return e&&(t.setAttribute("href",a),a=t.href),t.setAttribute("href",a),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return o=n(window.location.href),function(a){var u=De.isString(a)?n(a):a;return u.protocol===o.protocol&&u.host===o.host}}():function(){return function(){return!0}}()});var C=c(($t,_e)=>{"use strict";function Y(r){this.message=r}Y.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Y.prototype.__CANCEL__=!0;_e.exports=Y});var Z=c((Ht,Ie)=>{"use strict";var B=h(),Gr=Re(),Yr=Ce(),Qr=V(),Zr=je(),et=ke(),rt=Fe(),Q=K(),tt=X(),nt=C();Ie.exports=function(e){return new Promise(function(o,n){var i=e.data,a=e.headers,u=e.responseType,f;function p(){e.cancelToken&&e.cancelToken.unsubscribe(f),e.signal&&e.signal.removeEventListener("abort",f)}B.isFormData(i)&&delete a["Content-Type"];var s=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",x=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(l+":"+x)}var d=Zr(e.baseURL,e.url);s.open(e.method.toUpperCase(),Qr(d,e.params,e.paramsSerializer),!0),s.timeout=e.timeout;function N(){if(!!s){var v="getAllResponseHeaders"in s?et(s.getAllResponseHeaders()):null,y=!u||u==="text"||u==="json"?s.responseText:s.response,q={data:y,status:s.status,statusText:s.statusText,headers:v,config:e,request:s};Gr(function(_){o(_),p()},function(_){n(_),p()},q),s=null}}if("onloadend"in s?s.onloadend=N:s.onreadystatechange=function(){!s||s.readyState!==4||s.status===0&&!(s.responseURL&&s.responseURL.indexOf("file:")===0)||setTimeout(N)},s.onabort=function(){!s||(n(Q("Request aborted",e,"ECONNABORTED",s)),s=null)},s.onerror=function(){n(Q("Network Error",e,null,s)),s=null},s.ontimeout=function(){var y=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",q=e.transitional||tt;e.timeoutErrorMessage&&(y=e.timeoutErrorMessage),n(Q(y,e,q.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",s)),s=null},B.isStandardBrowserEnv()){var g=(e.withCredentials||rt(d))&&e.xsrfCookieName?Yr.read(e.xsrfCookieName):void 0;g&&(a[e.xsrfHeaderName]=g)}"setRequestHeader"in s&&B.forEach(a,function(y,q){typeof i>"u"&&q.toLowerCase()==="content-type"?delete a[q]:s.setRequestHeader(q,y)}),B.isUndefined(e.withCredentials)||(s.withCredentials=!!e.withCredentials),u&&u!=="json"&&(s.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&s.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&s.upload&&s.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(f=function(v){!s||(n(!v||v&&v.type?new nt("canceled"):v),s.abort(),s=null)},e.cancelToken&&e.cancelToken.subscribe(f),e.signal&&(e.signal.aborted?f():e.signal.addEventListener("abort",f))),i||(i=null),s.send(i)})}});var D=c((zt,He)=>{"use strict";var m=h(),Me=ye(),ot=W(),st=X(),it={"Content-Type":"application/x-www-form-urlencoded"};function $e(r,e){!m.isUndefined(r)&&m.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function at(){var r;return typeof XMLHttpRequest<"u"?r=Z():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=Z()),r}function ut(r,e,t){if(m.isString(r))try{return(e||JSON.parse)(r),m.trim(r)}catch(o){if(o.name!=="SyntaxError")throw o}return(t||JSON.stringify)(r)}var k={transitional:st,adapter:at(),transformRequest:[function(e,t){return Me(t,"Accept"),Me(t,"Content-Type"),m.isFormData(e)||m.isArrayBuffer(e)||m.isBuffer(e)||m.isStream(e)||m.isFile(e)||m.isBlob(e)?e:m.isArrayBufferView(e)?e.buffer:m.isURLSearchParams(e)?($e(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):m.isObject(e)||t&&t["Content-Type"]==="application/json"?($e(t,"application/json"),ut(e)):e}],transformResponse:[function(e){var t=this.transitional||k.transitional,o=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!o&&this.responseType==="json";if(i||n&&m.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(i)throw a.name==="SyntaxError"?ot(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};m.forEach(["delete","get","head"],function(e){k.headers[e]={}});m.forEach(["post","put","patch"],function(e){k.headers[e]=m.merge(it)});He.exports=k});var Je=c((Jt,ze)=>{"use strict";var ft=h(),ct=D();ze.exports=function(e,t,o){var n=this||ct;return ft.forEach(o,function(a){e=a.call(n,e,t)}),e}});var ee=c((Vt,Ve)=>{"use strict";Ve.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ke=c((Wt,Xe)=>{"use strict";var We=h(),re=Je(),lt=ee(),pt=D(),dt=C();function te(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new dt("canceled")}Xe.exports=function(e){te(e),e.headers=e.headers||{},e.data=re.call(e,e.data,e.headers,e.transformRequest),e.headers=We.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),We.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var t=e.adapter||pt.adapter;return t(e).then(function(n){return te(e),n.data=re.call(e,n.data,n.headers,e.transformResponse),n},function(n){return lt(n)||(te(e),n&&n.response&&(n.response.data=re.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})}});var ne=c((Xt,Ge)=>{"use strict";var b=h();Ge.exports=function(e,t){t=t||{};var o={};function n(s,l){return b.isPlainObject(s)&&b.isPlainObject(l)?b.merge(s,l):b.isPlainObject(l)?b.merge({},l):b.isArray(l)?l.slice():l}function i(s){if(b.isUndefined(t[s])){if(!b.isUndefined(e[s]))return n(void 0,e[s])}else return n(e[s],t[s])}function a(s){if(!b.isUndefined(t[s]))return n(void 0,t[s])}function u(s){if(b.isUndefined(t[s])){if(!b.isUndefined(e[s]))return n(void 0,e[s])}else return n(void 0,t[s])}function f(s){if(s in t)return n(e[s],t[s]);if(s in e)return n(void 0,e[s])}var p={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:f};return b.forEach(Object.keys(e).concat(Object.keys(t)),function(l){var x=p[l]||i,d=x(l);b.isUndefined(d)&&x!==f||(o[l]=d)}),o}});var oe=c((Kt,Ye)=>{Ye.exports={version:"0.26.1"}});var er=c((Gt,Ze)=>{"use strict";var mt=oe().version,se={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){se[r]=function(o){return typeof o===r||"a"+(e<1?"n ":" ")+r}});var Qe={};se.transitional=function(e,t,o){function n(i,a){return"[Axios v"+mt+"] Transitional option '"+i+"'"+a+(o?". "+o:"")}return function(i,a,u){if(e===!1)throw new Error(n(a," has been removed"+(t?" in "+t:"")));return t&&!Qe[a]&&(Qe[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,a,u):!0}};function ht(r,e,t){if(typeof r!="object")throw new TypeError("options must be an object");for(var o=Object.keys(r),n=o.length;n-- >0;){var i=o[n],a=e[i];if(a){var u=r[i],f=u===void 0||a(u,i,r);if(f!==!0)throw new TypeError("option "+i+" must be "+f);continue}if(t!==!0)throw Error("Unknown option "+i)}}Ze.exports={assertOptions:ht,validators:se}});var ir=c((Yt,sr)=>{"use strict";var nr=h(),xt=V(),rr=be(),tr=Ke(),L=ne(),or=er(),R=or.validators;function A(r){this.defaults=r,this.interceptors={request:new rr,response:new rr}}A.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=L(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var o=t.transitional;o!==void 0&&or.assertOptions(o,{silentJSONParsing:R.transitional(R.boolean),forcedJSONParsing:R.transitional(R.boolean),clarifyTimeoutError:R.transitional(R.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(t)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var a=[];this.interceptors.response.forEach(function(d){a.push(d.fulfilled,d.rejected)});var u;if(!i){var f=[tr,void 0];for(Array.prototype.unshift.apply(f,n),f=f.concat(a),u=Promise.resolve(t);f.length;)u=u.then(f.shift(),f.shift());return u}for(var p=t;n.length;){var s=n.shift(),l=n.shift();try{p=s(p)}catch(x){l(x);break}}try{u=tr(p)}catch(x){return Promise.reject(x)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};A.prototype.getUri=function(e){return e=L(this.defaults,e),xt(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};nr.forEach(["delete","get","head","options"],function(e){A.prototype[e]=function(t,o){return this.request(L(o||{},{method:e,url:t,data:(o||{}).data}))}});nr.forEach(["post","put","patch"],function(e){A.prototype[e]=function(t,o,n){return this.request(L(n||{},{method:e,url:t,data:o}))}});sr.exports=A});var ur=c((Qt,ar)=>{"use strict";var vt=C();function O(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(n){e=n});var t=this;this.promise.then(function(o){if(!!t._listeners){var n,i=t._listeners.length;for(n=0;n<i;n++)t._listeners[n](o);t._listeners=null}}),this.promise.then=function(o){var n,i=new Promise(function(a){t.subscribe(a),n=a}).then(o);return i.cancel=function(){t.unsubscribe(n)},i},r(function(n){t.reason||(t.reason=new vt(n),e(t.reason))})}O.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};O.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};O.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};O.source=function(){var e,t=new O(function(n){e=n});return{token:t,cancel:e}};ar.exports=O});var cr=c((Zt,fr)=>{"use strict";fr.exports=function(e){return function(o){return e.apply(null,o)}}});var pr=c((en,lr)=>{"use strict";var bt=h();lr.exports=function(e){return bt.isObject(e)&&e.isAxiosError===!0}});var hr=c((rn,ie)=>{"use strict";var dr=h(),wt=M(),F=ir(),yt=ne(),Et=D();function mr(r){var e=new F(r),t=wt(F.prototype.request,e);return dr.extend(t,F.prototype,e),dr.extend(t,e),t.create=function(n){return mr(yt(r,n))},t}var w=mr(Et);w.Axios=F;w.Cancel=C();w.CancelToken=ur();w.isCancel=ee();w.VERSION=oe().version;w.all=function(e){return Promise.all(e)};w.spread=cr();w.isAxiosError=pr();ie.exports=w;ie.exports.default=w});var vr=c((tn,xr)=>{xr.exports=hr()});function fe(){if(document.querySelector(".moonvy-figma-backup"))return;let r=document.createElement("div");return r.classList.add("moonvy-figma-backup"),document.body.appendChild(r),r.style=`position: fixed;
width: 500px;
height: 300px;
background: rgba(29, 25, 37, 0.93);
backdrop-filter: blur(23px);
inset: 0px;
margin: auto;
z-index: 111;
overflow: hidden;
box-shadow: rgb(20 15 35 / 17%) 0px 2px 4px, rgb(17 17 17 / 14%) 0px 10px 23px;
border-top: 5px solid rgb(98, 49, 239);
border-radius: 4px;
color: rgb(238, 232, 255);
font-family: sans-serif;
padding: 20px;
box-sizing: border-box;
overflow-y: auto;
font-size: 14px;
white-space: break-spaces;
word-break: break-all;`,r}var T=Cr(vr());function br(r){let e=typeof r;if(e==="string"&&r.length>0)return gt(r);return e==="number"&&isFinite(r),r;throw Error("no match time string.")}function gt(r){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(r);if(!e)throw Error("no match time string.");var t=parseFloat(e[1]),o=(e[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return t*315576e5;case"weeks":case"week":case"w":return t*6048e5;case"days":case"day":case"d":return t*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return t*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return t*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return t*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:throw Error("no match time string.")}}var qt=function(r,e,t,o){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(s){try{p(o.next(s))}catch(l){a(l)}}function f(s){try{p(o.throw(s))}catch(l){a(l)}}function p(s){s.done?i(s.value):n(s.value).then(u,f)}p((o=o.apply(r,e||[])).next())})};function ae(r){return qt(this,void 0,void 0,function*(){return r=br(r),new Promise(function(e,t){setTimeout(()=>{e()},r)})})}function ue(r,e){if(typeof r=="string"){let t=document.createElement("a");e&&(t.download=e),t.rel="noopener",t.href=r,setTimeout(()=>{t.click()},0)}else{let t=window.URL||window.webkitURL,o=document.createElement("a"),n=e||r.name;return o.download=n,o.rel="noopener",o.href=t.createObjectURL(r),setTimeout(()=>{t.revokeObjectURL(o.href),o=null},4e4),setTimeout(()=>{o.click()},0),o.href}}async function St(){let e=(await T.default.get("https://www.figma.com/api/user/state")).data.meta.teams;console.log("Teams:",e);let t=fe(),o="",n="",i="",a=[];function u(){let f="\u{1F312} \u5907\u4EFD\u5168\u90E8 Figma \u6587\u4EF6 v1.1";t.innerText=`${f}
${o}
${n}
${i}`}o=`\u5907\u4EFD ${e.length} \u4E2A\u56E2\u961F\u7684\u6240\u6709\u6587\u4EF6\uFF0C\uFF08\u4E4B\u540E\u4F1A\u901A\u8FC7\u6D4F\u89C8\u5668\u81EA\u52A8\u4E0B\u8F7D\u6BCF\u4E00\u4E2A\u6587\u4EF6\uFF0C \u8BF7\u7559\u610F\u4F60\u7684\u4E0B\u8F7D\u6587\u4EF6\u5939\uFF09`,u();for(let f of e){let p=await T.default.get(`https://www.figma.com/api/teams/${f.id}/folders`),s=Object.keys(p.data.meta.folders);console.log("Folders:",s),n=`\u5907\u4EFD ${f.name} \u56E2\u961F\uFF0C \u5171 ${s.length} \u4E2A\u9879\u76EE`,u();for(let l of s){let x=await T.default.get(`https://www.figma.com/api/folders/${l}/files`),d=x.data.meta.files,N=x.data.meta.folder.name;console.log("Files:",d),await Promise.all(d.map(async g=>{let v=await T.default.get(`https://www.figma.com/api/file_metadata/${g.key}`),y={name:g.name,dlname:`${f.name}-${N}-${g.name}`,url:v.data.meta.canvas_url};i=`\u627E\u5230\u6587\u4EF6 ${g.name}, \u5DF2\u627E\u5230 ${a.length} \u4E2A\u6587\u4EF6`,u(),a.push(y)}))}}n=`\u627E\u5230 ${a.length} \u4E2A\u6587\u4EF6\uFF0C\u5F00\u59CB\u4E0B\u8F7D...\uFF08\u8BF7\u8BA9\u6D4F\u89C8\u5668\u5141\u8BB8\u4E0B\u8F7D\u591A\u4E2A\u6587\u4EF6\uFF1B\u4E0B\u8F7D\u5B8C\u6BD5\u540E\u81EA\u884C\u5237\u65B0\u9875\u9762\uFF09`,i=`\u4E0B\u8F7D\u94FE\u63A5\uFF08\u5982\u679C\u60F3\u7528\u4E0B\u8F7D\u5DE5\u5177\u4E0B\u8F7D\uFF09:
${a.map(f=>`${f.name}
${f.url}
`).join(`
`)}`,u(),console.log(a);for(let f of a)await ae(500),fetch(f.url).then(p=>p.blob().then(s=>{ue(s,f.dlname+".fig")}))}St();})();