PageSourceSearch

https://survivalbrasil.org/assets/@lezer--highlight-811b3d56.js

js survivalbrasil.org collected 2026-09-25 18:52:32 UTC 7,670 bytes, 4 lines download raw bytes

1// @lezer/[email protected] downloaded from https://ga.jspm.io/npm:@lezer/[email protected]/dist/index.js
2
3import{NodeProp as t}from"@lezer/common";let e=0;class Tag{constructor(t,a,i,o){this.name=t;this.set=a;this.base=i;this.modified=o;this.id=e++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let a=typeof t=="string"?t:"?";t instanceof Tag&&(e=t);if(e===null||e===void 0?void 0:e.base)throw new Error("Can not derive from a modified tag");let i=new Tag(a,[],null,[]);i.set.push(i);if(e)for(let t of e.set)i.set.push(t);return i}static defineModifier(t){let e=new Modifier(t);return t=>t.modified.indexOf(e)>-1?t:Modifier.get(t.base||t,t.modified.concat(e).sort(((t,e)=>t.id-e.id)))}}let a=0;class Modifier{constructor(t){this.name=t;this.instances=[];this.id=a++}static get(t,e){if(!e.length)return t;let a=e[0].instances.find((a=>a.base==t&&i(e,a.modified)));if(a)return a;let r=[],n=new Tag(t.name,r,t,e);for(let t of e)t.instances.push(n);let s=o(e);for(let e of t.set)if(!e.modified.length)for(let t of s)r.push(Modifier.get(e,t));return n}}function i(t,e){return t.length==e.length&&t.every(((t,a)=>t==e[a]))}function o(t){let e=[[]];for(let a=0;a<t.length;a++)for(let i=0,o=e.length;i<o;i++)e.push(e[i].concat(t[a]));return e.sort(((t,e)=>e.length-t.length))}function r(t){let e=Object.create(null);for(let a in t){let i=t[a];Array.isArray(i)||(i=[i]);for(let t of a.split(" "))if(t){let a=[],o=2,r=t;for(let e=0;;){if(r=="..."&&e>0&&e+3==t.length){o=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!i)throw new RangeError("Invalid path: "+t);a.push(i[0]=="*"?"":i[0][0]=='"'?JSON.parse(i[0]):i[0]);e+=i[0].length;if(e==t.length)break;let n=t[e++];if(e==t.length&&n=="!"){o=0;break}if(n!="/")throw new RangeError("Invalid path: "+t);r=t.slice(e)}let n=a.length-1,s=a[n];if(!s)throw new RangeError("Invalid path: "+t);let l=new Rule(i,o,n>0?a.slice(0,n):null);e[s]=l.sort(e[s])}}return n.add(e)}const n=new t({combine(t,e){let a,i,o;while(t||e){if(!t||e&&t.depth>=e.depth){o=e;e=e.next}else{o=t;t=t.next}if(a&&a.mode==o.mode&&!o.context&&!a.context)continue;let r=new Rule(o.tags,o.mode,o.context);a?a.next=r:i=r;a=r}return i}});class Rule{constructor(t,e,a,i){this.tags=t;this.mode=e;this.context=a;this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){if(!t||t.depth<this.depth){this.next=t;return this}t.next=this.sort(t.next);return t}get depth(){return this.context?this.context.length:0}}Rule.empty=new Rule([],2,null);function s(t,e){let a=Object.create(null);for(let e of t)if(Array.isArray(e.tag))for(let t of e.tag)a[t.id]=e.class;else a[e.tag.id]=e.class;let{scope:i,all:o=null}=e||{};return{style:t=>{let e=o;for(let i of t)for(let t of i.set){let i=a[t.id];if(i){e=e?e+" "+i:i;break}}return e},scope:i}}function l(t,e){let a=null;for(let i of t){let t=i.style(e);t&&(a=a?a+" "+t:t)}return a}function c(t,e,a,i=0,o=t.length){let r=new HighlightBuilder(i,Array.isArray(e)?e:[e],a);r.highlightRange(t.cursor(),i,o,"",r.highlighters);r.flush(o)}function h(t,e,a,i,o,r=0,n=t.length){let s=r;function l(e,a){if(!(e<=s)){for(let r=t.slice(s,e),n=0;;){let t=r.indexOf("\n",n);let e=t<0?r.length:t;e>n&&i(r.slice(n,e),a);if(t<0)break;o();n=t+1}s=e}}c(e,a,((t,e,a)=>{l(t,"");l(e,a)}),r,n);l(n,"")}class HighlightBuilder{constructor(t,e,a){this.at=t;this.highlighters=e;this.span=a;this.class=""}startSpan(t,e){if(e!=this.class){this.flush(t);t>this.at&&(this.at=t);this.class=e}}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(e,a,i,o,r){let{type:n,from:s,to:c}=e;if(s>=i||c<=a)return;n.isTop&&(r=this.highlighters.filter((t=>!t.scope||t.scope(n))));let h=o;let f=g(e)||Rule.empty;let d=l(r,f.tags);if(d){h&&(h+=" ");h+=d;f.mode==1&&(o+=(o?" ":"")+d)}this.startSpan(Math.max(a,s),h);if(f.opaque)return;let m=e.tree&&e.tree.prop(t.mounted);if(m&&m.overlay){let t=e.node.enter(m.overlay[0].from+s,1);let n=this.highlighters.filter((t=>!t.scope||t.scope(m.tree.type)));let l=e.firstChild();for(let g=0,f=s;;g++){let d=g<m.overlay.length?m.overlay[g]:null;let p=d?d.from+s:c;let u=Math.max(a,f),k=Math.min(i,p);if(u<k&&l)while(e.from<k){this.highlightRange(e,u,k,o,r);this.startSpan(Math.min(k,e.to),h);if(e.to>=p||!e.nextSibling())break}if(!d||p>i)break;f=d.to+s;if(f>a){this.highlightRange(t.cursor(),Math.max(a,d.from+s),Math.min(i,f),"",n);this.startSpan(Math.min(i,f),h)}}l&&e.parent()}else if(e.firstChild()){m&&(o="");
3do{if(!(e.to<=a)){if(e.from>=i)break;this.highlightRange(e,a,i,o,r);this.startSpan(Math.min(i,e.to),h)}}while(e.nextSibling());e.parent()}}}function g(t){let e=t.type.prop(n);while(e&&e.context&&!t.matchContext(e.context))e=e.next;return e||null}const f=Tag.define;const d=f(),m=f(),p=f(m),u=f(m),k=f(),b=f(k),y=f(k),N=f(),w=f(N),x=f(),v=f(),M=f(),O=f(M),R=f();const T={comment:d,lineComment:f(d),blockComment:f(d),docComment:f(d),name:m,variableName:f(m),typeName:p,tagName:f(p),propertyName:u,attributeName:f(u),className:f(m),labelName:f(m),namespace:f(m),macroName:f(m),literal:k,string:b,docString:f(b),character:f(b),attributeValue:f(b),number:y,integer:f(y),float:f(y),bool:f(k),regexp:f(k),escape:f(k),color:f(k),url:f(k),keyword:x,self:f(x),null:f(x),atom:f(x),unit:f(x),modifier:f(x),operatorKeyword:f(x),controlKeyword:f(x),definitionKeyword:f(x),moduleKeyword:f(x),operator:v,derefOperator:f(v),arithmeticOperator:f(v),logicOperator:f(v),bitwiseOperator:f(v),compareOperator:f(v),updateOperator:f(v),definitionOperator:f(v),typeOperator:f(v),controlOperator:f(v),punctuation:M,separator:f(M),bracket:O,angleBracket:f(O),squareBracket:f(O),paren:f(O),brace:f(O),content:N,heading:w,heading1:f(w),heading2:f(w),heading3:f(w),heading4:f(w),heading5:f(w),heading6:f(w),contentSeparator:f(N),list:f(N),quote:f(N),emphasis:f(N),strong:f(N),link:f(N),monospace:f(N),strikethrough:f(N),inserted:f(),deleted:f(),changed:f(),invalid:f(),meta:R,documentMeta:f(R),annotation:f(R),processingInstruction:f(R),definition:Tag.defineModifier("definition"),constant:Tag.defineModifier("constant"),function:Tag.defineModifier("function"),standard:Tag.defineModifier("standard"),local:Tag.defineModifier("local"),special:Tag.defineModifier("special")};for(let t in T){let e=T[t];e instanceof Tag&&(e.name=t)}const S=s([{tag:T.link,class:"tok-link"},{tag:T.heading,class:"tok-heading"},{tag:T.emphasis,class:"tok-emphasis"},{tag:T.strong,class:"tok-strong"},{tag:T.keyword,class:"tok-keyword"},{tag:T.atom,class:"tok-atom"},{tag:T.bool,class:"tok-bool"},{tag:T.url,class:"tok-url"},{tag:T.labelName,class:"tok-labelName"},{tag:T.inserted,class:"tok-inserted"},{tag:T.deleted,class:"tok-deleted"},{tag:T.literal,class:"tok-literal"},{tag:T.string,class:"tok-string"},{tag:T.number,class:"tok-number"},{tag:[T.regexp,T.escape,T.special(T.string)],class:"tok-string2"},{tag:T.variableName,class:"tok-variableName"},{tag:T.local(T.variableName),class:"tok-variableName tok-local"},{tag:T.definition(T.variableName),class:"tok-variableName tok-definition"},{tag:T.special(T.variableName),class:"tok-variableName2"},{tag:T.definition(T.propertyName),class:"tok-propertyName tok-definition"},{tag:T.typeName,class:"tok-typeName"},{tag:T.namespace,class:"tok-namespace"},{tag:T.className,class:"tok-className"},{tag:T.macroName,class:"tok-macroName"},{tag:T.propertyName,class:"tok-propertyName"},{tag:T.operator,class:"tok-operator"},{tag:T.comment,class:"tok-comment"},{tag:T.meta,class:"tok-meta"},{tag:T.invalid,class:"tok-invalid"},{tag:T.punctuation,class:"tok-punctuation"}]);export{Tag,S as classHighlighter,g as getStyleTags,h as highlightCode,c as highlightTree,r as styleTags,s as tagHighlighter,T as tags};
4

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.