/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@dashkite/scan@0.8.19/build/node/src/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";function _export(n,r){for(var e in r)Object.defineProperty(n,e,{enumerable:!0,get:r[e]})}Object.defineProperty(exports,"__esModule",{value:!0}),_export(exports,{append:function(){return append},buffer:function(){return buffer},clear:function(){return clear},log:function(){return log},lower:function(){return lower},make:function(){return make},match:function(){return match},pipe:function(){return pipe},poke:function(){return poke},pop:function(){return pop},prefix:function(){return prefix},push:function(){return push},save:function(){return save},skip:function(){return skip},tag:function(){return tag},trim:function(){return trim},unbuffer:function(){return unbuffer}});const _lrucache=require("@dashkite/lru-cache");var append,buffer,clear,getContext,getExpected,getMode,isFinished,log,lower,make,match,pipe,poke,pop,prefix,push,run,save,skip,tag,trim,unbuffer;pipe=function(n){switch(n.length){case 1:return function(){return n[0].apply(null,arguments)};case 2:return function(){return n[1](n[0].apply(null,arguments))};case 3:return function(){return n[2](n[1](n[0].apply(null,arguments)))};case 4:return function(){return n[3](n[2](n[1](n[0].apply(null,arguments))))};case 5:return function(){return n[4](n[3](n[2](n[1](n[0].apply(null,arguments)))))};case 6:return function(){return n[5](n[4](n[3](n[2](n[1](n[0].apply(null,arguments))))))};case 7:return function(){return n[6](n[5](n[4](n[3](n[2](n[1](n[0].apply(null,arguments)))))))};default:return function(...r){var e,t;for(e=0,t=n.length;e<t;e++)r=[n[e].apply(null,r)];return r[0]}}},skip=function(n,r){return r},push=function(n){return function(r){return r.mode.push(n),r}},pop=function(n){return n.mode.pop(),n},poke=function(n){return function(r){return r.mode.pop(),r.mode.push(n),r}},trim=function(n){return n.current=n.current.trim(),n},lower=function(n){return n.current=n.current.toLowerCase(),n},tag=function(n){return function(r){return r.current={[n]:r.current},r}},save=function(n){return function(r){var e;return(null!=(e=r.data)[n]?e[n]:e[n]=[]).push(r.current),r}},clear=function(n){return n.current="",n},append=function(n,r){return null!=r?(r.current+=n,r):function(r){return r.current+=n,r}},prefix=function(n,r){return function(e,t){return r(`${n}${e}`,t)}},buffer=function(n,r){return r.buffer=n,r},unbuffer=function(n){return function(r){var e;return e=r.buffer,r.buffer=void 0,n(e,r)}},match=function(n){return function(r){if(n.test(r.current))return r;throw new Error("match failed")}},log=function(n){return function(n,r){return r=null!=r?r:n,console.log(r),r}},getContext=function(n){var r;return r=n.index,n.text.slice(r-5,+(r+5)+1||9e9)},getMode=function(n){return n.mode[n.mode.length-1]},getExpected=function(n){var r;return r=getMode(n),Object.keys(n.rules[r]).join(", ")},isFinished=function(n){return 0===n.mode.length},run=function(n,r){var e,t,u,o,c,i;if(o=getMode(r),null!=(u=r.rules[o])){if(null!=(i=null!=(c=u[n])?c:u.default))return i(n,r);throw t=getExpected(r),e=getContext(r),new Error(`parse error at '${e}'. Expected one of: [ ${t} ], got: '${n}'`)}throw new Error(`parser in an unknown state: ${o}`)},make=function(n,r){return(0,_lrucache.memoize)((function(e){var t,u,o,c,i,f,p,a,l,s;s={mode:[n],data:{},current:"",text:e,rules:r};try{for(i=f=0,p=e.length;f<p;i=++f)t=e[i],s.index=i,run(t,s);if(l=run("end",s),isFinished(s))return l;throw a=getMode(s),new Error(`unexpected end of input while parsing [ ${a} ]`)}catch(n){throw c=n,o=getContext(s),u=s.text[s.index],console.error(`unexpected parse error at '${u}' (near '${o}') on: [ ${a} ].`),c}}))};
//# sourceMappingURL=/sm/e56d5bda0e26bd393ae439ddba9a59b65d5639015f3f787c9f872c86816cae3f.map