-
-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathmain.js
1 lines (1 loc) · 44.7 KB
/
main.js
1
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=23)}([function(e,t,n){const r=n(6),{MAX_LENGTH:o,MAX_SAFE_INTEGER:i}=n(5),{re:s,t:a}=n(3),{compareIdentifiers:l}=n(12);class c{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof c){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>o)throw new TypeError(`version is longer than ${o} characters`);r("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?s[a.LOOSE]:s[a.FULL]);if(!n)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>i||this.major<0)throw new TypeError("Invalid major version");if(this.minor>i||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>i||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version}toString(){return this.version}compare(e){if(r("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof c||(e=new c(e,this.options)),l(this.major,e.major)||l(this.minor,e.minor)||l(this.patch,e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],o=e.prerelease[t];if(r("prerelease compare",t,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return l(n,o)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{const n=this.build[t],o=e.build[t];if(r("prerelease compare",t,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return l(n,o)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this}}e.exports=c},function(e,t,n){const r=n(0);e.exports=(e,t,n)=>new r(e,n).compare(new r(t,n))},function(e,t,n){class r{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof o)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=this.options.loose;e=e.trim();const n=t?a[l.HYPHENRANGELOOSE]:a[l.HYPHENRANGE];e=e.replace(n,O(this.options.includePrerelease)),i("hyphen replace",e),e=e.replace(a[l.COMPARATORTRIM],c),i("comparator trim",e,a[l.COMPARATORTRIM]),e=(e=(e=e.replace(a[l.TILDETRIM],p)).replace(a[l.CARETTRIM],u)).split(/\s+/).join(" ");const r=t?a[l.COMPARATORLOOSE]:a[l.COMPARATOR];return e.split(" ").map(e=>h(e,this.options)).join(" ").split(/\s+/).map(e=>b(e,this.options)).filter(this.options.loose?e=>!!e.match(r):()=>!0).map(e=>new o(e,this.options))}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some(n=>d(n,t)&&e.set.some(e=>d(e,t)&&n.every(n=>e.every(e=>n.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new s(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(I(this.set[t],e,this.options))return!0;return!1}}e.exports=r;const o=n(8),i=n(6),s=n(0),{re:a,t:l,comparatorTrimReplace:c,tildeTrimReplace:p,caretTrimReplace:u}=n(3),d=(e,t)=>{let n=!0;const r=e.slice();let o=r.pop();for(;n&&r.length;)n=r.every(e=>o.intersects(e,t)),o=r.pop();return n},h=(e,t)=>(i("comp",e,t),e=E(e,t),i("caret",e),e=g(e,t),i("tildes",e),e=v(e,t),i("xrange",e),e=x(e,t),i("stars",e),e),f=e=>!e||"x"===e.toLowerCase()||"*"===e,g=(e,t)=>e.trim().split(/\s+/).map(e=>m(e,t)).join(" "),m=(e,t)=>{const n=t.loose?a[l.TILDELOOSE]:a[l.TILDE];return e.replace(n,(t,n,r,o,s)=>{let a;return i("tilde",e,t,n,r,o,s),f(n)?a="":f(r)?a=`>=${n}.0.0 <${+n+1}.0.0-0`:f(o)?a=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:s?(i("replaceTilde pr",s),a=`>=${n}.${r}.${o}-${s} <${n}.${+r+1}.0-0`):a=`>=${n}.${r}.${o} <${n}.${+r+1}.0-0`,i("tilde return",a),a})},E=(e,t)=>e.trim().split(/\s+/).map(e=>w(e,t)).join(" "),w=(e,t)=>{i("caret",e,t);const n=t.loose?a[l.CARETLOOSE]:a[l.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,(t,n,o,s,a)=>{let l;return i("caret",e,t,n,o,s,a),f(n)?l="":f(o)?l=`>=${n}.0.0${r} <${+n+1}.0.0-0`:f(s)?l="0"===n?`>=${n}.${o}.0${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.0${r} <${+n+1}.0.0-0`:a?(i("replaceCaret pr",a),l="0"===n?"0"===o?`>=${n}.${o}.${s}-${a} <${n}.${o}.${+s+1}-0`:`>=${n}.${o}.${s}-${a} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${s}-${a} <${+n+1}.0.0-0`):(i("no pr"),l="0"===n?"0"===o?`>=${n}.${o}.${s}${r} <${n}.${o}.${+s+1}-0`:`>=${n}.${o}.${s}${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${s} <${+n+1}.0.0-0`),i("caret return",l),l})},v=(e,t)=>(i("replaceXRanges",e,t),e.split(/\s+/).map(e=>y(e,t)).join(" ")),y=(e,t)=>{e=e.trim();const n=t.loose?a[l.XRANGELOOSE]:a[l.XRANGE];return e.replace(n,(n,r,o,s,a,l)=>{i("xRange",e,n,r,o,s,a,l);const c=f(o),p=c||f(s),u=p||f(a),d=u;return"="===r&&d&&(r=""),l=t.includePrerelease?"-0":"",c?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&d?(p&&(s=0),a=0,">"===r?(r=">=",p?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):"<="===r&&(r="<",p?o=+o+1:s=+s+1),"<"===r&&(l="-0"),n=`${r+o}.${s}.${a}${l}`):p?n=`>=${o}.0.0${l} <${+o+1}.0.0-0`:u&&(n=`>=${o}.${s}.0${l} <${o}.${+s+1}.0-0`),i("xRange return",n),n})},x=(e,t)=>(i("replaceStars",e,t),e.trim().replace(a[l.STAR],"")),b=(e,t)=>(i("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),O=e=>(t,n,r,o,i,s,a,l,c,p,u,d,h)=>`${n=f(r)?"":f(o)?`>=${r}.0.0${e?"-0":""}`:f(i)?`>=${r}.${o}.0${e?"-0":""}`:s?">="+n:`>=${n}${e?"-0":""}`} ${l=f(c)?"":f(p)?`<${+c+1}.0.0-0`:f(u)?`<${c}.${+p+1}.0-0`:d?`<=${c}.${p}.${u}-${d}`:e?`<${c}.${p}.${+u+1}-0`:"<="+l}`.trim(),I=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(i(e[n].semver),e[n].semver!==o.ANY&&e[n].semver.prerelease.length>0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}},function(e,t,n){const{MAX_SAFE_COMPONENT_LENGTH:r}=n(5),o=n(6),i=(t=e.exports={}).re=[],s=t.src=[],a=t.t={};let l=0;const c=(e,t,n)=>{const r=l++;o(r,t),a[e]=r,s[r]=t,i[r]=new RegExp(t,n?"g":void 0)};c("NUMERICIDENTIFIER","0|[1-9]\\d*"),c("NUMERICIDENTIFIERLOOSE","[0-9]+"),c("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),c("MAINVERSION",`(${s[a.NUMERICIDENTIFIER]})\\.(${s[a.NUMERICIDENTIFIER]})\\.(${s[a.NUMERICIDENTIFIER]})`),c("MAINVERSIONLOOSE",`(${s[a.NUMERICIDENTIFIERLOOSE]})\\.(${s[a.NUMERICIDENTIFIERLOOSE]})\\.(${s[a.NUMERICIDENTIFIERLOOSE]})`),c("PRERELEASEIDENTIFIER",`(?:${s[a.NUMERICIDENTIFIER]}|${s[a.NONNUMERICIDENTIFIER]})`),c("PRERELEASEIDENTIFIERLOOSE",`(?:${s[a.NUMERICIDENTIFIERLOOSE]}|${s[a.NONNUMERICIDENTIFIER]})`),c("PRERELEASE",`(?:-(${s[a.PRERELEASEIDENTIFIER]}(?:\\.${s[a.PRERELEASEIDENTIFIER]})*))`),c("PRERELEASELOOSE",`(?:-?(${s[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[a.PRERELEASEIDENTIFIERLOOSE]})*))`),c("BUILDIDENTIFIER","[0-9A-Za-z-]+"),c("BUILD",`(?:\\+(${s[a.BUILDIDENTIFIER]}(?:\\.${s[a.BUILDIDENTIFIER]})*))`),c("FULLPLAIN",`v?${s[a.MAINVERSION]}${s[a.PRERELEASE]}?${s[a.BUILD]}?`),c("FULL",`^${s[a.FULLPLAIN]}$`),c("LOOSEPLAIN",`[v=\\s]*${s[a.MAINVERSIONLOOSE]}${s[a.PRERELEASELOOSE]}?${s[a.BUILD]}?`),c("LOOSE",`^${s[a.LOOSEPLAIN]}$`),c("GTLT","((?:<|>)?=?)"),c("XRANGEIDENTIFIERLOOSE",s[a.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*"),c("XRANGEIDENTIFIER",s[a.NUMERICIDENTIFIER]+"|x|X|\\*"),c("XRANGEPLAIN",`[v=\\s]*(${s[a.XRANGEIDENTIFIER]})(?:\\.(${s[a.XRANGEIDENTIFIER]})(?:\\.(${s[a.XRANGEIDENTIFIER]})(?:${s[a.PRERELEASE]})?${s[a.BUILD]}?)?)?`),c("XRANGEPLAINLOOSE",`[v=\\s]*(${s[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[a.XRANGEIDENTIFIERLOOSE]})(?:${s[a.PRERELEASELOOSE]})?${s[a.BUILD]}?)?)?`),c("XRANGE",`^${s[a.GTLT]}\\s*${s[a.XRANGEPLAIN]}$`),c("XRANGELOOSE",`^${s[a.GTLT]}\\s*${s[a.XRANGEPLAINLOOSE]}$`),c("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),c("COERCERTL",s[a.COERCE],!0),c("LONETILDE","(?:~>?)"),c("TILDETRIM",`(\\s*)${s[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",c("TILDE",`^${s[a.LONETILDE]}${s[a.XRANGEPLAIN]}$`),c("TILDELOOSE",`^${s[a.LONETILDE]}${s[a.XRANGEPLAINLOOSE]}$`),c("LONECARET","(?:\\^)"),c("CARETTRIM",`(\\s*)${s[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",c("CARET",`^${s[a.LONECARET]}${s[a.XRANGEPLAIN]}$`),c("CARETLOOSE",`^${s[a.LONECARET]}${s[a.XRANGEPLAINLOOSE]}$`),c("COMPARATORLOOSE",`^${s[a.GTLT]}\\s*(${s[a.LOOSEPLAIN]})$|^$`),c("COMPARATOR",`^${s[a.GTLT]}\\s*(${s[a.FULLPLAIN]})$|^$`),c("COMPARATORTRIM",`(\\s*)${s[a.GTLT]}\\s*(${s[a.LOOSEPLAIN]}|${s[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",c("HYPHENRANGE",`^\\s*(${s[a.XRANGEPLAIN]})\\s+-\\s+(${s[a.XRANGEPLAIN]})\\s*$`),c("HYPHENRANGELOOSE",`^\\s*(${s[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[a.XRANGEPLAINLOOSE]})\\s*$`),c("STAR","(<|>)?=?\\s*\\*"),c("GTE0","^\\s*>=\\s*0.0.0\\s*$"),c("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")},function(e,t,n){const{MAX_LENGTH:r}=n(5),{re:o,t:i}=n(3),s=n(0);e.exports=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof s)return e;if("string"!=typeof e)return null;if(e.length>r)return null;if(!(t.loose?o[i.LOOSE]:o[i.FULL]).test(e))return null;try{return new s(e,t)}catch(e){return null}}},function(e,t){const n=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:n,MAX_SAFE_COMPONENT_LENGTH:16}},function(e,t,n){(function(t){const n="object"==typeof t&&t.env&&t.env.NODE_DEBUG&&/\bsemver\b/i.test(t.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=n}).call(this,n(27))},function(e,t,n){const r=n(1);e.exports=(e,t,n)=>r(e,t,n)>0},function(e,t,n){const r=Symbol("SemVer ANY");class o{static get ANY(){return r}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof o){if(e.loose===!!t.loose)return e;e=e.value}l("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===r?this.value="":this.value=this.operator+this.semver.version,l("comp",this)}parse(e){const t=this.options.loose?i[s.COMPARATORLOOSE]:i[s.COMPARATOR],n=e.match(t);if(!n)throw new TypeError("Invalid comparator: "+e);this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new c(n[2],this.options.loose):this.semver=r}toString(){return this.value}test(e){if(l("Comparator.test",e,this.options.loose),this.semver===r||e===r)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return a(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof o))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new p(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new p(this.value,t).test(e.semver);const n=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),r=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),i=this.semver.version===e.semver.version,s=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),l=a(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),c=a(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return n||r||i&&s||l||c}}e.exports=o;const{re:i,t:s}=n(3),a=n(21),l=n(6),c=n(0),p=n(2)},function(e,t,n){const r=n(2);e.exports=(e,t,n)=>{try{t=new r(t,n)}catch(e){return!1}return t.test(e)}},function(e,t){e.exports=require("uxp")},function(e,t,n){"use strict";const r=n(10).storage.localFileSystem,o=n(26),i=n(22);e.exports=class{static uuidv4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}static debugLog(e){console.log("io.overflow.sync",e)}static appVersionCompatible(e){const t=e.version.split("-")[0],n=i.OverflowAppMinVersion;let r=o.satisfies(t,">="+n);return"development"===e.env&&(r=!0),r&&e.appName!==i.appName&&(r=!1),r}static getPortsRange(){let e=[],t=[];for(let t=25e3;t<=25050;t++)e.push(t);for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20));return t}static async exportOptions(){const e=await r.getDataFolder();let t=null,n={scale:1,flows:!1};try{t=await e.getEntry("settings.json");const r=await t.read();n=JSON.parse(r)}catch(r){this.debugLog(r),t=await e.createEntry("settings.json",{overwrite:!0}),await t.write(JSON.stringify(n))}return n}}},function(e,t){const n=/^[0-9]+$/,r=(e,t)=>{const r=n.test(e),o=n.test(t);return r&&o&&(e=+e,t=+t),e===t?0:r&&!o?-1:o&&!r?1:e<t?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},function(e,t,n){const r=n(1);e.exports=(e,t,n)=>0===r(e,t,n)},function(e,t,n){const r=n(0);e.exports=(e,t,n)=>{const o=new r(e,n),i=new r(t,n);return o.compare(i)||o.compareBuild(i)}},function(e,t,n){const r=n(1);e.exports=(e,t,n)=>r(e,t,n)<0},function(e,t,n){const r=n(1);e.exports=(e,t,n)=>r(e,t,n)>=0},function(e,t,n){const r=n(1);e.exports=(e,t,n)=>r(e,t,n)<=0},function(e,t,n){const r=n(0),o=n(8),{ANY:i}=o,s=n(2),a=n(9),l=n(7),c=n(15),p=n(17),u=n(16);e.exports=(e,t,n,d)=>{let h,f,g,m,E;switch(e=new r(e,d),t=new s(t,d),n){case">":h=l,f=p,g=c,m=">",E=">=";break;case"<":h=c,f=u,g=l,m="<",E="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,d))return!1;for(let n=0;n<t.set.length;++n){const r=t.set[n];let s=null,a=null;if(r.forEach(e=>{e.semver===i&&(e=new o(">=0.0.0")),s=s||e,a=a||e,h(e.semver,s.semver,d)?s=e:g(e.semver,a.semver,d)&&(a=e)}),s.operator===m||s.operator===E)return!1;if((!a.operator||a.operator===m)&&f(e,a.semver))return!1;if(a.operator===E&&g(e,a.semver))return!1}return!0}},function(e,t,n){"use strict";const r=n(10).storage.localFileSystem,o=n(24),i=n(25),s=n(11);var a=n(51);e.exports=class{constructor(e,t,n,r=!1,o){this.selection=e,this.documentRoot=t,this.syncId=n,this.isOperationCancelled=!1,this.exportAll=r,this.dialog=o,this.exportOptions=void 0}async startExportingSelectedItems(){this.exportOptions=await this.getExportOptions();const e=this.dialog.querySelector("#inner-loader"),t=this.dialog.querySelector("#msg");let n=this.exportAll?this.getAllArtboards().artboardsInstances:this.findSelectedArtboards().artboardsInstances;const a=n.length,l=await r.getTemporaryFolder(),c=s.uuidv4();await l.createFolder(c);const p=await l.getEntry(c);let u=[];for(let r=0;r<n.length;r++){if(this.isOperationCancelled)return null;const o=(r+1)/a*100;e.style.width=o+"%",t.innerHTML=`Artboard ${r+1} of ${a}`;const i=n[r],s=this.artboardObject(i);await this.renditionsCreation(i,p,this.exportOptions.scale),u.push(s)}return{action:"finish",data:{info:{about:"Overflow.io XD Export",toolVersion:o.version,version:i.version,syncId:this.syncId,tempPath:p.nativePath,flows:this.exportOptions.flows,density:this.exportOptions.scale},pages:[{name:"Board",screens:u}]}}}artboardObject(e){const t={x:""+e.globalBounds.x,y:""+e.globalBounds.y},n={width:""+e.width,height:""+e.height},r=this.getArtboardChildren(e.children,this.documentRoot);return{id:e.guid,title:e.name,position:t,size:n,layers:r,backgroundColor:this.colorToRGBA(e.fill),flow:this.getInteraction(e.guid)}}async renditionsCreation(e,t,n){let r=null;try{r=await t.createEntry(e.guid+".png",{overwrite:!0})}catch(e){console.log(e)}const i=[{node:e,outputFile:r,type:o.RenditionType.PNG,scale:n}];await o.createRenditions(i)}async getExportOptions(){return await s.exportOptions()}getAllArtboards(){let e={artboardsInstances:[],artboardDetails:[]};return this.documentRoot.children.forEach((function(t,n){if("Artboard"===t.constructor.name){if(!e.artboardsInstances.find(e=>e.guid==t.guid)){e.artboardsInstances.push(t);const n={id:t.guid,title:t.name};e.artboardDetails.push(n)}}})),e}findSelectedArtboards(){let e={artboardsInstances:[],artboardDetails:[]};for(let t=0;t<this.selection.items.length;t++){const n=this.selection.items[t],r=this.getSelectedItemArtboard(n);if(null==r)continue;if(!e.artboardsInstances.find(e=>e.guid==r.guid)){e.artboardsInstances.push(r);const t={id:r.guid,title:r.name};e.artboardDetails.push(t)}}return e}getArtboardChildren(e,t,n){let r=[];return e[n?"forEachRight":"forEach"]((e,o)=>{if(!e.visible)return;let i={x:e.globalBounds.x,y:e.globalBounds.y},s={width:e.globalBounds.width,height:e.globalBounds.height};if(e.mask){const t=e.children.at(e.children.length-1);i={x:t.globalBounds.x,y:t.globalBounds.y},s={width:t.globalBounds.width,height:t.globalBounds.height}}if(n){const e={globalBounds:{x:i.x,y:i.y,width:s.width,height:s.height}};if(!this.isMaskSublayerVisible(n,e))return r;{const t=this.getMaskSubLayerCorrectBounds(n,e);i=t.position,s=t.size}}let a={id:""+e.guid,isGroup:"0",name:""+e.name,path:""+e.parent?e.parent.name:"",pathID:""+e.parent?e.parent.guid:"",hidden:e.visible?"0":"1",position:i,size:s,flow:this.getInteraction(e.guid)},l=[];if(("SymbolInstance"===e.constructor.name||"Group"===e.constructor.name||"RepeatGrid"===e.constructor.name)&&("SymbolInstance"===e.constructor.name&&(a.isGroup="1"),e.children.length>0&&e.visible)){const n=a;l=this.getArtboardChildren(e.children,t,e.mask?n:null)}e.mask||r.push(a),r.push(...l)}),r}getSelectedItemArtboard(e){return null==e?null:"Artboard"===e.constructor.name?e:this.getSelectedItemArtboard(e.parent)}colorToRGBA(e){if(null===e)return"rgba(0,0,0,0)";return"rgba("+e.r+","+e.g+","+e.b+","+(e.a/255).toFixed(2)+")"}getMaskSubLayerCorrectBounds(e,t){let n={x1:0,x2:0,y1:0,y2:0};t.globalBounds.y<e.position.y?n.y1=e.position.y:n.y1=t.globalBounds.y;const r=t.globalBounds.y+t.globalBounds.height,o=e.position.y+e.size.height;n.y2=r>o?o:r,t.globalBounds.x<e.position.x?n.x1=e.position.x:n.x1=t.globalBounds.x;const i=t.globalBounds.x+t.globalBounds.width,s=e.position.x+e.size.width;n.x2=i>s?s:i;return{position:{x:n.x1,y:n.y1},size:{width:n.x2-n.x1,height:n.y2-n.y1}}}isMaskSublayerVisible(e,t){return!(t.globalBounds.x+t.globalBounds.width<e.position.x||t.globalBounds.x>e.position.x+e.position.width)&&!(t.globalBounds.y+t.globalBounds.height<e.position.y||t.globalBounds.y>e.position.y+e.position.height)}numberOfSelectedArtboards(){return this.findSelectedArtboards().artboardsInstances.length}getInteraction(e){return a.allInteractions.filter(t=>t.triggerNode.guid===e).map(e=>e.interactions.find(e=>["goToArtboard","overlay"].includes(e.action.type))).filter(e=>e).map(e=>e.action.destination?{screenId:e.action.destination.guid}:e.action.overlay?{screenId:e.action.overlay.guid}:void 0)[0]}}},function(e,t,n){const r=n(1);e.exports=(e,t,n)=>0!==r(e,t,n)},function(e,t,n){const r=n(13),o=n(20),i=n(7),s=n(16),a=n(15),l=n(17);e.exports=(e,t,n,c)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return r(e,n,c);case"!=":return o(e,n,c);case">":return i(e,n,c);case">=":return s(e,n,c);case"<":return a(e,n,c);case"<=":return l(e,n,c);default:throw new TypeError("Invalid operator: "+t)}}},function(e){e.exports=JSON.parse('{"appName":"overflow","pluginName":"adobexd","localhost":"http://127.0.0.1","OverflowAppMinVersion":"1.11.0"}')},function(e,t,n){const r=n(10).storage.localFileSystem;r.isFileSystemProvider;const o=n(19),i=n(52),s=n(11);let a,l,c;function p(e,t){return new i(e,t).startCommunication()}e.exports={commands:{exportAllCommand:function(e,t){return new i(e,t,!0).startCommunication()},exportSelectedCommand:p},panels:{optionsPanel:{show:function(e){a=document.createElement("panel"),a.innerHTML='\n<style>\n.panel-div-wrapper {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.panel-div-right {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n}\n\n.group {\n margin: 10px 0 5px 0;\n\n}\n.group-title {\n margin-bottom: 5px;\n \n}\n.group-dropdown{\n margin: 0px \n}\n.fat-black {\n font-size: 12px !important;\n font-weight: 350 !important;\n color: #040e1a !important;\n}\n.full-width {\n width:100%\n}\n.extra-space {\n margin-bottom: 10px;\n}\n\n#scale {\n width:100%;\n height: 35px;\n}\n#sync {\n width: 100%;\n text-align: center;\n font-size: 24px;\n margin: 0;\n}\n#footer {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: absolute;\n bottom: 0;\n font-size: 12px;\n font-weight: 350;\n text-align: center;\n}\n.overflow-logo {\n width: 100%;\n display: flex;\n justify-content: center;\n margin-bottom: 5px;\n}\n.overflow-icon {\n width: 160px;\n}\n</style>\n<form method="dialog" id="main">\n <div class="panel-div-wrapper">\n <div class="panel-div-right">\n \n<div class="selection-info group extra-space">\n <div><label class="group-title">Select 1 or more artboards to sync</label></div>\n <span id="selection" class="fat-black"></span>\n</div>\n \n<div id="export-size" class="group">\n <label class="full-width">\n <div>Export density</div>\n </label>\n \n <div class="row group">\n <label>\n <select id="scale" class="group-dropdown"> \n <option value="1">1x</option>\n <option value="2">2x</option>\n <option value="3">3x</option>\n </select>\n </label>\n </div>\n \n</div>\n \n<div class="group">\n <label>\n <div class="group-title full-width">Prototype interactions</div>\n <div class="row">\n <input id="exportLinks" type="checkbox"/>\n <span class="fat-black">Include prototype interactions</span>\n </div>\n </label>\n</div>\n \n<div class="group">\n <button id="sync" disabled uxp-variant="cta">Sync to Overflow</button>\n</div>\n </div>\n \n<div id="footer">\n <div class="overflow-logo" ><a href="https://overflow.io"><img src="./assets/images/overflow-logo.png" class="overflow-icon" /></a></div>\n <div>\n Turn your XD designs into<br/>\n beautiful user flow diagrams\n </div>\n</div>\n </div>\n</form>\n',a.querySelector("#sync").addEventListener("click",()=>{p(l,c)}),e.node.appendChild(a)},hide:function(e){e.node.firstChild.remove()},update:async function(e,t){l=e,c=t;const n=await r.getDataFolder();let i=await s.exportOptions(),p=await n.getEntry("settings.json"),u=new o(e,t).numberOfSelectedArtboards();const d=document.querySelector("#scale"),h=document.querySelector("#selection"),f=a.querySelector("#sync"),g=a.querySelector("#exportLinks");0!==u?(f.disabled=!1,h.innerHTML=1==u?u+" artboard selected":u+" artboards selected"):(h.innerHTML="No artboards selected",f.disabled=!0),d.value=""+i.scale,g.checked=i.flows,d.addEventListener("change",async()=>{i={scale:Number(d.value),flows:g.checked},await p.write(JSON.stringify(i))}),g.addEventListener("change",async()=>{i={scale:Number(d.value),flows:g.checked},await p.write(JSON.stringify(i))})}}}}},function(e,t){e.exports=require("application")},function(e){e.exports=JSON.parse('{"id":"232cee78","name":"Overflow","version":"1.1.5","author":"PROTOIO Inc","summary":"User flows done right","description":"The Overflow plugin for Adobe XD syncs your designs to Overflow enabling you to create, present and share playable user flow diagrams.\\n\\nDownload Overflow for MacOS and get started for free.\\nhttps://overflow.io/download","website":"https://overflow.io/","helpUrl":"https://support.overflow.io/hc/en-us/articles/360010498753-Inserting-Screens-from-Adobe-XD","keywords":["user flow","diagram","UX","user journey","mapping","presentation"],"languages":["en"],"icons":[{"width":24,"height":24,"path":"./assets/images/[email protected]"},{"width":48,"height":48,"path":"./assets/images/[email protected]"}],"host":{"app":"XD","minVersion":"21.0"},"uiEntryPoints":[{"type":"panel","label":"Overflow","panelId":"optionsPanel","shortcut":{"mac":"Ctrl+Alt+O","win":"Ctrl+Alt+O"}}]}')},function(e,t,n){const r=n(3);e.exports={re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:n(5).SEMVER_SPEC_VERSION,SemVer:n(0),compareIdentifiers:n(12).compareIdentifiers,rcompareIdentifiers:n(12).rcompareIdentifiers,parse:n(4),valid:n(28),clean:n(29),inc:n(30),diff:n(31),major:n(32),minor:n(33),patch:n(34),prerelease:n(35),compare:n(1),rcompare:n(36),compareLoose:n(37),compareBuild:n(14),sort:n(38),rsort:n(39),gt:n(7),lt:n(15),eq:n(13),neq:n(20),gte:n(16),lte:n(17),cmp:n(21),coerce:n(40),Comparator:n(8),Range:n(2),satisfies:n(9),toComparators:n(41),maxSatisfying:n(42),minSatisfying:n(43),minVersion:n(44),validRange:n(45),outside:n(18),gtr:n(46),ltr:n(47),intersects:n(48),simplifyRange:n(49),subset:n(50)}},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l,c=[],p=!1,u=-1;function d(){p&&l&&(p=!1,l.length?c=l.concat(c):u=-1,c.length&&h())}function h(){if(!p){var e=a(d);p=!0;for(var t=c.length;t;){for(l=c,c=[];++u<t;)l&&l[u].run();u=-1,t=c.length}l=null,p=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new f(e,t)),1!==c.length||p||a(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){const r=n(4);e.exports=(e,t)=>{const n=r(e,t);return n?n.version:null}},function(e,t,n){const r=n(4);e.exports=(e,t)=>{const n=r(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}},function(e,t,n){const r=n(0);e.exports=(e,t,n,o)=>{"string"==typeof n&&(o=n,n=void 0);try{return new r(e,n).inc(t,o).version}catch(e){return null}}},function(e,t,n){const r=n(4),o=n(13);e.exports=(e,t)=>{if(o(e,t))return null;{const n=r(e),o=r(t),i=n.prerelease.length||o.prerelease.length,s=i?"pre":"",a=i?"prerelease":"";for(const e in n)if(("major"===e||"minor"===e||"patch"===e)&&n[e]!==o[e])return s+e;return a}}},function(e,t,n){const r=n(0);e.exports=(e,t)=>new r(e,t).major},function(e,t,n){const r=n(0);e.exports=(e,t)=>new r(e,t).minor},function(e,t,n){const r=n(0);e.exports=(e,t)=>new r(e,t).patch},function(e,t,n){const r=n(4);e.exports=(e,t)=>{const n=r(e,t);return n&&n.prerelease.length?n.prerelease:null}},function(e,t,n){const r=n(1);e.exports=(e,t,n)=>r(t,e,n)},function(e,t,n){const r=n(1);e.exports=(e,t)=>r(e,t,!0)},function(e,t,n){const r=n(14);e.exports=(e,t)=>e.sort((e,n)=>r(e,n,t))},function(e,t,n){const r=n(14);e.exports=(e,t)=>e.sort((e,n)=>r(n,e,t))},function(e,t,n){const r=n(0),o=n(4),{re:i,t:s}=n(3);e.exports=(e,t)=>{if(e instanceof r)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){let t;for(;(t=i[s.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&t.index+t[0].length===n.index+n[0].length||(n=t),i[s.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;i[s.COERCERTL].lastIndex=-1}else n=e.match(i[s.COERCE]);return null===n?null:o(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)}},function(e,t,n){const r=n(2);e.exports=(e,t)=>new r(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},function(e,t,n){const r=n(0),o=n(2);e.exports=(e,t,n)=>{let i=null,s=null,a=null;try{a=new o(t,n)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(i&&-1!==s.compare(e)||(i=e,s=new r(i,n)))}),i}},function(e,t,n){const r=n(0),o=n(2);e.exports=(e,t,n)=>{let i=null,s=null,a=null;try{a=new o(t,n)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(i&&1!==s.compare(e)||(i=e,s=new r(i,n)))}),i}},function(e,t,n){const r=n(0),o=n(2),i=n(7);e.exports=(e,t)=>{e=new o(e,t);let n=new r("0.0.0");if(e.test(n))return n;if(n=new r("0.0.0-0"),e.test(n))return n;n=null;for(let t=0;t<e.set.length;++t){e.set[t].forEach(e=>{const t=new r(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":n&&!i(n,t)||(n=t);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+e.operator)}})}return n&&e.test(n)?n:null}},function(e,t,n){const r=n(2);e.exports=(e,t)=>{try{return new r(e,t).range||"*"}catch(e){return null}}},function(e,t,n){const r=n(18);e.exports=(e,t,n)=>r(e,t,">",n)},function(e,t,n){const r=n(18);e.exports=(e,t,n)=>r(e,t,"<",n)},function(e,t,n){const r=n(2);e.exports=(e,t,n)=>(e=new r(e,n),t=new r(t,n),e.intersects(t))},function(e,t,n){const r=n(9),o=n(1);e.exports=(e,t,n)=>{const i=[];let s=null,a=null;const l=e.sort((e,t)=>o(e,t,n));for(const e of l){r(e,t,n)?(a=e,s||(s=e)):(a&&i.push([s,a]),a=null,s=null)}s&&i.push([s,null]);const c=[];for(const[e,t]of i)e===t?c.push(e):t||e!==l[0]?t?e===l[0]?c.push("<="+t):c.push(`${e} - ${t}`):c.push(">="+e):c.push("*");const p=c.join(" || "),u="string"==typeof t.raw?t.raw:String(t);return p.length<u.length?p:t}},function(e,t,n){const r=n(2),{ANY:o}=n(8),i=n(9),s=n(1),a=(e,t,n)=>{if(1===e.length&&e[0].semver===o)return 1===t.length&&t[0].semver===o;const r=new Set;let a,p,u,d,h,f,g;for(const t of e)">"===t.operator||">="===t.operator?a=l(a,t,n):"<"===t.operator||"<="===t.operator?p=c(p,t,n):r.add(t.semver);if(r.size>1)return null;if(a&&p){if(u=s(a.semver,p.semver,n),u>0)return null;if(0===u&&(">="!==a.operator||"<="!==p.operator))return null}for(const e of r){if(a&&!i(e,String(a),n))return null;if(p&&!i(e,String(p),n))return null;for(const r of t)if(!i(e,String(r),n))return!1;return!0}for(const e of t){if(g=g||">"===e.operator||">="===e.operator,f=f||"<"===e.operator||"<="===e.operator,a)if(">"===e.operator||">="===e.operator){if(d=l(a,e,n),d===e)return!1}else if(">="===a.operator&&!i(a.semver,String(e),n))return!1;if(p)if("<"===e.operator||"<="===e.operator){if(h=c(p,e,n),h===e)return!1}else if("<="===p.operator&&!i(p.semver,String(e),n))return!1;if(!e.operator&&(p||a)&&0!==u)return!1}return!(a&&f&&!p&&0!==u)&&!(p&&g&&!a&&0!==u)},l=(e,t,n)=>{if(!e)return t;const r=s(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},c=(e,t,n)=>{if(!e)return t;const r=s(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,n)=>{e=new r(e,n),t=new r(t,n);let o=!1;e:for(const r of e.set){for(const e of t.set){const t=a(r,e,n);if(o=o||null!==t,t)continue e}if(o)return!1}return!0}},function(e,t){e.exports=require("interactions")},function(e,t,n){"use strict";const r=n(53),o=n(19),i=n(11),s=n(22);e.exports=class{constructor(e,t,n=!1){this.selection=e,this.documentRoot=t,this.exportAll=n,this.syncDialog=null,this.userCancelledConnection=!1,this.exportOptions=void 0,this.URL=s.localhost,this.isOverflowVersionCompatible=!0,this.overflowResponseDetails=null}async startCommunication(){this.exportOptions=await this.getExportOptions();const e=new o(this.selection,this.documentRoot,"",this.exportAll,this.syncDialog);if(!this.exportAll&&(0===this.selection.items.length||0===e.findSelectedArtboards().artboardDetails.length))return i.debugLog("No selected items found"),this.noArtboardsSelected();if(!await this.isOverflowOpen())return;return await this.isOverflowCompatible()?await this.uploadOnOverflow(e):void 0}async isOverflowOpen(){let e=this.waitingForOverflow();e.showModal();e.querySelector("#dialog-title").innerHTML="Establishing Connection";let t=!1;try{this.URL=await this.findOverflowAddress(),this.userCancelledConnection||null===this.URL||(t=!0,i.debugLog("Connection with Overflow established"))}catch(e){i.debugLog(e)}if(e.close(),document.removeChild(e),t||this.userCancelledConnection)return!0;try{await this.overflowNotOpened().showModal()}catch(e){}return!1}async findOverflowAddress(){const e=i.getPortsRange();for(let t=0;t<e.length;t++)try{await Promise.all(e[t].map(e=>this.isOverflow(e)))}catch(e){return e.message}return null}async isOverflow(e){const t=`${this.URL}:${e}`;try{const t=await window.fetch(`${this.URL}:${e}/ping?plugin=${s.pluginName}`);this.overflowResponseDetails=await t.json()}catch(e){return null}throw new Error(t+"/sync")}async uploadOnOverflow(e){this.syncDialog=this.waitingForOverflow(),e.dialog=this.syncDialog,e.isOperationCancelled=this.userCancelledConnection,this.syncDialog.showModal().then(t=>{e.isOperationCancelled=!0}).catch(t=>{i.debugLog("rej "+t),e.isOperationCancelled=!0});this.syncDialog.querySelector("#cancel").addEventListener("click",()=>{e.isOperationCancelled=!0,this.syncDialog.close()});try{const t=await e.startExportingSelectedItems();if(e.isOperationCancelled)return;await this.upload(t),this.syncDialog.close()}catch(e){i.debugLog("Parser error: ",e),this.syncDialog.close(),document.removeChild(this.syncDialog);try{const e=this.parsingFailed();await e.showModal()}catch(e){}}}async upload(e){return new Promise((t,n)=>{const r=new XMLHttpRequest;r.onloadend=()=>{200===r.status?(i.debugLog("Sync successful"),t()):n(new Error(r.status))},r.onerror=e=>{n(e)},r.timeout=6e4;const o=new FormData;o.append("doc",JSON.stringify(e.data)),o.append("path",e.data.info.tempPath),o.append("integrationType",s.pluginName),r.open("POST",this.URL),r.send(o)})}async isOverflowCompatible(){if(null===this.overflowResponseDetails)return!1;if(!i.appVersionCompatible(this.overflowResponseDetails)){try{const e=this.incompatibleAppVersion();await e.showModal()}catch(e){}return!1}return!0}async getExportOptions(){return await i.exportOptions()}incompatibleAppVersion(){i.debugLog("Overflow app version is incompatible");const e=new r;let t=document.createElement("dialog");t.style.width=400,t.innerHTML=e.constructForm(e.formTypes.incompatibleAppVersion);return t.querySelector("#ok").addEventListener("click",()=>{t.close()}),document.appendChild(t)}connectionFailed(){i.debugLog("Overflow connection failed");const e=new r;let t=document.createElement("dialog");t.style.width=400,t.innerHTML=e.constructForm(e.formTypes.ConnectionFailed);return document.querySelector("#ok").addEventListener("click",async()=>{document.querySelector("dialog").close()}),document.body.appendChild(t).showModal()}parsingFailed(){const e=new r;let t=document.createElement("dialog");t.style.width=400,t.innerHTML=e.constructForm(e.formTypes.parsingFailed);return t.querySelector("#ok").addEventListener("click",()=>{t.close()}),document.appendChild(t)}overflowNotOpened(){i.debugLog("Overflow not opened");const e=new r;let t=document.createElement("dialog");return t.style.width=400,t.innerHTML=e.constructForm(e.formTypes.NotOpened),document.appendChild(t)}waitingForOverflow(){i.debugLog("Waiting for Overflow");const e=new r;let t=document.createElement("dialog");t.style.width=400,t.innerHTML=e.constructForm(e.formTypes.Loading);const n=t.querySelector("#inner-loader"),o=t.querySelector("#msg");return n.style.width="2%",o.innerHTML="Establishing Connection",document.appendChild(t)}noArtboardsSelected(){const e=new r;let t=document.createElement("dialog");t.style.width=400,t.innerHTML=e.constructForm(e.formTypes.LayersNotSelected);return t.querySelector("#ok").addEventListener("click",()=>{t.close()}),document.appendChild(t).showModal()}}},function(e,t,n){"use strict";e.exports=class{constructor(e=300){this.name="Default",this.width=e,this.formTypes={Loading:"loading",LayersNotSelected:"layersNotSelected",OverflowNotInstalled:"overflowNotInstalled",WaitingForOverflow:"waitingForOverflow",ExportOptions:"exportOptions",ConnectionFailed:"connectionFailed",NotOpened:"notOpened",parsingFailed:"parsingFailed",incompatibleAppVersion:"incompatibleAppVersion"}}constructForm(e){let t="";switch(e){case"layersNotSelected":this.width=320,t=this.getNoSelectedArtboardsHtml();break;case"loading":t=this.getLoaderHtml();break;case"waitingForOverflow":t=this.getWaitingForOverflowHtml();break;case"parsingFailed":this.width=314,t=this.parsingArtboardsFailedHtml();break;case"incompatibleAppVersion":t=this.incompatibleAppVersion();break;case"connectionFailed":case"notOpened":case"overflowNotInstalled":this.width=314,t=this.syncToOverflowFailedHtml();break;default:t=""}return t=`\n ${this.getStyles()}\n <form method="dialog">\n ${t}\n </form>\n `,t}getNoSelectedArtboardsHtml(){return'\n <style>\n .h1 {\n align-items: center;\n justify-content: space-between;\n display: flex;\n flex-direction: row;\n }\n .icon {\n border-radius: 4px;\n width: 24px;\n height: 24px;\n overflow: hidden;\n }\n </style>\n <div>\n <h1 class="h1">\n <span>No artboards selected</span>\n <img id="logo" src="./assets/images/warning.png" class="icon" />\n </h1>\n <hr/ >\n\n <p>Please select at least one artboard to sync to Overflow.</p>\n\n </div>\n <footer>\n <button id="ok" uxp-variant="cta">OK</button>\n </footer>\n '}getLoaderHtml(){return'\n <style>\n h1 {\n align-items: center;\n justify-content: space-between;\n display: flex;\n flex-direction: row;\n }\n .icon {\n border-radius: 4px;\n width: 24px;\n height: 24px;\n overflow: hidden;\n }\n </style>\n <div>\n <h1 class="h1">\n <span id="dialog-title">Syncing artboards</span>\n <img id="logo" src="./assets/images/app-icon.png" class="icon" />\n </h1>\n <hr/ >\n\n\n\n <div>\n <p id="msg">Artboard 1 of 10</p>\n <p>\n <div id="outer-loader">\n <div id="inner-loader">\n </div>\n </div>\n </p>\n </div>\n </div>\n <footer>\n <button id="cancel">Cancel</button>\n </footer>\n '}getWaitingForOverflowHtml(){return'\n <div class="div-wrapper">\n <div class="div-left">\n <img id="logo" src="./assets/images/app-icon.png" width="56" height="60" />\n </div>\n <div class="div-right">\n <h2 class="title-app-icon">Waiting for Overflow</h2>\n </div>\n </div>\n '}syncToOverflowFailedHtml(){return'\n <style>\n\n .h1 {\n align-items: center;\n justify-content: space-between;\n display: flex;\n flex-direction: row;\n }\n\n\n\n h5 {\n margin: 12px 88px 0px 0px;\n cursor: pointer;\n }\n .icon {\n border-radius: 4px;\n width: 24px;\n height: 24px;\n overflow: hidden;\n }\n\n </style>\n\n <div>\n <h1 class="h1">\n <span>Sync to Overflow</span>\n <img id="logo" src="./assets/images/warning.png" class="icon" /></h1>\n <hr />\n <p>A connection with Overflow couldn\'t be established. Please ensure that Overflow is open and re-sync.</p>\n </div>\n <footer>\n\n <a style=" margin-top: 12px; margin-right:10px;"href="https://overflow.io/download">Get Overflow</a>\n\n <button type="submit" id="cancel" uxp-variant="cta">OK</button>\n </footer>\n '}parsingArtboardsFailedHtml(){return'\n<style>\n\n.h1 {\n align-items: center;\n justify-content: space-between;\n display: flex;\n flex-direction: row;\n}\n\nh5 {\n margin: 12px 88px 0px 0px;\n cursor: pointer;\n}\n.icon {\n border-radius: 4px;\n width: 24px;\n height: 24px;\n overflow: hidden;\n}\n\n</style>\n\n<div>\n <h1 class="h1">\n <span>Sync to Overflow</span>\n <img id="logo" src="./assets/images/warning.png" class="icon" />\n </h1>\n <hr />\n <p>We encounter an error while trying to sync your artboards. Please contact Overflow support to troubleshoot the issue.</p>\n</div>\n<footer>\n <a style=" margin-top: 12px; margin-right:10px;"href="https://support.overflow.io/hc/en-us/requests/new">Contact Support</a>\n <button type="submit" id="ok" uxp-variant="cta">OK</button>\n</footer>\n'}incompatibleAppVersion(){return'\n <style>\n \n .h1 {\n align-items: center;\n justify-content: space-between;\n display: flex;\n flex-direction: row;\n }\n \n h5 {\n margin: 12px 88px 0px 0px;\n cursor: pointer;\n }\n .icon {\n border-radius: 4px;\n width: 24px;\n height: 24px;\n overflow: hidden;\n }\n \n </style>\n \n <div>\n <h1 class="h1">\n <span>Sync to Overflow</span>\n <img id="logo" src="./assets/images/warning.png" class="icon" />\n </h1>\n <hr />\n <p>Your current Overflow app version is outdated with this plugin. Please update Overflow and sync again.</p>\n </div>\n <footer>\n <a style=" margin-top: 12px; margin-right:10px;"href="https://support.overflow.io/hc/en-us/requests/new">Contact Support</a>\n <button type="submit" id="ok" uxp-variant="cta">OK</button>\n </footer>\n '}getStyles(){return"<style>\n #dialog form {\n width: 360px;\n }\n\n #outer-loader {\n margin-left: 7px;\n background: #d3d3d3;\n border-radius: 3px;\n }\n\n #inner-loader {\n background: #2680EB;\n height: 5px;\n width: 0%;\n border-radius: 3px;\n }\n\n h2 {\n color: black;\n }\n </style>\n "}}}]);