Marp/.obsidian/plugins/marp-slides/lib/marp-cli-b9daa9b1.js

44 lines
328 KiB
JavaScript
Raw Normal View History

2024-02-20 08:46:27 +01:00
"use strict";var e=require("process"),t=require("os"),n=require("tty"),r=require("yargs/yargs"),i=require("yargs"),o=require("fs"),s=require("path"),a=require("cosmiconfig"),u=require("util"),c=require("child_process"),l=require("url"),p=require("import-from"),A=require("stream"),f=require("events"),D=require("tmp"),d=require("@marp-team/marpit"),g=require("puppeteer-core"),h=require("net"),m=require("is-wsl"),v=require("crypto"),b=require("chokidar"),y=require("ws"),w=require("querystring"),C=require("serve-index"),E=require("@marp-team/marp-core/package.json");function F(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var k=F(l);const _=(e=0)=>t=>`[${t+e}m`,B=(e=0)=>t=>`[${38+e};5;${t}m`,P=(e=0)=>(t,n,r)=>`[${38+e};2;${t};${n};${r}m`,x={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(x.modifier),Object.keys(x.color),Object.keys(x.bgColor);const S=function(){const e=new Map;for(const[t,n]of Object.entries(x)){for(const[t,r]of Object.entries(n))x[t]={open:`[${r[0]}m`,close:`[${r[1]}m`},n[t]=x[t],e.set(r[0],r[1]);Object.defineProperty(x,t,{value:n,enumerable:!1})}return Object.defineProperty(x,"codes",{value:e,enumerable:!1}),x.color.close="",x.bgColor.close="",x.color.ansi=_(),x.color.ansi256=B(),x.color.ansi16m=P(),x.bgColor.ansi=_(10),x.bgColor.ansi256=B(10),x.bgColor.ansi16m=P(10),Object.defineProperties(x,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;3===n.length&&(n=[...n].map((e=>e+e)).join(""));const r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},enumerable:!1},hexToAnsi256:{value:e=>x.rgbToAnsi256(...x.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,n,r;if(e>=232)t=(10*(e-232)+8)/255,n=t,r=t;else{const i=(e-=16)%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const i=2*Math.max(t,n,r);if(0===i)return 30;let o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return 2===i&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>x.ansi256ToAnsi(x.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>x.ansi256ToAnsi(x.hexToAnsi256(e)),enumerable:!1}}),x}();function T(t,n=(globalThis.Deno?globalThis.Deno.args:e.argv)){const r=t.startsWith("-")?"":1===t.length?"-":"--",i=n.indexOf(r+t),o=n.indexOf("--");return-1!==i&&(-1===o||i<o)}const{env:O}=e;let I;function M(n,r={}){return i=function(n,{streamIsTTY:r,sniffFlags:i=!0}={}){const o=function(){if("FORCE_COLOR"in O)return"true"===O.FORCE_COLOR?1:"false"===O.FORCE_COLOR?0:0===O.FORCE_COLOR.length?1:Math.min(Number.parseInt(O.FORCE_COLOR,10),3)}();void 0!==o&&(I=o);const s=i?I:o;if(0===s)return 0;if(i){if(T("color=16m")||T("color=full")||T("color=truecolor"))return 3;if(T("color=256"))return 2}if("TF_BUILD"in O&&"AGENT_NAME"in O)return 1;if(n&&!r&&void 0===s)return 0;const a=s||0;if("dumb"===O.TERM)return a;if("win32"===e.platform){const e=t.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>
/*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/!function(e){e.isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,i)=>!1!==i&&!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=i,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>"brace"===e.type&&e.commas>>0+e.ranges>>0==0&&(e.invalid=!0,!0),e.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges>>0!=0&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let i=e[r];Array.isArray(i)?n(i):void 0!==i&&t.push(i)}return t};return n(e),t}}(Lt);const Nt=Lt;var Ht=(e,t={})=>{let n=(e,r={})=>{let i=t.escapeInvalid&&Nt.isInvalidBrace(r),o=!0===e.invalid&&!0===t.escapeInvalid,s="";if(e.value)return(i||o)&&Nt.isOpenOrClose(e)?"\\"+e.value:e.value;if(e.value)return e.value;if(e.nodes)for(let t of e.nodes)s+=n(t);return s};return n(e)};
/*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*/
/*!
* to-regex-range <https://github.com/micromatch/to-regex-range>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*/
const jt=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))},Qt=(e,t,n)=>{if(!1===jt(e))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===t||e===t)return String(e);if(!1===jt(t))throw new TypeError("toRegexRange: expected the second argument to be a number.");let r={relaxZeros:!0,...n};"boolean"==typeof r.strictZeros&&(r.relaxZeros=!1===r.strictZeros);let i=e+":"+t+"="+String(r.relaxZeros)+String(r.shorthand)+String(r.capture)+String(r.wrap);if(Qt.cache.hasOwnProperty(i))return Qt.cache[i].result;let o=Math.min(e,t),s=Math.max(e,t);if(1===Math.abs(o-s)){let n=e+"|"+t;return r.capture?`(${n})`:!1===r.wrap?n:`(?:${n})`}let a=Jt(e)||Jt(t),u={min:e,max:t,a:o,b:s},c=[],l=[];return a&&(u.isPadded=a,u.maxLen=String(u.max).length),o<0&&(l=Ut(s<0?Math.abs(s):1,Math.abs(o),u,r),o=u.a=0),s>=0&&(c=Ut(o,s,u,r)),u.negatives=l,u.positives=c,u.result=function(e,t,n){let r=Gt(e,t,"-",!1)||[],i=Gt(t,e,"",!1)||[],o=Gt(e,t,"-?",!0)||[];return r.concat(o).concat(i).join("|")}(l,c),!0===r.capture?u.result=`(${u.result})`:!1!==r.wrap&&c.length+l.length>1&&(u.result=`(?:${u.result})`),Qt.cache[i]=u,u.result};function zt(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=function(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}(e,t),i=r.length,o="",s=0;for(let e=0;e<i;e++){let[t,n]=r[e];t===n?o+=t:"0"!==t||"9"!==n?o+=`[${a=t}${(u=n)-a==1?"":"-"}${u}]`:s++}var a,u;return s&&(o+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:o,count:[s],digits:i}}function Ut(e,t,n,r){let i,o=function(e,t){let n=1,r=1,i=Zt(e,n),o=new Set([t]);for(;e<=i&&i<=t;)o.add(i),n+=1,i=Zt(e,n);for(i=qt(t+1,r)-1;e<i&&i<=t;)o.add(i),r+=1,i=qt(t+1,r)-1;return o=[...o],o.sort(Yt),o}(e,t),s=[],a=e;for(let e=0;e<o.length;e++){let t=o[e],u=zt(String(a),String(t),r),c="";n.isPadded||!i||i.pattern!==u.pattern?(n.isPadded&&(c=Kt(t,n,r)),u.string=c+u.pattern+Wt(u.count),s.push(u),a=t+1,i=u):(i.count.length>1&&i.count.pop(),i.count.push(u.count[0]),i.string=i.pattern+Wt(i.count),a=t+1)}return s}function Gt(e,t,n,r,i){let o=[];for(let i of e){let{string:e}=i;r||Xt(t,"string",e)||o.push(n+e),r&&Xt(t,"string",e)&&o.push(n+e)}return o}function Yt(e,t){return e>t?1:t>e?-1:0}function Xt(e,t,n){return e.some((e=>e[t]===n))}function Zt(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function qt(e,t){return e-e%Math.pow(10,t)}function Wt(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function Jt(e){return/^-?(0+)\d/.test(e)}function Kt(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),i=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${r}}`:`0{${r}}`}}Qt.cache={},Qt.clearCache=()=>Qt.cache={};
/*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Licensed under the MIT License.
*/
const Vt=u,$t=Qt,en=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),tn=e=>"number"==typeof e||"string"==typeof e&&""!==e,nn=e=>Number.isInteger(+e),rn=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},on=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},sn=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},an=(e,t,n,r)=>{if(n)return $t(e,t,{wrap:!1,...r});let i=String.fromCharCode(e);return e===t?i:`[${i}-${String.fromCharCode(t)}]`},un=(e,t,n)=>{if(Array.isArray(e)){let t=!0===n.wrap,r=n.capture?"":"?:";return t?`(${r}${e.join("|")})`:e.join("|")}return $t(e,t,n)},cn=(...e)=>new RangeError("Invalid range arguments: "+Vt.inspect(...e)),ln=(e,t,n)=>{if(!0===n.strictRanges)throw cn([e,t]);return[]},pn=(e,t,n,r={})=>{if(null==t&&tn(e))return[e];if(!tn(e)||!tn(t))return ln(e,t,r);if("function"==typeof n)return pn(e,t,1,{transform:n});if(en(n))return pn(e,t,0,n);let i={...r};return!0===i.capture&&(i.wrap=!0),n=n||i.step||1,nn(n)?nn(e)&&nn(t)?((e,t,n=1,r={})=>{let i=Number(e),o=Number(t);if(!Number.isInteger(i)||!Number.isInteger(o)){if(!0===r.strictRanges)throw cn([e,t]);return[]}0===i&&(i=0),0===o&&(o=0);let s=i>o,a=String(e),u=String(t),c=String(n);n=Math.max(Math.abs(n),1);let l=rn(a)||rn(u)||rn(c),p=l?Math.max(a.length,u.length,c.length):0,A=!1===l&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),f=r.transform||(e=>t=>!0===e?Number(t):String(t))(A);if(r.toRegex&&1===n)return an(sn(e,p),sn(t,p),!0,r);let D={negatives:[],positives:[]},d=[],g=0;for(;s?i>=o:i<=o;)!0===r.toRegex&&n>1?D[(h=i)<0?"negatives":"positives"].push(Math.abs(h)):d.push(on(f(i,g),p,A)),i=s?i-n:i+n,g++;var h;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",i="",o="";return e.positives.length&&(i=e.positives.join("|")),e.negatives.length&&(o=`-(${r}${e.negatives.join("|")})`),n=i&&o?`${i}|${o}`:i||o,t.wrap?`(${r}${n})`:n})(D,r):un(d,null,{wrap:!1,...r}):d})(e,t,n,i):((e,t,n=1,r={})=>{if(!nn(e)&&e.length>1||!nn(t)&&t.length>1)return ln(e,t,r);let i=r.transform||(e=>String.fromCharCode(e)),o=`${e}`.charCodeAt(0),s=`${t}`.charCodeAt(0),a=o>s,u=Math.min(o,s),c=Math.max(o,s);if(r.toRegex&&1===n)return an(u,c,!1,r);let l=[],p=0;for(;a?o>=s:o<=s;)l.push(i(o,p)),o=a?o-n:o+n,p++;return!0===r.toRegex?un(l,null,{wrap:!1,options:r}):l})(e,t,Math.max(Math.abs(n),1),i):null==n||en(n)?pn(e,t,1,n):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(n,i)},An=pn,fn=Lt;const Dn=pn,dn=Ht,gn=Lt,hn=(e="",t="",n=!1)=>{let r=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return n?gn.flatten(t).map((e=>`{${e}}`)):t;for(let i of e)if(Array.isArray(i))for(let e of i)r.push(hn(e,t,n));else for(let e of t)!0===n&&"string"==typeof e&&(e=`{${e}}`),r.push(Array.isArray(e)?hn(i,e,n):i+e);return gn.flatten(r)};const mn=Ht,{MAX_LENGTH:vn,CHAR_BACKSLASH:bn,CHAR_BACKTICK:yn,CHAR_COMMA:wn,CHAR_DOT:Cn,CHAR_LEFT_PARENTHESES:En,CHAR_RIGHT_PARENTHESES:Fn,CHAR_LEFT_CURLY_BRACE:kn,CHAR_RIGHT_CURLY_BRACE:_n,CHAR_LEFT_SQUARE_BRACKET:Bn,CHAR_RIGHT_SQUARE_BRACKET:Pn,CHAR_DOUBLE_QUOTE:xn,CHAR_SINGLE_QUOTE:Sn,CHAR_NO_BREAK_SPACE:Tn,CHAR_ZERO_WIDTH_NOBREAK_SPACE:On}={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?
/**
* @license Copyright 2016 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
const cc=ju,lc=ne(Object.freeze({__proto__:null,get clear(){return ic},get getEntries(){return rc},get mark(){return tc},get stop(){return nc}})),pc=f.EventEmitter,Ac="win32"===process.platform,fc=process.browser,Dc={red:fc?"crimson":1,yellow:fc?"gold":3,cyan:fc?"darkturquoise":6,green:fc?"forestgreen":2,blue:fc?"steelblue":4,magenta:fc?"palevioletred":5};cc.colors=[Dc.cyan,Dc.green,Dc.blue,Dc.magenta];const dc={};let gc;class hc{static _logToStdErr(e,t){hc.loggerfn(e)(...t)}static loggerfn(e){let t=dc[e=`LH:${e}`];return t||(t=cc(e),dc[e]=t,e.endsWith("error")?t.color=Dc.red:e.endsWith("warn")&&(t.color=Dc.yellow)),t}static setLevel(e){switch(gc=e,e){case"silent":cc.enable("-LH:*");break;case"verbose":cc.enable("LH:*");break;case"error":cc.enable("-LH:*, LH:*:error");break;default:cc.enable("LH:*, -LH:*:verbose")}}static formatProtocol(e,t,n){const r=!process||process.browser?1/0:process.stdout.columns,i=t.method||"?????",o=r-i.length-e.length-25,s=t.params&&"IO.read"!==i?JSON.stringify(t.params).substr(0,o):"";hc._logToStdErr(`${e}:${n||""}`,[i,s])}static isVerbose(){return"verbose"===gc}static time({msg:e,id:t,args:n=[]},r="log"){lc.mark(t),hc[r]("status",e,...n)}static timeEnd({msg:e,id:t,args:n=[]},r="verbose"){hc[r]("statusEnd",e,...n),lc.stop(t)}static log(e,...t){return hc.events.issueStatus(e,t),hc._logToStdErr(e,t)}static warn(e,...t){return hc.events.issueWarning(e,t),hc._logToStdErr(`${e}:warn`,t)}static error(e,...t){return hc._logToStdErr(`${e}:error`,t)}static verbose(e,...t){return hc.events.issueStatus(e,t),hc._logToStdErr(`${e}:verbose`,t)}static greenify(e){return`${hc.green}${e}${hc.reset}`}static redify(e){return`${hc.red}${e}${hc.reset}`}static get green(){return""}static get red(){return""}static get yellow(){return""}static get purple(){return""}static get reset(){return""}static get bold(){return""}static get dim(){return""}static get tick(){return Ac?"√":"✓"}static get cross(){return Ac?"×":"✘"}static get whiteSmallSquare(){return Ac?"·":"▫"}static get heavyHorizontal(){return Ac?"─":"━"}static get heavyVertical(){return Ac?"│ ":"┃ "}static get heavyUpAndRight(){return Ac?"└":"┗"}static get heavyVerticalAndRight(){return Ac?"├":"┣"}static get heavyDownAndHorizontal(){return Ac?"┬":"┳"}static get doubleLightHorizontal(){return"──"}}hc.events=new class extends pc{issueStatus(e,t){"status"!==e&&"statusEnd"!==e||this.emit(e,[e,...t])}issueWarning(e,t){this.emit("warning",[e,...t])}},hc.takeTimeEntries=()=>{const e=lc.getEntries();return lc.clear(),e},hc.getTimeEntries=()=>lc.getEntries();var mc=hc,vc={};
/**
* @license Copyright 2017 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
Object.defineProperty(vc,"__esModule",{value:!0}),vc.getWSLLocalAppDataPath=vc.toWSLPath=vc.toWin32Path=vc.makeTmpDir=vc.getPlatform=vc.ChromeNotInstalledError=vc.UnsupportedPlatformError=vc.InvalidUserDataDirectoryError=vc.ChromePathNotSetError=vc.LauncherError=vc.delay=vc.defaults=void 0;const bc=s,yc=c,wc=o,Cc=m;vc.defaults=function(e,t){return void 0===e?t:e},vc.delay=async function(e){return new Promise((t=>setTimeout(t,e)))};class Ec extends Error{constructor(e="Unexpected error",t){return super(),this.message=e,this.code=t,this.stack=(new Error).stack,this}}vc.LauncherError=Ec,vc.ChromePathNotSetError=class extends Ec{constructor(){super(...arguments),this.message="The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.",this.code="ERR_LAUNCHER_PATH_NOT_SET"}},vc.InvalidUserDataDirectoryError=class extends Ec{constructor(){super(...arguments),this.message="userDataDir must be false or a path.",this.code="ERR_LAUNCHER_INVALID_USER_DATA_DIRECTORY"}};class Fc extends Ec{constructor(){super(...arguments),this.message=`Platform ${kc()} is not supported.`,this.code="ERR_LAUNCHER_UNSUPPORTED_PLATFORM"}}function kc(){return Cc?"wsl":process.platform}function _c(e,t){try{return yc.execFileSync("wslpath",["-u",e]).toString().trim()}catch{return t}}function Bc(e){const t=/\/([a-z])\/Users\/([^\/:]+)\/AppData\//.exec(e)||[];return _c(`${t[1]}:\\Users\\${t[2]}\\AppData\\Local`,function(e){const t=/\/mnt\/([a-z])\/Users\/([^\/:]+)\/AppData\//.exec(e)||[];return`/mnt/${t[1]}/Users/${t[2]}/AppData/Local`}(e))}vc.UnsupportedPlatformError=Fc,vc.ChromeNotInstalledError=class extends Ec{constructor(){super(...arguments),this.message="No Chrome installations found.",this.code="ERR_LAUNCHER_NOT_INSTALLED"}},vc.getPlatform=kc,vc.makeTmpDir=function(){switch(kc()){case"darwin":case"linux":return yc.execSync("mktemp -d -t lighthouse.XXXXXXX").toString().trim();case"wsl":process.env.TEMP=Bc(`${process.env.PATH}`);case"win32":return function(){const e=process.env.TEMP||process.env.TMP||(process.env.SystemRoot||process.env.windir)+"\\temp",t=Math.floor(9e7*Math.random()+1e7),n=bc.join(e,"lighthouse."+t);return wc.mkdirSync(n,{recursive:!0}),n}
/**
* @license Copyright 2016 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/();default:throw new Fc}},vc.toWin32Path=function(e=""){if(/[a-z]:\\/iu.test(e))return e;try{return yc.execFileSync("wslpath",["-w",e]).toString().trim()}catch{return function(e=""){const t=/\/mnt\/([a-z])\//.exec(e);if(!t)return e;const n=t[1];return e.replace(`/mnt/${n}/`,`${n.toUpperCase()}:\\`).replace(/\//g,"\\")}(e)}},vc.toWSLPath=_c,vc.getWSLLocalAppDataPath=Bc,Object.defineProperty(Hu,"__esModule",{value:!0});var Pc=Hu.win32=zc=Hu.wsl=Qc=Hu.linux=Hu.darwin=Nc=Hu.darwinFast=void 0;const xc=o,Sc=s,Tc=t,Oc=c,Ic=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},Mc=mc,Rc=vc,Lc=/\r?\n/;var Nc=Hu.darwinFast=function(){const e=[process.env.CHROME_PATH,process.env.LIGHTHOUSE_CHROMIUM_PATH,"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary","/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"];for(const t of e)if(t&&Yc(t))return t;return Hc()[0]};function Hc(){const e=["/Contents/MacOS/Google Chrome Canary","/Contents/MacOS/Google Chrome"],t=[],n=jc();n&&t.push(n),Oc.execSync("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -i 'google chrome\\( canary\\)\\?\\.app' | awk '{$1=\"\"; print $0}'").toString().split(Lc).forEach((n=>{e.forEach((e=>{const r=Sc.join(n.substring(0,n.indexOf(".app")+4).trim(),e);Yc(r)&&-1===t.indexOf(r)&&t.push(r)}))}));const r=Ic(process.env.HOME||Tc.homedir()),i=[{regex:new RegExp(`^${r}/Applications/.*Chrome\\.app`),weight:50},{regex:new RegExp(`^${r}/Applications/.*Chrome Canary\\.app`),weight:51},{regex:/^\/Applications\/.*Chrome.app/,weight:100},{regex:/^\/Applications\/.*Chrome Canary.app/,weight:101},{regex:/^\/Volumes\/.*Chrome.app/,weight:-2},{regex:/^\/Volumes\/.*Chrome Canary.app/,weight:-1}];return process.env.LIGHTHOUSE_CHROMIUM_PATH&&i.unshift({regex:new RegExp(Ic(process.env.LIGHTHOUSE_CHROMIUM_PATH)),weight:150}),process.env.CHROME_PATH&&i.unshift({regex:new RegExp(Ic(process.env.CHROME_PATH)),weight:151}),Gc(t,i)}function jc(){return Yc(process.env.CHROME_PATH)?process.env.CHROME_PATH:Yc(process.env.LIGHTHOUSE_CHROMIUM_PATH)?(Mc.warn("ChromeLauncher","LIGHTHOUSE_CHROMIUM_PATH is deprecated, use CHROME_PATH env variable instead."),process.env.LIGHTHOUSE_CHROMIUM_PATH):void 0}Hu.darwin=Hc;var Qc=Hu.linux=function(){let e=[];const t=jc();if(t&&e.push(t),[Sc.join(Tc.homedir(),".local/share/applications/"),"/usr/share/applications/"].forEach((t=>{e=e.concat(function(e){const t=/(^[^ ]+).*/,n="^Exec=/.*/(google-chrome|chrome|chromium)-.*";let r=[];if(Yc(e)){let i;try{i=Oc.execSync(`grep -ER "${n}" ${e} | awk -F '=' '{print $2}'`,{stdio:"pipe"})}catch(t){i=Oc.execSync(`grep -Er "${n}" ${e} | awk -F '=' '{print $2}'`,{stdio:"pipe"})}i=i.toString().split(Lc).map((e=>e.replace(t,"$1"))),i.forEach((e=>Yc(e)&&r.push(e)))}return r}(t))})),["google-chrome-stable","google-chrome","chromium-browser","chromium"].forEach((t=>{try{const n=Oc.execFileSync("which",[t],{stdio:"pipe"}).toString().split(Lc)[0];Yc(n)&&e.push(n)}catch(e){}})),!e.length)throw new Rc.ChromePathNotSetError;const n=[{regex:/chrome-wrapper$/,weight:51},{regex:/google-chrome-stable$/,weight:50},{regex:/google-chrome$/,weight:49},{regex:/chromium-browser$/,weight:48},{regex:/chromium$/,weight:47}];return process.env.LIGHTHOUSE_CHROMIUM_PATH&&n.unshift({regex:new RegExp(Ic(process.env.LIGHTHOUSE_CHROMIUM_PATH)),weight:100}),process.env.CHROME_PATH&&n.unshift({regex:new RegExp(Ic(process.env.CHROME_PATH)),weight:101}),Gc((r=e.filter(Boolean),Array.from(new Set(r))),n);var r},zc=Hu.wsl=function(){return process.env.LOCALAPPDATA=Rc.getWSLLocalAppDataPath(`${process.env.PATH}`),process.env.PROGRAMFILES=Rc.toWSLPath("C:/Program Files","/mnt/c/Program Files"),process.env["PROGRAMFILES(X86)"]=Rc.toWSLPath("C:/Program Files (x86)","/mnt/c/Program Files (x86)"),Uc()};function Uc(){const e=[],t=[`${Sc.sep}Google${Sc.sep}Chrome SxS${Sc.sep}Application${Sc.sep}chrome.exe`,`${Sc.sep}Google${Sc.sep}Chrome${Sc.sep}Application${Sc.sep