skeptic-cli 0.2.1 → 1.0.1

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 (79) hide show
  1. package/AGENTS.md +20 -53
  2. package/LICENSE +24 -0
  3. package/LICENSES.md +92 -3
  4. package/README.md +25 -49
  5. package/agent-skills/skeptic/SKILL.md +150 -38
  6. package/dist/adb-DUGGW3FV.mjs +2 -0
  7. package/dist/adb-driver-TBOCCKEO.mjs +3 -0
  8. package/dist/adb-session-AVVXL3QQ.mjs +2 -0
  9. package/dist/add-G7JFXU4S.mjs +67 -0
  10. package/dist/audit-ID2BSVYC.mjs +7 -0
  11. package/dist/auto-spawn-4TO4DBO6.mjs +2 -0
  12. package/dist/browser-verbs-R7R6PK2G.mjs +21 -0
  13. package/dist/browsers-install-F2ZWEBOX.mjs +3 -0
  14. package/dist/chokidar-KB6GLGX4.mjs +7 -0
  15. package/dist/chunk-2N64R5DC.mjs +457 -0
  16. package/dist/chunk-2VGKPSCR.mjs +8 -0
  17. package/dist/chunk-2VSGDT7T.mjs +7 -0
  18. package/dist/chunk-2YKSIUIN.mjs +3 -0
  19. package/dist/chunk-2ZORFJJP.mjs +11 -0
  20. package/dist/chunk-42J77CYA.mjs +3 -0
  21. package/dist/chunk-6TLKI7UN.mjs +4 -0
  22. package/dist/chunk-6U6H22OR.mjs +3 -0
  23. package/dist/chunk-7BFRKEFV.mjs +160 -0
  24. package/dist/chunk-7ZUWKIDM.mjs +3 -0
  25. package/dist/chunk-AH75LR2T.mjs +3 -0
  26. package/dist/chunk-B26AZRXU.mjs +41 -0
  27. package/dist/chunk-BIGNULF6.mjs +12 -0
  28. package/dist/chunk-COVGJJ47.mjs +3 -0
  29. package/dist/chunk-CWNYWHJ2.mjs +143 -0
  30. package/dist/chunk-EU3OXJX4.mjs +3 -0
  31. package/dist/chunk-EYVJTUBL.mjs +3 -0
  32. package/dist/chunk-G22LGRZ4.mjs +4 -0
  33. package/dist/chunk-I4JX25Y5.mjs +13 -0
  34. package/dist/chunk-IXBYLSGB.mjs +5 -0
  35. package/dist/chunk-IYLF56WL.mjs +3 -0
  36. package/dist/chunk-K65JNLTT.mjs +3 -0
  37. package/dist/chunk-LPJF33QP.mjs +3 -0
  38. package/dist/chunk-MHNEFL35.mjs +3 -0
  39. package/dist/chunk-N3533BCE.mjs +3 -0
  40. package/dist/chunk-NXTEMSUR.mjs +4 -0
  41. package/dist/chunk-OHVNABCL.mjs +10 -0
  42. package/dist/chunk-QICYK6XT.mjs +10 -0
  43. package/dist/chunk-RU7M6UGM.mjs +5 -0
  44. package/dist/chunk-S3M2RTHJ.mjs +7 -0
  45. package/dist/chunk-U3KRIAEU.mjs +3 -0
  46. package/dist/chunk-YB25SMQ2.mjs +141 -0
  47. package/dist/chunk-ZN6MI2TU.mjs +4 -0
  48. package/dist/client-UR65IKYX.mjs +2 -0
  49. package/dist/comment-F734YE5S.mjs +6 -0
  50. package/dist/cookies-X7W5U3VE.mjs +3 -0
  51. package/dist/daemon-7M5HNFD7.mjs +7 -0
  52. package/dist/device-fixture-MJSDIP75.mjs +2 -0
  53. package/dist/devices-NG4P5UPS.mjs +4 -0
  54. package/dist/devtools-N5AYAR54.mjs +12 -0
  55. package/dist/doctor-Q76JEQQI.mjs +4 -0
  56. package/dist/extractor-Y477MBN6.mjs +2 -0
  57. package/dist/html-reporter-7QHIRHEY.mjs +2 -0
  58. package/dist/index.d.ts +87 -120
  59. package/dist/index.mjs +26 -1741
  60. package/dist/init-6RHO2LGR.mjs +15 -0
  61. package/dist/ink-reporter-4EN7CRMK.mjs +3 -0
  62. package/dist/inspect-44KF3IPH.mjs +19 -0
  63. package/dist/ios-tools-WK66CQ7Q.mjs +2 -0
  64. package/dist/json-reporter-SXWPAXRY.mjs +2 -0
  65. package/dist/junit-reporter-5AT3OFWV.mjs +12 -0
  66. package/dist/mail-GTOZFXJ5.mjs +14 -0
  67. package/dist/observe-EDXYWK6C.mjs +3 -0
  68. package/dist/render-MHOBDOSP.mjs +383 -0
  69. package/dist/run-GUWITPL4.mjs +2 -0
  70. package/dist/scaffold-6ZF6K6Y5.mjs +38 -0
  71. package/dist/screenshot-GUJSIRQB.mjs +2 -0
  72. package/dist/session-daemon-cmd-QHVSSKSL.mjs +4 -0
  73. package/dist/simctl-driver-PNUN7W7G.mjs +5 -0
  74. package/dist/skeptic.mjs +3 -1754
  75. package/dist/slack-reporter-EEFO66V6.mjs +8 -0
  76. package/dist/watch-A7ZLUYR2.mjs +3 -0
  77. package/dist/webhook-reporter-BXJGZS2I.mjs +3 -0
  78. package/dist/worker.mjs +3 -724
  79. package/package.json +13 -11
@@ -0,0 +1,8 @@
1
+ import {createRequire}from'node:module';import {a as a$3}from'./chunk-EU3OXJX4.mjs';import {d as d$1}from'./chunk-CWNYWHJ2.mjs';import {c}from'./chunk-6U6H22OR.mjs';import {b}from'./chunk-AH75LR2T.mjs';import {a as a$2,d as d$2}from'./chunk-ZN6MI2TU.mjs';import {a as a$1,d}from'./chunk-MHNEFL35.mjs';import {a}from'./chunk-S3M2RTHJ.mjs';import*as te from'fs';import {existsSync,statSync}from'fs';import*as O from'path';import {resolve}from'path';import {Worker}from'worker_threads';import {fileURLToPath}from'url';import ce from'fast-glob';import*as _ from'os';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var U=class{verbose;concurrency;shardLabel;suppressFinalSummary;buffer=new Map;constructor(e={}){this.verbose=e.verbose??false,this.concurrency=e.concurrency??1,this.shardLabel=e.shardLabel,this.suppressFinalSummary=e.suppressFinalSummary??false;}write(e){console.log(this.shardLabel?`${this.shardLabel} ${e}`:e);}onTestStart(e){if(this.concurrency>1){let t=["",`${a.bold(` ${e.name}`)} ${a.dim(`(${e.file})`)}`];this.buffer.set(e.name,t);}else this.write(""),this.write(`${a.bold(` ${e.name}`)} ${a.dim(`(${e.file})`)}`);}onStepComplete(e,t,n,i){let c=e.status==="passed"?a.green(" \u2713"):e.status==="failed"?a.red(" \u2717"):a.yellow(" \u26A0"),s=a.dim(`(${e.duration_ms}ms)`),l=this.verbose?`${e.command} ${typeof e.args=="string"?e.args:JSON.stringify(e.args)}`:e.command,o=`${c} ${a.dim(`${t+1}/${n}`)} ${l} ${s}`,u=e.error&&(e.status==="failed"||e.status==="error")?a.red(` ${e.error}`):void 0,d=[];e.diffPath&&(e.baselinePath&&d.push(a.dim(` baseline: ${e.baselinePath}`)),e.currentPath&&d.push(a.dim(` current: ${e.currentPath}`)),d.push(a.dim(` diff: ${e.diffPath}`)));let g=e.warnings?.map(m=>a.yellow(` \u26A0 ${m}`))??[];if(this.concurrency>1&&i){let m=this.buffer.get(i.name);if(m){m.push(o),u&&m.push(u);for(let S of d)m.push(S);for(let S of g)m.push(S);}}else {this.write(o),u&&this.write(u);for(let m of d)this.write(m);for(let m of g)this.write(m);}}onTestComplete(e,t){let n=e.status==="passed"?a.bgGreen.black(" PASS "):a.bgRed.white(" FAIL "),i=se(e.metrics),c=e.artifacts?.video?.path,s=e.artifacts?.trace,l=e.artifacts?.accessibilityAudit;if(this.concurrency>1){let o=this.buffer.get(e.name);if(o){o.push(` ${n} ${a.dim(`${e.duration_ms}ms`)}`),c&&o.push(` ${a.dim("Video:")} ${a.cyan(c)}`),s&&o.push(` ${a.dim("Trace:")} ${a.cyan(s)}`),l&&o.push(` ${a.dim("Audit:")} ${a.cyan(l)}`),i&&o.push(i);for(let u of o)this.write(u);this.buffer.delete(e.name);}}else this.write(` ${n} ${a.dim(`${e.duration_ms}ms`)}`),c&&this.write(` ${a.dim("Video:")} ${a.cyan(c)}`),s&&this.write(` ${a.dim("Trace:")} ${a.cyan(s)}`),l&&this.write(` ${a.dim("Audit:")} ${a.cyan(l)}`),i&&this.write(i);}onRunComplete(e){if(this.suppressFinalSummary)return;this.write(""),this.write(a.bold(` ${a$1} Results`)),this.write(a.dim(" \u2500".repeat(20)));let t=[];e.passed>0&&t.push(a.green(`${e.passed} passed`)),e.failed>0&&t.push(a.red(`${e.failed} failed`)),t.push(`${e.total} total`),this.write(` ${t.join(a.dim(", "))}`),this.write(` ${a.dim(`Duration: ${ie(e.duration_ms)}`)}`),this.write("");}};function ie(r){return r<1e3?`${Math.round(r)}ms`:`${(r/1e3).toFixed(2)}s`}function j(r){return r>=1e3?`${(r/1e3).toFixed(2)}s`:`${Math.round(r)}ms`}function se(r){if(!r)return null;let e=[],t=r.performance;if(t){let o=[];t.fcp!==null&&o.push(`FCP ${j(t.fcp)}`),t.lcp!==null&&o.push(`LCP ${j(t.lcp)}`),t.cls!==null&&o.push(`CLS ${t.cls.toFixed(3)}`),t.inp!==null&&o.push(`INP ${j(t.inp)}`),t.ttfb!==null&&o.push(`TTFB ${j(t.ttfb)}`),o.length>0&&e.push(`perf: ${o.join(", ")}`);}let n=r.network;if(n&&n.issues){let o=n.issues.failedRequests.length+n.issues.networkFailures.length+n.issues.duplicates.length+n.issues.mixedContent.length+n.issues.corsErrors.length;e.push(`net: ${n.requests.length} reqs${o>0?`, ${o} issues`:""}`);}let i=r.accessibility;i&&e.push(`a11y: ${i.summary.violations} violations`);let c=r.mobilePerformance;c?.frames&&e.push(`perf: ${c.frames.totalFrames} frames (${c.frames.jankyPercent}% janky, p90 ${c.frames.percentiles.p90}ms)`);let s=r.mobileAccessibility;s&&e.push(`a11y: ${s.summary.issues} issues`);let l=r.mobileNetwork;return l?.totals&&e.push(`net: ${(l.totals.rxBytes/1024/1024).toFixed(1)}MB in (degraded)`),e.length===0?null:` ${a.dim("Metrics:")} ${a.dim(e.join(" \xB7 "))}`}var ue=async(r,e=process.cwd())=>{let t=Array.isArray(r)?r:[r],n=new Set,i=[];for(let s of t){let l=resolve(e,s);try{if(existsSync(l)&&statSync(l).isFile()){n.add(resolve(l));continue}}catch{}i.push(s.replace(/\\/g,"/"));}let c=i.length===0?[]:await ce(i,{cwd:e,absolute:true,onlyFiles:true,dot:false});for(let s of c)n.add(resolve(s));return [...n].sort()},fe=()=>{let r=new URL("./worker.mjs",import.meta.url);try{if(existsSync(fileURLToPath(r)))return r}catch{}return new URL("./worker.ts",import.meta.url)},G=async r=>{let e=await ue(r.patterns,r.cwd);return await Promise.all(e.map(n=>de(n)))},de=async r=>new Promise(e=>{let t;try{t=fe();}catch(s){e({file:r,fileUse:{},hookCount:{beforeEach:0,afterEach:0},tests:[],error:{message:s instanceof Error?s.message:String(s)}});return}let n=new Worker(t,{workerData:{mode:"discover",file:r},stderr:false,stdout:false}),i=null,c=null;n.on("message",s=>{s.type==="manifest"&&s.manifest&&(i=s.manifest),s.type==="error"&&s.error&&(c=s.error);}),n.on("error",s=>{c={message:s.message,stack:s.stack??""};}),n.on("exit",()=>{if(i){e(i);return}e({file:r,fileUse:{},hookCount:{beforeEach:0,afterEach:0},tests:[],error:c??{message:"discovery worker exited without manifest"}});});});var ge=2e3,F=(r,e)=>{try{e();}catch(t){process.stderr.write(`[skeptic] reporter ${r} threw: ${t instanceof Error?t.message:String(t)}
4
+ `);}},be=async(r,e)=>{try{await e();}catch(t){process.stderr.write(`[skeptic] reporter ${r} threw: ${t instanceof Error?t.message:String(t)}
5
+ `);}},ye=()=>{let r=new URL("./worker.mjs",import.meta.url);try{if(existsSync(fileURLToPath(r)))return r}catch{}return new URL("./worker.ts",import.meta.url)},we=r=>r.map(e=>e.id),Y=r=>({name:r.name,file:r.file,testIndex:r.ordinal}),ke=(r,e)=>r?.use.hardTimeout??e,ve=()=>{try{if(typeof _.availableParallelism=="function")return _.availableParallelism()}catch{}let r=_.cpus?.().length??1;return r>0?r:1},Re=(r,e)=>{if(r.bail||e<=1)return 1;let t=r.concurrency;if(t!==void 0&&t>=1)return Math.min(Math.max(1,Math.floor(t)),e);let n=Math.max(1,Math.ceil(ve()/2));return Math.min(n,e)},B=async(r,e,t)=>{let n=we(e),i=t.workerEntry??ye(),c=new Worker(i,{stderr:false,stdout:false}),s=[],l=new Set,o=new Map(e.map(R=>[R.id,R])),u=new Map,d=t.killGraceMs??ge,g=t.signal,m=false,S,E,M=null,T=false,C=(R=t.config.hardTimeout)=>{E&&clearTimeout(E),E=setTimeout(()=>{m=true,S=R,c.terminate().catch(()=>{process.stderr.write(`[skeptic] worker.terminate() rejected for ${r}
6
+ `);});},R+d);};return new Promise(R=>{let $=false,A=()=>{$=true,c.terminate().catch(()=>{});};g&&(g.aborted?A():g.addEventListener("abort",A,{once:true})),C(),c.on("message",f=>{switch(f.type){case "ready":{let p={type:"start",file:r,allowlist:n,config:t.config};c.postMessage(p);return}case "test:start":{let p=e.find(b=>b.id===f.testId),y={name:f.name,file:f.file,testIndex:f.ordinal};for(let b of t.reporters)F("onTestStart",()=>b.onTestStart(y));C(ke(p,t.config.hardTimeout));return}case "test:action":{let p=o.get(f.testId);if(!p)return;let y=Y(p),b=u.get(f.testId)??0;if(f.status==="started"){let k=b,P=k+1;u.set(f.testId,P);for(let x of t.reporters)F("onStepStart",()=>x.onStepStart?.({command:f.label,args:{}},k,P,y));return}let w=b>0?b-1:0,v=Math.max(b,w+1);u.set(f.testId,v);let I={command:f.label,args:{},status:f.status==="completed"?"passed":"failed",duration_ms:f.durationMs??0,...f.error!==void 0?{error:f.error}:{}};for(let k of t.reporters)F("onStepComplete",()=>k.onStepComplete(I,w,v,y));return}case "test:complete":{l.add(f.testId),s.push(f.result);let p={name:f.result.name,file:f.result.file,testIndex:f.ordinal};for(let y of t.reporters)F("onTestComplete",()=>y.onTestComplete(f.result,p));C(),t.bail&&f.result.status!=="passed"&&(T=true,c.terminate().catch(()=>{}));return}case "step:complete":{let p=o.get(f.testId),y=p?Y(p):{name:"(step)",file:r,testIndex:0};for(let b of t.reporters)F("onStepComplete",()=>b.onStepComplete(f.step,f.index,f.total,y));return}case "log":return;case "fatal":{let p={name:r,file:r,status:"error",duration_ms:0,steps:[{command:"spec:import",args:{file:r},status:"error",duration_ms:0,error:f.message}],artifacts:{}};s.push(p);return}case "file:complete":return}}),c.on("error",f=>{M=f,process.stderr.write(`[skeptic] worker error for ${r}: ${f.message}
7
+ `);}),c.on("exit",f=>{g&&g.removeEventListener("abort",A),E&&clearTimeout(E);let p=e.filter(b=>!l.has(b.id)),y=!m&&!T&&!$&&p.length>0&&(M!==null||f!==0);R({file:r,results:s,remaining:p,workerTerminated:m||y,...S!==void 0?{killTimeoutMs:S}:{},requeueAttempted:false,crashed:y,...M?{crashError:M.message}:{},aborted:$});});})},Se=async(r,e,t)=>e.length===0?{file:r,results:[],remaining:[],workerTerminated:false,requeueAttempted:true}:{...await B(r,e,t),requeueAttempted:true},N=(r,e,t)=>({name:e.name,file:r,status:"error",duration_ms:0,steps:[{command:"test",args:{name:e.name},status:"error",duration_ms:0,error:t}],artifacts:{}}),Q=async(r,e,t)=>{if(e.length===0)return [];let n=await B(r,e,t),i=[...n.results],c=t.config.retries;if(c>0&&!n.workerTerminated&&!n.aborted){let s=e.filter(l=>{let o=i.find(u=>u.file===l.file&&u.name===l.name);return o&&o.status!=="passed"});for(let l of s)for(let o=1;o<=c;o++){let d=(await B(l.file,[l],t)).results.find(m=>m.file===l.file&&m.name===l.name);if(!d)break;d.steps[0]&&(d.steps[0].warnings??=[],d.steps[0].warnings.push(`retry attempt ${o}/${c}`));let g=i.findIndex(m=>m.file===l.file&&m.name===l.name);if(g>=0&&(i[g]=d),d.status==="passed"){d.flaky=true;break}}}if(n.crashed)for(let s of n.remaining)i.push(N(r,s,`worker crashed before this test completed${n.crashError?`: ${n.crashError}`:""}`));else if(n.workerTerminated&&n.remaining.length>0){let s=n.remaining[0];i.push(N(r,s,`test killed worker (${n.killTimeoutMs??t.config.hardTimeout}ms hard ceiling)`));let l=n.remaining.slice(1);if(l.length>0){let o=await Se(r,l,t);if(i.push(...o.results),o.workerTerminated&&o.remaining.length>0){let u=o.remaining[0];i.push(N(r,u,"test killed worker twice"));for(let d of o.remaining.slice(1))i.push(N(r,d,"skipped due to upstream worker kill"));}}}return i},$e=async(r,e,t)=>{let n=new Array(r.length),i=0,c=async()=>{for(;;){if(e.signal?.aborted)return;let l=i;i+=1;let o=r[l];if(!o)return;let[u,d]=o;n[l]=await Q(u,d,e);}},s=Math.min(Math.max(1,t),r.length);return await Promise.all(Array.from({length:s},()=>c())),n.flat()},Z=async r=>{let e=performance.now(),t=[],n=[...r.partition.values()].flat(),i={tests:n.map(o=>({name:o.name,file:o.file,stepCount:0,testIndex:o.ordinal})),totalTests:n.length};for(let o of r.reporters)F("onRunStart",()=>o.onRunStart?.(i));let c=[...r.partition.entries()].filter(([,o])=>o.length>0),s=Re(r,c.length);if(s>1&&c.length>1)t.push(...await $e(c,r,s));else for(let[o,u]of c){if(r.signal?.aborted)break;let d=await Q(o,u,r);if(t.push(...d),r.bail&&t.some(g=>g.status!=="passed"))break}let l={total:t.length,passed:t.filter(o=>o.status==="passed"&&!o.skipped).length,failed:t.filter(o=>o.status!=="passed").length,skipped:t.filter(o=>o.skipped===true).length,duration_ms:Math.round(performance.now()-e),tests:t};return await Promise.all(r.reporters.map(o=>be("onRunComplete",()=>o.onRunComplete(l)))),{results:t,summary:l}};var ee=(r,e,t)=>{if(e<1)throw new Error(`partitionTests: shardCount must be >= 1, got ${e}`);let n=Array.from({length:e},()=>[]);for(let i=0;i<r.length;i++)n[i%e].push(r[i]);return n};var Te=(r,e)=>{if(!e||e.length===0)return true;let t=r.use.tags??[];return e.some(n=>t.includes(n))},xe=(r,e)=>!e||e.length===0?true:e.some(t=>r.name.includes(t)),Ee=r=>{let e=r.filter(t=>t.only);return e.length>0?e:r},Me=(r,e,t)=>Ee(r.filter(n=>Te(n,e)&&xe(n,t))),Ie=(r,e)=>{if(e.shardSplit){let{count:t,index:n}=e.shardSplit;return t<=1?r:ee(r,t)[n-1]??[]}return r},Pe=r=>{let e=new Map;for(let t of r){let n=e.get(t.file)??[];n.push(t),e.set(t.file,n);}for(let t of e.values())t.sort((n,i)=>n.ordinal-i.ordinal);return e},q=async r=>{let e=await G({patterns:r.patterns,cwd:r.cwd}),t=e.flatMap(u=>u.error?[{id:`${u.file}#discovery-error`,file:u.file,ordinal:0,name:`discovery error: ${u.file}`,skip:false,only:false,use:{}}]:u.tests),n=Me(t,r.tagFilter,r.nameFilter),i=Ie(n,r),c=Pe(i),s=new Map;for(let u of e)s.set(u.file,u);if(r.listOnly)return {manifests:e,discoveredCount:n.length,results:[],summary:{total:n.length,passed:0,failed:0,skipped:0,duration_ms:0,tests:[]}};let l={config:r.config,reporters:r.reporters,partition:c,bail:r.bail??false,...r.config.parallel!==void 0?{concurrency:r.config.parallel}:{},...r.signal!==void 0?{signal:r.signal}:{},...r.workerEntry!==void 0?{workerEntry:r.workerEntry}:{},...r.killGraceMs!==void 0?{killGraceMs:r.killGraceMs}:{}};return {...await Z(l),manifests:e,discoveredCount:n.length}},re=async(r,e)=>({manifests:await G({patterns:r,cwd:process.cwd()})});var Ce=r=>{let e=/^(\d+)[xX](\d+)$/.exec(r);if(!e)throw new Error(`--video-size: expected "<width>x<height>" (e.g. 1920x1080), got "${r}"`);let t=Number(e[1]),n=Number(e[2]),i=3840;if(!Number.isInteger(t)||!Number.isInteger(n))throw new Error(`--video-size: dimensions must be integers, got "${r}"`);if(t<1||n<1||t>i||n>i)throw new Error(`--video-size: width and height must be within [1, ${i}], got ${t}x${n}`);return {width:t,height:n}},Ae=(r,e,t)=>{let n=r.observability??false,c$1=(r.observabilityWriteSidecars??false)||n&&e.observability.defaultsForReports!=="none",s=r.device??e.browser.device,l=s?c(s):void 0,o=l?{width:l.width,height:l.height}:e.browser.viewport,u={timeout:r.timeout??e.browser.timeout,hardTimeout:r.hardTimeout??e.browser.timeout,outputDir:r.output??e.output.dir??d,envOverrides:t,observability:{forceAll:n,consoleRedaction:e.observability.consoleRedaction??true,networkCaptureLimit:e.observability.networkCaptureLimit,duplicateWindowMs:e.observability.duplicateWindowMs,consoleCaptureLimit:e.observability.consoleCaptureLimit??200,accessibilityDualEngine:n||e.observability.accessibilityDualEngine,accessibilityHtmlSnippetLimit:e.observability.accessibilityHtmlSnippetLimit,accessibilityStandard:e.observability.accessibilityStandard??"WCAG21AA",autoAccessibilityAudit:n||(e.observability.autoAccessibilityAudit??false),accessibilityMaxRulesPerImpact:e.observability.accessibilityMaxRulesPerImpact??100},artifact:{fullPageScreenshots:r.fullPageScreenshot??n??e.observability.fullPageScreenshots,blankFrameDetection:r.blankFrameDetection??(n?"fail":e.observability.blankFrameDetection??"warn"),writeSidecars:c$1},screenshotOnFailure:e.execution.screenshotOnFailure,video:r.video??false,trace:r.trace??false,har:r.har??false,headed:r.headed??!e.browser.headless,browserEngine:e.browser.engine,viewport:o,retries:r.retries??e.execution.retries};return typeof r.parallel=="number"&&(u.parallel=r.parallel),typeof r.visualSettle=="boolean"&&(u.visualSettle=r.visualSettle),(r.url??e.url)&&(u.baseUrl=r.url??e.url),s&&(u.device=s),r.videoSize&&(u.videoSize=Ce(r.videoSize)),(r.cookies??e.auth.cookies)&&(u.cookies={enabled:r.cookies??e.auth.cookies,...r.cookiesFrom?{browser:r.cookiesFrom}:{}}),r.daemon===false&&(u.noDaemon=true),typeof r.daemonIdleTimeout=="number"&&(u.daemonIdleTimeoutSeconds=r.daemonIdleTimeout),(r.platform==="android"||r.platform==="ios-sim")&&(u.platform=r.platform,r.target&&(u.target=r.target)),u},Fe=(r,e)=>{let t={...e.env};if(r.env)for(let n of r.env){let i=n.indexOf("=");i>0&&(t[n.slice(0,i)]=n.slice(i+1));}return t},Oe=async(r,e,t)=>{let n=[],i,c=new Set;for(let s of r)if(!c.has(s))switch(c.add(s),s){case "console":if(t.useInkTui){let l=await import('./ink-reporter-4EN7CRMK.mjs');i=new l.InkReporter,n.push(i);}else n.push(new U({verbose:t.verbose??false,concurrency:t.concurrency??1}));break;case "json":{let{JsonReporter:l}=await import('./json-reporter-SXWPAXRY.mjs');n.push(new l(e,{silent:t.useInkTui}));break}case "junit":{let{JUnitReporter:l}=await import('./junit-reporter-5AT3OFWV.mjs');n.push(new l(e,{silent:t.useInkTui}));break}case "html":{let{HtmlReporter:l}=await import('./html-reporter-7QHIRHEY.mjs');n.push(new l(e,{silent:t.useInkTui}));break}default:d$2.warn(`Unknown reporter format: ${s}`);}if(n.length===0)if(t.useInkTui){let s=await import('./ink-reporter-4EN7CRMK.mjs');i=new s.InkReporter,n.push(i);}else n.push(new U({verbose:t.verbose??false}));if(t.notifications?.slack){let{SlackReporter:s}=await import('./slack-reporter-EEFO66V6.mjs');n.push(new s(t.notifications.slack,t.runUrl));}if(t.notifications?.webhook){let{WebhookReporter:s}=await import('./webhook-reporter-BXJGZS2I.mjs');n.push(new s(t.notifications.webhook,t.runUrl));}return i?{reporters:n,inkReporter:i}:{reporters:n}},Le=()=>{if(process.env.SKEPTIC_RUN_URL)return process.env.SKEPTIC_RUN_URL;let r=process.env.GITHUB_SERVER_URL,e=process.env.GITHUB_REPOSITORY,t=process.env.GITHUB_RUN_ID;if(r&&e&&t)return `${r}/${e}/actions/runs/${t}`},Ue=(r,e)=>{if(r.tests.filter(n=>{let i=n.artifacts??{};return i.video||i.trace||i.perfTrace||i.accessibilityAudit||i.screenshots&&i.screenshots.length>0}).length!==0){d$2.raw(""),d$2.raw(a.bold(" Artifacts"));for(let[n,i]of [["Report",O.join(e,"report.html")],["JSON",O.join(e,"results.json")],["JUnit",O.join(e,"junit.xml")]])te.existsSync(i)&&d$2.raw(` ${a.dim(n.padEnd(11))} ${a.cyan(i)}`);}},_e=r=>{d$2.raw(""),d$2.raw(a.bold(` ${a$1} Results`)),d$2.raw(a.dim(" "+"-".repeat(40)));let e=[];r.passed>0&&e.push(a.green(`${r.passed} passed`)),r.failed>0&&e.push(a.red(`${r.failed} failed`)),e.push(`${r.total} total`),d$2.raw(` ${e.join(a.dim(", "))}`),d$2.raw(` ${a.dim(`Duration: ${je(r.duration_ms)}`)}`);},je=r=>r<1e3?`${Math.round(r)}ms`:`${(r/1e3).toFixed(2)}s`,Ne=(r,e,t)=>e.watch||e.ci||!e.forceTui||t||process.env.SKEPTIC_DISABLE_INK_TUI==="1"||process.env.TERM==="dumb"||!process.stdout.isTTY||!process.stdin.isTTY?false:r.includes("console"),De=r=>r.includes("console")?r:["console",...r],We=r=>r.includes("json")?r:[...r,"json"],Ge=(r,e,t)=>r?130:e.total===0?t?.active&&t.discoveredTestCount>0?0:1:e.failed>0?1:0,gr=async(r,e)=>{e.verbose&&a$2("debug");let t=a$3(),n=e.ci??t.isCI,i=d$1({configPath:e.config,overrides:{}}),c=Fe(e,i),s=r&&r.length>0?r:i.tests,l=e.output??i.output.dir??d;if(e.list){let{manifests:w}=await re(s),v=0,I=0;for(let k of w){let P=O.relative(process.cwd(),k.file);if(k.error){v+=1,d$2.warn(` ${a.red("\u2717")} ${P} \u2014 ${k.error.message}`);continue}I+=k.tests.length,d$2.raw(` ${a.cyan(P)} (${k.tests.length} test${k.tests.length===1?"":"s"})`);for(let x of k.tests){let ne=x.skip?a.yellow(" [skip]"):x.only?a.green(" [only]"):"";d$2.raw(` ${a.dim(`#${x.ordinal}`)} ${x.name}${ne}`);}}v>0?(d$2.error(`${v} spec file${v===1?"":"s"} failed to load during discovery.`),process.exitCode=1):I===0&&(d$2.error(`No tests found matching ${Array.isArray(s)?s.join(", "):s}`),process.exitCode=1);return}e.shardSplit!==void 0&&e.shardAll!==void 0&&(console.error("--shard-split and --shard-all are mutually exclusive."),process.exit(2));let o=We(e.reporter??i.output.reporters),u=e.forceTui?De(o):o,d$3=Ne(u,e,n),g=Ae(e,i,c);n&&(g.headed=false);let[{reporters:m,inkReporter:S},E]=await Promise.all([Oe(u,l,{verbose:e.verbose??i.output.verbose,concurrency:e.parallel??i.execution.parallel??1,notifications:i.notifications,runUrl:Le(),useInkTui:d$3}),e.platform==="android"||e.platform==="ios-sim"?Promise.resolve(false):b(process.argv,{engine:g.browserEngine,headed:g.headed,cliVersion:"1.0.1",noDaemon:e.daemon===false,...typeof e.daemonIdleTimeout=="number"?{idleTimeoutSeconds:e.daemonIdleTimeout}:{}})]);(e.platform==="android"||e.platform==="ios-sim")&&(g.noDaemon=true),!E&&e.daemon!==false&&(g.noDaemon=true);let M=new AbortController,T=false,C=()=>{T&&process.exit(130),T=true,d$2.warn(`
8
+ Interrupted \u2014 stopping workers and writing partial results\u2026`),M.abort();};process.on("SIGINT",C);let R=e.shardIndex??Number(process.env.SKEPTIC_SHARD_INDEX??""),$=Number.isFinite(R)&&R>0?R:1;(e.shardSplit!==void 0||e.shardAll!==void 0)&&(g.shardId=$);let A={patterns:s,reporters:m,config:g,bail:e.bail??i.execution.bail,signal:M.signal,...e.tag?{tagFilter:e.tag}:{},...e.grep?{nameFilter:[e.grep]}:{},...e.shardSplit!==void 0?{shardSplit:{count:e.shardSplit,index:$}}:{},...e.shardAll!==void 0?{shardAll:{count:e.shardAll,index:$}}:{}},f;if(S){let{renderRunTui:w}=await import('./render-MHOBDOSP.mjs');f=w(S,{onAbort:()=>{f?.unmount(),process.exit(130);},onQuit:()=>{f?.unmount();},alternateScreen:process.env.SKEPTIC_TUI_ALT_SCREEN!=="0"});}else d$2.info(`${a$1} \u2014 running ${a.cyan(Array.isArray(s)?s.join(", "):s)}`);let p=await q(A).finally(()=>{process.removeListener("SIGINT",C);});f&&(T?f.unmount():await f.waitUntilExit(),_e(p.summary)),Ue(p.summary,l);let y=e.shardSplit!==void 0||e.shardAll!==void 0,b$1=p.discoveredCount;if(!T&&p.summary.total===0)if(y&&b$1>0){let w=e.shardSplit??e.shardAll,v=`${b$1} test${b$1===1?"":"s"} total across shards`;w!==void 0&&$>w?d$2.info(`shard index ${$} is out of range for ${w} shard${w===1?"":"s"}; nothing to run (${v}).`):d$2.info(`shard ${$}/${w} has no tests (${v}).`);}else d$2.error(`No tests found matching ${Array.isArray(s)?s.join(", "):s}`);if(process.exitCode=Ge(T,p.summary,{active:y,discoveredTestCount:b$1}),e.watch&&!n&&!T){let{startWatching:w}=await import('./watch-A7ZLUYR2.mjs'),v=Array.isArray(s)?s:[s];d$2.info(a.dim("Watching for changes... (Ctrl+C to exit)"));let I=Promise.resolve(),k=await w({patterns:v,onChange:async P=>{d$2.info(`File changed: ${a.cyan(P)}`),await I,I=q(A).then(x=>{process.exitCode=x.summary.failed>0?1:0;});}});process.on("SIGINT",()=>{k.close(),process.exit(process.exitCode??0);}),await new Promise(()=>{});}};export{U as a,Ce as b,Ae as c,We as d,Ge as e,gr as f};
@@ -0,0 +1,7 @@
1
+ import {createRequire}from'node:module';import*as s from'fs';import*as n from'path';import*as y from'net';import*as x from'os';import*as k from'crypto';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var E=8*1024,f=()=>{let e=process.env.SKEPTIC_DAEMON_DIR;return e&&e.length>0?e:n.join(x.homedir(),".skeptic")},w="\\\\.\\pipe\\",R=e=>e.toLowerCase().startsWith(w.toLowerCase()),P=e=>{if(process.platform!=="win32"||R(e))return e;let r=n.resolve(e),i=n.basename(r).replace(/[^a-zA-Z0-9_.-]/g,"_").slice(0,32)||"daemon",l=k.createHash("sha256").update(r.toLowerCase()).digest("hex").slice(0,32);return `${w}skeptic-${i}-${l}`},T=()=>n.join(f(),"daemon.sock"),A=()=>n.join(f(),"daemon.pid"),O=()=>n.join(f(),"daemon.version"),_=()=>n.join(f(),"daemon.engine"),L=()=>n.join(f(),"daemon.log"),C=()=>n.join(f(),"session.sock"),N=()=>n.join(f(),"session.pid"),j=()=>n.join(f(),"session.version"),B=()=>n.join(f(),"session.engine"),H=e=>n.join(f(),"sessions",e.replace(/[^a-zA-Z0-9_.-]/g,"_")||"default"),I=()=>{let e=f();if(!s.existsSync(e))s.mkdirSync(e,{recursive:true,mode:448});else try{s.chmodSync(e,448);}catch{}return e},q=e=>{let r;try{r=s.lstatSync(e);}catch{return true}if(r.isSymbolicLink()){let i;try{i=s.realpathSync(e);}catch{return false}let l=f(),o;try{o=s.realpathSync(l);}catch{o=l;}if(!i.startsWith(o+n.sep)&&i!==o)return false}try{return s.unlinkSync(e),!0}catch{return false}},$=e=>{let r=process.env.SKEPTIC_DAEMON_AUTH_TOKEN;if(!r||r.length===0)return true;if(typeof e!="string"||e.length===0)return false;let i=Buffer.from(r,"utf8"),l=Buffer.from(e,"utf8");return i.length!==l.length?false:k.timingSafeEqual(i,l)},b=["GET ","POST ","PUT ","DELETE ","PATCH ","HEAD ","OPTIONS ","CONNECT ","TRACE "],D=e=>b.some(r=>e.startsWith(r)),W=async(e,r,i={})=>{let l=i.maxLineBytes??E,o=P(e),m=y.createServer(t=>{let a=Buffer.alloc(0),u=false;t.on("data",S=>{for(a=Buffer.concat([a,S]);;){let p=a.indexOf(10);if(p<0){a.length>l&&(u=true,a=Buffer.alloc(0));break}if(p>l){a=a.subarray(p+1),u=false,h(t,{error:"frame-too-large"});continue}let d=a.subarray(0,p).toString("utf8").trim();if(a=a.subarray(p+1),u){u=false,h(t,{error:"frame-too-large"});continue}if(d.length===0)continue;if(D(d)){t.destroy();return}let g;try{let c=JSON.parse(d);if(!c||typeof c!="object"||typeof c.method!="string"){h(t,{error:"invalid-request"});continue}g=c;}catch(c){h(t,{error:`parse-failed: ${c.message}`});continue}let v={value:false};r(g,{onActivity:()=>i.onAccept?.(),close:()=>{v.value=true;}}).then(c=>{g.id!==void 0&&(c.id=g.id),h(t,c),v.value&&setTimeout(()=>i.onClose?.(),50);}).catch(c=>{h(t,{...g.id!==void 0?{id:g.id}:{},error:`dispatch-failed: ${c instanceof Error?c.message:String(c)}`});});}}),t.on("error",()=>{});});return await new Promise((t,a)=>{m.once("error",a),m.listen(o,()=>{m.removeListener("error",a);try{process.platform==="win32"&&o!==e?s.writeFileSync(e,`${o}
4
+ `,{mode:384}):s.chmodSync(e,384);}catch{}t();});}),{server:m,socketPath:o,close:()=>new Promise(t=>{m.close(()=>{if(process.platform==="win32"&&o!==e)try{s.unlinkSync(e);}catch{}t();});})}},h=(e,r)=>{try{let i=`${JSON.stringify(r)}
5
+ `;e.write(i);}catch{}},J=async(e,r,i=1500)=>new Promise(l=>{let o=y.createConnection(P(e)),m="",t=u=>{o.removeAllListeners(),o.destroy(),l(u);},a=setTimeout(()=>t({ok:false,reason:"probe-timeout"}),i);o.on("connect",()=>{o.write(`${JSON.stringify({method:"daemon.ping",params:r})}
6
+ `);}),o.on("data",u=>{m+=u.toString("utf8");let S=m.indexOf(`
7
+ `);if(S>=0){clearTimeout(a);try{let p=JSON.parse(m.slice(0,S));if(p.error){t({ok:!1,reason:p.error});return}let d=p.result;d&&d.ok===!0?t({ok:!0,result:d}):t({ok:!1,reason:d?.reason??"ping-failed",result:d});}catch(p){t({ok:false,reason:`bad-response: ${p.message}`});}}}),o.on("error",u=>{clearTimeout(a),t({ok:false,reason:u.message});});});export{f as a,P as b,T as c,A as d,O as e,_ as f,L as g,C as h,N as i,j,B as k,H as l,I as m,q as n,$ as o,W as p,J as q};
@@ -0,0 +1,3 @@
1
+ import {createRequire}from'node:module';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ const require$1 = createRequire(import.meta.url);
3
+ var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require$1<"u"?require$1:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require$1<"u"?require$1:b)[c]}):a)(function(a){if(typeof require$1<"u")return require$1.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),o=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:true});},l=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=h(b,d))||f.enumerable});return a};var p=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:true}):c,a));export{m as a,n as b,o as c,p as d};
@@ -0,0 +1,11 @@
1
+ import {createRequire}from'node:module';import {d,c as c$1}from'./chunk-OHVNABCL.mjs';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var c=t=>{if(t.selectorHint&&t.selectorHint.length>0)return t.selectorHint;if(t.kind==="aria"){if(t.name&&t.name.length>0&&t.name.length<60)return `role=${t.role}:${t.name}`;if(t.role==="link"&&t.href){let e=p(t.href);if(e)return `css=a[href*="${e}"]`}return `role=${t.role}`}return "css=*"},p=t=>{try{let e=new URL(t,"http://dummy.invalid");return e.host&&e.host!=="dummy.invalid"?e.host.replace(/^www\./,""):e.pathname.split("/").filter(Boolean).pop()??null}catch{return null}},h=(t,e={})=>{let r=d(t.yaml,t.entries,{interactive:e.interactive??false,compact:e.compact??false,...t.offViewportRefs?{offViewportRefs:t.offViewportRefs}:{}}),a=c$1(r,t.entries),o=new Set([...r.matchAll(/\[ref=(e\d+)\]/g)].map(s=>s[1])),l=t.entries.filter(s=>o.has(s.ref)).map(s=>({ref:s.ref,kind:s.kind,role:s.role,name:s.name,selectorHint:c(s),...s.href?{href:s.href}:{}}));return {yaml:r,refs:l,stats:a}},n=t=>new Intl.NumberFormat("en-US").format(t),u=(t,e={})=>{let r=t.yaml;if(r.endsWith(`
4
+ `)||(r+=`
5
+ `),t.refs.length>0){r+=`
6
+ `;for(let o of t.refs)r+=` ${o.ref} selectorHint: ${o.selectorHint}
7
+ `,o.href&&(r+=` ${o.ref} /url: ${o.href}
8
+ `);}let a=e.portabilityNote??"Stable artifact: copy a selectorHint into your test \u2014 refs are NOT portable across snapshot calls.";return r+=`
9
+ Stats: ${n(t.stats.lines)} lines, ${n(t.stats.characters)} chars, ~${n(t.stats.estimatedTokens)} tokens; ${n(t.stats.renderedRefs)} refs rendered / ${n(t.stats.totalRefs)} captured (${n(t.stats.ariaRefs)} ARIA, ${n(t.stats.cursorInteractiveRefs)} cursor-interactive), ${n(t.stats.interactiveRefs)} interactive.
10
+ ${a}
11
+ `,r};export{c as a,h as b,n as c,u as d};
@@ -0,0 +1,3 @@
1
+ import {createRequire}from'node:module';import {d as d$1}from'./chunk-ZN6MI2TU.mjs';import*as u from'fs';import*as d from'path';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var f=o=>{if(!o)return;let t={},e=o.performance;if(e&&(e.lcp!==null||e.cls!==null||e.inp!==null)){let n=0,i=p=>{p>n&&(n=p);};e.lcp!==null&&i(e.lcp<=2500?0:e.lcp<=4e3?1:2),e.cls!==null&&i(e.cls<=.1?0:e.cls<=.25?1:2),e.inp!==null&&i(e.inp<=200?0:e.inp<=500?1:2),t.perfRating=n===0?"good":n===1?"needs-improvement":"poor";}let s=o.network;s&&(t.networkIssues=s.issues.failedRequests.length+s.issues.networkFailures.length+s.issues.duplicates.length+s.issues.mixedContent.length+s.issues.corsErrors.length);let r=o.accessibility;r&&(t.a11yViolations=r.summary.violations);let l=o.console;return l&&(t.consoleErrors=l.summary.errorCount),Object.keys(t).length>0?t:void 0},c=class{outputDir;silent;constructor(t,e={}){this.outputDir=t,this.silent=e.silent??false;}onTestStart(t){}onStepComplete(t,e,s,r){}onTestComplete(t,e){}onRunComplete(t){u.mkdirSync(this.outputDir,{recursive:true});let e=d.join(this.outputDir,"results.json"),s=t.tests.map(n=>{let i=f(n.metrics);return i!==void 0?{...n,metricsSummary:i}:n}),r={version:"0.3.0",timestamp:new Date().toISOString(),total:t.total,passed:t.passed,failed:t.failed,skipped:t.skipped,duration_ms:t.duration_ms,tests:s},l=process.env.SKEPTIC_JSON_PRETTY==="true";u.writeFileSync(e,JSON.stringify(r,null,l?2:0),"utf-8"),this.silent||d$1.info(`JSON report written to ${e}`);}};export{c as a};
@@ -0,0 +1,4 @@
1
+ import {createRequire}from'node:module';import {d as d$1}from'./chunk-ZN6MI2TU.mjs';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var q=new Set(["token","apikey","api_key","auth","authorization","secret","password","pwd","access_token","refresh_token","bearer","signature","sig","nonce","csrf","key","private_key","session","sessionid","session_id"].map(i=>i.toLowerCase())),E=["signature","credential","security_token","token","secret","key"],k=i=>i.toLowerCase().replace(/-/g,"_"),x=i=>{let t=k(i);if(q.has(t))return true;for(let o of E)if(t.endsWith("_"+o))return true;return false},y=i=>{let t=i.split("&"),o=false;for(let e=0;e<t.length;e++){let s=t[e],r=s.indexOf("="),n=r>=0?s.slice(0,r):s;if(n.length===0)continue;let a;try{a=decodeURIComponent(n);}catch{a=n;}x(a)&&(t[e]=`${n}=***`,o=true);}return {result:t.join("&"),mutated:o}},l=i=>{if(typeof i!="string"||i.length===0||i.startsWith("data:")||i.startsWith("blob:"))return i;let t=i.indexOf("#"),o=t>=0?i.slice(0,t):i,e=t>=0?i.slice(t+1):"",s=o.indexOf("?"),r=e.includes("=");if(s<0&&!r)return i;let n=false,a=o;if(s>=0){let c=o.slice(0,s),h=o.slice(s+1);if(h.length>0){let u=y(h);u.mutated&&(a=`${c}?${u.result}`,n=true);}}let p=t>=0?`#${e}`:"";if(r){let c=y(e);c.mutated&&(p=`#${c.result}`,n=true);}return n?`${a}${p}`:i},C=4*1024,m="[REDACTED]",N=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,b=/\bBearer\s+[A-Za-z0-9._\-+/=]{16,}\b/gi,T=["password","passwd","api[_-]?key","secret","token","access[_-]?token","refresh[_-]?token","private[_-]?key","session[_-]?id"],_=new RegExp(String.raw`(["']?)\b(${T.join("|")})\b\1(\s*[:=]\s*)(["']?)([^\s"'&,;}]+)\4`,"gi"),v=/\b[\w.+-]+@([\w-]+\.[\w.-]+)\b/g,D=/(https?:\/\/[^\s'")]+)/g,d=i=>{if(typeof i!="string"||i.length===0)return i;let t=i;return t=t.replace(N,m),t=t.replace(b,`Bearer ${m}`),t=t.replace(_,(o,e,s,r,n)=>`${e}${s}${e}${r}${n}${m}${n}`),t=t.replace(v,(o,e)=>`[EMAIL]@${e}`),t=t.replace(D,o=>l(o)),t.length>C&&(t=t.slice(0,C)+"\u2026"),t};var w=class{name="network";page=null;requests=[];entryByRequest=new Map;options;onRequest;onResponse;onRequestFailed;onRequestFinished;constructor(t){this.options=t;}async attach(t,o){this.page=t,this.onRequest=e=>{if(this.options.captureLimit>0&&this.requests.length>=this.options.captureLimit)return;let s;try{let n=e.frame().url();s=l(n);}catch{s=void 0;}let r={url:l(e.url()),method:e.method(),resourceType:e.resourceType(),timestamp:Date.now(),frameUrl:s};this.requests.push(r),this.entryByRequest.set(e,r);},this.onResponse=e=>{let s=this.entryByRequest.get(e.request());s&&(s.status=e.status());},this.onRequestFailed=e=>{let s=this.entryByRequest.get(e);s&&(s.failure=e.failure()?.errorText??"unknown failure");},this.onRequestFinished=e=>{let s=this.entryByRequest.get(e);if(s)try{let r=e.timing().responseEnd;s.duration=r>=0?Math.round(r):void 0;}catch{}},t.on("request",this.onRequest),t.on("response",this.onResponse),t.on("requestfailed",this.onRequestFailed),t.on("requestfinished",this.onRequestFinished);}async snapshot(){let t=this.requests.slice(),o=this.computeIssues();return {requests:t,issues:o,summary:this.computeSummary(t,o)}}async detach(){this.page&&(this.onRequest&&this.page.off("request",this.onRequest),this.onResponse&&this.page.off("response",this.onResponse),this.onRequestFailed&&this.page.off("requestfailed",this.onRequestFailed),this.onRequestFinished&&this.page.off("requestfinished",this.onRequestFinished)),d$1.debug(`[net] detach \u2014 captured ${this.requests.length} request(s)`),this.page=null,this.entryByRequest.clear();}computeIssues(){let t=[],o=[];for(let e of this.requests){if(e.status!==void 0&&e.status>=400&&e.status<600){t.push({url:e.url,method:e.method,status:e.status});continue}if(e.status===void 0&&e.failure!==void 0){let s=e.failure.toLowerCase();!s.includes("cors")&&!s.includes("access-control")&&o.push({url:e.url,method:e.method,reason:e.failure});}}return {failedRequests:t,networkFailures:o,duplicates:this.findDuplicates(),mixedContent:this.findMixedContent(),corsErrors:this.findCorsErrors()}}computeSummary(t,o){let e={},s={},r={};for(let u of t)if(e[u.resourceType]=(e[u.resourceType]??0)+1,s[u.method]=(s[u.method]??0)+1,u.status!==void 0){let g=String(u.status);r[g]=(r[g]??0)+1;}let n=o.failedRequests.length,a=o.networkFailures.length,p=o.duplicates.length,c=o.mixedContent.length,h=o.corsErrors.length;return {requestCount:t.length,failedRequestCount:n,networkFailureCount:a,duplicateGroupCount:p,mixedContentCount:c,corsErrorCount:h,issueCount:n+a+p+c+h,captureLimit:this.options.captureLimit,truncated:this.options.captureLimit>0&&t.length>=this.options.captureLimit,resourceTypes:e,methods:s,statusCodes:r}}findDuplicates(){let t=new Map;for(let e of this.requests){let s=`${e.method}:${e.url}`,r=t.get(s);r||(r=[],t.set(s,r)),r.push(e);}let o=[];for(let e of t.values()){if(e.length<2)continue;e.sort((r,n)=>r.timestamp-n.timestamp);let s=1;for(let r=1;r<e.length;r++){let n=e[r-1];e[r].timestamp-n.timestamp<this.options.duplicateWindowMs?s++:(s>=2&&o.push({method:e[0].method,url:e[0].url,count:s,windowMs:this.options.duplicateWindowMs}),s=1);}s>=2&&o.push({method:e[0].method,url:e[0].url,count:s,windowMs:this.options.duplicateWindowMs});}return o}findMixedContent(){let t=[];for(let o of this.requests)!o.frameUrl||!o.frameUrl.startsWith("https://")||o.url.startsWith("data:")||o.url.startsWith("blob:")||o.url.startsWith("http://")&&t.push(o.url);return t}findCorsErrors(){let t=[];for(let o of this.requests){if(!o.failure)continue;let e=o.failure.toLowerCase();(e.includes("cors")||e.includes("access-control"))&&t.push({url:o.url,method:o.method,reason:o.failure});}return t}};var R=class{name="console";page=null;messages=[];options;onConsole;onPageError;onDialog;onCrash;constructor(t){this.options=t;}async attach(t,o){this.page=t,this.onConsole=e=>{if(this.messages.length>=this.options.captureLimit)return;let s=e.text(),r=this.options.redact?d(s):s,n;try{let a=e.location();a&&a.url&&(n={url:this.options.redact?l(a.url):a.url,lineNumber:a.lineNumber,columnNumber:a.columnNumber});}catch{}this.messages.push({type:e.type(),text:r,...n?{location:n}:{},timestamp:Date.now()});},this.onPageError=e=>{if(this.messages.length>=this.options.captureLimit)return;let s=`Uncaught ${e.stack||`${e.name}: ${e.message}`}`;this.messages.push({type:"error",text:this.options.redact?d(s):s,timestamp:Date.now()});},this.onDialog=e=>{let s=e.type();if(this.messages.length<this.options.captureLimit){let n=e.defaultValue(),a=`Dialog (${s}): ${e.message()}${n?` [default: ${n}]`:""}`;this.messages.push({type:"warning",kind:"dialog",text:this.options.redact?d(a):a,dialog:{type:s,...n?{defaultValue:this.options.redact?d(n):n}:{}},timestamp:Date.now()});}(s==="beforeunload"?e.accept():e.dismiss()).catch(()=>{});},this.onCrash=()=>{this.messages.length>=this.options.captureLimit||this.messages.push({type:"error",kind:"crash",text:"Renderer process crashed (page crash event) \u2014 the page became unresponsive",timestamp:Date.now()});},t.on("console",this.onConsole),t.on("pageerror",this.onPageError),t.on("dialog",this.onDialog),t.on("crash",this.onCrash);}async snapshot(){let t=0,o=0,e=0;for(let s of this.messages)s.type==="error"?t++:s.type==="warning"?o++:(s.type==="info"||s.type==="log")&&e++;return {messages:this.messages.slice(),summary:{total:this.messages.length,errorCount:t,warningCount:o,infoCount:e,redactionDisabled:!this.options.redact}}}async detach(){this.page&&this.onConsole&&this.page.off("console",this.onConsole),this.page&&this.onPageError&&this.page.off("pageerror",this.onPageError),this.page&&this.onDialog&&this.page.off("dialog",this.onDialog),this.page&&this.onCrash&&this.page.off("crash",this.onCrash),d$1.debug(`[console] detach \u2014 captured ${this.messages.length} message(s)`),this.page=null;}};
4
+ export{l as a,w as b,R as c};
@@ -0,0 +1,3 @@
1
+ import {createRequire}from'node:module';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var e="Mozilla/5.0 (iPhone; CPU iPhone OS 18_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Mobile/15E148 Safari/604.1",o="Mozilla/5.0 (iPad; CPU OS 18_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Mobile/15E148 Safari/604.1",t={desktop_1080p:{label:"Desktop 1080p",category:"desktop",width:1920,height:1080,dpr:1,userAgent:null},desktop_1440p:{label:"Desktop 1440p",category:"desktop",width:2560,height:1440,dpr:1,userAgent:null},macbook_pro_14:{label:'MacBook Pro 14"',category:"desktop",width:1512,height:982,dpr:2,userAgent:null},iphone_16_pro_max:{label:"iPhone 16 Pro Max",category:"phone",width:440,height:956,dpr:3,userAgent:e},iphone_16_pro:{label:"iPhone 16 Pro",category:"phone",width:402,height:874,dpr:3,userAgent:e},iphone_16:{label:"iPhone 16",category:"phone",width:390,height:844,dpr:3,userAgent:e},iphone_15_pro_max:{label:"iPhone 15 Pro Max",category:"phone",width:430,height:932,dpr:3,userAgent:e},iphone_se_3:{label:"iPhone SE (3rd gen)",category:"phone",width:375,height:667,dpr:2,userAgent:e},galaxy_s25_ultra:{label:"Samsung Galaxy S25 Ultra",category:"phone",width:412,height:891,dpr:3.5,userAgent:"Mozilla/5.0 (Linux; Android 15; SM-S938B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36"},galaxy_s25:{label:"Samsung Galaxy S25",category:"phone",width:360,height:780,dpr:3,userAgent:"Mozilla/5.0 (Linux; Android 15; SM-S931B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36"},pixel_9_pro_xl:{label:"Google Pixel 9 Pro XL",category:"phone",width:414,height:921,dpr:3.25,userAgent:"Mozilla/5.0 (Linux; Android 15; Pixel 9 Pro XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36"},pixel_9:{label:"Google Pixel 9",category:"phone",width:412,height:892,dpr:2.625,userAgent:"Mozilla/5.0 (Linux; Android 15; Pixel 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36"},ipad_pro_13_m4:{label:'iPad Pro 13" (M4)',category:"tablet",width:1032,height:1376,dpr:2,userAgent:o},ipad_pro_11_m4:{label:'iPad Pro 11" (M4)',category:"tablet",width:834,height:1210,dpr:2,userAgent:o},ipad_air_13_m3:{label:'iPad Air 13" (M3)',category:"tablet",width:1024,height:1366,dpr:2,userAgent:o},galaxy_tab_s10_ultra:{label:"Samsung Galaxy Tab S10 Ultra",category:"tablet",width:906,height:1422,dpr:2,userAgent:"Mozilla/5.0 (Linux; Android 15; SM-X920) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"}},n=Object.keys(t);function h(i){return t[i]}function p(i){let r={};for(let[a,l]of Object.entries(t))l.category===i&&(r[a]=l);return r}export{t as a,n as b,h as c,p as d};
@@ -0,0 +1,160 @@
1
+ import {createRequire}from'node:module';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var y=`(function () {
4
+ if (typeof window === "undefined" || window.__skeptic_selector) return;
5
+
6
+ function getRole(el) {
7
+ var explicit = el.getAttribute && el.getAttribute("role");
8
+ if (explicit) return explicit;
9
+ var tag = el.tagName ? el.tagName.toLowerCase() : "";
10
+ if (tag === "a" && el.hasAttribute("href")) return "link";
11
+ if (tag === "button") return "button";
12
+ if (tag === "input") {
13
+ var type = (el.getAttribute("type") || "text").toLowerCase();
14
+ if (type === "checkbox") return "checkbox";
15
+ if (type === "radio") return "radio";
16
+ if (type === "submit" || type === "button") return "button";
17
+ return "textbox";
18
+ }
19
+ if (tag === "textarea") return "textbox";
20
+ if (tag === "select") return "combobox";
21
+ if (tag === "h1" || tag === "h2" || tag === "h3" || tag === "h4" || tag === "h5" || tag === "h6") return "heading";
22
+ if (tag === "img") return "img";
23
+ if (tag === "nav") return "navigation";
24
+ return null;
25
+ }
26
+
27
+ function getAccessibleName(el) {
28
+ var aria = el.getAttribute && el.getAttribute("aria-label");
29
+ if (aria && aria.trim()) return aria.trim();
30
+ var labelledby = el.getAttribute && el.getAttribute("aria-labelledby");
31
+ if (labelledby) {
32
+ var ref = document.getElementById(labelledby);
33
+ if (ref && ref.textContent) return ref.textContent.trim();
34
+ }
35
+ var alt = el.getAttribute && el.getAttribute("alt");
36
+ if (alt && alt.trim()) return alt.trim();
37
+ var title = el.getAttribute && el.getAttribute("title");
38
+ if (title && title.trim()) return title.trim();
39
+ var text = (el.textContent || "").trim();
40
+ if (text.length > 0 && text.length < 80) return text;
41
+ return null;
42
+ }
43
+
44
+ function escapeCssIdent(value) {
45
+ if (typeof CSS !== "undefined" && CSS.escape) return CSS.escape(value);
46
+ return value.replace(/([^a-zA-Z0-9_-])/g, "\\\\$1");
47
+ }
48
+
49
+ function cssPath(el) {
50
+ if (!el || el.nodeType !== 1) return null;
51
+ if (el.id) return "#" + escapeCssIdent(el.id);
52
+
53
+ var path = [];
54
+ var current = el;
55
+ var depth = 0;
56
+ while (current && current.nodeType === 1 && depth < 8) {
57
+ var segment = current.tagName.toLowerCase();
58
+ var classList = current.classList ? Array.from(current.classList) : [];
59
+ var stableClass = classList.find(function (c) {
60
+ // Filter out auto-generated/utility classes (heuristic).
61
+ return c.length > 0 && c.length < 40 && !/^[a-zA-Z]*-?\\d+$/.test(c);
62
+ });
63
+ if (stableClass) segment += "." + escapeCssIdent(stableClass);
64
+
65
+ var parent = current.parentElement;
66
+ if (parent) {
67
+ var siblings = Array.prototype.filter.call(parent.children, function (s) {
68
+ return s.tagName === current.tagName;
69
+ });
70
+ if (siblings.length > 1) {
71
+ var index = siblings.indexOf(current) + 1;
72
+ segment += ":nth-of-type(" + index + ")";
73
+ }
74
+ }
75
+
76
+ path.unshift(segment);
77
+ if (current.id) {
78
+ path[0] = "#" + escapeCssIdent(current.id);
79
+ break;
80
+ }
81
+ current = current.parentElement;
82
+ depth++;
83
+ }
84
+ return path.join(" > ");
85
+ }
86
+
87
+ window.__skeptic_selector = function (el) {
88
+ if (!el) return "";
89
+
90
+ var testid = el.getAttribute && el.getAttribute("data-testid");
91
+ if (testid) return "testid=" + testid;
92
+
93
+ var role = getRole(el);
94
+ var name = getAccessibleName(el);
95
+ if (role && name && name.length < 60) return "role=" + role + ":" + name;
96
+ if (role && role !== "generic") return "role=" + role;
97
+
98
+ var text = (el.textContent || "").trim();
99
+ if (text && text.length > 0 && text.length < 60) return text;
100
+
101
+ var css = cssPath(el);
102
+ if (css) return "css=" + css;
103
+ return "css=" + el.tagName.toLowerCase();
104
+ };
105
+ })();`,g=new WeakSet,b=async e=>{g.has(e)||(await e.addScriptTag({content:y}),g.add(e));};var v=256,A=100,C=50,R=/-\s+(\w+)(?:\s+"((?:[^"\\]|\\.)*)")?(?:\s+\[(?!ref=)[^\]]*\])*\s+\[ref=(e\d+)\]/,E=()=>{let e=process.env.SKEPTIC_ARIA_SNAPSHOT_LIMIT_KB,t=e?Number.parseInt(e,10):NaN;return (Number.isFinite(t)&&t>0?t:v)*1024};async function M(e,t,i){let r=await e.locator(t).first().ariaSnapshot({mode:"ai"}),n=E(),o=Buffer.byteLength(r,"utf8")>n;o&&console.warn(`[ariaSnapshot] captured YAML exceeds ${n} bytes \u2014 registry truncated. Tunable via SKEPTIC_ARIA_SNAPSHOT_LIMIT_KB.`);let s=S(r,t,n),l;if(i.viewport&&(l=await k(e,s)),i.extractLinkHrefs&&await P(e,s),i.includeCursorInteractive){let a=await I(e,t,s);for(let c of a)s.push(c);}return {yaml:r,entries:s,truncated:o,offViewportRefs:l}}function S(e,t,i){let r=new Map,n=[],o=0,s=e.split(`
106
+ `);for(let l of s){if(o+=Buffer.byteLength(l,"utf8")+1,o>i)break;let a=R.exec(l);if(!a)continue;let c=a[1],h=a[2]??"",m=a[3],u=`${c} ${h}`,f=r.get(u)??0;r.set(u,f+1),n.push({ref:m,kind:"aria",role:c,name:h,nth:f,scopeSelector:t,matchCountAtSnapshot:0});}for(let l of n){if(l.kind!=="aria")continue;let a=`${l.role} ${l.name}`;l.matchCountAtSnapshot=r.get(a)??1;}return n}async function k(e,t){let i=new Set,r=e.viewportSize();if(!r)return i;let n=t.filter(a=>a.kind==="aria");if(n.length===0)return i;let o=await Promise.all(n.map(a=>e.locator(`aria-ref=${a.ref}`).elementHandle({timeout:250}).catch(()=>null))),s=a=>{let c=a;return c.els.map(h=>{if(!h)return false;let m=h.getBoundingClientRect(),u=m.left+m.width/2,f=m.top+m.height/2;return u>=0&&u<=c.vw&&f>=0&&f<=c.vh})},l;try{l=await e.evaluate(s,{els:o,vw:r.width,vh:r.height});}catch{l=n.map(()=>true);}finally{await Promise.all(o.map(a=>a?.dispose().catch(()=>{})));}return n.forEach((a,c)=>{l[c]===false&&i.add(a.ref);}),i}async function P(e,t){let i=t.filter(r=>r.kind==="aria"&&r.role==="link").slice(0,C);await Promise.all(i.map(async r=>{try{let n=await e.locator(`aria-ref=${r.ref}`).getAttribute("href",{timeout:250});n&&(r.href=n);}catch{}}));}async function I(e,t,i){let r="data-__skeptic-ci",n=A,o=`((scopeSel, attrName, maxCap) => {
107
+ var interactiveTags = { a:1, button:1, input:1, select:1, textarea:1, details:1, summary:1 };
108
+ var interactiveRoles = {
109
+ button:1, link:1, textbox:1, checkbox:1, radio:1, combobox:1, listbox:1,
110
+ menuitem:1, menuitemcheckbox:1, menuitemradio:1, option:1, searchbox:1,
111
+ slider:1, spinbutton:1, switch:1, tab:1, treeitem:1
112
+ };
113
+ var scope = document.querySelector(scopeSel) || document.body;
114
+ if (!scope) return [];
115
+ var results = [];
116
+ var all = scope.querySelectorAll("*");
117
+ for (var i = 0; i < all.length && results.length < maxCap; i++) {
118
+ var el = all[i];
119
+ if (el.closest && el.closest('[hidden], [aria-hidden="true"]')) continue;
120
+ var tagName = el.tagName.toLowerCase();
121
+ if (interactiveTags[tagName]) continue;
122
+ var role = el.getAttribute("role");
123
+ if (role && interactiveRoles[role.toLowerCase()]) continue;
124
+ var computed = getComputedStyle(el);
125
+ var hasCursorPointer = computed.cursor === "pointer";
126
+ var hasOnClick = el.hasAttribute("onclick") || el.onclick !== null;
127
+ var tabIndex = el.getAttribute("tabindex");
128
+ var hasTabIndex = tabIndex !== null && tabIndex !== "-1";
129
+ if (!hasCursorPointer && !hasOnClick && !hasTabIndex) continue;
130
+ if (hasCursorPointer && !hasOnClick && !hasTabIndex) {
131
+ var parent = el.parentElement;
132
+ if (parent && getComputedStyle(parent).cursor === "pointer") continue;
133
+ }
134
+ var rect = el.getBoundingClientRect();
135
+ if (rect.width === 0 || rect.height === 0) continue;
136
+ var text = (el.textContent || "").trim().slice(0, 100);
137
+ if (!text && hasCursorPointer && !hasOnClick && !hasTabIndex) continue;
138
+ el.setAttribute(attrName, String(results.length));
139
+ results.push({
140
+ index: results.length,
141
+ text: text,
142
+ tagName: tagName,
143
+ bbox: [rect.x, rect.y, rect.width, rect.height],
144
+ hasOnClick: hasOnClick,
145
+ hasCursorPointer: hasCursorPointer,
146
+ hasTabIndex: hasTabIndex,
147
+ ariaRoleHint: role
148
+ });
149
+ }
150
+ return results;
151
+ })(${JSON.stringify(t)}, ${JSON.stringify(r)}, ${n})`,s=await e.evaluate(o)??[];if(s.length===0)return [];let l=await L(e,T(i,s));if(s=s.filter(u=>!N(u.bbox,l)),s.length===0)return [];let a=new Set;for(let u of i){let f=/^e(\d+)$/.exec(u.ref);f&&a.add(Number(f[1]));}let c=1;for(;a.has(c);)c++;let h=await _(e,r,s.map(u=>u.index)),m=[];for(let u of s){let f=c;for(c++;a.has(c);)c++;let x=`e${f}`,d=h[String(u.index)]??"",w=d.length>0?d:`css=[${r}="${u.index}"]`;m.push({ref:x,kind:"cursor-interactive",role:u.tagName,name:u.text,nth:0,scopeSelector:t,selectorHint:w,matchCountAtSnapshot:1});}return m}async function _(e,t,i){if(i.length===0)return {};try{await b(e);let r=`((attrName, indices) => {
152
+ var fn = (typeof window !== "undefined") ? window.__skeptic_selector : null;
153
+ var out = {};
154
+ for (var i = 0; i < indices.length; i++) {
155
+ var idx = indices[i];
156
+ var el = document.querySelector('[' + attrName + '="' + idx + '"]');
157
+ out[idx] = (el && typeof fn === "function") ? (fn(el) || "") : "";
158
+ }
159
+ return out;
160
+ })(${JSON.stringify(t)}, ${JSON.stringify(i)})`;return await e.evaluate(r)??{}}catch{return {}}}var N=(e,t)=>t.some(i=>Math.abs(i[0]-e[0])<=1&&Math.abs(i[1]-e[1])<=1&&Math.abs(i[2]-e[2])<=1&&Math.abs(i[3]-e[3])<=1),T=(e,t)=>{if(t.length<=10)return e.filter(r=>r.kind==="aria"&&r.role==="generic");let i=t.map(r=>r.text).filter(r=>r.length>0);return i.length===0?[]:e.filter(r=>r.kind!=="aria"||r.role!=="generic"||r.name.length===0?false:i.some(n=>n===r.name||n.includes(r.name)||r.name.includes(n)))};async function L(e,t){let i=[];return await Promise.all(t.map(async r=>{if(r.kind==="aria")try{let n=await e.locator(`aria-ref=${r.ref}`).boundingBox({timeout:300});n&&i.push([n.x,n.y,n.width,n.height]);}catch{}})),i}async function V(e,t){if(t.startsWith("@e"))throw new Error("Internal error: @-prefixed ARIA refs must go through resolveSelectorArg, not resolveElement");if(t.startsWith("testid=")){let n=t.slice(7),o=e.getByTestId(n);if(await o.count()>0)return o.first();throw new Error(`No element found with test-id "${n}"`)}if(t.startsWith("css=")){let n=t.slice(4),o=e.locator(n);if(await o.count()>0)return o.first();throw new Error(`No element found with CSS selector "${n}"`)}if(t.startsWith("role=")){let n=t.slice(5),o=n.indexOf(":"),s=o>=0?n.slice(0,o):n,l=o>=0?n.slice(o+1):void 0,a=e.getByRole(s,{name:l});if(await a.count()>0)return a.first();throw new Error(`No element found with role "${s}"${l?` and name "${l}"`:""}`)}let i=[()=>e.getByRole("button",{name:t}),()=>e.getByRole("link",{name:t}),()=>e.getByRole("heading",{name:t}),()=>e.getByText(t,{exact:true}),()=>e.getByLabel(t),()=>e.getByPlaceholder(t),()=>e.getByTestId(t),()=>e.getByText(t)];for(let n of i){let o=n();if(await o.count()>0)return o.first()}let r=e.locator(t);if(await r.count()>0)return r.first();throw new Error(`Could not find element matching "${t}". Tried: role (button/link/heading), text, label, placeholder, testid, css.`)}var p=new Set(["button","checkbox","combobox","link","listbox","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]),B=new Set(["complementary","contentinfo","group","heading","main","navigation","region","tabpanel"]),W=e=>e.kind==="cursor-interactive"||p.has(e.role)?true:B.has(e.role)?e.role==="main"||e.name.length>0:false,O=e=>e.kind==="cursor-interactive"||p.has(e.role),J=e=>O(e);export{M as a,V as b,W as c,O as d,J as e};
@@ -0,0 +1,3 @@
1
+ import {createRequire}from'node:module';import*as t from'fs';import {dirname,join,resolve}from'path';import {fileURLToPath}from'url';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var r=dirname(fileURLToPath(import.meta.url)),f=()=>{let e=join(r,"templates");return t.existsSync(e)?e:resolve(r,"../../templates")},m=e=>t.readFileSync(join(f(),e)),p=()=>{let e=join(r,"web-vitals.iife.js");return t.existsSync(e)?e:resolve(r,"../../node_modules/web-vitals/dist/web-vitals.iife.js")};export{m as a,p as b};
@@ -0,0 +1,3 @@
1
+ import {createRequire}from'node:module';import {f}from'./chunk-RU7M6UGM.mjs';import {m,c}from'./chunk-2VSGDT7T.mjs';import {d as d$1}from'./chunk-ZN6MI2TU.mjs';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var l=n=>{let e=0;for(;e<n.length;){let r=n[e]??"";if(/node|skeptic/.test(r)||r.includes("/")){e+=1;continue}break}let o=n[e];return o==="inspect"?!n.includes("--no-daemon"):o==="run"||o==="tui"?!(n.includes("--list")||n.includes("--no-daemon")):false},d=async(n,e)=>{if(e.noDaemon||!l(n))return false;m();let o=c(),r=await f(o,{engine:e.engine,headed:e.headed,cliVersion:e.cliVersion,...typeof e.idleTimeoutSeconds=="number"?{idleTimeoutSeconds:e.idleTimeoutSeconds}:{}});return r.ok?true:(d$1.warn(`[skeptic daemon] pre-warm failed (${r.reason??"unknown"}); falling back to fresh launches`),false)};export{l as a,d as b};
@@ -0,0 +1,41 @@
1
+ import {createRequire}from'node:module';import {a,e,b}from'./chunk-7BFRKEFV.mjs';import {d}from'./chunk-N3533BCE.mjs';import {join}from'path';import {mkdir,writeFile}from'fs/promises';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var v="__skeptic-annotation-host",A=async(e,t)=>{if(t.length===0)return;let n=t.map(i=>({label:i.label,x:i.boundingBox.x,y:i.boundingBox.y,width:i.boundingBox.width,height:i.boundingBox.height})),o=`((items, hostId) => {
4
+ var existing = document.getElementById(hostId);
5
+ if (existing) existing.remove();
6
+ var host = document.createElement('div');
7
+ host.id = hostId;
8
+ host.style.cssText = 'all:initial;position:absolute;top:0;left:0;width:0;height:0;pointer-events:none;z-index:2147483647;';
9
+ var root = host.attachShadow({ mode: 'closed' });
10
+ var style = document.createElement('style');
11
+ style.textContent = ':host{all:initial;}' +
12
+ '.bx{position:absolute;border:2px solid rgba(220,38,38,0.85);box-sizing:border-box;pointer-events:none;}' +
13
+ '.lbl{position:absolute;left:-2px;background:rgba(220,38,38,0.95);color:#fff;' +
14
+ 'font:600 11px/14px ui-monospace,SFMono-Regular,Menlo,monospace;' +
15
+ 'padding:0 4px;border-radius:2px;white-space:nowrap;pointer-events:none;}';
16
+ root.appendChild(style);
17
+ for (var i = 0; i < items.length; i++) {
18
+ var it = items[i];
19
+ var box = document.createElement('div');
20
+ box.className = 'bx';
21
+ box.style.left = it.x + 'px';
22
+ box.style.top = it.y + 'px';
23
+ box.style.width = it.width + 'px';
24
+ box.style.height = it.height + 'px';
25
+ var lbl = document.createElement('div');
26
+ lbl.className = 'lbl';
27
+ // Mirror agent-browser's "stay-inside-viewport" heuristic: top-of-bbox <14px
28
+ // means the label would clip above the page; nudge it down inside the box.
29
+ lbl.style.top = (it.y < 14) ? '2px' : '-14px';
30
+ lbl.textContent = '[' + it.label + ']';
31
+ box.appendChild(lbl);
32
+ root.appendChild(box);
33
+ }
34
+ var target = document.documentElement || document.body;
35
+ target.appendChild(host);
36
+ return true;
37
+ })(${JSON.stringify(n)}, ${JSON.stringify(v)})`;await e.evaluate(o);},S=async e=>{try{let t=`((hostId) => {
38
+ var el = document.getElementById(hostId);
39
+ if (el) el.remove();
40
+ return true;
41
+ })(${JSON.stringify(v)})`;await e.evaluate(t);}catch{}};var O=e=>e.replace(/[^a-zA-Z0-9_-]/g,"_"),z=async(e,t,n,o={})=>{let i=t.testDir;await mkdir(i,{recursive:true});let d$1=O(n),a=join(i,`${d$1}.png`),h=o.fullPage??t.artifactConfig.fullPageScreenshots;if(o.annotate){let l=await _(e,a,{fullPage:h,scope:o.annotateScope??"body"});return t.addScreenshot(a),l}let s=await e.screenshot({fullPage:h,path:a});await writeFile(a,s).catch(()=>{}),t.addScreenshot(a);let c=[],p=t.artifactConfig.blankFrameDetection;if(p!=="off"){let l=d(s);if(l.blank){let r=`blank screenshot "${n}": ${l.reasons.join("; ")}`;if(p==="fail")throw new Error(r);c.push({kind:"blank-screenshot",message:r,meta:l.meta});}}return {path:a,diagnostics:c}},_=async(e$1,t,n)=>{let{fullPage:o,scope:i}=n,d=[],a$1=await a(e$1,i,{viewport:false,includeCursorInteractive:true,extractLinkHrefs:false}),h=o?await k(e$1):0,s=[],c=[],p=1;for(let r of a$1.entries.filter(e)){let u=await I(e$1,r).catch(()=>null);if(!u)continue;let m={x:u.x,y:u.y+h,width:u.width,height:u.height},f=p;p+=1,c.push({label:f,boundingBox:m});let b={label:f,ref:r.ref,role:r.role,boundingBox:m};r.selectorHint&&(b.selectorHint=r.selectorHint),s.push(b);}await e$1.evaluate("(() => { try { window.__skepticCursor && window.__skepticCursor.hide && window.__skepticCursor.hide(); } catch {} })()").catch(()=>{});let l=false;try{c.length>0&&(await A(e$1,c),l=!0);let r=await e$1.screenshot({fullPage:o,path:t});await writeFile(t,r).catch(()=>{});}finally{l&&await S(e$1),await e$1.evaluate("(() => { try { window.__skepticCursor && window.__skepticCursor.show && window.__skepticCursor.show(); } catch {} })()").catch(()=>{});}return d.push({kind:"annotation-map",message:`annotated ${s.length} ref${s.length===1?"":"s"}`,meta:{entries:s}}),{path:t,diagnostics:d,annotations:s}},k=async e=>{try{let t=await e.evaluate("(window.scrollY || 0)");return typeof t=="number"&&Number.isFinite(t)?t:0}catch{return 0}},I=async(e,t)=>{let n=null;if(t.kind==="cursor-interactive"){if(!t.selectorHint)return null;try{n=await b(e,t.selectorHint);}catch{return null}}else n=e.locator(`aria-ref=${t.ref}`);if(!n)return null;let o=await n.boundingBox({timeout:500});return o?{x:o.x,y:o.y,width:o.width,height:o.height}:null};export{z as a,_ as b};
@@ -0,0 +1,12 @@
1
+ import {createRequire}from'node:module';import {b,c}from'./chunk-G22LGRZ4.mjs';import {d}from'./chunk-N3533BCE.mjs';import*as U from'fs';import*as Ee from'path';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var Ce=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",wt=Ce+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",xt="["+Ce+"]["+wt+"]*",Et=new RegExp("^"+xt+"$");function D(r,e){let t=[],n=e.exec(r);for(;n;){let s=[];s.startIndex=e.lastIndex-n[0].length;let i=n.length;for(let o=0;o<i;o++)s.push(n[o]);t.push(s),n=e.exec(r);}return t}var oe=function(r){let e=Et.exec(r);return !(e===null||typeof e>"u")};function Te(r){return typeof r<"u"}var q=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],J=["__proto__","constructor","prototype"];var Nt={allowBooleanAttributes:false,unpairedTags:[]};function ke(r,e){e=Object.assign({},Nt,e);let t=[],n=false,s=false;r[0]==="\uFEFF"&&(r=r.substr(1));for(let i=0;i<r.length;i++)if(r[i]==="<"&&r[i+1]==="?"){if(i+=2,i=_e(r,i),i.err)return i}else if(r[i]==="<"){let o=i;if(i++,r[i]==="!"){i=Ie(r,i);continue}else {let a=false;r[i]==="/"&&(a=true,i++);let c="";for(;i<r.length&&r[i]!==">"&&r[i]!==" "&&r[i]!==" "&&r[i]!==`
4
+ `&&r[i]!=="\r";i++)c+=r[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!Pt(c)){let d;return c.trim().length===0?d="Invalid space after '<'.":d="Tag '"+c+"' is an invalid name.",m("InvalidTag",d,x(r,i))}let l=Ct(r,i);if(l===false)return m("InvalidAttr","Attributes for '"+c+"' have open quote.",x(r,i));let u=l.value;if(i=l.index,u[u.length-1]==="/"){let d=i-u.length;u=u.substring(0,u.length-1);let h=Pe(u,e);if(h===true)n=true;else return m(h.err.code,h.err.msg,x(r,d+h.err.line))}else if(a)if(l.tagClosed){if(u.trim().length>0)return m("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",x(r,o));if(t.length===0)return m("InvalidTag","Closing tag '"+c+"' has not been opened.",x(r,o));{let d=t.pop();if(c!==d.tagName){let h=x(r,d.tagStartPos);return m("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+c+"'.",x(r,o))}t.length==0&&(s=true);}}else return m("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",x(r,i));else {let d=Pe(u,e);if(d!==true)return m(d.err.code,d.err.msg,x(r,i-u.length+d.err.line));if(s===true)return m("InvalidXml","Multiple possible root nodes found.",x(r,i));e.unpairedTags.indexOf(c)!==-1||t.push({tagName:c,tagStartPos:o}),n=true;}for(i++;i<r.length;i++)if(r[i]==="<")if(r[i+1]==="!"){i++,i=Ie(r,i);continue}else if(r[i+1]==="?"){if(i=_e(r,++i),i.err)return i}else break;else if(r[i]==="&"){let d=_t(r,i);if(d==-1)return m("InvalidChar","char '&' is not expected.",x(r,i));i=d;}else if(s===true&&!Se(r[i]))return m("InvalidXml","Extra text at the end",x(r,i));r[i]==="<"&&i--;}}else {if(Se(r[i]))continue;return m("InvalidChar","char '"+r[i]+"' is not expected.",x(r,i))}if(n){if(t.length==1)return m("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",x(r,t[0].tagStartPos));if(t.length>0)return m("InvalidXml","Invalid '"+JSON.stringify(t.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return m("InvalidXml","Start tag expected.",1);return true}function Se(r){return r===" "||r===" "||r===`
5
+ `||r==="\r"}function _e(r,e){let t=e;for(;e<r.length;e++)if(r[e]=="?"||r[e]==" "){let n=r.substr(t,e-t);if(e>5&&n==="xml")return m("InvalidXml","XML declaration allowed only at the start of the document.",x(r,e));if(r[e]=="?"&&r[e+1]==">"){e++;break}else continue}return e}function Ie(r,e){if(r.length>e+5&&r[e+1]==="-"&&r[e+2]==="-"){for(e+=3;e<r.length;e++)if(r[e]==="-"&&r[e+1]==="-"&&r[e+2]===">"){e+=2;break}}else if(r.length>e+8&&r[e+1]==="D"&&r[e+2]==="O"&&r[e+3]==="C"&&r[e+4]==="T"&&r[e+5]==="Y"&&r[e+6]==="P"&&r[e+7]==="E"){let t=1;for(e+=8;e<r.length;e++)if(r[e]==="<")t++;else if(r[e]===">"&&(t--,t===0))break}else if(r.length>e+9&&r[e+1]==="["&&r[e+2]==="C"&&r[e+3]==="D"&&r[e+4]==="A"&&r[e+5]==="T"&&r[e+6]==="A"&&r[e+7]==="["){for(e+=8;e<r.length;e++)if(r[e]==="]"&&r[e+1]==="]"&&r[e+2]===">"){e+=2;break}}return e}var vt='"',At="'";function Ct(r,e){let t="",n="",s=false;for(;e<r.length;e++){if(r[e]===vt||r[e]===At)n===""?n=r[e]:n!==r[e]||(n="");else if(r[e]===">"&&n===""){s=true;break}t+=r[e];}return n!==""?false:{value:t,index:e,tagClosed:s}}var Tt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Pe(r,e){let t=D(r,Tt),n={};for(let s=0;s<t.length;s++){if(t[s][1].length===0)return m("InvalidAttr","Attribute '"+t[s][2]+"' has no space in starting.",H(t[s]));if(t[s][3]!==void 0&&t[s][4]===void 0)return m("InvalidAttr","Attribute '"+t[s][2]+"' is without value.",H(t[s]));if(t[s][3]===void 0&&!e.allowBooleanAttributes)return m("InvalidAttr","boolean attribute '"+t[s][2]+"' is not allowed.",H(t[s]));let i=t[s][2];if(!It(i))return m("InvalidAttr","Attribute '"+i+"' is an invalid name.",H(t[s]));if(!Object.prototype.hasOwnProperty.call(n,i))n[i]=1;else return m("InvalidAttr","Attribute '"+i+"' is repeated.",H(t[s]))}return true}function St(r,e){let t=/\d/;for(r[e]==="x"&&(e++,t=/[\da-fA-F]/);e<r.length;e++){if(r[e]===";")return e;if(!r[e].match(t))break}return -1}function _t(r,e){if(e++,r[e]===";")return -1;if(r[e]==="#")return e++,St(r,e);let t=0;for(;e<r.length;e++,t++)if(!(r[e].match(/\w/)&&t<20)){if(r[e]===";")break;return -1}return e}function m(r,e,t){return {err:{code:r,msg:e,line:t.line||t,col:t.col}}}function It(r){return oe(r)}function Pt(r){return oe(r)}function x(r,e){let t=r.substring(0,e).split(/\r?\n/);return {line:t.length,col:t[t.length-1].length+1}}function H(r){return r.startIndex+r[1].length}var Q={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},W={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},ae={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"};var ce=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"}),Mt=new Set("!?\\\\/[]$%{}^&*()<>|+");function We(r){if(r[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${r}"`);for(let e of r)if(Mt.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${r}"`);return r}function Y(...r){let e=Object.create(null);for(let t of r)if(t)for(let n of Object.keys(t)){let s=t[n];if(typeof s=="string")e[n]=s;else if(s&&typeof s=="object"&&s.val!==void 0){let i=s.val;typeof i=="string"&&(e[n]=i);}}return e}var _="external",ee="base",le="all";function Rt(r){return !r||r===_?new Set([_]):r===le?new Set([le]):r===ee?new Set([ee]):Array.isArray(r)?new Set(r):new Set([_])}var N=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Ot=new Set([9,10,13]);function Ft(r){if(!r)return {xmlVersion:1,onLevel:N.allow,nullLevel:N.remove};let e=r.xmlVersion===1.1?1.1:1,t=N[r.onNCR]??N.allow,n=N[r.nullNCR]??N.remove,s=Math.max(n,N.remove);return {xmlVersion:e,onLevel:t,nullLevel:s}}var O=class{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck=="function"?e.postCheck:n=>n,this._limitTiers=Rt(this._limit.applyLimitsTo??_),this._numericAllowed=e.numericAllowed??true,this._baseMap=Y(W,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let t=Ft(e.ncr);this._ncrXmlVersion=t.xmlVersion,this._ncrOnLevel=t.onLevel,this._ncrNullLevel=t.nullLevel,this._onExternalEntity=typeof e.onExternalEntity=="function"?e.onExternalEntity:null,this._onInputEntity=typeof e.onInputEntity=="function"?e.onInputEntity:null;}_applyRegistrationHook(e,t,n,s){if(!e)return true;let i=e(t,n);if(i===ce.BLOCK)return false;if(i===ce.THROW)throw new Error(`[EntityDecoder] Registration of ${s} entity "&${t};" was rejected by hook`);return true}setExternalEntities(e){if(e)for(let s of Object.keys(e))We(s);if(!this._onExternalEntity){this._externalMap=Y(e);return}let t=Y(e),n=Object.create(null);for(let[s,i]of Object.entries(t))this._applyRegistrationHook(this._onExternalEntity,s,i,"external")&&(n[s]=i);this._externalMap=n;}addExternalEntity(e,t){We(e),typeof t=="string"&&t.indexOf("&")===-1&&this._applyRegistrationHook(this._onExternalEntity,e,t,"external")&&(this._externalMap[e]=t);}addInputEntities(e){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity){this._inputMap=Y(e);return}let t=Y(e),n=Object.create(null);for(let[s,i]of Object.entries(t))this._applyRegistrationHook(this._onInputEntity,s,i,"input")&&(n[s]=i);this._inputMap=n;}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1;}decode(e){if(typeof e!="string"||e.length===0||e.indexOf("&")===-1)return e;let t=e,n=[],s=e.length,i=0,o=0,a=this._maxTotalExpansions>0,c=this._maxExpandedLength>0,l=a||c;for(;o<s;){if(e.charCodeAt(o)!==38){o++;continue}let d=o+1;for(;d<s&&e.charCodeAt(d)!==59&&d-o<=32;)d++;if(d>=s||e.charCodeAt(d)!==59){o++;continue}let h=e.slice(o+1,d);if(h.length===0){o++;continue}let f,g;if(this._removeSet.has(h))f="",g===void 0&&(g=_);else if(this._leaveSet.has(h)){o++;continue}else if(h.charCodeAt(0)===35){let p=this._resolveNCR(h);if(p===void 0){o++;continue}f=p,g=ee;}else {let p=this._resolveName(h);f=p?.value,g=p?.tier;}if(f===void 0){o++;continue}if(o>i&&n.push(e.slice(i,o)),n.push(f),i=d+1,o=i,l&&this._tierCounts(g)){if(a&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(c){let p=f.length-(h.length+2);if(p>0&&(this._expandedLength+=p,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}i<s&&n.push(e.slice(i));let u=n.length===0?e:n.join("");return this._postCheck(u,t)}_tierCounts(e){return this._limitTiers.has(le)?true:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return {value:this._inputMap[e],tier:_};if(e in this._externalMap)return {value:this._externalMap[e],tier:_};if(e in this._baseMap)return {value:this._baseMap[e],tier:ee}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!Ot.has(e)?N.remove:-1}_applyNCRAction(e,t,n){switch(e){case N.allow:return String.fromCodePoint(n);case N.remove:return "";case N.leave:return;case N.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${t}; (U+${n.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(n)}}_resolveNCR(e){let t=e.charCodeAt(1),n;if(t===120||t===88?n=parseInt(e.slice(2),16):n=parseInt(e.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let s=this._classifyNCR(n);if(!this._numericAllowed&&s<N.remove)return;let i=s===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,s);return this._applyNCRAction(i,e,n)}};var Ye=r=>q.includes(r)?"__"+r:r,Lt={preserveOrder:false,attributeNamePrefix:"@_",attributesGroupName:false,textNodeName:"#text",ignoreAttributes:true,removeNSPrefix:false,allowBooleanAttributes:false,parseTagValue:true,parseAttributeValue:false,trimValues:true,cdataPropName:false,numberParseOptions:{hex:true,leadingZeros:true,eNotation:true},tagValueProcessor:function(r,e){return e},attributeValueProcessor:function(r,e){return e},stopNodes:[],alwaysCreateTextNode:false,isArray:()=>false,commentPropName:false,unpairedTags:[],processEntities:true,htmlEntities:false,entityDecoder:null,ignoreDeclaration:false,ignorePiTags:false,transformTagName:false,transformAttributeName:false,updateTag:function(r,e,t){return r},captureMetaData:false,maxNestedTags:100,strictReservedNames:true,jPath:true,onDangerousProperty:Ye};function $t(r,e){if(typeof r!="string")return;let t=r.toLowerCase();if(q.some(n=>t===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${r}" is a reserved JavaScript keyword that could cause prototype pollution`);if(J.some(n=>t===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${r}" is a reserved JavaScript keyword that could cause prototype pollution`)}function Ge(r,e){return typeof r=="boolean"?{enabled:r,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof r=="object"&&r!==null?{enabled:r.enabled!==false,maxEntitySize:Math.max(1,r.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,r.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,r.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,r.maxExpandedLength??1e5),maxEntityCount:Math.max(1,r.maxEntityCount??1e3),allowedTags:r.allowedTags??null,tagFilter:r.tagFilter??null,appliesTo:r.appliesTo??"all"}:Ge(true)}var ze=function(r){let e=Object.assign({},Lt,r),t=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(let{value:n,name:s}of t)n&&$t(n,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=Ye),e.processEntities=Ge(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(n=>typeof n=="string"&&n.startsWith("*.")?".."+n.substring(2):n)),e};var te;typeof Symbol!="function"?te="@@xmlMetadata":te=Symbol("XML Node Metadata");var v=class{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null);}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t});}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][te]={startIndex:t});}static getMetaDataSymbol(){return te}};var Xe=":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",Vt=Xe+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",Ke=":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}",Ut=Ke+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",Ze=(r,e,t="")=>{let n=r.replace(":",""),s=e.replace(":",""),i=`[${n}][${s}]*`;return {name:new RegExp(`^[${r}][${e}]*$`,t),ncName:new RegExp(`^${i}$`,t),qName:new RegExp(`^${i}(?::${i})?$`,t),nmToken:new RegExp(`^[${e}]+$`,t),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,t)}},jt=Ze(Xe,Vt),Bt=Ze(Ke,Ut,"u"),qt=(r="1.0")=>r==="1.1"?Bt:jt;var ue=(r,{xmlVersion:e="1.0"}={})=>qt(e).qName.test(r);var z=class{constructor(e,t){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=t||1;}setXmlVersion(e=1){this.xmlVersion=e;}readDocType(e,t){let n=Object.create(null),s=0;if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let i=1,o=false,a=false,c="";for(;t<e.length;t++)if(e[t]==="<"&&!a){if(o&&I(e,"!ENTITY",t)){t+=7;let l,u;if([l,u,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),u.indexOf("&")===-1){if(this.options.enabled!==false&&this.options.maxEntityCount!=null&&s>=this.options.maxEntityCount)throw new Error(`Entity count (${s+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);n[l]=u,s++;}}else if(o&&I(e,"!ELEMENT",t)){t+=8;let{index:l}=this.readElementExp(e,t+1);t=l;}else if(o&&I(e,"!ATTLIST",t))t+=8;else if(o&&I(e,"!NOTATION",t)){t+=9;let{index:l}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=l;}else if(I(e,"!--",t))a=true;else throw new Error("Invalid DOCTYPE");i++,c="";}else if(e[t]===">"){if(a?e[t-1]==="-"&&e[t-2]==="-"&&(a=false,i--):i--,i===0)break}else e[t]==="["?o=true:c+=e[t];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return {entities:n,i:t}}readEntityExp(e,t){t=A(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)t++;let s=e.substring(n,t);if(G(s,{xmlVersion:this.xmlVersion}),t=A(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[t]==="%")throw new Error("Parameter entities are not supported")}let i="";if([t,i]=this.readIdentifierVal(e,t,"entity"),this.options.enabled!==false&&this.options.maxEntitySize!=null&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${s}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[s,i,t]}readNotationExp(e,t){t=A(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let s=e.substring(n,t);!this.suppressValidationErr&&G(s,{xmlVersion:this.xmlVersion}),t=A(e,t);let i=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&i!=="SYSTEM"&&i!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);t+=i.length,t=A(e,t);let o=null,a=null;if(i==="PUBLIC")[t,o]=this.readIdentifierVal(e,t,"publicIdentifier"),t=A(e,t),(e[t]==='"'||e[t]==="'")&&([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"));else if(i==="SYSTEM"&&([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return {notationName:s,publicIdentifier:o,systemIdentifier:a,index:--t}}readIdentifierVal(e,t,n){let s="",i=e[t];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);t++;let o=t;for(;t<e.length&&e[t]!==i;)t++;if(s=e.substring(o,t),e[t]!==i)throw new Error(`Unterminated ${n} value`);return t++,[t,s]}readElementExp(e,t){t=A(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let s=e.substring(n,t);if(!this.suppressValidationErr&&!ue(s,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${s}"`);t=A(e,t);let i="";if(e[t]==="E"&&I(e,"MPTY",t))t+=4;else if(e[t]==="A"&&I(e,"NY",t))t+=2;else if(e[t]==="("){t++;let o=t;for(;t<e.length&&e[t]!==")";)t++;if(i=e.substring(o,t),e[t]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[t]}"`);return {elementName:s,contentModel:i.trim(),index:t}}readAttlistExp(e,t){t=A(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let s=e.substring(n,t);for(G(s,{xmlVersion:this.xmlVersion}),t=A(e,t),n=t;t<e.length&&!/\s/.test(e[t]);)t++;let i=e.substring(n,t);if(!G(i,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${i}"`);t=A(e,t);let o="";if(e.substring(t,t+8).toUpperCase()==="NOTATION"){if(o="NOTATION",t+=8,t=A(e,t),e[t]!=="(")throw new Error(`Expected '(', found "${e[t]}"`);t++;let c=[];for(;t<e.length&&e[t]!==")";){let l=t;for(;t<e.length&&e[t]!=="|"&&e[t]!==")";)t++;let u=e.substring(l,t);if(u=u.trim(),!G(u,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${u}"`);c.push(u),e[t]==="|"&&(t++,t=A(e,t));}if(e[t]!==")")throw new Error("Unterminated list of notations");t++,o+=" ("+c.join("|")+")";}else {let c=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;o+=e.substring(c,t);let l=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!l.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}t=A(e,t);let a="";return e.substring(t,t+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",t+=8):e.substring(t,t+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",t+=7):[t,a]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:s,attributeName:i,attributeType:o,defaultValue:a,index:t}}},A=(r,e)=>{for(;e<r.length&&/\s/.test(r[e]);)e++;return e};function I(r,e,t){for(let n=0;n<e.length;n++)if(e[n]!==r[t+n+1])return false;return true}function G(r,e){if(ue(r,{xmlVersion:e}))return r;throw new Error(`Invalid entity name ${r}`)}var Ht=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],re=255,ne=new Map,De=65535,Je=1632,F=Je,Wt=De-Je+1,se=new Uint8Array(Wt).fill(re);for(let r of Ht)for(let e=0;e<10;e++){let t=r+e;t<=De?se[t-F]=e:ne.set(t,e);}var Qe=48,et=57,tt=45,ie=new Set([8722,65293,65123]);function Yt(r){if(typeof r!="string")return r;let e=r.length;if(e===0)return r;let t=-1;for(let s=0;s<e;s++){let i=r.charCodeAt(s);if(!(i>=Qe&&i<=et||i===tt)){if(i<F){if(ie.has(i)){t=s;break}continue}if(i>=55296&&i<=56319){if(s+1<e){let o=r.charCodeAt(s+1);if(o>=56320&&o<=57343){let a=65536+(i-55296<<10)+(o-56320);if(ne.has(a)){t=s;break}}}continue}if(se[i-F]!==re||ie.has(i)){t=s;break}}}if(t===-1)return r;let n=[];t>0&&n.push(r.slice(0,t));for(let s=t;s<e;s++){let i=r.charCodeAt(s);if(i>=Qe&&i<=et||i===tt){n.push(r[s]);continue}if(i<F){n.push(ie.has(i)?"-":r[s]);continue}if(i>=55296&&i<=56319){if(s+1<e){let a=r.charCodeAt(s+1);if(a>=56320&&a<=57343){let c=65536+(i-55296<<10)+(a-56320),l=ne.get(c);if(l!==void 0){n.push(String.fromCharCode(l+48)),s++;continue}}}n.push(r[s]);continue}if(ie.has(i)){n.push("-");continue}let o=se[i-F];n.push(o!==re?String.fromCharCode(o+48):r[s]);}return n.join("")}var rt=Yt;var Gt=/^[-+]?0x[a-fA-F0-9]+$/,zt=/^0b[01]+$/,Xt=/^0o[0-7]+$/,Kt=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Zt={hex:true,binary:false,octal:false,leadingZeros:true,decimalPoint:".",eNotation:true,infinity:"original",unicode:false};function he(r,e={}){if(e=Object.assign({},Zt,e),!r||typeof r!="string")return r;let t=r.trim();if(t.length===0)return r;if(e.skipLike!==void 0&&e.skipLike.test(t))return r;if(t==="0"||e.unicode&&(t=rt(t),t==="0"))return 0;if(e.hex&&Gt.test(t))return de(t,16);if(e.binary&&zt.test(t))return de(t,2);if(e.octal&&Xt.test(t))return de(t,8);if(isFinite(t)){if(t.includes("e")||t.includes("E"))return Jt(r,t,e);{let n=Kt.exec(t);if(n){let s=n[1]||"",i=n[2],o=Qt(n[3]),a=s?r[i.length+1]===".":r[i.length]===".";if(!e.leadingZeros&&(i.length>1||i.length===1&&!a))return r;{let c=Number(t),l=String(c);if(c===0)return c;if(l.search(/[eE]/)!==-1)return e.eNotation?c:r;if(t.indexOf(".")!==-1)return l==="0"||l===o||l===`${s}${o}`?c:r;let u=i?o:t;return i?u===l||s+u===l?c:r:u===l||u===s+l?c:r}}else return r}}else return er(r,Number(t),e)}var Dt=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Jt(r,e,t){if(!t.eNotation)return r;let n=e.match(Dt);if(n){let s=n[1]||"",i=n[3].indexOf("e")===-1?"E":"e",o=n[2],a=s?r[o.length+1]===i:r[o.length]===i;return o.length>1&&a?r:o.length===1&&(n[3].startsWith(`.${i}`)||n[3][0]===i)?Number(e):o.length>0?t.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):r:Number(e)}else return r}function Qt(r){return r&&r.indexOf(".")!==-1&&(r=r.replace(/0+$/,""),r==="."?r="0":r[0]==="."?r="0"+r:r[r.length-1]==="."&&(r=r.substring(0,r.length-1))),r}function de(r,e){let t=r.trim();if((e===2||e===8)&&(r=t.substring(2)),parseInt)return parseInt(r,e);if(Number.parseInt)return Number.parseInt(r,e);if(window&&window.parseInt)return window.parseInt(r,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function er(r,e,t){let n=e===1/0;switch(t.infinity.toLowerCase()){case "null":return null;case "infinity":return e;case "string":return n?"Infinity":"-Infinity";default:return r}}function fe(r){return typeof r=="function"?r:Array.isArray(r)?e=>{for(let t of r)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return true}:()=>false}var P=class{constructor(e,t={},n){this.pattern=e,this.separator=t.separator||".",this.segments=this._parse(e),this.data=n,this._hasDeepWildcard=this.segments.some(s=>s.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(s=>s.attrName!==void 0),this._hasPositionSelector=this.segments.some(s=>s.position!==void 0);}_parse(e){let t=[],n=0,s="";for(;n<e.length;)e[n]===this.separator?n+1<e.length&&e[n+1]===this.separator?(s.trim()&&(t.push(this._parseSegment(s.trim())),s=""),t.push({type:"deep-wildcard"}),n+=2):(s.trim()&&t.push(this._parseSegment(s.trim())),s="",n++):(s+=e[n],n++);return s.trim()&&t.push(this._parseSegment(s.trim())),t}_parseSegment(e){let t={type:"tag"},n=null,s=e,i=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(s=i[1]+i[3],i[2])){let u=i[2].slice(1,-1);u&&(n=u);}let o,a=s;if(s.includes("::")){let u=s.indexOf("::");if(o=s.substring(0,u).trim(),a=s.substring(u+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${e}`)}let c,l=null;if(a.includes(":")){let u=a.lastIndexOf(":"),d=a.substring(0,u).trim(),h=a.substring(u+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(c=d,l=h):c=a;}else c=a;if(!c)throw new Error(`Invalid segment pattern: ${e}`);if(t.tag=c,o&&(t.namespace=o),n)if(n.includes("=")){let u=n.indexOf("=");t.attrName=n.substring(0,u).trim(),t.attrValue=n.substring(u+1).trim();}else t.attrName=n.trim();if(l){let u=l.match(/^nth\((\d+)\)$/);u?(t.position="nth",t.positionValue=parseInt(u[1],10)):t.position=l;}return t}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}};var L=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=false;}add(e){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard())return this._deepWildcards.push(e),this;let t=e.length,s=e.segments[e.segments.length-1]?.tag;if(!s||s==="*")this._wildcardByDepth.has(t)||this._wildcardByDepth.set(t,[]),this._wildcardByDepth.get(t).push(e);else {let i=`${t}:${s}`;this._byDepthAndTag.has(i)||this._byDepthAndTag.set(i,[]),this._byDepthAndTag.get(i).push(e);}return this}addAll(e){for(let t of e)this.add(t);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=true,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let t=e.getDepth(),n=e.getCurrentTag(),s=`${t}:${n}`,i=this._byDepthAndTag.get(s);if(i){for(let a=0;a<i.length;a++)if(e.matches(i[a]))return i[a]}let o=this._wildcardByDepth.get(t);if(o){for(let a=0;a<o.length;a++)if(e.matches(o[a]))return o[a]}for(let a=0;a<this._deepWildcards.length;a++)if(e.matches(this._deepWildcards[a]))return this._deepWildcards[a];return null}};var pe=class{constructor(e){this._matcher=e;}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let t=this._matcher.path;if(t.length!==0)return t[t.length-1].values?.[e]}hasAttr(e){let t=this._matcher.path;if(t.length===0)return false;let n=t[t.length-1];return n.values!==void 0&&e in n.values}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,t=true){return this._matcher.toString(e,t)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},$=class{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new pe(this);}push(e,t=null,n=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let s=this.path.length;this.siblingStacks[s]||(this.siblingStacks[s]=new Map);let i=this.siblingStacks[s],o=n?`${n}:${e}`:e,a=i.get(o)||0,c=0;for(let u of i.values())c+=u;i.set(o,a+1);let l={tag:e,position:c,counter:a};n!=null&&(l.namespace=n),t!=null&&(l.values=t),this.path.push(l);}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){let t=this.path[this.path.length-1];e!=null&&(t.values=e);}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return false;let t=this.path[this.path.length-1];return t.values!==void 0&&e in t.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,t=true){let n=e||this.separator;if(n===this.separator&&t===true){if(this._pathStringCache!==null)return this._pathStringCache;let i=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(n);return this._pathStringCache=i,i}return this.path.map(i=>t&&i.namespace?`${i.namespace}:${i.tag}`:i.tag).join(n)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[];}matches(e){let t=e.segments;return t.length===0?false:e.hasDeepWildcard()?this._matchWithDeepWildcard(t):this._matchSimple(t)}_matchSimple(e){if(this.path.length!==e.length)return false;for(let t=0;t<e.length;t++)if(!this._matchSegment(e[t],this.path[t],t===this.path.length-1))return false;return true}_matchWithDeepWildcard(e){let t=this.path.length-1,n=e.length-1;for(;n>=0&&t>=0;){let s=e[n];if(s.type==="deep-wildcard"){if(n--,n<0)return true;let i=e[n],o=false;for(let a=t;a>=0;a--)if(this._matchSegment(i,this.path[a],a===this.path.length-1)){t=a-1,n--,o=true;break}if(!o)return false}else {if(!this._matchSegment(s,this.path[t],t===this.path.length-1))return false;t--,n--;}}return n<0}_matchSegment(e,t,n){if(e.tag!=="*"&&e.tag!==t.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==t.namespace||e.attrName!==void 0&&(!n||!t.values||!(e.attrName in t.values)||e.attrValue!==void 0&&String(t.values[e.attrName])!==String(e.attrValue)))return false;if(e.position!==void 0){if(!n)return false;let s=t.counter??0;if(e.position==="first"&&s!==0)return false;if(e.position==="odd"&&s%2!==1)return false;if(e.position==="even"&&s%2!==0)return false;if(e.position==="nth"&&s!==e.positionValue)return false}return true}matchesAny(e){return e.matchesAny(this)}snapshot(){return {path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(t=>({...t})),this.siblingStacks=e.siblingStacks.map(t=>new Map(t));}readOnly(){return this._view}};function tr(r,e){if(!r)return {};let t=e.attributesGroupName?r[e.attributesGroupName]:r;if(!t)return {};let n={};for(let s in t)if(s.startsWith(e.attributeNamePrefix)){let i=s.substring(e.attributeNamePrefix.length);n[i]=t[s];}else n[s]=t[s];return n}function rr(r){if(!r||typeof r!="string")return;let e=r.indexOf(":");if(e!==-1&&e>0){let t=r.substring(0,e);if(t!=="xmlns")return t}}var X=class{constructor(e,t){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=ar,this.parseTextData=nr,this.resolveNameSpace=sr,this.buildAttributesMap=or,this.isItStopNode=dr,this.replaceEntitiesValue=lr,this.readStopNodeData=pr,this.saveTextToParentTag=ur,this.addChild=cr,this.ignoreAttributesFn=fe(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let n={...W};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?n=this.options.htmlEntities:this.options.htmlEntities===true&&(n={...ae,...Q}),this.entityDecoder=new O({namedEntities:{...n,...t},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new $,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=false,this.stopNodeExpressionsSet=new L;let s=this.options.stopNodes;if(s&&s.length>0){for(let i=0;i<s.length;i++){let o=s[i];typeof o=="string"?this.stopNodeExpressionsSet.add(new P(o)):o instanceof P&&this.stopNodeExpressionsSet.add(o);}this.stopNodeExpressionsSet.seal();}}};function nr(r,e,t,n,s,i,o){let a=this.options;if(r!==void 0&&(a.trimValues&&!n&&(r=r.trim()),r.length>0)){o||(r=this.replaceEntitiesValue(r,e,t));let c=a.jPath?t.toString():t,l=a.tagValueProcessor(e,r,c,s,i);return l==null?r:typeof l!=typeof r||l!==r?l:a.trimValues||r.trim()===r?be(r,a.parseTagValue,a.numberParseOptions):r}}function sr(r){if(this.options.removeNSPrefix){let e=r.split(":"),t=r.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return "";e.length===2&&(r=t+e[1]);}return r}var ir=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function or(r,e,t,n=false){let s=this.options;if(n===true||s.ignoreAttributes!==true&&typeof r=="string"){let i=D(r,ir),o=i.length,a={},c=new Array(o),l=false,u={};for(let f=0;f<o;f++){let g=this.resolveNameSpace(i[f][1]),p=i[f][4];if(g.length&&p!==void 0){let b=p;s.trimValues&&(b=b.trim()),b=this.replaceEntitiesValue(b,t,this.readonlyMatcher),c[f]=b,u[g]=b,l=true;}}l&&typeof e=="object"&&e.updateCurrent&&e.updateCurrent(u);let d=s.jPath?e.toString():this.readonlyMatcher,h=false;for(let f=0;f<o;f++){let g=this.resolveNameSpace(i[f][1]);if(this.ignoreAttributesFn(g,d))continue;let p=s.attributeNamePrefix+g;if(g.length)if(s.transformAttributeName&&(p=s.transformAttributeName(p)),p=nt(p,s),i[f][4]!==void 0){let b=c[f],E=s.attributeValueProcessor(g,b,d);E==null?a[p]=b:typeof E!=typeof b||E!==b?a[p]=E:a[p]=be(b,s.parseAttributeValue,s.numberParseOptions),h=true;}else s.allowBooleanAttributes&&(a[p]=true,h=true);}if(!h)return;if(s.attributesGroupName&&!s.preserveOrder){let f={};return f[s.attributesGroupName]=a,f}return a}}var ar=function(r){r=r.replace(/\r\n?/g,`
6
+ `);let e=new v("!xml"),t=e,n="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let s=this.options,i=new z(s.processEntities),o=r.length;for(let a=0;a<o;a++)if(r[a]==="<"){let l=r.charCodeAt(a+1);if(l===47){let u=V(r,">",a,"Closing Tag is not closed."),d=r.substring(a+2,u).trim();if(s.removeNSPrefix){let f=d.indexOf(":");f!==-1&&(d=d.substr(f+1));}d=ge(s.transformTagName,d,"",s).tagName,t&&(n=this.saveTextToParentTag(n,t,this.readonlyMatcher));let h=this.matcher.getCurrentTag();if(d&&s.unpairedTagsSet.has(d))throw new Error(`Unpaired tag can not be used as closing tag: </${d}>`);h&&s.unpairedTagsSet.has(h)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=false,t=this.tagsNodeStack.pop(),n="",a=u;}else if(l===63){let u=me(r,a,false,"?>");if(!u)throw new Error("Pi Tag is not closed.");n=this.saveTextToParentTag(n,t,this.readonlyMatcher);let d=this.buildAttributesMap(u.tagExp,this.matcher,u.tagName,true);if(d){let h=d[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(h)||1),i.setXmlVersion(Number(h)||1);}if(!(s.ignoreDeclaration&&u.tagName==="?xml"||s.ignorePiTags)){let h=new v(u.tagName);h.add(s.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&s.ignoreAttributes!==true&&(h[":@"]=d),this.addChild(t,h,this.readonlyMatcher,a);}a=u.closeIndex+1;}else if(l===33&&r.charCodeAt(a+2)===45&&r.charCodeAt(a+3)===45){let u=V(r,"-->",a+4,"Comment is not closed.");if(s.commentPropName){let d=r.substring(a+4,u-2);n=this.saveTextToParentTag(n,t,this.readonlyMatcher),t.add(s.commentPropName,[{[s.textNodeName]:d}]);}a=u;}else if(l===33&&r.charCodeAt(a+2)===68){let u=i.readDocType(r,a);this.entityDecoder.addInputEntities(u.entities),a=u.i;}else if(l===33&&r.charCodeAt(a+2)===91){let u=V(r,"]]>",a,"CDATA is not closed.")-2,d=r.substring(a+9,u);n=this.saveTextToParentTag(n,t,this.readonlyMatcher);let h=this.parseTextData(d,t.tagname,this.readonlyMatcher,true,false,true,true);h==null&&(h=""),s.cdataPropName?t.add(s.cdataPropName,[{[s.textNodeName]:d}]):t.add(s.textNodeName,h),a=u+2;}else {let u=me(r,a,s.removeNSPrefix);if(!u){let y=r.substring(Math.max(0,a-50),Math.min(o,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${y}"`)}let d=u.tagName,h=u.rawTagName,f=u.tagExp,g=u.attrExpPresent,p=u.closeIndex;if({tagName:d,tagExp:f}=ge(s.transformTagName,d,f,s),s.strictReservedNames&&(d===s.commentPropName||d===s.cdataPropName||d===s.textNodeName||d===s.attributesGroupName))throw new Error(`Invalid tag name: ${d}`);t&&n&&t.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,t,this.readonlyMatcher,false));let b=t;b&&s.unpairedTagsSet.has(b.tagname)&&(t=this.tagsNodeStack.pop(),this.matcher.pop());let E=false;f.length>0&&f.lastIndexOf("/")===f.length-1&&(E=true,d[d.length-1]==="/"?(d=d.substr(0,d.length-1),f=d):f=f.substr(0,f.length-1),g=d!==f);let w=null,j;j=rr(h),d!==e.tagname&&this.matcher.push(d,{},j),d!==f&&g&&(w=this.buildAttributesMap(f,this.matcher,d),w&&(tr(w,s))),d!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let k=a;if(this.isCurrentNodeStopNode){let y="";if(E)a=u.closeIndex;else if(s.unpairedTagsSet.has(d))a=u.closeIndex;else {let T=this.readStopNodeData(r,h,p+1);if(!T)throw new Error(`Unexpected end of ${h}`);a=T.i,y=T.tagContent;}let M=new v(d);w&&(M[":@"]=w),M.add(s.textNodeName,y),this.matcher.pop(),this.isCurrentNodeStopNode=false,this.addChild(t,M,this.readonlyMatcher,k);}else {if(E){({tagName:d,tagExp:f}=ge(s.transformTagName,d,f,s));let y=new v(d);w&&(y[":@"]=w),this.addChild(t,y,this.readonlyMatcher,k),this.matcher.pop(),this.isCurrentNodeStopNode=false;}else if(s.unpairedTagsSet.has(d)){let y=new v(d);w&&(y[":@"]=w),this.addChild(t,y,this.readonlyMatcher,k),this.matcher.pop(),this.isCurrentNodeStopNode=false,a=u.closeIndex;continue}else {let y=new v(d);if(this.tagsNodeStack.length>s.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(t),w&&(y[":@"]=w),this.addChild(t,y,this.readonlyMatcher,k),t=y;}n="",a=p;}}}else n+=r[a];return e.child};function cr(r,e,t,n){this.options.captureMetaData||(n=void 0);let s=this.options.jPath?t.toString():t,i=this.options.updateTag(e.tagname,s,e[":@"]);i===false||(typeof i=="string"&&(e.tagname=i),r.addChild(e,n));}function lr(r,e,t){let n=this.options.processEntities;if(!n||!n.enabled)return r;if(n.allowedTags){let s=this.options.jPath?t.toString():t;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,s)))return r}if(n.tagFilter){let s=this.options.jPath?t.toString():t;if(!n.tagFilter(e,s))return r}return this.entityDecoder.decode(r)}function ur(r,e,t,n){return r&&(n===void 0&&(n=e.child.length===0),r=this.parseTextData(r,e.tagname,t,false,e[":@"]?Object.keys(e[":@"]).length!==0:false,n),r!==void 0&&r!==""&&e.add(this.options.textNodeName,r),r=""),r}function dr(){return this.stopNodeExpressionsSet.size===0?false:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function hr(r,e,t=">"){let n=0,s=r.length,i=t.charCodeAt(0),o=t.length>1?t.charCodeAt(1):-1,a="",c=e;for(let l=e;l<s;l++){let u=r.charCodeAt(l);if(n)u===n&&(n=0);else if(u===34||u===39)n=u;else if(u===i)if(o!==-1){if(r.charCodeAt(l+1)===o)return a+=r.substring(c,l),{data:a,index:l}}else return a+=r.substring(c,l),{data:a,index:l};else u===9&&!n&&(a+=r.substring(c,l)+" ",c=l+1);}}function V(r,e,t,n){let s=r.indexOf(e,t);if(s===-1)throw new Error(n);return s+e.length-1}function fr(r,e,t,n){let s=r.indexOf(e,t);if(s===-1)throw new Error(n);return s}function me(r,e,t,n=">"){let s=hr(r,e+1,n);if(!s)return;let i=s.data,o=s.index,a=i.search(/\s/),c=i,l=true;a!==-1&&(c=i.substring(0,a),i=i.substring(a+1).trimStart());let u=c;if(t){let d=c.indexOf(":");d!==-1&&(c=c.substr(d+1),l=c!==s.data.substr(d+1));}return {tagName:c,tagExp:i,closeIndex:o,attrExpPresent:l,rawTagName:u}}function pr(r,e,t){let n=t,s=1,i=r.length;for(;t<i;t++)if(r[t]==="<"){let o=r.charCodeAt(t+1);if(o===47){let a=fr(r,">",t,`${e} is not closed`);if(r.substring(t+2,a).trim()===e&&(s--,s===0))return {tagContent:r.substring(n,t),i:a};t=a;}else if(o===63)t=V(r,"?>",t+1,"StopNode is not closed.");else if(o===33&&r.charCodeAt(t+2)===45&&r.charCodeAt(t+3)===45)t=V(r,"-->",t+3,"StopNode is not closed.");else if(o===33&&r.charCodeAt(t+2)===91)t=V(r,"]]>",t,"StopNode is not closed.")-2;else {let a=me(r,t,false);a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&s++,t=a.closeIndex);}}}function be(r,e,t){if(e&&typeof r=="string"){let n=r.trim();return n==="true"?true:n==="false"?false:he(r,t)}else return Te(r)?r:""}function ge(r,e,t,n){if(r){let s=r(e);t===e&&(t=s),e=s;}return e=nt(e,n),{tagName:e,tagExp:t}}function nt(r,e){if(J.includes(r))throw new Error(`[SECURITY] Invalid name: "${r}" is a reserved JavaScript keyword that could cause prototype pollution`);return q.includes(r)?e.onDangerousProperty(r):r}var ye=v.getMetaDataSymbol();function gr(r,e){if(!r||typeof r!="object")return {};if(!e)return r;let t={};for(let n in r)if(n.startsWith(e)){let s=n.substring(e.length);t[s]=r[n];}else t[n]=r[n];return t}function we(r,e,t,n){return st(r,e,t,n)}function st(r,e,t,n){let s,i={};for(let o=0;o<r.length;o++){let a=r[o],c=mr(a);if(c!==void 0&&c!==e.textNodeName){let l=gr(a[":@"]||{},e.attributeNamePrefix);t.push(c,l);}if(c===e.textNodeName)s===void 0?s=a[c]:s+=""+a[c];else {if(c===void 0)continue;if(a[c]){let l=st(a[c],e,t,n),u=yr(l,e);if(Object.keys(l).length===0&&e.alwaysCreateTextNode&&(l[e.textNodeName]=""),a[":@"]?br(l,a[":@"],n,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),a[ye]!==void 0&&typeof l=="object"&&l!==null&&(l[ye]=a[ye]),i[c]!==void 0&&Object.prototype.hasOwnProperty.call(i,c))Array.isArray(i[c])||(i[c]=[i[c]]),i[c].push(l);else {let d=e.jPath?n.toString():n;e.isArray(c,d,u)?i[c]=[l]:i[c]=l;}c!==void 0&&c!==e.textNodeName&&t.pop();}}}return typeof s=="string"?s.length>0&&(i[e.textNodeName]=s):s!==void 0&&(i[e.textNodeName]=s),i}function mr(r){let e=Object.keys(r);for(let t=0;t<e.length;t++){let n=e[t];if(n!==":@")return n}}function br(r,e,t,n){if(e){let s=Object.keys(e),i=s.length;for(let o=0;o<i;o++){let a=s[o],c=a.startsWith(n.attributeNamePrefix)?a.substring(n.attributeNamePrefix.length):a,l=n.jPath?t.toString()+"."+c:t;n.isArray(a,l,true,true)?r[a]=[e[a]]:r[a]=e[a];}}}function yr(r,e){let{textNodeName:t}=e,n=Object.keys(r).length;return !!(n===0||n===1&&(r[t]||typeof r[t]=="boolean"||r[t]===0))}var S=class{constructor(e){this.externalEntities={},this.options=ze(e);}parse(e,t){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===true&&(t={});let i=ke(e,t);if(i!==true)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new X(this.options,this.externalEntities),s=n.parseXml(e);return this.options.preserveOrder||s===void 0?s:we(s,this.options,n.matcher,n.readonlyMatcher)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t;}static getMetaDataSymbol(){return v.getMetaDataSymbol()}};var C=r=>r==="true",wr=r=>{let e=/\[(-?\d+),(-?\d+)\]\[(-?\d+),(-?\d+)\]/.exec(r??"");return e?{x1:Number(e[1]),y1:Number(e[2]),x2:Number(e[3]),y2:Number(e[4])}:null},xr=r=>r.split(".").pop()||r,Er=r=>{let e=r.class??"",t=C(r.clickable);return /WebView$/.test(e)?"webview":/EditText$/.test(e)||C(r.password)?(r["resource-id"]??"").toLowerCase().includes("search")?"searchbox":"textbox":/Switch|ToggleButton/.test(e)?"switch":/CheckBox$/.test(e)||C(r.checkable)&&!/Radio/.test(e)?"checkbox":/RadioButton$/.test(e)?"radio":/SeekBar$/.test(e)?"slider":/Spinner$/.test(e)?"combobox":/(Button|ImageButton)$/.test(e)?"button":/(RecyclerView|ListView|ScrollView|GridView)$/.test(e)||C(r.scrollable)?"list":/TextView$/.test(e)?"text":t?"button":"generic"};var Nr=(r,e)=>{let t=r["resource-id"]??"";if(t)return `res=${t}`;let n=(r["content-desc"]??"").trim();if(n)return `desc=${n}`;let s=(r.text??"").trim();return s&&!C(r.password)?`text=${s}`:e?`text=${e}`:`class=${xr(r.class??"")}`},vr=r=>C(r.clickable)||C(r["long-clickable"])||C(r.checkable),Ar=r=>/(FrameLayout|LinearLayout|RelativeLayout|ConstraintLayout|ViewGroup|GridLayout|TableLayout)$/.test(r),it=r=>(r["content-desc"]??"").trim()||(C(r.password)?"":(r.text??"").trim())||"",ot=r=>{let e=r.node??[];for(let t of e){let n=it(t);if(n)return n}for(let t of e){let n=ot(t);if(n)return n}return ""},Cr=new S({ignoreAttributes:false,attributeNamePrefix:"",isArray:r=>r==="node"}),at=(r,e={})=>{let t=Cr.parse(r),n=[],s=new Map,i=[],o=0,a=e.packageName?`pkg=${e.packageName}`:"pkg=*",c=(h,f,g)=>{let p=h,b=h.node??[],E=Er(p),w=vr(p),Z=it(p),j=C(p.scrollable),k=w||!g&&Z.length>0&&!Ar(p.class??"")&&E!=="generic"||j,y=g,M=f;if(k){let T=`e${++o}`,B=Z||(w?ot(h):""),R=wr(p.bounds),bt=Nr(p,B),yt=B.length>0&&E!=="generic"?"aria":"cursor-interactive";n.push({ref:T,kind:yt,role:E,name:B,nth:0,scopeSelector:a,selectorHint:bt,matchCountAtSnapshot:0}),R&&s.set(T,{ref:T,bounds:R,center:{x:Math.round((R.x1+R.x2)/2),y:Math.round((R.y1+R.y2)/2)},className:p.class??"",resourceId:p["resource-id"]??"",clickable:w,scrollable:j,enabled:C(p.enabled)}),i.push(`${" ".repeat(f)}- ${E}${B?` "${B}"`:""} [ref=${T}]`),M=f+1,w&&(y=true);}for(let T of b)c(T,M,y);};for(let h of t.hierarchy?.node??[])c(h,0,false);let l=new Map;for(let h of n){let f=`${h.role}\0${h.name}`,g=l.get(f)??0;h.nth=g,l.set(f,g+1);}for(let h of n)h.matchCountAtSnapshot=l.get(`${h.role}\0${h.name}`)??1;let u;if(e.screen){let{width:h,height:f}=e.screen;u=new Set;for(let[g,p]of s)(p.center.x<0||p.center.y<0||p.center.x>h||p.center.y>f)&&u.add(g);u.size===0&&(u=void 0);}return {capture:{yaml:i.join(`
7
+ `),entries:n,truncated:false,...u?{offViewportRefs:u}:{}},nodes:s}};var Tr={Enter:"KEYCODE_ENTER",Tab:"KEYCODE_TAB",Backspace:"KEYCODE_DEL",Escape:"KEYCODE_ESCAPE",ArrowUp:"KEYCODE_DPAD_UP",ArrowDown:"KEYCODE_DPAD_DOWN",ArrowLeft:"KEYCODE_DPAD_LEFT",ArrowRight:"KEYCODE_DPAD_RIGHT"},Sr=128,K=class{constructor(e,t){this.adb=e;this.node=t;}adb;node;async click(){let{x:e,y:t}=this.node.center;await this.adb.text(["shell","input","tap",String(e),String(t)]);}async fill(e){await this.click(),await this.clearField(),await this.typeAscii(e);}async type(e){await this.typeAscii(e);}async press(e){let t=Tr[e]??(e.startsWith("KEYCODE_")?e:null);if(!t)throw new Error(`[adbInput] unsupported key "${e}"`);await this.adb.text(["shell","input","keyevent",t]);}hover(){return Promise.resolve()}async check(){await this.click();}async uncheck(){await this.click();}selectOption(){return this.click()}scrollIntoView(){return Promise.resolve()}waitFor(e){return Promise.resolve()}boundingBox(){let e=this.node.bounds;return Promise.resolve({x:e.x1,y:e.y1,width:e.x2-e.x1,height:e.y2-e.y1})}textContent(){return Promise.resolve(null)}isVisible(){let e=this.node.bounds;return Promise.resolve(e.x2>e.x1&&e.y2>e.y1)}isEnabled(){return Promise.resolve(this.node.enabled)}isChecked(){return Promise.reject(new Error("[adbQuery:checked_unsupported] checked state isn't tracked by the Android driver; re-snapshot to read it"))}inputValue(){return Promise.reject(new Error("[adbQuery:value_unsupported] per-field value reads aren't supported on Android; read the field text from `skeptic snapshot`"))}async clearField(){let e=Array.from({length:Sr},()=>"KEYCODE_DEL");await this.adb.text(["shell","input","keyevent","KEYCODE_MOVE_END",...e]).catch(()=>{});}async typeAscii(e){if(!b(e))throw new Error(`[adbInput:unicode_unsupported] adb input text is ASCII-only; "${"*".repeat(e.length)}" contains non-ASCII. Use a deep link / test seam to set this value, or enable the pushed-binary fast lane.`);e.length!==0&&await this.adb.text(["shell","input","text",c(e)]);}};var ct=(r,e,t)=>{let n=o=>{let a=t.get(o.ref);if(!a)return false;if(r.startsWith("res="))return a.resourceId===r.slice(4);if(r.startsWith("desc=")||r.startsWith("text="))return o.name===r.slice(5);if(r.startsWith("class="))return a.className.endsWith(r.slice(6));if(r.startsWith("role=")){let[c,l]=r.slice(5).split(":");return o.role===c&&(l===void 0||o.name===l)}return o.name===r},s=e.find(o=>o.selectorHint===r);if(s)return t.get(s.ref)??null;let i=e.find(n);return i?t.get(i.ref)??null:null};var _r=r=>{let e=/Total frames rendered:\s*(\d+)/.exec(r);if(!e)return null;let t=/Janky frames:\s*(\d+)\s*\(([\d.]+)%\)/.exec(r),n=i=>{let o=new RegExp(`${i}th percentile:\\s*(\\d+)ms`).exec(r);return o?Number(o[1]):0},s=i=>{let o=new RegExp(`${i}:\\s*(\\d+)`).exec(r);return o?Number(o[1]):0};return {totalFrames:Number(e[1]),jankyFrames:t?Number(t[1]):0,jankyPercent:t?Number(t[2]):0,percentiles:{p50:n(50),p90:n(90),p95:n(95),p99:n(99)},missedVsync:s("Number Missed Vsync"),deadlineMissed:s("Number Frame deadline missed")}},Ir=r=>{let e=/TOTAL PSS:\s*(\d+)/.exec(r),t=/TOTAL RSS:\s*(\d+)/.exec(r);return !e&&!t?null:{totalPssKb:e?Number(e[1]):0,totalRssKb:t?Number(t[1]):0}},ut=r=>{let e=/TotalTime:\s*(\d+)/.exec(r),t=/WaitTime:\s*(\d+)/.exec(r);return {totalTimeMs:e?Number(e[1]):null,waitTimeMs:t?Number(t[1]):null}},dt=async(r,e,t)=>{let[n,s]=await Promise.all([r.text(["shell","dumpsys","gfxinfo",e]).catch(()=>""),r.text(["shell","dumpsys","meminfo",e]).catch(()=>"")]);return {platform:"android",launch:t,frames:_r(n),memory:Ir(s)}},Pr=new S({ignoreAttributes:false,attributeNamePrefix:"",isArray:r=>r==="node"}),kr=r=>{let e=/\[(-?\d+),(-?\d+)\]\[(-?\d+),(-?\d+)\]/.exec(r??"");return e?{x1:Number(e[1]),y1:Number(e[2]),x2:Number(e[3]),y2:Number(e[4])}:null},ht=r=>({className:String(r.class??""),resourceId:String(r["resource-id"]??""),contentDesc:String(r["content-desc"]??"").trim(),text:String(r.text??"").trim(),clickable:r.clickable==="true",naf:r.NAF==="true",bounds:kr(r.bounds),children:(r.node??[]).map(ht)}),ft=r=>r.contentDesc.length>0||r.text.length>0||r.children.some(ft),lt=r=>r.split(".").pop()||r,Mr=(r,e)=>{let t=Pr.parse(r),n=[],s=0,i=o=>{if(o.clickable){s+=1;let a={className:lt(o.className),...o.resourceId?{resourceId:o.resourceId}:{},bounds:o.bounds??{x1:0,y1:0,x2:0,y2:0}};if(ft(o)||n.push({...a,rule:"unlabeled-clickable",impact:"serious",detail:"clickable element has no text or content-desc \u2014 a screen reader announces nothing"}),o.bounds){let c=o.bounds.x2-o.bounds.x1,l=o.bounds.y2-o.bounds.y1;c>0&&l>0&&(c<e||l<e)&&n.push({...a,rule:"small-touch-target",impact:"moderate",detail:`touch target ${c}\xD7${l}px is below the ${e}px (48dp) minimum`});}}o.naf&&n.push({className:lt(o.className),...o.resourceId?{resourceId:o.resourceId}:{},bounds:o.bounds??{x1:0,y1:0,x2:0,y2:0},rule:"not-accessibility-friendly",impact:"minor",detail:"uiautomator flagged this node NAF (not accessibility-friendly)"}),o.children.forEach(i);};for(let o of t.hierarchy?.node??[])i(ht(o));return {issues:n,checked:s}},Rr=r=>Math.round(48*(r||160)/160),pt=(r,e)=>{let t=Rr(e),{issues:n,checked:s}=Mr(r,t);return {platform:"android",issues:n,summary:{issues:n.length,checked:s,minTouchTargetPx:t,note:"structural uiautomator heuristics only \u2014 no color-contrast check (no pixel access on the dump)"}}},Or=(r,e)=>{let t=0,n=0,s=false,i=r.split(`
8
+ `),o=false;for(let a of i){let c=/uid=(-?\d+)/.exec(a);if(c&&(o=Number(c[1])===e),!o)continue;let l=/\brb=(\d+)/.exec(a),u=/\btb=(\d+)/.exec(a);l&&(t+=Number(l[1]),s=true),u&&(n+=Number(u[1]),s=true);}return s?{rxBytes:t,txBytes:n}:null},Fr="Android exposes only per-uid byte totals to an unprivileged client \u2014 never per-request URLs/methods/status. For per-request capture run with an instrumenting proxy (opt-in, fragile under TLS pinning / Android-7+ user-CA distrust).",xe=async(r,e)=>{let t=null;if(e!==null){let n=await r.text(["shell","dumpsys","netstats","detail"]).catch(()=>"");t=Or(n,e);}return {platform:"android",degraded:true,totals:t,requests:[],note:Fr}},gt=async(r,e)=>{let n=(await r.text(["shell","ps","-A"]).catch(()=>"")).split(`
9
+ `).find(i=>i.trim().endsWith(` ${e}`)||i.includes(` ${e}\r`)),s=n?/u\d+_a(\d+)/.exec(n):null;return s?1e4+Number(s[1]):null};var Lr=8,$r=3e4,mt=class{constructor(e,t,n){this.adb=e;this.serial=t;this.artifactDir=n;}adb;serial;artifactDir;nodes=new Map;lastEntries=[];lastYaml=null;currentTarget="";packageName="";screen=null;density=null;lastXml=null;lastLaunch={totalTimeMs:null,waitTimeMs:null};async open(e,t){if(this.currentTarget=e,e.includes("://"))await this.adb.text(["shell","am","start","-a","android.intent.action.VIEW","-d",e]);else {this.packageName=e;let s=(await this.adb.text(["shell","cmd","package","resolve-activity","--brief",e]).catch(()=>"")).split(`
10
+ `).map(i=>i.trim()).filter(i=>i.includes("/")).pop();if(s){let i=await this.adb.text(["shell","am","start","-W","-n",s]);this.lastLaunch=ut(i);}else await this.adb.text(["shell","monkey","-p",e,"-c","android.intent.category.LAUNCHER","1"]).catch(()=>{});}this.invalidate(),await this.wait(800);}url(){return this.packageName||this.currentTarget}title(){return this.foregroundPackage()}async snapshot(e){this.screen||(this.screen=await this.fetchScreen());let t=await this.dumpWithRetry(),n=this.packageName||await this.foregroundPackage(),{capture:s,nodes:i}=at(t,{...n?{packageName:n}:{},...this.screen?{screen:this.screen}:{}});return this.nodes=i,this.lastEntries=s.entries,this.lastYaml=s.yaml,this.lastXml=t,s}async resolveRef(e){let t=e.startsWith("@")?e.slice(1):e,n=this.nodes.get(t);if(!n)throw new Error(`[adbRef:not_found] {"ref":"${t}","available":${JSON.stringify([...this.nodes.keys()])},"hasSnapshot":${this.lastYaml!==null}}`);return new K(this.adb,n)}async resolveSelector(e){let t=ct(e,this.lastEntries,this.nodes);if(!t)throw new Error(`[adbSelector:not_found] no node matches "${e}" in the last snapshot`);return new K(this.adb,t)}async screenshot(e,t){if(t?.annotate)throw new Error("[adbScreenshot:annotate_unsupported] [android] annotated screenshots are not supported on the mobile driver yet; use the web driver or take a plain screenshot (a device screencap is always full-screen, so --full is implied).");let n=await this.adb.bytes(["exec-out","screencap","-p"]);U.mkdirSync(this.artifactDir,{recursive:true});let s=Ee.join(this.artifactDir,`${e.replace(/[^a-zA-Z0-9_-]/g,"_")}.png`);return U.writeFileSync(s,n),{path:s,diagnostics:Ur(n)}}async recordVideo(e){let t=Math.max(1,Math.min(20,Math.round(e||3))),n="/sdcard/skeptic-record.mp4",s=(t+10)*1e3;await this.adb.text(["shell","screenrecord","--time-limit",String(t),n],s).catch(()=>{}),U.mkdirSync(this.artifactDir,{recursive:true});let i=Ee.join(this.artifactDir,"recording.mp4"),o=await this.adb.bytes(["exec-out","cat",n],s).catch(()=>Buffer.alloc(0));return U.writeFileSync(i,o),await this.adb.text(["shell","rm",n]).catch(()=>{}),{path:i,bytes:o.length,durationSec:t,degraded:o.length<2e4}}async scroll(e){this.screen||(this.screen=await this.fetchScreen());let t=this.screen?.width??1080,n=this.screen?.height??2400,s=Math.round(t/2),i=e.dy??600,o=Math.round(n*.6);await this.adb.text(["shell","input","swipe",String(s),String(o),String(s),String(o-i),"300"]);}wait(e){return new Promise(t=>setTimeout(t,e))}attachCollectors(e){return Promise.resolve()}async collectEvidence(){let e=this.packageName||await this.foregroundPackage(),[t,n,s,i]=await Promise.all([this.collectConsole(e),dt(this.adb,e,this.lastLaunch),this.collectAccessibility(),e?gt(this.adb,e).then(o=>xe(this.adb,o)):xe(this.adb,null)]);return {console:t,performance:n,accessibility:s,network:i}}async collectConsole(e){let t=e?(await this.adb.text(["shell","pidof","-s",e]).catch(()=>"")).trim():"",n=t?["shell","logcat","-d","-v","brief",`--pid=${t}`]:["shell","logcat","-d","-v","brief","-t","200"],i=(await this.adb.text(n).catch(()=>"")).split(`
11
+ `).map(o=>o.trim()).filter(Boolean).slice(-200).map(o=>({type:jr(o),text:o,timestamp:Date.now()}));return {messages:i,summary:{total:i.length,errorCount:i.filter(o=>o.type==="error").length,warningCount:i.filter(o=>o.type==="warning").length,infoCount:i.filter(o=>o.type==="info").length,redactionDisabled:false}}}async collectAccessibility(){this.density===null&&(this.density=await this.fetchDensity());let e=this.lastXml??await this.dumpWithRetry().catch(()=>"");return e?pt(e,this.density??160):{platform:"android",issues:[],summary:{issues:0,checked:0,minTouchTargetPx:0,note:"no uiautomator dump available"}}}detachCollectors(){return Promise.resolve()}close(){return this.invalidate(),Promise.resolve()}invalidate(){this.nodes=new Map,this.lastEntries=[],this.lastYaml=null,this.lastXml=null;}async dumpWithRetry(){let e=Date.now(),t=e+$r,n="",s=0;for(;s<Lr&&Date.now()<t;){s++,await this.adb.text(["shell","uiautomator","dump","/sdcard/skeptic-dump.xml"]).catch(a=>{n=String(a);});let o=await this.adb.text(["shell","cat","/sdcard/skeptic-dump.xml"]).catch(a=>(n=String(a),""));if(o.includes("<hierarchy")&&o.length>100)return o;await this.wait(400+s*200);}let i=Math.round((Date.now()-e)/1e3);throw new Error(`[adbDump] uiautomator dump returned no usable hierarchy after ${s} attempt(s) in ${i}s. The device looks unresponsive \u2014 check \`adb devices\`, device load/disk, and (for emulators) the GPU mode.`+(n?` Last error: ${n}`:""))}async fetchScreen(){let e=await this.adb.text(["shell","wm","size"]).catch(()=>""),t=/(\d+)x(\d+)/.exec(e);return t?{width:Number(t[1]),height:Number(t[2])}:null}async fetchDensity(){let e=await this.adb.text(["shell","wm","density"]).catch(()=>""),t=/(?:Override|Physical) density:\s*(\d+)/.exec(e);return t?Number(t[1]):160}async foregroundPackage(){let e=await this.adb.text(["shell","dumpsys","window"]).catch(()=>"");return /mCurrentFocus=Window\{[^ ]+ [^ ]+ ([\w.]+)\//.exec(e)?.[1]??""}},Vr=8,Ur=r=>{let{meta:e}=d(r);return e.channelRange>=Vr?[]:[{kind:"blank-screenshot",message:`[android] captured frame is near-uniform (pixel channel range ${e.channelRange}) \u2014 the device/emulator GPU is not compositing into screencap, so this image is blank. For a headless emulator relaunch with \`-gpu swiftshader_indirect\` (software rendering) or without \`-no-window\`; on a physical device make sure the screen is on and unlocked. \`skeptic doctor\` reports the device state.`,meta:e}]},jr=r=>{switch(/^([VDIWEF])\//.exec(r)?.[1]){case "E":case "F":return "error";case "W":return "warning";case "I":return "info";default:return "log"}};
12
+ export{mt as a,Ur as b};
@@ -0,0 +1,3 @@
1
+ import {createRequire}from'node:module';import {b}from'./chunk-NXTEMSUR.mjs';import {a as a$1}from'./chunk-OHVNABCL.mjs';import {a as a$2}from'./chunk-B26AZRXU.mjs';import {a,b as b$1}from'./chunk-7BFRKEFV.mjs';/*! @license skeptic-cli — see LICENSES.md for third-party attributions */
2
+ createRequire(import.meta.url);
3
+ var o=class{constructor(e){this.locator=e;}locator;click(){return this.locator.click()}fill(e){return this.locator.fill(e)}type(e){return this.locator.pressSequentially(e)}press(e){return this.locator.press(e)}hover(){return this.locator.hover()}check(){return this.locator.check()}uncheck(){return this.locator.uncheck()}async selectOption(e){await this.locator.selectOption(e);}scrollIntoView(){return this.locator.scrollIntoViewIfNeeded()}waitFor(e){return this.locator.waitFor({...e?.state?{state:e.state}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{}})}boundingBox(){return this.locator.boundingBox()}textContent(){return this.locator.textContent()}isVisible(){return this.locator.isVisible()}isEnabled(){return this.locator.isEnabled()}isChecked(){return this.locator.isChecked()}inputValue(){return this.locator.inputValue()}};var i=class{constructor(e,t,r){this.context=e;this.page=t;this.ctx=r;}context;page;ctx;collectors=[];async open(e,t){await this.page.goto(e,{waitUntil:t?.waitUntil??"load",...t?.timeoutMs!==void 0?{timeout:t.timeoutMs}:{}}),this.invalidateRefs();}url(){return this.page.url()}title(){return this.page.title()}async snapshot(e){let t=await a(this.page,"body",{viewport:e?.viewport??true,includeCursorInteractive:e?.includeCursorInteractive??true,extractLinkHrefs:e?.extractLinkHrefs??true});this.ctx.ariaRefs.clear();for(let r of t.entries)this.ctx.ariaRefs.set(r.ref,r);return this.ctx.ariaSnapshotYaml=t.yaml,t}async resolveRef(e){let t=e.startsWith("@")?e:`@${e}`,r=await a$1(this.page,this.ctx,t);return new o(r)}async resolveSelector(e){let t=await b$1(this.page,e);return new o(t)}screenshot(e,t){return a$2(this.page,this.ctx,e,t)}async scroll(e){await this.page.mouse.wheel(e.dx??0,e.dy??0);}async wait(e){await this.page.waitForTimeout(e);}async attachCollectors(e){this.collectors=e;for(let t of e)await t.attach(this.page,this.ctx);}async collectEvidence(){let e={};for(let t of this.collectors)try{let r=await t.snapshot();r!==void 0&&(e[t.name]=r);}catch{}return e}async detachCollectors(){for(let e of this.collectors)try{await e.detach();}catch{}this.collectors=[];}async close(){await this.detachCollectors(),await this.context.close();}raw(){return {page:this.page,context:this.context}}invalidateRefs(){this.ctx.ariaRefs.clear(),this.ctx.ariaSnapshotYaml=null;}};var u=class s{constructor(e,t){this.browser=e;this.ownsBrowser=t;}browser;ownsBrowser;static fromBrowser(e,t=false){return new s(e,t)}async newSession(e){let t=await this.browser.newContext({...e?.viewport?{viewport:e.viewport}:{},...e?.deviceScaleFactor!==void 0?{deviceScaleFactor:e.deviceScaleFactor}:{},...e?.userAgent?{userAgent:e.userAgent}:{},...e?.baseUrl?{baseURL:e.baseUrl}:{}}),r=await t.newPage(),p=new b(r,e?.baseUrl??"",e?.artifactDir);return new i(t,r,p)}async close(){this.ownsBrowser&&await this.browser.close();}};export{u as a};