@gadgetinc/ggt 1.7.1 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +1 -0
  2. package/dist/{add-M2YVCVDJ.js → add-VP2I3CKE.js} +2 -2
  3. package/dist/{chunk-UAZBF6WU.js → chunk-22W3HJQG.js} +2 -2
  4. package/dist/{chunk-2WKENYA3.js → chunk-DRI75CDO.js} +2 -2
  5. package/dist/{chunk-GC4CQ6BI.js → chunk-IZO5RL5L.js} +2 -2
  6. package/dist/{chunk-TPWSJOGX.js → chunk-L5H5T2T6.js} +3 -3
  7. package/dist/{chunk-TPWSJOGX.js.map → chunk-L5H5T2T6.js.map} +2 -2
  8. package/dist/{chunk-ILB6CSBN.js → chunk-MHTXRD5G.js} +2 -2
  9. package/dist/{chunk-KMNQ3LJT.js → chunk-OIVNACS7.js} +2 -2
  10. package/dist/{chunk-KMNQ3LJT.js.map → chunk-OIVNACS7.js.map} +2 -2
  11. package/dist/{chunk-DP2MEKPK.js → chunk-OKVWONGO.js} +2 -2
  12. package/dist/{chunk-DYAWQS24.js → chunk-X47UA3VR.js} +2 -2
  13. package/dist/{configure-LD5XC2MR.js → configure-CXY6JQB7.js} +2 -2
  14. package/dist/{deploy-QX2ELPOA.js → deploy-ZRLKAGWM.js} +2 -2
  15. package/dist/{dev-ODLZZUI4.js → dev-XI2RDRXJ.js} +3 -2
  16. package/dist/{dev-ODLZZUI4.js.map → dev-XI2RDRXJ.js.map} +2 -2
  17. package/dist/{list-E3DN5VVW.js → list-3QZTSHQV.js} +2 -2
  18. package/dist/login-HKGCVIWO.js +2 -0
  19. package/dist/{logout-ACRXIJEF.js → logout-SWWGI27Q.js} +2 -2
  20. package/dist/{logs-VGDAULNT.js → logs-36QPFIDT.js} +2 -2
  21. package/dist/main.js +1 -1
  22. package/dist/{open-LBVP7DXX.js → open-65LHZE2M.js} +2 -2
  23. package/dist/{pull-I3WM4RL3.js → pull-GS2VSBLT.js} +2 -2
  24. package/dist/push-4LGFNWTC.js +2 -0
  25. package/dist/{status-2PKSATWL.js → status-6QVAIYUR.js} +2 -2
  26. package/dist/{whoami-LEZVATND.js → whoami-MIJFO4MW.js} +2 -2
  27. package/package.json +1 -1
  28. package/dist/login-LXGUUTW3.js +0 -2
  29. package/dist/push-GE55G6KR.js +0 -2
  30. /package/dist/{add-M2YVCVDJ.js.map → add-VP2I3CKE.js.map} +0 -0
  31. /package/dist/{chunk-UAZBF6WU.js.map → chunk-22W3HJQG.js.map} +0 -0
  32. /package/dist/{chunk-2WKENYA3.js.map → chunk-DRI75CDO.js.map} +0 -0
  33. /package/dist/{chunk-GC4CQ6BI.js.map → chunk-IZO5RL5L.js.map} +0 -0
  34. /package/dist/{chunk-ILB6CSBN.js.map → chunk-MHTXRD5G.js.map} +0 -0
  35. /package/dist/{chunk-DP2MEKPK.js.map → chunk-OKVWONGO.js.map} +0 -0
  36. /package/dist/{chunk-DYAWQS24.js.map → chunk-X47UA3VR.js.map} +0 -0
  37. /package/dist/{configure-LD5XC2MR.js.map → configure-CXY6JQB7.js.map} +0 -0
  38. /package/dist/{deploy-QX2ELPOA.js.map → deploy-ZRLKAGWM.js.map} +0 -0
  39. /package/dist/{list-E3DN5VVW.js.map → list-3QZTSHQV.js.map} +0 -0
  40. /package/dist/{login-LXGUUTW3.js.map → login-HKGCVIWO.js.map} +0 -0
  41. /package/dist/{logout-ACRXIJEF.js.map → logout-SWWGI27Q.js.map} +0 -0
  42. /package/dist/{logs-VGDAULNT.js.map → logs-36QPFIDT.js.map} +0 -0
  43. /package/dist/{open-LBVP7DXX.js.map → open-65LHZE2M.js.map} +0 -0
  44. /package/dist/{pull-I3WM4RL3.js.map → pull-GS2VSBLT.js.map} +0 -0
  45. /package/dist/{push-GE55G6KR.js.map → push-4LGFNWTC.js.map} +0 -0
  46. /package/dist/{status-2PKSATWL.js.map → status-6QVAIYUR.js.map} +0 -0
  47. /package/dist/{whoami-LEZVATND.js.map → whoami-MIJFO4MW.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as l}from"./chunk-JBY5A44K.js";import{c as g}from"./chunk-KMNQ3LJT.js";import{A as d,Z as i,ca as c,ja as r}from"./chunk-24OT7GHO.js";import{a as s,f as p,h as u}from"./chunk-7DYQUG5M.js";u();var f=p(d(),1);var D=s(async t=>{let o=i.defaultsConfigFile,e;if(await l({ensureEmptyLineAbove:!0,choices:["default","configure"],content:"Default configuration from Gadget or configure manually"})==="configure"){let n=await l({ensureEmptyLineAbove:!0,choices:["enable","disable"],content:"Automatically send crash reports and telemetry to Gadget"}),m=await l({ensureEmptyLineAbove:!0,choices:["disable","enable"],content:"ggt output as JSON"});e={telemetry:n==="enable",json:m==="enable"}}else e={telemetry:!0,json:!1};return await f.default.outputJSON(o,e).then(()=>{r("Default arguments were saved.")},n=>{t.log.error("failed to write config",{error:n.message})}),e},"promptDefaultsConfig"),x=s(async(t,o)=>{let e=i.defaultsConfigFile,a;try{a=await f.default.readJSON(e)}catch(n){g(n),c.isInteractive&&o?(r("No ggt defaults were found to have been configured. Please answer the prompts to configure your defaults."),a=await D(t),r("To update these options later, see `ggt configure`.")):a={}}return a},"loadDefaultsConfig"),v=s(async t=>{let o=i.defaultsConfigFile;await f.default.outputJSON(o,{}).then(()=>{r("Default arguments were saved.")},e=>{t.log.error("failed to write config",{error:e.message})})},"clearDefaultsConfig");export{D as a,x as b,v as c};
2
- //# sourceMappingURL=chunk-ILB6CSBN.js.map
1
+ import{a as l}from"./chunk-JBY5A44K.js";import{c as g}from"./chunk-OIVNACS7.js";import{A as d,Z as i,ca as c,ja as r}from"./chunk-24OT7GHO.js";import{a as s,f as p,h as u}from"./chunk-7DYQUG5M.js";u();var f=p(d(),1);var D=s(async t=>{let o=i.defaultsConfigFile,e;if(await l({ensureEmptyLineAbove:!0,choices:["default","configure"],content:"Default configuration from Gadget or configure manually"})==="configure"){let n=await l({ensureEmptyLineAbove:!0,choices:["enable","disable"],content:"Automatically send crash reports and telemetry to Gadget"}),m=await l({ensureEmptyLineAbove:!0,choices:["disable","enable"],content:"ggt output as JSON"});e={telemetry:n==="enable",json:m==="enable"}}else e={telemetry:!0,json:!1};return await f.default.outputJSON(o,e).then(()=>{r("Default arguments were saved.")},n=>{t.log.error("failed to write config",{error:n.message})}),e},"promptDefaultsConfig"),x=s(async(t,o)=>{let e=i.defaultsConfigFile,a;try{a=await f.default.readJSON(e)}catch(n){g(n),c.isInteractive&&o?(r("No ggt defaults were found to have been configured. Please answer the prompts to configure your defaults."),a=await D(t),r("To update these options later, see `ggt configure`.")):a={}}return a},"loadDefaultsConfig"),v=s(async t=>{let o=i.defaultsConfigFile;await f.default.outputJSON(o,{}).then(()=>{r("Default arguments were saved.")},e=>{t.log.error("failed to write config",{error:e.message})})},"clearDefaultsConfig");export{D as a,x as b,v as c};
2
+ //# sourceMappingURL=chunk-MHTXRD5G.js.map
@@ -1,4 +1,4 @@
1
- import{A as z}from"./chunk-24OT7GHO.js";import{a as n,d as $,f as _,h as c}from"./chunk-7DYQUG5M.js";var G=$((ht,H)=>{c();function v(e){return Array.isArray(e)?e:[e]}n(v,"makeArray");var m="",N=" ",d="\\",k=/^\s+$/,W=/(?:[^\\]|^)\\$/,j=/^\\!/,B=/^\\#/,V=/\r?\n/g,K=/^\.*\/|^\.+$/,E="/",C="node-ignore";typeof Symbol<"u"&&(C=Symbol.for("node-ignore"));var S=C,Y=n((e,t,s)=>Object.defineProperty(e,t,{value:s}),"define"),M=/([0-z])-([0-z])/g,I=n(()=>!1,"RETURN_FALSE"),q=n(e=>e.replace(M,(t,s,r)=>s.charCodeAt(0)<=r.charCodeAt(0)?t:m),"sanitizeRange"),J=n(e=>{let{length:t}=e;return e.slice(0,t-t%2)},"cleanRangeBackSlash"),Q=[[/^\uFEFF/,()=>m],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,s)=>t+(s.indexOf("\\")===0?N:m)],[/(\\+?)\s/g,(e,t)=>{let{length:s}=t;return t.slice(0,s-s%2)+N}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,n(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,s)=>t+6<s.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,s)=>{let r=s.replace(/\\\*/g,"[^\\/]*");return t+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>d],[/\\\\/g,()=>d],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,s,r,i)=>t===d?`\\[${s}${J(r)}${i}`:i==="]"&&r.length%2===0?`[${q(s)}${r}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],b=Object.create(null),U=n((e,t)=>{let s=b[e];return s||(s=Q.reduce((r,[i,o])=>r.replace(i,o.bind(e)),e),b[e]=s),t?new RegExp(s,"i"):new RegExp(s)},"makeRegex"),p=n(e=>typeof e=="string","isString"),Z=n(e=>e&&p(e)&&!k.test(e)&&!W.test(e)&&e.indexOf("#")!==0,"checkPattern"),tt=n(e=>e.split(V),"splitPattern"),y=class{static{n(this,"IgnoreRule")}constructor(t,s,r,i){this.origin=t,this.pattern=s,this.negative=r,this.regex=i}},et=n((e,t)=>{let s=e,r=!1;e.indexOf("!")===0&&(r=!0,e=e.substr(1)),e=e.replace(j,"!").replace(B,"#");let i=U(e,t);return new y(s,e,r,i)},"createRule"),st=n((e,t)=>{throw new t(e)},"throwError"),a=n((e,t,s)=>p(e)?e?a.isNotRelative(e)?s(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:s("path must not be empty",TypeError):s(`path must be a string, but got \`${t}\``,TypeError),"checkPath"),O=n(e=>K.test(e),"isNotRelative");a.isNotRelative=O;a.convert=e=>e;var R=class{static{n(this,"Ignore")}constructor({ignorecase:t=!0,ignoreCase:s=t,allowRelativePaths:r=!1}={}){Y(this,S,!0),this._rules=[],this._ignoreCase=s,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[S]){this._rules=this._rules.concat(t._rules),this._added=!0;return}if(Z(t)){let s=et(t,this._ignoreCase);this._added=!0,this._rules.push(s)}}add(t){return this._added=!1,v(p(t)?tt(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,s){let r=!1,i=!1;return this._rules.forEach(o=>{let{negative:u}=o;if(i===u&&r!==i||u&&!r&&!i&&!s)return;o.regex.test(t)&&(r=!u,i=u)}),{ignored:r,unignored:i}}_test(t,s,r,i){let o=t&&a.convert(t);return a(o,t,this._allowRelativePaths?I:st),this._t(o,s,r,i)}_t(t,s,r,i){if(t in s)return s[t];if(i||(i=t.split(E)),i.pop(),!i.length)return s[t]=this._testOne(t,r);let o=this._t(i.join(E)+E,s,r,i);return s[t]=o.ignored?o:this._testOne(t,r)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return v(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},g=n(e=>new R(e),"factory"),rt=n(e=>a(e&&a.convert(e),e,I),"isPathValid");g.isPathValid=rt;g.default=g;H.exports=g;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let e=n(s=>/^\\\\\?\\/.test(s)||/["<>|\u0000-\u001F]+/u.test(s)?s:s.replace(/\\/g,"/"),"makePosix");a.convert=e;let t=/^[a-z]:\//i;a.isNotRelative=s=>t.test(s)||O(s)}});var L=$((Et,T)=>{c();T.exports=function(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var s=e.length;if(s<=1)return e;var r="";if(s>4&&e[3]==="\\"){var i=e[2];(i==="?"||i===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),r="//")}var o=e.split(/[/\\]+/);return t!==!1&&o[o.length-1]===""&&o.pop(),r+o.join("/")}});c();var f=_(z(),1),D=_(G(),1),A=_(L(),1);import it from"node:assert";import{createHash as nt}from"node:crypto";import l from"node:path";import{Transform as ot}from"node:stream";import{pipeline as at}from"node:stream/promises";var ct=[".gadget/"],lt=[".DS_Store","node_modules",".git"],ut=[".gadget/sync.json",".gadget/backup","yarn-error.log"],F=class e{constructor(t){this.path=t}static{n(this,"Directory")}_ignorer;_isHashing=!1;static async init(t){let s=new e(t);return await s.loadIgnoreFile(),s}relative(t){return l.isAbsolute(t)?l.relative(this.path,t):t}absolute(...t){let s=l.resolve(this.path,...t);return it(s.startsWith(this.path),`expected ${s} to be within ${this.path}`),s}normalize(t,s){return l.isAbsolute(t)&&(t=this.relative(t)),t=(0,A.default)(t,!0),s&&(t+="/"),t}async loadIgnoreFile(){this._ignorer=D.default.default(),this._ignorer.add(lt);try{let t=await f.default.readFile(this.absolute(".ignore"),"utf8");this._ignorer.add(t)}catch(t){X(t)}}ignores(t){return t=this.relative(t),t===""?!1:t.startsWith("..")||(t=(0,A.default)(t,!1),this._isHashing&&ut.some(s=>t.startsWith(s)))?!0:ct.some(s=>t.startsWith(s))?!1:this._ignorer.ignores(t)}async*walk({dir:t=this.path}={}){t!==this.path&&(yield this.normalize(t,!0));for await(let s of await f.default.opendir(t)){let r=l.join(t,s.name);this.ignores(r)||(s.isDirectory()?yield*this.walk({dir:r}):s.isFile()&&(yield this.normalize(r,!1)))}}async hashes(){try{this._isHashing=!0;let t={};for await(let s of this.walk()){let r=this.absolute(s);t[s]=await gt(r)}return t}finally{this._isHashing=!1}}async hasFiles(){return!await this.isEmptyOrNonExistent()}async isEmptyOrNonExistent(){let t=!0;try{for await(let s of this.walk()){t=!1;break}}catch(s){X(s)}return t}},ft=process.platform==="linux"||process.platform==="darwin",gt=n(async e=>{let t=nt("sha1");t.update(l.basename(e));let s=await f.default.stat(e),r;if(ft&&(r=s.mode&511),s.isDirectory())return{sha1:t.digest("hex"),permissions:r};let i=new ot({transform(o,u,h){if(!o.includes(13)){h(void 0,o);return}let x=Buffer.alloc(o.length),P=0;for(let w of o)w!==13&&(x[P++]=w);h(void 0,x.subarray(0,P))}});return await at(f.default.createReadStream(e),i,t),{sha1:t.digest("hex"),permissions:r}},"hash"),X=n(e=>{if(!(e&&typeof e=="object"&&"code"in e&&e.code==="ENOENT"))throw e},"swallowEnoent");export{F as a,ft as b,X as c};
1
+ import{A as z}from"./chunk-24OT7GHO.js";import{a as n,d as $,f as _,h as c}from"./chunk-7DYQUG5M.js";var G=$((ht,H)=>{c();function v(e){return Array.isArray(e)?e:[e]}n(v,"makeArray");var m="",N=" ",d="\\",k=/^\s+$/,W=/(?:[^\\]|^)\\$/,j=/^\\!/,B=/^\\#/,V=/\r?\n/g,K=/^\.*\/|^\.+$/,E="/",C="node-ignore";typeof Symbol<"u"&&(C=Symbol.for("node-ignore"));var S=C,Y=n((e,t,s)=>Object.defineProperty(e,t,{value:s}),"define"),M=/([0-z])-([0-z])/g,I=n(()=>!1,"RETURN_FALSE"),q=n(e=>e.replace(M,(t,s,r)=>s.charCodeAt(0)<=r.charCodeAt(0)?t:m),"sanitizeRange"),J=n(e=>{let{length:t}=e;return e.slice(0,t-t%2)},"cleanRangeBackSlash"),Q=[[/^\uFEFF/,()=>m],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,s)=>t+(s.indexOf("\\")===0?N:m)],[/(\\+?)\s/g,(e,t)=>{let{length:s}=t;return t.slice(0,s-s%2)+N}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,n(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,s)=>t+6<s.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,s)=>{let r=s.replace(/\\\*/g,"[^\\/]*");return t+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>d],[/\\\\/g,()=>d],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,s,r,i)=>t===d?`\\[${s}${J(r)}${i}`:i==="]"&&r.length%2===0?`[${q(s)}${r}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],b=Object.create(null),U=n((e,t)=>{let s=b[e];return s||(s=Q.reduce((r,[i,o])=>r.replace(i,o.bind(e)),e),b[e]=s),t?new RegExp(s,"i"):new RegExp(s)},"makeRegex"),p=n(e=>typeof e=="string","isString"),Z=n(e=>e&&p(e)&&!k.test(e)&&!W.test(e)&&e.indexOf("#")!==0,"checkPattern"),tt=n(e=>e.split(V),"splitPattern"),y=class{static{n(this,"IgnoreRule")}constructor(t,s,r,i){this.origin=t,this.pattern=s,this.negative=r,this.regex=i}},et=n((e,t)=>{let s=e,r=!1;e.indexOf("!")===0&&(r=!0,e=e.substr(1)),e=e.replace(j,"!").replace(B,"#");let i=U(e,t);return new y(s,e,r,i)},"createRule"),st=n((e,t)=>{throw new t(e)},"throwError"),a=n((e,t,s)=>p(e)?e?a.isNotRelative(e)?s(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:s("path must not be empty",TypeError):s(`path must be a string, but got \`${t}\``,TypeError),"checkPath"),O=n(e=>K.test(e),"isNotRelative");a.isNotRelative=O;a.convert=e=>e;var R=class{static{n(this,"Ignore")}constructor({ignorecase:t=!0,ignoreCase:s=t,allowRelativePaths:r=!1}={}){Y(this,S,!0),this._rules=[],this._ignoreCase=s,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[S]){this._rules=this._rules.concat(t._rules),this._added=!0;return}if(Z(t)){let s=et(t,this._ignoreCase);this._added=!0,this._rules.push(s)}}add(t){return this._added=!1,v(p(t)?tt(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,s){let r=!1,i=!1;return this._rules.forEach(o=>{let{negative:u}=o;if(i===u&&r!==i||u&&!r&&!i&&!s)return;o.regex.test(t)&&(r=!u,i=u)}),{ignored:r,unignored:i}}_test(t,s,r,i){let o=t&&a.convert(t);return a(o,t,this._allowRelativePaths?I:st),this._t(o,s,r,i)}_t(t,s,r,i){if(t in s)return s[t];if(i||(i=t.split(E)),i.pop(),!i.length)return s[t]=this._testOne(t,r);let o=this._t(i.join(E)+E,s,r,i);return s[t]=o.ignored?o:this._testOne(t,r)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return v(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},g=n(e=>new R(e),"factory"),rt=n(e=>a(e&&a.convert(e),e,I),"isPathValid");g.isPathValid=rt;g.default=g;H.exports=g;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let e=n(s=>/^\\\\\?\\/.test(s)||/["<>|\u0000-\u001F]+/u.test(s)?s:s.replace(/\\/g,"/"),"makePosix");a.convert=e;let t=/^[a-z]:\//i;a.isNotRelative=s=>t.test(s)||O(s)}});var L=$((Et,T)=>{c();T.exports=function(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var s=e.length;if(s<=1)return e;var r="";if(s>4&&e[3]==="\\"){var i=e[2];(i==="?"||i===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),r="//")}var o=e.split(/[/\\]+/);return t!==!1&&o[o.length-1]===""&&o.pop(),r+o.join("/")}});c();var f=_(z(),1),D=_(G(),1),A=_(L(),1);import it from"node:assert";import{createHash as nt}from"node:crypto";import l from"node:path";import{Transform as ot}from"node:stream";import{pipeline as at}from"node:stream/promises";var ct=[".gadget/"],lt=[".DS_Store","node_modules",".git",".shopify"],ut=[".gadget/sync.json",".gadget/backup","yarn-error.log"],F=class e{constructor(t){this.path=t}static{n(this,"Directory")}_ignorer;_isHashing=!1;static async init(t){let s=new e(t);return await s.loadIgnoreFile(),s}relative(t){return l.isAbsolute(t)?l.relative(this.path,t):t}absolute(...t){let s=l.resolve(this.path,...t);return it(s.startsWith(this.path),`expected ${s} to be within ${this.path}`),s}normalize(t,s){return l.isAbsolute(t)&&(t=this.relative(t)),t=(0,A.default)(t,!0),s&&(t+="/"),t}async loadIgnoreFile(){this._ignorer=D.default.default(),this._ignorer.add(lt);try{let t=await f.default.readFile(this.absolute(".ignore"),"utf8");this._ignorer.add(t)}catch(t){X(t)}}ignores(t){return t=this.relative(t),t===""?!1:t.startsWith("..")||(t=(0,A.default)(t,!1),this._isHashing&&ut.some(s=>t.startsWith(s)))?!0:ct.some(s=>t.startsWith(s))?!1:this._ignorer.ignores(t)}async*walk({dir:t=this.path}={}){t!==this.path&&(yield this.normalize(t,!0));for await(let s of await f.default.opendir(t)){let r=l.join(t,s.name);this.ignores(r)||(s.isDirectory()?yield*this.walk({dir:r}):s.isFile()&&(yield this.normalize(r,!1)))}}async hashes(){try{this._isHashing=!0;let t={};for await(let s of this.walk()){let r=this.absolute(s);t[s]=await gt(r)}return t}finally{this._isHashing=!1}}async hasFiles(){return!await this.isEmptyOrNonExistent()}async isEmptyOrNonExistent(){let t=!0;try{for await(let s of this.walk()){t=!1;break}}catch(s){X(s)}return t}},ft=process.platform==="linux"||process.platform==="darwin",gt=n(async e=>{let t=nt("sha1");t.update(l.basename(e));let s=await f.default.stat(e),r;if(ft&&(r=s.mode&511),s.isDirectory())return{sha1:t.digest("hex"),permissions:r};let i=new ot({transform(o,u,h){if(!o.includes(13)){h(void 0,o);return}let x=Buffer.alloc(o.length),P=0;for(let w of o)w!==13&&(x[P++]=w);h(void 0,x.subarray(0,P))}});return await at(f.default.createReadStream(e),i,t),{sha1:t.digest("hex"),permissions:r}},"hash"),X=n(e=>{if(!(e&&typeof e=="object"&&"code"in e&&e.code==="ENOENT"))throw e},"swallowEnoent");export{F as a,ft as b,X as c};
2
2
  /*! Bundled license information:
3
3
 
4
4
  normalize-path/index.js:
@@ -9,4 +9,4 @@ normalize-path/index.js:
9
9
  * Released under the MIT License.
10
10
  *)
11
11
  */
12
- //# sourceMappingURL=chunk-KMNQ3LJT.js.map
12
+ //# sourceMappingURL=chunk-OIVNACS7.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../node_modules/.pnpm/ignore@6.0.2/node_modules/ignore/index.js", "../node_modules/.pnpm/normalize-path@3.0.0/node_modules/normalize-path/index.js", "../src/services/filesync/directory.ts"],
4
- "sourcesContent": ["// A simple implementation of make-array\nfunction makeArray (subject) {\n return Array.isArray(subject)\n ? subject\n : [subject]\n}\n\nconst EMPTY = ''\nconst SPACE = ' '\nconst ESCAPE = '\\\\'\nconst REGEX_TEST_BLANK_LINE = /^\\s+$/\nconst REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\\\]|^)\\\\$/\nconst REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\\\!/\nconst REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\\\#/\nconst REGEX_SPLITALL_CRLF = /\\r?\\n/g\n// /foo,\n// ./foo,\n// ../foo,\n// .\n// ..\nconst REGEX_TEST_INVALID_PATH = /^\\.*\\/|^\\.+$/\n\nconst SLASH = '/'\n\n// Do not use ternary expression here, since \"istanbul ignore next\" is buggy\nlet TMP_KEY_IGNORE = 'node-ignore'\n/* istanbul ignore else */\nif (typeof Symbol !== 'undefined') {\n TMP_KEY_IGNORE = Symbol.for('node-ignore')\n}\nconst KEY_IGNORE = TMP_KEY_IGNORE\n\nconst define = (object, key, value) =>\n Object.defineProperty(object, key, {value})\n\nconst REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g\n\nconst RETURN_FALSE = () => false\n\n// Sanitize the range of a regular expression\n// The cases are complicated, see test cases for details\nconst sanitizeRange = range => range.replace(\n REGEX_REGEXP_RANGE,\n (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)\n ? match\n // Invalid range (out of order) which is ok for gitignore rules but\n // fatal for JavaScript regular expression, so eliminate it.\n : EMPTY\n)\n\n// See fixtures #59\nconst cleanRangeBackSlash = slashes => {\n const {length} = slashes\n return slashes.slice(0, length - length % 2)\n}\n\n// > If the pattern ends with a slash,\n// > it is removed for the purpose of the following description,\n// > but it would only find a match with a directory.\n// > In other words, foo/ will match a directory foo and paths underneath it,\n// > but will not match a regular file or a symbolic link foo\n// > (this is consistent with the way how pathspec works in general in Git).\n// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'\n// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call\n// you could use option `mark: true` with `glob`\n\n// '`foo/`' should not continue with the '`..`'\nconst REPLACERS = [\n\n [\n // remove BOM\n // TODO:\n // Other similar zero-width characters?\n /^\\uFEFF/,\n () => EMPTY\n ],\n\n // > Trailing spaces are ignored unless they are quoted with backslash (\"\\\")\n [\n // (a\\ ) -> (a )\n // (a ) -> (a)\n // (a ) -> (a)\n // (a \\ ) -> (a )\n /((?:\\\\\\\\)*?)(\\\\?\\s+)$/,\n (_, m1, m2) => m1 + (\n m2.indexOf('\\\\') === 0\n ? SPACE\n : EMPTY\n )\n ],\n\n // replace (\\ ) with ' '\n // (\\ ) -> ' '\n // (\\\\ ) -> '\\\\ '\n // (\\\\\\ ) -> '\\\\ '\n [\n /(\\\\+?)\\s/g,\n (_, m1) => {\n const {length} = m1\n return m1.slice(0, length - length % 2) + SPACE\n }\n ],\n\n // Escape metacharacters\n // which is written down by users but means special for regular expressions.\n\n // > There are 12 characters with special meanings:\n // > - the backslash \\,\n // > - the caret ^,\n // > - the dollar sign $,\n // > - the period or dot .,\n // > - the vertical bar or pipe symbol |,\n // > - the question mark ?,\n // > - the asterisk or star *,\n // > - the plus sign +,\n // > - the opening parenthesis (,\n // > - the closing parenthesis ),\n // > - and the opening square bracket [,\n // > - the opening curly brace {,\n // > These special characters are often called \"metacharacters\".\n [\n /[\\\\$.|*+(){^]/g,\n match => `\\\\${match}`\n ],\n\n [\n // > a question mark (?) matches a single character\n /(?!\\\\)\\?/g,\n () => '[^/]'\n ],\n\n // leading slash\n [\n\n // > A leading slash matches the beginning of the pathname.\n // > For example, \"/*.c\" matches \"cat-file.c\" but not \"mozilla-sha1/sha1.c\".\n // A leading slash matches the beginning of the pathname\n /^\\//,\n () => '^'\n ],\n\n // replace special metacharacter slash after the leading slash\n [\n /\\//g,\n () => '\\\\/'\n ],\n\n [\n // > A leading \"**\" followed by a slash means match in all directories.\n // > For example, \"**/foo\" matches file or directory \"foo\" anywhere,\n // > the same as pattern \"foo\".\n // > \"**/foo/bar\" matches file or directory \"bar\" anywhere that is directly\n // > under directory \"foo\".\n // Notice that the '*'s have been replaced as '\\\\*'\n /^\\^*\\\\\\*\\\\\\*\\\\\\//,\n\n // '**/foo' <-> 'foo'\n () => '^(?:.*\\\\/)?'\n ],\n\n // starting\n [\n // there will be no leading '/'\n // (which has been replaced by section \"leading slash\")\n // If starts with '**', adding a '^' to the regular expression also works\n /^(?=[^^])/,\n function startingReplacer () {\n // If has a slash `/` at the beginning or middle\n return !/\\/(?!$)/.test(this)\n // > Prior to 2.22.1\n // > If the pattern does not contain a slash /,\n // > Git treats it as a shell glob pattern\n // Actually, if there is only a trailing slash,\n // git also treats it as a shell glob pattern\n\n // After 2.22.1 (compatible but clearer)\n // > If there is a separator at the beginning or middle (or both)\n // > of the pattern, then the pattern is relative to the directory\n // > level of the particular .gitignore file itself.\n // > Otherwise the pattern may also match at any level below\n // > the .gitignore level.\n ? '(?:^|\\\\/)'\n\n // > Otherwise, Git treats the pattern as a shell glob suitable for\n // > consumption by fnmatch(3)\n : '^'\n }\n ],\n\n // two globstars\n [\n // Use lookahead assertions so that we could match more than one `'/**'`\n /\\\\\\/\\\\\\*\\\\\\*(?=\\\\\\/|$)/g,\n\n // Zero, one or several directories\n // should not use '*', or it will be replaced by the next replacer\n\n // Check if it is not the last `'/**'`\n (_, index, str) => index + 6 < str.length\n\n // case: /**/\n // > A slash followed by two consecutive asterisks then a slash matches\n // > zero or more directories.\n // > For example, \"a/**/b\" matches \"a/b\", \"a/x/b\", \"a/x/y/b\" and so on.\n // '/**/'\n ? '(?:\\\\/[^\\\\/]+)*'\n\n // case: /**\n // > A trailing `\"/**\"` matches everything inside.\n\n // #21: everything inside but it should not include the current folder\n : '\\\\/.+'\n ],\n\n // normal intermediate wildcards\n [\n // Never replace escaped '*'\n // ignore rule '\\*' will match the path '*'\n\n // 'abc.*/' -> go\n // 'abc.*' -> skip this rule,\n // coz trailing single wildcard will be handed by [trailing wildcard]\n /(^|[^\\\\]+)(\\\\\\*)+(?=.+)/g,\n\n // '*.js' matches '.js'\n // '*.js' doesn't match 'abc'\n (_, p1, p2) => {\n // 1.\n // > An asterisk \"*\" matches anything except a slash.\n // 2.\n // > Other consecutive asterisks are considered regular asterisks\n // > and will match according to the previous rules.\n const unescaped = p2.replace(/\\\\\\*/g, '[^\\\\/]*')\n return p1 + unescaped\n }\n ],\n\n [\n // unescape, revert step 3 except for back slash\n // For example, if a user escape a '\\\\*',\n // after step 3, the result will be '\\\\\\\\\\\\*'\n /\\\\\\\\\\\\(?=[$.|*+(){^])/g,\n () => ESCAPE\n ],\n\n [\n // '\\\\\\\\' -> '\\\\'\n /\\\\\\\\/g,\n () => ESCAPE\n ],\n\n [\n // > The range notation, e.g. [a-zA-Z],\n // > can be used to match one of the characters in a range.\n\n // `\\` is escaped by step 3\n /(\\\\)?\\[([^\\]/]*?)(\\\\*)($|\\])/g,\n (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE\n // '\\\\[bar]' -> '\\\\\\\\[bar\\\\]'\n ? `\\\\[${range}${cleanRangeBackSlash(endEscape)}${close}`\n : close === ']'\n ? endEscape.length % 2 === 0\n // A normal case, and it is a range notation\n // '[bar]'\n // '[bar\\\\\\\\]'\n ? `[${sanitizeRange(range)}${endEscape}]`\n // Invalid range notaton\n // '[bar\\\\]' -> '[bar\\\\\\\\]'\n : '[]'\n : '[]'\n ],\n\n // ending\n [\n // 'js' will not match 'js.'\n // 'ab' will not match 'abc'\n /(?:[^*])$/,\n\n // WTF!\n // https://git-scm.com/docs/gitignore\n // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)\n // which re-fixes #24, #38\n\n // > If there is a separator at the end of the pattern then the pattern\n // > will only match directories, otherwise the pattern can match both\n // > files and directories.\n\n // 'js*' will not match 'a.js'\n // 'js/' will not match 'a.js'\n // 'js' will match 'a.js' and 'a.js/'\n match => /\\/$/.test(match)\n // foo/ will not match 'foo'\n ? `${match}$`\n // foo matches 'foo' and 'foo/'\n : `${match}(?=$|\\\\/$)`\n ],\n\n // trailing wildcard\n [\n /(\\^|\\\\\\/)?\\\\\\*$/,\n (_, p1) => {\n const prefix = p1\n // '\\^':\n // '/*' does not match EMPTY\n // '/*' does not match everything\n\n // '\\\\\\/':\n // 'abc/*' does not match 'abc/'\n ? `${p1}[^/]+`\n\n // 'a*' matches 'a'\n // 'a*' matches 'aa'\n : '[^/]*'\n\n return `${prefix}(?=$|\\\\/$)`\n }\n ],\n]\n\n// A simple cache, because an ignore rule only has only one certain meaning\nconst regexCache = Object.create(null)\n\n// @param {pattern}\nconst makeRegex = (pattern, ignoreCase) => {\n let source = regexCache[pattern]\n\n if (!source) {\n source = REPLACERS.reduce(\n (prev, [matcher, replacer]) =>\n prev.replace(matcher, replacer.bind(pattern)),\n pattern\n )\n regexCache[pattern] = source\n }\n\n return ignoreCase\n ? new RegExp(source, 'i')\n : new RegExp(source)\n}\n\nconst isString = subject => typeof subject === 'string'\n\n// > A blank line matches no files, so it can serve as a separator for readability.\nconst checkPattern = pattern => pattern\n && isString(pattern)\n && !REGEX_TEST_BLANK_LINE.test(pattern)\n && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)\n\n // > A line starting with # serves as a comment.\n && pattern.indexOf('#') !== 0\n\nconst splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)\n\nclass IgnoreRule {\n constructor (\n origin,\n pattern,\n negative,\n regex\n ) {\n this.origin = origin\n this.pattern = pattern\n this.negative = negative\n this.regex = regex\n }\n}\n\nconst createRule = (pattern, ignoreCase) => {\n const origin = pattern\n let negative = false\n\n // > An optional prefix \"!\" which negates the pattern;\n if (pattern.indexOf('!') === 0) {\n negative = true\n pattern = pattern.substr(1)\n }\n\n pattern = pattern\n // > Put a backslash (\"\\\") in front of the first \"!\" for patterns that\n // > begin with a literal \"!\", for example, `\"\\!important!.txt\"`.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')\n // > Put a backslash (\"\\\") in front of the first hash for patterns that\n // > begin with a hash.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')\n\n const regex = makeRegex(pattern, ignoreCase)\n\n return new IgnoreRule(\n origin,\n pattern,\n negative,\n regex\n )\n}\n\nconst throwError = (message, Ctor) => {\n throw new Ctor(message)\n}\n\nconst checkPath = (path, originalPath, doThrow) => {\n if (!isString(path)) {\n return doThrow(\n `path must be a string, but got \\`${originalPath}\\``,\n TypeError\n )\n }\n\n // We don't know if we should ignore EMPTY, so throw\n if (!path) {\n return doThrow(`path must not be empty`, TypeError)\n }\n\n // Check if it is a relative path\n if (checkPath.isNotRelative(path)) {\n const r = '`path.relative()`d'\n return doThrow(\n `path should be a ${r} string, but got \"${originalPath}\"`,\n RangeError\n )\n }\n\n return true\n}\n\nconst isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)\n\ncheckPath.isNotRelative = isNotRelative\ncheckPath.convert = p => p\n\nclass Ignore {\n constructor ({\n ignorecase = true,\n ignoreCase = ignorecase,\n allowRelativePaths = false\n } = {}) {\n define(this, KEY_IGNORE, true)\n\n this._rules = []\n this._ignoreCase = ignoreCase\n this._allowRelativePaths = allowRelativePaths\n this._initCache()\n }\n\n _initCache () {\n this._ignoreCache = Object.create(null)\n this._testCache = Object.create(null)\n }\n\n _addPattern (pattern) {\n // #32\n if (pattern && pattern[KEY_IGNORE]) {\n this._rules = this._rules.concat(pattern._rules)\n this._added = true\n return\n }\n\n if (checkPattern(pattern)) {\n const rule = createRule(pattern, this._ignoreCase)\n this._added = true\n this._rules.push(rule)\n }\n }\n\n // @param {Array<string> | string | Ignore} pattern\n add (pattern) {\n this._added = false\n\n makeArray(\n isString(pattern)\n ? splitPattern(pattern)\n : pattern\n ).forEach(this._addPattern, this)\n\n // Some rules have just added to the ignore,\n // making the behavior changed.\n if (this._added) {\n this._initCache()\n }\n\n return this\n }\n\n // legacy\n addPattern (pattern) {\n return this.add(pattern)\n }\n\n // | ignored : unignored\n // negative | 0:0 | 0:1 | 1:0 | 1:1\n // -------- | ------- | ------- | ------- | --------\n // 0 | TEST | TEST | SKIP | X\n // 1 | TESTIF | SKIP | TEST | X\n\n // - SKIP: always skip\n // - TEST: always test\n // - TESTIF: only test if checkUnignored\n // - X: that never happen\n\n // @param {boolean} whether should check if the path is unignored,\n // setting `checkUnignored` to `false` could reduce additional\n // path matching.\n\n // @returns {TestResult} true if a file is ignored\n _testOne (path, checkUnignored) {\n let ignored = false\n let unignored = false\n\n this._rules.forEach(rule => {\n const {negative} = rule\n if (\n unignored === negative && ignored !== unignored\n || negative && !ignored && !unignored && !checkUnignored\n ) {\n return\n }\n\n const matched = rule.regex.test(path)\n\n if (matched) {\n ignored = !negative\n unignored = negative\n }\n })\n\n return {\n ignored,\n unignored\n }\n }\n\n // @returns {TestResult}\n _test (originalPath, cache, checkUnignored, slices) {\n const path = originalPath\n // Supports nullable path\n && checkPath.convert(originalPath)\n\n checkPath(\n path,\n originalPath,\n this._allowRelativePaths\n ? RETURN_FALSE\n : throwError\n )\n\n return this._t(path, cache, checkUnignored, slices)\n }\n\n _t (path, cache, checkUnignored, slices) {\n if (path in cache) {\n return cache[path]\n }\n\n if (!slices) {\n // path/to/a.js\n // ['path', 'to', 'a.js']\n slices = path.split(SLASH)\n }\n\n slices.pop()\n\n // If the path has no parent directory, just test it\n if (!slices.length) {\n return cache[path] = this._testOne(path, checkUnignored)\n }\n\n const parent = this._t(\n slices.join(SLASH) + SLASH,\n cache,\n checkUnignored,\n slices\n )\n\n // If the path contains a parent directory, check the parent first\n return cache[path] = parent.ignored\n // > It is not possible to re-include a file if a parent directory of\n // > that file is excluded.\n ? parent\n : this._testOne(path, checkUnignored)\n }\n\n ignores (path) {\n return this._test(path, this._ignoreCache, false).ignored\n }\n\n createFilter () {\n return path => !this.ignores(path)\n }\n\n filter (paths) {\n return makeArray(paths).filter(this.createFilter())\n }\n\n // @returns {TestResult}\n test (path) {\n return this._test(path, this._testCache, true)\n }\n}\n\nconst factory = options => new Ignore(options)\n\nconst isPathValid = path =>\n checkPath(path && checkPath.convert(path), path, RETURN_FALSE)\n\nfactory.isPathValid = isPathValid\n\n// Fixes typescript\nfactory.default = factory\n\nmodule.exports = factory\n\n// Windows\n// --------------------------------------------------------------\n/* istanbul ignore if */\nif (\n // Detect `process` so that it can run in browsers.\n typeof process !== 'undefined'\n && (\n process.env && process.env.IGNORE_TEST_WIN32\n || process.platform === 'win32'\n )\n) {\n /* eslint no-control-regex: \"off\" */\n const makePosix = str => /^\\\\\\\\\\?\\\\/.test(str)\n || /[\"<>|\\u0000-\\u001F]+/u.test(str)\n ? str\n : str.replace(/\\\\/g, '/')\n\n checkPath.convert = makePosix\n\n // 'C:\\\\foo' <- 'C:\\\\foo' has been converted to 'C:/'\n // 'd:\\\\foo'\n const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\\//i\n checkPath.isNotRelative = path =>\n REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)\n || isNotRelative(path)\n}\n", "/*!\n * normalize-path <https://github.com/jonschlinkert/normalize-path>\n *\n * Copyright (c) 2014-2018, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nmodule.exports = function(path, stripTrailing) {\n if (typeof path !== 'string') {\n throw new TypeError('expected path to be a string');\n }\n\n if (path === '\\\\' || path === '/') return '/';\n\n var len = path.length;\n if (len <= 1) return path;\n\n // ensure that win32 namespaces has two leading slashes, so that the path is\n // handled properly by the win32 version of path.parse() after being normalized\n // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces\n var prefix = '';\n if (len > 4 && path[3] === '\\\\') {\n var ch = path[2];\n if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\\\\\') {\n path = path.slice(2);\n prefix = '//';\n }\n }\n\n var segs = path.split(/[/\\\\]+/);\n if (stripTrailing !== false && segs[segs.length - 1] === '') {\n segs.pop();\n }\n return prefix + segs.join('/');\n};\n", "/**\n * DO NOT MODIFY\n *\n * Everything in this file also exists in gadget to ensure that this logic\n * is the same between the two projects.\n */\nimport fs from \"fs-extra\";\nimport type { Ignore } from \"ignore\";\nimport ignore from \"ignore\";\nimport assert from \"node:assert\";\nimport { createHash } from \"node:crypto\";\nimport path from \"node:path\";\nimport { Transform } from \"node:stream\";\nimport { pipeline } from \"node:stream/promises\";\nimport normalizePath from \"normalize-path\";\n\n/**\n * Paths that are never ignored, regardless of the contents of the `.ignore` file.\n */\nexport const NEVER_IGNORE_PATHS = [\".gadget/\"] as const;\n\n/**\n * Paths that are always ignored, regardless of the contents of the `.ignore` file.\n */\nexport const ALWAYS_IGNORE_PATHS = [\".DS_Store\", \"node_modules\", \".git\"] as const;\n\n/**\n * Paths that are ignored when hashing the directory.\n *\n * NOTE: This is the _only_ thing that is allowed to be different between gadget and ggt.\n */\nexport const HASHING_IGNORE_PATHS = [\".gadget/sync.json\", \".gadget/backup\", \"yarn-error.log\"] as const;\n\n/**\n * Represents a directory that is being synced.\n */\nexport class Directory {\n /**\n * A gitignore-style file parser used to determine which files to\n * ignore while syncing.\n *\n * @see https://www.npmjs.com/package/ignore\n */\n private _ignorer!: Ignore;\n\n /**\n * Whether the directory is currently being hashed.\n */\n private _isHashing = false;\n\n private constructor(\n /**\n * An absolute path to the directory that is being synced.\n */\n readonly path: string,\n ) {}\n\n /**\n * Initializes a directory to be synced.\n *\n * If the directory does not exist, it is created.\n *\n * @param dir - The directory to initialize.\n * @returns A Promise that resolves to a Directory instance.\n */\n static async init(dir: string): Promise<Directory> {\n const directory = new Directory(dir);\n await directory.loadIgnoreFile();\n return directory;\n }\n\n /**\n * Returns the relative path from this directory to the specified path.\n *\n * @param to - The path to which the relative path is calculated.\n * @returns The relative path from this directory to the specified path.\n */\n relative(to: string): string {\n if (!path.isAbsolute(to)) {\n // the filepath is already relative\n return to;\n }\n\n return path.relative(this.path, to);\n }\n\n /**\n * Returns the absolute path by resolving the given path segments\n * relative to the directory path.\n *\n * @param pathSegments - The path segments to resolve.\n * @returns The absolute path.\n */\n absolute(...pathSegments: string[]): string {\n const result = path.resolve(this.path, ...pathSegments);\n assert(result.startsWith(this.path), `expected ${result} to be within ${this.path}`);\n return result;\n }\n\n /**\n * Similar to {@linkcode relative} in that it converts an absolute\n * path into a relative one from {@linkcode path}. However, it also\n * changes any slashes to be posix/unix-like forward slashes,\n * condenses repeated slashes into a single slash, and adds a trailing\n * slash if the path is a directory.\n *\n * This is used when sending files to Gadget to ensure that the paths\n * are consistent across platforms.\n *\n * @see https://www.npmjs.com/package/normalize-path\n */\n normalize(filepath: string, isDirectory: boolean): string {\n if (path.isAbsolute(filepath)) {\n filepath = this.relative(filepath);\n }\n\n // true = trim trailing slashes\n filepath = normalizePath(filepath, true);\n\n if (isDirectory) {\n filepath += \"/\";\n }\n\n return filepath;\n }\n\n /**\n * Loads the `.ignore` file in the directory. If the file does not\n * exist, it is silently ignored.\n */\n async loadIgnoreFile(): Promise<void> {\n this._ignorer = ignore.default();\n this._ignorer.add(ALWAYS_IGNORE_PATHS);\n\n try {\n const content = await fs.readFile(this.absolute(\".ignore\"), \"utf8\");\n this._ignorer.add(content);\n } catch (error) {\n swallowEnoent(error);\n }\n }\n\n /**\n * Determines if a file should be ignored based on its filepath.\n *\n * @param filepath - The filepath of the file to check.\n * @returns True if the file should be ignored, false otherwise.\n */\n ignores(filepath: string): boolean {\n filepath = this.relative(filepath);\n if (filepath === \"\") {\n // don't ignore the root dir\n return false;\n }\n\n if (filepath.startsWith(\"..\")) {\n // anything above the root dir is ignored\n return true;\n }\n\n // false = don't trim trailing slashes\n filepath = normalizePath(filepath, false);\n if (this._isHashing && HASHING_IGNORE_PATHS.some((ignored) => filepath.startsWith(ignored))) {\n // special case for hashing\n return true;\n }\n\n if (NEVER_IGNORE_PATHS.some((neverIgnored) => filepath.startsWith(neverIgnored))) {\n // special case for never ignored paths\n return false;\n }\n\n return this._ignorer.ignores(filepath);\n }\n\n /**\n * Recursively walks through the directory and yields all non-ignored\n * files and directories within it.\n *\n * @yields - The normalized path of each file and directory.\n */\n async *walk({ dir = this.path } = {}): AsyncGenerator<string> {\n // don't yield the root directory\n if (dir !== this.path) {\n yield this.normalize(dir, true);\n }\n\n for await (const entry of await fs.opendir(dir)) {\n const filepath = path.join(dir, entry.name);\n if (this.ignores(filepath)) {\n continue;\n }\n\n if (entry.isDirectory()) {\n yield* this.walk({ dir: filepath });\n } else if (entry.isFile()) {\n yield this.normalize(filepath, false);\n }\n }\n }\n\n /**\n * Calculates the hash of each file and directory and returns an\n * object containing the hashes keyed by the normalized file path.\n *\n * @returns A Promise that resolves to an object containing the hashes\n * of each file.\n */\n async hashes(): Promise<Hashes> {\n try {\n this._isHashing = true;\n const files = {} as Hashes;\n\n for await (const normalizedPath of this.walk()) {\n const absolutePath = this.absolute(normalizedPath);\n files[normalizedPath] = await hash(absolutePath);\n }\n\n return files;\n } finally {\n this._isHashing = false;\n }\n }\n\n async hasFiles(): Promise<boolean> {\n return !(await this.isEmptyOrNonExistent());\n }\n\n async isEmptyOrNonExistent(): Promise<boolean> {\n let isEmptyOrNonExistent = true;\n try {\n for await (const _ of this.walk()) {\n isEmptyOrNonExistent = false;\n break;\n }\n } catch (error) {\n swallowEnoent(error);\n }\n return isEmptyOrNonExistent;\n }\n}\n\n/**\n * Key/value pairs where the key is the normalized path and the value is\n * the result of {@linkcode hash} for that path.\n */\nexport type Hashes = Record<string, Hash>;\n\nexport type Hash = {\n /**\n * The SHA-1 hash of the file or directory.\n *\n * If the path points to a directory, the hash is calculated based on\n * the directory's basename. If the path points to a file, the hash is\n * calculated based on the file's basename and contents.\n */\n sha1: string;\n\n /**\n * The Unix-style file permissions of the file or directory, or\n * undefined if the platform that generated this hash doesn't support\n * them.\n *\n * @example 0o644\n * @see supportsPermissions\n */\n permissions?: number;\n};\n\n/**\n * Whether the current platform supports Unix-style file permissions.\n *\n * Windows doesn't support Unix-style file permissions and all file\n * permissions retrieved via `node:fs` on Windows are translated to 666\n * or 444.\n */\nexport const supportsPermissions = process.platform === \"linux\" || process.platform === \"darwin\";\n\n/**\n * Calculates the {@linkcode Hash} of the file or directory at the\n * specified absolute path.\n *\n * @param absolutePath - The absolute path to the file or directory.\n * @returns A Promise that resolves to the {@linkcode Hash} of the file\n * or directory.\n */\nconst hash = async (absolutePath: string): Promise<Hash> => {\n const sha1 = createHash(\"sha1\");\n sha1.update(path.basename(absolutePath));\n\n const stats = await fs.stat(absolutePath);\n\n let permissions;\n if (supportsPermissions) {\n // strip everything but the permissions\n permissions = stats.mode & 0o777;\n }\n\n if (stats.isDirectory()) {\n return { sha1: sha1.digest(\"hex\"), permissions };\n }\n\n // windows uses CRLF line endings whereas unix uses LF line endings so\n // we always strip out CR bytes (0x0d) when hashing files. this does\n // make us blind to files that only differ by CR bytes, but that's a\n // tradeoff we're willing to make.\n const removeCR = new Transform({\n transform(chunk: Buffer, _encoding, callback) {\n if (!chunk.includes(0x0d)) {\n callback(undefined, chunk);\n return;\n }\n\n const filteredChunk = Buffer.alloc(chunk.length);\n let i = 0;\n for (const byte of chunk) {\n if (byte !== 0x0d) {\n filteredChunk[i++] = byte;\n }\n }\n\n callback(undefined, filteredChunk.subarray(0, i));\n },\n });\n\n await pipeline(fs.createReadStream(absolutePath), removeCR, sha1);\n\n return { sha1: sha1.digest(\"hex\"), permissions };\n};\n\n/**\n * Swallows ENOENT errors and throws any other errors.\n *\n * @param error - The error to handle.\n * @throws The original error if it is not an ENOENT error.\n */\nexport const swallowEnoent = (error: unknown): void => {\n if (error && typeof error === \"object\" && \"code\" in error && error.code === \"ENOENT\") {\n return;\n }\n throw error;\n};\n"],
5
- "mappings": "qGAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CAAAC,IACA,SAASC,EAAWC,EAAS,CAC3B,OAAO,MAAM,QAAQA,CAAO,EACxBA,EACA,CAACA,CAAO,CACd,CAJSC,EAAAF,EAAA,aAMT,IAAMG,EAAQ,GACRC,EAAQ,IACRC,EAAS,KACTC,EAAwB,QACxBC,EAAmC,iBACnCC,EAA4C,OAC5CC,EAAqC,OACrCC,EAAsB,SAMtBC,EAA0B,eAE1BC,EAAQ,IAGVC,EAAiB,cAEjB,OAAO,OAAW,MACpBA,EAAiB,OAAO,IAAI,aAAa,GAE3C,IAAMC,EAAaD,EAEbE,EAASb,EAAA,CAACc,EAAQC,EAAKC,IAC3B,OAAO,eAAeF,EAAQC,EAAK,CAAC,MAAAC,CAAK,CAAC,EAD7B,UAGTC,EAAqB,mBAErBC,EAAelB,EAAA,IAAM,GAAN,gBAIfmB,EAAgBnB,EAAAoB,GAASA,EAAM,QACnCH,EACA,CAACI,EAAOC,EAAMC,IAAOD,EAAK,WAAW,CAAC,GAAKC,EAAG,WAAW,CAAC,EACtDF,EAGApB,CACN,EAPsB,iBAUhBuB,EAAsBxB,EAAAyB,GAAW,CACrC,GAAM,CAAC,OAAAC,CAAM,EAAID,EACjB,OAAOA,EAAQ,MAAM,EAAGC,EAASA,EAAS,CA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AAW,QAAQ,WAAa,SAUlFH,GAAOrB,EAAA,MAAOoB,GAAwC,CAC1D,IAAMK,EAAOC,GAAW,MAAM,EAC9BD,EAAK,OAAO1B,EAAK,SAASqB,CAAY,CAAC,EAEvC,IAAMO,EAAQ,MAAM,EAAAf,QAAG,KAAKQ,CAAY,EAEpCQ,EAMJ,GALIJ,KAEFI,EAAcD,EAAM,KAAO,KAGzBA,EAAM,YAAY,EACpB,MAAO,CAAE,KAAMF,EAAK,OAAO,KAAK,EAAG,YAAAG,CAAY,EAOjD,IAAMC,EAAW,IAAIC,GAAU,CAC7B,UAAUC,EAAeC,EAAWC,EAAU,CAC5C,GAAI,CAACF,EAAM,SAAS,EAAI,EAAG,CACzBE,EAAS,OAAWF,CAAK,EACzB,MACF,CAEA,IAAMG,EAAgB,OAAO,MAAMH,EAAM,MAAM,EAC3CI,EAAI,EACR,QAAWC,KAAQL,EACbK,IAAS,KACXF,EAAcC,GAAG,EAAIC,GAIzBH,EAAS,OAAWC,EAAc,SAAS,EAAGC,CAAC,CAAC,CAClD,CACF,CAAC,EAED,aAAME,GAAS,EAAAzB,QAAG,iBAAiBQ,CAAY,EAAGS,EAAUJ,CAAI,EAEzD,CAAE,KAAMA,EAAK,OAAO,KAAK,EAAG,YAAAG,CAAY,CACjD,EA1Ca,QAkDAd,EAAgBd,EAACa,GAAyB,CACrD,GAAI,EAAAA,GAAS,OAAOA,GAAU,UAAY,SAAUA,GAASA,EAAM,OAAS,UAG5E,MAAMA,CACR,EAL6B",
4
+ "sourcesContent": ["// A simple implementation of make-array\nfunction makeArray (subject) {\n return Array.isArray(subject)\n ? subject\n : [subject]\n}\n\nconst EMPTY = ''\nconst SPACE = ' '\nconst ESCAPE = '\\\\'\nconst REGEX_TEST_BLANK_LINE = /^\\s+$/\nconst REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\\\]|^)\\\\$/\nconst REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\\\!/\nconst REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\\\#/\nconst REGEX_SPLITALL_CRLF = /\\r?\\n/g\n// /foo,\n// ./foo,\n// ../foo,\n// .\n// ..\nconst REGEX_TEST_INVALID_PATH = /^\\.*\\/|^\\.+$/\n\nconst SLASH = '/'\n\n// Do not use ternary expression here, since \"istanbul ignore next\" is buggy\nlet TMP_KEY_IGNORE = 'node-ignore'\n/* istanbul ignore else */\nif (typeof Symbol !== 'undefined') {\n TMP_KEY_IGNORE = Symbol.for('node-ignore')\n}\nconst KEY_IGNORE = TMP_KEY_IGNORE\n\nconst define = (object, key, value) =>\n Object.defineProperty(object, key, {value})\n\nconst REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g\n\nconst RETURN_FALSE = () => false\n\n// Sanitize the range of a regular expression\n// The cases are complicated, see test cases for details\nconst sanitizeRange = range => range.replace(\n REGEX_REGEXP_RANGE,\n (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)\n ? match\n // Invalid range (out of order) which is ok for gitignore rules but\n // fatal for JavaScript regular expression, so eliminate it.\n : EMPTY\n)\n\n// See fixtures #59\nconst cleanRangeBackSlash = slashes => {\n const {length} = slashes\n return slashes.slice(0, length - length % 2)\n}\n\n// > If the pattern ends with a slash,\n// > it is removed for the purpose of the following description,\n// > but it would only find a match with a directory.\n// > In other words, foo/ will match a directory foo and paths underneath it,\n// > but will not match a regular file or a symbolic link foo\n// > (this is consistent with the way how pathspec works in general in Git).\n// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'\n// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call\n// you could use option `mark: true` with `glob`\n\n// '`foo/`' should not continue with the '`..`'\nconst REPLACERS = [\n\n [\n // remove BOM\n // TODO:\n // Other similar zero-width characters?\n /^\\uFEFF/,\n () => EMPTY\n ],\n\n // > Trailing spaces are ignored unless they are quoted with backslash (\"\\\")\n [\n // (a\\ ) -> (a )\n // (a ) -> (a)\n // (a ) -> (a)\n // (a \\ ) -> (a )\n /((?:\\\\\\\\)*?)(\\\\?\\s+)$/,\n (_, m1, m2) => m1 + (\n m2.indexOf('\\\\') === 0\n ? SPACE\n : EMPTY\n )\n ],\n\n // replace (\\ ) with ' '\n // (\\ ) -> ' '\n // (\\\\ ) -> '\\\\ '\n // (\\\\\\ ) -> '\\\\ '\n [\n /(\\\\+?)\\s/g,\n (_, m1) => {\n const {length} = m1\n return m1.slice(0, length - length % 2) + SPACE\n }\n ],\n\n // Escape metacharacters\n // which is written down by users but means special for regular expressions.\n\n // > There are 12 characters with special meanings:\n // > - the backslash \\,\n // > - the caret ^,\n // > - the dollar sign $,\n // > - the period or dot .,\n // > - the vertical bar or pipe symbol |,\n // > - the question mark ?,\n // > - the asterisk or star *,\n // > - the plus sign +,\n // > - the opening parenthesis (,\n // > - the closing parenthesis ),\n // > - and the opening square bracket [,\n // > - the opening curly brace {,\n // > These special characters are often called \"metacharacters\".\n [\n /[\\\\$.|*+(){^]/g,\n match => `\\\\${match}`\n ],\n\n [\n // > a question mark (?) matches a single character\n /(?!\\\\)\\?/g,\n () => '[^/]'\n ],\n\n // leading slash\n [\n\n // > A leading slash matches the beginning of the pathname.\n // > For example, \"/*.c\" matches \"cat-file.c\" but not \"mozilla-sha1/sha1.c\".\n // A leading slash matches the beginning of the pathname\n /^\\//,\n () => '^'\n ],\n\n // replace special metacharacter slash after the leading slash\n [\n /\\//g,\n () => '\\\\/'\n ],\n\n [\n // > A leading \"**\" followed by a slash means match in all directories.\n // > For example, \"**/foo\" matches file or directory \"foo\" anywhere,\n // > the same as pattern \"foo\".\n // > \"**/foo/bar\" matches file or directory \"bar\" anywhere that is directly\n // > under directory \"foo\".\n // Notice that the '*'s have been replaced as '\\\\*'\n /^\\^*\\\\\\*\\\\\\*\\\\\\//,\n\n // '**/foo' <-> 'foo'\n () => '^(?:.*\\\\/)?'\n ],\n\n // starting\n [\n // there will be no leading '/'\n // (which has been replaced by section \"leading slash\")\n // If starts with '**', adding a '^' to the regular expression also works\n /^(?=[^^])/,\n function startingReplacer () {\n // If has a slash `/` at the beginning or middle\n return !/\\/(?!$)/.test(this)\n // > Prior to 2.22.1\n // > If the pattern does not contain a slash /,\n // > Git treats it as a shell glob pattern\n // Actually, if there is only a trailing slash,\n // git also treats it as a shell glob pattern\n\n // After 2.22.1 (compatible but clearer)\n // > If there is a separator at the beginning or middle (or both)\n // > of the pattern, then the pattern is relative to the directory\n // > level of the particular .gitignore file itself.\n // > Otherwise the pattern may also match at any level below\n // > the .gitignore level.\n ? '(?:^|\\\\/)'\n\n // > Otherwise, Git treats the pattern as a shell glob suitable for\n // > consumption by fnmatch(3)\n : '^'\n }\n ],\n\n // two globstars\n [\n // Use lookahead assertions so that we could match more than one `'/**'`\n /\\\\\\/\\\\\\*\\\\\\*(?=\\\\\\/|$)/g,\n\n // Zero, one or several directories\n // should not use '*', or it will be replaced by the next replacer\n\n // Check if it is not the last `'/**'`\n (_, index, str) => index + 6 < str.length\n\n // case: /**/\n // > A slash followed by two consecutive asterisks then a slash matches\n // > zero or more directories.\n // > For example, \"a/**/b\" matches \"a/b\", \"a/x/b\", \"a/x/y/b\" and so on.\n // '/**/'\n ? '(?:\\\\/[^\\\\/]+)*'\n\n // case: /**\n // > A trailing `\"/**\"` matches everything inside.\n\n // #21: everything inside but it should not include the current folder\n : '\\\\/.+'\n ],\n\n // normal intermediate wildcards\n [\n // Never replace escaped '*'\n // ignore rule '\\*' will match the path '*'\n\n // 'abc.*/' -> go\n // 'abc.*' -> skip this rule,\n // coz trailing single wildcard will be handed by [trailing wildcard]\n /(^|[^\\\\]+)(\\\\\\*)+(?=.+)/g,\n\n // '*.js' matches '.js'\n // '*.js' doesn't match 'abc'\n (_, p1, p2) => {\n // 1.\n // > An asterisk \"*\" matches anything except a slash.\n // 2.\n // > Other consecutive asterisks are considered regular asterisks\n // > and will match according to the previous rules.\n const unescaped = p2.replace(/\\\\\\*/g, '[^\\\\/]*')\n return p1 + unescaped\n }\n ],\n\n [\n // unescape, revert step 3 except for back slash\n // For example, if a user escape a '\\\\*',\n // after step 3, the result will be '\\\\\\\\\\\\*'\n /\\\\\\\\\\\\(?=[$.|*+(){^])/g,\n () => ESCAPE\n ],\n\n [\n // '\\\\\\\\' -> '\\\\'\n /\\\\\\\\/g,\n () => ESCAPE\n ],\n\n [\n // > The range notation, e.g. [a-zA-Z],\n // > can be used to match one of the characters in a range.\n\n // `\\` is escaped by step 3\n /(\\\\)?\\[([^\\]/]*?)(\\\\*)($|\\])/g,\n (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE\n // '\\\\[bar]' -> '\\\\\\\\[bar\\\\]'\n ? `\\\\[${range}${cleanRangeBackSlash(endEscape)}${close}`\n : close === ']'\n ? endEscape.length % 2 === 0\n // A normal case, and it is a range notation\n // '[bar]'\n // '[bar\\\\\\\\]'\n ? `[${sanitizeRange(range)}${endEscape}]`\n // Invalid range notaton\n // '[bar\\\\]' -> '[bar\\\\\\\\]'\n : '[]'\n : '[]'\n ],\n\n // ending\n [\n // 'js' will not match 'js.'\n // 'ab' will not match 'abc'\n /(?:[^*])$/,\n\n // WTF!\n // https://git-scm.com/docs/gitignore\n // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)\n // which re-fixes #24, #38\n\n // > If there is a separator at the end of the pattern then the pattern\n // > will only match directories, otherwise the pattern can match both\n // > files and directories.\n\n // 'js*' will not match 'a.js'\n // 'js/' will not match 'a.js'\n // 'js' will match 'a.js' and 'a.js/'\n match => /\\/$/.test(match)\n // foo/ will not match 'foo'\n ? `${match}$`\n // foo matches 'foo' and 'foo/'\n : `${match}(?=$|\\\\/$)`\n ],\n\n // trailing wildcard\n [\n /(\\^|\\\\\\/)?\\\\\\*$/,\n (_, p1) => {\n const prefix = p1\n // '\\^':\n // '/*' does not match EMPTY\n // '/*' does not match everything\n\n // '\\\\\\/':\n // 'abc/*' does not match 'abc/'\n ? `${p1}[^/]+`\n\n // 'a*' matches 'a'\n // 'a*' matches 'aa'\n : '[^/]*'\n\n return `${prefix}(?=$|\\\\/$)`\n }\n ],\n]\n\n// A simple cache, because an ignore rule only has only one certain meaning\nconst regexCache = Object.create(null)\n\n// @param {pattern}\nconst makeRegex = (pattern, ignoreCase) => {\n let source = regexCache[pattern]\n\n if (!source) {\n source = REPLACERS.reduce(\n (prev, [matcher, replacer]) =>\n prev.replace(matcher, replacer.bind(pattern)),\n pattern\n )\n regexCache[pattern] = source\n }\n\n return ignoreCase\n ? new RegExp(source, 'i')\n : new RegExp(source)\n}\n\nconst isString = subject => typeof subject === 'string'\n\n// > A blank line matches no files, so it can serve as a separator for readability.\nconst checkPattern = pattern => pattern\n && isString(pattern)\n && !REGEX_TEST_BLANK_LINE.test(pattern)\n && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)\n\n // > A line starting with # serves as a comment.\n && pattern.indexOf('#') !== 0\n\nconst splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)\n\nclass IgnoreRule {\n constructor (\n origin,\n pattern,\n negative,\n regex\n ) {\n this.origin = origin\n this.pattern = pattern\n this.negative = negative\n this.regex = regex\n }\n}\n\nconst createRule = (pattern, ignoreCase) => {\n const origin = pattern\n let negative = false\n\n // > An optional prefix \"!\" which negates the pattern;\n if (pattern.indexOf('!') === 0) {\n negative = true\n pattern = pattern.substr(1)\n }\n\n pattern = pattern\n // > Put a backslash (\"\\\") in front of the first \"!\" for patterns that\n // > begin with a literal \"!\", for example, `\"\\!important!.txt\"`.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')\n // > Put a backslash (\"\\\") in front of the first hash for patterns that\n // > begin with a hash.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')\n\n const regex = makeRegex(pattern, ignoreCase)\n\n return new IgnoreRule(\n origin,\n pattern,\n negative,\n regex\n )\n}\n\nconst throwError = (message, Ctor) => {\n throw new Ctor(message)\n}\n\nconst checkPath = (path, originalPath, doThrow) => {\n if (!isString(path)) {\n return doThrow(\n `path must be a string, but got \\`${originalPath}\\``,\n TypeError\n )\n }\n\n // We don't know if we should ignore EMPTY, so throw\n if (!path) {\n return doThrow(`path must not be empty`, TypeError)\n }\n\n // Check if it is a relative path\n if (checkPath.isNotRelative(path)) {\n const r = '`path.relative()`d'\n return doThrow(\n `path should be a ${r} string, but got \"${originalPath}\"`,\n RangeError\n )\n }\n\n return true\n}\n\nconst isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)\n\ncheckPath.isNotRelative = isNotRelative\ncheckPath.convert = p => p\n\nclass Ignore {\n constructor ({\n ignorecase = true,\n ignoreCase = ignorecase,\n allowRelativePaths = false\n } = {}) {\n define(this, KEY_IGNORE, true)\n\n this._rules = []\n this._ignoreCase = ignoreCase\n this._allowRelativePaths = allowRelativePaths\n this._initCache()\n }\n\n _initCache () {\n this._ignoreCache = Object.create(null)\n this._testCache = Object.create(null)\n }\n\n _addPattern (pattern) {\n // #32\n if (pattern && pattern[KEY_IGNORE]) {\n this._rules = this._rules.concat(pattern._rules)\n this._added = true\n return\n }\n\n if (checkPattern(pattern)) {\n const rule = createRule(pattern, this._ignoreCase)\n this._added = true\n this._rules.push(rule)\n }\n }\n\n // @param {Array<string> | string | Ignore} pattern\n add (pattern) {\n this._added = false\n\n makeArray(\n isString(pattern)\n ? splitPattern(pattern)\n : pattern\n ).forEach(this._addPattern, this)\n\n // Some rules have just added to the ignore,\n // making the behavior changed.\n if (this._added) {\n this._initCache()\n }\n\n return this\n }\n\n // legacy\n addPattern (pattern) {\n return this.add(pattern)\n }\n\n // | ignored : unignored\n // negative | 0:0 | 0:1 | 1:0 | 1:1\n // -------- | ------- | ------- | ------- | --------\n // 0 | TEST | TEST | SKIP | X\n // 1 | TESTIF | SKIP | TEST | X\n\n // - SKIP: always skip\n // - TEST: always test\n // - TESTIF: only test if checkUnignored\n // - X: that never happen\n\n // @param {boolean} whether should check if the path is unignored,\n // setting `checkUnignored` to `false` could reduce additional\n // path matching.\n\n // @returns {TestResult} true if a file is ignored\n _testOne (path, checkUnignored) {\n let ignored = false\n let unignored = false\n\n this._rules.forEach(rule => {\n const {negative} = rule\n if (\n unignored === negative && ignored !== unignored\n || negative && !ignored && !unignored && !checkUnignored\n ) {\n return\n }\n\n const matched = rule.regex.test(path)\n\n if (matched) {\n ignored = !negative\n unignored = negative\n }\n })\n\n return {\n ignored,\n unignored\n }\n }\n\n // @returns {TestResult}\n _test (originalPath, cache, checkUnignored, slices) {\n const path = originalPath\n // Supports nullable path\n && checkPath.convert(originalPath)\n\n checkPath(\n path,\n originalPath,\n this._allowRelativePaths\n ? RETURN_FALSE\n : throwError\n )\n\n return this._t(path, cache, checkUnignored, slices)\n }\n\n _t (path, cache, checkUnignored, slices) {\n if (path in cache) {\n return cache[path]\n }\n\n if (!slices) {\n // path/to/a.js\n // ['path', 'to', 'a.js']\n slices = path.split(SLASH)\n }\n\n slices.pop()\n\n // If the path has no parent directory, just test it\n if (!slices.length) {\n return cache[path] = this._testOne(path, checkUnignored)\n }\n\n const parent = this._t(\n slices.join(SLASH) + SLASH,\n cache,\n checkUnignored,\n slices\n )\n\n // If the path contains a parent directory, check the parent first\n return cache[path] = parent.ignored\n // > It is not possible to re-include a file if a parent directory of\n // > that file is excluded.\n ? parent\n : this._testOne(path, checkUnignored)\n }\n\n ignores (path) {\n return this._test(path, this._ignoreCache, false).ignored\n }\n\n createFilter () {\n return path => !this.ignores(path)\n }\n\n filter (paths) {\n return makeArray(paths).filter(this.createFilter())\n }\n\n // @returns {TestResult}\n test (path) {\n return this._test(path, this._testCache, true)\n }\n}\n\nconst factory = options => new Ignore(options)\n\nconst isPathValid = path =>\n checkPath(path && checkPath.convert(path), path, RETURN_FALSE)\n\nfactory.isPathValid = isPathValid\n\n// Fixes typescript\nfactory.default = factory\n\nmodule.exports = factory\n\n// Windows\n// --------------------------------------------------------------\n/* istanbul ignore if */\nif (\n // Detect `process` so that it can run in browsers.\n typeof process !== 'undefined'\n && (\n process.env && process.env.IGNORE_TEST_WIN32\n || process.platform === 'win32'\n )\n) {\n /* eslint no-control-regex: \"off\" */\n const makePosix = str => /^\\\\\\\\\\?\\\\/.test(str)\n || /[\"<>|\\u0000-\\u001F]+/u.test(str)\n ? str\n : str.replace(/\\\\/g, '/')\n\n checkPath.convert = makePosix\n\n // 'C:\\\\foo' <- 'C:\\\\foo' has been converted to 'C:/'\n // 'd:\\\\foo'\n const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\\//i\n checkPath.isNotRelative = path =>\n REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)\n || isNotRelative(path)\n}\n", "/*!\n * normalize-path <https://github.com/jonschlinkert/normalize-path>\n *\n * Copyright (c) 2014-2018, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nmodule.exports = function(path, stripTrailing) {\n if (typeof path !== 'string') {\n throw new TypeError('expected path to be a string');\n }\n\n if (path === '\\\\' || path === '/') return '/';\n\n var len = path.length;\n if (len <= 1) return path;\n\n // ensure that win32 namespaces has two leading slashes, so that the path is\n // handled properly by the win32 version of path.parse() after being normalized\n // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces\n var prefix = '';\n if (len > 4 && path[3] === '\\\\') {\n var ch = path[2];\n if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\\\\\') {\n path = path.slice(2);\n prefix = '//';\n }\n }\n\n var segs = path.split(/[/\\\\]+/);\n if (stripTrailing !== false && segs[segs.length - 1] === '') {\n segs.pop();\n }\n return prefix + segs.join('/');\n};\n", "/**\n * DO NOT MODIFY\n *\n * Everything in this file also exists in gadget to ensure that this logic\n * is the same between the two projects.\n */\nimport fs from \"fs-extra\";\nimport type { Ignore } from \"ignore\";\nimport ignore from \"ignore\";\nimport assert from \"node:assert\";\nimport { createHash } from \"node:crypto\";\nimport path from \"node:path\";\nimport { Transform } from \"node:stream\";\nimport { pipeline } from \"node:stream/promises\";\nimport normalizePath from \"normalize-path\";\n\n/**\n * Paths that are never ignored, regardless of the contents of the `.ignore` file.\n */\nexport const NEVER_IGNORE_PATHS = [\".gadget/\"] as const;\n\n/**\n * Paths that are always ignored, regardless of the contents of the `.ignore` file.\n */\nexport const ALWAYS_IGNORE_PATHS = [\".DS_Store\", \"node_modules\", \".git\", \".shopify\"] as const;\n\n/**\n * Paths that are ignored when hashing the directory.\n *\n * NOTE: This is the _only_ thing that is allowed to be different between gadget and ggt.\n */\nexport const HASHING_IGNORE_PATHS = [\".gadget/sync.json\", \".gadget/backup\", \"yarn-error.log\"] as const;\n\n/**\n * Represents a directory that is being synced.\n */\nexport class Directory {\n /**\n * A gitignore-style file parser used to determine which files to\n * ignore while syncing.\n *\n * @see https://www.npmjs.com/package/ignore\n */\n private _ignorer!: Ignore;\n\n /**\n * Whether the directory is currently being hashed.\n */\n private _isHashing = false;\n\n private constructor(\n /**\n * An absolute path to the directory that is being synced.\n */\n readonly path: string,\n ) {}\n\n /**\n * Initializes a directory to be synced.\n *\n * If the directory does not exist, it is created.\n *\n * @param dir - The directory to initialize.\n * @returns A Promise that resolves to a Directory instance.\n */\n static async init(dir: string): Promise<Directory> {\n const directory = new Directory(dir);\n await directory.loadIgnoreFile();\n return directory;\n }\n\n /**\n * Returns the relative path from this directory to the specified path.\n *\n * @param to - The path to which the relative path is calculated.\n * @returns The relative path from this directory to the specified path.\n */\n relative(to: string): string {\n if (!path.isAbsolute(to)) {\n // the filepath is already relative\n return to;\n }\n\n return path.relative(this.path, to);\n }\n\n /**\n * Returns the absolute path by resolving the given path segments\n * relative to the directory path.\n *\n * @param pathSegments - The path segments to resolve.\n * @returns The absolute path.\n */\n absolute(...pathSegments: string[]): string {\n const result = path.resolve(this.path, ...pathSegments);\n assert(result.startsWith(this.path), `expected ${result} to be within ${this.path}`);\n return result;\n }\n\n /**\n * Similar to {@linkcode relative} in that it converts an absolute\n * path into a relative one from {@linkcode path}. However, it also\n * changes any slashes to be posix/unix-like forward slashes,\n * condenses repeated slashes into a single slash, and adds a trailing\n * slash if the path is a directory.\n *\n * This is used when sending files to Gadget to ensure that the paths\n * are consistent across platforms.\n *\n * @see https://www.npmjs.com/package/normalize-path\n */\n normalize(filepath: string, isDirectory: boolean): string {\n if (path.isAbsolute(filepath)) {\n filepath = this.relative(filepath);\n }\n\n // true = trim trailing slashes\n filepath = normalizePath(filepath, true);\n\n if (isDirectory) {\n filepath += \"/\";\n }\n\n return filepath;\n }\n\n /**\n * Loads the `.ignore` file in the directory. If the file does not\n * exist, it is silently ignored.\n */\n async loadIgnoreFile(): Promise<void> {\n this._ignorer = ignore.default();\n this._ignorer.add(ALWAYS_IGNORE_PATHS);\n\n try {\n const content = await fs.readFile(this.absolute(\".ignore\"), \"utf8\");\n this._ignorer.add(content);\n } catch (error) {\n swallowEnoent(error);\n }\n }\n\n /**\n * Determines if a file should be ignored based on its filepath.\n *\n * @param filepath - The filepath of the file to check.\n * @returns True if the file should be ignored, false otherwise.\n */\n ignores(filepath: string): boolean {\n filepath = this.relative(filepath);\n if (filepath === \"\") {\n // don't ignore the root dir\n return false;\n }\n\n if (filepath.startsWith(\"..\")) {\n // anything above the root dir is ignored\n return true;\n }\n\n // false = don't trim trailing slashes\n filepath = normalizePath(filepath, false);\n if (this._isHashing && HASHING_IGNORE_PATHS.some((ignored) => filepath.startsWith(ignored))) {\n // special case for hashing\n return true;\n }\n\n if (NEVER_IGNORE_PATHS.some((neverIgnored) => filepath.startsWith(neverIgnored))) {\n // special case for never ignored paths\n return false;\n }\n\n return this._ignorer.ignores(filepath);\n }\n\n /**\n * Recursively walks through the directory and yields all non-ignored\n * files and directories within it.\n *\n * @yields - The normalized path of each file and directory.\n */\n async *walk({ dir = this.path } = {}): AsyncGenerator<string> {\n // don't yield the root directory\n if (dir !== this.path) {\n yield this.normalize(dir, true);\n }\n\n for await (const entry of await fs.opendir(dir)) {\n const filepath = path.join(dir, entry.name);\n if (this.ignores(filepath)) {\n continue;\n }\n\n if (entry.isDirectory()) {\n yield* this.walk({ dir: filepath });\n } else if (entry.isFile()) {\n yield this.normalize(filepath, false);\n }\n }\n }\n\n /**\n * Calculates the hash of each file and directory and returns an\n * object containing the hashes keyed by the normalized file path.\n *\n * @returns A Promise that resolves to an object containing the hashes\n * of each file.\n */\n async hashes(): Promise<Hashes> {\n try {\n this._isHashing = true;\n const files = {} as Hashes;\n\n for await (const normalizedPath of this.walk()) {\n const absolutePath = this.absolute(normalizedPath);\n files[normalizedPath] = await hash(absolutePath);\n }\n\n return files;\n } finally {\n this._isHashing = false;\n }\n }\n\n async hasFiles(): Promise<boolean> {\n return !(await this.isEmptyOrNonExistent());\n }\n\n async isEmptyOrNonExistent(): Promise<boolean> {\n let isEmptyOrNonExistent = true;\n try {\n for await (const _ of this.walk()) {\n isEmptyOrNonExistent = false;\n break;\n }\n } catch (error) {\n swallowEnoent(error);\n }\n return isEmptyOrNonExistent;\n }\n}\n\n/**\n * Key/value pairs where the key is the normalized path and the value is\n * the result of {@linkcode hash} for that path.\n */\nexport type Hashes = Record<string, Hash>;\n\nexport type Hash = {\n /**\n * The SHA-1 hash of the file or directory.\n *\n * If the path points to a directory, the hash is calculated based on\n * the directory's basename. If the path points to a file, the hash is\n * calculated based on the file's basename and contents.\n */\n sha1: string;\n\n /**\n * The Unix-style file permissions of the file or directory, or\n * undefined if the platform that generated this hash doesn't support\n * them.\n *\n * @example 0o644\n * @see supportsPermissions\n */\n permissions?: number;\n};\n\n/**\n * Whether the current platform supports Unix-style file permissions.\n *\n * Windows doesn't support Unix-style file permissions and all file\n * permissions retrieved via `node:fs` on Windows are translated to 666\n * or 444.\n */\nexport const supportsPermissions = process.platform === \"linux\" || process.platform === \"darwin\";\n\n/**\n * Calculates the {@linkcode Hash} of the file or directory at the\n * specified absolute path.\n *\n * @param absolutePath - The absolute path to the file or directory.\n * @returns A Promise that resolves to the {@linkcode Hash} of the file\n * or directory.\n */\nconst hash = async (absolutePath: string): Promise<Hash> => {\n const sha1 = createHash(\"sha1\");\n sha1.update(path.basename(absolutePath));\n\n const stats = await fs.stat(absolutePath);\n\n let permissions;\n if (supportsPermissions) {\n // strip everything but the permissions\n permissions = stats.mode & 0o777;\n }\n\n if (stats.isDirectory()) {\n return { sha1: sha1.digest(\"hex\"), permissions };\n }\n\n // windows uses CRLF line endings whereas unix uses LF line endings so\n // we always strip out CR bytes (0x0d) when hashing files. this does\n // make us blind to files that only differ by CR bytes, but that's a\n // tradeoff we're willing to make.\n const removeCR = new Transform({\n transform(chunk: Buffer, _encoding, callback) {\n if (!chunk.includes(0x0d)) {\n callback(undefined, chunk);\n return;\n }\n\n const filteredChunk = Buffer.alloc(chunk.length);\n let i = 0;\n for (const byte of chunk) {\n if (byte !== 0x0d) {\n filteredChunk[i++] = byte;\n }\n }\n\n callback(undefined, filteredChunk.subarray(0, i));\n },\n });\n\n await pipeline(fs.createReadStream(absolutePath), removeCR, sha1);\n\n return { sha1: sha1.digest(\"hex\"), permissions };\n};\n\n/**\n * Swallows ENOENT errors and throws any other errors.\n *\n * @param error - The error to handle.\n * @throws The original error if it is not an ENOENT error.\n */\nexport const swallowEnoent = (error: unknown): void => {\n if (error && typeof error === \"object\" && \"code\" in error && error.code === \"ENOENT\") {\n return;\n }\n throw error;\n};\n"],
5
+ "mappings": "qGAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CAAAC,IACA,SAASC,EAAWC,EAAS,CAC3B,OAAO,MAAM,QAAQA,CAAO,EACxBA,EACA,CAACA,CAAO,CACd,CAJSC,EAAAF,EAAA,aAMT,IAAMG,EAAQ,GACRC,EAAQ,IACRC,EAAS,KACTC,EAAwB,QACxBC,EAAmC,iBACnCC,EAA4C,OAC5CC,EAAqC,OACrCC,EAAsB,SAMtBC,EAA0B,eAE1BC,EAAQ,IAGVC,EAAiB,cAEjB,OAAO,OAAW,MACpBA,EAAiB,OAAO,IAAI,aAAa,GAE3C,IAAMC,EAAaD,EAEbE,EAASb,EAAA,CAACc,EAAQC,EAAKC,IAC3B,OAAO,eAAeF,EAAQC,EAAK,CAAC,MAAAC,CAAK,CAAC,EAD7B,UAGTC,EAAqB,mBAErBC,EAAelB,EAAA,IAAM,GAAN,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commonJSMin", "exports", "module", "init_cjs", "makeArray", "subject", "__name", "EMPTY", "SPACE", "ESCAPE", "REGEX_TEST_BLANK_LINE", "REGEX_INVALID_TRAILING_BACKSLASH", "REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION", "REGEX_REPLACE_LEADING_EXCAPED_HASH", "REGEX_SPLITALL_CRLF", "REGEX_TEST_INVALID_PATH", "SLASH", "TMP_KEY_IGNORE", "KEY_IGNORE", "define", "object", "key", "value", "REGEX_REGEXP_RANGE", "RETURN_FALSE", "sanitizeRange", "range", "match", "from", "to", "cleanRangeBackSlash", "slashes", "length", "REPLACERS", "_", "m1", "m2", "index", "str", "p1", "p2", "unescaped", "leadEscape", "endEscape", "close", "regexCache", "makeRegex", "pattern", "ignoreCase", "source", "prev", "matcher", "replacer", "isString", "checkPattern", "splitPattern", "IgnoreRule", "origin", "negative", "regex", "createRule", "throwError", "message", "Ctor", "checkPath", "path", "originalPath", "doThrow", "isNotRelative", "p", "Ignore", "ignorecase", "allowRelativePaths", "rule", "checkUnignored", "ignored", "unignored", "cache", "slices", "parent", "paths", "factory", "options", "isPathValid", "makePosix", "REGIX_IS_WINDOWS_PATH_ABSOLUTE", "require_normalize_path", "__commonJSMin", "exports", "module", "init_cjs", "path", "stripTrailing", "len", "prefix", "ch", "segs", "init_cjs", "import_fs_extra", "import_ignore", "import_normalize_path", "assert", "createHash", "path", "Transform", "pipeline", "NEVER_IGNORE_PATHS", "ALWAYS_IGNORE_PATHS", "HASHING_IGNORE_PATHS", "Directory", "_Directory", "path", "__name", "dir", "directory", "to", "pathSegments", "result", "assert", "filepath", "isDirectory", "normalizePath", "ignore", "content", "fs", "error", "swallowEnoent", "ignored", "neverIgnored", "entry", "files", "normalizedPath", "absolutePath", "hash", "isEmptyOrNonExistent", "_", "supportsPermissions", "sha1", "createHash", "stats", "permissions", "removeCR", "Transform", "chunk", "_encoding", "callback", "filteredChunk", "i", "byte", "pipeline"]
7
7
  }
@@ -1,4 +1,4 @@
1
- import{p as m}from"./chunk-2WKENYA3.js";import{l as g,m as h,n as p}from"./chunk-UAZBF6WU.js";import{c}from"./chunk-GC4CQ6BI.js";import{ha as a,ja as i}from"./chunk-24OT7GHO.js";import{a as s,h as r}from"./chunk-7DYQUG5M.js";r();var P={...g,"--env":{type:String,alias:["-e","--environment","--to"]},"--force":{type:Boolean,alias:"-f"}},S=s(e=>a`
1
+ import{p as m}from"./chunk-DRI75CDO.js";import{l as g,m as h,n as p}from"./chunk-22W3HJQG.js";import{c}from"./chunk-IZO5RL5L.js";import{ha as a,ja as i}from"./chunk-24OT7GHO.js";import{a as s,h as r}from"./chunk-7DYQUG5M.js";r();var P={...g,"--env":{type:String,alias:["-e","--environment","--to"]},"--force":{type:Boolean,alias:"-f"}},S=s(e=>a`
2
2
  Pushes your local files to your environment directory.
3
3
 
4
4
  This command first tracks changes in your environment directory since the last sync.
@@ -25,4 +25,4 @@ import{p as m}from"./chunk-2WKENYA3.js";import{l as g,m as h,n as p}from"./chunk
25
25
 
26
26
  Run "ggt push -h" for more information.
27
27
  `);let y=await p(process.cwd()),l=await h.loadOrInit(e,{command:"push",args:o,directory:y}),t=new m(l),n=await t.hashes(e);if(n.localChangesToPush.size===0){i({ensureEmptyLineAbove:!0,content:"Nothing to push."});return}n.environmentChangesToPull.size>0&&!n.onlyDotGadgetFilesChanged&&await t.print(e,{hashes:n}),await t.push(e,{command:"push",hashes:n,force:o["--force"]})},"run");export{P as a,S as b,A as c};
28
- //# sourceMappingURL=chunk-DP2MEKPK.js.map
28
+ //# sourceMappingURL=chunk-OKVWONGO.js.map
@@ -1,2 +1,2 @@
1
- import{c as d}from"./chunk-KMNQ3LJT.js";import{A as f,S as r,_ as n}from"./chunk-24OT7GHO.js";import{a as s,f as g,h as i}from"./chunk-7DYQUG5M.js";i();var t=g(f(),1);var m=r(e=>{if(process.env.GGT_SESSION)return e.log.debug("reading session from env"),process.env.GGT_SESSION;try{return e.log.debug("reading session from disk"),t.default.readFileSync(n("session.txt"),"utf8")}catch(o){d(o);return}}),c=s((e,o)=>{m.clear(),process.env.GGT_SESSION&&(e.log.debug("writing session to env",{session:!!o}),process.env.GGT_SESSION=o),e.log.debug("writing session to disk",{session:!!o,path:n("session.txt")}),o?t.default.outputFileSync(n("session.txt"),o):t.default.removeSync(n("session.txt"))},"writeSession"),a=r(e=>(e.log.debug("reading token from env"),process.env.GGT_TOKEN));export{m as a,c as b,a as c};
2
- //# sourceMappingURL=chunk-DYAWQS24.js.map
1
+ import{c as d}from"./chunk-OIVNACS7.js";import{A as f,S as r,_ as n}from"./chunk-24OT7GHO.js";import{a as s,f as g,h as i}from"./chunk-7DYQUG5M.js";i();var t=g(f(),1);var m=r(e=>{if(process.env.GGT_SESSION)return e.log.debug("reading session from env"),process.env.GGT_SESSION;try{return e.log.debug("reading session from disk"),t.default.readFileSync(n("session.txt"),"utf8")}catch(o){d(o);return}}),c=s((e,o)=>{m.clear(),process.env.GGT_SESSION&&(e.log.debug("writing session to env",{session:!!o}),process.env.GGT_SESSION=o),e.log.debug("writing session to disk",{session:!!o,path:n("session.txt")}),o?t.default.outputFileSync(n("session.txt"),o):t.default.removeSync(n("session.txt"))},"writeSession"),a=r(e=>(e.log.debug("reading token from env"),process.env.GGT_TOKEN));export{m as a,c as b,a as c};
2
+ //# sourceMappingURL=chunk-X47UA3VR.js.map
@@ -1,4 +1,4 @@
1
- import{a as i,b as s,c as g}from"./chunk-ILB6CSBN.js";import{b as n}from"./chunk-JSGXXXFU.js";import"./chunk-JBY5A44K.js";import"./chunk-XGQQOMPO.js";import"./chunk-KMNQ3LJT.js";import{ha as a,ja as r}from"./chunk-24OT7GHO.js";import{a as o,h as t}from"./chunk-7DYQUG5M.js";t();var c=o(e=>{n({json:e,headers:["Option","Configured Value"],rows:[["telemetry",String(e.telemetry)],["json",String(e.json)]],borders:"thick"})},"printDefaultsConfig"),m=o(e=>a`
1
+ import{a as i,b as s,c as g}from"./chunk-MHTXRD5G.js";import{b as n}from"./chunk-JSGXXXFU.js";import"./chunk-JBY5A44K.js";import"./chunk-XGQQOMPO.js";import"./chunk-OIVNACS7.js";import{ha as a,ja as r}from"./chunk-24OT7GHO.js";import{a as o,h as t}from"./chunk-7DYQUG5M.js";t();var c=o(e=>{n({json:e,headers:["Option","Configured Value"],rows:[["telemetry",String(e.telemetry)],["json",String(e.json)]],borders:"thick"})},"printDefaultsConfig"),m=o(e=>a`
2
2
  Make changes to the configured defaults. This allows you to set an option on every ggt command by default without
3
3
  needing to set a flag on every command.
4
4
 
@@ -9,4 +9,4 @@ import{a as i,b as s,c as g}from"./chunk-ILB6CSBN.js";import{b as n}from"./chunk
9
9
 
10
10
  ggt configure clear
11
11
  `,"usage"),h=o(async(e,f)=>{switch(f._[0]){case"show":c(await s(e,!1));break;case"change":await i(e);break;case"clear":await g(e);break;default:r(m(e));return}},"run");export{h as run,m as usage};
12
- //# sourceMappingURL=configure-LD5XC2MR.js.map
12
+ //# sourceMappingURL=configure-CXY6JQB7.js.map
@@ -1,4 +1,4 @@
1
- import{a as ee}from"./chunk-SX5LO3XQ.js";import{a as te}from"./chunk-DP2MEKPK.js";import{b as H,c as R,e as Q,k as y,p as Z}from"./chunk-2WKENYA3.js";import{a as J,c as q,d as _,i as X,m as W,n as K}from"./chunk-UAZBF6WU.js";import"./chunk-JSGXXXFU.js";import{b as Y}from"./chunk-WNAYBYSG.js";import"./chunk-GC4CQ6BI.js";import"./chunk-JBY5A44K.js";import"./chunk-HN3YKQ3C.js";import{a as A,c as O,g as z,u as w}from"./chunk-TPWSJOGX.js";import"./chunk-DYAWQS24.js";import"./chunk-XGQQOMPO.js";import"./chunk-KMNQ3LJT.js";import{b as i,ca as G,d as F,fa as j,ha as l,ja as t,n as V}from"./chunk-24OT7GHO.js";import"./chunk-GFQYFEEH.js";import{a as m,h as M}from"./chunk-7DYQUG5M.js";M();import le from"node:assert";var Re={...te,"--env":{type:String,alias:["-e","--environment","--from"]},"--allow-problems":{type:Boolean,alias:"--allow-issues"},"--allow-charges":{type:Boolean},"--allow-data-delete":{type:Boolean}},_e=m(s=>l`
1
+ import{a as ee}from"./chunk-SX5LO3XQ.js";import{a as te}from"./chunk-OKVWONGO.js";import{b as H,c as R,e as Q,k as y,p as Z}from"./chunk-DRI75CDO.js";import{a as J,c as q,d as _,i as X,m as W,n as K}from"./chunk-22W3HJQG.js";import"./chunk-JSGXXXFU.js";import{b as Y}from"./chunk-WNAYBYSG.js";import"./chunk-IZO5RL5L.js";import"./chunk-JBY5A44K.js";import"./chunk-HN3YKQ3C.js";import{a as A,c as O,g as z,u as w}from"./chunk-L5H5T2T6.js";import"./chunk-X47UA3VR.js";import"./chunk-XGQQOMPO.js";import"./chunk-OIVNACS7.js";import{b as i,ca as G,d as F,fa as j,ha as l,ja as t,n as V}from"./chunk-24OT7GHO.js";import"./chunk-GFQYFEEH.js";import{a as m,h as M}from"./chunk-7DYQUG5M.js";M();import le from"node:assert";var Re={...te,"--env":{type:String,alias:["-e","--environment","--from"]},"--allow-problems":{type:Boolean,alias:"--allow-issues"},"--allow-charges":{type:Boolean},"--allow-data-delete":{type:Boolean}},_e=m(s=>l`
2
2
  Deploys your app to production.
3
3
 
4
4
  This command first performs a sync to ensure that your local and environment directories
@@ -22,4 +22,4 @@ import{a as ee}from"./chunk-SX5LO3XQ.js";import{a as te}from"./chunk-DP2MEKPK.js
22
22
  Deploys code from the staging environment of a myBlog
23
23
  {cyanBright $ ggt deploy -a myBlog -from staging}
24
24
  `,"usage"),Pe=m(async(s,o)=>{let ne=await K(process.cwd()),a=await W.loadOrInit(s,{command:"deploy",args:o,directory:ne});t({ensureEmptyLineAbove:!0,content:`Deploying ${a.environment.name} to ${A(a.environment.application.primaryDomain,`https://${a.environment.application.primaryDomain}/`)}`});let T=new Z(a),p=await T.hashes(s);if(!p.inSync&&(p.localChangesToPush.size>0||!p.onlyDotGadgetFilesChanged)){if(await T.print(s,{hashes:p}),!o["--force"])if(t({ensureEmptyLineAbove:!0,content:"Your environment's files must match your local files before you can deploy."}),G.isInteractive||F.testLike){let r;switch(!0){case p.bothChanged:r=l`Would you like to push your local changes and {underline discard your environment's} changes now?`,o["--force"]=!0;break;case p.localChangesToPush.size>0:r=l`Would you like to push your local changes now?`;break;case p.environmentChanges.size>0:r=l`Do you want to {underline discard your environment's} changes now?`,o["--force"]=!0;break;default:ee("no changes to push or discard")}await w(r)}else t({ensureEmptyLineAbove:!0,content:"Assuming you want to push your local files now."});await T.push(s,{command:"deploy",hashes:p,force:o["--force"]})}let I={localFilesVersion:String(a.filesVersion),force:o["--allow-problems"],allowDeletedData:o["--allow-data-delete"],allowCharges:o["--allow-charges"]},E,f=e.NOT_STARTED,B=!1,v=a.edit.subscribe({subscription:Q,variables:I,onError:m(async r=>{if(s.log.error("failed to deploy",{error:r}),E?.fail(P(a,f)+" "+y()),V(r.cause)){let c=r.cause[0];if(le(c,"expected graphqlError to be defined"),c.extensions)switch(!0){case c.extensions.requiresUpgrade:t({ensureEmptyLineAbove:!0,content:c.message.replace(/GGT_PAYMENT_REQUIRED:?\s*/,"")}),process.exit(1);break;case c.extensions.requiresAdditionalCharge:t({ensureEmptyLineAbove:!0,content:c.message.replace(/GGT_PAYMENT_REQUIRED:?\s*/,"")}),await w({ensureEmptyLineAbove:!0,content:"Do you want to continue?"}),v.resubscribe({...I,allowCharges:!0});return}}await O(s,r)},"onError"),onData:m(async({publishStatus:r})=>{if(!r){s.log.warn("received empty publish status");return}let{publishStarted:c,progress:D,issues:N,status:g,deletedModelsAndFields:se}=r,C=N.length>0,{deletedModels:U,deletedModelFields:$}=se??{deletedModels:[],deletedModelFields:[]},x=U.length>0||$.length>0;if(!B&&(C||x)){B=!0;let d=N.filter(u=>u.severity===J.Fatal);if(d.length>0&&await O(s,new X(_(d))),C&&(t({ensureEmptyLineAbove:!0,content:l`{bold.yellow !} {bold Issues found in your development app}`}),q({problems:_(N)})),x){t({ensureEmptyLineAbove:!0,content:l`{bold.yellow !} {bold Data deleted on deploy}`});let u=i.blueBright("updated"),b=i.redBright("deleted"),S=[];U.forEach(n=>{S.push({symbol:R,name:i.redBright(n),action:b,indent:0})}),$.forEach(({modelIdentifier:n,fields:h})=>{S.push({symbol:H,name:i.blueBright(n),action:u,indent:0}),h.forEach(L=>{S.push({symbol:R,name:i.redBright(L),action:b,indent:2})})});let re=S.reduce((n,h)=>Math.max(n,h.name.length),0),ae=S.reduce((n,h)=>Math.max(n,h.indent),0),k=2;t({ensureEmptyLineAbove:!0,content:i.gray("These changes will be applied to production based on the app you're deploying.")});for(let n of S){let h=" ".repeat(n.indent*k),L=" ".repeat(re-n.name.length+2),ie=" ".repeat((ae-n.indent)*k);t({ensureEmptyLineAbove:!1,content:j(`${h}${n.symbol} ${n.name}${L}${ie}${n.action}`,6)})}}if(!c)await w("Do you want to continue?"),v.resubscribe({...I,force:!0,allowDeletedData:!0});else{let u=o["--allow-data-delete"],b=o["--allow-problems"];if(!u&&!b)throw new z("expected --allow-data-delete or --allow-problems to be true");b&&t(l`Deploying regardless of problems because "${i.gray("--allow-problems")}" was passed.`),u&&t(l`Deploying regardless of deleted data because "${i.gray("--allow-data-delete")}" was passed.`)}return}if(g?.code==="Errored"){E?.fail(P(a,f)+" "+y()),g.message&&t({ensureEmptyLineAbove:!0,content:i.red(g.message)}),g.output&&t({ensureEmptyLineAbove:!0,content:l`${A("Check logs",g.output)}`});return}if(D===e.COMPLETED){E?.succeed(oe(a,f));let d=i.green("Deploy successful!");g?.output&&(d+=` ${A("Check logs",g.output)}.`),t({ensureEmptyLineAbove:!0,content:d});return}if(D!==f){let d=P(a,D);if(d!==E?.text){E?.succeed(oe(a,f));let u=f===e.NOT_STARTED||!G.isInteractive;E=Y({ensureEmptyLineAbove:u,content:d})}f=D}},"onData"),onComplete:m(()=>{v.unsubscribe()},"onComplete")})},"run"),e=Object.freeze({NOT_STARTED:"NOT_STARTED",STARTING:"STARTING",BUILDING_ASSETS:"BUILDING_ASSETS",UPLOADING_ASSETS:"UPLOADING_ASSETS",CONVERGING_STORAGE:"CONVERGING_STORAGE",PUBLISHING_TREE:"PUBLISHING_TREE",RELOADING_SANDBOX:"RELOADING_SANDBOX",COMPLETED:"COMPLETED"}),P=m((s,o)=>{switch(o){case e.NOT_STARTED:case e.STARTING:case e.BUILDING_ASSETS:case e.UPLOADING_ASSETS:return"Building frontend assets.";case e.CONVERGING_STORAGE:return"Setting up database.";case e.PUBLISHING_TREE:return`Copying ${s.environment.name}.`;case e.RELOADING_SANDBOX:return"Restarting app.";case e.COMPLETED:return"Deploy complete!";default:return"Unknown step."}},"stepToSpinnerStart"),oe=m((s,o)=>{switch(o){case e.NOT_STARTED:case e.STARTING:case e.BUILDING_ASSETS:case e.UPLOADING_ASSETS:return`Built frontend assets. ${y()}`;case e.CONVERGING_STORAGE:return`Setup database. ${y()}`;case e.PUBLISHING_TREE:return`Copied ${s.environment.name}. ${y()}`;case e.RELOADING_SANDBOX:return`Restarted app. ${y()}`;case e.COMPLETED:return"Deploy successful!";default:return`Completed unknown step. ${y()}`}},"stepToSpinnerEnd");export{e as AppDeploymentSteps,Re as args,Pe as run,oe as stepToSpinnerEnd,P as stepToSpinnerStart,_e as usage};
25
- //# sourceMappingURL=deploy-QX2ELPOA.js.map
25
+ //# sourceMappingURL=deploy-ZRLKAGWM.js.map
@@ -1,4 +1,4 @@
1
- import{a as Nn}from"./chunk-QXWICGG6.js";import{a as nt}from"./chunk-SX5LO3XQ.js";import{a as it,d as vn,n as K,o as rr,p as or}from"./chunk-2WKENYA3.js";import{f as Xt,l as ir,m as nr,n as sr}from"./chunk-UAZBF6WU.js";import"./chunk-JSGXXXFU.js";import{b as tr}from"./chunk-WNAYBYSG.js";import"./chunk-GC4CQ6BI.js";import{a as er}from"./chunk-JBY5A44K.js";import"./chunk-HN3YKQ3C.js";import{E as Zt,G as Qt,c as Yt,i as En}from"./chunk-TPWSJOGX.js";import"./chunk-DYAWQS24.js";import{b as Vt}from"./chunk-XGQQOMPO.js";import"./chunk-KMNQ3LJT.js";import{M as rt,T as Kt,b as Ht,ca as je,ha as B,ia as zt,ja as Jt,p as $t}from"./chunk-24OT7GHO.js";import{a as gn}from"./chunk-GFQYFEEH.js";import{a as s,b as v,c as q,d as b,e as yn,f as Be,g as wn,h as c}from"./chunk-7DYQUG5M.js";var Cr=b(Ee=>{"use strict";c();Object.defineProperty(Ee,"__esModule",{value:!0});Ee.sync=Ee.isexe=void 0;var Rn=v("fs"),bn=v("fs/promises"),kn=s(async(e,t={})=>{let{ignoreErrors:r=!1}=t;try{return Ar(await(0,bn.stat)(e),t)}catch(i){let n=i;if(r||n.code==="EACCES")return!1;throw n}},"isexe");Ee.isexe=kn;var Ln=s((e,t={})=>{let{ignoreErrors:r=!1}=t;try{return Ar((0,Rn.statSync)(e),t)}catch(i){let n=i;if(r||n.code==="EACCES")return!1;throw n}},"sync");Ee.sync=Ln;var Ar=s((e,t)=>e.isFile()&&On(e,t),"checkStat"),On=s((e,t)=>{let r=t.uid??process.getuid?.(),i=t.groups??process.getgroups?.()??[],n=t.gid??process.getgid?.()??i[0];if(r===void 0||n===void 0)throw new Error("cannot get uid or gid");let o=new Set([n,...i]),a=e.mode,f=e.uid,l=e.gid,u=parseInt("100",8),h=parseInt("010",8),g=parseInt("001",8),p=u|h;return!!(a&g||a&h&&o.has(l)||a&u&&f===r||a&p&&r===0)},"checkMode")});var Rr=b(ve=>{"use strict";c();Object.defineProperty(ve,"__esModule",{value:!0});ve.sync=ve.isexe=void 0;var qn=v("fs"),Fn=v("fs/promises"),Un=s(async(e,t={})=>{let{ignoreErrors:r=!1}=t;try{return Tr(await(0,Fn.stat)(e),e,t)}catch(i){let n=i;if(r||n.code==="EACCES")return!1;throw n}},"isexe");ve.isexe=Un;var Pn=s((e,t={})=>{let{ignoreErrors:r=!1}=t;try{return Tr((0,qn.statSync)(e),e,t)}catch(i){let n=i;if(r||n.code==="EACCES")return!1;throw n}},"sync");ve.sync=Pn;var Mn=s((e,t)=>{let{pathExt:r=process.env.PATHEXT||""}=t,i=r.split(";");if(i.indexOf("")!==-1)return!0;for(let n=0;n<i.length;n++){let o=i[n].toLowerCase(),a=e.substring(e.length-o.length).toLowerCase();if(o&&a===o)return!0}return!1},"checkPathExt"),Tr=s((e,t,r)=>e.isFile()&&Mn(t,r),"checkStat")});var kr=b(br=>{"use strict";c();Object.defineProperty(br,"__esModule",{value:!0})});var Pr=b(R=>{"use strict";c();var Lr=R&&R.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:s(function(){return t[r]},"get")}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),Wn=R&&R.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Or=R&&R.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Lr(t,e,r);return Wn(t,e),t},Gn=R&&R.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Lr(t,e,r)};Object.defineProperty(R,"__esModule",{value:!0});R.sync=R.isexe=R.posix=R.win32=void 0;var qr=Or(Cr());R.posix=qr;var Fr=Or(Rr());R.win32=Fr;Gn(kr(),R);var Bn=process.env._ISEXE_TEST_PLATFORM_||process.platform,Ur=Bn==="win32"?Fr:qr;R.isexe=Ur.isexe;R.sync=Ur.sync});var Jr=b((zc,zr)=>{c();var{isexe:jn,sync:Hn}=Pr(),{join:$n,delimiter:Kn,sep:Mr,posix:Wr}=v("path"),Gr=process.platform==="win32",Br=new RegExp(`[${Wr.sep}${Mr===Wr.sep?"":Mr}]`.replace(/(\\)/g,"\\$1")),zn=new RegExp(`^\\.${Br.source}`),jr=s(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),Hr=s((e,{path:t=process.env.PATH,pathExt:r=process.env.PATHEXT,delimiter:i=Kn})=>{let n=e.match(Br)?[""]:[...Gr?[process.cwd()]:[],...(t||"").split(i)];if(Gr){let o=r||[".EXE",".CMD",".BAT",".COM"].join(i),a=o.split(i).flatMap(f=>[f,f.toLowerCase()]);return e.includes(".")&&a[0]!==""&&a.unshift(""),{pathEnv:n,pathExt:a,pathExtExe:o}}return{pathEnv:n,pathExt:[""]}},"getPathInfo"),$r=s((e,t)=>{let r=/^".*"$/.test(e)?e.slice(1,-1):e;return(!r&&zn.test(t)?t.slice(0,2):"")+$n(r,t)},"getPathPart"),Kr=s(async(e,t={})=>{let{pathEnv:r,pathExt:i,pathExtExe:n}=Hr(e,t),o=[];for(let a of r){let f=$r(a,e);for(let l of i){let u=f+l;if(await jn(u,{pathExt:n,ignoreErrors:!0})){if(!t.all)return u;o.push(u)}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw jr(e)},"which"),Jn=s((e,t={})=>{let{pathEnv:r,pathExt:i,pathExtExe:n}=Hr(e,t),o=[];for(let a of r){let f=$r(a,e);for(let l of i){let u=f+l;if(Hn(u,{pathExt:n,ignoreErrors:!0})){if(!t.all)return u;o.push(u)}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw jr(e)},"whichSync");zr.exports=Kr;Kr.sync=Jn});var Yr=b(Ke=>{c();(function(){var e;e=s(function(t,r,i){var n,o;for(o="";t.length>0;)n=t.match(r),n?(o+=t.slice(0,n.index),o+=i(n),t=t.slice(n.index+n[0].length)):(o+=t,t="");return o},"scan"),Ke.split=function(t){var r,i;return t==null&&(t=""),i=[],r="",e(t,/\s*(?:([^\s\\\'\"]+)|'((?:[^\'\\]|\\.)*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|$)?/,function(n){var o,a,f,l,u,h,g;if(l=n[0],g=n[1],h=n[2],o=n[3],a=n[4],f=n[5],u=n[6],f!=null)throw new Error("Unmatched quote");if(r+=g||(h||o||a).replace(/\\(?=.)/,""),u!=null)return i.push(r),r=""}),r&&i.push(r),i},Ke.escape=function(t){return t==null&&(t=""),t==null?"''":t.replace(/([^A-Za-z0-9_\-.,:\/@\n])/g,"\\$1").replace(/\n/g,`'
1
+ import{a as Nn}from"./chunk-QXWICGG6.js";import{a as nt}from"./chunk-SX5LO3XQ.js";import{a as it,d as vn,n as K,o as rr,p as or}from"./chunk-DRI75CDO.js";import{f as Xt,l as ir,m as nr,n as sr}from"./chunk-22W3HJQG.js";import"./chunk-JSGXXXFU.js";import{b as tr}from"./chunk-WNAYBYSG.js";import"./chunk-IZO5RL5L.js";import{a as er}from"./chunk-JBY5A44K.js";import"./chunk-HN3YKQ3C.js";import{E as Zt,G as Qt,c as Yt,i as En}from"./chunk-L5H5T2T6.js";import"./chunk-X47UA3VR.js";import{b as Vt}from"./chunk-XGQQOMPO.js";import"./chunk-OIVNACS7.js";import{M as rt,T as Kt,b as Ht,ca as je,ha as B,ia as zt,ja as Jt,p as $t}from"./chunk-24OT7GHO.js";import{a as gn}from"./chunk-GFQYFEEH.js";import{a as s,b as v,c as q,d as b,e as yn,f as Be,g as wn,h as c}from"./chunk-7DYQUG5M.js";var Cr=b(Ee=>{"use strict";c();Object.defineProperty(Ee,"__esModule",{value:!0});Ee.sync=Ee.isexe=void 0;var Rn=v("fs"),bn=v("fs/promises"),kn=s(async(e,t={})=>{let{ignoreErrors:r=!1}=t;try{return Ar(await(0,bn.stat)(e),t)}catch(i){let n=i;if(r||n.code==="EACCES")return!1;throw n}},"isexe");Ee.isexe=kn;var Ln=s((e,t={})=>{let{ignoreErrors:r=!1}=t;try{return Ar((0,Rn.statSync)(e),t)}catch(i){let n=i;if(r||n.code==="EACCES")return!1;throw n}},"sync");Ee.sync=Ln;var Ar=s((e,t)=>e.isFile()&&On(e,t),"checkStat"),On=s((e,t)=>{let r=t.uid??process.getuid?.(),i=t.groups??process.getgroups?.()??[],n=t.gid??process.getgid?.()??i[0];if(r===void 0||n===void 0)throw new Error("cannot get uid or gid");let o=new Set([n,...i]),a=e.mode,f=e.uid,l=e.gid,u=parseInt("100",8),h=parseInt("010",8),g=parseInt("001",8),p=u|h;return!!(a&g||a&h&&o.has(l)||a&u&&f===r||a&p&&r===0)},"checkMode")});var Rr=b(ve=>{"use strict";c();Object.defineProperty(ve,"__esModule",{value:!0});ve.sync=ve.isexe=void 0;var qn=v("fs"),Fn=v("fs/promises"),Un=s(async(e,t={})=>{let{ignoreErrors:r=!1}=t;try{return Tr(await(0,Fn.stat)(e),e,t)}catch(i){let n=i;if(r||n.code==="EACCES")return!1;throw n}},"isexe");ve.isexe=Un;var Pn=s((e,t={})=>{let{ignoreErrors:r=!1}=t;try{return Tr((0,qn.statSync)(e),e,t)}catch(i){let n=i;if(r||n.code==="EACCES")return!1;throw n}},"sync");ve.sync=Pn;var Mn=s((e,t)=>{let{pathExt:r=process.env.PATHEXT||""}=t,i=r.split(";");if(i.indexOf("")!==-1)return!0;for(let n=0;n<i.length;n++){let o=i[n].toLowerCase(),a=e.substring(e.length-o.length).toLowerCase();if(o&&a===o)return!0}return!1},"checkPathExt"),Tr=s((e,t,r)=>e.isFile()&&Mn(t,r),"checkStat")});var kr=b(br=>{"use strict";c();Object.defineProperty(br,"__esModule",{value:!0})});var Pr=b(R=>{"use strict";c();var Lr=R&&R.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:s(function(){return t[r]},"get")}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),Wn=R&&R.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Or=R&&R.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Lr(t,e,r);return Wn(t,e),t},Gn=R&&R.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Lr(t,e,r)};Object.defineProperty(R,"__esModule",{value:!0});R.sync=R.isexe=R.posix=R.win32=void 0;var qr=Or(Cr());R.posix=qr;var Fr=Or(Rr());R.win32=Fr;Gn(kr(),R);var Bn=process.env._ISEXE_TEST_PLATFORM_||process.platform,Ur=Bn==="win32"?Fr:qr;R.isexe=Ur.isexe;R.sync=Ur.sync});var Jr=b((zc,zr)=>{c();var{isexe:jn,sync:Hn}=Pr(),{join:$n,delimiter:Kn,sep:Mr,posix:Wr}=v("path"),Gr=process.platform==="win32",Br=new RegExp(`[${Wr.sep}${Mr===Wr.sep?"":Mr}]`.replace(/(\\)/g,"\\$1")),zn=new RegExp(`^\\.${Br.source}`),jr=s(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),Hr=s((e,{path:t=process.env.PATH,pathExt:r=process.env.PATHEXT,delimiter:i=Kn})=>{let n=e.match(Br)?[""]:[...Gr?[process.cwd()]:[],...(t||"").split(i)];if(Gr){let o=r||[".EXE",".CMD",".BAT",".COM"].join(i),a=o.split(i).flatMap(f=>[f,f.toLowerCase()]);return e.includes(".")&&a[0]!==""&&a.unshift(""),{pathEnv:n,pathExt:a,pathExtExe:o}}return{pathEnv:n,pathExt:[""]}},"getPathInfo"),$r=s((e,t)=>{let r=/^".*"$/.test(e)?e.slice(1,-1):e;return(!r&&zn.test(t)?t.slice(0,2):"")+$n(r,t)},"getPathPart"),Kr=s(async(e,t={})=>{let{pathEnv:r,pathExt:i,pathExtExe:n}=Hr(e,t),o=[];for(let a of r){let f=$r(a,e);for(let l of i){let u=f+l;if(await jn(u,{pathExt:n,ignoreErrors:!0})){if(!t.all)return u;o.push(u)}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw jr(e)},"which"),Jn=s((e,t={})=>{let{pathEnv:r,pathExt:i,pathExtExe:n}=Hr(e,t),o=[];for(let a of r){let f=$r(a,e);for(let l of i){let u=f+l;if(Hn(u,{pathExt:n,ignoreErrors:!0})){if(!t.all)return u;o.push(u)}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw jr(e)},"whichSync");zr.exports=Kr;Kr.sync=Jn});var Yr=b(Ke=>{c();(function(){var e;e=s(function(t,r,i){var n,o;for(o="";t.length>0;)n=t.match(r),n?(o+=t.slice(0,n.index),o+=i(n),t=t.slice(n.index+n[0].length)):(o+=t,t="");return o},"scan"),Ke.split=function(t){var r,i;return t==null&&(t=""),i=[],r="",e(t,/\s*(?:([^\s\\\'\"]+)|'((?:[^\'\\]|\\.)*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|$)?/,function(n){var o,a,f,l,u,h,g;if(l=n[0],g=n[1],h=n[2],o=n[3],a=n[4],f=n[5],u=n[6],f!=null)throw new Error("Unmatched quote");if(r+=g||(h||o||a).replace(/\\(?=.)/,""),u!=null)return i.push(r),r=""}),r&&i.push(r),i},Ke.escape=function(t){return t==null&&(t=""),t==null?"''":t.replace(/([^A-Za-z0-9_\-.,:\/@\n])/g,"\\$1").replace(/\n/g,`'
2
2
  '`)}}).call(Ke)});var Zr=b((sf,Xr)=>{"use strict";c();var Vr=v("fs"),Nt;function Yn(){try{return Vr.statSync("/.dockerenv"),!0}catch{return!1}}s(Yn,"hasDockerEnv");function Vn(){try{return Vr.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}s(Vn,"hasDockerCGroup");Xr.exports=()=>(Nt===void 0&&(Nt=Yn()||Vn()),Nt)});var ti=b((cf,St)=>{"use strict";c();var Xn=v("os"),Zn=v("fs"),Qr=Zr(),ei=s(()=>{if(process.platform!=="linux")return!1;if(Xn.release().toLowerCase().includes("microsoft"))return!Qr();try{return Zn.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Qr():!1}catch{return!1}},"isWsl");process.env.__IS_WSL_TEST__?St.exports=ei:St.exports=ei()});var de=b((uf,A)=>{c();var Qn=Yr(),ze=v("child_process"),xt=Nn(),es=ti(),ts=v("path"),rs=v("url"),he=v("os"),_t=v("fs"),is=v("net"),ns=1024;function si(e){return JSON.parse(JSON.stringify(e))}s(si,"clone");A.exports.clone=si;var ss=s(function(e){return typeof e=="string"?e.replace(/(["$`\\])/g,"\\$1"):e},"escapeQuotes"),os=s(function(e,t){return e.indexOf(t)!==-1},"inArray"),ri={u:"urgency",urgency:"urgency",t:"expire-time",time:"expire-time",timeout:"expire-time",e:"expire-time",expire:"expire-time","expire-time":"expire-time",i:"icon",icon:"icon",c:"category",category:"category",subtitle:"category",h:"hint",hint:"hint",a:"app-name","app-name":"app-name"};A.exports.command=function(e,t,r){return e=Qn.escape(e),process.env.DEBUG&&process.env.DEBUG.indexOf("notifier")!==-1&&(console.info("node-notifier debug info (command):"),console.info("[notifier path]",e),console.info("[notifier options]",t.join(" "))),ze.exec(e+" "+t.join(" "),function(i,n,o){if(i)return r(i);r(o,n)})};A.exports.fileCommand=function(e,t,r){return process.env.DEBUG&&process.env.DEBUG.indexOf("notifier")!==-1&&(console.info("node-notifier debug info (fileCommand):"),console.info("[notifier path]",e),console.info("[notifier options]",t.join(" "))),ze.execFile(e,t,function(i,n,o){if(i)return r(i,n);r(o,n)})};A.exports.fileCommandJson=function(e,t,r){return process.env.DEBUG&&process.env.DEBUG.indexOf("notifier")!==-1&&(console.info("node-notifier debug info (fileCommandJson):"),console.info("[notifier path]",e),console.info("[notifier options]",t.join(" "))),ze.execFile(e,t,function(i,n,o){if(i)return r(i,n);if(!n)return r(i,{});try{let a=JSON.parse(n);r(o||null,a)}catch(a){r(a,n)}})};A.exports.immediateFileCommand=function(e,t,r){process.env.DEBUG&&process.env.DEBUG.indexOf("notifier")!==-1&&(console.info("node-notifier debug info (notifier):"),console.info("[notifier path]",e)),as(e,function(i,n){if(!n)return r(new Error("Notifier ("+e+") not found on system."));ze.execFile(e,t),r()})};function as(e,t){return _t.stat(e,function(r,i){return r?ts.extname(e)?t(r,!1):_t.stat(e+".exe",function(n,o){if(n)return t(n,!1);t(n,o.isFile())}):t(r,i.isFile())})}s(as,"notifierExists");var Je=s(function(e){return e.appIcon&&(e.icon=e.appIcon,delete e.appIcon),e},"mapAppIcon"),De=s(function(e){return e.text&&(e.message=e.text,delete e.text),e},"mapText"),oi=s(function(e){return e.i&&(e.icon=e.i,delete e.i),e},"mapIconShorthand");A.exports.mapToNotifySend=function(e){e=Je(e),e=De(e),e.timeout===!1&&delete e.timeout,e.wait===!0&&(e["expire-time"]=5);for(let t in e)t==="message"||t==="title"||e.hasOwnProperty(t)&&ri[t]!==t&&(e[ri[t]]=e[t],delete e[t]);return typeof e["expire-time"]>"u"?e["expire-time"]=10*1e3:typeof e["expire-time"]=="number"&&(e["expire-time"]=e["expire-time"]*1e3),e};A.exports.mapToGrowl=function(e){if(e=Je(e),e=oi(e),e=De(e),e.icon&&!Buffer.isBuffer(e.icon))try{e.icon=_t.readFileSync(e.icon)}catch{}return e};A.exports.mapToMac=function(e){return e=oi(e),e=De(e),e.icon&&(e.appIcon=e.icon,delete e.icon),e.sound===!0&&(e.sound="Bottle"),e.sound===!1&&delete e.sound,e.sound&&e.sound.indexOf("Notification.")===0&&(e.sound="Bottle"),e.wait===!0&&(e.timeout||(e.timeout=5),delete e.wait),!e.wait&&!e.timeout&&(e.timeout===!1?delete e.timeout:e.timeout=10),e.json=!0,e};function It(e){return Object.prototype.toString.call(e)==="[object Array]"}s(It,"isArray");A.exports.isArray=It;function cs(){}s(cs,"noop");A.exports.actionJackerDecorator=function(e,t,r,i){if(t=si(t),r=r||cs,typeof r!="function")throw new TypeError("The second argument must be a function callback. You have passed "+typeof r);return function(n,o){let a=o,f={};if(a&&typeof a=="object"&&(f=a,a=a.activationType),a&&(a=a.toLowerCase().trim(),a.match(/^activate|clicked$/)&&(a="activate"),a.match(/^timedout$/)&&(a="timeout")),r.apply(e,[n,a,f]),!i||!a)return;let l=i(a);l&&e.emit(l,e,t,f)}};A.exports.constructArgumentList=function(e,t){let r=[];t=t||{};let i=t.initial||[],n=t.keyExtra||"",o=t.allowedArguments||[],a=t.noEscape!==void 0,f=t.allowedArguments!==void 0,l=!!t.explicitTrue,u=!!t.keepNewlines,h=t.wrapper===void 0?'"':t.wrapper,g=s(function p(d){return It(d)?ii(d.map(p).join(",")):(a||(d=ss(d)),typeof d=="string"&&!u&&(d=ii(d)),h+d+h)},"escapeFn");i.forEach(function(p){r.push(g(p))});for(let p in e)if(e.hasOwnProperty(p)&&(!f||os(o,p)))if(l&&e[p]===!0)r.push("-"+n+p);else{if(l&&e[p]===!1)continue;r.push("-"+n+p,g(e[p]))}return r};function ii(e){let t=process.platform==="win32"?"\\r\\n":"\\n";return e.replace(/\r?\n/g,t)}s(ii,"removeNewLines");var fs=["t","m","b","tb","p","id","s","silent","appID","pid","pipeName","close","install"],ls="Notification.",ni="Notification.Default";A.exports.mapToWin8=function(e){e=Je(e),e=De(e),e.icon&&(/^file:\/+/.test(e.icon)?e.p=new rs.URL(e.icon).pathname.replace(/^\/(\w:\/)/,"$1").replace(/\//g,"\\"):e.p=e.icon,delete e.icon),e.message&&(e.m=e.message.replace(/\x1b/g,""),delete e.message),e.title&&(e.t=e.title,delete e.title),e.appName&&(e.appID=e.appName,delete e.appName),typeof e.remove<"u"&&(e.close=e.remove,delete e.remove),(e.quiet||e.silent)&&(e.silent=e.quiet||e.silent,delete e.quiet),typeof e.sound<"u"&&(e.s=e.sound,delete e.sound),e.s===!1&&(e.silent=!0,delete e.s),e.s&&e.silent&&delete e.s,e.s===!0&&(e.s=ni),e.s&&e.s.indexOf(ls)!==0&&(e.s=ni),e.actions&&It(e.actions)&&(e.b=e.actions.join(";"),delete e.actions);for(let t in e)e.hasOwnProperty(t)&&fs.indexOf(t)===-1&&delete e[t];return e};A.exports.mapToNotifu=function(e){return e=Je(e),e=De(e),e.icon&&(e.i=e.icon,delete e.icon),e.message&&(e.m=e.message,delete e.message),e.title&&(e.p=e.title,delete e.title),e.time&&(e.d=e.time,delete e.time),e.q!==!1?e.q=!0:delete e.q,e.quiet===!1&&(delete e.q,delete e.quiet),e.sound&&(delete e.q,delete e.sound),e.t&&(e.d=e.t,delete e.t),e.type&&(e.t=us(e.type),delete e.type),e};A.exports.isMac=function(){return he.type()==="Darwin"};A.exports.isMountainLion=function(){return he.type()==="Darwin"&&xt.satisfies(Dt(he.release()),">=12.0.0")};A.exports.isWin8=function(){return he.type()==="Windows_NT"&&xt.satisfies(Dt(he.release()),">=6.2.9200")};A.exports.isWSL=function(){return es};A.exports.isLessThanWin8=function(){return he.type()==="Windows_NT"&&xt.satisfies(Dt(he.release()),"<6.2.9200")};function Dt(e){return e.split(".").length===2&&(e+=".0"),e}s(Dt,"garanteeSemverFormat");function us(e){if(typeof e=="string"||e instanceof String){if(e.toLowerCase()==="info")return"info";if(e.toLowerCase()==="warn")return"warn";if(e.toLowerCase()==="error")return"error"}return"info"}s(us,"sanitizeNotifuTypeArgument");A.exports.createNamedPipe=e=>{let t=Buffer.alloc(ns);return new Promise(r=>{e.instance=is.createServer(i=>{i.on("data",n=>{t.write(n.toString())}),i.on("end",()=>{e.instance.close()})}),e.instance.listen(e.namedPipe,()=>{r(t)})})}});var hi=b((mf,ui)=>{c();var ai=v("os"),hs=vn(),Ae=de(),fi=v("events").EventEmitter,ds=v("util"),li="notify-send",Ye;ui.exports=Ce;function Ce(e){if(e=Ae.clone(e||{}),!(this instanceof Ce))return new Ce(e);this.options=e,fi.call(this)}s(Ce,"NotifySend");ds.inherits(Ce,fi);function ms(){}s(ms,"noop");function ps(e,t){if(e=Ae.clone(e||{}),t=t||ms,typeof t!="function")throw new TypeError("The second argument must be a function callback. You have passed "+typeof t);if(typeof e=="string"&&(e={title:"node-notifier",message:e}),!e.message)return t(new Error("Message is required.")),this;if(ai.type()!=="Linux"&&!ai.type().match(/BSD$/))return t(new Error("Only supported on Linux and *BSD systems")),this;if(Ye===!1)return t(new Error("notify-send must be installed on the system.")),this;if(Ye||this.options.suppressOsdCheck)return ci(e,t),this;try{Ye=!!hs.sync(li),ci(e,t)}catch(r){return Ye=!1,t(r)}return this}s(ps,"notifyRaw");Object.defineProperty(Ce.prototype,"notify",{get:s(function(){return this._notify||(this._notify=ps.bind(this)),this._notify},"get")});var ys=["urgency","expire-time","icon","category","hint","app-name"];function ci(e,t){e=Ae.mapToNotifySend(e),e.title=e.title||"Node Notification:";let r=[e.title,e.message];delete e.title,delete e.message;let i=Ae.constructArgumentList(e,{initial:r,keyExtra:"-",allowedArguments:ys});Ae.command(li,i,t)}s(ci,"doNotification")});var At=b((wf,mi)=>{c();var ws=v("net"),di=!1;mi.exports=function(e,t){if(typeof t>"u"&&(t=e,e={}),di)return t(null,di);let r=e.port||23053,i=e.host||"localhost",n=ws.connect(r,i);n.setTimeout(100),n.once("connect",function(){n.end(),t(null,!0)}),n.once("error",function(){n.end(),t(null,!1)})}});var wi=b((Ef,yi)=>{c();var gs=v("net"),Es=v("crypto"),pi=v("util").format,vs=v("fs"),G=`\r
3
3
  `;function me(e,t){t=t||{},this.type=e,this.host=t.host||"localhost",this.port=t.port||23053,this.request="GNTP/1.0 "+e+" NONE"+G,this.resources=[],this.attempts=0,this.maxAttempts=5}s(me,"GNTP");me.prototype.parseResp=function(e){var t={},r,i;return e=e.slice(0,e.indexOf(G+G)).split(G),r=e[0],i=e.slice(1),t.state=r.match(/-(OK|ERROR|CALLBACK)/)[0].slice(1),i.forEach(function(n){n=n.split(": "),t[n[0]]=n[1]}),t};me.prototype.retry=function(){var e=this,t=arguments;setTimeout(function(){e.send.apply(e,t)},750)};me.prototype.addResource=function(e){var t=Es.createHash("md5").update(e).digest("hex"),r="Identifier: "+t+G+"Length: "+e.length+G+G;return this.resources.push({header:r,file:e}),"x-growl-resource://"+t};me.prototype.add=function(e,t){t!==void 0&&(/-Icon/.test(e)&&!/^https?:\/\//.test(t)&&(/\.(png|gif|jpe?g)$/.test(t)?t=this.addResource(vs.readFileSync(t)):t instanceof Buffer&&(t=this.addResource(t))),this.request+=e+": "+t+G)};me.prototype.newline=function(){this.request+=G};me.prototype.send=function(e){var t=this,r=gs.connect(this.port,this.host),i="";e=e||function(){},this.attempts+=1,r.on("connect",function(){r.write(t.request),t.resources.forEach(function(n){r.write(n.header),r.write(n.file),r.write(G+G)})}),r.on("data",function(n){i+=n.toString(),i.slice(i.length-4)===G+G&&(i=t.parseResp(i),i.state==="ERROR"||i.state==="CALLBACK"?r.end():i="")}),r.on("end",function(){if(["200","401","402"].indexOf(i["Error-Code"])>=0)if(t.attempts<=t.maxAttempts)t.retry(e);else{var n='GNTP request to "%s:%d" failed with error code %s (%s)';e(new Error(pi(n,t.host,t.port,i["Error-Code"],i["Error-Description"])))}else e(void 0,i)}),r.on("error",function(){e(new Error(pi('Error while sending GNTP request to "%s:%d"',t.host,t.port))),r.destroy()})};yi.exports=me});var vi=b((Sf,Ei)=>{c();var gi=wi();function Te(){this.appname="Growly",this.notifications=void 0,this.labels=void 0,this.count=0,this.registered=!1,this.host=void 0,this.port=void 0}s(Te,"Growly");Te.prototype.getLabels=function(){return this.notifications.map(function(e){return e.label})};Te.prototype.setHost=function(e,t){this.host=e,this.port=t};Te.prototype.register=function(e,t,r,i){var n;typeof t=="object"&&(r=t,t=void 0),(r===void 0||!r.length)&&(r=[{label:"default",dispname:"Default Notification",enabled:!0}]),typeof arguments[arguments.length-1]=="function"?i=arguments[arguments.length-1]:i=s(function(){},"callback"),this.appname=e,this.notifications=r,this.labels=this.getLabels(),this.registered=!0,n=new gi("REGISTER",{host:this.host,port:this.port}),n.add("Application-Name",e),n.add("Application-Icon",t),n.add("Notifications-Count",r.length),n.newline(),r.forEach(function(o){o.enabled===void 0&&(o.enabled=!0),n.add("Notification-Name",o.label),n.add("Notification-Display-Name",o.dispname),n.add("Notification-Enabled",o.enabled?"True":"False"),n.add("Notification-Icon",o.icon),n.newline()}),n.send(i)};Te.prototype.notify=function(e,t,r){var i=this,n;if(!this.registered){this.register(this.appname,function(o){o&&console.log(o),i.notify.call(i,e,t,r)});return}t=t||{},typeof t=="function"&&(r=t,t={}),n=new gi("NOTIFY",{host:this.host,port:this.port}),n.add("Application-Name",this.appname),n.add("Notification-Name",t.label||this.labels[0]),n.add("Notification-ID",++this.count),n.add("Notification-Title",t.title),n.add("Notification-Text",e),n.add("Notification-Sticky",t.sticky?"True":"False"),n.add("Notification-Priority",t.priority),n.add("Notification-Icon",t.icon),n.add("Notification-Coalescing-ID",t.coalescingId||void 0),n.add("Notification-Callback-Context",r?"context":void 0),n.add("Notification-Callback-Context-Type",r?"string":void 0),n.add("Notification-Callback-Target",void 0),n.newline(),n.send(function(o,a){r&&o?r(o):r&&a.state==="CALLBACK"&&r(void 0,a["Notification-Callback-Result"].toLowerCase())})};Ei.exports=new Te});var Xe=b((If,_i)=>{c();var Ns=At(),Ve=de(),Re=vi(),Si=v("events").EventEmitter,Ss=v("util"),_s="Couldn't connect to growl (might be used as a fallback). Make sure it is running";_i.exports=be;var Ni;function be(e){if(e=Ve.clone(e||{}),!(this instanceof be))return new be(e);Re.appname=e.name||"Node",this.options=e,Si.call(this)}s(be,"Growl");Ss.inherits(be,Si);function xs(e,t){if(Re.setHost(this.options.host,this.options.port),e=Ve.clone(e||{}),typeof e=="string"&&(e={title:"node-notifier",message:e}),t=Ve.actionJackerDecorator(this,e,t,function(r){return r==="click"?"click":r==="timedout"?"timeout":!1}),e=Ve.mapToGrowl(e),!e.message)return t(new Error("Message is required.")),this;if(e.title=e.title||"Node Notification:",Ni||e.wait){let r=e.wait?t:Is;return Re.notify(e.message,e,r),e.wait||t(),this}return Ns(Re,function(r,i){if(Ni=i,!i)return t(new Error(_s));Re.notify(e.message,e),t()}),this}s(xs,"notifyRaw");Object.defineProperty(be.prototype,"notify",{get:s(function(){return this._notify||(this._notify=xs.bind(this)),this._notify},"get")});function Is(){}s(Is,"noop")});var Ai=b((Cf,Di)=>{c();var pe=de(),Ds=Xe(),As=v("path"),Cs=As.join(__dirname,"../vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier"),Ii=v("events").EventEmitter,Ts=v("util"),Rs="You need Mac OS X 10.8 or above to use NotificationCenter, or use Growl fallback with constructor option {withFallback: true}.";Di.exports=ke;function ke(e){if(e=pe.clone(e||{}),!(this instanceof ke))return new ke(e);this.options=e,Ii.call(this)}s(ke,"NotificationCenter");Ts.inherits(ke,Ii);var xi=null;function bs(){}s(bs,"noop");function ks(e,t){let r,i=Ls();if(e=pe.clone(e||{}),xi=i,typeof e=="string"&&(e={title:"node-notifier",message:e}),t=t||bs,typeof t!="function")throw new TypeError("The second argument must be a function callback. You have passed "+typeof fn);let n=pe.actionJackerDecorator(this,e,t,function(a){return xi!==i?!1:a==="activate"?"click":a==="timeout"?"timeout":a==="replied"?"replied":!1});if(e=pe.mapToMac(e),!e.message&&!e.group&&!e.list&&!e.remove)return t(new Error("Message, group, remove or list property is required.")),this;let o=pe.constructArgumentList(e);return pe.isMountainLion()?(pe.fileCommandJson(this.options.customPath||Cs,o,n),this):r||this.options.withFallback?(r=r||new Ds(this.options),r.notify(e,t)):(t(new Error(Rs)),this)}s(ks,"notifyRaw");Object.defineProperty(ke.prototype,"notify",{get:s(function(){return this._notify||(this._notify=ks.bind(this)),this._notify},"get")});function Ls(){return{_ref:"val"}}s(Ls,"identificator")});var Ct=b((bf,bi)=>{c();var Os=v("path"),qs=Os.resolve(__dirname,"../vendor/notifu/notifu"),Fs=At(),re=de(),Us=Tt(),Ci=Xe(),Ps=v("os"),Ri=v("events").EventEmitter,Ms=v("util"),Ze;bi.exports=Le;function Le(e){if(e=re.clone(e||{}),!(this instanceof Le))return new Le(e);this.options=e,Ri.call(this)}s(Le,"WindowsBalloon");Ms.inherits(Le,Ri);function Ws(){}s(Ws,"noop");function Gs(e,t){let r,i=this.options;e=re.clone(e||{}),t=t||Ws,typeof e=="string"&&(e={title:"node-notifier",message:e});let n=re.actionJackerDecorator(this,e,t,function(o){return o==="activate"?"click":o==="timeout"?"timeout":!1});return this.options.withFallback&&re.isWin8()?(r=r||new Us(i),r.notify(e,t)):this.options.withFallback&&(!re.isLessThanWin8()||Ze===!0)?(r=r||new Ci(i),r.notify(e,t)):!this.options.withFallback||Ze===!1?(Ti(e,i,n),this):(Fs(i,function(o,a){if(Ze=a,Ze)return r=r||new Ci(i),r.notify(e,t);Ti(e,i,n)}),this)}s(Gs,"notifyRaw");Object.defineProperty(Le.prototype,"notify",{get:s(function(){return this._notify||(this._notify=Gs.bind(this)),this._notify},"get")});var Bs=["t","d","p","m","i","e","q","w","xp"];function Ti(e,t,r){let i=Ps.arch()==="x64";e=e||{},e=re.mapToNotifu(e),e.p=e.p||"Node Notification:";let n=qs+(i?"64":"")+".exe",o=t.customPath||n;if(!e.m)return r(new Error("Message is required.")),this;let a=re.constructArgumentList(e,{wrapper:"",noEscape:!0,explicitTrue:!0,allowedArguments:Bs});if(e.wait)return re.fileCommand(o,a,function(f,l){let u=js(f.code);return u==="error"?r(f,l):r(null,u)});re.immediateFileCommand(o,a,r)}s(Ti,"doNotification");function js(e){switch(e){case 2:return"timeout";case 3:case 6:case 7:return"activate";case 4:return"close";default:return"error"}}s(js,"fromErrorCodeToAction")});import Hs from"crypto";function Oe(){return Qe>et.length-16&&(Hs.randomFillSync(et),Qe=0),et.slice(Qe,Qe+=16)}var et,Qe,Rt=q(()=>{c();et=new Uint8Array(256),Qe=et.length;s(Oe,"rng")});var ki,Li=q(()=>{c();ki=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function $s(e){return typeof e=="string"&&ki.test(e)}var ae,qe=q(()=>{c();Li();s($s,"validate");ae=$s});function Ks(e,t=0){let r=(k[e[t+0]]+k[e[t+1]]+k[e[t+2]]+k[e[t+3]]+"-"+k[e[t+4]]+k[e[t+5]]+"-"+k[e[t+6]]+k[e[t+7]]+"-"+k[e[t+8]]+k[e[t+9]]+"-"+k[e[t+10]]+k[e[t+11]]+k[e[t+12]]+k[e[t+13]]+k[e[t+14]]+k[e[t+15]]).toLowerCase();if(!ae(r))throw TypeError("Stringified UUID is invalid");return r}var k,ce,Fe=q(()=>{c();qe();k=[];for(let e=0;e<256;++e)k.push((e+256).toString(16).substr(1));s(Ks,"stringify");ce=Ks});function zs(e,t,r){let i=t&&r||0,n=t||new Array(16);e=e||{};let o=e.node||Oi,a=e.clockseq!==void 0?e.clockseq:bt;if(o==null||a==null){let p=e.random||(e.rng||Oe)();o==null&&(o=Oi=[p[0]|1,p[1],p[2],p[3],p[4],p[5]]),a==null&&(a=bt=(p[6]<<8|p[7])&16383)}let f=e.msecs!==void 0?e.msecs:Date.now(),l=e.nsecs!==void 0?e.nsecs:Lt+1,u=f-kt+(l-Lt)/1e4;if(u<0&&e.clockseq===void 0&&(a=a+1&16383),(u<0||f>kt)&&e.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");kt=f,Lt=l,bt=a,f+=122192928e5;let h=((f&268435455)*1e4+l)%4294967296;n[i++]=h>>>24&255,n[i++]=h>>>16&255,n[i++]=h>>>8&255,n[i++]=h&255;let g=f/4294967296*1e4&268435455;n[i++]=g>>>8&255,n[i++]=g&255,n[i++]=g>>>24&15|16,n[i++]=g>>>16&255,n[i++]=a>>>8|128,n[i++]=a&255;for(let p=0;p<6;++p)n[i+p]=o[p];return t||ce(n)}var Oi,bt,kt,Lt,qi,Fi=q(()=>{c();Rt();Fe();kt=0,Lt=0;s(zs,"v1");qi=zs});function Js(e){if(!ae(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}var tt,Ot=q(()=>{c();qe();s(Js,"parse");tt=Js});function Ys(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}function Ue(e,t,r){function i(n,o,a,f){if(typeof n=="string"&&(n=Ys(n)),typeof o=="string"&&(o=tt(o)),o.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+n.length);if(l.set(o),l.set(n,o.length),l=r(l),l[6]=l[6]&15|t,l[8]=l[8]&63|128,a){f=f||0;for(let u=0;u<16;++u)a[f+u]=l[u];return a}return ce(l)}s(i,"generateUUID");try{i.name=e}catch{}return i.DNS=Vs,i.URL=Xs,i}var Vs,Xs,qt=q(()=>{c();Fe();Ot();s(Ys,"stringToBytes");Vs="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Xs="6ba7b811-9dad-11d1-80b4-00c04fd430c8";s(Ue,"default")});import Zs from"crypto";function Qs(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),Zs.createHash("md5").update(e).digest()}var Ui,Pi=q(()=>{c();s(Qs,"md5");Ui=Qs});var eo,Mi,Wi=q(()=>{c();qt();Pi();eo=Ue("v3",48,Ui),Mi=eo});function to(e,t,r){e=e||{};let i=e.random||(e.rng||Oe)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return ce(i)}var Gi,Bi=q(()=>{c();Rt();Fe();s(to,"v4");Gi=to});import ro from"crypto";function io(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),ro.createHash("sha1").update(e).digest()}var ji,Hi=q(()=>{c();s(io,"sha1");ji=io});var no,$i,Ki=q(()=>{c();qt();Hi();no=Ue("v5",80,ji),$i=no});var zi,Ji=q(()=>{c();zi="00000000-0000-0000-0000-000000000000"});function so(e){if(!ae(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}var Yi,Vi=q(()=>{c();qe();s(so,"version");Yi=so});var Xi={};yn(Xi,{NIL:()=>zi,parse:()=>tt,stringify:()=>ce,v1:()=>qi,v3:()=>Mi,v4:()=>Gi,v5:()=>$i,validate:()=>ae,version:()=>Yi});var Zi=q(()=>{c();Fi();Wi();Bi();Ki();Ji();Vi();qe();Fe();Ot()});var Tt=b(($l,en)=>{c();var oo=v("path"),ao=oo.resolve(__dirname,"../vendor/snoreToast/snoretoast"),X=de(),co=Ct(),fo=v("os"),{v4:lo}=(Zi(),wn(Xi)),Qi=v("events").EventEmitter,uo=v("util"),Ft,ho="notifierPipe",mo="\\\\.\\pipe\\",po="/tmp/";en.exports=Pe;function Pe(e){if(e=X.clone(e||{}),!(this instanceof Pe))return new Pe(e);this.options=e,Qi.call(this)}s(Pe,"WindowsToaster");uo.inherits(Pe,Qi);function yo(){}s(yo,"noop");function wo(e){return e?e.split(";").reduce((t,r)=>{let i=r.split("=");return i&&i.length===2&&(t[i[0]]=i[1]),t},{}):{}}s(wo,"parseResult");function go(){return`${X.isWSL()?po:mo}${ho}-${lo()}`}s(go,"getPipeName");function Eo(e,t){e=X.clone(e||{}),t=t||yo;let r=fo.arch()==="x64",i,n={namedPipe:go()};if(typeof e=="string"&&(e={title:"node-notifier",message:e}),typeof t!="function")throw new TypeError("The second argument must be a function callback. You have passed "+typeof fn);let o=s((f,l)=>{let u=wo(i&&i.toString("utf16le"));u.action==="buttonClicked"&&u.button?u.activationType=u.button:u.action&&(u.activationType=u.action),f&&f.code===-1&&l(f,u),l(null,u),n.instance&&n.instance.close()},"snoreToastResultParser"),a=s(f=>o(f,X.actionJackerDecorator(this,e,t,l=>l==="activate"?"click":l||!1)),"actionJackedCallback");return e.title=e.title||"Node Notification:",typeof e.message>"u"&&typeof e.close>"u"?(t(new Error("Message or ID to close is required.")),this):!X.isWin8()&&!X.isWSL()&&this.options.withFallback?(Ft=Ft||new co(this.options),Ft.notify(e,t)):(X.createNamedPipe(n).then(f=>{i=f,e.pipeName=n.namedPipe;let l=e.customPath||this.options.customPath||ao+"-x"+(r?"64":"86")+".exe";e=X.mapToWin8(e);let u=X.constructArgumentList(e,{explicitTrue:!0,wrapper:"",keepNewlines:!0,noEscape:!0});X.fileCommand(l,u,a)}),this)}s(Eo,"notifyRaw");Object.defineProperty(Pe.prototype,"notify",{get:s(function(){return this._notify||(this._notify=Eo.bind(this)),this._notify},"get")})});var nn=b((Jl,C)=>{c();var tn=v("os"),rn=de(),Me=hi(),Ut=Ai(),We=Tt(),Pt=Xe(),Mt=Ct(),ye={withFallback:!0},vo=rn.isWSL()?"WSL":tn.type();switch(vo){case"Linux":C.exports=new Me(ye),C.exports.Notification=Me;break;case"Darwin":C.exports=new Ut(ye),C.exports.Notification=Ut;break;case"Windows_NT":rn.isLessThanWin8()?(C.exports=new Mt(ye),C.exports.Notification=Mt):(C.exports=new We(ye),C.exports.Notification=We);break;case"WSL":C.exports=new We(ye),C.exports.Notification=We;break;default:tn.type().match(/BSD$/)?(C.exports=new Me(ye),C.exports.Notification=Me):(C.exports=new Pt(ye),C.exports.Notification=Pt)}C.exports.NotifySend=Me;C.exports.NotificationCenter=Ut;C.exports.WindowsToaster=We;C.exports.WindowsBalloon=Mt;C.exports.Growl=Pt});c();var cn=Be(En(),1),fe=Be(gn(),1);import an from"node:path";c();import{EventEmitter as Tn}from"node:events";import gt from"node:fs";import ge from"node:path";c();import Sn from"node:os";var ar=300,se=20,Ne=1e7,cr=Sn.platform();var _n=cr==="darwin",st=cr==="win32",oe=_n||st,fr=3e3,lr=2e4,ot=1250;c();var J;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(J||(J={}));var ue;(function(e){e.CHANGE="change",e.RENAME="rename"})(ue||(ue={}));var Se;(function(e){e.CHANGE="change",e.ERROR="error"})(Se||(Se={}));var m;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(m||(m={}));var F;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(F||(F={}));c();c();c();var xn=s((e,t=1,r)=>{t=Math.max(1,t);let i=r?.leading??!1,n=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),a,f,l=0,u=0,h=s(()=>{let _=Date.now(),W=_-l,ne=_-u,le=W>=t||ne>=o;return[_,le]},"getInstantData"),g=s(_=>{if(u=_,!a)return;let W=a;a=void 0,e.apply(void 0,W)},"invoke"),p=s(()=>{L(0)},"onCancel"),d=s(()=>{f&&(p(),g(Date.now()))},"onFlush"),D=s(_=>{if(u=_,i)return g(_)},"onLeading"),T=s(_=>{if(n&&a)return g(_);a=void 0},"onTrailing"),M=s(()=>{f=void 0;let[_,W]=h();return W?T(_):ie(_)},"onTimeout"),ie=s(_=>{let W=_-l,ne=_-u,le=t-W,Ge=o-ne,H=Math.min(le,Ge);return L(H)},"updateTimeout"),L=s(_=>{f&&clearTimeout(f),!(_<=0)&&(f=setTimeout(M,_))},"resetTimeout"),j=s((..._)=>{let[W,ne]=h(),le=!!f;if(a=_,l=W,(ne||!f)&&L(t),ne)return le?g(W):D(W)},"debounced");return j.cancel=p,j.flush=d,j},"debounce"),He=xn;c();import Sr from"node:fs";import lt from"node:path";c();import S from"node:fs";import{promisify as O}from"node:util";c();var Q=s((e,t)=>s(function(...i){return e.apply(void 0,i).catch(t)},"attemptified"),"attemptifyAsync"),Y=s((e,t)=>s(function(...i){try{return e.apply(void 0,i)}catch(n){return t(n)}},"attemptified"),"attemptifySync");c();import ur from"node:process";var hr=ur.getuid?!ur.getuid():!1,dr=1e4,P=s(()=>{},"NOOP");c();var _e={isChangeErrorOk:s(e=>{if(!_e.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!hr&&(t==="EINVAL"||t==="EPERM")},"isChangeErrorOk"),isNodeError:s(e=>e instanceof Error,"isNodeError"),isRetriableError:s(e=>{if(!_e.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},"isRetriableError"),onChangeError:s(e=>{if(!_e.isNodeError(e))throw e;if(!_e.isChangeErrorOk(e))throw e},"onChangeError")},I=_e;c();c();var at=class{static{s(this,"RetryfyQueue")}constructor(){this.interval=25,this.intervalId=void 0,this.limit=dr,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=s(()=>this.remove(i),"cleanup"),i=s(()=>t(r),"resolver");this.add(i)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},mr=new at;var ee=s((e,t)=>s(function(i){return s(function n(...o){return mr.schedule().then(a=>{let f=s(u=>(a(),u),"onResolve"),l=s(u=>{if(a(),Date.now()>=i)throw u;if(t(u)){let h=Math.round(100*Math.random());return new Promise(p=>setTimeout(p,h)).then(()=>n.apply(void 0,o))}throw u},"onReject");return e.apply(void 0,o).then(f,l)})},"attempt")},"retrified"),"retryifyAsync"),te=s((e,t)=>s(function(i){return s(function n(...o){try{return e.apply(void 0,o)}catch(a){if(Date.now()>i)throw a;if(t(a))return n.apply(void 0,o);throw a}},"attempt")},"retrified"),"retryifySync");var In={attempt:{chmod:Q(O(S.chmod),I.onChangeError),chown:Q(O(S.chown),I.onChangeError),close:Q(O(S.close),P),fsync:Q(O(S.fsync),P),mkdir:Q(O(S.mkdir),P),realpath:Q(O(S.realpath),P),stat:Q(O(S.stat),P),unlink:Q(O(S.unlink),P),chmodSync:Y(S.chmodSync,I.onChangeError),chownSync:Y(S.chownSync,I.onChangeError),closeSync:Y(S.closeSync,P),existsSync:Y(S.existsSync,P),fsyncSync:Y(S.fsync,P),mkdirSync:Y(S.mkdirSync,P),realpathSync:Y(S.realpathSync,P),statSync:Y(S.statSync,P),unlinkSync:Y(S.unlinkSync,P)},retry:{close:ee(O(S.close),I.isRetriableError),fsync:ee(O(S.fsync),I.isRetriableError),open:ee(O(S.open),I.isRetriableError),readFile:ee(O(S.readFile),I.isRetriableError),rename:ee(O(S.rename),I.isRetriableError),stat:ee(O(S.stat),I.isRetriableError),write:ee(O(S.write),I.isRetriableError),writeFile:ee(O(S.writeFile),I.isRetriableError),closeSync:te(S.closeSync,I.isRetriableError),fsyncSync:te(S.fsyncSync,I.isRetriableError),openSync:te(S.openSync,I.isRetriableError),readFileSync:te(S.readFileSync,I.isRetriableError),renameSync:te(S.renameSync,I.isRetriableError),statSync:te(S.statSync,I.isRetriableError),writeSync:te(S.writeSync,I.isRetriableError),writeFileSync:te(S.writeFileSync,I.isRetriableError)}},pr=In;c();import ft from"node:fs";import $e from"node:path";c();c();c();var ct=s(()=>{},"noop");var Dn=s(()=>{let e=ct,t=ct,r=!1,i=!1;return{promise:new Promise((l,u)=>{e=s(h=>(r=!0,l(h)),"resolve"),t=s(h=>(i=!0,u(h)),"reject")}),resolve:e,reject:t,isPending:s(()=>!r&&!i,"isPending"),isResolved:s(()=>r,"isResolved"),isRejected:s(()=>i,"isRejected")}},"makeNakedPromise"),yr=Dn;var An=s(()=>{let{promise:e,resolve:t,isPending:r}=yr(),i=0,n=s(()=>{i+=1},"increment"),o=s(()=>{i-=1,!i&&t()},"decrement");return s(()=>{n(),queueMicrotask(o)},"init")(),{promise:e,isPending:r,increment:n,decrement:o}},"makeCounterPromise"),wr=An;c();var gr={then:s(e=>{e()},"then")};c();var Er=s(e=>Array.isArray(e)?e:[e],"castArray"),vr=s(e=>typeof e=="function","isFunction");var Cn=s((e,t)=>{let r=t?.followSymlinks??!1,i=t?.depth??1/0,n=t?.limit??1/0,o=t?.ignore??[],a=Er(o).map(E=>vr(E)?E:w=>E.test(w)),f=s(E=>a.some(w=>w(E)),"isIgnored"),l=t?.signal??{aborted:!1},u=t?.onDirents||(()=>{}),h=[],g=new Set,p={},d=[],D=new Set,T={},M=[],ie=new Set,L={},j={},_=new Set,W={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},ne={directories:h,directoriesNames:g,directoriesNamesToPaths:p,files:d,filesNames:D,filesNamesToPaths:T,symlinks:M,symlinksNames:ie,symlinksNamesToPaths:L,map:j},{promise:le,increment:Ge,decrement:H}=wr(),Z=0,Wt=s((E,w,N,x)=>{_.has(w)||Z>=n||(Z+=1,E.directories.push(w),E.directoriesNames.add(N),h.push(w),g.add(N),p.propertyIsEnumerable(N)||(p[N]=[]),p[N].push(w),_.add(w),!(x>=i)&&(Z>=n||jt(w,x+1)))},"handleDirectory"),Gt=s((E,w,N)=>{_.has(w)||Z>=n||(Z+=1,E.files.push(w),E.filesNames.add(N),d.push(w),D.add(N),T.propertyIsEnumerable(N)||(T[N]=[]),T[N].push(w),_.add(w))},"handleFile"),Bt=s((E,w,N,x)=>{_.has(w)||Z>=n||(Z+=1,E.symlinks.push(w),E.symlinksNames.add(N),M.push(w),ie.add(N),L.propertyIsEnumerable(N)||(L[N]=[]),L[N].push(w),_.add(w),r&&(x>=i||Z>=n||mn(w,x+1)))},"handleSymlink"),un=s((E,w,N,x,$)=>{l.aborted||f(w)||(x.isDirectory()?Wt(E,w,N,$):x.isFile()?Gt(E,w,N):x.isSymbolicLink()&&Bt(E,w,N,$))},"handleStat"),hn=s((E,w,N,x)=>{if(l.aborted)return;let $=w===$e.sep?"":$e.sep,z=N.name,we=`${w}${$}${z}`;f(we)||(N.isDirectory()?Wt(E,we,z,x):N.isFile()?Gt(E,we,z):N.isSymbolicLink()&&Bt(E,we,z,x))},"handleDirent"),dn=s((E,w,N,x)=>{for(let $=0,z=N.length;$<z;$++)hn(E,w,N[$],x)},"handleDirents"),jt=s((E,w)=>{l.aborted||w>i||Z>=n||(Ge(),ft.readdir(E,{withFileTypes:!0},(N,x)=>{if(N||l.aborted||!x.length)return H();(u(x)||gr).then(()=>{let z=j[E]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};dn(z,E,x,w),H()})}))},"populateResultFromPath"),mn=s((E,w)=>{Ge(),ft.realpath(E,(N,x)=>{if(N||l.aborted)return H();ft.stat(x,($,z)=>{if($||l.aborted)return H();let we=$e.basename(x),pn=j[E]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};un(pn,x,we,z,w),H()})})},"populateResultFromSymlink");return s(async(E,w=1)=>(E=$e.normalize(E),_.add(E),jt(E,w),await le,l.aborted?W:ne),"getResult")(e)},"readdir"),Nr=Cn;var V={lang:{debounce:He,attempt:s(e=>{try{return e()}catch(t){return V.lang.castError(t)}},"attempt"),castArray:s(e=>V.lang.isArray(e)?e:[e],"castArray"),castError:s(e=>V.lang.isError(e)?e:V.lang.isString(e)?new Error(e):new Error("Unknown error"),"castError"),defer:s(e=>setTimeout(e,0),"defer"),isArray:s(e=>Array.isArray(e),"isArray"),isError:s(e=>e instanceof Error,"isError"),isFunction:s(e=>typeof e=="function","isFunction"),isNaN:s(e=>Number.isNaN(e),"isNaN"),isNumber:s(e=>typeof e=="number","isNumber"),isPrimitive:s(e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},"isPrimitive"),isShallowEqual:s((e,t)=>{if(e===t)return!0;if(V.lang.isNaN(e))return V.lang.isNaN(t);if(V.lang.isPrimitive(e)||V.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},"isShallowEqual"),isSet:s(e=>e instanceof Set,"isSet"),isString:s(e=>typeof e=="string","isString"),isUndefined:s(e=>e===void 0,"isUndefined"),noop:s(()=>{},"noop"),uniq:s(e=>e.length<2?e:Array.from(new Set(e)),"uniq")},fs:{getDepth:s(e=>Math.max(0,e.split(lt.sep).length-1),"getDepth"),getRealPath:s((e,t)=>{try{return t?Sr.realpathSync.native(e):Sr.realpathSync(e)}catch{return}},"getRealPath"),isSubPath:s((e,t)=>t.startsWith(e)&&t[e.length]===lt.sep&&t.length-e.length>lt.sep.length,"isSubPath"),poll:s((e,t=lr)=>pr.retry.stat(t)(e,{bigint:!0}).catch(V.lang.noop),"poll"),readdir:s(async(e,t,r=1/0,i=1/0,n,o)=>{if(o&&r===1&&e in o){let a=o[e];return[a.directories,a.files]}else{let a=await Nr(e,{depth:r,limit:i,ignore:t,signal:n});return[a.directories,a.files]}},"readdir")}},y=V;c();import ut from"node:path";var ht=class{static{s(this,"WatcherHandler")}constructor(t,r,i){this.base=i,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||y.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=ar){return(()=>{let r=this.watcher._readyWait,i=[],n=new Set,o=s(async(f,l)=>{let u=this.options.ignoreInitial?[]:f,h=await this.eventsPopulate([...l]),g=this.eventsDeduplicate([...u,...h]);this.onTargetEvents(g)},"flush"),a=y.lang.debounce(()=>{this.watcher.isClosed()||(r=o(i,n),i=[],n=new Set)},t);return async(f,l="",u=!1)=>{u?await this.eventsPopulate([l],i,!0):n.add(l),r.then(a)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((i,n)=>{let[o,a]=n,f=r[a];return o===f||o===m.CHANGE&&f===m.ADD||(r[a]=o,i.push(n)),i},[])}async eventsPopulate(t,r=[],i=!1){return await Promise.all(t.map(async n=>{let o=await this.watcher._poller.update(n,this.options.pollingTimeout);await Promise.all(o.map(async a=>{r.push([a,n]),a===m.ADD_DIR?await this.eventsPopulateAddDir(t,n,r,i):a===m.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,n,r,i)}))})),r}async eventsPopulateAddDir(t,r,i=[],n=!1){if(n)return i;let o=this.options.recursive?this.options.depth??se:Math.min(1,this.options.depth??se),a=this.options.limit??Ne,[f,l]=await y.fs.readdir(r,this.options.ignore,o,a,this.watcher._closeSignal),u=[...f,...l];return await Promise.all(u.map(h=>{if(!this.watcher.isIgnored(h,this.options.ignore)&&!t.includes(h))return this.eventsPopulate([h],i,!0)})),i}async eventsPopulateUnlinkDir(t,r,i=[],n=!1){if(n)return i;for(let o of this.watcher._poller.stats.keys())y.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],i,!0));return i}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(m.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!oe&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(m.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(m.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(ut.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(m.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(ut.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(m.UNLINK_DIR,t))}onTargetEvent(t){let[r,i]=t;r===m.ADD?this.onTargetAdd(i):r===m.ADD_DIR?this.onTargetAddDir(i):r===m.CHANGE?this.onTargetChange(i):r===m.UNLINK?this.onTargetUnlink(i):r===m.UNLINK_DIR&&this.onTargetUnlinkDir(i)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,i=!1){return this.handlerBatched(t,r,i)}onWatcherChange(t=ue.CHANGE,r){if(this.watcher.isClosed())return;let i=ut.resolve(this.folderPath,r||"");this.filePath&&i!==this.folderPath&&i!==this.filePath||this.watcher.isIgnored(i,this.options.ignore)||this.onWatcherEvent(t,i)}onWatcherError(t){st&&t.code==="EPERM"?this.onWatcherChange(ue.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(Se.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(Se.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(ue.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&oe&&this.options.native!==!1?this.options.depth??se:Math.min(1,this.options.depth??se),i=this.options.limit??Ne,[n,o]=await y.fs.readdir(this.folderPath,this.options.ignore,r,i,this.watcher._closeSignal,this.options.readdirMap),a=[this.folderPath,...n,...o];await Promise.all(a.map(f=>{if(!this.watcher._poller.stats.has(f)&&!this.watcher.isIgnored(f,this.options.ignore))return this.onWatcherEvent(ue.CHANGE,f,t)}))}}},_r=ht;c();c();var U={interval:100,intervalId:void 0,fns:new Map,init:s(()=>{U.intervalId||(U.intervalId=setInterval(U.resolve,U.interval))},"init"),reset:s(()=>{U.intervalId&&(clearInterval(U.intervalId),delete U.intervalId)},"reset"),add:s((e,t)=>{U.fns.set(e,Date.now()+t),U.init()},"add"),remove:s(e=>{U.fns.delete(e)},"remove"),resolve:s(()=>{if(!U.fns.size)return U.reset();let e=Date.now();for(let[t,r]of U.fns)r>=e||(U.remove(t),t())},"resolve")},xe=U;var Ie=class e{static{s(this,"WatcherLocker")}constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=ot){let{ino:i,targetPath:n,events:o,locks:a}=t,f=s(()=>{let g=this._watcher._poller.paths.find(i||-1,p=>p!==n);if(g&&g!==n){if(y.fs.getRealPath(n,!0)===g)return;this._watcher.event(o.rename,g,n)}else this._watcher.event(o.add,n)},"emit");if(!i)return f();let l=s(()=>{a.add.delete(i),xe.remove(u)},"cleanup"),u=s(()=>{l(),f()},"free");xe.add(u,r);let h=s(()=>{let g=a.unlink.get(i);if(!g)return;l();let p=g();n===p?o.change&&this._watcher._poller.stats.has(n)&&this._watcher.event(o.change,n):this._watcher.event(o.rename,p,n)},"resolve");a.add.set(i,h),h()}getLockUnlink(t,r=ot){let{ino:i,targetPath:n,events:o,locks:a}=t,f=s(()=>{this._watcher.event(o.unlink,n)},"emit");if(!i)return f();let l=s(()=>{a.unlink.delete(i),xe.remove(u)},"cleanup"),u=s(()=>{l(),f()},"free");xe.add(u,r);let h=s(()=>(l(),n),"overridden");a.unlink.set(i,h),a.add.get(i)?.()}getLockTargetAdd(t,r){let i=this._watcher._poller.getIno(t,m.ADD,J.FILE);return this.getLockAdd({ino:i,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let i=this._watcher._poller.getIno(t,m.ADD_DIR,J.DIR);return this.getLockAdd({ino:i,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let i=this._watcher._poller.getIno(t,m.UNLINK,J.FILE);return this.getLockUnlink({ino:i,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let i=this._watcher._poller.getIno(t,m.UNLINK_DIR,J.DIR);return this.getLockUnlink({ino:i,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};Ie.DIR_EVENTS={add:m.ADD_DIR,rename:m.RENAME_DIR,unlink:m.UNLINK_DIR};Ie.FILE_EVENTS={add:m.ADD,change:m.CHANGE,rename:m.RENAME,unlink:m.UNLINK};var xr=Ie;c();c();var dt=class{static{s(this,"LazyMapSet")}constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(y.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let i=this.map.get(t);if(y.lang.isSet(i)){let n=i.delete(r);return i.size||this.map.delete(t),n}else if(i===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let i=this.map.get(t);if(y.lang.isSet(i))return Array.from(i).find(r);if(r(i))return i}}get(t){return this.map.get(t)}has(t,r){if(y.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let i=this.map.get(t);return y.lang.isSet(i)?i.has(r):i===r}return!1}set(t,r){if(this.map.has(t)){let i=this.map.get(t);y.lang.isSet(i)?i.add(r):i!==r&&this.map.set(t,new Set([i,r]))}else this.map.set(t,r);return this}},mt=dt;c();var pt=class{static{s(this,"WatcherStats")}constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},Ir=pt;var yt=class{static{s(this,"WatcherPoller")}constructor(){this.inos={},this.paths=new mt,this.stats=new Map}getIno(t,r,i){let n=this.inos[r];if(!n)return;let o=n[t];if(o&&!(i&&o[1]!==i))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let i=await y.fs.poll(t,r);if(!(!i||!(i.isFile()||i.isDirectory())))return new Ir(i)}reset(){this.inos={},this.paths=new mt,this.stats=new Map}async update(t,r){let i=this.getStats(t),n=await this.poll(t,r);if(this.updateStats(t,n),!i&&n){if(n.isFile())return this.updateIno(t,m.ADD,n),[m.ADD];if(n.isDirectory())return this.updateIno(t,m.ADD_DIR,n),[m.ADD_DIR]}else if(i&&!n){if(i.isFile())return this.updateIno(t,m.UNLINK,i),[m.UNLINK];if(i.isDirectory())return this.updateIno(t,m.UNLINK_DIR,i),[m.UNLINK_DIR]}else if(i&&n){if(i.isFile()){if(n.isFile())return i.ino===n.ino&&!i.size&&!n.size?[]:(this.updateIno(t,m.CHANGE,n),[m.CHANGE]);if(n.isDirectory())return this.updateIno(t,m.UNLINK,i),this.updateIno(t,m.ADD_DIR,n),[m.UNLINK,m.ADD_DIR]}else if(i.isDirectory()){if(n.isFile())return this.updateIno(t,m.UNLINK_DIR,i),this.updateIno(t,m.ADD,n),[m.UNLINK_DIR,m.ADD];if(n.isDirectory())return i.ino===n.ino?[]:(this.updateIno(t,m.UNLINK_DIR,i),this.updateIno(t,m.ADD_DIR,n),[m.UNLINK_DIR,m.ADD_DIR])}}return[]}updateIno(t,r,i){let n=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=i.isFile()?J.FILE:J.DIR;n[t]=[i.ino,o]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let i=this.stats.get(t)?.ino||-1;this.paths.delete(i,t),this.stats.delete(t)}}},wt=yt;var Et=class e extends Tn{static{s(this,"Watcher")}constructor(t,r,i){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(F.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(n=>this.on(F.CLOSE,n)),this._readyWait=new Promise(n=>this.on(F.READY,n)),this._locker=new xr(this),this._roots=new Set,this._poller=new wt,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,i)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(y.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(F.CLOSE))}error(t){if(this.isClosed())return!1;let r=y.lang.castError(t);return this.emit(F.ERROR,r)}event(t,r,i){return this.isClosed()?!1:(this.emit(F.ALL,t,r,i),this.emit(t,r,i))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(F.READY))}pollerExists(t,r){for(let i of this._pollers)if(i.targetPath===t&&y.lang.isShallowEqual(i.options,r))return!0;return!1}subwatcherExists(t,r){for(let i of this._subwatchers)if(i.targetPath===t&&y.lang.isShallowEqual(i.options,r))return!0;return!1}watchersClose(t,r,i=!0){if(t){let n=this._watchers[t];if(n)for(let o of[...n])r&&o.filePath!==r||this.watcherClose(o);if(i)for(let o in this._watchers)y.fs.isSubPath(t,o)&&this.watchersClose(o,r,!1)}else for(let n in this._watchers)this.watchersClose(n,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,i]of t)this.watchPath(r,i.options,i.handler)}async watcherAdd(t,r){let{folderPath:i}=t;(this._watchers[i]=this._watchers[i]||[]).push(t);let o=new _r(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,1),r.length||delete this._watchers[t.folderPath]}let i=t.filePath||t.folderPath;this._roots.has(i)&&(this._watchersRestorable[i]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=y.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,i,n){if(this._watchers[t]?.find(f=>f.handler===i&&(!f.filePath||f.filePath===n)&&f.options.ignore===r.ignore&&!!f.options.native==!!r.native&&(!r.recursive||f.options.recursive)))return!0;let a=ge.dirname(t);for(let f=1;f<1/0;f++){if(this._watchers[a]?.find(h=>(f===1||h.options.recursive&&f<=(h.options.depth??se))&&h.handler===i&&(!h.filePath||h.filePath===n)&&h.options.ignore===r.ignore&&!!h.options.native==!!r.native&&(!r.recursive||h.options.recursive&&oe&&h.options.native!==!1)))return!0;if(!oe)break;let u=ge.dirname(t);if(a===u)break;a=u}return!1}async watchDirectories(t,r,i,n,o){if(this.isClosed())return;t=y.lang.uniq(t).sort();let a;for(let f of t)if(!this.isIgnored(f,r.ignore)&&!this.watcherExists(f,r,i,n))try{let l=!r.recursive||oe&&r.native!==!1?r:{...r,recursive:!1},h={watcher:gt.watch(f,l),handler:i,options:r,folderPath:f,filePath:n},g=a=await this.watcherAdd(h,o);if(this._roots.has(n||f)){let d={...r,ignoreInitial:!0,recursive:!1},D=ge.dirname(f),T=f;await this.watchDirectories([D],d,i,T,g)}}catch(l){this.error(l)}return a}async watchDirectory(t,r,i,n,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||oe&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,i,n,o));{r={...r,recursive:!0};let a=r.depth??se,f=r.limit??Ne,[l]=await y.fs.readdir(t,r.ignore,a,f,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let u=await this.watchDirectories([t],r,i,n,o);if(l.length){let h=y.fs.getDepth(t);for(let g of l){let p=y.fs.getDepth(g),d=Math.max(0,a-(p-h)),D={...r,depth:d};await this.watchDirectories([g],D,i,n,o||u)}}})}}}async watchFileOnce(t,r,i){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let n={targetPath:t,options:r},o=s((u,h)=>{h===t&&(l(),i())},"handler"),a=new e(o),f=s(()=>{this._subwatchers.add(n),this.on(F.CLOSE,l),a.watchFile(t,r,o)},"start"),l=s(()=>{this._subwatchers.delete(n),this.removeListener(F.CLOSE,l),a.close()},"stop");return f()}async watchFile(t,r,i){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let n=ge.dirname(t);return this.watchDirectory(n,r,i,t)}async watchPollingOnce(t,r,i){if(this.isClosed())return;let n=!1,o=new wt,a=await this.watchPolling(t,r,async()=>{n||!(await o.update(t,r.pollingTimeout)).length||n||(n=!0,a(),i())})}async watchPolling(t,r,i){if(this.isClosed())return y.lang.noop;if(this.pollerExists(t,r))return y.lang.noop;let n={...r,interval:r.pollingInterval??fr},o={targetPath:t,options:r},a=s(()=>{this._pollers.add(o),this.on(F.CLOSE,f),gt.watchFile(t,n,i)},"start"),f=s(()=>{this._pollers.delete(o),this.removeListener(F.CLOSE,f),gt.unwatchFile(t,i)},"stop");return y.lang.attempt(a),()=>y.lang.attempt(f)}async watchUnknownChild(t,r,i){if(this.isClosed())return;let n=s(()=>this.watchPath(t,r,i),"watch");return this.watchFileOnce(t,r,n)}async watchUnknownTarget(t,r,i){if(this.isClosed())return;let n=s(()=>this.watchPath(t,r,i),"watch");return this.watchPollingOnce(t,r,n)}async watchPaths(t,r,i){if(this.isClosed())return;if(t=y.lang.uniq(t).sort(),t.every((o,a)=>t.every((f,l)=>l===a||!y.fs.isSubPath(o,f))))await Promise.all(t.map(o=>this.watchPath(o,r,i)));else for(let o of t)await this.watchPath(o,r,i)}async watchPath(t,r,i){if(this.isClosed()||(t=ge.resolve(t),this.isIgnored(t,r.ignore)))return;let n=await y.fs.poll(t,r.pollingTimeout);if(n){if(n.isFile())return this.watchFile(t,r,i);if(n.isDirectory())return this.watchDirectory(t,r,i);this.error(`"${t}" is not supported`)}else{let o=ge.dirname(t);return(await y.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,i):this.watchUnknownTarget(t,r,i)}}async watch(t,r,i=y.lang.noop){if(y.lang.isFunction(t))return this.watch([],{},t);if(y.lang.isUndefined(t))return this.watch([],r,i);if(y.lang.isFunction(r))return this.watch(t,{},r);if(y.lang.isUndefined(r))return this.watch(t,{},i);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let n=y.lang.castArray(t);n.forEach(o=>this._roots.add(o)),await this.watchPaths(n,r,i),!this.isClosed()&&(i!==y.lang.noop&&this.on(F.ALL,i),r.readdirMap=void 0,this.ready())}},Dr=Et;var ln=Be(Jr(),1);c();var vt=s((e,...t)=>{let r=zt(e,...t);je.isInteractive?je.updateFooter(r):je.writeStdout(r)},"footer");c();var sn=Be(nn(),1);var on=s((e,t)=>{e.log.info("notifying user",{notification:t}),sn.default.notify({title:"Gadget",contentImage:rt("favicon-128@4x.png"),icon:rt("favicon-128@4x.png"),sound:!0,timeout:!1,...t},r=>{r&&e.log.warn("error notifying user",{notification:t})})},"notify");var Su={...ir,...Zt,"--prefer":rr,"--file-push-delay":{type:Number,default:(0,fe.default)("100ms")},"--file-watch-debounce":{type:Number,default:(0,fe.default)("300ms")},"--file-watch-poll-interval":{type:Number,default:(0,fe.default)("3s")},"--file-watch-poll-timeout":{type:Number,default:(0,fe.default)("20s")},"--file-watch-rename-timeout":{type:Number,default:(0,fe.default)("1.25s")},"--no-logs":Boolean},_u=s(e=>B`
4
4
  Clones your Gadget environment's files to your local machine and keeps it in sync, in order to
@@ -31,6 +31,7 @@ import{a as Nn}from"./chunk-QXWICGG6.js";import{a as nt}from"./chunk-SX5LO3XQ.js
31
31
  • .gadget
32
32
  • .git
33
33
  • node_modules
34
+ • .shopify
34
35
 
35
36
  {gray Notes}
36
37
  • "ggt dev" only works with development environments
@@ -55,4 +56,4 @@ ${i.sprint({indent:4})}
55
56
 
56
57
  Waiting for file changes${Vt.ellipsis} {gray Press Ctrl+C to stop}
57
58
  `})},"run");export{Su as args,xu as run,_u as usage};
58
- //# sourceMappingURL=dev-ODLZZUI4.js.map
59
+ //# sourceMappingURL=dev-XI2RDRXJ.js.map